Avoid re-evaluating internal modules
This commit is contained in:
Родитель
896ea7b79d
Коммит
e5886dda9b
|
@ -9,6 +9,12 @@
|
|||
// Make graceful-fs work with asar.
|
||||
var source = process.binding('natives');
|
||||
source['original-fs'] = source.fs;
|
||||
return source['fs'] = "var src = '(function (exports, require, module, __filename, __dirname) { ' +\n process.binding('natives')['original-fs'] +\n ' });';\nvar vm = require('vm');\nvar fn = vm.runInThisContext(src, { filename: 'fs.js' });\nfn(exports, require, module);\nvar asar = require('ATOM_SHELL_ASAR');\nasar.wrapFsWithAsar(exports);";
|
||||
return source['fs'] = `
|
||||
var nativeModule = new process.NativeModule('original-fs');
|
||||
nativeModule.cache();
|
||||
nativeModule.compile();
|
||||
var asar = require('ATOM_SHELL_ASAR');
|
||||
asar.wrapFsWithAsar(nativeModule.exports);
|
||||
module.exports = nativeModule.exports`;
|
||||
};
|
||||
})();
|
||||
|
|
Загрузка…
Ссылка в новой задаче