bun-types 1.3.2-canary.20251106T140813 → 1.3.2-canary.20251108T140624

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 (316) hide show
  1. package/bun.d.ts +102 -6
  2. package/docs/bundler/bytecode.mdx +465 -0
  3. package/docs/bundler/css.mdx +1024 -0
  4. package/docs/bundler/esbuild.mdx +253 -0
  5. package/docs/bundler/executables.mdx +535 -0
  6. package/docs/bundler/fullstack.mdx +1064 -0
  7. package/docs/bundler/hot-reloading.mdx +229 -0
  8. package/docs/bundler/html-static.mdx +386 -0
  9. package/docs/bundler/index.mdx +1499 -0
  10. package/docs/bundler/loaders.mdx +356 -0
  11. package/docs/bundler/macros.mdx +328 -0
  12. package/docs/bundler/minifier.mdx +1306 -0
  13. package/docs/bundler/plugins.mdx +411 -0
  14. package/docs/feedback.mdx +85 -0
  15. package/docs/guides/binary/arraybuffer-to-array.mdx +29 -0
  16. package/docs/guides/binary/arraybuffer-to-blob.mdx +26 -0
  17. package/docs/guides/binary/arraybuffer-to-buffer.mdx +27 -0
  18. package/docs/guides/binary/arraybuffer-to-string.mdx +17 -0
  19. package/docs/guides/binary/arraybuffer-to-typedarray.mdx +41 -0
  20. package/docs/guides/binary/blob-to-arraybuffer.mdx +16 -0
  21. package/docs/guides/binary/blob-to-dataview.mdx +16 -0
  22. package/docs/guides/binary/blob-to-stream.mdx +16 -0
  23. package/docs/guides/binary/blob-to-string.mdx +17 -0
  24. package/docs/guides/binary/blob-to-typedarray.mdx +16 -0
  25. package/docs/guides/binary/buffer-to-arraybuffer.mdx +16 -0
  26. package/docs/guides/binary/buffer-to-blob.mdx +16 -0
  27. package/docs/guides/binary/buffer-to-readablestream.mdx +43 -0
  28. package/docs/guides/binary/buffer-to-string.mdx +27 -0
  29. package/docs/guides/binary/buffer-to-typedarray.mdx +16 -0
  30. package/docs/guides/binary/dataview-to-string.mdx +17 -0
  31. package/docs/guides/binary/typedarray-to-arraybuffer.mdx +27 -0
  32. package/docs/guides/binary/typedarray-to-blob.mdx +18 -0
  33. package/docs/guides/binary/typedarray-to-buffer.mdx +16 -0
  34. package/docs/guides/binary/typedarray-to-dataview.mdx +16 -0
  35. package/docs/guides/binary/typedarray-to-readablestream.mdx +43 -0
  36. package/docs/guides/binary/typedarray-to-string.mdx +18 -0
  37. package/docs/guides/deployment/aws-lambda.mdx +204 -0
  38. package/docs/guides/deployment/digital-ocean.mdx +161 -0
  39. package/docs/guides/deployment/google-cloud-run.mdx +197 -0
  40. package/docs/guides/deployment/railway.mdx +145 -0
  41. package/docs/guides/deployment/render.mdx +82 -0
  42. package/docs/guides/deployment/vercel.mdx +99 -0
  43. package/docs/guides/ecosystem/astro.mdx +82 -0
  44. package/docs/guides/ecosystem/discordjs.mdx +80 -0
  45. package/docs/guides/ecosystem/docker.mdx +151 -0
  46. package/docs/guides/ecosystem/drizzle.mdx +195 -0
  47. package/docs/guides/ecosystem/edgedb.mdx +257 -0
  48. package/docs/guides/ecosystem/elysia.mdx +31 -0
  49. package/docs/guides/ecosystem/express.mdx +43 -0
  50. package/docs/guides/ecosystem/hono.mdx +47 -0
  51. package/docs/guides/ecosystem/mongoose.mdx +92 -0
  52. package/docs/guides/ecosystem/neon-drizzle.mdx +234 -0
  53. package/docs/guides/ecosystem/neon-serverless-postgres.mdx +60 -0
  54. package/docs/guides/ecosystem/nextjs.mdx +57 -0
  55. package/docs/guides/ecosystem/nuxt.mdx +90 -0
  56. package/docs/guides/ecosystem/pm2.mdx +55 -0
  57. package/docs/guides/ecosystem/prisma-postgres.mdx +169 -0
  58. package/docs/guides/ecosystem/prisma.mdx +164 -0
  59. package/docs/guides/ecosystem/qwik.mdx +114 -0
  60. package/docs/guides/ecosystem/react.mdx +52 -0
  61. package/docs/guides/ecosystem/remix.mdx +97 -0
  62. package/docs/guides/ecosystem/sentry.mdx +54 -0
  63. package/docs/guides/ecosystem/solidstart.mdx +66 -0
  64. package/docs/guides/ecosystem/ssr-react.mdx +49 -0
  65. package/docs/guides/ecosystem/stric.mdx +54 -0
  66. package/docs/guides/ecosystem/sveltekit.mdx +138 -0
  67. package/docs/guides/ecosystem/systemd.mdx +114 -0
  68. package/docs/guides/ecosystem/upstash.mdx +87 -0
  69. package/docs/guides/ecosystem/vite.mdx +77 -0
  70. package/docs/guides/html-rewriter/extract-links.mdx +72 -0
  71. package/docs/guides/html-rewriter/extract-social-meta.mdx +97 -0
  72. package/docs/guides/http/cluster.mdx +69 -0
  73. package/docs/guides/http/fetch-unix.mdx +35 -0
  74. package/docs/guides/http/fetch.mdx +26 -0
  75. package/docs/guides/http/file-uploads.mdx +97 -0
  76. package/docs/guides/http/hot.mdx +28 -0
  77. package/docs/guides/http/proxy.mdx +26 -0
  78. package/docs/guides/http/server.mdx +48 -0
  79. package/docs/guides/http/simple.mdx +20 -0
  80. package/docs/guides/http/stream-file.mdx +50 -0
  81. package/docs/guides/http/stream-iterator.mdx +49 -0
  82. package/docs/guides/http/stream-node-streams-in-bun.mdx +22 -0
  83. package/docs/guides/http/tls.mdx +32 -0
  84. package/docs/guides/index.mdx +10 -0
  85. package/docs/guides/install/add-dev.mdx +28 -0
  86. package/docs/guides/install/add-git.mdx +38 -0
  87. package/docs/guides/install/add-optional.mdx +27 -0
  88. package/docs/guides/install/add-peer.mdx +45 -0
  89. package/docs/guides/install/add-tarball.mdx +35 -0
  90. package/docs/guides/install/add.mdx +44 -0
  91. package/docs/guides/install/azure-artifacts.mdx +76 -0
  92. package/docs/guides/install/cicd.mdx +43 -0
  93. package/docs/guides/install/custom-registry.mdx +32 -0
  94. package/docs/guides/install/from-npm-install-to-bun-install.mdx +230 -0
  95. package/docs/guides/install/git-diff-bun-lockfile.mdx +47 -0
  96. package/docs/guides/install/jfrog-artifactory.mdx +28 -0
  97. package/docs/guides/install/npm-alias.mdx +25 -0
  98. package/docs/guides/install/registry-scope.mdx +40 -0
  99. package/docs/guides/install/trusted.mdx +50 -0
  100. package/docs/guides/install/workspaces.mdx +70 -0
  101. package/docs/guides/install/yarnlock.mdx +50 -0
  102. package/docs/guides/process/argv.mdx +66 -0
  103. package/docs/guides/process/ctrl-c.mdx +18 -0
  104. package/docs/guides/process/ipc.mdx +69 -0
  105. package/docs/guides/process/nanoseconds.mdx +15 -0
  106. package/docs/guides/process/os-signals.mdx +41 -0
  107. package/docs/guides/process/spawn-stderr.mdx +34 -0
  108. package/docs/guides/process/spawn-stdout.mdx +28 -0
  109. package/docs/guides/process/spawn.mdx +43 -0
  110. package/docs/guides/process/stdin.mdx +62 -0
  111. package/docs/guides/read-file/arraybuffer.mdx +30 -0
  112. package/docs/guides/read-file/buffer.mdx +21 -0
  113. package/docs/guides/read-file/exists.mdx +18 -0
  114. package/docs/guides/read-file/json.mdx +19 -0
  115. package/docs/guides/read-file/mime.mdx +22 -0
  116. package/docs/guides/read-file/stream.mdx +28 -0
  117. package/docs/guides/read-file/string.mdx +24 -0
  118. package/docs/guides/read-file/uint8array.mdx +23 -0
  119. package/docs/guides/read-file/watch.mdx +66 -0
  120. package/docs/guides/runtime/build-time-constants.mdx +295 -0
  121. package/docs/guides/runtime/cicd.mdx +45 -0
  122. package/docs/guides/runtime/codesign-macos-executable.mdx +61 -0
  123. package/docs/guides/runtime/define-constant.mdx +149 -0
  124. package/docs/guides/runtime/delete-directory.mdx +39 -0
  125. package/docs/guides/runtime/delete-file.mdx +21 -0
  126. package/docs/guides/runtime/heap-snapshot.mdx +28 -0
  127. package/docs/guides/runtime/import-html.mdx +17 -0
  128. package/docs/guides/runtime/import-json.mdx +46 -0
  129. package/docs/guides/runtime/import-toml.mdx +32 -0
  130. package/docs/guides/runtime/import-yaml.mdx +104 -0
  131. package/docs/guides/runtime/read-env.mdx +37 -0
  132. package/docs/guides/runtime/set-env.mdx +51 -0
  133. package/docs/guides/runtime/shell.mdx +42 -0
  134. package/docs/guides/runtime/timezone.mdx +38 -0
  135. package/docs/guides/runtime/tsconfig-paths.mdx +31 -0
  136. package/docs/guides/runtime/typescript.mdx +51 -0
  137. package/docs/guides/runtime/vscode-debugger.mdx +48 -0
  138. package/docs/guides/runtime/web-debugger.mdx +103 -0
  139. package/docs/guides/streams/node-readable-to-arraybuffer.mdx +13 -0
  140. package/docs/guides/streams/node-readable-to-blob.mdx +13 -0
  141. package/docs/guides/streams/node-readable-to-json.mdx +14 -0
  142. package/docs/guides/streams/node-readable-to-string.mdx +14 -0
  143. package/docs/guides/streams/node-readable-to-uint8array.mdx +13 -0
  144. package/docs/guides/streams/to-array.mdx +16 -0
  145. package/docs/guides/streams/to-arraybuffer.mdx +16 -0
  146. package/docs/guides/streams/to-blob.mdx +16 -0
  147. package/docs/guides/streams/to-buffer.mdx +17 -0
  148. package/docs/guides/streams/to-json.mdx +16 -0
  149. package/docs/guides/streams/to-string.mdx +16 -0
  150. package/docs/guides/streams/to-typedarray.mdx +24 -0
  151. package/docs/guides/test/bail.mdx +24 -0
  152. package/docs/guides/test/coverage-threshold.mdx +67 -0
  153. package/docs/guides/test/coverage.mdx +49 -0
  154. package/docs/guides/test/happy-dom.mdx +73 -0
  155. package/docs/guides/test/migrate-from-jest.mdx +125 -0
  156. package/docs/guides/test/mock-clock.mdx +50 -0
  157. package/docs/guides/test/mock-functions.mdx +70 -0
  158. package/docs/guides/test/rerun-each.mdx +16 -0
  159. package/docs/guides/test/run-tests.mdx +116 -0
  160. package/docs/guides/test/skip-tests.mdx +43 -0
  161. package/docs/guides/test/snapshot.mdx +102 -0
  162. package/docs/guides/test/spy-on.mdx +49 -0
  163. package/docs/guides/test/svelte-test.mdx +113 -0
  164. package/docs/guides/test/testing-library.mdx +93 -0
  165. package/docs/guides/test/timeout.mdx +17 -0
  166. package/docs/guides/test/todo-tests.mdx +74 -0
  167. package/docs/guides/test/update-snapshots.mdx +49 -0
  168. package/docs/guides/test/watch-mode.mdx +24 -0
  169. package/docs/guides/util/base64.mdx +17 -0
  170. package/docs/guides/util/deep-equals.mdx +41 -0
  171. package/docs/guides/util/deflate.mdx +20 -0
  172. package/docs/guides/util/detect-bun.mdx +25 -0
  173. package/docs/guides/util/entrypoint.mdx +19 -0
  174. package/docs/guides/util/escape-html.mdx +24 -0
  175. package/docs/guides/util/file-url-to-path.mdx +16 -0
  176. package/docs/guides/util/gzip.mdx +20 -0
  177. package/docs/guides/util/hash-a-password.mdx +56 -0
  178. package/docs/guides/util/import-meta-dir.mdx +15 -0
  179. package/docs/guides/util/import-meta-file.mdx +15 -0
  180. package/docs/guides/util/import-meta-path.mdx +15 -0
  181. package/docs/guides/util/javascript-uuid.mdx +25 -0
  182. package/docs/guides/util/main.mdx +43 -0
  183. package/docs/guides/util/path-to-file-url.mdx +16 -0
  184. package/docs/guides/util/sleep.mdx +24 -0
  185. package/docs/guides/util/version.mdx +23 -0
  186. package/docs/guides/util/which-path-to-executable-bin.mdx +17 -0
  187. package/docs/guides/websocket/compression.mdx +33 -0
  188. package/docs/guides/websocket/context.mdx +74 -0
  189. package/docs/guides/websocket/pubsub.mdx +40 -0
  190. package/docs/guides/websocket/simple.mdx +35 -0
  191. package/docs/guides/write-file/append.mdx +54 -0
  192. package/docs/guides/write-file/basic.mdx +46 -0
  193. package/docs/guides/write-file/blob.mdx +30 -0
  194. package/docs/guides/write-file/cat.mdx +19 -0
  195. package/docs/guides/write-file/file-cp.mdx +18 -0
  196. package/docs/guides/write-file/filesink.mdx +54 -0
  197. package/docs/guides/write-file/response.mdx +19 -0
  198. package/docs/guides/write-file/stdout.mdx +23 -0
  199. package/docs/guides/write-file/stream.mdx +19 -0
  200. package/docs/guides/write-file/unlink.mdx +18 -0
  201. package/docs/index.mdx +133 -0
  202. package/docs/installation.mdx +365 -0
  203. package/docs/pm/bunx.mdx +83 -0
  204. package/docs/pm/catalogs.mdx +292 -0
  205. package/docs/pm/cli/add.mdx +179 -0
  206. package/docs/pm/cli/audit.mdx +60 -0
  207. package/docs/pm/cli/install.mdx +471 -0
  208. package/docs/pm/cli/link.mdx +48 -0
  209. package/docs/pm/cli/outdated.mdx +197 -0
  210. package/docs/pm/cli/patch.mdx +69 -0
  211. package/docs/pm/cli/pm.mdx +319 -0
  212. package/docs/pm/cli/publish.mdx +123 -0
  213. package/docs/pm/cli/remove.mdx +16 -0
  214. package/docs/pm/cli/update.mdx +140 -0
  215. package/docs/pm/cli/why.mdx +84 -0
  216. package/docs/pm/filter.mdx +102 -0
  217. package/docs/pm/global-cache.mdx +72 -0
  218. package/docs/pm/isolated-installs.mdx +205 -0
  219. package/docs/pm/lifecycle.mdx +57 -0
  220. package/docs/pm/lockfile.mdx +64 -0
  221. package/docs/pm/npmrc.mdx +111 -0
  222. package/docs/pm/overrides.mdx +83 -0
  223. package/docs/pm/scopes-registries.mdx +35 -0
  224. package/docs/pm/security-scanner-api.mdx +95 -0
  225. package/docs/pm/workspaces.mdx +109 -0
  226. package/docs/project/benchmarking.mdx +218 -0
  227. package/docs/project/bindgen.mdx +223 -0
  228. package/docs/project/building-windows.mdx +133 -0
  229. package/docs/project/contributing.mdx +343 -0
  230. package/docs/project/feedback.mdx +20 -0
  231. package/docs/project/license.mdx +78 -0
  232. package/docs/project/roadmap.mdx +8 -0
  233. package/docs/quickstart.mdx +240 -0
  234. package/docs/runtime/auto-install.mdx +97 -0
  235. package/docs/runtime/binary-data.mdx +846 -0
  236. package/docs/runtime/bun-apis.mdx +59 -0
  237. package/docs/runtime/bunfig.mdx +642 -0
  238. package/docs/runtime/c-compiler.mdx +204 -0
  239. package/docs/runtime/child-process.mdx +532 -0
  240. package/docs/runtime/color.mdx +267 -0
  241. package/docs/runtime/console.mdx +67 -0
  242. package/docs/runtime/cookies.mdx +454 -0
  243. package/docs/runtime/debugger.mdx +335 -0
  244. package/docs/runtime/environment-variables.mdx +214 -0
  245. package/docs/runtime/ffi.mdx +565 -0
  246. package/docs/runtime/file-io.mdx +306 -0
  247. package/docs/runtime/file-system-router.mdx +118 -0
  248. package/docs/runtime/file-types.mdx +354 -0
  249. package/docs/runtime/glob.mdx +181 -0
  250. package/docs/runtime/globals.mdx +72 -0
  251. package/docs/runtime/hashing.mdx +315 -0
  252. package/docs/runtime/html-rewriter.mdx +340 -0
  253. package/docs/runtime/http/cookies.mdx +79 -0
  254. package/docs/runtime/http/error-handling.mdx +40 -0
  255. package/docs/runtime/http/metrics.mdx +36 -0
  256. package/docs/runtime/http/routing.mdx +289 -0
  257. package/docs/runtime/http/server.mdx +647 -0
  258. package/docs/runtime/http/tls.mdx +101 -0
  259. package/docs/runtime/http/websockets.mdx +404 -0
  260. package/docs/runtime/index.mdx +223 -0
  261. package/docs/runtime/jsx.mdx +115 -0
  262. package/docs/runtime/module-resolution.mdx +342 -0
  263. package/docs/runtime/networking/dns.mdx +111 -0
  264. package/docs/runtime/networking/fetch.mdx +468 -0
  265. package/docs/runtime/networking/tcp.mdx +239 -0
  266. package/docs/runtime/networking/udp.mdx +129 -0
  267. package/docs/runtime/node-api.mdx +19 -0
  268. package/docs/runtime/nodejs-compat.mdx +468 -0
  269. package/docs/runtime/plugins.mdx +405 -0
  270. package/docs/runtime/redis.mdx +582 -0
  271. package/docs/runtime/s3.mdx +863 -0
  272. package/docs/runtime/secrets.mdx +336 -0
  273. package/docs/runtime/semver.mdx +57 -0
  274. package/docs/runtime/shell.mdx +637 -0
  275. package/docs/runtime/sql.mdx +1404 -0
  276. package/docs/runtime/sqlite.mdx +699 -0
  277. package/docs/runtime/streams.mdx +232 -0
  278. package/docs/runtime/templating/create.mdx +269 -0
  279. package/docs/runtime/templating/init.mdx +58 -0
  280. package/docs/runtime/transpiler.mdx +288 -0
  281. package/docs/runtime/typescript.mdx +58 -0
  282. package/docs/runtime/utils.mdx +922 -0
  283. package/docs/runtime/watch-mode.mdx +161 -0
  284. package/docs/runtime/web-apis.mdx +29 -0
  285. package/docs/runtime/workers.mdx +328 -0
  286. package/docs/runtime/yaml.mdx +469 -0
  287. package/docs/snippets/cli/add.mdx +166 -0
  288. package/docs/snippets/cli/build.mdx +196 -0
  289. package/docs/snippets/cli/feedback.mdx +17 -0
  290. package/docs/snippets/cli/init.mdx +84 -0
  291. package/docs/snippets/cli/install.mdx +173 -0
  292. package/docs/snippets/cli/link.mdx +163 -0
  293. package/docs/snippets/cli/outdated.mdx +140 -0
  294. package/docs/snippets/cli/patch.mdx +171 -0
  295. package/docs/snippets/cli/publish.mdx +198 -0
  296. package/docs/snippets/cli/remove.mdx +146 -0
  297. package/docs/snippets/cli/run.mdx +293 -0
  298. package/docs/snippets/cli/test.mdx +100 -0
  299. package/docs/snippets/cli/update.mdx +144 -0
  300. package/docs/snippets/product-card.mdx +32 -0
  301. package/docs/snippets/product-tiles.mdx +94 -0
  302. package/docs/test/code-coverage.mdx +409 -0
  303. package/docs/test/configuration.mdx +467 -0
  304. package/docs/test/dates-times.mdx +129 -0
  305. package/docs/test/discovery.mdx +90 -0
  306. package/docs/test/dom.mdx +226 -0
  307. package/docs/test/index.mdx +380 -0
  308. package/docs/test/lifecycle.mdx +348 -0
  309. package/docs/test/mocks.mdx +637 -0
  310. package/docs/test/reporters.mdx +117 -0
  311. package/docs/test/runtime-behavior.mdx +342 -0
  312. package/docs/test/snapshots.mdx +434 -0
  313. package/docs/test/writing-tests.mdx +635 -0
  314. package/docs/typescript.mdx +54 -0
  315. package/package.json +8 -6
  316. package/test.d.ts +2 -2
