@types/node 18.17.10 → 18.17.11

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: Thu, 24 Aug 2023 22:03:17 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.11",
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": "2c7fab874e636c1fe036a027917b5774caaf6b5d1ecd18b0e9ea9355e359d769",
236
236
  "typeScriptVersion": "4.3"
237
237
  }
@@ -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 {
@@ -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
  /**