2019-07-16 17:23:04 +00:00
|
|
|
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
|
|
|
|
|
2020-02-24 21:02:04 +00:00
|
|
|
This patch initializes asar support in Node.js.
|
2019-07-16 17:23:04 +00:00
|
|
|
|
2022-11-10 21:31:20 +00:00
|
|
|
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
|
|
|
|
index f7ead4084ed4ed6a682bc62e7ad6fc350381d3b9..cd9ca227b9cac4ff021ce1643000ea4b45163df6 100644
|
|
|
|
--- a/lib/internal/main/worker_thread.js
|
|
|
|
+++ b/lib/internal/main/worker_thread.js
|
|
|
|
@@ -31,6 +31,7 @@ const {
|
|
|
|
initializeReport,
|
|
|
|
initializeSourceMapsHandlers,
|
|
|
|
loadPreloadModules,
|
|
|
|
+ setupAsarSupport,
|
|
|
|
setupTraceCategoryState,
|
|
|
|
markBootstrapComplete
|
|
|
|
} = require('internal/process/pre_execution');
|
|
|
|
@@ -164,6 +165,8 @@ port.on('message', (message) => {
|
|
|
|
};
|
|
|
|
workerIo.sharedCwdCounter = cwdCounter;
|
|
|
|
|
|
|
|
+ setupAsarSupport();
|
|
|
|
+
|
|
|
|
const CJSLoader = require('internal/modules/cjs/loader');
|
|
|
|
assert(!CJSLoader.hasLoadedAnyUserCJSModule);
|
|
|
|
loadPreloadModules();
|
|
|
|
diff --git a/lib/internal/process/pre_execution.js b/lib/internal/process/pre_execution.js
|
|
|
|
index 23d4dbcf6cd8e1e3e4a509672e203323d81e736c..db8bf724af5f113c7c86350a210d5eee82879d13 100644
|
|
|
|
--- a/lib/internal/process/pre_execution.js
|
|
|
|
+++ b/lib/internal/process/pre_execution.js
|
|
|
|
@@ -103,12 +103,17 @@ function prepareMainThreadExecution(expandArgv1 = false,
|
2020-02-24 21:02:04 +00:00
|
|
|
assert(!CJSLoader.hasLoadedAnyUserCJSModule);
|
2019-07-16 17:23:04 +00:00
|
|
|
loadPreloadModules();
|
2019-10-14 22:46:10 +00:00
|
|
|
initializeFrozenIntrinsics();
|
2019-07-16 17:23:04 +00:00
|
|
|
+ setupAsarSupport();
|
|
|
|
}
|
|
|
|
|
2022-08-29 13:55:36 +00:00
|
|
|
function refreshRuntimeOptions() {
|
2022-11-10 21:31:20 +00:00
|
|
|
refreshOptions();
|
2019-07-16 17:23:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+function setupAsarSupport() {
|
2020-02-14 11:25:39 +00:00
|
|
|
+ process._linkedBinding('electron_common_asar').initAsarSupport(require);
|
2019-07-16 17:23:04 +00:00
|
|
|
+}
|
|
|
|
+
|
2022-11-10 21:31:20 +00:00
|
|
|
function patchProcessObject(expandArgv1) {
|
|
|
|
const binding = internalBinding('process_methods');
|
|
|
|
binding.patchProcessObject(process);
|
|
|
|
@@ -620,6 +625,7 @@ module.exports = {
|
|
|
|
loadPreloadModules,
|
|
|
|
setupTraceCategoryState,
|
|
|
|
setupInspectorHooks,
|
|
|
|
+ setupAsarSupport,
|
|
|
|
initializeReport,
|
|
|
|
initializeCJSLoader,
|
|
|
|
initializeWASI,
|