Skip to content

Commit 061c2be

Browse files
authored
module: refactor ESM loader for adding future synchronous hooks
nodejs/node#54769
1 parent f851319 commit 061c2be

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

patches/node/fix_expose_the_built-in_electron_module_via_the_esm_loader.patch

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ index 93c7a040fd47f050b10b949e4f619d85660110c8..77b85490b1a65b594bb140deb07b33f3
7373
parsePackageName(specifier, base);
7474

7575
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
76-
index 044d820161a5f9809dd042be7e53b717de8678ab..5281d7c220c8adee0f3d7269a0116d082726ec91 100644
76+
index 23c14e2ec6..0be9253a00 100644
7777
--- a/lib/internal/modules/esm/translators.js
7878
+++ b/lib/internal/modules/esm/translators.js
79-
@@ -272,7 +272,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
79+
@@ -226,7 +226,7 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
8080

8181
const { exportNames, module } = cjsPreparseModuleExports(filename, source);
8282
cjsCache.set(url, module);
@@ -85,7 +85,7 @@ index 044d820161a5f9809dd042be7e53b717de8678ab..5281d7c220c8adee0f3d7269a0116d08
8585
[...exportNames] : ['default', ...exportNames];
8686

8787
if (isMain) {
88-
@@ -294,8 +294,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
88+
@@ -248,8 +248,8 @@ function createCJSModuleWrap(url, source, isMain, loadCJS = loadCJSModule) {
8989
({ exports } = module);
9090
}
9191
for (const exportName of exportNames) {
@@ -96,7 +96,7 @@ index 044d820161a5f9809dd042be7e53b717de8678ab..5281d7c220c8adee0f3d7269a0116d08
9696
continue;
9797
}
9898
// We might trigger a getter -> dont fail.
99-
@@ -329,6 +329,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
99+
@@ -283,6 +283,10 @@ translators.set('require-commonjs', (url, source, isMain) => {
100100
return createCJSModuleWrap(url, source);
101101
});
102102

@@ -106,7 +106,7 @@ index 044d820161a5f9809dd042be7e53b717de8678ab..5281d7c220c8adee0f3d7269a0116d08
106106
+
107107
// Handle CommonJS modules referenced by `import` statements or expressions,
108108
// or as the initial entry point when the ESM loader handles a CommonJS entry.
109-
translators.set('commonjs', async function commonjsStrategy(url, source,
109+
translators.set('commonjs', function commonjsStrategy(url, source, isMain) {
110110
diff --git a/lib/internal/url.js b/lib/internal/url.js
111111
index 42debfc20005b0d293e5507546dcd8caec2b6a4e..4b6d07b14bd92ac527b7f4bd55ff7005967cee7d 100644
112112
--- a/lib/internal/url.js

0 commit comments

Comments
 (0)