@@ -10,6 +10,7 @@ const {
1010 ObjectGetOwnPropertyNames,
1111 ObjectPrototypeHasOwnProperty,
1212 RegExp,
13+ RegExpPrototypeSymbolReplace,
1314 RegExpPrototypeTest,
1415 SafeMap,
1516 SafeSet,
@@ -18,7 +19,6 @@ const {
1819 StringPrototypeIncludes,
1920 StringPrototypeIndexOf,
2021 StringPrototypeLastIndexOf,
21- StringPrototypeReplace,
2222 StringPrototypeSlice,
2323 StringPrototypeSplit,
2424 StringPrototypeStartsWith,
@@ -470,7 +470,7 @@ function resolvePackageTargetString(
470470 } catch { }
471471 if ( ! isURL ) {
472472 const exportTarget = pattern ?
473- StringPrototypeReplace ( target , patternRegEx , subpath ) :
473+ RegExpPrototypeSymbolReplace ( patternRegEx , target , ( ) => subpath ) :
474474 target + subpath ;
475475 return packageResolve ( exportTarget , packageJSONUrl , conditions ) ;
476476 }
@@ -494,8 +494,8 @@ function resolvePackageTargetString(
494494 throwInvalidSubpath ( match + subpath , packageJSONUrl , internal , base ) ;
495495
496496 if ( pattern )
497- return new URL ( StringPrototypeReplace ( resolved . href , patternRegEx ,
498- subpath ) ) ;
497+ return new URL ( RegExpPrototypeSymbolReplace ( patternRegEx , resolved . href ,
498+ ( ) => subpath ) ) ;
499499 return new URL ( subpath , resolved ) ;
500500}
501501
@@ -939,7 +939,8 @@ function resolveAsCommonJS(specifier, parentURL) {
939939 // Normalize the path separator to give a valid suggestion
940940 // on Windows
941941 if ( process . platform === 'win32' ) {
942- found = StringPrototypeReplace ( found , new RegExp ( `\\${ sep } ` , 'g' ) , '/' ) ;
942+ found = RegExpPrototypeSymbolReplace ( new RegExp ( `\\${ sep } ` , 'g' ) ,
943+ found , '/' ) ;
943944 }
944945 return found ;
945946 } catch {
0 commit comments