2016-01-12 01:39:11 +00:00
|
|
|
(function () {
|
2016-01-12 02:40:23 +00:00
|
|
|
return function(process, require, asarSource) {
|
|
|
|
var createArchive, source;
|
|
|
|
createArchive = process.binding('atom_common_asar').createArchive;
|
|
|
|
|
2016-01-14 18:35:29 +00:00
|
|
|
// Make asar.coffee accessible via "require".
|
2016-01-12 02:40:23 +00:00
|
|
|
process.binding('natives').ATOM_SHELL_ASAR = asarSource;
|
|
|
|
|
2016-01-14 18:35:29 +00:00
|
|
|
// Monkey-patch the fs module.
|
2016-01-12 02:40:23 +00:00
|
|
|
require('ATOM_SHELL_ASAR').wrapFsWithAsar(require('fs'));
|
|
|
|
|
2016-01-14 18:35:29 +00:00
|
|
|
// Make graceful-fs work with asar.
|
2016-01-12 02:40:23 +00:00
|
|
|
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);";
|
|
|
|
};
|
2016-01-12 01:39:11 +00:00
|
|
|
})()
|