bun-types 1.1.37-canary.20241123T140655 → 1.1.37-canary.20241125T140601

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.
Files changed (272) hide show
  1. package/docs/api/binary-data.md +1028 -0
  2. package/docs/api/cc.md +197 -0
  3. package/docs/api/color.md +262 -0
  4. package/docs/api/console.md +38 -0
  5. package/docs/api/dns.md +113 -0
  6. package/docs/api/fetch.md +308 -0
  7. package/docs/api/ffi.md +536 -0
  8. package/docs/api/file-io.md +358 -0
  9. package/docs/api/file-system-router.md +112 -0
  10. package/docs/api/file.md +19 -0
  11. package/docs/api/glob.md +157 -0
  12. package/docs/api/globals.md +387 -0
  13. package/docs/api/hashing.md +314 -0
  14. package/docs/api/html-rewriter.md +31 -0
  15. package/docs/api/http.md +661 -0
  16. package/docs/api/import-meta.md +69 -0
  17. package/docs/api/node-api.md +16 -0
  18. package/docs/api/semver.md +52 -0
  19. package/docs/api/spawn.md +441 -0
  20. package/docs/api/sqlite.md +692 -0
  21. package/docs/api/streams.md +214 -0
  22. package/docs/api/tcp.md +221 -0
  23. package/docs/api/test.md +1 -0
  24. package/docs/api/transpiler.md +274 -0
  25. package/docs/api/udp.md +125 -0
  26. package/docs/api/utils.md +773 -0
  27. package/docs/api/websockets.md +547 -0
  28. package/docs/api/workers.md +230 -0
  29. package/docs/benchmarks.md +120 -0
  30. package/docs/bun-flavored-toml.md +42 -0
  31. package/docs/bundler/executables.md +291 -0
  32. package/docs/bundler/index.md +1543 -0
  33. package/docs/bundler/intro.md +75 -0
  34. package/docs/bundler/loaders.md +288 -0
  35. package/docs/bundler/macros.md +327 -0
  36. package/docs/bundler/plugins.md +30 -0
  37. package/docs/bundler/vs-esbuild.md +1127 -0
  38. package/docs/cli/add.md +163 -0
  39. package/docs/cli/bun-completions.md +3 -0
  40. package/docs/cli/bun-create.md +254 -0
  41. package/docs/cli/bun-dev.md +21 -0
  42. package/docs/cli/bun-install.md +255 -0
  43. package/docs/cli/bun-upgrade.md +39 -0
  44. package/docs/cli/bunx.md +80 -0
  45. package/docs/cli/filter.md +57 -0
  46. package/docs/cli/init.md +40 -0
  47. package/docs/cli/install.md +205 -0
  48. package/docs/cli/link.md +38 -0
  49. package/docs/cli/outdated.md +61 -0
  50. package/docs/cli/patch-commit.md +9 -0
  51. package/docs/cli/pm.md +150 -0
  52. package/docs/cli/publish.md +107 -0
  53. package/docs/cli/remove.md +5 -0
  54. package/docs/cli/run.md +196 -0
  55. package/docs/cli/test.md +247 -0
  56. package/docs/cli/unlink.md +7 -0
  57. package/docs/cli/update.md +34 -0
  58. package/docs/contributing/upgrading-webkit.md +57 -0
  59. package/docs/ecosystem/elysia.md +24 -0
  60. package/docs/ecosystem/express.md +37 -0
  61. package/docs/ecosystem/hono.md +18 -0
  62. package/docs/ecosystem/react.md +65 -0
  63. package/docs/ecosystem/stric.md +37 -0
  64. package/docs/guides/binary/arraybuffer-to-array.md +27 -0
  65. package/docs/guides/binary/arraybuffer-to-blob.md +24 -0
  66. package/docs/guides/binary/arraybuffer-to-buffer.md +25 -0
  67. package/docs/guides/binary/arraybuffer-to-string.md +15 -0
  68. package/docs/guides/binary/arraybuffer-to-typedarray.md +39 -0
  69. package/docs/guides/binary/blob-to-arraybuffer.md +14 -0
  70. package/docs/guides/binary/blob-to-dataview.md +14 -0
  71. package/docs/guides/binary/blob-to-stream.md +14 -0
  72. package/docs/guides/binary/blob-to-string.md +15 -0
  73. package/docs/guides/binary/blob-to-typedarray.md +14 -0
  74. package/docs/guides/binary/buffer-to-arraybuffer.md +14 -0
  75. package/docs/guides/binary/buffer-to-blob.md +14 -0
  76. package/docs/guides/binary/buffer-to-readablestream.md +41 -0
  77. package/docs/guides/binary/buffer-to-string.md +25 -0
  78. package/docs/guides/binary/buffer-to-typedarray.md +14 -0
  79. package/docs/guides/binary/dataview-to-string.md +15 -0
  80. package/docs/guides/binary/typedarray-to-arraybuffer.md +25 -0
  81. package/docs/guides/binary/typedarray-to-blob.md +16 -0
  82. package/docs/guides/binary/typedarray-to-buffer.md +14 -0
  83. package/docs/guides/binary/typedarray-to-dataview.md +14 -0
  84. package/docs/guides/binary/typedarray-to-readablestream.md +41 -0
  85. package/docs/guides/binary/typedarray-to-string.md +16 -0
  86. package/docs/guides/ecosystem/astro.md +72 -0
  87. package/docs/guides/ecosystem/discordjs.md +77 -0
  88. package/docs/guides/ecosystem/docker.md +140 -0
  89. package/docs/guides/ecosystem/drizzle.md +185 -0
  90. package/docs/guides/ecosystem/edgedb.md +228 -0
  91. package/docs/guides/ecosystem/elysia.md +31 -0
  92. package/docs/guides/ecosystem/express.md +40 -0
  93. package/docs/guides/ecosystem/hono.md +39 -0
  94. package/docs/guides/ecosystem/mongoose.md +87 -0
  95. package/docs/guides/ecosystem/neon-drizzle.md +220 -0
  96. package/docs/guides/ecosystem/neon-serverless-postgres.md +55 -0
  97. package/docs/guides/ecosystem/nextjs.md +38 -0
  98. package/docs/guides/ecosystem/nuxt.md +56 -0
  99. package/docs/guides/ecosystem/pm2.md +57 -0
  100. package/docs/guides/ecosystem/prisma.md +140 -0
  101. package/docs/guides/ecosystem/qwik.md +107 -0
  102. package/docs/guides/ecosystem/react.md +49 -0
  103. package/docs/guides/ecosystem/remix.md +78 -0
  104. package/docs/guides/ecosystem/render.md +79 -0
  105. package/docs/guides/ecosystem/sentry.md +52 -0
  106. package/docs/guides/ecosystem/solidstart.md +58 -0
  107. package/docs/guides/ecosystem/ssr-react.md +51 -0
  108. package/docs/guides/ecosystem/stric.md +55 -0
  109. package/docs/guides/ecosystem/sveltekit.md +125 -0
  110. package/docs/guides/ecosystem/systemd.md +113 -0
  111. package/docs/guides/ecosystem/vite.md +70 -0
  112. package/docs/guides/http/cluster.md +66 -0
  113. package/docs/guides/http/fetch-unix.md +33 -0
  114. package/docs/guides/http/fetch.md +24 -0
  115. package/docs/guides/http/file-uploads.md +94 -0
  116. package/docs/guides/http/hot.md +22 -0
  117. package/docs/guides/http/proxy.md +24 -0
  118. package/docs/guides/http/server.md +46 -0
  119. package/docs/guides/http/simple.md +18 -0
  120. package/docs/guides/http/stream-file.md +48 -0
  121. package/docs/guides/http/stream-iterator.md +47 -0
  122. package/docs/guides/http/stream-node-streams-in-bun.md +20 -0
  123. package/docs/guides/http/tls.md +30 -0
  124. package/docs/guides/install/add-dev.md +26 -0
  125. package/docs/guides/install/add-git.md +36 -0
  126. package/docs/guides/install/add-optional.md +25 -0
  127. package/docs/guides/install/add-peer.md +17 -0
  128. package/docs/guides/install/add-tarball.md +33 -0
  129. package/docs/guides/install/add.md +42 -0
  130. package/docs/guides/install/azure-artifacts.md +73 -0
  131. package/docs/guides/install/cicd.md +41 -0
  132. package/docs/guides/install/custom-registry.md +30 -0
  133. package/docs/guides/install/from-npm-install-to-bun-install.md +214 -0
  134. package/docs/guides/install/git-diff-bun-lockfile.md +38 -0
  135. package/docs/guides/install/jfrog-artifactory.md +28 -0
  136. package/docs/guides/install/npm-alias.md +23 -0
  137. package/docs/guides/install/registry-scope.md +36 -0
  138. package/docs/guides/install/trusted.md +48 -0
  139. package/docs/guides/install/workspaces.md +70 -0
  140. package/docs/guides/install/yarnlock.md +42 -0
  141. package/docs/guides/process/argv.md +57 -0
  142. package/docs/guides/process/ctrl-c.md +16 -0
  143. package/docs/guides/process/ipc.md +66 -0
  144. package/docs/guides/process/nanoseconds.md +13 -0
  145. package/docs/guides/process/os-signals.md +39 -0
  146. package/docs/guides/process/spawn-stderr.md +31 -0
  147. package/docs/guides/process/spawn-stdout.md +26 -0
  148. package/docs/guides/process/spawn.md +41 -0
  149. package/docs/guides/process/stdin.md +54 -0
  150. package/docs/guides/read-file/arraybuffer.md +28 -0
  151. package/docs/guides/read-file/buffer.md +19 -0
  152. package/docs/guides/read-file/exists.md +16 -0
  153. package/docs/guides/read-file/json.md +17 -0
  154. package/docs/guides/read-file/mime.md +20 -0
  155. package/docs/guides/read-file/stream.md +26 -0
  156. package/docs/guides/read-file/string.md +22 -0
  157. package/docs/guides/read-file/uint8array.md +21 -0
  158. package/docs/guides/read-file/watch.md +68 -0
  159. package/docs/guides/runtime/cicd.md +43 -0
  160. package/docs/guides/runtime/define-constant.md +145 -0
  161. package/docs/guides/runtime/import-html.md +15 -0
  162. package/docs/guides/runtime/import-json.md +44 -0
  163. package/docs/guides/runtime/import-toml.md +30 -0
  164. package/docs/guides/runtime/read-env.md +32 -0
  165. package/docs/guides/runtime/set-env.md +37 -0
  166. package/docs/guides/runtime/shell.md +40 -0
  167. package/docs/guides/runtime/timezone.md +35 -0
  168. package/docs/guides/runtime/tsconfig-paths.md +29 -0
  169. package/docs/guides/runtime/typescript.md +47 -0
  170. package/docs/guides/runtime/vscode-debugger.md +47 -0
  171. package/docs/guides/runtime/web-debugger.md +82 -0
  172. package/docs/guides/streams/node-readable-to-arraybuffer.md +11 -0
  173. package/docs/guides/streams/node-readable-to-blob.md +11 -0
  174. package/docs/guides/streams/node-readable-to-json.md +12 -0
  175. package/docs/guides/streams/node-readable-to-string.md +12 -0
  176. package/docs/guides/streams/node-readable-to-uint8array.md +11 -0
  177. package/docs/guides/streams/to-array.md +14 -0
  178. package/docs/guides/streams/to-arraybuffer.md +14 -0
  179. package/docs/guides/streams/to-blob.md +14 -0
  180. package/docs/guides/streams/to-buffer.md +15 -0
  181. package/docs/guides/streams/to-json.md +14 -0
  182. package/docs/guides/streams/to-string.md +14 -0
  183. package/docs/guides/streams/to-typedarray.md +22 -0
  184. package/docs/guides/test/bail.md +22 -0
  185. package/docs/guides/test/coverage-threshold.md +60 -0
  186. package/docs/guides/test/coverage.md +44 -0
  187. package/docs/guides/test/happy-dom.md +68 -0
  188. package/docs/guides/test/migrate-from-jest.md +110 -0
  189. package/docs/guides/test/mock-clock.md +48 -0
  190. package/docs/guides/test/mock-functions.md +68 -0
  191. package/docs/guides/test/rerun-each.md +14 -0
  192. package/docs/guides/test/run-tests.md +111 -0
  193. package/docs/guides/test/skip-tests.md +39 -0
  194. package/docs/guides/test/snapshot.md +99 -0
  195. package/docs/guides/test/spy-on.md +46 -0
  196. package/docs/guides/test/testing-library.md +87 -0
  197. package/docs/guides/test/timeout.md +15 -0
  198. package/docs/guides/test/todo-tests.md +67 -0
  199. package/docs/guides/test/update-snapshots.md +50 -0
  200. package/docs/guides/test/watch-mode.md +19 -0
  201. package/docs/guides/util/base64.md +15 -0
  202. package/docs/guides/util/deep-equals.md +39 -0
  203. package/docs/guides/util/deflate.md +18 -0
  204. package/docs/guides/util/detect-bun.md +23 -0
  205. package/docs/guides/util/entrypoint.md +17 -0
  206. package/docs/guides/util/escape-html.md +22 -0
  207. package/docs/guides/util/file-url-to-path.md +14 -0
  208. package/docs/guides/util/gzip.md +18 -0
  209. package/docs/guides/util/hash-a-password.md +54 -0
  210. package/docs/guides/util/import-meta-dir.md +13 -0
  211. package/docs/guides/util/import-meta-file.md +13 -0
  212. package/docs/guides/util/import-meta-path.md +13 -0
  213. package/docs/guides/util/main.md +32 -0
  214. package/docs/guides/util/path-to-file-url.md +14 -0
  215. package/docs/guides/util/sleep.md +22 -0
  216. package/docs/guides/util/version.md +21 -0
  217. package/docs/guides/util/which-path-to-executable-bin.md +15 -0
  218. package/docs/guides/websocket/compression.md +31 -0
  219. package/docs/guides/websocket/context.md +72 -0
  220. package/docs/guides/websocket/pubsub.md +38 -0
  221. package/docs/guides/websocket/simple.md +33 -0
  222. package/docs/guides/write-file/append.md +52 -0
  223. package/docs/guides/write-file/basic.md +44 -0
  224. package/docs/guides/write-file/blob.md +28 -0
  225. package/docs/guides/write-file/cat.md +17 -0
  226. package/docs/guides/write-file/file-cp.md +16 -0
  227. package/docs/guides/write-file/filesink.md +52 -0
  228. package/docs/guides/write-file/response.md +17 -0
  229. package/docs/guides/write-file/stdout.md +21 -0
  230. package/docs/guides/write-file/stream.md +17 -0
  231. package/docs/guides/write-file/unlink.md +23 -0
  232. package/docs/index.md +77 -0
  233. package/docs/install/cache.md +57 -0
  234. package/docs/install/index.md +202 -0
  235. package/docs/install/lifecycle.md +46 -0
  236. package/docs/install/lockfile.md +90 -0
  237. package/docs/install/npmrc.md +75 -0
  238. package/docs/install/overrides.md +73 -0
  239. package/docs/install/patch.md +57 -0
  240. package/docs/install/registries.md +30 -0
  241. package/docs/install/workspaces.md +70 -0
  242. package/docs/installation.md +289 -0
  243. package/docs/project/benchmarking.md +203 -0
  244. package/docs/project/building-windows.md +162 -0
  245. package/docs/project/internals/build-process-for-ci.md +75 -0
  246. package/docs/project/roadmap.md +87 -0
  247. package/docs/quickstart.md +144 -0
  248. package/docs/runtime/autoimport.md +94 -0
  249. package/docs/runtime/bun-apis.md +129 -0
  250. package/docs/runtime/bunfig.md +532 -0
  251. package/docs/runtime/debugger.md +325 -0
  252. package/docs/runtime/env.md +214 -0
  253. package/docs/runtime/hot.md +139 -0
  254. package/docs/runtime/index.md +309 -0
  255. package/docs/runtime/jsx.md +326 -0
  256. package/docs/runtime/loaders.md +127 -0
  257. package/docs/runtime/modules.md +298 -0
  258. package/docs/runtime/nodejs-apis.md +456 -0
  259. package/docs/runtime/plugins.md +605 -0
  260. package/docs/runtime/shell.md +537 -0
  261. package/docs/runtime/typescript.md +60 -0
  262. package/docs/runtime/web-apis.md +128 -0
  263. package/docs/test/coverage.md +91 -0
  264. package/docs/test/dom.md +75 -0
  265. package/docs/test/hot.md +15 -0
  266. package/docs/test/lifecycle.md +81 -0
  267. package/docs/test/mocks.md +236 -0
  268. package/docs/test/snapshots.md +15 -0
  269. package/docs/test/time.md +106 -0
  270. package/docs/test/writing.md +547 -0
  271. package/docs/typescript.md +51 -0
  272. package/package.json +5 -4
