From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedor Indutny <indutny@signal.org>
Date: Wed, 9 Mar 2022 17:52:32 -0800
Subject: worker_thread: add asar support

This patch initializes asar support in workers threads in
Node.js.

diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
index 419ffd9d5deb84eb94381259d3084411f6c3341b..17a1860d158976f11035553601560d171c7fc25a 100644
--- a/lib/internal/bootstrap/pre_execution.js
+++ b/lib/internal/bootstrap/pre_execution.js
@@ -505,6 +505,7 @@ module.exports = {
   loadPreloadModules,
   setupTraceCategoryState,
   setupInspectorHooks,
+  setupAsarSupport,
   initializeReport,
   initializeCJSLoader,
   initializeWASI
diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
index e3ce67987ee3185a93750ebad72beab304c71e3a..ef5082d73b6153b49875c61d9b365b873b16145d 100644
--- a/lib/internal/main/worker_thread.js
+++ b/lib/internal/main/worker_thread.js
@@ -27,6 +27,7 @@ const {
   initializeReport,
   initializeSourceMapsHandlers,
   loadPreloadModules,
+  setupAsarSupport,
   setupTraceCategoryState
 } = require('internal/bootstrap/pre_execution');
 
@@ -154,6 +155,8 @@ port.on('message', (message) => {
     };
     workerIo.sharedCwdCounter = cwdCounter;
 
+    setupAsarSupport();
+
     const CJSLoader = require('internal/modules/cjs/loader');
     assert(!CJSLoader.hasLoadedAnyUserCJSModule);
     loadPreloadModules();
