bun-types 1.2.6-canary.20250319T140718 → 1.2.6-canary.20250321T140602
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 +86 -0
- package/docs/api/fetch.md +1 -1
- package/docs/api/s3.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/project/building-windows.md +2 -2
- package/docs/project/contributing.md +1 -1
- package/docs/runtime/debugger.md +3 -3
- package/docs/runtime/nodejs-apis.md +1 -1
- package/docs/test/dom.md +1 -1
- package/globals.d.ts +48 -1
- package/package.json +1 -1
package/bun.d.ts
CHANGED
|
@@ -3901,6 +3901,7 @@ declare module "bun" {
|
|
|
3901
3901
|
|
|
3902
3902
|
interface BunRequest<T extends string = string> extends Request {
|
|
3903
3903
|
params: RouterTypes.ExtractRouteParams<T>;
|
|
3904
|
+
readonly cookies: CookieMap;
|
|
3904
3905
|
}
|
|
3905
3906
|
|
|
3906
3907
|
interface GenericServeOptions {
|
|
@@ -7854,4 +7855,89 @@ declare module "bun" {
|
|
|
7854
7855
|
| [pkg: string, info: BunLockFilePackageInfo, bunTag: string]
|
|
7855
7856
|
/** root */
|
|
7856
7857
|
| [pkg: string, info: Pick<BunLockFileBasePackageInfo, "bin" | "binDir">];
|
|
7858
|
+
|
|
7859
|
+
interface CookieInit {
|
|
7860
|
+
name?: string;
|
|
7861
|
+
value?: string;
|
|
7862
|
+
domain?: string;
|
|
7863
|
+
path?: string;
|
|
7864
|
+
expires?: number | Date;
|
|
7865
|
+
secure?: boolean;
|
|
7866
|
+
sameSite?: CookieSameSite;
|
|
7867
|
+
httpOnly?: boolean;
|
|
7868
|
+
partitioned?: boolean;
|
|
7869
|
+
maxAge?: number;
|
|
7870
|
+
}
|
|
7871
|
+
|
|
7872
|
+
interface CookieStoreDeleteOptions {
|
|
7873
|
+
name: string;
|
|
7874
|
+
domain?: string | null;
|
|
7875
|
+
path?: string;
|
|
7876
|
+
}
|
|
7877
|
+
|
|
7878
|
+
interface CookieStoreGetOptions {
|
|
7879
|
+
name?: string;
|
|
7880
|
+
url?: string;
|
|
7881
|
+
}
|
|
7882
|
+
|
|
7883
|
+
type CookieSameSite = "strict" | "lax" | "none";
|
|
7884
|
+
|
|
7885
|
+
class Cookie {
|
|
7886
|
+
constructor(name: string, value: string, options?: CookieInit);
|
|
7887
|
+
constructor(cookieString: string);
|
|
7888
|
+
constructor(cookieObject?: CookieInit);
|
|
7889
|
+
|
|
7890
|
+
name: string;
|
|
7891
|
+
value: string;
|
|
7892
|
+
domain?: string;
|
|
7893
|
+
path: string;
|
|
7894
|
+
expires?: number;
|
|
7895
|
+
secure: boolean;
|
|
7896
|
+
sameSite: CookieSameSite;
|
|
7897
|
+
partitioned: boolean;
|
|
7898
|
+
maxAge?: number;
|
|
7899
|
+
httpOnly: boolean;
|
|
7900
|
+
|
|
7901
|
+
isExpired(): boolean;
|
|
7902
|
+
|
|
7903
|
+
toString(): string;
|
|
7904
|
+
toJSON(): CookieInit;
|
|
7905
|
+
|
|
7906
|
+
static parse(cookieString: string): Cookie;
|
|
7907
|
+
static from(name: string, value: string, options?: CookieInit): Cookie;
|
|
7908
|
+
static serialize(...cookies: Cookie[]): string;
|
|
7909
|
+
}
|
|
7910
|
+
|
|
7911
|
+
class CookieMap implements Iterable<[string, Cookie]> {
|
|
7912
|
+
constructor(init?: string[][] | Record<string, string> | string);
|
|
7913
|
+
|
|
7914
|
+
get(name: string): Cookie | null;
|
|
7915
|
+
get(options?: CookieStoreGetOptions): Cookie | null;
|
|
7916
|
+
|
|
7917
|
+
getAll(name: string): Cookie[];
|
|
7918
|
+
getAll(options?: CookieStoreGetOptions): Cookie[];
|
|
7919
|
+
|
|
7920
|
+
has(name: string, value?: string): boolean;
|
|
7921
|
+
|
|
7922
|
+
set(name: string, value: string): void;
|
|
7923
|
+
set(options: CookieInit): void;
|
|
7924
|
+
|
|
7925
|
+
delete(name: string): void;
|
|
7926
|
+
delete(options: CookieStoreDeleteOptions): void;
|
|
7927
|
+
|
|
7928
|
+
toString(): string;
|
|
7929
|
+
|
|
7930
|
+
toJSON(): Record<string, ReturnType<Cookie["toJSON"]>>;
|
|
7931
|
+
readonly size: number;
|
|
7932
|
+
|
|
7933
|
+
entries(): IterableIterator<[string, Cookie]>;
|
|
7934
|
+
keys(): IterableIterator<string>;
|
|
7935
|
+
values(): IterableIterator<Cookie>;
|
|
7936
|
+
forEach(
|
|
7937
|
+
callback: (value: Cookie, key: string, map: CookieMap) => void,
|
|
7938
|
+
thisArg?: any,
|
|
7939
|
+
): void;
|
|
7940
|
+
|
|
7941
|
+
[Symbol.iterator](): IterableIterator<[string, Cookie]>;
|
|
7942
|
+
}
|
|
7857
7943
|
}
|
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.6-canary.
|
|
340
|
+
[fetch] > User-Agent: Bun/1.2.6-canary.20250321T140602
|
|
341
341
|
[fetch] > Accept: */*
|
|
342
342
|
[fetch] > Host: example.com
|
|
343
343
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/api/s3.md
CHANGED
|
@@ -715,7 +715,7 @@ await S3Client.delete("my-file.txt", credentials);
|
|
|
715
715
|
await S3Client.unlink("my-file.txt", credentials);
|
|
716
716
|
```
|
|
717
717
|
|
|
718
|
-
## s3
|
|
718
|
+
## `s3://` protocol
|
|
719
719
|
|
|
720
720
|
To make it easier to use the same code for local files and S3 files, the `s3://` protocol is supported in `fetch` and `Bun.file()`.
|
|
721
721
|
|
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.6-canary.
|
|
123
|
+
console.log(text); // => "1.2.6-canary.20250321T140602"
|
|
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.6-canary.
|
|
12
|
+
bun install v1.2.6-canary.20250321T140602 (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.6-canary.
|
|
19
|
+
+ "@types/bun": "^1.2.6-canary.20250321T140602"
|
|
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.6-canary.
|
|
31
|
+
"@types/bun": "^1.2.6-canary.20250321T140602"
|
|
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.6-canary.
|
|
100
|
+
$ bun update @types/bun@1.2.6-canary.20250321T140602
|
|
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.6-canary.
|
|
24
|
+
bun test v1.2.6-canary.20250321T140602 (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.6-canary.
|
|
50
|
+
bun test v1.2.6-canary.20250321T140602 (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.6-canary.
|
|
88
|
+
bun test v1.2.6-canary.20250321T140602 (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.6-canary.
|
|
21
|
+
bun test v1.2.6-canary.20250321T140602 (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.6-canary.
|
|
64
|
+
bun test v1.2.6-canary.20250321T140602 (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.6-canary.
|
|
81
|
+
bun test v1.2.6-canary.20250321T140602 (9c68abdb)
|
|
82
82
|
|
|
83
83
|
test/snap.test.ts:
|
|
84
84
|
✓ 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.6-canary.
|
|
17
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.6-canary.20250321T140602"
|
|
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.6-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.6-canary.20250321T140602`.
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.6-canary.
|
|
195
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.6-canary.20250321T140602"
|
|
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.6-canary.
|
|
204
|
+
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.6-canary.20250321T140602"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
## Downloading Bun binaries directly
|
|
@@ -60,7 +60,7 @@ Visual Studio can be installed graphically using the wizard or through WinGet:
|
|
|
60
60
|
|
|
61
61
|
After Visual Studio, you need the following:
|
|
62
62
|
|
|
63
|
-
- LLVM
|
|
63
|
+
- LLVM 19.1.7
|
|
64
64
|
- Go
|
|
65
65
|
- Rust
|
|
66
66
|
- NASM
|
|
@@ -81,7 +81,7 @@ After Visual Studio, you need the following:
|
|
|
81
81
|
> irm https://get.scoop.sh | iex
|
|
82
82
|
> scoop install nodejs-lts go rust nasm ruby perl ccache
|
|
83
83
|
# scoop seems to be buggy if you install llvm and the rest at the same time
|
|
84
|
-
> scoop install llvm@
|
|
84
|
+
> scoop install llvm@19.1.7
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
{% /codetabs %}
|
|
@@ -80,7 +80,7 @@ $ sudo zypper install clang18 lld18 llvm18
|
|
|
80
80
|
|
|
81
81
|
{% /codetabs %}
|
|
82
82
|
|
|
83
|
-
If none of the above solutions apply, you will have to install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-
|
|
83
|
+
If none of the above solutions apply, you will have to install it [manually](https://github.com/llvm/llvm-project/releases/tag/llvmorg-19.1.7).
|
|
84
84
|
|
|
85
85
|
Make sure Clang/LLVM 18 is in your path:
|
|
86
86
|
|
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.6-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.6-canary.20250321T140602" -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.6-canary.
|
|
131
|
+
[fetch] > User-Agent: Bun/1.2.6-canary.20250321T140602
|
|
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.6-canary.
|
|
173
|
+
[fetch] > User-Agent: Bun/1.2.6-canary.20250321T140602
|
|
174
174
|
[fetch] > Accept: */*
|
|
175
175
|
[fetch] > Host: example.com
|
|
176
176
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
|
@@ -174,7 +174,7 @@ Some methods are not optimized yet.
|
|
|
174
174
|
|
|
175
175
|
### [`node:test`](https://nodejs.org/api/test.html)
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
🟡 Partly implemented. Missing mocks, snapshots, timers. Use [`bun:test`](https://bun.sh/docs/cli/test) instead.
|
|
178
178
|
|
|
179
179
|
### [`node:trace_events`](https://nodejs.org/api/tracing.html)
|
|
180
180
|
|
package/docs/test/dom.md
CHANGED
package/globals.d.ts
CHANGED
|
@@ -76,6 +76,17 @@ declare global {
|
|
|
76
76
|
revision: string;
|
|
77
77
|
reallyExit(code?: number): never;
|
|
78
78
|
dlopen(module: { exports: any }, filename: string, flags?: number): void;
|
|
79
|
+
_exiting: boolean;
|
|
80
|
+
noDeprecation: boolean;
|
|
81
|
+
|
|
82
|
+
binding(m: string): object;
|
|
83
|
+
binding(m: "constants"): {
|
|
84
|
+
os: typeof import("node:os").constants;
|
|
85
|
+
fs: typeof import("node:fs").constants;
|
|
86
|
+
crypto: typeof import("node:crypto").constants;
|
|
87
|
+
zlib: typeof import("node:zlib").constants;
|
|
88
|
+
trace: typeof import("node:trace").constants;
|
|
89
|
+
};
|
|
79
90
|
}
|
|
80
91
|
}
|
|
81
92
|
|
|
@@ -1887,7 +1898,43 @@ declare global {
|
|
|
1887
1898
|
* @param base64 The base64 encoded string to decode into the array
|
|
1888
1899
|
* @param offset Optional starting index to begin setting the decoded bytes (default: 0)
|
|
1889
1900
|
*/
|
|
1890
|
-
setFromBase64(
|
|
1901
|
+
setFromBase64(
|
|
1902
|
+
base64: string,
|
|
1903
|
+
offset?: number,
|
|
1904
|
+
): {
|
|
1905
|
+
/**
|
|
1906
|
+
* The number of bytes read from the base64 string
|
|
1907
|
+
*/
|
|
1908
|
+
read: number;
|
|
1909
|
+
/**
|
|
1910
|
+
* The number of bytes written to the Uint8Array
|
|
1911
|
+
* Will never be greater than the `.byteLength` of this Uint8Array
|
|
1912
|
+
*/
|
|
1913
|
+
written: number;
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* Convert the Uint8Array to a hex encoded string
|
|
1918
|
+
* @returns The hex encoded string representation of the Uint8Array
|
|
1919
|
+
*/
|
|
1920
|
+
toHex(): string;
|
|
1921
|
+
|
|
1922
|
+
/**
|
|
1923
|
+
* Set the contents of the Uint8Array from a hex encoded string
|
|
1924
|
+
* @param hex The hex encoded string to decode into the array. The string must have
|
|
1925
|
+
* an even number of characters, be valid hexadecimal characters and contain no whitespace.
|
|
1926
|
+
*/
|
|
1927
|
+
setFromHex(hex: string): {
|
|
1928
|
+
/**
|
|
1929
|
+
* The number of bytes read from the hex string
|
|
1930
|
+
*/
|
|
1931
|
+
read: number;
|
|
1932
|
+
/**
|
|
1933
|
+
* The number of bytes written to the Uint8Array
|
|
1934
|
+
* Will never be greater than the `.byteLength` of this Uint8Array
|
|
1935
|
+
*/
|
|
1936
|
+
written: number;
|
|
1937
|
+
};
|
|
1891
1938
|
}
|
|
1892
1939
|
|
|
1893
1940
|
interface Uint8ArrayConstructor {
|
package/package.json
CHANGED