@@ -445,7 +445,11 @@ namespace ts {
445
445
446
446
// All resolutions are invalid if user provided resolutions
447
447
const hasInvalidatedResolution = resolutionCache . createHasInvalidatedResolution ( userProvidedResolution ) ;
448
- if ( isProgramUptoDate ( getCurrentProgram ( ) , rootFileNames , compilerOptions , getSourceVersion , fileExists , hasInvalidatedResolution , hasChangedAutomaticTypeDirectiveNames , getParsedCommandLine , projectReferences ) ) {
448
+ const {
449
+ originalReadFile, originalFileExists, originalDirectoryExists,
450
+ originalCreateDirectory, originalWriteFile,
451
+ } = changeCompilerHostLikeToUseCache ( compilerHost , toPath ) ;
452
+ if ( isProgramUptoDate ( getCurrentProgram ( ) , rootFileNames , compilerOptions , getSourceVersion , fileName => compilerHost . fileExists ( fileName ) , hasInvalidatedResolution , hasChangedAutomaticTypeDirectiveNames , getParsedCommandLine , projectReferences ) ) {
449
453
if ( hasChangedConfigFileParsingErrors ) {
450
454
if ( reportFileChangeDetectedOnCreateProgram ) {
451
455
reportWatchDiagnostic ( Diagnostics . File_change_detected_Starting_incremental_compilation ) ;
@@ -462,11 +466,16 @@ namespace ts {
462
466
}
463
467
464
468
reportFileChangeDetectedOnCreateProgram = false ;
465
-
466
469
if ( host . afterProgramCreate && program !== builderProgram ) {
467
470
host . afterProgramCreate ( builderProgram ) ;
468
471
}
469
472
473
+ compilerHost . readFile = originalReadFile ;
474
+ compilerHost . fileExists = originalFileExists ;
475
+ compilerHost . directoryExists = originalDirectoryExists ;
476
+ compilerHost . createDirectory = originalCreateDirectory ;
477
+ compilerHost . writeFile = originalWriteFile ! ;
478
+
470
479
return builderProgram ;
471
480
}
472
481
0 commit comments