Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

Commit

Permalink
Attempt to fix asar support
Browse files Browse the repository at this point in the history
  • Loading branch information
nitsakh authored and zcbenz committed Apr 10, 2019
1 parent ffd1b08 commit 152f200
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ function nativeModuleRequire(id) {
return mod.compile();
}

NativeModule.require = nativeModuleRequire

NativeModule.exists = function(id) {
return NativeModule.map.has(id);
};
Expand Down
7 changes: 0 additions & 7 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,11 @@ const { Object, Symbol } = primordials;
const config = internalBinding('config');
const { deprecate } = require('internal/util');

process.NativeModule = NativeModule;
setupProcessObject();

setupGlobalProxy();
setupBuffer();

setupAsarSupport();

process.domain = null;
process._exiting = false;

Expand Down Expand Up @@ -450,7 +447,3 @@ function defineOperation(target, name, method) {
value: method
});
}

function setupAsarSupport() {
process._linkedBinding('atom_common_asar').initAsarSupport(NativeModule._source, NativeModule.require);
}
5 changes: 5 additions & 0 deletions lib/internal/bootstrap/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function prepareMainThreadExecution() {
initializeFrozenIntrinsics();
initializeESMLoader();
loadPreloadModules();
setupAsarSupport();
}

function patchProcessObject() {
Expand Down Expand Up @@ -315,6 +316,10 @@ function loadPreloadModules() {
}
}

function setupAsarSupport() {
process._linkedBinding('atom_common_asar').initAsarSupport(require);
}

module.exports = {
patchProcessObject,
setupCoverageHooks,
Expand Down

0 comments on commit 152f200

Please sign in to comment.