@types/node 20.7.2 → 20.8.1

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/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 29 Sep 2023 15:35:13 GMT
11
+ * Last updated: Mon, 02 Oct 2023 20:06:22 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/buffer.d.ts CHANGED
@@ -71,7 +71,7 @@ declare module "buffer" {
71
71
  MAX_LENGTH: number;
72
72
  MAX_STRING_LENGTH: number;
73
73
  };
74
- export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
74
+ export type TranscodeEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "utf-16le" | "ucs2" | "ucs-2" | "latin1" | "binary";
75
75
  /**
76
76
  * Re-encodes the given `Buffer` or `Uint8Array` instance from one character
77
77
  * encoding to another. Returns a new `Buffer` instance.
@@ -225,6 +225,7 @@ declare module "buffer" {
225
225
  | "utf8"
226
226
  | "utf-8"
227
227
  | "utf16le"
228
+ | "utf-16le"
228
229
  | "ucs2"
229
230
  | "ucs-2"
230
231
  | "base64"
node/crypto.d.ts CHANGED
@@ -260,7 +260,7 @@ declare module "crypto" {
260
260
  function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
261
261
  // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
262
262
  type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary";
263
- type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "latin1";
263
+ type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "utf-16le" | "latin1";
264
264
  type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2";
265
265
  type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
266
266
  type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
node/events.d.ts CHANGED
@@ -35,6 +35,7 @@
35
35
  * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js)
36
36
  */
