bun-types 1.2.24-canary.20251009T140631 → 1.3.0

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
@@ -337,7 +337,7 @@ This will print the request and response headers to your terminal:
337
337
  ```sh
338
338
  [fetch] > HTTP/1.1 GET http://example.com/
339
339
  [fetch] > Connection: keep-alive
340
- [fetch] > User-Agent: Bun/1.2.24-canary.20251009T140631
340
+ [fetch] > User-Agent: Bun/1.3.0
341
341
  [fetch] > Accept: */*
342
342
  [fetch] > Host: example.com
343
343
  [fetch] > Accept-Encoding: gzip, deflate, br, zstd
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.24-canary.20251009T140631\n"
143
+ console.log(text); // => "1.3.0\n"
144
144
  ```
145
145
 
146
146
  Configure the output stream by passing one of the following values to `stdout/stderr`:
@@ -107,6 +107,8 @@ Bun.serve({
107
107
 
108
108
  Contextual `data` can be attached to a new WebSocket in the `.upgrade()` call. This data is made available on the `ws.data` property inside the WebSocket handlers.
109
109
 
110
+ To strongly type `ws.data`, add a `data` property to the `websocket` handler object. This types `ws.data` across all lifecycle hooks.
111
+
110
112
  ```ts
111
113
  type WebSocketData = {
112
114
  createdAt: number;
@@ -148,6 +150,10 @@ Bun.serve({
148
150
  });
149
151
  ```
150
152
 
153
+ {% callout %}
154
+ **Note:** Previously, you could specify the type of `ws.data` using a type parameter on `Bun.serve`, like `Bun.serve<MyData>({...})`. This pattern was removed due to [a limitation in TypeScript](https://github.com/microsoft/TypeScript/issues/26242) in favor of the `data` property shown above.
155
+ {% /callout %}
156
+
151
157
  To connect to this server from the browser, create a new `WebSocket`.
152
158
 
153
159
  ```ts#browser.js
@@ -586,12 +586,41 @@ Codesign support requires Bun v1.2.4 or newer.
586
586
 
587
587
  {% /callout %}
588
588
 
589
+ ## Code splitting
590
+
591
+ Standalone executables support code splitting. Use `--compile` with `--splitting` to create an executable that loads code-split chunks at runtime.
592
+
593
+ ```bash
594
+ $ bun build --compile --splitting ./src/entry.ts --outdir ./build
595
+ ```
596
+
597
+ {% codetabs %}
598
+
599
+ ```ts#src/entry.ts
600
+ console.log("Entrypoint loaded");
601
+ const lazy = await import("./lazy.ts");
602
+ lazy.hello();
603
+ ```
604
+
605
+ ```ts#src/lazy.ts
606
+ export function hello() {
607
+ console.log("Lazy module loaded");
608
+ }
609
+ ```
610
+
611
+ {% /codetabs %}
612
+
613
+ ```bash
614
+ $ ./build/entry
615
+ Entrypoint loaded
616
+ Lazy module loaded
617
+ ```
618
+
589
619
  ## Unsupported CLI arguments
590
620
 
591
621
  Currently, the `--compile` flag can only accept a single entrypoint at a time and does not support the following flags:
592
622
 
593
- - `--outdir` — use `outfile` instead.
594
- - `--splitting`
623
+ - `--outdir` — use `outfile` instead (except when using with `--splitting`).
595
624
  - `--public-path`
596
625
  - `--target=node` or `--target=browser`
597
626
  - `--no-bundle` - we always bundle everything into the executable.
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.24-canary.20251009T140631 (ca7428e9)
216
+ bun pm version v1.3.0 (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.24-canary.20251009T140631 (ca7428e9)
10
+ bun publish v1.3.0 (ca7428e9)
11
11
 
12
12
  packed 203B package.json
13
13
  packed 224B README.md
@@ -84,14 +84,12 @@ $ bun publish --dry-run
84
84
 
85
85
  ### `--tolerate-republish`
86
86
 
87
- The `--tolerate-republish` flag makes `bun publish` exit with code 0 instead of code 1 when attempting to republish over an existing version number. This is useful in automated workflows where republishing the same version might occur and should not be treated as an error.
87
+ Exit with code 0 instead of 1 if the package version already exists. Useful in CI/CD where jobs may be re-run.
88
88
 
89
89
  ```sh
90
90
  $ bun publish --tolerate-republish
91
91
  ```
92
92
 
93
- Without this flag, attempting to publish a version that already exists will result in an error and exit code 1. With this flag, the command will exit successfully even when trying to republish an existing version.
94
-
95
93
  ### `--gzip-level`
96
94
 
97
95
  Specify the level of gzip compression to use when packing the package. Only applies to `bun publish` without a tarball path argument. Values range from `0` to `9` (default is `9`).
@@ -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.24-canary.20251009T140631 (16b4bf34)
12
+ bun install v1.3.0 (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.24-canary.20251009T140631"
18
+ + "@types/bun": "^1.3.0"
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.24-canary.20251009T140631"
30
+ "@types/bun": "^1.3.0"
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.24-canary.20251009T140631
100
+ $ bun update @types/bun@1.3.0
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.24-canary.20251009T140631 (9c68abdb)
24
+ bun test v1.3.0 (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.24-canary.20251009T140631 (9c68abdb)
50
+ bun test v1.3.0 (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.24-canary.20251009T140631 (9c68abdb)
88
+ bun test v1.3.0 (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.24-canary.20251009T140631 (9c68abdb)
21
+ bun test v1.3.0 (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.24-canary.20251009T140631 (9c68abdb)
64
+ bun test v1.3.0 (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.24-canary.20251009T140631 (9c68abdb)
81
+ bun test v1.3.0 (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.24-canary.20251009T140631 (9c68abdb)
32
+ bun test v1.3.0 (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.24-canary.20251009T140631"
8
+ Bun.version; // => "1.3.0"
9
9
  ```
10
10
 
11
11
  ---
@@ -89,6 +89,12 @@ $ bun install --linker isolated
89
89
 
90
90
  Isolated installs create strict dependency isolation similar to pnpm, preventing phantom dependencies and ensuring more deterministic builds. For complete documentation, see [Isolated installs](https://bun.com/docs/install/isolated).
91
91
 
92
+ To protect against supply chain attacks, set a minimum age (in seconds) for package versions:
93
+
94
+ ```bash
95
+ $ bun install --minimum-release-age 259200 # 3 days
96
+ ```
97
+
92
98
  {% details summary="Configuring behavior" %}
93
99
  The default behavior of `bun install` can be configured in `bunfig.toml`:
94
100
 
@@ -122,6 +128,12 @@ concurrentScripts = 16 # (cpu count or GOMAXPROCS) x2
122
128
  # installation strategy: "hoisted" or "isolated"
123
129
  # default: "hoisted"
124
130
  linker = "hoisted"
131
+
132
+ # minimum package age in seconds (protects against supply chain attacks)
133
+ minimumReleaseAge = 259200 # 3 days
134
+
135
+ # exclude packages from age requirement
136
+ minimumReleaseAgeExcludes = ["@types/node", "typescript"]
125
137
  ```
126
138
 
127
139
  {% /details %}
@@ -36,7 +36,10 @@ linker = "isolated"
36
36
 
37
37
  ### Default behavior
38
38
 
39
- By default, Bun uses the **hoisted** installation strategy for all projects. To use isolated installs, you must explicitly specify the `--linker isolated` flag or set it in your configuration file.
39
+ - **Workspaces**: Bun uses **isolated** installs by default to prevent hoisting-related bugs
40
+ - **Single projects**: Bun uses **hoisted** installs by default
41
+
42
+ To override the default, use `--linker hoisted` or `--linker isolated`, or set it in your configuration file.
40
43
 
41
44
  ## How isolated installs work
42
45
 
@@ -174,14 +177,13 @@ The main difference is that Bun uses symlinks in `node_modules` while pnpm uses
174
177
 
175
178
  ## When to use isolated installs
176
179
 
177
- **Use isolated installs when:**
180
+ **Isolated installs are the default for workspaces.** You may want to explicitly enable them for single projects when:
178
181
 
179
- - Working in monorepos with multiple packages
180
182
  - Strict dependency management is required
181
183
  - Preventing phantom dependencies is important
182
184
  - Building libraries that need deterministic dependencies
183
185
 
184
- **Use hoisted installs when:**
186
+ **Switch to hoisted installs (including for workspaces) when:**
185
187
 
186
188
  - Working with legacy code that assumes flat `node_modules`
187
189
  - Compatibility with existing build tools is required
@@ -38,9 +38,21 @@ In the root `package.json`, the `"workspaces"` key is used to indicate which sub
38
38
  ```
39
39
 
40
40
  {% callout %}
41
- **Glob support** — Bun supports full glob syntax in `"workspaces"` (see [here](https://bun.com/docs/api/glob#supported-glob-patterns) for a comprehensive list of supported syntax), _except_ for exclusions (e.g. `!**/excluded/**`), which are not implemented yet.
41
+ **Glob support** — Bun supports full glob syntax in `"workspaces"`, including negative patterns (e.g. `!**/excluded/**`). See [here](https://bun.com/docs/api/glob#supported-glob-patterns) for a comprehensive list of supported syntax.
42
42
  {% /callout %}
43
43
 
44
+ ```json
45
+ {
46
+ "name": "my-project",
47
+ "version": "1.0.0",
48
+ "workspaces": [
49
+ "packages/**",
50
+ "!packages/**/test/**",
51
+ "!packages/**/template/**"
52
+ ]
53
+ }
54
+ ```
55
+
44
56
  Each workspace has it's own `package.json`. When referencing other packages in the monorepo, semver or workspace protocols (e.g. `workspace:*`) can be used as the version field in your `package.json`.
45
57
 
46
58
  ```json
@@ -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.24-canary.20251009T140631"
17
+ $ curl -fsSL https://bun.com/install | bash -s "bun-v1.3.0"
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.24-canary.20251009T140631`.
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.3.0`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.com/install | bash -s "bun-v1.2.24-canary.20251009T140631"
195
+ $ curl -fsSL https://bun.com/install | bash -s "bun-v1.3.0"
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.24-canary.20251009T140631"
204
+ $ iex "& {$(irm https://bun.com/install.ps1)} -Version 1.3.0"
205
205
  ```
206
206
 
207
207
  ## Downloading Bun binaries directly
@@ -2,7 +2,21 @@ Configuring a development environment for Bun can take 10-30 minutes depending o
2
2
 
3
3
  If you are using Windows, please refer to [this guide](https://bun.com/docs/project/building-windows)
4
4
 
5
- ## Install Dependencies
5
+ ## Using Nix (Alternative)
6
+
7
+ A Nix flake is provided as an alternative to manual dependency installation:
8
+
9
+ ```bash
10
+ nix develop
11
+ # or explicitly use the pure shell
12
+ # nix develop .#pure
13
+ export CMAKE_SYSTEM_PROCESSOR=$(uname -m)
14
+ bun bd
15
+ ```
16
+
17
+ This provides all dependencies in an isolated, reproducible environment without requiring sudo.
18
+
19
+ ## Install Dependencies (Manual)
6
20
 
7
21
  Using your system's package manager, install Bun's dependencies:
8
22
 
@@ -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.24-canary.20251009T140631" -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.3.0" -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.24-canary.20251009T140631
131
+ [fetch] > User-Agent: Bun/1.3.0
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.24-canary.20251009T140631
173
+ [fetch] > User-Agent: Bun/1.3.0
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -174,6 +174,29 @@ import { stuff } from "foo";
174
174
 
175
175
  The full specification of this algorithm are officially documented in the [Node.js documentation](https://nodejs.org/api/modules.html); we won't rehash it here. Briefly: if you import `from "foo"`, Bun scans up the file system for a `node_modules` directory containing the package `foo`.
176
176
 
177
+ ### NODE_PATH
178
+
179
+ Bun supports `NODE_PATH` for additional module resolution directories:
180
+
181
+ ```bash
182
+ NODE_PATH=./packages bun run src/index.js
183
+ ```
184
+
185
+ ```ts
186
+ // packages/foo/index.js
187
+ export const hello = "world";
188
+
189
+ // src/index.js
190
+ import { hello } from "foo";
191
+ ```
192
+
193
+ Multiple paths use the platform's delimiter (`:` on Unix, `;` on Windows):
194
+
195
+ ```bash
196
+ NODE_PATH=./packages:./lib bun run src/index.js # Unix/macOS
197
+ NODE_PATH=./packages;./lib bun run src/index.js # Windows
198
+ ```
199
+
177
200
  Once it finds the `foo` package, Bun reads the `package.json` to determine how the package should be imported. To determine the package's entrypoint, Bun first reads the `exports` field and checks for the following conditions.
178
201
 
179
202
  ```jsonc#package.json
@@ -65,6 +65,34 @@ Test files matching this pattern will behave as if the `--concurrent` flag was p
65
65
 
66
66
  The `--concurrent` CLI flag will override this setting when specified, forcing all tests to run concurrently regardless of the glob pattern.
67
67
 
68
+ #### randomize
69
+
70
+ Run tests in random order to identify tests with hidden dependencies:
71
+
72
+ ```toml
73
+ [test]
74
+ randomize = true
75
+ ```
76
+
77
+ #### seed
78
+
79
+ Specify a seed for reproducible random test order. Requires `randomize = true`:
80
+
81
+ ```toml
82
+ [test]
83
+ randomize = true
84
+ seed = 2444615283
85
+ ```
86
+
87
+ #### rerunEach
88
+
89
+ Re-run each test file multiple times to identify flaky tests:
90
+
91
+ ```toml
92
+ [test]
93
+ rerunEach = 3
94
+ ```
95
+
68
96
  ### Coverage options
69
97
 
70
98
  In addition to the options documented in the [coverage documentation](./coverage.md), the following options are available:
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.24-canary.20251009T140631
58
+ bun test v1.3.0
59
59
 
60
60
  dom.test.ts:
61
61
  ✓ dom test [0.82ms]
@@ -34,6 +34,15 @@ test/package-json-lint.test.ts:
34
34
  Ran 4 tests across 1 files. [0.66ms]
35
35
  ```
36
36
 
37
+ ### Dots Reporter
38
+
39
+ The dots reporter shows `.` for passing tests and `F` for failures—useful for large test suites.
40
+
41
+ ```sh
42
+ $ bun test --dots
43
+ $ bun test --reporter=dots
44
+ ```
45
+
37
46
  ### JUnit XML Reporter
38
47
 
39
48
  For CI/CD environments, Bun supports generating JUnit XML reports. JUnit XML is a widely-adopted format for test results that can be parsed by many CI/CD systems, including GitLab, Jenkins, and others.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.24-canary.20251009T140631",
2
+ "version": "1.3.0",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",