electron/patches/node/feat_initialize_asar_suppor...

43 строки
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Thu, 13 Sep 2018 08:56:07 -0700
Subject: feat: initialize asar support
diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js
index 7a98e4c96c87d4738829aadf1969ee90eda3876a..bf63de07613b4d19d95607f404139e587319f11d 100644
--- a/lib/internal/bootstrap/loaders.js
+++ b/lib/internal/bootstrap/loaders.js
@@ -189,6 +189,8 @@ function nativeModuleRequire(id) {
return mod.compile();
}
+NativeModule.require = nativeModuleRequire
+
NativeModule.exists = function(id) {
return NativeModule.map.has(id);
};
diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
index 24d25158f9e8adf5f2265504a21daa5ed96f517a..2351268eae27af7ae759dccb599c071e146ece71 100644
--- a/lib/internal/bootstrap/pre_execution.js
+++ b/lib/internal/bootstrap/pre_execution.js
@@ -51,6 +51,7 @@ function prepareMainThreadExecution(expandArgv1 = false) {
initializeCJSLoader();
initializeESMLoader();
loadPreloadModules();
+ setupAsarSupport();
}
function patchProcessObject(expandArgv1) {
@@ -393,6 +394,10 @@ function loadPreloadModules() {
}
}
+function setupAsarSupport() {
+ process._linkedBinding('atom_common_asar').initAsarSupport(require);
+}
+
module.exports = {
patchProcessObject,
setupCoverageHooks,