bun-types 0.0.83 → 0.1.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types.d.ts +559 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-types",
3
- "version": "0.0.83",
3
+ "version": "0.1.2",
4
4
  "description": "Type definitions for bun.js",
5
5
  "types": "types.d.ts",
6
6
  "files": [
package/types.d.ts CHANGED
@@ -192,6 +192,178 @@ declare module "bun" {
192
192
  syscall?: string | undefined;
193
193
  }
194
194
 
195
+ /**
196
+ * Concatenate an array of typed arrays into a single `ArrayBuffer`. This is a fast path.
197
+ *
198
+ * You can do this manually if you'd like, but this function will generally
199
+ * be a little faster.
200
+ *
201
+ * If you want a `Uint8Array` instead, consider `Buffer.concat`.
202
+ *
203
+ * @param buffers An array of typed arrays to concatenate.
204
+ * @returns An `ArrayBuffer` with the data from all the buffers.
205
+ *
206
+ * Here is similar code to do it manually, except about 30% slower:
207
+ * ```js
208
+ * var chunks = [...];
209
+ * var size = 0;
210
+ * for (const chunk of chunks) {
211
+ * size += chunk.byteLength;
212
+ * }
213
+ * var buffer = new ArrayBuffer(size);
214
+ * var view = new Uint8Array(buffer);
215
+ * var offset = 0;
216
+ * for (const chunk of chunks) {
217
+ * view.set(chunk, offset);
218
+ * offset += chunk.byteLength;
219
+ * }
220
+ * return buffer;
221
+ * ```
222
+ *
223
+ * This function is faster because it uses uninitialized memory when copying. Since the entire
224
+ * length of the buffer is known, it is safe to use uninitialized memory.
225
+ */
226
+ export function concatArrayBuffers(
227
+ buffers: Array<ArrayBufferView | ArrayBufferLike>
228
+ ): ArrayBuffer;
229
+
230
+ /**
231
+ * Consume all data from a {@link ReadableStream} until it closes or errors.
232
+ *
233
+ * Concatenate the chunks into a single {@link ArrayBuffer}.
234
+ *
235
+ * Each chunk must be a TypedArray or an ArrayBuffer. If you need to support
236
+ * chunks of different types, consider {@link readableStreamToBlob}
237
+ *
238
+ * @param stream The stream to consume.
239
+ * @returns A promise that resolves with the concatenated chunks or the concatenated chunks as an `ArrayBuffer`.
240
+ */
241
+ export function readableStreamToArrayBuffer(
242
+ stream: ReadableStream
243
+ ): Promise<ArrayBuffer> | ArrayBuffer;
244
+
245
+ /**
246
+ * Consume all data from a {@link ReadableStream} until it closes or errors.
247
+ *
248
+ * Concatenate the chunks into a single {@link Blob}.
249
+ *
250
+ * @param stream The stream to consume.
251
+ * @returns A promise that resolves with the concatenated chunks as a {@link Blob}.
252
+ */
253
+ export function readableStreamToBlob(stream: ReadableStream): Promise<Blob>;
254
+
255
+ /**
256
+ * Consume all data from a {@link ReadableStream} until it closes or errors.
257
+ *
258
+ * Concatenate the chunks into a single string. Chunks must be a TypedArray or an ArrayBuffer. If you need to support chunks of different types, consider {@link readableStreamToBlob}.
259
+ *
260
+ * @param stream The stream to consume.
261
+ * @returns A promise that resolves with the concatenated chunks as a {@link String}.
262
+ */
263
+ export function readableStreamToText(stream: ReadableStream): Promise<string>;
264
+
265
+ /**
266
+ * Consume all data from a {@link ReadableStream} until it closes or errors.
267
+ *
268
+ * Concatenate the chunks into a single string and parse as JSON. Chunks must be a TypedArray or an ArrayBuffer. If you need to support chunks of different types, consider {@link readableStreamToBlob}.
269
+ *
270
+ * @param stream The stream to consume.
271
+ * @returns A promise that resolves with the concatenated chunks as a {@link String}.
272
+ */
273
+ export function readableStreamToJSON(stream: ReadableStream): Promise<any>;
274
+
275
+ /**
276
+ * Consume all data from a {@link ReadableStream} until it closes or errors.
277
+ *
278
+ * @param stream The stream to consume
279
+ * @returns A promise that resolves with the chunks as an array
280
+ *
281
+ */
282
+ export function readableStreamToArray<T>(
283
+ stream: ReadableStream
284
+ ): Promise<T[]> | T[];
285
+
286
+ /**
287
+ * Escape the following characters in a string:
288
+ *
289
+ * - `"` becomes `"&quot;"`
290
+ * - `&` becomes `"&amp;"`
291
+ * - `'` becomes `"&#x27;"`
292
+ * - `<` becomes `"&lt;"`
293
+ * - `>` becomes `"&gt;"`
294
+ *
295
+ * This function is optimized for large input. On an M1X, it processes 480 MB/s -
296
+ * 20 GB/s, depending on how much data is being escaped and whether there is non-ascii
297
+ * text.
298
+ *
299
+ * Non-string types will be converted to a string before escaping.
300
+ */
301
+ export function escapeHTML(input: string | object | number | boolean): string;
302
+
303
+ /**
304
+ * Convert a filesystem path to a file:// URL.
305
+ *
306
+ * @param path The path to convert.
307
+ * @returns A {@link URL} with the file:// scheme.
308
+ *
309
+ * @example
310
+ * ```js
311
+ * const url = Bun.pathToFileURL("/foo/bar.txt");
312
+ * console.log(url.href); // "file:///foo/bar.txt"
313
+ *```
314
+ *
315
+ * Internally, this function uses WebKit's URL API to
316
+ * convert the path to a file:// URL.
317
+ */
318
+ export function pathToFileURL(path: string): URL;
319
+
320
+ /**
321
+ * Convert a {@link URL} to a filesystem path.
322
+ * @param url The URL to convert.
323
+ * @returns A filesystem path.
324
+ * @throws If the URL is not a URL.
325
+ * @example
326
+ * ```js
327
+ * const path = Bun.fileURLToPath(new URL("file:///foo/bar.txt"));
328
+ * console.log(path); // "/foo/bar.txt"
329
+ * ```
330
+ */
331
+ export function fileURLToPath(url: URL): string;
332
+
333
+ /**
334
+ * Fast incremental writer that becomes an `ArrayBuffer` on end().
335
+ */
336
+ export class ArrayBufferSink {
337
+ constructor();
338
+
339
+ start(options?: {
340
+ asUint8Array?: boolean;
341
+ /**
342
+ * Preallocate an internal buffer of this size
343
+ * This can significantly improve performance when the chunk size is small
344
+ */
345
+ highWaterMark?: number;
346
+ /**
347
+ * On {@link ArrayBufferSink.flush}, return the written data as a `Uint8Array`.
348
+ * Writes will restart from the beginning of the buffer.
349
+ */
350
+ stream?: boolean;
351
+ }): void;
352
+
353
+ write(chunk: string | ArrayBufferView | ArrayBuffer): number;
354
+ /**
355
+ * Flush the internal buffer
356
+ *
357
+ * If {@link ArrayBufferSink.start} was passed a `stream` option, this will return a `ArrayBuffer`
358
+ * If {@link ArrayBufferSink.start} was passed a `stream` option and `asUint8Array`, this will return a `Uint8Array`
359
+ * Otherwise, this will return the number of bytes written since the last flush
360
+ *
361
+ * This API might change later to separate Uint8ArraySink and ArrayBufferSink
362
+ */
363
+ flush(): number | Uint8Array | ArrayBuffer;
364
+ end(): ArrayBuffer | Uint8Array;
365
+ }
366
+
195
367
  /**
196
368
  * [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) powered by the fastest system calls available for operating on files.
197
369
  *
@@ -366,6 +538,16 @@ declare module "bun" {
366
538
  * ```
367
539
  */
368
540
  macros?: MacroMap;
541
+
542
+ autoImportJSX?: boolean;
543
+ allowBunRuntime?: boolean;
544
+ exports?: {
545
+ eliminate?: string[];
546
+ replace?: Record<string, string>;
547
+ };
548
+ treeShaking?: boolean;
549
+ trimUnusedImports?: boolean;
550
+ jsxOptimizationInline?: boolean;
369
551
  }