@@ -0,0 +1,642 @@
1
+ ---
2
+ title: "bunfig.toml"
3
+ description: "Configure Bun's behavior using its configuration file bunfig.toml"
4
+ ---
5
+
6
+ Bun's behavior can be configured using its configuration file, `bunfig.toml`.
7
+
8
+ 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.
9
+
10
+ ## Global vs. local
11
+
12
+ In general, it's recommended to add a `bunfig.toml` file to your project root, alongside your `package.json`.
13
+
14
+ To configure Bun globally, you can also create a `.bunfig.toml` file at one of the following paths:
15
+
16
+ - `$HOME/.bunfig.toml`
17
+ - `$XDG_CONFIG_HOME/.bunfig.toml`
18
+
19
+ 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.
20
+
21
+ ## Runtime
22
+
23
+ Bun's runtime behavior is configured using top-level fields in the `bunfig.toml` file.
24
+
25
+ ### `preload`
26
+
27
+ An array of scripts/plugins to execute before running a file or script.
28
+
29
+ ```toml title="bunfig.toml" icon="settings"
30
+ # scripts to run before `bun run`-ing a file or script
31
+ # register plugins by adding them to this list
32
+ preload = ["./preload.ts"]
33
+ ```
34
+
35
+ ### `jsx`
36
+
37
+ 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.
38
+
39
+ ```toml title="bunfig.toml" icon="settings"
40
+ jsx = "react"
41
+ jsxFactory = "h"
42
+ jsxFragment = "Fragment"
43
+ jsxImportSource = "react"
44
+ ```
45
+
46
+ Refer to the tsconfig docs for more information on these fields.
47
+
48
+ - [`jsx`](https://www.typescriptlang.org/tsconfig#jsx)
49
+ - [`jsxFactory`](https://www.typescriptlang.org/tsconfig#jsxFactory)
50
+ - [`jsxFragment`](https://www.typescriptlang.org/tsconfig#jsxFragment)
51
+ - [`jsxImportSource`](https://www.typescriptlang.org/tsconfig#jsxImportSource)
52
+
53
+ ### `smol`
54
+
55
+ Enable `smol` mode. This reduces memory usage at the cost of performance.
56
+
57
+ ```toml title="bunfig.toml" icon="settings"
58
+ # Reduce memory usage at the cost of performance
59
+ smol = true
60
+ ```
61
+
62
+ ### `logLevel`
63
+
64
+ Set the log level. This can be one of `"debug"`, `"warn"`, or `"error"`.
65
+
66
+ ```toml title="bunfig.toml" icon="settings"
67
+ logLevel = "debug" # "debug" | "warn" | "error"
68
+ ```
69
+
70
+ ### `define`
71
+
72
+ 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.
73
+
74
+ ```toml title="bunfig.toml" icon="settings"
75
+ [define]
76
+ # Replace any usage of "process.env.bagel" with the string `lox`.
77
+ # The values are parsed as JSON, except single-quoted strings are supported and `'undefined'` becomes `undefined` in JS.
78
+ # This will probably change in a future release to be just regular TOML instead. It is a holdover from the CLI argument parsing.
79
+ "process.env.bagel" = "'lox'"
80
+ ```
81
+
82
+ ### `loader`
83
+
84
+ Configure how Bun maps file extensions to loaders. This is useful for loading files that aren't natively supported by Bun.
85
+
86
+ ```toml title="bunfig.toml" icon="settings"
87
+ [loader]
88
+ # when a .bagel file is imported, treat it like a tsx file
89
+ ".bagel" = "tsx"
90
+ ```
91
+
92
+ Bun supports the following loaders:
93
+
94
+ - `jsx`
95
+ - `js`
96
+ - `ts`
97
+ - `tsx`
98
+ - `css`
99
+ - `file`
100
+ - `json`
101
+ - `toml`
102
+ - `wasm`
103
+ - `napi`
104
+ - `base64`
105
+ - `dataurl`
106
+ - `text`
107
+
108
+ ### `telemetry`
109
+
110
+ 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.
111
+
112
+ ```toml title="bunfig.toml" icon="settings"
113
+ telemetry = false
114
+ ```
115
+
116
+ ### `console`
117
+
118
+ Configure console output behavior.
119
+
120
+ #### `console.depth`
121
+
122
+ Set the default depth for `console.log()` object inspection. Default `2`.
123
+
124
+ ```toml title="bunfig.toml" icon="settings"
125
+ [console]
126
+ depth = 3
127
+ ```
128
+
129
+ 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.
130
+
131
+ ## Test runner
132
+
133
+ The test runner is configured under the `[test]` section of your bunfig.toml.
134
+
135
+ ```toml title="bunfig.toml" icon="settings"
136
+ [test]
137
+ # configuration goes here
138
+ ```
139
+
140
+ ### `test.root`
141
+
142
+ The root directory to run tests from. Default `.`.
143
+
144
+ ```toml title="bunfig.toml" icon="settings"
145
+ [test]
146
+ root = "./__tests__"
147
+ ```
148
+
149
+ ### `test.preload`
150
+
151
+ Same as the top-level `preload` field, but only applies to `bun test`.
152
+
153
+ ```toml title="bunfig.toml" icon="settings"
154
+ [test]
155
+ preload = ["./setup.ts"]
156
+ ```
157
+
158
+ ### `test.smol`
159
+
160
+ Same as the top-level `smol` field, but only applies to `bun test`.
161
+
162
+ ```toml title="bunfig.toml" icon="settings"
163
+ [test]
164
+ smol = true
165
+ ```
166
+
167
+ ### `test.coverage`
168
+
169
+ Enables coverage reporting. Default `false`. Use `--coverage` to override.
170
+
171
+ ```toml title="bunfig.toml" icon="settings"
172
+ [test]
173
+ coverage = false
174
+ ```
175
+
176
+ ### `test.coverageThreshold`
177
+
178
+ 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.
179
+
180
+ ```toml title="bunfig.toml" icon="settings"
181
+ [test]
182
+
183
+ # to require 90% line-level and function-level coverage
184
+ coverageThreshold = 0.9
185
+ ```
186
+
187
+ Different thresholds can be specified for line-wise, function-wise, and statement-wise coverage.
188
+
189
+ ```toml title="bunfig.toml" icon="settings"
190
+ [test]
191
+ coverageThreshold = { line = 0.7, function = 0.8, statement = 0.9 }
192
+ ```
193
+
194
+ ### `test.coverageSkipTestFiles`
195
+
196
+ Whether to skip test files when computing coverage statistics. Default `false`.
197
+
198
+ ```toml title="bunfig.toml" icon="settings"
199
+ [test]
200
+ coverageSkipTestFiles = false
201
+ ```
202
+
203
+ ### `test.coveragePathIgnorePatterns`
204
+
205
+ Exclude specific files or file patterns from coverage reports using glob patterns. Can be a single string pattern or an array of patterns.
206
+
207
+ ```toml title="bunfig.toml" icon="settings"
208
+ [test]
209
+ # Single pattern
210
+ coveragePathIgnorePatterns = "**/*.spec.ts"
211
+
212
+ # Multiple patterns
213
+ coveragePathIgnorePatterns = [
214
+ "**/*.spec.ts",
215
+ "**/*.test.ts",
216
+ "src/utils/**",
217
+ "*.config.js"
218
+ ]
219
+ ```
220
+
221
+ ### `test.coverageReporter`
222
+
223
+ By default, coverage reports will be printed to the console. For persistent code coverage reports in CI environments and for other tools use `lcov`.
224
+
225
+ ```toml title="bunfig.toml" icon="settings"
226
+ [test]
227
+ coverageReporter = ["text", "lcov"] # default ["text"]
228
+ ```
229
+
230
+ ### `test.coverageDir`
231
+
232
+ Set path where coverage reports will be saved. Please notice, that it works only for persistent `coverageReporter` like `lcov`.
233
+
234
+ ```toml title="bunfig.toml" icon="settings"
235
+ [test]
236
+ coverageDir = "path/to/somewhere" # default "coverage"
237
+ ```
238
+
239
+ ### `test.randomize`
240
+
241
+ Run tests in random order. Default `false`.
242
+
243
+ ```toml title="bunfig.toml" icon="settings"
244
+ [test]
245
+ randomize = true
246
+ ```
247
+
248
+ 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.
249
+
250
+ The `--randomize` CLI flag will override this setting when specified.
251
+
252
+ ### `test.seed`
253
+
254
+ Set the random seed for test randomization. This option requires `randomize` to be `true`.
255
+
256
+ ```toml title="bunfig.toml" icon="settings"
257
+ [test]
258
+ randomize = true
259
+ seed = 2444615283
260
+ ```
261
+
262
+ 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.
263
+
264
+ The `--seed` CLI flag will override this setting when specified.
265
+
266
+ ### `test.rerunEach`
267
+
268
+ Re-run each test file a specified number of times. Default `0` (run once).
269
+
270
+ ```toml title="bunfig.toml" icon="settings"
271
+ [test]
272
+ rerunEach = 3
273
+ ```
274
+
275
+ This is useful for catching flaky tests or non-deterministic behavior. Each test file will be executed the specified number of times.
276
+
277
+ The `--rerun-each` CLI flag will override this setting when specified.
278
+
279
+ ## Package manager
280
+
281
+ 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.
282
+
283
+ ```toml title="bunfig.toml" icon="settings"
284
+ [install]
285
+ # configuration here
286
+ ```
287
+
288
+ ### `install.optional`
289
+
290
+ Whether to install optional dependencies. Default `true`.
291
+
292
+ ```toml title="bunfig.toml" icon="settings"
293
+ [install]
294
+ optional = true
295
+ ```
296
+
297
+ ### `install.dev`
298
+
299
+ Whether to install development dependencies. Default `true`.
300
+
301
+ ```toml title="bunfig.toml" icon="settings"
302
+ [install]
303
+ dev = true
304
+ ```
305
+
306
+ ### `install.peer`
307
+
308
+ Whether to install peer dependencies. Default `true`.
309
+
310
+ ```toml title="bunfig.toml" icon="settings"
311
+ [install]
312
+ peer = true
313
+ ```
314
+
315
+ ### `install.production`
316
+
317
+ Whether `bun install` will run in "production mode". Default `false`.
318
+
319
+ In production mode, `"devDependencies"` are not installed. You can use `--production` in the CLI to override this setting.
320
+
321
+ ```toml title="bunfig.toml" icon="settings"
322
+ [install]
323
+ production = false
324
+ ```
325
+
326
+ ### `install.exact`
327
+
328
+ Whether to set an exact version in `package.json`. Default `false`.
329
+
330
+ 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.
331
+
332
+ ```toml title="bunfig.toml" icon="settings"
333
+ [install]
334
+ exact = false
335
+ ```
336
+
337
+ ### `install.saveTextLockfile`
338
+
339
+ If false, generate a binary `bun.lockb` instead of a text-based `bun.lock` file when running `bun install` and no lockfile is present.
340
+
341
+ Default `true` (since Bun v1.2).
342
+
343
+ ```toml title="bunfig.toml" icon="settings"
344
+ [install]
345
+ saveTextLockfile = false
346
+ ```
347
+
348
+ ### `install.auto`
349
+
350
+ 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.
351
+
352
+ ```toml title="bunfig.toml" icon="settings"
353
+ [install]
354
+ auto = "auto"
355
+ ```
356
+
357
+ Valid values are:
358
+
359
+ | Value | Description |
360
+ | ------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
361
+ | `"auto"` | Resolve modules from local `node_modules` if it exists. Otherwise, auto-install dependencies on the fly. |
362
+ | `"force"` | Always auto-install dependencies, even if `node_modules` exists. |
363
+ | `"disable"` | Never auto-install dependencies. |
364
+ | `"fallback"` | Check local `node_modules` first, then auto-install any packages that aren't found. You can enable this from the CLI with `bun -i`. |
365
+
366
+ ### `install.frozenLockfile`
367
+
368
+ 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.
369
+
370
+ ```toml title="bunfig.toml" icon="settings"
371
+ [install]
372
+ frozenLockfile = false
373
+ ```
374
+
375
+ ### `install.dryRun`
376
+
377
+ Whether `bun install` will actually install dependencies. Default `false`. When true, it's equivalent to setting `--dry-run` on all `bun install` commands.
378
+
379
+ ```toml title="bunfig.toml" icon="settings"
380
+ [install]
381
+ dryRun = false
382
+ ```
383
+
384
+ ### `install.globalDir`
385
+
386
+ To configure the directory where Bun puts globally installed packages.
387
+
388
+ Environment variable: `BUN_INSTALL_GLOBAL_DIR`
389
+
390
+ ```toml title="bunfig.toml" icon="settings"
391
+ [install]
392
+ # where `bun install --global` installs packages
393
+ globalDir = "~/.bun/install/global"
394
+ ```
395
+
396
+ ### `install.globalBinDir`
397
+
398
+ To configure the directory where Bun installs globally installed binaries and CLIs.
399
+
400
+ Environment variable: `BUN_INSTALL_BIN`
401
+
402
+ ```toml title="bunfig.toml" icon="settings"
403
+ # where globally-installed package bins are linked
404
+ globalBinDir = "~/.bun/bin"
405
+ ```
406
+
407
+ ### `install.registry`
408
+
409
+ The default registry is `https://registry.npmjs.org/`. This can be globally configured in `bunfig.toml`:
410
+
411
+ ```toml title="bunfig.toml" icon="settings"
412
+ [install]
413
+ # set default registry as a string
414
+ registry = "https://registry.npmjs.org"
415
+ # set a token
416
+ registry = { url = "https://registry.npmjs.org", token = "123456" }
417
+ # set a username/password
418
+ registry = "https://username:password@registry.npmjs.org"
419
+ ```
420
+
421
+ ### `install.linkWorkspacePackages`
422
+
423
+ To configure how workspace packages are linked, use the `install.linkWorkspacePackages` option.
424
+
425
+ Whether to link workspace packages from the monorepo root to their respective `node_modules` directories. Default `true`.
426
+
427
+ ```toml title="bunfig.toml" icon="settings"
428
+ [install]
429
+ linkWorkspacePackages = true
430
+ ```
431
+
432
+ ### `install.scopes`
433
+
434
+ To configure a registry for a particular scope (e.g. `@myorg/<package>`) use `install.scopes`. You can reference environment variables with `$variable` notation.
435
+
436
+ ```toml title="bunfig.toml" icon="settings"
437
+ [install.scopes]
438
+ # registry as string
439
+ myorg = "https://username:password@registry.myorg.com/"
440
+
441
+ # registry with username/password
442
+ # you can reference environment variables
443
+ myorg = { username = "myusername", password = "$npm_password", url = "https://registry.myorg.com/" }
444
+
445
+ # registry with token
446
+ myorg = { token = "$npm_token", url = "https://registry.myorg.com/" }
447
+ ```
448
+
449
+ ### `install.ca` and `install.cafile`
450
+
451
+ To configure a CA certificate, use `install.ca` or `install.cafile` to specify a path to a CA certificate file.
452
+
453
+ ```toml title="bunfig.toml" icon="settings"
454
+ [install]
455
+ # The CA certificate as a string
456
+ ca = "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
457
+
458
+ # A path to a CA certificate file. The file can contain multiple certificates.
459
+ cafile = "path/to/cafile"
460
+ ```
461
+
462
+ ### `install.cache`
463
+
464
+ To configure the cache behavior:
465
+
466
+ ```toml title="bunfig.toml" icon="settings"
467
+ [install.cache]
468
+
469
+ # the directory to use for the cache
470
+ dir = "~/.bun/install/cache"
471
+
472
+ # when true, don't load from the global cache.
473
+ # Bun may still write to node_modules/.cache
474
+ disable = false
475
+
476
+ # when true, always resolve the latest versions from the registry
477
+ disableManifest = false
478
+ ```
479
+
480
+ ### `install.lockfile`
481
+
482
+ To configure lockfile behavior, use the `install.lockfile` section.
483
+
484
+ Whether to generate a lockfile on `bun install`. Default `true`.
485
+
486
+ ```toml title="bunfig.toml" icon="settings"
487
+ [install.lockfile]
488
+ save = true
489
+ ```
490
+
491
+ Whether to generate a non-Bun lockfile alongside `bun.lock`. (A `bun.lock` will always be created.) Currently `"yarn"` is the only supported value.
492
+
493
+ ```toml title="bunfig.toml" icon="settings"
494
+ [install.lockfile]
495
+ print = "yarn"
496
+ ```
497
+
498
+ ### `install.linker`
499
+
500
+ Configure the default linker strategy. Default `"hoisted"` for single-project projects, `"isolated"` for monorepo projects.
501
+
502
+ For complete documentation refer to [Package manager > Isolated installs](/pm/isolated-installs).
503
+
504
+ ```toml title="bunfig.toml" icon="settings"
505
+ [install]
506
+ linker = "hoisted"
507
+ ```
508
+
509
+ Valid values are:
510
+
511
+ | Value | Description |
512
+ | ------------ | ------------------------------------------------------- |
513
+ | `"hoisted"` | Link dependencies in a shared `node_modules` directory. |
514
+ | `"isolated"` | Link dependencies inside each package installation. |
515
+
516
+ ```toml title="bunfig.toml" icon="settings"
517
+ [debug]
518
+ # When navigating to a blob: or src: link, open the file in your editor
519
+ # If not, it tries $EDITOR or $VISUAL
520
+ # If that still fails, it will try Visual Studio Code, then Sublime Text, then a few others
521
+ # This is used by Bun.openInEditor()
522
+ editor = "code"
523
+
524
+ # List of editors:
525
+ # - "subl", "sublime"
526
+ # - "vscode", "code"
527
+ # - "textmate", "mate"
528
+ # - "idea"
529
+ # - "webstorm"
530
+ # - "nvim", "neovim"
531
+ # - "vim","vi"
532
+ # - "emacs"
533
+ ```
534
+
535
+ ### `install.minimumReleaseAge`
536
+
537
+ 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).
538
+
539
+ ```toml title="bunfig.toml" icon="settings"
540
+ [install]
541
+ # Only install package versions published at least 3 days ago
542
+ minimumReleaseAge = 259200
543
+ # These packages will bypass the 3-day minimum age requirement
544
+ minimumReleaseAgeExcludes = ["@types/bun", "typescript"]
545
+ ```
546
+
547
+ For more details see [Minimum release age](/pm/cli/install#minimum-release-age) in the install documentation.
548
+
549
+ ## `bun run`
550
+
551
+ 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.
552
+
553
+ 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.
554
+
555
+ ### `run.shell` - use the system shell or Bun's shell
556
+
557
+ 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"`.
558
+
559
+ To always use the system shell instead of Bun's shell (default behavior unless Windows):
560
+
561
+ ```toml title="bunfig.toml" icon="settings"
562
+ [run]
563
+ # default outside of Windows
564
+ shell = "system"
565
+ ```
566
+
567
+ To always use Bun's shell instead of the system shell:
568
+
569
+ ```toml title="bunfig.toml" icon="settings"
570
+ [run]
571
+ # default on Windows
572
+ shell = "bun"
573
+ ```
574
+
575
+ ### `run.bun` - auto alias `node` to `bun`
576
+
577
+ 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`.
578
+
579
+ 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.
580
+
581
+ By default, this is enabled if `node` is not already in your `$PATH`.
582
+
583
+ ```toml title="bunfig.toml" icon="settings"
584
+ [run]
585
+ # equivalent to `bun --bun` for all `bun run` commands
586
+ bun = true
587
+ ```
588
+
589
+ You can test this by running:
590
+
591
+ ```sh
592
+ bun --bun which node # /path/to/bun
593
+ bun which node # /path/to/node
594
+ ```
595
+
596
+ This option is equivalent to prefixing all `bun run` commands with `--bun`:
597
+
598
+ ```sh
599
+ bun --bun run dev
600
+ bun --bun dev
601
+ bun run --bun dev
602
+ ```
603
+
604
+ If set to `false`, this will disable the `node` symlink.
605
+
606
+ ### `run.silent` - suppress reporting the command being run
607
+
608
+ When `true`, suppresses the output of the command being run by `bun run` or `bun`.
609
+
610
+ ```toml title="bunfig.toml" icon="settings"
611
+ [run]
612
+ silent = true
613
+ ```
614
+
615
+ Without this option, the command being run will be printed to the console:
616
+
617
+ ```sh terminal icon="terminal"
618
+ bun run dev
619
+ echo "Running \"dev\"..."
620
+ ```
621
+
622
+ ```txt
623
+ Running "dev"...
624
+ ```
625
+
626
+ With this option, the command being run will not be printed to the console:
627
+
628
+ ```sh
629
+ bun run dev
630
+ ```
631
+
632
+ ```txt
633
+ Running "dev"...
634
+ ```
635
+
636
+ This is equivalent to passing `--silent` to all `bun run` commands:
637
+
638
+ ```sh
639
+ bun --silent run dev
640
+ bun --silent dev
641
+ bun run --silent dev
642
+ ```