omegon 0.8.4 → 0.9.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 (139) hide show
  1. package/extensions/cleave/dispatcher.ts +213 -20
  2. package/extensions/cleave/rpc-child.ts +269 -0
  3. package/extensions/cleave/types.ts +52 -0
  4. package/node_modules/@types/node/README.md +3 -3
  5. package/node_modules/@types/node/assert/strict.d.ts +11 -5
  6. package/node_modules/@types/node/assert.d.ts +173 -50
  7. package/node_modules/@types/node/async_hooks.d.ts +8 -28
  8. package/node_modules/@types/node/buffer.buffer.d.ts +7 -1
  9. package/node_modules/@types/node/buffer.d.ts +168 -44
  10. package/node_modules/@types/node/child_process.d.ts +70 -27
  11. package/node_modules/@types/node/cluster.d.ts +332 -240
  12. package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  13. package/node_modules/@types/node/compatibility/index.d.ts +9 -0
  14. package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  15. package/node_modules/@types/node/compatibility/iterators.d.ts +0 -1
  16. package/node_modules/@types/node/console.d.ts +350 -49
  17. package/node_modules/@types/node/constants.d.ts +4 -3
  18. package/node_modules/@types/node/crypto.d.ts +1110 -630
  19. package/node_modules/@types/node/dgram.d.ts +51 -15
  20. package/node_modules/@types/node/diagnostics_channel.d.ts +6 -4
  21. package/node_modules/@types/node/dns/promises.d.ts +4 -4
  22. package/node_modules/@types/node/dns.d.ts +133 -132
  23. package/node_modules/@types/node/domain.d.ts +17 -13
  24. package/node_modules/@types/node/events.d.ts +663 -734
  25. package/node_modules/@types/node/fs/promises.d.ts +9 -43
  26. package/node_modules/@types/node/fs.d.ts +411 -628
  27. package/node_modules/@types/node/globals.d.ts +30 -8
  28. package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
  29. package/node_modules/@types/node/http.d.ts +265 -364
  30. package/node_modules/@types/node/http2.d.ts +715 -551
  31. package/node_modules/@types/node/https.d.ts +239 -65
  32. package/node_modules/@types/node/index.d.ts +6 -24
  33. package/node_modules/@types/node/inspector.d.ts +53 -69
  34. package/node_modules/@types/node/inspector.generated.d.ts +410 -759
  35. package/node_modules/@types/node/module.d.ts +186 -52
  36. package/node_modules/@types/node/net.d.ts +194 -70
  37. package/node_modules/@types/node/os.d.ts +11 -12
  38. package/node_modules/@types/node/package.json +3 -13
  39. package/node_modules/@types/node/path.d.ts +133 -120
  40. package/node_modules/@types/node/perf_hooks.d.ts +643 -318
  41. package/node_modules/@types/node/process.d.ts +132 -223
  42. package/node_modules/@types/node/punycode.d.ts +5 -5
  43. package/node_modules/@types/node/querystring.d.ts +4 -4
  44. package/node_modules/@types/node/readline/promises.d.ts +3 -3
  45. package/node_modules/@types/node/readline.d.ts +120 -68
  46. package/node_modules/@types/node/repl.d.ts +100 -87
  47. package/node_modules/@types/node/sea.d.ts +1 -10
  48. package/node_modules/@types/node/sqlite.d.ts +19 -363
  49. package/node_modules/@types/node/stream/consumers.d.ts +10 -10
  50. package/node_modules/@types/node/stream/promises.d.ts +15 -136
  51. package/node_modules/@types/node/stream/web.d.ts +502 -176
  52. package/node_modules/@types/node/stream.d.ts +475 -581
  53. package/node_modules/@types/node/string_decoder.d.ts +4 -4
  54. package/node_modules/@types/node/test.d.ts +196 -308
  55. package/node_modules/@types/node/timers/promises.d.ts +4 -4
  56. package/node_modules/@types/node/timers.d.ts +132 -4
  57. package/node_modules/@types/node/tls.d.ts +226 -110
  58. package/node_modules/@types/node/trace_events.d.ts +9 -9
  59. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +7 -1
  60. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
  61. package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
  62. package/node_modules/@types/node/tty.d.ts +16 -58
  63. package/node_modules/@types/node/url.d.ts +573 -130
  64. package/node_modules/@types/node/util.d.ts +1100 -181
  65. package/node_modules/@types/node/v8.d.ts +8 -76
  66. package/node_modules/@types/node/vm.d.ts +72 -280
  67. package/node_modules/@types/node/wasi.d.ts +4 -25
  68. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
  69. package/node_modules/@types/node/web-globals/events.d.ts +0 -9
  70. package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
  71. package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
  72. package/node_modules/@types/node/worker_threads.d.ts +335 -268
  73. package/node_modules/@types/node/zlib.d.ts +74 -9
  74. package/node_modules/undici-types/agent.d.ts +12 -13
  75. package/node_modules/undici-types/api.d.ts +26 -26
  76. package/node_modules/undici-types/balanced-pool.d.ts +12 -13
  77. package/node_modules/undici-types/client.d.ts +19 -19
  78. package/node_modules/undici-types/connector.d.ts +2 -2
  79. package/node_modules/undici-types/cookies.d.ts +0 -2
  80. package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
  81. package/node_modules/undici-types/dispatcher.d.ts +103 -123
  82. package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
  83. package/node_modules/undici-types/errors.d.ts +54 -66
  84. package/node_modules/undici-types/eventsource.d.ts +4 -9
  85. package/node_modules/undici-types/fetch.d.ts +20 -22
  86. package/node_modules/undici-types/file.d.ts +39 -0
  87. package/node_modules/undici-types/filereader.d.ts +54 -0
  88. package/node_modules/undici-types/formdata.d.ts +7 -7
  89. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  90. package/node_modules/undici-types/global-origin.d.ts +5 -5
  91. package/node_modules/undici-types/handlers.d.ts +8 -8
  92. package/node_modules/undici-types/header.d.ts +1 -157
  93. package/node_modules/undici-types/index.d.ts +47 -64
  94. package/node_modules/undici-types/interceptors.d.ts +8 -64
  95. package/node_modules/undici-types/mock-agent.d.ts +18 -36
  96. package/node_modules/undici-types/mock-client.d.ts +4 -6
  97. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  98. package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
  99. package/node_modules/undici-types/mock-pool.d.ts +4 -6
  100. package/node_modules/undici-types/package.json +1 -1
  101. package/node_modules/undici-types/patch.d.ts +4 -0
  102. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  103. package/node_modules/undici-types/pool.d.ts +13 -15
  104. package/node_modules/undici-types/proxy-agent.d.ts +4 -5
  105. package/node_modules/undici-types/readable.d.ts +16 -19
  106. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  107. package/node_modules/undici-types/retry-handler.d.ts +10 -19
  108. package/node_modules/undici-types/util.d.ts +3 -3
  109. package/node_modules/undici-types/webidl.d.ts +29 -142
  110. package/node_modules/undici-types/websocket.d.ts +10 -46
  111. package/package.json +2 -1
  112. package/scripts/check-vendor-dist.mjs +56 -0
  113. package/skills/cleave/SKILL.md +62 -2
  114. package/node_modules/@types/node/inspector/promises.d.ts +0 -41
  115. package/node_modules/@types/node/path/posix.d.ts +0 -8
  116. package/node_modules/@types/node/path/win32.d.ts +0 -8
  117. package/node_modules/@types/node/quic.d.ts +0 -910
  118. package/node_modules/@types/node/test/reporters.d.ts +0 -96
  119. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
  120. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
  121. package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
  122. package/node_modules/@types/node/util/types.d.ts +0 -558
  123. package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
  124. package/node_modules/@types/node/web-globals/console.d.ts +0 -9
  125. package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
  126. package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
  127. package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
  128. package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
  129. package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
  130. package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
  131. package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
  132. package/node_modules/@types/node/web-globals/url.d.ts +0 -24
  133. package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
  134. package/node_modules/undici-types/client-stats.d.ts +0 -15
  135. package/node_modules/undici-types/h2c-client.d.ts +0 -73
  136. package/node_modules/undici-types/mock-call-history.d.ts +0 -111
  137. package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
  138. package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
  139. package/node_modules/undici-types/utility.d.ts +0 -7
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @since v0.3.7
3
3
  */
