blob: 84937cd78de4af8976fe93e6bc2f9386773d1873 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
'use strict';
// Flags: --experimental-vm-modules
const common = require('../common');
const assert = require('assert');
const { types } = require('util');
const { SourceTextModule } = require('vm');
(async () => {
const m = new SourceTextModule('globalThis.importResult = import("");', {
importModuleDynamically: common.mustCall(async (specifier, wrap) => {
const m = new SourceTextModule('');
await m.link(() => 0);
await m.evaluate();
return m.namespace;
}),
});
await m.link(() => 0);
await m.evaluate();
const ns = await globalThis.importResult;
delete globalThis.importResult;
assert.ok(types.isModuleNamespaceObject(ns));
})().then(common.mustCall());
|