bun-types 1.2.16-canary.20250529T140623 → 1.2.16-canary.20250531T140544
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 +159 -19
- package/docs/api/fetch.md +1 -1
- package/docs/api/spawn.md +1 -1
- package/docs/cli/publish.md +1 -1
- package/docs/guides/ecosystem/nuxt.md +1 -1
- package/docs/guides/install/add-peer.md +2 -2
- package/docs/guides/install/from-npm-install-to-bun-install.md +1 -1
- package/docs/guides/test/run-tests.md +3 -3
- package/docs/guides/test/snapshot.md +3 -3
- package/docs/guides/test/update-snapshots.md +1 -1
- package/docs/guides/util/version.md +1 -1
- package/docs/installation.md +4 -4
- package/docs/runtime/debugger.md +3 -3
- package/docs/test/dom.md +1 -1
- package/package.json +1 -1
- package/test.d.ts +12 -8
package/bun.d.ts
CHANGED
|
@@ -5871,31 +5871,76 @@ declare module "bun" {
|
|
|
5871
5871
|
index: string;
|
|
5872
5872
|
}
|
|
5873
5873
|
|
|
5874
|
+
/**
|
|
5875
|
+
* Represents a TCP or TLS socket connection used for network communication.
|
|
5876
|
+
* This interface provides methods for reading, writing, managing the connection state,
|
|
5877
|
+
* and handling TLS-specific features if applicable.
|
|
5878
|
+
*
|
|
5879
|
+
* Sockets are created using `Bun.connect()` or accepted by a `Bun.listen()` server.
|
|
5880
|
+
*
|
|
5881
|
+
* @category HTTP & Networking
|
|
5882
|
+
*/
|
|
5874
5883
|
interface Socket<Data = undefined> extends Disposable {
|
|
5875
5884
|
/**
|
|
5876
|
-
*
|
|
5885
|
+
* Writes `data` to the socket. This method is unbuffered and non-blocking. This uses the `sendto(2)` syscall internally.
|
|
5886
|
+
*
|
|
5887
|
+
* For optimal performance with multiple small writes, consider batching multiple
|
|
5888
|
+
* writes together into a single `socket.write()` call.
|
|
5877
5889
|
*
|
|
5878
|
-
* @param data The data to write
|
|
5879
|
-
* @param byteOffset The offset in the buffer to start writing from
|
|
5880
|
-
* @param byteLength The number of bytes to write
|
|
5890
|
+
* @param data The data to write. Can be a string (encoded as UTF-8), `ArrayBuffer`, `TypedArray`, or `DataView`.
|
|
5891
|
+
* @param byteOffset The offset in bytes within the buffer to start writing from. Defaults to 0. Ignored for strings.
|
|
5892
|
+
* @param byteLength The number of bytes to write from the buffer. Defaults to the remaining length of the buffer from the offset. Ignored for strings.
|
|
5893
|
+
* @returns The number of bytes written. Returns `-1` if the socket is closed or shutting down. Can return less than the input size if the socket's buffer is full (backpressure).
|
|
5894
|
+
* @example
|
|
5895
|
+
* ```ts
|
|
5896
|
+
* // Send a string
|
|
5897
|
+
* const bytesWritten = socket.write("Hello, world!\n");
|
|
5881
5898
|
*
|
|
5882
|
-
*
|
|
5899
|
+
* // Send binary data
|
|
5900
|
+
* const buffer = new Uint8Array([0x01, 0x02, 0x03]);
|
|
5901
|
+
* socket.write(buffer);
|
|
5883
5902
|
*
|
|
5884
|
-
*
|
|
5885
|
-
*
|
|
5886
|
-
*
|
|
5903
|
+
* // Send part of a buffer
|
|
5904
|
+
* const largeBuffer = new Uint8Array(1024);
|
|
5905
|
+
* // ... fill largeBuffer ...
|
|
5906
|
+
* socket.write(largeBuffer, 100, 50); // Write 50 bytes starting from index 100
|
|
5907
|
+
* ```
|
|
5887
5908
|
*/
|
|
5888
5909
|
write(data: string | BufferSource, byteOffset?: number, byteLength?: number): number;
|
|
5889
5910
|
|
|
5890
5911
|
/**
|
|
5891
|
-
* The data
|
|
5912
|
+
* The user-defined data associated with this socket instance.
|
|
5913
|
+
* This can be set when the socket is created via `Bun.connect({ data: ... })`.
|
|
5914
|
+
* It can be read or updated at any time.
|
|
5915
|
+
*
|
|
5916
|
+
* @example
|
|
5917
|
+
* ```ts
|
|
5918
|
+
* // In a socket handler
|
|
5919
|
+
* function open(socket: Socket<{ userId: string }>) {
|
|
5920
|
+
* console.log(`Socket opened for user: ${socket.data.userId}`);
|
|
5921
|
+
* socket.data.lastActivity = Date.now(); // Update data
|
|
5922
|
+
* }
|
|
5923
|
+
* ```
|
|
5892
5924
|
*/
|
|
5893
5925
|
data: Data;
|
|
5894
5926
|
|
|
5895
5927
|
/**
|
|
5896
|
-
*
|
|
5928
|
+
* Sends the final data chunk and initiates a graceful shutdown of the socket's write side.
|
|
5929
|
+
* After calling `end()`, no more data can be written using `write()` or `end()`.
|
|
5930
|
+
* The socket remains readable until the remote end also closes its write side or the connection is terminated.
|
|
5931
|
+
* This sends a TCP FIN packet after writing the data.
|
|
5897
5932
|
*
|
|
5898
|
-
*
|
|
5933
|
+
* @param data Optional final data to write before closing. Same types as `write()`.
|
|
5934
|
+
* @param byteOffset Optional offset for buffer data.
|
|
5935
|
+
* @param byteLength Optional length for buffer data.
|
|
5936
|
+
* @returns The number of bytes written for the final chunk. Returns `-1` if the socket was already closed or shutting down.
|
|
5937
|
+
* @example
|
|
5938
|
+
* ```ts
|
|
5939
|
+
* // send some data and close the write side
|
|
5940
|
+
* socket.end("Goodbye!");
|
|
5941
|
+
* // or close write side without sending final data
|
|
5942
|
+
* socket.end();
|
|
5943
|
+
* ```
|
|
5899
5944
|
*/
|
|
5900
5945
|
end(data?: string | BufferSource, byteOffset?: number, byteLength?: number): number;
|
|
5901
5946
|
|
|
@@ -5922,20 +5967,33 @@ declare module "bun" {
|
|
|
5922
5967
|
timeout(seconds: number): void;
|
|
5923
5968
|
|
|
5924
5969
|
/**
|
|
5925
|
-
* Forcefully
|
|
5926
|
-
*
|
|
5970
|
+
* Forcefully closes the socket connection immediately. This is an abrupt termination, unlike the graceful shutdown initiated by `end()`.
|
|
5971
|
+
* It uses `SO_LINGER` with `l_onoff=1` and `l_linger=0` before calling `close(2)`.
|
|
5972
|
+
* Consider using {@link close close()} or {@link end end()} for graceful shutdowns.
|
|
5927
5973
|
*
|
|
5928
|
-
*
|
|
5929
|
-
*
|
|
5974
|
+
* @example
|
|
5975
|
+
* ```ts
|
|
5976
|
+
* socket.terminate();
|
|
5977
|
+
* ```
|
|
5930
5978
|
*/
|
|
5931
5979
|
terminate(): void;
|
|
5932
5980
|
|
|
5933
5981
|
/**
|
|
5934
|
-
*
|
|
5982
|
+
* Shuts down the write-half or both halves of the connection.
|
|
5983
|
+
* This allows the socket to enter a half-closed state where it can still receive data
|
|
5984
|
+
* but can no longer send data (`halfClose = true`), or close both read and write
|
|
5985
|
+
* (`halfClose = false`, similar to `end()` but potentially more immediate depending on OS).
|
|
5986
|
+
* Calls `shutdown(2)` syscall internally.
|
|
5935
5987
|
*
|
|
5936
|
-
*
|
|
5988
|
+
* @param halfClose If `true`, only shuts down the write side (allows receiving). If `false` or omitted, shuts down both read and write. Defaults to `false`.
|
|
5989
|
+
* @example
|
|
5990
|
+
* ```ts
|
|
5991
|
+
* // Stop sending data, but allow receiving
|
|
5992
|
+
* socket.shutdown(true);
|
|
5937
5993
|
*
|
|
5938
|
-
*
|
|
5994
|
+
* // Shutdown both reading and writing
|
|
5995
|
+
* socket.shutdown();
|
|
5996
|
+
* ```
|
|
5939
5997
|
*/
|
|
5940
5998
|
shutdown(halfClose?: boolean): void;
|
|
5941
5999
|
|
|
@@ -5961,6 +6019,11 @@ declare module "bun" {
|
|
|
5961
6019
|
|
|
5962
6020
|
/**
|
|
5963
6021
|
* Flush any buffered data to the socket
|
|
6022
|
+
* This attempts to send the data immediately, but success depends on the network conditions
|
|
6023
|
+
* and the receiving end.
|
|
6024
|
+
* It might be necessary after several `write` calls if immediate sending is critical,
|
|
6025
|
+
* though often the OS handles flushing efficiently. Note that `write` calls outside
|
|
6026
|
+
* `open`/`data`/`drain` might benefit from manual `cork`/`flush`.
|
|
5964
6027
|
*/
|
|
5965
6028
|
flush(): void;
|
|
5966
6029
|
|
|
@@ -5982,17 +6045,31 @@ declare module "bun" {
|
|
|
5982
6045
|
|
|
5983
6046
|
/**
|
|
5984
6047
|
* Remote IP address connected to the socket
|
|
6048
|
+
* @example "192.168.1.100" | "2001:db8::1"
|
|
5985
6049
|
*/
|
|
5986
6050
|
readonly remoteAddress: string;
|
|
5987
6051
|
|
|
6052
|
+
/**
|
|
6053
|
+
* Remote port connected to the socket
|
|
6054
|
+
* @example 8080
|
|
6055
|
+
*/
|
|
5988
6056
|
readonly remotePort: number;
|
|
5989
6057
|
|
|
6058
|
+
/**
|
|
6059
|
+
* IP protocol family used for the local endpoint of the socket
|
|
6060
|
+
* @example "IPv4" | "IPv6"
|
|
6061
|
+
*/
|
|
5990
6062
|
readonly localFamily: "IPv4" | "IPv6";
|
|
5991
6063
|
|
|
6064
|
+
/**
|
|
6065
|
+
* Local IP address connected to the socket
|
|
6066
|
+
* @example "192.168.1.100" | "2001:db8::1"
|
|
6067
|
+
*/
|
|
5992
6068
|
readonly localAddress: string;
|
|
5993
6069
|
|
|
5994
6070
|
/**
|
|
5995
6071
|
* local port connected to the socket
|
|
6072
|
+
* @example 8080
|
|
5996
6073
|
*/
|
|
5997
6074
|
readonly localPort: number;
|
|
5998
6075
|
|
|
@@ -6156,6 +6233,8 @@ declare module "bun" {
|
|
|
6156
6233
|
/**
|
|
6157
6234
|
* See `Session Resumption` for more information.
|
|
6158
6235
|
* @return `true` if the session was reused, `false` otherwise.
|
|
6236
|
+
* **TLS Only:** Checks if the current TLS session was resumed from a previous session.
|
|
6237
|
+
* Returns `true` if the session was resumed, `false` otherwise.
|
|
6159
6238
|
*/
|
|
6160
6239
|
isSessionReused(): boolean;
|
|
6161
6240
|
|
|
@@ -6198,30 +6277,91 @@ declare module "bun" {
|
|
|
6198
6277
|
setKeepAlive(enable?: boolean, initialDelay?: number): boolean;
|
|
6199
6278
|
|
|
6200
6279
|
/**
|
|
6201
|
-
* The number of bytes written to the socket.
|
|
6280
|
+
* The total number of bytes successfully written to the socket since it was established.
|
|
6281
|
+
* This includes data currently buffered by the OS but not yet acknowledged by the remote peer.
|
|
6202
6282
|
*/
|
|
6203
6283
|
readonly bytesWritten: number;
|
|
6204
6284
|
|
|
6285
|
+
/**
|
|
6286
|
+
* Alias for `socket.end()`. Allows the socket to be used with `using` declarations
|
|
6287
|
+
* for automatic resource management.
|
|
6288
|
+
* @example
|
|
6289
|
+
* ```ts
|
|
6290
|
+
* async function processSocket() {
|
|
6291
|
+
* using socket = await Bun.connect({ ... });
|
|
6292
|
+
* socket.write("Data");
|
|
6293
|
+
* // socket.end() is called automatically when exiting the scope
|
|
6294
|
+
* }
|
|
6295
|
+
* ```
|
|
6296
|
+
*/
|
|
6297
|
+
[Symbol.dispose](): void;
|
|
6298
|
+
|
|
6205
6299
|
resume(): void;
|
|
6206
6300
|
|
|
6207
6301
|
pause(): void;
|
|
6208
6302
|
|
|
6303
|
+
/**
|
|
6304
|
+
* If this is a TLS Socket
|
|
6305
|
+
*/
|
|
6209
6306
|
renegotiate(): void;
|
|
6210
6307
|
|
|
6308
|
+
/**
|
|
6309
|
+
* Sets the verify mode of the socket.
|
|
6310
|
+
*
|
|
6311
|
+
* @param requestCert Whether to request a certificate.
|
|
6312
|
+
* @param rejectUnauthorized Whether to reject unauthorized certificates.
|
|
6313
|
+
*/
|
|
6211
6314
|
setVerifyMode(requestCert: boolean, rejectUnauthorized: boolean): void;
|
|
6212
6315
|
|
|
6213
6316
|
getSession(): void;
|
|
6214
6317
|
|
|
6318
|
+
/**
|
|
6319
|
+
* Sets the session of the socket.
|
|
6320
|
+
*
|
|
6321
|
+
* @param session The session to set.
|
|
6322
|
+
*/
|
|
6215
6323
|
setSession(session: string | Buffer | BufferSource): void;
|
|
6216
6324
|
|
|
6325
|
+
/**
|
|
6326
|
+
* Exports the keying material of the socket.
|
|
6327
|
+
*
|
|
6328
|
+
* @param length The length of the keying material to export.
|
|
6329
|
+
* @param label The label of the keying material to export.
|
|
6330
|
+
* @param context The context of the keying material to export.
|
|
6331
|
+
*/
|
|
6217
6332
|
exportKeyingMaterial(length: number, label: string, context?: string | BufferSource): void;
|
|
6218
6333
|
|
|
6334
|
+
/**
|
|
6335
|
+
* Upgrades the socket to a TLS socket.
|
|
6336
|
+
*
|
|
6337
|
+
* @param options The options for the upgrade.
|
|
6338
|
+
* @returns A tuple containing the raw socket and the TLS socket.
|
|
6339
|
+
* @see {@link TLSUpgradeOptions}
|
|
6340
|
+
*/
|
|
6219
6341
|
upgradeTLS<Data>(options: TLSUpgradeOptions<Data>): [raw: Socket<Data>, tls: Socket<Data>];
|
|
6220
6342
|
|
|
6343
|
+
/**
|
|
6344
|
+
* Closes the socket.
|
|
6345
|
+
*
|
|
6346
|
+
* This is a wrapper around `end()` and `shutdown()`.
|
|
6347
|
+
*
|
|
6348
|
+
* @see {@link end}
|
|
6349
|
+
* @see {@link shutdown}
|
|
6350
|
+
*/
|
|
6221
6351
|
close(): void;
|
|
6222
6352
|
|
|
6353
|
+
/**
|
|
6354
|
+
* Returns the servername of the socket.
|
|
6355
|
+
*
|
|
6356
|
+
* @see {@link setServername}
|
|
6357
|
+
*/
|
|
6223
6358
|
getServername(): string;
|
|
6224
6359
|
|
|
6360
|
+
/**
|
|
6361
|
+
* Sets the servername of the socket.
|
|
6362
|
+
*
|
|
6363
|
+
* @see {@link getServername}
|
|
6364
|
+
*/
|
|
6225
6365
|
setServername(name: string): void;
|
|
6226
6366
|
}
|
|
6227
6367
|
|
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.16-canary.
|
|
340
|
+
[fetch] > User-Agent: Bun/1.2.16-canary.20250531T140544
|
|
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.16-canary.
|
|
123
|
+
console.log(text); // => "1.2.16-canary.20250531T140544"
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
Configure the output stream by passing one of the following values to `stdout/stderr`:
|
package/docs/cli/publish.md
CHANGED
|
@@ -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.16-canary.
|
|
12
|
+
bun install v1.2.16-canary.20250531T140544 (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.16-canary.
|
|
18
|
+
+ "@types/bun": "^1.2.16-canary.20250531T140544"
|
|
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.16-canary.
|
|
30
|
+
"@types/bun": "^1.2.16-canary.20250531T140544"
|
|
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.16-canary.
|
|
100
|
+
$ bun update @types/bun@1.2.16-canary.20250531T140544
|
|
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.16-canary.
|
|
24
|
+
bun test v1.2.16-canary.20250531T140544 (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.16-canary.
|
|
50
|
+
bun test v1.2.16-canary.20250531T140544 (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.16-canary.
|
|
88
|
+
bun test v1.2.16-canary.20250531T140544 (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.16-canary.
|
|
21
|
+
bun test v1.2.16-canary.20250531T140544 (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.16-canary.
|
|
64
|
+
bun test v1.2.16-canary.20250531T140544 (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.16-canary.
|
|
81
|
+
bun test v1.2.16-canary.20250531T140544 (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.16-canary.
|
|
32
|
+
bun test v1.2.16-canary.20250531T140544 (9c68abdb)
|
|
33
33
|
|
|
34
34
|
test/snap.test.ts:
|
|
35
35
|
✓ snapshot [0.86ms]
|
package/docs/installation.md
CHANGED
|
@@ -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.16-canary.
|
|
17
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.16-canary.20250531T140544"
|
|
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.16-canary.
|
|
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.20250531T140544`.
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.16-canary.
|
|
195
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.16-canary.20250531T140544"
|
|
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.16-canary.
|
|
204
|
+
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.16-canary.20250531T140544"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
## Downloading Bun binaries directly
|
package/docs/runtime/debugger.md
CHANGED
|
@@ -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.16-canary.
|
|
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.20250531T140544" -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.16-canary.
|
|
131
|
+
[fetch] > User-Agent: Bun/1.2.16-canary.20250531T140544
|
|
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.16-canary.
|
|
173
|
+
[fetch] > User-Agent: Bun/1.2.16-canary.20250531T140544
|
|
174
174
|
[fetch] > Accept: */*
|
|
175
175
|
[fetch] > Host: example.com
|
|
176
176
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/test/dom.md
CHANGED
package/package.json
CHANGED
package/test.d.ts
CHANGED
|
@@ -88,15 +88,19 @@ declare module "bun:test" {
|
|
|
88
88
|
*/
|
|
89
89
|
export function setSystemTime(now?: Date | number): ThisType<void>;
|
|
90
90
|
|
|
91
|
-
interface Jest {
|
|
92
|
-
restoreAllMocks(): void;
|
|
93
|
-
clearAllMocks(): void;
|
|
94
|
-
fn<T extends (...args: any[]) => any>(func?: T): Mock<T>;
|
|
95
|
-
setSystemTime(now?: number | Date): void;
|
|
96
|
-
setTimeout(milliseconds: number): void;
|
|
97
|
-
}
|
|
98
|
-
export const jest: Jest;
|
|
99
91
|
export namespace jest {
|
|
92
|
+
function restoreAllMocks(): void;
|
|
93
|
+
function clearAllMocks(): void;
|
|
94
|
+
function fn<T extends (...args: any[]) => any>(func?: T): Mock<T>;
|
|
95
|
+
function setSystemTime(now?: number | Date): void;
|
|
96
|
+
function setTimeout(milliseconds: number): void;
|
|
97
|
+
function useFakeTimers(): void;
|
|
98
|
+
function useRealTimers(): void;
|
|
99
|
+
function spyOn<T extends object, K extends keyof T>(
|
|
100
|
+
obj: T,
|
|
101
|
+
methodOrPropertyValue: K,
|
|
102
|
+
): Mock<Extract<T[K], (...args: any[]) => any>>;
|
|
103
|
+
|
|
100
104
|
/**
|
|
101
105
|
* Constructs the type of a mock function, e.g. the return type of `jest.fn()`.
|
|
102
106
|
*/
|