bun-types 1.2.23-canary.20250928T140513 → 1.2.23-canary.20250930T140635

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/docs/api/fetch.md CHANGED
@@ -233,6 +233,7 @@ In addition to the standard fetch options, Bun provides several extensions:
233
233
  ```ts
234
234
  const response = await fetch("http://example.com", {
235
235
  // Control automatic response decompression (default: true)
236
+ // Supports gzip, deflate, brotli (br), and zstd
236
237
  decompress: true,
237
238
 
238
239
  // Disable connection reuse for this request
@@ -336,10 +337,10 @@ This will print the request and response headers to your terminal:
336
337
  ```sh
337
338
  [fetch] > HTTP/1.1 GET http://example.com/
338
339
  [fetch] > Connection: keep-alive
339
- [fetch] > User-Agent: Bun/1.2.23-canary.20250928T140513
340
+ [fetch] > User-Agent: Bun/1.2.23-canary.20250930T140635
340
341
  [fetch] > Accept: */*
341
342
  [fetch] > Host: example.com
342
- [fetch] > Accept-Encoding: gzip, deflate, br
343
+ [fetch] > Accept-Encoding: gzip, deflate, br, zstd
343
344
 
344
345
  [fetch] < 200 OK
345
346
  [fetch] < Content-Encoding: gzip
package/docs/api/glob.md CHANGED
@@ -155,3 +155,24 @@ const glob = new Glob("\\!index.ts");
155
155
  glob.match("!index.ts"); // => true
156
156
  glob.match("index.ts"); // => false
157
157
  ```
158
+
159
+ ## Node.js `fs.glob()` compatibility
160
+
161
+ Bun also implements Node.js's `fs.glob()` functions with additional features:
162
+
163
+ ```ts
164
+ import { glob, globSync, promises } from "node:fs";
165
+
166
+ // Array of patterns
167
+ const files = await promises.glob(["**/*.ts", "**/*.js"]);
168
+
169
+ // Exclude patterns
170
+ const filtered = await promises.glob("**/*", {
171
+ exclude: ["node_modules/**", "*.test.*"],
172
+ });
173
+ ```
174
+
175
+ All three functions (`fs.glob()`, `fs.globSync()`, `fs.promises.glob()`) support:
176
+
177
+ - Array of patterns as the first argument
178
+ - `exclude` option to filter results
package/docs/api/redis.md CHANGED
@@ -88,6 +88,9 @@ await redis.set("user:1:name", "Alice");
88
88
  // Get a key
89
89
  const name = await redis.get("user:1:name");
90
90
 
91
+ // Get a key as Uint8Array
92
+ const buffer = await redis.getBuffer("user:1:name");
93
+
91
94
  // Delete a key
92
95
  await redis.del("user:1:name");
93
96
 
@@ -132,6 +135,10 @@ await redis.hmset("user:123", [
132
135
  const userFields = await redis.hmget("user:123", ["name", "email"]);
133
136
  console.log(userFields); // ["Alice", "alice@example.com"]
134
137
 
138
+ // Get single field from hash (returns value directly, null if missing)
139
+ const userName = await redis.hget("user:123", "name");
140
+ console.log(userName); // "Alice"
141
+
135
142
  // Increment a numeric field in a hash
136
143
  await redis.hincrby("user:123", "visits", 1);
137
144
 
package/docs/api/spawn.md CHANGED
@@ -140,7 +140,7 @@ You can read results from the subprocess via the `stdout` and `stderr` propertie
140
140
  ```ts
141
141
  const proc = Bun.spawn(["bun", "--version"]);
142
142
  const text = await proc.stdout.text();
143
- console.log(text); // => "1.2.23-canary.20250928T140513\n"
143
+ console.log(text); // => "1.2.23-canary.20250930T140635\n"
144
144
  ```
145
145
 
146
146
  Configure the output stream by passing one of the following values to `stdout/stderr`:
package/docs/api/sql.md CHANGED
@@ -377,6 +377,22 @@ const users = [
377
377
  await sql`SELECT * FROM users WHERE id IN ${sql(users, "id")}`;
378
378
  ```
379
379
 
380
+ ### `sql.array` helper
381
+
382
+ The `sql.array` helper creates PostgreSQL array literals from JavaScript arrays:
383
+
384
+ ```ts
385
+ // Create array literals for PostgreSQL
386
+ await sql`INSERT INTO tags (items) VALUES (${sql.array(["red", "blue", "green"])})`;
387
+ // Generates: INSERT INTO tags (items) VALUES (ARRAY['red', 'blue', 'green'])
388
+
389
+ // Works with numeric arrays too
390
+ await sql`SELECT * FROM products WHERE ids = ANY(${sql.array([1, 2, 3])})`;
391
+ // Generates: SELECT * FROM products WHERE ids = ANY(ARRAY[1, 2, 3])
392
+ ```
393
+
394
+ **Note**: `sql.array` is PostgreSQL-only. Multi-dimensional arrays and NULL elements may not be supported yet.
395
+
380
396
  ## `sql``.simple()`
381
397
 
382
398
  The PostgreSQL wire protocol supports two types of queries: "simple" and "extended". Simple queries can contain multiple statements but don't support parameters, while extended queries (the default) support parameters but only allow one statement.