370
552
 
371
553
  /**
@@ -843,9 +1025,9 @@ declare module "bun" {
843
1025
  * This uses a high-resolution monotonic system timer.
844
1026
  *
845
1027
  * After 14 weeks of consecutive uptime, this function
846
- * returns a `bigint` to prevent overflow
1028
+ * wraps
847
1029
  */
848
- export function nanoseconds(): number | bigint;
1030
+ export function nanoseconds(): number;
849
1031
 
850
1032
  /**
851
1033
  * Generate a heap snapshot for seeing where the heap is being used
@@ -1860,7 +2042,7 @@ declare module "bun:sqlite" {
1860
2042
  /**
1861
2043
  * Open or create a SQLite3 database
1862
2044
  *
1863
- * @param filename The filename of the database to open. Pass an empty string (`""`) or `":memory:"` for an in-memory database.
2045
+ * @param filename The filename of the database to open. Pass an empty string (`""` or undefined) or `":memory:"` for an in-memory database.
1864
2046
  * @param options defaults to `{readwrite: true, create: true}`. If a number, then it's treated as `SQLITE_OPEN_*` constant flags.
1865
2047
  *
1866
2048
  * @example
@@ -1892,7 +2074,7 @@ declare module "bun:sqlite" {
1892
2074
  * ```
1893
2075
  */
