@rio-cloud/cdk-v2-constructs 8.2.0 → 8.2.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.
Files changed (179) hide show
  1. package/.jsii +2 -2
  2. package/node_modules/@types/node/README.md +3 -3
  3. package/node_modules/@types/node/assert/strict.d.ts +105 -2
  4. package/node_modules/@types/node/assert.d.ts +211 -92
  5. package/node_modules/@types/node/async_hooks.d.ts +103 -19
  6. package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
  7. package/node_modules/@types/node/buffer.d.ts +88 -516
  8. package/node_modules/@types/node/child_process.d.ts +167 -231
  9. package/node_modules/@types/node/cluster.d.ts +172 -26
  10. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  11. package/node_modules/@types/node/console.d.ts +66 -28
  12. package/node_modules/@types/node/constants.d.ts +14 -12
  13. package/node_modules/@types/node/crypto.d.ts +1458 -497
  14. package/node_modules/@types/node/dgram.d.ts +44 -30
  15. package/node_modules/@types/node/diagnostics_channel.d.ts +389 -4
  16. package/node_modules/@types/node/dns/promises.d.ts +120 -42
  17. package/node_modules/@types/node/dns.d.ts +209 -95
  18. package/node_modules/@types/node/domain.d.ts +14 -18
  19. package/node_modules/@types/node/events.d.ts +245 -113
  20. package/node_modules/@types/node/fs/promises.d.ts +194 -96
  21. package/node_modules/@types/node/fs.d.ts +695 -270
  22. package/node_modules/@types/node/globals.d.ts +97 -308
  23. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  24. package/node_modules/@types/node/http.d.ts +363 -97
  25. package/node_modules/@types/node/http2.d.ts +684 -231
  26. package/node_modules/@types/node/https.d.ts +122 -87
  27. package/node_modules/@types/node/index.d.ts +24 -11
  28. package/node_modules/@types/node/inspector.d.ts +220 -2690
  29. package/node_modules/@types/node/inspector.generated.d.ts +4239 -0
  30. package/node_modules/@types/node/module.d.ts +705 -149
  31. package/node_modules/@types/node/net.d.ts +178 -54
  32. package/node_modules/@types/node/os.d.ts +47 -17
  33. package/node_modules/@types/node/package.json +22 -97
  34. package/node_modules/@types/node/path.d.ts +12 -3
  35. package/node_modules/@types/node/perf_hooks.d.ts +500 -97
  36. package/node_modules/@types/node/process.d.ts +657 -87
  37. package/node_modules/@types/node/punycode.d.ts +5 -5
  38. package/node_modules/@types/node/querystring.d.ts +24 -13
  39. package/node_modules/@types/node/readline/promises.d.ts +25 -14
  40. package/node_modules/@types/node/readline.d.ts +102 -41
  41. package/node_modules/@types/node/repl.d.ts +38 -30
  42. package/node_modules/@types/node/sea.d.ts +162 -0
  43. package/node_modules/@types/node/sqlite.d.ts +1040 -0
  44. package/node_modules/@types/node/stream/consumers.d.ts +33 -7
  45. package/node_modules/@types/node/stream/promises.d.ts +8 -1
  46. package/node_modules/@types/node/stream/web.d.ts +251 -28
  47. package/node_modules/@types/node/stream.d.ts +1060 -1055
  48. package/node_modules/@types/node/string_decoder.d.ts +8 -8
  49. package/node_modules/@types/node/test.d.ts +2133 -1166
  50. package/node_modules/@types/node/timers/promises.d.ts +31 -16
  51. package/node_modules/@types/node/timers.d.ts +159 -114
  52. package/node_modules/@types/node/tls.d.ts +232 -163
  53. package/node_modules/@types/node/trace_events.d.ts +43 -28
  54. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
  55. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  56. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  57. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  58. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  59. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  60. package/node_modules/@types/node/tty.d.ts +9 -9
  61. package/node_modules/@types/node/url.d.ts +236 -84
  62. package/node_modules/@types/node/util.d.ts +562 -412
  63. package/node_modules/@types/node/v8.d.ts +368 -21
  64. package/node_modules/@types/node/vm.d.ts +443 -149
  65. package/node_modules/@types/node/wasi.d.ts +62 -18
  66. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  67. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  68. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  69. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  72. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  73. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  74. package/node_modules/@types/node/worker_threads.d.ts +310 -107
  75. package/node_modules/@types/node/zlib.d.ts +301 -73
  76. package/node_modules/undici-types/LICENSE +21 -0
  77. package/node_modules/undici-types/agent.d.ts +13 -12
  78. package/node_modules/undici-types/api.d.ts +26 -26
  79. package/node_modules/undici-types/balanced-pool.d.ts +19 -7
  80. package/node_modules/undici-types/cache-interceptor.d.ts +173 -0
  81. package/node_modules/undici-types/client-stats.d.ts +15 -0
  82. package/node_modules/undici-types/client.d.ts +26 -15
  83. package/node_modules/undici-types/connector.d.ts +2 -2
  84. package/node_modules/undici-types/cookies.d.ts +2 -0
  85. package/node_modules/undici-types/diagnostics-channel.d.ts +19 -12
  86. package/node_modules/undici-types/dispatcher.d.ts +148 -113
  87. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  88. package/node_modules/undici-types/errors.d.ts +79 -46
  89. package/node_modules/undici-types/eventsource.d.ts +66 -0
  90. package/node_modules/undici-types/fetch.d.ts +41 -39
  91. package/node_modules/undici-types/formdata.d.ts +8 -8
  92. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  93. package/node_modules/undici-types/global-origin.d.ts +5 -5
  94. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  95. package/node_modules/undici-types/handlers.d.ts +11 -5
  96. package/node_modules/undici-types/header.d.ts +157 -1
  97. package/node_modules/undici-types/index.d.ts +68 -43
  98. package/node_modules/undici-types/interceptors.d.ts +71 -3
  99. package/node_modules/undici-types/mock-agent.d.ts +36 -18
  100. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  101. package/node_modules/undici-types/mock-client.d.ts +6 -4
  102. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  103. package/node_modules/undici-types/mock-interceptor.d.ts +24 -23
  104. package/node_modules/undici-types/mock-pool.d.ts +6 -4
  105. package/node_modules/undici-types/package.json +1 -1
  106. package/node_modules/undici-types/patch.d.ts +0 -42
  107. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  108. package/node_modules/undici-types/pool.d.ts +21 -8
  109. package/node_modules/undici-types/proxy-agent.d.ts +5 -6
  110. package/node_modules/undici-types/readable.d.ts +24 -17
  111. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  112. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  113. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  114. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  115. package/node_modules/undici-types/util.d.ts +18 -0
  116. package/node_modules/undici-types/utility.d.ts +7 -0
  117. package/node_modules/undici-types/webidl.d.ts +157 -36
  118. package/node_modules/undici-types/websocket.d.ts +67 -12
  119. package/package.json +9 -60
  120. package/version.json +1 -1
  121. package/node_modules/@types/node/dom-events.d.ts +0 -122
  122. package/node_modules/@types/node/globals.global.d.ts +0 -1
  123. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  124. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  125. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  126. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  127. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  128. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  129. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  130. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  131. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4455
  132. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -586
  133. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -191
  134. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  135. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  136. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  137. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  138. package/node_modules/@types/node/ts4.8/events.d.ts +0 -796
  139. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1232
  140. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4289
  141. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -381
  142. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  143. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1888
  144. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  145. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  146. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  147. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  148. package/node_modules/@types/node/ts4.8/module.d.ts +0 -287
  149. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  150. package/node_modules/@types/node/ts4.8/os.d.ts +0 -477
  151. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  152. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -639
  153. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1532
  154. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  155. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  156. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  157. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  158. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  159. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  160. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  161. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -350
  162. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  163. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  164. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1382
  165. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  166. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  167. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  168. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  169. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  170. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  171. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2186
  172. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -635
  173. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -901
  174. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -158
  175. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  176. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  177. package/node_modules/argparse/CHANGELOG.md +0 -216
  178. package/node_modules/undici-types/file.d.ts +0 -39
  179. package/node_modules/undici-types/filereader.d.ts +0 -54
