bun-types 1.2.21-canary.20250824T140615 → 1.2.21-canary.20250827T140618

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/bun.d.ts CHANGED
@@ -619,6 +619,33 @@ declare module "bun" {
619
619
  export function parse(input: string): object;
620
620
  }
621
621
 
622
+ /**
623
+ * YAML related APIs
624
+ */
625
+ namespace YAML {
626
+ /**
627
+ * Parse a YAML string into a JavaScript value
628
+ *
629
+ * @category Utilities
630
+ *
631
+ * @param input The YAML string to parse
632
+ * @returns A JavaScript value
633
+ *
634
+ * @example
635
+ * ```ts
636
+ * import { YAML } from "bun";
637
+ *
638
+ * console.log(YAML.parse("123")) // 123
639
+ * console.log(YAML.parse("123")) // null
640
+ * console.log(YAML.parse("false")) // false
641
+ * console.log(YAML.parse("abc")) // "abc"
642
+ * console.log(YAML.parse("- abc")) // [ "abc" ]
643
+ * console.log(YAML.parse("abc: def")) // { "abc": "def" }
644
+ * ```
645
+ */
646
+ export function parse(input: string): unknown;
647
+ }
648
+
622
649
  /**
623
650
  * Synchronously resolve a `moduleId` as though it were imported from `parent`
624
651
  *
@@ -1628,7 +1655,7 @@ declare module "bun" {
1628
1655
  kind: ImportKind;
1629
1656
  }
1630
1657
 
1631
- namespace _BunBuildInterface {
1658
+ namespace Build {
1632
1659
  type Architecture = "x64" | "arm64";
1633
1660
  type Libc = "glibc" | "musl";
1634
1661
  type SIMD = "baseline" | "modern";
@@ -1641,6 +1668,7 @@ declare module "bun" {
1641
1668
  | `bun-windows-x64-${SIMD}`
1642
1669
  | `bun-linux-x64-${SIMD}-${Libc}`;
1643
1670
  }
1671
+
1644
1672
  /**
1645
1673
  * @see [Bun.build API docs](https://bun.com/docs/bundler#api)
1646
1674
  */
