bun-types 1.2.14-canary.20250519T140714 → 1.2.14-canary.20250521T140632

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
@@ -5403,6 +5403,42 @@ declare module "bun" {
5403
5403
  options?: ZlibCompressionOptions | LibdeflateCompressionOptions,
5404
5404
  ): Uint8Array;
5405
5405
 
5406
+ /**
5407
+ * Compresses a chunk of data with the Zstandard (zstd) compression algorithm.
5408
+ * @param data The buffer of data to compress
5409
+ * @param options Compression options to use
5410
+ * @returns The output buffer with the compressed data
5411
+ */
5412
+ function zstdCompressSync(
5413
+ data: NodeJS.TypedArray | Buffer | string | ArrayBuffer,
5414
+ options?: { level?: number },
5415
+ ): Buffer;
5416
+
5417
+ /**
5418
+ * Compresses a chunk of data with the Zstandard (zstd) compression algorithm.
5419
+ * @param data The buffer of data to compress
5420
+ * @param options Compression options to use
5421
+ * @returns A promise that resolves to the output buffer with the compressed data
5422
+ */
5423
+ function zstdCompress(
5424
+ data: NodeJS.TypedArray | Buffer | string | ArrayBuffer,
5425
+ options?: { level?: number },
5426
+ ): Promise<Buffer>;
5427
+
5428
+ /**
5429
+ * Decompresses a chunk of data with the Zstandard (zstd) decompression algorithm.
5430
+ * @param data The buffer of data to decompress
5431
+ * @returns The output buffer with the decompressed data
5432
+ */
5433
+ function zstdDecompressSync(data: NodeJS.TypedArray | Buffer | string | ArrayBuffer): Buffer;
5434
+
5435
+ /**
5436
+ * Decompresses a chunk of data with the Zstandard (zstd) decompression algorithm.
5437
+ * @param data The buffer of data to decompress
5438
+ * @returns A promise that resolves to the output buffer with the decompressed data
5439
+ */
5440
+ function zstdDecompress(data: NodeJS.TypedArray | Buffer | string | ArrayBuffer): Promise<Buffer>;
5441
+
5406
5442
  type Target =
5407
5443
  /**
5408
5444
  * For generating bundles that are intended to be run by the Bun runtime. In many cases,
@@ -7443,9 +7479,16 @@ declare module "bun" {
7443
7479
  workspaces: {
7444
7480
  [workspace: string]: BunLockFileWorkspacePackage;
7445
7481
  };
7482
+ /** @see https://bun.sh/docs/install/overrides */
7446
7483
  overrides?: Record<string, string>;
7484
+ /** @see https://bun.sh/docs/install/patch */
7447
7485
  patchedDependencies?: Record<string, string>;
7486
+ /** @see https://bun.sh/docs/install/lifecycle#trusteddependencies */
7448
7487
  trustedDependencies?: string[];
7488
+ /** @see https://bun.sh/docs/install/catalogs */
7489
+ catalog?: Record<string, string>;
7490
+ /** @see https://bun.sh/docs/install/catalogs */
7491
+ catalogs?: Record<string, Record<string, string>>;
7449
7492
 
7450
7493
  /**
7451
7494
  * ```
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.14-canary.20250519T140714
340
+ [fetch] > User-Agent: Bun/1.2.14-canary.20250521T140632
341
341
  [fetch] > Accept: */*
342
342
  [fetch] > Host: example.com
343
343
  [fetch] > Accept-Encoding: gzip, deflate, br
package/docs/api/spawn.md CHANGED
@@ -120,7 +120,7 @@ You can read results from the subprocess via the `stdout` and `stderr` propertie
120
120
  ```ts
121
121
  const proc = Bun.spawn(["bun", "--version"]);
122
122
  const text = await new Response(proc.stdout).text();
123
- console.log(text); // => "1.2.14-canary.20250519T140714"
123
+ console.log(text); // => "1.2.14-canary.20250521T140632"
124
124
  ```
