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/globals.d.ts
CHANGED
|
@@ -1,149 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
readonly srcElement: EventTarget | null;
|
|
65
|
-
/** Stops the invocation of event listeners after the current one completes. */
|
|
66
|
-
stopImmediatePropagation(): void;
|
|
67
|
-
/** This is not used in Node.js and is provided purely for completeness. */
|
|
68
|
-
stopPropagation(): void;
|
|
69
|
-
/** The `EventTarget` dispatching the event */
|
|
70
|
-
readonly target: EventTarget | null;
|
|
71
|
-
/** The millisecond timestamp when the Event object was created. */
|
|
72
|
-
readonly timeStamp: number;
|
|
73
|
-
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
|
|
74
|
-
readonly type: string;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
type _EventTarget = typeof globalThis extends {
|
|
78
|
-
onerror: any;
|
|
79
|
-
EventTarget: any;
|
|
80
|
-
}
|
|
81
|
-
? {}
|
|
82
|
-
: {
|
|
83
|
-
/**
|
|
84
|
-
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
|
|
85
|
-
*
|
|
86
|
-
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
|
|
87
|
-
*
|
|
88
|
-
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
|
|
89
|
-
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
|
|
90
|
-
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
|
|
91
|
-
*/
|
|
92
|
-
addEventListener(
|
|
93
|
-
type: string,
|
|
94
|
-
listener: EventListener | EventListenerObject,
|
|
95
|
-
options?: AddEventListenerOptions | boolean,
|
|
96
|
-
): void;
|
|
97
|
-
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
|
|
98
|
-
dispatchEvent(event: Event): boolean;
|
|
99
|
-
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
|
|
100
|
-
removeEventListener(
|
|
101
|
-
type: string,
|
|
102
|
-
listener: EventListener | EventListenerObject,
|
|
103
|
-
options?: Bun.EventListenerOptions | boolean,
|
|
104
|
-
): void;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
type _Crypto = typeof globalThis extends {
|
|
108
|
-
onerror: any;
|
|
109
|
-
Crypto: infer T;
|
|
110
|
-
}
|
|
111
|
-
? T
|
|
112
|
-
: import("crypto").webcrypto.Crypto;
|
|
113
|
-
|
|
114
|
-
type _SubtleCrypto = typeof globalThis extends {
|
|
115
|
-
onerror: any;
|
|
116
|
-
SubtleCrypto: infer T;
|
|
117
|
-
}
|
|
118
|
-
? T
|
|
119
|
-
: import("crypto").webcrypto.SubtleCrypto;
|
|
120
|
-
|
|
121
|
-
type _CryptoKey = typeof globalThis extends {
|
|
122
|
-
onerror: any;
|
|
123
|
-
CryptoKey: infer T;
|
|
124
|
-
}
|
|
125
|
-
? T
|
|
126
|
-
: import("crypto").webcrypto.CryptoKey;
|
|
127
|
-
|
|
128
|
-
type _Body = typeof globalThis extends { onerror: any }
|
|
129
|
-
? {}
|
|
130
|
-
: {
|
|
131
|
-
readonly body: ReadableStream | null;
|
|
132
|
-
readonly bodyUsed: boolean;
|
|
133
|
-
readonly arrayBuffer: () => Promise<ArrayBuffer>;
|
|
134
|
-
readonly blob: () => Promise<Blob>;
|
|
135
|
-
readonly formData: () => Promise<FormData>;
|
|
136
|
-
readonly json: () => Promise<unknown>;
|
|
137
|
-
readonly text: () => Promise<string>;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
import { S3FileOptions } from "bun";
|
|
141
|
-
import type {
|
|
142
|
-
TextDecoder as NodeTextDecoder,
|
|
143
|
-
TextEncoder as NodeTextEncoder,
|
|
144
|
-
} from "util";
|
|
145
|
-
import type { MessagePort } from "worker_threads";
|
|
146
|
-
import type { WebSocket as _WebSocket } from "ws";
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
type _Event = {
|
|
4
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
5
|
+
readonly bubbles: boolean;
|
|
6
|
+
/** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */
|
|
7
|
+
cancelBubble: () => void;
|
|
8
|
+
/** True if the event was created with the cancelable option */
|
|
9
|
+
readonly cancelable: boolean;
|
|
10
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
11
|
+
readonly composed: boolean;
|
|
12
|
+
/** 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. */
|
|
13
|
+
composedPath(): [EventTarget?];
|
|
14
|
+
/** Alias for event.target. */
|
|
15
|
+
readonly currentTarget: EventTarget | null;
|
|
16
|
+
/** Is true if cancelable is true and event.preventDefault() has been called. */
|
|
17
|
+
readonly defaultPrevented: boolean;
|
|
18
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
19
|
+
readonly eventPhase: 0 | 2;
|
|
20
|
+
/** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */
|
|
21
|
+
readonly isTrusted: boolean;
|
|
22
|
+
/** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */
|
|
23
|
+
preventDefault(): void;
|
|
24
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
25
|
+
returnValue: boolean;
|
|
26
|
+
/** Alias for event.target. */
|
|
27
|
+
readonly srcElement: EventTarget | null;
|
|
28
|
+
/** Stops the invocation of event listeners after the current one completes. */
|
|
29
|
+
stopImmediatePropagation(): void;
|
|
30
|
+
/** This is not used in Node.js and is provided purely for completeness. */
|
|
31
|
+
stopPropagation(): void;
|
|
32
|
+
/** The `EventTarget` dispatching the event */
|
|
33
|
+
readonly target: EventTarget | null;
|
|
34
|
+
/** The millisecond timestamp when the Event object was created. */
|
|
35
|
+
readonly timeStamp: number;
|
|
36
|
+
/** Returns the type of event, e.g. "click", "hashchange", or "submit". */
|
|
37
|
+
readonly type: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
type _EventTarget = {
|
|
41
|
+
/**
|
|
42
|
+
* Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value.
|
|
43
|
+
*
|
|
44
|
+
* If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched.
|
|
45
|
+
*
|
|
46
|
+
* The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification.
|
|
47
|
+
* Specifically, the `capture` option is used as part of the key when registering a `listener`.
|
|
48
|
+
* Any individual `listener` may be added once with `capture = false`, and once with `capture = true`.
|
|
49
|
+
*/
|
|
50
|
+
addEventListener(
|
|
51
|
+
type: string,
|
|
52
|
+
listener: EventListener | EventListenerObject,
|
|
53
|
+
options?: AddEventListenerOptions | boolean,
|
|
54
|
+
): void;
|
|
55
|
+
/** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */
|
|
56
|
+
dispatchEvent(event: Event): boolean;
|
|
57
|
+
/** Removes the event listener in target's event listener list with the same type, callback, and options. */
|
|
58
|
+
removeEventListener(
|
|
59
|
+
type: string,
|
|
60
|
+
listener: EventListener | EventListenerObject,
|
|
61
|
+
options?: Bun.EventListenerOptions | boolean,
|
|
62
|
+
): void;
|
|
63
|
+
};
|
|
147
64
|
|
|
148
65
|
declare global {
|
|
149
66
|
var Bun: typeof import("bun");
|
|
@@ -154,7 +71,7 @@ declare global {
|
|
|
154
71
|
browser: boolean;
|
|
155
72
|
|
|
156
73
|
/** Whether you are using Bun */
|
|
157
|
-
isBun:
|
|
74
|
+
isBun: true;
|
|
158
75
|
/** The current git sha of Bun **/
|
|
159
76
|
revision: string;
|
|
160
77
|
reallyExit(code?: number): never;
|
|
@@ -165,7 +82,7 @@ declare global {
|
|
|
165
82
|
namespace Bun {
|
|
166
83
|
type ArrayBufferView = NodeJS.TypedArray | DataView;
|
|
167
84
|
type StringOrBuffer = string | NodeJS.TypedArray | ArrayBufferLike;
|
|
168
|
-
type PathLike =
|
|
85
|
+
type PathLike = import("bun").PathLike;
|
|
169
86
|
type BodyInit = ReadableStream | XMLHttpRequestBodyInit | URLSearchParams;
|
|
170
87
|
type XMLHttpRequestBodyInit = Blob | BufferSource | string | FormData;
|
|
171
88
|
type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
|
|
@@ -173,7 +90,7 @@ declare global {
|
|
|
173
90
|
| ReadableStreamDefaultReadValueResult<T>
|
|
174
91
|
| ReadableStreamDefaultReadDoneResult;
|
|
175
92
|
type ReadableStreamReader<T> = ReadableStreamDefaultReader<T>;
|
|
176
|
-
type Transferable = ArrayBuffer | MessagePort;
|
|
93
|
+
type Transferable = ArrayBuffer | import("worker_threads").MessagePort;
|
|
177
94
|
type MessageEventSource = undefined;
|
|
178
95
|
type Encoding = "utf-8" | "windows-1252" | "utf-16";
|
|
179
96
|
type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection";
|
|
@@ -257,7 +174,8 @@ declare global {
|
|
|
257
174
|
| "opaque"
|
|
258
175
|
| "opaqueredirect";
|
|
259
176
|
|
|
260
|
-
|
|
177
|
+
type _TextEncoder = import("util").TextEncoder;
|
|
178
|
+
interface TextEncoder extends _TextEncoder {
|
|
261
179
|
new (
|
|
262
180
|
encoding?: Bun.Encoding,
|
|
263
181
|
options?: { fatal?: boolean; ignoreBOM?: boolean },
|
|
@@ -281,7 +199,8 @@ declare global {
|
|
|
281
199
|
): import("util").EncodeIntoResult;
|
|
282
200
|
}
|
|
283
201
|
|
|
284
|
-
|
|
202
|
+
type _TextDecoder = import("util").TextDecoder;
|
|
203
|
+
interface TextDecoder extends _TextDecoder {
|
|
285
204
|
new (
|
|
286
205
|
encoding?: Bun.Encoding,
|
|
287
206
|
options?: { fatal?: boolean; ignoreBOM?: boolean },
|
|
@@ -332,7 +251,7 @@ declare global {
|
|
|
332
251
|
/** Returns the origin of the message, for server-sent events and cross-document messaging. */
|
|
333
252
|
readonly origin: string;
|
|
334
253
|
/** Returns the MessagePort array sent with the message, for cross-document messaging and channel messaging. */
|
|
335
|
-
readonly ports: readonly MessagePort[]; // ReadonlyArray<typeof import("worker_threads").MessagePort["prototype"]>;
|
|
254
|
+
readonly ports: readonly (typeof MessagePort)[]; // ReadonlyArray<typeof import("worker_threads").MessagePort["prototype"]>;
|
|
336
255
|
readonly source: Bun.MessageEventSource | null;
|
|
337
256
|
}
|
|
338
257
|
|
|
@@ -531,7 +450,6 @@ declare global {
|
|
|
531
450
|
type?: undefined;
|
|
532
451
|
}
|
|
533
452
|
|
|
534
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
535
453
|
interface DirectUnderlyingSource<R = any> {
|
|
536
454
|
cancel?: UnderlyingSourceCancelCallback;
|
|
537
455
|
pull: (
|
|
@@ -708,6 +626,7 @@ declare global {
|
|
|
708
626
|
* @since v10.5.0
|
|
709
627
|
*/
|
|
710
628
|
ref(): void;
|
|
629
|
+
|
|
711
630
|
/**
|
|
712
631
|
* Calling `unref()` on a worker allows the thread to exit if this is the only
|
|
713
632
|
* active handle in the event system. If the worker is already `unref()`ed calling`unref()` again has no effect.
|
|
@@ -725,83 +644,56 @@ declare global {
|
|
|
725
644
|
}
|
|
726
645
|
}
|
|
727
646
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
}
|
|
751
|
-
? T
|
|
752
|
-
: {
|
|
753
|
-
prototype: WritableStream;
|
|
754
|
-
new <W = any>(
|
|
755
|
-
underlyingSink?: Bun.UnderlyingSink<W>,
|
|
756
|
-
strategy?: QueuingStrategy<W>,
|
|
757
|
-
): WritableStream<W>;
|
|
758
|
-
};
|
|
647
|
+
type _ReadableStream = import("stream/web").ReadableStream;
|
|
648
|
+
interface ReadableStream<R = any> extends _ReadableStream {}
|
|
649
|
+
var ReadableStream: {
|
|
650
|
+
prototype: ReadableStream;
|
|
651
|
+
new <R = any>(
|
|
652
|
+
underlyingSource?: Bun.UnderlyingSource<R>,
|
|
653
|
+
strategy?: QueuingStrategy<R>,
|
|
654
|
+
): ReadableStream<R>;
|
|
655
|
+
new <R = any>(
|
|
656
|
+
underlyingSource?: Bun.DirectUnderlyingSource<R>,
|
|
657
|
+
strategy?: QueuingStrategy<R>,
|
|
658
|
+
): ReadableStream<R>;
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
type _WritableStream = import("stream/web").WritableStream;
|
|
662
|
+
interface WritableStream<W = any> extends _WritableStream {}
|
|
663
|
+
var WritableStream: {
|
|
664
|
+
prototype: WritableStream;
|
|
665
|
+
new <W = any>(
|
|
666
|
+
underlyingSink?: Bun.UnderlyingSink<W>,
|
|
667
|
+
strategy?: QueuingStrategy<W>,
|
|
668
|
+
): WritableStream<W>;
|
|
669
|
+
};
|
|
759
670
|
|
|
671
|
+
type _Worker = import("worker_threads").Worker;
|
|
760
672
|
interface Worker extends _Worker {}
|
|
761
|
-
var Worker:
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
:
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
*
|
|
775
|
-
* This is Bun's equivalent of `workerData` in Node.js.
|
|
776
|
-
*/
|
|
777
|
-
data: any;
|
|
778
|
-
};
|
|
673
|
+
var Worker: {
|
|
674
|
+
prototype: Worker;
|
|
675
|
+
new (
|
|
676
|
+
scriptURL: string | URL,
|
|
677
|
+
options?: Bun.WorkerOptions | undefined,
|
|
678
|
+
): Worker;
|
|
679
|
+
/**
|
|
680
|
+
* This is the cloned value of the `data` property passed to `new Worker()`
|
|
681
|
+
*
|
|
682
|
+
* This is Bun's equivalent of `workerData` in Node.js.
|
|
683
|
+
*/
|
|
684
|
+
data: any;
|
|
685
|
+
};
|
|
779
686
|
|
|
780
|
-
|
|
781
|
-
var WebSocket: typeof globalThis extends {
|
|
782
|
-
onerror: any;
|
|
783
|
-
WebSocket: infer T;
|
|
784
|
-
}
|
|
785
|
-
? T
|
|
786
|
-
: typeof _WebSocket;
|
|
687
|
+
var WebSocket: typeof import("ws").WebSocket;
|
|
787
688
|
|
|
689
|
+
type _Crypto = import("crypto").webcrypto.Crypto;
|
|
788
690
|
interface Crypto extends _Crypto {}
|
|
789
|
-
var Crypto:
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
prototype: Crypto;
|
|
796
|
-
new (): Crypto;
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
var crypto: typeof globalThis extends {
|
|
800
|
-
onerror: any;
|
|
801
|
-
crypto: infer T;
|
|
802
|
-
}
|
|
803
|
-
? T
|
|
804
|
-
: Crypto;
|
|
691
|
+
var Crypto: {
|
|
692
|
+
prototype: Crypto;
|
|
693
|
+
new (): Crypto;
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
var crypto: Crypto;
|
|
805
697
|
|
|
806
698
|
/**
|
|
807
699
|
* An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All
|
|
@@ -812,49 +704,27 @@ declare global {
|
|
|
812
704
|
* const uint8array = encoder.encode('this is some data');
|
|
813
705
|
* ```
|
|
814
706
|
*/
|
|
815
|
-
interface TextEncoder extends
|
|
816
|
-
var TextEncoder: typeof
|
|
817
|
-
onerror: any;
|
|
818
|
-
TextEncoder: infer T;
|
|
819
|
-
}
|
|
820
|
-
? T
|
|
821
|
-
: typeof TextEncoder;
|
|
707
|
+
interface TextEncoder extends Bun.TextEncoder {}
|
|
708
|
+
var TextEncoder: typeof TextEncoder;
|
|
822
709
|
|
|
823
|
-
interface TextDecoder extends
|
|
824
|
-
var TextDecoder: typeof
|
|
825
|
-
onerror: any;
|
|
826
|
-
TextDecoder: infer T;
|
|
827
|
-
}
|
|
828
|
-
? T
|
|
829
|
-
: typeof TextDecoder;
|
|
710
|
+
interface TextDecoder extends Bun.TextDecoder {}
|
|
711
|
+
var TextDecoder: typeof TextDecoder;
|
|
830
712
|
|
|
713
|
+
type _Performance = import("perf_hooks").Performance;
|
|
831
714
|
interface Performance extends _Performance {}
|
|
832
|
-
var performance:
|
|
833
|
-
onerror: any;
|
|
834
|
-
performance: infer T;
|
|
835
|
-
}
|
|
836
|
-
? T
|
|
837
|
-
: Performance;
|
|
715
|
+
var performance: Performance;
|
|
838
716
|
|
|
839
717
|
interface Event extends _Event {}
|
|
840
|
-
var Event:
|
|
841
|
-
|
|
842
|
-
:
|
|
843
|
-
|
|
844
|
-
new (type: string, eventInitDict?: Bun.EventInit): Event;
|
|
845
|
-
};
|
|
846
|
-
interface EventTarget extends _EventTarget {}
|
|
847
|
-
var EventTarget: typeof globalThis extends {
|
|
848
|
-
onerror: any;
|
|
849
|
-
EventTarget: infer T;
|
|
850
|
-
}
|
|
851
|
-
? T
|
|
852
|
-
: {
|
|
853
|
-
prototype: EventTarget;
|
|
854
|
-
new (): EventTarget;
|
|
855
|
-
};
|
|
718
|
+
var Event: {
|
|
719
|
+
prototype: Event;
|
|
720
|
+
new (type: string, eventInitDict?: Bun.EventInit): Event;
|
|
721
|
+
};
|
|
856
722
|
|
|
857
|
-
interface
|
|
723
|
+
interface EventTarget extends _EventTarget {}
|
|
724
|
+
var EventTarget: {
|
|
725
|
+
prototype: EventTarget;
|
|
726
|
+
new (): EventTarget;
|
|
727
|
+
};
|
|
858
728
|
|
|
859
729
|
interface File extends Blob {
|
|
860
730
|
/**
|
|
@@ -872,11 +742,11 @@ declare global {
|
|
|
872
742
|
readonly lastModified: number;
|
|
873
743
|
readonly name: string;
|
|
874
744
|
}
|
|
875
|
-
var File: typeof globalThis extends { onerror: any; File: infer T }
|
|
876
|
-
? T
|
|
877
|
-
: typeof File;
|
|
878
745
|
|
|
879
|
-
|
|
746
|
+
var File: typeof File;
|
|
747
|
+
|
|
748
|
+
type _RequestInit = import("undici-types").RequestInit;
|
|
749
|
+
interface RequestInit extends _RequestInit {
|
|
880
750
|
/**
|
|
881
751
|
* Log the raw HTTP request & response to stdout. This API may be
|
|
882
752
|
* removed in a future version of Bun without notice.
|
|
@@ -890,18 +760,10 @@ declare global {
|
|
|
890
760
|
*/
|
|
891
761
|
proxy?: string;
|
|
892
762
|
|
|
893
|
-
/**
|
|
894
|
-
* Override the default TLS options
|
|
895
|
-
*/
|
|
896
|
-
tls?: {
|
|
897
|
-
rejectUnauthorized?: boolean | undefined; // Defaults to true
|
|
898
|
-
checkServerIdentity?: any; // TODO: change `any` to `checkServerIdentity`
|
|
899
|
-
};
|
|
900
|
-
|
|
901
763
|
/**
|
|
902
764
|
* Override the default S3 options
|
|
903
765
|
*/
|
|
904
|
-
s3?:
|
|
766
|
+
s3?: import("bun").S3Options;
|
|
905
767
|
}
|
|
906
768
|
|
|
907
769
|
/**
|
|
@@ -990,46 +852,6 @@ declare global {
|
|
|
990
852
|
new (): ShadowRealm;
|
|
991
853
|
};
|
|
992
854
|
|
|
993
|
-
interface Fetch {
|
|
994
|
-
/**
|
|
995
|
-
* Send a HTTP(s) request
|
|
996
|
-
*
|
|
997
|
-
* @param request Request object
|
|
998
|
-
* @param init A structured value that contains settings for the fetch() request.
|
|
999
|
-
*
|
|
1000
|
-
* @returns A promise that resolves to {@link Response} object.
|
|
1001
|
-
*/
|
|
1002
|
-
(request: Request, init?: RequestInit): Promise<Response>;
|
|
1003
|
-
|
|
1004
|
-
/**
|
|
1005
|
-
* Send a HTTP(s) request
|
|
1006
|
-
*
|
|
1007
|
-
* @param url URL string
|
|
1008
|
-
* @param init A structured value that contains settings for the fetch() request.
|
|
1009
|
-
*
|
|
1010
|
-
* @returns A promise that resolves to {@link Response} object.
|
|
1011
|
-
*/
|
|
1012
|
-
(url: string | URL | Request, init?: FetchRequestInit): Promise<Response>;
|
|
1013
|
-
|
|
1014
|
-
(
|
|
1015
|
-
input: string | URL | globalThis.Request,
|
|
1016
|
-
init?: RequestInit,
|
|
1017
|
-
): Promise<Response>;
|
|
1018
|
-
|
|
1019
|
-
/**
|
|
1020
|
-
* Start the DNS resolution, TCP connection, and TLS handshake for a request
|
|
1021
|
-
* before the request is actually sent.
|
|
1022
|
-
*
|
|
1023
|
-
* This can reduce the latency of a request when you know there's some
|
|
1024
|
-
* long-running task that will delay the request starting.
|
|
1025
|
-
*
|
|
1026
|
-
* This is a bun-specific API and is not part of the Fetch API specification.
|
|
1027
|
-
*/
|
|
1028
|
-
preconnect(url: string | URL): void;
|
|
1029
|
-
}
|
|
1030
|
-
|
|
1031
|
-
var fetch: Fetch;
|
|
1032
|
-
|
|
1033
855
|
function queueMicrotask(callback: (...args: any[]) => void): void;
|
|
1034
856
|
/**
|
|
1035
857
|
* Log an error using the default exception handler
|
|
@@ -1140,18 +962,13 @@ declare global {
|
|
|
1140
962
|
};
|
|
1141
963
|
|
|
1142
964
|
interface MessageEvent<T = any> extends Bun.MessageEvent<T> {}
|
|
1143
|
-
var MessageEvent:
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
:
|
|
1149
|
-
|
|
1150
|
-
new <T>(
|
|
1151
|
-
type: string,
|
|
1152
|
-
eventInitDict?: Bun.MessageEventInit<T>,
|
|
1153
|
-
): MessageEvent<T>;
|
|
1154
|
-
};
|
|
965
|
+
var MessageEvent: {
|
|
966
|
+
prototype: MessageEvent;
|
|
967
|
+
new <T>(
|
|
968
|
+
type: string,
|
|
969
|
+
eventInitDict?: Bun.MessageEventInit<T>,
|
|
970
|
+
): MessageEvent<T>;
|
|
971
|
+
};
|
|
1155
972
|
|
|
1156
973
|
interface CustomEvent<T = any> extends Event {
|
|
1157
974
|
/** Returns any custom data event was created with. Typically used for synthetic events. */
|
|
@@ -1166,25 +983,25 @@ declare global {
|
|
|
1166
983
|
): CustomEvent<T>;
|
|
1167
984
|
};
|
|
1168
985
|
|
|
1169
|
-
/**
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
interface URL {
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
}
|
|
986
|
+
// /**
|
|
987
|
+
// * The URL interface represents an object providing static methods used for
|
|
988
|
+
// * creating object URLs.
|
|
989
|
+
// */
|
|
990
|
+
// interface URL extends _URL {
|
|
991
|
+
// new (url: string | URL, base?: string | URL): URL;
|
|
992
|
+
// /** Not implemented yet */
|
|
993
|
+
// createObjectURL(obj: Blob): string;
|
|
994
|
+
// /** Not implemented yet */
|
|
995
|
+
// revokeObjectURL(url: string): void;
|
|
996
|
+
|
|
997
|
+
// /**
|
|
998
|
+
// * Check if `url` is a valid URL string
|
|
999
|
+
// *
|
|
1000
|
+
// * @param url URL string to parse
|
|
1001
|
+
// * @param base URL to resolve against
|
|
1002
|
+
// */
|
|
1003
|
+
// canParse(url: string, base?: string): boolean;
|
|
1004
|
+
// }
|
|
1188
1005
|
|
|
1189
1006
|
interface EventListener {
|
|
1190
1007
|
(evt: Event): void;
|
|
@@ -1555,30 +1372,22 @@ declare global {
|
|
|
1555
1372
|
readonly DATA_CLONE_ERR: 25;
|
|
1556
1373
|
}
|
|
1557
1374
|
|
|
1558
|
-
var DOMException:
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
}
|
|
1562
|
-
? T
|
|
1563
|
-
: {
|
|
1564
|
-
prototype: DOMException;
|
|
1565
|
-
new (message?: string, name?: string): DOMException;
|
|
1566
|
-
};
|
|
1375
|
+
var DOMException: {
|
|
1376
|
+
prototype: DOMException;
|
|
1377
|
+
new (message?: string, name?: string): DOMException;
|
|
1378
|
+
};
|
|
1567
1379
|
|
|
1568
1380
|
function alert(message?: string): void;
|
|
1569
1381
|
function confirm(message?: string): boolean;
|
|
1570
1382
|
function prompt(message?: string, _default?: string): string | null;
|
|
1571
1383
|
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
: {
|
|
1578
|
-
prototype: _SubtleCrypto;
|
|
1579
|
-
new (): _SubtleCrypto;
|
|
1580
|
-
};
|
|
1384
|
+
type _SubtleCrypto = import("crypto").webcrypto.SubtleCrypto;
|
|
1385
|
+
var SubtleCrypto: {
|
|
1386
|
+
prototype: _SubtleCrypto;
|
|
1387
|
+
new (): _SubtleCrypto;
|
|
1388
|
+
};
|
|
1581
1389
|
|
|
1390
|
+
type _CryptoKey = import("crypto").webcrypto.CryptoKey;
|
|
1582
1391
|
interface CryptoKey extends _CryptoKey {}
|
|
1583
1392
|
var CryptoKey: {
|
|
1584
1393
|
prototype: CryptoKey;
|
|
@@ -2061,64 +1870,6 @@ declare global {
|
|
|
2061
1870
|
*/
|
|
2062
1871
|
bytes(): Promise<Uint8Array>;
|
|
2063
1872
|
}
|
|
2064
|
-
var Blob: typeof globalThis extends {
|
|
2065
|
-
onerror: any;
|
|
2066
|
-
Blob: infer T;
|
|
2067
|
-
}
|
|
2068
|
-
? T
|
|
2069
|
-
: typeof Blob;
|
|
2070
|
-
|
|
2071
|
-
var Response: typeof globalThis extends {
|
|
2072
|
-
onerror: any;
|
|
2073
|
-
Response: infer T;
|
|
2074
|
-
}
|
|
2075
|
-
? T
|
|
2076
|
-
: typeof import("./fetch").Response;
|
|
2077
1873
|
|
|
2078
|
-
var
|
|
2079
|
-
onerror: any;
|
|
2080
|
-
Request: infer T;
|
|
2081
|
-
}
|
|
2082
|
-
? T
|
|
2083
|
-
: {
|
|
2084
|
-
prototype: Request;
|
|
2085
|
-
new (requestInfo: string, requestInit?: RequestInit): Request;
|
|
2086
|
-
new (requestInfo: RequestInit & { url: string }): Request;
|
|
2087
|
-
new (requestInfo: Request, requestInit?: RequestInit): Request;
|
|
2088
|
-
};
|
|
2089
|
-
|
|
2090
|
-
interface Headers {
|
|
2091
|
-
/**
|
|
2092
|
-
* Convert {@link Headers} to a plain JavaScript object.
|
|
2093
|
-
*
|
|
2094
|
-
* About 10x faster than `Object.fromEntries(headers.entries())`
|
|
2095
|
-
*
|
|
2096
|
-
* Called when you run `JSON.stringify(headers)`
|
|
2097
|
-
*
|
|
2098
|
-
* Does not preserve insertion order. Well-known header names are lowercased. Other header names are left as-is.
|
|
2099
|
-
*/
|
|
2100
|
-
toJSON(): Record<string, string>;
|
|
2101
|
-
/**
|
|
2102
|
-
* Get the total number of headers
|
|
2103
|
-
*/
|
|
2104
|
-
readonly count: number;
|
|
2105
|
-
/**
|
|
2106
|
-
* Get all headers matching the name
|
|
2107
|
-
*
|
|
2108
|
-
* Only supports `"Set-Cookie"`. All other headers are empty arrays.
|
|
2109
|
-
*
|
|
2110
|
-
* @param name - The header name to get
|
|
2111
|
-
*
|
|
2112
|
-
* @returns An array of header values
|
|
2113
|
-
*
|
|
2114
|
-
* @example
|
|
2115
|
-
* ```ts
|
|
2116
|
-
* const headers = new Headers();
|
|
2117
|
-
* headers.append("Set-Cookie", "foo=bar");
|
|
2118
|
-
* headers.append("Set-Cookie", "baz=qux");
|
|
2119
|
-
* headers.getAll("Set-Cookie"); // ["foo=bar", "baz=qux"]
|
|
2120
|
-
* ```
|
|
2121
|
-
*/
|
|
2122
|
-
getAll(name: "set-cookie" | "Set-Cookie"): string[];
|
|
2123
|
-
}
|
|
1874
|
+
var Blob: typeof Blob;
|
|
2124
1875
|
}
|