@@ -968,7 +968,7 @@ namespace ts {
968
968
reportDeclarationDiagnostics ,
969
969
/*write*/ undefined ,
970
970
/*reportSummary*/ undefined ,
971
- ( name , text , writeByteOrderMark , _onError , _sourceFiles , data ) => outputFiles . push ( { name, text, writeByteOrderMark, buildInfo : data ?. buildInfo } ) ,
971
+ ( name , text , writeByteOrderMark , _onError , _sourceFiles , data ) => outputFiles . push ( { name, text, writeByteOrderMark, data } ) ,
972
972
cancellationToken ,
973
973
/*emitOnlyDts*/ false ,
974
974
customTransformers || state . host . getCustomTransformers ?.( project )
@@ -1000,12 +1000,15 @@ namespace ts {
1000
1000
const isIncremental = isIncrementalCompilation ( options ) ;
1001
1001
let outputTimeStampMap : ESMap < Path , Date > | undefined ;
1002
1002
let now : Date | undefined ;
1003
- outputFiles . forEach ( ( { name, text, writeByteOrderMark, buildInfo } ) => {
1003
+ outputFiles . forEach ( ( { name, text, writeByteOrderMark, data } ) => {
1004
1004
const path = toPath ( state , name ) ;
1005
1005
emittedOutputs . set ( toPath ( state , name ) , name ) ;
1006
- if ( buildInfo ) setBuildInfo ( state , buildInfo , projectPath , options , resultFlags ) ;
1006
+ if ( data ?. buildInfo ) setBuildInfo ( state , data . buildInfo , projectPath , options , resultFlags ) ;
1007
+ const modifiedTime = data ?. differsOnlyInMap ? ts . getModifiedTime ( state . host , name ) : undefined ;
1007
1008
writeFile ( writeFileCallback ? { writeFile : writeFileCallback } : compilerHost , emitterDiagnostics , name , text , writeByteOrderMark ) ;
1008
- if ( ! isIncremental && state . watch ) {
1009
+ // Revert the timestamp for the d.ts that is same
1010
+ if ( data ?. differsOnlyInMap ) state . host . setModifiedTime ( name , modifiedTime ! ) ;
1011
+ else if ( ! isIncremental && state . watch ) {
1009
1012
( outputTimeStampMap ||= getOutputTimeStampMap ( state , projectPath ) ! ) . set ( path , now ||= getCurrentTime ( state . host ) ) ;
1010
1013
}
1011
1014
} ) ;
@@ -1122,13 +1125,13 @@ namespace ts {
1122
1125
const emittedOutputs = new Map < Path , string > ( ) ;
1123
1126
let resultFlags = BuildResultFlags . DeclarationOutputUnchanged ;
1124
1127
const existingBuildInfo = state . buildInfoCache . get ( projectPath ) ! . buildInfo || undefined ;
1125
- outputFiles . forEach ( ( { name, text, writeByteOrderMark, buildInfo } ) => {
1128
+ outputFiles . forEach ( ( { name, text, writeByteOrderMark, data } ) => {
1126
1129
emittedOutputs . set ( toPath ( state , name ) , name ) ;
1127
- if ( buildInfo ) {
1128
- if ( ( buildInfo . program as ProgramBundleEmitBuildInfo ) ?. outSignature !== ( existingBuildInfo ?. program as ProgramBundleEmitBuildInfo ) ?. outSignature ) {
1130
+ if ( data ?. buildInfo ) {
1131
+ if ( ( data . buildInfo . program as ProgramBundleEmitBuildInfo ) ?. outSignature !== ( existingBuildInfo ?. program as ProgramBundleEmitBuildInfo ) ?. outSignature ) {
1129
1132
resultFlags &= ~ BuildResultFlags . DeclarationOutputUnchanged ;
1130
1133
}
1131
- setBuildInfo ( state , buildInfo , projectPath , config . options , resultFlags ) ;
1134
+ setBuildInfo ( state , data . buildInfo , projectPath , config . options , resultFlags ) ;
1132
1135
}
1133
1136
writeFile ( writeFileCallback ? { writeFile : writeFileCallback } : compilerHost , emitterDiagnostics , name , text , writeByteOrderMark ) ;
1134
1137
} ) ;
@@ -1629,6 +1632,13 @@ namespace ts {
1629
1632
buildInfoFile : buildInfoPath
1630
1633
} ;
1631
1634
}
1635
+
1636
+ if ( ! project . options . noEmit && getPendingEmitKind ( project . options , buildInfo . program . options || { } ) ) {
1637
+ return {
1638
+ type : UpToDateStatusType . OutOfDateOptions ,
1639
+ buildInfoFile : buildInfoPath
1640
+ } ;
1641
+ }
1632
1642
buildInfoProgram = buildInfo . program ;
1633
1643
}
1634
1644
@@ -2397,6 +2407,13 @@ namespace ts {
2397
2407
relName ( state , configFileName ) ,
2398
2408
relName ( state , status . buildInfoFile )
2399
2409
) ;
2410
+ case UpToDateStatusType . OutOfDateOptions :
2411
+ return reportStatus (
2412
+ state ,
2413
+ Diagnostics . Project_0_is_out_of_date_because_buildinfo_file_1_indicates_there_is_change_in_compilerOptions ,
2414
+ relName ( state , configFileName ) ,
2415
+ relName ( state , status . buildInfoFile )
2416
+ ) ;
2400
2417
case UpToDateStatusType . UpToDate :
2401
2418
if ( status . newestInputFileTime !== undefined ) {
2402
2419
return reportStatus (
0 commit comments