bun-types 1.2.15 → 1.2.16-canary.20250529T140623

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
@@ -3686,7 +3686,7 @@ declare module "bun" {
3686
3686
  * the well-known CAs curated by Mozilla. Mozilla's CAs are completely
3687
3687
  * replaced when CAs are explicitly specified using this option.
3688
3688
  */
3689
- ca?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
3689
+ ca?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined;
3690
3690
  /**
3691
3691
  * Cert chains in PEM format. One cert chain should be provided per
3692
3692
  * private key. Each cert chain should consist of the PEM formatted
@@ -3698,7 +3698,7 @@ declare module "bun" {
3698
3698
  * intermediate certificates are not provided, the peer will not be
3699
3699
  * able to validate the certificate, and the handshake will fail.
3700
3700
  */
3701
- cert?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
3701
+ cert?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined;
3702
3702
  /**
3703
3703
  * Private keys in PEM format. PEM allows the option of private keys
3704
3704
  * being encrypted. Encrypted keys will be decrypted with
@@ -3709,13 +3709,25 @@ declare module "bun" {
3709
3709
  * object.passphrase is optional. Encrypted keys will be decrypted with
3710
3710
  * object.passphrase if provided, or options.passphrase if it is not.
3711
3711
  */
3712
- key?: string | Buffer | BunFile | Array<string | Buffer | BunFile> | undefined;
3712
+ key?: string | BufferSource | BunFile | Array<string | BufferSource | BunFile> | undefined;
3713
3713
  /**
3714
3714
  * Optionally affect the OpenSSL protocol behavior, which is not
3715
3715
  * usually necessary. This should be used carefully if at all! Value is
3716
3716
  * a numeric bitmask of the SSL_OP_* options from OpenSSL Options
3717
3717
  */
3718
3718
  secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options
3719
+
3720
+ keyFile?: string;
3721
+
3722
+ certFile?: string;
3723
+
3724
+ ALPNProtocols?: string | BufferSource;
3725
+
3726
+ ciphers?: string;
3727
+
3728
+ clientRenegotiationLimit?: number;
3729
+
3730
+ clientRenegotiationWindow?: number;
3719
3731
  }
3720
3732
 
3721
3733
  // Note for contributors: TLSOptionsAsDeprecated should be considered immutable
@@ -6084,7 +6096,7 @@ declare module "bun" {
6084
6096
  * certificate.
6085
6097
  * @return A certificate object.
6086
6098
  */
6087
- getPeerCertificate(): import("tls").PeerCertificate;
6099
+ getPeerCertificate(): import("node:tls").PeerCertificate;
6088
6100
  getPeerX509Certificate(): import("node:crypto").X509Certificate;
6089
6101
 
6090
6102
  /**
@@ -6189,6 +6201,34 @@ declare module "bun" {
6189
6201
  * The number of bytes written to the socket.
6190
6202
  */
6191
6203
  readonly bytesWritten: number;
6204
+
6205
+ resume(): void;
6206
+
6207
+ pause(): void;
6208
+
6209
+ renegotiate(): void;
6210
+
6211
+ setVerifyMode(requestCert: boolean, rejectUnauthorized: boolean): void;
6212
+
6213
+ getSession(): void;
6214
+
6215
+ setSession(session: string | Buffer | BufferSource): void;
6216
+
6217
+ exportKeyingMaterial(length: number, label: string, context?: string | BufferSource): void;
6218
+
6219
+ upgradeTLS<Data>(options: TLSUpgradeOptions<Data>): [raw: Socket<Data>, tls: Socket<Data>];
6220
+
6221
+ close(): void;
6222
+
6223
+ getServername(): string;
6224
+
6225
+ setServername(name: string): void;
6226
+ }
6227
+
6228
+ interface TLSUpgradeOptions<Data> {
6229
+ data?: Data;
6230
+ tls: TLSOptions | boolean;
6231
+ socket: SocketHandler<Data>;
6192
6232
  }
6193
6233
 
