bun-types 1.3.3 → 1.3.4-canary.20251123T140630

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 (220) hide show
  1. package/CLAUDE.md +3 -3
  2. package/docs/bundler/css.mdx +1 -1
  3. package/docs/bundler/executables.mdx +33 -4
  4. package/docs/bundler/fullstack.mdx +3 -3
  5. package/docs/bundler/hot-reloading.mdx +2 -2
  6. package/docs/bundler/html-static.mdx +10 -9
  7. package/docs/bundler/index.mdx +27 -18
  8. package/docs/bundler/loaders.mdx +2 -2
  9. package/docs/bundler/macros.mdx +1 -1
  10. package/docs/feedback.mdx +2 -12
  11. package/docs/guides/binary/arraybuffer-to-array.mdx +1 -1
  12. package/docs/guides/binary/arraybuffer-to-blob.mdx +1 -1
  13. package/docs/guides/binary/arraybuffer-to-buffer.mdx +1 -1
  14. package/docs/guides/binary/arraybuffer-to-string.mdx +1 -1
  15. package/docs/guides/binary/arraybuffer-to-typedarray.mdx +1 -1
  16. package/docs/guides/binary/blob-to-arraybuffer.mdx +1 -1
  17. package/docs/guides/binary/blob-to-dataview.mdx +1 -1
  18. package/docs/guides/binary/blob-to-stream.mdx +1 -1
  19. package/docs/guides/binary/blob-to-string.mdx +1 -1
  20. package/docs/guides/binary/blob-to-typedarray.mdx +1 -1
  21. package/docs/guides/binary/buffer-to-arraybuffer.mdx +1 -1
  22. package/docs/guides/binary/buffer-to-blob.mdx +1 -1
  23. package/docs/guides/binary/buffer-to-readablestream.mdx +1 -1
  24. package/docs/guides/binary/buffer-to-string.mdx +1 -1
  25. package/docs/guides/binary/buffer-to-typedarray.mdx +1 -1
  26. package/docs/guides/binary/dataview-to-string.mdx +1 -1
  27. package/docs/guides/binary/typedarray-to-arraybuffer.mdx +1 -1
  28. package/docs/guides/binary/typedarray-to-blob.mdx +1 -1
  29. package/docs/guides/binary/typedarray-to-buffer.mdx +1 -1
  30. package/docs/guides/binary/typedarray-to-dataview.mdx +1 -1
  31. package/docs/guides/binary/typedarray-to-readablestream.mdx +1 -1
  32. package/docs/guides/binary/typedarray-to-string.mdx +1 -1
  33. package/docs/guides/deployment/aws-lambda.mdx +6 -6
  34. package/docs/guides/deployment/digital-ocean.mdx +7 -7
  35. package/docs/guides/deployment/vercel.mdx +1 -3
  36. package/docs/guides/ecosystem/discordjs.mdx +2 -2
  37. package/docs/guides/ecosystem/express.mdx +2 -2
  38. package/docs/guides/ecosystem/mongoose.mdx +1 -1
  39. package/docs/guides/ecosystem/neon-drizzle.mdx +2 -2
  40. package/docs/guides/ecosystem/neon-serverless-postgres.mdx +2 -2
  41. package/docs/guides/ecosystem/nuxt.mdx +1 -1
  42. package/docs/guides/ecosystem/prisma-postgres.mdx +1 -1
  43. package/docs/guides/ecosystem/prisma.mdx +1 -1
  44. package/docs/guides/ecosystem/qwik.mdx +4 -4
  45. package/docs/guides/ecosystem/sentry.mdx +2 -2
  46. package/docs/guides/ecosystem/sveltekit.mdx +1 -1
  47. package/docs/guides/ecosystem/tanstack-start.mdx +0 -1
  48. package/docs/guides/ecosystem/upstash.mdx +2 -2
  49. package/docs/guides/ecosystem/vite.mdx +2 -2
  50. package/docs/guides/html-rewriter/extract-links.mdx +2 -2
  51. package/docs/guides/html-rewriter/extract-social-meta.mdx +1 -1
  52. package/docs/guides/http/file-uploads.mdx +1 -1
  53. package/docs/guides/http/hot.mdx +1 -1
  54. package/docs/guides/http/server.mdx +1 -1
  55. package/docs/guides/http/simple.mdx +1 -1
  56. package/docs/guides/http/stream-file.mdx +3 -3
  57. package/docs/guides/http/tls.mdx +1 -1
  58. package/docs/guides/install/add-dev.mdx +1 -1
  59. package/docs/guides/install/add-git.mdx +1 -1
  60. package/docs/guides/install/add-optional.mdx +1 -1
  61. package/docs/guides/install/add-peer.mdx +3 -3
  62. package/docs/guides/install/add-tarball.mdx +1 -1
  63. package/docs/guides/install/add.mdx +1 -1
  64. package/docs/guides/install/azure-artifacts.mdx +3 -3
  65. package/docs/guides/install/custom-registry.mdx +2 -2
  66. package/docs/guides/install/from-npm-install-to-bun-install.mdx +1 -1
  67. package/docs/guides/install/git-diff-bun-lockfile.mdx +2 -1
  68. package/docs/guides/install/npm-alias.mdx +1 -1
  69. package/docs/guides/install/registry-scope.mdx +3 -3
  70. package/docs/guides/install/trusted.mdx +1 -1
  71. package/docs/guides/install/workspaces.mdx +1 -1
  72. package/docs/guides/install/yarnlock.mdx +4 -3
  73. package/docs/guides/process/ctrl-c.mdx +1 -1
  74. package/docs/guides/process/ipc.mdx +2 -2
  75. package/docs/guides/process/nanoseconds.mdx +1 -1
  76. package/docs/guides/process/os-signals.mdx +1 -1
  77. package/docs/guides/process/spawn-stderr.mdx +2 -2
  78. package/docs/guides/process/spawn-stdout.mdx +2 -2
  79. package/docs/guides/process/spawn.mdx +2 -2
  80. package/docs/guides/process/stdin.mdx +1 -1
  81. package/docs/guides/read-file/arraybuffer.mdx +2 -2
  82. package/docs/guides/read-file/buffer.mdx +1 -1
  83. package/docs/guides/read-file/exists.mdx +1 -1
  84. package/docs/guides/read-file/mime.mdx +1 -1
  85. package/docs/guides/read-file/stream.mdx +1 -1
  86. package/docs/guides/read-file/uint8array.mdx +1 -1
  87. package/docs/guides/read-file/watch.mdx +1 -1
  88. package/docs/guides/runtime/build-time-constants.mdx +3 -3
  89. package/docs/guides/runtime/cicd.mdx +1 -1
  90. package/docs/guides/runtime/codesign-macos-executable.mdx +1 -1
  91. package/docs/guides/runtime/delete-directory.mdx +1 -1
  92. package/docs/guides/runtime/delete-file.mdx +1 -1
  93. package/docs/guides/runtime/heap-snapshot.mdx +1 -1
  94. package/docs/guides/runtime/import-json.mdx +1 -1
  95. package/docs/guides/runtime/import-toml.mdx +1 -1
  96. package/docs/guides/runtime/import-yaml.mdx +1 -1
  97. package/docs/guides/runtime/read-env.mdx +1 -1
  98. package/docs/guides/runtime/set-env.mdx +2 -2
  99. package/docs/guides/runtime/shell.mdx +1 -1
  100. package/docs/guides/runtime/tsconfig-paths.mdx +1 -1
  101. package/docs/guides/runtime/typescript.mdx +1 -1
  102. package/docs/guides/runtime/vscode-debugger.mdx +1 -2
  103. package/docs/guides/runtime/web-debugger.mdx +1 -1
  104. package/docs/guides/streams/to-array.mdx +1 -1
  105. package/docs/guides/streams/to-arraybuffer.mdx +1 -1
  106. package/docs/guides/streams/to-blob.mdx +1 -1
  107. package/docs/guides/streams/to-buffer.mdx +1 -1
  108. package/docs/guides/streams/to-json.mdx +1 -1
  109. package/docs/guides/streams/to-string.mdx +1 -1
  110. package/docs/guides/streams/to-typedarray.mdx +1 -1
  111. package/docs/guides/test/bail.mdx +1 -1
  112. package/docs/guides/test/concurrent-test-glob.mdx +5 -2
  113. package/docs/guides/test/coverage-threshold.mdx +1 -1
  114. package/docs/guides/test/coverage.mdx +1 -1
  115. package/docs/guides/test/happy-dom.mdx +1 -1
  116. package/docs/guides/test/migrate-from-jest.mdx +7 -7
  117. package/docs/guides/test/mock-clock.mdx +2 -2
  118. package/docs/guides/test/mock-functions.mdx +1 -1
  119. package/docs/guides/test/rerun-each.mdx +1 -1
  120. package/docs/guides/test/run-tests.mdx +2 -2
  121. package/docs/guides/test/skip-tests.mdx +2 -2
  122. package/docs/guides/test/snapshot.mdx +4 -4
  123. package/docs/guides/test/spy-on.mdx +1 -1
  124. package/docs/guides/test/svelte-test.mdx +4 -4
  125. package/docs/guides/test/testing-library.mdx +3 -3
  126. package/docs/guides/test/timeout.mdx +1 -1
  127. package/docs/guides/test/todo-tests.mdx +2 -2
  128. package/docs/guides/test/update-snapshots.mdx +1 -1
  129. package/docs/guides/test/watch-mode.mdx +1 -1
  130. package/docs/guides/util/base64.mdx +1 -1
  131. package/docs/guides/util/deep-equals.mdx +3 -3
  132. package/docs/guides/util/deflate.mdx +1 -1
  133. package/docs/guides/util/entrypoint.mdx +2 -2
  134. package/docs/guides/util/escape-html.mdx +1 -1
  135. package/docs/guides/util/file-url-to-path.mdx +1 -1
  136. package/docs/guides/util/gzip.mdx +1 -1
  137. package/docs/guides/util/hash-a-password.mdx +1 -1
  138. package/docs/guides/util/import-meta-dir.mdx +2 -2
  139. package/docs/guides/util/import-meta-file.mdx +2 -2
  140. package/docs/guides/util/import-meta-path.mdx +2 -2
  141. package/docs/guides/util/javascript-uuid.mdx +2 -2
  142. package/docs/guides/util/main.mdx +1 -1
  143. package/docs/guides/util/path-to-file-url.mdx +1 -1
  144. package/docs/guides/util/sleep.mdx +1 -1
  145. package/docs/guides/util/version.mdx +2 -2
  146. package/docs/guides/util/which-path-to-executable-bin.mdx +1 -1
  147. package/docs/guides/websocket/context.mdx +1 -1
  148. package/docs/guides/websocket/simple.mdx +1 -1
  149. package/docs/guides/write-file/basic.mdx +2 -2
  150. package/docs/guides/write-file/blob.mdx +2 -2
  151. package/docs/guides/write-file/cat.mdx +2 -2
  152. package/docs/guides/write-file/file-cp.mdx +2 -2
  153. package/docs/guides/write-file/filesink.mdx +1 -1
  154. package/docs/guides/write-file/response.mdx +2 -2
  155. package/docs/guides/write-file/stdout.mdx +2 -2
  156. package/docs/guides/write-file/stream.mdx +2 -2
  157. package/docs/guides/write-file/unlink.mdx +1 -1
  158. package/docs/index.mdx +2 -2
  159. package/docs/installation.mdx +3 -3
  160. package/docs/pm/bunx.mdx +2 -2
  161. package/docs/pm/cli/install.mdx +8 -8
  162. package/docs/pm/cli/link.mdx +2 -2
  163. package/docs/pm/cli/outdated.mdx +3 -3
  164. package/docs/pm/cli/patch.mdx +2 -2
  165. package/docs/pm/cli/pm.mdx +1 -1
  166. package/docs/pm/cli/publish.mdx +1 -1
  167. package/docs/pm/filter.mdx +2 -2
  168. package/docs/pm/isolated-installs.mdx +3 -3
  169. package/docs/pm/npmrc.mdx +6 -6
  170. package/docs/pm/scopes-registries.mdx +1 -1
  171. package/docs/pm/security-scanner-api.mdx +2 -2
  172. package/docs/pm/workspaces.mdx +3 -4
  173. package/docs/project/benchmarking.mdx +1 -1
  174. package/docs/project/building-windows.mdx +1 -1
  175. package/docs/project/contributing.mdx +1 -1
  176. package/docs/project/license.mdx +1 -1
  177. package/docs/quickstart.mdx +3 -3
  178. package/docs/runtime/auto-install.mdx +1 -1
  179. package/docs/runtime/binary-data.mdx +1 -1
  180. package/docs/runtime/bun-apis.mdx +35 -35
  181. package/docs/runtime/bunfig.mdx +29 -3
  182. package/docs/runtime/c-compiler.mdx +3 -3
  183. package/docs/runtime/child-process.mdx +2 -2
  184. package/docs/runtime/cookies.mdx +19 -19
  185. package/docs/runtime/debugger.mdx +4 -4
  186. package/docs/runtime/environment-variables.mdx +24 -7
  187. package/docs/runtime/ffi.mdx +2 -2
  188. package/docs/runtime/file-io.mdx +2 -2
  189. package/docs/runtime/file-types.mdx +5 -5
  190. package/docs/runtime/globals.mdx +4 -4
  191. package/docs/runtime/http/error-handling.mdx +2 -2
  192. package/docs/runtime/http/routing.mdx +1 -1
  193. package/docs/runtime/http/server.mdx +5 -9
  194. package/docs/runtime/http/websockets.mdx +1 -1
  195. package/docs/runtime/index.mdx +2 -2
  196. package/docs/runtime/jsx.mdx +1 -1
  197. package/docs/runtime/module-resolution.mdx +2 -2
  198. package/docs/runtime/networking/fetch.mdx +4 -4
  199. package/docs/runtime/nodejs-compat.mdx +3 -3
  200. package/docs/runtime/plugins.mdx +1 -1
  201. package/docs/runtime/s3.mdx +4 -4
  202. package/docs/runtime/secrets.mdx +10 -7
  203. package/docs/runtime/sql.mdx +10 -10
  204. package/docs/runtime/sqlite.mdx +15 -4
  205. package/docs/runtime/templating/create.mdx +4 -4
  206. package/docs/runtime/transpiler.mdx +1 -1
  207. package/docs/runtime/utils.mdx +3 -3
  208. package/docs/runtime/watch-mode.mdx +1 -1
  209. package/docs/runtime/workers.mdx +5 -17
  210. package/docs/snippets/cli/publish.mdx +2 -2
  211. package/docs/test/configuration.mdx +1 -1
  212. package/docs/test/dom.mdx +1 -1
  213. package/docs/test/index.mdx +8 -8
  214. package/docs/test/reporters.mdx +1 -1
  215. package/docs/test/snapshots.mdx +3 -3
  216. package/docs/test/writing-tests.mdx +37 -0
  217. package/docs/typescript.mdx +2 -2
  218. package/package.json +3 -4
  219. package/docs/snippets/product-card.mdx +0 -32
  220. package/docs/snippets/product-tiles.mdx +0 -94