125
125
 
126
126
  Configure the output stream by passing one of the following values to `stdout/stderr`:
@@ -1,13 +1,13 @@
1
1
  Use `bun publish` to publish a package to the npm registry.
2
2
 
3
- `bun publish` will automatically pack your package into a tarball, strip workspace protocols from the `package.json` (resolving versions if necessary), and publish to the registry specified in your configuration files. Both `bunfig.toml` and `.npmrc` files are supported.
3
+ `bun publish` will automatically pack your package into a tarball, strip catalog and workspace protocols from the `package.json` (resolving versions if necessary), and publish to the registry specified in your configuration files. Both `bunfig.toml` and `.npmrc` files are supported.
4
4
 
5
5
  ```sh
6
6
  ## Publishing the package from the current working directory
7
7
  $ bun publish
8
8
 
9
9
  ## Output
10
- bun publish v1.2.14-canary.20250519T140714 (ca7428e9)
10
+ bun publish v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714 (16b4bf34)
12
+ bun install v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714"
18
+ + "@types/bun": "^1.2.14-canary.20250521T140632"
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.14-canary.20250519T140714"
30
+ "@types/bun": "^1.2.14-canary.20250521T140632"
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.14-canary.20250519T140714
100
+ $ bun update @types/bun@1.2.14-canary.20250521T140632
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.14-canary.20250519T140714 (9c68abdb)
24
+ bun test v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714 (9c68abdb)
50
+ bun test v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714 (9c68abdb)
88
+ bun test v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714 (9c68abdb)
21
+ bun test v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714 (9c68abdb)
64
+ bun test v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714 (9c68abdb)
81
+ bun test v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714 (9c68abdb)
32
+ bun test v1.2.14-canary.20250521T140632 (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.14-canary.20250519T140714"
8
+ Bun.version; // => "1.2.14-canary.20250521T140632"
9
9
  ```
10
10
 
11
11
  ---
