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