parent
					
						
							
								cc7e80c4e3
							
						
					
				
			
			
				commit
				
					
						62a897b75b
					
				
			
		
					 4 changed files with 42 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -8,10 +8,10 @@ they use themselves as the entry point. We should try to upstream some form
 | 
			
		|||
of this.
 | 
			
		||||
 | 
			
		||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
 | 
			
		||||
index 1f3b719048f2477de183e2856b9b8eee8502f708..21116088c101f4679b5a5f41762ce710368e69ed 100644
 | 
			
		||||
index dbbb454c3fc8a7774c1d190713e88862fda50f22..7a326e925a5769b8ea8e512e30fa655768beae3f 100644
 | 
			
		||||
--- a/lib/internal/modules/cjs/loader.js
 | 
			
		||||
+++ b/lib/internal/modules/cjs/loader.js
 | 
			
		||||
@@ -1351,6 +1351,13 @@ Module.prototype._compile = function(content, filename) {
 | 
			
		||||
@@ -1350,6 +1350,13 @@ Module.prototype._compile = function(content, filename) {
 | 
			
		||||
   if (getOptionValue('--inspect-brk') && process._eval == null) {
 | 
			
		||||
     if (!resolvedArgv) {
 | 
			
		||||
       // We enter the repl if we're not given a filename argument.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,7 +38,7 @@ index 6a15fcae677b3bda58fc85f705862bbcd9feec9d..449131b9af99744c08d62d73f8d124ce
 | 
			
		|||
     const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname);
 | 
			
		||||
     if (!match) {
 | 
			
		||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
 | 
			
		||||
index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..102165af37a42ca0394ec0d4efc21d3b03efe5eb 100644
 | 
			
		||||
index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..06d23dac1d0f591893643ed2c32711eb2b5c0675 100644
 | 
			
		||||
--- a/lib/internal/modules/esm/resolve.js
 | 
			
		||||
+++ b/lib/internal/modules/esm/resolve.js
 | 
			
		||||
@@ -24,7 +24,7 @@ const {
 | 
			
		||||
| 
						 | 
				
			
			@ -50,6 +50,15 @@ index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..102165af37a42ca0394ec0d4efc21d3b
 | 
			
		|||
 const { getOptionValue } = require('internal/options');
 | 
			
		||||
 // Do not eagerly grab .manifest, it may be in TDZ
 | 
			
		||||
 const policy = getOptionValue('--experimental-policy') ?
 | 
			
		||||
@@ -250,7 +250,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
 | 
			
		||||
     throw err;
 | 
			
		||||
   }
 | 
			
		||||
 
 | 
			
		||||
-  const stats = internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
 | 
			
		||||
+  const stats = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
 | 
			
		||||
     StringPrototypeSlice(path, -1) : path));
 | 
			
		||||
 
 | 
			
		||||
   // Check for stats.isDirectory()
 | 
			
		||||
@@ -266,7 +266,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
 | 
			
		||||
   }
 | 
			
		||||
 
 | 
			
		||||
| 
						 | 
				
			
			@ -59,6 +68,15 @@ index 66ecfbcdd4fb2c9986e2d4619a381337839979fe..102165af37a42ca0394ec0d4efc21d3b
 | 
			
		|||
       [internalFS.realpathCacheKey]: realpathCache,
 | 
			
		||||
     });
 | 
			
		||||
     const { search, hash } = resolved;
 | 
			
		||||
