INNER CODE UNIT · JavaScript
methodWrapper
standard-things/esm · src/hook/main.js:28
function methodWrapper() {
const [, mainPath] = realProcess.argv
const filename = dualResolveFilename(mainPath, null, true)
const defaultPkg = Loader.state.package.default
const dirPath = dirname(filename)
if (Package.get(dirPath) === defaultPkg) {
// Clone the default package to avoid the parsing phase fallback path
// of module/internal/compile.
Package.set(dirPath, defaultPkg.clone())
}
try {
esmParseLoad(mainPath, null, true)
} catch (e) {
if (! defaultPkg.options.debug &&
isStackTraceMaskable(e)) {
maskStackTrace(e, { filename })