@types/node 18.18.14 → 18.19.1
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.18 → node v18.19}/README.md +1 -1
- node v18.19/globals.d.ts +377 -0
- {node v18.18/ts4.8 → node v18.19}/module.d.ts +41 -5
- {node v18.18 → node v18.19}/package.json +2 -2
- {node v18.18/ts4.8 → node v18.19}/process.d.ts +6 -0
- {node v18.18/ts4.8 → node v18.19}/test.d.ts +197 -58
- {node v18.18 → node v18.19}/tls.d.ts +12 -0
- node v18.19/ts4.8/globals.d.ts +377 -0
- {node v18.18 → node v18.19/ts4.8}/module.d.ts +41 -5
- {node v18.18 → node v18.19/ts4.8}/process.d.ts +6 -0
- {node v18.18 → node v18.19/ts4.8}/test.d.ts +197 -58
- {node v18.18 → node v18.19}/ts4.8/tls.d.ts +12 -0
- {node v18.18 → node v18.19}/ts4.8/vm.d.ts +7 -3
- {node v18.18 → node v18.19}/vm.d.ts +7 -3
- node v18.18/globals.d.ts +0 -381
- node v18.18/ts4.8/globals.d.ts +0 -381
- {node v18.18 → node v18.19}/LICENSE +0 -0
- {node v18.18 → node v18.19}/assert/strict.d.ts +0 -0
- {node v18.18 → node v18.19}/assert.d.ts +0 -0
- {node v18.18 → node v18.19}/async_hooks.d.ts +0 -0
- {node v18.18 → node v18.19}/buffer.d.ts +0 -0
- {node v18.18 → node v18.19}/child_process.d.ts +0 -0
- {node v18.18 → node v18.19}/cluster.d.ts +0 -0
- {node v18.18 → node v18.19}/console.d.ts +0 -0
- {node v18.18 → node v18.19}/constants.d.ts +0 -0
- {node v18.18 → node v18.19}/crypto.d.ts +0 -0
- {node v18.18 → node v18.19}/dgram.d.ts +0 -0
- {node v18.18 → node v18.19}/diagnostics_channel.d.ts +0 -0
- {node v18.18 → node v18.19}/dns/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/dns.d.ts +0 -0
- {node v18.18 → node v18.19}/dom-events.d.ts +0 -0
- {node v18.18 → node v18.19}/domain.d.ts +0 -0
- {node v18.18 → node v18.19}/events.d.ts +0 -0
- {node v18.18 → node v18.19}/fs/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/fs.d.ts +0 -0
- {node v18.18 → node v18.19}/globals.global.d.ts +0 -0
- {node v18.18 → node v18.19}/http.d.ts +0 -0
- {node v18.18 → node v18.19}/http2.d.ts +0 -0
- {node v18.18 → node v18.19}/https.d.ts +0 -0
- {node v18.18 → node v18.19}/index.d.ts +0 -0
- {node v18.18 → node v18.19}/inspector.d.ts +0 -0
- {node v18.18 → node v18.19}/net.d.ts +0 -0
- {node v18.18 → node v18.19}/os.d.ts +0 -0
- {node v18.18 → node v18.19}/path.d.ts +0 -0
- {node v18.18 → node v18.19}/perf_hooks.d.ts +0 -0
- {node v18.18 → node v18.19}/punycode.d.ts +0 -0
- {node v18.18 → node v18.19}/querystring.d.ts +0 -0
- {node v18.18 → node v18.19}/readline/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/readline.d.ts +0 -0
- {node v18.18 → node v18.19}/repl.d.ts +0 -0
- {node v18.18 → node v18.19}/stream/consumers.d.ts +0 -0
- {node v18.18 → node v18.19}/stream/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/stream/web.d.ts +0 -0
- {node v18.18 → node v18.19}/stream.d.ts +0 -0
- {node v18.18 → node v18.19}/string_decoder.d.ts +0 -0
- {node v18.18 → node v18.19}/timers/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/timers.d.ts +0 -0
- {node v18.18 → node v18.19}/trace_events.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/assert/strict.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/assert.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/async_hooks.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/buffer.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/child_process.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/cluster.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/console.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/constants.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/crypto.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/dgram.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/diagnostics_channel.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/dns/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/dns.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/dom-events.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/domain.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/events.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/fs/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/fs.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/globals.global.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/http.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/http2.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/https.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/index.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/inspector.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/net.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/os.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/path.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/perf_hooks.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/punycode.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/querystring.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/readline/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/readline.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/repl.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/stream/consumers.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/stream/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/stream/web.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/stream.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/string_decoder.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/timers/promises.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/timers.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/trace_events.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/tty.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/url.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/util.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/v8.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/wasi.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/worker_threads.d.ts +0 -0
- {node v18.18 → node v18.19}/ts4.8/zlib.d.ts +0 -0
- {node v18.18 → node v18.19}/tty.d.ts +0 -0
- {node v18.18 → node v18.19}/url.d.ts +0 -0
- {node v18.18 → node v18.19}/util.d.ts +0 -0
- {node v18.18 → node v18.19}/v8.d.ts +0 -0
- {node v18.18 → node v18.19}/wasi.d.ts +0 -0
- {node v18.18 → node v18.19}/worker_threads.d.ts +0 -0
- {node v18.18 → node v18.19}/zlib.d.ts +0 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
export {}; // Make this a module
|
|
2
|
+
|
|
3
|
+
// #region Fetch and friends
|
|
4
|
+
// Conditional type aliases, used at the end of this file.
|
|
5
|
+
// Will either be empty if lib-dom is included, or the undici version otherwise.
|
|
6
|
+
type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request;
|
|
7
|
+
type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response;
|
|
8
|
+
type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData;
|
|
9
|
+
type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers;
|
|
10
|
+
type _RequestInit = typeof globalThis extends { onmessage: any } ? {}
|
|
11
|
+
: import("undici-types").RequestInit;
|
|
12
|
+
type _ResponseInit = typeof globalThis extends { onmessage: any } ? {}
|
|
13
|
+
: import("undici-types").ResponseInit;
|
|
14
|
+
// #endregion Fetch and friends
|
|
15
|
+
|
|
16
|
+
declare global {
|
|
17
|
+
// Declare "static" methods in Error
|
|
18
|
+
interface ErrorConstructor {
|
|
19
|
+
/** Create .stack property on a target object */
|
|
20
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Optional override for formatting stack traces
|
|
24
|
+
*
|
|
25
|
+
* @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
26
|
+
*/
|
|
27
|
+
prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
|
|
28
|
+
|
|
29
|
+
stackTraceLimit: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*-----------------------------------------------*
|
|
33
|
+
* *
|
|
34
|
+
* GLOBAL *
|
|
35
|
+
* *
|
|
36
|
+
------------------------------------------------*/
|
|
37
|
+
|
|
38
|
+
// For backwards compability
|
|
39
|
+
interface NodeRequire extends NodeJS.Require {}
|
|
40
|
+
interface RequireResolve extends NodeJS.RequireResolve {}
|
|
41
|
+
interface NodeModule extends NodeJS.Module {}
|
|
42
|
+
|
|
43
|
+
var process: NodeJS.Process;
|
|
44
|
+
var console: Console;
|
|
45
|
+
|
|
46
|
+
var __filename: string;
|
|
47
|
+
var __dirname: string;
|
|
48
|
+
|
|
49
|
+
var require: NodeRequire;
|
|
50
|
+
var module: NodeModule;
|
|
51
|
+
|
|
52
|
+
// Same as module.exports
|
|
53
|
+
var exports: any;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Only available if `--expose-gc` is passed to the process.
|
|
57
|
+
*/
|
|
58
|
+
var gc: undefined | (() => void);
|
|
59
|
+
|
|
60
|
+
// #region borrowed
|
|
61
|
+
// from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib
|
|
62
|
+
/** A controller object that allows you to abort one or more DOM requests as and when desired. */
|
|
63
|
+
interface AbortController {
|
|
64
|
+
/**
|
|
65
|
+
* Returns the AbortSignal object associated with this object.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
readonly signal: AbortSignal;
|
|
69
|
+
/**
|
|
70
|
+
* Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted.
|
|
71
|
+
*/
|
|
72
|
+
abort(reason?: any): void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
|
|
76
|
+
interface AbortSignal extends EventTarget {
|
|
77
|
+
/**
|
|
78
|
+
* Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise.
|
|
79
|
+
*/
|
|
80
|
+
readonly aborted: boolean;
|
|
81
|
+
readonly reason: any;
|
|
82
|
+
onabort: null | ((this: AbortSignal, event: Event) => any);
|
|
83
|
+
throwIfAborted(): void;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T
|
|
87
|
+
: {
|
|
88
|
+
prototype: AbortController;
|
|
89
|
+
new(): AbortController;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T
|
|
93
|
+
: {
|
|
94
|
+
prototype: AbortSignal;
|
|
95
|
+
new(): AbortSignal;
|
|
96
|
+
abort(reason?: any): AbortSignal;
|
|
97
|
+
timeout(milliseconds: number): AbortSignal;
|
|
98
|
+
};
|
|
99
|
+
// #endregion borrowed
|
|
100
|
+
|
|
101
|
+
// #region Disposable
|
|
102
|
+
interface SymbolConstructor {
|
|
103
|
+
/**
|
|
104
|
+
* A method that is used to release resources held by an object. Called by the semantics of the `using` statement.
|
|
105
|
+
*/
|
|
106
|
+
readonly dispose: unique symbol;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement.
|
|
110
|
+
*/
|
|
111
|
+
readonly asyncDispose: unique symbol;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
interface Disposable {
|
|
115
|
+
[Symbol.dispose](): void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface AsyncDisposable {
|
|
119
|
+
[Symbol.asyncDispose](): PromiseLike<void>;
|
|
120
|
+
}
|
|
121
|
+
// #endregion Disposable
|
|
122
|
+
|
|
123
|
+
// #region ArrayLike.at()
|
|
124
|
+
interface RelativeIndexable<T> {
|
|
125
|
+
/**
|
|
126
|
+
* Takes an integer value and returns the item at that index,
|
|
127
|
+
* allowing for positive and negative integers.
|
|
128
|
+
* Negative integers count back from the last item in the array.
|
|
129
|
+
*/
|
|
130
|
+
at(index: number): T | undefined;
|
|
131
|
+
}
|
|
132
|
+
interface String extends RelativeIndexable<string> {}
|
|
133
|
+
interface Array<T> extends RelativeIndexable<T> {}
|
|
134
|
+
interface ReadonlyArray<T> extends RelativeIndexable<T> {}
|
|
135
|
+
interface Int8Array extends RelativeIndexable<number> {}
|
|
136
|
+
interface Uint8Array extends RelativeIndexable<number> {}
|
|
137
|
+
interface Uint8ClampedArray extends RelativeIndexable<number> {}
|
|
138
|
+
interface Int16Array extends RelativeIndexable<number> {}
|
|
139
|
+
interface Uint16Array extends RelativeIndexable<number> {}
|
|
140
|
+
interface Int32Array extends RelativeIndexable<number> {}
|
|
141
|
+
interface Uint32Array extends RelativeIndexable<number> {}
|
|
142
|
+
interface Float32Array extends RelativeIndexable<number> {}
|
|
143
|
+
interface Float64Array extends RelativeIndexable<number> {}
|
|
144
|
+
interface BigInt64Array extends RelativeIndexable<bigint> {}
|
|
145
|
+
interface BigUint64Array extends RelativeIndexable<bigint> {}
|
|
146
|
+
// #endregion ArrayLike.at() end
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @since v17.0.0
|
|
150
|
+
*
|
|
151
|
+
* Creates a deep clone of an object.
|
|
152
|
+
*/
|
|
153
|
+
function structuredClone<T>(
|
|
154
|
+
value: T,
|
|
155
|
+
transfer?: { transfer: ReadonlyArray<import("worker_threads").TransferListItem> },
|
|
156
|
+
): T;
|
|
157
|
+
|
|
158
|
+
/*----------------------------------------------*
|
|
159
|
+
* *
|
|
160
|
+
* GLOBAL INTERFACES *
|
|
161
|
+
* *
|
|
162
|
+
*-----------------------------------------------*/
|
|
163
|
+
namespace NodeJS {
|
|
164
|
+
interface CallSite {
|
|
165
|
+
/**
|
|
166
|
+
* Value of "this"
|
|
167
|
+
*/
|
|
168
|
+
getThis(): unknown;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Type of "this" as a string.
|
|
172
|
+
* This is the name of the function stored in the constructor field of
|
|
173
|
+
* "this", if available. Otherwise the object's [[Class]] internal
|
|
174
|
+
* property.
|
|
175
|
+
*/
|
|
176
|
+
getTypeName(): string | null;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Current function
|
|
180
|
+
*/
|
|
181
|
+
getFunction(): Function | undefined;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Name of the current function, typically its name property.
|
|
185
|
+
* If a name property is not available an attempt will be made to try
|
|
186
|
+
* to infer a name from the function's context.
|
|
187
|
+
*/
|
|
188
|
+
getFunctionName(): string | null;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Name of the property [of "this" or one of its prototypes] that holds
|
|
192
|
+
* the current function
|
|
193
|
+
*/
|
|
194
|
+
getMethodName(): string | null;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Name of the script [if this function was defined in a script]
|
|
198
|
+
*/
|
|
199
|
+
getFileName(): string | undefined;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Current line number [if this function was defined in a script]
|
|
203
|
+
*/
|
|
204
|
+
getLineNumber(): number | null;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Current column number [if this function was defined in a script]
|
|
208
|
+
*/
|
|
209
|
+
getColumnNumber(): number | null;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* A call site object representing the location where eval was called
|
|
213
|
+
* [if this function was created using a call to eval]
|
|
214
|
+
*/
|
|
215
|
+
getEvalOrigin(): string | undefined;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Is this a toplevel invocation, that is, is "this" the global object?
|
|
219
|
+
*/
|
|
220
|
+
isToplevel(): boolean;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Does this call take place in code defined by a call to eval?
|
|
224
|
+
*/
|
|
225
|
+
isEval(): boolean;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Is this call in native V8 code?
|
|
229
|
+
*/
|
|
230
|
+
isNative(): boolean;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Is this a constructor call?
|
|
234
|
+
*/
|
|
235
|
+
isConstructor(): boolean;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface ErrnoException extends Error {
|
|
239
|
+
errno?: number | undefined;
|
|
240
|
+
code?: string | undefined;
|
|
241
|
+
path?: string | undefined;
|
|
242
|
+
syscall?: string | undefined;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
interface ReadableStream extends EventEmitter {
|
|
246
|
+
readable: boolean;
|
|
247
|
+
read(size?: number): string | Buffer;
|
|
248
|
+
setEncoding(encoding: BufferEncoding): this;
|
|
249
|
+
pause(): this;
|
|
250
|
+
resume(): this;
|
|
251
|
+
isPaused(): boolean;
|
|
252
|
+
pipe<T extends WritableStream>(destination: T, options?: { end?: boolean | undefined }): T;
|
|
253
|
+
unpipe(destination?: WritableStream): this;
|
|
254
|
+
unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void;
|
|
255
|
+
wrap(oldStream: ReadableStream): this;
|
|
256
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<string | Buffer>;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
interface WritableStream extends EventEmitter {
|
|
260
|
+
writable: boolean;
|
|
261
|
+
write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean;
|
|
262
|
+
write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean;
|
|
263
|
+
end(cb?: () => void): this;
|
|
264
|
+
end(data: string | Uint8Array, cb?: () => void): this;
|
|
265
|
+
end(str: string, encoding?: BufferEncoding, cb?: () => void): this;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface ReadWriteStream extends ReadableStream, WritableStream {}
|
|
269
|
+
|
|
270
|
+
interface RefCounted {
|
|
271
|
+
ref(): this;
|
|
272
|
+
unref(): this;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
type TypedArray =
|
|
276
|
+
| Uint8Array
|
|
277
|
+
| Uint8ClampedArray
|
|
278
|
+
| Uint16Array
|
|
279
|
+
| Uint32Array
|
|
280
|
+
| Int8Array
|
|
281
|
+
| Int16Array
|
|
282
|
+
| Int32Array
|
|
283
|
+
| BigUint64Array
|
|
284
|
+
| BigInt64Array
|
|
285
|
+
| Float32Array
|
|
286
|
+
| Float64Array;
|
|
287
|
+
type ArrayBufferView = TypedArray | DataView;
|
|
288
|
+
|
|
289
|
+
interface Require {
|
|
290
|
+
(id: string): any;
|
|
291
|
+
resolve: RequireResolve;
|
|
292
|
+
cache: Dict<NodeModule>;
|
|
293
|
+
/**
|
|
294
|
+
* @deprecated
|
|
295
|
+
*/
|
|
296
|
+
extensions: RequireExtensions;
|
|
297
|
+
main: Module | undefined;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
interface RequireResolve {
|
|
301
|
+
(id: string, options?: { paths?: string[] | undefined }): string;
|
|
302
|
+
paths(request: string): string[] | null;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
interface RequireExtensions extends Dict<(m: Module, filename: string) => any> {
|
|
306
|
+
".js": (m: Module, filename: string) => any;
|
|
307
|
+
".json": (m: Module, filename: string) => any;
|
|
308
|
+
".node": (m: Module, filename: string) => any;
|
|
309
|
+
}
|
|
310
|
+
interface Module {
|
|
311
|
+
/**
|
|
312
|
+
* `true` if the module is running during the Node.js preload
|
|
313
|
+
*/
|
|
314
|
+
isPreloading: boolean;
|
|
315
|
+
exports: any;
|
|
316
|
+
require: Require;
|
|
317
|
+
id: string;
|
|
318
|
+
filename: string;
|
|
319
|
+
loaded: boolean;
|
|
320
|
+
/** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */
|
|
321
|
+
parent: Module | null | undefined;
|
|
322
|
+
children: Module[];
|
|
323
|
+
/**
|
|
324
|
+
* @since v11.14.0
|
|
325
|
+
*
|
|
326
|
+
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
|
|
327
|
+
*/
|
|
328
|
+
path: string;
|
|
329
|
+
paths: string[];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
interface Dict<T> {
|
|
333
|
+
[key: string]: T | undefined;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
interface ReadOnlyDict<T> {
|
|
337
|
+
readonly [key: string]: T | undefined;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
interface RequestInit extends _RequestInit {}
|
|
342
|
+
|
|
343
|
+
function fetch(
|
|
344
|
+
input: string | URL | Request,
|
|
345
|
+
init?: RequestInit,
|
|
346
|
+
): Promise<Response>;
|
|
347
|
+
|
|
348
|
+
interface Request extends _Request {}
|
|
349
|
+
var Request: typeof globalThis extends {
|
|
350
|
+
onmessage: any;
|
|
351
|
+
Request: infer T;
|
|
352
|
+
} ? T
|
|
353
|
+
: typeof import("undici-types").Request;
|
|
354
|
+
|
|
355
|
+
interface ResponseInit extends _ResponseInit {}
|
|
356
|
+
|
|
357
|
+
interface Response extends _Response {}
|
|
358
|
+
var Response: typeof globalThis extends {
|
|
359
|
+
onmessage: any;
|
|
360
|
+
Response: infer T;
|
|
361
|
+
} ? T
|
|
362
|
+
: typeof import("undici-types").Response;
|
|
363
|
+
|
|
364
|
+
interface FormData extends _FormData {}
|
|
365
|
+
var FormData: typeof globalThis extends {
|
|
366
|
+
onmessage: any;
|
|
367
|
+
FormData: infer T;
|
|
368
|
+
} ? T
|
|
369
|
+
: typeof import("undici-types").FormData;
|
|
370
|
+
|
|
371
|
+
interface Headers extends _Headers {}
|
|
372
|
+
var Headers: typeof globalThis extends {
|
|
373
|
+
onmessage: any;
|
|
374
|
+
Headers: infer T;
|
|
375
|
+
} ? T
|
|
376
|
+
: typeof import("undici-types").Headers;
|
|
377
|
+
}
|
|
@@ -120,7 +120,9 @@ declare module "module" {
|
|
|
120
120
|
*/
|
|
121
121
|
findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {};
|
|
122
122
|
}
|
|
123
|
-
|
|
123
|
+
/** @deprecated Use `ImportAttributes` instead */
|
|
124
|
+
interface ImportAssertions extends ImportAttributes {}
|
|
125
|
+
interface ImportAttributes extends NodeJS.Dict<string> {
|
|
124
126
|
type?: string | undefined;
|
|
125
127
|
}
|
|
126
128
|
type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm";
|
|
@@ -129,6 +131,9 @@ declare module "module" {
|
|
|
129
131
|
port: MessagePort;
|
|
130
132
|
}
|
|
131
133
|
/**
|
|
134
|
+
* @deprecated This hook will be removed in a future version.
|
|
135
|
+
* Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored.
|
|
136
|
+
*
|
|
132
137
|
* Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
|
|
133
138
|
* This hook allows the return of a string that is run as a sloppy-mode script on startup.
|
|
134
139
|
*
|
|
@@ -136,15 +141,27 @@ declare module "module" {
|
|
|
136
141
|
* @return Code to run before application startup
|
|
137
142
|
*/
|
|
138
143
|
type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
|
|
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.
|
|
150
|
+
*/
|
|
151
|
+
type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
|
|
139
152
|
interface ResolveHookContext {
|
|
140
153
|
/**
|
|
141
154
|
* Export conditions of the relevant `package.json`
|
|
142
155
|
*/
|
|
143
156
|
conditions: string[];
|
|
157
|
+
/**
|
|
158
|
+
* @deprecated Use `importAttributes` instead
|
|
159
|
+
*/
|
|
160
|
+
importAssertions: ImportAttributes;
|
|
144
161
|
/**
|
|
145
162
|
* An object whose key-value pairs represent the assertions for the module to import
|
|
146
163
|
*/
|
|
147
|
-
|
|
164
|
+
importAttributes: ImportAttributes;
|
|
148
165
|
/**
|
|
149
166
|
* The module importing this one, or undefined if this is the Node.js entry point
|
|
150
167
|
*/
|
|
@@ -156,9 +173,13 @@ declare module "module" {
|
|
|
156
173
|
*/
|
|
157
174
|
format?: ModuleFormat | null | undefined;
|
|
158
175
|
/**
|
|
159
|
-
*
|
|
176
|
+
* @deprecated Use `importAttributes` instead
|
|
160
177
|
*/
|
|
161
|
-
importAssertions?:
|
|
178
|
+
importAssertions?: ImportAttributes | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* The import attributes to use when caching the module (optional; if excluded the input will be used)
|
|
181
|
+
*/
|
|
182
|
+
importAttributes?: ImportAttributes | undefined;
|
|
162
183
|
/**
|
|
163
184
|
* A signal that this hook intends to terminate the chain of `resolve` hooks.
|
|
164
185
|
* @default false
|
|
@@ -195,10 +216,14 @@ declare module "module" {
|
|
|
195
216
|
* The format optionally supplied by the `resolve` hook chain
|
|
196
217
|
*/
|
|
197
218
|
format: ModuleFormat;
|
|
219
|
+
/**
|
|
220
|
+
* @deprecated Use `importAttributes` instead
|
|
221
|
+
*/
|
|
222
|
+
importAssertions: ImportAttributes;
|
|
198
223
|
/**
|
|
199
224
|
* An object whose key-value pairs represent the assertions for the module to import
|
|
200
225
|
*/
|
|
201
|
-
|
|
226
|
+
importAttributes: ImportAttributes;
|
|
202
227
|
}
|
|
203
228
|
interface LoadFnOutput {
|
|
204
229
|
format: ModuleFormat;
|
|
@@ -226,6 +251,11 @@ declare module "module" {
|
|
|
226
251
|
nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>,
|
|
227
252
|
) => LoadFnOutput | Promise<LoadFnOutput>;
|
|
228
253
|
}
|
|
254
|
+
interface RegisterOptions<Data> {
|
|
255
|
+
parentURL: string | URL;
|
|
256
|
+
data?: Data | undefined;
|
|
257
|
+
transferList?: any[] | undefined;
|
|
258
|
+
}
|
|
229
259
|
interface Module extends NodeModule {}
|
|
230
260
|
class Module {
|
|
231
261
|
static runMain(): void;
|
|
@@ -234,6 +264,12 @@ declare module "module" {
|
|
|
234
264
|
static builtinModules: string[];
|
|
235
265
|
static isBuiltin(moduleName: string): boolean;
|
|
236
266
|
static Module: typeof Module;
|
|
267
|
+
static register<Data = any>(
|
|
268
|
+
specifier: string | URL,
|
|
269
|
+
parentURL?: string | URL,
|
|
270
|
+
options?: RegisterOptions<Data>,
|
|
271
|
+
): void;
|
|
272
|
+
static register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
|
|
237
273
|
constructor(id: string, parent?: Module);
|
|
238
274
|
}
|
|
239
275
|
global {
|
|
@@ -901,6 +901,12 @@ declare module "process" {
|
|
|
901
901
|
* @experimental
|
|
902
902
|
*/
|
|
903
903
|
setSourceMapsEnabled(value: boolean): void;
|
|
904
|
+
/**
|
|
905
|
+
* The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled.
|
|
906
|
+
* @since v18.19.0
|
|
907
|
+
* @experimental
|
|
908
|
+
*/
|
|
909
|
+
readonly sourceMapsEnabled: boolean;
|
|
904
910
|
/**
|
|
905
911
|
* The `process.version` property contains the Node.js version string.
|
|
906
912
|
*
|