@@ -10,6 +10,7 @@ const {
10
10
ObjectGetOwnPropertyNames,
11
11
ObjectPrototypeHasOwnProperty,
12
12
RegExp,
13
+ RegExpPrototypeSymbolReplace,
13
14
RegExpPrototypeTest,
14
15
SafeMap,
15
16
SafeSet,
@@ -18,7 +19,6 @@ const {
18
19
StringPrototypeIncludes,
19
20
StringPrototypeIndexOf,
20
21
StringPrototypeLastIndexOf,
21
- StringPrototypeReplace,
22
22
StringPrototypeSlice,
23
23
StringPrototypeSplit,
24
24
StringPrototypeStartsWith,
@@ -470,7 +470,7 @@ function resolvePackageTargetString(
470
470
} catch { }
471
471
if ( ! isURL ) {
472
472
const exportTarget = pattern ?
473
- StringPrototypeReplace ( target , patternRegEx , subpath ) :
473
+ RegExpPrototypeSymbolReplace ( patternRegEx , target , ( ) => subpath ) :
474
474
target + subpath ;
475
475
return packageResolve ( exportTarget , packageJSONUrl , conditions ) ;
476
476
}
@@ -494,8 +494,8 @@ function resolvePackageTargetString(
494
494
throwInvalidSubpath ( match + subpath , packageJSONUrl , internal , base ) ;
495
495
496
496
if ( pattern )
497
- return new URL ( StringPrototypeReplace ( resolved . href , patternRegEx ,
498
- subpath ) ) ;
497
+ return new URL ( RegExpPrototypeSymbolReplace ( patternRegEx , resolved . href ,
498
+ ( ) => subpath ) ) ;
499
499
return new URL ( subpath , resolved ) ;
500
500
}
501
501
@@ -939,7 +939,8 @@ function resolveAsCommonJS(specifier, parentURL) {
939
939
// Normalize the path separator to give a valid suggestion
940
940
// on Windows
941
941
if ( process . platform === 'win32' ) {
942
- found = StringPrototypeReplace ( found , new RegExp ( `\\${ sep } ` , 'g' ) , '/' ) ;
942
+ found = RegExpPrototypeSymbolReplace ( new RegExp ( `\\${ sep } ` , 'g' ) ,
943
+ found , '/' ) ;
943
944
}
944
945
return found ;
945
946
} catch {
0 commit comments