@@ -0,0 +1,289 @@
1
+ Catalogs in Bun provide a straightforward way to share common dependency versions across multiple packages in a monorepo. Rather than specifying the same versions repeatedly in each workspace package, you define them once in the root package.json and reference them consistently throughout your project.
2
+
3
+ ## Overview
4
+
5
+ Unlike traditional dependency management where each workspace package needs to independently specify versions, catalogs let you:
6
+
7
+ 1. Define version catalogs in the root package.json
8
+ 2. Reference these versions with a simple `catalog:` protocol
9
+ 3. Update all packages simultaneously by changing the version in just one place
10
+
11
+ This is especially useful in large monorepos where dozens of packages need to use the same version of key dependencies.
12
+
13
+ ## How to Use Catalogs
14
+
15
+ ### Directory Structure Example
16
+
17
+ Consider a monorepo with the following structure:
18
+
19
+ ```
20
+ my-monorepo/
21
+ ├── package.json
22
+ ├── bun.lock
23
+ └── packages/
24
+ ├── app/
25
+ │ └── package.json
26
+ ├── ui/
27
+ │ └── package.json
28
+ └── utils/
29
+ └── package.json
30
+ ```
31
+
32
+ ### 1. Define Catalogs in Root package.json
33
+
34
+ In your root-level `package.json`, add a `catalog` or `catalogs` field within the `workspaces` object:
35
+
36
+ ```json
37
+ {
38
+ "name": "my-monorepo",
39
+ "workspaces": {
40
+ "packages": ["packages/*"],
41
+ "catalog": {
42
+ "react": "^19.0.0",
43
+ "react-dom": "^19.0.0"
44
+ },
45
+ "catalogs": {
46
+ "testing": {
47
+ "jest": "30.0.0",
48
+ "testing-library": "14.0.0"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ ```
54
+
55
+ ### 2. Reference Catalog Versions in Workspace Packages
56
+
57
+ In your workspace packages, use the `catalog:` protocol to reference versions:
58
+
59
+ **packages/app/package.json**
60
+
61
+ ```json
62
+ {
63
+ "name": "app",
64
+ "dependencies": {
65
+ "react": "catalog:",
66
+ "react-dom": "catalog:",
67
+ "jest": "catalog:testing"
68
+ }
69
+ }
70
+ ```
71
+
72
+ **packages/ui/package.json**
73
+
74
+ ```json
75
+ {
76
+ "name": "ui",
77
+ "dependencies": {
78
+ "react": "catalog:",
79
+ "react-dom": "catalog:"
80
+ },
81
+ "devDependencies": {
82
+ "jest": "catalog:testing",
83
+ "testing-library": "catalog:testing"
84
+ }
85
+ }
86
+ ```
87
+
88
+ ### 3. Run Bun Install
89
+
90
+ Run `bun install` to install all dependencies according to the catalog versions.
91
+
92
+ ## Catalog vs Catalogs
93
+
94
+ Bun supports two ways to define catalogs:
95
+
96
+ 1. **`catalog`** (singular): A single default catalog for commonly used dependencies
97
+
98
+ ```json
99
+ "catalog": {
100
+ "react": "^19.0.0",
101
+ "react-dom": "^19.0.0"
102
+ }
103
+ ```
104
+
105
+ Reference with simply `catalog:`:
106
+
107
+ ```json
108
+ "dependencies": {
109
+ "react": "catalog:"
110
+ }
111
+ ```
112
+
113
+ 2. **`catalogs`** (plural): Multiple named catalogs for grouping dependencies
114
+
115
+ ```json
116
+ "catalogs": {
117
+ "testing": {
118
+ "jest": "30.0.0"
119
+ },
120
+ "ui": {
121
+ "tailwind": "4.0.0"
122
+ }
123
+ }
124
+ ```
125
+
126
+ Reference with `catalog:<name>`:
127
+
128
+ ```json
129
+ "dependencies": {
130
+ "jest": "catalog:testing",
131
+ "tailwind": "catalog:ui"
132
+ }
133
+ ```
134
+
135
+ ## Benefits of Using Catalogs
136
+
137
+ - **Consistency**: Ensures all packages use the same version of critical dependencies
138
+ - **Maintenance**: Update a dependency version in one place instead of across multiple package.json files
139
+ - **Clarity**: Makes it obvious which dependencies are standardized across your monorepo
140
+ - **Simplicity**: No need for complex version resolution strategies or external tools
141
+
142
+ ## Real-World Example
143
+
144
+ Here's a more comprehensive example for a React application:
145
+
146
+ **Root package.json**
147
+
148
+ ```json
149
+ {
150
+ "name": "react-monorepo",
151
+ "workspaces": {
152
+ "packages": ["packages/*"],
153
+ "catalog": {
154
+ "react": "^19.0.0",
155
+ "react-dom": "^19.0.0",
156
+ "react-router-dom": "^6.15.0"
157
+ },
158
+ "catalogs": {
159
+ "build": {
160
+ "webpack": "5.88.2",
161
+ "babel": "7.22.10"
162
+ },
163
+ "testing": {
164
+ "jest": "29.6.2",
165
+ "react-testing-library": "14.0.0"
166
+ }
167
+ }
168
+ },
169
+ "devDependencies": {
170
+ "typescript": "5.1.6"
171
+ }
172
+ }
173
+ ```
174
+
175
+ **packages/app/package.json**
176
+
177
+ ```json
178
+ {
179
+ "name": "app",
180
+ "dependencies": {
181
+ "react": "catalog:",
182
+ "react-dom": "catalog:",
183
+ "react-router-dom": "catalog:",
184
+ "@monorepo/ui": "workspace:*",
185
+ "@monorepo/utils": "workspace:*"
186
+ },
187
+ "devDependencies": {
188
+ "webpack": "catalog:build",
189
+ "babel": "catalog:build",
190
+ "jest": "catalog:testing",
191
+ "react-testing-library": "catalog:testing"
192
+ }
193
+ }
194
+ ```
195
+
196
+ **packages/ui/package.json**
197
+
198
+ ```json
199
+ {
200
+ "name": "@monorepo/ui",
201
+ "dependencies": {
202
+ "react": "catalog:",
203
+ "react-dom": "catalog:"
204
+ },
205
+ "devDependencies": {
206
+ "jest": "catalog:testing",
207
+ "react-testing-library": "catalog:testing"
208
+ }
209
+ }
210
+ ```
211
+
212
+ **packages/utils/package.json**
213
+
214
+ ```json
215
+ {
216
+ "name": "@monorepo/utils",
217
+ "dependencies": {
218
+ "react": "catalog:"
219
+ },
220
+ "devDependencies": {
221
+ "jest": "catalog:testing"
222
+ }
223
+ }
224
+ ```
225
+
226
+ ## Updating Versions
227
+
228
+ To update versions across all packages, simply change the version in the root package.json:
229
+
230
+ ```json
231
+ "catalog": {
232
+ "react": "^19.1.0", // Updated from ^19.0.0
233
+ "react-dom": "^19.1.0" // Updated from ^19.0.0
234
+ }
235
+ ```
236
+
237
+ Then run `bun install` to update all packages.
238
+
239
+ ## Lockfile Integration
240
+
241
+ Bun's lockfile tracks catalog versions, making it easy to ensure consistent installations across different environments. The lockfile includes:
242
+
243
+ - The catalog definitions from your package.json
244
+ - The resolution of each cataloged dependency
245
+
246
+ ```
247
+ // bun.lock (excerpt)
248
+ {
249
+ "lockfileVersion": 1,
250
+ "workspaces": {
251
+ "": {
252
+ "name": "react-monorepo",
253
+ },
254
+ "packages/app": {
255
+ "name": "app",
256
+ "dependencies": {
257
+ "react": "catalog:",
258
+ "react-dom": "catalog:",
259
+ ...
260
+ },
261
+ },
262
+ ...
263
+ },
264
+ "catalog": {
265
+ "react": "^19.0.0",
266
+ "react-dom": "^19.0.0",
267
+ ...
268
+ },
269
+ "catalogs": {
270
+ "build": {
271
+ "webpack": "5.88.2",
272
+ ...
273
+ },
274
+ ...
275
+ },
276
+ "packages": {
277
+ ...
278
+ }
279
+ }
280
+ ```
281
+
282
+ ## Limitations and Edge Cases
283
+
284
+ - Catalog references must match a dependency defined in either `catalog` or one of the named `catalogs`
285
+ - Empty strings and whitespace in catalog names are ignored (treated as default catalog)
286
+ - Invalid dependency versions in catalogs will fail to resolve during `bun install`
287
+ - Catalogs are only available within workspaces; they cannot be used outside the monorepo
288
+
289
+ Bun's catalog system provides a powerful yet simple way to maintain consistency across your monorepo without introducing additional complexity to your workflow.
@@ -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.sh/install | bash # for macOS, Linux, and WSL
16
16
  # to install a specific version
17
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.14-canary.20250519T140714"
17
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.14-canary.20250521T140632"
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.14-canary.20250519T140714`.
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.14-canary.20250521T140632`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.14-canary.20250519T140714"
195
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.14-canary.20250521T140632"
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.sh/install.ps1)} -Version 1.2.14-canary.20250519T140714"
204
+ $ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.14-canary.20250521T140632"
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.14-canary.20250519T140714" -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.14-canary.20250521T140632" -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.14-canary.20250519T140714
131
+ [fetch] > User-Agent: Bun/1.2.14-canary.20250521T140632
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.14-canary.20250519T140714
173
+ [fetch] > User-Agent: Bun/1.2.14-canary.20250521T140632
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
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.14-canary.20250519T140714
58
+ bun test v1.2.14-canary.20250521T140632
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.14-canary.20250519T140714",
2
+ "version": "1.2.14-canary.20250521T140632",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",