@types/node 22.19.20 → 22.20.0
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.
- {node v22.19 → node v22.20}/README.md +1 -1
- {node v22.19 → node v22.20}/diagnostics_channel.d.ts +0 -2
- {node v22.19 → node v22.20}/fs.d.ts +3 -1
- {node v22.19 → node v22.20}/http.d.ts +9 -1
- {node v22.19 → node v22.20}/http2.d.ts +146 -27
- {node v22.19 → node v22.20}/index.d.ts +1 -0
- {node v22.19 → node v22.20}/package.json +3 -3
- {node v22.19 → node v22.20}/sea.d.ts +9 -0
- {node v22.19 → node v22.20}/sqlite.d.ts +5 -4
- {node v22.19 → node v22.20}/stream/web.d.ts +5 -54
- {node v22.19 → node v22.20}/stream.d.ts +8 -1
- {node v22.19 → node v22.20}/test.d.ts +106 -4
- {node v22.19 → node v22.20}/tls.d.ts +1 -1
- {node v22.19 → node v22.20}/ts5.6/index.d.ts +1 -0
- {node v22.19 → node v22.20}/vm.d.ts +61 -8
- node v22.20/web-globals/streams.d.ts +22 -0
- {node v22.19 → node v22.20}/worker_threads.d.ts +35 -0
- {node v22.19 → node v22.20}/LICENSE +0 -0
- {node v22.19 → node v22.20}/assert/strict.d.ts +0 -0
- {node v22.19 → node v22.20}/assert.d.ts +0 -0
- {node v22.19 → node v22.20}/async_hooks.d.ts +0 -0
- {node v22.19 → node v22.20}/buffer.buffer.d.ts +0 -0
- {node v22.19 → node v22.20}/buffer.d.ts +0 -0
- {node v22.19 → node v22.20}/child_process.d.ts +0 -0
- {node v22.19 → node v22.20}/cluster.d.ts +0 -0
- {node v22.19 → node v22.20}/compatibility/disposable.d.ts +0 -0
- {node v22.19 → node v22.20}/compatibility/index.d.ts +0 -0
- {node v22.19 → node v22.20}/compatibility/indexable.d.ts +0 -0
- {node v22.19 → node v22.20}/compatibility/iterators.d.ts +0 -0
- {node v22.19 → node v22.20}/console.d.ts +0 -0
- {node v22.19 → node v22.20}/constants.d.ts +0 -0
- {node v22.19 → node v22.20}/crypto.d.ts +0 -0
- {node v22.19 → node v22.20}/dgram.d.ts +0 -0
- {node v22.19 → node v22.20}/dns/promises.d.ts +0 -0
- {node v22.19 → node v22.20}/dns.d.ts +0 -0
- {node v22.19 → node v22.20}/domain.d.ts +0 -0
- {node v22.19 → node v22.20}/events.d.ts +0 -0
- {node v22.19 → node v22.20}/fs/promises.d.ts +0 -0
- {node v22.19 → node v22.20}/globals.d.ts +0 -0
- {node v22.19 → node v22.20}/globals.typedarray.d.ts +0 -0
- {node v22.19 → node v22.20}/https.d.ts +0 -0
- {node v22.19 → node v22.20}/inspector.d.ts +0 -0
- {node v22.19 → node v22.20}/inspector.generated.d.ts +0 -0
- {node v22.19 → node v22.20}/module.d.ts +0 -0
- {node v22.19 → node v22.20}/net.d.ts +0 -0
- {node v22.19 → node v22.20}/os.d.ts +0 -0
- {node v22.19 → node v22.20}/path.d.ts +0 -0
- {node v22.19 → node v22.20}/perf_hooks.d.ts +0 -0
- {node v22.19 → node v22.20}/process.d.ts +0 -0
- {node v22.19 → node v22.20}/punycode.d.ts +0 -0
- {node v22.19 → node v22.20}/querystring.d.ts +0 -0
- {node v22.19 → node v22.20}/readline/promises.d.ts +0 -0
- {node v22.19 → node v22.20}/readline.d.ts +0 -0
- {node v22.19 → node v22.20}/repl.d.ts +0 -0
- {node v22.19 → node v22.20}/stream/consumers.d.ts +0 -0
- {node v22.19 → node v22.20}/stream/promises.d.ts +0 -0
- {node v22.19 → node v22.20}/string_decoder.d.ts +0 -0
- {node v22.19 → node v22.20}/timers/promises.d.ts +0 -0
- {node v22.19 → node v22.20}/timers.d.ts +0 -0
- {node v22.19 → node v22.20}/trace_events.d.ts +0 -0
- {node v22.19 → node v22.20}/ts5.6/buffer.buffer.d.ts +0 -0
- {node v22.19 → node v22.20}/ts5.6/globals.typedarray.d.ts +0 -0
- {node v22.19 → node v22.20}/tty.d.ts +0 -0
- {node v22.19 → node v22.20}/url.d.ts +0 -0
- {node v22.19 → node v22.20}/util.d.ts +0 -0
- {node v22.19 → node v22.20}/v8.d.ts +0 -0
- {node v22.19 → node v22.20}/wasi.d.ts +0 -0
- {node v22.19 → node v22.20}/web-globals/abortcontroller.d.ts +0 -0
- {node v22.19 → node v22.20}/web-globals/domexception.d.ts +0 -0
- {node v22.19 → node v22.20}/web-globals/events.d.ts +0 -0
- {node v22.19 → node v22.20}/web-globals/fetch.d.ts +0 -0
- {node v22.19 → node v22.20}/web-globals/navigator.d.ts +0 -0
- {node v22.19 → node v22.20}/web-globals/storage.d.ts +0 -0
- {node v22.19 → node v22.20}/zlib.d.ts +0 -0
|
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v22.
|
|
9
9
|
|
|
10
10
|
### Additional Details
|
|
11
|
-
* Last updated:
|
|
11
|
+
* Last updated: Sat, 20 Jun 2026 10:46:51 GMT
|
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
|
13
13
|
|
|
14
14
|
# Credits
|
|
@@ -189,7 +189,6 @@ declare module "diagnostics_channel" {
|
|
|
189
189
|
* });
|
|
190
190
|
* ```
|
|
191
191
|
* @since v15.1.0, v14.17.0
|
|
192
|
-
* @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)}
|
|
193
192
|
* @param onMessage The handler to receive channel messages
|
|
194
193
|
*/
|
|
195
194
|
subscribe(onMessage: ChannelListener): void;
|
|
@@ -210,7 +209,6 @@ declare module "diagnostics_channel" {
|
|
|
210
209
|
* channel.unsubscribe(onMessage);
|
|
211
210
|
* ```
|
|
212
211
|
* @since v15.1.0, v14.17.0
|
|
213
|
-
* @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)}
|
|
214
212
|
* @param onMessage The previous subscribed handler to remove
|
|
215
213
|
* @return `true` if the handler was found, `false` otherwise.
|
|
216
214
|
*/
|
|
@@ -4379,7 +4379,9 @@ declare module "fs" {
|
|
|
4379
4379
|
/**
|
|
4380
4380
|
* Function to filter out files/directories or a
|
|
4381
4381
|
* list of glob patterns to be excluded. If a function is provided, return
|
|
4382
|
-
* `true` to exclude the item, `false` to include it.
|
|
4382
|
+
* `true` to exclude the item, `false` to include it. If a string array is
|
|
4383
|
+
* provided, each string should be a glob pattern that specifies paths to exclude.
|
|
4384
|
+
* Note: Negation patterns (e.g., '!foo.js') are not supported.
|
|
4383
4385
|
* @default undefined
|
|
4384
4386
|
*/
|
|
4385
4387
|
exclude?: ((fileName: T) => boolean) | readonly string[] | undefined;
|
|
@@ -928,7 +928,7 @@ declare module "http" {
|
|
|
928
928
|
* been transmitted are equal or not.
|
|
929
929
|
*
|
|
930
930
|
* Attempting to set a header field name or value that contains invalid characters
|
|
931
|
-
* will result in a `
|
|
931
|
+
* will result in a [`TypeError`](https://nodejs.org/docs/latest-v22.x/api/errors.html#class-typeerror) being thrown.
|
|
932
932
|
* @since v0.1.30
|
|
933
933
|
*/
|
|
934
934
|
writeHead(
|
|
@@ -1472,6 +1472,14 @@ declare module "http" {
|
|
|
1472
1472
|
* Only relevant if keepAlive is set to true.
|
|
1473
1473
|
*/
|
|
1474
1474
|
keepAliveMsecs?: number | undefined;
|
|
1475
|
+
/**
|
|
1476
|
+
* Milliseconds to subtract from the server-provided `keep-alive: timeout=...` hint when determining socket
|
|
1477
|
+
* expiration time. This buffer helps ensure the agent closes the socket slightly before the server does, reducing
|
|
1478
|
+
* the chance of sending a request on a socket that’s about to be closed by the server.
|
|
1479
|
+
* @default 1000
|
|
1480
|
+
* @since v22.20.0
|
|
1481
|
+
*/
|
|
1482
|
+
agentKeepAliveTimeoutBuffer?: number | undefined;
|
|
1475
1483
|
/**
|
|
1476
1484
|
* Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity
|
|
1477
1485
|
*/
|
|
@@ -31,6 +31,7 @@ declare module "http2" {
|
|
|
31
31
|
":method"?: string | undefined;
|
|
32
32
|
":authority"?: string | undefined;
|
|
33
33
|
":scheme"?: string | undefined;
|
|
34
|
+
":protocol"?: string | undefined;
|
|
34
35
|
}
|
|
35
36
|
// Http2Stream
|
|
36
37
|
export interface StreamPriorityOptions {
|
|
@@ -299,61 +300,111 @@ declare module "http2" {
|
|
|
299
300
|
addListener(event: "continue", listener: () => {}): this;
|
|
300
301
|
addListener(
|
|
301
302
|
event: "headers",
|
|
302
|
-
listener: (
|
|
303
|
+
listener: (
|
|
304
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
305
|
+
flags: number,
|
|
306
|
+
rawHeaders: string[],
|
|
307
|
+
) => void,
|
|
303
308
|
): this;
|
|
304
309
|
addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
|
305
310
|
addListener(
|
|
306
311
|
event: "response",
|
|
307
|
-
listener: (
|
|
312
|
+
listener: (
|
|
313
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
314
|
+
flags: number,
|
|
315
|
+
rawHeaders: string[],
|
|
316
|
+
) => void,
|
|
308
317
|
): this;
|
|
309
318
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
310
319
|
emit(event: "continue"): boolean;
|
|
311
|
-
emit(
|
|
320
|
+
emit(
|
|
321
|
+
event: "headers",
|
|
322
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
323
|
+
flags: number,
|
|
324
|
+
rawHeaders: string[],
|
|
325
|
+
): boolean;
|
|
312
326
|
emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
|
|
313
|
-
emit(
|
|
327
|
+
emit(
|
|
328
|
+
event: "response",
|
|
329
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
330
|
+
flags: number,
|
|
331
|
+
rawHeaders: string[],
|
|
332
|
+
): boolean;
|
|
314
333
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
315
334
|
on(event: "continue", listener: () => {}): this;
|
|
316
335
|
on(
|
|
317
336
|
event: "headers",
|
|
318
|
-
listener: (
|
|
337
|
+
listener: (
|
|
338
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
339
|
+
flags: number,
|
|
340
|
+
rawHeaders: string[],
|
|
341
|
+
) => void,
|
|
319
342
|
): this;
|
|
320
343
|
on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
|
321
344
|
on(
|
|
322
345
|
event: "response",
|
|
323
|
-
listener: (
|
|
346
|
+
listener: (
|
|
347
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
348
|
+
flags: number,
|
|
349
|
+
rawHeaders: string[],
|
|
350
|
+
) => void,
|
|
324
351
|
): this;
|
|
325
352
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
326
353
|
once(event: "continue", listener: () => {}): this;
|
|
327
354
|
once(
|
|
328
355
|
event: "headers",
|
|
329
|
-
listener: (
|
|
356
|
+
listener: (
|
|
357
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
358
|
+
flags: number,
|
|
359
|
+
rawHeaders: string[],
|
|
360
|
+
) => void,
|
|
330
361
|
): this;
|
|
331
362
|
once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
|
332
363
|
once(
|
|
333
364
|
event: "response",
|
|
334
|
-
listener: (
|
|
365
|
+
listener: (
|
|
366
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
367
|
+
flags: number,
|
|
368
|
+
rawHeaders: string[],
|
|
369
|
+
) => void,
|
|
335
370
|
): this;
|
|
336
371
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
337
372
|
prependListener(event: "continue", listener: () => {}): this;
|
|
338
373
|
prependListener(
|
|
339
374
|
event: "headers",
|
|
340
|
-
listener: (
|
|
375
|
+
listener: (
|
|
376
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
377
|
+
flags: number,
|
|
378
|
+
rawHeaders: string[],
|
|
379
|
+
) => void,
|
|
341
380
|
): this;
|
|
342
381
|
prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
|
343
382
|
prependListener(
|
|
344
383
|
event: "response",
|
|
345
|
-
listener: (
|
|
384
|
+
listener: (
|
|
385
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
386
|
+
flags: number,
|
|
387
|
+
rawHeaders: string[],
|
|
388
|
+
) => void,
|
|
346
389
|
): this;
|
|
347
390
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
348
391
|
prependOnceListener(event: "continue", listener: () => {}): this;
|
|
349
392
|
prependOnceListener(
|
|
350
393
|
event: "headers",
|
|
351
|
-
listener: (
|
|
394
|
+
listener: (
|
|
395
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
396
|
+
flags: number,
|
|
397
|
+
rawHeaders: string[],
|
|
398
|
+
) => void,
|
|
352
399
|
): this;
|
|
353
400
|
prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
|
|
354
401
|
prependOnceListener(
|
|
355
402
|
event: "response",
|
|
356
|
-
listener: (
|
|
403
|
+
listener: (
|
|
404
|
+
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
405
|
+
flags: number,
|
|
406
|
+
rawHeaders: string[],
|
|
407
|
+
) => void,
|
|
357
408
|
): this;
|
|
358
409
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
359
410
|
}
|
|
@@ -439,7 +490,7 @@ declare module "http2" {
|
|
|
439
490
|
* ```
|
|
440
491
|
* @since v8.4.0
|
|
441
492
|
*/
|
|
442
|
-
respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void;
|
|
493
|
+
respond(headers?: OutgoingHttpHeaders | readonly string[], options?: ServerStreamResponseOptions): void;
|
|
443
494
|
/**
|
|
444
495
|
* Initiates a response whose data is read from the given file descriptor. No
|
|
445
496
|
* validation is performed on the given file descriptor. If an error occurs while
|
|
@@ -999,6 +1050,7 @@ declare module "http2" {
|
|
|
999
1050
|
stream: ClientHttp2Stream,
|
|
1000
1051
|
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
1001
1052
|
flags: number,
|
|
1053
|
+
rawHeaders: string[],
|
|
1002
1054
|
) => void,
|
|
1003
1055
|
): this;
|
|
1004
1056
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1010,6 +1062,7 @@ declare module "http2" {
|
|
|
1010
1062
|
stream: ClientHttp2Stream,
|
|
1011
1063
|
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
1012
1064
|
flags: number,
|
|
1065
|
+
rawHeaders: string[],
|
|
1013
1066
|
): boolean;
|
|
1014
1067
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
1015
1068
|
on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
|
|
@@ -1021,6 +1074,7 @@ declare module "http2" {
|
|
|
1021
1074
|
stream: ClientHttp2Stream,
|
|
1022
1075
|
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
1023
1076
|
flags: number,
|
|
1077
|
+
rawHeaders: string[],
|
|
1024
1078
|
) => void,
|
|
1025
1079
|
): this;
|
|
1026
1080
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1036,6 +1090,7 @@ declare module "http2" {
|
|
|
1036
1090
|
stream: ClientHttp2Stream,
|
|
1037
1091
|
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
1038
1092
|
flags: number,
|
|
1093
|
+
rawHeaders: string[],
|
|
1039
1094
|
) => void,
|
|
1040
1095
|
): this;
|
|
1041
1096
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1051,6 +1106,7 @@ declare module "http2" {
|
|
|
1051
1106
|
stream: ClientHttp2Stream,
|
|
1052
1107
|
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
1053
1108
|
flags: number,
|
|
1109
|
+
rawHeaders: string[],
|
|
1054
1110
|
) => void,
|
|
1055
1111
|
): this;
|
|
1056
1112
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1066,6 +1122,7 @@ declare module "http2" {
|
|
|
1066
1122
|
stream: ClientHttp2Stream,
|
|
1067
1123
|
headers: IncomingHttpHeaders & IncomingHttpStatusHeader,
|
|
1068
1124
|
flags: number,
|
|
1125
|
+
rawHeaders: string[],
|
|
1069
1126
|
) => void,
|
|
1070
1127
|
): this;
|
|
1071
1128
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1183,7 +1240,12 @@ declare module "http2" {
|
|
|
1183
1240
|
): this;
|
|
1184
1241
|
addListener(
|
|
1185
1242
|
event: "stream",
|
|
1186
|
-
listener: (
|
|
1243
|
+
listener: (
|
|
1244
|
+
stream: ServerHttp2Stream,
|
|
1245
|
+
headers: IncomingHttpHeaders,
|
|
1246
|
+
flags: number,
|
|
1247
|
+
rawHeaders: string[],
|
|
1248
|
+
) => void,
|
|
1187
1249
|
): this;
|
|
1188
1250
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1189
1251
|
emit(
|
|
@@ -1191,7 +1253,13 @@ declare module "http2" {
|
|
|
1191
1253
|
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
|
1192
1254
|
socket: net.Socket | tls.TLSSocket,
|
|
1193
1255
|
): boolean;
|
|
1194
|
-
emit(
|
|
1256
|
+
emit(
|
|
1257
|
+
event: "stream",
|
|
1258
|
+
stream: ServerHttp2Stream,
|
|
1259
|
+
headers: IncomingHttpHeaders,
|
|
1260
|
+
flags: number,
|
|
1261
|
+
rawHeaders: string[],
|
|
1262
|
+
): boolean;
|
|
1195
1263
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
1196
1264
|
on(
|
|
1197
1265
|
event: "connect",
|
|
@@ -1202,7 +1270,12 @@ declare module "http2" {
|
|
|
1202
1270
|
): this;
|
|
1203
1271
|
on(
|
|
1204
1272
|
event: "stream",
|
|
1205
|
-
listener: (
|
|
1273
|
+
listener: (
|
|
1274
|
+
stream: ServerHttp2Stream,
|
|
1275
|
+
headers: IncomingHttpHeaders,
|
|
1276
|
+
flags: number,
|
|
1277
|
+
rawHeaders: string[],
|
|
1278
|
+
) => void,
|
|
1206
1279
|
): this;
|
|
1207
1280
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1208
1281
|
once(
|
|
@@ -1214,7 +1287,12 @@ declare module "http2" {
|
|
|
1214
1287
|
): this;
|
|
1215
1288
|
once(
|
|
1216
1289
|
event: "stream",
|
|
1217
|
-
listener: (
|
|
1290
|
+
listener: (
|
|
1291
|
+
stream: ServerHttp2Stream,
|
|
1292
|
+
headers: IncomingHttpHeaders,
|
|
1293
|
+
flags: number,
|
|
1294
|
+
rawHeaders: string[],
|
|
1295
|
+
) => void,
|
|
1218
1296
|
): this;
|
|
1219
1297
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1220
1298
|
prependListener(
|
|
@@ -1226,7 +1304,12 @@ declare module "http2" {
|
|
|
1226
1304
|
): this;
|
|
1227
1305
|
prependListener(
|
|
1228
1306
|
event: "stream",
|
|
1229
|
-
listener: (
|
|
1307
|
+
listener: (
|
|
1308
|
+
stream: ServerHttp2Stream,
|
|
1309
|
+
headers: IncomingHttpHeaders,
|
|
1310
|
+
flags: number,
|
|
1311
|
+
rawHeaders: string[],
|
|
1312
|
+
) => void,
|
|
1230
1313
|
): this;
|
|
1231
1314
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1232
1315
|
prependOnceListener(
|
|
@@ -1238,7 +1321,12 @@ declare module "http2" {
|
|
|
1238
1321
|
): this;
|
|
1239
1322
|
prependOnceListener(
|
|
1240
1323
|
event: "stream",
|
|
1241
|
-
listener: (
|
|
1324
|
+
listener: (
|
|
1325
|
+
stream: ServerHttp2Stream,
|
|
1326
|
+
headers: IncomingHttpHeaders,
|
|
1327
|
+
flags: number,
|
|
1328
|
+
rawHeaders: string[],
|
|
1329
|
+
) => void,
|
|
1242
1330
|
): this;
|
|
1243
1331
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
1244
1332
|
}
|
|
@@ -1415,7 +1503,12 @@ declare module "http2" {
|
|
|
1415
1503
|
): this;
|
|
1416
1504
|
addListener(
|
|
1417
1505
|
event: "stream",
|
|
1418
|
-
listener: (
|
|
1506
|
+
listener: (
|
|
1507
|
+
stream: ServerHttp2Stream,
|
|
1508
|
+
headers: IncomingHttpHeaders,
|
|
1509
|
+
flags: number,
|
|
1510
|
+
rawHeaders: string[],
|
|
1511
|
+
) => void,
|
|
1419
1512
|
): this;
|
|
1420
1513
|
addListener(event: "timeout", listener: () => void): this;
|
|
1421
1514
|
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1434,7 +1527,13 @@ declare module "http2" {
|
|
|
1434
1527
|
err: Error,
|
|
1435
1528
|
session: ServerHttp2Session<Http1Request, Http1Response, Http2Request, Http2Response>,
|
|
1436
1529
|
): boolean;
|
|
1437
|
-
emit(
|
|
1530
|
+
emit(
|
|
1531
|
+
event: "stream",
|
|
1532
|
+
stream: ServerHttp2Stream,
|
|
1533
|
+
headers: IncomingHttpHeaders,
|
|
1534
|
+
flags: number,
|
|
1535
|
+
rawHeaders: string[],
|
|
1536
|
+
): boolean;
|
|
1438
1537
|
emit(event: "timeout"): boolean;
|
|
1439
1538
|
emit(event: string | symbol, ...args: any[]): boolean;
|
|
1440
1539
|
on(
|
|
@@ -1458,7 +1557,12 @@ declare module "http2" {
|
|
|
1458
1557
|
): this;
|
|
1459
1558
|
on(
|
|
1460
1559
|
event: "stream",
|
|
1461
|
-
listener: (
|
|
1560
|
+
listener: (
|
|
1561
|
+
stream: ServerHttp2Stream,
|
|
1562
|
+
headers: IncomingHttpHeaders,
|
|
1563
|
+
flags: number,
|
|
1564
|
+
rawHeaders: string[],
|
|
1565
|
+
) => void,
|
|
1462
1566
|
): this;
|
|
1463
1567
|
on(event: "timeout", listener: () => void): this;
|
|
1464
1568
|
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1483,7 +1587,12 @@ declare module "http2" {
|
|
|
1483
1587
|
): this;
|
|
1484
1588
|
once(
|
|
1485
1589
|
event: "stream",
|
|
1486
|
-
listener: (
|
|
1590
|
+
listener: (
|
|
1591
|
+
stream: ServerHttp2Stream,
|
|
1592
|
+
headers: IncomingHttpHeaders,
|
|
1593
|
+
flags: number,
|
|
1594
|
+
rawHeaders: string[],
|
|
1595
|
+
) => void,
|
|
1487
1596
|
): this;
|
|
1488
1597
|
once(event: "timeout", listener: () => void): this;
|
|
1489
1598
|
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1508,7 +1617,12 @@ declare module "http2" {
|
|
|
1508
1617
|
): this;
|
|
1509
1618
|
prependListener(
|
|
1510
1619
|
event: "stream",
|
|
1511
|
-
listener: (
|
|
1620
|
+
listener: (
|
|
1621
|
+
stream: ServerHttp2Stream,
|
|
1622
|
+
headers: IncomingHttpHeaders,
|
|
1623
|
+
flags: number,
|
|
1624
|
+
rawHeaders: string[],
|
|
1625
|
+
) => void,
|
|
1512
1626
|
): this;
|
|
1513
1627
|
prependListener(event: "timeout", listener: () => void): this;
|
|
1514
1628
|
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -1533,7 +1647,12 @@ declare module "http2" {
|
|
|
1533
1647
|
): this;
|
|
1534
1648
|
prependOnceListener(
|
|
1535
1649
|
event: "stream",
|
|
1536
|
-
listener: (
|
|
1650
|
+
listener: (
|
|
1651
|
+
stream: ServerHttp2Stream,
|
|
1652
|
+
headers: IncomingHttpHeaders,
|
|
1653
|
+
flags: number,
|
|
1654
|
+
rawHeaders: string[],
|
|
1655
|
+
) => void,
|
|
1537
1656
|
): this;
|
|
1538
1657
|
prependOnceListener(event: "timeout", listener: () => void): this;
|
|
1539
1658
|
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
|
@@ -2288,8 +2407,8 @@ declare module "http2" {
|
|
|
2288
2407
|
* will result in a `TypeError` being thrown.
|
|
2289
2408
|
* @since v8.4.0
|
|
2290
2409
|
*/
|
|
2291
|
-
writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this;
|
|
2292
|
-
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this;
|
|
2410
|
+
writeHead(statusCode: number, headers?: OutgoingHttpHeaders | readonly string[]): this;
|
|
2411
|
+
writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders | readonly string[]): this;
|
|
2293
2412
|
/**
|
|
2294
2413
|
* Call `http2stream.pushStream()` with the given headers, and wrap the
|
|
2295
2414
|
* given `Http2Stream` on a newly created `Http2ServerResponse` as the callback
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
/// <reference path="web-globals/fetch.d.ts" />
|
|
43
43
|
/// <reference path="web-globals/navigator.d.ts" />
|
|
44
44
|
/// <reference path="web-globals/storage.d.ts" />
|
|
45
|
+
/// <reference path="web-globals/streams.d.ts" />
|
|
45
46
|
/// <reference path="assert.d.ts" />
|
|
46
47
|
/// <reference path="assert/strict.d.ts" />
|
|
47
48
|
/// <reference path="async_hooks.d.ts" />
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.20.0",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -140,6 +140,6 @@
|
|
|
140
140
|
"undici-types": "~6.21.0"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {},
|
|
143
|
-
"typesPublisherContentHash": "
|
|
144
|
-
"typeScriptVersion": "5.
|
|
143
|
+
"typesPublisherContentHash": "4d1582b42850343fe58e9efa9e856921ec19ce7c4c28518c4961449c788abb65",
|
|
144
|
+
"typeScriptVersion": "5.6"
|
|
145
145
|
}
|
|
@@ -150,4 +150,13 @@ declare module "node:sea" {
|
|
|
150
150
|
* @since v20.12.0
|
|
151
151
|
*/
|
|
152
152
|
function getRawAsset(key: AssetKey): ArrayBuffer;
|
|
153
|
+
/**
|
|
154
|
+
* This method can be used to retrieve an array of all the keys of assets
|
|
155
|
+
* embedded into the single-executable application.
|
|
156
|
+
* An error is thrown when not running inside a single-executable application.
|
|
157
|
+
* @since v22.20.0
|
|
158
|
+
* @returns An array containing all the keys of the assets
|
|
159
|
+
* embedded in the executable. If no assets are embedded, returns an empty array.
|
|
160
|
+
*/
|
|
161
|
+
function getAssetKeys(): string[];
|
|
153
162
|
}
|
|
@@ -637,8 +637,9 @@ declare module "node:sqlite" {
|
|
|
637
637
|
*/
|
|
638
638
|
rate?: number | undefined;
|
|
639
639
|
/**
|
|
640
|
-
*
|
|
641
|
-
*
|
|
640
|
+
* An optional callback function that will be called after each backup step. The argument passed
|
|
641
|
+
* to this callback is an `Object` with `remainingPages` and `totalPages` properties, describing the current progress
|
|
642
|
+
* of the backup operation.
|
|
642
643
|
*/
|
|
643
644
|
progress?: ((progressInfo: BackupProgressInfo) => void) | undefined;
|
|
644
645
|
}
|
|
@@ -675,9 +676,9 @@ declare module "node:sqlite" {
|
|
|
675
676
|
* the contents will be overwritten.
|
|
676
677
|
* @param options Optional configuration for the backup. The
|
|
677
678
|
* following properties are supported:
|
|
678
|
-
* @returns A promise that
|
|
679
|
+
* @returns A promise that fulfills with the total number of backed-up pages upon completion, or rejects if an error occurs.
|
|
679
680
|
*/
|
|
680
|
-
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<
|
|
681
|
+
function backup(sourceDb: DatabaseSync, path: PathLike, options?: BackupOptions): Promise<number>;
|
|
681
682
|
/**
|
|
682
683
|
* @since v22.13.0
|
|
683
684
|
*/
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
type _ByteLengthQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
|
2
2
|
: import("stream/web").ByteLengthQueuingStrategy;
|
|
3
|
-
type _CompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
|
|
4
|
-
: import("stream/web").CompressionStream;
|
|
5
3
|
type _CountQueuingStrategy = typeof globalThis extends { onmessage: any } ? {}
|
|
6
4
|
: import("stream/web").CountQueuingStrategy;
|
|
7
|
-
type _DecompressionStream = typeof globalThis extends { onmessage: any; ReportingObserver: any } ? {}
|
|
8
|
-
: import("stream/web").DecompressionStream;
|
|
9
5
|
type _QueuingStrategy<T = any> = typeof globalThis extends { onmessage: any } ? {}
|
|
10
6
|
: import("stream/web").QueuingStrategy<T>;
|
|
11
7
|
type _ReadableByteStreamController = typeof globalThis extends { onmessage: any } ? {}
|
|
@@ -412,22 +408,17 @@ declare module "stream/web" {
|
|
|
412
408
|
prototype: TextDecoderStream;
|
|
413
409
|
new(encoding?: string, options?: TextDecoderOptions): TextDecoderStream;
|
|
414
410
|
};
|
|
415
|
-
|
|
411
|
+
type CompressionFormat = "brotli" | "deflate" | "deflate-raw" | "gzip";
|
|
412
|
+
class CompressionStream {
|
|
413
|
+
constructor(format: CompressionFormat);
|
|
416
414
|
readonly readable: ReadableStream;
|
|
417
415
|
readonly writable: WritableStream;
|
|
418
416
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): CompressionStream;
|
|
422
|
-
};
|
|
423
|
-
interface DecompressionStream {
|
|
417
|
+
class DecompressionStream {
|
|
418
|
+
constructor(format: CompressionFormat);
|
|
424
419
|
readonly writable: WritableStream;
|
|
425
420
|
readonly readable: ReadableStream;
|
|
426
421
|
}
|
|
427
|
-
const DecompressionStream: {
|
|
428
|
-
prototype: DecompressionStream;
|
|
429
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): DecompressionStream;
|
|
430
|
-
};
|
|
431
422
|
|
|
432
423
|
global {
|
|
433
424
|
interface ByteLengthQueuingStrategy extends _ByteLengthQueuingStrategy {}
|
|
@@ -440,26 +431,6 @@ declare module "stream/web" {
|
|
|
440
431
|
? T
|
|
441
432
|
: typeof import("stream/web").ByteLengthQueuingStrategy;
|
|
442
433
|
|
|
443
|
-
interface CompressionStream extends _CompressionStream {}
|
|
444
|
-
/**
|
|
445
|
-
* `CompressionStream` class is a global reference for `import { CompressionStream } from 'node:stream/web'`.
|
|
446
|
-
* https://nodejs.org/api/globals.html#class-compressionstream
|
|
447
|
-
* @since v18.0.0
|
|
448
|
-
*/
|
|
449
|
-
var CompressionStream: typeof globalThis extends {
|
|
450
|
-
onmessage: any;
|
|
451
|
-
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
|
|
452
|
-
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
|
|
453
|
-
ReportingObserver: any;
|
|
454
|
-
CompressionStream: infer T;
|
|
455
|
-
} ? T
|
|
456
|
-
// TS 4.8, 4.9, 5.0
|
|
457
|
-
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
|
|
458
|
-
prototype: T;
|
|
459
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): T;
|
|
460
|
-
}
|
|
461
|
-
: typeof import("stream/web").CompressionStream;
|
|
462
|
-
|
|
463
434
|
interface CountQueuingStrategy extends _CountQueuingStrategy {}
|
|
464
435
|
/**
|
|
465
436
|
* `CountQueuingStrategy` class is a global reference for `import { CountQueuingStrategy } from 'node:stream/web'`.
|
|
@@ -469,26 +440,6 @@ declare module "stream/web" {
|
|
|
469
440
|
var CountQueuingStrategy: typeof globalThis extends { onmessage: any; CountQueuingStrategy: infer T } ? T
|
|
470
441
|
: typeof import("stream/web").CountQueuingStrategy;
|
|
471
442
|
|
|
472
|
-
interface DecompressionStream extends _DecompressionStream {}
|
|
473
|
-
/**
|
|
474
|
-
* `DecompressionStream` class is a global reference for `import { DecompressionStream } from 'node:stream/web'`.
|
|
475
|
-
* https://nodejs.org/api/globals.html#class-decompressionstream
|
|
476
|
-
* @since v18.0.0
|
|
477
|
-
*/
|
|
478
|
-
var DecompressionStream: typeof globalThis extends {
|
|
479
|
-
onmessage: any;
|
|
480
|
-
// CompressionStream, DecompressionStream and ReportingObserver was introduced in the same commit.
|
|
481
|
-
// If ReportingObserver check is removed, the type here will form a circular reference in TS5.0+lib.dom.d.ts
|
|
482
|
-
ReportingObserver: any;
|
|
483
|
-
DecompressionStream: infer T extends object;
|
|
484
|
-
} ? T
|
|
485
|
-
// TS 4.8, 4.9, 5.0
|
|
486
|
-
: typeof globalThis extends { onmessage: any; TransformStream: { prototype: infer T } } ? {
|
|
487
|
-
prototype: T;
|
|
488
|
-
new(format: "deflate" | "deflate-raw" | "gzip"): T;
|
|
489
|
-
}
|
|
490
|
-
: typeof import("stream/web").DecompressionStream;
|
|
491
|
-
|
|
492
443
|
interface QueuingStrategy<T = any> extends _QueuingStrategy<T> {}
|
|
493
444
|
|
|
494
445
|
interface ReadableByteStreamController extends _ReadableByteStreamController {}
|
|
@@ -1676,8 +1676,15 @@ declare module "stream" {
|
|
|
1676
1676
|
/**
|
|
1677
1677
|
* Returns whether the stream is readable.
|
|
1678
1678
|
* @since v17.4.0, v16.14.0
|
|
1679
|
+
* @returns Only returns `null` if `stream` is not a valid `Readable`, `Duplex` or `ReadableStream`.
|
|
1679
1680
|
*/
|
|
1680
|
-
function isReadable(stream: Readable | NodeJS.ReadableStream): boolean;
|
|
1681
|
+
function isReadable(stream: Readable | NodeJS.ReadableStream): boolean | null;
|
|
1682
|
+
/**
|
|
1683
|
+
* Returns whether the stream is writable.
|
|
1684
|
+
* @since v20.0.0
|
|
1685
|
+
* @returns Only returns `null` if `stream` is not a valid `Writable`, `Duplex` or `WritableStream`.
|
|
1686
|
+
*/
|
|
1687
|
+
function isWritable(stream: Writable | NodeJS.WritableStream): boolean | null;
|
|
1681
1688
|
}
|
|
1682
1689
|
export = Stream;
|
|
1683
1690
|
}
|
|
@@ -242,8 +242,8 @@ declare module "node:test" {
|
|
|
242
242
|
*/
|
|
243
243
|
concurrency?: number | boolean | undefined;
|
|
244
244
|
/**
|
|
245
|
-
* An array containing the list of files to run.
|
|
246
|
-
* [
|
|
245
|
+
* An array containing the list of files to run.
|
|
246
|
+
* **Default:** Same as [running tests from the command line](https://nodejs.org/docs/latest-v22.x/api/test.html#running-tests-from-the-command-line).
|
|
247
247
|
*/
|
|
248
248
|
files?: readonly string[] | undefined;
|
|
249
249
|
/**
|
|
@@ -255,8 +255,8 @@ declare module "node:test" {
|
|
|
255
255
|
forceExit?: boolean | undefined;
|
|
256
256
|
/**
|
|
257
257
|
* An array containing the list of glob patterns to match test files.
|
|
258
|
-
* This option cannot be used together with `files`.
|
|
259
|
-
* [
|
|
258
|
+
* This option cannot be used together with `files`.
|
|
259
|
+
* **Default:** Same as [running tests from the command line](https://nodejs.org/docs/latest-v22.x/api/test.html#running-tests-from-the-command-line).
|
|
260
260
|
* @since v22.6.0
|
|
261
261
|
*/
|
|
262
262
|
globPatterns?: readonly string[] | undefined;
|
|
@@ -1640,6 +1640,46 @@ declare module "node:test" {
|
|
|
1640
1640
|
* @param options Optional configuration options for the mock module.
|
|
1641
1641
|
*/
|
|
1642
1642
|
module(specifier: string | URL, options?: MockModuleOptions): MockModuleContext;
|
|
1643
|
+
/**
|
|
1644
|
+
* Creates a mock for a property value on an object. This allows you to track and control access to a specific property,
|
|
1645
|
+
* including how many times it is read (getter) or written (setter), and to restore the original value after mocking.
|
|
1646
|
+
*
|
|
1647
|
+
* ```js
|
|
1648
|
+
* test('mocks a property value', (t) => {
|
|
1649
|
+
* const obj = { foo: 42 };
|
|
1650
|
+
* const prop = t.mock.property(obj, 'foo', 100);
|
|
1651
|
+
*
|
|
1652
|
+
* assert.strictEqual(obj.foo, 100);
|
|
1653
|
+
* assert.strictEqual(prop.mock.accessCount(), 1);
|
|
1654
|
+
* assert.strictEqual(prop.mock.accesses[0].type, 'get');
|
|
1655
|
+
* assert.strictEqual(prop.mock.accesses[0].value, 100);
|
|
1656
|
+
*
|
|
1657
|
+
* obj.foo = 200;
|
|
1658
|
+
* assert.strictEqual(prop.mock.accessCount(), 2);
|
|
1659
|
+
* assert.strictEqual(prop.mock.accesses[1].type, 'set');
|
|
1660
|
+
* assert.strictEqual(prop.mock.accesses[1].value, 200);
|
|
1661
|
+
*
|
|
1662
|
+
* prop.mock.restore();
|
|
1663
|
+
* assert.strictEqual(obj.foo, 42);
|
|
1664
|
+
* });
|
|
1665
|
+
* ```
|
|
1666
|
+
* @since v22.20.0
|
|
1667
|
+
* @param object The object whose value is being mocked.
|
|
1668
|
+
* @param propertyName The identifier of the property on `object` to mock.
|
|
1669
|
+
* @param value An optional value used as the mock value
|
|
1670
|
+
* for `object[propertyName]`. **Default:** The original property value.
|
|
1671
|
+
* @returns A proxy to the mocked object. The mocked object contains a
|
|
1672
|
+
* special `mock` property, which is an instance of [`MockPropertyContext`](https://nodejs.org/docs/latest-v22.x/api/test.html#class-mockpropertycontext),
|
|
1673
|
+
* and can be used for inspecting and changing the behavior of the mocked property.
|
|
1674
|
+
*/
|
|
1675
|
+
property<
|
|
1676
|
+
MockedObject extends object,
|
|
1677
|
+
PropertyName extends keyof MockedObject,
|
|
1678
|
+
>(
|
|
1679
|
+
object: MockedObject,
|
|
1680
|
+
property: PropertyName,
|
|
1681
|
+
value?: MockedObject[PropertyName],
|
|
1682
|
+
): MockedObject & { mock: MockPropertyContext<MockedObject[PropertyName]> };
|
|
1643
1683
|
/**
|
|
1644
1684
|
* This function restores the default behavior of all mocks that were previously
|
|
1645
1685
|
* created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be
|
|
@@ -1809,6 +1849,68 @@ declare module "node:test" {
|
|
|
1809
1849
|
*/
|
|
1810
1850
|
restore(): void;
|
|
1811
1851
|
}
|
|
1852
|
+
/**
|
|
1853
|
+
* @since v22.20.0
|
|
1854
|
+
*/
|
|
1855
|
+
class MockPropertyContext<PropertyType = any> {
|
|
1856
|
+
/**
|
|
1857
|
+
* A getter that returns a copy of the internal array used to track accesses (get/set) to
|
|
1858
|
+
* the mocked property. Each entry in the array is an object with the following properties:
|
|
1859
|
+
*/
|
|
1860
|
+
readonly accesses: Array<{
|
|
1861
|
+
type: "get" | "set";
|
|
1862
|
+
value: PropertyType;
|
|
1863
|
+
stack: Error;
|
|
1864
|
+
}>;
|
|
1865
|
+
/**
|
|
1866
|
+
* This function returns the number of times that the property was accessed.
|
|
1867
|
+
* This function is more efficient than checking `ctx.accesses.length` because
|
|
1868
|
+
* `ctx.accesses` is a getter that creates a copy of the internal access tracking array.
|
|
1869
|
+
* @returns The number of times that the property was accessed (read or written).
|
|
1870
|
+
*/
|
|
1871
|
+
accessCount(): number;
|
|
1872
|
+
/**
|
|
1873
|
+
* This function is used to change the value returned by the mocked property getter.
|
|
1874
|
+
* @param value The new value to be set as the mocked property value.
|
|
1875
|
+
*/
|
|
1876
|
+
mockImplementation(value: PropertyType): void;
|
|
1877
|
+
/**
|
|
1878
|
+
* This function is used to change the behavior of an existing mock for a single
|
|
1879
|
+
* invocation. Once invocation `onAccess` has occurred, the mock will revert to
|
|
1880
|
+
* whatever behavior it would have used had `mockImplementationOnce()` not been
|
|
1881
|
+
* called.
|
|
1882
|
+
*
|
|
1883
|
+
* The following example creates a mock function using `t.mock.property()`, calls the
|
|
1884
|
+
* mock property, changes the mock implementation to a different value for the
|
|
1885
|
+
* next invocation, and then resumes its previous behavior.
|
|
1886
|
+
*
|
|
1887
|
+
* ```js
|
|
1888
|
+
* test('changes a mock behavior once', (t) => {
|
|
1889
|
+
* const obj = { foo: 1 };
|
|
1890
|
+
*
|
|
1891
|
+
* assert.strictEqual(obj.foo, 5);
|
|
1892
|
+
* prop.mock.mockImplementationOnce(25);
|
|
1893
|
+
* assert.strictEqual(obj.foo, 25);
|
|
1894
|
+
* assert.strictEqual(obj.foo, 5);
|
|
1895
|
+
* });
|
|
1896
|
+
* ```
|
|
1897
|
+
* @param value The value to be used as the mock's
|
|
1898
|
+
* implementation for the invocation number specified by `onAccess`.
|
|
1899
|
+
* @param onAccess The invocation number that will use `value`. If
|
|
1900
|
+
* the specified invocation has already occurred then an exception is thrown.
|
|
1901
|
+
* **Default:** The number of the next invocation.
|
|
1902
|
+
*/
|
|
1903
|
+
mockImplementationOnce(value: PropertyType, onAccess?: number): void;
|
|
1904
|
+
/**
|
|
1905
|
+
* Resets the access history of the mocked property.
|
|
1906
|
+
*/
|
|
1907
|
+
resetAccesses(): void;
|
|
1908
|
+
/**
|
|
1909
|
+
* Resets the implementation of the mock property to its original behavior. The
|
|
1910
|
+
* mock can still be used after calling this function.
|
|
1911
|
+
*/
|
|
1912
|
+
restore(): void;
|
|
1913
|
+
}
|
|
1812
1914
|
interface MockTimersOptions {
|
|
1813
1915
|
apis: ReadonlyArray<"setInterval" | "setTimeout" | "setImmediate" | "Date">;
|
|
1814
1916
|
now?: number | Date | undefined;
|
|
@@ -1301,7 +1301,7 @@ declare module "tls" {
|
|
|
1301
1301
|
* It can be assigned any of the supported OpenSSL ciphers.
|
|
1302
1302
|
* Defaults to the content of `crypto.constants.defaultCoreCipherList`, unless
|
|
1303
1303
|
* changed using CLI options using `--tls-default-ciphers`.
|
|
1304
|
-
* @since
|
|
1304
|
+
* @since v0.11.3
|
|
1305
1305
|
*/
|
|
1306
1306
|
let DEFAULT_CIPHERS: string;
|
|
1307
1307
|
/**
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
/// <reference path="../web-globals/fetch.d.ts" />
|
|
43
43
|
/// <reference path="../web-globals/navigator.d.ts" />
|
|
44
44
|
/// <reference path="../web-globals/storage.d.ts" />
|
|
45
|
+
/// <reference path="../web-globals/streams.d.ts" />
|
|
45
46
|
/// <reference path="../assert.d.ts" />
|
|
46
47
|
/// <reference path="../assert/strict.d.ts" />
|
|
47
48
|
/// <reference path="../async_hooks.d.ts" />
|
|
@@ -762,14 +762,6 @@ declare module "vm" {
|
|
|
762
762
|
* @experimental
|
|
763
763
|
*/
|
|
764
764
|
class Module {
|
|
765
|
-
/**
|
|
766
|
-
* The specifiers of all dependencies of this module. The returned array is frozen
|
|
767
|
-
* to disallow any changes to it.
|
|
768
|
-
*
|
|
769
|
-
* Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in
|
|
770
|
-
* the ECMAScript specification.
|
|
771
|
-
*/
|
|
772
|
-
dependencySpecifiers: readonly string[];
|
|
773
765
|
/**
|
|
774
766
|
* If the `module.status` is `'errored'`, this property contains the exception
|
|
775
767
|
* thrown by the module during evaluation. If the status is anything else,
|
|
@@ -864,6 +856,21 @@ declare module "vm" {
|
|
|
864
856
|
*/
|
|
865
857
|
link(linker: ModuleLinker): Promise<void>;
|
|
866
858
|
}
|
|
859
|
+
/**
|
|
860
|
+
* A `ModuleRequest` represents the request to import a module with given import attributes and phase.
|
|
861
|
+
* @since v22.20.0
|
|
862
|
+
*/
|
|
863
|
+
interface ModuleRequest {
|
|
864
|
+
/**
|
|
865
|
+
* The specifier of the requested module.
|
|
866
|
+
*/
|
|
867
|
+
specifier: string;
|
|
868
|
+
/**
|
|
869
|
+
* The `"with"` value passed to the `WithClause` in a `ImportDeclaration`, or an empty object if no value was
|
|
870
|
+
* provided.
|
|
871
|
+
*/
|
|
872
|
+
attributes: ImportAttributes;
|
|
873
|
+
}
|
|
867
874
|
interface SourceTextModuleOptions extends Pick<ScriptOptions, "cachedData" | "columnOffset" | "lineOffset"> {
|
|
868
875
|
/**
|
|
869
876
|
* String used in stack traces.
|
|
@@ -897,6 +904,52 @@ declare module "vm" {
|
|
|
897
904
|
* @param code JavaScript Module code to parse
|
|
898
905
|
*/
|
|
899
906
|
constructor(code: string, options?: SourceTextModuleOptions);
|
|
907
|
+
/**
|
|
908
|
+
* The specifiers of all dependencies of this module. The returned array is frozen to disallow any changes to it.
|
|
909
|
+
*
|
|
910
|
+
* Corresponds to the [[RequestedModules]] field of [Cyclic Module Records](https://tc39.es/ecma262/#sec-cyclic-module-records)
|
|
911
|
+
* in the ECMAScript specification.
|
|
912
|
+
* @deprecated Use {@link moduleRequests} instead.
|
|
913
|
+
*/
|
|
914
|
+
readonly dependencySpecifiers: readonly string[];
|
|
915
|
+
/**
|
|
916
|
+
* The requested import dependencies of this module. The returned array is frozen
|
|
917
|
+
* to disallow any changes to it.
|
|
918
|
+
*
|
|
919
|
+
* For example, given a source text:
|
|
920
|
+
*
|
|
921
|
+
* ```js
|
|
922
|
+
* import foo from 'foo';
|
|
923
|
+
* import fooAlias from 'foo';
|
|
924
|
+
* import bar from './bar.js';
|
|
925
|
+
* import withAttrs from '../with-attrs.ts' with { arbitraryAttr: 'attr-val' };
|
|
926
|
+
* ```
|
|
927
|
+
*
|
|
928
|
+
* The value of the `sourceTextModule.moduleRequests` will be:
|
|
929
|
+
*
|
|
930
|
+
* ```js
|
|
931
|
+
* [
|
|
932
|
+
* {
|
|
933
|
+
* specifier: 'foo',
|
|
934
|
+
* attributes: {},
|
|
935
|
+
* },
|
|
936
|
+
* {
|
|
937
|
+
* specifier: 'foo',
|
|
938
|
+
* attributes: {},
|
|
939
|
+
* },
|
|
940
|
+
* {
|
|
941
|
+
* specifier: './bar.js',
|
|
942
|
+
* attributes: {},
|
|
943
|
+
* },
|
|
944
|
+
* {
|
|
945
|
+
* specifier: '../with-attrs.ts',
|
|
946
|
+
* attributes: { arbitraryAttr: 'attr-val' },
|
|
947
|
+
* },
|
|
948
|
+
* ];
|
|
949
|
+
* ```
|
|
950
|
+
* @since v22.20.0
|
|
951
|
+
*/
|
|
952
|
+
readonly moduleRequests: readonly ModuleRequest[];
|
|
900
953
|
}
|
|
901
954
|
interface SyntheticModuleOptions {
|
|
902
955
|
/**
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
import * as webstreams from "stream/web";
|
|
4
|
+
|
|
5
|
+
type _CompressionStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.CompressionStream;
|
|
6
|
+
type _DecompressionStream = typeof globalThis extends { onmessage: any } ? {} : webstreams.DecompressionStream;
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface CompressionStream extends _CompressionStream {}
|
|
10
|
+
var CompressionStream: typeof globalThis extends {
|
|
11
|
+
onmessage: any;
|
|
12
|
+
CompressionStream: infer T;
|
|
13
|
+
} ? T
|
|
14
|
+
: typeof webstreams.CompressionStream;
|
|
15
|
+
|
|
16
|
+
interface DecompressionStream extends _DecompressionStream {}
|
|
17
|
+
var DecompressionStream: typeof globalThis extends {
|
|
18
|
+
onmessage: any;
|
|
19
|
+
DecompressionStream: infer T;
|
|
20
|
+
} ? T
|
|
21
|
+
: typeof webstreams.DecompressionStream;
|
|
22
|
+
}
|
|
@@ -70,6 +70,7 @@ declare module "worker_threads" {
|
|
|
70
70
|
const resourceLimits: ResourceLimits;
|
|
71
71
|
const SHARE_ENV: unique symbol;
|
|
72
72
|
const threadId: number;
|
|
73
|
+
const threadName: string | null;
|
|
73
74
|
const workerData: any;
|
|
74
75
|
/**
|
|
75
76
|
* Instances of the `worker.MessageChannel` class represent an asynchronous,
|
|
@@ -300,6 +301,10 @@ declare module "worker_threads" {
|
|
|
300
301
|
*/
|
|
301
302
|
stackSizeMb?: number | undefined;
|
|
302
303
|
}
|
|
304
|
+
interface CPUProfileHandle {
|
|
305
|
+
stop(): Promise<string>;
|
|
306
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
307
|
+
}
|
|
303
308
|
/**
|
|
304
309
|
* The `Worker` class represents an independent JavaScript execution thread.
|
|
305
310
|
* Most Node.js APIs are available inside of it.
|
|
@@ -391,6 +396,12 @@ declare module "worker_threads" {
|
|
|
391
396
|
* @since v10.5.0
|
|
392
397
|
*/
|
|
393
398
|
readonly threadId: number;
|
|
399
|
+
/**
|
|
400
|
+
* A string identifier for the referenced thread or null if the thread is not running.
|
|
401
|
+
* Inside the worker thread, it is available as {@link threadName | `require('node:worker_threads').threadName`}.
|
|
402
|
+
* @since v22.20.0
|
|
403
|
+
*/
|
|
404
|
+
readonly threadName: string | null;
|
|
394
405
|
/**
|
|
395
406
|
* Provides the set of JS engine resource constraints for this Worker thread.
|
|
396
407
|
* If the `resourceLimits` option was passed to the `Worker` constructor,
|
|
@@ -461,6 +472,30 @@ declare module "worker_threads" {
|
|
|
461
472
|
* @since v22.16.0
|
|
462
473
|
*/
|
|
463
474
|
getHeapStatistics(): Promise<HeapInfo>;
|
|
475
|
+
/**
|
|
476
|
+
* Starting a CPU profile with the given `name`, then return a Promise that fulfills
|
|
477
|
+
* with an error or an object which has a `stop` method. Calling the `stop` method will
|
|
478
|
+
* stop collecting the profile, then return a Promise that fulfills with an error or the
|
|
479
|
+
* profile data.
|
|
480
|
+
*
|
|
481
|
+
* ```js
|
|
482
|
+
* const { Worker } = require('node:worker_threads');
|
|
483
|
+
*
|
|
484
|
+
* const worker = new Worker(`
|
|
485
|
+
* const { parentPort } = require('worker_threads');
|
|
486
|
+
* parentPort.on('message', () => {});
|
|
487
|
+
* `, { eval: true });
|
|
488
|
+
*
|
|
489
|
+
* worker.on('online', async () => {
|
|
490
|
+
* const handle = await worker.startCpuProfile('demo');
|
|
491
|
+
* const profile = await handle.stop();
|
|
492
|
+
* console.log(profile);
|
|
493
|
+
* worker.terminate();
|
|
494
|
+
* });
|
|
495
|
+
* ```
|
|
496
|
+
* @since v22.20.0
|
|
497
|
+
*/
|
|
498
|
+
startCpuProfile(name: string): Promise<CPUProfileHandle>;
|
|
464
499
|
/**
|
|
465
500
|
* Calls `worker.terminate()` when the dispose scope is exited.
|
|
466
501
|
*
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|