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