omegon 0.8.4 → 0.9.0

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 (138) 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/skills/cleave/SKILL.md +62 -2
  113. package/node_modules/@types/node/inspector/promises.d.ts +0 -41
  114. package/node_modules/@types/node/path/posix.d.ts +0 -8
  115. package/node_modules/@types/node/path/win32.d.ts +0 -8
  116. package/node_modules/@types/node/quic.d.ts +0 -910
  117. package/node_modules/@types/node/test/reporters.d.ts +0 -96
  118. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
  119. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
  120. package/node_modules/@types/node/ts5.7/index.d.ts +0 -117
  121. package/node_modules/@types/node/util/types.d.ts +0 -558
  122. package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
  123. package/node_modules/@types/node/web-globals/console.d.ts +0 -9
  124. package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
  125. package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
  126. package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
  127. package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
  128. package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
  129. package/node_modules/@types/node/web-globals/streams.d.ts +0 -115
  130. package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
  131. package/node_modules/@types/node/web-globals/url.d.ts +0 -24
  132. package/node_modules/undici-types/cache-interceptor.d.ts +0 -173
  133. package/node_modules/undici-types/client-stats.d.ts +0 -15
  134. package/node_modules/undici-types/h2c-client.d.ts +0 -73
  135. package/node_modules/undici-types/mock-call-history.d.ts +0 -111
  136. package/node_modules/undici-types/round-robin-pool.d.ts +0 -41
  137. package/node_modules/undici-types/snapshot-agent.d.ts +0 -109
  138. package/node_modules/undici-types/utility.d.ts +0 -7
@@ -4,9 +4,9 @@
4
4
  * ```js
5
5
  * import v8 from 'node:v8';
6
6
  * ```
7
- * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/v8.js)
7
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/v8.js)
8
8
  */
