Skip to content

Commit 31257e5

Browse files
committed
module: fix discrepancy between .ts and .js
nodejs/node#54461
1 parent 152ed5e commit 31257e5

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ index 605e812d515fc467001e4ab88fc15b4af3fd4aa2..463e76cb1abc0c2fdddba4db2ca2e00f
3838
const result = dataURLProcessor(url);
3939
if (result === 'failure') {
4040
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
41-
index f05c6f99c0037193c5802024be46a967d6cf47a0..f3dad958b2ec275992554477b9344214c8c1e2c8 100644
41+
index ee2cc03892c01141b71571989b18eec387d3c766..c13475102a75d65329908f44def06a60f4a2c4f1 100644
4242
--- a/lib/internal/modules/esm/resolve.js
4343
+++ b/lib/internal/modules/esm/resolve.js
44-
@@ -24,7 +24,7 @@ const {
45-
} = primordials;
44+
@@ -25,7 +25,7 @@ const {
45+
const assert = require('internal/assert');
4646
const internalFS = require('internal/fs/utils');
4747
const { BuiltinModule } = require('internal/bootstrap/realm');
4848
-const { realpathSync } = require('fs');
@@ -60,19 +60,19 @@ index f05c6f99c0037193c5802024be46a967d6cf47a0..f3dad958b2ec275992554477b9344214
6060
});
6161
const { search, hash } = resolved;
6262
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
63-
index d182eedf5e96039e0029d36e51f40b75c6fb2a39..06b31af80ebbfbf35ec787a94f345775eb512ebf 100644
63+
index 25ee090bbb4884d3e5f2530cc7153f9215754fae..45a0abc6423a4e53e070f3c117fac2a3554b188d 100644
6464
--- a/lib/internal/modules/esm/translators.js
6565
+++ b/lib/internal/modules/esm/translators.js
66-
@@ -34,7 +34,7 @@ const {
66+
@@ -24,7 +24,7 @@ const {
6767

6868
const { BuiltinModule } = require('internal/bootstrap/realm');
6969
const assert = require('internal/assert');
7070
-const { readFileSync } = require('fs');
7171
+const fs = require('fs');
7272
const { dirname, extname, isAbsolute } = require('path');
7373
const {
74-
loadBuiltinModule,
75-
@@ -335,7 +335,7 @@ translators.set('commonjs', async function commonjsStrategy(url, source,
74+
assertBufferSource,
75+
@@ -269,7 +269,7 @@ translators.set('commonjs', function commonjsStrategy(url, source, isMain) {
7676

7777
try {
7878
// We still need to read the FS to detect the exports.
@@ -81,7 +81,7 @@ index d182eedf5e96039e0029d36e51f40b75c6fb2a39..06b31af80ebbfbf35ec787a94f345775
8181
} catch {
8282
// Continue regardless of error.
8383
}
84-
@@ -403,7 +403,7 @@ function cjsPreparseModuleExports(filename, source) {
84+
@@ -336,7 +336,7 @@ function cjsPreparseModuleExports(filename, source) {
8585
isAbsolute(resolved)) {
8686
// TODO: this should be calling the `load` hook chain to get the source
8787
// (and fallback to reading the FS only if the source is nullish).
@@ -90,3 +90,4 @@ index d182eedf5e96039e0029d36e51f40b75c6fb2a39..06b31af80ebbfbf35ec787a94f345775
9090
const { exportNames: reexportNames } = cjsPreparseModuleExports(resolved, source);
9191
for (const name of reexportNames) {
9292
exportNames.add(name);
93+

0 commit comments

Comments
 (0)