function installRequireProxy() {
    NodeModule.Module.prototype.require = new Proxy(NodeModule.Module.prototype.require, {
        apply(aTarget, aThisContext, aArgumentsList) {
            const moduleFileName = NodeModule._resolveFilename(aArgumentsList[0], aThisContext, false);
            const confinementToFulfill = findConfinementFor(aThisContext);

            if (confinementToFulfill !== null && !isAllowedToCall(confinementToFulfill, moduleFileName)) {
                throw new Error(`NodeModuleConfinement: Confinement violation found! Loading "${moduleFileName}" from "${aThisContext.id}" is not allowed!`);
            }

            const argumentList = aArgumentsList.slice();
            if (confinementToFulfill.redirect.has(moduleFileName)) {
                argumentList[0] = confinementToFulfill.redirect.get(moduleFileName);
            }

            return Reflect.apply(aTarget, aThisContext, argumentList);
        },
    });
}
/**
 * Installs a proxy for the require function in node, confining all modules based on shared rules
 */
Installs a proxy for the require function in node, confining all modules based on shared rules
Installs a proxy for the require function in node confining all modules based on shared rules
function installRequireProxy() {
    NodeModule.Module.prototype.require = new Proxy(NodeModule.Module.prototype.require, {
        apply(aTarget, aThisContext, aArgumentsList) {
            const moduleFileName = NodeModule._resolveFilename(aArgumentsList[0], aThisContext, false);
            const confinementToFulfill = findConfinementFor(aThisContext);
            if (confinementToFulfill !== null && !isAllowedToCall(confinementToFulfill, moduleFileName)) {
                throw new Error(`NodeModuleConfinement: Confinement violation found! Loading "${moduleFileName}" from "${aThisContext.id}" is not allowed!`);
            }
            const argumentList = aArgumentsList.slice();
            if (confinementToFulfill.redirect.has(moduleFileName)) {
                argumentList[0] = confinementToFulfill.redirect.get(moduleFileName);
            }
            return Reflect.apply(aTarget, aThisContext, argumentList);
        },
    });
}
function installRequireProxy ( ) { NodeModule . Module . prototype . require = new Proxy ( NodeModule . Module . prototype . require , { apply ( aTarget , aThisContext , aArgumentsList ) { const moduleFileName = NodeModule . _resolveFilename ( aArgumentsList [ 0 ] , aThisContext , false ) ; const confinementToFulfill = findConfinementFor ( aThisContext ) ; if ( confinementToFulfill !== null && ! isAllowedToCall ( confinementToFulfill , moduleFileName ) ) { throw new Error ( ` ${ moduleFileName } ${ aThisContext . id } ` ) ; } const argumentList = aArgumentsList . slice ( ) ; if ( confinementToFulfill . redirect . has ( moduleFileName ) ) { argumentList [ 0 ] = confinementToFulfill . redirect . get ( moduleFileName ) ; } return Reflect . apply ( aTarget , aThisContext , argumentList ) ; } , } ) ; }
Installs a proxy for the require function in node, confining all modules based on shared rules
Installs a proxy for the require function in node confining all modules based on shared rules