@@ -1,20 +1,345 @@
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 {}
10
+ namespace Module {
11
+ export { Module };
12
+ }
8
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-v24.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
+ interface EnableCompileCacheOptions {
84
+ /**
85
+ * Optional. Directory to store the compile cache. If not specified, the directory specified by
86
+ * the [`NODE_COMPILE_CACHE=dir`](https://nodejs.org/docs/latest-v24.x/api/cli.html#node_compile_cachedir)
87
+ * environment variable will be used if it's set, or `path.join(os.tmpdir(), 'node-compile-cache')` otherwise.
88
+ * @since v24.12.0
89
+ */
90
+ directory?: string | undefined;
91
+ /**
92
+ * Optional. If `true`, enables portable compile cache so that the cache can be reused even if the project directory
93
+ * is moved. This is a best-effort feature. If not specified, it will depend on whether the environment variable
94
+ * [NODE_COMPILE_CACHE_PORTABLE=1](https://nodejs.org/docs/latest-v24.x/api/cli.html#node_compile_cache_portable1) is set.
95
+ * @since v24.12.0
96
+ */
97
+ portable?: boolean | undefined;
98
+ }
99
+ /**
100
+ * Enable [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
101
+ * in the current Node.js instance.
102
+ *
103
+ * For general use cases, it's recommended to call `module.enableCompileCache()` without specifying the
104
+ * `options.directory`, so that the directory can be overridden by the `NODE_COMPILE_CACHE` environment
105
+ * variable when necessary.
106
+ *
107
+ * Since compile cache is supposed to be a optimization that is not mission critical, this method is
108
+ * designed to not throw any exception when the compile cache cannot be enabled. Instead, it will return
109
+ * an object containing an error message in the `message` field to aid debugging. If compile cache is
110
+ * enabled successfully, the `directory` field in the returned object contains the path to the directory
111
+ * where the compile cache is stored. The `status` field in the returned object would be one of the
112
+ * `module.constants.compileCacheStatus` values to indicate the result of the attempt to enable the
113
+ * [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache).
114
+ *
115
+ * This method only affects the current Node.js instance. To enable it in child worker threads,
116
+ * either call this method in child worker threads too, or set the
117
+ * `process.env.NODE_COMPILE_CACHE` value to compile cache directory so the behavior can
118
+ * be inherited into the child workers. The directory can be obtained either from the
119
+ * `directory` field returned by this method, or with {@link getCompileCacheDir `module.getCompileCacheDir()`}.
120
+ * @since v22.8.0
121
+ * @param options Optional. If a string is passed, it is considered to be `options.directory`.
122
+ * will be stored/retrieved.
123
+ */
124
+ function enableCompileCache(options?: string | EnableCompileCacheOptions): EnableCompileCacheResult;
125
+ /**
126
+ * Flush the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
127
+ * accumulated from modules already loaded
128
+ * in the current Node.js instance to disk. This returns after all the flushing
129
+ * file system operations come to an end, no matter they succeed or not. If there
130
+ * are any errors, this will fail silently, since compile cache misses should not
131
+ * interfere with the actual operation of the application.
132
+ * @since v22.10.0
133
+ */
134
+ function flushCompileCache(): void;
135
+ /**
136
+ * @since v22.8.0
137
+ * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v24.x/api/module.html#module-compile-cache)
138
+ * directory if it is enabled, or `undefined` otherwise.
139
+ */
140
+ function getCompileCacheDir(): string | undefined;
141
+ /**
142
+ * ```text
143
+ * /path/to/project
144
+ * ├ packages/
145
+ * ├ bar/
146
+ * ├ bar.js
147
+ * └ package.json // name = '@foo/bar'
148
+ * └ qux/
149
+ * ├ node_modules/
150
+ * └ some-package/
151
+ * └ package.json // name = 'some-package'
152
+ * ├ qux.js
153
+ * └ package.json // name = '@foo/qux'
154
+ * ├ main.js
155
+ * └ package.json // name = '@foo'
156
+ * ```
157
+ * ```js
158
+ * // /path/to/project/packages/bar/bar.js
159
+ * import { findPackageJSON } from 'node:module';
160
+ *
161
+ * findPackageJSON('..', import.meta.url);
162
+ * // '/path/to/project/package.json'
163
+ * // Same result when passing an absolute specifier instead:
164
+ * findPackageJSON(new URL('../', import.meta.url));
165
+ * findPackageJSON(import.meta.resolve('../'));
166
+ *
167
+ * findPackageJSON('some-package', import.meta.url);
168
+ * // '/path/to/project/packages/bar/node_modules/some-package/package.json'
169
+ * // When passing an absolute specifier, you might get a different result if the
170
+ * // resolved module is inside a subfolder that has nested `package.json`.
171
+ * findPackageJSON(import.meta.resolve('some-package'));
172
+ * // '/path/to/project/packages/bar/node_modules/some-package/some-subfolder/package.json'
173
+ *
174
+ * findPackageJSON('@foo/qux', import.meta.url);
175
+ * // '/path/to/project/packages/qux/package.json'
176
+ * ```
177
+ * @since v22.14.0
178
+ * @param specifier The specifier for the module whose `package.json` to
179
+ * retrieve. When passing a _bare specifier_, the `package.json` at the root of
180
+ * the package is returned. When passing a _relative specifier_ or an _absolute specifier_,
181
+ * the closest parent `package.json` is returned.
182
+ * @param base The absolute location (`file:` URL string or FS path) of the
183
+ * containing module. For CJS, use `__filename` (not `__dirname`!); for ESM, use
184
+ * `import.meta.url`. You do not need to pass it if `specifier` is an _absolute specifier_.
185
+ * @returns A path if the `package.json` is found. When `startLocation`
186
+ * is a package, the package's root `package.json`; when a relative or unresolved, the closest
187
+ * `package.json` to the `startLocation`.
188
+ */
189
+ function findPackageJSON(specifier: string | URL, base?: string | URL): string | undefined;
190
+ /**
191
+ * @since v18.6.0, v16.17.0
192
+ */
193
+ function isBuiltin(moduleName: string): boolean;
194
+ interface RegisterOptions<Data> {
195
+ /**
196
+ * If you want to resolve `specifier` relative to a
197
+ * base URL, such as `import.meta.url`, you can pass that URL here. This
198
+ * property is ignored if the `parentURL` is supplied as the second argument.
199
+ * @default 'data:'
200
+ */
201
+ parentURL?: string | URL | undefined;
202
+ /**
203
+ * Any arbitrary, cloneable JavaScript value to pass into the
204
+ * {@link initialize} hook.
205
+ */
206
+ data?: Data | undefined;
207
+ /**
208
+ * [Transferable objects](https://nodejs.org/docs/latest-v24.x/api/worker_threads.html#portpostmessagevalue-transferlist)
209
+ * to be passed into the `initialize` hook.
210
+ */
211
+ transferList?: any[] | undefined;
212
+ }
213
+ /* eslint-disable @definitelytyped/no-unnecessary-generics */
214
+ /**
215
+ * Register a module that exports hooks that customize Node.js module
216
+ * resolution and loading behavior. See
217
+ * [Customization hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks).
218
+ *
219
+ * This feature requires `--allow-worker` if used with the
220
+ * [Permission Model](https://nodejs.org/docs/latest-v24.x/api/permissions.html#permission-model).
221
+ * @since v20.6.0, v18.19.0
222
+ * @param specifier Customization hooks to be registered; this should be
223
+ * the same string that would be passed to `import()`, except that if it is
224
+ * relative, it is resolved relative to `parentURL`.
225
+ * @param parentURL f you want to resolve `specifier` relative to a base
226
+ * URL, such as `import.meta.url`, you can pass that URL here.
227
+ */
228
+ function register<Data = any>(
229
+ specifier: string | URL,
230
+ parentURL?: string | URL,
231
+ options?: RegisterOptions<Data>,
232
+ ): void;
233
+ function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
234
+ interface RegisterHooksOptions {
235
+ /**
236
+ * See [load hook](https://nodejs.org/docs/latest-v24.x/api/module.html#loadurl-context-nextload).
237
+ * @default undefined
238
+ */
239
+ load?: LoadHookSync | undefined;
240
+ /**
241
+ * See [resolve hook](https://nodejs.org/docs/latest-v24.x/api/module.html#resolvespecifier-context-nextresolve).
242
+ * @default undefined
243
+ */
244
+ resolve?: ResolveHookSync | undefined;
245
+ }
246
+ interface ModuleHooks {
247
+ /**
248
+ * Deregister the hook instance.
249
+ */
250
+ deregister(): void;
251
+ }
252
+ /**
253
+ * Register [hooks](https://nodejs.org/docs/latest-v24.x/api/module.html#customization-hooks)
254
+ * that customize Node.js module resolution and loading behavior.
255
+ * @since v22.15.0
256
+ * @experimental
257
+ */
258
+ function registerHooks(options: RegisterHooksOptions): ModuleHooks;
259
+ interface StripTypeScriptTypesOptions {
260
+ /**
261
+ * Possible values are:
262
+ * * `'strip'` Only strip type annotations without performing the transformation of TypeScript features.
263
+ * * `'transform'` Strip type annotations and transform TypeScript features to JavaScript.
264
+ * @default 'strip'
265
+ */
266
+ mode?: "strip" | "transform" | undefined;
267
+ /**
268
+ * Only when `mode` is `'transform'`, if `true`, a source map
269
+ * will be generated for the transformed code.
270
+ * @default false
271
+ */
272
+ sourceMap?: boolean | undefined;
273
+ /**
274
+ * Specifies the source url used in the source map.
275
+ */
276
+ sourceUrl?: string | undefined;
277
+ }
278
+ /**
279
+ * `module.stripTypeScriptTypes()` removes type annotations from TypeScript code. It
280
+ * can be used to strip type annotations from TypeScript code before running it
281
+ * with `vm.runInContext()` or `vm.compileFunction()`.
282
+ * By default, it will throw an error if the code contains TypeScript features
283
+ * that require transformation such as `Enums`,
284
+ * see [type-stripping](https://nodejs.org/docs/latest-v24.x/api/typescript.md#type-stripping) for more information.
285
+ * When mode is `'transform'`, it also transforms TypeScript features to JavaScript,
286
+ * see [transform TypeScript features](https://nodejs.org/docs/latest-v24.x/api/typescript.md#typescript-features) for more information.
287
+ * When mode is `'strip'`, source maps are not generated, because locations are preserved.
288
+ * If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown.
289
+ *
290
+ * _WARNING_: The output of this function should not be considered stable across Node.js versions,
291
+ * due to changes in the TypeScript parser.
292
+ *
293
+ * ```js
294
+ * import { stripTypeScriptTypes } from 'node:module';
295
+ * const code = 'const a: number = 1;';
296
+ * const strippedCode = stripTypeScriptTypes(code);
297
+ * console.log(strippedCode);
298
+ * // Prints: const a = 1;
299
+ * ```
300
+ *
301
+ * If `sourceUrl` is provided, it will be used appended as a comment at the end of the output:
302
+ *
303
+ * ```js
304
+ * import { stripTypeScriptTypes } from 'node:module';
305
+ * const code = 'const a: number = 1;';
306
+ * const strippedCode = stripTypeScriptTypes(code, { mode: 'strip', sourceUrl: 'source.ts' });
307
+ * console.log(strippedCode);
308
+ * // Prints: const a = 1\n\n//# sourceURL=source.ts;
309
+ * ```
310
+ *
311
+ * When `mode` is `'transform'`, the code is transformed to JavaScript:
312
+ *
313
+ * ```js
314
+ * import { stripTypeScriptTypes } from 'node:module';
315
+ * const code = `
316
+ * namespace MathUtil {
317
+ * export const add = (a: number, b: number) => a + b;
318
+ * }`;
319
+ * const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true });
320
+ * console.log(strippedCode);
321
+ * // Prints:
322
+ * // var MathUtil;
323
+ * // (function(MathUtil) {
324
+ * // MathUtil.add = (a, b)=>a + b;
325
+ * // })(MathUtil || (MathUtil = {}));
326
+ * // # sourceMappingURL=data:application/json;base64, ...
327
+ * ```
328
+ * @since v22.13.0
329
+ * @param code The code to strip type annotations from.
330
+ * @returns The code with type annotations stripped.
331
+ */
332
+ function stripTypeScriptTypes(code: string, options?: StripTypeScriptTypesOptions): string;
333
+ /* eslint-enable @definitelytyped/no-unnecessary-generics */
9
334
  /**
10
335
  * The `module.syncBuiltinESMExports()` method updates all the live bindings for
11
336
  * builtin `ES Modules` to match the properties of the `CommonJS` exports. It
12
337
  * does not add or remove exported names from the `ES Modules`.
13
338
  *
14
339
  * ```js
15
- * const fs = require('node:fs');
16
- * const assert = require('node:assert');
17
- * const { syncBuiltinESMExports } = require('node:module');
340
+ * import fs from 'node:fs';
341
+ * import assert from 'node:assert';
342
+ * import { syncBuiltinESMExports } from 'node:module';
18
343
  *
19
344
  * fs.readFile = newAPI;
20
345
  *
@@ -42,13 +367,134 @@ declare module "module" {
42
367
  * @since v12.12.0
43
368
  */
