scripts to run before `jstime run`ning a file or script
There are two primary mechanisms for configuring the behavior of JSTime.
- environment variables
bunfig.toml: JSTime’s configuration file
Configuring with bunfig.toml is optional. JSTime aims to be zero-configuration out of the box, but is also highly configurable for advanced use cases. Your bunfig.toml should live in your project root alongside package.json.
You can also create a global configuration file at the following paths:
$HOME/.bunfig.toml$XDG_CONFIG_HOME/.bunfig.toml
If both a global and local bunfig are detected, the results are shallow-merged, with local overridding global. CLI flags will override bunfig setting where applicable.
Runtime
Section titled “Runtime”# scripts to run before `jstime run`ning a file or script# useful for registering pluginspreload = ["./preload.ts"]
# equivalent to corresponding tsconfig compilerOptionsjsx = "react"jsxFactory = "h"jsxFragment = "Fragment"jsxImportSource = "react"
# Reduce memory usage at the cost of performancesmol = true
# Set JSTime's log levellogLevel = "debug" # "debug", "warn", "error"
[define]# Replace any usage of "process.env.bagel" with the string `lox`.# The values are parsed as JSON, except single-quoted strings are supported and `'undefined'` becomes `undefined` in JS.# This will probably change in a future release to be just regular TOML instead. It is a holdover from the CLI argument parsing."process.env.bagel" = "'lox'"
[loader]# When loading a .bagel file, run the JS parser".bagel" = "js"Test runner
Section titled “Test runner”[test]# Scripts to run before all test filespreload = ["./setup.ts"]
# Reduce memory usage at the cost of performancesmol = truePackage manager
Section titled “Package manager”Package management is a complex issue; to support a range of use cases, the behavior of jspm install can be configured in bunfig.toml.
Default flags
Section titled “Default flags”The following settings modify the core behavior of JSTime’s package management commands. The default values are shown below.
[install]
# whether to install optionalDependenciesoptional = true
# whether to install devDependenciesdev = true
# whether to install peerDependenciespeer = false
# equivalent to `--production` flagproduction = false
# equivalent to `--frozen-lockfile` flagfrozenLockfile = false
# equivalent to `--dry-run` flagdryRun = falsePrivate scopes and registries
Section titled “Private scopes and registries”The default registry is https://registry.npmjs.org/. This can be globally configured in bunfig.toml:
[install]# set default registry as a stringregistry = "https://registry.npmjs.org"# set a tokenregistry = { url = "https://registry.npmjs.org", token = "123456" }# set a username/passwordregistry = "https://username:password@registry.npmjs.org"To configure scoped registries:
[install.scopes]# registry as stringmyorg1 = "https://username:password@registry.myorg.com/"
# registry with username/password# you can reference environment variablesmyorg12 = { username = "myusername", password = "$NPM_PASS", url = "https://registry.myorg.com/" }
# registry with tokenmyorg3 = { token = "$npm_token", url = "https://registry.myorg.com/" }To configure caching behavior:
[install]# where `jspm install --global` installs packagesglobalDir = "~/.jstime/install/global"
# where globally-installed package bins are linkedglobalBinDir = "~/.jstime/bin"
[install.cache]# the directory to use for the cachedir = "~/.jstime/install/cache"
# when true, don't load from the global cache.# JSTime may still write to node_modules/.cachedisable = false
# when true, always resolve the latest versions from the registrydisableManifest = falseLockfile
Section titled “Lockfile”To configure lockfile behavior:
[install.lockfile]
# path to read jspm.lockb frompath = "jspm.lockb"
# path to save jspm.lockb tosavePath = "jspm.lockb"
# whether to save the lockfile to disksave = true
# whether to save a non-JSTime lockfile alongside jspm.lockb# only "yarn" is supportedprint = "yarn"Debugging
Section titled “Debugging”[debug]# When navigating to a blob: or src: link, open the file in your editor# If not, it tries $EDITOR or $VISUAL# If that still fails, it will try Visual Studio Code, then Sublime Text, then a few others# This is used by JSTime.openInEditor()editor = "code"
# List of editors:# - "subl", "sublime"# - "vscode", "code"# - "textmate", "mate"# - "idea"# - "webstorm"# - "nvim", "neovim"# - "vim","vi"# - "emacs"Environment variables
Section titled “Environment variables”These environment variables are checked by JSTime to detect functionality and toggle features.
| Name | Description |
| --- | --- |
| TMPDIR | JSTime occasionally requires a directory to store intermediate assets during bundling or other operations. If unset, defaults to the platform-specific temporary directory: /tmp on Linux, /private/tmp on macOS. |
| NO_COLOR | If NO_COLOR=1, then ANSI color output is disabled. |
| FORCE_COLOR | If FORCE_COLOR=1, then ANSI color output is force enabled, even if NO_COLOR is set. |
| DO_NOT_TRACK | If DO_NOT_TRACK=1, then analytics are disabled. JSTime records bundle timings (so we can answer with data, “is JSTime getting faster?”) and feature usage (e.g., “are people actually using macros?”). The request body size is about 60 bytes, so it’s not a lot of data. |