@@ -1813,9 +1841,10 @@ declare module "bun" {
1813
1841
  drop?: string[];
1814
1842
 
1815
1843
  /**
1816
- * When set to `true`, the returned promise rejects with an AggregateError when a build failure happens.
1817
- * When set to `false`, the `success` property of the returned object will be `false` when a build failure happens.
1818
- * This defaults to `true`.
1844
+ * - When set to `true`, the returned promise rejects with an AggregateError when a build failure happens.
1845
+ * - When set to `false`, returns a {@link BuildOutput} with `{success: false}`
1846
+ *
1847
+ * @default true
1819
1848
  */
1820
1849
  throw?: boolean;
1821
1850
 
@@ -1836,7 +1865,7 @@ declare module "bun" {
1836
1865
  }
1837
1866
 
1838
1867
  interface CompileBuildOptions {
1839
- target?: _BunBuildInterface.Target;
1868
+ target?: Bun.Build.Target;
1840
1869
  execArgv?: string[];
1841
1870
  executablePath?: string;
1842
1871
  outfile?: string;
@@ -1878,7 +1907,7 @@ declare module "bun" {
1878
1907
  * });
1879
1908
  * ```
1880
1909
  */
1881
- compile: boolean | _BunBuildInterface.Target | CompileBuildOptions;
1910
+ compile: boolean | Bun.Build.Target | CompileBuildOptions;
1882
1911
  }
1883
1912
 
1884
1913
  /**
@@ -5484,6 +5513,7 @@ declare module "bun" {
5484
5513
  type OnLoadResult = OnLoadResultSourceCode | OnLoadResultObject | undefined | void;
5485
5514
  type OnLoadCallback = (args: OnLoadArgs) => OnLoadResult | Promise<OnLoadResult>;
5486
5515
  type OnStartCallback = () => void | Promise<void>;
5516
+ type OnEndCallback = (result: BuildOutput) => void | Promise<void>;
5487
5517
 
5488
5518
  interface OnResolveArgs {
5489
5519
  /**
@@ -5561,6 +5591,25 @@ declare module "bun" {
5561
5591
  * @returns `this` for method chaining
5562
5592
  */
5563
5593
  onStart(callback: OnStartCallback): this;
5594
+ /**
5595
+ * Register a callback which will be invoked when bundling ends. This is
5596
+ * called after all modules have been bundled and the build is complete.
5597
+ *
5598
+ * @example
5599
+ * ```ts
5600
+ * const plugin: Bun.BunPlugin = {
5601
+ * name: "my-plugin",
5602
+ * setup(builder) {
5603
+ * builder.onEnd((result) => {
5604
+ * console.log("bundle just finished!!", result);
5605
+ * });
5606
+ * },
5607
+ * };
5608
+ * ```
5609
+ *
5610
+ * @returns `this` for method chaining
5611
+ */
5612
+ onEnd(callback: OnEndCallback): this;
5564
5613
  onBeforeParse(
5565
5614
  constraints: PluginConstraints,
5566
5615
  callback: {
package/docs/api/fetch.md CHANGED
@@ -336,7 +336,7 @@ This will print the request and response headers to your terminal:
336
336
  ```sh
337
337
  [fetch] > HTTP/1.1 GET http://example.com/
338
338
  [fetch] > Connection: keep-alive
339
- [fetch] > User-Agent: Bun/1.2.21-canary.20250824T140615
339
+ [fetch] > User-Agent: Bun/1.2.21-canary.20250827T140618
340
340
  [fetch] > Accept: */*
341
341
  [fetch] > Host: example.com
342
342
  [fetch] > Accept-Encoding: gzip, deflate, br
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.21-canary.20250824T140615\n"
143
+ console.log(text); // => "1.2.21-canary.20250827T140618\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
@@ -90,8 +90,7 @@ const db2 = new SQL({
90
90
  const db3 = new SQL("myapp.db", { adapter: "sqlite" });
91
91
  ```
92
92
 
93
- <details>
94
- <summary>SQLite Connection String Formats</summary>
93
+ {% details summary="SQLite Connection String Formats" %}
95
94
 
96
95
  SQLite accepts various URL formats for connection strings:
97
96
 
@@ -122,10 +121,9 @@ new SQL("sqlite://data.db?mode=rwc"); // Read-write-create mode (default)
122
121
 
123
122
  **Note:** Simple filenames without a protocol (like `"myapp.db"`) require explicitly specifying `{ adapter: "sqlite" }` to avoid ambiguity with PostgreSQL.
124
123
 
125
- </details>
124
+ {% /details %}
126
125
 
127
- <details>
128
- <summary>SQLite-Specific Options</summary>
126
+ {% details summary="SQLite-Specific Options" %}
129
127
 
130
128
  SQLite databases support additional configuration options:
131
129
 
@@ -151,7 +149,7 @@ Query parameters in the URL are parsed to set these options:
151
149
  - `?mode=rw` → `readonly: false, create: false`
152
150
  - `?mode=rwc` → `readonly: false, create: true` (default)
153
151
 
154
- </details>
152
+ {% /details %}
155
153
 
156
154
  ### Inserting data
157
155
 
@@ -532,15 +530,14 @@ const db = new SQL({
532
530
  });
533
531
  ```
534
532
 
535
- <details>
536
- <summary>SQLite Connection Notes</summary>
533
+ {% details summary="SQLite Connection Notes" %}
537
534
 
538
535
  - **Connection Pooling**: SQLite doesn't use connection pooling as it's a file-based database. Each `SQL` instance represents a single connection.
539
536
  - **Transactions**: SQLite supports nested transactions through savepoints, similar to PostgreSQL.
540
537
  - **Concurrent Access**: SQLite handles concurrent access through file locking. Use WAL mode for better concurrency.
541
538
  - **Memory Databases**: Using `:memory:` creates a temporary database that exists only for the connection lifetime.
542
539
 
543
- </details>
540
+ {% /details %}
544
541
 
545
542
  ## Dynamic passwords
546
543
 
@@ -838,6 +835,8 @@ try {
838
835
  }
839
836
  ```
840
837
 
838
+ {% details summary="PostgreSQL-Specific Error Codes" %}
839
+
841
840
  ### PostgreSQL Connection Errors
842
841
 
843
842
  | Connection Errors | Description |
@@ -903,12 +902,13 @@ try {
903
902
  | `ERR_POSTGRES_UNSAFE_TRANSACTION` | Unsafe transaction operation detected |
904
903
  | `ERR_POSTGRES_INVALID_TRANSACTION_STATE` | Invalid transaction state |
905
904
 
905
+ {% /details %}
906
+
906
907
  ### SQLite-Specific Errors
907
908
 
908
909
  SQLite errors provide error codes and numbers that correspond to SQLite's standard error codes:
909
910
 
910
- <details>
911
- <summary>Common SQLite Error Codes</summary>
911
+ {% details summary="Common SQLite Error Codes" %}
912
912
 
913
913
  | Error Code | errno | Description |
914
914
  | ------------------- | ----- | ---------------------------------------------------- |
@@ -945,7 +945,7 @@ try {
945
945
  }
946
946
  ```
947
947
 
948
- </details>
948
+ {% /details %}
949
949
 
950
950
  ## Numbers and BigInt
951
951
 
@@ -998,13 +998,7 @@ We also haven't implemented some of the more uncommon features like:
998
998
  - Point & PostGIS types
999
999
  - All the multi-dimensional integer array types (only a couple of the types are supported)
1000
1000
 
1001
- ## Frequently Asked Questions
1002
-
1003
- > Why is this `Bun.sql` and not `Bun.postgres`?
1004
-
1005
- The plan is to add more database drivers in the future.
1006
-
1007
- > Why not just use an existing library?
1001
+ ## Why not just use an existing library?
1008
1002
 
1009
1003
  npm packages like postgres.js, pg, and node-postgres can be used in Bun too. They're great options.
1010
1004
 
@@ -1259,6 +1259,33 @@ $ bun build ./index.tsx --outdir ./out --drop=console --drop=debugger --drop=any
1259
1259
 
1260
1260
  {% /codetabs %}
1261
1261
 
1262
+ ### `throw`
1263
+
1264
+ Controls error handling behavior when the build fails. When set to `true` (default), the returned promise rejects with an `AggregateError`. When set to `false`, the promise resolves with a `BuildOutput` object where `success` is `false`.
1265
+
1266
+ ```ts#JavaScript
1267
+ // Default behavior: throws on error
1268
+ try {
1269
+ await Bun.build({
1270
+ entrypoints: ['./index.tsx'],
1271
+ throw: true, // default
1272
+ });
1273
+ } catch (error) {
1274
+ // Handle AggregateError
1275
+ console.error("Build failed:", error);
1276
+ }
1277
+
1278
+ // Alternative: handle errors via success property
1279
+ const result = await Bun.build({
1280
+ entrypoints: ['./index.tsx'],
1281
+ throw: false,
1282
+ });
1283
+
1284
+ if (!result.success) {
1285
+ console.error("Build failed with errors:", result.logs);
1286
+ }
1287
+ ```
1288
+
1262
1289
  ## Outputs
1263
1290
 
1264
1291
  The `Bun.build` function returns a `Promise<BuildOutput>`, defined as:
@@ -1569,8 +1596,7 @@ interface BuildConfig {
1569
1596
  * When set to `true`, the returned promise rejects with an AggregateError when a build failure happens.
1570
1597
  * When set to `false`, the `success` property of the returned object will be `false` when a build failure happens.
1571
1598
  *
1572
- * This defaults to `false` in Bun 1.1 and will change to `true` in Bun 1.2
1573
- * as most usage of `Bun.build` forgets to check for errors.
1599
+ * This defaults to `true`.
1574
1600
  */
1575
1601
  throw?: boolean;
1576
1602
  }
