@types/node 20.5.1 → 20.5.3

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, 18 Aug 2023 18:02:55 GMT
11
+ * Last updated: Tue, 22 Aug 2023 18:04:28 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/inspector.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line dt-header
1
+ // eslint-disable-next-line @definitelytyped/dt-header
2
2
  // Type definitions for inspector
3
3
 
4
4
  // These definitions are auto-generated.
node/module.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  */
4
4
  declare module 'module' {
5
5
  import { URL } from 'node:url';
6
+ import { MessagePort } from 'node:worker_threads';
6
7
  namespace Module {
7
8
  /**
8
9
  * The `module.syncBuiltinESMExports()` method updates all the live bindings for
@@ -92,6 +93,101 @@ declare module 'module' {
92
93
  */
93
94
  findEntry(lineOffset: number, columnOffset: number): SourceMapping;
94
95
  }
96
+ type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
97
+ type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
98
+ interface GlobalPreloadContext {
99
+ port: MessagePort;
100
+ }
101
+ /**
102
+ * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
103
+ * This hook allows the return of a string that is run as a sloppy-mode script on startup.
104
+ *
105
+ * @param context Information to assist the preload code
106
+ * @return Code to run before application startup
107
+ */
108
+ type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
109
+ interface ResolveHookContext {
110
+ /**
111
+ * Export conditions of the relevant `package.json`
112
+ */
113
+ conditions: string[];
114
+ /**
115
+ * An object whose key-value pairs represent the assertions for the module to import
116
+ */
117
+ importAssertions: Object;
118
+ /**
119
+ * The module importing this one, or undefined if this is the Node.js entry point
120
+ */
121
+ parentURL: string | undefined;
122
+ }
123
+ interface ResolveFnOutput {
124
+ /**
125
+ * A hint to the load hook (it might be ignored)
126
+ */
127
+ format?: ModuleFormat | null | undefined;
128
+ /**
129
+ * The import assertions to use when caching the module (optional; if excluded the input will be used)
130
+ */
131
+ importAssertions?: Object | undefined;
132
+ /**
133
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
134
+ * @default false
135
+ */
136
+ shortCircuit?: boolean | undefined;
137
+ /**
138
+ * The absolute URL to which this input resolves
139
+ */
140
+ url: string;
141
+ }
142
+ /**
143
+ * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook.
144
+ * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`);
145
+ * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook.
146
+ *
147
+ * @param specifier The specified URL path of the module to be resolved
148
+ * @param context
149
+ * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
150
+ */
151
+ type ResolveHook = (
152
+ specifier: string,
153
+ context: ResolveHookContext,
154
+ nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput
155
+ ) => ResolveFnOutput | Promise<ResolveFnOutput>;
156
+ interface LoadHookContext {
157
+ /**
158
+ * Export conditions of the relevant `package.json`
159
+ */
160
+ conditions: string[];
161
+ /**
162
+ * The format optionally supplied by the `resolve` hook chain
163
+ */
164
+ format: ModuleFormat;
165
+ /**
166
+ * An object whose key-value pairs represent the assertions for the module to import
167
+ */
168
+ importAssertions: Object;
169
+ }
170
+ interface LoadFnOutput {
171
+ format: ModuleFormat;
172
+ /**
173
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
174
+ * @default false
175
+ */
176
+ shortCircuit?: boolean | undefined;
177
+ /**
178
+ * The source for Node.js to evaluate
179
+ */
180
+ source?: ModuleSource;
181
+ }
182
+ /**
183
+ * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
184
+ * It is also in charge of validating the import assertion.
185
+ *
186
+ * @param url The URL/path of the module to be loaded
187
+ * @param context Metadata about the module
188
+ * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
189
+ */
190
+ type LoadHook = (url: string, context: LoadHookContext, nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput) => LoadFnOutput | Promise<LoadFnOutput>;
95
191
  }
96
192
  interface Module extends NodeModule {}
97
193
  class Module {
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "20.5.1",
3
+ "version": "20.5.3",
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": "d0c2c116cfc5f834b73aab1d11cdb6f25f2efa45c6ac4b26899129b75cbfb0d1",
230
+ "typesPublisherContentHash": "5eb884dc632226cd7f318964baa50a3183b958bd8272cd1396227b1e4ec43ab2",
231
231
  "typeScriptVersion": "4.3"
232
232
  }
