File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -780,6 +780,7 @@ namespace ts {
780
780
export const enum FileSystemEntryKind {
781
781
File ,
782
782
Directory ,
783
+ Any ,
783
784
}
784
785
785
786
/*@internal */
@@ -1821,6 +1822,7 @@ namespace ts {
1821
1822
switch ( entryKind ) {
1822
1823
case FileSystemEntryKind . File : return stat . isFile ( ) ;
1823
1824
case FileSystemEntryKind . Directory : return stat . isDirectory ( ) ;
1825
+ case FileSystemEntryKind . Any : return true ;
1824
1826
default : return false ;
1825
1827
}
1826
1828
}
@@ -1845,6 +1847,9 @@ namespace ts {
1845
1847
}
1846
1848
1847
1849
function realpath ( path : string ) : string {
1850
+ // `realpathSync` is slow on non-existent files, since it throws an exception - guard against calls on paths that don't exist with the
1851
+ // more optimized exists call (which attempts to avoid throwing an error if the runtime supports it)
1852
+ if ( ! fileSystemEntryExists ( path , FileSystemEntryKind . Any ) ) return path ;
1848
1853
try {
1849
1854
return realpathSync ( path ) ;
1850
1855
}
You can’t perform that action at this time.
0 commit comments