Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Module.prototype.load = function (filename){
// console.log "getting to Module#load",filename
this.filename = filename;
this.paths = Module._nodeModulePaths(path.dirname(filename));
var ext = findExtension(filename);
Module._extensions[ext](this,filename);
return this.loaded = true;
};
} else if(require.registerExtension) {
function requireFromString(code) {
const paths = Module._nodeModulePaths(path.dirname(''))
const parent = module.parent
const m = new Module('', parent)
m.filename = ''
m.paths = paths
m._compile(code, '')
return m.exports
}
cor.Program.prototype.getExports = function(parent) {
var mod, js = this.toJs();
mod = new Module(this.filename, parent);
mod.filename = this.filename;
mod.paths = Module._nodeModulePaths(nodePath.dirname(this.filename));
mod.src = js.src;
mod.loaded = true;
mod._contextLoad = true;
mod._compile(js.src, this.filename);
return mod.exports || {};
}
run: function (source, fileName) {
log.debug('io.run:' + fileName);
require.main.fileName = fileName;
require.main.paths = _module._nodeModulePaths(_path.dirname(_fs.realpathSync(fileName)));
require.main._compile(source, fileName);
},
Module.prototype.load = function (filename){
this.filename = filename;
this.paths = Module._nodeModulePaths(path.dirname(filename));
var ext = findExtension(filename);
Module._extensions[ext](this,filename);
return this.loaded = true;
};