bun-types 1.2.8-canary.20250327T140605 → 1.2.8-canary.20250329T140548
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 +335 -233
- package/docs/api/fetch.md +1 -1
- package/docs/api/spawn.md +1 -1
- package/docs/api/sql.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 +10 -0
- package/docs/runtime/debugger.md +3 -3
- package/docs/runtime/nodejs-apis.md +1 -2
- package/docs/test/dom.md +1 -1
- package/ffi.d.ts +8 -1
- package/globals.d.ts +140 -73
- package/html-rewriter.d.ts +2 -0
- package/package.json +1 -1
- package/s3.d.ts +6 -0
- package/sqlite.d.ts +4 -0
- package/test.d.ts +6 -0
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.8-canary.
|
|
340
|
+
[fetch] > User-Agent: Bun/1.2.8-canary.20250329T140548
|
|
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.8-canary.
|
|
123
|
+
console.log(text); // => "1.2.8-canary.20250329T140548"
|
|
124
124
|
```
|
|
125
125
|
|
|
126
126
|
Configure the output stream by passing one of the following values to `stdout/stderr`:
|
package/docs/api/sql.md
CHANGED
|
@@ -240,7 +240,7 @@ const result = await sql.unsafe(
|
|
|
240
240
|
|
|
241
241
|
### Execute and Cancelling Queries
|
|
242
242
|
|
|
243
|
-
Bun's SQL is lazy
|
|
243
|
+
Bun's SQL is lazy, which means it will only start executing when awaited or executed with `.execute()`.
|
|
244
244
|
You can cancel a query that is currently executing by calling the `cancel()` method on the query object.
|
|
245
245
|
|
|
246
246
|
```ts
|
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.8-canary.
|
|
12
|
+
bun install v1.2.8-canary.20250329T140548 (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.8-canary.
|
|
19
|
+
+ "@types/bun": "^1.2.8-canary.20250329T140548"
|
|
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.8-canary.
|
|
31
|
+
"@types/bun": "^1.2.8-canary.20250329T140548"
|
|
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.8-canary.
|
|
100
|
+
$ bun update @types/bun@1.2.8-canary.20250329T140548
|
|
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.8-canary.
|
|
24
|
+
bun test v1.2.8-canary.20250329T140548 (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.8-canary.
|
|
50
|
+
bun test v1.2.8-canary.20250329T140548 (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.8-canary.
|
|
88
|
+
bun test v1.2.8-canary.20250329T140548 (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.8-canary.
|
|
21
|
+
bun test v1.2.8-canary.20250329T140548 (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.8-canary.
|
|
64
|
+
bun test v1.2.8-canary.20250329T140548 (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.8-canary.
|
|
81
|
+
bun test v1.2.8-canary.20250329T140548 (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.8-canary.
|
|
17
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.8-canary.20250329T140548"
|
|
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.8-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.8-canary.20250329T140548`.
|
|
193
193
|
|
|
194
194
|
```sh
|
|
195
|
-
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.8-canary.
|
|
195
|
+
$ curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.8-canary.20250329T140548"
|
|
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.8-canary.
|
|
204
|
+
$ iex "& {$(irm https://bun.sh/install.ps1)} -Version 1.2.8-canary.20250329T140548"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
207
|
## Downloading Bun binaries directly
|
|
@@ -134,6 +134,16 @@ We recommend adding `./build/debug` to your `$PATH` so that you can run `bun-deb
|
|
|
134
134
|
$ bun-debug
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
+
## Running debug builds
|
|
138
|
+
|
|
139
|
+
The `bd` package.json script compiles and runs a debug build of Bun, only printing the output of the build process if it fails.
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
$ bun bd <args>
|
|
143
|
+
$ bun bd test foo.test.ts
|
|
144
|
+
$ bun bd ./foo.ts
|
|
145
|
+
```
|
|
146
|
+
|
|
137
147
|
## Code generation scripts
|
|
138
148
|
|
|
139
149
|
Several code generation scripts are used during Bun's build process. These are run automatically when changes are made to certain files.
|
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.8-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.8-canary.20250329T140548" -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.8-canary.
|
|
131
|
+
[fetch] > User-Agent: Bun/1.2.8-canary.20250329T140548
|
|
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.8-canary.
|
|
173
|
+
[fetch] > User-Agent: Bun/1.2.8-canary.20250329T140548
|
|
174
174
|
[fetch] > Accept: */*
|
|
175
175
|
[fetch] > Host: example.com
|
|
176
176
|
[fetch] > Accept-Encoding: gzip, deflate, br
|
|
@@ -378,8 +378,7 @@ The table below lists all globals implemented by Node.js and Bun's current compa
|
|
|
378
378
|
|
|
379
379
|
### [`require()`](https://nodejs.org/api/globals.html#require)
|
|
380
380
|
|
|
381
|
-
🟢 Fully implemented, including [`require.main`](https://nodejs.org/api/modules.html#requiremain), [`require.cache`](https://nodejs.org/api/modules.html#requirecache), [`require.resolve`](https://nodejs.org/api/modules.html#requireresolverequest-options).
|
|
382
|
-
|
|
381
|
+
🟢 Fully implemented, including [`require.main`](https://nodejs.org/api/modules.html#requiremain), [`require.cache`](https://nodejs.org/api/modules.html#requirecache), [`require.resolve`](https://nodejs.org/api/modules.html#requireresolverequest-options).
|
|
383
382
|
### [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
|
|
384
383
|
|
|
385
384
|
🟢 Fully implemented.
|
package/docs/test/dom.md
CHANGED
package/ffi.d.ts
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* that convert JavaScript types to C types and back. Internally,
|
|
14
14
|
* bun uses [tinycc](https://github.com/TinyCC/tinycc), so a big thanks
|
|
15
15
|
* goes to Fabrice Bellard and TinyCC maintainers for making this possible.
|
|
16
|
+
*
|
|
17
|
+
* @category FFI
|
|
16
18
|
*/
|
|
17
19
|
declare module "bun:ffi" {
|
|
18
20
|
enum FFIType {
|
|
@@ -600,6 +602,8 @@ declare module "bun:ffi" {
|
|
|
600
602
|
* that convert JavaScript types to C types and back. Internally,
|
|
601
603
|
* bun uses [tinycc](https://github.com/TinyCC/tinycc), so a big thanks
|
|
602
604
|
* goes to Fabrice Bellard and TinyCC maintainers for making this possible.
|
|
605
|
+
*
|
|
606
|
+
* @category FFI
|
|
603
607
|
*/
|
|
604
608
|
function dlopen<Fns extends Record<string, FFIFunction>>(
|
|
605
609
|
name: string | import("bun").BunFile | URL,
|
|
@@ -1018,6 +1022,8 @@ declare module "bun:ffi" {
|
|
|
1018
1022
|
* // Do something with rawPtr
|
|
1019
1023
|
* }
|
|
1020
1024
|
* ```
|
|
1025
|
+
*
|
|
1026
|
+
* @category FFI
|
|
1021
1027
|
*/
|
|
1022
1028
|
function ptr(view: NodeJS.TypedArray | ArrayBufferLike | DataView, byteOffset?: number): Pointer;
|
|
1023
1029
|
|
|
@@ -1042,8 +1048,9 @@ declare module "bun:ffi" {
|
|
|
1042
1048
|
* thing to do safely. Passing an invalid pointer can crash the program and
|
|
1043
1049
|
* reading beyond the bounds of the pointer will crash the program or cause
|
|
1044
1050
|
* undefined behavior. Use with care!
|
|
1051
|
+
*
|
|
1052
|
+
* @category FFI
|
|
1045
1053
|
*/
|
|
1046
|
-
|
|
1047
1054
|
class CString extends String {
|
|
1048
1055
|
/**
|
|
1049
1056
|
* Get a string from a UTF-8 encoded C string
|
package/globals.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare module "bun" {
|
|
2
2
|
namespace __internal {
|
|
3
3
|
type NodeWorkerThreadsWorker = import("worker_threads").Worker;
|
|
4
|
-
type
|
|
4
|
+
type LibWorkerOrBunWorker = Bun.__internal.UseLibDomIfAvailable<"Worker", Bun.Worker>;
|
|
5
5
|
|
|
6
6
|
type NodePerfHooksPerformance = import("perf_hooks").Performance;
|
|
7
7
|
type LibPerformanceOrNodePerfHooksPerformance = Bun.__internal.UseLibDomIfAvailable<
|
|
@@ -11,8 +11,10 @@ declare module "bun" {
|
|
|
11
11
|
|
|
12
12
|
type NodeCryptoWebcryptoSubtleCrypto = import("crypto").webcrypto.SubtleCrypto;
|
|
13
13
|
type NodeCryptoWebcryptoCryptoKey = import("crypto").webcrypto.CryptoKey;
|
|
14
|
-
|
|
15
|
-
type
|
|
14
|
+
|
|
15
|
+
type LibEmptyOrNodeUtilTextEncoder = LibDomIsLoaded extends true ? {} : import("util").TextEncoder;
|
|
16
|
+
|
|
17
|
+
type LibEmptyOrNodeUtilTextDecoder = LibDomIsLoaded extends true ? {} : import("util").TextDecoder;
|
|
16
18
|
|
|
17
19
|
type LibEmptyOrNodeReadableStream<T = any> = LibDomIsLoaded extends true
|
|
18
20
|
? {}
|
|
@@ -25,6 +27,8 @@ declare module "bun" {
|
|
|
25
27
|
type LibEmptyOrNodeTransformStream<I = any, O = any> = LibDomIsLoaded extends true
|
|
26
28
|
? {}
|
|
27
29
|
: import("stream/web").TransformStream<I, O>;
|
|
30
|
+
|
|
31
|
+
type LibEmptyOrNodeMessagePort = LibDomIsLoaded extends true ? {} : import("worker_threads").MessagePort;
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
|
|
@@ -47,7 +51,7 @@ declare var WritableStream: Bun.__internal.UseLibDomIfAvailable<
|
|
|
47
51
|
}
|
|
48
52
|
>;
|
|
49
53
|
|
|
50
|
-
interface Worker extends Bun.__internal.
|
|
54
|
+
interface Worker extends Bun.__internal.LibWorkerOrBunWorker {}
|
|
51
55
|
declare var Worker: Bun.__internal.UseLibDomIfAvailable<
|
|
52
56
|
"Worker",
|
|
53
57
|
{
|
|
@@ -62,6 +66,13 @@ declare var Worker: Bun.__internal.UseLibDomIfAvailable<
|
|
|
62
66
|
}
|
|
63
67
|
>;
|
|
64
68
|
|
|
69
|
+
/**
|
|
70
|
+
* A WebSocket client implementation
|
|
71
|
+
*
|
|
72
|
+
* If `DOM` is included in tsconfig `lib`, this falls back to the default DOM global `WebSocket`.
|
|
73
|
+
* Otherwise (when outside of a browser environment), this will be the `WebSocket`
|
|
74
|
+
* implementation from the `ws` package, which Bun implements.
|
|
75
|
+
*/
|
|
65
76
|
declare var WebSocket: Bun.__internal.UseLibDomIfAvailable<"WebSocket", typeof import("ws").WebSocket>;
|
|
66
77
|
|
|
67
78
|
interface Crypto {}
|
|
@@ -81,7 +92,7 @@ declare var crypto: Crypto;
|
|
|
81
92
|
* const uint8array = encoder.encode('this is some data');
|
|
82
93
|
* ```
|
|
83
94
|
*/
|
|
84
|
-
interface TextEncoder extends Bun.__internal.
|
|
95
|
+
interface TextEncoder extends Bun.__internal.LibEmptyOrNodeUtilTextEncoder {
|
|
85
96
|
/**
|
|
86
97
|
* UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object
|
|
87
98
|
* containing the read Unicode code units and written UTF-8 bytes.
|
|
@@ -113,53 +124,51 @@ declare var TextEncoder: Bun.__internal.UseLibDomIfAvailable<
|
|
|
113
124
|
* const decoder = new TextDecoder();
|
|
114
125
|
* const uint8array = decoder.decode('this is some data');
|
|
115
126
|
*/
|
|
127
|
+
interface TextDecoder extends Bun.__internal.LibEmptyOrNodeUtilTextDecoder {}
|
|
116
128
|
declare var TextDecoder: Bun.__internal.UseLibDomIfAvailable<
|
|
117
129
|
"TextDecoder",
|
|
118
130
|
{
|
|
119
|
-
prototype:
|
|
120
|
-
new (
|
|
121
|
-
encoding?: Bun.Encoding,
|
|
122
|
-
options?: { fatal?: boolean; ignoreBOM?: boolean },
|
|
123
|
-
): Bun.__internal.NodeUtilTextDecoder;
|
|
131
|
+
prototype: TextDecoder;
|
|
132
|
+
new (encoding?: Bun.Encoding, options?: { fatal?: boolean; ignoreBOM?: boolean }): TextDecoder;
|
|
124
133
|
}
|
|
125
134
|
>;
|
|
126
135
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
136
|
+
interface Event {
|
|
137
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
138
|
+
readonly bubbles: boolean;
|
|
139
|
+
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
|
|
140
|
+
cancelBubble: boolean;
|
|
141
|
+
/** True if the event was created with the cancelable option */
|
|
142
|
+
readonly cancelable: boolean;
|
|
143
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
144
|
+
readonly composed: boolean;
|
|
145
|
+
/** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */
|
|
146
|
+
composedPath(): [EventTarget?];
|
|
147
|
+
/** Alias for event.target. */
|
|
148
|
+
readonly currentTarget: EventTarget | null;
|
|
149
|
+
/** Is true if cancelable is true and event.preventDefault() has been called. */
|
|
150
|
+
readonly defaultPrevented: boolean;
|
|
151
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
152
|
+
readonly eventPhase: number;
|
|
153
|
+
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
|
|
154
|
+
readonly isTrusted: boolean;
|
|
155
|
+
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
|
|
156
|
+
preventDefault(): void;
|
|
157
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
158
|
+
returnValue: boolean;
|
|
159
|
+
/** Alias for event.target. */
|
|
160
|
+
readonly srcElement: EventTarget | null;
|
|
161
|
+
/** Stops the invocation of event listeners after the current one completes. */
|
|
162
|
+
stopImmediatePropagation(): void;
|
|
163
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
164
|
+
stopPropagation(): void;
|
|
165
|
+
/** The `EventTarget` dispatching the event */
|
|
166
|
+
readonly target: EventTarget | null;
|
|
167
|
+
/** The millisecond timestamp when the Event object was created. */
|
|
168
|
+
readonly timeStamp: number;
|
|
169
|
+
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
|
|
170
|
+
readonly type: string;
|
|
171
|
+
}
|
|
163
172
|
declare var Event: {
|
|
164
173
|
prototype: Event;
|
|
165
174
|
readonly NONE: 0;
|
|
@@ -411,7 +420,13 @@ declare var CloseEvent: {
|
|
|
411
420
|
};
|
|
412
421
|
|
|
413
422
|
interface MessageEvent<T = any> extends Bun.MessageEvent<T> {}
|
|
414
|
-
declare var MessageEvent: Bun.__internal.UseLibDomIfAvailable<
|
|
423
|
+
declare var MessageEvent: Bun.__internal.UseLibDomIfAvailable<
|
|
424
|
+
"MessageEvent",
|
|
425
|
+
{
|
|
426
|
+
prototype: MessageEvent;
|
|
427
|
+
new <T>(type: string, eventInitDict?: Bun.MessageEventInit<T>): MessageEvent<any>;
|
|
428
|
+
}
|
|
429
|
+
>;
|
|
415
430
|
|
|
416
431
|
interface CustomEvent<T = any> extends Event {
|
|
417
432
|
/** Returns any custom data event was created with. Typically used for synthetic events. */
|
|
@@ -1119,7 +1134,7 @@ interface ImportMeta {
|
|
|
1119
1134
|
* import.meta.env === process.env
|
|
1120
1135
|
* ```
|
|
1121
1136
|
*/
|
|
1122
|
-
readonly env:
|
|
1137
|
+
readonly env: Bun.Env;
|
|
1123
1138
|
|
|
1124
1139
|
/**
|
|
1125
1140
|
* @deprecated Use `require.resolve` or `Bun.resolveSync(moduleId, path.dirname(parent))` instead
|
|
@@ -1256,6 +1271,16 @@ interface BlobPropertyBag {
|
|
|
1256
1271
|
interface WorkerOptions extends Bun.WorkerOptions {}
|
|
1257
1272
|
|
|
1258
1273
|
interface Blob {
|
|
1274
|
+
/**
|
|
1275
|
+
* The size of this Blob in bytes
|
|
1276
|
+
*/
|
|
1277
|
+
readonly size: number;
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* The MIME type of this Blob
|
|
1281
|
+
*/
|
|
1282
|
+
readonly type: string;
|
|
1283
|
+
|
|
1259
1284
|
/**
|
|
1260
1285
|
* Read the data from the blob as a JSON object.
|
|
1261
1286
|
*
|
|
@@ -1384,7 +1409,7 @@ interface Uint8ArrayConstructor {
|
|
|
1384
1409
|
interface BroadcastChannel {}
|
|
1385
1410
|
declare var BroadcastChannel: Bun.__internal.UseLibDomIfAvailable<
|
|
1386
1411
|
"BroadcastChannel",
|
|
1387
|
-
import("node:worker_threads").BroadcastChannel
|
|
1412
|
+
typeof import("node:worker_threads").BroadcastChannel
|
|
1388
1413
|
>;
|
|
1389
1414
|
|
|
1390
1415
|
declare var URL: Bun.__internal.UseLibDomIfAvailable<
|
|
@@ -1434,6 +1459,24 @@ declare var AbortSignal: Bun.__internal.UseLibDomIfAvailable<
|
|
|
1434
1459
|
{
|
|
1435
1460
|
prototype: AbortSignal;
|
|
1436
1461
|
new (): AbortSignal;
|
|
1462
|
+
/**
|
|
1463
|
+
* Create an AbortSignal that will be aborted after a timeout
|
|
1464
|
+
* @param ms The timeout in milliseconds
|
|
1465
|
+
* @returns An AbortSignal that will be aborted after the timeout
|
|
1466
|
+
*/
|
|
1467
|
+
timeout(ms: number): AbortSignal;
|
|
1468
|
+
/**
|
|
1469
|
+
* Create an immediately-aborted AbortSignal
|
|
1470
|
+
* @param reason The reason for the abort
|
|
1471
|
+
* @returns An AbortSignal that is already aborted
|
|
1472
|
+
*/
|
|
1473
|
+
abort(reason?: any): AbortSignal;
|
|
1474
|
+
/**
|
|
1475
|
+
* Create an AbortSignal that will be aborted if any of the signals are aborted
|
|
1476
|
+
* @param signals The signals to combine
|
|
1477
|
+
* @returns An AbortSignal that will be aborted if any of the signals are aborted
|
|
1478
|
+
*/
|
|
1479
|
+
any(signals: AbortSignal[]): AbortSignal;
|
|
1437
1480
|
}
|
|
1438
1481
|
>;
|
|
1439
1482
|
|
|
@@ -1443,7 +1486,28 @@ declare var DOMException: Bun.__internal.UseLibDomIfAvailable<
|
|
|
1443
1486
|
{ prototype: DOMException; new (): DOMException }
|
|
1444
1487
|
>;
|
|
1445
1488
|
|
|
1446
|
-
interface FormData {
|
|
1489
|
+
interface FormData {
|
|
1490
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */
|
|
1491
|
+
append(name: string, value: string | Blob): void;
|
|
1492
|
+
append(name: string, value: string): void;
|
|
1493
|
+
append(name: string, blobValue: Blob, filename?: string): void;
|
|
1494
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) */
|
|
1495
|
+
delete(name: string): void;
|
|
1496
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) */
|
|
1497
|
+
get(name: string): Bun.FormDataEntryValue | null;
|
|
1498
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) */
|
|
1499
|
+
getAll(name: string): Bun.FormDataEntryValue[];
|
|
1500
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) */
|
|
1501
|
+
has(name: string): boolean;
|
|
1502
|
+
/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */
|
|
1503
|
+
set(name: string, value: string | Blob): void;
|
|
1504
|
+
set(name: string, value: string): void;
|
|
1505
|
+
set(name: string, blobValue: Blob, filename?: string): void;
|
|
1506
|
+
forEach(callbackfn: (value: Bun.FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void;
|
|
1507
|
+
keys(): IterableIterator<string>;
|
|
1508
|
+
values(): IterableIterator<string>;
|
|
1509
|
+
entries(): IterableIterator<[string, string]>;
|
|
1510
|
+
}
|
|
1447
1511
|
declare var FormData: Bun.__internal.UseLibDomIfAvailable<"FormData", { prototype: FormData; new (): FormData }>;
|
|
1448
1512
|
|
|
1449
1513
|
interface EventSource {}
|
|
@@ -1524,16 +1588,39 @@ declare var TextEncoderStream: Bun.__internal.UseLibDomIfAvailable<
|
|
|
1524
1588
|
interface URLSearchParams {}
|
|
1525
1589
|
declare var URLSearchParams: Bun.__internal.UseLibDomIfAvailable<
|
|
1526
1590
|
"URLSearchParams",
|
|
1527
|
-
{
|
|
1591
|
+
{
|
|
1592
|
+
prototype: URLSearchParams;
|
|
1593
|
+
new (
|
|
1594
|
+
init?:
|
|
1595
|
+
| URLSearchParams
|
|
1596
|
+
| string
|
|
1597
|
+
| Record<string, string | readonly string[]>
|
|
1598
|
+
| Iterable<[string, string]>
|
|
1599
|
+
| ReadonlyArray<[string, string]>,
|
|
1600
|
+
): URLSearchParams;
|
|
1601
|
+
}
|
|
1528
1602
|
>;
|
|
1529
1603
|
|
|
1530
|
-
interface MessageChannel {
|
|
1604
|
+
interface MessageChannel {
|
|
1605
|
+
/**
|
|
1606
|
+
* Returns the first MessagePort object.
|
|
1607
|
+
*
|
|
1608
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port1)
|
|
1609
|
+
*/
|
|
1610
|
+
readonly port1: MessagePort;
|
|
1611
|
+
/**
|
|
1612
|
+
* Returns the second MessagePort object.
|
|
1613
|
+
*
|
|
1614
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/MessageChannel/port2)
|
|
1615
|
+
*/
|
|
1616
|
+
readonly port2: MessagePort;
|
|
1617
|
+
}
|
|
1531
1618
|
declare var MessageChannel: Bun.__internal.UseLibDomIfAvailable<
|
|
1532
1619
|
"MessageChannel",
|
|
1533
1620
|
{ prototype: MessageChannel; new (): MessageChannel }
|
|
1534
1621
|
>;
|
|
1535
1622
|
|
|
1536
|
-
interface MessagePort {}
|
|
1623
|
+
interface MessagePort extends Bun.__internal.LibEmptyOrNodeMessagePort {}
|
|
1537
1624
|
declare var MessagePort: Bun.__internal.UseLibDomIfAvailable<
|
|
1538
1625
|
"MessagePort",
|
|
1539
1626
|
{
|
|
@@ -1665,26 +1752,6 @@ interface BunFetchRequestInit extends RequestInit {
|
|
|
1665
1752
|
s3?: Bun.S3Options;
|
|
1666
1753
|
}
|
|
1667
1754
|
|
|
1668
|
-
/**
|
|
1669
|
-
* Send a HTTP(s) request
|
|
1670
|
-
*
|
|
1671
|
-
* @param request Request object
|
|
1672
|
-
* @param init A structured value that contains settings for the fetch() request.
|
|
1673
|
-
*
|
|
1674
|
-
* @returns A promise that resolves to {@link Response} object.
|
|
1675
|
-
*/
|
|
1676
|
-
declare function fetch(request: Request, init?: BunFetchRequestInit): Promise<Response>;
|
|
1677
|
-
|
|
1678
|
-
/**
|
|
1679
|
-
* Send a HTTP(s) request
|
|
1680
|
-
*
|
|
1681
|
-
* @param url URL string
|
|
1682
|
-
* @param init A structured value that contains settings for the fetch() request.
|
|
1683
|
-
*
|
|
1684
|
-
* @returns A promise that resolves to {@link Response} object.
|
|
1685
|
-
*/
|
|
1686
|
-
declare function fetch(url: string | URL | Request, init?: BunFetchRequestInit): Promise<Response>;
|
|
1687
|
-
|
|
1688
1755
|
/**
|
|
1689
1756
|
* Send a HTTP(s) request
|
|
1690
1757
|
*
|
package/html-rewriter.d.ts
CHANGED
package/package.json
CHANGED
package/s3.d.ts
CHANGED
|
@@ -340,6 +340,8 @@ declare module "bun" {
|
|
|
340
340
|
/**
|
|
341
341
|
* Represents a file in an S3-compatible storage service.
|
|
342
342
|
* Extends the Blob interface for compatibility with web APIs.
|
|
343
|
+
*
|
|
344
|
+
* @category Cloud Storage
|
|
343
345
|
*/
|
|
344
346
|
interface S3File extends Blob {
|
|
345
347
|
/**
|
|
@@ -635,6 +637,8 @@ declare module "bun" {
|
|
|
635
637
|
* await bucket.write("data.json", JSON.stringify({hello: "world"}));
|
|
636
638
|
* const url = bucket.presign("file.pdf");
|
|
637
639
|
* await bucket.unlink("old.txt");
|
|
640
|
+
*
|
|
641
|
+
* @category Cloud Storage
|
|
638
642
|
*/
|
|
639
643
|
class S3Client {
|
|
640
644
|
prototype: S3Client;
|
|
@@ -820,6 +824,8 @@ declare module "bun" {
|
|
|
820
824
|
* A default instance of S3Client
|
|
821
825
|
*
|
|
822
826
|
* Pulls credentials from environment variables. Use `new Bun.S3Client()` if you need to explicitly set credentials.
|
|
827
|
+
*
|
|
828
|
+
* @category Cloud Storage
|
|
823
829
|
*/
|
|
824
830
|
var s3: S3Client;
|
|
825
831
|
}
|