@@ -337,6 +337,7 @@ namespace ts {
337
337
getAccessileSortedChildDirectories ( path : string ) : ReadonlyArray < string > ;
338
338
directoryExists ( dir : string ) : boolean ;
339
339
filePathComparer : Comparer < string > ;
340
+ realpath ( s : string ) : string ;
340
341
}
341
342
342
343
/**
@@ -392,9 +393,12 @@ namespace ts {
392
393
function watchChildDirectories ( parentDir : string , existingChildWatches : ChildWatches , callback : DirectoryWatcherCallback ) : ChildWatches {
393
394
let newChildWatches : DirectoryWatcher [ ] | undefined ;
394
395
enumerateInsertsAndDeletes < string , DirectoryWatcher > (
395
- host . directoryExists ( parentDir ) ? host . getAccessileSortedChildDirectories ( parentDir ) : emptyArray ,
396
+ host . directoryExists ( parentDir ) ? mapDefined ( host . getAccessileSortedChildDirectories ( parentDir ) , child => {
397
+ const childFullName = getNormalizedAbsolutePath ( child , parentDir ) ;
398
+ return host . filePathComparer ( childFullName , host . realpath ( childFullName ) ) === Comparison . EqualTo ? childFullName : undefined ;
399
+ } ) : emptyArray ,
396
400
existingChildWatches ,
397
- ( child , childWatcher ) => host . filePathComparer ( getNormalizedAbsolutePath ( child , parentDir ) , childWatcher . dirName ) ,
401
+ ( child , childWatcher ) => host . filePathComparer ( child , childWatcher . dirName ) ,
398
402
createAndAddChildDirectoryWatcher ,
399
403
closeFileWatcher ,
400
404
addChildDirectoryWatcher
@@ -406,7 +410,7 @@ namespace ts {
406
410
* Create new childDirectoryWatcher and add it to the new ChildDirectoryWatcher list
407
411
*/
408
412
function createAndAddChildDirectoryWatcher ( childName : string ) {
409
- const result = createDirectoryWatcher ( getNormalizedAbsolutePath ( childName , parentDir ) , callback ) ;
413
+ const result = createDirectoryWatcher ( childName , callback ) ;
410
414
addChildDirectoryWatcher ( result ) ;
411
415
}
412
416
@@ -601,14 +605,7 @@ namespace ts {
601
605
exit ( exitCode ?: number ) : void {
602
606
process . exit ( exitCode ) ;
603
607
} ,
604
- realpath ( path : string ) : string {
605
- try {
606
- return _fs . realpathSync ( path ) ;
607
- }
608
- catch {
609
- return path ;
610
- }
611
- } ,
608
+ realpath,
612
609
debugMode : some ( < string [ ] > process . execArgv , arg => / ^ - - ( i n s p e c t | d e b u g ) ( - b r k ) ? ( = \d + ) ? $ / i. test ( arg ) ) ,
613
610
tryEnableSourceMapsForHost ( ) {
614
611
try {
@@ -700,7 +697,8 @@ namespace ts {
700
697
filePathComparer : useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive ,
701
698
directoryExists,
702
699
getAccessileSortedChildDirectories : path => getAccessibleFileSystemEntries ( path ) . directories ,
703
- watchDirectory
700
+ watchDirectory,
701
+ realpath
704
702
} ) ;
705
703
706
704
return ( directoryName , callback , recursive ) => {
@@ -1043,6 +1041,15 @@ namespace ts {
1043
1041
return filter < string > ( _fs . readdirSync ( path ) , dir => fileSystemEntryExists ( combinePaths ( path , dir ) , FileSystemEntryKind . Directory ) ) ;
1044
1042
}
1045
1043
1044
+ function realpath ( path : string ) : string {
1045
+ try {
1046
+ return _fs . realpathSync ( path ) ;
1047
+ }
1048
+ catch {
1049
+ return path ;
1050
+ }
1051
+ }
1052
+
1046
1053
function getModifiedTime ( path : string ) {
1047
1054
try {
1048
1055
return _fs . statSync ( path ) . mtime ;
0 commit comments