bun-types 1.2.19-canary.20250709T140635 → 1.2.19-canary.20250710T140803
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bun.d.ts +9 -9
- package/devserver.d.ts +3 -3
- package/docs/api/binary-data.md +1 -1
- package/docs/api/cc.md +1 -1
- package/docs/api/dns.md +3 -3
- package/docs/api/fetch.md +6 -6
- package/docs/api/file-io.md +3 -3
- package/docs/api/globals.md +4 -4
- package/docs/api/http.md +6 -6
- package/docs/api/s3.md +1 -1
- package/docs/api/spawn.md +1 -1
- package/docs/api/utils.md +3 -3
- package/docs/bundler/fullstack.md +2 -2
- package/docs/bundler/index.md +8 -8
- package/docs/bundler/loaders.md +5 -5
- package/docs/bundler/macros.md +1 -1
- package/docs/bundler/plugins.md +1 -1
- package/docs/bundler/vs-esbuild.md +5 -5
- package/docs/cli/bun-create.md +3 -3
- package/docs/cli/bun-install.md +1 -1
- package/docs/cli/bun-upgrade.md +1 -1
- package/docs/cli/filter.md +2 -2
- package/docs/cli/install.md +5 -5
- package/docs/cli/patch-commit.md +1 -1
- package/docs/cli/pm.md +1 -1
- package/docs/cli/publish.md +1 -1
- package/docs/cli/run.md +2 -2
- package/docs/cli/test.md +6 -6
- package/docs/ecosystem/express.md +3 -3
- package/docs/ecosystem/react.md +1 -1
- package/docs/guides/binary/arraybuffer-to-array.md +1 -1
- package/docs/guides/binary/arraybuffer-to-blob.md +1 -1
- package/docs/guides/binary/arraybuffer-to-buffer.md +1 -1
- package/docs/guides/binary/arraybuffer-to-string.md +1 -1
- package/docs/guides/binary/arraybuffer-to-typedarray.md +1 -1
- package/docs/guides/binary/blob-to-arraybuffer.md +1 -1
- package/docs/guides/binary/blob-to-dataview.md +1 -1
- package/docs/guides/binary/blob-to-stream.md +1 -1
- package/docs/guides/binary/blob-to-string.md +1 -1
- package/docs/guides/binary/blob-to-typedarray.md +1 -1
- package/docs/guides/binary/buffer-to-arraybuffer.md +1 -1
- package/docs/guides/binary/buffer-to-blob.md +1 -1
- package/docs/guides/binary/buffer-to-readablestream.md +1 -1
- package/docs/guides/binary/buffer-to-string.md +1 -1
- package/docs/guides/binary/buffer-to-typedarray.md +1 -1
- package/docs/guides/binary/dataview-to-string.md +1 -1
- package/docs/guides/binary/typedarray-to-arraybuffer.md +1 -1
- package/docs/guides/binary/typedarray-to-blob.md +1 -1
- package/docs/guides/binary/typedarray-to-buffer.md +1 -1
- package/docs/guides/binary/typedarray-to-dataview.md +1 -1
- package/docs/guides/binary/typedarray-to-readablestream.md +1 -1
- package/docs/guides/binary/typedarray-to-string.md +1 -1
- package/docs/guides/ecosystem/express.md +1 -1
- package/docs/guides/ecosystem/neon-drizzle.md +1 -1
- package/docs/guides/ecosystem/neon-serverless-postgres.md +1 -1
- package/docs/guides/ecosystem/nuxt.md +1 -1
- package/docs/guides/html-rewriter/extract-links.md +4 -4
- package/docs/guides/html-rewriter/extract-social-meta.md +3 -3
- package/docs/guides/http/fetch.md +2 -2
- package/docs/guides/http/file-uploads.md +1 -1
- package/docs/guides/http/hot.md +1 -1
- package/docs/guides/http/server.md +1 -1
- package/docs/guides/http/simple.md +1 -1
- package/docs/guides/http/stream-file.md +3 -3
- package/docs/guides/http/tls.md +1 -1
- package/docs/guides/install/add-dev.md +1 -1
- package/docs/guides/install/add-git.md +1 -1
- package/docs/guides/install/add-optional.md +1 -1
- package/docs/guides/install/add-peer.md +3 -3
- package/docs/guides/install/add-tarball.md +1 -1
- package/docs/guides/install/add.md +1 -1
- package/docs/guides/install/azure-artifacts.md +1 -1
- package/docs/guides/install/custom-registry.md +2 -2
- package/docs/guides/install/from-npm-install-to-bun-install.md +1 -1
- package/docs/guides/install/git-diff-bun-lockfile.md +1 -1
- package/docs/guides/install/npm-alias.md +1 -1
- package/docs/guides/install/registry-scope.md +3 -3
- package/docs/guides/install/trusted.md +1 -1
- package/docs/guides/install/workspaces.md +1 -1
- package/docs/guides/install/yarnlock.md +2 -2
- package/docs/guides/process/ctrl-c.md +1 -1
- package/docs/guides/process/ipc.md +2 -2
- package/docs/guides/process/nanoseconds.md +1 -1
- package/docs/guides/process/os-signals.md +1 -1
- package/docs/guides/process/spawn-stderr.md +2 -2
- package/docs/guides/process/spawn-stdout.md +2 -2
- package/docs/guides/process/spawn.md +2 -2
- package/docs/guides/process/stdin.md +1 -1
- package/docs/guides/read-file/arraybuffer.md +1 -1
- package/docs/guides/read-file/buffer.md +1 -1
- package/docs/guides/read-file/exists.md +1 -1
- package/docs/guides/read-file/mime.md +1 -1
- package/docs/guides/read-file/stream.md +1 -1
- package/docs/guides/read-file/uint8array.md +1 -1
- package/docs/guides/read-file/watch.md +1 -1
- package/docs/guides/runtime/delete-directory.md +1 -1
- package/docs/guides/runtime/delete-file.md +1 -1
- package/docs/guides/runtime/import-json.md +1 -1
- package/docs/guides/runtime/import-toml.md +1 -1
- package/docs/guides/runtime/read-env.md +1 -1
- package/docs/guides/runtime/set-env.md +1 -1
- package/docs/guides/runtime/shell.md +1 -1
- package/docs/guides/runtime/tsconfig-paths.md +1 -1
- package/docs/guides/runtime/typescript.md +1 -1
- package/docs/guides/runtime/vscode-debugger.md +1 -1
- package/docs/guides/streams/to-array.md +1 -1
- package/docs/guides/streams/to-arraybuffer.md +1 -1
- package/docs/guides/streams/to-blob.md +1 -1
- package/docs/guides/streams/to-buffer.md +1 -1
- package/docs/guides/streams/to-json.md +1 -1
- package/docs/guides/streams/to-string.md +1 -1
- package/docs/guides/streams/to-typedarray.md +1 -1
- package/docs/guides/test/run-tests.md +3 -3
- package/docs/guides/test/snapshot.md +3 -3
- package/docs/guides/test/update-snapshots.md +1 -1
- package/docs/guides/util/base64.md +1 -1
- package/docs/guides/util/deep-equals.md +3 -3
- package/docs/guides/util/deflate.md +1 -1
- package/docs/guides/util/entrypoint.md +2 -2
- package/docs/guides/util/escape-html.md +1 -1
- package/docs/guides/util/file-url-to-path.md +1 -1
- package/docs/guides/util/gzip.md +1 -1
- package/docs/guides/util/hash-a-password.md +1 -1
- package/docs/guides/util/import-meta-dir.md +2 -2
- package/docs/guides/util/import-meta-file.md +2 -2
- package/docs/guides/util/import-meta-path.md +2 -2
- package/docs/guides/util/javascript-uuid.md +1 -1
- package/docs/guides/util/main.md +1 -1
- package/docs/guides/util/path-to-file-url.md +1 -1
- package/docs/guides/util/sleep.md +1 -1
- package/docs/guides/util/version.md +2 -2
- package/docs/guides/util/which-path-to-executable-bin.md +1 -1
- package/docs/guides/websocket/context.md +1 -1
- package/docs/guides/websocket/simple.md +1 -1
- package/docs/guides/write-file/basic.md +2 -2
- package/docs/guides/write-file/blob.md +2 -2
- package/docs/guides/write-file/cat.md +2 -2
- package/docs/guides/write-file/file-cp.md +2 -2
- package/docs/guides/write-file/filesink.md +1 -1
- package/docs/guides/write-file/response.md +3 -3
- package/docs/guides/write-file/stdout.md +2 -2
- package/docs/guides/write-file/stream.md +2 -2
- package/docs/guides/write-file/unlink.md +1 -1
- package/docs/index.md +1 -1
- package/docs/install/lockfile.md +1 -1
- package/docs/install/npmrc.md +4 -4
- package/docs/install/patch.md +2 -2
- package/docs/install/registries.md +1 -1
- package/docs/install/workspaces.md +3 -3
- package/docs/installation.md +8 -8
- package/docs/project/benchmarking.md +1 -1
- package/docs/project/building-windows.md +2 -2
- package/docs/project/contributing.md +2 -2
- package/docs/quickstart.md +1 -1
- package/docs/runtime/autoimport.md +1 -1
- package/docs/runtime/bun-apis.md +36 -36
- package/docs/runtime/debugger.md +4 -4
- package/docs/runtime/env.md +1 -1
- package/docs/runtime/index.md +19 -19
- package/docs/runtime/jsx.md +1 -1
- package/docs/runtime/loaders.md +3 -3
- package/docs/runtime/nodejs-apis.md +4 -4
- package/docs/runtime/plugins.md +5 -5
- package/docs/runtime/typescript.md +1 -1
- package/docs/test/dom.md +1 -1
- package/package.json +2 -2
- package/shell.d.ts +2 -2
package/docs/runtime/debugger.md
CHANGED
|
@@ -93,7 +93,7 @@ Here's a cheat sheet explaining the functions of the control flow buttons.
|
|
|
93
93
|
|
|
94
94
|
### Visual Studio Code Debugger
|
|
95
95
|
|
|
96
|
-
Experimental support for debugging Bun scripts is available in Visual Studio Code. To use it, you'll need to install the [Bun VSCode extension](https://bun.
|
|
96
|
+
Experimental support for debugging Bun scripts is available in Visual Studio Code. To use it, you'll need to install the [Bun VSCode extension](https://bun.com/guides/runtime/vscode-debugger).
|
|
97
97
|
|
|
98
98
|
## Debugging Network Requests
|
|
99
99
|
|
|
@@ -124,11 +124,11 @@ await fetch("https://example.com", {
|
|
|
124
124
|
This prints the `fetch` request as a single-line `curl` command to let you copy-paste into your terminal to replicate the request.
|
|
125
125
|
|
|
126
126
|
```sh
|
|
127
|
-
[fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.19-canary.
|
|
127
|
+
[fetch] $ curl --http1.1 "https://example.com/" -X POST -H "content-type: application/json" -H "Connection: keep-alive" -H "User-Agent: Bun/1.2.19-canary.20250710T140803" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
|
|
128
128
|
[fetch] > HTTP/1.1 POST https://example.com/
|
|
129
129
|
[fetch] > content-type: application/json
|
|
130
130
|
[fetch] > Connection: keep-alive
|
|
131
|
-
[fetch] > User-Agent: Bun/1.2.19-canary.
|
|
131
|
+
[fetch] > User-Agent: Bun/1.2.19-canary.20250710T140803
|
|
132
132
|
[fetch] > Accept: */*
|
|
133
133
|
[fetch] > Host: example.com
|
|
134
134
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
|
@@ -170,7 +170,7 @@ This prints the following to the console:
|
|
|
170
170
|
[fetch] > HTTP/1.1 POST https://example.com/
|
|
171
171
|
[fetch] > content-type: application/json
|
|
172
172
|
[fetch] > Connection: keep-alive
|
|
173
|
-
[fetch] > User-Agent: Bun/1.2.19-canary.
|
|
173
|
+
[fetch] > User-Agent: Bun/1.2.19-canary.20250710T140803
|
|
174
174
|
[fetch] > Accept: */*
|
|
175
175
|
[fetch] > Host: example.com
|
|
176
176
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/runtime/env.md
CHANGED
|
@@ -33,7 +33,7 @@ $ $env:FOO="helloworld"; bun run dev
|
|
|
33
33
|
|
|
34
34
|
{% details summary="Cross-platform solution with Windows" %}
|
|
35
35
|
|
|
36
|
-
For a cross-platform solution, you can use [bun shell](https://bun.
|
|
36
|
+
For a cross-platform solution, you can use [bun shell](https://bun.com/docs/runtime/shell). For example, the `bun exec` command.
|
|
37
37
|
|
|
38
38
|
```sh
|
|
39
39
|
$ bun exec 'FOO=helloworld bun run dev'
|
package/docs/runtime/index.md
CHANGED
|
@@ -6,7 +6,7 @@ Bun is designed to start fast and run fast. Its transpiler and runtime are writt
|
|
|
6
6
|
|
|
7
7
|
{% image src="/images/bun-run-speed.jpeg" caption="Bun vs Node.js vs Deno running Hello World" /%}
|
|
8
8
|
|
|
9
|
-
<!-- If no `node_modules` directory is found in the working directory or above, Bun will abandon Node.js-style module resolution in favor of the `Bun module resolution algorithm`. Under Bun-style module resolution, all packages are _auto-installed_ on the fly into a [global module cache](https://bun.
|
|
9
|
+
<!-- If no `node_modules` directory is found in the working directory or above, Bun will abandon Node.js-style module resolution in favor of the `Bun module resolution algorithm`. Under Bun-style module resolution, all packages are _auto-installed_ on the fly into a [global module cache](https://bun.com/docs/install/cache). For full details on this algorithm, refer to [Runtime > Modules](https://bun.com/docs/runtime/modules). -->
|
|
10
10
|
|
|
11
11
|
Performance sensitive APIs like `Buffer`, `fetch`, and `Response` are heavily profiled and optimized. Under the hood Bun uses the [JavaScriptCore engine](https://developer.apple.com/documentation/javascriptcore), which is developed by Apple for Safari. It starts and runs faster than V8, the engine used by Node.js and Chromium-based browsers.
|
|
12
12
|
|
|
@@ -21,7 +21,7 @@ $ bun index.ts
|
|
|
21
21
|
$ bun index.tsx
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](https://bun.
|
|
24
|
+
Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](https://bun.com/docs/runtime/typescript) page for details.
|
|
25
25
|
|
|
26
26
|
<!-- Before execution, Bun internally transforms all source files to vanilla JavaScript using its fast native transpiler. The transpiler looks at the files extension to determine how to handle it. -->
|
|
27
27
|
|
|
@@ -122,17 +122,17 @@ $ bun run ./my-wasm-app.whatever
|
|
|
122
122
|
|
|
123
123
|
## Node.js compatibility
|
|
124
124
|
|
|
125
|
-
Long-term, Bun aims for complete Node.js compatibility. Most Node.js packages already work with Bun out of the box, but certain low-level APIs like `dgram` are still unimplemented. Track the current compatibility status at [Ecosystem > Node.js](https://bun.
|
|
125
|
+
Long-term, Bun aims for complete Node.js compatibility. Most Node.js packages already work with Bun out of the box, but certain low-level APIs like `dgram` are still unimplemented. Track the current compatibility status at [Ecosystem > Node.js](https://bun.com/docs/runtime/nodejs-apis).
|
|
126
126
|
|
|
127
127
|
Bun implements the Node.js module resolution algorithm, so dependencies can still be managed with `package.json`, `node_modules`, and CommonJS-style imports.
|
|
128
128
|
|
|
129
129
|
{% callout %}
|
|
130
|
-
**Note** — We recommend using Bun's [built-in package manager](https://bun.
|
|
130
|
+
**Note** — We recommend using Bun's [built-in package manager](https://bun.com/docs/cli/install) for a performance boost over other npm clients.
|
|
131
131
|
{% /callout %}
|
|
132
132
|
|
|
133
133
|
## Web APIs
|
|
134
134
|
|
|
135
|
-
<!-- When prudent, Bun attempts to implement Web-standard APIs instead of introducing new APIs. Refer to [Runtime > Web APIs](https://bun.
|
|
135
|
+
<!-- When prudent, Bun attempts to implement Web-standard APIs instead of introducing new APIs. Refer to [Runtime > Web APIs](https://bun.com/docs/web-apis) for a list of Web APIs that are available in Bun. -->
|
|
136
136
|
|
|
137
137
|
Some Web APIs aren't relevant in the context of a server-first runtime like Bun, such as the [DOM API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API#html_dom_api_interfaces) or [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API). Many others, though, are broadly useful outside of the browser context; when possible, Bun implements these Web-standard APIs instead of introducing new APIs.
|
|
138
138
|
|
|
@@ -237,67 +237,67 @@ Bun exposes a set of Bun-specific APIs on the `Bun` global object and through a
|
|
|
237
237
|
|
|
238
238
|
---
|
|
239
239
|
|
|
240
|
-
- [HTTP](https://bun.
|
|
240
|
+
- [HTTP](https://bun.com/docs/api/http)
|
|
241
241
|
- `Bun.serve`
|
|
242
242
|
|
|
243
243
|
---
|
|
244
244
|
|
|
245
|
-
- [File I/O](https://bun.
|
|
245
|
+
- [File I/O](https://bun.com/docs/api/file-io)
|
|
246
246
|
- `Bun.file` `Bun.write`
|
|
247
247
|
|
|
248
248
|
---
|
|
249
249
|
|
|
250
|
-
- [Processes](https://bun.
|
|
250
|
+
- [Processes](https://bun.com/docs/api/spawn)
|
|
251
251
|
- `Bun.spawn` `Bun.spawnSync`
|
|
252
252
|
|
|
253
253
|
---
|
|
254
254
|
|
|
255
|
-
- [TCP](https://bun.
|
|
255
|
+
- [TCP](https://bun.com/docs/api/tcp)
|
|
256
256
|
- `Bun.listen` `Bun.connect`
|
|
257
257
|
|
|
258
258
|
---
|
|
259
259
|
|
|
260
|
-
- [Transpiler](https://bun.
|
|
260
|
+
- [Transpiler](https://bun.com/docs/api/transpiler)
|
|
261
261
|
- `Bun.Transpiler`
|
|
262
262
|
|
|
263
263
|
---
|
|
264
264
|
|
|
265
|
-
- [Routing](https://bun.
|
|
265
|
+
- [Routing](https://bun.com/docs/api/file-system-router)
|
|
266
266
|
- `Bun.FileSystemRouter`
|
|
267
267
|
|
|
268
268
|
---
|
|
269
269
|
|
|
270
|
-
- [HTMLRewriter](https://bun.
|
|
270
|
+
- [HTMLRewriter](https://bun.com/docs/api/html-rewriter)
|
|
271
271
|
- `HTMLRewriter`
|
|
272
272
|
|
|
273
273
|
---
|
|
274
274
|
|
|
275
|
-
- [Utils](https://bun.
|
|
275
|
+
- [Utils](https://bun.com/docs/api/utils)
|
|
276
276
|
- `Bun.peek` `Bun.which`
|
|
277
277
|
|
|
278
278
|
---
|
|
279
279
|
|
|
280
|
-
- [SQLite](https://bun.
|
|
280
|
+
- [SQLite](https://bun.com/docs/api/sqlite)
|
|
281
281
|
- `bun:sqlite`
|
|
282
282
|
|
|
283
283
|
---
|
|
284
284
|
|
|
285
|
-
- [FFI](https://bun.
|
|
285
|
+
- [FFI](https://bun.com/docs/api/ffi)
|
|
286
286
|
- `bun:ffi`
|
|
287
287
|
|
|
288
288
|
---
|
|
289
289
|
|
|
290
|
-
- [DNS](https://bun.
|
|
290
|
+
- [DNS](https://bun.com/docs/api/dns)
|
|
291
291
|
- `bun:dns`
|
|
292
292
|
|
|
293
293
|
---
|
|
294
294
|
|
|
295
|
-
- [Testing](https://bun.
|
|
295
|
+
- [Testing](https://bun.com/docs/api/test)
|
|
296
296
|
- `bun:test`
|
|
297
297
|
|
|
298
298
|
---
|
|
299
299
|
|
|
300
|
-
- [Node-API](https://bun.
|
|
300
|
+
- [Node-API](https://bun.com/docs/api/node-api)
|
|
301
301
|
- `Node-API`
|
|
302
302
|
|
|
303
303
|
---
|
|
@@ -306,4 +306,4 @@ Bun exposes a set of Bun-specific APIs on the `Bun` global object and through a
|
|
|
306
306
|
|
|
307
307
|
## Plugins
|
|
308
308
|
|
|
309
|
-
Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](https://bun.
|
|
309
|
+
Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](https://bun.com/docs/bundler/plugins) for full documentation.
|
package/docs/runtime/jsx.md
CHANGED
|
@@ -14,7 +14,7 @@ console.log(<Component message="Hello world!" />);
|
|
|
14
14
|
|
|
15
15
|
## Configuration
|
|
16
16
|
|
|
17
|
-
Bun reads your `tsconfig.json` or `jsconfig.json` configuration files to determines how to perform the JSX transform internally. To avoid using either of these, the following options can also be defined in [`bunfig.toml`](https://bun.
|
|
17
|
+
Bun reads your `tsconfig.json` or `jsconfig.json` configuration files to determines how to perform the JSX transform internally. To avoid using either of these, the following options can also be defined in [`bunfig.toml`](https://bun.com/docs/runtime/bunfig).
|
|
18
18
|
|
|
19
19
|
The following compiler options are respected.
|
|
20
20
|
|
package/docs/runtime/loaders.md
CHANGED
|
@@ -9,7 +9,7 @@ $ bun index.ts
|
|
|
9
9
|
$ bun index.tsx
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](https://bun.
|
|
12
|
+
Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](https://bun.com/docs/runtime/typescript) page for details.
|
|
13
13
|
|
|
14
14
|
## JSX
|
|
15
15
|
|
|
@@ -89,11 +89,11 @@ import db from "./my.db" with { type: "sqlite" };
|
|
|
89
89
|
console.log(db.query("select * from users LIMIT 1").get());
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
This uses [`bun:sqlite`](https://bun.
|
|
92
|
+
This uses [`bun:sqlite`](https://bun.com/docs/api/sqlite).
|
|
93
93
|
|
|
94
94
|
## Custom loaders
|
|
95
95
|
|
|
96
|
-
Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](https://bun.
|
|
96
|
+
Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](https://bun.com/docs/bundler/plugins) for full documentation.
|
|
97
97
|
|
|
98
98
|
<!--
|
|
99
99
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Every day, Bun gets closer to 100% Node.js API compatibility. Today, popular frameworks like Next.js, Express, and millions of `npm` packages intended for Node just work with Bun. To ensure compatibility, we run thousands of tests from Node.js' test suite before every release of Bun.
|
|
2
2
|
|
|
3
|
-
**If a package works in Node.js but doesn't work in Bun, we consider it a bug in Bun.** Please [open an issue](https://bun.
|
|
3
|
+
**If a package works in Node.js but doesn't work in Bun, we consider it a bug in Bun.** Please [open an issue](https://bun.com/issues) and we'll fix it.
|
|
4
4
|
|
|
5
5
|
This page is updated regularly to reflect compatibility status of the latest version of Bun. The information below reflects Bun's compatibility with _Node.js v23_.
|
|
6
6
|
|
|
@@ -116,7 +116,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
|
|
|
116
116
|
|
|
117
117
|
### [`node:module`](https://nodejs.org/api/module.html)
|
|
118
118
|
|
|
119
|
-
🟡 Missing `syncBuiltinESMExports`, `Module#load()`. Overriding `require.cache` is supported for ESM & CJS modules. `module._extensions`, `module._pathCache`, `module._cache` are no-ops. `module.register` is not implemented and we recommend using a [`Bun.plugin`](https://bun.
|
|
119
|
+
🟡 Missing `syncBuiltinESMExports`, `Module#load()`. Overriding `require.cache` is supported for ESM & CJS modules. `module._extensions`, `module._pathCache`, `module._cache` are no-ops. `module.register` is not implemented and we recommend using a [`Bun.plugin`](https://bun.com/docs/runtime/plugins) in the meantime.
|
|
120
120
|
|
|
121
121
|
### [`node:net`](https://nodejs.org/api/net.html)
|
|
122
122
|
|
|
@@ -144,7 +144,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
|
|
|
144
144
|
|
|
145
145
|
### [`node:v8`](https://nodejs.org/api/v8.html)
|
|
146
146
|
|
|
147
|
-
🟡 `writeHeapSnapshot` and `getHeapSnapshot` are implemented. `serialize` and `deserialize` use JavaScriptCore's wire format instead of V8's. Other methods are not implemented. For profiling, use [`bun:jsc`](https://bun.
|
|
147
|
+
🟡 `writeHeapSnapshot` and `getHeapSnapshot` are implemented. `serialize` and `deserialize` use JavaScriptCore's wire format instead of V8's. Other methods are not implemented. For profiling, use [`bun:jsc`](https://bun.com/docs/project/benchmarking#bunjsc) instead.
|
|
148
148
|
|
|
149
149
|
### [`node:vm`](https://nodejs.org/api/vm.html)
|
|
150
150
|
|
|
@@ -172,7 +172,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
|
|
|
172
172
|
|
|
173
173
|
### [`node:test`](https://nodejs.org/api/test.html)
|
|
174
174
|
|
|
175
|
-
🟡 Partly implemented. Missing mocks, snapshots, timers. Use [`bun:test`](https://bun.
|
|
175
|
+
🟡 Partly implemented. Missing mocks, snapshots, timers. Use [`bun:test`](https://bun.com/docs/cli/test) instead.
|
|
176
176
|
|
|
177
177
|
### [`node:trace_events`](https://nodejs.org/api/tracing.html)
|
|
178
178
|
|
package/docs/runtime/plugins.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Bun provides a universal plugin API that can be used to extend both the _runtime_ and [_bundler_](https://bun.
|
|
1
|
+
Bun provides a universal plugin API that can be used to extend both the _runtime_ and [_bundler_](https://bun.com/docs/bundler).
|
|
2
2
|
|
|
3
3
|
Plugins intercept imports and perform custom loading logic: reading files, transpiling code, etc. They can be used to add support for additional file types, like `.scss` or `.yaml`. In the context of Bun's bundler, plugins can be used to implement framework-level features like CSS extraction, macros, and client-server code co-location.
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ const myPlugin: BunPlugin = {
|
|
|
19
19
|
plugin(myPlugin);
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Plugins have to be loaded before any other code runs! To achieve this, use the `preload` option in your [`bunfig.toml`](https://bun.
|
|
22
|
+
Plugins have to be loaded before any other code runs! To achieve this, use the `preload` option in your [`bunfig.toml`](https://bun.com/docs/runtime/bunfig). Bun automatically loads the files/modules specified in `preload` before running a file.
|
|
23
23
|
|
|
24
24
|
```toml
|
|
25
25
|
preload = ["./myPlugin.ts"]
|
|
@@ -53,7 +53,7 @@ plugin(
|
|
|
53
53
|
);
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
-
Bun's plugin API is loosely based on [esbuild](https://esbuild.github.io/plugins). Only [a subset](https://bun.
|
|
56
|
+
Bun's plugin API is loosely based on [esbuild](https://esbuild.github.io/plugins). Only [a subset](https://bun.com/docs/bundler/vs-esbuild#plugin-api) of the esbuild API is implemented, but some esbuild plugins "just work" in Bun, like the official [MDX loader](https://mdxjs.com/packages/esbuild/):
|
|
57
57
|
|
|
58
58
|
```jsx
|
|
59
59
|
import { plugin } from "bun";
|
|
@@ -116,7 +116,7 @@ releaseYear: 2023
|
|
|
116
116
|
|
|
117
117
|
Note that the returned object has a `loader` property. This tells Bun which of its internal loaders should be used to handle the result. Even though we're implementing a loader for `.yaml`, the result must still be understandable by one of Bun's built-in loaders. It's loaders all the way down.
|
|
118
118
|
|
|
119
|
-
In this case we're using `"object"`—a built-in loader (intended for use by plugins) that converts a plain JavaScript object to an equivalent ES module. Any of Bun's built-in loaders are supported; these same loaders are used by Bun internally for handling files of various kinds. The table below is a quick reference; refer to [Bundler > Loaders](https://bun.
|
|
119
|
+
In this case we're using `"object"`—a built-in loader (intended for use by plugins) that converts a plain JavaScript object to an equivalent ES module. Any of Bun's built-in loaders are supported; these same loaders are used by Bun internally for handling files of various kinds. The table below is a quick reference; refer to [Bundler > Loaders](https://bun.com/docs/bundler/loaders) for complete documentation.
|
|
120
120
|
|
|
121
121
|
{% table %}
|
|
122
122
|
|
|
@@ -310,7 +310,7 @@ await import("my-object-virtual-module"); // { baz: "quix" }
|
|
|
310
310
|
|
|
311
311
|
## Reading or modifying the config
|
|
312
312
|
|
|
313
|
-
Plugins can read and write to the [build config](https://bun.
|
|
313
|
+
Plugins can read and write to the [build config](https://bun.com/docs/bundler#api) with `build.config`.
|
|
314
314
|
|
|
315
315
|
```ts
|
|
316
316
|
await Bun.build({
|
|
@@ -2,7 +2,7 @@ Bun treats TypeScript as a first-class citizen.
|
|
|
2
2
|
|
|
3
3
|
{% callout %}
|
|
4
4
|
|
|
5
|
-
**Note** — To add type declarations for Bun APIs like the `Bun` global, follow the instructions at [Intro > TypeScript](https://bun.
|
|
5
|
+
**Note** — To add type declarations for Bun APIs like the `Bun` global, follow the instructions at [Intro > TypeScript](https://bun.com/docs/typescript). This page describes how the Bun runtime runs TypeScript code.
|
|
6
6
|
|
|
7
7
|
{% /callout %}
|
|
8
8
|
|
package/docs/test/dom.md
CHANGED
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.2.19-canary.
|
|
2
|
+
"version": "1.2.19-canary.20250710T140803",
|
|
3
3
|
"name": "bun-types",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"types": "./index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"CLAUDE.md",
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
|
-
"homepage": "https://bun.
|
|
19
|
+
"homepage": "https://bun.com",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@types/node": "*"
|
|
22
22
|
},
|
package/shell.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare module "bun" {
|
|
|
12
12
|
| ReadableStream;
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* The [Bun shell](https://bun.
|
|
15
|
+
* The [Bun shell](https://bun.com/docs/runtime/shell) is a powerful tool for running shell commands.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```ts
|
|
@@ -206,7 +206,7 @@ declare module "bun" {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
|
-
* ShellError represents an error that occurred while executing a shell command with [the Bun Shell](https://bun.
|
|
209
|
+
* ShellError represents an error that occurred while executing a shell command with [the Bun Shell](https://bun.com/docs/runtime/shell).
|
|
210
210
|
*
|
|
211
211
|
* @example
|
|
212
212
|
* ```ts
|