@@ -825,7 +825,7 @@ function packageResolve(specifier, base, conditions) {
 | 
			
		||||
   let packageJSONPath = fileURLToPath(packageJSONUrl);
 | 
			
		||||
   let lastPath;
 | 
			
		||||
   do {
 | 
			
		||||
-    const stat = internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0,
 | 
			
		||||
+    const stat = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0,
 | 
			
		||||
                                                                           packageJSONPath.length - 13)));
 | 
			
		||||
     // Check for !stat.isDirectory()
 | 
			
		||||
     if (stat !== 1) {
 | 
			
		||||
diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js
 | 
			
		||||
index e5fea28126b1b810cd3e1e5a13c0fdc97b6b71f5..cea066d1073a31573e134d584f1991e7a06b1036 100644
 | 
			
		||||
--- a/lib/internal/modules/esm/translators.js
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@ to recognize asar files.
 | 
			
		|||
This reverts commit 9cf2e1f55b8446a7cde23699d00a3be73aa0c8f1.
 | 
			
		||||
 | 
			
		||||
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
 | 
			
		||||
index 102165af37a42ca0394ec0d4efc21d3b03efe5eb..cb8341f7378f16d4c0cc5368047a893704147842 100644
 | 
			
		||||
index 06d23dac1d0f591893643ed2c32711eb2b5c0675..585437ce6a5382cd8657e02e4f3bcefc92206d7b 100644
 | 
			
		||||
--- a/lib/internal/modules/esm/resolve.js
 | 
			
		||||
+++ b/lib/internal/modules/esm/resolve.js
 | 
			
		||||
@@ -36,10 +36,9 @@ const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main');
 | 
			
		||||
| 
						 | 
				
			
			@ -30,6 +30,15 @@ index 102165af37a42ca0394ec0d4efc21d3b03efe5eb..cb8341f7378f16d4c0cc5368047a8937
 | 
			
		|||
 const {
 | 
			
		||||
   ERR_INPUT_TYPE_NOT_ALLOWED,
 | 
			
		||||
   ERR_INVALID_ARG_TYPE,
 | 
			
		||||
@@ -58,7 +57,7 @@ const { Module: CJSModule } = require('internal/modules/cjs/loader');
 | 
			
		||||
 const { getPackageScopeConfig } = require('internal/modules/esm/package_config');
 | 
			
		||||
 const { getConditionsSet } = require('internal/modules/esm/utils');
 | 
			
		||||
 const packageJsonReader = require('internal/modules/package_json_reader');
 | 
			
		||||
-const { internalModuleStat } = internalBinding('fs');
 | 
			
		||||
+const internalFsBinding = internalBinding('fs');
 | 
			
		||||
 
 | 
			
		||||
 /**
 | 
			
		||||
  * @typedef {import('internal/modules/esm/package_config.js').PackageConfig} PackageConfig
 | 
			
		||||
@@ -161,34 +160,13 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
 | 
			
		||||
 
 | 
			
		||||
 const realpathCache = new SafeMap();
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +76,7 @@ index 102165af37a42ca0394ec0d4efc21d3b03efe5eb..cb8341f7378f16d4c0cc5368047a8937
 | 
			
		|||
+ * @returns {boolean}
 | 
			
		||||
+ */
 | 
			
		||||
+function fileExists(url) {
 | 
			
		||||
+  return internalModuleStat(toNamespacedPath(toPathIfFileURL(url))) === 0;
 | 
			
		||||
+  return internalFsBinding.internalModuleStat(toNamespacedPath(toPathIfFileURL(url))) === 0;
 | 
			
		||||
+}
 | 
			
		||||
 
 | 
			
		||||
 /**
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,18 +22,19 @@ index 7a773d5208e250abd8b0efb6dde66c45060bbee4..45e38ca0a122e3b1c5d8d59865f9610c
 | 
			
		|||
 const binding = internalBinding('builtins');
 | 
			
		||||
 
 | 
			
		||||
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
 | 
			
		||||
index d4b70bab5e89300bfe6305263d556c986380e2e0..1f3b719048f2477de183e2856b9b8eee8502f708 100644
 | 
			
		||||
index d4b70bab5e89300bfe6305263d556c986380e2e0..dbbb454c3fc8a7774c1d190713e88862fda50f22 100644
 | 
			
		||||
--- a/lib/internal/modules/cjs/loader.js
 | 
			
		||||
+++ b/lib/internal/modules/cjs/loader.js
 | 
			
		||||
@@ -96,6 +96,7 @@ const assert = require('internal/assert');
 | 
			
		||||
@@ -95,7 +95,7 @@ const { containsModuleSyntax } = internalBinding('contextify');
 | 
			
		||||
 const assert = require('internal/assert');
 | 
			
		||||
 const fs = require('fs');
 | 
			
		||||
 const path = require('path');
 | 
			
		||||
 const { internalModuleStat } = internalBinding('fs');
 | 
			
		||||
-const { internalModuleStat } = internalBinding('fs');
 | 
			
		||||
+const internalFsBinding = internalBinding('fs');
 | 
			
		||||
 const { safeGetenv } = internalBinding('credentials');
 | 
			
		||||
 const {
 | 
			
		||||
   privateSymbols: {
 | 
			
		||||
@@ -195,7 +196,7 @@ function stat(filename) {
 | 
			
		||||
@@ -195,7 +195,7 @@ function stat(filename) {
 | 
			
		||||
     const result = statCache.get(filename);
 | 
			
		||||
     if (result !== undefined) { return result; }
 | 
			
		||||
   }
 | 
			
		||||
| 
						 | 
				
			
			@ -43,18 +44,19 @@ index d4b70bab5e89300bfe6305263d556c986380e2e0..1f3b719048f2477de183e2856b9b8eee
 | 
			
		|||
     // Only set cache when `internalModuleStat(filename)` succeeds.
 | 
			
		||||
     statCache.set(filename, result);
 | 
			
		||||
diff --git a/lib/internal/modules/package_json_reader.js b/lib/internal/modules/package_json_reader.js
 | 
			
		||||
index 88c079d10d116107aa34dc9281f64c799c48c0b5..146e2e49dc46c7f5302638f75cca4af548509d77 100644
 | 
			
		||||
index 88c079d10d116107aa34dc9281f64c799c48c0b5..069f922612777f226127dc44f4091eed30416925 100644
 | 
			
		||||
--- a/lib/internal/modules/package_json_reader.js
 | 
			
		||||
+++ b/lib/internal/modules/package_json_reader.js
 | 
			
		||||
@@ -13,6 +13,7 @@ const {
 | 
			
		||||
@@ -12,7 +12,7 @@ const {
 | 
			
		||||
 const {
 | 
			
		||||
   ERR_INVALID_PACKAGE_CONFIG,
 | 
			
		||||
 } = require('internal/errors').codes;
 | 
			
		||||
 const { internalModuleReadJSON } = internalBinding('fs');
 | 
			
		||||
-const { internalModuleReadJSON } = internalBinding('fs');
 | 
			
		||||
+const internalFsBinding = internalBinding('fs');
 | 
			
		||||
 const { resolve, sep, toNamespacedPath } = require('path');
 | 
			
		||||
 const permission = require('internal/process/permission');
 | 
			
		||||
 const { kEmptyObject } = require('internal/util');
 | 
			
		||||
@@ -53,7 +54,7 @@ function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
 | 
			
		||||
@@ -53,7 +53,7 @@ function read(jsonPath, { base, specifier, isESM } = kEmptyObject) {
 | 
			
		||||
   const {
 | 
			
		||||
     0: string,
 | 
			
		||||
     1: containsKeys,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue