mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00: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>
22 lines
579 B
JavaScript
22 lines
579 B
JavaScript
'use strict';
|
|
|
|
// This script sets up the context for shadow realms.
|
|
|
|
const {
|
|
prepareShadowRealmExecution,
|
|
} = require('internal/process/pre_execution');
|
|
const {
|
|
BuiltinModule,
|
|
} = require('internal/bootstrap/realm');
|
|
|
|
BuiltinModule.setRealmAllowRequireByUsers([
|
|
/**
|
|
* The built-in modules exposed in the ShadowRealm must each be providing
|
|
* platform capabilities with no authority to cause side effects such as
|
|
* I/O or mutation of values that are shared across different realms within
|
|
* the same Node.js environment.
|
|
*/
|
|
]);
|
|
|
|
prepareShadowRealmExecution();
|