-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module: bootstrap module loaders in shadow realm
- Loading branch information
1 parent
966e3d3
commit f1f3986
Showing
25 changed files
with
487 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
// In ShadowRealm. | ||
|
||
const { | ||
prepareShadowRealmExecution, | ||
} = require('internal/process/pre_execution'); | ||
const { | ||
BuiltinModule, | ||
} = require('internal/bootstrap/realm'); | ||
const { setDefaultImportModuleDynamically } = require('internal/modules/esm/utils'); | ||
|
||
BuiltinModule.setRealmAllowRequireByUsers([ | ||
'assert', | ||
'assert/strict', | ||
'buffer', | ||
'console', | ||
'constants', | ||
'cypto', | ||
'diagnostics_channel', | ||
'events', | ||
'module', | ||
'path', | ||
'path/posix', | ||
'path/win32', | ||
'readline', | ||
'readline/promises', | ||
'repl', | ||
'stream', | ||
'stream/consumers', | ||
'stream/promises', | ||
'stream/web', | ||
'string_decoder', | ||
'url', | ||
'util', | ||
'util/types', | ||
'zlib', | ||
]); | ||
|
||
prepareShadowRealmExecution(); | ||
|
||
// The handler for `ShadowRealm.prototype.importValue`. | ||
setDefaultImportModuleDynamically((specifier, assertions) => { | ||
const { esmLoader } = require('internal/process/esm_loader'); | ||
// `parentUrl` is not set in the case of a ShadowRealm top-level import. | ||
return esmLoader.import(specifier, undefined, assertions); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.