@@ -483,11 +483,11 @@ namespace ts {
483
483
function startWatching ( ) {
484
484
const graph = getGlobalDependencyGraph ( ) ;
485
485
for ( const resolved of graph . buildQueue ) {
486
+ // Watch this file
487
+ watchConfigFile ( resolved ) ;
488
+
486
489
const cfg = parseConfigFile ( resolved ) ;
487
490
if ( cfg ) {
488
- // Watch this file
489
- watchConfigFile ( resolved ) ;
490
-
491
491
// Update watchers for wildcard directories
492
492
watchWildCardDirectories ( resolved , cfg ) ;
493
493
@@ -879,7 +879,11 @@ namespace ts {
879
879
// TODO:: handle this in better way later
880
880
881
881
const proj = parseConfigFile ( resolved ) ;
882
- if ( ! proj ) return ; // ?
882
+ if ( ! proj ) {
883
+ reportParseConfigFileDiagnostic ( resolved ) ;
884
+ return ;
885
+ }
886
+
883
887
if ( reloadLevel === ConfigFileProgramReloadLevel . Full ) {
884
888
watchConfigFile ( resolved ) ;
885
889
watchWildCardDirectories ( resolved , proj ) ;
@@ -954,6 +958,11 @@ namespace ts {
954
958
}
955
959
}
956
960
961
+ function reportParseConfigFileDiagnostic ( proj : ResolvedConfigFileName ) {
962
+ host . reportDiagnostic ( configFileCache . getValue ( proj ) as Diagnostic ) ;
963
+ storeErrorSummary ( proj , 1 ) ;
964
+ }
965
+
957
966
function buildSingleProject ( proj : ResolvedConfigFileName ) : BuildResultFlags {
958
967
if ( options . dry ) {
959
968
reportStatus ( Diagnostics . A_non_dry_build_would_build_project_0 , proj ) ;
@@ -969,8 +978,7 @@ namespace ts {
969
978
if ( ! configFile ) {
970
979
// Failed to read the config file
971
980
resultFlags |= BuildResultFlags . ConfigFileErrors ;
972
- host . reportDiagnostic ( configFileCache . getValue ( proj ) as Diagnostic ) ;
973
- storeErrorSummary ( proj , 1 ) ;
981
+ reportParseConfigFileDiagnostic ( proj ) ;
974
982
projectStatus . setValue ( proj , { type : UpToDateStatusType . Unbuildable , reason : "Config file errors" } ) ;
975
983
return resultFlags ;
976
984
}
@@ -995,10 +1003,7 @@ namespace ts {
995
1003
...program . getSyntacticDiagnostics ( ) ] ;
996
1004
if ( syntaxDiagnostics . length ) {
997
1005
resultFlags |= BuildResultFlags . SyntaxErrors ;
998
- for ( const diag of syntaxDiagnostics ) {
999
- host . reportDiagnostic ( diag ) ;
1000
- }
1001
- storeErrors ( proj , syntaxDiagnostics ) ;
1006
+ reportErrors ( proj , syntaxDiagnostics ) ;
1002
1007
projectStatus . setValue ( proj , { type : UpToDateStatusType . Unbuildable , reason : "Syntactic errors" } ) ;
1003
1008
return resultFlags ;
1004
1009
}
@@ -1008,10 +1013,7 @@ namespace ts {
1008
1013
const declDiagnostics = program . getDeclarationDiagnostics ( ) ;
1009
1014
if ( declDiagnostics . length ) {
1010
1015
resultFlags |= BuildResultFlags . DeclarationEmitErrors ;
1011
- for ( const diag of declDiagnostics ) {
1012
- host . reportDiagnostic ( diag ) ;
1013
- }
1014
- storeErrors ( proj , declDiagnostics ) ;
1016
+ reportErrors ( proj , declDiagnostics ) ;
1015
1017
projectStatus . setValue ( proj , { type : UpToDateStatusType . Unbuildable , reason : "Declaration file errors" } ) ;
1016
1018
return resultFlags ;
1017
1019
}
@@ -1021,10 +1023,7 @@ namespace ts {
1021
1023
const semanticDiagnostics = program . getSemanticDiagnostics ( ) ;
1022
1024
if ( semanticDiagnostics . length ) {
1023
1025
resultFlags |= BuildResultFlags . TypeErrors ;
1024
- for ( const diag of semanticDiagnostics ) {
1025
- host . reportDiagnostic ( diag ) ;
1026
- }
1027
- storeErrors ( proj , semanticDiagnostics ) ;
1026
+ reportErrors ( proj , semanticDiagnostics ) ;
1028
1027
projectStatus . setValue ( proj , { type : UpToDateStatusType . Unbuildable , reason : "Semantic errors" } ) ;
1029
1028
return resultFlags ;
1030
1029
}
@@ -1091,6 +1090,7 @@ namespace ts {
1091
1090
const parsed = parseConfigFile ( proj ) ;
1092
1091
if ( parsed === undefined ) {
1093
1092
// File has gone missing; fine to ignore here
1093
+ reportParseConfigFileDiagnostic ( proj ) ;
1094
1094
continue ;
1095
1095
}
1096
1096
const outputs = getAllProjectOutputs ( parsed ) ;
@@ -1133,6 +1133,7 @@ namespace ts {
1133
1133
for ( const next of graph . buildQueue ) {
1134
1134
const proj = parseConfigFile ( next ) ;
1135
1135
if ( proj === undefined ) {
1136
+ reportParseConfigFileDiagnostic ( next ) ;
1136
1137
anyFailed = true ;
1137
1138
break ;
1138
1139
}
@@ -1144,7 +1145,7 @@ namespace ts {
1144
1145
1145
1146
const projName = proj . options . configFilePath ! ;
1146
1147
if ( status . type === UpToDateStatusType . UpToDate && ! options . force ) {
1147
- reportErrors ( errors ) ;
1148
+ reportErrors ( next , errors ) ;
1148
1149
// Up to date, skip
1149
1150
if ( defaultOptions . dry ) {
1150
1151
// In a dry build, inform the user of this fact
@@ -1154,20 +1155,20 @@ namespace ts {
1154
1155
}
1155
1156
1156
1157
if ( status . type === UpToDateStatusType . UpToDateWithUpstreamTypes && ! options . force ) {
1157
- reportErrors ( errors ) ;
1158
+ reportErrors ( next , errors ) ;
1158
1159
// Fake build
1159
1160
updateOutputTimestamps ( proj ) ;
1160
1161
continue ;
1161
1162
}
1162
1163
1163
1164
if ( status . type === UpToDateStatusType . UpstreamBlocked ) {
1164
- reportErrors ( errors ) ;
1165
+ reportErrors ( next , errors ) ;
1165
1166
if ( options . verbose ) reportStatus ( Diagnostics . Skipping_build_of_project_0_because_its_dependency_1_has_errors , projName , status . upstreamProjectName ) ;
1166
1167
continue ;
1167
1168
}
1168
1169
1169
1170
if ( status . type === UpToDateStatusType . ContainerOnly ) {
1170
- reportErrors ( errors ) ;
1171
+ reportErrors ( next , errors ) ;
1171
1172
// Do nothing
1172
1173
continue ;
1173
1174
}
@@ -1179,8 +1180,9 @@ namespace ts {
1179
1180
return anyFailed ? ExitStatus . DiagnosticsPresent_OutputsSkipped : ExitStatus . Success ;
1180
1181
}
1181
1182
1182
- function reportErrors ( errors : Diagnostic [ ] ) {
1183
- errors . forEach ( ( err ) => host . reportDiagnostic ( err ) ) ;
1183
+ function reportErrors ( proj : ResolvedConfigFileName , errors : ReadonlyArray < Diagnostic > ) {
1184
+ errors . forEach ( err => host . reportDiagnostic ( err ) ) ;
1185
+ storeErrors ( proj , errors ) ;
1184
1186
}
1185
1187
1186
1188
/**
0 commit comments