typescript 5.6.0-dev.20240613 → 5.6.0-dev.20240615
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +470 -624
- package/lib/tsserver.js +0 -12
- package/lib/typescript.d.ts +55 -112
- package/lib/typescript.js +1022 -879
- package/package.json +2 -4
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240615`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -2548,16 +2548,6 @@ function tryGetNativePerformanceHooks() {
|
|
|
2548
2548
|
}
|
|
2549
2549
|
var timestamp = nativePerformanceTime ? () => nativePerformanceTime.now() : Date.now;
|
|
2550
2550
|
|
|
2551
|
-
// src/compiler/perfLogger.ts
|
|
2552
|
-
var etwModule;
|
|
2553
|
-
try {
|
|
2554
|
-
const etwModulePath = process.env.TS_ETW_MODULE_PATH ?? "./node_modules/@microsoft/typescript-etw";
|
|
2555
|
-
etwModule = require(etwModulePath);
|
|
2556
|
-
} catch (e) {
|
|
2557
|
-
etwModule = void 0;
|
|
2558
|
-
}
|
|
2559
|
-
var perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : void 0;
|
|
2560
|
-
|
|
2561
2551
|
// src/compiler/performance.ts
|
|
2562
2552
|
var perfHooks;
|
|
2563
2553
|
var performanceImpl;
|
|
@@ -3564,6 +3554,7 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => {
|
|
|
3564
3554
|
NodeCheckFlags3[NodeCheckFlags3["ContainsClassWithPrivateIdentifiers"] = 1048576] = "ContainsClassWithPrivateIdentifiers";
|
|
3565
3555
|
NodeCheckFlags3[NodeCheckFlags3["ContainsSuperPropertyInStaticInitializer"] = 2097152] = "ContainsSuperPropertyInStaticInitializer";
|
|
3566
3556
|
NodeCheckFlags3[NodeCheckFlags3["InCheckIdentifier"] = 4194304] = "InCheckIdentifier";
|
|
3557
|
+
NodeCheckFlags3[NodeCheckFlags3["PartiallyTypeChecked"] = 8388608] = "PartiallyTypeChecked";
|
|
3567
3558
|
NodeCheckFlags3[NodeCheckFlags3["LazyFlags"] = 539358128] = "LazyFlags";
|
|
3568
3559
|
return NodeCheckFlags3;
|
|
3569
3560
|
})(NodeCheckFlags || {});
|
|
@@ -5108,7 +5099,7 @@ var sys = (() => {
|
|
|
5108
5099
|
callback
|
|
5109
5100
|
);
|
|
5110
5101
|
}
|
|
5111
|
-
function
|
|
5102
|
+
function readFile(fileName, _encoding) {
|
|
5112
5103
|
let buffer;
|
|
5113
5104
|
try {
|
|
5114
5105
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -5133,16 +5124,7 @@ var sys = (() => {
|
|
|
5133
5124
|
}
|
|
5134
5125
|
return buffer.toString("utf8");
|
|
5135
5126
|
}
|
|
5136
|
-
function readFile(fileName, _encoding) {
|
|
5137
|
-
var _a, _b;
|
|
5138
|
-
(_a = perfLogger) == null ? void 0 : _a.logStartReadFile(fileName);
|
|
5139
|
-
const file = readFileWorker(fileName, _encoding);
|
|
5140
|
-
(_b = perfLogger) == null ? void 0 : _b.logStopReadFile();
|
|
5141
|
-
return file;
|
|
5142
|
-
}
|
|
5143
5127
|
function writeFile2(fileName, data, writeByteOrderMark) {
|
|
5144
|
-
var _a;
|
|
5145
|
-
(_a = perfLogger) == null ? void 0 : _a.logEvent("WriteFile: " + fileName);
|
|
5146
5128
|
if (writeByteOrderMark) {
|
|
5147
5129
|
data = byteOrderMarkIndicator + data;
|
|
5148
5130
|
}
|
|
@@ -5163,8 +5145,6 @@ var sys = (() => {
|
|
|
5163
5145
|
}
|
|
5164
5146
|
}
|
|
5165
5147
|
function getAccessibleFileSystemEntries(path) {
|
|
5166
|
-
var _a;
|
|
5167
|
-
(_a = perfLogger) == null ? void 0 : _a.logEvent("ReadDir: " + (path || "."));
|
|
5168
5148
|
try {
|
|
5169
5149
|
const entries = _fs.readdirSync(path || ".", { withFileTypes: true });
|
|
5170
5150
|
const files = [];
|
|
@@ -5923,7 +5903,6 @@ var Diagnostics = {
|
|
|
5923
5903
|
_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
5924
5904
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
|
|
5925
5905
|
_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
|
|
5926
|
-
ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
|
|
5927
5906
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5928
5907
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5929
5908
|
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
@@ -6812,7 +6791,6 @@ var Diagnostics = {
|
|
|
6812
6791
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
6813
6792
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
6814
6793
|
Cannot_read_file_0_Colon_1: diag(5012, 1 /* Error */, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."),
|
|
6815
|
-
Failed_to_parse_file_0_Colon_1: diag(5014, 1 /* Error */, "Failed_to_parse_file_0_Colon_1_5014", "Failed to parse file '{0}': {1}."),
|
|
6816
6794
|
Unknown_compiler_option_0: diag(5023, 1 /* Error */, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."),
|
|
6817
6795
|
Compiler_option_0_requires_a_value_of_type_1: diag(5024, 1 /* Error */, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."),
|
|
6818
6796
|
Unknown_compiler_option_0_Did_you_mean_1: diag(5025, 1 /* Error */, "Unknown_compiler_option_0_Did_you_mean_1_5025", "Unknown compiler option '{0}'. Did you mean '{1}'?"),
|
|
@@ -7184,8 +7162,6 @@ var Diagnostics = {
|
|
|
7184
7162
|
Building_project_0: diag(6358, 3 /* Message */, "Building_project_0_6358", "Building project '{0}'..."),
|
|
7185
7163
|
Updating_output_timestamps_of_project_0: diag(6359, 3 /* Message */, "Updating_output_timestamps_of_project_0_6359", "Updating output timestamps of project '{0}'..."),
|
|
7186
7164
|
Project_0_is_up_to_date: diag(6361, 3 /* Message */, "Project_0_is_up_to_date_6361", "Project '{0}' is up to date"),
|
|
7187
|
-
Skipping_build_of_project_0_because_its_dependency_1_has_errors: diag(6362, 3 /* Message */, "Skipping_build_of_project_0_because_its_dependency_1_has_errors_6362", "Skipping build of project '{0}' because its dependency '{1}' has errors"),
|
|
7188
|
-
Project_0_can_t_be_built_because_its_dependency_1_has_errors: diag(6363, 3 /* Message */, "Project_0_can_t_be_built_because_its_dependency_1_has_errors_6363", "Project '{0}' can't be built because its dependency '{1}' has errors"),
|
|
7189
7165
|
Build_one_or_more_projects_and_their_dependencies_if_out_of_date: diag(6364, 3 /* Message */, "Build_one_or_more_projects_and_their_dependencies_if_out_of_date_6364", "Build one or more projects and their dependencies, if out of date"),
|
|
7190
7166
|
Delete_the_outputs_of_all_projects: diag(6365, 3 /* Message */, "Delete_the_outputs_of_all_projects_6365", "Delete the outputs of all projects."),
|
|
7191
7167
|
Show_what_would_be_built_or_deleted_if_specified_with_clean: diag(6367, 3 /* Message */, "Show_what_would_be_built_or_deleted_if_specified_with_clean_6367", "Show what would be built (or deleted, if specified with '--clean')"),
|
|
@@ -7197,8 +7173,6 @@ var Diagnostics = {
|
|
|
7197
7173
|
Composite_projects_may_not_disable_incremental_compilation: diag(6379, 1 /* Error */, "Composite_projects_may_not_disable_incremental_compilation_6379", "Composite projects may not disable incremental compilation."),
|
|
7198
7174
|
Specify_file_to_store_incremental_compilation_information: diag(6380, 3 /* Message */, "Specify_file_to_store_incremental_compilation_information_6380", "Specify file to store incremental compilation information"),
|
|
7199
7175
|
Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2: diag(6381, 3 /* Message */, "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381", "Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'"),
|
|
7200
|
-
Skipping_build_of_project_0_because_its_dependency_1_was_not_built: diag(6382, 3 /* Message */, "Skipping_build_of_project_0_because_its_dependency_1_was_not_built_6382", "Skipping build of project '{0}' because its dependency '{1}' was not built"),
|
|
7201
|
-
Project_0_can_t_be_built_because_its_dependency_1_was_not_built: diag(6383, 3 /* Message */, "Project_0_can_t_be_built_because_its_dependency_1_was_not_built_6383", "Project '{0}' can't be built because its dependency '{1}' was not built"),
|
|
7202
7176
|
Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_directly_depending_on_it: diag(6384, 3 /* Message */, "Have_recompiles_in_incremental_and_watch_assume_that_changes_within_a_file_will_only_affect_files_di_6384", "Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it."),
|
|
7203
7177
|
_0_is_deprecated: diag(
|
|
7204
7178
|
6385,
|
|
@@ -7256,6 +7230,8 @@ var Diagnostics = {
|
|
|
7256
7230
|
Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
|
|
7257
7231
|
Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0: diag(6417, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_preferred_extensions_Colon_0_6417", "Searching all ancestor node_modules directories for preferred extensions: {0}."),
|
|
7258
7232
|
Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
|
|
7233
|
+
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
|
|
7234
|
+
Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
|
|
7259
7235
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
7260
7236
|
The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
7261
7237
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -11103,8 +11079,8 @@ function textSpanIsEmpty(span) {
|
|
|
11103
11079
|
function textSpanContainsPosition(span, position) {
|
|
11104
11080
|
return position >= span.start && position < textSpanEnd(span);
|
|
11105
11081
|
}
|
|
11106
|
-
function textRangeContainsPositionInclusive(
|
|
11107
|
-
return position >=
|
|
11082
|
+
function textRangeContainsPositionInclusive(range, position) {
|
|
11083
|
+
return position >= range.pos && position <= range.end;
|
|
11108
11084
|
}
|
|
11109
11085
|
function createTextSpan(start, length2) {
|
|
11110
11086
|
if (start < 0) {
|
|
@@ -14755,23 +14731,6 @@ function isFunctionSymbol(symbol) {
|
|
|
14755
14731
|
const decl = symbol.valueDeclaration;
|
|
14756
14732
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
14757
14733
|
}
|
|
14758
|
-
function canHaveModuleSpecifier(node) {
|
|
14759
|
-
switch (node == null ? void 0 : node.kind) {
|
|
14760
|
-
case 260 /* VariableDeclaration */:
|
|
14761
|
-
case 208 /* BindingElement */:
|
|
14762
|
-
case 272 /* ImportDeclaration */:
|
|
14763
|
-
case 278 /* ExportDeclaration */:
|
|
14764
|
-
case 271 /* ImportEqualsDeclaration */:
|
|
14765
|
-
case 273 /* ImportClause */:
|
|
14766
|
-
case 280 /* NamespaceExport */:
|
|
14767
|
-
case 274 /* NamespaceImport */:
|
|
14768
|
-
case 281 /* ExportSpecifier */:
|
|
14769
|
-
case 276 /* ImportSpecifier */:
|
|
14770
|
-
case 205 /* ImportType */:
|
|
14771
|
-
return true;
|
|
14772
|
-
}
|
|
14773
|
-
return false;
|
|
14774
|
-
}
|
|
14775
14734
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
14776
14735
|
var _a, _b;
|
|
14777
14736
|
switch (node.kind) {
|
|
@@ -17489,8 +17448,8 @@ function walkTreeForJSXTags(node) {
|
|
|
17489
17448
|
function isFileModuleFromUsingJSXTag(file) {
|
|
17490
17449
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
17491
17450
|
}
|
|
17492
|
-
function isFileForcedToBeModuleByFormat(file
|
|
17493
|
-
return (
|
|
17451
|
+
function isFileForcedToBeModuleByFormat(file) {
|
|
17452
|
+
return (file.impliedNodeFormat === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
|
|
17494
17453
|
}
|
|
17495
17454
|
function getSetExternalModuleIndicator(options) {
|
|
17496
17455
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -17509,14 +17468,10 @@ function getSetExternalModuleIndicator(options) {
|
|
|
17509
17468
|
}
|
|
17510
17469
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
17511
17470
|
const combined = or(...checks);
|
|
17512
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file
|
|
17471
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
17513
17472
|
return callback;
|
|
17514
17473
|
}
|
|
17515
17474
|
}
|
|
17516
|
-
function importSyntaxAffectsModuleResolution(options) {
|
|
17517
|
-
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
17518
|
-
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
17519
|
-
}
|
|
17520
17475
|
function createComputedCompilerOptions(options) {
|
|
17521
17476
|
return options;
|
|
17522
17477
|
}
|
|
@@ -18337,7 +18292,25 @@ function rangeOfTypeParameters(sourceFile, typeParameters) {
|
|
|
18337
18292
|
return { pos, end };
|
|
18338
18293
|
}
|
|
18339
18294
|
function skipTypeChecking(sourceFile, options, host) {
|
|
18340
|
-
return
|
|
18295
|
+
return skipTypeCheckingWorker(
|
|
18296
|
+
sourceFile,
|
|
18297
|
+
options,
|
|
18298
|
+
host,
|
|
18299
|
+
/*ignoreNoCheck*/
|
|
18300
|
+
false
|
|
18301
|
+
);
|
|
18302
|
+
}
|
|
18303
|
+
function skipTypeCheckingIgnoringNoCheck(sourceFile, options, host) {
|
|
18304
|
+
return skipTypeCheckingWorker(
|
|
18305
|
+
sourceFile,
|
|
18306
|
+
options,
|
|
18307
|
+
host,
|
|
18308
|
+
/*ignoreNoCheck*/
|
|
18309
|
+
true
|
|
18310
|
+
);
|
|
18311
|
+
}
|
|
18312
|
+
function skipTypeCheckingWorker(sourceFile, options, host, ignoreNoCheck) {
|
|
18313
|
+
return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || !ignoreNoCheck && options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnostics(sourceFile, options);
|
|
18341
18314
|
}
|
|
18342
18315
|
function canIncludeBindAndCheckDiagnostics(sourceFile, options) {
|
|
18343
18316
|
if (!!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false) return false;
|
|
@@ -26679,7 +26652,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
26679
26652
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
26680
26653
|
let namedBindings;
|
|
26681
26654
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
26682
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ ||
|
|
26655
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
26683
26656
|
const helpers = getEmitHelpers(sourceFile);
|
|
26684
26657
|
if (helpers) {
|
|
26685
26658
|
const helperNames = [];
|
|
@@ -26744,7 +26717,8 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
26744
26717
|
if (externalHelpersModuleName) {
|
|
26745
26718
|
return externalHelpersModuleName;
|
|
26746
26719
|
}
|
|
26747
|
-
|
|
26720
|
+
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
26721
|
+
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
|
|
26748
26722
|
if (!create) {
|
|
26749
26723
|
const helpers = getEmitHelpers(node);
|
|
26750
26724
|
if (helpers) {
|
|
@@ -27918,7 +27892,7 @@ function setExternalModuleIndicator(sourceFile) {
|
|
|
27918
27892
|
sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
|
|
27919
27893
|
}
|
|
27920
27894
|
function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
|
|
27921
|
-
var _a, _b
|
|
27895
|
+
var _a, _b;
|
|
27922
27896
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
27923
27897
|
tracing.Phase.Parse,
|
|
27924
27898
|
"createSourceFile",
|
|
@@ -27928,7 +27902,6 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
27928
27902
|
);
|
|
27929
27903
|
mark("beforeParse");
|
|
27930
27904
|
let result;
|
|
27931
|
-
(_b = perfLogger) == null ? void 0 : _b.logStartParseSourceFile(fileName);
|
|
27932
27905
|
const {
|
|
27933
27906
|
languageVersion,
|
|
27934
27907
|
setExternalModuleIndicator: overrideSetExternalModuleIndicator,
|
|
@@ -27964,10 +27937,9 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
27964
27937
|
jsDocParsingMode
|
|
27965
27938
|
);
|
|
27966
27939
|
}
|
|
27967
|
-
(_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
|
|
27968
27940
|
mark("afterParse");
|
|
27969
27941
|
measure("Parse", "beforeParse", "afterParse");
|
|
27970
|
-
(
|
|
27942
|
+
(_b = tracing) == null ? void 0 : _b.pop();
|
|
27971
27943
|
return result;
|
|
27972
27944
|
}
|
|
27973
27945
|
function parseIsolatedEntityName(text, languageVersion) {
|
|
@@ -35731,6 +35703,25 @@ var commonOptionsWithBuild = [
|
|
|
35731
35703
|
description: Diagnostics.Include_sourcemap_files_inside_the_emitted_JavaScript,
|
|
35732
35704
|
defaultValueDescription: false
|
|
35733
35705
|
},
|
|
35706
|
+
{
|
|
35707
|
+
name: "noCheck",
|
|
35708
|
+
type: "boolean",
|
|
35709
|
+
showInSimplifiedHelpView: false,
|
|
35710
|
+
category: Diagnostics.Compiler_Diagnostics,
|
|
35711
|
+
description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
|
|
35712
|
+
transpileOptionValue: true,
|
|
35713
|
+
defaultValueDescription: false
|
|
35714
|
+
// Not setting affectsSemanticDiagnostics or affectsBuildInfo because we dont want all diagnostics to go away, its handled in builder
|
|
35715
|
+
},
|
|
35716
|
+
{
|
|
35717
|
+
name: "noEmit",
|
|
35718
|
+
type: "boolean",
|
|
35719
|
+
showInSimplifiedHelpView: true,
|
|
35720
|
+
category: Diagnostics.Emit,
|
|
35721
|
+
description: Diagnostics.Disable_emitting_files_from_a_compilation,
|
|
35722
|
+
transpileOptionValue: void 0,
|
|
35723
|
+
defaultValueDescription: false
|
|
35724
|
+
},
|
|
35734
35725
|
{
|
|
35735
35726
|
name: "assumeChangesOnlyAffectDirectDependencies",
|
|
35736
35727
|
type: "boolean",
|
|
@@ -35995,29 +35986,6 @@ var commandOptionsWithoutBuild = [
|
|
|
35995
35986
|
defaultValueDescription: false,
|
|
35996
35987
|
description: Diagnostics.Disable_emitting_comments
|
|
35997
35988
|
},
|
|
35998
|
-
{
|
|
35999
|
-
name: "noCheck",
|
|
36000
|
-
type: "boolean",
|
|
36001
|
-
showInSimplifiedHelpView: false,
|
|
36002
|
-
category: Diagnostics.Compiler_Diagnostics,
|
|
36003
|
-
description: Diagnostics.Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported,
|
|
36004
|
-
transpileOptionValue: true,
|
|
36005
|
-
defaultValueDescription: false,
|
|
36006
|
-
affectsSemanticDiagnostics: true,
|
|
36007
|
-
affectsBuildInfo: true,
|
|
36008
|
-
extraValidation() {
|
|
36009
|
-
return [Diagnostics.Unknown_compiler_option_0, "noCheck"];
|
|
36010
|
-
}
|
|
36011
|
-
},
|
|
36012
|
-
{
|
|
36013
|
-
name: "noEmit",
|
|
36014
|
-
type: "boolean",
|
|
36015
|
-
showInSimplifiedHelpView: true,
|
|
36016
|
-
category: Diagnostics.Emit,
|
|
36017
|
-
description: Diagnostics.Disable_emitting_files_from_a_compilation,
|
|
36018
|
-
transpileOptionValue: void 0,
|
|
36019
|
-
defaultValueDescription: false
|
|
36020
|
-
},
|
|
36021
35989
|
{
|
|
36022
35990
|
name: "importHelpers",
|
|
36023
35991
|
type: "boolean",
|
|
@@ -39452,7 +39420,6 @@ function resolveLibrary(libraryName, resolveFrom, compilerOptions, host, cache)
|
|
|
39452
39420
|
return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host, cache);
|
|
39453
39421
|
}
|
|
39454
39422
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
39455
|
-
var _a, _b, _c;
|
|
39456
39423
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
39457
39424
|
if (redirectedReference) {
|
|
39458
39425
|
compilerOptions = redirectedReference.commandLine.options;
|
|
@@ -39481,7 +39448,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
39481
39448
|
trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]);
|
|
39482
39449
|
}
|
|
39483
39450
|
}
|
|
39484
|
-
(_a = perfLogger) == null ? void 0 : _a.logStartResolveModule(moduleName);
|
|
39485
39451
|
switch (moduleResolution) {
|
|
39486
39452
|
case 3 /* Node16 */:
|
|
39487
39453
|
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -39501,8 +39467,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
39501
39467
|
default:
|
|
39502
39468
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
39503
39469
|
}
|
|
39504
|
-
if (result && result.resolvedModule) (_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
|
|
39505
|
-
(_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
|
|
39506
39470
|
if (cache && !cache.isReadonly) {
|
|
39507
39471
|
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
39508
39472
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
@@ -41205,11 +41169,8 @@ function createFlowNode(flags, node, antecedent) {
|
|
|
41205
41169
|
}
|
|
41206
41170
|
var binder = /* @__PURE__ */ createBinder();
|
|
41207
41171
|
function bindSourceFile(file, options) {
|
|
41208
|
-
var _a, _b;
|
|
41209
41172
|
mark("beforeBind");
|
|
41210
|
-
(_a = perfLogger) == null ? void 0 : _a.logStartBindFile("" + file.fileName);
|
|
41211
41173
|
binder(file, options);
|
|
41212
|
-
(_b = perfLogger) == null ? void 0 : _b.logStopBindFile();
|
|
41213
41174
|
mark("afterBind");
|
|
41214
41175
|
measure("Bind", "beforeBind", "afterBind");
|
|
41215
41176
|
}
|
|
@@ -44177,15 +44138,13 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
44177
44138
|
}
|
|
44178
44139
|
|
|
44179
44140
|
// src/compiler/moduleSpecifiers.ts
|
|
44180
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding },
|
|
44141
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44181
44142
|
const filePreferredEnding = getPreferredEnding();
|
|
44182
44143
|
return {
|
|
44183
44144
|
relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
|
|
44184
44145
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
44185
|
-
const
|
|
44186
|
-
|
|
44187
|
-
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
44188
|
-
if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
44146
|
+
const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
44147
|
+
if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
|
|
44189
44148
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
44190
44149
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
44191
44150
|
}
|
|
@@ -44216,7 +44175,7 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
44216
44175
|
}
|
|
44217
44176
|
return getModuleSpecifierEndingPreference(
|
|
44218
44177
|
importModuleSpecifierEnding,
|
|
44219
|
-
resolutionMode ??
|
|
44178
|
+
resolutionMode ?? importingSourceFile.impliedNodeFormat,
|
|
44220
44179
|
compilerOptions,
|
|
44221
44180
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
44222
44181
|
);
|
|
@@ -44274,16 +44233,12 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
44274
44233
|
}
|
|
44275
44234
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
44276
44235
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
44277
|
-
const preferences = getModuleSpecifierPreferences(userPreferences,
|
|
44236
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
44278
44237
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
44279
44238
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
44280
44239
|
(reason) => {
|
|
44281
44240
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path) return void 0;
|
|
44282
|
-
|
|
44283
|
-
const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
|
|
44284
|
-
if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
|
|
44285
|
-
return void 0;
|
|
44286
|
-
}
|
|
44241
|
+
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions)) return void 0;
|
|
44287
44242
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
44288
44243
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
44289
44244
|
}
|
|
@@ -44798,7 +44753,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
44798
44753
|
if (!parts) {
|
|
44799
44754
|
return void 0;
|
|
44800
44755
|
}
|
|
44801
|
-
const preferences = getModuleSpecifierPreferences(userPreferences,
|
|
44756
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
44802
44757
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
44803
44758
|
let moduleSpecifier = path;
|
|
44804
44759
|
let isPackageRootPath = false;
|
|
@@ -44848,7 +44803,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
44848
44803
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
44849
44804
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
44850
44805
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
44851
|
-
const importMode = overrideMode ||
|
|
44806
|
+
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
44852
44807
|
if (getResolvePackageJsonExports(options)) {
|
|
44853
44808
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
44854
44809
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -44998,9 +44953,6 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
44998
44953
|
function isPathRelativeToParent(path) {
|
|
44999
44954
|
return startsWith(path, "..");
|
|
45000
44955
|
}
|
|
45001
|
-
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
45002
|
-
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
45003
|
-
}
|
|
45004
44956
|
|
|
45005
44957
|
// src/compiler/checker.ts
|
|
45006
44958
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -47223,28 +47175,22 @@ function createTypeChecker(host) {
|
|
|
47223
47175
|
function isSyntacticDefault(node) {
|
|
47224
47176
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
47225
47177
|
}
|
|
47226
|
-
function
|
|
47227
|
-
return isStringLiteralLike(usage) ? host.
|
|
47178
|
+
function getUsageModeForExpression(usage) {
|
|
47179
|
+
return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
47228
47180
|
}
|
|
47229
47181
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
47230
47182
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
47231
47183
|
}
|
|
47232
|
-
function
|
|
47233
|
-
|
|
47234
|
-
|
|
47235
|
-
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
47236
|
-
}
|
|
47237
|
-
return false;
|
|
47184
|
+
function isOnlyImportedAsDefault(usage) {
|
|
47185
|
+
const usageMode = getUsageModeForExpression(usage);
|
|
47186
|
+
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
47238
47187
|
}
|
|
47239
47188
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
47240
|
-
const usageMode = file &&
|
|
47241
|
-
if (file && usageMode !== void 0) {
|
|
47242
|
-
const
|
|
47243
|
-
if (usageMode === 99 /* ESNext */
|
|
47244
|
-
return
|
|
47245
|
-
}
|
|
47246
|
-
if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) {
|
|
47247
|
-
return false;
|
|
47189
|
+
const usageMode = file && getUsageModeForExpression(usage);
|
|
47190
|
+
if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
47191
|
+
const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
47192
|
+
if (usageMode === 99 /* ESNext */ || result) {
|
|
47193
|
+
return result;
|
|
47248
47194
|
}
|
|
47249
47195
|
}
|
|
47250
47196
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -47303,7 +47249,7 @@ function createTypeChecker(host) {
|
|
|
47303
47249
|
if (!specifier) {
|
|
47304
47250
|
return exportDefaultSymbol;
|
|
47305
47251
|
}
|
|
47306
|
-
const hasDefaultOnly =
|
|
47252
|
+
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
47307
47253
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
47308
47254
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
47309
47255
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -47505,7 +47451,7 @@ function createTypeChecker(host) {
|
|
|
47505
47451
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
47506
47452
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
47507
47453
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
47508
|
-
if (
|
|
47454
|
+
if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
47509
47455
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
47510
47456
|
}
|
|
47511
47457
|
}
|
|
@@ -48109,7 +48055,7 @@ function createTypeChecker(host) {
|
|
|
48109
48055
|
/*requireStringLiteralLikeArgument*/
|
|
48110
48056
|
true
|
|
48111
48057
|
) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
|
|
48112
|
-
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) :
|
|
48058
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48113
48059
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48114
48060
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
48115
48061
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -48353,7 +48299,7 @@ function createTypeChecker(host) {
|
|
|
48353
48299
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
48354
48300
|
}
|
|
48355
48301
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
48356
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
48302
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat);
|
|
48357
48303
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
48358
48304
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
48359
48305
|
if (!sigs || !sigs.length) {
|
|
@@ -50959,10 +50905,8 @@ function createTypeChecker(host) {
|
|
|
50959
50905
|
}
|
|
50960
50906
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
50961
50907
|
}
|
|
50962
|
-
const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
|
|
50963
|
-
const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
|
|
50964
50908
|
const contextFile = context.enclosingFile;
|
|
50965
|
-
const resolutionMode = overrideImportMode ||
|
|
50909
|
+
const resolutionMode = overrideImportMode || (contextFile == null ? void 0 : contextFile.impliedNodeFormat);
|
|
50966
50910
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
50967
50911
|
const links = getSymbolLinks(symbol);
|
|
50968
50912
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -51784,7 +51728,7 @@ function createTypeChecker(host) {
|
|
|
51784
51728
|
}
|
|
51785
51729
|
if (isJSDocTypeLiteral(node)) {
|
|
51786
51730
|
return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
|
|
51787
|
-
const name = isIdentifier(t.name) ? t.name : t.name.right;
|
|
51731
|
+
const name = visitNode(isIdentifier(t.name) ? t.name : t.name.right, visitExistingNodeTreeSymbols, isIdentifier);
|
|
51788
51732
|
const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, node), name.escapedText);
|
|
51789
51733
|
const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode2(context, t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
|
|
51790
51734
|
return factory.createPropertySignature(
|
|
@@ -51828,7 +51772,7 @@ function createTypeChecker(host) {
|
|
|
51828
51772
|
void 0,
|
|
51829
51773
|
getEffectiveDotDotDotForParameter(p),
|
|
51830
51774
|
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
51831
|
-
p.questionToken,
|
|
51775
|
+
factory.cloneNode(p.questionToken),
|
|
51832
51776
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51833
51777
|
/*initializer*/
|
|
51834
51778
|
void 0
|
|
@@ -51843,7 +51787,7 @@ function createTypeChecker(host) {
|
|
|
51843
51787
|
void 0,
|
|
51844
51788
|
getEffectiveDotDotDotForParameter(p),
|
|
51845
51789
|
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
51846
|
-
p.questionToken,
|
|
51790
|
+
factory.cloneNode(p.questionToken),
|
|
51847
51791
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51848
51792
|
/*initializer*/
|
|
51849
51793
|
void 0
|
|
@@ -51862,7 +51806,7 @@ function createTypeChecker(host) {
|
|
|
51862
51806
|
if (isTypeParameterDeclaration(node)) {
|
|
51863
51807
|
return factory.updateTypeParameterDeclaration(
|
|
51864
51808
|
node,
|
|
51865
|
-
node.modifiers,
|
|
51809
|
+
visitNodes2(node.modifiers, visitExistingNodeTreeSymbols, isModifier),
|
|
51866
51810
|
setTextRange2(context, typeParameterToName(getDeclaredTypeOfSymbol(getSymbolOfDeclaration(node)), context), node),
|
|
51867
51811
|
visitNode(node.constraint, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51868
51812
|
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
@@ -51894,8 +51838,8 @@ function createTypeChecker(host) {
|
|
|
51894
51838
|
return factory.updateImportTypeNode(
|
|
51895
51839
|
node,
|
|
51896
51840
|
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
|
|
51897
|
-
node.attributes,
|
|
51898
|
-
node.qualifier,
|
|
51841
|
+
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
|
|
51842
|
+
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
|
|
51899
51843
|
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51900
51844
|
node.isTypeOf
|
|
51901
51845
|
);
|
|
@@ -51931,8 +51875,28 @@ function createTypeChecker(host) {
|
|
|
51931
51875
|
} else {
|
|
51932
51876
|
const type = getWidenedType(getRegularTypeOfExpression(node.expression));
|
|
51933
51877
|
const computedPropertyNameType = typeToTypeNodeHelper(type, context);
|
|
51934
|
-
|
|
51935
|
-
|
|
51878
|
+
let literal;
|
|
51879
|
+
if (isLiteralTypeNode(computedPropertyNameType)) {
|
|
51880
|
+
literal = computedPropertyNameType.literal;
|
|
51881
|
+
} else {
|
|
51882
|
+
const evaluated = evaluateEntityNameExpression(node.expression);
|
|
51883
|
+
const literalNode = typeof evaluated.value === "string" ? factory.createStringLiteral(
|
|
51884
|
+
evaluated.value,
|
|
51885
|
+
/*isSingleQuote*/
|
|
51886
|
+
void 0
|
|
51887
|
+
) : typeof evaluated.value === "number" ? factory.createNumericLiteral(
|
|
51888
|
+
evaluated.value,
|
|
51889
|
+
/*numericLiteralFlags*/
|
|
51890
|
+
0
|
|
51891
|
+
) : void 0;
|
|
51892
|
+
if (!literalNode) {
|
|
51893
|
+
if (isImportTypeNode(computedPropertyNameType)) {
|
|
51894
|
+
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
51895
|
+
}
|
|
51896
|
+
return node;
|
|
51897
|
+
}
|
|
51898
|
+
literal = literalNode;
|
|
51899
|
+
}
|
|
51936
51900
|
if (literal.kind === 11 /* StringLiteral */ && isIdentifierText(literal.text, getEmitScriptTarget(compilerOptions))) {
|
|
51937
51901
|
return factory.createIdentifier(literal.text);
|
|
51938
51902
|
}
|
|
@@ -51949,9 +51913,9 @@ function createTypeChecker(host) {
|
|
|
51949
51913
|
hadError = hadError || introducesError;
|
|
51950
51914
|
parameterName = result;
|
|
51951
51915
|
} else {
|
|
51952
|
-
parameterName = node.parameterName;
|
|
51916
|
+
parameterName = factory.cloneNode(node.parameterName);
|
|
51953
51917
|
}
|
|
51954
|
-
return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51918
|
+
return factory.updateTypePredicateNode(node, factory.cloneNode(node.assertsModifier), parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51955
51919
|
}
|
|
51956
51920
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
51957
51921
|
const visited = visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
@@ -64687,7 +64651,7 @@ function createTypeChecker(host) {
|
|
|
64687
64651
|
const sourceArity = getTypeReferenceArity(source2);
|
|
64688
64652
|
const targetArity = getTypeReferenceArity(target2);
|
|
64689
64653
|
const sourceRestFlag = isTupleType(source2) ? source2.target.combinedFlags & 4 /* Rest */ : 4 /* Rest */;
|
|
64690
|
-
const
|
|
64654
|
+
const targetHasRestElement = !!(target2.target.combinedFlags & 12 /* Variable */);
|
|
64691
64655
|
const sourceMinLength = isTupleType(source2) ? source2.target.minLength : 0;
|
|
64692
64656
|
const targetMinLength = target2.target.minLength;
|
|
64693
64657
|
if (!sourceRestFlag && sourceArity < targetMinLength) {
|
|
@@ -64696,13 +64660,13 @@ function createTypeChecker(host) {
|
|
|
64696
64660
|
}
|
|
64697
64661
|
return 0 /* False */;
|
|
64698
64662
|
}
|
|
64699
|
-
if (!
|
|
64663
|
+
if (!targetHasRestElement && targetArity < sourceMinLength) {
|
|
64700
64664
|
if (reportErrors2) {
|
|
64701
64665
|
reportError(Diagnostics.Source_has_0_element_s_but_target_allows_only_1, sourceMinLength, targetArity);
|
|
64702
64666
|
}
|
|
64703
64667
|
return 0 /* False */;
|
|
64704
64668
|
}
|
|
64705
|
-
if (!
|
|
64669
|
+
if (!targetHasRestElement && (sourceRestFlag || targetArity < sourceArity)) {
|
|
64706
64670
|
if (reportErrors2) {
|
|
64707
64671
|
if (sourceMinLength < targetMinLength) {
|
|
64708
64672
|
reportError(Diagnostics.Target_requires_0_element_s_but_source_may_have_fewer, targetMinLength);
|
|
@@ -64716,7 +64680,6 @@ function createTypeChecker(host) {
|
|
|
64716
64680
|
const targetTypeArguments = getTypeArguments(target2);
|
|
64717
64681
|
const targetStartCount = getStartElementCount(target2.target, 11 /* NonRest */);
|
|
64718
64682
|
const targetEndCount = getEndElementCount(target2.target, 11 /* NonRest */);
|
|
64719
|
-
const targetHasRestElement = target2.target.hasRestElement;
|
|
64720
64683
|
let canExcludeDiscriminants = !!excludedProperties;
|
|
64721
64684
|
for (let sourcePosition = 0; sourcePosition < sourceArity; sourcePosition++) {
|
|
64722
64685
|
const sourceFlags = isTupleType(source2) ? source2.target.elementFlags[sourcePosition] : 4 /* Rest */;
|
|
@@ -65956,6 +65919,7 @@ function createTypeChecker(host) {
|
|
|
65956
65919
|
return type;
|
|
65957
65920
|
}
|
|
65958
65921
|
function reportWideningErrorsInType(type) {
|
|
65922
|
+
var _a;
|
|
65959
65923
|
let errorReported = false;
|
|
65960
65924
|
if (getObjectFlags(type) & 65536 /* ContainsWideningType */) {
|
|
65961
65925
|
if (type.flags & 1048576 /* Union */) {
|
|
@@ -65963,27 +65927,28 @@ function createTypeChecker(host) {
|
|
|
65963
65927
|
errorReported = true;
|
|
65964
65928
|
} else {
|
|
65965
65929
|
for (const t of type.types) {
|
|
65966
|
-
|
|
65967
|
-
errorReported = true;
|
|
65968
|
-
}
|
|
65930
|
+
errorReported || (errorReported = reportWideningErrorsInType(t));
|
|
65969
65931
|
}
|
|
65970
65932
|
}
|
|
65971
|
-
}
|
|
65972
|
-
if (isArrayOrTupleType(type)) {
|
|
65933
|
+
} else if (isArrayOrTupleType(type)) {
|
|
65973
65934
|
for (const t of getTypeArguments(type)) {
|
|
65974
|
-
|
|
65975
|
-
errorReported = true;
|
|
65976
|
-
}
|
|
65935
|
+
errorReported || (errorReported = reportWideningErrorsInType(t));
|
|
65977
65936
|
}
|
|
65978
|
-
}
|
|
65979
|
-
if (isObjectLiteralType(type)) {
|
|
65937
|
+
} else if (isObjectLiteralType(type)) {
|
|
65980
65938
|
for (const p of getPropertiesOfObjectType(type)) {
|
|
65981
65939
|
const t = getTypeOfSymbol(p);
|
|
65982
65940
|
if (getObjectFlags(t) & 65536 /* ContainsWideningType */) {
|
|
65983
|
-
|
|
65984
|
-
|
|
65941
|
+
errorReported = reportWideningErrorsInType(t);
|
|
65942
|
+
if (!errorReported) {
|
|
65943
|
+
const valueDeclaration = (_a = p.declarations) == null ? void 0 : _a.find((d) => {
|
|
65944
|
+
var _a2;
|
|
65945
|
+
return ((_a2 = d.symbol.valueDeclaration) == null ? void 0 : _a2.parent) === type.symbol.valueDeclaration;
|
|
65946
|
+
});
|
|
65947
|
+
if (valueDeclaration) {
|
|
65948
|
+
error(valueDeclaration, Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, symbolToString(p), typeToString(getWidenedType(t)));
|
|
65949
|
+
errorReported = true;
|
|
65950
|
+
}
|
|
65985
65951
|
}
|
|
65986
|
-
errorReported = true;
|
|
65987
65952
|
}
|
|
65988
65953
|
}
|
|
65989
65954
|
}
|
|
@@ -75434,7 +75399,7 @@ function createTypeChecker(host) {
|
|
|
75434
75399
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
75435
75400
|
}
|
|
75436
75401
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75437
|
-
const hasDefaultOnly =
|
|
75402
|
+
const hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
|
|
75438
75403
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75439
75404
|
const synthType = type;
|
|
75440
75405
|
if (!synthType.defaultOnlyType) {
|
|
@@ -80661,7 +80626,7 @@ function createTypeChecker(host) {
|
|
|
80661
80626
|
});
|
|
80662
80627
|
}
|
|
80663
80628
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
80664
|
-
if (
|
|
80629
|
+
if (moduleKind >= 5 /* ES2015 */ && !(moduleKind >= 100 /* Node16 */ && getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
80665
80630
|
return;
|
|
80666
80631
|
}
|
|
80667
80632
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -82082,7 +82047,7 @@ function createTypeChecker(host) {
|
|
|
82082
82047
|
}
|
|
82083
82048
|
}
|
|
82084
82049
|
function checkClassNameCollisionWithObject(name) {
|
|
82085
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" &&
|
|
82050
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
82086
82051
|
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
82087
82052
|
}
|
|
82088
82053
|
}
|
|
@@ -83162,7 +83127,7 @@ function createTypeChecker(host) {
|
|
|
83162
83127
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
83163
83128
|
}
|
|
83164
83129
|
}
|
|
83165
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ &&
|
|
83130
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83166
83131
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
83167
83132
|
if (exportModifier) {
|
|
83168
83133
|
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -83382,10 +83347,8 @@ function createTypeChecker(host) {
|
|
|
83382
83347
|
}
|
|
83383
83348
|
}
|
|
83384
83349
|
}
|
|
83385
|
-
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) &&
|
|
83350
|
+
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83386
83351
|
error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
83387
|
-
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
83388
|
-
error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
|
83389
83352
|
}
|
|
83390
83353
|
}
|
|
83391
83354
|
if (isImportSpecifier(node)) {
|
|
@@ -83426,7 +83389,7 @@ function createTypeChecker(host) {
|
|
|
83426
83389
|
checkAliasSymbol(node);
|
|
83427
83390
|
if (node.kind === 276 /* ImportSpecifier */) {
|
|
83428
83391
|
checkModuleExportName(node.propertyName);
|
|
83429
|
-
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) &&
|
|
83392
|
+
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83430
83393
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
83431
83394
|
}
|
|
83432
83395
|
}
|
|
@@ -83448,7 +83411,7 @@ function createTypeChecker(host) {
|
|
|
83448
83411
|
if (validForTypeAttributes && override) {
|
|
83449
83412
|
return;
|
|
83450
83413
|
}
|
|
83451
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
83414
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
83452
83415
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
83453
83416
|
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
|
|
83454
83417
|
return grammarErrorOnNode(node, message);
|
|
@@ -83481,7 +83444,7 @@ function createTypeChecker(host) {
|
|
|
83481
83444
|
if (importClause.namedBindings) {
|
|
83482
83445
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
83483
83446
|
checkImportBinding(importClause.namedBindings);
|
|
83484
|
-
if (
|
|
83447
|
+
if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) {
|
|
83485
83448
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
83486
83449
|
}
|
|
83487
83450
|
} else {
|
|
@@ -83521,7 +83484,7 @@ function createTypeChecker(host) {
|
|
|
83521
83484
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
83522
83485
|
}
|
|
83523
83486
|
} else {
|
|
83524
|
-
if (5 /* ES2015 */
|
|
83487
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
83525
83488
|
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
|
83526
83489
|
}
|
|
83527
83490
|
}
|
|
@@ -83551,7 +83514,7 @@ function createTypeChecker(host) {
|
|
|
83551
83514
|
checkAliasSymbol(node.exportClause);
|
|
83552
83515
|
checkModuleExportName(node.exportClause.name);
|
|
83553
83516
|
}
|
|
83554
|
-
if (
|
|
83517
|
+
if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83555
83518
|
if (node.exportClause) {
|
|
83556
83519
|
if (getESModuleInterop(compilerOptions)) {
|
|
83557
83520
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -83610,7 +83573,7 @@ function createTypeChecker(host) {
|
|
|
83610
83573
|
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
83611
83574
|
}
|
|
83612
83575
|
} else {
|
|
83613
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
83576
|
+
if (getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleExportNameIsDefault(node.propertyName || node.name)) {
|
|
83614
83577
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
83615
83578
|
}
|
|
83616
83579
|
}
|
|
@@ -83636,7 +83599,7 @@ function createTypeChecker(host) {
|
|
|
83636
83599
|
if (typeAnnotationNode) {
|
|
83637
83600
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
83638
83601
|
}
|
|
83639
|
-
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax &&
|
|
83602
|
+
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
|
|
83640
83603
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
83641
83604
|
const id = node.expression;
|
|
83642
83605
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -83716,7 +83679,7 @@ function createTypeChecker(host) {
|
|
|
83716
83679
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
83717
83680
|
}
|
|
83718
83681
|
if (node.isExportEquals) {
|
|
83719
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ &&
|
|
83682
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
83720
83683
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
83721
83684
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
83722
83685
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -83777,6 +83740,9 @@ function createTypeChecker(host) {
|
|
|
83777
83740
|
}
|
|
83778
83741
|
}
|
|
83779
83742
|
function checkSourceElementWorker(node) {
|
|
83743
|
+
if (getNodeCheckFlags(node) & 8388608 /* PartiallyTypeChecked */) {
|
|
83744
|
+
return;
|
|
83745
|
+
}
|
|
83780
83746
|
if (canHaveJSDoc(node)) {
|
|
83781
83747
|
forEach(node.jsDoc, ({ comment, tags }) => {
|
|
83782
83748
|
checkJSDocCommentWorker(comment);
|
|
@@ -84120,19 +84086,21 @@ function createTypeChecker(host) {
|
|
|
84120
84086
|
currentNode = saveCurrentNode;
|
|
84121
84087
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
84122
84088
|
}
|
|
84123
|
-
function checkSourceFile(node) {
|
|
84089
|
+
function checkSourceFile(node, nodesToCheck) {
|
|
84124
84090
|
var _a, _b;
|
|
84125
84091
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
84126
84092
|
tracing.Phase.Check,
|
|
84127
|
-
"checkSourceFile",
|
|
84093
|
+
nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile",
|
|
84128
84094
|
{ path: node.path },
|
|
84129
84095
|
/*separateBeginAndEnd*/
|
|
84130
84096
|
true
|
|
84131
84097
|
);
|
|
84132
|
-
|
|
84133
|
-
|
|
84134
|
-
mark(
|
|
84135
|
-
|
|
84098
|
+
const beforeMark = nodesToCheck ? "beforeCheckNodes" : "beforeCheck";
|
|
84099
|
+
const afterMark = nodesToCheck ? "afterCheckNodes" : "afterCheck";
|
|
84100
|
+
mark(beforeMark);
|
|
84101
|
+
nodesToCheck ? checkSourceFileNodesWorker(node, nodesToCheck) : checkSourceFileWorker(node);
|
|
84102
|
+
mark(afterMark);
|
|
84103
|
+
measure("Check", beforeMark, afterMark);
|
|
84136
84104
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
84137
84105
|
}
|
|
84138
84106
|
function unusedIsError(kind, isAmbient) {
|
|
@@ -84163,6 +84131,13 @@ function createTypeChecker(host) {
|
|
|
84163
84131
|
clear(potentialWeakMapSetCollisions);
|
|
84164
84132
|
clear(potentialReflectCollisions);
|
|
84165
84133
|
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
84134
|
+
if (links.flags & 8388608 /* PartiallyTypeChecked */) {
|
|
84135
|
+
potentialThisCollisions = links.potentialThisCollisions;
|
|
84136
|
+
potentialNewTargetCollisions = links.potentialNewTargetCollisions;
|
|
84137
|
+
potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions;
|
|
84138
|
+
potentialReflectCollisions = links.potentialReflectCollisions;
|
|
84139
|
+
potentialUnusedRenamedBindingElementsInTypes = links.potentialUnusedRenamedBindingElementsInTypes;
|
|
84140
|
+
}
|
|
84166
84141
|
forEach(node.statements, checkSourceElement);
|
|
84167
84142
|
checkSourceElement(node.endOfFileToken);
|
|
84168
84143
|
checkDeferredNodes(node);
|
|
@@ -84203,10 +84178,38 @@ function createTypeChecker(host) {
|
|
|
84203
84178
|
links.flags |= 1 /* TypeChecked */;
|
|
84204
84179
|
}
|
|
84205
84180
|
}
|
|
84206
|
-
function
|
|
84181
|
+
function checkSourceFileNodesWorker(file, nodes) {
|
|
84182
|
+
const links = getNodeLinks(file);
|
|
84183
|
+
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
84184
|
+
if (skipTypeChecking(file, compilerOptions, host)) {
|
|
84185
|
+
return;
|
|
84186
|
+
}
|
|
84187
|
+
checkGrammarSourceFile(file);
|
|
84188
|
+
clear(potentialThisCollisions);
|
|
84189
|
+
clear(potentialNewTargetCollisions);
|
|
84190
|
+
clear(potentialWeakMapSetCollisions);
|
|
84191
|
+
clear(potentialReflectCollisions);
|
|
84192
|
+
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
84193
|
+
forEach(nodes, checkSourceElement);
|
|
84194
|
+
checkDeferredNodes(file);
|
|
84195
|
+
(links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions);
|
|
84196
|
+
(links.potentialNewTargetCollisions || (links.potentialNewTargetCollisions = [])).push(...potentialNewTargetCollisions);
|
|
84197
|
+
(links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions);
|
|
84198
|
+
(links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions);
|
|
84199
|
+
(links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push(
|
|
84200
|
+
...potentialUnusedRenamedBindingElementsInTypes
|
|
84201
|
+
);
|
|
84202
|
+
links.flags |= 8388608 /* PartiallyTypeChecked */;
|
|
84203
|
+
for (const node of nodes) {
|
|
84204
|
+
const nodeLinks2 = getNodeLinks(node);
|
|
84205
|
+
nodeLinks2.flags |= 8388608 /* PartiallyTypeChecked */;
|
|
84206
|
+
}
|
|
84207
|
+
}
|
|
84208
|
+
}
|
|
84209
|
+
function getDiagnostics(sourceFile, ct, nodesToCheck) {
|
|
84207
84210
|
try {
|
|
84208
84211
|
cancellationToken = ct;
|
|
84209
|
-
return getDiagnosticsWorker(sourceFile);
|
|
84212
|
+
return getDiagnosticsWorker(sourceFile, nodesToCheck);
|
|
84210
84213
|
} finally {
|
|
84211
84214
|
cancellationToken = void 0;
|
|
84212
84215
|
}
|
|
@@ -84217,20 +84220,23 @@ function createTypeChecker(host) {
|
|
|
84217
84220
|
}
|
|
84218
84221
|
deferredDiagnosticsCallbacks = [];
|
|
84219
84222
|
}
|
|
84220
|
-
function checkSourceFileWithEagerDiagnostics(sourceFile) {
|
|
84223
|
+
function checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck) {
|
|
84221
84224
|
ensurePendingDiagnosticWorkComplete();
|
|
84222
84225
|
const oldAddLazyDiagnostics = addLazyDiagnostic;
|
|
84223
84226
|
addLazyDiagnostic = (cb) => cb();
|
|
84224
|
-
checkSourceFile(sourceFile);
|
|
84227
|
+
checkSourceFile(sourceFile, nodesToCheck);
|
|
84225
84228
|
addLazyDiagnostic = oldAddLazyDiagnostics;
|
|
84226
84229
|
}
|
|
84227
|
-
function getDiagnosticsWorker(sourceFile) {
|
|
84230
|
+
function getDiagnosticsWorker(sourceFile, nodesToCheck) {
|
|
84228
84231
|
if (sourceFile) {
|
|
84229
84232
|
ensurePendingDiagnosticWorkComplete();
|
|
84230
84233
|
const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
|
|
84231
84234
|
const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
|
|
84232
|
-
checkSourceFileWithEagerDiagnostics(sourceFile);
|
|
84235
|
+
checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck);
|
|
84233
84236
|
const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
|
84237
|
+
if (nodesToCheck) {
|
|
84238
|
+
return semanticDiagnostics;
|
|
84239
|
+
}
|
|
84234
84240
|
const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
|
|
84235
84241
|
if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
|
|
84236
84242
|
const deferredGlobalDiagnostics = relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, compareDiagnostics);
|
|
@@ -84240,7 +84246,7 @@ function createTypeChecker(host) {
|
|
|
84240
84246
|
}
|
|
84241
84247
|
return semanticDiagnostics;
|
|
84242
84248
|
}
|
|
84243
|
-
forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
|
|
84249
|
+
forEach(host.getSourceFiles(), (file) => checkSourceFileWithEagerDiagnostics(file));
|
|
84244
84250
|
return diagnostics.getDiagnostics();
|
|
84245
84251
|
}
|
|
84246
84252
|
function getGlobalDiagnostics() {
|
|
@@ -86219,7 +86225,7 @@ function createTypeChecker(host) {
|
|
|
86219
86225
|
break;
|
|
86220
86226
|
case 95 /* ExportKeyword */:
|
|
86221
86227
|
if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
|
|
86222
|
-
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ &&
|
|
86228
|
+
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
86223
86229
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
86224
86230
|
}
|
|
86225
86231
|
if (flags & 32 /* Export */) {
|
|
@@ -87128,7 +87134,7 @@ function createTypeChecker(host) {
|
|
|
87128
87134
|
const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
|
87129
87135
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
87130
87136
|
}
|
|
87131
|
-
if (
|
|
87137
|
+
if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
|
|
87132
87138
|
checkESModuleMarker(node.name);
|
|
87133
87139
|
}
|
|
87134
87140
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -87629,9 +87635,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
87629
87635
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
87630
87636
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
87631
87637
|
getFileIncludeReasons: () => host.getFileIncludeReasons(),
|
|
87632
|
-
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
87633
|
-
getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
|
|
87634
|
-
getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
|
|
87638
|
+
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
87635
87639
|
};
|
|
87636
87640
|
}
|
|
87637
87641
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -107304,7 +107308,7 @@ function transformModule(context) {
|
|
|
107304
107308
|
case 354 /* PartiallyEmittedExpression */:
|
|
107305
107309
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
107306
107310
|
case 213 /* CallExpression */:
|
|
107307
|
-
if (isImportCall(node) &&
|
|
107311
|
+
if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
|
|
107308
107312
|
return visitImportCallExpression(node);
|
|
107309
107313
|
}
|
|
107310
107314
|
break;
|
|
@@ -110300,8 +110304,8 @@ function transformECMAScriptModule(context) {
|
|
|
110300
110304
|
}
|
|
110301
110305
|
}
|
|
110302
110306
|
|
|
110303
|
-
// src/compiler/transformers/module/
|
|
110304
|
-
function
|
|
110307
|
+
// src/compiler/transformers/module/node.ts
|
|
110308
|
+
function transformNodeModule(context) {
|
|
110305
110309
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
110306
110310
|
const previousOnEmitNode = context.onEmitNode;
|
|
110307
110311
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -110312,7 +110316,6 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110312
110316
|
const cjsTransform = transformModule(context);
|
|
110313
110317
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
110314
110318
|
const cjsOnEmitNode = context.onEmitNode;
|
|
110315
|
-
const getEmitModuleFormatOfFile = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
110316
110319
|
context.onSubstituteNode = onSubstituteNode;
|
|
110317
110320
|
context.onEmitNode = onEmitNode;
|
|
110318
110321
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -110327,7 +110330,7 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110327
110330
|
if (!currentSourceFile) {
|
|
110328
110331
|
return previousOnSubstituteNode(hint, node);
|
|
110329
110332
|
}
|
|
110330
|
-
if (
|
|
110333
|
+
if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
110331
110334
|
return esmOnSubstituteNode(hint, node);
|
|
110332
110335
|
}
|
|
110333
110336
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -110340,13 +110343,13 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110340
110343
|
if (!currentSourceFile) {
|
|
110341
110344
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
110342
110345
|
}
|
|
110343
|
-
if (
|
|
110346
|
+
if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
110344
110347
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
110345
110348
|
}
|
|
110346
110349
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
110347
110350
|
}
|
|
110348
110351
|
function getModuleTransformForFile(file) {
|
|
110349
|
-
return
|
|
110352
|
+
return file.impliedNodeFormat === 99 /* ESNext */ ? esmTransform : cjsTransform;
|
|
110350
110353
|
}
|
|
110351
110354
|
function transformSourceFile(node) {
|
|
110352
110355
|
if (node.isDeclarationFile) {
|
|
@@ -112468,18 +112471,17 @@ function isProcessedComponent(node) {
|
|
|
112468
112471
|
// src/compiler/transformer.ts
|
|
112469
112472
|
function getModuleTransformer(moduleKind) {
|
|
112470
112473
|
switch (moduleKind) {
|
|
112471
|
-
case 200 /* Preserve */:
|
|
112472
|
-
return transformECMAScriptModule;
|
|
112473
112474
|
case 99 /* ESNext */:
|
|
112474
112475
|
case 7 /* ES2022 */:
|
|
112475
112476
|
case 6 /* ES2020 */:
|
|
112476
112477
|
case 5 /* ES2015 */:
|
|
112477
|
-
case
|
|
112478
|
-
|
|
112479
|
-
case 1 /* CommonJS */:
|
|
112480
|
-
return transformImpliedNodeFormatDependentModule;
|
|
112478
|
+
case 200 /* Preserve */:
|
|
112479
|
+
return transformECMAScriptModule;
|
|
112481
112480
|
case 4 /* System */:
|
|
112482
112481
|
return transformSystemModule;
|
|
112482
|
+
case 100 /* Node16 */:
|
|
112483
|
+
case 199 /* NodeNext */:
|
|
112484
|
+
return transformNodeModule;
|
|
112483
112485
|
default:
|
|
112484
112486
|
return transformModule;
|
|
112485
112487
|
}
|
|
@@ -113196,7 +113198,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113196
113198
|
newLine: compilerOptions.newLine,
|
|
113197
113199
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
113198
113200
|
module: getEmitModuleKind(compilerOptions),
|
|
113199
|
-
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
113200
113201
|
target: getEmitScriptTarget(compilerOptions),
|
|
113201
113202
|
sourceMap: compilerOptions.sourceMap,
|
|
113202
113203
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -113259,7 +113260,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113259
113260
|
newLine: compilerOptions.newLine,
|
|
113260
113261
|
noEmitHelpers: true,
|
|
113261
113262
|
module: compilerOptions.module,
|
|
113262
|
-
moduleResolution: compilerOptions.moduleResolution,
|
|
113263
113263
|
target: compilerOptions.target,
|
|
113264
113264
|
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
113265
113265
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -113275,7 +113275,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113275
113275
|
isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
|
|
113276
113276
|
substituteNode: declarationTransform.substituteNode
|
|
113277
113277
|
});
|
|
113278
|
-
printSourceFileOrBundle(
|
|
113278
|
+
const dtsWritten = printSourceFileOrBundle(
|
|
113279
113279
|
declarationFilePath,
|
|
113280
113280
|
declarationMapPath,
|
|
113281
113281
|
declarationTransform,
|
|
@@ -113289,7 +113289,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113289
113289
|
}
|
|
113290
113290
|
);
|
|
113291
113291
|
if (emittedFilesList) {
|
|
113292
|
-
emittedFilesList.push(declarationFilePath);
|
|
113292
|
+
if (dtsWritten) emittedFilesList.push(declarationFilePath);
|
|
113293
113293
|
if (declarationMapPath) {
|
|
113294
113294
|
emittedFilesList.push(declarationMapPath);
|
|
113295
113295
|
}
|
|
@@ -113380,8 +113380,10 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113380
113380
|
writer.writeLine();
|
|
113381
113381
|
}
|
|
113382
113382
|
const text = writer.getText();
|
|
113383
|
-
|
|
113383
|
+
const data = { sourceMapUrlPos, diagnostics: transform.diagnostics };
|
|
113384
|
+
writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
|
|
113384
113385
|
writer.clear();
|
|
113386
|
+
return !data.skippedDtsWrite;
|
|
113385
113387
|
}
|
|
113386
113388
|
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
|
|
113387
113389
|
return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 307 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
|
|
@@ -118712,6 +118714,9 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
118712
118714
|
function getModeForFileReference(ref, containingFileMode) {
|
|
118713
118715
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
118714
118716
|
}
|
|
118717
|
+
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
118718
|
+
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
118719
|
+
}
|
|
118715
118720
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
118716
118721
|
var _a;
|
|
118717
118722
|
if (isExportDeclaration(decl)) {
|
|
@@ -118726,6 +118731,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
118726
118731
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
118727
118732
|
}
|
|
118728
118733
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
118734
|
+
var _a;
|
|
118729
118735
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
118730
118736
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
118731
118737
|
if (isTypeOnly) {
|
|
@@ -118741,28 +118747,19 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
118741
118747
|
return override;
|
|
118742
118748
|
}
|
|
118743
118749
|
}
|
|
118744
|
-
if (compilerOptions &&
|
|
118745
|
-
return
|
|
118750
|
+
if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
118751
|
+
return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
|
|
118752
|
+
usage.parent,
|
|
118753
|
+
/*requireStringLiteralLikeArgument*/
|
|
118754
|
+
false
|
|
118755
|
+
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
118746
118756
|
}
|
|
118747
|
-
|
|
118748
|
-
|
|
118749
|
-
|
|
118750
|
-
if (!compilerOptions) {
|
|
118751
|
-
return void 0;
|
|
118757
|
+
if (file.impliedNodeFormat === void 0) return void 0;
|
|
118758
|
+
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
118759
|
+
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
118752
118760
|
}
|
|
118753
118761
|
const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
|
|
118754
|
-
|
|
118755
|
-
usage.parent,
|
|
118756
|
-
/*requireStringLiteralLikeArgument*/
|
|
118757
|
-
false
|
|
118758
|
-
)) {
|
|
118759
|
-
return 1 /* CommonJS */;
|
|
118760
|
-
}
|
|
118761
|
-
if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
|
|
118762
|
-
return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
118763
|
-
}
|
|
118764
|
-
const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
|
|
118765
|
-
return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
|
|
118762
|
+
return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
118766
118763
|
}
|
|
118767
118764
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
118768
118765
|
if (!node) return void 0;
|
|
@@ -118819,7 +118816,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
118819
118816
|
}
|
|
118820
118817
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
118821
118818
|
getName: getTypeReferenceResolutionName,
|
|
118822
|
-
getMode: (entry, file
|
|
118819
|
+
getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
|
|
118823
118820
|
};
|
|
118824
118821
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
118825
118822
|
return {
|
|
@@ -119454,8 +119451,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119454
119451
|
isSourceFileFromExternalLibrary,
|
|
119455
119452
|
isSourceFileDefaultLibrary,
|
|
119456
119453
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
119457
|
-
|
|
119458
|
-
getModeForResolutionAtIndex,
|
|
119454
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
119459
119455
|
getSourceFileFromReference,
|
|
119460
119456
|
getLibFileFromReference,
|
|
119461
119457
|
sourceFileToPackageName,
|
|
@@ -119483,11 +119479,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119483
119479
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
119484
119480
|
isSourceOfProjectReferenceRedirect,
|
|
119485
119481
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
119486
|
-
getCompilerOptionsForFile,
|
|
119487
|
-
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
119488
|
-
getEmitModuleFormatOfFile,
|
|
119489
|
-
getImpliedNodeFormatForEmit,
|
|
119490
|
-
shouldTransformImportCall,
|
|
119491
119482
|
emitBuildInfo,
|
|
119492
119483
|
fileExists,
|
|
119493
119484
|
readFile,
|
|
@@ -120070,10 +120061,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120070
120061
|
getSymlinkCache,
|
|
120071
120062
|
writeFile: writeFileCallback || writeFile2,
|
|
120072
120063
|
isEmitBlocked,
|
|
120073
|
-
shouldTransformImportCall,
|
|
120074
|
-
getEmitModuleFormatOfFile,
|
|
120075
|
-
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
120076
|
-
getModeForResolutionAtIndex,
|
|
120077
120064
|
readFile: (f) => host.readFile(f),
|
|
120078
120065
|
fileExists: (f) => {
|
|
120079
120066
|
const path = toPath3(f);
|
|
@@ -120231,15 +120218,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120231
120218
|
function getSyntacticDiagnostics(sourceFile, cancellationToken) {
|
|
120232
120219
|
return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
|
|
120233
120220
|
}
|
|
120234
|
-
function getSemanticDiagnostics(sourceFile, cancellationToken) {
|
|
120235
|
-
return getDiagnosticsHelper(
|
|
120221
|
+
function getSemanticDiagnostics(sourceFile, cancellationToken, nodesToCheck) {
|
|
120222
|
+
return getDiagnosticsHelper(
|
|
120223
|
+
sourceFile,
|
|
120224
|
+
(sourceFile2, cancellationToken2) => getSemanticDiagnosticsForFile(sourceFile2, cancellationToken2, nodesToCheck),
|
|
120225
|
+
cancellationToken
|
|
120226
|
+
);
|
|
120236
120227
|
}
|
|
120237
120228
|
function getCachedSemanticDiagnostics(sourceFile) {
|
|
120238
120229
|
var _a2;
|
|
120239
120230
|
return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
|
|
120240
120231
|
}
|
|
120241
120232
|
function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
|
|
120242
|
-
return getBindAndCheckDiagnosticsForFile(
|
|
120233
|
+
return getBindAndCheckDiagnosticsForFile(
|
|
120234
|
+
sourceFile,
|
|
120235
|
+
cancellationToken,
|
|
120236
|
+
/*nodesToCheck*/
|
|
120237
|
+
void 0
|
|
120238
|
+
);
|
|
120243
120239
|
}
|
|
120244
120240
|
function getProgramDiagnostics(sourceFile) {
|
|
120245
120241
|
var _a2;
|
|
@@ -120279,16 +120275,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120279
120275
|
throw e;
|
|
120280
120276
|
}
|
|
120281
120277
|
}
|
|
120282
|
-
function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
|
|
120278
|
+
function getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
|
|
120283
120279
|
return concatenate(
|
|
120284
|
-
filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options),
|
|
120280
|
+
filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options),
|
|
120285
120281
|
getProgramDiagnostics(sourceFile)
|
|
120286
120282
|
);
|
|
120287
120283
|
}
|
|
120288
|
-
function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
|
|
120284
|
+
function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
|
|
120285
|
+
if (nodesToCheck) {
|
|
120286
|
+
return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
|
|
120287
|
+
}
|
|
120289
120288
|
return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
|
|
120290
120289
|
}
|
|
120291
|
-
function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
|
|
120290
|
+
function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
|
|
120292
120291
|
return runWithCancellationToken(() => {
|
|
120293
120292
|
if (skipTypeChecking(sourceFile, options, program)) {
|
|
120294
120293
|
return emptyArray;
|
|
@@ -120296,24 +120295,34 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120296
120295
|
const typeChecker2 = getTypeChecker();
|
|
120297
120296
|
Debug.assert(!!sourceFile.bindDiagnostics);
|
|
120298
120297
|
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
120299
|
-
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
120300
120298
|
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
120299
|
+
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
120301
120300
|
let bindDiagnostics = sourceFile.bindDiagnostics;
|
|
120302
|
-
let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
|
|
120301
|
+
let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken, nodesToCheck);
|
|
120303
120302
|
if (isPlainJs) {
|
|
120304
120303
|
bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
120305
120304
|
checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
120306
120305
|
}
|
|
120307
|
-
return getMergedBindAndCheckDiagnostics(
|
|
120306
|
+
return getMergedBindAndCheckDiagnostics(
|
|
120307
|
+
sourceFile,
|
|
120308
|
+
!isPlainJs,
|
|
120309
|
+
!!nodesToCheck,
|
|
120310
|
+
bindDiagnostics,
|
|
120311
|
+
checkDiagnostics,
|
|
120312
|
+
isCheckJs ? sourceFile.jsDocDiagnostics : void 0
|
|
120313
|
+
);
|
|
120308
120314
|
});
|
|
120309
120315
|
}
|
|
120310
|
-
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
|
|
120316
|
+
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, partialCheck, ...allDiagnostics) {
|
|
120311
120317
|
var _a2;
|
|
120312
120318
|
const flatDiagnostics = flatten(allDiagnostics);
|
|
120313
120319
|
if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
|
|
120314
120320
|
return flatDiagnostics;
|
|
120315
120321
|
}
|
|
120316
120322
|
const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics);
|
|
120323
|
+
if (partialCheck) {
|
|
120324
|
+
return diagnostics;
|
|
120325
|
+
}
|
|
120317
120326
|
for (const errorExpectation of directives.getUnusedExpectations()) {
|
|
120318
120327
|
diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive));
|
|
120319
120328
|
}
|
|
@@ -121134,14 +121143,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121134
121143
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
121135
121144
|
const fileName = ref.fileName;
|
|
121136
121145
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
121137
|
-
const mode = ref.resolutionMode ||
|
|
121146
|
+
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
121138
121147
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
121139
121148
|
}
|
|
121140
121149
|
}
|
|
121141
|
-
function getCompilerOptionsForFile(file) {
|
|
121142
|
-
var _a2;
|
|
121143
|
-
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
121144
|
-
}
|
|
121145
121150
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
121146
121151
|
var _a2, _b2;
|
|
121147
121152
|
(_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
|
|
@@ -121242,12 +121247,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121242
121247
|
return host.getCanonicalFileName(fileName);
|
|
121243
121248
|
}
|
|
121244
121249
|
function processImportedModules(file) {
|
|
121250
|
+
var _a2;
|
|
121245
121251
|
collectExternalModuleReferences(file);
|
|
121246
121252
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
121247
121253
|
const moduleNames = getModuleNames(file);
|
|
121248
121254
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
121249
121255
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
121250
|
-
const optionsForFile =
|
|
121256
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
121251
121257
|
const resolutionsInFile = createModeAwareCache();
|
|
121252
121258
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
121253
121259
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -121803,7 +121809,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121803
121809
|
redirectInfo = cachedChain.redirectInfo;
|
|
121804
121810
|
} else {
|
|
121805
121811
|
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
121806
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file
|
|
121812
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
121807
121813
|
}
|
|
121808
121814
|
if (fileProcessingReason) processReason(fileProcessingReason);
|
|
121809
121815
|
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
|
@@ -122161,53 +122167,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122161
122167
|
return symlinks;
|
|
122162
122168
|
}
|
|
122163
122169
|
function getModeForUsageLocation2(file, usage) {
|
|
122164
|
-
|
|
122165
|
-
|
|
122166
|
-
|
|
122167
|
-
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
122170
|
+
var _a2;
|
|
122171
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
122172
|
+
return getModeForUsageLocationWorker(file, usage, optionsForFile);
|
|
122168
122173
|
}
|
|
122169
|
-
function
|
|
122174
|
+
function getModeForResolutionAtIndex2(file, index) {
|
|
122170
122175
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
122171
122176
|
}
|
|
122172
|
-
function getDefaultResolutionModeForFile2(sourceFile) {
|
|
122173
|
-
return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122174
|
-
}
|
|
122175
|
-
function getImpliedNodeFormatForEmit(sourceFile) {
|
|
122176
|
-
return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122177
|
-
}
|
|
122178
|
-
function getEmitModuleFormatOfFile(sourceFile) {
|
|
122179
|
-
return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122180
|
-
}
|
|
122181
|
-
function shouldTransformImportCall(sourceFile) {
|
|
122182
|
-
return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
|
|
122183
|
-
}
|
|
122184
|
-
}
|
|
122185
|
-
function shouldTransformImportCallWorker(sourceFile, options) {
|
|
122186
|
-
const moduleKind = getEmitModuleKind(options);
|
|
122187
|
-
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
|
|
122188
|
-
return false;
|
|
122189
|
-
}
|
|
122190
|
-
return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
|
|
122191
|
-
}
|
|
122192
|
-
function getEmitModuleFormatOfFileWorker(sourceFile, options) {
|
|
122193
|
-
return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
|
|
122194
|
-
}
|
|
122195
|
-
function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
|
|
122196
|
-
var _a, _b;
|
|
122197
|
-
const moduleKind = getEmitModuleKind(options);
|
|
122198
|
-
if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
122199
|
-
return sourceFile.impliedNodeFormat;
|
|
122200
|
-
}
|
|
122201
|
-
if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
|
|
122202
|
-
return 1 /* CommonJS */;
|
|
122203
|
-
}
|
|
122204
|
-
if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
|
|
122205
|
-
return 99 /* ESNext */;
|
|
122206
|
-
}
|
|
122207
|
-
return void 0;
|
|
122208
|
-
}
|
|
122209
|
-
function getDefaultResolutionModeForFileWorker(sourceFile, options) {
|
|
122210
|
-
return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
|
|
122211
122177
|
}
|
|
122212
122178
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
122213
122179
|
let setOfDeclarationDirectories;
|
|
@@ -122849,6 +122815,7 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
122849
122815
|
}
|
|
122850
122816
|
state.changedFilesSet = /* @__PURE__ */ new Set();
|
|
122851
122817
|
state.latestChangedDtsFile = compilerOptions.composite ? oldState == null ? void 0 : oldState.latestChangedDtsFile : void 0;
|
|
122818
|
+
state.checkPending = state.compilerOptions.noCheck ? true : void 0;
|
|
122852
122819
|
const useOldState = BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
122853
122820
|
const oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0;
|
|
122854
122821
|
let canCopySemanticDiagnostics = useOldState && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
|
|
@@ -122865,6 +122832,7 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
122865
122832
|
canCopySemanticDiagnostics = false;
|
|
122866
122833
|
canCopyEmitDiagnostics = false;
|
|
122867
122834
|
}
|
|
122835
|
+
state.hasErrorsFromOldState = oldState.hasErrors;
|
|
122868
122836
|
} else {
|
|
122869
122837
|
state.buildInfoEmitPending = isIncrementalCompilation(compilerOptions);
|
|
122870
122838
|
}
|
|
@@ -122945,6 +122913,7 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
122945
122913
|
state.buildInfoEmitPending = true;
|
|
122946
122914
|
}
|
|
122947
122915
|
}
|
|
122916
|
+
if (useOldState && state.semanticDiagnosticsPerFile.size !== state.fileInfos.size && oldState.checkPending !== state.checkPending) state.buildInfoEmitPending = true;
|
|
122948
122917
|
return state;
|
|
122949
122918
|
function addFileToChangeSet(path) {
|
|
122950
122919
|
state.changedFilesSet.add(path);
|
|
@@ -123024,40 +122993,6 @@ function releaseCache(state) {
|
|
|
123024
122993
|
BuilderState.releaseCache(state);
|
|
123025
122994
|
state.program = void 0;
|
|
123026
122995
|
}
|
|
123027
|
-
function backupBuilderProgramEmitState(state) {
|
|
123028
|
-
const outFilePath = state.compilerOptions.outFile;
|
|
123029
|
-
Debug.assert(!state.changedFilesSet.size || outFilePath);
|
|
123030
|
-
return {
|
|
123031
|
-
affectedFilesPendingEmit: state.affectedFilesPendingEmit && new Map(state.affectedFilesPendingEmit),
|
|
123032
|
-
seenEmittedFiles: state.seenEmittedFiles && new Map(state.seenEmittedFiles),
|
|
123033
|
-
seenProgramEmit: state.seenProgramEmit,
|
|
123034
|
-
programEmitPending: state.programEmitPending,
|
|
123035
|
-
emitSignatures: state.emitSignatures && new Map(state.emitSignatures),
|
|
123036
|
-
outSignature: state.outSignature,
|
|
123037
|
-
latestChangedDtsFile: state.latestChangedDtsFile,
|
|
123038
|
-
hasChangedEmitSignature: state.hasChangedEmitSignature,
|
|
123039
|
-
changedFilesSet: outFilePath ? new Set(state.changedFilesSet) : void 0,
|
|
123040
|
-
buildInfoEmitPending: state.buildInfoEmitPending,
|
|
123041
|
-
emitDiagnosticsPerFile: state.emitDiagnosticsPerFile && new Map(state.emitDiagnosticsPerFile)
|
|
123042
|
-
};
|
|
123043
|
-
}
|
|
123044
|
-
function restoreBuilderProgramEmitState(state, savedEmitState) {
|
|
123045
|
-
state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
|
|
123046
|
-
state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
|
|
123047
|
-
state.seenProgramEmit = savedEmitState.seenProgramEmit;
|
|
123048
|
-
state.programEmitPending = savedEmitState.programEmitPending;
|
|
123049
|
-
state.emitSignatures = savedEmitState.emitSignatures;
|
|
123050
|
-
state.outSignature = savedEmitState.outSignature;
|
|
123051
|
-
state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
|
|
123052
|
-
state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
|
|
123053
|
-
state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
|
|
123054
|
-
state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
|
|
123055
|
-
if (savedEmitState.changedFilesSet) state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
123056
|
-
if (state.compilerOptions.outFile && state.changedFilesSet.size) {
|
|
123057
|
-
state.semanticDiagnosticsPerFile.clear();
|
|
123058
|
-
state.emitDiagnosticsPerFile = void 0;
|
|
123059
|
-
}
|
|
123060
|
-
}
|
|
123061
122996
|
function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
123062
122997
|
Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
123063
122998
|
}
|
|
@@ -123162,7 +123097,7 @@ function removeDiagnosticsOfLibraryFiles(state) {
|
|
|
123162
123097
|
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
123163
123098
|
state.cleanedDiagnosticsOfLibFiles = true;
|
|
123164
123099
|
const options = state.program.getCompilerOptions();
|
|
123165
|
-
forEach(state.program.getSourceFiles(), (f) => state.program.isSourceFileDefaultLibrary(f) && !
|
|
123100
|
+
forEach(state.program.getSourceFiles(), (f) => state.program.isSourceFileDefaultLibrary(f) && !skipTypeCheckingIgnoringNoCheck(f, options, state.program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
|
|
123166
123101
|
}
|
|
123167
123102
|
}
|
|
123168
123103
|
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
@@ -123325,6 +123260,7 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
|
|
|
123325
123260
|
return void 0;
|
|
123326
123261
|
}
|
|
123327
123262
|
function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
|
|
123263
|
+
if (state.compilerOptions.noCheck) return emptyArray;
|
|
123328
123264
|
return concatenate(
|
|
123329
123265
|
getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
|
|
123330
123266
|
state.program.getProgramDiagnostics(sourceFile)
|
|
@@ -123339,6 +123275,7 @@ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationTok
|
|
|
123339
123275
|
}
|
|
123340
123276
|
const diagnostics = state.program.getBindAndCheckDiagnostics(sourceFile, cancellationToken);
|
|
123341
123277
|
semanticDiagnosticsPerFile.set(path, diagnostics);
|
|
123278
|
+
state.buildInfoEmitPending = true;
|
|
123342
123279
|
return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
|
|
123343
123280
|
}
|
|
123344
123281
|
function isIncrementalBundleEmitBuildInfo(info) {
|
|
@@ -123348,6 +123285,35 @@ function isIncrementalBundleEmitBuildInfo(info) {
|
|
|
123348
123285
|
function isIncrementalBuildInfo(info) {
|
|
123349
123286
|
return !!info.fileNames;
|
|
123350
123287
|
}
|
|
123288
|
+
function isNonIncrementalBuildInfo(info) {
|
|
123289
|
+
return !isIncrementalBuildInfo(info) && !!info.root;
|
|
123290
|
+
}
|
|
123291
|
+
function ensureHasErrorsForState(state) {
|
|
123292
|
+
if (state.hasErrors !== void 0) return;
|
|
123293
|
+
if (isIncrementalCompilation(state.compilerOptions)) {
|
|
123294
|
+
state.hasErrors = !some(state.program.getSourceFiles(), (f) => {
|
|
123295
|
+
var _a, _b;
|
|
123296
|
+
const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
|
|
123297
|
+
return bindAndCheckDiagnostics === void 0 || // Missing semantic diagnostics in cache will be encoded in buildInfo
|
|
123298
|
+
!!bindAndCheckDiagnostics.length || // cached semantic diagnostics will be encoded in buildInfo
|
|
123299
|
+
!!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
|
|
123300
|
+
}) && (hasSyntaxOrGlobalErrors(state) || some(state.program.getSourceFiles(), (f) => !!state.program.getProgramDiagnostics(f).length));
|
|
123301
|
+
} else {
|
|
123302
|
+
state.hasErrors = some(state.program.getSourceFiles(), (f) => {
|
|
123303
|
+
var _a, _b;
|
|
123304
|
+
const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
|
|
123305
|
+
return !!(bindAndCheckDiagnostics == null ? void 0 : bindAndCheckDiagnostics.length) || // If has semantic diagnostics
|
|
123306
|
+
!!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
|
|
123307
|
+
}) || hasSyntaxOrGlobalErrors(state);
|
|
123308
|
+
}
|
|
123309
|
+
}
|
|
123310
|
+
function hasSyntaxOrGlobalErrors(state) {
|
|
123311
|
+
return !!state.program.getConfigFileParsingDiagnostics().length || !!state.program.getSyntacticDiagnostics().length || !!state.program.getOptionsDiagnostics().length || !!state.program.getGlobalDiagnostics().length;
|
|
123312
|
+
}
|
|
123313
|
+
function getBuildInfoEmitPending(state) {
|
|
123314
|
+
ensureHasErrorsForState(state);
|
|
123315
|
+
return state.buildInfoEmitPending ?? (state.buildInfoEmitPending = !!state.hasErrorsFromOldState !== !!state.hasErrors);
|
|
123316
|
+
}
|
|
123351
123317
|
function getBuildInfo2(state) {
|
|
123352
123318
|
var _a, _b;
|
|
123353
123319
|
const currentDirectory = state.program.getCurrentDirectory();
|
|
@@ -123356,7 +123322,16 @@ function getBuildInfo2(state) {
|
|
|
123356
123322
|
const fileNames = [];
|
|
123357
123323
|
const fileNameToFileId = /* @__PURE__ */ new Map();
|
|
123358
123324
|
const rootFileNames = new Set(state.program.getRootFileNames().map((f) => toPath(f, currentDirectory, state.program.getCanonicalFileName)));
|
|
123359
|
-
|
|
123325
|
+
ensureHasErrorsForState(state);
|
|
123326
|
+
if (!isIncrementalCompilation(state.compilerOptions)) {
|
|
123327
|
+
const buildInfo2 = {
|
|
123328
|
+
root: arrayFrom(rootFileNames, (r) => relativeToBuildInfo(r)),
|
|
123329
|
+
errors: state.hasErrors ? true : void 0,
|
|
123330
|
+
checkPending: state.checkPending,
|
|
123331
|
+
version
|
|
123332
|
+
};
|
|
123333
|
+
return buildInfo2;
|
|
123334
|
+
}
|
|
123360
123335
|
const root = [];
|
|
123361
123336
|
if (state.compilerOptions.outFile) {
|
|
123362
123337
|
const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
|
|
@@ -123372,7 +123347,6 @@ function getBuildInfo2(state) {
|
|
|
123372
123347
|
options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
|
|
123373
123348
|
semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
|
|
123374
123349
|
emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
|
|
123375
|
-
changeFileSet: toChangeFileSet(),
|
|
123376
123350
|
outSignature: state.outSignature,
|
|
123377
123351
|
latestChangedDtsFile,
|
|
123378
123352
|
pendingEmit: !state.programEmitPending ? void 0 : (
|
|
@@ -123383,6 +123357,8 @@ function getBuildInfo2(state) {
|
|
|
123383
123357
|
)
|
|
123384
123358
|
),
|
|
123385
123359
|
// Actual value
|
|
123360
|
+
errors: state.hasErrors ? true : void 0,
|
|
123361
|
+
checkPending: state.checkPending,
|
|
123386
123362
|
version
|
|
123387
123363
|
};
|
|
123388
123364
|
return buildInfo2;
|
|
@@ -123475,9 +123451,10 @@ function getBuildInfo2(state) {
|
|
|
123475
123451
|
semanticDiagnosticsPerFile,
|
|
123476
123452
|
emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
|
|
123477
123453
|
affectedFilesPendingEmit,
|
|
123478
|
-
changeFileSet: toChangeFileSet(),
|
|
123479
123454
|
emitSignatures,
|
|
123480
123455
|
latestChangedDtsFile,
|
|
123456
|
+
errors: state.hasErrors ? true : void 0,
|
|
123457
|
+
checkPending: state.checkPending,
|
|
123481
123458
|
version
|
|
123482
123459
|
};
|
|
123483
123460
|
return buildInfo;
|
|
@@ -123561,7 +123538,7 @@ function getBuildInfo2(state) {
|
|
|
123561
123538
|
state.fileInfos.forEach((_value, key) => {
|
|
123562
123539
|
const value = state.semanticDiagnosticsPerFile.get(key);
|
|
123563
123540
|
if (!value) {
|
|
123564
|
-
|
|
123541
|
+
result = append(result, toFileId(key));
|
|
123565
123542
|
} else if (value.length) {
|
|
123566
123543
|
result = append(result, [
|
|
123567
123544
|
toFileId(key),
|
|
@@ -123628,15 +123605,6 @@ function getBuildInfo2(state) {
|
|
|
123628
123605
|
return result;
|
|
123629
123606
|
}) || array;
|
|
123630
123607
|
}
|
|
123631
|
-
function toChangeFileSet() {
|
|
123632
|
-
let changeFileSet;
|
|
123633
|
-
if (state.changedFilesSet.size) {
|
|
123634
|
-
for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
|
|
123635
|
-
changeFileSet = append(changeFileSet, toFileId(path));
|
|
123636
|
-
}
|
|
123637
|
-
}
|
|
123638
|
-
return changeFileSet;
|
|
123639
|
-
}
|
|
123640
123608
|
}
|
|
123641
123609
|
function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
|
|
123642
123610
|
let host;
|
|
@@ -123708,8 +123676,6 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123708
123676
|
oldState = void 0;
|
|
123709
123677
|
const builderProgram = createRedirectedBuilderProgram(state, configFileParsingDiagnostics);
|
|
123710
123678
|
builderProgram.state = state;
|
|
123711
|
-
builderProgram.saveEmitState = () => backupBuilderProgramEmitState(state);
|
|
123712
|
-
builderProgram.restoreEmitState = (saved) => restoreBuilderProgramEmitState(state, saved);
|
|
123713
123679
|
builderProgram.hasChangedEmitSignature = () => !!state.hasChangedEmitSignature;
|
|
123714
123680
|
builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(
|
|
123715
123681
|
state,
|
|
@@ -123731,7 +123697,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123731
123697
|
return builderProgram;
|
|
123732
123698
|
function emitBuildInfo(writeFile2, cancellationToken) {
|
|
123733
123699
|
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
123734
|
-
if (state
|
|
123700
|
+
if (getBuildInfoEmitPending(state)) {
|
|
123735
123701
|
const result = state.program.emitBuildInfo(
|
|
123736
123702
|
writeFile2 || maybeBind(host, host.writeFile),
|
|
123737
123703
|
cancellationToken
|
|
@@ -123782,7 +123748,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123782
123748
|
}
|
|
123783
123749
|
}
|
|
123784
123750
|
if (!affected) {
|
|
123785
|
-
if (!state
|
|
123751
|
+
if (!getBuildInfoEmitPending(state)) return void 0;
|
|
123786
123752
|
const affected2 = state.program;
|
|
123787
123753
|
const result2 = affected2.emitBuildInfo(
|
|
123788
123754
|
writeFile2 || maybeBind(host, host.writeFile),
|
|
@@ -123870,7 +123836,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123870
123836
|
if (state.compilerOptions.composite) {
|
|
123871
123837
|
const filePath = sourceFiles[0].resolvedPath;
|
|
123872
123838
|
emitSignature = handleNewSignature((_c = state.emitSignatures) == null ? void 0 : _c.get(filePath), emitSignature);
|
|
123873
|
-
if (!emitSignature) return;
|
|
123839
|
+
if (!emitSignature) return data.skippedDtsWrite = true;
|
|
123874
123840
|
(state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature);
|
|
123875
123841
|
}
|
|
123876
123842
|
} else if (state.compilerOptions.composite) {
|
|
@@ -123879,7 +123845,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123879
123845
|
/*newSignature*/
|
|
123880
123846
|
void 0
|
|
123881
123847
|
);
|
|
123882
|
-
if (!newSignature) return;
|
|
123848
|
+
if (!newSignature) return data.skippedDtsWrite = true;
|
|
123883
123849
|
state.outSignature = newSignature;
|
|
123884
123850
|
}
|
|
123885
123851
|
}
|
|
@@ -123949,8 +123915,13 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123949
123915
|
while (true) {
|
|
123950
123916
|
const affected = getNextAffectedFile(state, cancellationToken, host);
|
|
123951
123917
|
let result;
|
|
123952
|
-
if (!affected)
|
|
123953
|
-
|
|
123918
|
+
if (!affected) {
|
|
123919
|
+
if (state.checkPending && !state.compilerOptions.noCheck) {
|
|
123920
|
+
state.checkPending = void 0;
|
|
123921
|
+
state.buildInfoEmitPending = true;
|
|
123922
|
+
}
|
|
123923
|
+
return void 0;
|
|
123924
|
+
} else if (affected !== state.program) {
|
|
123954
123925
|
const affectedSourceFile = affected;
|
|
123955
123926
|
if (!ignoreSourceFile || !ignoreSourceFile(affectedSourceFile)) {
|
|
123956
123927
|
result = getSemanticDiagnosticsOfFile(state, affectedSourceFile, cancellationToken);
|
|
@@ -123977,6 +123948,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123977
123948
|
result = diagnostics || emptyArray;
|
|
123978
123949
|
state.changedFilesSet.clear();
|
|
123979
123950
|
state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
|
|
123951
|
+
if (!state.compilerOptions.noCheck) state.checkPending = void 0;
|
|
123980
123952
|
state.buildInfoEmitPending = true;
|
|
123981
123953
|
}
|
|
123982
123954
|
return { result, affected };
|
|
@@ -123997,6 +123969,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123997
123969
|
for (const sourceFile2 of state.program.getSourceFiles()) {
|
|
123998
123970
|
diagnostics = addRange(diagnostics, getSemanticDiagnosticsOfFile(state, sourceFile2, cancellationToken));
|
|
123999
123971
|
}
|
|
123972
|
+
if (state.checkPending && !state.compilerOptions.noCheck) {
|
|
123973
|
+
state.checkPending = void 0;
|
|
123974
|
+
state.buildInfoEmitPending = true;
|
|
123975
|
+
}
|
|
124000
123976
|
return diagnostics || emptyArray;
|
|
124001
123977
|
}
|
|
124002
123978
|
}
|
|
@@ -124024,7 +124000,6 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
|
|
|
124024
124000
|
let filePathsSetList;
|
|
124025
124001
|
const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
|
|
124026
124002
|
const fileInfos = /* @__PURE__ */ new Map();
|
|
124027
|
-
const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
|
|
124028
124003
|
if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
|
|
124029
124004
|
buildInfo.fileInfos.forEach((fileInfo, index) => {
|
|
124030
124005
|
const path = toFilePath(index + 1);
|
|
@@ -124036,10 +124011,11 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
|
|
|
124036
124011
|
semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
|
|
124037
124012
|
emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
|
|
124038
124013
|
hasReusableDiagnostic: true,
|
|
124039
|
-
changedFilesSet,
|
|
124040
124014
|
latestChangedDtsFile,
|
|
124041
124015
|
outSignature: buildInfo.outSignature,
|
|
124042
|
-
programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options)
|
|
124016
|
+
programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options),
|
|
124017
|
+
hasErrors: buildInfo.errors,
|
|
124018
|
+
checkPending: buildInfo.checkPending
|
|
124043
124019
|
};
|
|
124044
124020
|
} else {
|
|
124045
124021
|
filePathsSetList = (_b = buildInfo.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
|
|
@@ -124072,15 +124048,14 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
|
|
|
124072
124048
|
emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
|
|
124073
124049
|
hasReusableDiagnostic: true,
|
|
124074
124050
|
affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
|
|
124075
|
-
changedFilesSet,
|
|
124076
124051
|
latestChangedDtsFile,
|
|
124077
|
-
emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
|
|
124052
|
+
emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0,
|
|
124053
|
+
hasErrors: buildInfo.errors,
|
|
124054
|
+
checkPending: buildInfo.checkPending
|
|
124078
124055
|
};
|
|
124079
124056
|
}
|
|
124080
124057
|
return {
|
|
124081
124058
|
state,
|
|
124082
|
-
saveEmitState: noop,
|
|
124083
|
-
restoreEmitState: noop,
|
|
124084
124059
|
getProgram: notImplemented,
|
|
124085
124060
|
getProgramOrUndefined: returnUndefined,
|
|
124086
124061
|
releaseProgram: noop,
|
|
@@ -124124,7 +124099,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
|
|
|
124124
124099
|
const semanticDiagnostics = new Map(
|
|
124125
124100
|
mapDefinedIterator(
|
|
124126
124101
|
fileInfos.keys(),
|
|
124127
|
-
(key) =>
|
|
124102
|
+
(key) => [key, emptyArray]
|
|
124128
124103
|
)
|
|
124129
124104
|
);
|
|
124130
124105
|
diagnostics == null ? void 0 : diagnostics.forEach((value) => {
|
|
@@ -124172,11 +124147,15 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
|
124172
124147
|
}
|
|
124173
124148
|
}
|
|
124174
124149
|
}
|
|
124150
|
+
function getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host) {
|
|
124151
|
+
if (!isNonIncrementalBuildInfo(buildInfo)) return void 0;
|
|
124152
|
+
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
124153
|
+
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
124154
|
+
return buildInfo.root.map((r) => toPath(r, buildInfoDirectory, getCanonicalFileName));
|
|
124155
|
+
}
|
|
124175
124156
|
function createRedirectedBuilderProgram(state, configFileParsingDiagnostics) {
|
|
124176
124157
|
return {
|
|
124177
124158
|
state: void 0,
|
|
124178
|
-
saveEmitState: noop,
|
|
124179
|
-
restoreEmitState: noop,
|
|
124180
124159
|
getProgram,
|
|
124181
124160
|
getProgramOrUndefined: () => state.program,
|
|
124182
124161
|
releaseProgram: () => state.program = void 0,
|
|
@@ -125504,10 +125483,10 @@ function explainFiles(program, write) {
|
|
|
125504
125483
|
for (const file of program.getSourceFiles()) {
|
|
125505
125484
|
write(`${toFileName(file, relativeFileName)}`);
|
|
125506
125485
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
125507
|
-
(_b = explainIfFileIsRedirectAndImpliedFormat(file,
|
|
125486
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
125508
125487
|
}
|
|
125509
125488
|
}
|
|
125510
|
-
function explainIfFileIsRedirectAndImpliedFormat(file,
|
|
125489
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
125511
125490
|
var _a;
|
|
125512
125491
|
let result;
|
|
125513
125492
|
if (file.path !== file.resolvedPath) {
|
|
@@ -125527,7 +125506,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConverto
|
|
|
125527
125506
|
));
|
|
125528
125507
|
}
|
|
125529
125508
|
if (isExternalOrCommonJsModule(file)) {
|
|
125530
|
-
switch (
|
|
125509
|
+
switch (file.impliedNodeFormat) {
|
|
125531
125510
|
case 99 /* ESNext */:
|
|
125532
125511
|
if (file.packageJsonScope) {
|
|
125533
125512
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|
|
@@ -125724,13 +125703,12 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
|
|
|
125724
125703
|
emitOnlyDtsFiles,
|
|
125725
125704
|
customTransformers
|
|
125726
125705
|
);
|
|
125727
|
-
|
|
125728
|
-
addRange(allDiagnostics, emitDiagnostics);
|
|
125706
|
+
addRange(allDiagnostics, emitResult.diagnostics);
|
|
125729
125707
|
const diagnostics = sortAndDeduplicateDiagnostics(allDiagnostics);
|
|
125730
125708
|
diagnostics.forEach(reportDiagnostic);
|
|
125731
125709
|
if (write) {
|
|
125732
125710
|
const currentDir = program.getCurrentDirectory();
|
|
125733
|
-
forEach(emittedFiles, (file) => {
|
|
125711
|
+
forEach(emitResult.emittedFiles, (file) => {
|
|
125734
125712
|
const filepath = getNormalizedAbsolutePath(file, currentDir);
|
|
125735
125713
|
write(`TSFILE: ${filepath}`);
|
|
125736
125714
|
});
|
|
@@ -126388,22 +126366,17 @@ function createWatchProgram(host) {
|
|
|
126388
126366
|
updateProgram();
|
|
126389
126367
|
}
|
|
126390
126368
|
function updateProgram() {
|
|
126391
|
-
var _a, _b, _c, _d;
|
|
126392
126369
|
switch (updateLevel) {
|
|
126393
126370
|
case 1 /* RootNamesAndUpdate */:
|
|
126394
|
-
(_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
|
|
126395
126371
|
reloadFileNamesFromConfigFile();
|
|
126396
126372
|
break;
|
|
126397
126373
|
case 2 /* Full */:
|
|
126398
|
-
(_b = perfLogger) == null ? void 0 : _b.logStartUpdateProgram("FullConfigReload");
|
|
126399
126374
|
reloadConfigFile();
|
|
126400
126375
|
break;
|
|
126401
126376
|
default:
|
|
126402
|
-
(_c = perfLogger) == null ? void 0 : _c.logStartUpdateProgram("SynchronizeProgram");
|
|
126403
126377
|
synchronizeProgram();
|
|
126404
126378
|
break;
|
|
126405
126379
|
}
|
|
126406
|
-
(_d = perfLogger) == null ? void 0 : _d.logStopUpdateProgram("Done");
|
|
126407
126380
|
return getCurrentBuilderProgram();
|
|
126408
126381
|
}
|
|
126409
126382
|
function reloadFileNamesFromConfigFile() {
|
|
@@ -127139,7 +127112,7 @@ function createUpdateOutputFileStampsProject(state, project, projectPath, config
|
|
|
127139
127112
|
}
|
|
127140
127113
|
};
|
|
127141
127114
|
}
|
|
127142
|
-
function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder) {
|
|
127115
|
+
function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, status, buildOrder) {
|
|
127143
127116
|
let step = 0 /* CreateProgram */;
|
|
127144
127117
|
let program;
|
|
127145
127118
|
let buildResult;
|
|
@@ -127190,17 +127163,13 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
127190
127163
|
}
|
|
127191
127164
|
);
|
|
127192
127165
|
}
|
|
127193
|
-
executeSteps(
|
|
127194
|
-
if (step === 4 /* EmitBuildInfo */) {
|
|
127195
|
-
return emitBuildInfo(writeFile2, cancellationToken);
|
|
127196
|
-
}
|
|
127197
|
-
if (step !== 3 /* Emit */) return void 0;
|
|
127166
|
+
executeSteps(0 /* CreateProgram */, cancellationToken);
|
|
127198
127167
|
return emit(writeFile2, cancellationToken, customTransformers);
|
|
127199
127168
|
},
|
|
127200
127169
|
done
|
|
127201
127170
|
};
|
|
127202
127171
|
function done(cancellationToken, writeFile2, customTransformers) {
|
|
127203
|
-
executeSteps(
|
|
127172
|
+
executeSteps(3 /* Done */, cancellationToken, writeFile2, customTransformers);
|
|
127204
127173
|
mark("SolutionBuilder::Projects built");
|
|
127205
127174
|
return doneInvalidatedProject(state, projectPath);
|
|
127206
127175
|
}
|
|
@@ -127217,14 +127186,14 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
127217
127186
|
if (state.options.dry) {
|
|
127218
127187
|
reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
|
|
127219
127188
|
buildResult = 1 /* Success */;
|
|
127220
|
-
step =
|
|
127189
|
+
step = 2 /* QueueReferencingProjects */;
|
|
127221
127190
|
return;
|
|
127222
127191
|
}
|
|
127223
127192
|
if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project);
|
|
127224
127193
|
if (config.fileNames.length === 0) {
|
|
127225
127194
|
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
|
|
127226
127195
|
buildResult = 0 /* None */;
|
|
127227
|
-
step =
|
|
127196
|
+
step = 2 /* QueueReferencingProjects */;
|
|
127228
127197
|
return;
|
|
127229
127198
|
}
|
|
127230
127199
|
const { host, compilerHost } = state;
|
|
@@ -127252,179 +127221,97 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
127252
127221
|
}
|
|
127253
127222
|
step++;
|
|
127254
127223
|
}
|
|
127255
|
-
function handleDiagnostics(diagnostics, errorFlags, errorType) {
|
|
127256
|
-
if (diagnostics.length) {
|
|
127257
|
-
({ buildResult, step } = buildErrors(
|
|
127258
|
-
state,
|
|
127259
|
-
projectPath,
|
|
127260
|
-
diagnostics,
|
|
127261
|
-
errorFlags,
|
|
127262
|
-
errorType
|
|
127263
|
-
));
|
|
127264
|
-
} else {
|
|
127265
|
-
step++;
|
|
127266
|
-
}
|
|
127267
|
-
}
|
|
127268
|
-
function getSyntaxDiagnostics(cancellationToken) {
|
|
127269
|
-
Debug.assertIsDefined(program);
|
|
127270
|
-
handleDiagnostics(
|
|
127271
|
-
[
|
|
127272
|
-
...program.getConfigFileParsingDiagnostics(),
|
|
127273
|
-
...program.getOptionsDiagnostics(cancellationToken),
|
|
127274
|
-
...program.getGlobalDiagnostics(cancellationToken),
|
|
127275
|
-
...program.getSyntacticDiagnostics(
|
|
127276
|
-
/*sourceFile*/
|
|
127277
|
-
void 0,
|
|
127278
|
-
cancellationToken
|
|
127279
|
-
)
|
|
127280
|
-
],
|
|
127281
|
-
8 /* SyntaxErrors */,
|
|
127282
|
-
"Syntactic"
|
|
127283
|
-
);
|
|
127284
|
-
}
|
|
127285
|
-
function getSemanticDiagnostics(cancellationToken) {
|
|
127286
|
-
handleDiagnostics(
|
|
127287
|
-
Debug.checkDefined(program).getSemanticDiagnostics(
|
|
127288
|
-
/*sourceFile*/
|
|
127289
|
-
void 0,
|
|
127290
|
-
cancellationToken
|
|
127291
|
-
),
|
|
127292
|
-
16 /* TypeErrors */,
|
|
127293
|
-
"Semantic"
|
|
127294
|
-
);
|
|
127295
|
-
}
|
|
127296
127224
|
function emit(writeFileCallback, cancellationToken, customTransformers) {
|
|
127297
127225
|
var _a, _b, _c;
|
|
127298
127226
|
Debug.assertIsDefined(program);
|
|
127299
|
-
Debug.assert(step ===
|
|
127300
|
-
const
|
|
127301
|
-
|
|
127302
|
-
const
|
|
127303
|
-
const
|
|
127304
|
-
|
|
127227
|
+
Debug.assert(step === 1 /* Emit */);
|
|
127228
|
+
const { host, compilerHost } = state;
|
|
127229
|
+
const emittedOutputs = /* @__PURE__ */ new Map();
|
|
127230
|
+
const options = program.getCompilerOptions();
|
|
127231
|
+
const isIncremental = isIncrementalCompilation(options);
|
|
127232
|
+
let outputTimeStampMap;
|
|
127233
|
+
let now;
|
|
127234
|
+
const { emitResult, diagnostics } = emitFilesAndReportErrors(
|
|
127305
127235
|
program,
|
|
127306
|
-
|
|
127307
|
-
|
|
127308
|
-
void 0,
|
|
127236
|
+
(d) => host.reportDiagnostic(d),
|
|
127237
|
+
state.write,
|
|
127309
127238
|
/*reportSummary*/
|
|
127310
127239
|
void 0,
|
|
127311
|
-
(name, text, writeByteOrderMark,
|
|
127240
|
+
(name, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
127241
|
+
var _a2;
|
|
127242
|
+
const path = toPath2(state, name);
|
|
127243
|
+
emittedOutputs.set(toPath2(state, name), name);
|
|
127244
|
+
if (data == null ? void 0 : data.buildInfo) {
|
|
127245
|
+
now || (now = getCurrentTime(state.host));
|
|
127246
|
+
const isChangedSignature2 = (_a2 = program.hasChangedEmitSignature) == null ? void 0 : _a2.call(program);
|
|
127247
|
+
const existing = getBuildInfoCacheEntry(state, name, projectPath);
|
|
127248
|
+
if (existing) {
|
|
127249
|
+
existing.buildInfo = data.buildInfo;
|
|
127250
|
+
existing.modifiedTime = now;
|
|
127251
|
+
if (isChangedSignature2) existing.latestChangedDtsTime = now;
|
|
127252
|
+
} else {
|
|
127253
|
+
state.buildInfoCache.set(projectPath, {
|
|
127254
|
+
path: toPath2(state, name),
|
|
127255
|
+
buildInfo: data.buildInfo,
|
|
127256
|
+
modifiedTime: now,
|
|
127257
|
+
latestChangedDtsTime: isChangedSignature2 ? now : void 0
|
|
127258
|
+
});
|
|
127259
|
+
}
|
|
127260
|
+
}
|
|
127261
|
+
const modifiedTime = (data == null ? void 0 : data.differsOnlyInMap) ? getModifiedTime(state.host, name) : void 0;
|
|
127262
|
+
(writeFileCallback || compilerHost.writeFile)(
|
|
127263
|
+
name,
|
|
127264
|
+
text,
|
|
127265
|
+
writeByteOrderMark,
|
|
127266
|
+
onError,
|
|
127267
|
+
sourceFiles,
|
|
127268
|
+
data
|
|
127269
|
+
);
|
|
127270
|
+
if (data == null ? void 0 : data.differsOnlyInMap) state.host.setModifiedTime(name, modifiedTime);
|
|
127271
|
+
else if (!isIncremental && state.watch) {
|
|
127272
|
+
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
127273
|
+
}
|
|
127274
|
+
},
|
|
127312
127275
|
cancellationToken,
|
|
127313
127276
|
/*emitOnlyDtsFiles*/
|
|
127314
|
-
|
|
127277
|
+
void 0,
|
|
127315
127278
|
customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a, project))
|
|
127316
127279
|
);
|
|
127317
|
-
if (
|
|
127318
|
-
|
|
127319
|
-
({ buildResult, step } = buildErrors(
|
|
127320
|
-
state,
|
|
127321
|
-
projectPath,
|
|
127322
|
-
declDiagnostics,
|
|
127323
|
-
32 /* DeclarationEmitErrors */,
|
|
127324
|
-
"Declaration file"
|
|
127325
|
-
));
|
|
127326
|
-
return {
|
|
127327
|
-
emitSkipped: true,
|
|
127328
|
-
diagnostics: emitResult.diagnostics
|
|
127329
|
-
};
|
|
127280
|
+
if ((!options.noEmitOnError || !diagnostics.length) && (emittedOutputs.size || status.type !== 8 /* OutOfDateBuildInfoWithErrors */)) {
|
|
127281
|
+
updateOutputTimestampsWorker(state, config, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
|
|
127330
127282
|
}
|
|
127331
|
-
|
|
127332
|
-
|
|
127333
|
-
|
|
127334
|
-
|
|
127335
|
-
|
|
127336
|
-
|
|
127337
|
-
|
|
127338
|
-
|
|
127339
|
-
|
|
127340
|
-
|
|
127341
|
-
|
|
127342
|
-
|
|
127343
|
-
const modifiedTime = (data == null ? void 0 : data.differsOnlyInMap) ? getModifiedTime(state.host, name) : void 0;
|
|
127344
|
-
writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
|
|
127345
|
-
if (data == null ? void 0 : data.differsOnlyInMap) state.host.setModifiedTime(name, modifiedTime);
|
|
127346
|
-
else if (!isIncremental && state.watch) {
|
|
127347
|
-
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
127348
|
-
}
|
|
127349
|
-
});
|
|
127350
|
-
finishEmit(
|
|
127351
|
-
emitterDiagnostics,
|
|
127352
|
-
emittedOutputs,
|
|
127353
|
-
outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(config, !host.useCaseSensitiveFileNames()),
|
|
127354
|
-
resultFlags
|
|
127355
|
-
);
|
|
127356
|
-
return emitResult;
|
|
127357
|
-
}
|
|
127358
|
-
function emitBuildInfo(writeFileCallback, cancellationToken) {
|
|
127359
|
-
Debug.assertIsDefined(program);
|
|
127360
|
-
Debug.assert(step === 4 /* EmitBuildInfo */);
|
|
127361
|
-
const emitResult = program.emitBuildInfo((name, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
127362
|
-
if (data == null ? void 0 : data.buildInfo) setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), 2 /* DeclarationOutputUnchanged */);
|
|
127363
|
-
if (writeFileCallback) writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
127364
|
-
else state.compilerHost.writeFile(name, text, writeByteOrderMark, onError, sourceFiles, data);
|
|
127365
|
-
}, cancellationToken);
|
|
127366
|
-
if (emitResult.diagnostics.length) {
|
|
127367
|
-
reportErrors(state, emitResult.diagnostics);
|
|
127368
|
-
state.diagnostics.set(projectPath, [...state.diagnostics.get(projectPath), ...emitResult.diagnostics]);
|
|
127369
|
-
buildResult = 64 /* EmitErrors */ & buildResult;
|
|
127370
|
-
}
|
|
127371
|
-
if (emitResult.emittedFiles && state.write) {
|
|
127372
|
-
emitResult.emittedFiles.forEach((name) => listEmittedFile(state, config, name));
|
|
127283
|
+
state.projectErrorsReported.set(projectPath, true);
|
|
127284
|
+
buildResult = ((_c = program.hasChangedEmitSignature) == null ? void 0 : _c.call(program)) ? 0 /* None */ : 2 /* DeclarationOutputUnchanged */;
|
|
127285
|
+
if (!diagnostics.length) {
|
|
127286
|
+
state.diagnostics.delete(projectPath);
|
|
127287
|
+
state.projectStatus.set(projectPath, {
|
|
127288
|
+
type: 1 /* UpToDate */,
|
|
127289
|
+
oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(config, !host.useCaseSensitiveFileNames())
|
|
127290
|
+
});
|
|
127291
|
+
} else {
|
|
127292
|
+
state.diagnostics.set(projectPath, diagnostics);
|
|
127293
|
+
state.projectStatus.set(projectPath, { type: 0 /* Unbuildable */, reason: `it had errors` });
|
|
127294
|
+
buildResult |= 4 /* AnyErrors */;
|
|
127373
127295
|
}
|
|
127374
127296
|
afterProgramDone(state, program);
|
|
127375
|
-
step =
|
|
127297
|
+
step = 2 /* QueueReferencingProjects */;
|
|
127376
127298
|
return emitResult;
|
|
127377
127299
|
}
|
|
127378
|
-
function finishEmit(emitterDiagnostics, emittedOutputs, oldestOutputFileName, resultFlags) {
|
|
127379
|
-
const emitDiagnostics = emitterDiagnostics.getDiagnostics();
|
|
127380
|
-
if (emitDiagnostics.length) {
|
|
127381
|
-
({ buildResult, step } = buildErrors(
|
|
127382
|
-
state,
|
|
127383
|
-
projectPath,
|
|
127384
|
-
emitDiagnostics,
|
|
127385
|
-
64 /* EmitErrors */,
|
|
127386
|
-
"Emit"
|
|
127387
|
-
));
|
|
127388
|
-
return emitDiagnostics;
|
|
127389
|
-
}
|
|
127390
|
-
if (state.write) {
|
|
127391
|
-
emittedOutputs.forEach((name) => listEmittedFile(state, config, name));
|
|
127392
|
-
}
|
|
127393
|
-
updateOutputTimestampsWorker(state, config, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
|
|
127394
|
-
state.diagnostics.delete(projectPath);
|
|
127395
|
-
state.projectStatus.set(projectPath, {
|
|
127396
|
-
type: 1 /* UpToDate */,
|
|
127397
|
-
oldestOutputFileName
|
|
127398
|
-
});
|
|
127399
|
-
afterProgramDone(state, program);
|
|
127400
|
-
step = 5 /* QueueReferencingProjects */;
|
|
127401
|
-
buildResult = resultFlags;
|
|
127402
|
-
return emitDiagnostics;
|
|
127403
|
-
}
|
|
127404
127300
|
function executeSteps(till, cancellationToken, writeFile2, customTransformers) {
|
|
127405
|
-
while (step <= till && step <
|
|
127301
|
+
while (step <= till && step < 3 /* Done */) {
|
|
127406
127302
|
const currentStep = step;
|
|
127407
127303
|
switch (step) {
|
|
127408
127304
|
case 0 /* CreateProgram */:
|
|
127409
127305
|
createProgram2();
|
|
127410
127306
|
break;
|
|
127411
|
-
case 1 /*
|
|
127412
|
-
getSyntaxDiagnostics(cancellationToken);
|
|
127413
|
-
break;
|
|
127414
|
-
case 2 /* SemanticDiagnostics */:
|
|
127415
|
-
getSemanticDiagnostics(cancellationToken);
|
|
127416
|
-
break;
|
|
127417
|
-
case 3 /* Emit */:
|
|
127307
|
+
case 1 /* Emit */:
|
|
127418
127308
|
emit(writeFile2, cancellationToken, customTransformers);
|
|
127419
127309
|
break;
|
|
127420
|
-
case
|
|
127421
|
-
emitBuildInfo(writeFile2, cancellationToken);
|
|
127422
|
-
break;
|
|
127423
|
-
case 5 /* QueueReferencingProjects */:
|
|
127310
|
+
case 2 /* QueueReferencingProjects */:
|
|
127424
127311
|
queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
|
|
127425
127312
|
step++;
|
|
127426
127313
|
break;
|
|
127427
|
-
case
|
|
127314
|
+
case 3 /* Done */:
|
|
127428
127315
|
default:
|
|
127429
127316
|
assertType(step);
|
|
127430
127317
|
}
|
|
@@ -127486,20 +127373,6 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
|
|
|
127486
127373
|
};
|
|
127487
127374
|
}
|
|
127488
127375
|
}
|
|
127489
|
-
if (status.type === 11 /* UpstreamBlocked */) {
|
|
127490
|
-
verboseReportProjectStatus(state, project, status);
|
|
127491
|
-
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
|
|
127492
|
-
projectPendingBuild.delete(projectPath);
|
|
127493
|
-
if (options.verbose) {
|
|
127494
|
-
reportStatus(
|
|
127495
|
-
state,
|
|
127496
|
-
status.upstreamProjectBlocked ? Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_was_not_built : Diagnostics.Skipping_build_of_project_0_because_its_dependency_1_has_errors,
|
|
127497
|
-
project,
|
|
127498
|
-
status.upstreamProjectName
|
|
127499
|
-
);
|
|
127500
|
-
}
|
|
127501
|
-
continue;
|
|
127502
|
-
}
|
|
127503
127376
|
if (status.type === 15 /* ContainerOnly */) {
|
|
127504
127377
|
verboseReportProjectStatus(state, project, status);
|
|
127505
127378
|
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
|
|
@@ -127525,6 +127398,7 @@ function createInvalidatedProjectWithInfo(state, info, buildOrder) {
|
|
|
127525
127398
|
info.projectPath,
|
|
127526
127399
|
info.projectIndex,
|
|
127527
127400
|
info.config,
|
|
127401
|
+
info.status,
|
|
127528
127402
|
buildOrder
|
|
127529
127403
|
) : createUpdateOutputFileStampsProject(
|
|
127530
127404
|
state,
|
|
@@ -127539,11 +127413,6 @@ function getNextInvalidatedProject(state, buildOrder, reportQueue) {
|
|
|
127539
127413
|
if (!info) return info;
|
|
127540
127414
|
return createInvalidatedProjectWithInfo(state, info, buildOrder);
|
|
127541
127415
|
}
|
|
127542
|
-
function listEmittedFile({ write }, proj, file) {
|
|
127543
|
-
if (write && proj.options.listEmittedFiles) {
|
|
127544
|
-
write(`TSFILE: ${file}`);
|
|
127545
|
-
}
|
|
127546
|
-
}
|
|
127547
127416
|
function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed) {
|
|
127548
127417
|
if (options.force) return void 0;
|
|
127549
127418
|
const value = builderPrograms.get(proj);
|
|
@@ -127552,7 +127421,6 @@ function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed)
|
|
|
127552
127421
|
}
|
|
127553
127422
|
function afterProgramDone(state, program) {
|
|
127554
127423
|
if (program) {
|
|
127555
|
-
if (state.write) listFiles(program, state.write);
|
|
127556
127424
|
if (state.host.afterProgramEmitAndDiagnostics) {
|
|
127557
127425
|
state.host.afterProgramEmitAndDiagnostics(program);
|
|
127558
127426
|
}
|
|
@@ -127560,11 +127428,6 @@ function afterProgramDone(state, program) {
|
|
|
127560
127428
|
}
|
|
127561
127429
|
state.projectCompilerOptions = state.baseCompilerOptions;
|
|
127562
127430
|
}
|
|
127563
|
-
function buildErrors(state, resolvedPath, diagnostics, buildResult, errorType) {
|
|
127564
|
-
reportAndStoreErrors(state, resolvedPath, diagnostics);
|
|
127565
|
-
state.projectStatus.set(resolvedPath, { type: 0 /* Unbuildable */, reason: `${errorType} errors` });
|
|
127566
|
-
return { buildResult, step: 4 /* EmitBuildInfo */ };
|
|
127567
|
-
}
|
|
127568
127431
|
function isFileWatcherWithModifiedTime(value) {
|
|
127569
127432
|
return !!value.watcher;
|
|
127570
127433
|
}
|
|
@@ -127622,23 +127485,6 @@ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
|
|
|
127622
127485
|
if (!result) state.outputTimeStamps.set(resolvedConfigFilePath, result = /* @__PURE__ */ new Map());
|
|
127623
127486
|
return result;
|
|
127624
127487
|
}
|
|
127625
|
-
function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
|
|
127626
|
-
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
|
|
127627
|
-
const existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
|
|
127628
|
-
const modifiedTime = getCurrentTime(state.host);
|
|
127629
|
-
if (existing) {
|
|
127630
|
-
existing.buildInfo = buildInfo;
|
|
127631
|
-
existing.modifiedTime = modifiedTime;
|
|
127632
|
-
if (!(resultFlags & 2 /* DeclarationOutputUnchanged */)) existing.latestChangedDtsTime = modifiedTime;
|
|
127633
|
-
} else {
|
|
127634
|
-
state.buildInfoCache.set(resolvedConfigPath, {
|
|
127635
|
-
path: toPath2(state, buildInfoPath),
|
|
127636
|
-
buildInfo,
|
|
127637
|
-
modifiedTime,
|
|
127638
|
-
latestChangedDtsTime: resultFlags & 2 /* DeclarationOutputUnchanged */ ? void 0 : modifiedTime
|
|
127639
|
-
});
|
|
127640
|
-
}
|
|
127641
|
-
}
|
|
127642
127488
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
127643
127489
|
const path = toPath2(state, buildInfoPath);
|
|
127644
127490
|
const existing = state.buildInfoCache.get(resolvedConfigPath);
|
|
@@ -127666,7 +127512,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
|
|
|
127666
127512
|
}
|
|
127667
127513
|
}
|
|
127668
127514
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
127669
|
-
var _a, _b, _c
|
|
127515
|
+
var _a, _b, _c;
|
|
127670
127516
|
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
|
|
127671
127517
|
return {
|
|
127672
127518
|
type: 15 /* ContainerOnly */
|
|
@@ -127684,19 +127530,6 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127684
127530
|
if (refStatus.type === 12 /* ComputingUpstream */ || refStatus.type === 15 /* ContainerOnly */) {
|
|
127685
127531
|
continue;
|
|
127686
127532
|
}
|
|
127687
|
-
if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 11 /* UpstreamBlocked */) {
|
|
127688
|
-
return {
|
|
127689
|
-
type: 11 /* UpstreamBlocked */,
|
|
127690
|
-
upstreamProjectName: ref.path,
|
|
127691
|
-
upstreamProjectBlocked: refStatus.type === 11 /* UpstreamBlocked */
|
|
127692
|
-
};
|
|
127693
|
-
}
|
|
127694
|
-
if (refStatus.type !== 1 /* UpToDate */) {
|
|
127695
|
-
return {
|
|
127696
|
-
type: 10 /* UpstreamOutOfDate */,
|
|
127697
|
-
upstreamProjectName: ref.path
|
|
127698
|
-
};
|
|
127699
|
-
}
|
|
127700
127533
|
if (!force) (referenceStatuses || (referenceStatuses = [])).push({ ref, refStatus, resolvedRefPath, resolvedConfig });
|
|
127701
127534
|
}
|
|
127702
127535
|
}
|
|
@@ -127733,16 +127566,29 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127733
127566
|
version: buildInfo.version
|
|
127734
127567
|
};
|
|
127735
127568
|
}
|
|
127569
|
+
if (!project.options.noCheck && (buildInfo.errors || // TODO: syntax errors????
|
|
127570
|
+
buildInfo.checkPending)) {
|
|
127571
|
+
return {
|
|
127572
|
+
type: 8 /* OutOfDateBuildInfoWithErrors */,
|
|
127573
|
+
buildInfoFile: buildInfoPath
|
|
127574
|
+
};
|
|
127575
|
+
}
|
|
127736
127576
|
if (incrementalBuildInfo) {
|
|
127737
|
-
if (((_a = incrementalBuildInfo.
|
|
127577
|
+
if (!project.options.noCheck && (((_a = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _a.length) || !project.options.noEmit && getEmitDeclarations(project.options) && ((_b = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _b.length))) {
|
|
127578
|
+
return {
|
|
127579
|
+
type: 8 /* OutOfDateBuildInfoWithErrors */,
|
|
127580
|
+
buildInfoFile: buildInfoPath
|
|
127581
|
+
};
|
|
127582
|
+
}
|
|
127583
|
+
if (!project.options.noEmit && (((_c = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _c.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
|
|
127738
127584
|
return {
|
|
127739
|
-
type: 7 /*
|
|
127585
|
+
type: 7 /* OutOfDateBuildInfoWithPendingEmit */,
|
|
127740
127586
|
buildInfoFile: buildInfoPath
|
|
127741
127587
|
};
|
|
127742
127588
|
}
|
|
127743
127589
|
if (!project.options.noEmit && getPendingEmitKind(project.options, incrementalBuildInfo.options || {})) {
|
|
127744
127590
|
return {
|
|
127745
|
-
type:
|
|
127591
|
+
type: 9 /* OutOfDateOptions */,
|
|
127746
127592
|
buildInfoFile: buildInfoPath
|
|
127747
127593
|
};
|
|
127748
127594
|
}
|
|
@@ -127762,7 +127608,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127762
127608
|
reason: `${inputFile} does not exist`
|
|
127763
127609
|
};
|
|
127764
127610
|
}
|
|
127765
|
-
const inputPath =
|
|
127611
|
+
const inputPath = toPath2(state, inputFile);
|
|
127766
127612
|
if (buildInfoTime < inputTime) {
|
|
127767
127613
|
let version2;
|
|
127768
127614
|
let currentVersion;
|
|
@@ -127786,22 +127632,28 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127786
127632
|
newestInputFileName = inputFile;
|
|
127787
127633
|
newestInputFileTime = inputTime;
|
|
127788
127634
|
}
|
|
127789
|
-
|
|
127635
|
+
seenRoots.add(inputPath);
|
|
127790
127636
|
}
|
|
127637
|
+
let existingRoot;
|
|
127791
127638
|
if (incrementalBuildInfo) {
|
|
127792
127639
|
if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
|
|
127793
|
-
|
|
127640
|
+
existingRoot = forEachEntry(
|
|
127794
127641
|
buildInfoVersionMap.roots,
|
|
127795
127642
|
// File was root file when project was built but its not any more
|
|
127796
127643
|
(_resolved, existingRoot2) => !seenRoots.has(existingRoot2) ? existingRoot2 : void 0
|
|
127797
127644
|
);
|
|
127798
|
-
|
|
127799
|
-
|
|
127800
|
-
|
|
127801
|
-
|
|
127802
|
-
|
|
127803
|
-
|
|
127804
|
-
|
|
127645
|
+
} else {
|
|
127646
|
+
existingRoot = forEach(
|
|
127647
|
+
getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host),
|
|
127648
|
+
(root) => !seenRoots.has(root) ? root : void 0
|
|
127649
|
+
);
|
|
127650
|
+
}
|
|
127651
|
+
if (existingRoot) {
|
|
127652
|
+
return {
|
|
127653
|
+
type: 10 /* OutOfDateRoots */,
|
|
127654
|
+
buildInfoFile: buildInfoPath,
|
|
127655
|
+
inputFile: existingRoot
|
|
127656
|
+
};
|
|
127805
127657
|
}
|
|
127806
127658
|
if (!isIncremental) {
|
|
127807
127659
|
const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
@@ -127882,7 +127734,7 @@ function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
|
|
|
127882
127734
|
}
|
|
127883
127735
|
function getUpToDateStatus(state, project, resolvedPath) {
|
|
127884
127736
|
if (project === void 0) {
|
|
127885
|
-
return { type: 0 /* Unbuildable */, reason: "
|
|
127737
|
+
return { type: 0 /* Unbuildable */, reason: "config file deleted mid-build" };
|
|
127886
127738
|
}
|
|
127887
127739
|
const prior = state.projectStatus.get(resolvedPath);
|
|
127888
127740
|
if (prior !== void 0) {
|
|
@@ -127953,7 +127805,6 @@ function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
|
127953
127805
|
});
|
|
127954
127806
|
}
|
|
127955
127807
|
function queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult) {
|
|
127956
|
-
if (buildResult & 124 /* AnyErrors */) return;
|
|
127957
127808
|
if (!config.options.composite) return;
|
|
127958
127809
|
for (let index = projectIndex + 1; index < buildOrder.length; index++) {
|
|
127959
127810
|
const nextProject = buildOrder[index];
|
|
@@ -127982,11 +127833,6 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
|
|
|
127982
127833
|
});
|
|
127983
127834
|
}
|
|
127984
127835
|
break;
|
|
127985
|
-
case 11 /* UpstreamBlocked */:
|
|
127986
|
-
if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
|
|
127987
|
-
clearProjectStatus(state, nextProjectPath);
|
|
127988
|
-
}
|
|
127989
|
-
break;
|
|
127990
127836
|
}
|
|
127991
127837
|
}
|
|
127992
127838
|
addProjToQueue(state, nextProjectPath, 0 /* Update */);
|
|
@@ -128401,21 +128247,28 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
128401
128247
|
relName(state, configFileName),
|
|
128402
128248
|
relName(state, status.fileName)
|
|
128403
128249
|
);
|
|
128404
|
-
case 7 /*
|
|
128250
|
+
case 7 /* OutOfDateBuildInfoWithPendingEmit */:
|
|
128405
128251
|
return reportStatus(
|
|
128406
128252
|
state,
|
|
128407
128253
|
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted,
|
|
128408
128254
|
relName(state, configFileName),
|
|
128409
128255
|
relName(state, status.buildInfoFile)
|
|
128410
128256
|
);
|
|
128411
|
-
case 8 /*
|
|
128257
|
+
case 8 /* OutOfDateBuildInfoWithErrors */:
|
|
128258
|
+
return reportStatus(
|
|
128259
|
+
state,
|
|
128260
|
+
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors,
|
|
128261
|
+
relName(state, configFileName),
|
|
128262
|
+
relName(state, status.buildInfoFile)
|
|
128263
|
+
);
|
|
128264
|
+
case 9 /* OutOfDateOptions */:
|
|
128412
128265
|
return reportStatus(
|
|
128413
128266
|
state,
|
|
128414
128267
|
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_there_is_change_in_compilerOptions,
|
|
128415
128268
|
relName(state, configFileName),
|
|
128416
128269
|
relName(state, status.buildInfoFile)
|
|
128417
128270
|
);
|
|
128418
|
-
case
|
|
128271
|
+
case 10 /* OutOfDateRoots */:
|
|
128419
128272
|
return reportStatus(
|
|
128420
128273
|
state,
|
|
128421
128274
|
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
|
|
@@ -128446,24 +128299,17 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
128446
128299
|
Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
|
|
128447
128300
|
relName(state, configFileName)
|
|
128448
128301
|
);
|
|
128449
|
-
case
|
|
128302
|
+
case 11 /* UpstreamOutOfDate */:
|
|
128450
128303
|
return reportStatus(
|
|
128451
128304
|
state,
|
|
128452
128305
|
Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
|
|
128453
128306
|
relName(state, configFileName),
|
|
128454
128307
|
relName(state, status.upstreamProjectName)
|
|
128455
128308
|
);
|
|
128456
|
-
case 11 /* UpstreamBlocked */:
|
|
128457
|
-
return reportStatus(
|
|
128458
|
-
state,
|
|
128459
|
-
status.upstreamProjectBlocked ? Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_was_not_built : Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors,
|
|
128460
|
-
relName(state, configFileName),
|
|
128461
|
-
relName(state, status.upstreamProjectName)
|
|
128462
|
-
);
|
|
128463
128309
|
case 0 /* Unbuildable */:
|
|
128464
128310
|
return reportStatus(
|
|
128465
128311
|
state,
|
|
128466
|
-
Diagnostics.
|
|
128312
|
+
Diagnostics.Project_0_is_out_of_date_because_1,
|
|
128467
128313
|
relName(state, configFileName),
|
|
128468
128314
|
status.reason
|
|
128469
128315
|
);
|