mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
fc2862b7f5
This bootstraps ESM loaders in the ShadowRealm with `ShadowRealm.prototype.importValue` as its entry point and enables loading ESM and CJS modules in the ShadowRealm. The module is imported without a parent URL and resolved with the current process's working directory. PR-URL: https://github.com/nodejs/node/pull/48655 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
27 lines
783 B
JavaScript
27 lines
783 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
const assert = require('assert');
|
|
|
|
const commonArgs = [
|
|
'--experimental-shadow-realm',
|
|
'--no-warnings',
|
|
];
|
|
|
|
async function main() {
|
|
// Verifies that custom loaders are not enabled in the ShadowRealm.
|
|
const child = await common.spawnPromisified(process.execPath, [
|
|
...commonArgs,
|
|
'--experimental-loader',
|
|
fixtures.fileURL('es-module-loaders', 'loader-resolve-shortcircuit.mjs'),
|
|
'--experimental-loader',
|
|
fixtures.fileURL('es-module-loaders', 'loader-load-foo-or-42.mjs'),
|
|
fixtures.path('es-module-shadow-realm', 'custom-loaders.js'),
|
|
]);
|
|
|
|
assert.strictEqual(child.stderr, '');
|
|
assert.strictEqual(child.code, 0);
|
|
}
|
|
|
|
main().then(common.mustCall());
|