37
37
  declare module "events" {
38
+ import { AsyncResource, AsyncResourceOptions } from "node:async_hooks";
38
39
  // NOTE: This class is in the docs but is **not actually exported** by Node.
39
40
  // If https://github.com/nodejs/node/issues/39903 gets resolved and Node
40
41
  // actually starts exporting the class, uncomment below.
@@ -107,6 +108,9 @@ declare module "events" {
107
108
  */
108
109
  class EventEmitter {
109
110
  constructor(options?: EventEmitterOptions);
111
+
112
+ [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
113
+
110
114
  /**
111
115
  * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given
112
116
  * event or that is rejected if the `EventEmitter` emits `'error'` while waiting.
@@ -451,10 +455,55 @@ declare module "events" {
451
455
  */
452
456
  signal?: AbortSignal | undefined;
453
457
  }
458
+
459
+ export interface EventEmitterReferencingAsyncResource extends AsyncResource {
460
+ readonly eventEmitter: EventEmitterAsyncResource;
461
+ }
462
+
463
+ export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions {
464
+ /**
465
+ * The type of async event, this is required when instantiating `EventEmitterAsyncResource`
466
+ * directly rather than as a child class.
467
+ * @default new.target.name if instantiated as a child class.
468
+ */
469
+ name?: string;
470
+ }
471
+
472
+ /**
473
+ * Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that require
474
+ * manual async tracking. Specifically, all events emitted by instances of
475
+ * `EventEmitterAsyncResource` will run within its async context.
476
+ *
477
+ * The EventEmitterAsyncResource class has the same methods and takes the
478
+ * same options as EventEmitter and AsyncResource themselves.
479
+ * @throws if `options.name` is not provided when instantiated directly.
480
+ * @since v17.4.0, v16.14.0
481
+ */
482
+ export class EventEmitterAsyncResource extends EventEmitter {
483
+ /**
484
+ * @param options Only optional in child class.
485
+ */
486
+ constructor(options?: EventEmitterAsyncResourceOptions);
487
+ /**
488
+ * Call all destroy hooks. This should only ever be called once. An
489
+ * error will be thrown if it is called more than once. This must be
490
+ * manually called. If the resource is left to be collected by the GC then
491
+ * the destroy hooks will never be called.
492
+ */
493
+ emitDestroy(): void;
494
+ /** The unique asyncId assigned to the resource. */
495
+ readonly asyncId: number;
496
+ /** The same triggerAsyncId that is passed to the AsyncResource constructor. */
497
+ readonly triggerAsyncId: number;
498
+ /** The underlying AsyncResource */
499
+ readonly asyncResource: EventEmitterReferencingAsyncResource;
500
+ }
454
501
  }
455
502
  global {
456
503
  namespace NodeJS {
457
504
  interface EventEmitter {
505
+
506
+ [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void;
458
507
  /**
459
508
  * Alias for `emitter.on(eventName, listener)`.
460
509
  * @since v0.1.26
node/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // Type definitions for non-npm package Node.js 20.7
1
+ // Type definitions for non-npm package Node.js 20.8
2
2
  // Project: https://nodejs.org/
3
3
  // Definitions by: Microsoft TypeScript <https://github.com/Microsoft>
4
4
  // DefinitelyTyped <https://github.com/DefinitelyTyped>
node/module.d.ts CHANGED
@@ -142,13 +142,13 @@ declare module "module" {
142
142
  */
143
143
  type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
144
144
  /**
145
- * The `initialize` hook provides a way to define a custom function that runs in the loader's thread
146
- * when the loader is initialized. Initialization happens when the loader is registered via `register`
147
- * or registered via the `--experimental-loader` command line option.
145
+ * The `initialize` hook provides a way to define a custom function that runs in the hooks thread
146
+ * when the hooks module is initialized. Initialization happens when the hooks module is registered via `register`.
148
147
  *
149
- * This hook can send and receive data from a `register` invocation, including ports and other transferrable objects.
148
+ * This hook can receive data from a `register` invocation, including ports and other transferrable objects.
149
+ * The return value of `initialize` can be a `Promise`, in which case it will be awaited before the main application thread execution resumes.
150
150
  */
151
- type InitializeHook<Data = any, ReturnType = any> = (data: Data) => ReturnType;
151
+ type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
152
152
  interface ResolveHookContext {
153
153
  /**
154
154
  * Export conditions of the relevant `package.json`
@@ -240,7 +240,7 @@ declare module "module" {
240
240
  ) => LoadFnOutput | Promise<LoadFnOutput>;
241
241
  }
242
242
  interface RegisterOptions<Data> {
243
- parentURL: string;
243
+ parentURL: string | URL;
244
244
  data?: Data | undefined;
245
245
  transferList?: any[] | undefined;
246
246
  }
@@ -252,12 +252,12 @@ declare module "module" {
252
252
  static builtinModules: string[];
253
253
  static isBuiltin(moduleName: string): boolean;
254
254
  static Module: typeof Module;
255
- static register<Data = any, ReturnType = any>(
256
- specifier: string,
257
- parentURL?: string,
255
+ static register<Data = any>(
256
+ specifier: string | URL,
257
+ parentURL?: string | URL,
258
258
  options?: RegisterOptions<Data>,
259
- ): ReturnType;
260
- static register<Data = any, ReturnType = any>(specifier: string, options?: RegisterOptions<Data>): ReturnType;
259
+ ): void;
260
+ static register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
261
261
  constructor(id: string, parent?: Module);
262
262
  }
263
263
  global {
node/net.d.ts CHANGED
@@ -240,6 +240,7 @@ declare module "net" {
240
240
  *
241
241
  * Each address is a string in the form of `$IP:$PORT`.
242
242
  * If the connection was successful, then the last address is the one that the socket is currently connected to.
243
+ * @since v19.4.0
243
244
  */
244
245
  readonly autoSelectFamilyAttemptedAddresses: string[];
245
246
  /**
@@ -832,9 +833,27 @@ declare module "net" {
832
833
  function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
833
834
  function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
834
835
  function createConnection(path: string, connectionListener?: () => void): Socket;
836
+ /**
837
+ * Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`.
838
+ * The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided.
839
+ * @since v19.4.0
840
+ */
835
841
  function getDefaultAutoSelectFamily(): boolean;
842
+ /**
843
+ * Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`.
844
+ * @since v19.4.0
845
+ */
836
846
  function setDefaultAutoSelectFamily(value: boolean): void;
847
+ /**
848
+ * Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
849
+ * The initial default value is `250`.
850
+ * @since v19.8.0
851
+ */
837
852
  function getDefaultAutoSelectFamilyAttemptTimeout(): number;
853
+ /**
854
+ * Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
855
+ * @since v19.8.0
856
+ */
838
857
  function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void;
839
858
  /**
840
859
  * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
node/os.d.ts CHANGED
@@ -400,7 +400,7 @@ declare module "os" {
400
400
  const EOL: string;
401
401
  /**
402
402
  * Returns the operating system CPU architecture for which the Node.js binary was
403
- * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
403
+ * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`.
404
404
  *
405
405
  * The return value is equivalent to `process.arch`.
406
406
  * @since v0.5.0
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.7.2",
3
+ "version": "20.8.1",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -227,6 +227,6 @@
227
227
  },
228
228
  "scripts": {},
229
229
  "dependencies": {},
230
- "typesPublisherContentHash": "1d9a94d3ffc1829c322fb6ca879309caef54742b9397b368762561566ddea037",
230
+ "typesPublisherContentHash": "9df8dc36b5df180b9e925f6a58ac11ac2a2d8851a8f5dbe6646356a90dcd886c",
231
231
  "typeScriptVersion": "4.5"
232
232
  }
node/stream/web.d.ts CHANGED
@@ -77,6 +77,15 @@ declare module "stream/web" {
77
77
  type ReadableStreamDefaultReadResult<T> =
78
78
  | ReadableStreamDefaultReadValueResult<T>
79
79
  | ReadableStreamDefaultReadDoneResult;
80
+ interface ReadableStreamReadValueResult<T> {
81
+ done: false;
82
+ value: T;
83
+ }
84
+ interface ReadableStreamReadDoneResult<T> {
85
+ done: true;
86
+ value?: T;
87
+ }
88
+ type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
80
89
  interface ReadableByteStreamControllerCallback {
81
90
  (controller: ReadableByteStreamController): void | PromiseLike<void>;
82
91
  }
@@ -138,6 +147,7 @@ declare module "stream/web" {
138
147
  readonly locked: boolean;
139
148
  cancel(reason?: any): Promise<void>;
140
149
  getReader(): ReadableStreamDefaultReader<R>;
150
+ getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
141
151
  pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
142
152
  pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
143
153
  tee(): [ReadableStream<R>, ReadableStream<R>];
@@ -153,6 +163,10 @@ declare module "stream/web" {
153
163
  read(): Promise<ReadableStreamDefaultReadResult<R>>;
154
164
  releaseLock(): void;
155
165
  }
166
+ interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
167
+ read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
168
+ releaseLock(): void;
169
+ }
156
170
  const ReadableStreamDefaultReader: {
157
171
  prototype: ReadableStreamDefaultReader;
158
172
  new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
node/test.d.ts CHANGED
@@ -84,7 +84,9 @@ declare module "node:test" {
84
84
  /**
85
85
  * ```js
86
86
  * import { tap } from 'node:test/reporters';
87
+ * import { run } from 'node:test';
87
88
  * import process from 'node:process';
89
+ * import path from 'node:path';
88
90
  *
89
91
  * run({ files: [path.resolve('./tests/test.js')] })
90
92
  * .compose(tap)
@@ -292,6 +294,10 @@ declare module "node:test" {
292
294
  * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
293
295
  */
294
296
  testNamePatterns?: string | RegExp | string[] | RegExp[];
297
+ /**
298
+ * If truthy, the test context will only run tests that have the `only` option set
299
+ */
300
+ only?: boolean;
295
301
  /**
296
302
  * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
297
303
  */
@@ -1368,5 +1374,9 @@ declare module "node:test/reporters" {
1368
1374
  class Spec extends Transform {
1369
1375
  constructor();
1370
1376
  }
1371
- export { dot, Spec as spec, tap, TestEvent };
1377
+ /**
1378
+ * The `junit` reporter outputs test results in a jUnit XML format
1379
+ */
1380
+ function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
1381
+ export { dot, Spec as spec, tap, junit, TestEvent };
1372
1382
  }
node/ts4.8/buffer.d.ts CHANGED
@@ -71,7 +71,7 @@ declare module "buffer" {
71
71
  MAX_LENGTH: number;
72
72
  MAX_STRING_LENGTH: number;
73
73
  };
74
- export type TranscodeEncoding = "ascii" | "utf8" | "utf16le" | "ucs2" | "latin1" | "binary";
74
+ export type TranscodeEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "utf-16le" | "ucs2" | "ucs-2" | "latin1" | "binary";
75
75
  /**
76
76
  * Re-encodes the given `Buffer` or `Uint8Array` instance from one character
77
77
  * encoding to another. Returns a new `Buffer` instance.
@@ -225,6 +225,7 @@ declare module "buffer" {
225
225
  | "utf8"
226
226
  | "utf-8"
227
227
  | "utf16le"
228
+ | "utf-16le"
228
229
  | "ucs2"
229
230
  | "ucs-2"
230
231
  | "base64"
@@ -529,7 +530,7 @@ declare module "buffer" {
529
530
  * @param [fill=0] A value to pre-fill the new `Buffer` with.
530
531
  * @param [encoding='utf8'] If `fill` is a string, this is its encoding.
531
532
  */
532
- alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
533
+ alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer;
533
534
  /**
534
535
  * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
535
536
  *
node/ts4.8/crypto.d.ts CHANGED
@@ -260,7 +260,7 @@ declare module "crypto" {
260
260
  function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
261
261
  // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
262
262
  type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary";
263
- type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "latin1";
263
+ type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "utf-16le" | "latin1";
264
264
  type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2";
265
265
  type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
266
266
  type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
node/ts4.8/module.d.ts CHANGED
@@ -65,6 +65,24 @@ declare module "module" {
65
65
  originalLine: number;
66
66
  originalColumn: number;
67
67
  }
68
+ interface SourceOrigin {
69
+ /**
70
+ * The name of the range in the source map, if one was provided
71
+ */
72
+ name?: string;
73
+ /**
74
+ * The file name of the original source, as reported in the SourceMap
75
+ */
76
+ fileName: string;
77
+ /**
78
+ * The 1-indexed lineNumber of the corresponding call site in the original source
79
+ */
80
+ lineNumber: number;
81
+ /**
82
+ * The 1-indexed columnNumber of the corresponding call site in the original source
83
+ */
84
+ columnNumber: number;
85
+ }
68
86
  /**
69
87
  * @since v13.7.0, v12.17.0
70
88
  */
@@ -93,6 +111,16 @@ declare module "module" {
93
111
  * @param columnOffset The zero-indexed column number offset in the generated source
94
112
  */
95
113
  findEntry(lineOffset: number, columnOffset: number): SourceMapping;
114
+ /**
115
+ * Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source,
116
+ * find the corresponding call site location in the original source.
117
+ *
118
+ * If the `lineNumber` and `columnNumber` provided are not found in any source map,
119
+ * then an empty object is returned.
120
+ * @param lineNumber The 1-indexed line number of the call site in the generated source
121
+ * @param columnNumber The 1-indexed column number of the call site in the generated source
122
+ */
123
+ findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {};
96
124
  }
97
125
  interface ImportAssertions extends NodeJS.Dict<string> {
98
126
  type?: string | undefined;
@@ -114,13 +142,13 @@ declare module "module" {
114
142
  */
115
143
  type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
116
144
  /**
117
- * The `initialize` hook provides a way to define a custom function that runs in the loader's thread
118
- * when the loader is initialized. Initialization happens when the loader is registered via `register`
119
- * or registered via the `--experimental-loader` command line option.
145
+ * The `initialize` hook provides a way to define a custom function that runs in the hooks thread
146
+ * when the hooks module is initialized. Initialization happens when the hooks module is registered via `register`.
120
147
  *
121
- * This hook can send and receive data from a `register` invocation, including ports and other transferrable objects.
148
+ * This hook can receive data from a `register` invocation, including ports and other transferrable objects.
149
+ * The return value of `initialize` can be a `Promise`, in which case it will be awaited before the main application thread execution resumes.
122
150
  */
123
- type InitializeHook<Data = any, ReturnType = any> = (data: Data) => ReturnType;
151
+ type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
124
152
  interface ResolveHookContext {
125
153
  /**
126
154
  * Export conditions of the relevant `package.json`
@@ -212,7 +240,7 @@ declare module "module" {
212
240
  ) => LoadFnOutput | Promise<LoadFnOutput>;
213
241
  }
214
242
  interface RegisterOptions<Data> {
215
- parentURL: string;
243
+ parentURL: string | URL;
216
244
  data?: Data | undefined;
217
245
  transferList?: any[] | undefined;
218
246
  }
@@ -224,12 +252,12 @@ declare module "module" {
224
252
  static builtinModules: string[];
225
253
  static isBuiltin(moduleName: string): boolean;
226
254
  static Module: typeof Module;
227
- static register<Data = any, ReturnType = any>(
228
- specifier: string,
229
- parentURL?: string,
255
+ static register<Data = any>(
256
+ specifier: string | URL,
257
+ parentURL?: string | URL,
230
258
  options?: RegisterOptions<Data>,
231
- ): ReturnType;
232
- static register<Data = any, ReturnType = any>(specifier: string, options?: RegisterOptions<Data>): ReturnType;
259
+ ): void;
260
+ static register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
233
261
  constructor(id: string, parent?: Module);
234
262
  }
235
263
  global {
node/ts4.8/net.d.ts CHANGED
@@ -234,6 +234,15 @@ declare module "net" {
234
234
  * @return The socket itself.
235
235
  */
236
236
  ref(): this;
237
+ /**
238
+ * This property is only present if the family autoselection algorithm is enabled in `socket.connect(options)`
239
+ * and it is an array of the addresses that have been attempted.
240
+ *
241
+ * Each address is a string in the form of `$IP:$PORT`.
242
+ * If the connection was successful, then the last address is the one that the socket is currently connected to.
243
+ * @since v19.4.0
244
+ */
245
+ readonly autoSelectFamilyAttemptedAddresses: string[];
237
246
  /**
238
247
  * This property shows the number of characters buffered for writing. The buffer
239
248
  * may contain strings whose length after encoding is not yet known. So this number
@@ -824,6 +833,28 @@ declare module "net" {
824
833
  function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
825
834
  function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
826
835
  function createConnection(path: string, connectionListener?: () => void): Socket;
836
+ /**
837
+ * Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`.
838
+ * The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided.
839
+ * @since v19.4.0
840
+ */
841
+ function getDefaultAutoSelectFamily(): boolean;
842
+ /**
843
+ * Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`.
844
+ * @since v19.4.0
845
+ */
846
+ function setDefaultAutoSelectFamily(value: boolean): void;
847
+ /**
848
+ * Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
849
+ * The initial default value is `250`.
850
+ * @since v19.8.0
851
+ */
852
+ function getDefaultAutoSelectFamilyAttemptTimeout(): number;
853
+ /**
854
+ * Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
855
+ * @since v19.8.0
856
+ */
857
+ function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void;
827
858
  /**
828
859
  * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
829
860
  * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
node/ts4.8/os.d.ts CHANGED
@@ -400,7 +400,7 @@ declare module "os" {
400
400
  const EOL: string;
401
401
  /**
402
402
  * Returns the operating system CPU architecture for which the Node.js binary was
403
- * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'s390'`, `'s390x'`, and `'x64'`.
403
+ * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`.
404
404
  *
405
405
  * The return value is equivalent to `process.arch`.
406
406
  * @since v0.5.0
@@ -77,6 +77,15 @@ declare module "stream/web" {
77
77
  type ReadableStreamDefaultReadResult<T> =
78
78
  | ReadableStreamDefaultReadValueResult<T>
79
79
  | ReadableStreamDefaultReadDoneResult;
80
+ interface ReadableStreamReadValueResult<T> {
81
+ done: false;
82
+ value: T;
83
+ }
84
+ interface ReadableStreamReadDoneResult<T> {
85
+ done: true;
86
+ value?: T;
87
+ }
88
+ type ReadableStreamReadResult<T> = ReadableStreamReadValueResult<T> | ReadableStreamReadDoneResult<T>;
80
89
  interface ReadableByteStreamControllerCallback {
81
90
  (controller: ReadableByteStreamController): void | PromiseLike<void>;
82
91
  }
@@ -138,6 +147,7 @@ declare module "stream/web" {
138
147
  readonly locked: boolean;
139
148
  cancel(reason?: any): Promise<void>;
140
149
  getReader(): ReadableStreamDefaultReader<R>;
150
+ getReader(options: { mode: "byob" }): ReadableStreamBYOBReader;
141
151
  pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
142
152
  pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
143
153
  tee(): [ReadableStream<R>, ReadableStream<R>];
@@ -153,6 +163,10 @@ declare module "stream/web" {
153
163
  read(): Promise<ReadableStreamDefaultReadResult<R>>;
154
164
  releaseLock(): void;
155
165
  }
166
+ interface ReadableStreamBYOBReader extends ReadableStreamGenericReader {
167
+ read<T extends ArrayBufferView>(view: T): Promise<ReadableStreamReadResult<T>>;
168
+ releaseLock(): void;
169
+ }
156
170
  const ReadableStreamDefaultReader: {
157
171
  prototype: ReadableStreamDefaultReader;
158
172
  new<R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R>;
node/ts4.8/stream.d.ts CHANGED
@@ -40,6 +40,12 @@ declare module "stream" {
40
40
  import Stream = internal.Stream;
41
41
  import Readable = internal.Readable;
42
42
  import ReadableOptions = internal.ReadableOptions;
43
+ interface ArrayOptions {
44
+ /** the maximum concurrent invocations of `fn` to call on the stream at once. **Default: 1**. */
45
+ concurrency?: number;
46
+ /** allows destroying the stream if the signal is aborted. */
47
+ signal?: AbortSignal;
48
+ }
43
49
  class ReadableBase extends Stream implements NodeJS.ReadableStream {
44
50
  /**
45
51
  * A utility method for creating Readable Streams out of iterators.
@@ -399,6 +405,164 @@ declare module "stream" {
399
405
  */
400
406
  wrap(stream: NodeJS.ReadableStream): this;
401
407
  push(chunk: any, encoding?: BufferEncoding): boolean;
408
+ /**
409
+ * The iterator created by this method gives users the option to cancel the destruction
410
+ * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`,
411
+ * or if the iterator should destroy the stream if the stream emitted an error during iteration.
412
+ * @since v16.3.0
413
+ * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator,
414
+ * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream.
415
+ * **Default: `true`**.
416
+ */
417
+ iterator(options?: { destroyOnReturn?: boolean }): AsyncIterableIterator<any>;
418
+ /**
419
+ * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream.
420
+ * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.
421
+ * @since v17.4.0, v16.14.0
422
+ * @param fn a function to map over every chunk in the stream. Async or not.
423
+ * @returns a stream mapped with the function *fn*.
424
+ */
425
+ map(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
426
+ /**
427
+ * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called
428
+ * and if it returns a truthy value, the chunk will be passed to the result stream.
429
+ * If the *fn* function returns a promise - that promise will be `await`ed.
430
+ * @since v17.4.0, v16.14.0
431
+ * @param fn a function to filter chunks from the stream. Async or not.
432
+ * @returns a stream filtered with the predicate *fn*.
433
+ */
434
+ filter(
435
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
436
+ options?: ArrayOptions,
437
+ ): Readable;
438
+ /**
439
+ * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called.
440
+ * If the *fn* function returns a promise - that promise will be `await`ed.
441
+ *
442
+ * This method is different from `for await...of` loops in that it can optionally process chunks concurrently.
443
+ * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option
444
+ * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`.
445
+ * In either case the stream will be destroyed.
446
+ *
447
+ * This method is different from listening to the `'data'` event in that it uses the `readable` event
448
+ * in the underlying machinary and can limit the number of concurrent *fn* calls.
449
+ * @since v17.5.0
450
+ * @param fn a function to call on each chunk of the stream. Async or not.
451
+ * @returns a promise for when the stream has finished.
452
+ */
453
+ forEach(
454
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => void | Promise<void>,
455
+ options?: ArrayOptions,
456
+ ): Promise<void>;
457
+ /**
458
+ * This method allows easily obtaining the contents of a stream.
459
+ *
460
+ * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended
461
+ * for interoperability and convenience, not as the primary way to consume streams.
462
+ * @since v17.5.0
463
+ * @returns a promise containing an array with the contents of the stream.
464
+ */
465
+ toArray(options?: Pick<ArrayOptions, "signal">): Promise<any[]>;
466
+ /**
467
+ * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream
468
+ * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk
469
+ * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`.
470
+ * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`.
471
+ * @since v17.5.0
472
+ * @param fn a function to call on each chunk of the stream. Async or not.
473
+ * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks.
474
+ */
475
+ some(
476
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
477
+ options?: ArrayOptions,
478
+ ): Promise<boolean>;
479
+ /**
480
+ * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream
481
+ * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy,
482
+ * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value.
483
+ * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`.
484
+ * @since v17.5.0
485
+ * @param fn a function to call on each chunk of the stream. Async or not.
486
+ * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value,
487
+ * or `undefined` if no element was found.
488
+ */
489
+ find<T>(
490
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => data is T,
491
+ options?: ArrayOptions,
492
+ ): Promise<T | undefined>;
493
+ find(
494
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
495
+ options?: ArrayOptions,
496
+ ): Promise<any>;
497
+ /**
498
+ * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream
499
+ * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk
500
+ * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`.
501
+ * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`.
502
+ * @since v17.5.0
503
+ * @param fn a function to call on each chunk of the stream. Async or not.
504
+ * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks.
505
+ */
506
+ every(
507
+ fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>,
508
+ options?: ArrayOptions,
509
+ ): Promise<boolean>;
510
+ /**
511
+ * This method returns a new stream by applying the given callback to each chunk of the stream
512
+ * and then flattening the result.
513
+ *
514
+ * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams
515
+ * will be merged (flattened) into the returned stream.
516
+ * @since v17.5.0
517
+ * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator.
518
+ * @returns a stream flat-mapped with the function *fn*.
519
+ */
520
+ flatMap(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
521
+ /**
522
+ * This method returns a new stream with the first *limit* chunks dropped from the start.
523
+ * @since v17.5.0
524
+ * @param limit the number of chunks to drop from the readable.
525
+ * @returns a stream with *limit* chunks dropped from the start.
526
+ */
527
+ drop(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
528
+ /**
529
+ * This method returns a new stream with the first *limit* chunks.
530
+ * @since v17.5.0
531
+ * @param limit the number of chunks to take from the readable.
532
+ * @returns a stream with *limit* chunks taken.
533
+ */
534
+ take(limit: number, options?: Pick<ArrayOptions, "signal">): Readable;
535
+ /**
536
+ * This method returns a new stream with chunks of the underlying stream paired with a counter
537
+ * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced.
538
+ * @since v17.5.0
539
+ * @returns a stream of indexed pairs.
540
+ */
541
+ asIndexedPairs(options?: Pick<ArrayOptions, "signal">): Readable;
542
+ /**
543
+ * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation
544
+ * on the previous element. It returns a promise for the final value of the reduction.
545
+ *
546
+ * If no *initial* value is supplied the first chunk of the stream is used as the initial value.
547
+ * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property.
548
+ *
549
+ * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter
550
+ * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method.
551
+ * @since v17.5.0
552
+ * @param fn a reducer function to call over every chunk in the stream. Async or not.
553
+ * @param initial the initial value to use in the reduction.
554
+ * @returns a promise for the final value of the reduction.
555
+ */
556
+ reduce<T = any>(
557
+ fn: (previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T,
558
+ initial?: undefined,
559
+ options?: Pick<ArrayOptions, "signal">,
560
+ ): Promise<T>;
561
+ reduce<T = any>(
562
+ fn: (previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T,
563
+ initial: T,
564
+ options?: Pick<ArrayOptions, "signal">,
565
+ ): Promise<T>;
402
566
  _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
403
567
  /**
404
568
  * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable
node/ts4.8/test.d.ts CHANGED
@@ -76,7 +76,7 @@
76
76
  *
77
77
  * If any tests fail, the process exit code is set to `1`.
78
78
  * @since v18.0.0, v16.17.0
79
- * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test.js)
79
+ * @see [source](https://github.com/nodejs/node/blob/v20.4.0/lib/test.js)
80
80
  */
81
81
  declare module "node:test" {
82
82
  import { Readable } from "node:stream";
@@ -84,7 +84,9 @@ declare module "node:test" {
84
84
  /**
85
85
  * ```js
86
86
  * import { tap } from 'node:test/reporters';
87
+ * import { run } from 'node:test';
87
88
  * import process from 'node:process';
89
+ * import path from 'node:path';
88
90
  *
89
91
  * run({ files: [path.resolve('./tests/test.js')] })
90
92
  * .compose(tap)
@@ -292,6 +294,10 @@ declare module "node:test" {
292
294
  * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run.
293
295
  */
294
296
  testNamePatterns?: string | RegExp | string[] | RegExp[];
297
+ /**
298
+ * If truthy, the test context will only run tests that have the `only` option set
299
+ */
300
+ only?: boolean;
295
301
  /**
296
302
  * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run.
297
303
  */
@@ -1146,7 +1152,22 @@ declare module "node:test" {
1146
1152
  */
1147
1153
  [Symbol.dispose](): void;
1148
1154
  }
1149
- export { after, afterEach, before, beforeEach, describe, it, mock, only, run, skip, test, test as default, todo, Mock };
1155
+ export {
1156
+ after,
1157
+ afterEach,
1158
+ before,
1159
+ beforeEach,
1160
+ describe,
1161
+ it,
1162
+ Mock,
1163
+ mock,
1164
+ only,
1165
+ run,
1166
+ skip,
1167
+ test,
1168
+ test as default,
1169
+ todo,
1170
+ };
1150
1171
  }
1151
1172
 
1152
1173
  interface TestLocationInfo {
@@ -1353,5 +1374,9 @@ declare module "node:test/reporters" {
1353
1374
  class Spec extends Transform {
1354
1375
  constructor();
1355
1376
  }
1356
- export { dot, Spec as spec, tap, TestEvent };
1377
+ /**
1378
+ * The `junit` reporter outputs test results in a jUnit XML format
1379
+ */
1380
+ function junit(source: TestEventGenerator): AsyncGenerator<string, void>;
1381
+ export { dot, Spec as spec, tap, junit, TestEvent };
1357
1382
  }
node/ts4.8/util.d.ts CHANGED
@@ -419,8 +419,14 @@ declare module "util" {
419
419
  * const bigNumber = 123_456_789n;
420
420
  * const bigDecimal = 1_234.123_45;
421
421
  *
422
- * console.log(thousand, million, bigNumber, bigDecimal);
423
- * // 1_000 1_000_000 123_456_789n 1_234.123_45
422
+ * console.log(inspect(thousand, { numericSeparator: true }));
423
+ * // 1_000
424
+ * console.log(inspect(million, { numericSeparator: true }));
425
+ * // 1_000_000
426
+ * console.log(inspect(bigNumber, { numericSeparator: true }));
427
+ * // 123_456_789n
428
+ * console.log(inspect(bigDecimal, { numericSeparator: true }));
429
+ * // 1_234.123_45
424
430
  * ```
425
431
  *
426
432
  * `util.inspect()` is a synchronous method intended for debugging. Its maximum
@@ -1087,6 +1093,8 @@ declare module "util" {
1087
1093
  * const stats = await stat('.');
1088
1094
  * console.log(`This directory is owned by ${stats.uid}`);
1089
1095
  * }
1096
+ *
1097
+ * callStat();
1090
1098
  * ```
1091
1099
  *
1092
1100
  * If there is an `original[util.promisify.custom]` property present, `promisify`will return its value, see `Custom promisified functions`.
@@ -1632,7 +1640,7 @@ declare module "util" {
1632
1640
  * params.set('foo', 'def');
1633
1641
  * params.set('baz', 'xyz');
1634
1642
  * console.log(params.toString());
1635
- * // Prints: foo=def&#x26;bar=1&#x26;baz=xyz
1643
+ * // Prints: foo=def;bar=1;baz=xyz
1636
1644
  * ```
1637
1645
  */
1638
1646
  set(name: string, value: string): void;
node/util.d.ts CHANGED
@@ -419,8 +419,14 @@ declare module "util" {
419
419
  * const bigNumber = 123_456_789n;
420
420
  * const bigDecimal = 1_234.123_45;
421
421
  *
422
- * console.log(thousand, million, bigNumber, bigDecimal);
423
- * // 1_000 1_000_000 123_456_789n 1_234.123_45
422
+ * console.log(inspect(thousand, { numericSeparator: true }));
423
+ * // 1_000
424
+ * console.log(inspect(million, { numericSeparator: true }));
425
+ * // 1_000_000
426
+ * console.log(inspect(bigNumber, { numericSeparator: true }));
427
+ * // 123_456_789n
428
+ * console.log(inspect(bigDecimal, { numericSeparator: true }));
429
+ * // 1_234.123_45
424
430
  * ```
425
431
  *
426
432
  * `util.inspect()` is a synchronous method intended for debugging. Its maximum
@@ -1087,6 +1093,8 @@ declare module "util" {
1087
1093
  * const stats = await stat('.');
1088
1094
  * console.log(`This directory is owned by ${stats.uid}`);
1089
1095
  * }
1096
+ *
1097
+ * callStat();
1090
1098
  * ```
1091
1099
  *
1092
1100
  * If there is an `original[util.promisify.custom]` property present, `promisify`will return its value, see `Custom promisified functions`.
@@ -1632,7 +1640,7 @@ declare module "util" {
1632
1640
  * params.set('foo', 'def');
1633
1641
  * params.set('baz', 'xyz');
1634
1642
  * console.log(params.toString());
1635
- * // Prints: foo=def&#x26;bar=1&#x26;baz=xyz
1643
+ * // Prints: foo=def;bar=1;baz=xyz
1636
1644
  * ```
1637
1645
  */
1638
1646
  set(name: string, value: string): void;