@@ -15,4 +15,4 @@ process.on("SIGINT", () => {
15
15
 
16
16
  ---
17
17
 
18
- See [Docs > API > Utils](https://bun.com/docs/api/utils) for more useful utilities.
18
+ See [Docs > API > Utils](/docs/runtime/utils) for more useful utilities.
@@ -4,7 +4,7 @@ sidebarTitle: Spawn a child process and communicate using IPC
4
4
  mode: center
5
5
  ---
6
6
 
7
- Use [`Bun.spawn()`](https://bun.com/docs/api/spawn) to spawn a child process. When spawning a second `bun` process, you can open a direct inter-process communication (IPC) channel between the two processes.
7
+ Use [`Bun.spawn()`](/docs/runtime/child-process) to spawn a child process. When spawning a second `bun` process, you can open a direct inter-process communication (IPC) channel between the two processes.
8
8
 
9
9
  <Note>
10
10
  This API is only compatible with other `bun` processes. Use `process.execPath` to get a path to the currently running
@@ -66,4 +66,4 @@ process.send({ message: "Hello from child as object" });
66
66
 
67
67
  ---
68
68
 
69
- See [Docs > API > Child processes](https://bun.com/docs/api/spawn) for complete documentation.
69
+ See [Docs > API > Child processes](/docs/runtime/child-process) for complete documentation.
@@ -12,4 +12,4 @@ Bun.nanoseconds();
12
12
 
13
13
  ---
14
14
 
15
- See [Docs > API > Utils](https://bun.com/docs/api/utils) for more useful utilities.
15
+ See [Docs > API > Utils](/docs/runtime/utils) for more useful utilities.
@@ -38,4 +38,4 @@ process.on("exit", code => {
38
38
 
39
39
  ---
40
40
 
41
- See [Docs > API > Utils](https://bun.com/docs/api/utils) for more useful utilities.
41
+ See [Docs > API > Utils](/docs/runtime/utils) for more useful utilities.
@@ -4,7 +4,7 @@ sidebarTitle: Read stderr
4
4
  mode: center
5
5
  ---
6
6
 
7
- When using [`Bun.spawn()`](https://bun.com/docs/api/spawn), the child process inherits the `stderr` of the spawning process. If instead you'd prefer to read and handle `stderr`, set the `stderr` option to `"pipe"`.
7
+ When using [`Bun.spawn()`](/docs/runtime/child-process), the child process inherits the `stderr` of the spawning process. If instead you'd prefer to read and handle `stderr`, set the `stderr` option to `"pipe"`.
8
8
 
9
9
  ```ts
10
10
  const proc = Bun.spawn(["echo", "hello"], {
@@ -31,4 +31,4 @@ if (errors) {
31
31
 
32
32
  ---
33
33
 
34
- See [Docs > API > Child processes](https://bun.com/docs/api/spawn) for complete documentation.
34
+ See [Docs > API > Child processes](/docs/runtime/child-process) for complete documentation.
@@ -4,7 +4,7 @@ sidebarTitle: Read stdout
4
4
  mode: center
5
5
  ---
6
6
 
7
- When using [`Bun.spawn()`](https://bun.com/docs/api/spawn), the `stdout` of the child process can be consumed as a `ReadableStream` via `proc.stdout`.
7
+ When using [`Bun.spawn()`](/docs/runtime/child-process), the `stdout` of the child process can be consumed as a `ReadableStream` via `proc.stdout`.
8
8
 
9
9
  ```ts
10
10
  const proc = Bun.spawn(["echo", "hello"]);
@@ -25,4 +25,4 @@ const proc = Bun.spawn(["echo", "hello"], {
25
25
 
26
26
  ---
27
27
 
28
- See [Docs > API > Child processes](https://bun.com/docs/api/spawn) for complete documentation.
28
+ See [Docs > API > Child processes](/docs/runtime/child-process) for complete documentation.
@@ -4,7 +4,7 @@ sidebarTitle: Spawn child process
4
4
  mode: center
5
5
  ---
6
6
 
7
- Use [`Bun.spawn()`](https://bun.com/docs/api/spawn) to spawn a child process.
7
+ Use [`Bun.spawn()`](/docs/runtime/child-process) to spawn a child process.
8
8
 
9
9
  ```ts
10
10
  const proc = Bun.spawn(["echo", "hello"]);
@@ -40,4 +40,4 @@ output; // => "hello\n"
40
40
 
41
41
  ---
42
42
 
43
- See [Docs > API > Child processes](https://bun.com/docs/api/spawn) for complete documentation.
43
+ See [Docs > API > Child processes](/docs/runtime/child-process) for complete documentation.
@@ -59,4 +59,4 @@ Chunk: hello
59
59
 
60
60
  ---
61
61
 
62
- See [Docs > API > Utils](https://bun.com/docs/api/utils) for more useful utilities.
62
+ See [Docs > API > Utils](/docs/runtime/utils) for more useful utilities.
@@ -15,7 +15,7 @@ const buffer = await file.arrayBuffer();
15
15
 
16
16
  ---
17
17
 
18
- The binary content in the `ArrayBuffer` can then be read as a typed array, such as `Int8Array`. For `Uint8Array`, use [`.bytes()`](./uint8array).
18
+ The binary content in the `ArrayBuffer` can then be read as a typed array, such as `Int8Array`. For `Uint8Array`, use [`.bytes()`](/docs/guides/read-file/uint8array).
19
19
 
20
20
  ```ts index.ts icon="/icons/typescript.svg"
21
21
  const buffer = await file.arrayBuffer();
@@ -27,4 +27,4 @@ bytes.length;
27
27
 
28
28
  ---
29
29
 
30
- Refer to the [Typed arrays](https://bun.com/docs/api/binary-data#typedarray) docs for more information on working with typed arrays in Bun.
30
+ Refer to the [Typed arrays](/docs/runtime/binary-data#typedarray) docs for more information on working with typed arrays in Bun.
@@ -18,4 +18,4 @@ const buffer = Buffer.from(arrbuf);
18
18
 
19
19
  ---
20
20
 
21
- Refer to [Binary data > Buffer](https://bun.com/docs/api/binary-data#buffer) for more information on working with `Buffer` and other binary data formats in Bun.
21
+ Refer to [Binary data > Buffer](/docs/runtime/binary-data#buffer) for more information on working with `Buffer` and other binary data formats in Bun.
@@ -15,4 +15,4 @@ await file.exists(); // boolean;
15
15
 
16
16
  ---
17
17
 
18
- Refer to [API > File I/O](https://bun.com/docs/api/file-io) for more information on working with `BunFile`.
18
+ Refer to [API > File I/O](/docs/runtime/file-io) for more information on working with `BunFile`.
@@ -19,4 +19,4 @@ file.type; // image/png
19
19
 
20
20
  ---
21
21
 
22
- Refer to [API > File I/O](https://bun.com/docs/api/file-io) for more information on working with `BunFile`.
22
+ Refer to [API > File I/O](/docs/runtime/file-io) for more information on working with `BunFile`.
@@ -25,4 +25,4 @@ for await (const chunk of stream) {
25
25
 
26
26
  ---
27
27
 
28
- Refer to the [Streams](https://bun.com/docs/api/streams) documentation for more information on working with streams in Bun.
28
+ Refer to the [Streams](/docs/runtime/streams) documentation for more information on working with streams in Bun.
@@ -20,4 +20,4 @@ byteArray.length; // length of byteArray
20
20
 
21
21
  ---
22
22
 
23
- Refer to [API > Binary data > Typed arrays](https://bun.com/docs/api/binary-data#typedarray) for more information on working with `Uint8Array` and other binary data formats in Bun.
23
+ Refer to [API > Binary data > Typed arrays](/docs/runtime/binary-data#typedarray) for more information on working with `Uint8Array` and other binary data formats in Bun.
@@ -63,4 +63,4 @@ process.on("SIGINT", () => {
63
63
 
64
64
  ---
65
65
 
66
- Refer to [API > Binary data > Typed arrays](https://bun.com/docs/api/binary-data#typedarray) for more information on working with `Uint8Array` and other binary data formats in Bun.
66
+ Refer to [API > Binary data > Typed arrays](/docs/runtime/binary-data#typedarray) for more information on working with `Uint8Array` and other binary data formats in Bun.
@@ -290,6 +290,6 @@ bun build --compile --target=bun-windows-x64 --define PLATFORM='"windows"' src/a
290
290
 
291
291
  ## Related
292
292
 
293
- - [Define constants at runtime](/guides/runtime/define-constant) - Using `--define` with `bun run`
294
- - [Building executables](/bundler/executables) - Complete guide to `bun build --compile`
295
- - [Bundler API](/bundler) - Full bundler documentation including `define` option
293
+ - [Define constants at runtime](/docs/guides/runtime/define-constant) - Using `--define` with `bun run`
294
+ - [Building executables](/docs/bundler/executables) - Complete guide to `bun build --compile`
295
+ - [Bundler API](/docs/bundler) - Full bundler documentation including `define` option
@@ -37,7 +37,7 @@ jobs:
37
37
  # ...
38
38
  - uses: oven-sh/setup-bun@v2
39
39
  with: # [!code ++]
40
- bun-version: 1.2.0 # or "latest", "canary", <sha> # [!code ++]
40
+ bun-version: 1.3.3 # or "latest", "canary", <sha> # [!code ++]
41
41
  ```
42
42
 
43
43
  ---
@@ -58,4 +58,4 @@ codesign -vvv --verify ./myapp
58
58
 
59
59
  ---
60
60
 
61
- For more information on macOS codesigning, refer to [Apple's Code Signing documentation](https://developer.apple.com/documentation/security/code_signing_services). For details about creating single-file executables with Bun, see [Standalone Executables](/bundler/executables). This guide requires Bun v1.2.4 or newer.
61
+ For more information on macOS codesigning, refer to [Apple's Code Signing documentation](https://developer.apple.com/documentation/security/code_signing_services). For details about creating single-file executables with Bun, see [Standalone Executables](/docs/bundler/executables). This guide requires Bun v1.2.4 or newer.
@@ -36,4 +36,4 @@ try {
36
36
 
37
37
  ---
38
38
 
39
- See [Docs > API > FileSystem](https://bun.com/docs/api/file-io) for more filesystem operations.
39
+ See [Docs > API > FileSystem](/docs/runtime/file-io) for more filesystem operations.
@@ -18,4 +18,4 @@ const exists = await file.exists();
18
18
 
19
19
  ---
20
20
 
21
- See [Docs > API > FileSystem](https://bun.com/docs/api/file-io) for more filesystem operations.
21
+ See [Docs > API > FileSystem](/docs/runtime/file-io) for more filesystem operations.
@@ -25,4 +25,4 @@ To view V8 heap snapshots in Chrome DevTools:
25
25
  3. Click the "Load" button (folder icon)
26
26
  4. Select your `.heapsnapshot` file
27
27
 
28
- <Frame>![Chrome DevTools Memory Tab](/images/chrome-devtools-memory.png)</Frame>
28
+ <Frame>![Chrome DevTools Memory Tab](https://bun.com/images/chrome-devtools-memory.png)</Frame>
@@ -43,4 +43,4 @@ data.author.name; // => "John Dough"
43
43
 
44
44
  ---
45
45
 
46
- See [Docs > Runtime > TypeScript](https://bun.com/docs/runtime/typescript) for more information on using TypeScript with Bun.
46
+ See [Docs > Runtime > TypeScript](/docs/runtime/typescript) for more information on using TypeScript with Bun.
@@ -29,4 +29,4 @@ data.author.name; // => "John Dough"
29
29
 
30
30
  ---
31
31
 
32
- See [Docs > Runtime > TypeScript](https://bun.com/docs/runtime/typescript) for more information on using TypeScript with Bun.
32
+ See [Docs > Runtime > TypeScript](/docs/runtime/typescript) for more information on using TypeScript with Bun.
@@ -101,4 +101,4 @@ export = contents;
101
101
 
102
102
  ---
103
103
 
104
- See [Docs > API > YAML](https://bun.com/docs/api/yaml) for complete documentation on YAML support in Bun.
104
+ See [Docs > API > YAML](/docs/runtime/yaml) for complete documentation on YAML support in Bun.
@@ -34,4 +34,4 @@ FOOBAR=aaaaaa
34
34
 
35
35
  ---
36
36
 
37
- See [Docs > Runtime > Environment variables](https://bun.com/docs/runtime/env) for more information on using environment variables with Bun.
37
+ See [Docs > Runtime > Environment variables](/docs/runtime/environment-variables) for more information on using environment variables with Bun.
@@ -21,7 +21,7 @@ Bun reads the following files automatically (listed in order of increasing prece
21
21
  - `.env.production`, `.env.development`, `.env.test` (depending on value of `NODE_ENV`)
22
22
  - `.env.local` (not loaded when `NODE_ENV=test`)
23
23
 
24
- ```txt .env icon="settings"
24
+ ```ini .env icon="settings"
25
25
  FOO=hello
26
26
  BAR=world
27
27
  ```
@@ -48,4 +48,4 @@ $env:FOO="helloworld"; bun run dev
48
48
 
49
49
  ---
50
50
 
51
- See [Docs > Runtime > Environment variables](https://bun.com/docs/runtime/env) for more information on using environment variables with Bun.
51
+ See [Docs > Runtime > Environment variables](/docs/runtime/environment-variables) for more information on using environment variables with Bun.
@@ -39,4 +39,4 @@ for await (const line of $`ls -l`.lines()) {
39
39
 
40
40
  ---
41
41
 
42
- See [Docs > API > Shell](https://bun.com/docs/runtime/shell) for complete documentation.
42
+ See [Docs > API > Shell](/docs/runtime/shell) for complete documentation.
@@ -28,4 +28,4 @@ import { Button } from "@components/Button"; // imports from "./src/components/B
28
28
 
29
29
  ---
30
30
 
31
- See [Docs > Runtime > TypeScript](https://bun.com/docs/runtime/typescript) for more information on using TypeScript with Bun.
31
+ See [Docs > Runtime > TypeScript](/docs/runtime/typescript) for more information on using TypeScript with Bun.
@@ -48,4 +48,4 @@ Below is the full set of recommended `compilerOptions` for a Bun project. With t
48
48
 
49
49
  ---
50
50
 
51
- Refer to [Ecosystem > TypeScript](https://bun.com/docs/runtime/typescript) for a complete guide to TypeScript support in Bun.
51
+ Refer to [Ecosystem > TypeScript](/docs/runtime/typescript) for a complete guide to TypeScript support in Bun.
@@ -5,8 +5,7 @@ mode: center
5
5
  ---
6
6
 
7
7
  <Note>
8
- VSCode extension support is currently buggy. We recommend the [Web
9
- Debugger](https://bun.com/guides/runtime/web-debugger) for now.
8
+ VSCode extension support is currently buggy. We recommend the [Web Debugger](/docs/guides/runtime/web-debugger) for now.
10
9
  </Note>
11
10
 
12
11
  Bun speaks the [WebKit Inspector Protocol](https://github.com/oven-sh/bun/blob/main/packages/bun-inspector-protocol/src/protocol/jsc/index.d.ts) so you can debug your code with an interactive debugger.
@@ -4,7 +4,7 @@ sidebarTitle: Web debugger
4
4
  mode: center
5
5
  ---
6
6
 
7
- Bun speaks the [WebKit Inspector Protocol](https://github.com/oven-sh/bun/blob/main/packages/bun-vscode/types/jsc.d.ts). To enable debugging when running code with Bun, use the `--inspect` flag. For demonstration purposes, consider the following simple web server.
7
+ Bun speaks the [WebKit Inspector Protocol](https://github.com/oven-sh/bun/blob/main/packages/bun-inspector-protocol/src/protocol/jsc/index.d.ts). To enable debugging when running code with Bun, use the `--inspect` flag. For demonstration purposes, consider the following simple web server.
8
8
 
9
9
  ```ts server.ts icon="/icons/typescript.svg"
10
10
  Bun.serve({
@@ -13,4 +13,4 @@ const str = await Bun.readableStreamToArray(stream);
13
13
 
14
14
  ---
15
15
 
16
- See [Docs > API > Utils](https://bun.com/docs/api/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
16
+ See [Docs > API > Utils](/docs/runtime/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
@@ -13,4 +13,4 @@ const buf = await Bun.readableStreamToArrayBuffer(stream);
13
13
 
14
14
  ---
15
15
 
16
- See [Docs > API > Utils](https://bun.com/docs/api/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
16
+ See [Docs > API > Utils](/docs/runtime/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
@@ -13,4 +13,4 @@ const blob = await Bun.readableStreamToBlob(stream);
13
13
 
14
14
  ---
15
15
 
16
- See [Docs > API > Utils](https://bun.com/docs/api/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
16
+ See [Docs > API > Utils](/docs/runtime/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
@@ -14,4 +14,4 @@ const nodeBuf = Buffer.from(arrBuf);
14
14
 
15
15
  ---
16
16
 
17
- See [Docs > API > Utils](https://bun.com/docs/api/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
17
+ See [Docs > API > Utils](/docs/runtime/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
@@ -13,4 +13,4 @@ const json = await stream.json();
13
13
 
14
14
  ---
15
15
 
16
- See [Docs > API > Utils](https://bun.com/docs/api/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
16
+ See [Docs > API > Utils](/docs/runtime/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
@@ -13,4 +13,4 @@ const str = await Bun.readableStreamToText(stream);
13
13
 
14
14
  ---
15
15
 
16
- See [Docs > API > Utils](https://bun.com/docs/api/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
16
+ See [Docs > API > Utils](/docs/runtime/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
@@ -21,4 +21,4 @@ const uint8 = await Bun.readableStreamToBytes(stream);
21
21
 
22
22
  ---
23
23
 
24
- See [Docs > API > Utils](https://bun.com/docs/api/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
24
+ See [Docs > API > Utils](/docs/runtime/utils#bun-readablestreamto) for documentation on Bun's other `ReadableStream` conversion functions.
@@ -21,4 +21,4 @@ bun test --bail=10
21
21
 
22
22
  ---
23
23
 
24
- See [Docs > Test runner](https://bun.sh/docs/cli/test) for complete documentation of `bun test`.
24
+ See [Docs > Test runner](/docs/test) for complete documentation of `bun test`.
@@ -2,6 +2,7 @@
2
2
  title: Selectively run tests concurrently with glob patterns
3
3
  sidebarTitle: Concurrent test glob
4
4
  mode: center
5
+ description: Set a glob pattern to decide which tests from which files run in parallel
5
6
  ---
6
7
 
7
8
  This guide demonstrates how to use the `concurrentTestGlob` option to selectively run tests concurrently based on file naming patterns.
@@ -69,12 +70,14 @@ test("fetch user data", async () => {
69
70
  expect(response.ok).toBe(true);
70
71
  });
71
72
 
72
- test("fetch posts", async () => {
73
+ // can also use test.concurrent() for explicitly marking it as concurrent
74
+ test.concurrent("fetch posts", async () => {
73
75
  const response = await fetch("/api/posts");
74
76
  expect(response.ok).toBe(true);
75
77
  });
76
78
 
77
- test("fetch comments", async () => {
79
+ // can also use test.serial() for explicitly marking it as sequential
80
+ test.serial("fetch comments", async () => {
78
81
  const response = await fetch("/api/comments");
79
82
  expect(response.ok).toBe(true);
80
83
  });
@@ -64,4 +64,4 @@ coverageThreshold = { lines = 0.5, functions = 0.7 }
64
64
 
65
65
  ---
66
66
 
67
- See [Docs > Test runner > Coverage](https://bun.sh/docs/test/coverage) for complete documentation on code coverage reporting in Bun.
67
+ See [Docs > Test runner > Coverage](/docs/test/code-coverage) for complete documentation on code coverage reporting in Bun.
@@ -46,4 +46,4 @@ coverage = true # always enable coverage
46
46
 
47
47
  ---
48
48
 
49
- Refer to [Docs > Test runner > Coverage](https://bun.sh/docs/test/coverage) for complete documentation on code coverage reporting in Bun.
49
+ Refer to [Docs > Test runner > Coverage](/docs/test/code-coverage) for complete documentation on code coverage reporting in Bun.
@@ -70,4 +70,4 @@ Ran 1 tests across 1 files. 1 total [125.00ms]
70
70
 
71
71
  ---
72
72
 
73
- Refer to the [Happy DOM repo](https://github.com/capricorn86/happy-dom) and [Docs > Test runner > DOM](https://bun.sh/docs/test/dom) for complete documentation on writing browser tests with Bun.
73
+ Refer to the [Happy DOM repo](https://github.com/capricorn86/happy-dom) and [Docs > Test runner > DOM](/docs/test/dom) for complete documentation on writing browser tests with Bun.
@@ -62,7 +62,7 @@ describe("my test suite", () => {
62
62
 
63
63
  ---
64
64
 
65
- Bun implements the vast majority of Jest's matchers, but compatibility isn't 100% yet. Refer to the full compatibility table at [Docs > Test runner > Writing tests](https://bun.sh/docs/test/writing#matchers).
65
+ Bun implements the vast majority of Jest's matchers, but compatibility isn't 100% yet. Refer to the full compatibility table at [Docs > Test runner > Writing tests](/docs/test/writing-tests#matchers).
66
66
 
67
67
  Some notable missing features:
68
68
 
@@ -70,11 +70,11 @@ Some notable missing features:
70
70
 
71
71
  ---
72
72
 
73
- If you're using `testEnvironment: "jsdom"` to run your tests in a browser-like environment, you should follow the [DOM testing with Bun and happy-dom](/guides/test/happy-dom) guide to inject browser APIs into the global scope. This guide relies on [`happy-dom`](https://github.com/capricorn86/happy-dom), which is a leaner and faster alternative to [`jsdom`](https://github.com/jsdom/jsdom).
73
+ If you're using `testEnvironment: "jsdom"` to run your tests in a browser-like environment, you should follow the [DOM testing with Bun and happy-dom](/docs/guides/test/happy-dom) guide to inject browser APIs into the global scope. This guide relies on [`happy-dom`](https://github.com/capricorn86/happy-dom), which is a leaner and faster alternative to [`jsdom`](https://github.com/jsdom/jsdom).
74
74
 
75
75
  At the moment jsdom does not work in Bun due to its internal use of V8 APIs. Track support for it [here](https://github.com/oven-sh/bun/issues/3554).
76
76
 
77
- ```toml bunfig.toml
77
+ ```toml bunfig.toml icon="settings"
78
78
  [test]
79
79
  preload = ["./happy-dom.ts"]
80
80
  ```
@@ -107,11 +107,11 @@ bun test --timeout 10000
107
107
 
108
108
  Many other flags become irrelevant or obsolete when using `bun test`.
109
109
 
110
- - `transform` — Bun supports TypeScript & JSX. Other file types can be configured with [Plugins](https://bun.sh/docs/runtime/plugins).
110
+ - `transform` — Bun supports TypeScript & JSX. Other file types can be configured with [Plugins](/docs/runtime/plugins).
111
111
  - `extensionsToTreatAsEsm`
112
112
  - `haste` — Bun uses it's own internal source maps
113
113
  - `watchman`, `watchPlugins`, `watchPathIgnorePatterns` — use `--watch` to run tests in watch mode
114
- - `verbose` — set `logLevel: "debug"` in [`bunfig.toml`](https://bun.sh/docs/runtime/bunfig#loglevel)
114
+ - `verbose` — set `logLevel: "debug"` in [`bunfig.toml`](/docs/runtime/bunfig#loglevel)
115
115
 
116
116
  ---
117
117
 
@@ -121,5 +121,5 @@ Settings that aren't mentioned here are not supported or have no equivalent. Ple
121
121
 
122
122
  See also:
123
123
 
124
- - [Mark a test as a todo](/guides/test/todo-tests)
125
- - [Docs > Test runner > Writing tests](https://bun.sh/docs/test/writing)
124
+ - [Mark a test as a todo](/docs/guides/test/todo-tests)
125
+ - [Docs > Test runner > Writing tests](/docs/test/writing-tests)
@@ -22,7 +22,7 @@ test("party like it's 1999", () => {
22
22
 
23
23
  ---
24
24
 
25
- The `setSystemTime` function is commonly used on conjunction with [Lifecycle Hooks](https://bun.sh/docs/test/lifecycle) to configure a testing environment with a deterministic "fake clock".
25
+ The `setSystemTime` function is commonly used on conjunction with [Lifecycle Hooks](/docs/test/lifecycle) to configure a testing environment with a deterministic "fake clock".
26
26
 
27
27
  ```ts
28
28
  import { test, expect, beforeAll, setSystemTime } from "bun:test";
@@ -47,4 +47,4 @@ setSystemTime(); // reset to actual time
47
47
 
48
48
  ---
49
49
 
50
- See [Docs > Test Runner > Date and time](https://bun.sh/docs/test/time) for complete documentation on mocking with the Bun test runner.
50
+ See [Docs > Test Runner > Date and time](/docs/test/dates-times) for complete documentation on mocking with the Bun test runner.
@@ -67,4 +67,4 @@ test("random", async () => {
67
67
 
68
68
  ---
69
69
 
70
- See [Docs > Test Runner > Mocks](https://bun.sh/docs/test/mocks) for complete documentation on mocking with the Bun test runner.
70
+ See [Docs > Test Runner > Mocks](/docs/test/mocks) for complete documentation on mocking with the Bun test runner.
@@ -13,4 +13,4 @@ bun test --rerun-each 10
13
13
 
14
14
  ---
15
15
 
16
- See [Docs > Test runner](https://bun.sh/docs/cli/test) for complete documentation of `bun test`.
16
+ See [Docs > Test runner](/docs/test) for complete documentation of `bun test`.
@@ -4,7 +4,7 @@ sidebarTitle: Run tests
4
4
  mode: center
5
5
  ---
6
6
 
7
- Bun has a built-in [test runner](https://bun.sh/docs/cli/test) with a Jest-like `expect` API.
7
+ Bun has a built-in [test runner](/docs/test) with a Jest-like `expect` API.
8
8
 
9
9
  ---
10
10
 
@@ -113,4 +113,4 @@ Ran 6 tests across 3 files. [59.00ms]
113
113
 
114
114
  ---
115
115
 
116
- See [Docs > Test Runner](https://bun.sh/docs/cli/test) for complete documentation on the test runner.
116
+ See [Docs > Test Runner](/docs/test) for complete documentation on the test runner.
@@ -39,5 +39,5 @@ Ran 3 tests across 1 files. [74.00ms]
39
39
 
40
40
  See also:
41
41
 
42
- - [Mark a test as a todo](/guides/test/todo-tests)
43
- - [Docs > Test runner > Writing tests](https://bun.sh/docs/test/writing)
42
+ - [Mark a test as a todo](/docs/guides/test/todo-tests)
43
+ - [Docs > Test runner > Writing tests](/docs/test/writing-tests)
@@ -49,7 +49,7 @@ test
49
49
  The `snap.test.ts.snap` file is a JavaScript file that exports a serialized version of the value passed into `expect()`. The `{foo: "bar"}` object has been serialized to JSON.
50
50
 
51
51
  ```js snap.test.ts.snap icon="file-code"
52
- // Bun Snapshot v1, https://bun.sh/docs/test/snapshots
52
+ // Bun Snapshot v1, https://bun.com/docs/test/snapshots
53
53
 
54
54
  exports[`snapshot 1`] = `
55
55
  {
@@ -67,7 +67,7 @@ bun test
67
67
  ```
68
68
 
69
69
  ```txt
70
- bun test v1.3.2 (9c68abdb)
70
+ bun test v1.3.3 (9c68abdb)
71
71
  test/snap.test.ts:
72
72
  ✓ snapshot [1.05ms]
73
73
 
@@ -86,7 +86,7 @@ bun test --update-snapshots
86
86
  ```
87
87
 
88
88
  ```txt
89
- bun test v1.3.2 (9c68abdb)
89
+ bun test v1.3.3 (9c68abdb)
90
90
  test/snap.test.ts:
91
91
  ✓ snapshot [0.86ms]
92
92
 
@@ -99,4 +99,4 @@ Ran 1 tests across 1 files. [102.00ms]
99
99
 
100
100
  ---
101
101
 
102
- See [Docs > Test Runner > Snapshots](https://bun.sh/docs/test/snapshots) for complete documentation on snapshots with the Bun test runner.
102
+ See [Docs > Test Runner > Snapshots](/docs/test/snapshots) for complete documentation on snapshots with the Bun test runner.
@@ -46,4 +46,4 @@ test("turtles", () => { // [!code ++]
46
46
 
47
47
  ---
48
48
 
49
- See [Docs > Test Runner > Mocks](https://bun.sh/docs/test/mocks) for complete documentation on mocking with the Bun test runner.
49
+ See [Docs > Test Runner > Mocks](/docs/test/mocks) for complete documentation on mocking with the Bun test runner.
@@ -4,7 +4,7 @@ sidebarTitle: Test Svelte
4
4
  mode: center
5
5
  ---
6
6
 
7
- Bun's [Plugin API](/runtime/plugins) lets you add custom loaders to your project. The `test.preload` option in `bunfig.toml` lets you configure your loader to start before your tests run.
7
+ Bun's [Plugin API](/docs/runtime/plugins) lets you add custom loaders to your project. The `test.preload` option in `bunfig.toml` lets you configure your loader to start before your tests run.
8
8
 
9
9
  Firstly, install `@testing-library/svelte`, `svelte`, and `@happy-dom/global-registrator`.
10
10
 
@@ -14,7 +14,7 @@ bun add @testing-library/svelte svelte@4 @happy-dom/global-registrator
14
14
 
15
15
  Then, save this plugin in your project.
16
16
 
17
- ```ts svelte-loader.js icon="/icons/typescript.svg"
17
+ ```ts svelte-loader.ts icon="/icons/typescript.svg"
18
18
  import { plugin } from "bun";
19
19
  import { compile } from "svelte/compiler";
20
20
  import { readFileSync } from "fs";
@@ -61,10 +61,10 @@ Add this to `bunfig.toml` to tell Bun to preload the plugin, so it loads before
61
61
  ```toml bunfig.toml icon="settings"
62
62
  [test]
63
63
  # Tell Bun to load this plugin before your tests run
64
- preload = ["./svelte-loader.js"]
64
+ preload = ["./svelte-loader.ts"]
65
65
 
66
66
  # This also works:
67
- # test.preload = ["./svelte-loader.js"]
67
+ # test.preload = ["./svelte-loader.ts"]
68
68
  ```
69
69
 
70
70
  ---
@@ -8,7 +8,7 @@ You can use [Testing Library](https://testing-library.com/) with Bun's test runn
8
8
 
9
9
  ---
10
10
 
11
- As a prerequisite to using Testing Library you will need to install [Happy Dom](https://github.com/capricorn86/happy-dom). ([see Bun's Happy DOM guide for more information](https://bun.sh/guides/test/happy-dom)).
11
+ As a prerequisite to using Testing Library you will need to install [Happy Dom](https://github.com/capricorn86/happy-dom). ([see Bun's Happy DOM guide for more information](/docs/guides/test/happy-dom)).
12
12
 
13
13
  ```sh terminal icon="terminal"
14
14
  bun add -D @happy-dom/global-registrator
@@ -24,7 +24,7 @@ bun add -D @testing-library/react @testing-library/dom @testing-library/jest-dom
24
24
 
25
25
  ---
26
26
 
27
- Next you will need to create a preload script for Happy DOM and for Testing Library. For more details about the Happy DOM setup script see [Bun's Happy DOM guide](https://bun.sh/guides/test/happy-dom).
27
+ Next you will need to create a preload script for Happy DOM and for Testing Library. For more details about the Happy DOM setup script see [Bun's Happy DOM guide](/docs/guides/test/happy-dom).
28
28
 
29
29
  ```ts happydom.ts icon="/icons/typescript.svg"
30
30
  import { GlobalRegistrator } from "@happy-dom/global-registrator";
@@ -90,4 +90,4 @@ test("Can use Testing Library", () => {
90
90
 
91
91
  ---
92
92
 
93
- Refer to the [Testing Library docs](https://testing-library.com/), [Happy DOM repo](https://github.com/capricorn86/happy-dom) and [Docs > Test runner > DOM](https://bun.sh/docs/test/dom) for complete documentation on writing browser tests with Bun.
93
+ Refer to the [Testing Library docs](https://testing-library.com/), [Happy DOM repo](https://github.com/capricorn86/happy-dom) and [Docs > Test runner > DOM](/docs/test/dom) for complete documentation on writing browser tests with Bun.
@@ -14,4 +14,4 @@ bun test --timeout 3000 # 3 seconds
14
14
 
15
15
  ---
16
16
 
17
- See [Docs > Test runner](https://bun.sh/docs/cli/test) for complete documentation of `bun test`.
17
+ See [Docs > Test runner](/docs/test) for complete documentation of `bun test`.
@@ -70,5 +70,5 @@ $ echo $?
70
70
 
71
71
  See also:
72
72
 
73
- - [Skip a test](/guides/test/skip-tests)
74
- - [Docs > Test runner > Writing tests](https://bun.sh/docs/test/writing)
73
+ - [Skip a test](/docs/guides/test/skip-tests)
74
+ - [Docs > Test runner > Writing tests](/docs/test/writing-tests)