4
- declare module "node:module" {
4
+ declare module "module" {
5
5
  import { URL } from "node:url";
6
6
  class Module {
7
7
  constructor(id: string, parent?: Module);
@@ -30,7 +30,7 @@ declare module "node:module" {
30
30
  /**
31
31
  * The following constants are returned as the `status` field in the object returned by
32
32
  * {@link enableCompileCache} to indicate the result of the attempt to enable the
33
- * [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache).
33
+ * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache).
34
34
  * @since v22.8.0
35
35
  */
36
36
  namespace compileCacheStatus {
@@ -62,24 +62,6 @@ declare module "node:module" {
62
62
  const DISABLED: number;
63
63
  }
64
64
  }
65
- interface EnableCompileCacheOptions {
66
- /**
67
- * Optional. Directory to store the compile cache. If not specified,
68
- * the directory specified by the `NODE_COMPILE_CACHE=dir` environment variable
69
- * will be used if it's set, or `path.join(os.tmpdir(), 'node-compile-cache')`
70
- * otherwise.
71
- * @since v25.0.0
72
- */
73
- directory?: string | undefined;
74
- /**
75
- * Optional. If `true`, enables portable compile cache so that
76
- * the cache can be reused even if the project directory is moved. This is a best-effort
77
- * feature. If not specified, it will depend on whether the environment variable
78
- * `NODE_COMPILE_CACHE_PORTABLE=1` is set.
79
- * @since v25.0.0
80
- */
81
- portable?: boolean | undefined;
82
- }
83
65
  interface EnableCompileCacheResult {
84
66
  /**
85
67
  * One of the {@link constants.compileCacheStatus}
@@ -99,21 +81,25 @@ declare module "node:module" {
99
81
  directory?: string;
100
82
  }
101
83
  /**
102
- * Enable [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
84
+ * Enable [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
103
85
  * in the current Node.js instance.
104
86
  *
105
- * For general use cases, it's recommended to call `module.enableCompileCache()` without
106
- * specifying the `options.directory`, so that the directory can be overridden by the
107
- * `NODE_COMPILE_CACHE` environment variable when necessary.
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.
108
93
  *
109
- * Since compile cache is supposed to be a optimization that is not mission critical, this
110
- * method is designed to not throw any exception when the compile cache cannot be enabled.
111
- * Instead, it will return an object containing an error message in the `message` field to
112
- * aid debugging. If compile cache is enabled successfully, the `directory` field in the
113
- * returned object contains the path to the directory where the compile cache is stored. The
114
- * `status` field in the returned object would be one of the `module.constants.compileCacheStatus`
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`
115
101
  * values to indicate the result of the attempt to enable the
116
- * [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache).
102
+ * [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache).
117
103
  *
118
104
  * This method only affects the current Node.js instance. To enable it in child worker threads,
119
105
  * either call this method in child worker threads too, or set the
@@ -121,11 +107,12 @@ declare module "node:module" {
121
107
  * be inherited into the child workers. The directory can be obtained either from the
122
108
  * `directory` field returned by this method, or with {@link getCompileCacheDir}.
123
109
  * @since v22.8.0
124
- * @param options Optional. If a string is passed, it is considered to be `options.directory`.
110
+ * @param cacheDir Optional path to specify the directory where the compile cache
111
+ * will be stored/retrieved.
125
112
  */
126
- function enableCompileCache(options?: string | EnableCompileCacheOptions): EnableCompileCacheResult;
113
+ function enableCompileCache(cacheDir?: string): EnableCompileCacheResult;
127
114
  /**
128
- * Flush the [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
115
+ * Flush the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
129
116
  * accumulated from modules already loaded
130
117
  * in the current Node.js instance to disk. This returns after all the flushing
131
118
  * file system operations come to an end, no matter they succeed or not. If there
@@ -136,7 +123,7 @@ declare module "node:module" {
136
123
  function flushCompileCache(): void;
137
124
  /**
138
125
  * @since v22.8.0
139
- * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v25.x/api/module.html#module-compile-cache)
126
+ * @return Path to the [module compile cache](https://nodejs.org/docs/latest-v22.x/api/module.html#module-compile-cache)
140
127
  * directory if it is enabled, or `undefined` otherwise.
141
128
  */
142
129
  function getCompileCacheDir(): string | undefined;
@@ -207,7 +194,7 @@ declare module "node:module" {
207
194
  */
208
195
  data?: Data | undefined;
209
196
  /**
210
- * [Transferable objects](https://nodejs.org/docs/latest-v25.x/api/worker_threads.html#portpostmessagevalue-transferlist)
197
+ * [Transferable objects](https://nodejs.org/docs/latest-v22.x/api/worker_threads.html#portpostmessagevalue-transferlist)
211
198
  * to be passed into the `initialize` hook.
212
199
  */
213
200
  transferList?: any[] | undefined;
@@ -216,10 +203,10 @@ declare module "node:module" {
216
203
  /**
217
204
  * Register a module that exports hooks that customize Node.js module
218
205
  * resolution and loading behavior. See
219
- * [Customization hooks](https://nodejs.org/docs/latest-v25.x/api/module.html#customization-hooks).
206
+ * [Customization hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks).
220
207
  *
221
208
  * This feature requires `--allow-worker` if used with the
222
- * [Permission Model](https://nodejs.org/docs/latest-v25.x/api/permissions.html#permission-model).
209
+ * [Permission Model](https://nodejs.org/docs/latest-v22.x/api/permissions.html#permission-model).
223
210
  * @since v20.6.0, v18.19.0
224
211
  * @param specifier Customization hooks to be registered; this should be
225
212
  * the same string that would be passed to `import()`, except that if it is
@@ -235,12 +222,12 @@ declare module "node:module" {
235
222
  function register<Data = any>(specifier: string | URL, options?: RegisterOptions<Data>): void;
236
223
  interface RegisterHooksOptions {
237
224
  /**
238
- * See [load hook](https://nodejs.org/docs/latest-v25.x/api/module.html#loadurl-context-nextload).
225
+ * See [load hook](https://nodejs.org/docs/latest-v22.x/api/module.html#loadurl-context-nextload).
239
226
  * @default undefined
240
227
  */
241
228
  load?: LoadHookSync | undefined;
242
229
  /**
243
- * See [resolve hook](https://nodejs.org/docs/latest-v25.x/api/module.html#resolvespecifier-context-nextresolve).
230
+ * See [resolve hook](https://nodejs.org/docs/latest-v22.x/api/module.html#resolvespecifier-context-nextresolve).
244
231
  * @default undefined
245
232
  */
246
233
  resolve?: ResolveHookSync | undefined;
@@ -252,7 +239,7 @@ declare module "node:module" {
252
239
  deregister(): void;
253
240
  }
254
241
  /**
255
- * Register [hooks](https://nodejs.org/docs/latest-v25.x/api/module.html#customization-hooks)
242
+ * Register [hooks](https://nodejs.org/docs/latest-v22.x/api/module.html#customization-hooks)
256
243
  * that customize Node.js module resolution and loading behavior.
257
244
  * @since v22.15.0
258
245
  * @experimental
@@ -283,9 +270,9 @@ declare module "node:module" {
283
270
  * with `vm.runInContext()` or `vm.compileFunction()`.
284
271
  * By default, it will throw an error if the code contains TypeScript features
285
272
  * that require transformation such as `Enums`,
286
- * see [type-stripping](https://nodejs.org/docs/latest-v25.x/api/typescript.md#type-stripping) for more information.
273
+ * see [type-stripping](https://nodejs.org/docs/latest-v22.x/api/typescript.md#type-stripping) for more information.
287
274
  * When mode is `'transform'`, it also transforms TypeScript features to JavaScript,
288
- * see [transform TypeScript features](https://nodejs.org/docs/latest-v25.x/api/typescript.md#typescript-features) for more information.
275
+ * see [transform TypeScript features](https://nodejs.org/docs/latest-v22.x/api/typescript.md#typescript-features) for more information.
289
276
  * When mode is `'strip'`, source maps are not generated, because locations are preserved.
290
277
  * If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown.
291
278
  *
@@ -372,9 +359,7 @@ declare module "node:module" {
372
359
  interface ImportAttributes extends NodeJS.Dict<string> {
373
360
  type?: string | undefined;
374
361
  }
375
- type ImportPhase = "source" | "evaluation";
376
362
  type ModuleFormat =
377
- | "addon"
378
363
  | "builtin"
379
364
  | "commonjs"
380
365
  | "commonjs-typescript"
@@ -383,18 +368,59 @@ declare module "node:module" {
383
368
  | "module-typescript"
384
369
  | "wasm";
385
370
  type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray;
371
+ /**
372
+ * The `initialize` hook provides a way to define a custom function that runs in
373
+ * the hooks thread when the hooks module is initialized. Initialization happens
374
+ * when the hooks module is registered via {@link register}.
375
+ *
376
+ * This hook can receive data from a {@link register} invocation, including
377
+ * ports and other transferable objects. The return value of `initialize` can be a
378
+ * `Promise`, in which case it will be awaited before the main application thread
379
+ * execution resumes.
380
+ */
386
381
  type InitializeHook<Data = any> = (data: Data) => void | Promise<void>;
387
382
  interface ResolveHookContext {
383
+ /**
384
+ * Export conditions of the relevant `package.json`
385
+ */
388
386
  conditions: string[];
387
+ /**
388
+ * An object whose key-value pairs represent the assertions for the module to import
389
+ */
389
390
  importAttributes: ImportAttributes;
391
+ /**
392
+ * The module importing this one, or undefined if this is the Node.js entry point
393
+ */
390
394
  parentURL: string | undefined;
391
395
  }
392
396
  interface ResolveFnOutput {
397
+ /**
398
+ * A hint to the load hook (it might be ignored); can be an intermediary value.
399
+ */
393
400
  format?: string | null | undefined;
401
+ /**
402
+ * The import attributes to use when caching the module (optional; if excluded the input will be used)
403
+ */
394
404
  importAttributes?: ImportAttributes | undefined;
405
+ /**
406
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
407
+ * @default false
408
+ */
395
409
  shortCircuit?: boolean | undefined;
410
+ /**
411
+ * The absolute URL to which this input resolves
412
+ */
396
413
  url: string;
397
414
  }
415
+ /**
416
+ * The `resolve` hook chain is responsible for telling Node.js where to find and
417
+ * how to cache a given `import` statement or expression, or `require` call. It can
418
+ * optionally return a format (such as `'module'`) as a hint to the `load` hook. If
419
+ * a format is specified, the `load` hook is ultimately responsible for providing
420
+ * the final `format` value (and it is free to ignore the hint provided by
421
+ * `resolve`); if `resolve` provides a `format`, a custom `load` hook is required
422
+ * even if only to pass the value to the Node.js default `load` hook.
423
+ */
398
424
  type ResolveHook = (
399
425
  specifier: string,
400
426
  context: ResolveHookContext,
@@ -412,15 +438,36 @@ declare module "node:module" {
412
438
  ) => ResolveFnOutput,
413
439
  ) => ResolveFnOutput;
414
440
  interface LoadHookContext {
441
+ /**
442
+ * Export conditions of the relevant `package.json`
443
+ */
415
444
  conditions: string[];
445
+ /**
446
+ * The format optionally supplied by the `resolve` hook chain (can be an intermediary value).
447
+ */
416
448
  format: string | null | undefined;
449
+ /**
450
+ * An object whose key-value pairs represent the assertions for the module to import
451
+ */
417
452
  importAttributes: ImportAttributes;
418
453
  }
419
454
  interface LoadFnOutput {
420
455
  format: string | null | undefined;
456
+ /**
457
+ * A signal that this hook intends to terminate the chain of `resolve` hooks.
458
+ * @default false
459
+ */
421
460
  shortCircuit?: boolean | undefined;
461
+ /**
462
+ * The source for Node.js to evaluate
463
+ */
422
464
  source?: ModuleSource | undefined;
423
465
  }
466
+ /**
467
+ * The `load` hook provides a way to define a custom method of determining how a
468
+ * URL should be interpreted, retrieved, and parsed. It is also in charge of
469
+ * validating the import attributes.
470
+ */
424
471
  type LoadHook = (
425
472
  url: string,
426
473
  context: LoadHookContext,
@@ -454,7 +501,7 @@ declare module "node:module" {
454
501
  /**
455
502
  * This method returns whether the [Source Map v3](https://tc39.es/ecma426/) support for stack
456
503
  * traces is enabled.
457
- * @since v23.7.0, v22.14.0
504
+ * @since v22.14.0
458
505
  */
459
506
  function getSourceMapsSupport(): SourceMapsSupport;
460
507
  /**
@@ -488,7 +535,7 @@ declare module "node:module" {
488
535
  * enabled will be parsed and loaded. Preferably, use the commandline options
489
536
  * `--enable-source-maps` to avoid losing track of source maps of modules loaded
490
537
  * before this API call.
491
- * @since v23.7.0, v22.14.0
538
+ * @since v22.14.0
492
539
  */
493
540
  function setSourceMapsSupport(enabled: boolean, options?: SetSourceMapsSupportOptions): void;
494
541
  interface SourceMapConstructorOptions {
@@ -574,6 +621,94 @@ declare module "node:module" {
574
621
  function wrap(script: string): string;
575
622
  }
576
623
  global {
624
+ interface ImportMeta {
625
+ /**
626
+ * The directory name of the current module.
627
+ *
628
+ * This is the same as the `path.dirname()` of the `import.meta.filename`.
629
+ *
630
+ * > **Caveat**: only present on `file:` modules.
631
+ * @since v21.2.0, v20.11.0
632
+ */
633
+ dirname: string;
634
+ /**
635
+ * The full absolute path and filename of the current module, with
636
+ * symlinks resolved.
637
+ *
638
+ * This is the same as the `url.fileURLToPath()` of the `import.meta.url`.
639
+ *
640
+ * > **Caveat** only local modules support this property. Modules not using the
641
+ * > `file:` protocol will not provide it.
642
+ * @since v21.2.0, v20.11.0
643
+ */
644
+ filename: string;
645
+ /**
646
+ * The absolute `file:` URL of the module.
647
+ *
648
+ * This is defined exactly the same as it is in browsers providing the URL of the
649
+ * current module file.
650
+ *
651
+ * This enables useful patterns such as relative file loading:
652
+ *
653
+ * ```js
654
+ * import { readFileSync } from 'node:fs';
655
+ * const buffer = readFileSync(new URL('./data.proto', import.meta.url));
656
+ * ```
657
+ */
658
+ url: string;
659
+ /**
660
+ * `import.meta.resolve` is a module-relative resolution function scoped to
661
+ * each module, returning the URL string.
662
+ *
663
+ * ```js
664
+ * const dependencyAsset = import.meta.resolve('component-lib/asset.css');
665
+ * // file:///app/node_modules/component-lib/asset.css
666
+ * import.meta.resolve('./dep.js');
667
+ * // file:///app/dep.js
668
+ * ```
669
+ *
670
+ * All features of the Node.js module resolution are supported. Dependency
671
+ * resolutions are subject to the permitted exports resolutions within the package.
672
+ *
673
+ * **Caveats**:
674
+ *
675
+ * * This can result in synchronous file-system operations, which
676
+ * can impact performance similarly to `require.resolve`.
677
+ * * This feature is not available within custom loaders (it would
678
+ * create a deadlock).
679
+ * @since v13.9.0, v12.16.0
680
+ * @param specifier The module specifier to resolve relative to the
681
+ * current module.
682
+ * @param parent An optional absolute parent module URL to resolve from.
683
+ * **Default:** `import.meta.url`
684
+ * @returns The absolute URL string that the specifier would resolve to.
685
+ */
686
+ resolve(specifier: string, parent?: string | URL): string;
687
+ /**
688
+ * `true` when the current module is the entry point of the current process; `false` otherwise.
689
+ *
690
+ * Equivalent to `require.main === module` in CommonJS.
691
+ *
692
+ * Analogous to Python's `__name__ == "__main__"`.
693
+ *
694
+ * ```js
695
+ * export function foo() {
696
+ * return 'Hello, world';
697
+ * }
698
+ *
699
+ * function main() {
700
+ * const message = foo();
701
+ * console.log(message);
702
+ * }
703
+ *
704
+ * if (import.meta.main) main();
705
+ * // `foo` can be imported from another module without possible side-effects from `main`
706
+ * ```
707
+ * @since v22.18.0
708
+ * @experimental
709
+ */
710
+ main: boolean;
711
+ }
577
712
  namespace NodeJS {
578
713
  interface Module {
579
714
  /**
@@ -647,7 +782,7 @@ declare module "node:module" {
647
782
  * Modules are cached in this object when they are required. By deleting a key
648
783
  * value from this object, the next `require` will reload the module.
649
784
  * This does not apply to
650
- * [native addons](https://nodejs.org/docs/latest-v25.x/api/addons.html),
785
+ * [native addons](https://nodejs.org/docs/latest-v22.x/api/addons.html),
651
786
  * for which reloading will result in an error.
652
787
  * @since v0.3.0
653
788
  */
@@ -681,7 +816,7 @@ declare module "node:module" {
681
816
  * Paths to resolve module location from. If present, these
682
817
  * paths are used instead of the default resolution paths, with the exception
683
818
  * of
684
- * [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v25.x/api/modules.html#loading-from-the-global-folders)
819
+ * [GLOBAL\_FOLDERS](https://nodejs.org/docs/latest-v22.x/api/modules.html#loading-from-the-global-folders)
685
820
  * like `$HOME/.node_modules`, which are
686
821
  * always included. Each of these paths is used as a starting point for
687
822
  * the module resolution algorithm, meaning that the `node_modules` hierarchy
@@ -741,7 +876,6 @@ declare module "node:module" {
741
876
  */
742
877
  var require: NodeJS.Require;
743
878
  // Global-scope aliases for backwards compatibility with @types/node <13.0.x
744
- // TODO: consider removing in a future major version update
745
879
  /** @deprecated Use `NodeJS.Module` instead. */
746
880
  interface NodeModule extends NodeJS.Module {}
747
881
  /** @deprecated Use `NodeJS.Require` instead. */
@@ -751,7 +885,7 @@ declare module "node:module" {
751
885
  }
752
886
  export = Module;
753
887
  }
754
- declare module "module" {
755
- import module = require("node:module");
888
+ declare module "node:module" {
889
+ import module = require("module");
756
890
  export = module;
757
891
  }