Allow access to module cache through require.cache and require.resolve
This commit is contained in:
parent
badf8b5470
commit
ef04a62c54
1 changed files with 10 additions and 3 deletions
|
@ -309,11 +309,18 @@ When resolving module names to file paths, ScriptCraft uses the following rules.
|
||||||
return moduleInfo;
|
return moduleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _requireClosure( parent ) {
|
function _requireClosure( parentFile ) {
|
||||||
return function requireBoundToParent( path, options ) {
|
var _boundRequire = function requireBoundToParent( path, options ) {
|
||||||
var module = _require( parent, path , options);
|
var module = _require( parentFile, path , options);
|
||||||
return module.exports;
|
return module.exports;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_boundRequire.resolve = function resolveBoundToParent ( path ) {
|
||||||
|
return resolveModuleToFile(path, parentFile);
|
||||||
|
};
|
||||||
|
_boundRequire.cache = _loadedModules;
|
||||||
|
|
||||||
|
return _boundRequire;
|
||||||
}
|
}
|
||||||
var _loadedModules = {};
|
var _loadedModules = {};
|
||||||
var _format = java.lang.String.format;
|
var _format = java.lang.String.format;
|
||||||
|
|
Reference in a new issue