bun-types 1.2.5-canary.20250303T140616 → 1.2.5-canary.20250305T140703
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/ambient.d.ts +6 -0
- package/bun.d.ts +263 -84
- package/devserver.d.ts +24 -0
- package/docs/api/fetch.md +2 -2
- 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/runtime/nodejs-apis.md +1 -1
- package/docs/test/dom.md +1 -1
- package/fetch.d.ts +123 -12
- package/globals.d.ts +174 -423
- package/index.d.ts +5 -4
- package/package.json +3 -4
- package/test.d.ts +21 -0
package/ambient.d.ts
CHANGED
package/bun.d.ts
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
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
|
+
|
|
1
72
|
/**
|
|
2
73
|
* Bun.js runtime APIs
|
|
3
74
|
*
|
|
@@ -16,13 +87,17 @@
|
|
|
16
87
|
declare module "bun" {
|
|
17
88
|
import type { FFIFunctionCallableSymbol } from "bun:ffi";
|
|
18
89
|
import type { Encoding as CryptoEncoding } from "crypto";
|
|
90
|
+
import type { X509Certificate } from "node:crypto";
|
|
91
|
+
import type { Stats } from "node:fs";
|
|
19
92
|
import type {
|
|
20
93
|
CipherNameAndProtocol,
|
|
21
94
|
EphemeralKeyInfo,
|
|
22
95
|
PeerCertificate,
|
|
23
96
|
} from "tls";
|
|
24
|
-
|
|
25
|
-
|
|
97
|
+
|
|
98
|
+
type DistributedOmit<T, K extends keyof T> = T extends T ? Omit<T, K> : never;
|
|
99
|
+
type PathLike = string | NodeJS.TypedArray | ArrayBufferLike | URL;
|
|
100
|
+
|
|
26
101
|
interface Env {
|
|
27
102
|
NODE_ENV?: string;
|
|
28
103
|
/**
|
|
@@ -117,77 +192,6 @@ declare module "bun" {
|
|
|
117
192
|
| SpawnOptions.Writable
|
|
118
193
|
| ReadableStream;
|
|
119
194
|
|
|
120
|
-
class ShellError extends Error implements ShellOutput {
|
|
121
|
-
readonly stdout: Buffer;
|
|
122
|
-
readonly stderr: Buffer;
|
|
123
|
-
readonly exitCode: number;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Read from stdout as a string
|
|
127
|
-
*
|
|
128
|
-
* @param encoding - The encoding to use when decoding the output
|
|
129
|
-
* @returns Stdout as a string with the given encoding
|
|
130
|
-
* @example
|
|
131
|
-
*
|
|
132
|
-
* ## Read as UTF-8 string
|
|
133
|
-
*
|
|
134
|
-
* ```ts
|
|
135
|
-
* const output = await $`echo hello`;
|
|
136
|
-
* console.log(output.text()); // "hello\n"
|
|
137
|
-
* ```
|
|
138
|
-
*
|
|
139
|
-
* ## Read as base64 string
|
|
140
|
-
*
|
|
141
|
-
* ```ts
|
|
142
|
-
* const output = await $`echo ${atob("hello")}`;
|
|
143
|
-
* console.log(output.text("base64")); // "hello\n"
|
|
144
|
-
* ```
|
|
145
|
-
*
|
|
146
|
-
*/
|
|
147
|
-
text(encoding?: BufferEncoding): string;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Read from stdout as a JSON object
|
|
151
|
-
*
|
|
152
|
-
* @returns Stdout as a JSON object
|
|
153
|
-
* @example
|
|
154
|
-
*
|
|
155
|
-
* ```ts
|
|
156
|
-
* const output = await $`echo '{"hello": 123}'`;
|
|
157
|
-
* console.log(output.json()); // { hello: 123 }
|
|
158
|
-
* ```
|
|
159
|
-
*
|
|
160
|
-
*/
|
|
161
|
-
json(): any;
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Read from stdout as an ArrayBuffer
|
|
165
|
-
*
|
|
166
|
-
* @returns Stdout as an ArrayBuffer
|
|
167
|
-
* @example
|
|
168
|
-
*
|
|
169
|
-
* ```ts
|
|
170
|
-
* const output = await $`echo hello`;
|
|
171
|
-
* console.log(output.arrayBuffer()); // ArrayBuffer { byteLength: 6 }
|
|
172
|
-
* ```
|
|
173
|
-
*/
|
|
174
|
-
arrayBuffer(): ArrayBuffer;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Read from stdout as a Blob
|
|
178
|
-
*
|
|
179
|
-
* @returns Stdout as a blob
|
|
180
|
-
* @example
|
|
181
|
-
* ```ts
|
|
182
|
-
* const output = await $`echo hello`;
|
|
183
|
-
* console.log(output.blob()); // Blob { size: 6, type: "" }
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
blob(): Blob;
|
|
187
|
-
|
|
188
|
-
bytes(): Uint8Array;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
195
|
class ShellPromise extends Promise<ShellOutput> {
|
|
192
196
|
get stdin(): WritableStream;
|
|
193
197
|
/**
|
|
@@ -307,12 +311,16 @@ declare module "bun" {
|
|
|
307
311
|
new (): Shell;
|
|
308
312
|
}
|
|
309
313
|
|
|
314
|
+
type ShellError = _ShellError;
|
|
315
|
+
|
|
310
316
|
export interface Shell {
|
|
311
317
|
(
|
|
312
318
|
strings: TemplateStringsArray,
|
|
313
319
|
...expressions: ShellExpression[]
|
|
314
320
|
): ShellPromise;
|
|
315
321
|
|
|
322
|
+
readonly ShellError: typeof _ShellError;
|
|
323
|
+
|
|
316
324
|
/**
|
|
317
325
|
* Perform bash-like brace expansion on the given pattern.
|
|
318
326
|
* @param pattern - Brace pattern to expand
|
|
@@ -2684,9 +2692,15 @@ declare module "bun" {
|
|
|
2684
2692
|
kind: ImportKind;
|
|
2685
2693
|
}
|
|
2686
2694
|
|
|
2695
|
+
/**
|
|
2696
|
+
* @see [Bun.build API docs](https://bun.sh/docs/bundler#api)
|
|
2697
|
+
*/
|
|
2687
2698
|
interface BuildConfig {
|
|
2688
2699
|
entrypoints: string[]; // list of file path
|
|
2689
2700
|
outdir?: string; // output directory
|
|
2701
|
+
/**
|
|
2702
|
+
* @default "browser"
|
|
2703
|
+
*/
|
|
2690
2704
|
target?: Target; // default: "browser"
|
|
2691
2705
|
/**
|
|
2692
2706
|
* Output module format. Top-level await is only supported for `"esm"`.
|
|
@@ -2730,7 +2744,25 @@ declare module "bun" {
|
|
|
2730
2744
|
define?: Record<string, string>;
|
|
2731
2745
|
// origin?: string; // e.g. http://mydomain.com
|
|
2732
2746
|
loader?: { [k in string]: Loader };
|
|
2733
|
-
|
|
2747
|
+
/**
|
|
2748
|
+
* Specifies if and how to generate source maps.
|
|
2749
|
+
*
|
|
2750
|
+
* - `"none"` - No source maps are generated
|
|
2751
|
+
* - `"linked"` - A separate `*.ext.map` file is generated alongside each
|
|
2752
|
+
* `*.ext` file. A `//# sourceMappingURL` comment is added to the output
|
|
2753
|
+
* file to link the two. Requires `outdir` to be set.
|
|
2754
|
+
* - `"inline"` - an inline source map is appended to the output file.
|
|
2755
|
+
* - `"external"` - Generate a separate source map file for each input file.
|
|
2756
|
+
* No `//# sourceMappingURL` comment is added to the output file.
|
|
2757
|
+
*
|
|
2758
|
+
* `true` and `false` are aliasees for `"inline"` and `"none"`, respectively.
|
|
2759
|
+
*
|
|
2760
|
+
* @default "none"
|
|
2761
|
+
*
|
|
2762
|
+
* @see {@link outdir} required for `"linked"` maps
|
|
2763
|
+
* @see {@link publicPath} to customize the base url of linked source maps
|
|
2764
|
+
*/
|
|
2765
|
+
sourcemap?: "none" | "linked" | "inline" | "external" | "linked" | boolean;
|
|
2734
2766
|
/**
|
|
2735
2767
|
* package.json `exports` conditions used when resolving imports
|
|
2736
2768
|
*
|
|
@@ -2759,6 +2791,14 @@ declare module "bun" {
|
|
|
2759
2791
|
* ```
|
|
2760
2792
|
*/
|
|
2761
2793
|
env?: "inline" | "disable" | `${string}*`;
|
|
2794
|
+
/**
|
|
2795
|
+
* Whether to enable minification.
|
|
2796
|
+
*
|
|
2797
|
+
* Use `true`/`false` to enable/disable all minification options. Alternatively,
|
|
2798
|
+
* you can pass an object for granular control over certain minifications.
|
|
2799
|
+
*
|
|
2800
|
+
* @default false
|
|
2801
|
+
*/
|
|
2762
2802
|
minify?:
|
|
2763
2803
|
| boolean
|
|
2764
2804
|
| {
|
|
@@ -4092,13 +4132,14 @@ declare module "bun" {
|
|
|
4092
4132
|
|
|
4093
4133
|
interface TLSWebSocketServeOptions<WebSocketDataType = undefined>
|
|
4094
4134
|
extends WebSocketServeOptions<WebSocketDataType>,
|
|
4095
|
-
|
|
4135
|
+
TLSOptionsAsDeprecated {
|
|
4096
4136
|
unix?: never;
|
|
4097
4137
|
tls?: TLSOptions | TLSOptions[];
|
|
4098
4138
|
}
|
|
4139
|
+
|
|
4099
4140
|
interface UnixTLSWebSocketServeOptions<WebSocketDataType = undefined>
|
|
4100
4141
|
extends UnixWebSocketServeOptions<WebSocketDataType>,
|
|
4101
|
-
|
|
4142
|
+
TLSOptionsAsDeprecated {
|
|
4102
4143
|
/**
|
|
4103
4144
|
* If set, the HTTP server will listen on a unix socket instead of a port.
|
|
4104
4145
|
* (Cannot be used with hostname+port)
|
|
@@ -4106,6 +4147,7 @@ declare module "bun" {
|
|
|
4106
4147
|
unix: string;
|
|
4107
4148
|
tls?: TLSOptions | TLSOptions[];
|
|
4108
4149
|
}
|
|
4150
|
+
|
|
4109
4151
|
interface ErrorLike extends Error {
|
|
4110
4152
|
code?: string;
|
|
4111
4153
|
errno?: number;
|
|
@@ -4200,11 +4242,146 @@ declare module "bun" {
|
|
|
4200
4242
|
secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options
|
|
4201
4243
|
}
|
|
4202
4244
|
|
|
4203
|
-
|
|
4245
|
+
// Note for contributors: TLSOptionsAsDeprecated should be considered immutable
|
|
4246
|
+
// and new TLS option keys should only be supported on the `.tls` property (which comes
|
|
4247
|
+
// from the TLSOptions interface above).
|
|
4248
|
+
/**
|
|
4249
|
+
* This exists because Bun.serve() extends the TLSOptions object, but
|
|
4250
|
+
* they're now considered deprecated. You should be passing the
|
|
4251
|
+
* options on `.tls` instead.
|
|
4252
|
+
*
|
|
4253
|
+
* @example
|
|
4254
|
+
* ```ts
|
|
4255
|
+
* //// OLD ////
|
|
4256
|
+
* Bun.serve({
|
|
4257
|
+
* fetch: () => new Response("Hello World"),
|
|
4258
|
+
* passphrase: "secret",
|
|
4259
|
+
* });
|
|
4260
|
+
*
|
|
4261
|
+
* //// NEW ////
|
|
4262
|
+
* Bun.serve({
|
|
4263
|
+
* fetch: () => new Response("Hello World"),
|
|
4264
|
+
* tls: {
|
|
4265
|
+
* passphrase: "secret",
|
|
4266
|
+
* },
|
|
4267
|
+
* });
|
|
4268
|
+
* ```
|
|
4269
|
+
*/
|
|
4270
|
+
interface TLSOptionsAsDeprecated {
|
|
4271
|
+
/**
|
|
4272
|
+
* Passphrase for the TLS key
|
|
4273
|
+
*
|
|
4274
|
+
* @deprecated Use `.tls.passphrase` instead
|
|
4275
|
+
*/
|
|
4276
|
+
passphrase?: string;
|
|
4277
|
+
|
|
4278
|
+
/**
|
|
4279
|
+
* File path to a .pem file custom Diffie Helman parameters
|
|
4280
|
+
*
|
|
4281
|
+
* @deprecated Use `.tls.dhParamsFile` instead
|
|
4282
|
+
*/
|
|
4283
|
+
dhParamsFile?: string;
|
|
4284
|
+
|
|
4285
|
+
/**
|
|
4286
|
+
* Explicitly set a server name
|
|
4287
|
+
*
|
|
4288
|
+
* @deprecated Use `.tls.serverName` instead
|
|
4289
|
+
*/
|
|
4290
|
+
serverName?: string;
|
|
4291
|
+
|
|
4292
|
+
/**
|
|
4293
|
+
* This sets `OPENSSL_RELEASE_BUFFERS` to 1.
|
|
4294
|
+
* It reduces overall performance but saves some memory.
|
|
4295
|
+
* @default false
|
|
4296
|
+
*
|
|
4297
|
+
* @deprecated Use `.tls.lowMemoryMode` instead
|
|
4298
|
+
*/
|
|
4299
|
+
lowMemoryMode?: boolean;
|
|
4300
|
+
|
|
4301
|
+
/**
|
|
4302
|
+
* If set to `false`, any certificate is accepted.
|
|
4303
|
+
* Default is `$NODE_TLS_REJECT_UNAUTHORIZED` environment variable, or `true` if it is not set.
|
|
4304
|
+
*
|
|
4305
|
+
* @deprecated Use `.tls.rejectUnauthorized` instead
|
|
4306
|
+
*/
|
|
4307
|
+
rejectUnauthorized?: boolean;
|
|
4308
|
+
|
|
4309
|
+
/**
|
|
4310
|
+
* If set to `true`, the server will request a client certificate.
|
|
4311
|
+
*
|
|
4312
|
+
* Default is `false`.
|
|
4313
|
+
*
|
|
4314
|
+
* @deprecated Use `.tls.requestCert` instead
|
|
4315
|
+
*/
|
|
4316
|
+
requestCert?: boolean;
|
|
4317
|
+
|
|
4318
|
+
/**
|
|
4319
|
+
* Optionally override the trusted CA certificates. Default is to trust
|
|
4320
|
+
* the well-known CAs curated by Mozilla. Mozilla's CAs are completely
|
|
4321
|
+
* replaced when CAs are explicitly specified using this option.
|
|
4322
|
+
*
|
|
4323
|
+
* @deprecated Use `.tls.ca` instead
|
|
4324
|
+
*/
|
|
4325
|
+
ca?:
|
|
4326
|
+
| string
|
|
4327
|
+
| Buffer
|
|
4328
|
+
| BunFile
|
|
4329
|
+
| Array<string | Buffer | BunFile>
|
|
4330
|
+
| undefined;
|
|
4331
|
+
/**
|
|
4332
|
+
* Cert chains in PEM format. One cert chain should be provided per
|
|
4333
|
+
* private key. Each cert chain should consist of the PEM formatted
|
|
4334
|
+
* certificate for a provided private key, followed by the PEM
|
|
4335
|
+
* formatted intermediate certificates (if any), in order, and not
|
|
4336
|
+
* including the root CA (the root CA must be pre-known to the peer,
|
|
4337
|
+
* see ca). When providing multiple cert chains, they do not have to
|
|
4338
|
+
* be in the same order as their private keys in key. If the
|
|
4339
|
+
* intermediate certificates are not provided, the peer will not be
|
|
4340
|
+
* able to validate the certificate, and the handshake will fail.
|
|
4341
|
+
*
|
|
4342
|
+
* @deprecated Use `.tls.cert` instead
|
|
4343
|
+
*/
|
|
4344
|
+
cert?:
|
|
4345
|
+
| string
|
|
4346
|
+
| Buffer
|
|
4347
|
+
| BunFile
|
|
4348
|
+
| Array<string | Buffer | BunFile>
|
|
4349
|
+
| undefined;
|
|
4350
|
+
/**
|
|
4351
|
+
* Private keys in PEM format. PEM allows the option of private keys
|
|
4352
|
+
* being encrypted. Encrypted keys will be decrypted with
|
|
4353
|
+
* options.passphrase. Multiple keys using different algorithms can be
|
|
4354
|
+
* provided either as an array of unencrypted key strings or buffers,
|
|
4355
|
+
* or an array of objects in the form {pem: <string|buffer>[,
|
|
4356
|
+
* passphrase: <string>]}. The object form can only occur in an array.
|
|
4357
|
+
* object.passphrase is optional. Encrypted keys will be decrypted with
|
|
4358
|
+
* object.passphrase if provided, or options.passphrase if it is not.
|
|
4359
|
+
*
|
|
4360
|
+
* @deprecated Use `.tls.key` instead
|
|
4361
|
+
*/
|
|
4362
|
+
key?:
|
|
4363
|
+
| string
|
|
4364
|
+
| Buffer
|
|
4365
|
+
| BunFile
|
|
4366
|
+
| Array<string | Buffer | BunFile>
|
|
4367
|
+
| undefined;
|
|
4368
|
+
/**
|
|
4369
|
+
* Optionally affect the OpenSSL protocol behavior, which is not
|
|
4370
|
+
* usually necessary. This should be used carefully if at all! Value is
|
|
4371
|
+
* a numeric bitmask of the SSL_OP_* options from OpenSSL Options
|
|
4372
|
+
*
|
|
4373
|
+
* @deprecated `Use .tls.secureOptions` instead
|
|
4374
|
+
*/
|
|
4375
|
+
secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options
|
|
4376
|
+
}
|
|
4377
|
+
|
|
4378
|
+
interface TLSServeOptions extends ServeOptions, TLSOptionsAsDeprecated {
|
|
4204
4379
|
tls?: TLSOptions | TLSOptions[];
|
|
4205
4380
|
}
|
|
4206
4381
|
|
|
4207
|
-
interface UnixTLSServeOptions
|
|
4382
|
+
interface UnixTLSServeOptions
|
|
4383
|
+
extends UnixServeOptions,
|
|
4384
|
+
TLSOptionsAsDeprecated {
|
|
4208
4385
|
tls?: TLSOptions | TLSOptions[];
|
|
4209
4386
|
}
|
|
4210
4387
|
|
|
@@ -4672,7 +4849,7 @@ declare module "bun" {
|
|
|
4672
4849
|
R extends { [K in keyof R]: RouterTypes.RouteValue<K & string> },
|
|
4673
4850
|
>(
|
|
4674
4851
|
options: (
|
|
4675
|
-
| (
|
|
4852
|
+
| (DistributedOmit<Serve, "fetch"> & {
|
|
4676
4853
|
routes: R;
|
|
4677
4854
|
fetch?: (
|
|
4678
4855
|
this: Server,
|
|
@@ -4680,7 +4857,7 @@ declare module "bun" {
|
|
|
4680
4857
|
server: Server,
|
|
4681
4858
|
) => Response | Promise<Response>;
|
|
4682
4859
|
})
|
|
4683
|
-
| (
|
|
4860
|
+
| (DistributedOmit<Serve, "routes"> & {
|
|
4684
4861
|
routes?: never;
|
|
4685
4862
|
fetch: (
|
|
4686
4863
|
this: Server,
|
|
@@ -4691,7 +4868,7 @@ declare module "bun" {
|
|
|
4691
4868
|
| WebSocketServeOptions<T>
|
|
4692
4869
|
) & {
|
|
4693
4870
|
/**
|
|
4694
|
-
* @deprecated Use `routes` instead in new code. This will continue to work for
|
|
4871
|
+
* @deprecated Use `routes` instead in new code. This will continue to work for a while though.
|
|
4695
4872
|
*/
|
|
4696
4873
|
static?: R;
|
|
4697
4874
|
},
|
|
@@ -5122,7 +5299,7 @@ declare module "bun" {
|
|
|
5122
5299
|
*/
|
|
5123
5300
|
function openInEditor(path: string, options?: EditorOptions): void;
|
|
5124
5301
|
|
|
5125
|
-
|
|
5302
|
+
var fetch: typeof globalThis.fetch & {
|
|
5126
5303
|
preconnect(url: string): void;
|
|
5127
5304
|
};
|
|
5128
5305
|
|
|
@@ -5886,13 +6063,15 @@ declare module "bun" {
|
|
|
5886
6063
|
*
|
|
5887
6064
|
* If unspecified, it is assumed that the plugin is compatible with all targets.
|
|
5888
6065
|
*
|
|
5889
|
-
* This field is not read by Bun.plugin
|
|
6066
|
+
* This field is not read by {@link Bun.plugin}
|
|
5890
6067
|
*/
|
|
5891
6068
|
target?: Target;
|
|
5892
6069
|
/**
|
|
5893
6070
|
* A function that will be called when the plugin is loaded.
|
|
5894
6071
|
*
|
|
5895
|
-
* This function may be called in the same tick that it is registered, or it
|
|
6072
|
+
* This function may be called in the same tick that it is registered, or it
|
|
6073
|
+
* may be called later. It could potentially be called multiple times for
|
|
6074
|
+
* different targets.
|
|
5896
6075
|
*/
|
|
5897
6076
|
setup(
|
|
5898
6077
|
/**
|
package/devserver.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface ImportMeta {
|
|
5
|
+
/**
|
|
6
|
+
* Hot module replacement
|
|
7
|
+
*
|
|
8
|
+
* https://bun.sh/docs/bundler/fullstack
|
|
9
|
+
*/
|
|
10
|
+
hot: {
|
|
11
|
+
/**
|
|
12
|
+
* import.meta.hot.data maintains state between module instances during hot replacement, enabling data transfer from previous to new versions.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import.meta.hot.data = {
|
|
17
|
+
* bun: 'is cool',
|
|
18
|
+
* };
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
data: any;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
package/docs/api/fetch.md
CHANGED
|
@@ -204,7 +204,7 @@ To customize the TLS validation, use the `checkServerIdentity` option in `tls`
|
|
|
204
204
|
await fetch("https://example.com", {
|
|
205
205
|
tls: {
|
|
206
206
|
checkServerIdentity: (hostname, peerCertificate) => {
|
|
207
|
-
// Return an
|
|
207
|
+
// Return an Error if the certificate is invalid
|
|
208
208
|
},
|
|
209
209
|
},
|
|
210
210
|
});
|
|
@@ -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.5-canary.
|
|
340
|
+
[fetch] > User-Agent: Bun/1.2.5-canary.20250305T140703
|
|
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.5-canary.
|
|
113
|
+
console.log(text); // => "1.2.5-canary.20250305T140703"
|
|
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.5-canary.
|
|
12
|
+
bun install v1.2.5-canary.20250305T140703 (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.5-canary.
|
|
19
|
+
+ "@types/bun": "^1.2.5-canary.20250305T140703"
|
|
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.5-canary.
|
|
31
|
+
"@types/bun": "^1.2.5-canary.20250305T140703"
|
|
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.5-canary.
|
|
100
|
+
$ bun update @types/bun@1.2.5-canary.20250305T140703
|
|
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.5-canary.
|
|
24
|
+
bun test v1.2.5-canary.20250305T140703 (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.5-canary.
|
|
50
|
+
bun test v1.2.5-canary.20250305T140703 (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.5-canary.
|
|
88
|
+
bun test v1.2.5-canary.20250305T140703 (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.5-canary.
|
|
21
|
+
bun test v1.2.5-canary.20250305T140703 (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.5-canary.
|
|
64
|
+
bun test v1.2.5-canary.20250305T140703 (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.5-canary.
|
|
81
|
+
bun test v1.2.5-canary.20250305T140703 (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.5-canary.
|
|
17
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.5-canary.20250305T140703"
|
|
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.5-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.5-canary.20250305T140703`.
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.5-canary.
|
|
195
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.5-canary.20250305T140703"
|
|
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.5-canary.
|
|
204
|
+
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.5-canary.20250305T140703"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
## Downloading Bun binaries directly
|