@@ -68,7 +68,7 @@ const cjsParseCache = new SafeWeakMap();
6868
6969// Set first due to cycle with ESM loader functions.
7070module . exports = {
71- wrapSafe, Module, toRealPath , readPackageScope, cjsParseCache,
71+ wrapSafe, Module, readPackageScope, cjsParseCache,
7272 get hasLoadedAnyUserCJSModule ( ) { return hasLoadedAnyUserCJSModule ; } ,
7373 initializeCJS,
7474} ;
@@ -88,7 +88,6 @@ const {
8888const { internalCompileFunction } = require ( 'internal/vm' ) ;
8989const assert = require ( 'internal/assert' ) ;
9090const fs = require ( 'fs' ) ;
91- const internalFS = require ( 'internal/fs/utils' ) ;
9291const path = require ( 'path' ) ;
9392const { sep } = path ;
9493const { internalModuleStat } = internalBinding ( 'fs' ) ;
@@ -106,6 +105,7 @@ const {
106105 makeRequireFunction,
107106 normalizeReferrerURL,
108107 stripBOM,
108+ toRealPath,
109109} = require ( 'internal/modules/helpers' ) ;
110110const packageJsonReader = require ( 'internal/modules/package_json_reader' ) ;
111111const { getOptionValue, getEmbedderOptions } = require ( 'internal/options' ) ;
@@ -498,14 +498,6 @@ function tryPackage(requestPath, exts, isMain, originalPath) {
498498 return actual ;
499499}
500500
501- /**
502- * Cache for storing resolved real paths of modules.
503- * In order to minimize unnecessary lstat() calls, this cache is a list of known-real paths.
504- * Set to an empty Map to reset.
505- * @type {Map<string, string> }
506- */
507- const realpathCache = new SafeMap ( ) ;
508-
509501/**
510502 * Check if the file exists and is not a directory if using `--preserve-symlinks` and `isMain` is false, keep symlinks
511503 * intact, otherwise resolve to the absolute realpath.
@@ -521,17 +513,6 @@ function tryFile(requestPath, isMain) {
521513 return toRealPath ( requestPath ) ;
522514}
523515
524-
525- /**
526- * Resolves the path of a given `require` specifier, following symlinks.
527- * @param {string } requestPath The `require` specifier
528- */
529- function toRealPath ( requestPath ) {
530- return fs . realpathSync ( requestPath , {
531- [ internalFS . realpathCacheKey ] : realpathCache ,
532- } ) ;
533- }
534-
535516/**
536517 * Given a path, check if the file exists with any of the set extensions.
537518 * @param {string } basePath The path and filename without extension
0 commit comments