bun-types 1.2.11-canary.20250417T140614 → 1.2.11-canary.20250419T140546

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.11-canary.20250417T140614
340
+ [fetch] > User-Agent: Bun/1.2.11-canary.20250419T140546
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.11-canary.20250417T140614"
123
+ console.log(text); // => "1.2.11-canary.20250419T140546"
124
124
  ```
125
125
 
126
126
  Configure the output stream by passing one of the following values to `stdout/stderr`:
@@ -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.11-canary.20250417T140614 (ca7428e9)
10
+ bun publish v1.2.11-canary.20250419T140546 (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.11-canary.20250417T140614 (16b4bf34)
12
+ bun install v1.2.11-canary.20250419T140546 (16b4bf34)
13
13
  + @nuxt/devtools@0.8.2
14
14
  + nuxt@3.7.0
15
15
  785 packages installed [2.67s]
@@ -16,7 +16,7 @@ This will add the package to `peerDependencies` in `package.json`.
16
16
  ```json-diff
17
17
  {
18
18
  "peerDependencies": {
19
- + "@types/bun": "^1.2.11-canary.20250417T140614"
19
+ + "@types/bun": "^1.2.11-canary.20250419T140546"
20
20
  }
21
21
  }
22
22
  ```
@@ -28,7 +28,7 @@ Running `bun install` will install peer dependencies by default, unless marked o
28
28
  ```json-diff
