@@ -573,16 +573,6 @@ const contextifiedObject = vm.createContext({
573573})();
574574```
575575
576- ### ` module.dependencySpecifiers `
577-
578- * {string\[ ] }
579-
580- The specifiers of all dependencies of this module. The returned array is frozen
581- to disallow any changes to it.
582-
583- Corresponds to the ` [[RequestedModules]] ` field of [ Cyclic Module Record] [ ] s in
584- the ECMAScript specification.
585-
586576### ` module.error `
587577
588578* Type: {any}
@@ -887,6 +877,72 @@ const cachedData = module.createCachedData();
887877const module2 = new vm.SourceTextModule(' const a = 1 ;' , { cachedData });
888878```
889879
880+ ### `sourceTextModule.dependencySpecifiers`
881+
882+ <!-- YAML
883+ changes:
884+ - version: REPLACEME
885+ pr-url: https://github.com/nodejs/node/pull/20300
886+ description: This is deprecated in favour of `sourceTextModule.moduleRequests`.
887+ -->
888+
889+ > Stability: 0 - Deprecated: Use [`sourceTextModule.moduleRequests`][] instead.
890+
891+ * {string\[ ]}
892+
893+ The specifiers of all dependencies of this module. The returned array is frozen
894+ to disallow any changes to it.
895+
896+ Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record][]s in
897+ the ECMAScript specification.
898+
899+ ### `sourceTextModule.moduleRequests`
900+
901+ <!-- YAML
902+ added: REPLACEME
903+ -->
904+
905+ * {ModuleRequest\[ ]} Dependencies of this module.
906+
907+ The requested import dependencies of this module. The returned array is frozen
908+ to disallow any changes to it.
909+
910+ For example, given a source text:
911+
912+ <!-- eslint-disable no-duplicate-imports -->
913+
914+ ```mjs
915+ import foo from ' foo' ;
916+ import fooAlias from ' foo' ;
917+ import bar from ' ./ bar .js ' ;
918+ import withAttrs from ' ../ with - attrs .ts ' with { arbitraryAttr: ' attr- val' };
919+ ```
920+
921+ <!-- eslint-enable no-duplicate-imports -->
922+
923+ The value of the `sourceTextModule.moduleRequests` will be:
924+
925+ ```js
926+ [
927+ {
928+ specifier: ' foo' ,
929+ attributes: {},
930+ },
931+ {
932+ specifier: ' foo' ,
933+ attributes: {},
934+ },
935+ {
936+ specifier: ' ./ bar .js ' ,
937+ attributes: {},
938+ },
939+ {
940+ specifier: ' ../ with - attrs .ts ' ,
941+ attributes: { arbitraryAttr: ' attr- val' },
942+ },
943+ ];
944+ ```
945+
890946## Class: `vm.SyntheticModule`
891947
892948<!-- YAML
@@ -983,6 +1039,20 @@ const vm = require('node:vm');
9831039})();
9841040```
9851041
1042+ ## Type: `ModuleRequest`
1043+
1044+ <!-- YAML
1045+ added: REPLACEME
1046+ -->
1047+
1048+ * {Object}
1049+ * `specifier` {string} The specifier of the requested module.
1050+ * `attributes` {Object} The `"with"` value passed to the
1051+ [WithClause][] in a [ImportDeclaration][], or an empty object if no value was
1052+ provided.
1053+
1054+ A `ModuleRequest` represents the request to import a module with given import attributes and phase.
1055+
9861056## `vm.compileFunction(code[, params[, options]])`
9871057
9881058<!-- YAML
@@ -1953,12 +2023,14 @@ const { Script, SyntheticModule } = require('node:vm');
19532023[Evaluate() concrete method]: https://tc39.es/ecma262/#sec-moduleevaluation
19542024[GetModuleNamespace]: https://tc39.es/ecma262/#sec-getmodulenamespace
19552025[HostResolveImportedModule]: https://tc39.es/ecma262/#sec-hostresolveimportedmodule
2026+ [ImportDeclaration]: https://tc39.es/ecma262/#prod-ImportDeclaration
19562027[Link() concrete method]: https://tc39.es/ecma262/#sec-moduledeclarationlinking
19572028[Module Record]: https://tc39.es/ecma262/#sec-abstract-module-records
19582029[Source Text Module Record]: https://tc39.es/ecma262/#sec-source-text-module-records
19592030[Support of dynamic ` import ()` in compilation APIs]: #support-of-dynamic-import-in-compilation-apis
19602031[Synthetic Module Record]: https://tc39.es/ecma262/#sec-synthetic-module-records
19612032[V8 Embedder's Guide]: https://v8.dev/docs/embed#contexts
2033+ [WithClause]: https://tc39.es/ecma262/#prod-WithClause
19622034[` ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG ` ]: errors.md#err_vm_dynamic_import_callback_missing_flag
19632035[` ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING ` ]: errors.md#err_vm_dynamic_import_callback_missing
19642036[` ERR_VM_MODULE_STATUS ` ]: errors.md#err_vm_module_status
@@ -1968,6 +2040,7 @@ const { Script, SyntheticModule } = require('node:vm');
19682040[` optionsExpression` ]: https://tc39.es/proposal-import-attributes/#sec-evaluate-import-call
19692041[` script .runInContext ()` ]: #scriptrunincontextcontextifiedobject-options
19702042[` script .runInThisContext ()` ]: #scriptruninthiscontextoptions
2043+ [` sourceTextModule .moduleRequests ` ]: #sourcetextmodulemodulerequests
19712044[` url .origin ` ]: url.md#urlorigin
19722045[` vm .compileFunction ()` ]: #vmcompilefunctioncode-params-options
19732046[` vm .constants .DONT_CONTEXTIFY ` ]: #vmconstantsdont_contextify
0 commit comments