@@ -172,6 +172,8 @@ namespace ts {
172
172
es2018 : ScriptTarget . ES2018 ,
173
173
esnext : ScriptTarget . ESNext ,
174
174
} ) ,
175
+ affectsSourceFile : true ,
176
+ affectsModuleResolution : true ,
175
177
paramType : Diagnostics . VERSION ,
176
178
showInSimplifiedHelpView : true ,
177
179
category : Diagnostics . Basic_Options ,
@@ -190,6 +192,7 @@ namespace ts {
190
192
es2015 : ModuleKind . ES2015 ,
191
193
esnext : ModuleKind . ESNext
192
194
} ) ,
195
+ affectsModuleResolution : true ,
193
196
paramType : Diagnostics . KIND ,
194
197
showInSimplifiedHelpView : true ,
195
198
category : Diagnostics . Basic_Options ,
@@ -202,13 +205,15 @@ namespace ts {
202
205
name : "lib" ,
203
206
type : libMap
204
207
} ,
208
+ affectsModuleResolution : true ,
205
209
showInSimplifiedHelpView : true ,
206
210
category : Diagnostics . Basic_Options ,
207
211
description : Diagnostics . Specify_library_files_to_be_included_in_the_compilation
208
212
} ,
209
213
{
210
214
name : "allowJs" ,
211
215
type : "boolean" ,
216
+ affectsModuleResolution : true ,
212
217
showInSimplifiedHelpView : true ,
213
218
category : Diagnostics . Basic_Options ,
214
219
description : Diagnostics . Allow_javascript_files_to_be_compiled
@@ -226,6 +231,7 @@ namespace ts {
226
231
"react-native" : JsxEmit . ReactNative ,
227
232
"react" : JsxEmit . React
228
233
} ) ,
234
+ affectsSourceFile : true ,
229
235
paramType : Diagnostics . KIND ,
230
236
showInSimplifiedHelpView : true ,
231
237
category : Diagnostics . Basic_Options ,
@@ -336,6 +342,7 @@ namespace ts {
336
342
{
337
343
name : "noImplicitAny" ,
338
344
type : "boolean" ,
345
+ affectsSemanticDiagnostics : true ,
339
346
strictFlag : true ,
340
347
showInSimplifiedHelpView : true ,
341
348
category : Diagnostics . Strict_Type_Checking_Options ,
@@ -344,6 +351,7 @@ namespace ts {
344
351
{
345
352
name : "strictNullChecks" ,
346
353
type : "boolean" ,
354
+ affectsSemanticDiagnostics : true ,
347
355
strictFlag : true ,
348
356
showInSimplifiedHelpView : true ,
349
357
category : Diagnostics . Strict_Type_Checking_Options ,
@@ -352,6 +360,7 @@ namespace ts {
352
360
{
353
361
name : "strictFunctionTypes" ,
354
362
type : "boolean" ,
363
+ affectsSemanticDiagnostics : true ,
355
364
strictFlag : true ,
356
365
showInSimplifiedHelpView : true ,
357
366
category : Diagnostics . Strict_Type_Checking_Options ,
@@ -360,6 +369,7 @@ namespace ts {
360
369
{
361
370
name : "strictPropertyInitialization" ,
362
371
type : "boolean" ,
372
+ affectsSemanticDiagnostics : true ,
363
373
strictFlag : true ,
364
374
showInSimplifiedHelpView : true ,
365
375
category : Diagnostics . Strict_Type_Checking_Options ,
@@ -368,6 +378,7 @@ namespace ts {
368
378
{
369
379
name : "noImplicitThis" ,
370
380
type : "boolean" ,
381
+ affectsSemanticDiagnostics : true ,
371
382
strictFlag : true ,
372
383
showInSimplifiedHelpView : true ,
373
384
category : Diagnostics . Strict_Type_Checking_Options ,
@@ -376,6 +387,7 @@ namespace ts {
376
387
{
377
388
name : "alwaysStrict" ,
378
389
type : "boolean" ,
390
+ affectsSourceFile : true ,
379
391
strictFlag : true ,
380
392
showInSimplifiedHelpView : true ,
381
393
category : Diagnostics . Strict_Type_Checking_Options ,
@@ -410,6 +422,7 @@ namespace ts {
410
422
{
411
423
name : "noFallthroughCasesInSwitch" ,
412
424
type : "boolean" ,
425
+ affectsBindDiagnostics : true ,
413
426
affectsSemanticDiagnostics : true ,
414
427
showInSimplifiedHelpView : true ,
415
428
category : Diagnostics . Additional_Checks ,
@@ -423,13 +436,15 @@ namespace ts {
423
436
node : ModuleResolutionKind . NodeJs ,
424
437
classic : ModuleResolutionKind . Classic ,
425
438
} ) ,
439
+ affectsModuleResolution : true ,
426
440
paramType : Diagnostics . STRATEGY ,
427
441
category : Diagnostics . Module_Resolution_Options ,
428
442
description : Diagnostics . Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6 ,
429
443
} ,
430
444
{
431
445
name : "baseUrl" ,
432
446
type : "string" ,
447
+ affectsModuleResolution : true ,
433
448
isFilePath : true ,
434
449
category : Diagnostics . Module_Resolution_Options ,
435
450
description : Diagnostics . Base_directory_to_resolve_non_absolute_module_names
@@ -439,6 +454,7 @@ namespace ts {
439
454
// use type = object to copy the value as-is
440
455
name : "paths" ,
441
456
type : "object" ,
457
+ affectsModuleResolution : true ,
442
458
isTSConfigOnly : true ,
443
459
category : Diagnostics . Module_Resolution_Options ,
444
460
description : Diagnostics . A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
@@ -454,6 +470,7 @@ namespace ts {
454
470
type : "string" ,
455
471
isFilePath : true
456
472
} ,
473
+ affectsModuleResolution : true ,
457
474
category : Diagnostics . Module_Resolution_Options ,
458
475
description : Diagnostics . List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime
459
476
} ,
@@ -465,6 +482,7 @@ namespace ts {
465
482
type : "string" ,
466
483
isFilePath : true
467
484
} ,
485
+ affectsModuleResolution : true ,
468
486
category : Diagnostics . Module_Resolution_Options ,
469
487
description : Diagnostics . List_of_folders_to_include_type_definitions_from
470
488
} ,
@@ -475,6 +493,7 @@ namespace ts {
475
493
name : "types" ,
476
494
type : "string"
477
495
} ,
496
+ affectsModuleResolution : true ,
478
497
showInSimplifiedHelpView : true ,
479
498
category : Diagnostics . Module_Resolution_Options ,
480
499
description : Diagnostics . Type_declaration_files_to_be_included_in_compilation
@@ -633,12 +652,14 @@ namespace ts {
633
652
{
634
653
name : "noLib" ,
635
654
type : "boolean" ,
655
+ affectsModuleResolution : true ,
636
656
category : Diagnostics . Advanced_Options ,
637
657
description : Diagnostics . Do_not_include_the_default_library_file_lib_d_ts
638
658
} ,
639
659
{
640
660
name : "noResolve" ,
641
661
type : "boolean" ,
662
+ affectsModuleResolution : true ,
642
663
category : Diagnostics . Advanced_Options ,
643
664
description : Diagnostics . Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files
644
665
} ,
@@ -651,6 +672,7 @@ namespace ts {
651
672
{
652
673
name : "disableSizeLimit" ,
653
674
type : "boolean" ,
675
+ affectsSourceFile : true ,
654
676
category : Diagnostics . Advanced_Options ,
655
677
description : Diagnostics . Disable_size_limitations_on_JavaScript_projects
656
678
} ,
@@ -696,13 +718,15 @@ namespace ts {
696
718
{
697
719
name : "allowUnusedLabels" ,
698
720
type : "boolean" ,
721
+ affectsBindDiagnostics : true ,
699
722
affectsSemanticDiagnostics : true ,
700
723
category : Diagnostics . Advanced_Options ,
701
724
description : Diagnostics . Do_not_report_errors_on_unused_labels
702
725
} ,
703
726
{
704
727
name : "allowUnreachableCode" ,
705
728
type : "boolean" ,
729
+ affectsBindDiagnostics : true ,
706
730
affectsSemanticDiagnostics : true ,
707
731
category : Diagnostics . Advanced_Options ,
708
732
description : Diagnostics . Do_not_report_errors_on_unreachable_code
@@ -730,6 +754,7 @@ namespace ts {
730
754
{
731
755
name : "maxNodeModuleJsDepth" ,
732
756
type : "number" ,
757
+ // TODO: GH#27108 affectsModuleResolution: true,
733
758
category : Diagnostics . Advanced_Options ,
734
759
description : Diagnostics . The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files
735
760
} ,
@@ -759,6 +784,18 @@ namespace ts {
759
784
}
760
785
] ;
761
786
787
+ /* @internal */
788
+ export const semanticDiagnosticsOptionDeclarations : ReadonlyArray < CommandLineOption > =
789
+ optionDeclarations . filter ( option => ! ! option . affectsSemanticDiagnostics ) ;
790
+
791
+ /* @internal */
792
+ export const moduleResolutionOptionDeclarations : ReadonlyArray < CommandLineOption > =
793
+ optionDeclarations . filter ( option => ! ! option . affectsModuleResolution ) ;
794
+
795
+ /* @internal */
796
+ export const sourceFileAffectingCompilerOptions : ReadonlyArray < CommandLineOption > = optionDeclarations . filter ( option =>
797
+ ! ! option . affectsSourceFile || ! ! option . affectsModuleResolution || ! ! option . affectsBindDiagnostics ) ;
798
+
762
799
/* @internal */
763
800
export const buildOpts : CommandLineOption [ ] = [
764
801
...commonOptionsWithBuild ,
@@ -1993,7 +2030,7 @@ namespace ts {
1993
2030
if ( ownConfig . extendedConfigPath ) {
1994
2031
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
1995
2032
resolutionStack = resolutionStack . concat ( [ resolvedPath ] ) ;
1996
- const extendedConfig = getExtendedConfig ( sourceFile ! , ownConfig . extendedConfigPath , host , basePath , resolutionStack , errors ) ;
2033
+ const extendedConfig = getExtendedConfig ( sourceFile , ownConfig . extendedConfigPath , host , basePath , resolutionStack , errors ) ;
1997
2034
if ( extendedConfig && isSuccessfulParsedTsconfig ( extendedConfig ) ) {
1998
2035
const baseRaw = extendedConfig . raw ;
1999
2036
const raw = ownConfig . raw ;
@@ -2134,7 +2171,7 @@ namespace ts {
2134
2171
}
2135
2172
2136
2173
function getExtendedConfig (
2137
- sourceFile : TsConfigSourceFile ,
2174
+ sourceFile : TsConfigSourceFile | undefined ,
2138
2175
extendedConfigPath : string ,
2139
2176
host : ParseConfigHost ,
2140
2177
basePath : string ,
@@ -2143,7 +2180,7 @@ namespace ts {
2143
2180
) : ParsedTsconfig | undefined {
2144
2181
const extendedResult = readJsonConfigFile ( extendedConfigPath , path => host . readFile ( path ) ) ;
2145
2182
if ( sourceFile ) {
2146
- ( sourceFile . extendedSourceFiles || ( sourceFile . extendedSourceFiles = [ ] ) ) . push ( extendedResult . fileName ) ;
2183
+ sourceFile . extendedSourceFiles = [ extendedResult . fileName ] ;
2147
2184
}
2148
2185
if ( extendedResult . parseDiagnostics . length ) {
2149
2186
errors . push ( ...extendedResult . parseDiagnostics ) ;
@@ -2153,8 +2190,8 @@ namespace ts {
2153
2190
const extendedDirname = getDirectoryPath ( extendedConfigPath ) ;
2154
2191
const extendedConfig = parseConfig ( /*json*/ undefined , extendedResult , host , extendedDirname ,
2155
2192
getBaseFileName ( extendedConfigPath ) , resolutionStack , errors ) ;
2156
- if ( sourceFile ) {
2157
- sourceFile . extendedSourceFiles ! . push ( ...extendedResult . extendedSourceFiles ! ) ;
2193
+ if ( sourceFile && extendedResult . extendedSourceFiles ) {
2194
+ sourceFile . extendedSourceFiles ! . push ( ...extendedResult . extendedSourceFiles ) ;
2158
2195
}
2159
2196
2160
2197
if ( isSuccessfulParsedTsconfig ( extendedConfig ) ) {
0 commit comments