@@ -663,6 +663,8 @@ class Statement<Params, ReturnType> {
663
663
  toString(): string; // serialize to SQL
664
664
 
665
665
  columnNames: string[]; // the column names of the result set
666
+ columnTypes: string[]; // types based on actual values in first row (call .get()/.all() first)
667
+ declaredTypes: (string | null)[]; // types from CREATE TABLE schema (call .get()/.all() first)
666
668
  paramsCount: number; // the number of parameters expected by the statement
667
669
  native: any; // the native object representing the statement
668
670
 
@@ -28,6 +28,20 @@ for await (const chunk of stream) {
28
28
  }
29
29
  ```
30
30
 
31
+ `ReadableStream` also provides convenience methods for consuming the entire stream:
32
+
33
+ ```ts
34
+ const stream = new ReadableStream({
35
+ start(controller) {
36
+ controller.enqueue("hello world");
37
+ controller.close();
38
+ },
39
+ });
40
+
41
+ const data = await stream.text(); // => "hello world"
42
+ // Also available: .json(), .bytes(), .blob()
43
+ ```
44
+
31
45
  ## Direct `ReadableStream`
32
46
 
33
47
  Bun implements an optimized version of `ReadableStream` that avoid unnecessary data copying & queue management logic. With a traditional `ReadableStream`, chunks of data are _enqueued_. Each chunk is copied into a queue, where it sits until the stream is ready to send more data.
package/docs/api/utils.md CHANGED
@@ -602,6 +602,40 @@ dec.decode(decompressed);
602
602
  // => "hellohellohello..."
603
603
  ```
604
604
 
605
+ ## `Bun.zstdCompress()` / `Bun.zstdCompressSync()`
606
+
607
+ Compresses a `Uint8Array` using the Zstandard algorithm.
608
+
609
+ ```ts
610
+ const buf = Buffer.from("hello".repeat(100));
611
+
612
+ // Synchronous
613
+ const compressedSync = Bun.zstdCompressSync(buf);
614
+ // Asynchronous
615
+ const compressedAsync = await Bun.zstdCompress(buf);
616
+
617
+ // With compression level (1-22, default: 3)
618
+ const compressedLevel = Bun.zstdCompressSync(buf, { level: 6 });
619
+ ```
620
+
621
+ ## `Bun.zstdDecompress()` / `Bun.zstdDecompressSync()`
622
+
623
+ Decompresses a `Uint8Array` using the Zstandard algorithm.
624
+
625
+ ```ts
626
+ const buf = Buffer.from("hello".repeat(100));
627
+ const compressed = Bun.zstdCompressSync(buf);
628
+
629
+ // Synchronous
630
+ const decompressedSync = Bun.zstdDecompressSync(compressed);
631
+ // Asynchronous
632
+ const decompressedAsync = await Bun.zstdDecompress(compressed);
633
+
634
+ const dec = new TextDecoder();
635
+ dec.decode(decompressedSync);
636
+ // => "hellohellohello..."
637
+ ```
638
+
605
639
  ## `Bun.inspect()`
606
640
 
607
641
  Serializes an object to a `string` exactly as it would be printed by `console.log`.
@@ -279,6 +279,9 @@ Bun implements the `WebSocket` class. To create a WebSocket client that connects
279
279
 
280
280
  ```ts
281
281
  const socket = new WebSocket("ws://localhost:3000");
282
+
283
+ // With subprotocol negotiation
284
+ const socket2 = new WebSocket("ws://localhost:3000", ["soap", "wamp"]);
282
285
  ```
283
286
 
284
287
  In browsers, the cookies that are currently set on the page will be sent with the WebSocket upgrade request. This is a standard feature of the `WebSocket` API.
@@ -293,6 +296,17 @@ const socket = new WebSocket("ws://localhost:3000", {
293
296
  });
294
297
  ```
295
298
 
299
+ ### Client compression
300
+
301
+ WebSocket clients support permessage-deflate compression. The `extensions` property shows negotiated compression:
302
+
303
+ ```ts
304
+ const socket = new WebSocket("wss://echo.websocket.org");
305
+ socket.addEventListener("open", () => {
306
+ console.log(socket.extensions); // => "permessage-deflate"
307
+ });
308
+ ```
309
+
296
310
  To add event listeners to the socket:
297
311
 
298
312
  ```ts
@@ -282,6 +282,31 @@ const worker = new Worker("./i-am-smol.ts", {
282
282
  Setting `smol: true` sets `JSC::HeapSize` to be `Small` instead of the default `Large`.
283
283
  {% /details %}
284
284
 
285
+ ## Environment Data
286
+
287
+ Share data between the main thread and workers using `setEnvironmentData()` and `getEnvironmentData()`.
288
+
289
+ ```js
290
+ import { setEnvironmentData, getEnvironmentData } from "worker_threads";
291
+
292
+ // In main thread
293
+ setEnvironmentData("config", { apiUrl: "https://api.example.com" });
294
+
295
+ // In worker
296
+ const config = getEnvironmentData("config");
297
+ console.log(config); // => { apiUrl: "https://api.example.com" }
298
+ ```
299
+
300
+ ## Worker Events
301
+
302
+ Listen for worker creation events using `process.emit()`:
303
+
304
+ ```js
305
+ process.on("worker", worker => {
306
+ console.log("New worker created:", worker.threadId);
307
+ });
308
+ ```
309
+
285
310
  ## `Bun.isMainThread`
286
311
 
287
312
  You can check if you're in the main thread by checking `Bun.isMainThread`.
@@ -140,6 +140,19 @@ The `--sourcemap` argument embeds a sourcemap compressed with zstd, so that erro
140
140
 
141
141
  The `--bytecode` argument enables bytecode compilation. Every time you run JavaScript code in Bun, JavaScriptCore (the engine) will compile your source code into bytecode. We can move this parsing work from runtime to bundle time, saving you startup time.
142
142
 
143
+ ## Embedding runtime arguments
144
+
145
+ **`--compile-exec-argv="args"`** - Embed runtime arguments that are available via `process.execArgv`:
146
+
147
+ ```bash
148
+ bun build --compile --compile-exec-argv="--smol --user-agent=MyBot" ./app.ts --outfile myapp
149
+ ```
150
+
151
+ ```js
152
+ // In the compiled app
153
+ console.log(process.execArgv); // ["--smol", "--user-agent=MyBot"]
154
+ ```
155
+
143
156
  ## Act as the Bun CLI
144
157
 
145
158
  {% note %}
@@ -313,6 +313,14 @@ $ bun build --entrypoints ./index.ts --outdir ./out --target browser
313
313
 
314
314
  Depending on the target, Bun will apply different module resolution rules and optimizations.
315
315
 
316
+ ### Module resolution
317
+
318
+ Bun supports the `NODE_PATH` environment variable for additional module resolution paths:
319
+
320
+ ```bash
321
+ NODE_PATH=./src bun build ./entry.js --outdir ./dist
322
+ ```
323
+
316
324
  <!-- - Module resolution. For example, when bundling for the browser, Bun will prioritize the `"browser"` export condition when resolving imports. An error will be thrown if any Node.js or Bun built-ins are imported or used, e.g. `node:fs` or `Bun.serve`. -->
317
325
 
318
326
  {% table %}
@@ -392,6 +400,55 @@ $ bun build ./index.tsx --outdir ./out --format cjs
392
400
 
393
401
  TODO: document IIFE once we support globalNames.
394
402
 
403
+ ### `jsx`
404
+
405
+ Configure JSX transform behavior. Allows fine-grained control over how JSX is compiled.
406
+
407
+ **Classic runtime example** (uses `factory` and `fragment`):
408
+
409
+ {% codetabs %}
410
+
411
+ ```ts#JavaScript
412
+ await Bun.build({
413
+ entrypoints: ['./app.tsx'],
414
+ outdir: './out',
415
+ jsx: {
416
+ factory: 'h',
417
+ fragment: 'Fragment',
418
+ runtime: 'classic',
419
+ },
420
+ })
421
+ ```
422
+
423
+ ```bash#CLI
424
+ # JSX configuration is handled via bunfig.toml or tsconfig.json
425
+ $ bun build ./app.tsx --outdir ./out
426
+ ```
427
+
428
+ {% /codetabs %}
429
+
430
+ **Automatic runtime example** (uses `importSource`):
431
+
432
+ {% codetabs %}
433
+
434
+ ```ts#JavaScript
435
+ await Bun.build({
436
+ entrypoints: ['./app.tsx'],
437
+ outdir: './out',
438
+ jsx: {
439
+ importSource: 'preact',
440
+ runtime: 'automatic',
441
+ },
442
+ })
443
+ ```
444
+
445
+ ```bash#CLI
446
+ # JSX configuration is handled via bunfig.toml or tsconfig.json
447
+ $ bun build ./app.tsx --outdir ./out
448
+ ```
449
+
450
+ {% /codetabs %}
451
+
395
452
  ### `splitting`
396
453
 
397
454
  Whether to enable code splitting.
@@ -1519,6 +1576,15 @@ interface BuildConfig {
1519
1576
  * @default "esm"
1520
1577
  */
1521
1578
  format?: "esm" | "cjs" | "iife";
1579
+ /**
1580
+ * JSX configuration object for controlling JSX transform behavior
1581
+ */
1582
+ jsx?: {
1583
+ factory?: string;
1584
+ fragment?: string;
1585
+ importSource?: string;
1586
+ runtime?: "automatic" | "classic";
1587
+ };
1522
1588
  naming?:
1523
1589
  | string
1524
1590
  | {
@@ -176,7 +176,21 @@ When a `bun.lock` exists and `package.json` hasn’t changed, Bun downloads miss
176
176
 
177
177
  ## Platform-specific dependencies?
178
178
 
179
- bun stores normalized `cpu` and `os` values from npm in the lockfile, along with the resolved packages. It skips downloading, extracting, and installing packages disabled for the current target at runtime. This means the lockfile wont change between platforms/architectures even if the packages ultimately installed do change.
179
+ bun stores normalized `cpu` and `os` values from npm in the lockfile, along with the resolved packages. It skips downloading, extracting, and installing packages disabled for the current target at runtime. This means the lockfile won't change between platforms/architectures even if the packages ultimately installed do change.
180
+
181
+ ### `--cpu` and `--os` flags
182
+
183
+ You can override the target platform for package selection:
184
+
185
+ ```bash
186
+ bun install --cpu=x64 --os=linux
187
+ ```
188
+
189
+ This installs packages for the specified platform instead of the current system. Useful for cross-platform builds or when preparing deployments for different environments.
190
+
191
+ **Accepted values for `--cpu`**: `arm64`, `x64`, `ia32`, `ppc64`, `s390x`
192
+
193
+ **Accepted values for `--os`**: `linux`, `darwin`, `win32`, `freebsd`, `openbsd`, `sunos`, `aix`
180
194
 
181
195
  ## Peer dependencies?
182
196
 
@@ -245,3 +259,91 @@ bun uses a binary format for caching NPM registry responses. This loads much fas
245
259
  You will see these files in `~/.bun/install/cache/*.npm`. The filename pattern is `${hash(packageName)}.npm`. It’s a hash so that extra directories don’t need to be created for scoped packages.
246
260
 
247
261
  Bun's usage of `Cache-Control` ignores `Age`. This improves performance, but means bun may be about 5 minutes out of date to receive the latest package version metadata from npm.
262
+
263
+ ## pnpm migration
264
+
265
+ Bun automatically migrates projects from pnpm to bun. When a `pnpm-lock.yaml` file is detected and no `bun.lock` file exists, Bun will automatically migrate the lockfile to `bun.lock` during installation. The original `pnpm-lock.yaml` file remains unmodified.
266
+
267
+ ```bash
268
+ bun install
269
+ ```
270
+
271
+ **Note**: Migration only runs when `bun.lock` is absent. There is currently no opt-out flag for pnpm migration.
272
+
273
+ The migration process handles:
274
+
275
+ ### Lockfile Migration
276
+
277
+ - Converts `pnpm-lock.yaml` to `bun.lock` format
278
+ - Preserves package versions and resolution information
279
+ - Maintains dependency relationships and peer dependencies
280
+ - Handles patched dependencies with integrity hashes
281
+
282
+ ### Workspace Configuration
283
+
284
+ When a `pnpm-workspace.yaml` file exists, Bun migrates workspace settings to your root `package.json`:
285
+
286
+ ```yaml
287
+ # pnpm-workspace.yaml
288
+ packages:
289
+ - "apps/*"
290
+ - "packages/*"
291
+
292
+ catalog:
293
+ react: ^18.0.0
294
+ typescript: ^5.0.0
295
+
296
+ catalogs:
297
+ build:
298
+ webpack: ^5.0.0
299
+ babel: ^7.0.0
300
+ ```
301
+
302
+ The workspace packages list and catalogs are moved to the `workspaces` field in `package.json`:
303
+
304
+ ```json
305
+ {
306
+ "workspaces": {
307
+ "packages": ["apps/*", "packages/*"],
308
+ "catalog": {
309
+ "react": "^18.0.0",
310
+ "typescript": "^5.0.0"
311
+ },
312
+ "catalogs": {
313
+ "build": {
314
+ "webpack": "^5.0.0",
315
+ "babel": "^7.0.0"
316
+ }
317
+ }
318
+ }
319
+ }
320
+ ```
321
+
322
+ ### Catalog Dependencies
323
+
324
+ Dependencies using pnpm's `catalog:` protocol are preserved:
325
+
326
+ ```json
327
+ {
328
+ "dependencies": {
329
+ "react": "catalog:",
330
+ "webpack": "catalog:build"
331
+ }
332
+ }
333
+ ```
334
+
335
+ ### Configuration Migration
336
+
337
+ The following pnpm configuration is migrated from both `pnpm-lock.yaml` and `pnpm-workspace.yaml`:
338
+
339
+ - **Overrides**: Moved from `pnpm.overrides` to root-level `overrides` in `package.json`
340
+ - **Patched Dependencies**: Moved from `pnpm.patchedDependencies` to root-level `patchedDependencies` in `package.json`
341
+ - **Workspace Overrides**: Applied from `pnpm-workspace.yaml` to root `package.json`
342
+
343
+ ### Requirements
344
+
345
+ - Requires pnpm lockfile version 7 or higher
346
+ - Workspace packages must have a `name` field in their `package.json`
347
+ - All catalog entries referenced by dependencies must exist in the catalogs definition
348
+
349
+ After migration, you can safely remove `pnpm-lock.yaml` and `pnpm-workspace.yaml` files.
package/docs/cli/bunx.md CHANGED
@@ -63,6 +63,15 @@ $ bunx --bun my-cli # good
63
63
  $ bunx my-cli --bun # bad
64
64
  ```
65
65
 
66
+ ## Package flag
67
+
68
+ **`--package <pkg>` or `-p <pkg>`** - Run binary from specific package. Useful when binary name differs from package name:
69
+
70
+ ```bash
71
+ bunx -p renovate renovate-config-validator
72
+ bunx --package @angular/cli ng
73
+ ```
74
+
66
75
  To force bun to always be used with a script, use a shebang.
67
76
 
68
77
  ```
package/docs/cli/init.md CHANGED
@@ -33,6 +33,11 @@ It creates:
33
33
  - an entry point which defaults to `index.ts` unless any of `index.{tsx, jsx, js, mts, mjs}` exist or the `package.json` specifies a `module` or `main` field
34
34
  - a `README.md` file
35
35
 
36
+ AI Agent rules (disable with `$BUN_AGENT_RULE_DISABLED=1`):
37
+
38
+ - a `CLAUDE.md` file when Claude CLI is detected (disable with `CLAUDE_CODE_AGENT_RULE_DISABLED` env var)
39
+ - a `.cursor/rules/*.mdc` file to guide [Cursor AI](https://cursor.sh) to use Bun instead of Node.js and npm when Cursor is detected
40
+
36
41
  If you pass `-y` or `--yes`, it will assume you want to continue without asking questions.
37
42
 
38
43
  At the end, it runs `bun install` to install `@types/bun`.
@@ -44,4 +44,47 @@ You can also pass glob patterns to filter by workspace names:
44
44
 
45
45
  {% bunOutdatedTerminal glob="{e,t}*" displayGlob="--filter='@monorepo/{types,cli}'" /%}
46
46
 
47
+ ### Catalog Dependencies
48
+
49
+ `bun outdated` supports checking catalog dependencies defined in `package.json`:
50
+
51
+ ```sh
52
+ $ bun outdated -r
53
+ ┌────────────────────┬─────────┬─────────┬─────────┬────────────────────────────────┐
54
+ │ Package │ Current │ Update │ Latest │ Workspace │
55
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
56
+ │ body-parser │ 1.19.0 │ 1.19.0 │ 2.2.0 │ @test/shared │
57
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
58
+ │ cors │ 2.8.0 │ 2.8.0 │ 2.8.5 │ @test/shared │
59
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
60
+ │ chalk │ 4.0.0 │ 4.0.0 │ 5.6.2 │ @test/utils │
61
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
62
+ │ uuid │ 8.0.0 │ 8.0.0 │ 13.0.0 │ @test/utils │
63
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
64
+ │ axios │ 0.21.0 │ 0.21.0 │ 1.12.2 │ catalog (@test/app) │
65
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
66
+ │ lodash │ 4.17.15 │ 4.17.15 │ 4.17.21 │ catalog (@test/app, @test/app) │
67
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
68
+ │ react │ 17.0.0 │ 17.0.0 │ 19.1.1 │ catalog (@test/app) │
69
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
70
+ │ react-dom │ 17.0.0 │ 17.0.0 │ 19.1.1 │ catalog (@test/app) │
71
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
72
+ │ express │ 4.17.0 │ 4.17.0 │ 5.1.0 │ catalog (@test/shared) │
73
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
74
+ │ moment │ 2.24.0 │ 2.24.0 │ 2.30.1 │ catalog (@test/utils) │
75
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
76
+ │ @types/node (dev) │ 14.0.0 │ 14.0.0 │ 24.5.2 │ @test/shared │
77
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
78
+ │ @types/react (dev) │ 17.0.0 │ 17.0.0 │ 19.1.15 │ catalog:testing (@test/app) │
79
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
80
+ │ eslint (dev) │ 7.0.0 │ 7.0.0 │ 9.36.0 │ catalog:testing (@test/app) │
81
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
82
+ │ typescript (dev) │ 4.9.5 │ 4.9.5 │ 5.9.2 │ catalog:build (@test/app) │
83
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
84
+ │ jest (dev) │ 26.0.0 │ 26.0.0 │ 30.2.0 │ catalog:testing (@test/shared) │
85
+ ├────────────────────┼─────────┼─────────┼─────────┼────────────────────────────────┤
86
+ │ prettier (dev) │ 2.0.0 │ 2.0.0 │ 3.6.2 │ catalog:build (@test/utils) │
87
+ └────────────────────┴─────────┴─────────┴─────────┴────────────────────────────────┘
88
+ ```
89
+
47
90
  {% bunCLIUsage command="outdated" /%}
package/docs/cli/pm.md CHANGED
@@ -213,7 +213,7 @@ To display current package version and help:
213
213
 
214
214
  ```bash
215
215
  $ bun pm version
216
- bun pm version v1.2.23-canary.20250928T140513 (ca7428e9)
216
+ bun pm version v1.2.23-canary.20250930T140635 (ca7428e9)
217
217
  Current package version: v1.0.0
218
218
 
219
219
  Increment:
@@ -7,7 +7,7 @@ Use `bun publish` to publish a package to the npm registry.
7
7
  $ bun publish
8
8
 
9
9
  ## Output
10
- bun publish v1.2.23-canary.20250928T140513 (ca7428e9)
10
+ bun publish v1.2.23-canary.20250930T140635 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
package/docs/cli/run.md CHANGED
@@ -151,6 +151,14 @@ By default, Bun respects this shebang and executes the script with `node`. Howev
151
151
  $ bun run --bun vite
152
152
  ```
153
153
 
154
+ ### `--no-addons`
155
+
156
+ Disable native addons and use the `node-addons` export condition.
157
+
158
+ ```bash
159
+ $ bun --no-addons run server.js
160
+ ```
161
+
154
162
  ### Filtering
155
163
 
156
164
  In monorepos containing multiple packages, you can use the `--filter` argument to execute scripts in many packages at once.
@@ -166,6 +174,14 @@ will execute `<script>` in both `bar` and `baz`, but not in `foo`.
166
174
 
167
175
  Find more details in the docs page for [filter](https://bun.com/docs/cli/filter#running-scripts-with-filter).
168
176
 
177
+ ### `--workspaces`
178
+
179
+ Run scripts across all workspaces in the monorepo:
180
+
181
+ ```bash
182
+ bun run --workspaces test
183
+ ```
184
+
169
185
  ## `bun run -` to pipe code from stdin
170
186
 
171
187
  `bun run -` lets you read JavaScript, TypeScript, TSX, or JSX from stdin and execute it without writing to a temporary file first.
@@ -212,6 +228,14 @@ $ bun --smol run index.tsx
212
228
 
213
229
  This causes the garbage collector to run more frequently, which can slow down execution. However, it can be useful in environments with limited memory. Bun automatically adjusts the garbage collector's heap size based on the available memory (accounting for cgroups and other memory limits) with and without the `--smol` flag, so this is mostly useful for cases where you want to make the heap size grow more slowly.
214
230
 
231
+ ## `--user-agent`
232
+
233
+ **`--user-agent <string>`** - Set User-Agent header for all `fetch()` requests:
234
+
235
+ ```bash
236
+ bun --user-agent "MyBot/1.0" run index.tsx
237
+ ```
238
+
215
239
  ## Resolution order
216
240
 
217
241
  Absolute paths and paths starting with `./` or `.\\` are always executed as source files. Unless using `bun run`, running a file with an allowed extension will prefer the file over a package.json script.
@@ -223,4 +247,15 @@ When there is a package.json script and a file with the same name, `bun run` pri
223
247
  3. Binaries from project packages, eg `bun add eslint && bun run eslint`
224
248
  4. (`bun run` only) System commands, eg `bun run ls`
225
249
 
250
+ ### `--unhandled-rejections`
251
+
252
+ Configure how unhandled promise rejections are handled:
253
+
254
+ ```bash
255
+ $ bun --unhandled-rejections=throw script.js # Throw exception (terminate immediately)
256
+ $ bun --unhandled-rejections=strict script.js # Throw exception (emit rejectionHandled if handled later)
257
+ $ bun --unhandled-rejections=warn script.js # Print warning to stderr (default in Node.js)
258
+ $ bun --unhandled-rejections=none script.js # Silently ignore
259
+ ```
260
+
226
261
  {% bunCLIUsage command="run" /%}
package/docs/cli/test.md CHANGED
@@ -47,6 +47,8 @@ To filter by _test name_, use the `-t`/`--test-name-pattern` flag.
47
47
  $ bun test --test-name-pattern addition
48
48
  ```
49
49
 
50
+ When no tests match the filter, `bun test` exits with code 1.
51
+
50
52
  To run a specific file in the test runner, make sure the path starts with `./` or `/` to distinguish it from a filter name.
51
53
 
52
54
  ```bash
@@ -186,6 +188,11 @@ test.serial("second serial test", () => {
186
188
  test("independent test", () => {
187
189
  expect(true).toBe(true);
188
190
  });
191
+
192
+ // Chaining test qualifiers
193
+ test.failing.each([1, 2, 3])("chained qualifiers %d", input => {
194
+ expect(input).toBe(0); // This test is expected to fail for each input
195
+ });
189
196
  ```
190
197
 
191
198
  ## Rerun tests
@@ -90,6 +90,17 @@ Packages are organized in sections by dependency type:
90
90
 
91
91
  Within each section, individual packages may have additional suffixes (` dev`, ` peer`, ` optional`) for extra clarity.
92
92
 
93
+ ## `--recursive`
94
+
95
+ Use the `--recursive` flag with `--interactive` to update dependencies across all workspaces in a monorepo:
96
+
97
+ ```sh
98
+ $ bun update --interactive --recursive
99
+ $ bun update -i -r
100
+ ```
101
+
102
+ This displays an additional "Workspace" column showing which workspace each dependency belongs to.
103
+
93
104
  ## `--latest`
94
105
 
95
106
  By default, `bun update` will update to the latest version of a dependency that satisfies the version range specified in your `package.json`.
@@ -9,7 +9,7 @@ $ bunx nuxi init my-nuxt-app
9
9
  ✔ Which package manager would you like to use?
10
10
  bun
11
11
  ◐ Installing dependencies...
12
- bun install v1.2.23-canary.20250928T140513 (16b4bf34)
12
+ bun install v1.2.23-canary.20250930T140635 (16b4bf34)
13
13
  + @nuxt/devtools@0.8.2
14
14
  + nuxt@3.7.0
15
15
  785 packages installed [2.67s]
@@ -15,7 +15,7 @@ This will add the package to `peerDependencies` in `package.json`.
15
15
  ```json-diff
16
16
  {
17
17
  "peerDependencies": {
18
- + "@types/bun": "^1.2.23-canary.20250928T140513"
18
+ + "@types/bun": "^1.2.23-canary.20250930T140635"
19
19
  }
20
20
  }
21
21
  ```
@@ -27,7 +27,7 @@ Running `bun install` will install peer dependencies by default, unless marked o
27
27
  ```json-diff
28
28
  {
29
29
  "peerDependencies": {
30
- "@types/bun": "^1.2.23-canary.20250928T140513"
30
+ "@types/bun": "^1.2.23-canary.20250930T140635"
31
31
  },
32
32
  "peerDependenciesMeta": {
33
33
  + "@types/bun": {
@@ -97,7 +97,7 @@ $ bun update
97
97
  $ bun update @types/bun --latest
98
98
 
99
99
  # Update a dependency to a specific version
100
- $ bun update @types/bun@1.2.23-canary.20250928T140513
100
+ $ bun update @types/bun@1.2.23-canary.20250930T140635
101
101
 
102
102
  # Update all dependencies to the latest versions
103
103
  $ bun update --latest
@@ -21,7 +21,7 @@ Here's what the output of a typical test run looks like. In this case, there are
21
21
 
22
22
  ```sh
23
23
  $ bun test
24
- bun test v1.2.23-canary.20250928T140513 (9c68abdb)
24
+ bun test v1.2.23-canary.20250930T140635 (9c68abdb)
25
25
 
26
26
  test.test.js:
27
27
  ✓ add [0.87ms]
@@ -47,7 +47,7 @@ To only run certain test files, pass a positional argument to `bun test`. The ru
47
47
 
48
48
  ```sh
49
49
  $ bun test test3
50
- bun test v1.2.23-canary.20250928T140513 (9c68abdb)
50
+ bun test v1.2.23-canary.20250930T140635 (9c68abdb)
51
51
 
52
52
  test3.test.js:
53
53
  ✓ add [1.40ms]
@@ -85,7 +85,7 @@ Adding `-t add` will only run tests with "add" in the name. This works with test
85
85
 
86
86
  ```sh
87
87
  $ bun test -t add
88
- bun test v1.2.23-canary.20250928T140513 (9c68abdb)
88
+ bun test v1.2.23-canary.20250930T140635 (9c68abdb)
89
89
 
90
90
  test.test.js:
91
91
  ✓ add [1.79ms]
@@ -18,7 +18,7 @@ The first time this test is executed, Bun will evaluate the value passed into `e
18
18
 
19
19
  ```sh
20
20
  $ bun test test/snap
21
- bun test v1.2.23-canary.20250928T140513 (9c68abdb)
21
+ bun test v1.2.23-canary.20250930T140635 (9c68abdb)
22
22
 
23
23
  test/snap.test.ts:
24
24
  ✓ snapshot [1.48ms]
@@ -61,7 +61,7 @@ Later, when this test file is executed again, Bun will read the snapshot file an
61
61
 
62
62
  ```sh
63
63
  $ bun test
64
- bun test v1.2.23-canary.20250928T140513 (9c68abdb)
64
+ bun test v1.2.23-canary.20250930T140635 (9c68abdb)
65
65
 
66
66
  test/snap.test.ts:
67
67
  ✓ snapshot [1.05ms]
@@ -78,7 +78,7 @@ To update snapshots, use the `--update-snapshots` flag.
78
78
 
79
79
  ```sh
80
80
  $ bun test --update-snapshots
81
- bun test v1.2.23-canary.20250928T140513 (9c68abdb)
81
+ bun test v1.2.23-canary.20250930T140635 (9c68abdb)
82
82
 
83
83
  test/snap.test.ts:
84
84
  ✓ snapshot [0.86ms]
@@ -29,7 +29,7 @@ To regenerate snapshots, use the `--update-snapshots` flag.
29
29
 
30
30
  ```sh
31
31
  $ bun test --update-snapshots
32
- bun test v1.2.23-canary.20250928T140513 (9c68abdb)
32
+ bun test v1.2.23-canary.20250930T140635 (9c68abdb)
33
33
 
34
34
  test/snap.test.ts:
35
35
  ✓ snapshot [0.86ms]
@@ -5,7 +5,7 @@ name: Get the current Bun version
5
5
  Get the current version of Bun in a semver format.
6
6
 
7
7
  ```ts#index.ts
8
- Bun.version; // => "1.2.23-canary.20250928T140513"
8
+ Bun.version; // => "1.2.23-canary.20250930T140635"
9
9
  ```
10
10
 
11
11
  ---
@@ -24,6 +24,26 @@ To update all dependencies to the latest versions (including breaking changes):
24
24
  bun update --latest
25
25
  ```
26
26
 
27
+ ### Filtering options
28
+
29
+ **`--audit-level=<low|moderate|high|critical>`** - Only show vulnerabilities at this severity level or higher:
30
+
31
+ ```bash
32
+ bun audit --audit-level=high
33
+ ```
34
+
35
+ **`--prod`** - Audit only production dependencies (excludes devDependencies):
36
+
37
+ ```bash
38
+ bun audit --prod
39
+ ```
40
+
41
+ **`--ignore <CVE>`** - Ignore specific CVEs (can be used multiple times):
42
+
43
+ ```bash
44
+ bun audit --ignore CVE-2022-25883 --ignore CVE-2023-26136
45
+ ```
46
+
27
47
  ### `--json`
28
48
 
29
49
  Use the `--json` flag to print the raw JSON response from the registry instead of the formatted report:
@@ -46,3 +46,13 @@ print = "yarn"
46
46
  Bun v1.2 changed the default lockfile format to the text-based `bun.lock`. Existing binary `bun.lockb` lockfiles can be migrated to the new format by running `bun install --save-text-lockfile --frozen-lockfile --lockfile-only` and deleting `bun.lockb`.
47
47
 
48
48
  More information about the new lockfile format can be found on [our blogpost](https://bun.com/blog/bun-lock-text-lockfile).
49
+
50
+ #### Automatic lockfile migration
51
+
52
+ When running `bun install` in a project without a `bun.lock`, Bun automatically migrates existing lockfiles:
53
+
54
+ - `yarn.lock` (v1)
55
+ - `package-lock.json` (npm)
56
+ - `pnpm-lock.yaml` (pnpm)
57
+
58
+ The original lockfile is preserved and can be removed manually after verification.
@@ -73,3 +73,33 @@ The equivalent `bunfig.toml` option is to add a key in [`install.scopes`](https:
73
73
  [install.scopes]
74
74
  myorg = { url = "http://localhost:4873/", username = "myusername", password = "$NPM_PASSWORD" }
75
75
  ```
76
+
77
+ ### `link-workspace-packages`: Control workspace package installation
78
+
79
+ Controls how workspace packages are installed when available locally:
80
+
81
+ ```ini
82
+ link-workspace-packages=true
83
+ ```
84
+
85
+ The equivalent `bunfig.toml` option is [`install.linkWorkspacePackages`](https://bun.com/docs/runtime/bunfig#install-linkworkspacepackages):
86
+
87
+ ```toml
88
+ [install]
89
+ linkWorkspacePackages = true
90
+ ```
91
+
92
+ ### `save-exact`: Save exact versions
93
+
94
+ Always saves exact versions without the `^` prefix:
95
+
96
+ ```ini
97
+ save-exact=true
98
+ ```
99
+
100
+ The equivalent `bunfig.toml` option is [`install.exact`](https://bun.com/docs/runtime/bunfig#install-exact):
101
+
102
+ ```toml
103
+ [install]
104
+ exact = true
105
+ ```
@@ -81,7 +81,7 @@ Workspaces have a couple major benefits.
81
81
 
82
82
  - **Code can be split into logical parts.** If one package relies on another, you can simply add it as a dependency in `package.json`. If package `b` depends on `a`, `bun install` will install your local `packages/a` directory into `node_modules` instead of downloading it from the npm registry.
83
83
  - **Dependencies can be de-duplicated.** If `a` and `b` share a common dependency, it will be _hoisted_ to the root `node_modules` directory. This reduces redundant disk usage and minimizes "dependency hell" issues associated with having multiple versions of a package installed simultaneously.
84
- - **Run scripts in multiple packages.** You can use the [`--filter` flag](https://bun.com/docs/cli/filter) to easily run `package.json` scripts in multiple packages in your workspace.
84
+ - **Run scripts in multiple packages.** You can use the [`--filter` flag](https://bun.com/docs/cli/filter) to easily run `package.json` scripts in multiple packages in your workspace, or `--workspaces` to run scripts across all workspaces.
85
85
 
86
86
  ## Share versions with Catalogs
87
87
 
@@ -14,7 +14,7 @@ Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1. Us
14
14
  ```bash#macOS/Linux_(curl)
15
15
  $ curl -fsSL https://bun.com/install | bash # for macOS, Linux, and WSL
16
16
  # to install a specific version
17
- $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250928T140513"
17
+ $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250930T140635"
18
18
  ```
19
19
 
20
20
  ```bash#npm
@@ -189,10 +189,10 @@ Since Bun is a single binary, you can install older versions of Bun by re-runnin
189
189
 
190
190
  ### Installing a specific version of Bun on Linux/Mac
191
191
 
192
- To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.23-canary.20250928T140513`.
192
+ To install a specific version of Bun, you can pass the git tag of the version you want to install to the install script, such as `bun-v1.2.0` or `bun-v1.2.23-canary.20250930T140635`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250928T140513"
195
+ $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.23-canary.20250930T140635"
196
196
  ```
197
197
 
198
198
  ### Installing a specific version of Bun on Windows
@@ -201,7 +201,7 @@ On Windows, you can install a specific version of Bun by passing the version num
201
201
 
202
202
  ```sh
203
203
  # PowerShell:
204
- $ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.23-canary.20250928T140513"
204
+ $ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.23-canary.20250930T140635"
205
205
  ```
206
206
 
207
207
  ## Downloading Bun binaries directly
@@ -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.23-canary.20250928T140513" -H "Accept: */*" -H "Host: example.com" -H "Accept-Encoding: gzip, deflate, br" --compressed -H "Content-Length: 13" --data-raw "{\"foo\":\"bar\"}"
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.23-canary.20250930T140635" -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.23-canary.20250928T140513
131
+ [fetch] > User-Agent: Bun/1.2.23-canary.20250930T140635
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.23-canary.20250928T140513
173
+ [fetch] > User-Agent: Bun/1.2.23-canary.20250930T140635
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -220,6 +220,11 @@ These environment variables are read by Bun and configure aspects of its behavio
220
220
  - `DO_NOT_TRACK`
221
221
  - Disable uploading crash reports to `bun.report` on crash. On macOS & Windows, crash report uploads are enabled by default. Otherwise, telemetry is not sent yet as of May 21st, 2024, but we are planning to add telemetry in the coming weeks. If `DO_NOT_TRACK=1`, then auto-uploading crash reports and telemetry are both [disabled](https://do-not-track.dev/).
222
222
 
223
+ ---
224
+
225
+ - `BUN_OPTIONS`
226
+ - Prepends command-line arguments to any Bun execution. For example, `BUN_OPTIONS="--hot"` makes `bun run dev` behave like `bun --hot run dev`.
227
+
223
228
  {% /table %}
224
229
 
225
230
  ## Runtime transpiler caching
@@ -124,7 +124,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
124
124
 
125
125
  ### [`node:perf_hooks`](https://nodejs.org/api/perf_hooks.html)
126
126
 
127
- 🟡 Missing `createHistogram` `monitorEventLoopDelay`. It's recommended to use `performance` global instead of `perf_hooks.performance`.
127
+ 🟡 APIs are implemented, but Node.js test suite does not pass yet for this module.
128
128
 
129
129
  ### [`node:process`](https://nodejs.org/api/process.html)
130
130
 
@@ -156,7 +156,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
156
156
 
157
157
  ### [`node:worker_threads`](https://nodejs.org/api/worker_threads.html)
158
158
 
159
- 🟡 `Worker` doesn't support the following options: `stdin` `stdout` `stderr` `trackedUnmanagedFds` `resourceLimits`. Missing `markAsUntransferable` `moveMessagePortToContext` `getHeapSnapshot`.
159
+ 🟡 `Worker` doesn't support the following options: `stdin` `stdout` `stderr` `trackedUnmanagedFds` `resourceLimits`. Missing `markAsUntransferable` `moveMessagePortToContext`.
160
160
 
161
161
  ### [`node:inspector`](https://nodejs.org/api/inspector.html)
162
162
 
package/docs/test/dom.md CHANGED
@@ -55,7 +55,7 @@ Let's run this test with `bun test`:
55
55
 
56
56
  ```bash
57
57
  $ bun test
58
- bun test v1.2.23-canary.20250928T140513
58
+ bun test v1.2.23-canary.20250930T140635
59
59
 
60
60
  dom.test.ts:
61
61
  ✓ dom test [0.82ms]
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.23-canary.20250928T140513",
2
+ "version": "1.2.23-canary.20250930T140635",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",