bun-types 1.3.2-canary.20251104T140728 → 1.3.2-canary.20251106T140813
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun.d.ts +4 -4
- package/docs/README.md +28 -0
- package/globals.d.ts +0 -1
- package/overrides.d.ts +45 -15
- package/package.json +1 -1
- package/test.d.ts +1 -1
- package/docs/api/binary-data.md +0 -1038
- package/docs/api/cc.md +0 -197
- package/docs/api/color.md +0 -262
- package/docs/api/console.md +0 -57
- package/docs/api/cookie.md +0 -449
- package/docs/api/dns.md +0 -110
- package/docs/api/fetch.md +0 -463
- package/docs/api/ffi.md +0 -557
- package/docs/api/file-io.md +0 -366
- package/docs/api/file-system-router.md +0 -112
- package/docs/api/file.md +0 -19
- package/docs/api/glob.md +0 -178
- package/docs/api/globals.md +0 -387
- package/docs/api/hashing.md +0 -319
- package/docs/api/html-rewriter.md +0 -334
- package/docs/api/http.md +0 -1408
- package/docs/api/import-meta.md +0 -69
- package/docs/api/node-api.md +0 -14
- package/docs/api/redis.md +0 -597
- package/docs/api/s3.md +0 -850
- package/docs/api/secrets.md +0 -319
- package/docs/api/semver.md +0 -52
- package/docs/api/spawn.md +0 -582
- package/docs/api/sql.md +0 -1374
- package/docs/api/sqlite.md +0 -694
- package/docs/api/streams.md +0 -230
- package/docs/api/tcp.md +0 -221
- package/docs/api/transpiler.md +0 -276
- package/docs/api/udp.md +0 -123
- package/docs/api/utils.md +0 -891
- package/docs/api/websockets.md +0 -573
- package/docs/api/workers.md +0 -322
- package/docs/api/yaml.md +0 -668
- package/docs/benchmarks.md +0 -120
- package/docs/bun-flavored-toml.md +0 -42
- package/docs/bundler/css.md +0 -1028
- package/docs/bundler/css_modules.md +0 -145
- package/docs/bundler/executables.md +0 -626
- package/docs/bundler/fullstack.md +0 -418
- package/docs/bundler/hmr.md +0 -234
- package/docs/bundler/html.md +0 -349
- package/docs/bundler/index.md +0 -1735
- package/docs/bundler/intro.md +0 -75
- package/docs/bundler/loaders.md +0 -410
- package/docs/bundler/macros.md +0 -329
- package/docs/bundler/plugins.md +0 -449
- package/docs/bundler/vs-esbuild.md +0 -1127
- package/docs/cli/add.md +0 -173
- package/docs/cli/bun-completions.md +0 -3
- package/docs/cli/bun-create.md +0 -338
- package/docs/cli/bun-install.md +0 -349
- package/docs/cli/bun-upgrade.md +0 -39
- package/docs/cli/bunx.md +0 -89
- package/docs/cli/filter.md +0 -90
- package/docs/cli/info.md +0 -65
- package/docs/cli/init.md +0 -85
- package/docs/cli/install.md +0 -344
- package/docs/cli/link.md +0 -40
- package/docs/cli/outdated.md +0 -90
- package/docs/cli/patch-commit.md +0 -11
- package/docs/cli/pm.md +0 -285
- package/docs/cli/publish.md +0 -120
- package/docs/cli/remove.md +0 -7
- package/docs/cli/run.md +0 -261
- package/docs/cli/test.md +0 -397
- package/docs/cli/unlink.md +0 -9
- package/docs/cli/update.md +0 -129
- package/docs/cli/why.md +0 -67
- package/docs/contributing/upgrading-webkit.md +0 -57
- package/docs/ecosystem/elysia.md +0 -24
- package/docs/ecosystem/express.md +0 -37
- package/docs/ecosystem/hono.md +0 -18
- package/docs/ecosystem/react.md +0 -65
- package/docs/ecosystem/stric.md +0 -38
- package/docs/guides/binary/arraybuffer-to-array.md +0 -27
- package/docs/guides/binary/arraybuffer-to-blob.md +0 -24
- package/docs/guides/binary/arraybuffer-to-buffer.md +0 -25
- package/docs/guides/binary/arraybuffer-to-string.md +0 -15
- package/docs/guides/binary/arraybuffer-to-typedarray.md +0 -39
- package/docs/guides/binary/blob-to-arraybuffer.md +0 -14
- package/docs/guides/binary/blob-to-dataview.md +0 -14
- package/docs/guides/binary/blob-to-stream.md +0 -14
- package/docs/guides/binary/blob-to-string.md +0 -15
- package/docs/guides/binary/blob-to-typedarray.md +0 -14
- package/docs/guides/binary/buffer-to-arraybuffer.md +0 -14
- package/docs/guides/binary/buffer-to-blob.md +0 -14
- package/docs/guides/binary/buffer-to-readablestream.md +0 -41
- package/docs/guides/binary/buffer-to-string.md +0 -25
- package/docs/guides/binary/buffer-to-typedarray.md +0 -14
- package/docs/guides/binary/dataview-to-string.md +0 -15
- package/docs/guides/binary/typedarray-to-arraybuffer.md +0 -25
- package/docs/guides/binary/typedarray-to-blob.md +0 -16
- package/docs/guides/binary/typedarray-to-buffer.md +0 -14
- package/docs/guides/binary/typedarray-to-dataview.md +0 -14
- package/docs/guides/binary/typedarray-to-readablestream.md +0 -41
- package/docs/guides/binary/typedarray-to-string.md +0 -16
- package/docs/guides/deployment/railway.md +0 -157
- package/docs/guides/ecosystem/astro.md +0 -72
- package/docs/guides/ecosystem/discordjs.md +0 -77
- package/docs/guides/ecosystem/docker.md +0 -140
- package/docs/guides/ecosystem/drizzle.md +0 -185
- package/docs/guides/ecosystem/edgedb.md +0 -228
- package/docs/guides/ecosystem/elysia.md +0 -31
- package/docs/guides/ecosystem/express.md +0 -40
- package/docs/guides/ecosystem/hono.md +0 -39
- package/docs/guides/ecosystem/mongoose.md +0 -87
- package/docs/guides/ecosystem/neon-drizzle.md +0 -220
- package/docs/guides/ecosystem/neon-serverless-postgres.md +0 -55
- package/docs/guides/ecosystem/nextjs.md +0 -49
- package/docs/guides/ecosystem/nuxt.md +0 -56
- package/docs/guides/ecosystem/pm2.md +0 -57
- package/docs/guides/ecosystem/prisma.md +0 -141
- package/docs/guides/ecosystem/qwik.md +0 -107
- package/docs/guides/ecosystem/react.md +0 -50
- package/docs/guides/ecosystem/remix.md +0 -78
- package/docs/guides/ecosystem/render.md +0 -79
- package/docs/guides/ecosystem/sentry.md +0 -52
- package/docs/guides/ecosystem/solidstart.md +0 -58
- package/docs/guides/ecosystem/ssr-react.md +0 -51
- package/docs/guides/ecosystem/stric.md +0 -55
- package/docs/guides/ecosystem/sveltekit.md +0 -125
- package/docs/guides/ecosystem/systemd.md +0 -113
- package/docs/guides/ecosystem/vite.md +0 -71
- package/docs/guides/html-rewriter/extract-links.md +0 -68
- package/docs/guides/html-rewriter/extract-social-meta.md +0 -93
- package/docs/guides/http/cluster.md +0 -66
- package/docs/guides/http/fetch-unix.md +0 -33
- package/docs/guides/http/fetch.md +0 -24
- package/docs/guides/http/file-uploads.md +0 -94
- package/docs/guides/http/hot.md +0 -26
- package/docs/guides/http/proxy.md +0 -24
- package/docs/guides/http/server.md +0 -46
- package/docs/guides/http/simple.md +0 -18
- package/docs/guides/http/stream-file.md +0 -48
- package/docs/guides/http/stream-iterator.md +0 -47
- package/docs/guides/http/stream-node-streams-in-bun.md +0 -20
- package/docs/guides/http/tls.md +0 -30
- package/docs/guides/install/add-dev.md +0 -26
- package/docs/guides/install/add-git.md +0 -36
- package/docs/guides/install/add-optional.md +0 -25
- package/docs/guides/install/add-peer.md +0 -43
- package/docs/guides/install/add-tarball.md +0 -33
- package/docs/guides/install/add.md +0 -42
- package/docs/guides/install/azure-artifacts.md +0 -73
- package/docs/guides/install/cicd.md +0 -41
- package/docs/guides/install/custom-registry.md +0 -30
- package/docs/guides/install/from-npm-install-to-bun-install.md +0 -214
- package/docs/guides/install/git-diff-bun-lockfile.md +0 -44
- package/docs/guides/install/jfrog-artifactory.md +0 -28
- package/docs/guides/install/npm-alias.md +0 -23
- package/docs/guides/install/registry-scope.md +0 -38
- package/docs/guides/install/trusted.md +0 -46
- package/docs/guides/install/workspaces.md +0 -70
- package/docs/guides/install/yarnlock.md +0 -44
- package/docs/guides/process/argv.md +0 -58
- package/docs/guides/process/ctrl-c.md +0 -16
- package/docs/guides/process/ipc.md +0 -66
- package/docs/guides/process/nanoseconds.md +0 -13
- package/docs/guides/process/os-signals.md +0 -39
- package/docs/guides/process/spawn-stderr.md +0 -31
- package/docs/guides/process/spawn-stdout.md +0 -26
- package/docs/guides/process/spawn.md +0 -41
- package/docs/guides/process/stdin.md +0 -54
- package/docs/guides/read-file/arraybuffer.md +0 -28
- package/docs/guides/read-file/buffer.md +0 -19
- package/docs/guides/read-file/exists.md +0 -16
- package/docs/guides/read-file/json.md +0 -17
- package/docs/guides/read-file/mime.md +0 -20
- package/docs/guides/read-file/stream.md +0 -26
- package/docs/guides/read-file/string.md +0 -22
- package/docs/guides/read-file/uint8array.md +0 -21
- package/docs/guides/read-file/watch.md +0 -68
- package/docs/guides/runtime/build-time-constants.md +0 -293
- package/docs/guides/runtime/cicd.md +0 -43
- package/docs/guides/runtime/codesign-macos-executable.md +0 -56
- package/docs/guides/runtime/define-constant.md +0 -145
- package/docs/guides/runtime/delete-directory.md +0 -37
- package/docs/guides/runtime/delete-file.md +0 -19
- package/docs/guides/runtime/heap-snapshot.md +0 -26
- package/docs/guides/runtime/import-html.md +0 -15
- package/docs/guides/runtime/import-json.md +0 -44
- package/docs/guides/runtime/import-toml.md +0 -30
- package/docs/guides/runtime/import-yaml.md +0 -102
- package/docs/guides/runtime/read-env.md +0 -32
- package/docs/guides/runtime/set-env.md +0 -47
- package/docs/guides/runtime/shell.md +0 -40
- package/docs/guides/runtime/timezone.md +0 -35
- package/docs/guides/runtime/tsconfig-paths.md +0 -29
- package/docs/guides/runtime/typescript.md +0 -49
- package/docs/guides/runtime/vscode-debugger.md +0 -47
- package/docs/guides/runtime/web-debugger.md +0 -82
- package/docs/guides/streams/node-readable-to-arraybuffer.md +0 -11
- package/docs/guides/streams/node-readable-to-blob.md +0 -11
- package/docs/guides/streams/node-readable-to-json.md +0 -12
- package/docs/guides/streams/node-readable-to-string.md +0 -12
- package/docs/guides/streams/node-readable-to-uint8array.md +0 -11
- package/docs/guides/streams/to-array.md +0 -14
- package/docs/guides/streams/to-arraybuffer.md +0 -14
- package/docs/guides/streams/to-blob.md +0 -14
- package/docs/guides/streams/to-buffer.md +0 -15
- package/docs/guides/streams/to-json.md +0 -14
- package/docs/guides/streams/to-string.md +0 -14
- package/docs/guides/streams/to-typedarray.md +0 -22
- package/docs/guides/test/bail.md +0 -22
- package/docs/guides/test/coverage-threshold.md +0 -60
- package/docs/guides/test/coverage.md +0 -44
- package/docs/guides/test/happy-dom.md +0 -68
- package/docs/guides/test/migrate-from-jest.md +0 -143
- package/docs/guides/test/mock-clock.md +0 -48
- package/docs/guides/test/mock-functions.md +0 -68
- package/docs/guides/test/rerun-each.md +0 -14
- package/docs/guides/test/run-tests.md +0 -111
- package/docs/guides/test/skip-tests.md +0 -39
- package/docs/guides/test/snapshot.md +0 -95
- package/docs/guides/test/spy-on.md +0 -46
- package/docs/guides/test/svelte-test.md +0 -120
- package/docs/guides/test/testing-library.md +0 -92
- package/docs/guides/test/timeout.md +0 -15
- package/docs/guides/test/todo-tests.md +0 -67
- package/docs/guides/test/update-snapshots.md +0 -46
- package/docs/guides/test/watch-mode.md +0 -19
- package/docs/guides/util/base64.md +0 -15
- package/docs/guides/util/deep-equals.md +0 -39
- package/docs/guides/util/deflate.md +0 -18
- package/docs/guides/util/detect-bun.md +0 -23
- package/docs/guides/util/entrypoint.md +0 -17
- package/docs/guides/util/escape-html.md +0 -22
- package/docs/guides/util/file-url-to-path.md +0 -14
- package/docs/guides/util/gzip.md +0 -18
- package/docs/guides/util/hash-a-password.md +0 -54
- package/docs/guides/util/import-meta-dir.md +0 -13
- package/docs/guides/util/import-meta-file.md +0 -13
- package/docs/guides/util/import-meta-path.md +0 -13
- package/docs/guides/util/javascript-uuid.md +0 -23
- package/docs/guides/util/main.md +0 -32
- package/docs/guides/util/path-to-file-url.md +0 -14
- package/docs/guides/util/sleep.md +0 -22
- package/docs/guides/util/version.md +0 -21
- package/docs/guides/util/which-path-to-executable-bin.md +0 -15
- package/docs/guides/websocket/compression.md +0 -31
- package/docs/guides/websocket/context.md +0 -77
- package/docs/guides/websocket/pubsub.md +0 -41
- package/docs/guides/websocket/simple.md +0 -33
- package/docs/guides/write-file/append.md +0 -52
- package/docs/guides/write-file/basic.md +0 -44
- package/docs/guides/write-file/blob.md +0 -28
- package/docs/guides/write-file/cat.md +0 -17
- package/docs/guides/write-file/file-cp.md +0 -16
- package/docs/guides/write-file/filesink.md +0 -52
- package/docs/guides/write-file/response.md +0 -17
- package/docs/guides/write-file/stdout.md +0 -21
- package/docs/guides/write-file/stream.md +0 -17
- package/docs/guides/write-file/unlink.md +0 -16
- package/docs/index.md +0 -77
- package/docs/install/audit.md +0 -57
- package/docs/install/cache.md +0 -59
- package/docs/install/catalogs.md +0 -298
- package/docs/install/index.md +0 -248
- package/docs/install/isolated.md +0 -197
- package/docs/install/lifecycle.md +0 -46
- package/docs/install/lockfile.md +0 -58
- package/docs/install/npmrc.md +0 -105
- package/docs/install/overrides.md +0 -73
- package/docs/install/patch.md +0 -59
- package/docs/install/registries.md +0 -30
- package/docs/install/security-scanner-api.md +0 -81
- package/docs/install/workspaces.md +0 -114
- package/docs/installation.md +0 -327
- package/docs/project/asan.md +0 -124
- package/docs/project/benchmarking.md +0 -203
- package/docs/project/bindgen.md +0 -225
- package/docs/project/building-windows.md +0 -162
- package/docs/project/contributing.md +0 -347
- package/docs/project/internals/build-process-for-ci.md +0 -75
- package/docs/project/licensing.md +0 -73
- package/docs/project/roadmap.md +0 -87
- package/docs/quickstart.md +0 -157
- package/docs/runtime/autoimport.md +0 -94
- package/docs/runtime/bun-apis.md +0 -207
- package/docs/runtime/bunfig.md +0 -772
- package/docs/runtime/debugger.md +0 -325
- package/docs/runtime/env.md +0 -253
- package/docs/runtime/hot.md +0 -145
- package/docs/runtime/index.md +0 -312
- package/docs/runtime/jsx.md +0 -385
- package/docs/runtime/loaders.md +0 -130
- package/docs/runtime/modules.md +0 -320
- package/docs/runtime/nodejs-apis.md +0 -463
- package/docs/runtime/plugins.md +0 -561
- package/docs/runtime/shell.md +0 -605
- package/docs/runtime/typescript.md +0 -139
- package/docs/runtime/web-apis.md +0 -128
- package/docs/test/configuration.md +0 -154
- package/docs/test/coverage.md +0 -142
- package/docs/test/discovery.md +0 -85
- package/docs/test/dom.md +0 -75
- package/docs/test/examples/concurrent-test-glob.md +0 -132
- package/docs/test/hot.md +0 -15
- package/docs/test/lifecycle.md +0 -81
- package/docs/test/mocks.md +0 -313
- package/docs/test/reporters.md +0 -117
- package/docs/test/runtime-behavior.md +0 -95
- package/docs/test/snapshots.md +0 -68
- package/docs/test/time.md +0 -126
- package/docs/test/writing.md +0 -825
- package/docs/typescript.md +0 -53
package/docs/runtime/bunfig.md
DELETED
|
@@ -1,772 +0,0 @@
|
|
|
1
|
-
Bun's behavior can be configured using its configuration file, `bunfig.toml`.
|
|
2
|
-
|
|
3
|
-
In general, Bun relies on pre-existing configuration files like `package.json` and `tsconfig.json` to configure its behavior. `bunfig.toml` is only necessary for configuring Bun-specific things. This file is optional, and Bun will work out of the box without it.
|
|
4
|
-
|
|
5
|
-
## Global vs. local
|
|
6
|
-
|
|
7
|
-
In general, it's recommended to add a `bunfig.toml` file to your project root, alongside your `package.json`.
|
|
8
|
-
|
|
9
|
-
To configure Bun globally, you can also create a `.bunfig.toml` file at one of the following paths:
|
|
10
|
-
|
|
11
|
-
- `$HOME/.bunfig.toml`
|
|
12
|
-
- `$XDG_CONFIG_HOME/.bunfig.toml`
|
|
13
|
-
|
|
14
|
-
If both a global and local `bunfig` are detected, the results are shallow-merged, with local overriding global. CLI flags will override `bunfig` setting where applicable.
|
|
15
|
-
|
|
16
|
-
## Runtime
|
|
17
|
-
|
|
18
|
-
Bun's runtime behavior is configured using top-level fields in the `bunfig.toml` file.
|
|
19
|
-
|
|
20
|
-
### `preload`
|
|
21
|
-
|
|
22
|
-
An array of scripts/plugins to execute before running a file or script.
|
|
23
|
-
|
|
24
|
-
```toml
|
|
25
|
-
# scripts to run before `bun run`-ing a file or script
|
|
26
|
-
# register plugins by adding them to this list
|
|
27
|
-
preload = ["./preload.ts"]
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### `jsx`
|
|
31
|
-
|
|
32
|
-
Configure how Bun handles JSX. You can also set these fields in the `compilerOptions` of your `tsconfig.json`, but they are supported here as well for non-TypeScript projects.
|
|
33
|
-
|
|
34
|
-
```toml
|
|
35
|
-
jsx = "react"
|
|
36
|
-
jsxFactory = "h"
|
|
37
|
-
jsxFragment = "Fragment"
|
|
38
|
-
jsxImportSource = "react"
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Refer to the tsconfig docs for more information on these fields.
|
|
42
|
-
|
|
43
|
-
- [jsx](https://www.typescriptlang.org/tsconfig#jsx)
|
|
44
|
-
- [jsxFactory](https://www.typescriptlang.org/tsconfig#jsxFactory)
|
|
45
|
-
- [jsxFragment](https://www.typescriptlang.org/tsconfig#jsxFragment)
|
|
46
|
-
- [jsxImportSource](https://www.typescriptlang.org/tsconfig#jsxImportSource)
|
|
47
|
-
|
|
48
|
-
### `smol`
|
|
49
|
-
|
|
50
|
-
Enable `smol` mode. This reduces memory usage at the cost of performance.
|
|
51
|
-
|
|
52
|
-
```toml
|
|
53
|
-
# Reduce memory usage at the cost of performance
|
|
54
|
-
smol = true
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### `logLevel`
|
|
58
|
-
|
|
59
|
-
Set the log level. This can be one of `"debug"`, `"warn"`, or `"error"`.
|
|
60
|
-
|
|
61
|
-
```toml
|
|
62
|
-
logLevel = "debug" # "debug" | "warn" | "error"
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### `define`
|
|
66
|
-
|
|
67
|
-
The `define` field allows you to replace certain global identifiers with constant expressions. Bun will replace any usage of the identifier with the expression. The expression should be a JSON string.
|
|
68
|
-
|
|
69
|
-
```toml
|
|
70
|
-
[define]
|
|
71
|
-
# Replace any usage of "process.env.bagel" with the string `lox`.
|
|
72
|
-
# The values are parsed as JSON, except single-quoted strings are supported and `'undefined'` becomes `undefined` in JS.
|
|
73
|
-
# This will probably change in a future release to be just regular TOML instead. It is a holdover from the CLI argument parsing.
|
|
74
|
-
"process.env.bagel" = "'lox'"
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### `loader`
|
|
78
|
-
|
|
79
|
-
Configure how Bun maps file extensions to loaders. This is useful for loading files that aren't natively supported by Bun.
|
|
80
|
-
|
|
81
|
-
```toml
|
|
82
|
-
[loader]
|
|
83
|
-
# when a .bagel file is imported, treat it like a tsx file
|
|
84
|
-
".bagel" = "tsx"
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Bun supports the following loaders:
|
|
88
|
-
|
|
89
|
-
- `jsx`
|
|
90
|
-
- `js`
|
|
91
|
-
- `ts`
|
|
92
|
-
- `tsx`
|
|
93
|
-
- `css`
|
|
94
|
-
- `file`
|
|
95
|
-
- `json`
|
|
96
|
-
- `toml`
|
|
97
|
-
- `yaml`
|
|
98
|
-
- `wasm`
|
|
99
|
-
- `napi`
|
|
100
|
-
- `base64`
|
|
101
|
-
- `dataurl`
|
|
102
|
-
- `text`
|
|
103
|
-
|
|
104
|
-
### `telemetry`
|
|
105
|
-
|
|
106
|
-
The `telemetry` field permit to enable/disable the analytics records. Bun records bundle timings (so we can answer with data, "is Bun 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. By default the telemetry is enabled. Equivalent of `DO_NOT_TRACK` env variable.
|
|
107
|
-
|
|
108
|
-
```toml
|
|
109
|
-
telemetry = false
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### `console`
|
|
113
|
-
|
|
114
|
-
Configure console output behavior.
|
|
115
|
-
|
|
116
|
-
#### `console.depth`
|
|
117
|
-
|
|
118
|
-
Set the default depth for `console.log()` object inspection. Default `2`.
|
|
119
|
-
|
|
120
|
-
```toml
|
|
121
|
-
[console]
|
|
122
|
-
depth = 3
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
This controls how deeply nested objects are displayed in console output. Higher values show more nested properties but may produce verbose output for complex objects. This setting can be overridden by the `--console-depth` CLI flag.
|
|
126
|
-
|
|
127
|
-
## Test runner
|
|
128
|
-
|
|
129
|
-
The test runner is configured under the `[test]` section of your bunfig.toml.
|
|
130
|
-
|
|
131
|
-
```toml
|
|
132
|
-
[test]
|
|
133
|
-
# configuration goes here
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### `test.root`
|
|
137
|
-
|
|
138
|
-
The root directory to run tests from. Default `.`.
|
|
139
|
-
|
|
140
|
-
```toml
|
|
141
|
-
[test]
|
|
142
|
-
root = "./__tests__"
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### `test.preload`
|
|
146
|
-
|
|
147
|
-
Same as the top-level `preload` field, but only applies to `bun test`.
|
|
148
|
-
|
|
149
|
-
```toml
|
|
150
|
-
[test]
|
|
151
|
-
preload = ["./setup.ts"]
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### `test.smol`
|
|
155
|
-
|
|
156
|
-
Same as the top-level `smol` field, but only applies to `bun test`.
|
|
157
|
-
|
|
158
|
-
```toml
|
|
159
|
-
[test]
|
|
160
|
-
smol = true
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
### `test.coverage`
|
|
164
|
-
|
|
165
|
-
Enables coverage reporting. Default `false`. Use `--coverage` to override.
|
|
166
|
-
|
|
167
|
-
```toml
|
|
168
|
-
[test]
|
|
169
|
-
coverage = false
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
### `test.coverageThreshold`
|
|
173
|
-
|
|
174
|
-
To specify a coverage threshold. By default, no threshold is set. If your test suite does not meet or exceed this threshold, `bun test` will exit with a non-zero exit code to indicate the failure.
|
|
175
|
-
|
|
176
|
-
```toml
|
|
177
|
-
[test]
|
|
178
|
-
|
|
179
|
-
# to require 90% line-level and function-level coverage
|
|
180
|
-
coverageThreshold = 0.9
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Different thresholds can be specified for line-wise, function-wise, and statement-wise coverage.
|
|
184
|
-
|
|
185
|
-
```toml
|
|
186
|
-
[test]
|
|
187
|
-
coverageThreshold = { line = 0.7, function = 0.8, statement = 0.9 }
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### `test.coverageSkipTestFiles`
|
|
191
|
-
|
|
192
|
-
Whether to skip test files when computing coverage statistics. Default `false`.
|
|
193
|
-
|
|
194
|
-
```toml
|
|
195
|
-
[test]
|
|
196
|
-
coverageSkipTestFiles = false
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### `test.coveragePathIgnorePatterns`
|
|
200
|
-
|
|
201
|
-
Exclude specific files or file patterns from coverage reports using glob patterns. Can be a single string pattern or an array of patterns.
|
|
202
|
-
|
|
203
|
-
```toml
|
|
204
|
-
[test]
|
|
205
|
-
# Single pattern
|
|
206
|
-
coveragePathIgnorePatterns = "**/*.spec.ts"
|
|
207
|
-
|
|
208
|
-
# Multiple patterns
|
|
209
|
-
coveragePathIgnorePatterns = [
|
|
210
|
-
"**/*.spec.ts",
|
|
211
|
-
"**/*.test.ts",
|
|
212
|
-
"src/utils/**",
|
|
213
|
-
"*.config.js"
|
|
214
|
-
]
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### `test.coverageReporter`
|
|
218
|
-
|
|
219
|
-
By default, coverage reports will be printed to the console. For persistent code coverage reports in CI environments and for other tools use `lcov`.
|
|
220
|
-
|
|
221
|
-
```toml
|
|
222
|
-
[test]
|
|
223
|
-
coverageReporter = ["text", "lcov"] # default ["text"]
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### `test.coverageDir`
|
|
227
|
-
|
|
228
|
-
Set path where coverage reports will be saved. Please notice, that it works only for persistent `coverageReporter` like `lcov`.
|
|
229
|
-
|
|
230
|
-
```toml
|
|
231
|
-
[test]
|
|
232
|
-
coverageDir = "path/to/somewhere" # default "coverage"
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### `test.concurrentTestGlob`
|
|
236
|
-
|
|
237
|
-
Specify a glob pattern to automatically run matching test files with concurrent test execution enabled. Test files matching this pattern will behave as if the `--concurrent` flag was passed, running all tests within those files concurrently.
|
|
238
|
-
|
|
239
|
-
```toml
|
|
240
|
-
[test]
|
|
241
|
-
concurrentTestGlob = "**/concurrent-*.test.ts"
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
This is useful for:
|
|
245
|
-
|
|
246
|
-
- Gradually migrating test suites to concurrent execution
|
|
247
|
-
- Running integration tests concurrently while keeping unit tests sequential
|
|
248
|
-
- Separating fast concurrent tests from tests that require sequential execution
|
|
249
|
-
|
|
250
|
-
The `--concurrent` CLI flag will override this setting when specified.
|
|
251
|
-
|
|
252
|
-
### `test.onlyFailures`
|
|
253
|
-
|
|
254
|
-
When enabled, only failed tests are displayed in the output. This helps reduce noise in large test suites by hiding passing tests. Default `false`.
|
|
255
|
-
|
|
256
|
-
```toml
|
|
257
|
-
[test]
|
|
258
|
-
onlyFailures = true
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
This is equivalent to using the `--only-failures` flag when running `bun test`.
|
|
262
|
-
|
|
263
|
-
### `test.reporter`
|
|
264
|
-
|
|
265
|
-
Configure the test reporter settings.
|
|
266
|
-
|
|
267
|
-
#### `test.reporter.dots`
|
|
268
|
-
|
|
269
|
-
Enable the dots reporter, which displays a compact output showing a dot for each test. Default `false`.
|
|
270
|
-
|
|
271
|
-
```toml
|
|
272
|
-
[test.reporter]
|
|
273
|
-
dots = true
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
#### `test.reporter.junit`
|
|
277
|
-
|
|
278
|
-
Enable JUnit XML reporting and specify the output file path.
|
|
279
|
-
|
|
280
|
-
```toml
|
|
281
|
-
[test.reporter]
|
|
282
|
-
junit = "test-results.xml"
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
This generates a JUnit XML report that can be consumed by CI systems and other tools.
|
|
286
|
-
|
|
287
|
-
### `test.randomize`
|
|
288
|
-
|
|
289
|
-
Run tests in random order. Default `false`.
|
|
290
|
-
|
|
291
|
-
```toml
|
|
292
|
-
[test]
|
|
293
|
-
randomize = true
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
This helps catch bugs related to test interdependencies by running tests in a different order each time. When combined with `seed`, the random order becomes reproducible.
|
|
297
|
-
|
|
298
|
-
The `--randomize` CLI flag will override this setting when specified.
|
|
299
|
-
|
|
300
|
-
### `test.seed`
|
|
301
|
-
|
|
302
|
-
Set the random seed for test randomization. This option requires `randomize` to be `true`.
|
|
303
|
-
|
|
304
|
-
```toml
|
|
305
|
-
[test]
|
|
306
|
-
randomize = true
|
|
307
|
-
seed = 2444615283
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
Using a seed makes the randomized test order reproducible across runs, which is useful for debugging flaky tests. When you encounter a test failure with randomization enabled, you can use the same seed to reproduce the exact test order.
|
|
311
|
-
|
|
312
|
-
The `--seed` CLI flag will override this setting when specified.
|
|
313
|
-
|
|
314
|
-
### `test.rerunEach`
|
|
315
|
-
|
|
316
|
-
Re-run each test file a specified number of times. Default `0` (run once).
|
|
317
|
-
|
|
318
|
-
```toml
|
|
319
|
-
[test]
|
|
320
|
-
rerunEach = 3
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
This is useful for catching flaky tests or non-deterministic behavior. Each test file will be executed the specified number of times.
|
|
324
|
-
|
|
325
|
-
The `--rerun-each` CLI flag will override this setting when specified.
|
|
326
|
-
|
|
327
|
-
## Package manager
|
|
328
|
-
|
|
329
|
-
Package management is a complex issue; to support a range of use cases, the behavior of `bun install` can be configured under the `[install]` section.
|
|
330
|
-
|
|
331
|
-
```toml
|
|
332
|
-
[install]
|
|
333
|
-
# configuration here
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
### `install.optional`
|
|
337
|
-
|
|
338
|
-
Whether to install optional dependencies. Default `true`.
|
|
339
|
-
|
|
340
|
-
```toml
|
|
341
|
-
[install]
|
|
342
|
-
optional = true
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
### `install.dev`
|
|
346
|
-
|
|
347
|
-
Whether to install development dependencies. Default `true`.
|
|
348
|
-
|
|
349
|
-
```toml
|
|
350
|
-
[install]
|
|
351
|
-
dev = true
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
### `install.peer`
|
|
355
|
-
|
|
356
|
-
Whether to install peer dependencies. Default `true`.
|
|
357
|
-
|
|
358
|
-
```toml
|
|
359
|
-
[install]
|
|
360
|
-
peer = true
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
### `install.production`
|
|
364
|
-
|
|
365
|
-
Whether `bun install` will run in "production mode". Default `false`.
|
|
366
|
-
|
|
367
|
-
In production mode, `"devDependencies"` are not installed. You can use `--production` in the CLI to override this setting.
|
|
368
|
-
|
|
369
|
-
```toml
|
|
370
|
-
[install]
|
|
371
|
-
production = false
|
|
372
|
-
```
|
|
373
|
-
|
|
374
|
-
### `install.exact`
|
|
375
|
-
|
|
376
|
-
Whether to set an exact version in `package.json`. Default `false`.
|
|
377
|
-
|
|
378
|
-
By default Bun uses caret ranges; if the `latest` version of a package is `2.4.1`, the version range in your `package.json` will be `^2.4.1`. This indicates that any version from `2.4.1` up to (but not including) `3.0.0` is acceptable.
|
|
379
|
-
|
|
380
|
-
```toml
|
|
381
|
-
[install]
|
|
382
|
-
exact = false
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
### `install.saveTextLockfile`
|
|
386
|
-
|
|
387
|
-
If false, generate a binary `bun.lockb` instead of a text-based `bun.lock` file when running `bun install` and no lockfile is present.
|
|
388
|
-
|
|
389
|
-
Default `true` (since Bun v1.2).
|
|
390
|
-
|
|
391
|
-
```toml
|
|
392
|
-
[install]
|
|
393
|
-
saveTextLockfile = false
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
<!--
|
|
397
|
-
### `install.prefer`
|
|
398
|
-
|
|
399
|
-
Whether the package manager should prefer offline or online dependency resolution. Default `"online"`.
|
|
400
|
-
|
|
401
|
-
```toml
|
|
402
|
-
[install]
|
|
403
|
-
prefer = "online"
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
Valid values are:
|
|
407
|
-
|
|
408
|
-
{% table %}
|
|
409
|
-
|
|
410
|
-
---
|
|
411
|
-
|
|
412
|
-
- `"online"`
|
|
413
|
-
- Prefer online resolution. This is the default. If a package is not found in the local cache, it will be downloaded from the registry.
|
|
414
|
-
|
|
415
|
-
---
|
|
416
|
-
|
|
417
|
-
- `"offline"`
|
|
418
|
-
- Prefer offline resolution. When possible, packages will be installed from the global cache. This minimizes the fraction of the time Bun will check for newer versions from the registry. If a package is not found in the global cache, it will be downloaded from the registry.
|
|
419
|
-
|
|
420
|
-
{% /table %} -->
|
|
421
|
-
|
|
422
|
-
### `install.auto`
|
|
423
|
-
|
|
424
|
-
To configure Bun's package auto-install behavior. Default `"auto"` — when no `node_modules` folder is found, Bun will automatically install dependencies on the fly during execution.
|
|
425
|
-
|
|
426
|
-
```toml
|
|
427
|
-
[install]
|
|
428
|
-
auto = "auto"
|
|
429
|
-
```
|
|
430
|
-
|
|
431
|
-
Valid values are:
|
|
432
|
-
|
|
433
|
-
{% table %}
|
|
434
|
-
|
|
435
|
-
- Value
|
|
436
|
-
- Description
|
|
437
|
-
|
|
438
|
-
---
|
|
439
|
-
|
|
440
|
-
- `"auto"`
|
|
441
|
-
- Resolve modules from local `node_modules` if it exists. Otherwise, auto-install dependencies on the fly.
|
|
442
|
-
|
|
443
|
-
---
|
|
444
|
-
|
|
445
|
-
- `"force"`
|
|
446
|
-
- Always auto-install dependencies, even if `node_modules` exists.
|
|
447
|
-
|
|
448
|
-
---
|
|
449
|
-
|
|
450
|
-
- `"disable"`
|
|
451
|
-
- Never auto-install dependencies.
|
|
452
|
-
|
|
453
|
-
---
|
|
454
|
-
|
|
455
|
-
- `"fallback"`
|
|
456
|
-
- Check local `node_modules` first, then auto-install any packages that aren't found. You can enable this from the CLI with `bun -i`.
|
|
457
|
-
|
|
458
|
-
{% /table %}
|
|
459
|
-
|
|
460
|
-
### `install.frozenLockfile`
|
|
461
|
-
|
|
462
|
-
When true, `bun install` will not update `bun.lock`. Default `false`. If `package.json` and the existing `bun.lock` are not in agreement, this will error.
|
|
463
|
-
|
|
464
|
-
```toml
|
|
465
|
-
[install]
|
|
466
|
-
frozenLockfile = false
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
### `install.dryRun`
|
|
470
|
-
|
|
471
|
-
Whether `bun install` will actually install dependencies. Default `false`. When true, it's equivalent to setting `--dry-run` on all `bun install` commands.
|
|
472
|
-
|
|
473
|
-
```toml
|
|
474
|
-
[install]
|
|
475
|
-
dryRun = false
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
### `install.globalDir`
|
|
479
|
-
|
|
480
|
-
To configure the directory where Bun puts globally installed packages.
|
|
481
|
-
|
|
482
|
-
Environment variable: `BUN_INSTALL_GLOBAL_DIR`
|
|
483
|
-
|
|
484
|
-
```toml
|
|
485
|
-
[install]
|
|
486
|
-
# where `bun install --global` installs packages
|
|
487
|
-
globalDir = "~/.bun/install/global"
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
### `install.globalBinDir`
|
|
491
|
-
|
|
492
|
-
To configure the directory where Bun installs globally installed binaries and CLIs.
|
|
493
|
-
|
|
494
|
-
Environment variable: `BUN_INSTALL_BIN`
|
|
495
|
-
|
|
496
|
-
```toml
|
|
497
|
-
# where globally-installed package bins are linked
|
|
498
|
-
globalBinDir = "~/.bun/bin"
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
### `install.registry`
|
|
502
|
-
|
|
503
|
-
The default registry is `https://registry.npmjs.org/`. This can be globally configured in `bunfig.toml`:
|
|
504
|
-
|
|
505
|
-
```toml
|
|
506
|
-
[install]
|
|
507
|
-
# set default registry as a string
|
|
508
|
-
registry = "https://registry.npmjs.org"
|
|
509
|
-
# set a token
|
|
510
|
-
registry = { url = "https://registry.npmjs.org", token = "123456" }
|
|
511
|
-
# set a username/password
|
|
512
|
-
registry = "https://username:password@registry.npmjs.org"
|
|
513
|
-
```
|
|
514
|
-
|
|
515
|
-
### `install.linkWorkspacePackages`
|
|
516
|
-
|
|
517
|
-
To configure how workspace packages are linked, use the `install.linkWorkspacePackages` option.
|
|
518
|
-
|
|
519
|
-
Whether to link workspace packages from the monorepo root to their respective `node_modules` directories. Default `true`.
|
|
520
|
-
|
|
521
|
-
```toml
|
|
522
|
-
[install]
|
|
523
|
-
linkWorkspacePackages = true
|
|
524
|
-
```
|
|
525
|
-
|
|
526
|
-
### `install.scopes`
|
|
527
|
-
|
|
528
|
-
To configure a registry for a particular scope (e.g. `@myorg/<package>`) use `install.scopes`. You can reference environment variables with `$variable` notation.
|
|
529
|
-
|
|
530
|
-
```toml
|
|
531
|
-
[install.scopes]
|
|
532
|
-
# registry as string
|
|
533
|
-
myorg = "https://username:password@registry.myorg.com/"
|
|
534
|
-
|
|
535
|
-
# registry with username/password
|
|
536
|
-
# you can reference environment variables
|
|
537
|
-
myorg = { username = "myusername", password = "$npm_password", url = "https://registry.myorg.com/" }
|
|
538
|
-
|
|
539
|
-
# registry with token
|
|
540
|
-
myorg = { token = "$npm_token", url = "https://registry.myorg.com/" }
|
|
541
|
-
```
|
|
542
|
-
|
|
543
|
-
### `install.ca` and `install.cafile`
|
|
544
|
-
|
|
545
|
-
To configure a CA certificate, use `install.ca` or `install.cafile` to specify a path to a CA certificate file.
|
|
546
|
-
|
|
547
|
-
```toml
|
|
548
|
-
[install]
|
|
549
|
-
# The CA certificate as a string
|
|
550
|
-
ca = "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
|
|
551
|
-
|
|
552
|
-
# A path to a CA certificate file. The file can contain multiple certificates.
|
|
553
|
-
cafile = "path/to/cafile"
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
### `install.cache`
|
|
557
|
-
|
|
558
|
-
To configure the cache behavior:
|
|
559
|
-
|
|
560
|
-
```toml
|
|
561
|
-
[install.cache]
|
|
562
|
-
|
|
563
|
-
# the directory to use for the cache
|
|
564
|
-
dir = "~/.bun/install/cache"
|
|
565
|
-
|
|
566
|
-
# when true, don't load from the global cache.
|
|
567
|
-
# Bun may still write to node_modules/.cache
|
|
568
|
-
disable = false
|
|
569
|
-
|
|
570
|
-
# when true, always resolve the latest versions from the registry
|
|
571
|
-
disableManifest = false
|
|
572
|
-
```
|
|
573
|
-
|
|
574
|
-
### `install.lockfile`
|
|
575
|
-
|
|
576
|
-
To configure lockfile behavior, use the `install.lockfile` section.
|
|
577
|
-
|
|
578
|
-
Whether to generate a lockfile on `bun install`. Default `true`.
|
|
579
|
-
|
|
580
|
-
```toml
|
|
581
|
-
[install.lockfile]
|
|
582
|
-
save = true
|
|
583
|
-
```
|
|
584
|
-
|
|
585
|
-
Whether to generate a non-Bun lockfile alongside `bun.lock`. (A `bun.lock` will always be created.) Currently `"yarn"` is the only supported value.
|
|
586
|
-
|
|
587
|
-
```toml
|
|
588
|
-
[install.lockfile]
|
|
589
|
-
print = "yarn"
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
### `install.security.scanner`
|
|
593
|
-
|
|
594
|
-
Configure a security scanner to scan packages for vulnerabilities before installation.
|
|
595
|
-
|
|
596
|
-
First, install a security scanner from npm:
|
|
597
|
-
|
|
598
|
-
```bash
|
|
599
|
-
$ bun add -d @acme/bun-security-scanner
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
Then configure it in your `bunfig.toml`:
|
|
603
|
-
|
|
604
|
-
```toml
|
|
605
|
-
[install.security]
|
|
606
|
-
scanner = "@acme/bun-security-scanner"
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
When a security scanner is configured:
|
|
610
|
-
|
|
611
|
-
- Auto-install is automatically disabled for security
|
|
612
|
-
- Packages are scanned before installation
|
|
613
|
-
- Installation is cancelled if fatal issues are found
|
|
614
|
-
- Security warnings are displayed during installation
|
|
615
|
-
|
|
616
|
-
Learn more about [using and writing security scanners](/docs/install/security-scanner-api).
|
|
617
|
-
|
|
618
|
-
### `install.linker`
|
|
619
|
-
|
|
620
|
-
Configure the default linker strategy. Default `"hoisted"`.
|
|
621
|
-
|
|
622
|
-
For complete documentation refer to [Package manager > Isolated installs](https://bun.com/docs/install/isolated).
|
|
623
|
-
|
|
624
|
-
```toml
|
|
625
|
-
[install]
|
|
626
|
-
linker = "hoisted"
|
|
627
|
-
```
|
|
628
|
-
|
|
629
|
-
Valid values are:
|
|
630
|
-
|
|
631
|
-
{% table %}
|
|
632
|
-
|
|
633
|
-
- Value
|
|
634
|
-
- Description
|
|
635
|
-
|
|
636
|
-
---
|
|
637
|
-
|
|
638
|
-
- `"hoisted"`
|
|
639
|
-
- Link dependencies in a shared `node_modules` directory.
|
|
640
|
-
|
|
641
|
-
---
|
|
642
|
-
|
|
643
|
-
- `"isolated"`
|
|
644
|
-
- Link dependencies inside each package installation.
|
|
645
|
-
|
|
646
|
-
{% /table %}
|
|
647
|
-
|
|
648
|
-
### `install.minimumReleaseAge`
|
|
649
|
-
|
|
650
|
-
Configure a minimum age (in seconds) for npm package versions. Package versions published more recently than this threshold will be filtered out during installation. Default is `null` (disabled).
|
|
651
|
-
|
|
652
|
-
```toml
|
|
653
|
-
[install]
|
|
654
|
-
# Only install package versions published at least 3 days ago
|
|
655
|
-
minimumReleaseAge = 259200
|
|
656
|
-
# These packages will bypass the 3-day minimum age requirement
|
|
657
|
-
minimumReleaseAgeExcludes = ["@types/bun", "typescript"]
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
For more details see [Minimum release age](https://bun.com/docs/cli/install#minimum-release-age) in the install documentation.
|
|
661
|
-
|
|
662
|
-
<!-- ## Debugging -->
|
|
663
|
-
|
|
664
|
-
<!--
|
|
665
|
-
```toml
|
|
666
|
-
[debug]
|
|
667
|
-
# When navigating to a blob: or src: link, open the file in your editor
|
|
668
|
-
# If not, it tries $EDITOR or $VISUAL
|
|
669
|
-
# If that still fails, it will try Visual Studio Code, then Sublime Text, then a few others
|
|
670
|
-
# This is used by Bun.openInEditor()
|
|
671
|
-
editor = "code"
|
|
672
|
-
|
|
673
|
-
# List of editors:
|
|
674
|
-
# - "subl", "sublime"
|
|
675
|
-
# - "vscode", "code"
|
|
676
|
-
# - "textmate", "mate"
|
|
677
|
-
# - "idea"
|
|
678
|
-
# - "webstorm"
|
|
679
|
-
# - "nvim", "neovim"
|
|
680
|
-
# - "vim","vi"
|
|
681
|
-
# - "emacs"
|
|
682
|
-
```
|
|
683
|
-
-->
|
|
684
|
-
|
|
685
|
-
## `bun run`
|
|
686
|
-
|
|
687
|
-
The `bun run` command can be configured under the `[run]` section. These apply to the `bun run` command and the `bun` command when running a file or executable or script.
|
|
688
|
-
|
|
689
|
-
Currently, `bunfig.toml` is only automatically loaded for `bun run` in a local project (it doesn't check for a global `.bunfig.toml`).
|
|
690
|
-
|
|
691
|
-
### `run.shell` - use the system shell or Bun's shell
|
|
692
|
-
|
|
693
|
-
The shell to use when running package.json scripts via `bun run` or `bun`. On Windows, this defaults to `"bun"` and on other platforms it defaults to `"system"`.
|
|
694
|
-
|
|
695
|
-
To always use the system shell instead of Bun's shell (default behavior unless Windows):
|
|
696
|
-
|
|
697
|
-
```toml
|
|
698
|
-
[run]
|
|
699
|
-
# default outside of Windows
|
|
700
|
-
shell = "system"
|
|
701
|
-
```
|
|
702
|
-
|
|
703
|
-
To always use Bun's shell instead of the system shell:
|
|
704
|
-
|
|
705
|
-
```toml
|
|
706
|
-
[run]
|
|
707
|
-
# default on Windows
|
|
708
|
-
shell = "bun"
|
|
709
|
-
```
|
|
710
|
-
|
|
711
|
-
### `run.bun` - auto alias `node` to `bun`
|
|
712
|
-
|
|
713
|
-
When `true`, this prepends `$PATH` with a `node` symlink that points to the `bun` binary for all scripts or executables invoked by `bun run` or `bun`.
|
|
714
|
-
|
|
715
|
-
This means that if you have a script that runs `node`, it will actually run `bun` instead, without needing to change your script. This works recursively, so if your script runs another script that runs `node`, it will also run `bun` instead. This applies to shebangs as well, so if you have a script with a shebang that points to `node`, it will actually run `bun` instead.
|
|
716
|
-
|
|
717
|
-
By default, this is enabled if `node` is not already in your `$PATH`.
|
|
718
|
-
|
|
719
|
-
```toml
|
|
720
|
-
[run]
|
|
721
|
-
# equivalent to `bun --bun` for all `bun run` commands
|
|
722
|
-
bun = true
|
|
723
|
-
```
|
|
724
|
-
|
|
725
|
-
You can test this by running:
|
|
726
|
-
|
|
727
|
-
```sh
|
|
728
|
-
$ bun --bun which node # /path/to/bun
|
|
729
|
-
$ bun which node # /path/to/node
|
|
730
|
-
```
|
|
731
|
-
|
|
732
|
-
This option is equivalent to prefixing all `bun run` commands with `--bun`:
|
|
733
|
-
|
|
734
|
-
```sh
|
|
735
|
-
bun --bun run dev
|
|
736
|
-
bun --bun dev
|
|
737
|
-
bun run --bun dev
|
|
738
|
-
```
|
|
739
|
-
|
|
740
|
-
If set to `false`, this will disable the `node` symlink.
|
|
741
|
-
|
|
742
|
-
### `run.silent` - suppress reporting the command being run
|
|
743
|
-
|
|
744
|
-
When `true`, suppresses the output of the command being run by `bun run` or `bun`.
|
|
745
|
-
|
|
746
|
-
```toml
|
|
747
|
-
[run]
|
|
748
|
-
silent = true
|
|
749
|
-
```
|
|
750
|
-
|
|
751
|
-
Without this option, the command being run will be printed to the console:
|
|
752
|
-
|
|
753
|
-
```sh
|
|
754
|
-
$ bun run dev
|
|
755
|
-
> $ echo "Running \"dev\"..."
|
|
756
|
-
Running "dev"...
|
|
757
|
-
```
|
|
758
|
-
|
|
759
|
-
With this option, the command being run will not be printed to the console:
|
|
760
|
-
|
|
761
|
-
```sh
|
|
762
|
-
$ bun run dev
|
|
763
|
-
Running "dev"...
|
|
764
|
-
```
|
|
765
|
-
|
|
766
|
-
This is equivalent to passing `--silent` to all `bun run` commands:
|
|
767
|
-
|
|
768
|
-
```sh
|
|
769
|
-
bun --silent run dev
|
|
770
|
-
bun --silent dev
|
|
771
|
-
bun run --silent dev
|
|
772
|
-
```
|