@@ -126,12 +126,12 @@ namespace ts {
126
126
*/
127
127
export interface UpToDate {
128
128
type : UpToDateStatusType . UpToDate | UpToDateStatusType . UpToDateWithUpstreamTypes ;
129
- newestInputFileTime : Date ;
130
- newestInputFileName : string ;
131
- newestDeclarationFileContentChangedTime : Date ;
132
- newestOutputFileTime : Date ;
133
- newestOutputFileName : string ;
134
- oldestOutputFileName : string ;
129
+ newestInputFileTime ? : Date ;
130
+ newestInputFileName ? : string ;
131
+ newestDeclarationFileContentChangedTime ? : Date ;
132
+ newestOutputFileTime ? : Date ;
133
+ newestOutputFileName ? : string ;
134
+ oldestOutputFileName ? : string ;
135
135
}
136
136
137
137
/**
@@ -801,15 +801,19 @@ namespace ts {
801
801
}
802
802
803
803
let newestDeclarationFileContentChangedTime = minimumDate ;
804
+ let anyDtsChanged = false ;
804
805
program . emit ( /*targetSourceFile*/ undefined , ( fileName , content , writeBom , onError ) => {
805
806
let priorChangeTime : Date | undefined ;
806
807
807
- if ( isDeclarationFile ( fileName ) && compilerHost . fileExists ( fileName ) ) {
808
+ if ( ! anyDtsChanged && isDeclarationFile ( fileName ) && compilerHost . fileExists ( fileName ) ) {
808
809
if ( compilerHost . readFile ( fileName ) === content ) {
809
810
// Check for unchanged .d.ts files
810
811
resultFlags &= ~ BuildResultFlags . DeclarationOutputUnchanged ;
811
812
priorChangeTime = compilerHost . getModifiedTime && compilerHost . getModifiedTime ( fileName ) ;
812
813
}
814
+ else {
815
+ anyDtsChanged = true ;
816
+ }
813
817
}
814
818
815
819
compilerHost . writeFile ( fileName , content , writeBom , onError , emptyArray ) ;
@@ -819,7 +823,11 @@ namespace ts {
819
823
}
820
824
} ) ;
821
825
822
- context . projectStatus . setValue ( proj , { type : UpToDateStatusType . UpToDate , newestDeclarationFileContentChangedTime } as UpToDateStatus ) ;
826
+ const status : UpToDateStatus = {
827
+ type : UpToDateStatusType . UpToDate ,
828
+ newestDeclarationFileContentChangedTime : anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime
829
+ } ;
830
+ context . projectStatus . setValue ( proj , status ) ;
823
831
return resultFlags ;
824
832
}
825
833
@@ -1134,13 +1142,13 @@ namespace ts {
1134
1142
1135
1143
// If the upstream project's newest file is older than our oldest output, we
1136
1144
// can't be out of date because of it
1137
- if ( refStatus . newestInputFileTime <= oldestOutputFileTime ) {
1145
+ if ( refStatus . newestInputFileTime && refStatus . newestInputFileTime <= oldestOutputFileTime ) {
1138
1146
continue ;
1139
1147
}
1140
1148
1141
1149
// If the upstream project has only change .d.ts files, and we've built
1142
1150
// *after* those files, then we're "psuedo up to date" and eligible for a fast rebuild
1143
- if ( refStatus . newestDeclarationFileContentChangedTime <= oldestOutputFileTime ) {
1151
+ if ( refStatus . newestDeclarationFileContentChangedTime && refStatus . newestDeclarationFileContentChangedTime <= oldestOutputFileTime ) {
1144
1152
pseudoUpToDate = true ;
1145
1153
upstreamChangedProject = ref . path ;
1146
1154
continue ;
@@ -1224,8 +1232,8 @@ namespace ts {
1224
1232
if ( status . newestInputFileTime !== undefined ) {
1225
1233
return formatMessage ( Diagnostics . Project_0_is_up_to_date_because_newest_input_1_is_older_than_oldest_output_2 ,
1226
1234
relName ( configFileName ) ,
1227
- relName ( status . newestInputFileName ) ,
1228
- relName ( status . oldestOutputFileName ) ) ;
1235
+ relName ( status . newestInputFileName || "" ) ,
1236
+ relName ( status . oldestOutputFileName || "" ) ) ;
1229
1237
}
1230
1238
// Don't report anything for "up to date because it was already built" -- too verbose
1231
1239
break ;
0 commit comments