@types/node 18.17.10 → 18.17.12

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 v18.17/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/v18.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Thu, 24 Aug 2023 21:33:09 GMT
11
+ * Last updated: Mon, 28 Aug 2023 00:33:01 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node v18.17/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": "18.17.10",
3
+ "version": "18.17.12",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -232,6 +232,6 @@
232
232
  },
233
233
  "scripts": {},
234
234
  "dependencies": {},
235
- "typesPublisherContentHash": "e7d4c795a67a90f21fdfacae6ed2b4127ad04555d1acd5c2340fc8621582a606",
235
+ "typesPublisherContentHash": "42b2e48cacb4776d62b695deffaffacdaf029bcaa951a0a2ff1cbec3e8b7e01f",
236
236
  "typeScriptVersion": "4.3"
237
237
  }
node v18.17/test.d.ts CHANGED
@@ -167,9 +167,8 @@ declare module 'node:test' {
167
167
 
168
168
  /**
169
169
  * The type of a function under Suite.
170
- * If the test uses callbacks, the callback function is passed as an argument
171
170
  */
172
- type SuiteFn = (done: (result?: any) => void) => void;
171
+ type SuiteFn = (s: SuiteContext) => void | Promise<void>;
173
172
 
174
173
  interface RunOptions {
175
174
  /**
@@ -386,6 +385,24 @@ declare module 'node:test' {
386
385
  readonly mock: MockTracker;
387
386
  }
388
387
 
388
+ /**
389
+ * An instance of `SuiteContext` is passed to each suite function in order to
390
+ * interact with the test runner. However, the `SuiteContext` constructor is not
391
+ * exposed as part of the API.
392
+ * @since v18.7.0, v16.17.0
393
+ */
394
+ class SuiteContext {
395
+ /**
396
+ * The name of the suite.
397
+ * @since v18.8.0, v16.18.0
398
+ */
399
+ readonly name: string;
400
+ /**
401
+ * Can be used to abort test subtasks when the test has been aborted.
402
+ * @since v18.7.0, v16.17.0
403
+ */
404
+ readonly signal: AbortSignal;
405
+ }
389
406
  interface TestOptions {
390
407
  /**
391
408
  * If a number is provided, then that many tests would run in parallel.
@@ -473,7 +490,7 @@ declare module 'node:test' {
473
490
  * The hook function. If the hook uses callbacks, the callback function is passed as the
474
491
  * second argument.
475
492
  */
476
- type HookFn = (done: (result?: any) => void) => any;
493
+ type HookFn = (s: SuiteContext, done: (result?: any) => void) => any;
477
494
 
478
495
  /**
479
496
  * Configuration options for hooks.
@@ -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 {
@@ -166,9 +166,8 @@ declare module 'node:test' {
166
166
 
167
167
  /**
168
168
  * The type of a function under Suite.
169
- * If the test uses callbacks, the callback function is passed as an argument
170
169
  */
171
- type SuiteFn = (done: (result?: any) => void) => void;
170
+ type SuiteFn = (s: SuiteContext) => void | Promise<void>;
172
171
 
173
172
  interface RunOptions {
174
173
  /**
@@ -372,6 +371,24 @@ declare module 'node:test' {
372
371
  readonly mock: MockTracker;
373
372
  }
374
373
 
374
+ /**
375
+ * An instance of `SuiteContext` is passed to each suite function in order to
376
+ * interact with the test runner. However, the `SuiteContext` constructor is not
377
+ * exposed as part of the API.
378
+ * @since v18.7.0, v16.17.0
379
+ */
380
+ class SuiteContext {
381
+ /**
382
+ * The name of the suite.
383
+ * @since v18.8.0, v16.18.0
384
+ */
385
+ readonly name: string;
386
+ /**
387
+ * Can be used to abort test subtasks when the test has been aborted.
388
+ * @since v18.7.0, v16.17.0
389
+ */
390
+ readonly signal: AbortSignal;
391
+ }
375
392
  interface TestOptions {
376
393
  /**
377
394
  * If a number is provided, then that many tests would run in parallel.
@@ -459,7 +476,7 @@ declare module 'node:test' {
459
476
  * The hook function. If the hook uses callbacks, the callback function is passed as the
460
477
  * second argument.
461
478
  */
462
- type HookFn = (done: (result?: any) => void) => any;
479
+ type HookFn = (s: SuiteContext, done: (result?: any) => void) => any;
463
480
 
464
481
  /**
465
482
  * Configuration options for hooks.
@@ -37,6 +37,7 @@
37
37
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/vm.js)
38
38
  */
39
39
  declare module 'vm' {
40
+ import { ImportAssertions } from 'node:module';
40
41
  interface Context extends NodeJS.Dict<any> {}
41
42
  interface BaseOptions {
42
43
  /**
@@ -66,7 +67,7 @@ declare module 'vm' {
66
67
  * Called during evaluation of this module when `import()` is called.
67
68
  * If this option is not specified, calls to `import()` will reject with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`.
68
69
  */
69
- importModuleDynamically?: ((specifier: string, script: Script, importAssertions: Object) => Module) | undefined;
70
+ importModuleDynamically?: ((specifier: string, script: Script, importAssertions: ImportAssertions) => Module) | undefined;
70
71
  }
71
72
  interface RunningScriptOptions extends BaseOptions {
72
73
  /**
node v18.17/vm.d.ts CHANGED
@@ -37,6 +37,7 @@
37
37
  * @see [source](https://github.com/nodejs/node/blob/v18.0.0/lib/vm.js)
38
38
  */
39
39
  declare module 'vm' {
40
+ import { ImportAssertions } from 'node:module';
40
41
  interface Context extends NodeJS.Dict<any> {}
41
42
  interface BaseOptions {
42
43
  /**
@@ -66,7 +67,7 @@ declare module 'vm' {
66
67
  * Called during evaluation of this module when `import()` is called.
67
68
  * If this option is not specified, calls to `import()` will reject with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`.
68
69
  */
69
- importModuleDynamically?: ((specifier: string, script: Script, importAssertions: Object) => Module) | undefined;
70
+ importModuleDynamically?: ((specifier: string, script: Script, importAssertions: ImportAssertions) => Module) | undefined;
70
71
  }
71
72
  interface RunningScriptOptions extends BaseOptions {
72
73
  /**