@@ -0,0 +1,532 @@
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. If
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
+ - `wasm`
98
+ - `napi`
99
+ - `base64`
100
+ - `dataurl`
101
+ - `text`
102
+
103
+ ### `telemetry`
104
+
105
+ 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.
106
+
107
+ ```toml
108
+ telemetry = false
109
+ ```
110
+
111
+ ## Test runner
112
+
113
+ The test runner is configured under the `[test]` section of your bunfig.toml.
114
+
115
+ ```toml
116
+ [test]
117
+ # configuration goes here
118
+ ```
119
+
120
+ ### `test.root`
121
+
122
+ The root directory to run tests from. Default `.`.
123
+
124
+ ```toml
125
+ [test]
126
+ root = "./__tests__"
127
+ ```
128
+
129
+ ### `test.preload`
130
+
131
+ Same as the top-level `preload` field, but only applies to `bun test`.
132
+
133
+ ```toml
134
+ [test]
135
+ preload = ["./setup.ts"]
136
+ ```
137
+
138
+ ### `test.smol`
139
+
140
+ Same as the top-level `smol` field, but only applies to `bun test`.
141
+
142
+ ```toml
143
+ [test]
144
+ smol = true
145
+ ```
146
+
147
+ ### `test.coverage`
148
+
149
+ Enables coverage reporting. Default `false`. Use `--coverage` to override.
150
+
151
+ ```toml
152
+ [test]
153
+ coverage = false
154
+ ```
155
+
156
+ ### `test.coverageThreshold`
157
+
158
+ 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.
159
+
160
+ ```toml
161
+ [test]
162
+
163
+ # to require 90% line-level and function-level coverage
164
+ coverageThreshold = 0.9
165
+ ```
166
+
167
+ Different thresholds can be specified for line-wise, function-wise, and statement-wise coverage.
168
+
169
+ ```toml
170
+ [test]
171
+ coverageThreshold = { line = 0.7, function = 0.8, statement = 0.9 }
172
+ ```
173
+
174
+ ### `test.coverageSkipTestFiles`
175
+
176
+ Whether to skip test files when computing coverage statistics. Default `false`.
177
+
178
+ ```toml
179
+ [test]
180
+ coverageSkipTestFiles = false
181
+ ```
182
+
183
+ ## Package manager
184
+
185
+ 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.
186
+
187
+ ```toml
188
+ [install]
189
+ # configuration here
190
+ ```
191
+
192
+ ### `install.optional`
193
+
194
+ Whether to install optional dependencies. Default `true`.
195
+
196
+ ```toml
197
+ [install]
198
+ optional = true
199
+ ```
200
+
201
+ ### `install.dev`
202
+
203
+ Whether to install development dependencies. Default `true`.
204
+
205
+ ```toml
206
+ [install]
207
+ dev = true
208
+ ```
209
+
210
+ ### `install.peer`
211
+
212
+ Whether to install peer dependencies. Default `true`.
213
+
214
+ ```toml
215
+ [install]
216
+ peer = true
217
+ ```
218
+
219
+ ### `install.production`
220
+
221
+ Whether `bun install` will run in "production mode". Default `false`.
222
+
223
+ In production mode, `"devDependencies"` are not installed. You can use `--production` in the CLI to override this setting.
224
+
225
+ ```toml
226
+ [install]
227
+ production = false
228
+ ```
229
+
230
+ ### `install.exact`
231
+
232
+ Whether to set an exact version in `package.json`. Default `false`.
233
+
234
+ 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.
235
+
236
+ ```toml
237
+ [install]
238
+ exact = false
239
+ ```
240
+
241
+ <!--
242
+ ### `install.prefer`
243
+
244
+ Whether the package manager should prefer offline or online dependency resolution. Default `"online"`.
245
+
246
+ ```toml
247
+ [install]
248
+ prefer = "online"
249
+ ```
250
+
251
+ Valid values are:
252
+
253
+ {% table %}
254
+
255
+ ---
256
+
257
+ - `"online"`
258
+ - Prefer online resolution. This is the default. If a package is not found in the local cache, it will be downloaded from the registry.
259
+
260
+ ---
261
+
262
+ - `"offline"`
263
+ - 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.
264
+
265
+ {% /table %} -->
266
+
267
+ ### `install.auto`
268
+
269
+ 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.
270
+
271
+ ```toml
272
+ [install]
273
+ auto = "auto"
274
+ ```
275
+
276
+ Valid values are:
277
+
278
+ {% table %}
279
+
280
+ - Value
281
+ - Description
282
+
283
+ ---
284
+
285
+ - `"auto"`
286
+ - Resolve modules from local `node_modules` if it exists. Otherwise, auto-install dependencies on the fly.
287
+
288
+ ---
289
+
290
+ - `"force"`
291
+ - Always auto-install dependencies, even if `node_modules` exists.
292
+
293
+ ---
294
+
295
+ - `"disable"`
296
+ - Never auto-install dependencies.
297
+
298
+ ---
299
+
300
+ - `"fallback"`
301
+ - Check local `node_modules` first, then auto-install any packages that aren't found. You can enable this from the CLI with `bun -i`.
302
+
303
+ {% /table %}
304
+
305
+ ### `install.frozenLockfile`
306
+
307
+ When true, `bun install` will not update `bun.lockb`. Default `false`. If `package.json` and the existing `bun.lockb` are not in agreement, this will error.
308
+
309
+ ```toml
310
+ [install]
311
+ frozenLockfile = false
312
+ ```
313
+
314
+ ### `install.dryRun`
315
+
316
+ Whether `bun install` will actually install dependencies. Default `false`. When true, it's equivalent to setting `--dry-run` on all `bun install` commands.
317
+
318
+ ```toml
319
+ [install]
320
+ dryRun = false
321
+ ```
322
+
323
+ ### `install.globalDir`
324
+
325
+ To configure the directory where Bun puts globally installed packages.
326
+
327
+ ```toml
328
+ [install]
329
+ # where `bun install --global` installs packages
330
+ globalDir = "~/.bun/install/global"
331
+ ```
332
+
333
+ ### `install.globalBinDir`
334
+
335
+ To configure the directory where Bun installs globally installed binaries and CLIs.
336
+
337
+ ```toml
338
+ # where globally-installed package bins are linked
339
+ globalBinDir = "~/.bun/bin"
340
+ ```
341
+
342
+ ### `install.registry`
343
+
344
+ The default registry is `https://registry.npmjs.org/`. This can be globally configured in `bunfig.toml`:
345
+
346
+ ```toml
347
+ [install]
348
+ # set default registry as a string
349
+ registry = "https://registry.npmjs.org"
350
+ # set a token
351
+ registry = { url = "https://registry.npmjs.org", token = "123456" }
352
+ # set a username/password
353
+ registry = "https://username:password@registry.npmjs.org"
354
+ ```
355
+
356
+ ### `install.scopes`
357
+
358
+ To configure a registry for a particular scope (e.g. `@myorg/<package>`) use `install.scopes`. You can reference environment variables with `$variable` notation.
359
+
360
+ ```toml
361
+ [install.scopes]
362
+ # registry as string
363
+ myorg = "https://username:password@registry.myorg.com/"
364
+
365
+ # registry with username/password
366
+ # you can reference environment variables
367
+ myorg = { username = "myusername", password = "$npm_password", url = "https://registry.myorg.com/" }
368
+
369
+ # registry with token
370
+ myorg = { token = "$npm_token", url = "https://registry.myorg.com/" }
371
+ ```
372
+
373
+ ### `install.ca` and `install.cafile`
374
+
375
+ To configure a CA certificate, use `install.ca` or `install.cafile` to specify a path to a CA certificate file.
376
+
377
+ ```toml
378
+ [install]
379
+ # The CA certificate as a string
380
+ ca = "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
381
+
382
+ # A path to a CA certificate file. The file can contain multiple certificates.
383
+ cafile = "path/to/cafile"
384
+ ```
385
+
386
+ ### `install.cache`
387
+
388
+ To configure the cache behavior:
389
+
390
+ ```toml
391
+ [install.cache]
392
+
393
+ # the directory to use for the cache
394
+ dir = "~/.bun/install/cache"
395
+
396
+ # when true, don't load from the global cache.
397
+ # Bun may still write to node_modules/.cache
398
+ disable = false
399
+
400
+ # when true, always resolve the latest versions from the registry
401
+ disableManifest = false
402
+ ```
403
+
404
+ ### `install.lockfile`
405
+
406
+ To configure lockfile behavior, use the `install.lockfile` section.
407
+
408
+ Whether to generate a lockfile on `bun install`. Default `true`.
409
+
410
+ ```toml
411
+ [install.lockfile]
412
+ save = true
413
+ ```
414
+
415
+ Whether to generate a non-Bun lockfile alongside `bun.lockb`. (A `bun.lockb` will always be created.) Currently `"yarn"` is the only supported value.
416
+
417
+ ```toml
418
+ [install.lockfile]
419
+ print = "yarn"
420
+ ```
421
+
422
+ <!-- ## Debugging -->
423
+
424
+ <!--
425
+ ```toml
426
+ [debug]
427
+ # When navigating to a blob: or src: link, open the file in your editor
428
+ # If not, it tries $EDITOR or $VISUAL
429
+ # If that still fails, it will try Visual Studio Code, then Sublime Text, then a few others
430
+ # This is used by Bun.openInEditor()
431
+ editor = "code"
432
+
433
+ # List of editors:
434
+ # - "subl", "sublime"
435
+ # - "vscode", "code"
436
+ # - "textmate", "mate"
437
+ # - "idea"
438
+ # - "webstorm"
439
+ # - "nvim", "neovim"
440
+ # - "vim","vi"
441
+ # - "emacs"
442
+ ```
443
+ -->
444
+
445
+ ## `bun run`
446
+
447
+ 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.
448
+
449
+ Currently, `bunfig.toml` isn't always automatically loaded for `bun run` in a local project (it does check for a global `bunfig.toml`), so you might still need to pass `-c` or `-c=bunfig.toml` to use these settings.
450
+
451
+ ### `run.shell` - use the system shell or Bun's shell
452
+
453
+ 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"`.
454
+
455
+ To always use the system shell instead of Bun's shell (default behavior unless Windows):
456
+
457
+ ```toml
458
+ [run]
459
+ # default outside of Windows
460
+ shell = "system"
461
+ ```
462
+
463
+ To always use Bun's shell instead of the system shell:
464
+
465
+ ```toml
466
+ [run]
467
+ # default on Windows
468
+ shell = "bun"
469
+ ```
470
+
471
+ ### `run.bun` - auto alias `node` to `bun`
472
+
473
+ 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`.
474
+
475
+ 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.
476
+
477
+ By default, this is enabled if `node` is not already in your `$PATH`.
478
+
479
+ ```toml
480
+ [run]
481
+ # equivalent to `bun --bun` for all `bun run` commands
482
+ bun = true
483
+ ```
484
+
485
+ You can test this by running:
486
+
487
+ ```sh
488
+ $ bun --bun which node # /path/to/bun
489
+ $ bun which node # /path/to/node
490
+ ```
491
+
492
+ This option is equivalent to prefixing all `bun run` commands with `--bun`:
493
+
494
+ ```sh
495
+ bun --bun run dev
496
+ bun --bun dev
497
+ bun run --bun dev
498
+ ```
499
+
500
+ If set to `false`, this will disable the `node` symlink.
501
+
502
+ ### `run.silent` - suppress reporting the command being run
503
+
504
+ When `true`, suppresses the output of the command being run by `bun run` or `bun`.
505
+
506
+ ```toml
507
+ [run]
508
+ silent = true
509
+ ```
510
+
511
+ Without this option, the command being run will be printed to the console:
512
+
513
+ ```sh
514
+ $ bun run dev
515
+ > $ echo "Running \"dev\"..."
516
+ Running "dev"...
517
+ ```
518
+
519
+ With this option, the command being run will not be printed to the console:
520
+
521
+ ```sh
522
+ $ bun run dev
523
+ Running "dev"...
524
+ ```
525
+
526
+ This is equivalent to passing `--silent` to all `bun run` commands:
527
+
528
+ ```sh
529
+ bun --silent run dev
530
+ bun --silent dev
531
+ bun run --silent dev
532
+ ```