typescript 5.6.0-dev.20240613 → 5.6.0-dev.20240614
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 +406 -550
- package/lib/tsserver.js +0 -12
- package/lib/typescript.d.ts +55 -112
- package/lib/typescript.js +886 -782
- 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.20240614`;
|
|
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}'?"),
|
|
@@ -7256,6 +7234,8 @@ var Diagnostics = {
|
|
|
7256
7234
|
Exiting_conditional_exports: diag(6416, 3 /* Message */, "Exiting_conditional_exports_6416", "Exiting conditional exports."),
|
|
7257
7235
|
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
7236
|
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}."),
|
|
7237
|
+
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."),
|
|
7238
|
+
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
7239
|
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
7240
|
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
7241
|
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 +11083,8 @@ function textSpanIsEmpty(span) {
|
|
|
11103
11083
|
function textSpanContainsPosition(span, position) {
|
|
11104
11084
|
return position >= span.start && position < textSpanEnd(span);
|
|
11105
11085
|
}
|
|
11106
|
-
function textRangeContainsPositionInclusive(
|
|
11107
|
-
return position >=
|
|
11086
|
+
function textRangeContainsPositionInclusive(range, position) {
|
|
11087
|
+
return position >= range.pos && position <= range.end;
|
|
11108
11088
|
}
|
|
11109
11089
|
function createTextSpan(start, length2) {
|
|
11110
11090
|
if (start < 0) {
|
|
@@ -14755,23 +14735,6 @@ function isFunctionSymbol(symbol) {
|
|
|
14755
14735
|
const decl = symbol.valueDeclaration;
|
|
14756
14736
|
return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
|
|
14757
14737
|
}
|
|
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
14738
|
function tryGetModuleSpecifierFromDeclaration(node) {
|
|
14776
14739
|
var _a, _b;
|
|
14777
14740
|
switch (node.kind) {
|
|
@@ -17489,8 +17452,8 @@ function walkTreeForJSXTags(node) {
|
|
|
17489
17452
|
function isFileModuleFromUsingJSXTag(file) {
|
|
17490
17453
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
|
|
17491
17454
|
}
|
|
17492
|
-
function isFileForcedToBeModuleByFormat(file
|
|
17493
|
-
return (
|
|
17455
|
+
function isFileForcedToBeModuleByFormat(file) {
|
|
17456
|
+
return (file.impliedNodeFormat === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
|
|
17494
17457
|
}
|
|
17495
17458
|
function getSetExternalModuleIndicator(options) {
|
|
17496
17459
|
switch (getEmitModuleDetectionKind(options)) {
|
|
@@ -17509,14 +17472,10 @@ function getSetExternalModuleIndicator(options) {
|
|
|
17509
17472
|
}
|
|
17510
17473
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
17511
17474
|
const combined = or(...checks);
|
|
17512
|
-
const callback = (file) => void (file.externalModuleIndicator = combined(file
|
|
17475
|
+
const callback = (file) => void (file.externalModuleIndicator = combined(file));
|
|
17513
17476
|
return callback;
|
|
17514
17477
|
}
|
|
17515
17478
|
}
|
|
17516
|
-
function importSyntaxAffectsModuleResolution(options) {
|
|
17517
|
-
const moduleResolution = getEmitModuleResolutionKind(options);
|
|
17518
|
-
return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
|
|
17519
|
-
}
|
|
17520
17479
|
function createComputedCompilerOptions(options) {
|
|
17521
17480
|
return options;
|
|
17522
17481
|
}
|
|
@@ -26679,7 +26638,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
|
|
|
26679
26638
|
if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
26680
26639
|
let namedBindings;
|
|
26681
26640
|
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
26682
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ ||
|
|
26641
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
26683
26642
|
const helpers = getEmitHelpers(sourceFile);
|
|
26684
26643
|
if (helpers) {
|
|
26685
26644
|
const helperNames = [];
|
|
@@ -26744,7 +26703,8 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
|
|
|
26744
26703
|
if (externalHelpersModuleName) {
|
|
26745
26704
|
return externalHelpersModuleName;
|
|
26746
26705
|
}
|
|
26747
|
-
|
|
26706
|
+
const moduleKind = getEmitModuleKind(compilerOptions);
|
|
26707
|
+
let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
|
|
26748
26708
|
if (!create) {
|
|
26749
26709
|
const helpers = getEmitHelpers(node);
|
|
26750
26710
|
if (helpers) {
|
|
@@ -27918,7 +27878,7 @@ function setExternalModuleIndicator(sourceFile) {
|
|
|
27918
27878
|
sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile);
|
|
27919
27879
|
}
|
|
27920
27880
|
function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) {
|
|
27921
|
-
var _a, _b
|
|
27881
|
+
var _a, _b;
|
|
27922
27882
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
27923
27883
|
tracing.Phase.Parse,
|
|
27924
27884
|
"createSourceFile",
|
|
@@ -27928,7 +27888,6 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
27928
27888
|
);
|
|
27929
27889
|
mark("beforeParse");
|
|
27930
27890
|
let result;
|
|
27931
|
-
(_b = perfLogger) == null ? void 0 : _b.logStartParseSourceFile(fileName);
|
|
27932
27891
|
const {
|
|
27933
27892
|
languageVersion,
|
|
27934
27893
|
setExternalModuleIndicator: overrideSetExternalModuleIndicator,
|
|
@@ -27964,10 +27923,9 @@ function createSourceFile(fileName, sourceText, languageVersionOrOptions, setPar
|
|
|
27964
27923
|
jsDocParsingMode
|
|
27965
27924
|
);
|
|
27966
27925
|
}
|
|
27967
|
-
(_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile();
|
|
27968
27926
|
mark("afterParse");
|
|
27969
27927
|
measure("Parse", "beforeParse", "afterParse");
|
|
27970
|
-
(
|
|
27928
|
+
(_b = tracing) == null ? void 0 : _b.pop();
|
|
27971
27929
|
return result;
|
|
27972
27930
|
}
|
|
27973
27931
|
function parseIsolatedEntityName(text, languageVersion) {
|
|
@@ -39452,7 +39410,6 @@ function resolveLibrary(libraryName, resolveFrom, compilerOptions, host, cache)
|
|
|
39452
39410
|
return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host, cache);
|
|
39453
39411
|
}
|
|
39454
39412
|
function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
39455
|
-
var _a, _b, _c;
|
|
39456
39413
|
const traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
39457
39414
|
if (redirectedReference) {
|
|
39458
39415
|
compilerOptions = redirectedReference.commandLine.options;
|
|
@@ -39481,7 +39438,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
39481
39438
|
trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]);
|
|
39482
39439
|
}
|
|
39483
39440
|
}
|
|
39484
|
-
(_a = perfLogger) == null ? void 0 : _a.logStartResolveModule(moduleName);
|
|
39485
39441
|
switch (moduleResolution) {
|
|
39486
39442
|
case 3 /* Node16 */:
|
|
39487
39443
|
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -39501,8 +39457,6 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
39501
39457
|
default:
|
|
39502
39458
|
return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`);
|
|
39503
39459
|
}
|
|
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
39460
|
if (cache && !cache.isReadonly) {
|
|
39507
39461
|
cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
|
|
39508
39462
|
if (!isExternalModuleNameRelative(moduleName)) {
|
|
@@ -41205,11 +41159,8 @@ function createFlowNode(flags, node, antecedent) {
|
|
|
41205
41159
|
}
|
|
41206
41160
|
var binder = /* @__PURE__ */ createBinder();
|
|
41207
41161
|
function bindSourceFile(file, options) {
|
|
41208
|
-
var _a, _b;
|
|
41209
41162
|
mark("beforeBind");
|
|
41210
|
-
(_a = perfLogger) == null ? void 0 : _a.logStartBindFile("" + file.fileName);
|
|
41211
41163
|
binder(file, options);
|
|
41212
|
-
(_b = perfLogger) == null ? void 0 : _b.logStopBindFile();
|
|
41213
41164
|
mark("afterBind");
|
|
41214
41165
|
measure("Bind", "beforeBind", "afterBind");
|
|
41215
41166
|
}
|
|
@@ -44177,15 +44128,13 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu
|
|
|
44177
44128
|
}
|
|
44178
44129
|
|
|
44179
44130
|
// src/compiler/moduleSpecifiers.ts
|
|
44180
|
-
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding },
|
|
44131
|
+
function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
|
|
44181
44132
|
const filePreferredEnding = getPreferredEnding();
|
|
44182
44133
|
return {
|
|
44183
44134
|
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
44135
|
getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
|
|
44185
|
-
const
|
|
44186
|
-
|
|
44187
|
-
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
44188
|
-
if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
44136
|
+
const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
|
|
44137
|
+
if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
|
|
44189
44138
|
if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
|
|
44190
44139
|
return [3 /* TsExtension */, 2 /* JsExtension */];
|
|
44191
44140
|
}
|
|
@@ -44216,7 +44165,7 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
|
|
|
44216
44165
|
}
|
|
44217
44166
|
return getModuleSpecifierEndingPreference(
|
|
44218
44167
|
importModuleSpecifierEnding,
|
|
44219
|
-
resolutionMode ??
|
|
44168
|
+
resolutionMode ?? importingSourceFile.impliedNodeFormat,
|
|
44220
44169
|
compilerOptions,
|
|
44221
44170
|
isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
|
|
44222
44171
|
);
|
|
@@ -44274,16 +44223,12 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
|
|
|
44274
44223
|
}
|
|
44275
44224
|
function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
|
|
44276
44225
|
const info = getInfo(importingSourceFile.fileName, host);
|
|
44277
|
-
const preferences = getModuleSpecifierPreferences(userPreferences,
|
|
44226
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
|
|
44278
44227
|
const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
|
|
44279
44228
|
host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
|
|
44280
44229
|
(reason) => {
|
|
44281
44230
|
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
|
-
}
|
|
44231
|
+
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions)) return void 0;
|
|
44287
44232
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
44288
44233
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
44289
44234
|
}
|
|
@@ -44798,7 +44743,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
44798
44743
|
if (!parts) {
|
|
44799
44744
|
return void 0;
|
|
44800
44745
|
}
|
|
44801
|
-
const preferences = getModuleSpecifierPreferences(userPreferences,
|
|
44746
|
+
const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
|
|
44802
44747
|
const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
|
|
44803
44748
|
let moduleSpecifier = path;
|
|
44804
44749
|
let isPackageRootPath = false;
|
|
@@ -44848,7 +44793,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
44848
44793
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
44849
44794
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
44850
44795
|
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
44851
|
-
const importMode = overrideMode ||
|
|
44796
|
+
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
44852
44797
|
if (getResolvePackageJsonExports(options)) {
|
|
44853
44798
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
44854
44799
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
@@ -44998,9 +44943,6 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
|
|
|
44998
44943
|
function isPathRelativeToParent(path) {
|
|
44999
44944
|
return startsWith(path, "..");
|
|
45000
44945
|
}
|
|
45001
|
-
function getDefaultResolutionModeForFile(file, host, compilerOptions) {
|
|
45002
|
-
return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
|
|
45003
|
-
}
|
|
45004
44946
|
|
|
45005
44947
|
// src/compiler/checker.ts
|
|
45006
44948
|
var ambientModuleSymbolRegex = /^".+"$/;
|
|
@@ -47223,28 +47165,22 @@ function createTypeChecker(host) {
|
|
|
47223
47165
|
function isSyntacticDefault(node) {
|
|
47224
47166
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
47225
47167
|
}
|
|
47226
|
-
function
|
|
47227
|
-
return isStringLiteralLike(usage) ? host.
|
|
47168
|
+
function getUsageModeForExpression(usage) {
|
|
47169
|
+
return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
47228
47170
|
}
|
|
47229
47171
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
47230
47172
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
47231
47173
|
}
|
|
47232
|
-
function
|
|
47233
|
-
|
|
47234
|
-
|
|
47235
|
-
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
47236
|
-
}
|
|
47237
|
-
return false;
|
|
47174
|
+
function isOnlyImportedAsDefault(usage) {
|
|
47175
|
+
const usageMode = getUsageModeForExpression(usage);
|
|
47176
|
+
return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
|
|
47238
47177
|
}
|
|
47239
47178
|
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;
|
|
47179
|
+
const usageMode = file && getUsageModeForExpression(usage);
|
|
47180
|
+
if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
47181
|
+
const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
47182
|
+
if (usageMode === 99 /* ESNext */ || result) {
|
|
47183
|
+
return result;
|
|
47248
47184
|
}
|
|
47249
47185
|
}
|
|
47250
47186
|
if (!allowSyntheticDefaultImports) {
|
|
@@ -47303,7 +47239,7 @@ function createTypeChecker(host) {
|
|
|
47303
47239
|
if (!specifier) {
|
|
47304
47240
|
return exportDefaultSymbol;
|
|
47305
47241
|
}
|
|
47306
|
-
const hasDefaultOnly =
|
|
47242
|
+
const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
|
|
47307
47243
|
const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
|
|
47308
47244
|
if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
|
|
47309
47245
|
if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
|
|
@@ -47505,7 +47441,7 @@ function createTypeChecker(host) {
|
|
|
47505
47441
|
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
47506
47442
|
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
47507
47443
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
47508
|
-
if (
|
|
47444
|
+
if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
47509
47445
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
47510
47446
|
}
|
|
47511
47447
|
}
|
|
@@ -48109,7 +48045,7 @@ function createTypeChecker(host) {
|
|
|
48109
48045
|
/*requireStringLiteralLikeArgument*/
|
|
48110
48046
|
true
|
|
48111
48047
|
) ? 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) :
|
|
48048
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
48113
48049
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
48114
48050
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
48115
48051
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -48353,7 +48289,7 @@ function createTypeChecker(host) {
|
|
|
48353
48289
|
return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
|
|
48354
48290
|
}
|
|
48355
48291
|
const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
48356
|
-
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(
|
|
48292
|
+
const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat);
|
|
48357
48293
|
if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
|
|
48358
48294
|
let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
|
|
48359
48295
|
if (!sigs || !sigs.length) {
|
|
@@ -50959,10 +50895,8 @@ function createTypeChecker(host) {
|
|
|
50959
50895
|
}
|
|
50960
50896
|
return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
|
|
50961
50897
|
}
|
|
50962
|
-
const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
|
|
50963
|
-
const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
|
|
50964
50898
|
const contextFile = context.enclosingFile;
|
|
50965
|
-
const resolutionMode = overrideImportMode ||
|
|
50899
|
+
const resolutionMode = overrideImportMode || (contextFile == null ? void 0 : contextFile.impliedNodeFormat);
|
|
50966
50900
|
const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
|
|
50967
50901
|
const links = getSymbolLinks(symbol);
|
|
50968
50902
|
let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
|
|
@@ -51931,8 +51865,28 @@ function createTypeChecker(host) {
|
|
|
51931
51865
|
} else {
|
|
51932
51866
|
const type = getWidenedType(getRegularTypeOfExpression(node.expression));
|
|
51933
51867
|
const computedPropertyNameType = typeToTypeNodeHelper(type, context);
|
|
51934
|
-
|
|
51935
|
-
|
|
51868
|
+
let literal;
|
|
51869
|
+
if (isLiteralTypeNode(computedPropertyNameType)) {
|
|
51870
|
+
literal = computedPropertyNameType.literal;
|
|
51871
|
+
} else {
|
|
51872
|
+
const evaluated = evaluateEntityNameExpression(node.expression);
|
|
51873
|
+
const literalNode = typeof evaluated.value === "string" ? factory.createStringLiteral(
|
|
51874
|
+
evaluated.value,
|
|
51875
|
+
/*isSingleQuote*/
|
|
51876
|
+
void 0
|
|
51877
|
+
) : typeof evaluated.value === "number" ? factory.createNumericLiteral(
|
|
51878
|
+
evaluated.value,
|
|
51879
|
+
/*numericLiteralFlags*/
|
|
51880
|
+
0
|
|
51881
|
+
) : void 0;
|
|
51882
|
+
if (!literalNode) {
|
|
51883
|
+
if (isImportTypeNode(computedPropertyNameType)) {
|
|
51884
|
+
trackComputedName(node.expression, context.enclosingDeclaration, context);
|
|
51885
|
+
}
|
|
51886
|
+
return node;
|
|
51887
|
+
}
|
|
51888
|
+
literal = literalNode;
|
|
51889
|
+
}
|
|
51936
51890
|
if (literal.kind === 11 /* StringLiteral */ && isIdentifierText(literal.text, getEmitScriptTarget(compilerOptions))) {
|
|
51937
51891
|
return factory.createIdentifier(literal.text);
|
|
51938
51892
|
}
|
|
@@ -75434,7 +75388,7 @@ function createTypeChecker(host) {
|
|
|
75434
75388
|
return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
|
|
75435
75389
|
}
|
|
75436
75390
|
function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
|
|
75437
|
-
const hasDefaultOnly =
|
|
75391
|
+
const hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
|
|
75438
75392
|
if (hasDefaultOnly && type && !isErrorType(type)) {
|
|
75439
75393
|
const synthType = type;
|
|
75440
75394
|
if (!synthType.defaultOnlyType) {
|
|
@@ -80661,7 +80615,7 @@ function createTypeChecker(host) {
|
|
|
80661
80615
|
});
|
|
80662
80616
|
}
|
|
80663
80617
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
80664
|
-
if (
|
|
80618
|
+
if (moduleKind >= 5 /* ES2015 */ && !(moduleKind >= 100 /* Node16 */ && getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
80665
80619
|
return;
|
|
80666
80620
|
}
|
|
80667
80621
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -82082,7 +82036,7 @@ function createTypeChecker(host) {
|
|
|
82082
82036
|
}
|
|
82083
82037
|
}
|
|
82084
82038
|
function checkClassNameCollisionWithObject(name) {
|
|
82085
|
-
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" &&
|
|
82039
|
+
if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
82086
82040
|
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
|
|
82087
82041
|
}
|
|
82088
82042
|
}
|
|
@@ -83162,7 +83116,7 @@ function createTypeChecker(host) {
|
|
|
83162
83116
|
getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
|
|
83163
83117
|
}
|
|
83164
83118
|
}
|
|
83165
|
-
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ &&
|
|
83119
|
+
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83166
83120
|
const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
|
|
83167
83121
|
if (exportModifier) {
|
|
83168
83122
|
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
@@ -83382,10 +83336,8 @@ function createTypeChecker(host) {
|
|
|
83382
83336
|
}
|
|
83383
83337
|
}
|
|
83384
83338
|
}
|
|
83385
|
-
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) &&
|
|
83339
|
+
if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83386
83340
|
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
83341
|
}
|
|
83390
83342
|
}
|
|
83391
83343
|
if (isImportSpecifier(node)) {
|
|
@@ -83426,7 +83378,7 @@ function createTypeChecker(host) {
|
|
|
83426
83378
|
checkAliasSymbol(node);
|
|
83427
83379
|
if (node.kind === 276 /* ImportSpecifier */) {
|
|
83428
83380
|
checkModuleExportName(node.propertyName);
|
|
83429
|
-
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) &&
|
|
83381
|
+
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83430
83382
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
83431
83383
|
}
|
|
83432
83384
|
}
|
|
@@ -83448,7 +83400,7 @@ function createTypeChecker(host) {
|
|
|
83448
83400
|
if (validForTypeAttributes && override) {
|
|
83449
83401
|
return;
|
|
83450
83402
|
}
|
|
83451
|
-
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier &&
|
|
83403
|
+
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
83452
83404
|
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
83453
83405
|
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
83406
|
return grammarErrorOnNode(node, message);
|
|
@@ -83481,7 +83433,7 @@ function createTypeChecker(host) {
|
|
|
83481
83433
|
if (importClause.namedBindings) {
|
|
83482
83434
|
if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
|
|
83483
83435
|
checkImportBinding(importClause.namedBindings);
|
|
83484
|
-
if (
|
|
83436
|
+
if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) {
|
|
83485
83437
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
83486
83438
|
}
|
|
83487
83439
|
} else {
|
|
@@ -83521,7 +83473,7 @@ function createTypeChecker(host) {
|
|
|
83521
83473
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
83522
83474
|
}
|
|
83523
83475
|
} else {
|
|
83524
|
-
if (5 /* ES2015 */
|
|
83476
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
83525
83477
|
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
83478
|
}
|
|
83527
83479
|
}
|
|
@@ -83551,7 +83503,7 @@ function createTypeChecker(host) {
|
|
|
83551
83503
|
checkAliasSymbol(node.exportClause);
|
|
83552
83504
|
checkModuleExportName(node.exportClause.name);
|
|
83553
83505
|
}
|
|
83554
|
-
if (
|
|
83506
|
+
if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
83555
83507
|
if (node.exportClause) {
|
|
83556
83508
|
if (getESModuleInterop(compilerOptions)) {
|
|
83557
83509
|
checkExternalEmitHelpers(node, 65536 /* ImportStar */);
|
|
@@ -83610,7 +83562,7 @@ function createTypeChecker(host) {
|
|
|
83610
83562
|
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
83611
83563
|
}
|
|
83612
83564
|
} else {
|
|
83613
|
-
if (getESModuleInterop(compilerOptions) &&
|
|
83565
|
+
if (getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleExportNameIsDefault(node.propertyName || node.name)) {
|
|
83614
83566
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
83615
83567
|
}
|
|
83616
83568
|
}
|
|
@@ -83636,7 +83588,7 @@ function createTypeChecker(host) {
|
|
|
83636
83588
|
if (typeAnnotationNode) {
|
|
83637
83589
|
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
|
|
83638
83590
|
}
|
|
83639
|
-
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax &&
|
|
83591
|
+
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
|
|
83640
83592
|
if (node.expression.kind === 80 /* Identifier */) {
|
|
83641
83593
|
const id = node.expression;
|
|
83642
83594
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
@@ -83716,7 +83668,7 @@ function createTypeChecker(host) {
|
|
|
83716
83668
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
83717
83669
|
}
|
|
83718
83670
|
if (node.isExportEquals) {
|
|
83719
|
-
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ &&
|
|
83671
|
+
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
83672
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
83721
83673
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
83722
83674
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -83777,6 +83729,9 @@ function createTypeChecker(host) {
|
|
|
83777
83729
|
}
|
|
83778
83730
|
}
|
|
83779
83731
|
function checkSourceElementWorker(node) {
|
|
83732
|
+
if (getNodeCheckFlags(node) & 8388608 /* PartiallyTypeChecked */) {
|
|
83733
|
+
return;
|
|
83734
|
+
}
|
|
83780
83735
|
if (canHaveJSDoc(node)) {
|
|
83781
83736
|
forEach(node.jsDoc, ({ comment, tags }) => {
|
|
83782
83737
|
checkJSDocCommentWorker(comment);
|
|
@@ -84120,19 +84075,21 @@ function createTypeChecker(host) {
|
|
|
84120
84075
|
currentNode = saveCurrentNode;
|
|
84121
84076
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
84122
84077
|
}
|
|
84123
|
-
function checkSourceFile(node) {
|
|
84078
|
+
function checkSourceFile(node, nodesToCheck) {
|
|
84124
84079
|
var _a, _b;
|
|
84125
84080
|
(_a = tracing) == null ? void 0 : _a.push(
|
|
84126
84081
|
tracing.Phase.Check,
|
|
84127
|
-
"checkSourceFile",
|
|
84082
|
+
nodesToCheck ? "checkSourceFileNodes" : "checkSourceFile",
|
|
84128
84083
|
{ path: node.path },
|
|
84129
84084
|
/*separateBeginAndEnd*/
|
|
84130
84085
|
true
|
|
84131
84086
|
);
|
|
84132
|
-
|
|
84133
|
-
|
|
84134
|
-
mark(
|
|
84135
|
-
|
|
84087
|
+
const beforeMark = nodesToCheck ? "beforeCheckNodes" : "beforeCheck";
|
|
84088
|
+
const afterMark = nodesToCheck ? "afterCheckNodes" : "afterCheck";
|
|
84089
|
+
mark(beforeMark);
|
|
84090
|
+
nodesToCheck ? checkSourceFileNodesWorker(node, nodesToCheck) : checkSourceFileWorker(node);
|
|
84091
|
+
mark(afterMark);
|
|
84092
|
+
measure("Check", beforeMark, afterMark);
|
|
84136
84093
|
(_b = tracing) == null ? void 0 : _b.pop();
|
|
84137
84094
|
}
|
|
84138
84095
|
function unusedIsError(kind, isAmbient) {
|
|
@@ -84163,6 +84120,13 @@ function createTypeChecker(host) {
|
|
|
84163
84120
|
clear(potentialWeakMapSetCollisions);
|
|
84164
84121
|
clear(potentialReflectCollisions);
|
|
84165
84122
|
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
84123
|
+
if (links.flags & 8388608 /* PartiallyTypeChecked */) {
|
|
84124
|
+
potentialThisCollisions = links.potentialThisCollisions;
|
|
84125
|
+
potentialNewTargetCollisions = links.potentialNewTargetCollisions;
|
|
84126
|
+
potentialWeakMapSetCollisions = links.potentialWeakMapSetCollisions;
|
|
84127
|
+
potentialReflectCollisions = links.potentialReflectCollisions;
|
|
84128
|
+
potentialUnusedRenamedBindingElementsInTypes = links.potentialUnusedRenamedBindingElementsInTypes;
|
|
84129
|
+
}
|
|
84166
84130
|
forEach(node.statements, checkSourceElement);
|
|
84167
84131
|
checkSourceElement(node.endOfFileToken);
|
|
84168
84132
|
checkDeferredNodes(node);
|
|
@@ -84203,10 +84167,38 @@ function createTypeChecker(host) {
|
|
|
84203
84167
|
links.flags |= 1 /* TypeChecked */;
|
|
84204
84168
|
}
|
|
84205
84169
|
}
|
|
84206
|
-
function
|
|
84170
|
+
function checkSourceFileNodesWorker(file, nodes) {
|
|
84171
|
+
const links = getNodeLinks(file);
|
|
84172
|
+
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
84173
|
+
if (skipTypeChecking(file, compilerOptions, host)) {
|
|
84174
|
+
return;
|
|
84175
|
+
}
|
|
84176
|
+
checkGrammarSourceFile(file);
|
|
84177
|
+
clear(potentialThisCollisions);
|
|
84178
|
+
clear(potentialNewTargetCollisions);
|
|
84179
|
+
clear(potentialWeakMapSetCollisions);
|
|
84180
|
+
clear(potentialReflectCollisions);
|
|
84181
|
+
clear(potentialUnusedRenamedBindingElementsInTypes);
|
|
84182
|
+
forEach(nodes, checkSourceElement);
|
|
84183
|
+
checkDeferredNodes(file);
|
|
84184
|
+
(links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions);
|
|
84185
|
+
(links.potentialNewTargetCollisions || (links.potentialNewTargetCollisions = [])).push(...potentialNewTargetCollisions);
|
|
84186
|
+
(links.potentialWeakMapSetCollisions || (links.potentialWeakMapSetCollisions = [])).push(...potentialWeakMapSetCollisions);
|
|
84187
|
+
(links.potentialReflectCollisions || (links.potentialReflectCollisions = [])).push(...potentialReflectCollisions);
|
|
84188
|
+
(links.potentialUnusedRenamedBindingElementsInTypes || (links.potentialUnusedRenamedBindingElementsInTypes = [])).push(
|
|
84189
|
+
...potentialUnusedRenamedBindingElementsInTypes
|
|
84190
|
+
);
|
|
84191
|
+
links.flags |= 8388608 /* PartiallyTypeChecked */;
|
|
84192
|
+
for (const node of nodes) {
|
|
84193
|
+
const nodeLinks2 = getNodeLinks(node);
|
|
84194
|
+
nodeLinks2.flags |= 8388608 /* PartiallyTypeChecked */;
|
|
84195
|
+
}
|
|
84196
|
+
}
|
|
84197
|
+
}
|
|
84198
|
+
function getDiagnostics(sourceFile, ct, nodesToCheck) {
|
|
84207
84199
|
try {
|
|
84208
84200
|
cancellationToken = ct;
|
|
84209
|
-
return getDiagnosticsWorker(sourceFile);
|
|
84201
|
+
return getDiagnosticsWorker(sourceFile, nodesToCheck);
|
|
84210
84202
|
} finally {
|
|
84211
84203
|
cancellationToken = void 0;
|
|
84212
84204
|
}
|
|
@@ -84217,20 +84209,23 @@ function createTypeChecker(host) {
|
|
|
84217
84209
|
}
|
|
84218
84210
|
deferredDiagnosticsCallbacks = [];
|
|
84219
84211
|
}
|
|
84220
|
-
function checkSourceFileWithEagerDiagnostics(sourceFile) {
|
|
84212
|
+
function checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck) {
|
|
84221
84213
|
ensurePendingDiagnosticWorkComplete();
|
|
84222
84214
|
const oldAddLazyDiagnostics = addLazyDiagnostic;
|
|
84223
84215
|
addLazyDiagnostic = (cb) => cb();
|
|
84224
|
-
checkSourceFile(sourceFile);
|
|
84216
|
+
checkSourceFile(sourceFile, nodesToCheck);
|
|
84225
84217
|
addLazyDiagnostic = oldAddLazyDiagnostics;
|
|
84226
84218
|
}
|
|
84227
|
-
function getDiagnosticsWorker(sourceFile) {
|
|
84219
|
+
function getDiagnosticsWorker(sourceFile, nodesToCheck) {
|
|
84228
84220
|
if (sourceFile) {
|
|
84229
84221
|
ensurePendingDiagnosticWorkComplete();
|
|
84230
84222
|
const previousGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
|
|
84231
84223
|
const previousGlobalDiagnosticsSize = previousGlobalDiagnostics.length;
|
|
84232
|
-
checkSourceFileWithEagerDiagnostics(sourceFile);
|
|
84224
|
+
checkSourceFileWithEagerDiagnostics(sourceFile, nodesToCheck);
|
|
84233
84225
|
const semanticDiagnostics = diagnostics.getDiagnostics(sourceFile.fileName);
|
|
84226
|
+
if (nodesToCheck) {
|
|
84227
|
+
return semanticDiagnostics;
|
|
84228
|
+
}
|
|
84234
84229
|
const currentGlobalDiagnostics = diagnostics.getGlobalDiagnostics();
|
|
84235
84230
|
if (currentGlobalDiagnostics !== previousGlobalDiagnostics) {
|
|
84236
84231
|
const deferredGlobalDiagnostics = relativeComplement(previousGlobalDiagnostics, currentGlobalDiagnostics, compareDiagnostics);
|
|
@@ -84240,7 +84235,7 @@ function createTypeChecker(host) {
|
|
|
84240
84235
|
}
|
|
84241
84236
|
return semanticDiagnostics;
|
|
84242
84237
|
}
|
|
84243
|
-
forEach(host.getSourceFiles(), checkSourceFileWithEagerDiagnostics);
|
|
84238
|
+
forEach(host.getSourceFiles(), (file) => checkSourceFileWithEagerDiagnostics(file));
|
|
84244
84239
|
return diagnostics.getDiagnostics();
|
|
84245
84240
|
}
|
|
84246
84241
|
function getGlobalDiagnostics() {
|
|
@@ -86219,7 +86214,7 @@ function createTypeChecker(host) {
|
|
|
86219
86214
|
break;
|
|
86220
86215
|
case 95 /* ExportKeyword */:
|
|
86221
86216
|
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 */ &&
|
|
86217
|
+
node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
|
|
86223
86218
|
return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
|
86224
86219
|
}
|
|
86225
86220
|
if (flags & 32 /* Export */) {
|
|
@@ -87128,7 +87123,7 @@ function createTypeChecker(host) {
|
|
|
87128
87123
|
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
87124
|
return grammarErrorOnNode(node.exclamationToken, message);
|
|
87130
87125
|
}
|
|
87131
|
-
if (
|
|
87126
|
+
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
87127
|
checkESModuleMarker(node.name);
|
|
87133
87128
|
}
|
|
87134
87129
|
return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
|
|
@@ -87629,9 +87624,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
|
|
|
87629
87624
|
isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
|
|
87630
87625
|
fileExists: (fileName) => host.fileExists(fileName),
|
|
87631
87626
|
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)
|
|
87627
|
+
readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
|
|
87635
87628
|
};
|
|
87636
87629
|
}
|
|
87637
87630
|
var SymbolTrackerImpl = class _SymbolTrackerImpl {
|
|
@@ -107304,7 +107297,7 @@ function transformModule(context) {
|
|
|
107304
107297
|
case 354 /* PartiallyEmittedExpression */:
|
|
107305
107298
|
return visitPartiallyEmittedExpression(node, valueIsDiscarded);
|
|
107306
107299
|
case 213 /* CallExpression */:
|
|
107307
|
-
if (isImportCall(node) &&
|
|
107300
|
+
if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
|
|
107308
107301
|
return visitImportCallExpression(node);
|
|
107309
107302
|
}
|
|
107310
107303
|
break;
|
|
@@ -110300,8 +110293,8 @@ function transformECMAScriptModule(context) {
|
|
|
110300
110293
|
}
|
|
110301
110294
|
}
|
|
110302
110295
|
|
|
110303
|
-
// src/compiler/transformers/module/
|
|
110304
|
-
function
|
|
110296
|
+
// src/compiler/transformers/module/node.ts
|
|
110297
|
+
function transformNodeModule(context) {
|
|
110305
110298
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
110306
110299
|
const previousOnEmitNode = context.onEmitNode;
|
|
110307
110300
|
const esmTransform = transformECMAScriptModule(context);
|
|
@@ -110312,7 +110305,6 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110312
110305
|
const cjsTransform = transformModule(context);
|
|
110313
110306
|
const cjsOnSubstituteNode = context.onSubstituteNode;
|
|
110314
110307
|
const cjsOnEmitNode = context.onEmitNode;
|
|
110315
|
-
const getEmitModuleFormatOfFile = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
|
|
110316
110308
|
context.onSubstituteNode = onSubstituteNode;
|
|
110317
110309
|
context.onEmitNode = onEmitNode;
|
|
110318
110310
|
context.enableSubstitution(307 /* SourceFile */);
|
|
@@ -110327,7 +110319,7 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110327
110319
|
if (!currentSourceFile) {
|
|
110328
110320
|
return previousOnSubstituteNode(hint, node);
|
|
110329
110321
|
}
|
|
110330
|
-
if (
|
|
110322
|
+
if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
110331
110323
|
return esmOnSubstituteNode(hint, node);
|
|
110332
110324
|
}
|
|
110333
110325
|
return cjsOnSubstituteNode(hint, node);
|
|
@@ -110340,13 +110332,13 @@ function transformImpliedNodeFormatDependentModule(context) {
|
|
|
110340
110332
|
if (!currentSourceFile) {
|
|
110341
110333
|
return previousOnEmitNode(hint, node, emitCallback);
|
|
110342
110334
|
}
|
|
110343
|
-
if (
|
|
110335
|
+
if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
|
|
110344
110336
|
return esmOnEmitNode(hint, node, emitCallback);
|
|
110345
110337
|
}
|
|
110346
110338
|
return cjsOnEmitNode(hint, node, emitCallback);
|
|
110347
110339
|
}
|
|
110348
110340
|
function getModuleTransformForFile(file) {
|
|
110349
|
-
return
|
|
110341
|
+
return file.impliedNodeFormat === 99 /* ESNext */ ? esmTransform : cjsTransform;
|
|
110350
110342
|
}
|
|
110351
110343
|
function transformSourceFile(node) {
|
|
110352
110344
|
if (node.isDeclarationFile) {
|
|
@@ -112468,18 +112460,17 @@ function isProcessedComponent(node) {
|
|
|
112468
112460
|
// src/compiler/transformer.ts
|
|
112469
112461
|
function getModuleTransformer(moduleKind) {
|
|
112470
112462
|
switch (moduleKind) {
|
|
112471
|
-
case 200 /* Preserve */:
|
|
112472
|
-
return transformECMAScriptModule;
|
|
112473
112463
|
case 99 /* ESNext */:
|
|
112474
112464
|
case 7 /* ES2022 */:
|
|
112475
112465
|
case 6 /* ES2020 */:
|
|
112476
112466
|
case 5 /* ES2015 */:
|
|
112477
|
-
case
|
|
112478
|
-
|
|
112479
|
-
case 1 /* CommonJS */:
|
|
112480
|
-
return transformImpliedNodeFormatDependentModule;
|
|
112467
|
+
case 200 /* Preserve */:
|
|
112468
|
+
return transformECMAScriptModule;
|
|
112481
112469
|
case 4 /* System */:
|
|
112482
112470
|
return transformSystemModule;
|
|
112471
|
+
case 100 /* Node16 */:
|
|
112472
|
+
case 199 /* NodeNext */:
|
|
112473
|
+
return transformNodeModule;
|
|
112483
112474
|
default:
|
|
112484
112475
|
return transformModule;
|
|
112485
112476
|
}
|
|
@@ -113196,7 +113187,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113196
113187
|
newLine: compilerOptions.newLine,
|
|
113197
113188
|
noEmitHelpers: compilerOptions.noEmitHelpers,
|
|
113198
113189
|
module: getEmitModuleKind(compilerOptions),
|
|
113199
|
-
moduleResolution: getEmitModuleResolutionKind(compilerOptions),
|
|
113200
113190
|
target: getEmitScriptTarget(compilerOptions),
|
|
113201
113191
|
sourceMap: compilerOptions.sourceMap,
|
|
113202
113192
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -113259,7 +113249,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113259
113249
|
newLine: compilerOptions.newLine,
|
|
113260
113250
|
noEmitHelpers: true,
|
|
113261
113251
|
module: compilerOptions.module,
|
|
113262
|
-
moduleResolution: compilerOptions.moduleResolution,
|
|
113263
113252
|
target: compilerOptions.target,
|
|
113264
113253
|
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
|
|
113265
113254
|
inlineSourceMap: compilerOptions.inlineSourceMap,
|
|
@@ -113275,7 +113264,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113275
113264
|
isEmitNotificationEnabled: declarationTransform.isEmitNotificationEnabled,
|
|
113276
113265
|
substituteNode: declarationTransform.substituteNode
|
|
113277
113266
|
});
|
|
113278
|
-
printSourceFileOrBundle(
|
|
113267
|
+
const dtsWritten = printSourceFileOrBundle(
|
|
113279
113268
|
declarationFilePath,
|
|
113280
113269
|
declarationMapPath,
|
|
113281
113270
|
declarationTransform,
|
|
@@ -113289,7 +113278,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113289
113278
|
}
|
|
113290
113279
|
);
|
|
113291
113280
|
if (emittedFilesList) {
|
|
113292
|
-
emittedFilesList.push(declarationFilePath);
|
|
113281
|
+
if (dtsWritten) emittedFilesList.push(declarationFilePath);
|
|
113293
113282
|
if (declarationMapPath) {
|
|
113294
113283
|
emittedFilesList.push(declarationMapPath);
|
|
113295
113284
|
}
|
|
@@ -113380,8 +113369,10 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
113380
113369
|
writer.writeLine();
|
|
113381
113370
|
}
|
|
113382
113371
|
const text = writer.getText();
|
|
113383
|
-
|
|
113372
|
+
const data = { sourceMapUrlPos, diagnostics: transform.diagnostics };
|
|
113373
|
+
writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
|
|
113384
113374
|
writer.clear();
|
|
113375
|
+
return !data.skippedDtsWrite;
|
|
113385
113376
|
}
|
|
113386
113377
|
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
|
|
113387
113378
|
return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 307 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
|
|
@@ -118712,6 +118703,9 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
118712
118703
|
function getModeForFileReference(ref, containingFileMode) {
|
|
118713
118704
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
118714
118705
|
}
|
|
118706
|
+
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
118707
|
+
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
118708
|
+
}
|
|
118715
118709
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
118716
118710
|
var _a;
|
|
118717
118711
|
if (isExportDeclaration(decl)) {
|
|
@@ -118726,6 +118720,7 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
|
118726
118720
|
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
118727
118721
|
}
|
|
118728
118722
|
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
118723
|
+
var _a;
|
|
118729
118724
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
118730
118725
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
118731
118726
|
if (isTypeOnly) {
|
|
@@ -118741,28 +118736,19 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
|
118741
118736
|
return override;
|
|
118742
118737
|
}
|
|
118743
118738
|
}
|
|
118744
|
-
if (compilerOptions &&
|
|
118745
|
-
return
|
|
118739
|
+
if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
118740
|
+
return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
|
|
118741
|
+
usage.parent,
|
|
118742
|
+
/*requireStringLiteralLikeArgument*/
|
|
118743
|
+
false
|
|
118744
|
+
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
118746
118745
|
}
|
|
118747
|
-
|
|
118748
|
-
|
|
118749
|
-
|
|
118750
|
-
if (!compilerOptions) {
|
|
118751
|
-
return void 0;
|
|
118746
|
+
if (file.impliedNodeFormat === void 0) return void 0;
|
|
118747
|
+
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
118748
|
+
return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
|
|
118752
118749
|
}
|
|
118753
118750
|
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;
|
|
118751
|
+
return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
118766
118752
|
}
|
|
118767
118753
|
function getResolutionModeOverride(node, grammarErrorOnNode) {
|
|
118768
118754
|
if (!node) return void 0;
|
|
@@ -118819,7 +118805,7 @@ function getTypeReferenceResolutionName(entry) {
|
|
|
118819
118805
|
}
|
|
118820
118806
|
var typeReferenceResolutionNameAndModeGetter = {
|
|
118821
118807
|
getName: getTypeReferenceResolutionName,
|
|
118822
|
-
getMode: (entry, file
|
|
118808
|
+
getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
|
|
118823
118809
|
};
|
|
118824
118810
|
function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
118825
118811
|
return {
|
|
@@ -119454,8 +119440,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119454
119440
|
isSourceFileFromExternalLibrary,
|
|
119455
119441
|
isSourceFileDefaultLibrary,
|
|
119456
119442
|
getModeForUsageLocation: getModeForUsageLocation2,
|
|
119457
|
-
|
|
119458
|
-
getModeForResolutionAtIndex,
|
|
119443
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
119459
119444
|
getSourceFileFromReference,
|
|
119460
119445
|
getLibFileFromReference,
|
|
119461
119446
|
sourceFileToPackageName,
|
|
@@ -119483,11 +119468,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119483
119468
|
forEachResolvedProjectReference: forEachResolvedProjectReference2,
|
|
119484
119469
|
isSourceOfProjectReferenceRedirect,
|
|
119485
119470
|
getRedirectReferenceForResolutionFromSourceOfProject,
|
|
119486
|
-
getCompilerOptionsForFile,
|
|
119487
|
-
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
119488
|
-
getEmitModuleFormatOfFile,
|
|
119489
|
-
getImpliedNodeFormatForEmit,
|
|
119490
|
-
shouldTransformImportCall,
|
|
119491
119471
|
emitBuildInfo,
|
|
119492
119472
|
fileExists,
|
|
119493
119473
|
readFile,
|
|
@@ -120070,10 +120050,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120070
120050
|
getSymlinkCache,
|
|
120071
120051
|
writeFile: writeFileCallback || writeFile2,
|
|
120072
120052
|
isEmitBlocked,
|
|
120073
|
-
shouldTransformImportCall,
|
|
120074
|
-
getEmitModuleFormatOfFile,
|
|
120075
|
-
getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
|
|
120076
|
-
getModeForResolutionAtIndex,
|
|
120077
120053
|
readFile: (f) => host.readFile(f),
|
|
120078
120054
|
fileExists: (f) => {
|
|
120079
120055
|
const path = toPath3(f);
|
|
@@ -120231,15 +120207,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120231
120207
|
function getSyntacticDiagnostics(sourceFile, cancellationToken) {
|
|
120232
120208
|
return getDiagnosticsHelper(sourceFile, getSyntacticDiagnosticsForFile, cancellationToken);
|
|
120233
120209
|
}
|
|
120234
|
-
function getSemanticDiagnostics(sourceFile, cancellationToken) {
|
|
120235
|
-
return getDiagnosticsHelper(
|
|
120210
|
+
function getSemanticDiagnostics(sourceFile, cancellationToken, nodesToCheck) {
|
|
120211
|
+
return getDiagnosticsHelper(
|
|
120212
|
+
sourceFile,
|
|
120213
|
+
(sourceFile2, cancellationToken2) => getSemanticDiagnosticsForFile(sourceFile2, cancellationToken2, nodesToCheck),
|
|
120214
|
+
cancellationToken
|
|
120215
|
+
);
|
|
120236
120216
|
}
|
|
120237
120217
|
function getCachedSemanticDiagnostics(sourceFile) {
|
|
120238
120218
|
var _a2;
|
|
120239
120219
|
return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics;
|
|
120240
120220
|
}
|
|
120241
120221
|
function getBindAndCheckDiagnostics(sourceFile, cancellationToken) {
|
|
120242
|
-
return getBindAndCheckDiagnosticsForFile(
|
|
120222
|
+
return getBindAndCheckDiagnosticsForFile(
|
|
120223
|
+
sourceFile,
|
|
120224
|
+
cancellationToken,
|
|
120225
|
+
/*nodesToCheck*/
|
|
120226
|
+
void 0
|
|
120227
|
+
);
|
|
120243
120228
|
}
|
|
120244
120229
|
function getProgramDiagnostics(sourceFile) {
|
|
120245
120230
|
var _a2;
|
|
@@ -120279,16 +120264,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120279
120264
|
throw e;
|
|
120280
120265
|
}
|
|
120281
120266
|
}
|
|
120282
|
-
function getSemanticDiagnosticsForFile(sourceFile, cancellationToken) {
|
|
120267
|
+
function getSemanticDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
|
|
120283
120268
|
return concatenate(
|
|
120284
|
-
filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options),
|
|
120269
|
+
filterSemanticDiagnostics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck), options),
|
|
120285
120270
|
getProgramDiagnostics(sourceFile)
|
|
120286
120271
|
);
|
|
120287
120272
|
}
|
|
120288
|
-
function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken) {
|
|
120273
|
+
function getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken, nodesToCheck) {
|
|
120274
|
+
if (nodesToCheck) {
|
|
120275
|
+
return getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck);
|
|
120276
|
+
}
|
|
120289
120277
|
return getAndCacheDiagnostics(sourceFile, cancellationToken, cachedBindAndCheckDiagnosticsForFile, getBindAndCheckDiagnosticsForFileNoCache);
|
|
120290
120278
|
}
|
|
120291
|
-
function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken) {
|
|
120279
|
+
function getBindAndCheckDiagnosticsForFileNoCache(sourceFile, cancellationToken, nodesToCheck) {
|
|
120292
120280
|
return runWithCancellationToken(() => {
|
|
120293
120281
|
if (skipTypeChecking(sourceFile, options, program)) {
|
|
120294
120282
|
return emptyArray;
|
|
@@ -120296,24 +120284,34 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120296
120284
|
const typeChecker2 = getTypeChecker();
|
|
120297
120285
|
Debug.assert(!!sourceFile.bindDiagnostics);
|
|
120298
120286
|
const isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
120299
|
-
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
120300
120287
|
const isPlainJs = isPlainJsFile(sourceFile, options.checkJs);
|
|
120288
|
+
const isCheckJs = isJs && isCheckJsEnabledForFile(sourceFile, options);
|
|
120301
120289
|
let bindDiagnostics = sourceFile.bindDiagnostics;
|
|
120302
|
-
let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken);
|
|
120290
|
+
let checkDiagnostics = typeChecker2.getDiagnostics(sourceFile, cancellationToken, nodesToCheck);
|
|
120303
120291
|
if (isPlainJs) {
|
|
120304
120292
|
bindDiagnostics = filter(bindDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
120305
120293
|
checkDiagnostics = filter(checkDiagnostics, (d) => plainJSErrors.has(d.code));
|
|
120306
120294
|
}
|
|
120307
|
-
return getMergedBindAndCheckDiagnostics(
|
|
120295
|
+
return getMergedBindAndCheckDiagnostics(
|
|
120296
|
+
sourceFile,
|
|
120297
|
+
!isPlainJs,
|
|
120298
|
+
!!nodesToCheck,
|
|
120299
|
+
bindDiagnostics,
|
|
120300
|
+
checkDiagnostics,
|
|
120301
|
+
isCheckJs ? sourceFile.jsDocDiagnostics : void 0
|
|
120302
|
+
);
|
|
120308
120303
|
});
|
|
120309
120304
|
}
|
|
120310
|
-
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) {
|
|
120305
|
+
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, partialCheck, ...allDiagnostics) {
|
|
120311
120306
|
var _a2;
|
|
120312
120307
|
const flatDiagnostics = flatten(allDiagnostics);
|
|
120313
120308
|
if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
|
|
120314
120309
|
return flatDiagnostics;
|
|
120315
120310
|
}
|
|
120316
120311
|
const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics);
|
|
120312
|
+
if (partialCheck) {
|
|
120313
|
+
return diagnostics;
|
|
120314
|
+
}
|
|
120317
120315
|
for (const errorExpectation of directives.getUnusedExpectations()) {
|
|
120318
120316
|
diagnostics.push(createDiagnosticForRange(sourceFile, errorExpectation.range, Diagnostics.Unused_ts_expect_error_directive));
|
|
120319
120317
|
}
|
|
@@ -121134,14 +121132,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121134
121132
|
const resolvedTypeReferenceDirective = resolutions[index];
|
|
121135
121133
|
const fileName = ref.fileName;
|
|
121136
121134
|
resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
|
|
121137
|
-
const mode = ref.resolutionMode ||
|
|
121135
|
+
const mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
121138
121136
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
|
|
121139
121137
|
}
|
|
121140
121138
|
}
|
|
121141
|
-
function getCompilerOptionsForFile(file) {
|
|
121142
|
-
var _a2;
|
|
121143
|
-
return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
121144
|
-
}
|
|
121145
121139
|
function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
|
|
121146
121140
|
var _a2, _b2;
|
|
121147
121141
|
(_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 +121236,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121242
121236
|
return host.getCanonicalFileName(fileName);
|
|
121243
121237
|
}
|
|
121244
121238
|
function processImportedModules(file) {
|
|
121239
|
+
var _a2;
|
|
121245
121240
|
collectExternalModuleReferences(file);
|
|
121246
121241
|
if (file.imports.length || file.moduleAugmentations.length) {
|
|
121247
121242
|
const moduleNames = getModuleNames(file);
|
|
121248
121243
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
121249
121244
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
121250
|
-
const optionsForFile =
|
|
121245
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
121251
121246
|
const resolutionsInFile = createModeAwareCache();
|
|
121252
121247
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
121253
121248
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
@@ -121803,7 +121798,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121803
121798
|
redirectInfo = cachedChain.redirectInfo;
|
|
121804
121799
|
} else {
|
|
121805
121800
|
reasons == null ? void 0 : reasons.forEach(processReason);
|
|
121806
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file
|
|
121801
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
|
|
121807
121802
|
}
|
|
121808
121803
|
if (fileProcessingReason) processReason(fileProcessingReason);
|
|
121809
121804
|
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
|
@@ -122161,53 +122156,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122161
122156
|
return symlinks;
|
|
122162
122157
|
}
|
|
122163
122158
|
function getModeForUsageLocation2(file, usage) {
|
|
122164
|
-
|
|
122165
|
-
|
|
122166
|
-
|
|
122167
|
-
return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
|
|
122159
|
+
var _a2;
|
|
122160
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
122161
|
+
return getModeForUsageLocationWorker(file, usage, optionsForFile);
|
|
122168
122162
|
}
|
|
122169
|
-
function
|
|
122163
|
+
function getModeForResolutionAtIndex2(file, index) {
|
|
122170
122164
|
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
122171
122165
|
}
|
|
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
122166
|
}
|
|
122212
122167
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
122213
122168
|
let setOfDeclarationDirectories;
|
|
@@ -122865,6 +122820,7 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
122865
122820
|
canCopySemanticDiagnostics = false;
|
|
122866
122821
|
canCopyEmitDiagnostics = false;
|
|
122867
122822
|
}
|
|
122823
|
+
state.hasErrorsFromOldState = oldState.hasErrors;
|
|
122868
122824
|
} else {
|
|
122869
122825
|
state.buildInfoEmitPending = isIncrementalCompilation(compilerOptions);
|
|
122870
122826
|
}
|
|
@@ -123024,40 +122980,6 @@ function releaseCache(state) {
|
|
|
123024
122980
|
BuilderState.releaseCache(state);
|
|
123025
122981
|
state.program = void 0;
|
|
123026
122982
|
}
|
|
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
122983
|
function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
123062
122984
|
Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
123063
122985
|
}
|
|
@@ -123339,6 +123261,7 @@ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationTok
|
|
|
123339
123261
|
}
|
|
123340
123262
|
const diagnostics = state.program.getBindAndCheckDiagnostics(sourceFile, cancellationToken);
|
|
123341
123263
|
semanticDiagnosticsPerFile.set(path, diagnostics);
|
|
123264
|
+
state.buildInfoEmitPending = true;
|
|
123342
123265
|
return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
|
|
123343
123266
|
}
|
|
123344
123267
|
function isIncrementalBundleEmitBuildInfo(info) {
|
|
@@ -123348,6 +123271,35 @@ function isIncrementalBundleEmitBuildInfo(info) {
|
|
|
123348
123271
|
function isIncrementalBuildInfo(info) {
|
|
123349
123272
|
return !!info.fileNames;
|
|
123350
123273
|
}
|
|
123274
|
+
function isNonIncrementalBuildInfo(info) {
|
|
123275
|
+
return !isIncrementalBuildInfo(info) && !!info.root;
|
|
123276
|
+
}
|
|
123277
|
+
function ensureHasErrorsForState(state) {
|
|
123278
|
+
if (state.hasErrors !== void 0) return;
|
|
123279
|
+
if (isIncrementalCompilation(state.compilerOptions)) {
|
|
123280
|
+
state.hasErrors = !some(state.program.getSourceFiles(), (f) => {
|
|
123281
|
+
var _a, _b;
|
|
123282
|
+
const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
|
|
123283
|
+
return bindAndCheckDiagnostics === void 0 || // Missing semantic diagnostics in cache will be encoded in buildInfo
|
|
123284
|
+
!!bindAndCheckDiagnostics.length || // cached semantic diagnostics will be encoded in buildInfo
|
|
123285
|
+
!!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
|
|
123286
|
+
}) && (hasSyntaxOrGlobalErrors(state) || some(state.program.getSourceFiles(), (f) => !!state.program.getProgramDiagnostics(f).length));
|
|
123287
|
+
} else {
|
|
123288
|
+
state.hasErrors = some(state.program.getSourceFiles(), (f) => {
|
|
123289
|
+
var _a, _b;
|
|
123290
|
+
const bindAndCheckDiagnostics = state.semanticDiagnosticsPerFile.get(f.resolvedPath);
|
|
123291
|
+
return !!(bindAndCheckDiagnostics == null ? void 0 : bindAndCheckDiagnostics.length) || // If has semantic diagnostics
|
|
123292
|
+
!!((_b = (_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.get(f.resolvedPath)) == null ? void 0 : _b.length);
|
|
123293
|
+
}) || hasSyntaxOrGlobalErrors(state);
|
|
123294
|
+
}
|
|
123295
|
+
}
|
|
123296
|
+
function hasSyntaxOrGlobalErrors(state) {
|
|
123297
|
+
return !!state.program.getConfigFileParsingDiagnostics().length || !!state.program.getSyntacticDiagnostics().length || !!state.program.getOptionsDiagnostics().length || !!state.program.getGlobalDiagnostics().length;
|
|
123298
|
+
}
|
|
123299
|
+
function getBuildInfoEmitPending(state) {
|
|
123300
|
+
ensureHasErrorsForState(state);
|
|
123301
|
+
return state.buildInfoEmitPending ?? (state.buildInfoEmitPending = !!state.hasErrorsFromOldState !== !!state.hasErrors);
|
|
123302
|
+
}
|
|
123351
123303
|
function getBuildInfo2(state) {
|
|
123352
123304
|
var _a, _b;
|
|
123353
123305
|
const currentDirectory = state.program.getCurrentDirectory();
|
|
@@ -123356,7 +123308,15 @@ function getBuildInfo2(state) {
|
|
|
123356
123308
|
const fileNames = [];
|
|
123357
123309
|
const fileNameToFileId = /* @__PURE__ */ new Map();
|
|
123358
123310
|
const rootFileNames = new Set(state.program.getRootFileNames().map((f) => toPath(f, currentDirectory, state.program.getCanonicalFileName)));
|
|
123359
|
-
|
|
123311
|
+
ensureHasErrorsForState(state);
|
|
123312
|
+
if (!isIncrementalCompilation(state.compilerOptions)) {
|
|
123313
|
+
const buildInfo2 = {
|
|
123314
|
+
root: arrayFrom(rootFileNames, (r) => relativeToBuildInfo(r)),
|
|
123315
|
+
errors: state.hasErrors ? true : void 0,
|
|
123316
|
+
version
|
|
123317
|
+
};
|
|
123318
|
+
return buildInfo2;
|
|
123319
|
+
}
|
|
123360
123320
|
const root = [];
|
|
123361
123321
|
if (state.compilerOptions.outFile) {
|
|
123362
123322
|
const fileInfos2 = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
|
|
@@ -123372,7 +123332,6 @@ function getBuildInfo2(state) {
|
|
|
123372
123332
|
options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
|
|
123373
123333
|
semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
|
|
123374
123334
|
emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
|
|
123375
|
-
changeFileSet: toChangeFileSet(),
|
|
123376
123335
|
outSignature: state.outSignature,
|
|
123377
123336
|
latestChangedDtsFile,
|
|
123378
123337
|
pendingEmit: !state.programEmitPending ? void 0 : (
|
|
@@ -123383,6 +123342,7 @@ function getBuildInfo2(state) {
|
|
|
123383
123342
|
)
|
|
123384
123343
|
),
|
|
123385
123344
|
// Actual value
|
|
123345
|
+
errors: state.hasErrors ? true : void 0,
|
|
123386
123346
|
version
|
|
123387
123347
|
};
|
|
123388
123348
|
return buildInfo2;
|
|
@@ -123475,9 +123435,9 @@ function getBuildInfo2(state) {
|
|
|
123475
123435
|
semanticDiagnosticsPerFile,
|
|
123476
123436
|
emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
|
|
123477
123437
|
affectedFilesPendingEmit,
|
|
123478
|
-
changeFileSet: toChangeFileSet(),
|
|
123479
123438
|
emitSignatures,
|
|
123480
123439
|
latestChangedDtsFile,
|
|
123440
|
+
errors: state.hasErrors ? true : void 0,
|
|
123481
123441
|
version
|
|
123482
123442
|
};
|
|
123483
123443
|
return buildInfo;
|
|
@@ -123561,7 +123521,7 @@ function getBuildInfo2(state) {
|
|
|
123561
123521
|
state.fileInfos.forEach((_value, key) => {
|
|
123562
123522
|
const value = state.semanticDiagnosticsPerFile.get(key);
|
|
123563
123523
|
if (!value) {
|
|
123564
|
-
|
|
123524
|
+
result = append(result, toFileId(key));
|
|
123565
123525
|
} else if (value.length) {
|
|
123566
123526
|
result = append(result, [
|
|
123567
123527
|
toFileId(key),
|
|
@@ -123628,15 +123588,6 @@ function getBuildInfo2(state) {
|
|
|
123628
123588
|
return result;
|
|
123629
123589
|
}) || array;
|
|
123630
123590
|
}
|
|
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
123591
|
}
|
|
123641
123592
|
function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
|
|
123642
123593
|
let host;
|
|
@@ -123708,8 +123659,6 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123708
123659
|
oldState = void 0;
|
|
123709
123660
|
const builderProgram = createRedirectedBuilderProgram(state, configFileParsingDiagnostics);
|
|
123710
123661
|
builderProgram.state = state;
|
|
123711
|
-
builderProgram.saveEmitState = () => backupBuilderProgramEmitState(state);
|
|
123712
|
-
builderProgram.restoreEmitState = (saved) => restoreBuilderProgramEmitState(state, saved);
|
|
123713
123662
|
builderProgram.hasChangedEmitSignature = () => !!state.hasChangedEmitSignature;
|
|
123714
123663
|
builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(
|
|
123715
123664
|
state,
|
|
@@ -123731,7 +123680,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123731
123680
|
return builderProgram;
|
|
123732
123681
|
function emitBuildInfo(writeFile2, cancellationToken) {
|
|
123733
123682
|
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
123734
|
-
if (state
|
|
123683
|
+
if (getBuildInfoEmitPending(state)) {
|
|
123735
123684
|
const result = state.program.emitBuildInfo(
|
|
123736
123685
|
writeFile2 || maybeBind(host, host.writeFile),
|
|
123737
123686
|
cancellationToken
|
|
@@ -123782,7 +123731,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123782
123731
|
}
|
|
123783
123732
|
}
|
|
123784
123733
|
if (!affected) {
|
|
123785
|
-
if (!state
|
|
123734
|
+
if (!getBuildInfoEmitPending(state)) return void 0;
|
|
123786
123735
|
const affected2 = state.program;
|
|
123787
123736
|
const result2 = affected2.emitBuildInfo(
|
|
123788
123737
|
writeFile2 || maybeBind(host, host.writeFile),
|
|
@@ -123870,7 +123819,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123870
123819
|
if (state.compilerOptions.composite) {
|
|
123871
123820
|
const filePath = sourceFiles[0].resolvedPath;
|
|
123872
123821
|
emitSignature = handleNewSignature((_c = state.emitSignatures) == null ? void 0 : _c.get(filePath), emitSignature);
|
|
123873
|
-
if (!emitSignature) return;
|
|
123822
|
+
if (!emitSignature) return data.skippedDtsWrite = true;
|
|
123874
123823
|
(state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature);
|
|
123875
123824
|
}
|
|
123876
123825
|
} else if (state.compilerOptions.composite) {
|
|
@@ -123879,7 +123828,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
123879
123828
|
/*newSignature*/
|
|
123880
123829
|
void 0
|
|
123881
123830
|
);
|
|
123882
|
-
if (!newSignature) return;
|
|
123831
|
+
if (!newSignature) return data.skippedDtsWrite = true;
|
|
123883
123832
|
state.outSignature = newSignature;
|
|
123884
123833
|
}
|
|
123885
123834
|
}
|
|
@@ -124024,7 +123973,6 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
|
|
|
124024
123973
|
let filePathsSetList;
|
|
124025
123974
|
const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
|
|
124026
123975
|
const fileInfos = /* @__PURE__ */ new Map();
|
|
124027
|
-
const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
|
|
124028
123976
|
if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
|
|
124029
123977
|
buildInfo.fileInfos.forEach((fileInfo, index) => {
|
|
124030
123978
|
const path = toFilePath(index + 1);
|
|
@@ -124036,10 +123984,10 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
|
|
|
124036
123984
|
semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
|
|
124037
123985
|
emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
|
|
124038
123986
|
hasReusableDiagnostic: true,
|
|
124039
|
-
changedFilesSet,
|
|
124040
123987
|
latestChangedDtsFile,
|
|
124041
123988
|
outSignature: buildInfo.outSignature,
|
|
124042
|
-
programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options)
|
|
123989
|
+
programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options),
|
|
123990
|
+
hasErrors: buildInfo.errors
|
|
124043
123991
|
};
|
|
124044
123992
|
} else {
|
|
124045
123993
|
filePathsSetList = (_b = buildInfo.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
|
|
@@ -124072,15 +124020,13 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
|
|
|
124072
124020
|
emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
|
|
124073
124021
|
hasReusableDiagnostic: true,
|
|
124074
124022
|
affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
|
|
124075
|
-
changedFilesSet,
|
|
124076
124023
|
latestChangedDtsFile,
|
|
124077
|
-
emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
|
|
124024
|
+
emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0,
|
|
124025
|
+
hasErrors: buildInfo.errors
|
|
124078
124026
|
};
|
|
124079
124027
|
}
|
|
124080
124028
|
return {
|
|
124081
124029
|
state,
|
|
124082
|
-
saveEmitState: noop,
|
|
124083
|
-
restoreEmitState: noop,
|
|
124084
124030
|
getProgram: notImplemented,
|
|
124085
124031
|
getProgramOrUndefined: returnUndefined,
|
|
124086
124032
|
releaseProgram: noop,
|
|
@@ -124124,7 +124070,7 @@ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath,
|
|
|
124124
124070
|
const semanticDiagnostics = new Map(
|
|
124125
124071
|
mapDefinedIterator(
|
|
124126
124072
|
fileInfos.keys(),
|
|
124127
|
-
(key) =>
|
|
124073
|
+
(key) => [key, emptyArray]
|
|
124128
124074
|
)
|
|
124129
124075
|
);
|
|
124130
124076
|
diagnostics == null ? void 0 : diagnostics.forEach((value) => {
|
|
@@ -124172,11 +124118,15 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
|
124172
124118
|
}
|
|
124173
124119
|
}
|
|
124174
124120
|
}
|
|
124121
|
+
function getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host) {
|
|
124122
|
+
if (!isNonIncrementalBuildInfo(buildInfo)) return void 0;
|
|
124123
|
+
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
124124
|
+
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
124125
|
+
return buildInfo.root.map((r) => toPath(r, buildInfoDirectory, getCanonicalFileName));
|
|
124126
|
+
}
|
|
124175
124127
|
function createRedirectedBuilderProgram(state, configFileParsingDiagnostics) {
|
|
124176
124128
|
return {
|
|
124177
124129
|
state: void 0,
|
|
124178
|
-
saveEmitState: noop,
|
|
124179
|
-
restoreEmitState: noop,
|
|
124180
124130
|
getProgram,
|
|
124181
124131
|
getProgramOrUndefined: () => state.program,
|
|
124182
124132
|
releaseProgram: () => state.program = void 0,
|
|
@@ -125504,10 +125454,10 @@ function explainFiles(program, write) {
|
|
|
125504
125454
|
for (const file of program.getSourceFiles()) {
|
|
125505
125455
|
write(`${toFileName(file, relativeFileName)}`);
|
|
125506
125456
|
(_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
|
|
125507
|
-
(_b = explainIfFileIsRedirectAndImpliedFormat(file,
|
|
125457
|
+
(_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
|
|
125508
125458
|
}
|
|
125509
125459
|
}
|
|
125510
|
-
function explainIfFileIsRedirectAndImpliedFormat(file,
|
|
125460
|
+
function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
|
|
125511
125461
|
var _a;
|
|
125512
125462
|
let result;
|
|
125513
125463
|
if (file.path !== file.resolvedPath) {
|
|
@@ -125527,7 +125477,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConverto
|
|
|
125527
125477
|
));
|
|
125528
125478
|
}
|
|
125529
125479
|
if (isExternalOrCommonJsModule(file)) {
|
|
125530
|
-
switch (
|
|
125480
|
+
switch (file.impliedNodeFormat) {
|
|
125531
125481
|
case 99 /* ESNext */:
|
|
125532
125482
|
if (file.packageJsonScope) {
|
|
125533
125483
|
(result ?? (result = [])).push(chainDiagnosticMessages(
|
|
@@ -125724,13 +125674,12 @@ function emitFilesAndReportErrors(program, reportDiagnostic, write, reportSummar
|
|
|
125724
125674
|
emitOnlyDtsFiles,
|
|
125725
125675
|
customTransformers
|
|
125726
125676
|
);
|
|
125727
|
-
|
|
125728
|
-
addRange(allDiagnostics, emitDiagnostics);
|
|
125677
|
+
addRange(allDiagnostics, emitResult.diagnostics);
|
|
125729
125678
|
const diagnostics = sortAndDeduplicateDiagnostics(allDiagnostics);
|
|
125730
125679
|
diagnostics.forEach(reportDiagnostic);
|
|
125731
125680
|
if (write) {
|
|
125732
125681
|
const currentDir = program.getCurrentDirectory();
|
|
125733
|
-
forEach(emittedFiles, (file) => {
|
|
125682
|
+
forEach(emitResult.emittedFiles, (file) => {
|
|
125734
125683
|
const filepath = getNormalizedAbsolutePath(file, currentDir);
|
|
125735
125684
|
write(`TSFILE: ${filepath}`);
|
|
125736
125685
|
});
|
|
@@ -126388,22 +126337,17 @@ function createWatchProgram(host) {
|
|
|
126388
126337
|
updateProgram();
|
|
126389
126338
|
}
|
|
126390
126339
|
function updateProgram() {
|
|
126391
|
-
var _a, _b, _c, _d;
|
|
126392
126340
|
switch (updateLevel) {
|
|
126393
126341
|
case 1 /* RootNamesAndUpdate */:
|
|
126394
|
-
(_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
|
|
126395
126342
|
reloadFileNamesFromConfigFile();
|
|
126396
126343
|
break;
|
|
126397
126344
|
case 2 /* Full */:
|
|
126398
|
-
(_b = perfLogger) == null ? void 0 : _b.logStartUpdateProgram("FullConfigReload");
|
|
126399
126345
|
reloadConfigFile();
|
|
126400
126346
|
break;
|
|
126401
126347
|
default:
|
|
126402
|
-
(_c = perfLogger) == null ? void 0 : _c.logStartUpdateProgram("SynchronizeProgram");
|
|
126403
126348
|
synchronizeProgram();
|
|
126404
126349
|
break;
|
|
126405
126350
|
}
|
|
126406
|
-
(_d = perfLogger) == null ? void 0 : _d.logStopUpdateProgram("Done");
|
|
126407
126351
|
return getCurrentBuilderProgram();
|
|
126408
126352
|
}
|
|
126409
126353
|
function reloadFileNamesFromConfigFile() {
|
|
@@ -127139,7 +127083,7 @@ function createUpdateOutputFileStampsProject(state, project, projectPath, config
|
|
|
127139
127083
|
}
|
|
127140
127084
|
};
|
|
127141
127085
|
}
|
|
127142
|
-
function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, buildOrder) {
|
|
127086
|
+
function createBuildOrUpdateInvalidedProject(state, project, projectPath, projectIndex, config, status, buildOrder) {
|
|
127143
127087
|
let step = 0 /* CreateProgram */;
|
|
127144
127088
|
let program;
|
|
127145
127089
|
let buildResult;
|
|
@@ -127190,17 +127134,13 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
127190
127134
|
}
|
|
127191
127135
|
);
|
|
127192
127136
|
}
|
|
127193
|
-
executeSteps(
|
|
127194
|
-
if (step === 4 /* EmitBuildInfo */) {
|
|
127195
|
-
return emitBuildInfo(writeFile2, cancellationToken);
|
|
127196
|
-
}
|
|
127197
|
-
if (step !== 3 /* Emit */) return void 0;
|
|
127137
|
+
executeSteps(0 /* CreateProgram */, cancellationToken);
|
|
127198
127138
|
return emit(writeFile2, cancellationToken, customTransformers);
|
|
127199
127139
|
},
|
|
127200
127140
|
done
|
|
127201
127141
|
};
|
|
127202
127142
|
function done(cancellationToken, writeFile2, customTransformers) {
|
|
127203
|
-
executeSteps(
|
|
127143
|
+
executeSteps(3 /* Done */, cancellationToken, writeFile2, customTransformers);
|
|
127204
127144
|
mark("SolutionBuilder::Projects built");
|
|
127205
127145
|
return doneInvalidatedProject(state, projectPath);
|
|
127206
127146
|
}
|
|
@@ -127217,14 +127157,14 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
127217
127157
|
if (state.options.dry) {
|
|
127218
127158
|
reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
|
|
127219
127159
|
buildResult = 1 /* Success */;
|
|
127220
|
-
step =
|
|
127160
|
+
step = 2 /* QueueReferencingProjects */;
|
|
127221
127161
|
return;
|
|
127222
127162
|
}
|
|
127223
127163
|
if (state.options.verbose) reportStatus(state, Diagnostics.Building_project_0, project);
|
|
127224
127164
|
if (config.fileNames.length === 0) {
|
|
127225
127165
|
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
|
|
127226
127166
|
buildResult = 0 /* None */;
|
|
127227
|
-
step =
|
|
127167
|
+
step = 2 /* QueueReferencingProjects */;
|
|
127228
127168
|
return;
|
|
127229
127169
|
}
|
|
127230
127170
|
const { host, compilerHost } = state;
|
|
@@ -127252,179 +127192,97 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
127252
127192
|
}
|
|
127253
127193
|
step++;
|
|
127254
127194
|
}
|
|
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
127195
|
function emit(writeFileCallback, cancellationToken, customTransformers) {
|
|
127297
127196
|
var _a, _b, _c;
|
|
127298
127197
|
Debug.assertIsDefined(program);
|
|
127299
|
-
Debug.assert(step ===
|
|
127300
|
-
const
|
|
127301
|
-
|
|
127302
|
-
const
|
|
127303
|
-
const
|
|
127304
|
-
|
|
127198
|
+
Debug.assert(step === 1 /* Emit */);
|
|
127199
|
+
const { host, compilerHost } = state;
|
|
127200
|
+
const emittedOutputs = /* @__PURE__ */ new Map();
|
|
127201
|
+
const options = program.getCompilerOptions();
|
|
127202
|
+
const isIncremental = isIncrementalCompilation(options);
|
|
127203
|
+
let outputTimeStampMap;
|
|
127204
|
+
let now;
|
|
127205
|
+
const { emitResult, diagnostics } = emitFilesAndReportErrors(
|
|
127305
127206
|
program,
|
|
127306
|
-
|
|
127307
|
-
|
|
127308
|
-
void 0,
|
|
127207
|
+
(d) => host.reportDiagnostic(d),
|
|
127208
|
+
state.write,
|
|
127309
127209
|
/*reportSummary*/
|
|
127310
127210
|
void 0,
|
|
127311
|
-
(name, text, writeByteOrderMark,
|
|
127211
|
+
(name, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
127212
|
+
var _a2;
|
|
127213
|
+
const path = toPath2(state, name);
|
|
127214
|
+
emittedOutputs.set(toPath2(state, name), name);
|
|
127215
|
+
if (data == null ? void 0 : data.buildInfo) {
|
|
127216
|
+
now || (now = getCurrentTime(state.host));
|
|
127217
|
+
const isChangedSignature2 = (_a2 = program.hasChangedEmitSignature) == null ? void 0 : _a2.call(program);
|
|
127218
|
+
const existing = getBuildInfoCacheEntry(state, name, projectPath);
|
|
127219
|
+
if (existing) {
|
|
127220
|
+
existing.buildInfo = data.buildInfo;
|
|
127221
|
+
existing.modifiedTime = now;
|
|
127222
|
+
if (isChangedSignature2) existing.latestChangedDtsTime = now;
|
|
127223
|
+
} else {
|
|
127224
|
+
state.buildInfoCache.set(projectPath, {
|
|
127225
|
+
path: toPath2(state, name),
|
|
127226
|
+
buildInfo: data.buildInfo,
|
|
127227
|
+
modifiedTime: now,
|
|
127228
|
+
latestChangedDtsTime: isChangedSignature2 ? now : void 0
|
|
127229
|
+
});
|
|
127230
|
+
}
|
|
127231
|
+
}
|
|
127232
|
+
const modifiedTime = (data == null ? void 0 : data.differsOnlyInMap) ? getModifiedTime(state.host, name) : void 0;
|
|
127233
|
+
(writeFileCallback || compilerHost.writeFile)(
|
|
127234
|
+
name,
|
|
127235
|
+
text,
|
|
127236
|
+
writeByteOrderMark,
|
|
127237
|
+
onError,
|
|
127238
|
+
sourceFiles,
|
|
127239
|
+
data
|
|
127240
|
+
);
|
|
127241
|
+
if (data == null ? void 0 : data.differsOnlyInMap) state.host.setModifiedTime(name, modifiedTime);
|
|
127242
|
+
else if (!isIncremental && state.watch) {
|
|
127243
|
+
(outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
|
|
127244
|
+
}
|
|
127245
|
+
},
|
|
127312
127246
|
cancellationToken,
|
|
127313
127247
|
/*emitOnlyDtsFiles*/
|
|
127314
|
-
|
|
127248
|
+
void 0,
|
|
127315
127249
|
customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a, project))
|
|
127316
127250
|
);
|
|
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
|
-
};
|
|
127251
|
+
if ((!options.noEmitOnError || !diagnostics.length) && (emittedOutputs.size || status.type !== 8 /* OutOfDateBuildInfoWithErrors */)) {
|
|
127252
|
+
updateOutputTimestampsWorker(state, config, projectPath, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
|
|
127330
127253
|
}
|
|
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));
|
|
127254
|
+
state.projectErrorsReported.set(projectPath, true);
|
|
127255
|
+
if (!diagnostics.length) {
|
|
127256
|
+
state.diagnostics.delete(projectPath);
|
|
127257
|
+
state.projectStatus.set(projectPath, {
|
|
127258
|
+
type: 1 /* UpToDate */,
|
|
127259
|
+
oldestOutputFileName: firstOrUndefinedIterator(emittedOutputs.values()) ?? getFirstProjectOutput(config, !host.useCaseSensitiveFileNames())
|
|
127260
|
+
});
|
|
127261
|
+
buildResult = ((_c = program.hasChangedEmitSignature) == null ? void 0 : _c.call(program)) ? 0 /* None */ : 2 /* DeclarationOutputUnchanged */;
|
|
127262
|
+
} else {
|
|
127263
|
+
state.diagnostics.set(projectPath, diagnostics);
|
|
127264
|
+
state.projectStatus.set(projectPath, { type: 0 /* Unbuildable */, reason: `it had errors` });
|
|
127265
|
+
buildResult = 4 /* AnyErrors */;
|
|
127373
127266
|
}
|
|
127374
127267
|
afterProgramDone(state, program);
|
|
127375
|
-
step =
|
|
127268
|
+
step = 2 /* QueueReferencingProjects */;
|
|
127376
127269
|
return emitResult;
|
|
127377
127270
|
}
|
|
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
127271
|
function executeSteps(till, cancellationToken, writeFile2, customTransformers) {
|
|
127405
|
-
while (step <= till && step <
|
|
127272
|
+
while (step <= till && step < 3 /* Done */) {
|
|
127406
127273
|
const currentStep = step;
|
|
127407
127274
|
switch (step) {
|
|
127408
127275
|
case 0 /* CreateProgram */:
|
|
127409
127276
|
createProgram2();
|
|
127410
127277
|
break;
|
|
127411
|
-
case 1 /*
|
|
127412
|
-
getSyntaxDiagnostics(cancellationToken);
|
|
127413
|
-
break;
|
|
127414
|
-
case 2 /* SemanticDiagnostics */:
|
|
127415
|
-
getSemanticDiagnostics(cancellationToken);
|
|
127416
|
-
break;
|
|
127417
|
-
case 3 /* Emit */:
|
|
127278
|
+
case 1 /* Emit */:
|
|
127418
127279
|
emit(writeFile2, cancellationToken, customTransformers);
|
|
127419
127280
|
break;
|
|
127420
|
-
case
|
|
127421
|
-
emitBuildInfo(writeFile2, cancellationToken);
|
|
127422
|
-
break;
|
|
127423
|
-
case 5 /* QueueReferencingProjects */:
|
|
127281
|
+
case 2 /* QueueReferencingProjects */:
|
|
127424
127282
|
queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, Debug.checkDefined(buildResult));
|
|
127425
127283
|
step++;
|
|
127426
127284
|
break;
|
|
127427
|
-
case
|
|
127285
|
+
case 3 /* Done */:
|
|
127428
127286
|
default:
|
|
127429
127287
|
assertType(step);
|
|
127430
127288
|
}
|
|
@@ -127474,7 +127332,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
|
|
|
127474
127332
|
}
|
|
127475
127333
|
continue;
|
|
127476
127334
|
}
|
|
127477
|
-
if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type ===
|
|
127335
|
+
if (status.type === 2 /* UpToDateWithUpstreamTypes */ || status.type === 15 /* UpToDateWithInputFileText */) {
|
|
127478
127336
|
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
|
|
127479
127337
|
return {
|
|
127480
127338
|
kind: 1 /* UpdateOutputFileStamps */,
|
|
@@ -127486,7 +127344,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
|
|
|
127486
127344
|
};
|
|
127487
127345
|
}
|
|
127488
127346
|
}
|
|
127489
|
-
if (status.type ===
|
|
127347
|
+
if (status.type === 12 /* UpstreamBlocked */) {
|
|
127490
127348
|
verboseReportProjectStatus(state, project, status);
|
|
127491
127349
|
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
|
|
127492
127350
|
projectPendingBuild.delete(projectPath);
|
|
@@ -127500,7 +127358,7 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
|
|
|
127500
127358
|
}
|
|
127501
127359
|
continue;
|
|
127502
127360
|
}
|
|
127503
|
-
if (status.type ===
|
|
127361
|
+
if (status.type === 16 /* ContainerOnly */) {
|
|
127504
127362
|
verboseReportProjectStatus(state, project, status);
|
|
127505
127363
|
reportAndStoreErrors(state, projectPath, getConfigFileParsingDiagnostics(config));
|
|
127506
127364
|
projectPendingBuild.delete(projectPath);
|
|
@@ -127525,6 +127383,7 @@ function createInvalidatedProjectWithInfo(state, info, buildOrder) {
|
|
|
127525
127383
|
info.projectPath,
|
|
127526
127384
|
info.projectIndex,
|
|
127527
127385
|
info.config,
|
|
127386
|
+
info.status,
|
|
127528
127387
|
buildOrder
|
|
127529
127388
|
) : createUpdateOutputFileStampsProject(
|
|
127530
127389
|
state,
|
|
@@ -127539,11 +127398,6 @@ function getNextInvalidatedProject(state, buildOrder, reportQueue) {
|
|
|
127539
127398
|
if (!info) return info;
|
|
127540
127399
|
return createInvalidatedProjectWithInfo(state, info, buildOrder);
|
|
127541
127400
|
}
|
|
127542
|
-
function listEmittedFile({ write }, proj, file) {
|
|
127543
|
-
if (write && proj.options.listEmittedFiles) {
|
|
127544
|
-
write(`TSFILE: ${file}`);
|
|
127545
|
-
}
|
|
127546
|
-
}
|
|
127547
127401
|
function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed) {
|
|
127548
127402
|
if (options.force) return void 0;
|
|
127549
127403
|
const value = builderPrograms.get(proj);
|
|
@@ -127552,7 +127406,6 @@ function getOldProgram({ options, builderPrograms, compilerHost }, proj, parsed)
|
|
|
127552
127406
|
}
|
|
127553
127407
|
function afterProgramDone(state, program) {
|
|
127554
127408
|
if (program) {
|
|
127555
|
-
if (state.write) listFiles(program, state.write);
|
|
127556
127409
|
if (state.host.afterProgramEmitAndDiagnostics) {
|
|
127557
127410
|
state.host.afterProgramEmitAndDiagnostics(program);
|
|
127558
127411
|
}
|
|
@@ -127560,11 +127413,6 @@ function afterProgramDone(state, program) {
|
|
|
127560
127413
|
}
|
|
127561
127414
|
state.projectCompilerOptions = state.baseCompilerOptions;
|
|
127562
127415
|
}
|
|
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
127416
|
function isFileWatcherWithModifiedTime(value) {
|
|
127569
127417
|
return !!value.watcher;
|
|
127570
127418
|
}
|
|
@@ -127622,23 +127470,6 @@ function getOutputTimeStampMap(state, resolvedConfigFilePath) {
|
|
|
127622
127470
|
if (!result) state.outputTimeStamps.set(resolvedConfigFilePath, result = /* @__PURE__ */ new Map());
|
|
127623
127471
|
return result;
|
|
127624
127472
|
}
|
|
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
127473
|
function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
|
|
127643
127474
|
const path = toPath2(state, buildInfoPath);
|
|
127644
127475
|
const existing = state.buildInfoCache.get(resolvedConfigPath);
|
|
@@ -127666,41 +127497,41 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
|
|
|
127666
127497
|
}
|
|
127667
127498
|
}
|
|
127668
127499
|
function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
127669
|
-
var _a, _b, _c
|
|
127500
|
+
var _a, _b, _c;
|
|
127670
127501
|
if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
|
|
127671
127502
|
return {
|
|
127672
|
-
type:
|
|
127503
|
+
type: 16 /* ContainerOnly */
|
|
127673
127504
|
};
|
|
127674
127505
|
}
|
|
127675
127506
|
let referenceStatuses;
|
|
127676
127507
|
const force = !!state.options.force;
|
|
127677
127508
|
if (project.projectReferences) {
|
|
127678
|
-
state.projectStatus.set(resolvedPath, { type:
|
|
127509
|
+
state.projectStatus.set(resolvedPath, { type: 13 /* ComputingUpstream */ });
|
|
127679
127510
|
for (const ref of project.projectReferences) {
|
|
127680
127511
|
const resolvedRef = resolveProjectReferencePath(ref);
|
|
127681
127512
|
const resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
|
|
127682
127513
|
const resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
|
|
127683
127514
|
const refStatus = getUpToDateStatus(state, resolvedConfig, resolvedRefPath);
|
|
127684
|
-
if (refStatus.type ===
|
|
127515
|
+
if (refStatus.type === 13 /* ComputingUpstream */ || refStatus.type === 16 /* ContainerOnly */) {
|
|
127685
127516
|
continue;
|
|
127686
127517
|
}
|
|
127687
|
-
if (refStatus.type === 0 /* Unbuildable */ || refStatus.type ===
|
|
127518
|
+
if (refStatus.type === 0 /* Unbuildable */ || refStatus.type === 12 /* UpstreamBlocked */) {
|
|
127688
127519
|
return {
|
|
127689
|
-
type:
|
|
127520
|
+
type: 12 /* UpstreamBlocked */,
|
|
127690
127521
|
upstreamProjectName: ref.path,
|
|
127691
|
-
upstreamProjectBlocked: refStatus.type ===
|
|
127522
|
+
upstreamProjectBlocked: refStatus.type === 12 /* UpstreamBlocked */
|
|
127692
127523
|
};
|
|
127693
127524
|
}
|
|
127694
127525
|
if (refStatus.type !== 1 /* UpToDate */) {
|
|
127695
127526
|
return {
|
|
127696
|
-
type:
|
|
127527
|
+
type: 11 /* UpstreamOutOfDate */,
|
|
127697
127528
|
upstreamProjectName: ref.path
|
|
127698
127529
|
};
|
|
127699
127530
|
}
|
|
127700
127531
|
if (!force) (referenceStatuses || (referenceStatuses = [])).push({ ref, refStatus, resolvedRefPath, resolvedConfig });
|
|
127701
127532
|
}
|
|
127702
127533
|
}
|
|
127703
|
-
if (force) return { type:
|
|
127534
|
+
if (force) return { type: 17 /* ForceBuild */ };
|
|
127704
127535
|
const { host } = state;
|
|
127705
127536
|
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(project.options);
|
|
127706
127537
|
const isIncremental = isIncrementalCompilation(project.options);
|
|
@@ -127729,20 +127560,32 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127729
127560
|
const incrementalBuildInfo = isIncremental && isIncrementalBuildInfo(buildInfo) ? buildInfo : void 0;
|
|
127730
127561
|
if ((incrementalBuildInfo || !isIncremental) && buildInfo.version !== version) {
|
|
127731
127562
|
return {
|
|
127732
|
-
type:
|
|
127563
|
+
type: 14 /* TsVersionOutputOfDate */,
|
|
127733
127564
|
version: buildInfo.version
|
|
127734
127565
|
};
|
|
127735
127566
|
}
|
|
127567
|
+
if (buildInfo.errors) {
|
|
127568
|
+
return {
|
|
127569
|
+
type: 8 /* OutOfDateBuildInfoWithErrors */,
|
|
127570
|
+
buildInfoFile: buildInfoPath
|
|
127571
|
+
};
|
|
127572
|
+
}
|
|
127736
127573
|
if (incrementalBuildInfo) {
|
|
127737
|
-
if (((_a = incrementalBuildInfo.
|
|
127574
|
+
if (((_a = incrementalBuildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _a.length) || !project.options.noEmit && getEmitDeclarations(project.options) && ((_b = incrementalBuildInfo.emitDiagnosticsPerFile) == null ? void 0 : _b.length)) {
|
|
127738
127575
|
return {
|
|
127739
|
-
type:
|
|
127576
|
+
type: 8 /* OutOfDateBuildInfoWithErrors */,
|
|
127577
|
+
buildInfoFile: buildInfoPath
|
|
127578
|
+
};
|
|
127579
|
+
}
|
|
127580
|
+
if (!project.options.noEmit && (((_c = incrementalBuildInfo.affectedFilesPendingEmit) == null ? void 0 : _c.length) || incrementalBuildInfo.pendingEmit !== void 0)) {
|
|
127581
|
+
return {
|
|
127582
|
+
type: 7 /* OutOfDateBuildInfoWithPendingEmit */,
|
|
127740
127583
|
buildInfoFile: buildInfoPath
|
|
127741
127584
|
};
|
|
127742
127585
|
}
|
|
127743
127586
|
if (!project.options.noEmit && getPendingEmitKind(project.options, incrementalBuildInfo.options || {})) {
|
|
127744
127587
|
return {
|
|
127745
|
-
type:
|
|
127588
|
+
type: 9 /* OutOfDateOptions */,
|
|
127746
127589
|
buildInfoFile: buildInfoPath
|
|
127747
127590
|
};
|
|
127748
127591
|
}
|
|
@@ -127762,7 +127605,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127762
127605
|
reason: `${inputFile} does not exist`
|
|
127763
127606
|
};
|
|
127764
127607
|
}
|
|
127765
|
-
const inputPath =
|
|
127608
|
+
const inputPath = toPath2(state, inputFile);
|
|
127766
127609
|
if (buildInfoTime < inputTime) {
|
|
127767
127610
|
let version2;
|
|
127768
127611
|
let currentVersion;
|
|
@@ -127786,22 +127629,28 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127786
127629
|
newestInputFileName = inputFile;
|
|
127787
127630
|
newestInputFileTime = inputTime;
|
|
127788
127631
|
}
|
|
127789
|
-
|
|
127632
|
+
seenRoots.add(inputPath);
|
|
127790
127633
|
}
|
|
127634
|
+
let existingRoot;
|
|
127791
127635
|
if (incrementalBuildInfo) {
|
|
127792
127636
|
if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
|
|
127793
|
-
|
|
127637
|
+
existingRoot = forEachEntry(
|
|
127794
127638
|
buildInfoVersionMap.roots,
|
|
127795
127639
|
// File was root file when project was built but its not any more
|
|
127796
127640
|
(_resolved, existingRoot2) => !seenRoots.has(existingRoot2) ? existingRoot2 : void 0
|
|
127797
127641
|
);
|
|
127798
|
-
|
|
127799
|
-
|
|
127800
|
-
|
|
127801
|
-
|
|
127802
|
-
|
|
127803
|
-
|
|
127804
|
-
|
|
127642
|
+
} else {
|
|
127643
|
+
existingRoot = forEach(
|
|
127644
|
+
getNonIncrementalBuildInfoRoots(buildInfo, buildInfoPath, host),
|
|
127645
|
+
(root) => !seenRoots.has(root) ? root : void 0
|
|
127646
|
+
);
|
|
127647
|
+
}
|
|
127648
|
+
if (existingRoot) {
|
|
127649
|
+
return {
|
|
127650
|
+
type: 10 /* OutOfDateRoots */,
|
|
127651
|
+
buildInfoFile: buildInfoPath,
|
|
127652
|
+
inputFile: existingRoot
|
|
127653
|
+
};
|
|
127805
127654
|
}
|
|
127806
127655
|
if (!isIncremental) {
|
|
127807
127656
|
const outputs = getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
|
|
@@ -127870,7 +127719,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
127870
127719
|
);
|
|
127871
127720
|
if (dependentPackageFileStatus) return dependentPackageFileStatus;
|
|
127872
127721
|
return {
|
|
127873
|
-
type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ?
|
|
127722
|
+
type: pseudoUpToDate ? 2 /* UpToDateWithUpstreamTypes */ : pseudoInputUpToDate ? 15 /* UpToDateWithInputFileText */ : 1 /* UpToDate */,
|
|
127874
127723
|
newestInputFileTime,
|
|
127875
127724
|
newestInputFileName,
|
|
127876
127725
|
oldestOutputFileName
|
|
@@ -127882,7 +127731,7 @@ function hasSameBuildInfo(state, buildInfoCacheEntry, resolvedRefPath) {
|
|
|
127882
127731
|
}
|
|
127883
127732
|
function getUpToDateStatus(state, project, resolvedPath) {
|
|
127884
127733
|
if (project === void 0) {
|
|
127885
|
-
return { type: 0 /* Unbuildable */, reason: "
|
|
127734
|
+
return { type: 0 /* Unbuildable */, reason: "config file deleted mid-build" };
|
|
127886
127735
|
}
|
|
127887
127736
|
const prior = state.projectStatus.get(resolvedPath);
|
|
127888
127737
|
if (prior !== void 0) {
|
|
@@ -127953,7 +127802,7 @@ function updateOutputTimestamps(state, proj, resolvedPath) {
|
|
|
127953
127802
|
});
|
|
127954
127803
|
}
|
|
127955
127804
|
function queueReferencingProjects(state, project, projectPath, projectIndex, config, buildOrder, buildResult) {
|
|
127956
|
-
if (buildResult &
|
|
127805
|
+
if (buildResult & 4 /* AnyErrors */) return;
|
|
127957
127806
|
if (!config.options.composite) return;
|
|
127958
127807
|
for (let index = projectIndex + 1; index < buildOrder.length; index++) {
|
|
127959
127808
|
const nextProject = buildOrder[index];
|
|
@@ -127972,7 +127821,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
|
|
|
127972
127821
|
status.type = 2 /* UpToDateWithUpstreamTypes */;
|
|
127973
127822
|
break;
|
|
127974
127823
|
}
|
|
127975
|
-
case
|
|
127824
|
+
case 15 /* UpToDateWithInputFileText */:
|
|
127976
127825
|
case 2 /* UpToDateWithUpstreamTypes */:
|
|
127977
127826
|
if (!(buildResult & 2 /* DeclarationOutputUnchanged */)) {
|
|
127978
127827
|
state.projectStatus.set(nextProjectPath, {
|
|
@@ -127982,7 +127831,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
|
|
|
127982
127831
|
});
|
|
127983
127832
|
}
|
|
127984
127833
|
break;
|
|
127985
|
-
case
|
|
127834
|
+
case 12 /* UpstreamBlocked */:
|
|
127986
127835
|
if (toResolvedConfigFilePath(state, resolveProjectName(state, status.upstreamProjectName)) === projectPath) {
|
|
127987
127836
|
clearProjectStatus(state, nextProjectPath);
|
|
127988
127837
|
}
|
|
@@ -128401,21 +128250,28 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
128401
128250
|
relName(state, configFileName),
|
|
128402
128251
|
relName(state, status.fileName)
|
|
128403
128252
|
);
|
|
128404
|
-
case 7 /*
|
|
128253
|
+
case 7 /* OutOfDateBuildInfoWithPendingEmit */:
|
|
128405
128254
|
return reportStatus(
|
|
128406
128255
|
state,
|
|
128407
128256
|
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted,
|
|
128408
128257
|
relName(state, configFileName),
|
|
128409
128258
|
relName(state, status.buildInfoFile)
|
|
128410
128259
|
);
|
|
128411
|
-
case 8 /*
|
|
128260
|
+
case 8 /* OutOfDateBuildInfoWithErrors */:
|
|
128261
|
+
return reportStatus(
|
|
128262
|
+
state,
|
|
128263
|
+
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors,
|
|
128264
|
+
relName(state, configFileName),
|
|
128265
|
+
relName(state, status.buildInfoFile)
|
|
128266
|
+
);
|
|
128267
|
+
case 9 /* OutOfDateOptions */:
|
|
128412
128268
|
return reportStatus(
|
|
128413
128269
|
state,
|
|
128414
128270
|
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_there_is_change_in_compilerOptions,
|
|
128415
128271
|
relName(state, configFileName),
|
|
128416
128272
|
relName(state, status.buildInfoFile)
|
|
128417
128273
|
);
|
|
128418
|
-
case
|
|
128274
|
+
case 10 /* OutOfDateRoots */:
|
|
128419
128275
|
return reportStatus(
|
|
128420
128276
|
state,
|
|
128421
128277
|
Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_file_2_was_root_file_of_compilation_but_not_any_more,
|
|
@@ -128440,20 +128296,20 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
128440
128296
|
Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies,
|
|
128441
128297
|
relName(state, configFileName)
|
|
128442
128298
|
);
|
|
128443
|
-
case
|
|
128299
|
+
case 15 /* UpToDateWithInputFileText */:
|
|
128444
128300
|
return reportStatus(
|
|
128445
128301
|
state,
|
|
128446
128302
|
Diagnostics.Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files,
|
|
128447
128303
|
relName(state, configFileName)
|
|
128448
128304
|
);
|
|
128449
|
-
case
|
|
128305
|
+
case 11 /* UpstreamOutOfDate */:
|
|
128450
128306
|
return reportStatus(
|
|
128451
128307
|
state,
|
|
128452
128308
|
Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date,
|
|
128453
128309
|
relName(state, configFileName),
|
|
128454
128310
|
relName(state, status.upstreamProjectName)
|
|
128455
128311
|
);
|
|
128456
|
-
case
|
|
128312
|
+
case 12 /* UpstreamBlocked */:
|
|
128457
128313
|
return reportStatus(
|
|
128458
128314
|
state,
|
|
128459
128315
|
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,
|
|
@@ -128463,11 +128319,11 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
128463
128319
|
case 0 /* Unbuildable */:
|
|
128464
128320
|
return reportStatus(
|
|
128465
128321
|
state,
|
|
128466
|
-
Diagnostics.
|
|
128322
|
+
Diagnostics.Project_0_is_out_of_date_because_1,
|
|
128467
128323
|
relName(state, configFileName),
|
|
128468
128324
|
status.reason
|
|
128469
128325
|
);
|
|
128470
|
-
case
|
|
128326
|
+
case 14 /* TsVersionOutputOfDate */:
|
|
128471
128327
|
return reportStatus(
|
|
128472
128328
|
state,
|
|
128473
128329
|
Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2,
|
|
@@ -128475,14 +128331,14 @@ function reportUpToDateStatus(state, configFileName, status) {
|
|
|
128475
128331
|
status.version,
|
|
128476
128332
|
version
|
|
128477
128333
|
);
|
|
128478
|
-
case
|
|
128334
|
+
case 17 /* ForceBuild */:
|
|
128479
128335
|
return reportStatus(
|
|
128480
128336
|
state,
|
|
128481
128337
|
Diagnostics.Project_0_is_being_forcibly_rebuilt,
|
|
128482
128338
|
relName(state, configFileName)
|
|
128483
128339
|
);
|
|
128484
|
-
case
|
|
128485
|
-
case
|
|
128340
|
+
case 16 /* ContainerOnly */:
|
|
128341
|
+
case 13 /* ComputingUpstream */:
|
|
128486
128342
|
break;
|
|
128487
128343
|
default:
|
|
128488
128344
|
assertType(status);
|