6194
6234
  interface SocketListener<Data = undefined> extends Disposable {
@@ -6289,6 +6329,22 @@ declare module "bun" {
6289
6329
  * The per-instance data context
6290
6330
  */
6291
6331
  data?: Data;
6332
+ /**
6333
+ * Whether to allow half-open connections.
6334
+ *
6335
+ * A half-open connection occurs when one end of the connection has called `close()`
6336
+ * or sent a FIN packet, while the other end remains open. When set to `true`:
6337
+ *
6338
+ * - The socket won't automatically send FIN when the remote side closes its end
6339
+ * - The local side can continue sending data even after the remote side has closed
6340
+ * - The application must explicitly call `end()` to fully close the connection
6341
+ *
6342
+ * When `false`, the socket automatically closes both ends of the connection when
6343
+ * either side closes.
6344
+ *
6345
+ * @default false
6346
+ */
6347
+ allowHalfOpen?: boolean;
6292
6348
  }
6293
6349
 
6294
6350
  interface TCPSocketListenOptions<Data = undefined> extends SocketOptions<Data> {
@@ -6303,7 +6359,7 @@ declare module "bun" {
6303
6359
  /**
6304
6360
  * The TLS configuration object with which to create the server
6305
6361
  */
6306
- tls?: TLSOptions;
6362
+ tls?: TLSOptions | boolean;
6307
6363
  /**
6308
6364
  * Whether to use exclusive mode.
6309
6365
  *
@@ -6349,7 +6405,7 @@ declare module "bun" {
6349
6405
  /**
6350
6406
  * TLS Configuration with which to create the socket
6351
6407
  */
6352
- tls?: boolean;
6408
+ tls?: TLSOptions | boolean;
6353
6409
  /**
6354
6410
  * Whether to use exclusive mode.
6355
6411
  *
@@ -6365,22 +6421,8 @@ declare module "bun" {
6365
6421
  * @default false
6366
6422
  */
6367
6423
  exclusive?: boolean;
6368
- /**
6369
- * Whether to allow half-open connections.
6370
- *
6371
- * A half-open connection occurs when one end of the connection has called `close()`
6372
- * or sent a FIN packet, while the other end remains open. When set to `true`:
6373
- *
6374
- * - The socket won't automatically send FIN when the remote side closes its end
6375
- * - The local side can continue sending data even after the remote side has closed
6376
- * - The application must explicitly call `end()` to fully close the connection
6377
- *
6378
- * When `false` (default), the socket automatically closes both ends of the connection
6379
- * when either side closes.
6380
- *
6381
- * @default false
6382
- */
6383
- allowHalfOpen?: boolean;
6424
+ reusePort?: boolean;
6425
+ ipv6Only?: boolean;
6384
6426
  }
6385
6427
 
6386
6428
  interface UnixSocketOptions<Data = undefined> extends SocketOptions<Data> {
@@ -6391,14 +6433,14 @@ declare module "bun" {
6391
6433
  /**
6392
6434
  * TLS Configuration with which to create the socket
6393
6435
  */
6394
- tls?: TLSOptions;
6436
+ tls?: TLSOptions | boolean;
6395
6437
  }
6396
6438
 
6397
6439
  interface FdSocketOptions<Data = undefined> extends SocketOptions<Data> {
6398
6440
  /**
6399
6441
  * TLS Configuration with which to create the socket
6400
6442
  */
6401
- tls?: TLSOptions;
6443
+ tls?: TLSOptions | boolean;
6402
6444
  /**
6403
6445
  * The file descriptor to connect to
6404
6446
  */
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.15
340
+ [fetch] > User-Agent: Bun/1.2.16-canary.20250529T140623
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.15"
123
+ console.log(text); // => "1.2.16-canary.20250529T140623"
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.15 (ca7428e9)
10
+ bun publish v1.2.16-canary.20250529T140623 (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.15 (16b4bf34)
12
+ bun install v1.2.16-canary.20250529T140623 (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.15"
18
+ + "@types/bun": "^1.2.16-canary.20250529T140623"
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.15"
30
+ "@types/bun": "^1.2.16-canary.20250529T140623"
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.15
100
+ $ bun update @types/bun@1.2.16-canary.20250529T140623
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.15 (9c68abdb)
24
+ bun test v1.2.16-canary.20250529T140623 (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.15 (9c68abdb)
50
+ bun test v1.2.16-canary.20250529T140623 (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.15 (9c68abdb)
88
+ bun test v1.2.16-canary.20250529T140623 (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.15 (9c68abdb)
21
+ bun test v1.2.16-canary.20250529T140623 (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.15 (9c68abdb)
64
+ bun test v1.2.16-canary.20250529T140623 (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.15 (9c68abdb)
81
+ bun test v1.2.16-canary.20250529T140623 (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.15 (9c68abdb)
32
+ bun test v1.2.16-canary.20250529T140623 (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.15"
8
+ Bun.version; // => "1.2.16-canary.20250529T140623"
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.15"
17
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.16-canary.20250529T140623"
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.15`.
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.16-canary.20250529T140623`.
193
193
 
194
194
  ```sh
195
- $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.15"
195
+ $ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.16-canary.20250529T140623"
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.15"
204
+ $ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.16-canary.20250529T140623"
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.15" -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.16-canary.20250529T140623" -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.15
131
+ [fetch] > User-Agent: Bun/1.2.16-canary.20250529T140623
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.15
173
+ [fetch] > User-Agent: Bun/1.2.16-canary.20250529T140623
174
174
  [fetch] > Accept: */*
175
175
  [fetch] > Host: example.com
176
176
  [fetch] > Accept-Encoding: gzip, deflate, br
@@ -120,7 +120,7 @@ This page is updated regularly to reflect compatibility status of the latest ver
120
120
 
121
121
  ### [`node:net`](https://nodejs.org/api/net.html)
122
122
 
123
- 🟡 `SocketAddress` class not exposed (but implemented). `BlockList` exists but is a no-op.
123
+ 🟢 Fully implemented.
124
124
 
125
125
  ### [`node:perf_hooks`](https://nodejs.org/api/perf_hooks.html)
126
126
 
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.15
58
+ bun test v1.2.16-canary.20250529T140623
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.15",
2
+ "version": "1.2.16-canary.20250529T140623",
3
3
  "name": "bun-types",
4
4
  "license": "MIT",
5
5
  "types": "./index.d.ts",