1894
2076
  constructor(
1895
- filename: string,
2077
+ filename?: string,
1896
2078
  options?:
1897
2079
  | number
1898
2080
  | {
@@ -1999,14 +2181,14 @@ declare module "bun:sqlite" {
1999
2181
  */
2000
2182
  run<ParamsType = SQLQueryBindings>(
2001
2183
  sqlQuery: string,
2002
- ...bindings: ParamsType
2184
+ ...bindings: ParamsType[]
2003
2185
  ): void;
2004
2186
  /**
2005
2187
  This is an alias of {@link Database.prototype.run}
2006
2188
  */
2007
2189
  exec<ParamsType = SQLQueryBindings>(
2008
2190
  sqlQuery: string,
2009
- ...bindings: ParamsType
2191
+ ...bindings: ParamsType[]
2010
2192
  ): void;
2011
2193
 
2012
2194
  /**
@@ -2189,8 +2371,6 @@ declare module "bun:sqlite" {
2189
2371
  };
2190
2372
  }
2191
2373
 
2192
- export { default as Database };
2193
-
2194
2374
  /**
2195
2375
  * A prepared statement.
2196
2376
  *
@@ -2576,6 +2756,8 @@ declare module "bun:sqlite" {
2576
2756
  | boolean
2577
2757
  | null
2578
2758
  | Record<string, string | bigint | TypedArray | number | boolean | null>;
2759
+
2760
+ export default Database;
2579
2761
  }
2580
2762
 
2581
2763
 
@@ -6752,8 +6934,13 @@ type ReferrerPolicy =
6752
6934
  | "unsafe-url";
6753
6935
  type RequestInfo = Request | string;
6754
6936
 
6755
- type BodyInit = XMLHttpRequestBodyInit;
6937
+ type BodyInit = ReadableStream | XMLHttpRequestBodyInit;
6756
6938
  type XMLHttpRequestBodyInit = Blob | BufferSource | string;
6939
+ type ReadableStreamController<T> = ReadableStreamDefaultController<T>;
6940
+ type ReadableStreamDefaultReadResult<T> =
6941
+ | ReadableStreamDefaultReadValueResult<T>
6942
+ | ReadableStreamDefaultReadDoneResult;
6943
+ type ReadableStreamReader<T> = ReadableStreamDefaultReader<T>;
6757
6944
 
6758
6945
  interface RequestInit {
6759
6946
  /**
@@ -7726,6 +7913,304 @@ declare var Loader: {
7726
7913
  resolveSync: (specifier: string, from: string) => string;
7727
7914
  };
7728
7915
 
7916
+ /** This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
7917
+ interface ReadableStream<R = any> {
7918
+ readonly locked: boolean;
7919
+ cancel(reason?: any): Promise<void>;
7920
+ getReader(): ReadableStreamDefaultReader<R>;
7921
+ pipeThrough<T>(
7922
+ transform: ReadableWritablePair<T, R>,
7923
+ options?: StreamPipeOptions
7924
+ ): ReadableStream<T>;
7925
+ pipeTo(
7926
+ destination: WritableStream<R>,
7927
+ options?: StreamPipeOptions
7928
+ ): Promise<void>;
7929
+ tee(): [ReadableStream<R>, ReadableStream<R>];
7930
+ forEach(
7931
+ callbackfn: (value: any, key: number, parent: ReadableStream<R>) => void,
7932
+ thisArg?: any
7933
+ ): void;
7934
+ }
7935
+
7936
+ declare var ReadableStream: {
7937
+ prototype: ReadableStream;
7938
+ new <R = any>(
7939
+ underlyingSource?: DirectUnderlyingSource<R> | UnderlyingSource<R>,
7940
+ strategy?: QueuingStrategy<R>
7941
+ ): ReadableStream<R>;
7942
+ };
7943
+
7944
+ interface QueuingStrategy<T = any> {
7945
+ highWaterMark?: number;
7946
+ size?: QueuingStrategySize<T>;
7947
+ }
7948
+
7949
+ interface QueuingStrategyInit {
7950
+ /**
7951
+ * Creates a new ByteLengthQueuingStrategy with the provided high water mark.
7952
+ *
7953
+ * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw.
7954
+ */
7955
+ highWaterMark: number;
7956
+ }
7957
+
7958
+ /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
7959
+ interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
7960
+ readonly highWaterMark: number;
7961
+ readonly size: QueuingStrategySize<ArrayBufferView>;
7962
+ }
7963
+
7964
+ declare var ByteLengthQueuingStrategy: {
7965
+ prototype: ByteLengthQueuingStrategy;
7966
+ new (init: QueuingStrategyInit): ByteLengthQueuingStrategy;
7967
+ };
7968
+
7969
+ interface ReadableStreamDefaultController<R = any> {
7970
+ readonly desiredSize: number | null;
7971
+ close(): void;
7972
+ enqueue(chunk?: R): void;
7973
+ error(e?: any): void;
7974
+ }
7975
+
7976
+ interface ReadableStreamDirectController {
7977
+ close(error?: Error): void;
7978
+ write(data: ArrayBufferView | ArrayBuffer | string): number | Promise<number>;
7979
+ end(): number | Promise<number>;
7980
+ flush(): number | Promise<number>;
7981
+ start(): void;
7982
+ }
7983
+
7984
+ declare var ReadableStreamDefaultController: {
7985
+ prototype: ReadableStreamDefaultController;
7986
+ new (): ReadableStreamDefaultController;
7987
+ };
7988
+
7989
+ interface ReadableStreamDefaultReader<R = any>
7990
+ extends ReadableStreamGenericReader {
7991
+ read(): Promise<ReadableStreamDefaultReadResult<R>>;
7992
+ releaseLock(): void;
7993
+ }
7994
+
7995
+ declare var ReadableStreamDefaultReader: {
7996
+ prototype: ReadableStreamDefaultReader;
7997
+ new <R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
7998
+ };
7999
+
8000
+ interface ReadableStreamGenericReader {
8001
+ readonly closed: Promise<undefined>;
8002
+ cancel(reason?: any): Promise<void>;
8003
+ }
8004
+
8005
+ interface ReadableStreamDefaultReadDoneResult {
8006
+ done: true;
8007
+ value?: undefined;
8008
+ }
8009
+
8010
+ interface ReadableStreamDefaultReadValueResult<T> {
8011
+ done: false;
8012
+ value: T;
8013
+ }
8014
+
8015
+ interface ReadableWritablePair<R = any, W = any> {
8016
+ readable: ReadableStream<R>;
8017
+ /**
8018
+ * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use.
8019
+ *
8020
+ * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
8021
+ */
8022
+ writable: WritableStream<W>;
8023
+ }
8024
+
8025
+ /** This Streams API interface provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. */
8026
+ interface WritableStream<W = any> {
8027
+ readonly locked: boolean;
8028
+ abort(reason?: any): Promise<void>;
8029
+ close(): Promise<void>;
8030
+ getWriter(): WritableStreamDefaultWriter<W>;
8031
+ }
8032
+
8033
+ declare var WritableStream: {
8034
+ prototype: WritableStream;
8035
+ new <W = any>(
8036
+ underlyingSink?: UnderlyingSink<W>,
8037
+ strategy?: QueuingStrategy<W>
8038
+ ): WritableStream<W>;
8039
+ };
8040
+
8041
+ /** This Streams API interface represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
8042
+ interface WritableStreamDefaultController {
8043
+ error(e?: any): void;
8044
+ }
8045
+
8046
+ declare var WritableStreamDefaultController: {
8047
+ prototype: WritableStreamDefaultController;
8048
+ new (): WritableStreamDefaultController;
8049
+ };
8050
+
8051
+ /** This Streams API interface is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */
8052
+ interface WritableStreamDefaultWriter<W = any> {
8053
+ readonly closed: Promise<undefined>;
8054
+ readonly desiredSize: number | null;
8055
+ readonly ready: Promise<undefined>;
8056
+ abort(reason?: any): Promise<void>;
8057
+ close(): Promise<void>;
8058
+ releaseLock(): void;
8059
+ write(chunk?: W): Promise<void>;
8060
+ }
8061
+
8062
+ declare var WritableStreamDefaultWriter: {
8063
+ prototype: WritableStreamDefaultWriter;
8064
+ new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W>;
8065
+ };
8066
+
8067
+ interface TransformerFlushCallback<O> {
8068
+ (controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
8069
+ }
8070
+
8071
+ interface TransformerStartCallback<O> {
8072
+ (controller: TransformStreamDefaultController<O>): any;
8073
+ }
8074
+
8075
+ interface TransformerTransformCallback<I, O> {
8076
+ (
8077
+ chunk: I,
8078
+ controller: TransformStreamDefaultController<O>
8079
+ ): void | PromiseLike<void>;
8080
+ }
8081
+
8082
+ interface UnderlyingSinkAbortCallback {
8083
+ (reason?: any): void | PromiseLike<void>;
8084
+ }
8085
+
8086
+ interface UnderlyingSinkCloseCallback {
8087
+ (): void | PromiseLike<void>;
8088
+ }
8089
+
8090
+ interface UnderlyingSinkStartCallback {
8091
+ (controller: WritableStreamDefaultController): any;
8092
+ }
8093
+
8094
+ interface UnderlyingSinkWriteCallback<W> {
8095
+ (
8096
+ chunk: W,
8097
+ controller: WritableStreamDefaultController
8098
+ ): void | PromiseLike<void>;
8099
+ }
8100
+
8101
+ interface UnderlyingSourceCancelCallback {
8102
+ (reason?: any): void | PromiseLike<void>;
8103
+ }
8104
+
8105
+ interface UnderlyingSink<W = any> {
8106
+ abort?: UnderlyingSinkAbortCallback;
8107
+ close?: UnderlyingSinkCloseCallback;
8108
+ start?: UnderlyingSinkStartCallback;
8109
+ type?: undefined | "default" | "bytes";
8110
+ write?: UnderlyingSinkWriteCallback<W>;
8111
+ }
8112
+
8113
+ interface UnderlyingSource<R = any> {
8114
+ cancel?: UnderlyingSourceCancelCallback;
8115
+ pull?: UnderlyingSourcePullCallback<R>;
8116
+ start?: UnderlyingSourceStartCallback<R>;
8117
+ type?: undefined;
8118
+ }
8119
+
8120
+ interface DirectUnderlyingSource<R = any> {
8121
+ cancel?: UnderlyingSourceCancelCallback;
8122
+ pull: (
8123
+ controller: ReadableStreamDirectController
8124
+ ) => void | PromiseLike<void>;
8125
+ type: "direct";
8126
+ }
8127
+
8128
+ interface UnderlyingSourcePullCallback<R> {
8129
+ (controller: ReadableStreamController<R>): void | PromiseLike<void>;
8130
+ }
8131
+
8132
+ interface UnderlyingSourceStartCallback<R> {
8133
+ (controller: ReadableStreamController<R>): any;
8134
+ }
8135
+
8136
+ interface GenericTransformStream {
8137
+ readonly readable: ReadableStream;
8138
+ readonly writable: WritableStream;
8139
+ }
8140
+
8141
+ interface TransformStream<I = any, O = any> {
8142
+ readonly readable: ReadableStream<O>;
8143
+ readonly writable: WritableStream<I>;
8144
+ }
8145
+
8146
+ declare var TransformStream: {
8147
+ prototype: TransformStream;
8148
+ new <I = any, O = any>(
8149
+ transformer?: Transformer<I, O>,
8150
+ writableStrategy?: QueuingStrategy<I>,
8151
+ readableStrategy?: QueuingStrategy<O>
8152
+ ): TransformStream<I, O>;
8153
+ };
8154
+
8155
+ interface TransformStreamDefaultController<O = any> {
8156
+ readonly desiredSize: number | null;
8157
+ enqueue(chunk?: O): void;
8158
+ error(reason?: any): void;
8159
+ terminate(): void;
8160
+ }
8161
+
8162
+ declare var TransformStreamDefaultController: {
8163
+ prototype: TransformStreamDefaultController;
8164
+ new (): TransformStreamDefaultController;
8165
+ };
8166
+
8167
+ interface StreamPipeOptions {
8168
+ preventAbort?: boolean;
8169
+ preventCancel?: boolean;
8170
+ /**
8171
+ * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered.
8172
+ *
8173
+ * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader.
8174
+ *
8175
+ * Errors and closures of the source and destination streams propagate as follows:
8176
+ *
8177
+ * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination.
8178
+ *
8179
+ * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source.
8180
+ *
8181
+ * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error.
8182
+ *
8183
+ * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source.
8184
+ *
8185
+ * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set.
8186
+ */
8187
+ preventClose?: boolean;
8188
+ signal?: AbortSignal;
8189
+ }
8190
+
8191
+ /** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */
8192
+ interface CountQueuingStrategy extends QueuingStrategy {
8193
+ readonly highWaterMark: number;
8194
+ readonly size: QueuingStrategySize;
8195
+ }
8196
+
8197
+ declare var CountQueuingStrategy: {
8198
+ prototype: CountQueuingStrategy;
8199
+ new (init: QueuingStrategyInit): CountQueuingStrategy;
8200
+ };
8201
+
8202
+ interface QueuingStrategySize<T = any> {
8203
+ (chunk?: T): number;
8204
+ }
8205
+
8206
+ interface Transformer<I = any, O = any> {
8207
+ flush?: TransformerFlushCallback<O>;
8208
+ readableType?: undefined;
8209
+ start?: TransformerStartCallback<O>;
8210
+ transform?: TransformerTransformCallback<I, O>;
8211
+ writableType?: undefined;
8212
+ }
8213
+
7729
8214
 
7730
8215
  // ./path.d.ts
7731
8216
 
@@ -7957,7 +8442,7 @@ declare module "node:path/win32" {
7957
8442
  */
7958
8443
 
7959
8444
  declare module "bun:test" {
7960
- export function describe(label: string, body: () => {}): any;
8445
+ export function describe(label: string, body: () => void): any;
7961
8446
  export function it(label: string, test: () => void | Promise<any>): any;
7962
8447
  export function test(label: string, test: () => void | Promise<any>): any;
7963
8448
 
@@ -7974,3 +8459,67 @@ declare module "test" {
7974
8459
  export = BunTestModule;
7975
8460
  }
7976
8461
 
8462
+
8463
+ // ./jsc.d.ts
8464
+
8465
+ declare module "bun:jsc" {
8466
+ export function describe(value: any): string;
8467
+ export function describeArray(args: any[]): string;
8468
+ export function gcAndSweep(): void;
8469
+ export function fullGC(): void;
8470
+ export function edenGC(): void;
8471
+ export function heapSize(): number;
8472
+ export function heapStats(): {
8473
+ heapSize: number;
8474
+ heapCapacity: number;
8475
+ extraMemorySize: number;
8476
+ objectCount: number;
8477
+ protectedObjectCount: number;
8478
+ globalObjectCount: number;
8479
+ protectedGlobalObjectCount: number;
8480
+ objectTypeCounts: Record<string, number>;
8481
+ protectedObjectTypeCounts: Record<string, number>;
8482
+ };
8483
+ export function memoryUsage(): {
8484
+ current: number;
8485
+ peak: number;
8486
+ currentCommit: number;
8487
+ peakCommit: number;
8488
+ pageFaults: number;
8489
+ };
8490
+ export function getRandomSeed(): number;
8491
+ export function setRandomSeed(value: number): void;
8492
+ export function isRope(input: string): boolean;
8493
+ export function callerSourceOrigin(): string;
8494
+ export function noFTL(func: Function): Function;
8495
+ export function noOSRExitFuzzing(func: Function): Function;
8496
+ export function optimizeNextInvocation(func: Function): Function;
8497
+ export function numberOfDFGCompiles(func: Function): number;
8498
+ export function releaseWeakRefs(): void;
8499
+ export function totalCompileTime(func: Function): number;
8500
+ export function reoptimizationRetryCount(func: Function): number;
8501
+ export function drainMicrotasks(): void;
8502
+
8503
+ /**
8504
+ * This returns objects which native code has explicitly protected from being
8505
+ * garbage collected
8506
+ *
8507
+ * By calling this function you create another reference to the object, which
8508
+ * will further prevent it from being garbage collected
8509
+ *
8510
+ * This function is mostly a debugging tool for bun itself.
8511
+ *
8512
+ * Warning: not all objects returned are supposed to be observable from JavaScript
8513
+ */
8514
+ export function getProtectedObjects(): any[];
8515
+
8516
+ /**
8517
+ * Start a remote debugging socket server on the given port.
8518
+ *
8519
+ * This exposes JavaScriptCore's built-in debugging server.
8520
+ *
8521
+ * This is untested. May not be supported yet on macOS
8522
+ */
8523
+ export function startRemoteDebugger(host?: string, port?: number): void;
8524
+ }
8525
+