@types/node 20.17.15 → 20.17.17
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 v20.17/README.md +1 -1
- node v20.17/fs/promises.d.ts +2 -2
- node v20.17/globals.d.ts +0 -57
- node v20.17/module.d.ts +361 -137
- node v20.17/package.json +2 -2
node v20.17/README.md
CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|
8
8
|
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v20.
|
9
9
|
|
10
10
|
### Additional Details
|
11
|
-
* Last updated:
|
11
|
+
* Last updated: Tue, 04 Feb 2025 00:04:06 GMT
|
12
12
|
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
13
13
|
|
14
14
|
# Credits
|
node v20.17/fs/promises.d.ts
CHANGED
@@ -109,7 +109,7 @@ declare module "fs/promises" {
|
|
109
109
|
appendFile(
|
110
110
|
data: string | Uint8Array,
|
111
111
|
options?:
|
112
|
-
| (ObjectEncodingOptions &
|
112
|
+
| (ObjectEncodingOptions & Abortable)
|
113
113
|
| BufferEncoding
|
114
114
|
| null,
|
115
115
|
): Promise<void>;
|
@@ -395,7 +395,7 @@ declare module "fs/promises" {
|
|
395
395
|
writeFile(
|
396
396
|
data: string | Uint8Array,
|
397
397
|
options?:
|
398
|
-
| (ObjectEncodingOptions &
|
398
|
+
| (ObjectEncodingOptions & Abortable)
|
399
399
|
| BufferEncoding
|
400
400
|
| null,
|
401
401
|
): Promise<void>;
|
node v20.17/globals.d.ts
CHANGED
@@ -106,25 +106,11 @@ declare global {
|
|
106
106
|
* *
|
107
107
|
------------------------------------------------*/
|
108
108
|
|
109
|
-
// For backwards compability
|
110
|
-
interface NodeRequire extends NodeJS.Require {}
|
111
|
-
interface RequireResolve extends NodeJS.RequireResolve {}
|
112
|
-
interface NodeModule extends NodeJS.Module {}
|
113
|
-
|
114
109
|
var global: typeof globalThis;
|
115
110
|
|
116
111
|
var process: NodeJS.Process;
|
117
112
|
var console: Console;
|
118
113
|
|
119
|
-
var __filename: string;
|
120
|
-
var __dirname: string;
|
121
|
-
|
122
|
-
var require: NodeRequire;
|
123
|
-
var module: NodeModule;
|
124
|
-
|
125
|
-
// Same as module.exports
|
126
|
-
var exports: any;
|
127
|
-
|
128
114
|
interface GCFunction {
|
129
115
|
(options: {
|
130
116
|
execution?: "sync";
|
@@ -355,49 +341,6 @@ declare global {
|
|
355
341
|
unref(): this;
|
356
342
|
}
|
357
343
|
|
358
|
-
interface Require {
|
359
|
-
(id: string): any;
|
360
|
-
resolve: RequireResolve;
|
361
|
-
cache: Dict<NodeModule>;
|
362
|
-
/**
|
363
|
-
* @deprecated
|
364
|
-
*/
|
365
|
-
extensions: RequireExtensions;
|
366
|
-
main: Module | undefined;
|
367
|
-
}
|
368
|
-
|
369
|
-
interface RequireResolve {
|
370
|
-
(id: string, options?: { paths?: string[] | undefined }): string;
|
371
|
-
paths(request: string): string[] | null;
|
372
|
-
}
|
373
|
-
|
374
|
-
interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
|
375
|
-
".js": (m: Module, filename: string) => any;
|
376
|
-
".json": (m: Module, filename: string) => any;
|
377
|
-
".node": (m: Module, filename: string) => any;
|
378
|
-
}
|
379
|
-
interface Module {
|
380
|
-
/**
|
381
|
-
* `true` if the module is running during the Node.js preload
|
382
|
-
*/
|
383
|
-
isPreloading: boolean;
|
384
|
-
exports: any;
|
385
|
-
require: Require;
|
386
|
-
id: string;
|
387
|
-
filename: string;
|
388
|
-
loaded: boolean;
|
389
|
-
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
|
390
|
-
parent: Module | null | undefined;
|
391
|
-
children: Module[];
|
392
|
-
/**
|
393
|
-
* @since v11.14.0
|
394
|
-
*
|
395
|
-
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
396
|
-
*/
|
397
|
-
path: string;
|
398
|
-
paths: string[];
|
399
|
-
}
|
400
|
-
|
401
344
|
interface Dict<T> {
|
402
345
|
[key: string]: T | undefined;
|
403
346
|
}
|
node v20.17/module.d.ts
CHANGED
@@ -1,11 +1,74 @@
|
|
1
1
|
/**
|
2
2
|
* @since v0.3.7
|
3
|
-
* @experimental
|
4
3
|
*/
|
5
4
|
declare module "module" {
|
6
5
|
import { URL } from "node:url";
|
7
6
|
import { MessagePort } from "node:worker_threads";
|
7
|
+
class Module {
|
8
|
+
constructor(id: string, parent?: Module);
|
9
|
+
}
|
10
|
+
interface Module extends NodeJS.Module {}
|
8
11
|
namespace Module {
|
12
|
+
export { Module };
|
13
|
+
}
|
14
|
+
namespace Module {
|
15
|
+
/**
|
16
|
+
* A list of the names of all modules provided by Node.js. Can be used to verify
|
17
|
+
* if a module is maintained by a third party or not.
|
18
|
+
*
|
19
|
+
* Note: the list doesn't contain prefix-only modules like `node:test`.
|
20
|
+
* @since v9.3.0, v8.10.0, v6.13.0
|
21
|
+
*/
|
22
|
+
const builtinModules: readonly string[];
|
23
|
+
/**
|
24
|
+
* @since v12.2.0
|
25
|
+
* @param path Filename to be used to construct the require
|
26
|
+
* function. Must be a file URL object, file URL string, or absolute path
|
27
|
+
* string.
|
28
|
+
*/
|
29
|
+
function createRequire(path: string | URL): NodeJS.Require;
|
30
|
+
/**
|
31
|
+
* @since v18.6.0, v16.17.0
|
32
|
+
*/
|
33
|
+
function isBuiltin(moduleName: string): boolean;
|
34
|
+
interface RegisterOptions<Data> {
|
35
|
+
/**
|
36
|
+
* If you want to resolve `specifier` relative to a
|
37
|
+
* base URL, such as `import.meta.url`, you can pass that URL here. This
|
38
|
+
* property is ignored if the `parentURL` is supplied as the second argument.
|
39
|
+
* @default 'data:'
|
40
|
+
*/
|
41
|
+
parentURL?: string | URL | undefined;
|
42
|
+
/**
|
43
|
+
* Any arbitrary, cloneable JavaScript value to pass into the
|
44
|
+
* {@link initialize} hook.
|
45
|
+
*/
|
46
|
+
data?: Data | undefined;
|
47
|
+
/**
|
48
|
+
* [Transferable objects](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html#portpostmessagevalue-transferlist)
|
49
|
+
* to be passed into the `initialize` hook.
|
50
|
+
*/
|
51
|
+
transferList?: any[] | undefined;
|
52
|
+
}
|
53
|
+
/* eslint-disable @definitelytyped/no-unnecessary-generics */
|
54
|
+
/**
|
55
|
+
* Register a module that exports hooks that customize Node.js module
|
56
|
+
* resolution and loading behavior. See
|
57
|
+
* [Customization hooks](https://nodejs.org/docs/latest-v20.x/api/module.html#customization-hooks).
|
58
|
+
* @since v20.6.0, v18.19.0
|
59
|
+
* @param specifier Customization hooks to be registered; this should be
|
60
|
+
* the same string that would be passed to `import()`, except that if it is
|
61
|
+
* relative, it is resolved relative to `parentURL`.
|
62
|
+
* @param parentURL f you want to resolve `specifier` relative to a base
|
63
|
+
* URL, such as `import.meta.url`, you can pass that URL here.
|
64
|
+
*/
|
65
|
+
function register<Data = any>(
|
66
|
+
specifier: string | URL,
|
67
|
+
parentURL?: string | URL,
|
68
|
+
options?: RegisterOptions<Data>,
|
69
|
+
): void;
|
70
|
+
function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
|
71
|
+
/* eslint-enable @definitelytyped/no-unnecessary-generics */
|
9
72
|
/**
|
10
73
|
* The `module.syncBuiltinESMExports()` method updates all the live bindings for
|
11
74
|
* builtin `ES Modules` to match the properties of the `CommonJS` exports. It
|
@@ -42,86 +105,6 @@ declare module "module" {
|
|
42
105
|
* @since v12.12.0
|
43
106
|
*/
|
44
107
|
function syncBuiltinESMExports(): void;
|
45
|
-
/**
|
46
|
-
* `path` is the resolved path for the file for which a corresponding source map
|
47
|
-
* should be fetched.
|
48
|
-
* @since v13.7.0, v12.17.0
|
49
|
-
* @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
|
50
|
-
*/
|
51
|
-
function findSourceMap(path: string, error?: Error): SourceMap | undefined;
|
52
|
-
interface SourceMapPayload {
|
53
|
-
file: string;
|
54
|
-
version: number;
|
55
|
-
sources: string[];
|
56
|
-
sourcesContent: string[];
|
57
|
-
names: string[];
|
58
|
-
mappings: string;
|
59
|
-
sourceRoot: string;
|
60
|
-
}
|
61
|
-
interface SourceMapping {
|
62
|
-
generatedLine: number;
|
63
|
-
generatedColumn: number;
|
64
|
-
originalSource: string;
|
65
|
-
originalLine: number;
|
66
|
-
originalColumn: number;
|
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
|
-
}
|
86
|
-
/**
|
87
|
-
* @since v13.7.0, v12.17.0
|
88
|
-
*/
|
89
|
-
class SourceMap {
|
90
|
-
/**
|
91
|
-
* Getter for the payload used to construct the `SourceMap` instance.
|
92
|
-
*/
|
93
|
-
readonly payload: SourceMapPayload;
|
94
|
-
constructor(payload: SourceMapPayload);
|
95
|
-
/**
|
96
|
-
* Given a line offset and column offset in the generated source
|
97
|
-
* file, returns an object representing the SourceMap range in the
|
98
|
-
* original file if found, or an empty object if not.
|
99
|
-
*
|
100
|
-
* The object returned contains the following keys:
|
101
|
-
*
|
102
|
-
* The returned value represents the raw range as it appears in the
|
103
|
-
* SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and
|
104
|
-
* column numbers as they appear in Error messages and CallSite
|
105
|
-
* objects.
|
106
|
-
*
|
107
|
-
* To get the corresponding 1-indexed line and column numbers from a
|
108
|
-
* lineNumber and columnNumber as they are reported by Error stacks
|
109
|
-
* and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)`
|
110
|
-
* @param lineOffset The zero-indexed line number offset in the generated source
|
111
|
-
* @param columnOffset The zero-indexed column number offset in the generated source
|
112
|
-
*/
|
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 | {};
|
124
|
-
}
|
125
108
|
/** @deprecated Use `ImportAttributes` instead */
|
126
109
|
interface ImportAssertions extends ImportAttributes {}
|
127
110
|
interface ImportAttributes extends NodeJS.Dict<string> {
|
@@ -129,26 +112,15 @@ declare module "module" {
|
|
129
112
|
}
|
130
113
|
type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm";
|
131
114
|
type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
|
132
|
-
interface GlobalPreloadContext {
|
133
|
-
port: MessagePort;
|
134
|
-
}
|
135
|
-
/**
|
136
|
-
* @deprecated This hook will be removed in a future version.
|
137
|
-
* Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored.
|
138
|
-
*
|
139
|
-
* Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
|
140
|
-
* This hook allows the return of a string that is run as a sloppy-mode script on startup.
|
141
|
-
*
|
142
|
-
* @param context Information to assist the preload code
|
143
|
-
* @return Code to run before application startup
|
144
|
-
*/
|
145
|
-
type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
|
146
115
|
/**
|
147
|
-
* The `initialize` hook provides a way to define a custom function that runs in
|
148
|
-
*
|
116
|
+
* The `initialize` hook provides a way to define a custom function that runs in
|
117
|
+
* the hooks thread when the hooks module is initialized. Initialization happens
|
118
|
+
* when the hooks module is registered via {@link register}.
|
149
119
|
*
|
150
|
-
* This hook can receive data from a
|
151
|
-
* The return value of `initialize` can be a
|
120
|
+
* This hook can receive data from a {@link register} invocation, including
|
121
|
+
* ports and other transferable objects. The return value of `initialize` can be a
|
122
|
+
* `Promise`, in which case it will be awaited before the main application thread
|
123
|
+
* execution resumes.
|
152
124
|
*/
|
153
125
|
type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
|
154
126
|
interface ResolveHookContext {
|
@@ -193,20 +165,20 @@ declare module "module" {
|
|
193
165
|
url: string;
|
194
166
|
}
|
195
167
|
/**
|
196
|
-
* The `resolve` hook chain is responsible for
|
197
|
-
*
|
198
|
-
*
|
199
|
-
*
|
200
|
-
*
|
201
|
-
*
|
202
|
-
*
|
168
|
+
* The `resolve` hook chain is responsible for telling Node.js where to find and
|
169
|
+
* how to cache a given `import` statement or expression, or `require` call. It can
|
170
|
+
* optionally return a format (such as `'module'`) as a hint to the `load` hook. If
|
171
|
+
* a format is specified, the `load` hook is ultimately responsible for providing
|
172
|
+
* the final `format` value (and it is free to ignore the hint provided by
|
173
|
+
* `resolve`); if `resolve` provides a `format`, a custom `load` hook is required
|
174
|
+
* even if only to pass the value to the Node.js default `load` hook.
|
203
175
|
*/
|
204
176
|
type ResolveHook = (
|
205
177
|
specifier: string,
|
206
178
|
context: ResolveHookContext,
|
207
179
|
nextResolve: (
|
208
180
|
specifier: string,
|
209
|
-
context?: ResolveHookContext
|
181
|
+
context?: Partial<ResolveHookContext>,
|
210
182
|
) => ResolveFnOutput | Promise<ResolveFnOutput>,
|
211
183
|
) => ResolveFnOutput | Promise<ResolveFnOutput>;
|
212
184
|
interface LoadHookContext {
|
@@ -217,7 +189,7 @@ declare module "module" {
|
|
217
189
|
/**
|
218
190
|
* The format optionally supplied by the `resolve` hook chain
|
219
191
|
*/
|
220
|
-
format: ModuleFormat;
|
192
|
+
format: ModuleFormat | null | undefined;
|
221
193
|
/**
|
222
194
|
* @deprecated Use `importAttributes` instead
|
223
195
|
*/
|
@@ -237,42 +209,121 @@ declare module "module" {
|
|
237
209
|
/**
|
238
210
|
* The source for Node.js to evaluate
|
239
211
|
*/
|
240
|
-
source?: ModuleSource;
|
212
|
+
source?: ModuleSource | undefined;
|
241
213
|
}
|
242
214
|
/**
|
243
|
-
* The `load` hook provides a way to define a custom method of determining how a
|
244
|
-
* It is also in charge of
|
245
|
-
*
|
246
|
-
* @param url The URL/path of the module to be loaded
|
247
|
-
* @param context Metadata about the module
|
248
|
-
* @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
|
215
|
+
* The `load` hook provides a way to define a custom method of determining how a
|
216
|
+
* URL should be interpreted, retrieved, and parsed. It is also in charge of
|
217
|
+
* validating the import attributes.
|
249
218
|
*/
|
250
219
|
type LoadHook = (
|
251
220
|
url: string,
|
252
221
|
context: LoadHookContext,
|
253
|
-
nextLoad: (
|
222
|
+
nextLoad: (
|
223
|
+
url: string,
|
224
|
+
context?: Partial<LoadHookContext>,
|
225
|
+
) => LoadFnOutput | Promise<LoadFnOutput>,
|
254
226
|
) => LoadFnOutput | Promise<LoadFnOutput>;
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
):
|
274
|
-
|
275
|
-
|
227
|
+
interface GlobalPreloadContext {
|
228
|
+
port: MessagePort;
|
229
|
+
}
|
230
|
+
/**
|
231
|
+
* Sometimes it might be necessary to run some code inside of the same global
|
232
|
+
* scope that the application runs in. This hook allows the return of a string
|
233
|
+
* that is run as a sloppy-mode script on startup.
|
234
|
+
* @deprecated This hook will be removed in a future version. Use
|
235
|
+
* `initialize` instead. When a hooks module has an `initialize` export,
|
236
|
+
* `globalPreload` will be ignored.
|
237
|
+
*/
|
238
|
+
type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
|
239
|
+
/**
|
240
|
+
* `path` is the resolved path for the file for which a corresponding source map
|
241
|
+
* should be fetched.
|
242
|
+
* @since v13.7.0, v12.17.0
|
243
|
+
* @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
|
244
|
+
*/
|
245
|
+
function findSourceMap(path: string): SourceMap | undefined;
|
246
|
+
interface SourceMapConstructorOptions {
|
247
|
+
/**
|
248
|
+
* @since v20.5.0
|
249
|
+
*/
|
250
|
+
lineLengths?: readonly number[] | undefined;
|
251
|
+
}
|
252
|
+
interface SourceMapPayload {
|
253
|
+
file: string;
|
254
|
+
version: number;
|
255
|
+
sources: string[];
|
256
|
+
sourcesContent: string[];
|
257
|
+
names: string[];
|
258
|
+
mappings: string;
|
259
|
+
sourceRoot: string;
|
260
|
+
}
|
261
|
+
interface SourceMapping {
|
262
|
+
generatedLine: number;
|
263
|
+
generatedColumn: number;
|
264
|
+
originalSource: string;
|
265
|
+
originalLine: number;
|
266
|
+
originalColumn: number;
|
267
|
+
}
|
268
|
+
interface SourceOrigin {
|
269
|
+
/**
|
270
|
+
* The name of the range in the source map, if one was provided
|
271
|
+
*/
|
272
|
+
name: string | undefined;
|
273
|
+
/**
|
274
|
+
* The file name of the original source, as reported in the SourceMap
|
275
|
+
*/
|
276
|
+
fileName: string;
|
277
|
+
/**
|
278
|
+
* The 1-indexed lineNumber of the corresponding call site in the original source
|
279
|
+
*/
|
280
|
+
lineNumber: number;
|
281
|
+
/**
|
282
|
+
* The 1-indexed columnNumber of the corresponding call site in the original source
|
283
|
+
*/
|
284
|
+
columnNumber: number;
|
285
|
+
}
|
286
|
+
/**
|
287
|
+
* @since v13.7.0, v12.17.0
|
288
|
+
*/
|
289
|
+
class SourceMap {
|
290
|
+
constructor(payload: SourceMapPayload, options?: SourceMapConstructorOptions);
|
291
|
+
/**
|
292
|
+
* Getter for the payload used to construct the `SourceMap` instance.
|
293
|
+
*/
|
294
|
+
readonly payload: SourceMapPayload;
|
295
|
+
/**
|
296
|
+
* Given a line offset and column offset in the generated source
|
297
|
+
* file, returns an object representing the SourceMap range in the
|
298
|
+
* original file if found, or an empty object if not.
|
299
|
+
*
|
300
|
+
* The object returned contains the following keys:
|
301
|
+
*
|
302
|
+
* The returned value represents the raw range as it appears in the
|
303
|
+
* SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and
|
304
|
+
* column numbers as they appear in Error messages and CallSite
|
305
|
+
* objects.
|
306
|
+
*
|
307
|
+
* To get the corresponding 1-indexed line and column numbers from a
|
308
|
+
* lineNumber and columnNumber as they are reported by Error stacks
|
309
|
+
* and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)`
|
310
|
+
* @param lineOffset The zero-indexed line number offset in the generated source
|
311
|
+
* @param columnOffset The zero-indexed column number offset in the generated source
|
312
|
+
*/
|
313
|
+
findEntry(lineOffset: number, columnOffset: number): SourceMapping | {};
|
314
|
+
/**
|
315
|
+
* Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source,
|
316
|
+
* find the corresponding call site location in the original source.
|
317
|
+
*
|
318
|
+
* If the `lineNumber` and `columnNumber` provided are not found in any source map,
|
319
|
+
* then an empty object is returned.
|
320
|
+
* @param lineNumber The 1-indexed line number of the call site in the generated source
|
321
|
+
* @param columnNumber The 1-indexed column number of the call site in the generated source
|
322
|
+
*/
|
323
|
+
findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {};
|
324
|
+
}
|
325
|
+
function runMain(main?: string): void;
|
326
|
+
function wrap(script: string): string;
|
276
327
|
}
|
277
328
|
global {
|
278
329
|
interface ImportMeta {
|
@@ -306,6 +357,179 @@ declare module "module" {
|
|
306
357
|
*/
|
307
358
|
resolve(specifier: string, parent?: string | URL | undefined): string;
|
308
359
|
}
|
360
|
+
namespace NodeJS {
|
361
|
+
interface Module {
|
362
|
+
/**
|
363
|
+
* The module objects required for the first time by this one.
|
364
|
+
* @since v0.1.16
|
365
|
+
*/
|
366
|
+
children: Module[];
|
367
|
+
/**
|
368
|
+
* The `module.exports` object is created by the `Module` system. Sometimes this is
|
369
|
+
* not acceptable; many want their module to be an instance of some class. To do
|
370
|
+
* this, assign the desired export object to `module.exports`.
|
371
|
+
* @since v0.1.16
|
372
|
+
*/
|
373
|
+
exports: any;
|
374
|
+
/**
|
375
|
+
* The fully resolved filename of the module.
|
376
|
+
* @since v0.1.16
|
377
|
+
*/
|
378
|
+
filename: string;
|
379
|
+
/**
|
380
|
+
* The identifier for the module. Typically this is the fully resolved
|
381
|
+
* filename.
|
382
|
+
* @since v0.1.16
|
383
|
+
*/
|
384
|
+
id: string;
|
385
|
+
/**
|
386
|
+
* `true` if the module is running during the Node.js preload
|
387
|
+
* phase.
|
388
|
+
* @since v15.4.0, v14.17.0
|
389
|
+
*/
|
390
|
+
isPreloading: boolean;
|
391
|
+
/**
|
392
|
+
* Whether or not the module is done loading, or is in the process of
|
393
|
+
* loading.
|
394
|
+
* @since v0.1.16
|
395
|
+
*/
|
396
|
+
loaded: boolean;
|
397
|
+
/**
|
398
|
+
* The module that first required this one, or `null` if the current module is the
|
399
|
+
* entry point of the current process, or `undefined` if the module was loaded by
|
400
|
+
* something that is not a CommonJS module (e.g. REPL or `import`).
|
401
|
+
* @since v0.1.16
|
402
|
+
* @deprecated Please use `require.main` and `module.children` instead.
|
403
|
+
*/
|
404
|
+
parent: Module | null | undefined;
|
405
|
+
/**
|
406
|
+
* The directory name of the module. This is usually the same as the
|
407
|
+
* `path.dirname()` of the `module.id`.
|
408
|
+
* @since v11.14.0
|
409
|
+
*/
|
410
|
+
path: string;
|
411
|
+
/**
|
412
|
+
* The search paths for the module.
|
413
|
+
* @since v0.4.0
|
414
|
+
*/
|
415
|
+
paths: string[];
|
416
|
+
/**
|
417
|
+
* The `module.require()` method provides a way to load a module as if
|
418
|
+
* `require()` was called from the original module.
|
419
|
+
* @since v0.5.1
|
420
|
+
*/
|
421
|
+
require(id: string): any;
|
422
|
+
}
|
423
|
+
interface Require {
|
424
|
+
/**
|
425
|
+
* Used to import modules, `JSON`, and local files.
|
426
|
+
* @since v0.1.13
|
427
|
+
*/
|
428
|
+
(id: string): any;
|
429
|
+
/**
|
430
|
+
* Modules are cached in this object when they are required. By deleting a key
|
431
|
+
* value from this object, the next `require` will reload the module.
|
432
|
+
* This does not apply to
|
433
|
+
* [native addons](https://nodejs.org/docs/latest-v20.x/api/addons.html),
|
434
|
+
* for which reloading will result in an error.
|
435
|
+
* @since v0.3.0
|
436
|
+
*/
|
437
|
+
cache: Dict<Module>;
|
438
|
+
/**
|
439
|
+
* Instruct `require` on how to handle certain file extensions.
|
440
|
+
* @since v0.3.0
|
441
|
+
* @deprecated
|
442
|
+
*/
|
443
|
+
extensions: RequireExtensions;
|
444
|
+
/**
|
445
|
+
* The `Module` object representing the entry script loaded when the Node.js
|
446
|
+
* process launched, or `undefined` if the entry point of the program is not a
|
447
|
+
* CommonJS module.
|
448
|
+
* @since v0.1.17
|
449
|
+
*/
|
450
|
+
main: Module | undefined;
|
451
|
+
/**
|
452
|
+
* @since v0.3.0
|
453
|
+
*/
|
454
|
+
resolve: RequireResolve;
|
455
|
+
}
|
456
|
+
/** @deprecated */
|
457
|
+
interface RequireExtensions extends Dict<(module: Module, filename: string) => any> {
|
458
|
+
".js": (module: Module, filename: string) => any;
|
459
|
+
".json": (module: Module, filename: string) => any;
|
460
|
+
".node": (module: Module, filename: string) => any;
|
461
|
+
}
|
462
|
+
interface RequireResolveOptions {
|
463
|
+
/**
|
464
|
+
* Paths to resolve module location from. If present, these
|
465
|
+
* paths are used instead of the default resolution paths, with the exception
|
466
|
+
* of
|
467
|
+
* [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v20.x/api/modules.html#loading-from-the-global-folders)
|
468
|
+
* like `$HOME/.node_modules`, which are
|
469
|
+
* always included. Each of these paths is used as a starting point for
|
470
|
+
* the module resolution algorithm, meaning that the `node_modules` hierarchy
|
471
|
+
* is checked from this location.
|
472
|
+
* @since v8.9.0
|
473
|
+
*/
|
474
|
+
paths?: string[] | undefined;
|
475
|
+
}
|
476
|
+
interface RequireResolve {
|
477
|
+
/**
|
478
|
+
* Use the internal `require()` machinery to look up the location of a module,
|
479
|
+
* but rather than loading the module, just return the resolved filename.
|
480
|
+
*
|
481
|
+
* If the module can not be found, a `MODULE_NOT_FOUND` error is thrown.
|
482
|
+
* @since v0.3.0
|
483
|
+
* @param request The module path to resolve.
|
484
|
+
*/
|
485
|
+
(id: string, options?: RequireResolveOptions): string;
|
486
|
+
/**
|
487
|
+
* Returns an array containing the paths searched during resolution of `request` or
|
488
|
+
* `null` if the `request` string references a core module, for example `http` or
|
489
|
+
* `fs`.
|
490
|
+
* @since v8.9.0
|
491
|
+
* @param request The module path whose lookup paths are being retrieved.
|
492
|
+
*/
|
493
|
+
paths(request: string): string[] | null;
|
494
|
+
}
|
495
|
+
}
|
496
|
+
/**
|
497
|
+
* The directory name of the current module. This is the same as the
|
498
|
+
* `path.dirname()` of the `__filename`.
|
499
|
+
* @since v0.1.27
|
500
|
+
*/
|
501
|
+
var __dirname: string;
|
502
|
+
/**
|
503
|
+
* The file name of the current module. This is the current module file's absolute
|
504
|
+
* path with symlinks resolved.
|
505
|
+
*
|
506
|
+
* For a main program this is not necessarily the same as the file name used in the
|
507
|
+
* command line.
|
508
|
+
* @since v0.0.1
|
509
|
+
*/
|
510
|
+
var __filename: string;
|
511
|
+
/**
|
512
|
+
* The `exports` variable is available within a module's file-level scope, and is
|
513
|
+
* assigned the value of `module.exports` before the module is evaluated.
|
514
|
+
* @since v0.1.16
|
515
|
+
*/
|
516
|
+
var exports: NodeJS.Module["exports"];
|
517
|
+
/**
|
518
|
+
* A reference to the current module.
|
519
|
+
* @since v0.1.16
|
520
|
+
*/
|
521
|
+
var module: NodeJS.Module;
|
522
|
+
/**
|
523
|
+
* @since v0.1.13
|
524
|
+
*/
|
525
|
+
var require: NodeJS.Require;
|
526
|
+
// Global-scope aliases for backwards compatibility with @types/node <13.0.x
|
527
|
+
/** @deprecated Use `NodeJS.Module` instead. */
|
528
|
+
interface NodeModule extends NodeJS.Module {}
|
529
|
+
/** @deprecated Use `NodeJS.Require` instead. */
|
530
|
+
interface NodeRequire extends NodeJS.Require {}
|
531
|
+
/** @deprecated Use `NodeJS.RequireResolve` instead. */
|
532
|
+
interface RequireResolve extends NodeJS.RequireResolve {}
|
309
533
|
}
|
310
534
|
export = Module;
|
311
535
|
}
|
node v20.17/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@types/node",
|
3
|
-
"version": "20.17.
|
3
|
+
"version": "20.17.17",
|
4
4
|
"description": "TypeScript definitions for node",
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
6
6
|
"license": "MIT",
|
@@ -215,6 +215,6 @@
|
|
215
215
|
"undici-types": "~6.19.2"
|
216
216
|
},
|
217
217
|
"peerDependencies": {},
|
218
|
-
"typesPublisherContentHash": "
|
218
|
+
"typesPublisherContentHash": "e184a1585085e8f3830812fd0f375097a556d3a552f6fb38e3244d755334d004",
|
219
219
|
"typeScriptVersion": "5.0"
|
220
220
|
}
|