9
- declare module "node:v8" {
9
+ declare module "v8" {
10
10
  import { NonSharedBuffer } from "node:buffer";
11
11
  import { Readable } from "node:stream";
12
12
  interface HeapSpaceInfo {
@@ -33,7 +33,6 @@ declare module "node:v8" {
33
33
  total_global_handles_size: number;
34
34
  used_global_handles_size: number;
35
35
  external_memory: number;
36
- total_allocated_bytes: number;
37
36
  }
38
37
  interface HeapCodeStatistics {
39
38
  code_and_metadata_size: number;
@@ -94,9 +93,6 @@ declare module "node:v8" {
94
93
  * `external_memory` The value of external\_memory is the memory size of array
95
94
  * buffers and external strings.
96
95
  *
97
- * `total_allocated_bytes` The value of total allocated bytes since the Isolate
98
- * creation.
99
- *
100
96
  * ```js
101
97
  * {
102
98
  * total_heap_size: 7326976,
@@ -112,8 +108,7 @@ declare module "node:v8" {
112
108
  * number_of_detached_contexts: 0,
113
109
  * total_global_handles_size: 8192,
114
110
  * used_global_handles_size: 3296,
115
- * external_memory: 318824,
116
- * total_allocated_bytes: 45224088
111
+ * external_memory: 318824
117
112
  * }
118
113
  * ```
119
114
  * @since v1.0.0
@@ -309,6 +304,7 @@ declare module "node:v8" {
309
304
  * ```
310
305
  * @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap.
311
306
  * @since v20.13.0
307
+ * @experimental
312
308
  */
313
309
  function queryObjects(ctor: Function): number | string[];
314
310
  function queryObjects(ctor: Function, options: { format: "count" }): number;
@@ -405,65 +401,6 @@ declare module "node:v8" {
405
401
  * @since v12.8.0
406
402
  */
407
403
  function getHeapCodeStatistics(): HeapCodeStatistics;
408
- /**
409
- * @since v25.0.0
410
- */
411
- interface SyncCPUProfileHandle {
412
- /**
413
- * Stopping collecting the profile and return the profile data.
414
- * @since v25.0.0
415
- */
416
- stop(): string;
417
- /**
418
- * Stopping collecting the profile and the profile will be discarded.
419
- * @since v25.0.0
420
- */
421
- [Symbol.dispose](): void;
422
- }
423
- /**
424
- * @since v24.8.0
425
- */
426
- interface CPUProfileHandle {
427
- /**
428
- * Stopping collecting the profile, then return a Promise that fulfills with an error or the
429
- * profile data.
430
- * @since v24.8.0
431
- */
432
- stop(): Promise<string>;
433
- /**
434
- * Stopping collecting the profile and the profile will be discarded.
435
- * @since v24.8.0
436
- */
437
- [Symbol.asyncDispose](): Promise<void>;
438
- }
439
- /**
440
- * @since v24.9.0
441
- */
442
- interface HeapProfileHandle {
443
- /**
444
- * Stopping collecting the profile, then return a Promise that fulfills with an error or the
445
- * profile data.
446
- * @since v24.9.0
447
- */
448
- stop(): Promise<string>;
449
- /**
450
- * Stopping collecting the profile and the profile will be discarded.
451
- * @since v24.9.0
452
- */
453
- [Symbol.asyncDispose](): Promise<void>;
454
- }
455
- /**
456
- * Starting a CPU profile then return a `SyncCPUProfileHandle` object.
457
- * This API supports `using` syntax.
458
- *
459
- * ```js
460
- * const handle = v8.startCpuProfile();
461
- * const profile = handle.stop();
462
- * console.log(profile);
463
- * ```
464
- * @since v25.0.0
465
- */
466
- function startCpuProfile(): SyncCPUProfileHandle;
467
404
  /**
468
405
  * V8 only supports `Latin-1/ISO-8859-1` and `UTF16` as the underlying representation of a string.
469
406
  * If the `content` uses `Latin-1/ISO-8859-1` as the underlying representation, this function will return true;
@@ -494,7 +431,7 @@ declare module "node:v8" {
494
431
  * writeString('hello');
495
432
  * writeString('你好');
496
433
  * ```
497
- * @since v23.10.0, v22.15.0
434
+ * @since v22.15.0
498
435
  */
499
436
  function isStringOneByteRepresentation(content: string): boolean;
500
437
  /**
@@ -644,7 +581,7 @@ declare module "node:v8" {
644
581
  function stopCoverage(): void;
645
582
  /**
646
583
  * The API is a no-op if `--heapsnapshot-near-heap-limit` is already set from the command line or the API is called more than once.
647
- * `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v25.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information.
584
+ * `limit` must be a positive integer. See [`--heapsnapshot-near-heap-limit`](https://nodejs.org/docs/latest-v22.x/api/cli.html#--heapsnapshot-near-heap-limitmax_count) for more information.
648
585
  * @since v18.10.0, v16.18.0
649
586
  */
650
587
  function setHeapSnapshotNearHeapLimit(limit: number): void;
@@ -737,11 +674,6 @@ declare module "node:v8" {
737
674
  * @since v19.6.0, v18.15.0
738
675
  */
739
676
  stop(): GCProfilerResult;
740
- /**
741
- * Stop collecting GC data, and discard the profile.
742
- * @since v25.5.0
743
- */
744
- [Symbol.dispose](): void;
745
677
  }
746
678
  interface GCProfilerResult {
747
679
  version: number;
@@ -983,6 +915,6 @@ declare module "node:v8" {
983
915
  function isBuildingSnapshot(): boolean;
984
916
  }
985
917
  }
986
- declare module "v8" {
987
- export * from "node:v8";
918
+ declare module "node:v8" {
919
+ export * from "v8";
988
920
  }
@@ -34,11 +34,11 @@
34
34
  *
35
35
  * console.log(x); // 1; y is not defined.
36
36
  * ```
37
- * @see [source](https://github.com/nodejs/node/blob/v25.x/lib/vm.js)
37
+ * @see [source](https://github.com/nodejs/node/blob/v22.x/lib/vm.js)
38
38
  */
39
- declare module "node:vm" {
39
+ declare module "vm" {
40
40
  import { NonSharedBuffer } from "node:buffer";
41
- import { ImportAttributes, ImportPhase } from "node:module";
41
+ import { ImportAttributes } from "node:module";
42
42
  interface Context extends NodeJS.Dict<any> {}
43
43
  interface BaseOptions {
44
44
  /**
@@ -61,7 +61,6 @@ declare module "node:vm" {
61
61
  specifier: string,
62
62
  referrer: T,
63
63
  importAttributes: ImportAttributes,
64
- phase: ImportPhase,
65
64
  ) => Module | Promise<Module>;
66
65
  interface ScriptOptions extends BaseOptions {
67
66
  /**
@@ -73,8 +72,7 @@ declare module "node:vm" {
73
72
  /**
74
73
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
75
74
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
76
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
77
- * @experimental
75
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
78
76
  */
79
77
  importModuleDynamically?:
80
78
  | DynamicModuleLoader<Script>
@@ -119,8 +117,7 @@ declare module "node:vm" {
119
117
  /**
120
118
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
121
119
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
122
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
123
- * @experimental
120
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
124
121
  */
125
122
  importModuleDynamically?:
126
123
  | DynamicModuleLoader<Script>
@@ -133,8 +130,7 @@ declare module "node:vm" {
133
130
  /**
134
131
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
135
132
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
136
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
137
- * @experimental
133
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
138
134
  */
139
135
  importModuleDynamically?:
140
136
  | DynamicModuleLoader<Script>
@@ -153,8 +149,7 @@ declare module "node:vm" {
153
149
  /**
154
150
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
155
151
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
156
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
157
- * @experimental
152
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
158
153
  */
159
154
  importModuleDynamically?:
160
155
  | DynamicModuleLoader<ReturnType<typeof compileFunction>>
@@ -197,8 +192,7 @@ declare module "node:vm" {
197
192
  /**
198
193
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
199
194
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
200
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
201
- * @experimental
195
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
202
196
  */
203
197
  importModuleDynamically?:
204
198
  | DynamicModuleLoader<Context>
@@ -400,9 +394,9 @@ declare module "node:vm" {
400
394
  }
401
395
  /**
402
396
  * If the given `contextObject` is an object, the `vm.createContext()` method will
403
- * [prepare that object](https://nodejs.org/docs/latest-v25.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
397
+ * [prepare that object](https://nodejs.org/docs/latest-v22.x/api/vm.html#what-does-it-mean-to-contextify-an-object)
404
398
  * and return a reference to it so that it can be used in calls to {@link runInContext} or
405
- * [`script.runInContext()`](https://nodejs.org/docs/latest-v25.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
399
+ * [`script.runInContext()`](https://nodejs.org/docs/latest-v22.x/api/vm.html#scriptrunincontextcontextifiedobject-options).
406
400
  * Inside such scripts, the global object will be wrapped by the `contextObject`, retaining all of its
407
401
  * existing properties but also having the built-in objects and functions any standard
408
402
  * [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global
@@ -677,12 +671,14 @@ declare module "node:vm" {
677
671
  * flag enabled.
678
672
  *
679
673
  * The `vm.Module` class provides a low-level interface for using
680
- * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script`
681
- * class that closely mirrors [Module Record](https://tc39.es/ecma262/#sec-abstract-module-records)s as defined in the ECMAScript
674
+ * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script` class that closely mirrors [Module Record](https://262.ecma-international.org/14.0/#sec-abstract-module-records) s as
675
+ * defined in the ECMAScript
682
676
  * specification.
683
677
  *
684
678
  * Unlike `vm.Script` however, every `vm.Module` object is bound to a context from
685
- * its creation.
679
+ * its creation. Operations on `vm.Module` objects are intrinsically asynchronous,
680
+ * in contrast with the synchronous nature of `vm.Script` objects. The use of
681
+ * 'async' functions can help with manipulating `vm.Module` objects.
686
682
  *
687
683
  * Using a `vm.Module` object requires three distinct steps: creation/parsing,
688
684
  * linking, and evaluation. These three steps are illustrated in the following
@@ -710,7 +706,7 @@ declare module "node:vm" {
710
706
  * // Here, we attempt to obtain the default export from the module "foo", and
711
707
  * // put it into local binding "secret".
712
708
  *
713
- * const rootModule = new vm.SourceTextModule(`
709
+ * const bar = new vm.SourceTextModule(`
714
710
  * import s from 'foo';
715
711
  * s;
716
712
  * print(s);
@@ -720,48 +716,39 @@ declare module "node:vm" {
720
716
  * //
721
717
  * // "Link" the imported dependencies of this Module to it.
722
718
  * //
723
- * // Obtain the requested dependencies of a SourceTextModule by
724
- * // `sourceTextModule.moduleRequests` and resolve them.
719
+ * // The provided linking callback (the "linker") accepts two arguments: the
720
+ * // parent module (`bar` in this case) and the string that is the specifier of
721
+ * // the imported module. The callback is expected to return a Module that
722
+ * // corresponds to the provided specifier, with certain requirements documented
723
+ * // in `module.link()`.
724
+ * //
725
+ * // If linking has not started for the returned Module, the same linker
726
+ * // callback will be called on the returned Module.
725
727
  * //
726
728
  * // Even top-level Modules without dependencies must be explicitly linked. The
727
- * // array passed to `sourceTextModule.linkRequests(modules)` can be
728
- * // empty, however.
729
+ * // callback provided would never be called, however.
729
730
  * //
730
- * // Note: This is a contrived example in that the resolveAndLinkDependencies
731
- * // creates a new "foo" module every time it is called. In a full-fledged
732
- * // module system, a cache would probably be used to avoid duplicated modules.
733
- *
734
- * const moduleMap = new Map([
735
- * ['root', rootModule],
736
- * ]);
737
- *
738
- * function resolveAndLinkDependencies(module) {
739
- * const requestedModules = module.moduleRequests.map((request) => {
740
- * // In a full-fledged module system, the resolveAndLinkDependencies would
741
- * // resolve the module with the module cache key `[specifier, attributes]`.
742
- * // In this example, we just use the specifier as the key.
743
- * const specifier = request.specifier;
744
- *
745
- * let requestedModule = moduleMap.get(specifier);
746
- * if (requestedModule === undefined) {
747
- * requestedModule = new vm.SourceTextModule(`
748
- * // The "secret" variable refers to the global variable we added to
749
- * // "contextifiedObject" when creating the context.
750
- * export default secret;
751
- * `, { context: referencingModule.context });
752
- * moduleMap.set(specifier, requestedModule);
753
- * // Resolve the dependencies of the new module as well.
754
- * resolveAndLinkDependencies(requestedModule);
755
- * }
756
- *
757
- * return requestedModule;
758
- * });
759
- *
760
- * module.linkRequests(requestedModules);
731
+ * // The link() method returns a Promise that will be resolved when all the
732
+ * // Promises returned by the linker resolve.
733
+ * //
734
+ * // Note: This is a contrived example in that the linker function creates a new
735
+ * // "foo" module every time it is called. In a full-fledged module system, a
736
+ * // cache would probably be used to avoid duplicated modules.
737
+ *
738
+ * async function linker(specifier, referencingModule) {
739
+ * if (specifier === 'foo') {
740
+ * return new vm.SourceTextModule(`
741
+ * // The "secret" variable refers to the global variable we added to
742
+ * // "contextifiedObject" when creating the context.
743
+ * export default secret;
744
+ * `, { context: referencingModule.context });
745
+ *
746
+ * // Using `contextifiedObject` instead of `referencingModule.context`
747
+ * // here would work as well.
748
+ * }
749
+ * throw new Error(`Unable to resolve dependency: ${specifier}`);
761
750
  * }
762
- *
763
- * resolveAndLinkDependencies(rootModule);
764
- * rootModule.instantiate();
751
+ * await bar.link(linker);
765
752
  *
766
753
  * // Step 3
767
754
  * //
@@ -769,12 +756,20 @@ declare module "node:vm" {
769
756
  * // resolve after the module has finished evaluating.
770
757
  *
771
758
  * // Prints 42.
772
- * await rootModule.evaluate();
759
+ * await bar.evaluate();
773
760
  * ```
774
761
  * @since v13.0.0, v12.16.0
775
762
  * @experimental
776
763
  */
777
764
  class Module {
765
+ /**
766
+ * The specifiers of all dependencies of this module. The returned array is frozen
767
+ * to disallow any changes to it.
768
+ *
769
+ * Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in
770
+ * the ECMAScript specification.
771
+ */
772
+ dependencySpecifiers: readonly string[];
778
773
  /**
779
774
  * If the `module.status` is `'errored'`, this property contains the exception
780
775
  * thrown by the module during evaluation. If the status is anything else,
@@ -819,47 +814,19 @@ declare module "node:vm" {
819
814
  */
820
815
  status: ModuleStatus;
821
816
  /**
822
- * Evaluate the module and its depenendencies. Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of
823
- * [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records)s in the ECMAScript specification.
824
- *
825
- * If the module is a `vm.SourceTextModule`, `evaluate()` must be called after the module has been instantiated;
826
- * otherwise `evaluate()` will return a rejected promise.
827
- *
828
- * For a `vm.SourceTextModule`, the promise returned by `evaluate()` may be fulfilled either
829
- * synchronously or asynchronously:
830
- *
831
- * 1. If the `vm.SourceTextModule` has no top-level `await` in itself or any of its dependencies, the promise will be
832
- * fulfilled _synchronously_ after the module and all its dependencies have been evaluated.
833
- * 1. If the evaluation succeeds, the promise will be _synchronously_ resolved to `undefined`.
834
- * 2. If the evaluation results in an exception, the promise will be _synchronously_ rejected with the exception
835
- * that causes the evaluation to fail, which is the same as `module.error`.
836
- * 2. If the `vm.SourceTextModule` has top-level `await` in itself or any of its dependencies, the promise will be
837
- * fulfilled _asynchronously_ after the module and all its dependencies have been evaluated.
838
- * 1. If the evaluation succeeds, the promise will be _asynchronously_ resolved to `undefined`.
839
- * 2. If the evaluation results in an exception, the promise will be _asynchronously_ rejected with the exception
840
- * that causes the evaluation to fail.
841
- *
842
- * If the module is a `vm.SyntheticModule`, `evaluate()` always returns a promise that fulfills synchronously, see
843
- * the specification of [Evaluate() of a Synthetic Module Record](https://tc39.es/ecma262/#sec-smr-Evaluate):
844
- *
845
- * 1. If the `evaluateCallback` passed to its constructor throws an exception synchronously, `evaluate()` returns
846
- * a promise that will be synchronously rejected with that exception.
847
- * 2. If the `evaluateCallback` does not throw an exception, `evaluate()` returns a promise that will be
848
- * synchronously resolved to `undefined`.
817
+ * Evaluate the module.
849
818
  *
850
- * The `evaluateCallback` of a `vm.SyntheticModule` is executed synchronously within the `evaluate()` call, and its
851
- * return value is discarded. This means if `evaluateCallback` is an asynchronous function, the promise returned by
852
- * `evaluate()` will not reflect its asynchronous behavior, and any rejections from an asynchronous
853
- * `evaluateCallback` will be lost.
819
+ * This must be called after the module has been linked; otherwise it will reject.
820
+ * It could be called also when the module has already been evaluated, in which
821
+ * case it will either do nothing if the initial evaluation ended in success
822
+ * (`module.status` is `'evaluated'`) or it will re-throw the exception that the
823
+ * initial evaluation resulted in (`module.status` is `'errored'`).
854
824
  *
855
- * `evaluate()` could also be called again after the module has already been evaluated, in which case:
825
+ * This method cannot be called while the module is being evaluated
826
+ * (`module.status` is `'evaluating'`).
856
827
  *
857
- * 1. If the initial evaluation ended in success (`module.status` is `'evaluated'`), it will do nothing
858
- * and return a promise that resolves to `undefined`.
859
- * 2. If the initial evaluation resulted in an exception (`module.status` is `'errored'`), it will re-reject
860
- * the exception that the initial evaluation resulted in.
861
- *
862
- * This method cannot be called while the module is being evaluated (`module.status` is `'evaluating'`).
828
+ * Corresponds to the [Evaluate() concrete method](https://tc39.es/ecma262/#sec-moduleevaluation) field of [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) s in the
829
+ * ECMAScript specification.
863
830
  * @return Fulfills with `undefined` upon success.
864
831
  */
865
832
  evaluate(options?: ModuleEvaluateOptions): Promise<void>;
@@ -867,10 +834,6 @@ declare module "node:vm" {
867
834
  * Link module dependencies. This method must be called before evaluation, and
868
835
  * can only be called once per module.
869
836
  *
870
- * Use `sourceTextModule.linkRequests(modules)` and
871
- * `sourceTextModule.instantiate()` to link modules either synchronously or
872
- * asynchronously.
873
- *
874
837
  * The function is expected to return a `Module` object or a `Promise` that
875
838
  * eventually resolves to a `Module` object. The returned `Module` must satisfy the
876
839
  * following two invariants:
@@ -915,30 +878,10 @@ declare module "node:vm" {
915
878
  /**
916
879
  * Used to specify how the modules should be loaded during the evaluation of this script when `import()` is called. This option is
917
880
  * part of the experimental modules API. We do not recommend using it in a production environment. For detailed information, see
918
- * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
919
- * @experimental
881
+ * [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
920
882
  */
921
883
  importModuleDynamically?: DynamicModuleLoader<SourceTextModule> | undefined;
922
884
  }
923
- /**
924
- * A `ModuleRequest` represents the request to import a module with given import attributes and phase.
925
- * @since 24.4.0
926
- */
927
- interface ModuleRequest {
928
- /**
929
- * The specifier of the requested module.
930
- */
931
- specifier: string;
932
- /**
933
- * The `"with"` value passed to the `WithClause` in a `ImportDeclaration`, or an empty object if no value was
934
- * provided.
935
- */
936
- attributes: ImportAttributes;
937
- /**
938
- * The phase of the requested module (`"source"` or `"evaluation"`).
939
- */
940
- phase: ImportPhase;
941
- }
942
885
  /**
943
886
  * This feature is only available with the `--experimental-vm-modules` command
944
887
  * flag enabled.
@@ -951,163 +894,9 @@ declare module "node:vm" {
951
894
  class SourceTextModule extends Module {
952
895
  /**
953
896
  * Creates a new `SourceTextModule` instance.
954
- *
955
- * Properties assigned to the `import.meta` object that are objects may
956
- * allow the module to access information outside the specified `context`. Use
957
- * `vm.runInContext()` to create objects in a specific context.
958
- *
959
- * ```js
960
- * import vm from 'node:vm';
961
- *
962
- * const contextifiedObject = vm.createContext({ secret: 42 });
963
- *
964
- * const module = new vm.SourceTextModule(
965
- * 'Object.getPrototypeOf(import.meta.prop).secret = secret;',
966
- * {
967
- * initializeImportMeta(meta) {
968
- * // Note: this object is created in the top context. As such,
969
- * // Object.getPrototypeOf(import.meta.prop) points to the
970
- * // Object.prototype in the top context rather than that in
971
- * // the contextified object.
972
- * meta.prop = {};
973
- * },
974
- * });
975
- * // The module has an empty `moduleRequests` array.
976
- * module.linkRequests([]);
977
- * module.instantiate();
978
- * await module.evaluate();
979
- *
980
- * // Now, Object.prototype.secret will be equal to 42.
981
- * //
982
- * // To fix this problem, replace
983
- * // meta.prop = {};
984
- * // above with
985
- * // meta.prop = vm.runInContext('{}', contextifiedObject);
986
- * ```
987
897
  * @param code JavaScript Module code to parse
988
898
  */
989
899
  constructor(code: string, options?: SourceTextModuleOptions);
990
- /**
991
- * @deprecated Use `sourceTextModule.moduleRequests` instead.
992
- */
993
- readonly dependencySpecifiers: readonly string[];
994
- /**
995
- * Iterates over the dependency graph and returns `true` if any module in its
996
- * dependencies or this module itself contains top-level `await` expressions,
997
- * otherwise returns `false`.
998
- *
999
- * The search may be slow if the graph is big enough.
1000
- *
1001
- * This requires the module to be instantiated first. If the module is not
1002
- * instantiated yet, an error will be thrown.
1003
- * @since v24.9.0
1004
- */
1005
- hasAsyncGraph(): boolean;
1006
- /**
1007
- * Returns whether the module itself contains any top-level `await` expressions.
1008
- *
1009
- * This corresponds to the field `[[HasTLA]]` in [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) in the
1010
- * ECMAScript specification.
1011
- * @since v24.9.0
1012
- */
1013
- hasTopLevelAwait(): boolean;
1014
- /**
1015
- * Instantiate the module with the linked requested modules.
1016
- *
1017
- * This resolves the imported bindings of the module, including re-exported
1018
- * binding names. When there are any bindings that cannot be resolved,
1019
- * an error would be thrown synchronously.
1020
- *
1021
- * If the requested modules include cyclic dependencies, the
1022
- * `sourceTextModule.linkRequests(modules)` method must be called on all
1023
- * modules in the cycle before calling this method.
1024
- * @since v24.8.0
1025
- */
1026
- instantiate(): void;
1027
- /**
1028
- * Link module dependencies. This method must be called before evaluation, and
1029
- * can only be called once per module.
1030
- *
1031
- * The order of the module instances in the `modules` array should correspond to the order of
1032
- * `sourceTextModule.moduleRequests` being resolved. If two module requests have the same
1033
- * specifier and import attributes, they must be resolved with the same module instance or an
1034
- * `ERR_MODULE_LINK_MISMATCH` would be thrown. For example, when linking requests for this
1035
- * module:
1036
- *
1037
- * ```js
1038
- * import foo from 'foo';
1039
- * import source Foo from 'foo';
1040
- * ```
1041
- *
1042
- * The `modules` array must contain two references to the same instance, because the two
1043
- * module requests are identical but in two phases.
1044
- *
1045
- * If the module has no dependencies, the `modules` array can be empty.
1046
- *
1047
- * Users can use `sourceTextModule.moduleRequests` to implement the host-defined
1048
- * [HostLoadImportedModule](https://tc39.es/ecma262/#sec-HostLoadImportedModule) abstract operation in the ECMAScript specification,
1049
- * and using `sourceTextModule.linkRequests()` to invoke specification defined
1050
- * [FinishLoadingImportedModule](https://tc39.es/ecma262/#sec-FinishLoadingImportedModule), on the module with all dependencies in a batch.
1051
- *
1052
- * It's up to the creator of the `SourceTextModule` to determine if the resolution
1053
- * of the dependencies is synchronous or asynchronous.
1054
- *
1055
- * After each module in the `modules` array is linked, call
1056
- * `sourceTextModule.instantiate()`.
1057
- * @since v24.8.0
1058
- * @param modules Array of `vm.Module` objects that this module depends on.
1059
- * The order of the modules in the array is the order of
1060
- * `sourceTextModule.moduleRequests`.
1061
- */
1062
- linkRequests(modules: readonly Module[]): void;
1063
- /**
1064
- * The requested import dependencies of this module. The returned array is frozen
1065
- * to disallow any changes to it.
1066
- *
1067
- * For example, given a source text:
1068
- *
1069
- * ```js
1070
- * import foo from 'foo';
1071
- * import fooAlias from 'foo';
1072
- * import bar from './bar.js';
1073
- * import withAttrs from '../with-attrs.ts' with { arbitraryAttr: 'attr-val' };
1074
- * import source Module from 'wasm-mod.wasm';
1075
- * ```
1076
- *
1077
- * The value of the `sourceTextModule.moduleRequests` will be:
1078
- *
1079
- * ```js
1080
- * [
1081
- * {
1082
- * specifier: 'foo',
1083
- * attributes: {},
1084
- * phase: 'evaluation',
1085
- * },
1086
- * {
1087
- * specifier: 'foo',
1088
- * attributes: {},
1089
- * phase: 'evaluation',
1090
- * },
1091
- * {
1092
- * specifier: './bar.js',
1093
- * attributes: {},
1094
- * phase: 'evaluation',
1095
- * },
1096
- * {
1097
- * specifier: '../with-attrs.ts',
1098
- * attributes: { arbitraryAttr: 'attr-val' },
1099
- * phase: 'evaluation',
1100
- * },
1101
- * {
1102
- * specifier: 'wasm-mod.wasm',
1103
- * attributes: {},
1104
- * phase: 'source',
1105
- * },
1106
- * ];
1107
- * ```
1108
- * @since v24.4.0
1109
- */
1110
- readonly moduleRequests: readonly ModuleRequest[];
1111
900
  }
1112
901
  interface SyntheticModuleOptions {
1113
902
  /**
@@ -1155,7 +944,9 @@ declare module "node:vm" {
1155
944
  options?: SyntheticModuleOptions,
1156
945
  );
1157
946
  /**
1158
- * This method sets the module export binding slots with the given value.
947
+ * This method is used after the module is linked to set the values of exports. If
948
+ * it is called before the module is linked, an `ERR_VM_MODULE_STATUS` error
949
+ * will be thrown.
1159
950
  *
1160
951
  * ```js
1161
952
  * import vm from 'node:vm';
@@ -1164,6 +955,7 @@ declare module "node:vm" {
1164
955
  * m.setExport('x', 1);
1165
956
  * });
1166
957
  *
958
+ * await m.link(() => {});
1167
959
  * await m.evaluate();
1168
960
  *
1169
961
  * assert.strictEqual(m.namespace.x, 1);
@@ -1184,7 +976,7 @@ declare module "node:vm" {
1184
976
  * and `vm.compileFunction()` so that Node.js uses the default ESM loader from the main
1185
977
  * context to load the requested module.
1186
978
  *
1187
- * For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v25.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
979
+ * For detailed information, see [Support of dynamic `import()` in compilation APIs](https://nodejs.org/docs/latest-v22.x/api/vm.html#support-of-dynamic-import-in-compilation-apis).
1188
980
  * @since v21.7.0, v20.12.0
1189
981
  */
1190
982
  const USE_MAIN_CONTEXT_DEFAULT_LOADER: number;
@@ -1203,6 +995,6 @@ declare module "node:vm" {
1203
995
  const DONT_CONTEXTIFY: number;
1204
996
  }
1205
997
  }
1206
- declare module "vm" {
1207
- export * from "node:vm";
998
+ declare module "node:vm" {
999
+ export * from "vm";
1208
1000
  }