@types/node 16.18.44 → 16.18.46

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 v16.18/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/v16.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Wed, 23 Aug 2023 21:03:08 GMT
11
+ * Last updated: Thu, 24 Aug 2023 22:03:19 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
node v16.18/module.d.ts CHANGED
@@ -79,6 +79,9 @@ declare module 'module' {
79
79
  */
80
80
  findEntry(line: number, column: number): SourceMapping;
81
81
  }
82
+ interface ImportAssertions extends NodeJS.Dict<string> {
83
+ type?: string | undefined;
84
+ }
82
85
  type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
83
86
  type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
84
87
  interface GlobalPreloadContext {
@@ -100,7 +103,7 @@ declare module 'module' {
100
103
  /**
101
104
  * An object whose key-value pairs represent the assertions for the module to import
102
105
  */
103
- importAssertions: Object;
106
+ importAssertions: ImportAssertions;
104
107
  /**
105
108
  * The module importing this one, or undefined if this is the Node.js entry point
106
109
  */
@@ -114,7 +117,7 @@ declare module 'module' {
114
117
  /**
115
118
  * The import assertions to use when caching the module (optional; if excluded the input will be used)
116
119
  */
117
- importAssertions?: Object | undefined;
120
+ importAssertions?: ImportAssertions | undefined;
118
121
  /**
119
122
  * A signal that this hook intends to terminate the chain of `resolve` hooks.
120
123
  * @default false
@@ -137,7 +140,7 @@ declare module 'module' {
137
140
  type ResolveHook = (
138
141
  specifier: string,
139
142
  context: ResolveHookContext,
140
- nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput
143
+ nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput | Promise<ResolveFnOutput>
141
144
  ) => ResolveFnOutput | Promise<ResolveFnOutput>;
142
145
  interface LoadHookContext {
143
146
  /**
@@ -151,7 +154,7 @@ declare module 'module' {
151
154
  /**
152
155
  * An object whose key-value pairs represent the assertions for the module to import
153
156
  */
154
- importAssertions: Object;
157
+ importAssertions: ImportAssertions;
155
158
  }
156
159
  interface LoadFnOutput {
157
160
  format: ModuleFormat;
@@ -173,7 +176,11 @@ declare module 'module' {
173
176
  * @param context Metadata about the module
174
177
  * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
175
178
  */
176
- type LoadHook = (url: string, context: LoadHookContext, nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput) => LoadFnOutput | Promise<LoadFnOutput>;
179
+ type LoadHook = (
180
+ url: string,
181
+ context: LoadHookContext,
182
+ nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>
183
+ ) => LoadFnOutput | Promise<LoadFnOutput>;
177
184
  }
178
185
  interface Module extends NodeModule {}
179
186
  class Module {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "16.18.44",
3
+ "version": "16.18.46",
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": "1789de9e33b185d930e4be32ff03fb9648a61edce6d3a8a422b1b9fb67c23b6c",
230
+ "typesPublisherContentHash": "8d5133d6e87c80c24e50b67a6edb678d3776cc8f8d61476c0a112958a9ec5629",
231
231
  "typeScriptVersion": "4.3"
232
232
  }
node v16.18/stream.d.ts CHANGED
@@ -45,6 +45,12 @@ declare module 'stream' {
45
45
  encoding?: BufferEncoding | undefined;
46
46
  read?(this: Readable, size: number): void;
47
47
  }
48
+ interface ArrayOptions {
49
+ /** the maximum concurrent invocations of `fn` to call on the stream at once. **Default: 1**. */
50
+ concurrency?: number;
51
+ /** allows destroying the stream if the signal is aborted. */
52
+ signal?: AbortSignal;
53
+ }
48
54
  /**
49
55
  * @since v0.9.4
50
56
  */
@@ -397,6 +403,33 @@ declare module 'stream' {
397
403
  */
398
404
  wrap(stream: NodeJS.ReadableStream): this;
399
405
  push(chunk: any, encoding?: BufferEncoding): boolean;
406
+ /**
407
+ * The iterator created by this method gives users the option to cancel the destruction
408
+ * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`,
409
+ * or if the iterator should destroy the stream if the stream emitted an error during iteration.
410
+ * @since v16.3.0
411
+ * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator,
412
+ * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream.
413
+ * **Default: `true`**.
414
+ */
415
+ iterator(options?: {destroyOnReturn?: boolean}): AsyncIterableIterator<any>;
416
+ /**
417
+ * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream.
418
+ * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream.
419
+ * @since v17.4.0, v16.14.0
420
+ * @param fn a function to map over every chunk in the stream. Async or not.
421
+ * @returns a stream mapped with the function *fn*.
422
+ */
423
+ map(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => any, options?: ArrayOptions): Readable;
424
+ /**
425
+ * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called
426
+ * and if it returns a truthy value, the chunk will be passed to the result stream.
427
+ * If the *fn* function returns a promise - that promise will be `await`ed.
428
+ * @since v17.4.0, v16.14.0
429
+ * @param fn a function to filter chunks from the stream. Async or not.
430
+ * @returns a stream filtered with the predicate *fn*.
431
+ */
432
+ filter(fn: (data: any, options?: Pick<ArrayOptions, "signal">) => boolean | Promise<boolean>, options?: ArrayOptions): Readable;
400
433
  _destroy(error: Error | null, callback: (error?: Error | null) => void): void;
401
434
  /**
402
435
  * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable
@@ -79,6 +79,9 @@ declare module 'module' {
79
79
  */
80
80
  findEntry(line: number, column: number): SourceMapping;
81
81
  }
82
+ interface ImportAssertions extends NodeJS.Dict<string> {
83
+ type?: string | undefined;
84
+ }
82
85
  type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
83
86
  type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
84
87
  interface GlobalPreloadContext {
@@ -100,7 +103,7 @@ declare module 'module' {
100
103
  /**
101
104
  * An object whose key-value pairs represent the assertions for the module to import
102
105
  */
103
- importAssertions: Object;
106
+ importAssertions: ImportAssertions;
104
107
  /**
105
108
  * The module importing this one, or undefined if this is the Node.js entry point
106
109
  */
@@ -114,7 +117,7 @@ declare module 'module' {
114
117
  /**
115
118
  * The import assertions to use when caching the module (optional; if excluded the input will be used)
116
119
  */
117
- importAssertions?: Object | undefined;
120
+ importAssertions?: ImportAssertions | undefined;
118
121
  /**
119
122
  * A signal that this hook intends to terminate the chain of `resolve` hooks.
120
123
  * @default false
@@ -137,7 +140,7 @@ declare module 'module' {
137
140
  type ResolveHook = (
138
141
  specifier: string,
139
142
  context: ResolveHookContext,
140
- nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput
143
+ nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput | Promise<ResolveFnOutput>
141
144
  ) => ResolveFnOutput | Promise<ResolveFnOutput>;
142
145
  interface LoadHookContext {
143
146
  /**
@@ -151,7 +154,7 @@ declare module 'module' {
151
154
  /**
152
155
  * An object whose key-value pairs represent the assertions for the module to import
153
156
  */
154
- importAssertions: Object;
157
+ importAssertions: ImportAssertions;
155
158
  }
156
159
  interface LoadFnOutput {
157
160
  format: ModuleFormat;
@@ -173,7 +176,11 @@ declare module 'module' {
173
176
  * @param context Metadata about the module
174
177
  * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
175
178
  */
176
- type LoadHook = (url: string, context: LoadHookContext, nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput) => LoadFnOutput | Promise<LoadFnOutput>;
179
+ type LoadHook = (
180
+ url: string,
181
+ context: LoadHookContext,
182
+ nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>
183
+ ) => LoadFnOutput | Promise<LoadFnOutput>;
177
184
  }
178
185
  interface Module extends NodeModule {}
179
186
  class Module {