29
29
  {
30
30
  "peerDependencies": {
31
- "@types/bun": "^1.2.11-canary.20250417T140614"
31
+ "@types/bun": "^1.2.11-canary.20250419T140546"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  + "@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.11-canary.20250417T140614
100
+ $ bun update @types/bun@1.2.11-canary.20250419T140546
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.11-canary.20250417T140614 (9c68abdb)
24
+ bun test v1.2.11-canary.20250419T140546 (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.11-canary.20250417T140614 (9c68abdb)
50
+ bun test v1.2.11-canary.20250419T140546 (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.11-canary.20250417T140614 (9c68abdb)
88
+ bun test v1.2.11-canary.20250419T140546 (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.11-canary.20250417T140614 (9c68abdb)
21
+ bun test v1.2.11-canary.20250419T140546 (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.11-canary.20250417T140614 (9c68abdb)
64
+ bun test v1.2.11-canary.20250419T140546 (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.11-canary.20250417T140614 (9c68abdb)
81
+ bun test v1.2.11-canary.20250419T140546 (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.11-canary.20250417T140614 (9c68abdb)
32
+ bun test v1.2.11-canary.20250419T140546 (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.11-canary.20250417T140614"
8
+ Bun.version; // => "1.2.11-canary.20250419T140546"
9
9
  ```
10
10
 
11
11
  ---
@@ -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.11-canary.20250417T140614"
17
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.11-canary.20250419T140546"
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.11-canary.20250417T140614`.
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.11-canary.20250419T140546`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.11-canary.20250417T140614"
195
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.11-canary.20250419T140546"
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.11-canary.20250417T140614"
204
+ $ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.11-canary.20250419T140546"
205
205
  ```
206
206
 
207
207
  ## Downloading Bun binaries directly
@@ -32,7 +32,7 @@ pub fn add(global: *JSC.JSGlobalObject, a: i32, b: i32) !i32 {
32
32
  const gen = bun.gen.math; // "math" being this file's basename
33
33
 
34
34
  const std = @import("std");
35
- const bun = @import("root").bun;
35
+ const bun = @import("bun");
36
36
  const JSC = bun.JSC;
37
37
  ```
38
38
 
@@ -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.11-canary.20250417T140614" -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.11-canary.20250419T140546" -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.11-canary.20250417T140614
131
+ [fetch] > User-Agent: Bun/1.2.11-canary.20250419T140546
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.11-canary.20250417T140614
173
+ [fetch] > User-Agent: Bun/1.2.11-canary.20250419T140546
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -106,8 +106,6 @@ This page is updated regularly to reflect compatibility status of the latest ver
106
106
 
107
107
  🟡 Missing `secureHeapUsed` `setEngine` `setFips`
108
108
 
109
- Some methods are not optimized yet.
110
-
111
109
  ### [`node:domain`](https://nodejs.org/api/domain.html)
112
110
 
113
111
  🟡 Missing `Domain` `active`
@@ -379,6 +377,7 @@ The table below lists all globals implemented by Node.js and Bun's current compa
379
377
  ### [`require()`](https://nodejs.org/api/globals.html#require)
380
378
 
381
379
  🟢 Fully implemented, including [`require.main`](https://nodejs.org/api/modules.html#requiremain), [`require.cache`](https://nodejs.org/api/modules.html#requirecache), [`require.resolve`](https://nodejs.org/api/modules.html#requireresolverequest-options).
380
+
382
381
  ### [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
383
382
 
384
383
  🟢 Fully implemented.
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.11-canary.20250417T140614
58
+ bun test v1.2.11-canary.20250419T140546
59
59
 
60
60
  dom.test.ts:
61
61
  ✓ dom test [0.82ms]
package/fetch.d.ts CHANGED
@@ -39,7 +39,7 @@ declare module "bun" {
39
39
  *
40
40
  * Does not preserve insertion order. Well-known header names are lowercased. Other header names are left as-is.
41
41
  */
42
- toJSON(): Record<string, string>;
42
+ toJSON(): Record<string, string> & { "set-cookie"?: string[] };
43
43
 
44
44
  /**
45
45
  * Get the total number of headers
package/globals.d.ts CHANGED
@@ -1312,7 +1312,7 @@ interface PromiseConstructor {
1312
1312
  * This is useful when you want to return a Promise and have code outside the Promise
1313
1313
  * resolve or reject it.
1314
1314
  *
1315
- * ## Example
1315
+ * @example
1316
1316
  * ```ts
1317
1317
  * const { promise, resolve, reject } = Promise.withResolvers();
1318
1318
  *
@@ -1322,8 +1322,6 @@ interface PromiseConstructor {
1322
1322
  *
1323
1323
  * await promise; // "Hello world!"
1324
1324
  * ```
1325
- *
1326
- * `Promise.withResolvers()` is a [stage3 proposal](https://github.com/tc39/proposal-promise-with-resolvers).
1327
1325
  */
1328
1326
  withResolvers<T>(): {
1329
1327
  promise: Promise<T>;
@@ -1832,14 +1830,40 @@ interface BunFetchRequestInit extends RequestInit {
1832
1830
  /**
1833
1831
  * Override http_proxy or HTTPS_PROXY
1834
1832
  * This is a custom property that is not part of the Fetch API specification.
1833
+ *
1834
+ * @example
1835
+ * ```js
1836
+ * const response = await fetch("http://example.com", {
1837
+ * proxy: "https://username:password@127.0.0.1:8080"
1838
+ * });
1839
+ * ```
1835
1840
  */
1836
1841
  proxy?: string;
1837
1842
 
1838
1843
  /**
1839
1844
  * Override the default S3 options
1845
+ *
1846
+ * @example
1847
+ * ```js
1848
+ * const response = await fetch("s3://bucket/key", {
1849
+ * s3: {
1850
+ * accessKeyId: "AKIAIOSFODNN7EXAMPLE",
1851
+ * secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
1852
+ * region: "us-east-1",
1853
+ * }
1854
+ * });
1855
+ * ```
1840
1856
  */
1841
1857
  s3?: Bun.S3Options;
1842
1858
 
1859
+ /**
1860
+ * Make the request over a Unix socket
1861
+ *
1862
+ * @example
1863
+ * ```js
1864
+ * const response = await fetch("http://example.com", { unix: "/path/to/socket" });
1865
+ * ```
1866
+ */
1843
1867
  unix?: string;
1844
1868
  }
1845
1869
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.11-canary.20250417T140614",
2
+ "version": "1.2.11-canary.20250419T140546",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",
package/redis.d.ts CHANGED
@@ -1,11 +1,5 @@
1
1
  declare module "bun" {
2
2
  export interface RedisOptions {
3
- /**
4
- * URL to connect to, defaults to "redis://localhost:6379"
5
- * Supported protocols: redis://, rediss://, redis+unix://, redis+tls://
6
- */
7
- url?: string;
8
-
9
3
  /**
10
4
  * Connection timeout in milliseconds
11
5
  * @default 10000
package/s3.d.ts CHANGED
@@ -764,7 +764,6 @@ declare module "bun" {
764
764
  * @category Cloud Storage
765
765
  */
766
766
  class S3Client {
767
- prototype: S3Client;
768
767
  /**
769
768
  * Create a new instance of an S3 bucket so that credentials can be managed
770
769
  * from a single instance instead of being passed to every method.
package/shell.d.ts CHANGED
@@ -12,7 +12,13 @@ declare module "bun" {
12
12
  | ReadableStream;
13
13
 
14
14
  /**
15
- * The Bun shell
15
+ * The [Bun shell](https://bun.sh/docs/runtime/shell) is a powerful tool for running shell commands.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const result = await $`echo "Hello, world!"`.text();
20
+ * console.log(result); // "Hello, world!"
21
+ * ```
16
22
  *
17
23
  * @category Process Management
18
24
  */
@@ -46,8 +52,7 @@ declare module "bun" {
46
52
  * @param newEnv Default environment variables to use for shells created by this instance.
47
53
  * @default process.env
48
54
  *
49
- * ## Example
50
- *
55
+ * @example
51
56
  * ```js
52
57
  * import {$} from 'bun';
53
58
  * $.env({ BUN: "bun" });
@@ -73,6 +78,17 @@ declare module "bun" {
73
78
  */
74
79
  function throws(shouldThrow: boolean): typeof $;
75
80
 
81
+ /**
82
+ * The `Bun.$.ShellPromise` class represents a shell command that gets executed
83
+ * once awaited, or called with `.text()`, `.json()`, etc.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const myShellPromise = $`echo "Hello, world!"`;
88
+ * const result = await myShellPromise.text();
89
+ * console.log(result); // "Hello, world!"
90
+ * ```
91
+ */
76
92
  class ShellPromise extends Promise<ShellOutput> {
77
93
  get stdin(): WritableStream;
78
94
 
@@ -81,6 +97,7 @@ declare module "bun" {
81
97
  * @param newCwd - The new working directory
82
98
  */
83
99
  cwd(newCwd: string): this;
100
+
84
101
  /**
85
102
  * Set environment variables for the shell.
86
103
  * @param newEnv - The new environment variables
@@ -92,6 +109,7 @@ declare module "bun" {
92
109
  * ```
93
110
  */
94
111
  env(newEnv: Record<string, string> | undefined): this;
112
+
95
113
  /**
96
114
  * By default, the shell will write to the current process's stdout and stderr, as well as buffering that output.
97
115
  *
@@ -107,27 +125,25 @@ declare module "bun" {
107
125
  lines(): AsyncIterable<string>;
108
126
 
109
127
  /**
110
- * Read from stdout as a string
128
+ * Read from stdout as a string.
111
129
  *
112
130
  * Automatically calls {@link quiet} to disable echoing to stdout.
131
+ *
113
132
  * @param encoding - The encoding to use when decoding the output
114
133
  * @returns A promise that resolves with stdout as a string
115
- * @example
116
- *
117
- * ## Read as UTF-8 string
118
134
  *
135
+ * @example
136
+ * **Read as UTF-8 string**
119
137
  * ```ts
120
138
  * const output = await $`echo hello`.text();
121
139
  * console.log(output); // "hello\n"
122
140
  * ```
123
141
  *
124
- * ## Read as base64 string
125
- *
142
+ * **Read as base64 string**
126
143
  * ```ts
127
144
  * const output = await $`echo ${atob("hello")}`.text("base64");
128
145
  * console.log(output); // "hello\n"
129
146
  * ```
130
- *
131
147
  */
132
148
  text(encoding?: BufferEncoding): Promise<string>;
133
149
 
@@ -189,6 +205,20 @@ declare module "bun" {
189
205
  throws(shouldThrow: boolean): this;
190
206
  }
191
207
 
208
+ /**
209
+ * ShellError represents an error that occurred while executing a shell command with [the Bun Shell](https://bun.sh/docs/runtime/shell).
210
+ *
211
+ * @example
212
+ * ```ts
213
+ * try {
214
+ * const result = await $`exit 1`;
215
+ * } catch (error) {
216
+ * if (error instanceof ShellError) {
217
+ * console.log(error.exitCode); // 1
218
+ * }
219
+ * }
220
+ * ```
221
+ */
192
222
  class ShellError extends Error implements ShellOutput {
193
223
  readonly stdout: Buffer;
194
224
  readonly stderr: Buffer;
@@ -199,22 +229,19 @@ declare module "bun" {
199
229
  *
200
230
  * @param encoding - The encoding to use when decoding the output
201
231
  * @returns Stdout as a string with the given encoding
202
- * @example
203
- *
204
- * ## Read as UTF-8 string
205
232
  *
233
+ * @example
234
+ * **Read as UTF-8 string**
206
235
  * ```ts
207
236
  * const output = await $`echo hello`;
208
237
  * console.log(output.text()); // "hello\n"
209
238
  * ```
210
239
  *
211
- * ## Read as base64 string
212
- *
240
+ * **Read as base64 string**
213
241
  * ```ts
214
242
  * const output = await $`echo ${atob("hello")}`;
215
243
  * console.log(output.text("base64")); // "hello\n"
216
244
  * ```
217
- *
218
245
  */
219
246
  text(encoding?: BufferEncoding): string;
220
247
 
@@ -280,22 +307,19 @@ declare module "bun" {
280
307
  *
281
308
  * @param encoding - The encoding to use when decoding the output
282
309
  * @returns Stdout as a string with the given encoding
283
- * @example
284
- *
285
- * ## Read as UTF-8 string
286
310
  *
311
+ * @example
312
+ * **Read as UTF-8 string**
287
313
  * ```ts
288
314
  * const output = await $`echo hello`;
289
315
  * console.log(output.text()); // "hello\n"
290
316
  * ```
291
317
  *
292
- * ## Read as base64 string
293
- *
318
+ * **Read as base64 string**
294
319
  * ```ts
295
320
  * const output = await $`echo ${atob("hello")}`;
296
321
  * console.log(output.text("base64")); // "hello\n"
297
322
  * ```
298
- *
299
323
  */
300
324
  text(encoding?: BufferEncoding): string;
301
325