electron/patches/node/feat_initialize_asar_support.patch

43 lines
1.4 KiB
Diff
Raw Normal View History

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
2019-07-17 21:22:27 +00:00
index bbb0786dcd20ec741892b02f96b3c37fec8f1de0..a998b095fb067ab6ca35cc276ac6a9a7c38dcf30 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,