aws-delivlib 14.15.2 → 14.15.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.
@@ -1,11 +1,174 @@
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
- import { MessagePort } from "node:worker_threads";
6
+ class Module {
7
+ constructor(id: string, parent?: Module);
8
+ }
9
+ interface Module extends NodeJS.Module {}
8
10
  namespace Module {
11
+ export { Module };
12
+ }
13
+ namespace Module {
14
+ /**
15
+ * A list of the names of all modules provided by Node.js. Can be used to verify
16
+ * if a module is maintained by a third party or not.
17
+ *
18
+ * Note: the list doesn't contain prefix-only modules like `node:test`.
19
+ * @since v9.3.0, v8.10.0, v6.13.0
20
+ */
21
+ const builtinModules: readonly string[];
22
+ /**
23
+ * @since v12.2.0
24
+ * @param path Filename to be used to construct the require
25
+ * function. Must be a file URL object, file URL string, or absolute path
26
+ * string.
27
+ */
28
+ function createRequire(path: string | URL): NodeJS.Require;
29
+ namespace constants {
30
+ /**
31
+ * The following constants are returned as the `status` field in the object returned by
32
+ * {@link enableCompileCache} to indicate the result of the attempt to enable the
33
+ * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache).
34
+ * @since v22.8.0
35
+ */
36
+ namespace compileCacheStatus {
37
+ /**
38
+ * Node.js has enabled the compile cache successfully. The directory used to store the
39
+ * compile cache will be returned in the `directory` field in the
40
+ * returned object.
41
+ */
42
+ const ENABLED: number;
43
+ /**
44
+ * The compile cache has already been enabled before, either by a previous call to
45
+ * {@link enableCompileCache}, or by the `NODE_COMPILE_CACHE=dir`
46
+ * environment variable. The directory used to store the
47
+ * compile cache will be returned in the `directory` field in the
48
+ * returned object.
49
+ */
50
+ const ALREADY_ENABLED: number;
51
+ /**
52
+ * Node.js fails to enable the compile cache. This can be caused by the lack of
53
+ * permission to use the specified directory, or various kinds of file system errors.
54
+ * The detail of the failure will be returned in the `message` field in the
55
+ * returned object.
56
+ */
57
+ const FAILED: number;
58
+ /**
59
+ * Node.js cannot enable the compile cache because the environment variable
60
+ * `NODE_DISABLE_COMPILE_CACHE=1` has been set.
61
+ */
62
+ const DISABLED: number;
63
+ }
64
+ }
65
+ interface EnableCompileCacheResult {
66
+ /**
67
+ * One of the {@link constants.compileCacheStatus}
68
+ */
69
+ status: number;
70
+ /**
71
+ * If Node.js cannot enable the compile cache, this contains
72
+ * the error message. Only set if `status` is `module.constants.compileCacheStatus.FAILED`.
73
+ */
74
+ message?: string;
75
+ /**
76
+ * If the compile cache is enabled, this contains the directory
77
+ * where the compile cache is stored. Only set if `status` is
78
+ * `module.constants.compileCacheStatus.ENABLED` or
79
+ * `module.constants.compileCacheStatus.ALREADY_ENABLED`.
80
+ */
81
+ directory?: string;
82
+ }
83
+ /**
84
+ * Enable [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
85
+ * in the current Node.js instance.
86
+ *
87
+ * If `cacheDir` is not specified, Node.js will either use the directory specified by the
88
+ * `NODE_COMPILE_CACHE=dir` environment variable if it's set, or use
89
+ * `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. For general use cases, it's
90
+ * recommended to call `module.enableCompileCache()` without specifying the `cacheDir`,
91
+ * so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
92
+ * variable when necessary.
93
+ *
94
+ * Since compile cache is supposed to be a quiet optimization that is not required for the
95
+ * application to be functional, this method is designed to not throw any exception when the
96
+ * compile cache cannot be enabled. Instead, it will return an object containing an error
97
+ * message in the `message` field to aid debugging.
98
+ * If compile cache is enabled successfully, the `directory` field in the returned object
99
+ * contains the path to the directory where the compile cache is stored. The `status`
100
+ * field in the returned object would be one of the `module.constants.compileCacheStatus`
101
+ * values to indicate the result of the attempt to enable the
102
+ * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache).
103
+ *
104
+ * This method only affects the current Node.js instance. To enable it in child worker threads,
105
+ * either call this method in child worker threads too, or set the
106
+ * `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can
107
+ * be inherited into the child workers. The directory can be obtained either from the
108
+ * `directory` field returned by this method, or with {@link getCompileCacheDir}.
109
+ * @since v22.8.0
110
+ * @param cacheDir Optional path to specify the directory where the compile cache
111
+ * will be stored/retrieved.
112
+ */
113
+ function enableCompileCache(cacheDir?: string): EnableCompileCacheResult;
114
+ /**
115
+ * Flush the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
116
+ * accumulated from modules already loaded
117
+ * in the current Node.js instance to disk. This returns after all the flushing
118
+ * file system operations come to an end, no matter they succeed or not. If there
119
+ * are any errors, this will fail silently, since compile cache misses should not
120
+ * interfere with the actual operation of the application.
121
+ * @since v22.10.0
122
+ */
123
+ function flushCompileCache(): void;
124
+ /**
125
+ * @since v22.8.0
126
+ * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
127
+ * directory if it is enabled, or `undefined` otherwise.
128
+ */
129
+ function getCompileCacheDir(): string | undefined;
130
+ /**
131
+ * @since v18.6.0, v16.17.0
132
+ */
133
+ function isBuiltin(moduleName: string): boolean;
134
+ interface RegisterOptions<Data> {
135
+ /**
136
+ * If you want to resolve `specifier` relative to a
137
+ * base URL, such as `import.meta.url`, you can pass that URL here. This
138
+ * property is ignored if the `parentURL` is supplied as the second argument.
139
+ * @default 'data:'
140
+ */
141
+ parentURL?: string | URL | undefined;
142
+ /**
143
+ * Any arbitrary, cloneable JavaScript value to pass into the
144
+ * {@link initialize} hook.
145
+ */
146
+ data?: Data | undefined;
147
+ /**
148
+ * [Transferable objects](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html#portpostmessagevalue-transferlist)
149
+ * to be passed into the `initialize` hook.
150
+ */
151
+ transferList?: any[] | undefined;
152
+ }
153
+ /* eslint-disable @definitelytyped/no-unnecessary-generics */
154
+ /**
155
+ * Register a module that exports hooks that customize Node.js module
156
+ * resolution and loading behavior. See
157
+ * [Customization hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks).
158
+ * @since v20.6.0, v18.19.0
159
+ * @param specifier Customization hooks to be registered; this should be
160
+ * the same string that would be passed to `import()`, except that if it is
161
+ * relative, it is resolved relative to `parentURL`.
162
+ * @param parentURL f you want to resolve `specifier` relative to a base
163
+ * URL, such as `import.meta.url`, you can pass that URL here.
164
+ */
165
+ function register<Data = any>(
166
+ specifier: string | URL,
167
+ parentURL?: string | URL,
168
+ options?: RegisterOptions<Data>,
169
+ ): void;
170
+ function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
171
+ /* eslint-enable @definitelytyped/no-unnecessary-generics */
9
172
  /**
10
173
  * The `module.syncBuiltinESMExports()` method updates all the live bindings for
11
174
  * builtin `ES Modules` to match the properties of the `CommonJS` exports. It
@@ -42,86 +205,6 @@ declare module "module" {
42
205
  * @since v12.12.0
43
206
  */
44
207
  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
208
  interface ImportAttributes extends NodeJS.Dict<string> {
126
209
  type?: string | undefined;
127
210
  }
@@ -134,26 +217,15 @@ declare module "module" {
134
217
  | "module-typescript"
135
218
  | "wasm";
136
219
  type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
137
- interface GlobalPreloadContext {
138
- port: MessagePort;
139
- }
140
220
  /**
141
- * @deprecated This hook will be removed in a future version.
142
- * Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored.
221
+ * The `initialize` hook provides a way to define a custom function that runs in
222
+ * the hooks thread when the hooks module is initialized. Initialization happens
223
+ * when the hooks module is registered via {@link register}.
143
224
  *
144
- * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in.
145
- * This hook allows the return of a string that is run as a sloppy-mode script on startup.
146
- *
147
- * @param context Information to assist the preload code
148
- * @return Code to run before application startup
149
- */
150
- type GlobalPreloadHook = (context: GlobalPreloadContext) => string;
151
- /**
152
- * The `initialize` hook provides a way to define a custom function that runs in the hooks thread
153
- * when the hooks module is initialized. Initialization happens when the hooks module is registered via `register`.
154
- *
155
- * This hook can receive data from a `register` invocation, including ports and other transferrable objects.
156
- * The return value of `initialize` can be a `Promise`, in which case it will be awaited before the main application thread execution resumes.
225
+ * This hook can receive data from a {@link register} invocation, including
226
+ * ports and other transferable objects. The return value of `initialize` can be a
227
+ * `Promise`, in which case it will be awaited before the main application thread
228
+ * execution resumes.
157
229
  */
158
230
  type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
159
231
  interface ResolveHookContext {
@@ -190,13 +262,13 @@ declare module "module" {
190
262
  url: string;
191
263
  }
192
264
  /**
193
- * 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.
194
- * 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`);
195
- * 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.
196
- *
197
- * @param specifier The specified URL path of the module to be resolved
198
- * @param context
199
- * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
265
+ * The `resolve` hook chain is responsible for telling Node.js where to find and
266
+ * how to cache a given `import` statement or expression, or `require` call. It can
267
+ * optionally return a format (such as `'module'`) as a hint to the `load` hook. If
268
+ * a format is specified, the `load` hook is ultimately responsible for providing
269
+ * the final `format` value (and it is free to ignore the hint provided by
270
+ * `resolve`); if `resolve` provides a `format`, a custom `load` hook is required
271
+ * even if only to pass the value to the Node.js default `load` hook.
200
272
  */
201
273
  type ResolveHook = (
202
274
  specifier: string,
@@ -214,7 +286,7 @@ declare module "module" {
214
286
  /**
215
287
  * The format optionally supplied by the `resolve` hook chain
216
288
  */
217
- format: ModuleFormat;
289
+ format: ModuleFormat | null | undefined;
218
290
  /**
219
291
  * An object whose key-value pairs represent the assertions for the module to import
220
292
  */
@@ -230,143 +302,109 @@ declare module "module" {
230
302
  /**
231
303
  * The source for Node.js to evaluate
232
304
  */
233
- source?: ModuleSource;
305
+ source?: ModuleSource | undefined;
234
306
  }
235
307
  /**
236
- * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
237
- * It is also in charge of validating the import assertion.
238
- *
239
- * @param url The URL/path of the module to be loaded
240
- * @param context Metadata about the module
241
- * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
308
+ * The `load` hook provides a way to define a custom method of determining how a
309
+ * URL should be interpreted, retrieved, and parsed. It is also in charge of
310
+ * validating the import attributes.
242
311
  */
243
312
  type LoadHook = (
244
313
  url: string,
245
314
  context: LoadHookContext,
246
- nextLoad: (url: string, context?: Partial<LoadHookContext>) => LoadFnOutput | Promise<LoadFnOutput>,
315
+ nextLoad: (
316
+ url: string,
317
+ context?: Partial<LoadHookContext>,
318
+ ) => LoadFnOutput | Promise<LoadFnOutput>,
247
319
  ) => LoadFnOutput | Promise<LoadFnOutput>;
248
- namespace constants {
320
+ /**
321
+ * `path` is the resolved path for the file for which a corresponding source map
322
+ * should be fetched.
323
+ * @since v13.7.0, v12.17.0
324
+ * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
325
+ */
326
+ function findSourceMap(path: string): SourceMap | undefined;
327
+ interface SourceMapConstructorOptions {
249
328
  /**
250
- * The following constants are returned as the `status` field in the object returned by
251
- * {@link enableCompileCache} to indicate the result of the attempt to enable the
252
- * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache).
253
- * @since v22.8.0
329
+ * @since v21.0.0, v20.5.0
254
330
  */
255
- namespace compileCacheStatus {
256
- /**
257
- * Node.js has enabled the compile cache successfully. The directory used to store the
258
- * compile cache will be returned in the `directory` field in the
259
- * returned object.
260
- */
261
- const ENABLED: number;
262
- /**
263
- * The compile cache has already been enabled before, either by a previous call to
264
- * {@link enableCompileCache}, or by the `NODE_COMPILE_CACHE=dir`
265
- * environment variable. The directory used to store the
266
- * compile cache will be returned in the `directory` field in the
267
- * returned object.
268
- */
269
- const ALREADY_ENABLED: number;
270
- /**
271
- * Node.js fails to enable the compile cache. This can be caused by the lack of
272
- * permission to use the specified directory, or various kinds of file system errors.
273
- * The detail of the failure will be returned in the `message` field in the
274
- * returned object.
275
- */
276
- const FAILED: number;
277
- /**
278
- * Node.js cannot enable the compile cache because the environment variable
279
- * `NODE_DISABLE_COMPILE_CACHE=1` has been set.
280
- */
281
- const DISABLED: number;
282
- }
331
+ lineLengths?: readonly number[] | undefined;
332
+ }
333
+ interface SourceMapPayload {
334
+ file: string;
335
+ version: number;
336
+ sources: string[];
337
+ sourcesContent: string[];
338
+ names: string[];
339
+ mappings: string;
340
+ sourceRoot: string;
341
+ }
342
+ interface SourceMapping {
343
+ generatedLine: number;
344
+ generatedColumn: number;
345
+ originalSource: string;
346
+ originalLine: number;
347
+ originalColumn: number;
348
+ }
349
+ interface SourceOrigin {
350
+ /**
351
+ * The name of the range in the source map, if one was provided
352
+ */
353
+ name: string | undefined;
354
+ /**
355
+ * The file name of the original source, as reported in the SourceMap
356
+ */
357
+ fileName: string;
358
+ /**
359
+ * The 1-indexed lineNumber of the corresponding call site in the original source
360
+ */
361
+ lineNumber: number;
362
+ /**
363
+ * The 1-indexed columnNumber of the corresponding call site in the original source
364
+ */
365
+ columnNumber: number;
283
366
  }
284
- }
285
- interface RegisterOptions<Data> {
286
- parentURL: string | URL;
287
- data?: Data | undefined;
288
- transferList?: any[] | undefined;
289
- }
290
- interface EnableCompileCacheResult {
291
- /**
292
- * One of the {@link constants.compileCacheStatus}
293
- */
294
- status: number;
295
- /**
296
- * If Node.js cannot enable the compile cache, this contains
297
- * the error message. Only set if `status` is `module.constants.compileCacheStatus.FAILED`.
298
- */
299
- message?: string;
300
- /**
301
- * If the compile cache is enabled, this contains the directory
302
- * where the compile cache is stored. Only set if `status` is
303
- * `module.constants.compileCacheStatus.ENABLED` or
304
- * `module.constants.compileCacheStatus.ALREADY_ENABLED`.
305
- */
306
- directory?: string;
307
- }
308
- interface Module extends NodeModule {}
309
- class Module {
310
- static runMain(): void;
311
- static wrap(code: string): string;
312
- static createRequire(path: string | URL): NodeRequire;
313
- static builtinModules: string[];
314
- static isBuiltin(moduleName: string): boolean;
315
- static Module: typeof Module;
316
- static register<Data = any>(
317
- specifier: string | URL,
318
- parentURL?: string | URL,
319
- options?: RegisterOptions<Data>,
320
- ): void;
321
- static register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
322
- /**
323
- * Enable [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
324
- * in the current Node.js instance.
325
- *
326
- * If `cacheDir` is not specified, Node.js will either use the directory specified by the
327
- * `NODE_COMPILE_CACHE=dir` environment variable if it's set, or use
328
- * `path.join(os.tmpdir(), 'node-compile-cache')` otherwise. For general use cases, it's
329
- * recommended to call `module.enableCompileCache()` without specifying the `cacheDir`,
330
- * so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
331
- * variable when necessary.
332
- *
333
- * Since compile cache is supposed to be a quiet optimization that is not required for the
334
- * application to be functional, this method is designed to not throw any exception when the
335
- * compile cache cannot be enabled. Instead, it will return an object containing an error
336
- * message in the `message` field to aid debugging.
337
- * If compile cache is enabled successfully, the `directory` field in the returned object
338
- * contains the path to the directory where the compile cache is stored. The `status`
339
- * field in the returned object would be one of the `module.constants.compileCacheStatus`
340
- * values to indicate the result of the attempt to enable the
341
- * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache).
342
- *
343
- * This method only affects the current Node.js instance. To enable it in child worker threads,
344
- * either call this method in child worker threads too, or set the
345
- * `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can
346
- * be inherited into the child workers. The directory can be obtained either from the
347
- * `directory` field returned by this method, or with {@link getCompileCacheDir}.
348
- * @since v22.8.0
349
- * @param cacheDir Optional path to specify the directory where the compile cache
350
- * will be stored/retrieved.
351
- */
352
- static enableCompileCache(cacheDir?: string): EnableCompileCacheResult;
353
- /**
354
- * @since v22.8.0
355
- * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
356
- * directory if it is enabled, or `undefined` otherwise.
357
- */
358
- static getCompileCacheDir(): string | undefined;
359
367
  /**
360
- * Flush the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
361
- * accumulated from modules already loaded
362
- * in the current Node.js instance to disk. This returns after all the flushing
363
- * file system operations come to an end, no matter they succeed or not. If there
364
- * are any errors, this will fail silently, since compile cache misses should not
365
- * interfere with the actual operation of the application.
366
- * @since v22.10.0
368
+ * @since v13.7.0, v12.17.0
367
369
  */
368
- static flushCompileCache(): void;
369
- constructor(id: string, parent?: Module);
370
+ class SourceMap {
371
+ constructor(payload: SourceMapPayload, options?: SourceMapConstructorOptions);
372
+ /**
373
+ * Getter for the payload used to construct the `SourceMap` instance.
374
+ */
375
+ readonly payload: SourceMapPayload;
376
+ /**
377
+ * Given a line offset and column offset in the generated source
378
+ * file, returns an object representing the SourceMap range in the
379
+ * original file if found, or an empty object if not.
380
+ *
381
+ * The object returned contains the following keys:
382
+ *
383
+ * The returned value represents the raw range as it appears in the
384
+ * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and
385
+ * column numbers as they appear in Error messages and CallSite
386
+ * objects.
387
+ *
388
+ * To get the corresponding 1-indexed line and column numbers from a
389
+ * lineNumber and columnNumber as they are reported by Error stacks
390
+ * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)`
391
+ * @param lineOffset The zero-indexed line number offset in the generated source
392
+ * @param columnOffset The zero-indexed column number offset in the generated source
393
+ */
394
+ findEntry(lineOffset: number, columnOffset: number): SourceMapping | {};
395
+ /**
396
+ * Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source,
397
+ * find the corresponding call site location in the original source.
398
+ *
399
+ * If the `lineNumber` and `columnNumber` provided are not found in any source map,
400
+ * then an empty object is returned.
401
+ * @param lineNumber The 1-indexed line number of the call site in the generated source
402
+ * @param columnNumber The 1-indexed column number of the call site in the generated source
403
+ */
404
+ findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {};
405
+ }
406
+ function runMain(main?: string): void;
407
+ function wrap(script: string): string;
370
408
  }
371
409
  global {
372
410
  interface ImportMeta {
@@ -400,6 +438,180 @@ declare module "module" {
400
438
  */
401
439
  resolve(specifier: string, parent?: string | URL | undefined): string;
402
440
  }
441
+ namespace NodeJS {
442
+ interface Module {
443
+ /**
444
+ * The module objects required for the first time by this one.
445
+ * @since v0.1.16
446
+ */
447
+ children: Module[];
448
+ /**
449
+ * The `module.exports` object is created by the `Module` system. Sometimes this is
450
+ * not acceptable; many want their module to be an instance of some class. To do
451
+ * this, assign the desired export object to `module.exports`.
452
+ * @since v0.1.16
453
+ */
454
+ exports: any;
455
+ /**
456
+ * The fully resolved filename of the module.
457
+ * @since v0.1.16
458
+ */
459
+ filename: string;
460
+ /**
461
+ * The identifier for the module. Typically this is the fully resolved
462
+ * filename.
463
+ * @since v0.1.16
464
+ */
465
+ id: string;
466
+ /**
467
+ * `true` if the module is running during the Node.js preload
468
+ * phase.
469
+ * @since v15.4.0, v14.17.0
470
+ */
471
+ isPreloading: boolean;
472
+ /**
473
+ * Whether or not the module is done loading, or is in the process of
474
+ * loading.
475
+ * @since v0.1.16
476
+ */
477
+ loaded: boolean;
478
+ /**
479
+ * The module that first required this one, or `null` if the current module is the
480
+ * entry point of the current process, or `undefined` if the module was loaded by
481
+ * something that is not a CommonJS module (e.g. REPL or `import`).
482
+ * @since v0.1.16
483
+ * @deprecated Please use `require.main` and `module.children` instead.
484
+ */
485
+ parent: Module | null | undefined;
486
+ /**
487
+ * The directory name of the module. This is usually the same as the
488
+ * `path.dirname()` of the `module.id`.
489
+ * @since v11.14.0
490
+ */
491
+ path: string;
492
+ /**
493
+ * The search paths for the module.
494
+ * @since v0.4.0
495
+ */
496
+ paths: string[];
497
+ /**
498
+ * The `module.require()` method provides a way to load a module as if
499
+ * `require()` was called from the original module.
500
+ * @since v0.5.1
501
+ */
502
+ require(id: string): any;
503
+ }
504
+ interface Require {
505
+ /**
506
+ * Used to import modules, `JSON`, and local files.
507
+ * @since v0.1.13
508
+ */
509
+ (id: string): any;
510
+ /**
511
+ * Modules are cached in this object when they are required. By deleting a key
512
+ * value from this object, the next `require` will reload the module.
513
+ * This does not apply to
514
+ * [native addons](https://nodejs.org/docs/latest-v22.x/api/addons.html),
515
+ * for which reloading will result in an error.
516
+ * @since v0.3.0
517
+ */
518
+ cache: Dict<Module>;
519
+ /**
520
+ * Instruct `require` on how to handle certain file extensions.
521
+ * @since v0.3.0
522
+ * @deprecated
523
+ */
524
+ extensions: RequireExtensions;
525
+ /**
526
+ * The `Module` object representing the entry script loaded when the Node.js
527
+ * process launched, or `undefined` if the entry point of the program is not a
528
+ * CommonJS module.
529
+ * @since v0.1.17
530
+ */
531
+ main: Module | undefined;
532
+ /**
533
+ * @since v0.3.0
534
+ */
535
+ resolve: RequireResolve;
536
+ }
537
+ /** @deprecated */
538
+ interface RequireExtensions extends Dict<(module: Module, filename: string) => any> {
539
+ ".js": (module: Module, filename: string) => any;
540
+ ".json": (module: Module, filename: string) => any;
541
+ ".node": (module: Module, filename: string) => any;
542
+ }
543
+ interface RequireResolveOptions {
544
+ /**
545
+ * Paths to resolve module location from. If present, these
546
+ * paths are used instead of the default resolution paths, with the exception
547
+ * of
548
+ * [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v22.x/api/modules.html#loading-from-the-global-folders)
549
+ * like `$HOME/.node_modules`, which are
550
+ * always included. Each of these paths is used as a starting point for
551
+ * the module resolution algorithm, meaning that the `node_modules` hierarchy
552
+ * is checked from this location.
553
+ * @since v8.9.0
554
+ */
555
+ paths?: string[] | undefined;
556
+ }
557
+ interface RequireResolve {
558
+ /**
559
+ * Use the internal `require()` machinery to look up the location of a module,
560
+ * but rather than loading the module, just return the resolved filename.
561
+ *
562
+ * If the module can not be found, a `MODULE_NOT_FOUND` error is thrown.
563
+ * @since v0.3.0
564
+ * @param request The module path to resolve.
565
+ */
566
+ (request: string, options?: RequireResolveOptions): string;
567
+ /**
568
+ * Returns an array containing the paths searched during resolution of `request` or
569
+ * `null` if the `request` string references a core module, for example `http` or
570
+ * `fs`.
571
+ * @since v8.9.0
572
+ * @param request The module path whose lookup paths are being retrieved.
573
+ */
574
+ paths(request: string): string[] | null;
575
+ }
576
+ }
577
+ /**
578
+ * The directory name of the current module. This is the same as the
579
+ * `path.dirname()` of the `__filename`.
580
+ * @since v0.1.27
581
+ */
582
+ var __dirname: string;
583
+ /**
584
+ * The file name of the current module. This is the current module file's absolute
585
+ * path with symlinks resolved.
586
+ *
587
+ * For a main program this is not necessarily the same as the file name used in the
588
+ * command line.
589
+ * @since v0.0.1
590
+ */
591
+ var __filename: string;
592
+ /**
593
+ * The `exports` variable is available within a module's file-level scope, and is
594
+ * assigned the value of `module.exports` before the module is evaluated.
595
+ * @since v0.1.16
596
+ */
597
+ var exports: NodeJS.Module["exports"];
598
+ /**
599
+ * A reference to the current module.
600
+ * @since v0.1.16
601
+ */
602
+ var module: NodeJS.Module;
603
+ /**
604
+ * @since v0.1.13
605
+ */
606
+ var require: NodeJS.Require;
607
+ // Global-scope aliases for backwards compatibility with @types/node <13.0.x
608
+ // TODO: consider removing in a future major version update
609
+ /** @deprecated Use `NodeJS.Module` instead. */
610
+ interface NodeModule extends NodeJS.Module {}
611
+ /** @deprecated Use `NodeJS.Require` instead. */
612
+ interface NodeRequire extends NodeJS.Require {}
613
+ /** @deprecated Use `NodeJS.RequireResolve` instead. */
614
+ interface RequireResolve extends NodeJS.RequireResolve {}
403
615
  }
404
616
  export = Module;
405
617
  }