44
369
  function syncBuiltinESMExports(): void;
370
+ interface ImportAttributes extends NodeJS.Dict<string> {
371
+ type?: string | undefined;
372
+ }
373
+ type ImportPhase = "source" | "evaluation";
374
+ type ModuleFormat =
375
+ | "addon"
376
+ | "builtin"
377
+ | "commonjs"
378
+ | "commonjs-typescript"
379
+ | "json"
380
+ | "module"
381
+ | "module-typescript"
382
+ | "wasm";
383
+ type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
384
+ type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
385
+ interface ResolveHookContext {
386
+ conditions: string[];
387
+ importAttributes: ImportAttributes;
388
+ parentURL: string | undefined;
389
+ }
390
+ interface ResolveFnOutput {
391
+ format?: string | null | undefined;
392
+ importAttributes?: ImportAttributes | undefined;
393
+ shortCircuit?: boolean | undefined;
394
+ url: string;
395
+ }
396
+ type ResolveHook = (
397
+ specifier: string,
398
+ context: ResolveHookContext,
399
+ nextResolve: (
400
+ specifier: string,
401
+ context?: Partial<ResolveHookContext>,
402
+ ) => ResolveFnOutput | Promise<ResolveFnOutput>,
403
+ ) => ResolveFnOutput | Promise<ResolveFnOutput>;
404
+ type ResolveHookSync = (
405
+ specifier: string,
406
+ context: ResolveHookContext,
407
+ nextResolve: (
408
+ specifier: string,
409
+ context?: Partial<ResolveHookContext>,
410
+ ) => ResolveFnOutput,
411
+ ) => ResolveFnOutput;
412
+ interface LoadHookContext {
413
+ conditions: string[];
414
+ format: string | null | undefined;
415
+ importAttributes: ImportAttributes;
416
+ }
417
+ interface LoadFnOutput {
418
+ format: string | null | undefined;
419
+ shortCircuit?: boolean | undefined;
420
+ source?: ModuleSource | undefined;
421
+ }
422
+ type LoadHook = (
423
+ url: string,
424
+ context: LoadHookContext,
425
+ nextLoad: (
426
+ url: string,
427
+ context?: Partial<LoadHookContext>,
428
+ ) => LoadFnOutput | Promise<LoadFnOutput>,
429
+ ) => LoadFnOutput | Promise<LoadFnOutput>;
430
+ type LoadHookSync = (
431
+ url: string,
432
+ context: LoadHookContext,
433
+ nextLoad: (
434
+ url: string,
435
+ context?: Partial<LoadHookContext>,
436
+ ) => LoadFnOutput,
437
+ ) => LoadFnOutput;
438
+ interface SourceMapsSupport {
439
+ /**
440
+ * If the source maps support is enabled
441
+ */
442
+ enabled: boolean;
443
+ /**
444
+ * If the support is enabled for files in `node_modules`.
445
+ */
446
+ nodeModules: boolean;
447
+ /**
448
+ * If the support is enabled for generated code from `eval` or `new Function`.
449
+ */
450
+ generatedCode: boolean;
451
+ }
452
+ /**
453
+ * This method returns whether the [Source Map v3](https://tc39.es/ecma426/) support for stack
454
+ * traces is enabled.
455
+ * @since v23.7.0, v22.14.0
456
+ */
457
+ function getSourceMapsSupport(): SourceMapsSupport;
45
458
  /**
46
459
  * `path` is the resolved path for the file for which a corresponding source map
47
460
  * should be fetched.
48
461
  * @since v13.7.0, v12.17.0
49
462
  * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise.
50
463
  */
