bun-types 1.2.6-canary.20250312T140728 → 1.2.6-canary.20250313T140623
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 +116 -115
- package/devserver.d.ts +60 -0
- 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/project/contributing.md +13 -1
- package/docs/runtime/debugger.md +3 -3
- package/docs/runtime/nodejs-apis.md +1 -1
- package/docs/test/dom.md +1 -1
- package/package.json +1 -1
package/bun.d.ts
CHANGED
|
@@ -1,74 +1,3 @@
|
|
|
1
|
-
declare class _ShellError extends Error implements ShellOutput {
|
|
2
|
-
readonly stdout: Buffer;
|
|
3
|
-
readonly stderr: Buffer;
|
|
4
|
-
readonly exitCode: number;
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Read from stdout as a string
|
|
8
|
-
*
|
|
9
|
-
* @param encoding - The encoding to use when decoding the output
|
|
10
|
-
* @returns Stdout as a string with the given encoding
|
|
11
|
-
* @example
|
|
12
|
-
*
|
|
13
|
-
* ## Read as UTF-8 string
|
|
14
|
-
*
|
|
15
|
-
* ```ts
|
|
16
|
-
* const output = await $`echo hello`;
|
|
17
|
-
* console.log(output.text()); // "hello\n"
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* ## Read as base64 string
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* const output = await $`echo ${atob("hello")}`;
|
|
24
|
-
* console.log(output.text("base64")); // "hello\n"
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
text(encoding?: BufferEncoding): string;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Read from stdout as a JSON object
|
|
32
|
-
*
|
|
33
|
-
* @returns Stdout as a JSON object
|
|
34
|
-
* @example
|
|
35
|
-
*
|
|
36
|
-
* ```ts
|
|
37
|
-
* const output = await $`echo '{"hello": 123}'`;
|
|
38
|
-
* console.log(output.json()); // { hello: 123 }
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
json(): any;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Read from stdout as an ArrayBuffer
|
|
46
|
-
*
|
|
47
|
-
* @returns Stdout as an ArrayBuffer
|
|
48
|
-
* @example
|
|
49
|
-
*
|
|
50
|
-
* ```ts
|
|
51
|
-
* const output = await $`echo hello`;
|
|
52
|
-
* console.log(output.arrayBuffer()); // ArrayBuffer { byteLength: 6 }
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
arrayBuffer(): ArrayBuffer;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Read from stdout as a Blob
|
|
59
|
-
*
|
|
60
|
-
* @returns Stdout as a blob
|
|
61
|
-
* @example
|
|
62
|
-
* ```ts
|
|
63
|
-
* const output = await $`echo hello`;
|
|
64
|
-
* console.log(output.blob()); // Blob { size: 6, type: "" }
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
blob(): Blob;
|
|
68
|
-
|
|
69
|
-
bytes(): Uint8Array;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
1
|
/**
|
|
73
2
|
* Bun.js runtime APIs
|
|
74
3
|
*
|
|
@@ -192,6 +121,77 @@ declare module "bun" {
|
|
|
192
121
|
| SpawnOptions.Writable
|
|
193
122
|
| ReadableStream;
|
|
194
123
|
|
|
124
|
+
class ShellError extends Error implements ShellOutput {
|
|
125
|
+
readonly stdout: Buffer;
|
|
126
|
+
readonly stderr: Buffer;
|
|
127
|
+
readonly exitCode: number;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Read from stdout as a string
|
|
131
|
+
*
|
|
132
|
+
* @param encoding - The encoding to use when decoding the output
|
|
133
|
+
* @returns Stdout as a string with the given encoding
|
|
134
|
+
* @example
|
|
135
|
+
*
|
|
136
|
+
* ## Read as UTF-8 string
|
|
137
|
+
*
|
|
138
|
+
* ```ts
|
|
139
|
+
* const output = await $`echo hello`;
|
|
140
|
+
* console.log(output.text()); // "hello\n"
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* ## Read as base64 string
|
|
144
|
+
*
|
|
145
|
+
* ```ts
|
|
146
|
+
* const output = await $`echo ${atob("hello")}`;
|
|
147
|
+
* console.log(output.text("base64")); // "hello\n"
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
150
|
+
*/
|
|
151
|
+
text(encoding?: BufferEncoding): string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Read from stdout as a JSON object
|
|
155
|
+
*
|
|
156
|
+
* @returns Stdout as a JSON object
|
|
157
|
+
* @example
|
|
158
|
+
*
|
|
159
|
+
* ```ts
|
|
160
|
+
* const output = await $`echo '{"hello": 123}'`;
|
|
161
|
+
* console.log(output.json()); // { hello: 123 }
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
*/
|
|
165
|
+
json(): any;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Read from stdout as an ArrayBuffer
|
|
169
|
+
*
|
|
170
|
+
* @returns Stdout as an ArrayBuffer
|
|
171
|
+
* @example
|
|
172
|
+
*
|
|
173
|
+
* ```ts
|
|
174
|
+
* const output = await $`echo hello`;
|
|
175
|
+
* console.log(output.arrayBuffer()); // ArrayBuffer { byteLength: 6 }
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
arrayBuffer(): ArrayBuffer;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Read from stdout as a Blob
|
|
182
|
+
*
|
|
183
|
+
* @returns Stdout as a blob
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* const output = await $`echo hello`;
|
|
187
|
+
* console.log(output.blob()); // Blob { size: 6, type: "" }
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
blob(): Blob;
|
|
191
|
+
|
|
192
|
+
bytes(): Uint8Array;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
195
|
class ShellPromise extends Promise<ShellOutput> {
|
|
196
196
|
get stdin(): WritableStream;
|
|
197
197
|
/**
|
|
@@ -311,15 +311,15 @@ declare module "bun" {
|
|
|
311
311
|
new (): Shell;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
type ShellError = _ShellError;
|
|
315
|
-
|
|
316
314
|
export interface Shell {
|
|
317
315
|
(
|
|
318
316
|
strings: TemplateStringsArray,
|
|
319
317
|
...expressions: ShellExpression[]
|
|
320
318
|
): ShellPromise;
|
|
321
319
|
|
|
322
|
-
readonly
|
|
320
|
+
readonly Shell: ShellConstructor;
|
|
321
|
+
readonly ShellError: typeof ShellError;
|
|
322
|
+
readonly ShellPromise: typeof ShellPromise;
|
|
323
323
|
|
|
324
324
|
/**
|
|
325
325
|
* Perform bash-like brace expansion on the given pattern.
|
|
@@ -372,9 +372,6 @@ declare module "bun" {
|
|
|
372
372
|
* Configure whether or not the shell should throw an exception on non-zero exit codes.
|
|
373
373
|
*/
|
|
374
374
|
throws(shouldThrow: boolean): this;
|
|
375
|
-
|
|
376
|
-
readonly ShellPromise: typeof ShellPromise;
|
|
377
|
-
readonly Shell: ShellConstructor;
|
|
378
375
|
}
|
|
379
376
|
|
|
380
377
|
export interface ShellOutput {
|
|
@@ -4513,25 +4510,7 @@ declare module "bun" {
|
|
|
4513
4510
|
* Passing other options such as `port` or `hostname` won't do anything.
|
|
4514
4511
|
*/
|
|
4515
4512
|
reload<T, R extends { [K in keyof R]: RouterTypes.RouteValue<K & string> }>(
|
|
4516
|
-
options:
|
|
4517
|
-
| (Omit<ServeOptions, "fetch"> & {
|
|
4518
|
-
routes: R;
|
|
4519
|
-
fetch?: (
|
|
4520
|
-
this: Server,
|
|
4521
|
-
request: Request,
|
|
4522
|
-
server: Server,
|
|
4523
|
-
) => Response | Promise<Response>;
|
|
4524
|
-
})
|
|
4525
|
-
| (Omit<ServeOptions, "routes"> & {
|
|
4526
|
-
routes?: never;
|
|
4527
|
-
fetch: (
|
|
4528
|
-
this: Server,
|
|
4529
|
-
request: Request,
|
|
4530
|
-
server: Server,
|
|
4531
|
-
) => Response | Promise<Response>;
|
|
4532
|
-
})
|
|
4533
|
-
| WebSocketServeOptions<T>
|
|
4534
|
-
) & {
|
|
4513
|
+
options: ServeFunctionOptions<T, R> & {
|
|
4535
4514
|
/**
|
|
4536
4515
|
* @deprecated Use `routes` instead in new code. This will continue to work for awhile though.
|
|
4537
4516
|
*/
|
|
@@ -4912,25 +4891,7 @@ declare module "bun" {
|
|
|
4912
4891
|
T,
|
|
4913
4892
|
R extends { [K in keyof R]: RouterTypes.RouteValue<K & string> },
|
|
4914
4893
|
>(
|
|
4915
|
-
options:
|
|
4916
|
-
| (DistributedOmit<Serve, "fetch"> & {
|
|
4917
|
-
routes: R;
|
|
4918
|
-
fetch?: (
|
|
4919
|
-
this: Server,
|
|
4920
|
-
request: Request,
|
|
4921
|
-
server: Server,
|
|
4922
|
-
) => Response | Promise<Response>;
|
|
4923
|
-
})
|
|
4924
|
-
| (DistributedOmit<Serve, "routes"> & {
|
|
4925
|
-
routes?: never;
|
|
4926
|
-
fetch: (
|
|
4927
|
-
this: Server,
|
|
4928
|
-
request: Request,
|
|
4929
|
-
server: Server,
|
|
4930
|
-
) => Response | Promise<Response>;
|
|
4931
|
-
})
|
|
4932
|
-
| WebSocketServeOptions<T>
|
|
4933
|
-
) & {
|
|
4894
|
+
options: ServeFunctionOptions<T, R> & {
|
|
4934
4895
|
/**
|
|
4935
4896
|
* @deprecated Use `routes` instead in new code. This will continue to work for a while though.
|
|
4936
4897
|
*/
|
|
@@ -4938,6 +4899,46 @@ declare module "bun" {
|
|
|
4938
4899
|
},
|
|
4939
4900
|
): Server;
|
|
4940
4901
|
|
|
4902
|
+
type ServeFunctionOptions<
|
|
4903
|
+
T,
|
|
4904
|
+
R extends { [K in keyof R]: RouterTypes.RouteValue<K & string> },
|
|
4905
|
+
> =
|
|
4906
|
+
| (DistributedOmit<Exclude<Serve<T>, WebSocketServeOptions<T>>, "fetch"> & {
|
|
4907
|
+
routes: R;
|
|
4908
|
+
fetch?: (
|
|
4909
|
+
this: Server,
|
|
4910
|
+
request: Request,
|
|
4911
|
+
server: Server,
|
|
4912
|
+
) => Response | Promise<Response>;
|
|
4913
|
+
})
|
|
4914
|
+
| (DistributedOmit<
|
|
4915
|
+
Exclude<Serve<T>, WebSocketServeOptions<T>>,
|
|
4916
|
+
"routes"
|
|
4917
|
+
> & {
|
|
4918
|
+
routes?: never;
|
|
4919
|
+
fetch: (
|
|
4920
|
+
this: Server,
|
|
4921
|
+
request: Request,
|
|
4922
|
+
server: Server,
|
|
4923
|
+
) => Response | Promise<Response>;
|
|
4924
|
+
})
|
|
4925
|
+
| (WebSocketServeOptions<T> & {
|
|
4926
|
+
routes: R;
|
|
4927
|
+
fetch?: (
|
|
4928
|
+
this: Server,
|
|
4929
|
+
request: Request,
|
|
4930
|
+
server: Server,
|
|
4931
|
+
) => Response | Promise<Response | void | undefined> | void | undefined;
|
|
4932
|
+
})
|
|
4933
|
+
| (WebSocketServeOptions<T> & {
|
|
4934
|
+
routes?: never;
|
|
4935
|
+
fetch: (
|
|
4936
|
+
this: Server,
|
|
4937
|
+
request: Request,
|
|
4938
|
+
server: Server,
|
|
4939
|
+
) => Response | Promise<Response | void | undefined> | void | undefined;
|
|
4940
|
+
});
|
|
4941
|
+
|
|
4941
4942
|
/**
|
|
4942
4943
|
* [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) powered by the fastest system calls available for operating on files.
|
|
4943
4944
|
*
|
package/devserver.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
export {};
|
|
2
2
|
|
|
3
3
|
declare global {
|
|
4
|
+
namespace Bun {
|
|
5
|
+
type HMREventNames =
|
|
6
|
+
| "bun:beforeUpdate"
|
|
7
|
+
| "bun:afterUpdate"
|
|
8
|
+
| "bun:beforeFullReload"
|
|
9
|
+
| "bun:beforePrune"
|
|
10
|
+
| "bun:invalidate"
|
|
11
|
+
| "bun:error"
|
|
12
|
+
| "bun:ws:disconnect"
|
|
13
|
+
| "bun:ws:connect";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The event names for the dev server
|
|
17
|
+
*/
|
|
18
|
+
type HMREvent = `bun:${HMREventNames}` | (string & {});
|
|
19
|
+
}
|
|
20
|
+
|
|
4
21
|
interface ImportMeta {
|
|
5
22
|
/**
|
|
6
23
|
* Hot module replacement APIs. This value is `undefined` in production and
|
|
@@ -131,6 +148,49 @@ declare global {
|
|
|
131
148
|
* @deprecated
|
|
132
149
|
*/
|
|
133
150
|
decline(): void;
|
|
151
|
+
|
|
152
|
+
// NOTE TO CONTRIBUTORS ////////////////////////////////////////
|
|
153
|
+
// Callback is currently never called for `.prune()` //
|
|
154
|
+
// so the types are commented out until we support it. //
|
|
155
|
+
////////////////////////////////////////////////////////////////
|
|
156
|
+
// /**
|
|
157
|
+
// * Attach a callback that is called when the module is removed from the module graph.
|
|
158
|
+
// *
|
|
159
|
+
// * This can be used to clean up resources that were created when the module was loaded.
|
|
160
|
+
// * Unlike `import.meta.hot.dispose()`, this pairs much better with `accept` and `data` to manage stateful resources.
|
|
161
|
+
// *
|
|
162
|
+
// * @example
|
|
163
|
+
// * ```ts
|
|
164
|
+
// * export const ws = (import.meta.hot.data.ws ??= new WebSocket(location.origin));
|
|
165
|
+
// *
|
|
166
|
+
// * import.meta.hot.prune(() => {
|
|
167
|
+
// * ws.close();
|
|
168
|
+
// * });
|
|
169
|
+
// * ```
|
|
170
|
+
// */
|
|
171
|
+
// prune(callback: () => void): void;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Listen for an event from the dev server
|
|
175
|
+
*
|
|
176
|
+
* For compatibility with Vite, event names are also available via vite:* prefix instead of bun:*.
|
|
177
|
+
*
|
|
178
|
+
* https://bun.sh/docs/bundler/hmr#import-meta-hot-on-and-off
|
|
179
|
+
* @param event The event to listen to
|
|
180
|
+
* @param callback The callback to call when the event is emitted
|
|
181
|
+
*/
|
|
182
|
+
on(event: Bun.HMREvent, callback: () => void): void;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Stop listening for an event from the dev server
|
|
186
|
+
*
|
|
187
|
+
* For compatibility with Vite, event names are also available via vite:* prefix instead of bun:*.
|
|
188
|
+
*
|
|
189
|
+
* https://bun.sh/docs/bundler/hmr#import-meta-hot-on-and-off
|
|
190
|
+
* @param event The event to stop listening to
|
|
191
|
+
* @param callback The callback to stop listening to
|
|
192
|
+
*/
|
|
193
|
+
off(event: Bun.HMREvent, callback: () => void): void;
|
|
134
194
|
};
|
|
135
195
|
}
|
|
136
196
|
}
|
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.20250313T140623
|
|
341
341
|
[fetch] > Accept: */*
|
|
342
342
|
[fetch] > Host: example.com
|
|
343
343
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
package/docs/api/spawn.md
CHANGED
|
@@ -110,7 +110,7 @@ You can read results from the subprocess via the `stdout` and `stderr` propertie
|
|
|
110
110
|
```ts
|
|
111
111
|
const proc = Bun.spawn(["bun", "--version"]);
|
|
112
112
|
const text = await new Response(proc.stdout).text();
|
|
113
|
-
console.log(text); // => "1.2.6-canary.
|
|
113
|
+
console.log(text); // => "1.2.6-canary.20250313T140623"
|
|
114
114
|
```
|
|
115
115
|
|
|
116
116
|
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.20250313T140623 (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.20250313T140623"
|
|
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.20250313T140623"
|
|
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.20250313T140623
|
|
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.20250313T140623 (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.20250313T140623 (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.20250313T140623 (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.20250313T140623 (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.20250313T140623 (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.20250313T140623 (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.20250313T140623"
|
|
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.20250313T140623`.
|
|
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.20250313T140623"
|
|
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.20250313T140623"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
## Downloading Bun binaries directly
|
|
@@ -205,18 +205,30 @@ WebKit is not cloned by default (to save time and disk space). To clone and buil
|
|
|
205
205
|
# Clone WebKit into ./vendor/WebKit
|
|
206
206
|
$ git clone https://github.com/oven-sh/WebKit vendor/WebKit
|
|
207
207
|
|
|
208
|
+
# Check out the commit hash specified in `set(WEBKIT_VERSION <commit_hash>)` in cmake/tools/SetupWebKit.cmake
|
|
209
|
+
$ git -C vendor/WebKit checkout <commit_hash>
|
|
210
|
+
|
|
208
211
|
# Make a debug build of JSC. This will output build artifacts in ./vendor/WebKit/WebKitBuild/Debug
|
|
209
212
|
# Optionally, you can use `make jsc` for a release build
|
|
210
|
-
$ make jsc-debug
|
|
213
|
+
$ make jsc-debug && rm vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/DerivedSources/inspector/InspectorProtocolObjects.h
|
|
211
214
|
|
|
212
215
|
# Build bun with the local JSC build
|
|
213
216
|
$ bun run build:local
|
|
214
217
|
```
|
|
215
218
|
|
|
219
|
+
Using `bun run build:local` will build Bun in the `./build/debug-local` directory (instead of `./build/debug`), you'll have to change a couple of places to use this new directory:
|
|
220
|
+
|
|
221
|
+
- The first line in [`src/js/builtins.d.ts`](/src/js/builtins.d.ts)
|
|
222
|
+
- The `CompilationDatabase` line in [`.clangd` config](/.clangd) should be `CompilationDatabase: build/debug-local`
|
|
223
|
+
- In [`build.zig`](/build.zig), the `codegen_path` option should be `build/debug-local/codegen` (instead of `build/debug/codegen`)
|
|
224
|
+
- In [`.vscode/launch.json`](/.vscode/launch.json), many configurations use `./build/debug/`, change them as you see fit
|
|
225
|
+
|
|
216
226
|
Note that the WebKit folder, including build artifacts, is 8GB+ in size.
|
|
217
227
|
|
|
218
228
|
If you are using a JSC debug build and using VScode, make sure to run the `C/C++: Select a Configuration` command to configure intellisense to find the debug headers.
|
|
219
229
|
|
|
230
|
+
Note that if you change make changes to our [WebKit fork](https://github.com/oven-sh/WebKit), you will also have to change [`SetupWebKit.cmake`](/cmake/tools/SetupWebKit.cmake) to point to the commit hash.
|
|
231
|
+
|
|
220
232
|
## Troubleshooting
|
|
221
233
|
|
|
222
234
|
### 'span' file not found on Ubuntu
|
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.20250313T140623" -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.20250313T140623
|
|
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.20250313T140623
|
|
174
174
|
[fetch] > Accept: */*
|
|
175
175
|
[fetch] > Host: example.com
|
|
176
176
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
|
@@ -346,7 +346,7 @@ The table below lists all globals implemented by Node.js and Bun's current compa
|
|
|
346
346
|
|
|
347
347
|
### [`process`](https://nodejs.org/api/process.html)
|
|
348
348
|
|
|
349
|
-
🟡 Mostly implemented. `process.binding` (internal Node.js bindings some packages rely on) is partially implemented. `process.title` is
|
|
349
|
+
🟡 Mostly implemented. `process.binding` (internal Node.js bindings some packages rely on) is partially implemented. `process.title` is currently a no-op on macOS & Linux. `getActiveResourcesInfo` `setActiveResourcesInfo`, `getActiveResources` and `setSourceMapsEnabled` are stubs. Newer APIs like `process.loadEnvFile` and `process.getBuiltinModule` are not implemented yet.
|
|
350
350
|
|
|
351
351
|
### [`queueMicrotask()`](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask)
|
|
352
352
|
|
package/docs/test/dom.md
CHANGED
package/package.json
CHANGED