@@ -9,6 +9,7 @@ Plugins can register callbacks to be run at various points in the lifecycle of a
9
9
  - [`onStart()`](#onstart): Run once the bundler has started a bundle
10
10
  - [`onResolve()`](#onresolve): Run before a module is resolved
11
11
  - [`onLoad()`](#onload): Run before a module is loaded.
12
+ - [`onEnd()`](#onend): Run after the bundle has completed
12
13
  - [`onBeforeParse()`](#onbeforeparse): Run zero-copy native addons in the parser thread before a file is parsed.
13
14
 
14
15
  ### Reference
@@ -18,6 +19,7 @@ A rough overview of the types (please refer to Bun's `bun.d.ts` for the full typ
18
19
  ```ts
19
20
  type PluginBuilder = {
20
21
  onStart(callback: () => void): void;
22
+ onEnd(callback: (result: BuildOutput) => void | Promise<void>): void;
21
23
  onResolve: (
22
24
  args: { filter: RegExp; namespace?: string },
23
25
  callback: (args: { path: string; importer: string }) => {
@@ -285,6 +287,53 @@ plugin({
285
287
 
286
288
  Note that the `.defer()` function currently has the limitation that it can only be called once per `onLoad` callback.
287
289
 
290
+ ### `onEnd`
291
+
292
+ ```ts
293
+ onEnd(callback: (result: BuildOutput) => void | Promise<void>): void;
294
+ ```
295
+
296
+ Registers a callback to be run when the bundler completes a bundle (whether successful or not).
297
+
298
+ The callback receives the `BuildOutput` object containing:
299
+
300
+ - `success`: boolean indicating if the build succeeded
301
+ - `outputs`: array of generated build artifacts
302
+ - `logs`: array of build messages (warnings, errors, etc.)
303
+
304
+ This is useful for post-processing, cleanup, notifications, or custom error handling.
305
+
306
+ ```ts
307
+ await Bun.build({
308
+ entrypoints: ["./index.ts"],
309
+ outdir: "./out",
310
+ plugins: [
311
+ {
312
+ name: "onEnd example",
313
+ setup(build) {
314
+ build.onEnd(result => {
315
+ if (result.success) {
316
+ console.log(
317
+ `✅ Build succeeded with ${result.outputs.length} outputs`,
318
+ );
319
+ } else {
320
+ console.error(`❌ Build failed with ${result.logs.length} errors`);
321
+ }
322
+ });
323
+ },
324
+ },
325
+ ],
326
+ });
327
+ ```
328
+
329
+ The `onEnd` callbacks are called:
330
+
331
+ - **Before** the build promise resolves or rejects
332
+ - **After** all bundling is complete
333
+ - **In the order** they were registered
334
+
335
+ Multiple plugins can register `onEnd` callbacks, and they will all be called sequentially. If an `onEnd` callback returns a promise, the build will wait for it to resolve before continuing.
336
+
288
337
  ## Native plugins
289
338
 
290
339
  One of the reasons why Bun's bundler is so fast is that it is written in native code and leverages multi-threading to load and parse modules in parallel.
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.21-canary.20250824T140615 (ca7428e9)
216
+ bun pm version v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615 (ca7428e9)
10
+ bun publish v1.2.21-canary.20250827T140618 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
@@ -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.21-canary.20250824T140615 (16b4bf34)
12
+ bun install v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615"
18
+ + "@types/bun": "^1.2.21-canary.20250827T140618"
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.21-canary.20250824T140615"
30
+ "@types/bun": "^1.2.21-canary.20250827T140618"
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.21-canary.20250824T140615
100
+ $ bun update @types/bun@1.2.21-canary.20250827T140618
101
101
 
102
102
  # Update all dependencies to the latest versions
103
103
  $ bun update --latest
@@ -17,7 +17,7 @@ Bun reads the following files automatically (listed in order of increasing prece
17
17
 
18
18
  - `.env`
19
19
  - `.env.production`, `.env.development`, `.env.test` (depending on value of `NODE_ENV`)
20
- - `.env.local`
20
+ - `.env.local` (not loaded when `NODE_ENV=test`)
21
21
 
22
22
  ```txt#.env
23
23
  FOO=hello
@@ -35,7 +35,7 @@ Add this directive to _just one file_ in your project, such as:
35
35
  - Any single `.ts` file that TypeScript includes in your compilation
36
36
 
37
37
  ```ts
38
- /// <reference types="bun/test-globals" />
38
+ /// <reference types="bun-types/test-globals" />
39
39
  ```
40
40
 
41
41
  ---
@@ -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.21-canary.20250824T140615 (9c68abdb)
24
+ bun test v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615 (9c68abdb)
50
+ bun test v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615 (9c68abdb)
88
+ bun test v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615 (9c68abdb)
21
+ bun test v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615 (9c68abdb)
64
+ bun test v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615 (9c68abdb)
81
+ bun test v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615 (9c68abdb)
32
+ bun test v1.2.21-canary.20250827T140618 (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.21-canary.20250824T140615"
8
+ Bun.version; // => "1.2.21-canary.20250827T140618"
9
9
  ```
10
10
 
11
11
  ---
@@ -76,6 +76,6 @@ For a complete example with tests and CI setup, see the official template:
76
76
 
77
77
  ## Related
78
78
 
79
- - [Configuration (bunfig.toml)](/docs/runtime/bunfig#installsecurityscanner)
79
+ - [Configuration (bunfig.toml)](/docs/runtime/bunfig#install-security-scanner)
80
80
  - [Package Manager](/docs/install)
81
81
  - [Security Scanner Template](https://github.com/oven-sh/security-scanner-template)
@@ -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.21-canary.20250824T140615"
17
+ $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.21-canary.20250827T140618"
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.21-canary.20250824T140615`.
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.21-canary.20250827T140618`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.21-canary.20250824T140615"
195
+ $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.21-canary.20250827T140618"
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.21-canary.20250824T140615"
204
+ $ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.2.21-canary.20250827T140618"
205
205
  ```
206
206
 
207
207
  ## Downloading Bun binaries directly
@@ -223,8 +223,8 @@ $ git clone https://github.com/oven-sh/WebKit vendor/WebKit
223
223
  $ git -C vendor/WebKit checkout <commit_hash>
224
224
 
225
225
  # Make a debug build of JSC. This will output build artifacts in ./vendor/WebKit/WebKitBuild/Debug
226
- # Optionally, you can use `make jsc` for a release build
227
- $ make jsc-debug && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
226
+ # Optionally, you can use `bun run jsc:build` for a release build
227
+ $ bun run jsc:build:debug && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
228
228
 
229
229
  # After an initial run of `make jsc-debug`, you can rebuild JSC with:
230
230
  $ cmake --build vendor/WebKit/WebKitBuild/Debug --target jsc && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
@@ -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.21-canary.20250824T140615" -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.21-canary.20250827T140618" -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.21-canary.20250824T140615
131
+ [fetch] > User-Agent: Bun/1.2.21-canary.20250827T140618
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.21-canary.20250824T140615
173
+ [fetch] > User-Agent: Bun/1.2.21-canary.20250827T140618
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -8,6 +8,10 @@ Bun reads the following files automatically (listed in order of increasing prece
8
8
  - `.env.production`, `.env.development`, `.env.test` (depending on value of `NODE_ENV`)
9
9
  - `.env.local`
10
10
 
11
+ {% callout %}
12
+ **Note:** When `NODE_ENV=test`, `.env.local` is **not** loaded. This ensures consistent test environments across different executions by preventing local overrides during testing. This behavior matches popular frameworks like [Next.js](https://nextjs.org/docs/pages/guides/environment-variables#test-environment-variables) and [Create React App](https://create-react-app.dev/docs/adding-custom-environment-variables/#what-other-env-files-can-be-used).
13
+ {% /callout %}
14
+
11
15
  ```txt#.env
12
16
  FOO=hello
13
17
  BAR=world
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.21-canary.20250824T140615
58
+ bun test v1.2.21-canary.20250827T140618
59
59
 
60
60
  dom.test.ts:
61
61
  ✓ dom test [0.82ms]
@@ -12,6 +12,8 @@ test("NODE_ENV is set to test", () => {
12
12
  });
13
13
  ```
14
14
 
15
+ When `NODE_ENV` is set to `"test"`, Bun will not load `.env.local` files. This ensures consistent test environments across different executions by preventing local overrides during testing. Instead, use `.env.test` for test-specific environment variables, which should be committed to your repository for consistency across all developers and CI environments.
16
+
15
17
  #### `$TZ` environment variable
16
18
 
17
19
  By default, all `bun test` runs use UTC (`Etc/UTC`) as the time zone unless overridden by the `TZ` environment variable. This ensures consistent date and time behavior across different development environments.
package/experimental.d.ts CHANGED
@@ -191,7 +191,9 @@ declare module "bun" {
191
191
  * };
192
192
  * ```
193
193
  */
194
- export type SSGPage<Params extends SSGParamsLike = SSGParamsLike> = React.ComponentType<SSGPageProps<Params>>;
194
+ export type SSGPage<Params extends SSGParamsLike = SSGParamsLike> = import("react").ComponentType<
195
+ SSGPageProps<Params>
196
+ >;
195
197
 
196
198
  /**
197
199
  * getStaticPaths is Bun's implementation of SSG (Static Site Generation) path determination.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.21-canary.20250824T140615",
2
+ "version": "1.2.21-canary.20250827T140618",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",
package/shell.d.ts CHANGED
@@ -211,7 +211,7 @@ declare module "bun" {
211
211
  * try {
212
212
  * const result = await $`exit 1`;
213
213
  * } catch (error) {
214
- * if (error instanceof ShellError) {
214
+ * if (error instanceof $.ShellError) {
215
215
  * console.log(error.exitCode); // 1
216
216
  * }
217
217
  * }
package/test-globals.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // This file gets loaded by developers including the following triple slash directive:
4
4
  //
5
5
  // ```ts
6
- // /// <reference types="bun/test-globals" />
6
+ // /// <reference types="bun-types/test-globals" />
7
7
  // ```
8
8
 
9
9
  declare var test: typeof import("bun:test").test;
@@ -19,3 +19,6 @@ declare var setDefaultTimeout: typeof import("bun:test").setDefaultTimeout;
19
19
  declare var mock: typeof import("bun:test").mock;
20
20
  declare var spyOn: typeof import("bun:test").spyOn;
21
21
  declare var jest: typeof import("bun:test").jest;
22
+ declare var xit: typeof import("bun:test").xit;
23
+ declare var xtest: typeof import("bun:test").xtest;
24
+ declare var xdescribe: typeof import("bun:test").xdescribe;
package/test.d.ts CHANGED
@@ -262,6 +262,15 @@ declare module "bun:test" {
262
262
  * @param fn the function that defines the tests
263
263
  */
264
264
  export const describe: Describe;
265
+ /**
266
+ * Skips a group of related tests.
267
+ *
268
+ * This is equivalent to calling `describe.skip()`.
269
+ *
270
+ * @param label the label for the tests
271
+ * @param fn the function that defines the tests
272
+ */
273
+ export const xdescribe: Describe;
265
274
  /**
266
275
  * Runs a function, once, before all the tests.
267
276
  *
@@ -515,7 +524,17 @@ declare module "bun:test" {
515
524
  * @param fn the test function
516
525
  */
517
526
  export const test: Test;
518
- export { test as it };
527
+ export { test as it, xtest as xit };
528
+
529
+ /**
530
+ * Skips a test.
531
+ *
532
+ * This is equivalent to calling `test.skip()`.
533
+ *
534
+ * @param label the label for the test
535
+ * @param fn the test function
536
+ */
537
+ export const xtest: Test;
519
538
 
520
539
  /**
521
540
  * Asserts that a value matches some criteria.