51
- function findSourceMap(path: string, error?: Error): SourceMap;
464
+ function findSourceMap(path: string): SourceMap | undefined;
465
+ interface SetSourceMapsSupportOptions {
466
+ /**
467
+ * If enabling the support for files in `node_modules`.
468
+ * @default false
469
+ */
470
+ nodeModules?: boolean | undefined;
471
+ /**
472
+ * If enabling the support for generated code from `eval` or `new Function`.
473
+ * @default false
474
+ */
475
+ generatedCode?: boolean | undefined;
476
+ }
477
+ /**
478
+ * This function enables or disables the [Source Map v3](https://tc39.es/ecma426/) support for
479
+ * stack traces.
480
+ *
481
+ * It provides same features as launching Node.js process with commandline options
482
+ * `--enable-source-maps`, with additional options to alter the support for files
483
+ * in `node_modules` or generated codes.
484
+ *
485
+ * Only source maps in JavaScript files that are loaded after source maps has been
486
+ * enabled will be parsed and loaded. Preferably, use the commandline options
487
+ * `--enable-source-maps` to avoid losing track of source maps of modules loaded
488
+ * before this API call.
489
+ * @since v23.7.0, v22.14.0
490
+ */
491
+ function setSourceMapsSupport(enabled: boolean, options?: SetSourceMapsSupportOptions): void;
492
+ interface SourceMapConstructorOptions {
493
+ /**
494
+ * @since v21.0.0, v20.5.0
495
+ */
496
+ lineLengths?: readonly number[] | undefined;
497
+ }
52
498
  interface SourceMapPayload {
53
499
  file: string;
54
500
  version: number;
@@ -69,7 +515,7 @@ declare module "module" {
69
515
  /**
70
516
  * The name of the range in the source map, if one was provided
71
517
  */
72
- name?: string;
518
+ name: string | undefined;
73
519
  /**
74
520
  * The file name of the original source, as reported in the SourceMap
75
521
  */
@@ -87,11 +533,11 @@ declare module "module" {
87
533
  * @since v13.7.0, v12.17.0
88
534
  */
89
535
  class SourceMap {
536
+ constructor(payload: SourceMapPayload, options?: SourceMapConstructorOptions);
90
537
  /**
91
538
  * Getter for the payload used to construct the `SourceMap` instance.
92
539
  */
93
540
  readonly payload: SourceMapPayload;
94
- constructor(payload: SourceMapPayload);
95
541
  /**
96
542
  * Given a line offset and column offset in the generated source
97
543
  * file, returns an object representing the SourceMap range in the
@@ -110,7 +556,7 @@ declare module "module" {
110
556
  * @param lineOffset The zero-indexed line number offset in the generated source
111
557
  * @param columnOffset The zero-indexed column number offset in the generated source
112
558
  */
113
- findEntry(lineOffset: number, columnOffset: number): SourceMapping;
559
+ findEntry(lineOffset: number, columnOffset: number): SourceMapping | {};
114
560
  /**
115
561
  * Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source,
116
562
  * find the corresponding call site location in the original source.
@@ -122,162 +568,272 @@ declare module "module" {
122
568
  */
123
569
  findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {};
124
570
  }
125
- interface ImportAssertions extends NodeJS.Dict<string> {
126
- type?: string | undefined;
127
- }
128
- type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm";
129
- type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
130
- interface GlobalPreloadContext {
131
- port: MessagePort;
132
- }
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
- *
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.
139
- *
140
- * @param context Information to assist the preload code
141
- * @return Code to run before application startup
142
- */
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>;
152
- interface ResolveHookContext {
153
- /**
154
- * Export conditions of the relevant `package.json`
155
- */
156
- conditions: string[];
157
- /**
158
- * An object whose key-value pairs represent the assertions for the module to import
159
- */
160
- importAssertions: ImportAssertions;
161
- /**
162
- * The module importing this one, or undefined if this is the Node.js entry point
163
- */
164
- parentURL: string | undefined;
165
- }
166
- interface ResolveFnOutput {
167
- /**
168
- * A hint to the load hook (it might be ignored)
169
- */
170
- format?: ModuleFormat | null | undefined;
571
+ function runMain(main?: string): void;
572
+ function wrap(script: string): string;
573
+ }
574
+ global {
575
+ interface ImportMeta {
171
576
  /**
172
- * The import assertions to use when caching the module (optional; if excluded the input will be used)
577
+ * The directory name of the current module.
578
+ *
579
+ * This is the same as the `path.dirname()` of the `import.meta.filename`.
580
+ *
581
+ * > **Caveat**: only present on `file:` modules.
582
+ * @since v21.2.0, v20.11.0
173
583
  */
174
- importAssertions?: ImportAssertions | undefined;
584
+ dirname: string;
175
585
  /**
176
- * A signal that this hook intends to terminate the chain of `resolve` hooks.
177
- * @default false
586
+ * The full absolute path and filename of the current module, with
587
+ * symlinks resolved.
588
+ *
589
+ * This is the same as the `url.fileURLToPath()` of the `import.meta.url`.
590
+ *
591
+ * > **Caveat** only local modules support this property. Modules not using the
592
+ * > `file:` protocol will not provide it.
593
+ * @since v21.2.0, v20.11.0
178
594
  */
179
- shortCircuit?: boolean | undefined;
595
+ filename: string;
180
596
  /**
181
- * The absolute URL to which this input resolves
597
+ * The absolute `file:` URL of the module.
598
+ *
599
+ * This is defined exactly the same as it is in browsers providing the URL of the
600
+ * current module file.
601
+ *
602
+ * This enables useful patterns such as relative file loading:
603
+ *
604
+ * ```js
605
+ * import { readFileSync } from 'node:fs';
606
+ * const buffer = readFileSync(new URL('./data.proto', import.meta.url));
607
+ * ```
182
608
  */
183
609
  url: string;
184
- }
185
- /**
186
- * 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.
187
- * 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`);
188
- * 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.
189
- *
190
- * @param specifier The specified URL path of the module to be resolved
191
- * @param context
192
- * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook
193
- */
194
- type ResolveHook = (
195
- specifier: string,
196
- context: ResolveHookContext,
197
- nextResolve: (
198
- specifier: string,
199
- context?: ResolveHookContext,
200
- ) => ResolveFnOutput | Promise<ResolveFnOutput>,
201
- ) => ResolveFnOutput | Promise<ResolveFnOutput>;
202
- interface LoadHookContext {
203
610
  /**
204
- * Export conditions of the relevant `package.json`
205
- */
206
- conditions: string[];
207
- /**
208
- * The format optionally supplied by the `resolve` hook chain
611
+ * `import.meta.resolve` is a module-relative resolution function scoped to
612
+ * each module, returning the URL string.
613
+ *
614
+ * ```js
615
+ * const dependencyAsset = import.meta.resolve('component-lib/asset.css');
616
+ * // file:///app/node_modules/component-lib/asset.css
617
+ * import.meta.resolve('./dep.js');
618
+ * // file:///app/dep.js
619
+ * ```
620
+ *
621
+ * All features of the Node.js module resolution are supported. Dependency
622
+ * resolutions are subject to the permitted exports resolutions within the package.
623
+ *
624
+ * **Caveats**:
625
+ *
626
+ * * This can result in synchronous file-system operations, which
627
+ * can impact performance similarly to `require.resolve`.
628
+ * * This feature is not available within custom loaders (it would
629
+ * create a deadlock).
630
+ * @since v13.9.0, v12.16.0
631
+ * @param specifier The module specifier to resolve relative to the
632
+ * current module.
633
+ * @param parent An optional absolute parent module URL to resolve from.
634
+ * **Default:** `import.meta.url`
635
+ * @returns The absolute URL string that the specifier would resolve to.
209
636
  */
210
- format: ModuleFormat;
637
+ resolve(specifier: string, parent?: string | URL): string;
211
638
  /**
212
- * An object whose key-value pairs represent the assertions for the module to import
639
+ * `true` when the current module is the entry point of the current process; `false` otherwise.
640
+ *
641
+ * Equivalent to `require.main === module` in CommonJS.
642
+ *
643
+ * Analogous to Python's `__name__ == "__main__"`.
644
+ *
645
+ * ```js
646
+ * export function foo() {
647
+ * return 'Hello, world';
648
+ * }
649
+ *
650
+ * function main() {
651
+ * const message = foo();
652
+ * console.log(message);
653
+ * }
654
+ *
655
+ * if (import.meta.main) main();
656
+ * // `foo` can be imported from another module without possible side-effects from `main`
657
+ * ```
658
+ * @since v24.2.0
659
+ * @experimental
213
660
  */
214
- importAssertions: ImportAssertions;
661
+ main: boolean;
215
662
  }
216
- interface LoadFnOutput {
217
- format: ModuleFormat;
218
- /**
219
- * A signal that this hook intends to terminate the chain of `resolve` hooks.
220
- * @default false
221
- */
222
- shortCircuit?: boolean | undefined;
223
- /**
224
- * The source for Node.js to evaluate
225
- */
226
- source?: ModuleSource;
663
+ namespace NodeJS {
664
+ interface Module {
665
+ /**
666
+ * The module objects required for the first time by this one.
667
+ * @since v0.1.16
668
+ */
669
+ children: Module[];
670
+ /**
671
+ * The `module.exports` object is created by the `Module` system. Sometimes this is
672
+ * not acceptable; many want their module to be an instance of some class. To do
673
+ * this, assign the desired export object to `module.exports`.
674
+ * @since v0.1.16
675
+ */
676
+ exports: any;
677
+ /**
678
+ * The fully resolved filename of the module.
679
+ * @since v0.1.16
680
+ */
681
+ filename: string;
682
+ /**
683
+ * The identifier for the module. Typically this is the fully resolved
684
+ * filename.
685
+ * @since v0.1.16
686
+ */
687
+ id: string;
688
+ /**
689
+ * `true` if the module is running during the Node.js preload
690
+ * phase.
691
+ * @since v15.4.0, v14.17.0
692
+ */
693
+ isPreloading: boolean;
694
+ /**
695
+ * Whether or not the module is done loading, or is in the process of
696
+ * loading.
697
+ * @since v0.1.16
698
+ */
699
+ loaded: boolean;
700
+ /**
701
+ * The module that first required this one, or `null` if the current module is the
702
+ * entry point of the current process, or `undefined` if the module was loaded by
703
+ * something that is not a CommonJS module (e.g. REPL or `import`).
704
+ * @since v0.1.16
705
+ * @deprecated Please use `require.main` and `module.children` instead.
706
+ */
707
+ parent: Module | null | undefined;
708
+ /**
709
+ * The directory name of the module. This is usually the same as the
710
+ * `path.dirname()` of the `module.id`.
711
+ * @since v11.14.0
712
+ */
713
+ path: string;
714
+ /**
715
+ * The search paths for the module.
716
+ * @since v0.4.0
717
+ */
718
+ paths: string[];
719
+ /**
720
+ * The `module.require()` method provides a way to load a module as if
721
+ * `require()` was called from the original module.
722
+ * @since v0.5.1
723
+ */
724
+ require(id: string): any;
725
+ }
726
+ interface Require {
727
+ /**
728
+ * Used to import modules, `JSON`, and local files.
729
+ * @since v0.1.13
730
+ */
731
+ (id: string): any;
732
+ /**
733
+ * Modules are cached in this object when they are required. By deleting a key
734
+ * value from this object, the next `require` will reload the module.
735
+ * This does not apply to
736
+ * [native addons](https://nodejs.org/docs/latest-v24.x/api/addons.html),
737
+ * for which reloading will result in an error.
738
+ * @since v0.3.0
739
+ */
740
+ cache: Dict<Module>;
741
+ /**
742
+ * Instruct `require` on how to handle certain file extensions.
743
+ * @since v0.3.0
744
+ * @deprecated
745
+ */
746
+ extensions: RequireExtensions;
747
+ /**
748
+ * The `Module` object representing the entry script loaded when the Node.js
749
+ * process launched, or `undefined` if the entry point of the program is not a
750
+ * CommonJS module.
751
+ * @since v0.1.17
752
+ */
753
+ main: Module | undefined;
754
+ /**
755
+ * @since v0.3.0
756
+ */
757
+ resolve: RequireResolve;
758
+ }
759
+ /** @deprecated */
760
+ interface RequireExtensions extends Dict<(module: Module, filename: string) => any> {
761
+ ".js": (module: Module, filename: string) => any;
762
+ ".json": (module: Module, filename: string) => any;
763
+ ".node": (module: Module, filename: string) => any;
764
+ }
765
+ interface RequireResolveOptions {
766
+ /**
767
+ * Paths to resolve module location from. If present, these
768
+ * paths are used instead of the default resolution paths, with the exception
769
+ * of
770
+ * [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v24.x/api/modules.html#loading-from-the-global-folders)
771
+ * like `$HOME/.node_modules`, which are
772
+ * always included. Each of these paths is used as a starting point for
773
+ * the module resolution algorithm, meaning that the `node_modules` hierarchy
774
+ * is checked from this location.
775
+ * @since v8.9.0
776
+ */
777
+ paths?: string[] | undefined;
778
+ }
779
+ interface RequireResolve {
780
+ /**
781
+ * Use the internal `require()` machinery to look up the location of a module,
782
+ * but rather than loading the module, just return the resolved filename.
783
+ *
784
+ * If the module can not be found, a `MODULE_NOT_FOUND` error is thrown.
785
+ * @since v0.3.0
786
+ * @param request The module path to resolve.
787
+ */
788
+ (request: string, options?: RequireResolveOptions): string;
789
+ /**
790
+ * Returns an array containing the paths searched during resolution of `request` or
791
+ * `null` if the `request` string references a core module, for example `http` or
792
+ * `fs`.
793
+ * @since v8.9.0
794
+ * @param request The module path whose lookup paths are being retrieved.
795
+ */
796
+ paths(request: string): string[] | null;
797
+ }
227
798
  }
228
799
  /**
229
- * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed.
230
- * It is also in charge of validating the import assertion.
800
+ * The directory name of the current module. This is the same as the
801
+ * `path.dirname()` of the `__filename`.
802
+ * @since v0.1.27
803
+ */
804
+ var __dirname: string;
805
+ /**
806
+ * The file name of the current module. This is the current module file's absolute
807
+ * path with symlinks resolved.
231
808
  *
232
- * @param url The URL/path of the module to be loaded
233
- * @param context Metadata about the module
234
- * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook
809
+ * For a main program this is not necessarily the same as the file name used in the
810
+ * command line.
811
+ * @since v0.0.1
235
812
  */
236
- type LoadHook = (
237
- url: string,
238
- context: LoadHookContext,
239
- nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise<LoadFnOutput>,
240
- ) => LoadFnOutput | Promise<LoadFnOutput>;
241
- }
242
- interface RegisterOptions<Data> {
243
- parentURL: string | URL;
244
- data?: Data | undefined;
245
- transferList?: any[] | undefined;
246
- }
247
- interface Module extends NodeModule {}
248
- class Module {
249
- static runMain(): void;
250
- static wrap(code: string): string;
251
- static createRequire(path: string | URL): NodeRequire;
252
- static builtinModules: string[];
253
- static isBuiltin(moduleName: string): boolean;
254
- static Module: typeof Module;
255
- static register<Data = any>(
256
- specifier: string | URL,
257
- parentURL?: string | URL,
258
- options?: RegisterOptions<Data>,
259
- ): void;
260
- static register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
261
- constructor(id: string, parent?: Module);
262
- }
263
- global {
264
- interface ImportMeta {
265
- url: string;
266
- /**
267
- * Provides a module-relative resolution function scoped to each module, returning
268
- * the URL string.
269
- *
270
- * Second `parent` parameter is only used when the `--experimental-import-meta-resolve`
271
- * command flag enabled.
272
- *
273
- * @since v20.6.0
274
- *
275
- * @param specifier The module specifier to resolve relative to `parent`.
276
- * @param parent The absolute parent module URL to resolve from.
277
- * @returns The absolute (`file:`) URL string for the resolved module.
278
- */
279
- resolve(specifier: string, parent?: string | URL | undefined): string;
280
- }
813
+ var __filename: string;
814
+ /**
815
+ * The `exports` variable is available within a module's file-level scope, and is
816
+ * assigned the value of `module.exports` before the module is evaluated.
817
+ * @since v0.1.16
818
+ */
819
+ var exports: NodeJS.Module["exports"];
820
+ /**
821
+ * A reference to the current module.
822
+ * @since v0.1.16
823
+ */
824
+ var module: NodeJS.Module;
825
+ /**
826
+ * @since v0.1.13
827
+ */
828
+ var require: NodeJS.Require;
829
+ // Global-scope aliases for backwards compatibility with @types/node <13.0.x
830
+ // TODO: consider removing in a future major version update
831
+ /** @deprecated Use `NodeJS.Module` instead. */
832
+ interface NodeModule extends NodeJS.Module {}
833
+ /** @deprecated Use `NodeJS.Require` instead. */
834
+ interface NodeRequire extends NodeJS.Require {}
835
+ /** @deprecated Use `NodeJS.RequireResolve` instead. */
836
+ interface RequireResolve extends NodeJS.RequireResolve {}
281
837
  }
282
838
  export = Module;
283
839
  }