File tree 1 file changed +10
-1
lines changed
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -552,10 +552,19 @@ namespace ts {
552
552
553
553
export function normalizePath ( path : string ) : string {
554
554
path = normalizeSlashes ( path ) ;
555
- path = path . replace ( / \/ \. \/ / g , "/" ) ;
555
+ // Most paths don't require normalization
556
556
if ( ! relativePathSegmentRegExp . test ( path ) ) {
557
557
return path ;
558
558
}
559
+ // Some paths only require cleanup of `/./`
560
+ const simplified = path . replace ( / \/ \. \/ / g, "/" ) ;
561
+ if ( simplified !== path ) {
562
+ path = simplified ;
563
+ if ( ! relativePathSegmentRegExp . test ( path ) ) {
564
+ return path ;
565
+ }
566
+ }
567
+ // Other paths require full normalization
559
568
const normalized = getPathFromPathComponents ( reducePathComponents ( getPathComponents ( path ) ) ) ;
560
569
return normalized && hasTrailingDirectorySeparator ( path ) ? ensureTrailingDirectorySeparator ( normalized ) : normalized ;
561
570
}
You can’t perform that action at this time.
0 commit comments