node/ts4.8/inspector.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- // eslint-disable-next-line dt-header
1
+ // eslint-disable-next-line @definitelytyped/dt-header
2
2
  // Type definitions for inspector
3
3
 
4
4
  // These definitions are auto-generated.
node/ts4.8/module.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  */
4
4
  declare module 'module' {
5
5
  import { URL } from 'node:url';
6
+ import { MessagePort } from 'node:worker_threads';
6
7
  namespace Module {
7
8
  /**
8
9
  * The `module.syncBuiltinESMExports()` method updates all the live bindings for
@@ -92,6 +93,101 @@ declare module 'module' {
92
93
  */
93
94
  findEntry(lineOffset: number, columnOffset: number): SourceMapping;
94
95
  }
96
+ type ModuleFormat = 'builtin' | 'commonjs' | 'json' | 'module' | 'wasm';
97
+ type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
98
+ interface GlobalPreloadContext {
99
+ port: MessagePort;
100
+ }
101
+ /**
102
+ * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
103
+ * This hook allows the return of a string that is run as a sloppy-mode script on startup.
104
+ *
105
+ * @param context Information to assist the preload code
106
+ * @return Code to run before application startup
107
+ */
108
+ type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
109
+ interface ResolveHookContext {
110
+ /**
111
+ * Export conditions of the relevant `package.json`
112
+ */
113
+ conditions: string[];
114
+ /**
115
+ * An object whose key-value pairs represent the assertions for the module to import
116
+ */
117
+ importAssertions: Object;
118
+ /**
119
+ * The module importing this one, or undefined if this is the Node.js entry point
120
+ */
121
+ parentURL: string | undefined;
122
+ }
123
+ interface ResolveFnOutput {
124
+ /**
125
+ * A hint to the load hook (it might be ignored)
126
+ */
127
+ format?: ModuleFormat | null | undefined;
128
+ /**
129
+ * The import assertions to use when caching the module (optional; if excluded the input will be used)
130
+ */
131
+ importAssertions?: Object | undefined;
132
+ /**
133
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
134
+ * @default false
135
+ */
136
+ shortCircuit?: boolean | undefined;
137
+ /**
138
+ * The absolute URL to which this input resolves
139
+ */
140
+ url: string;
141
+ }
142
+ /**
143
+ * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook.
144
+ * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`);
145
+ * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook.
146
+ *
147
+ * @param specifier The specified URL path of the module to be resolved
148
+ * @param context
149
+ * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
150
+ */
151
+ type ResolveHook = (
152
+ specifier: string,
153
+ context: ResolveHookContext,
154
+ nextResolve: (specifier: string, context?: ResolveHookContext) => ResolveFnOutput
155
+ ) => ResolveFnOutput | Promise<ResolveFnOutput>;
156
+ interface LoadHookContext {
157
+ /**
158
+ * Export conditions of the relevant `package.json`
159
+ */
160
+ conditions: string[];
161
+ /**
162
+ * The format optionally supplied by the `resolve` hook chain
163
+ */
164
+ format: ModuleFormat;
165
+ /**
166
+ * An object whose key-value pairs represent the assertions for the module to import
167
+ */
168
+ importAssertions: Object;
169
+ }
170
+ interface LoadFnOutput {
171
+ format: ModuleFormat;
172
+ /**
173
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
174
+ * @default false
175
+ */
176
+ shortCircuit?: boolean | undefined;
177
+ /**
178
+ * The source for Node.js to evaluate
179
+ */
180
+ source?: ModuleSource;
181
+ }
182
+ /**
183
+ * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
184
+ * It is also in charge of validating the import assertion.
185
+ *
186
+ * @param url The URL/path of the module to be loaded
187
+ * @param context Metadata about the module
188
+ * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
189
+ */
190
+ type LoadHook = (url: string, context: LoadHookContext, nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput) => LoadFnOutput | Promise<LoadFnOutput>;
95
191
  }
96
192
  interface Module extends NodeModule {}
97
193
  class Module {