Skip to content

Commit 01b3fff

Browse files
committed
esm: remove unnecessary toNamespacedPath calls
nodejs/node#53656
1 parent a548fe4 commit 01b3fff

1 file changed

Lines changed: 3 additions & 21 deletions

File tree

patches/node/fix_lazyload_fs_in_esm_loaders_to_apply_asar_patches.patch

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ 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 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d58434af647d 100644
41+
index f05c6f99c0037193c5802024be46a967d6cf47a0..f3dad958b2ec275992554477b9344214c8c1e2c8 100644
4242
--- a/lib/internal/modules/esm/resolve.js
4343
+++ b/lib/internal/modules/esm/resolve.js
4444
@@ -24,7 +24,7 @@ const {
@@ -49,17 +49,8 @@ index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d584
4949
+const fs = require('fs');
5050
const { getOptionValue } = require('internal/options');
5151
// Do not eagerly grab .manifest, it may be in TDZ
52-
const policy = getOptionValue('--experimental-policy') ?
53-
@@ -251,7 +251,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
54-
throw err;
55-
}
56-
57-
- const stats = internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
58-
+ const stats = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
59-
StringPrototypeSlice(path, -1) : path));
60-
61-
// Check for stats.isDirectory()
62-
@@ -267,7 +267,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
52+
const { sep, posix: { relative: relativePosixPath }, resolve } = require('path');
53+
@@ -259,7 +259,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
6354
}
6455

6556
if (!preserveSymlinks) {
@@ -68,15 +59,6 @@ index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d584
6859
[internalFS.realpathCacheKey]: realpathCache,
6960
});
7061
const { search, hash } = resolved;
71-
@@ -826,7 +826,7 @@ function packageResolve(specifier, base, conditions) {
72-
let packageJSONPath = fileURLToPath(packageJSONUrl);
73-
let lastPath;
74-
do {
75-
- const stat = internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0,
76-
+ const stat = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0,
77-
packageJSONPath.length - 13)));
78-
// Check for !stat.isDirectory()
79-
if (stat !== 1) {
8062
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
8163
index 89ca269294ee1afa7f5aeb0ac6b8958f7a8b49d0..f3dfc69cd2cdec50bc3b3f7cb2d63349812d87dd 100644
8264
--- a/lib/internal/modules/esm/translators.js

0 commit comments

Comments
 (0)