@typescript-deploys/pr-build 5.6.0-pr-57196-3 → 5.6.0-pr-58668-2
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 +674 -421
- package/lib/typescript.d.ts +12 -10
- package/lib/typescript.js +818 -541
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -277,7 +277,7 @@ __export(typescript_exports, {
|
|
|
277
277
|
changeFullExtension: () => changeFullExtension,
|
|
278
278
|
changesAffectModuleResolution: () => changesAffectModuleResolution,
|
|
279
279
|
changesAffectingProgramStructure: () => changesAffectingProgramStructure,
|
|
280
|
-
|
|
280
|
+
characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
|
|
281
281
|
childIsDecorated: () => childIsDecorated,
|
|
282
282
|
classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
|
|
283
283
|
classHasClassThisAssignment: () => classHasClassThisAssignment,
|
|
@@ -377,9 +377,8 @@ __export(typescript_exports, {
|
|
|
377
377
|
createBaseNodeFactory: () => createBaseNodeFactory,
|
|
378
378
|
createBinaryExpressionTrampoline: () => createBinaryExpressionTrampoline,
|
|
379
379
|
createBindingHelper: () => createBindingHelper,
|
|
380
|
-
createBuildInfo: () => createBuildInfo,
|
|
381
380
|
createBuilderProgram: () => createBuilderProgram,
|
|
382
|
-
|
|
381
|
+
createBuilderProgramUsingIncrementalBuildInfo: () => createBuilderProgramUsingIncrementalBuildInfo,
|
|
383
382
|
createBuilderStatusReporter: () => createBuilderStatusReporter,
|
|
384
383
|
createCacheWithRedirects: () => createCacheWithRedirects,
|
|
385
384
|
createCacheableExportInfoMap: () => createCacheableExportInfoMap,
|
|
@@ -1263,7 +1262,7 @@ __export(typescript_exports, {
|
|
|
1263
1262
|
isBreakStatement: () => isBreakStatement,
|
|
1264
1263
|
isBuild: () => isBuild,
|
|
1265
1264
|
isBuildInfoFile: () => isBuildInfoFile,
|
|
1266
|
-
isBuilderProgram: () =>
|
|
1265
|
+
isBuilderProgram: () => isBuilderProgram,
|
|
1267
1266
|
isBundle: () => isBundle,
|
|
1268
1267
|
isCallChain: () => isCallChain,
|
|
1269
1268
|
isCallExpression: () => isCallExpression,
|
|
@@ -1470,6 +1469,8 @@ __export(typescript_exports, {
|
|
|
1470
1469
|
isInTemplateString: () => isInTemplateString,
|
|
1471
1470
|
isInTopLevelContext: () => isInTopLevelContext,
|
|
1472
1471
|
isInTypeQuery: () => isInTypeQuery,
|
|
1472
|
+
isIncrementalBuildInfo: () => isIncrementalBuildInfo,
|
|
1473
|
+
isIncrementalBundleEmitBuildInfo: () => isIncrementalBundleEmitBuildInfo,
|
|
1473
1474
|
isIncrementalCompilation: () => isIncrementalCompilation,
|
|
1474
1475
|
isIndexSignatureDeclaration: () => isIndexSignatureDeclaration,
|
|
1475
1476
|
isIndexedAccessTypeNode: () => isIndexedAccessTypeNode,
|
|
@@ -1612,6 +1613,7 @@ __export(typescript_exports, {
|
|
|
1612
1613
|
isModuleBlock: () => isModuleBlock,
|
|
1613
1614
|
isModuleBody: () => isModuleBody,
|
|
1614
1615
|
isModuleDeclaration: () => isModuleDeclaration,
|
|
1616
|
+
isModuleExportName: () => isModuleExportName,
|
|
1615
1617
|
isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
|
|
1616
1618
|
isModuleIdentifier: () => isModuleIdentifier,
|
|
1617
1619
|
isModuleName: () => isModuleName,
|
|
@@ -1705,7 +1707,6 @@ __export(typescript_exports, {
|
|
|
1705
1707
|
isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
|
|
1706
1708
|
isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
|
|
1707
1709
|
isPrivateIdentifierSymbol: () => isPrivateIdentifierSymbol,
|
|
1708
|
-
isProgramBundleEmitBuildInfo: () => isProgramBundleEmitBuildInfo,
|
|
1709
1710
|
isProgramUptoDate: () => isProgramUptoDate,
|
|
1710
1711
|
isPrologueDirective: () => isPrologueDirective,
|
|
1711
1712
|
isPropertyAccessChain: () => isPropertyAccessChain,
|
|
@@ -1929,6 +1930,9 @@ __export(typescript_exports, {
|
|
|
1929
1930
|
missingFileModifiedTime: () => missingFileModifiedTime,
|
|
1930
1931
|
modifierToFlag: () => modifierToFlag,
|
|
1931
1932
|
modifiersToFlags: () => modifiersToFlags,
|
|
1933
|
+
moduleExportNameIsDefault: () => moduleExportNameIsDefault,
|
|
1934
|
+
moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
|
|
1935
|
+
moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
|
|
1932
1936
|
moduleOptionDeclaration: () => moduleOptionDeclaration,
|
|
1933
1937
|
moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
|
|
1934
1938
|
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
@@ -2074,7 +2078,7 @@ __export(typescript_exports, {
|
|
|
2074
2078
|
reducePathComponents: () => reducePathComponents,
|
|
2075
2079
|
refactor: () => ts_refactor_exports,
|
|
2076
2080
|
regExpEscape: () => regExpEscape,
|
|
2077
|
-
|
|
2081
|
+
regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
|
|
2078
2082
|
relativeComplement: () => relativeComplement,
|
|
2079
2083
|
removeAllComments: () => removeAllComments,
|
|
2080
2084
|
removeEmitHelper: () => removeEmitHelper,
|
|
@@ -2371,7 +2375,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2371
2375
|
|
|
2372
2376
|
// src/compiler/corePublic.ts
|
|
2373
2377
|
var versionMajorMinor = "5.6";
|
|
2374
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2378
|
+
var version = `${versionMajorMinor}.0-insiders.20240607`;
|
|
2375
2379
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2376
2380
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2377
2381
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11456,7 +11460,8 @@ var Diagnostics = {
|
|
|
11456
11460
|
Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type."),
|
|
11457
11461
|
await_using_statements_cannot_be_used_inside_a_class_static_block: diag(18054, 1 /* Error */, "await_using_statements_cannot_be_used_inside_a_class_static_block_18054", "'await using' statements cannot be used inside a class static block."),
|
|
11458
11462
|
_0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is_enabled: diag(18055, 1 /* Error */, "_0_has_a_string_type_but_must_have_syntactically_recognizable_string_syntax_when_isolatedModules_is__18055", "'{0}' has a string type, but must have syntactically recognizable string syntax when 'isolatedModules' is enabled."),
|
|
11459
|
-
Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.")
|
|
11463
|
+
Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is_enabled: diag(18056, 1 /* Error */, "Enum_member_following_a_non_literal_numeric_member_must_have_an_initializer_when_isolatedModules_is__18056", "Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled."),
|
|
11464
|
+
String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020: diag(18057, 1 /* Error */, "String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es_18057", "String literal import and export names are not supported when the '--module' flag is set to 'es2015' or 'es2020'.")
|
|
11460
11465
|
};
|
|
11461
11466
|
|
|
11462
11467
|
// src/compiler/scanner.ts
|
|
@@ -11616,16 +11621,16 @@ var textToToken = new Map(Object.entries({
|
|
|
11616
11621
|
"#": 63 /* HashToken */,
|
|
11617
11622
|
"`": 62 /* BacktickToken */
|
|
11618
11623
|
}));
|
|
11619
|
-
var
|
|
11620
|
-
d
|
|
11621
|
-
g
|
|
11622
|
-
i
|
|
11623
|
-
m
|
|
11624
|
-
s
|
|
11625
|
-
u
|
|
11626
|
-
v
|
|
11627
|
-
y
|
|
11628
|
-
|
|
11624
|
+
var charCodeToRegExpFlag = /* @__PURE__ */ new Map([
|
|
11625
|
+
[100 /* d */, 1 /* HasIndices */],
|
|
11626
|
+
[103 /* g */, 2 /* Global */],
|
|
11627
|
+
[105 /* i */, 4 /* IgnoreCase */],
|
|
11628
|
+
[109 /* m */, 8 /* Multiline */],
|
|
11629
|
+
[115 /* s */, 16 /* DotAll */],
|
|
11630
|
+
[117 /* u */, 32 /* Unicode */],
|
|
11631
|
+
[118 /* v */, 64 /* UnicodeSets */],
|
|
11632
|
+
[121 /* y */, 128 /* Sticky */]
|
|
11633
|
+
]);
|
|
11629
11634
|
var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
|
|
11630
11635
|
[1 /* HasIndices */, 9 /* RegularExpressionFlagsHasIndices */],
|
|
11631
11636
|
[16 /* DotAll */, 5 /* RegularExpressionFlagsDotAll */],
|
|
@@ -11681,12 +11686,12 @@ function tokenToString(t) {
|
|
|
11681
11686
|
function stringToToken(s) {
|
|
11682
11687
|
return textToToken.get(s);
|
|
11683
11688
|
}
|
|
11684
|
-
var
|
|
11685
|
-
function
|
|
11686
|
-
return
|
|
11689
|
+
var regExpFlagCharCodes = makeReverseMap(charCodeToRegExpFlag);
|
|
11690
|
+
function regularExpressionFlagToCharacterCode(f) {
|
|
11691
|
+
return regExpFlagCharCodes[f];
|
|
11687
11692
|
}
|
|
11688
|
-
function
|
|
11689
|
-
return
|
|
11693
|
+
function characterCodeToRegularExpressionFlag(ch) {
|
|
11694
|
+
return charCodeToRegExpFlag.get(ch);
|
|
11690
11695
|
}
|
|
11691
11696
|
function computeLineStarts(text) {
|
|
11692
11697
|
const result = [];
|
|
@@ -13402,24 +13407,25 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13402
13407
|
pos++;
|
|
13403
13408
|
let regExpFlags = 0 /* None */;
|
|
13404
13409
|
while (true) {
|
|
13405
|
-
const ch =
|
|
13410
|
+
const ch = codePointChecked(pos);
|
|
13406
13411
|
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
|
|
13407
13412
|
break;
|
|
13408
13413
|
}
|
|
13414
|
+
const size = charSize(ch);
|
|
13409
13415
|
if (reportErrors2) {
|
|
13410
|
-
const flag =
|
|
13416
|
+
const flag = characterCodeToRegularExpressionFlag(ch);
|
|
13411
13417
|
if (flag === void 0) {
|
|
13412
|
-
error2(Diagnostics.Unknown_regular_expression_flag, pos,
|
|
13418
|
+
error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
|
|
13413
13419
|
} else if (regExpFlags & flag) {
|
|
13414
|
-
error2(Diagnostics.Duplicate_regular_expression_flag, pos,
|
|
13420
|
+
error2(Diagnostics.Duplicate_regular_expression_flag, pos, size);
|
|
13415
13421
|
} else if (((regExpFlags | flag) & 96 /* AnyUnicodeMode */) === 96 /* AnyUnicodeMode */) {
|
|
13416
|
-
error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos,
|
|
13422
|
+
error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, size);
|
|
13417
13423
|
} else {
|
|
13418
13424
|
regExpFlags |= flag;
|
|
13419
|
-
|
|
13425
|
+
checkRegularExpressionFlagAvailability(flag, size);
|
|
13420
13426
|
}
|
|
13421
13427
|
}
|
|
13422
|
-
pos
|
|
13428
|
+
pos += size;
|
|
13423
13429
|
}
|
|
13424
13430
|
if (reportErrors2) {
|
|
13425
13431
|
scanRange(startOfRegExpBody, endOfRegExpBody - startOfRegExpBody, () => {
|
|
@@ -13634,22 +13640,23 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
13634
13640
|
}
|
|
13635
13641
|
function scanPatternModifiers(currFlags) {
|
|
13636
13642
|
while (true) {
|
|
13637
|
-
const ch =
|
|
13643
|
+
const ch = codePointChecked(pos);
|
|
13638
13644
|
if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
|
|
13639
13645
|
break;
|
|
13640
13646
|
}
|
|
13641
|
-
const
|
|
13647
|
+
const size = charSize(ch);
|
|
13648
|
+
const flag = characterCodeToRegularExpressionFlag(ch);
|
|
13642
13649
|
if (flag === void 0) {
|
|
13643
|
-
error2(Diagnostics.Unknown_regular_expression_flag, pos,
|
|
13650
|
+
error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
|
|
13644
13651
|
} else if (currFlags & flag) {
|
|
13645
|
-
error2(Diagnostics.Duplicate_regular_expression_flag, pos,
|
|
13652
|
+
error2(Diagnostics.Duplicate_regular_expression_flag, pos, size);
|
|
13646
13653
|
} else if (!(flag & 28 /* Modifiers */)) {
|
|
13647
|
-
error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos,
|
|
13654
|
+
error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, size);
|
|
13648
13655
|
} else {
|
|
13649
13656
|
currFlags |= flag;
|
|
13650
|
-
|
|
13657
|
+
checkRegularExpressionFlagAvailability(flag, size);
|
|
13651
13658
|
}
|
|
13652
|
-
pos
|
|
13659
|
+
pos += size;
|
|
13653
13660
|
}
|
|
13654
13661
|
return currFlags;
|
|
13655
13662
|
}
|
|
@@ -14253,6 +14260,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14253
14260
|
forEach(groupNameReferences, (reference) => {
|
|
14254
14261
|
if (!(groupSpecifiers == null ? void 0 : groupSpecifiers.has(reference.name))) {
|
|
14255
14262
|
error2(Diagnostics.There_is_no_capturing_group_named_0_in_this_regular_expression, reference.pos, reference.end - reference.pos, reference.name);
|
|
14263
|
+
if (groupSpecifiers) {
|
|
14264
|
+
const suggestion = getSpellingSuggestion(reference.name, groupSpecifiers, identity);
|
|
14265
|
+
if (suggestion) {
|
|
14266
|
+
error2(Diagnostics.Did_you_mean_0, reference.pos, reference.end - reference.pos, suggestion);
|
|
14267
|
+
}
|
|
14268
|
+
}
|
|
14256
14269
|
}
|
|
14257
14270
|
});
|
|
14258
14271
|
forEach(decimalEscapes, (escape) => {
|
|
@@ -14265,10 +14278,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
|
|
|
14265
14278
|
}
|
|
14266
14279
|
});
|
|
14267
14280
|
}
|
|
14268
|
-
function
|
|
14281
|
+
function checkRegularExpressionFlagAvailability(flag, size) {
|
|
14269
14282
|
const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
|
|
14270
14283
|
if (availableFrom && languageVersion < availableFrom) {
|
|
14271
|
-
error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later,
|
|
14284
|
+
error2(Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later, pos, size, getNameOfScriptTarget(availableFrom));
|
|
14272
14285
|
}
|
|
14273
14286
|
}
|
|
14274
14287
|
function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
|
|
@@ -16596,7 +16609,16 @@ function isJSDocTypeExpressionOrChild(node) {
|
|
|
16596
16609
|
return !!findAncestor(node, isJSDocTypeExpression);
|
|
16597
16610
|
}
|
|
16598
16611
|
function isExportNamespaceAsDefaultDeclaration(node) {
|
|
16599
|
-
return !!(isExportDeclaration(node) && node.exportClause && isNamespaceExport(node.exportClause) && node.exportClause.name
|
|
16612
|
+
return !!(isExportDeclaration(node) && node.exportClause && isNamespaceExport(node.exportClause) && moduleExportNameIsDefault(node.exportClause.name));
|
|
16613
|
+
}
|
|
16614
|
+
function moduleExportNameTextUnescaped(node) {
|
|
16615
|
+
return node.kind === 11 /* StringLiteral */ ? node.text : unescapeLeadingUnderscores(node.escapedText);
|
|
16616
|
+
}
|
|
16617
|
+
function moduleExportNameTextEscaped(node) {
|
|
16618
|
+
return node.kind === 11 /* StringLiteral */ ? escapeLeadingUnderscores(node.text) : node.escapedText;
|
|
16619
|
+
}
|
|
16620
|
+
function moduleExportNameIsDefault(node) {
|
|
16621
|
+
return (node.kind === 11 /* StringLiteral */ ? node.text : node.escapedText) === "default" /* Default */;
|
|
16600
16622
|
}
|
|
16601
16623
|
function getTextOfNodeFromSourceText(sourceText, node, includeTrivia = false) {
|
|
16602
16624
|
if (nodeIsMissing(node)) {
|
|
@@ -30391,6 +30413,9 @@ function isNamedExports(node) {
|
|
|
30391
30413
|
function isExportSpecifier(node) {
|
|
30392
30414
|
return node.kind === 281 /* ExportSpecifier */;
|
|
30393
30415
|
}
|
|
30416
|
+
function isModuleExportName(node) {
|
|
30417
|
+
return node.kind === 80 /* Identifier */ || node.kind === 11 /* StringLiteral */;
|
|
30418
|
+
}
|
|
30394
30419
|
function isMissingDeclaration(node) {
|
|
30395
30420
|
return node.kind === 282 /* MissingDeclaration */;
|
|
30396
30421
|
}
|
|
@@ -31136,6 +31161,9 @@ function getLocalNameForExternalImport(factory2, node, sourceFile) {
|
|
|
31136
31161
|
const namespaceDeclaration = getNamespaceDeclarationNode(node);
|
|
31137
31162
|
if (namespaceDeclaration && !isDefaultImport(node) && !isExportNamespaceAsDefaultDeclaration(node)) {
|
|
31138
31163
|
const name = namespaceDeclaration.name;
|
|
31164
|
+
if (name.kind === 11 /* StringLiteral */) {
|
|
31165
|
+
return factory2.getGeneratedNameForNode(node);
|
|
31166
|
+
}
|
|
31139
31167
|
return isGeneratedIdentifier(name) ? name : factory2.createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, name) || idText(name));
|
|
31140
31168
|
}
|
|
31141
31169
|
if (node.kind === 272 /* ImportDeclaration */ && node.importClause) {
|
|
@@ -33498,6 +33526,9 @@ var Parser;
|
|
|
33498
33526
|
if (token() === 161 /* FromKeyword */ && lookAhead(nextTokenIsStringLiteral)) {
|
|
33499
33527
|
return false;
|
|
33500
33528
|
}
|
|
33529
|
+
if (token() === 11 /* StringLiteral */) {
|
|
33530
|
+
return true;
|
|
33531
|
+
}
|
|
33501
33532
|
return tokenIsIdentifierOrKeyword(token());
|
|
33502
33533
|
case 13 /* JsxAttributes */:
|
|
33503
33534
|
return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
|
|
@@ -37946,6 +37977,12 @@ var Parser;
|
|
|
37946
37977
|
const name = parseIdentifier();
|
|
37947
37978
|
return finishNode(factory2.createNamespaceImport(name), pos);
|
|
37948
37979
|
}
|
|
37980
|
+
function canParseModuleExportName() {
|
|
37981
|
+
return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
|
|
37982
|
+
}
|
|
37983
|
+
function parseModuleExportName(parseName) {
|
|
37984
|
+
return token() === 11 /* StringLiteral */ ? parseLiteralNode() : parseName();
|
|
37985
|
+
}
|
|
37949
37986
|
function parseNamedImportsOrExports(kind) {
|
|
37950
37987
|
const pos = getNodePos();
|
|
37951
37988
|
const node = kind === 275 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */));
|
|
@@ -37966,42 +38003,51 @@ var Parser;
|
|
|
37966
38003
|
let isTypeOnly = false;
|
|
37967
38004
|
let propertyName;
|
|
37968
38005
|
let canParseAsKeyword = true;
|
|
37969
|
-
let name = parseIdentifierName
|
|
37970
|
-
if (name.escapedText === "type") {
|
|
38006
|
+
let name = parseModuleExportName(parseIdentifierName);
|
|
38007
|
+
if (name.kind === 80 /* Identifier */ && name.escapedText === "type") {
|
|
37971
38008
|
if (token() === 130 /* AsKeyword */) {
|
|
37972
38009
|
const firstAs = parseIdentifierName();
|
|
37973
38010
|
if (token() === 130 /* AsKeyword */) {
|
|
37974
38011
|
const secondAs = parseIdentifierName();
|
|
37975
|
-
if (
|
|
38012
|
+
if (canParseModuleExportName()) {
|
|
37976
38013
|
isTypeOnly = true;
|
|
37977
38014
|
propertyName = firstAs;
|
|
37978
|
-
name = parseNameWithKeywordCheck
|
|
38015
|
+
name = parseModuleExportName(parseNameWithKeywordCheck);
|
|
37979
38016
|
canParseAsKeyword = false;
|
|
37980
38017
|
} else {
|
|
37981
38018
|
propertyName = name;
|
|
37982
38019
|
name = secondAs;
|
|
37983
38020
|
canParseAsKeyword = false;
|
|
37984
38021
|
}
|
|
37985
|
-
} else if (
|
|
38022
|
+
} else if (canParseModuleExportName()) {
|
|
37986
38023
|
propertyName = name;
|
|
37987
38024
|
canParseAsKeyword = false;
|
|
37988
|
-
name = parseNameWithKeywordCheck
|
|
38025
|
+
name = parseModuleExportName(parseNameWithKeywordCheck);
|
|
37989
38026
|
} else {
|
|
37990
38027
|
isTypeOnly = true;
|
|
37991
38028
|
name = firstAs;
|
|
37992
38029
|
}
|
|
37993
|
-
} else if (
|
|
38030
|
+
} else if (canParseModuleExportName()) {
|
|
37994
38031
|
isTypeOnly = true;
|
|
37995
|
-
name = parseNameWithKeywordCheck
|
|
38032
|
+
name = parseModuleExportName(parseNameWithKeywordCheck);
|
|
37996
38033
|
}
|
|
37997
38034
|
}
|
|
37998
38035
|
if (canParseAsKeyword && token() === 130 /* AsKeyword */) {
|
|
37999
38036
|
propertyName = name;
|
|
38000
38037
|
parseExpected(130 /* AsKeyword */);
|
|
38001
|
-
name = parseNameWithKeywordCheck
|
|
38038
|
+
name = parseModuleExportName(parseNameWithKeywordCheck);
|
|
38002
38039
|
}
|
|
38003
|
-
if (kind === 276 /* ImportSpecifier */
|
|
38004
|
-
|
|
38040
|
+
if (kind === 276 /* ImportSpecifier */) {
|
|
38041
|
+
if (name.kind !== 80 /* Identifier */) {
|
|
38042
|
+
parseErrorAt(skipTrivia(sourceText, name.pos), name.end, Diagnostics.Identifier_expected);
|
|
38043
|
+
name = setTextRangePosEnd(createMissingNode(
|
|
38044
|
+
80 /* Identifier */,
|
|
38045
|
+
/*reportAtCurrentPosition*/
|
|
38046
|
+
false
|
|
38047
|
+
), name.pos, name.pos);
|
|
38048
|
+
} else if (checkIdentifierIsKeyword) {
|
|
38049
|
+
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
|
|
38050
|
+
}
|
|
38005
38051
|
}
|
|
38006
38052
|
const node = kind === 276 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name);
|
|
38007
38053
|
return finishNode(node, pos);
|
|
@@ -38013,7 +38059,7 @@ var Parser;
|
|
|
38013
38059
|
}
|
|
38014
38060
|
}
|
|
38015
38061
|
function parseNamespaceExport(pos) {
|
|
38016
|
-
return finishNode(factory2.createNamespaceExport(parseIdentifierName
|
|
38062
|
+
return finishNode(factory2.createNamespaceExport(parseModuleExportName(parseIdentifierName)), pos);
|
|
38017
38063
|
}
|
|
38018
38064
|
function parseExportDeclaration(pos, hasJSDoc, modifiers) {
|
|
38019
38065
|
const savedAwaitContext = inAwaitContext();
|
|
@@ -45774,6 +45820,9 @@ function getModuleInstanceStateWorker(node, visited) {
|
|
|
45774
45820
|
}
|
|
45775
45821
|
function getModuleInstanceStateForAliasTarget(specifier, visited) {
|
|
45776
45822
|
const name = specifier.propertyName || specifier.name;
|
|
45823
|
+
if (name.kind !== 80 /* Identifier */) {
|
|
45824
|
+
return 1 /* Instantiated */;
|
|
45825
|
+
}
|
|
45777
45826
|
let p = specifier.parent;
|
|
45778
45827
|
while (p) {
|
|
45779
45828
|
if (isBlock(p) || isModuleBlock(p) || isSourceFile(p)) {
|
|
@@ -46030,7 +46079,7 @@ function createBinder() {
|
|
|
46030
46079
|
}
|
|
46031
46080
|
function declareSymbol(symbolTable, parent3, node, includes, excludes, isReplaceableByMethod, isComputedName) {
|
|
46032
46081
|
Debug.assert(isComputedName || !hasDynamicName(node));
|
|
46033
|
-
const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && node.name
|
|
46082
|
+
const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && moduleExportNameIsDefault(node.name);
|
|
46034
46083
|
const name = isComputedName ? "__computed" /* Computed */ : isDefaultExport && parent3 ? "default" /* Default */ : getDeclarationName(node);
|
|
46035
46084
|
let symbol;
|
|
46036
46085
|
if (name === void 0) {
|
|
@@ -49918,7 +49967,8 @@ function createTypeChecker(host) {
|
|
|
49918
49967
|
isUndefinedIdentifierExpression(node) {
|
|
49919
49968
|
Debug.assert(isExpressionNode(node));
|
|
49920
49969
|
return getSymbolAtLocation(node) === undefinedSymbol;
|
|
49921
|
-
}
|
|
49970
|
+
},
|
|
49971
|
+
isDefinitelyReferenceToGlobalSymbolObject
|
|
49922
49972
|
});
|
|
49923
49973
|
var evaluate = createEvaluator({
|
|
49924
49974
|
evaluateElementAccessExpression,
|
|
@@ -50875,6 +50925,21 @@ function createTypeChecker(host) {
|
|
|
50875
50925
|
];
|
|
50876
50926
|
initializeTypeChecker();
|
|
50877
50927
|
return checker;
|
|
50928
|
+
function isDefinitelyReferenceToGlobalSymbolObject(node) {
|
|
50929
|
+
if (!isPropertyAccessExpression(node)) return false;
|
|
50930
|
+
if (!isIdentifier(node.name)) return false;
|
|
50931
|
+
if (!isPropertyAccessExpression(node.expression) && !isIdentifier(node.expression)) return false;
|
|
50932
|
+
if (isIdentifier(node.expression)) {
|
|
50933
|
+
return idText(node.expression) === "Symbol" && getResolvedSymbol(node.expression) === (getGlobalSymbol(
|
|
50934
|
+
"Symbol",
|
|
50935
|
+
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
50936
|
+
/*diagnostic*/
|
|
50937
|
+
void 0
|
|
50938
|
+
) || unknownSymbol);
|
|
50939
|
+
}
|
|
50940
|
+
if (!isIdentifier(node.expression.expression)) return false;
|
|
50941
|
+
return idText(node.expression.name) === "Symbol" && idText(node.expression.expression) === "globalThis" && getResolvedSymbol(node.expression.expression) === globalThisSymbol;
|
|
50942
|
+
}
|
|
50878
50943
|
function getCachedType(key) {
|
|
50879
50944
|
return key ? cachedTypes.get(key) : void 0;
|
|
50880
50945
|
}
|
|
@@ -51221,6 +51286,8 @@ function createTypeChecker(host) {
|
|
|
51221
51286
|
moduleName,
|
|
51222
51287
|
moduleName,
|
|
51223
51288
|
moduleNotFoundError,
|
|
51289
|
+
/*ignoreErrors*/
|
|
51290
|
+
false,
|
|
51224
51291
|
/*isForAugmentation*/
|
|
51225
51292
|
true
|
|
51226
51293
|
);
|
|
@@ -51903,7 +51970,7 @@ function createTypeChecker(host) {
|
|
|
51903
51970
|
const isExport = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */;
|
|
51904
51971
|
const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
|
|
51905
51972
|
const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
|
|
51906
|
-
const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" :
|
|
51973
|
+
const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : moduleExportNameTextUnescaped(typeOnlyDeclaration.name);
|
|
51907
51974
|
addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
|
|
51908
51975
|
}
|
|
51909
51976
|
}
|
|
@@ -52147,12 +52214,12 @@ function createTypeChecker(host) {
|
|
|
52147
52214
|
if (valueSymbol.exports) result.exports = new Map(valueSymbol.exports);
|
|
52148
52215
|
return result;
|
|
52149
52216
|
}
|
|
52150
|
-
function getExportOfModule(symbol,
|
|
52217
|
+
function getExportOfModule(symbol, nameText, specifier, dontResolveAlias) {
|
|
52151
52218
|
var _a;
|
|
52152
52219
|
if (symbol.flags & 1536 /* Module */) {
|
|
52153
|
-
const exportSymbol = getExportsOfSymbol(symbol).get(
|
|
52220
|
+
const exportSymbol = getExportsOfSymbol(symbol).get(nameText);
|
|
52154
52221
|
const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
|
|
52155
|
-
const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(
|
|
52222
|
+
const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(nameText);
|
|
52156
52223
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
52157
52224
|
specifier,
|
|
52158
52225
|
exportSymbol,
|
|
@@ -52160,7 +52227,7 @@ function createTypeChecker(host) {
|
|
|
52160
52227
|
/*overwriteEmpty*/
|
|
52161
52228
|
false,
|
|
52162
52229
|
exportStarDeclaration,
|
|
52163
|
-
|
|
52230
|
+
nameText
|
|
52164
52231
|
);
|
|
52165
52232
|
return resolved;
|
|
52166
52233
|
}
|
|
@@ -52178,10 +52245,11 @@ function createTypeChecker(host) {
|
|
|
52178
52245
|
const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
|
|
52179
52246
|
const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
|
|
52180
52247
|
const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
|
|
52181
|
-
if (!isIdentifier(name)) {
|
|
52248
|
+
if (!isIdentifier(name) && name.kind !== 11 /* StringLiteral */) {
|
|
52182
52249
|
return void 0;
|
|
52183
52250
|
}
|
|
52184
|
-
const
|
|
52251
|
+
const nameText = moduleExportNameTextEscaped(name);
|
|
52252
|
+
const suppressInteropError = nameText === "default" /* Default */ && allowSyntheticDefaultImports;
|
|
52185
52253
|
const targetSymbol = resolveESModuleSymbol(
|
|
52186
52254
|
moduleSymbol,
|
|
52187
52255
|
moduleSpecifier,
|
|
@@ -52190,7 +52258,7 @@ function createTypeChecker(host) {
|
|
|
52190
52258
|
suppressInteropError
|
|
52191
52259
|
);
|
|
52192
52260
|
if (targetSymbol) {
|
|
52193
|
-
if (name.
|
|
52261
|
+
if (nameText || name.kind === 11 /* StringLiteral */) {
|
|
52194
52262
|
if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
|
|
52195
52263
|
return moduleSymbol;
|
|
52196
52264
|
}
|
|
@@ -52198,16 +52266,16 @@ function createTypeChecker(host) {
|
|
|
52198
52266
|
if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=" /* ExportEquals */)) {
|
|
52199
52267
|
symbolFromVariable = getPropertyOfType(
|
|
52200
52268
|
getTypeOfSymbol(targetSymbol),
|
|
52201
|
-
|
|
52269
|
+
nameText,
|
|
52202
52270
|
/*skipObjectFunctionPropertyAugment*/
|
|
52203
52271
|
true
|
|
52204
52272
|
);
|
|
52205
52273
|
} else {
|
|
52206
|
-
symbolFromVariable = getPropertyOfVariable(targetSymbol,
|
|
52274
|
+
symbolFromVariable = getPropertyOfVariable(targetSymbol, nameText);
|
|
52207
52275
|
}
|
|
52208
52276
|
symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
|
|
52209
|
-
let symbolFromModule = getExportOfModule(targetSymbol,
|
|
52210
|
-
if (symbolFromModule === void 0 &&
|
|
52277
|
+
let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
|
|
52278
|
+
if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
|
|
52211
52279
|
const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
|
|
52212
52280
|
if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
|
|
52213
52281
|
symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
|
|
@@ -52225,7 +52293,7 @@ function createTypeChecker(host) {
|
|
|
52225
52293
|
var _a;
|
|
52226
52294
|
const moduleName = getFullyQualifiedName(moduleSymbol, node);
|
|
52227
52295
|
const declarationName = declarationNameToString(name);
|
|
52228
|
-
const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
|
|
52296
|
+
const suggestion = isIdentifier(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0;
|
|
52229
52297
|
if (suggestion !== void 0) {
|
|
52230
52298
|
const suggestionName = symbolToString(suggestion);
|
|
52231
52299
|
const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
|
|
@@ -52247,7 +52315,7 @@ function createTypeChecker(host) {
|
|
|
52247
52315
|
}
|
|
52248
52316
|
function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
|
|
52249
52317
|
var _a, _b;
|
|
52250
|
-
const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name
|
|
52318
|
+
const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(moduleExportNameTextEscaped(name));
|
|
52251
52319
|
const exports2 = moduleSymbol.exports;
|
|
52252
52320
|
if (localSymbol) {
|
|
52253
52321
|
const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
|
|
@@ -52279,7 +52347,7 @@ function createTypeChecker(host) {
|
|
|
52279
52347
|
}
|
|
52280
52348
|
}
|
|
52281
52349
|
function getTargetOfImportSpecifier(node, dontResolveAlias) {
|
|
52282
|
-
if (isImportSpecifier(node) &&
|
|
52350
|
+
if (isImportSpecifier(node) && moduleExportNameIsDefault(node.propertyName || node.name)) {
|
|
52283
52351
|
const specifier = getModuleSpecifierForImportOrExport(node);
|
|
52284
52352
|
const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
|
|
52285
52353
|
if (moduleSymbol) {
|
|
@@ -52323,19 +52391,23 @@ function createTypeChecker(host) {
|
|
|
52323
52391
|
}
|
|
52324
52392
|
}
|
|
52325
52393
|
function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
|
|
52326
|
-
|
|
52394
|
+
const name = node.propertyName || node.name;
|
|
52395
|
+
if (moduleExportNameIsDefault(name)) {
|
|
52327
52396
|
const specifier = getModuleSpecifierForImportOrExport(node);
|
|
52328
52397
|
const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
|
|
52329
52398
|
if (moduleSymbol) {
|
|
52330
52399
|
return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
|
|
52331
52400
|
}
|
|
52332
52401
|
}
|
|
52333
|
-
const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) :
|
|
52334
|
-
|
|
52335
|
-
|
|
52336
|
-
|
|
52337
|
-
|
|
52338
|
-
|
|
52402
|
+
const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : name.kind === 11 /* StringLiteral */ ? void 0 : (
|
|
52403
|
+
// Skip for invalid syntax like this: export { "x" }
|
|
52404
|
+
resolveEntityName(
|
|
52405
|
+
name,
|
|
52406
|
+
meaning,
|
|
52407
|
+
/*ignoreErrors*/
|
|
52408
|
+
false,
|
|
52409
|
+
dontResolveAlias
|
|
52410
|
+
)
|
|
52339
52411
|
);
|
|
52340
52412
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
52341
52413
|
node,
|
|
@@ -52783,14 +52855,14 @@ function createTypeChecker(host) {
|
|
|
52783
52855
|
function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
|
|
52784
52856
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
52785
52857
|
const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
|
|
52786
|
-
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage);
|
|
52858
|
+
return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage, ignoreErrors);
|
|
52787
52859
|
}
|
|
52788
|
-
function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation = false) {
|
|
52789
|
-
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
|
|
52860
|
+
function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, ignoreErrors = false, isForAugmentation = false) {
|
|
52861
|
+
return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
|
|
52790
52862
|
}
|
|
52791
52863
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
|
|
52792
52864
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
52793
|
-
if (startsWith(moduleReference, "@types/")) {
|
|
52865
|
+
if (errorNode && startsWith(moduleReference, "@types/")) {
|
|
52794
52866
|
const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
52795
52867
|
const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
|
|
52796
52868
|
error2(errorNode, diag2, withoutAtTypePrefix, moduleReference);
|
|
@@ -52812,7 +52884,7 @@ function createTypeChecker(host) {
|
|
|
52812
52884
|
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
|
|
52813
52885
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
52814
52886
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
52815
|
-
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
52887
|
+
const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
52816
52888
|
const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
52817
52889
|
if (sourceFile) {
|
|
52818
52890
|
if (resolutionDiagnostic) {
|
|
@@ -52820,7 +52892,7 @@ function createTypeChecker(host) {
|
|
|
52820
52892
|
}
|
|
52821
52893
|
if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
|
|
52822
52894
|
const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
52823
|
-
if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
52895
|
+
if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
|
|
52824
52896
|
error2(
|
|
52825
52897
|
errorNode,
|
|
52826
52898
|
Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
|
|
@@ -52829,13 +52901,13 @@ function createTypeChecker(host) {
|
|
|
52829
52901
|
}
|
|
52830
52902
|
} else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
|
|
52831
52903
|
const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
|
|
52832
|
-
if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
52904
|
+
if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
|
|
52833
52905
|
const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
|
|
52834
52906
|
error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
|
|
52835
52907
|
}
|
|
52836
52908
|
}
|
|
52837
52909
|
if (sourceFile.symbol) {
|
|
52838
|
-
if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
52910
|
+
if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
52839
52911
|
errorOnImplicitAnyModule(
|
|
52840
52912
|
/*isError*/
|
|
52841
52913
|
false,
|
|
@@ -52846,7 +52918,7 @@ function createTypeChecker(host) {
|
|
|
52846
52918
|
moduleReference
|
|
52847
52919
|
);
|
|
52848
52920
|
}
|
|
52849
|
-
if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
|
|
52921
|
+
if (errorNode && (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */)) {
|
|
52850
52922
|
const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
|
|
52851
52923
|
const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
|
|
52852
52924
|
if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
|
|
@@ -52906,7 +52978,7 @@ function createTypeChecker(host) {
|
|
|
52906
52978
|
}
|
|
52907
52979
|
return getMergedSymbol(sourceFile.symbol);
|
|
52908
52980
|
}
|
|
52909
|
-
if (moduleNotFoundError) {
|
|
52981
|
+
if (errorNode && moduleNotFoundError) {
|
|
52910
52982
|
error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
|
|
52911
52983
|
}
|
|
52912
52984
|
return void 0;
|
|
@@ -52921,6 +52993,9 @@ function createTypeChecker(host) {
|
|
|
52921
52993
|
return getMergedSymbol(pattern.symbol);
|
|
52922
52994
|
}
|
|
52923
52995
|
}
|
|
52996
|
+
if (!errorNode) {
|
|
52997
|
+
return void 0;
|
|
52998
|
+
}
|
|
52924
52999
|
if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === void 0 || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) {
|
|
52925
53000
|
if (isForAugmentation) {
|
|
52926
53001
|
const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
|
@@ -56384,6 +56459,57 @@ function createTypeChecker(host) {
|
|
|
56384
56459
|
function onEnterNewScope(node) {
|
|
56385
56460
|
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
56386
56461
|
}
|
|
56462
|
+
function tryVisitSimpleTypeNode(node) {
|
|
56463
|
+
const innerNode = skipTypeParentheses(node);
|
|
56464
|
+
switch (innerNode.kind) {
|
|
56465
|
+
case 183 /* TypeReference */:
|
|
56466
|
+
return tryVisitTypeReference(innerNode);
|
|
56467
|
+
case 186 /* TypeQuery */:
|
|
56468
|
+
return tryVisitTypeQuery(innerNode);
|
|
56469
|
+
case 199 /* IndexedAccessType */:
|
|
56470
|
+
return tryVisitIndexedAccess(innerNode);
|
|
56471
|
+
case 198 /* TypeOperator */:
|
|
56472
|
+
const typeOperatorNode = innerNode;
|
|
56473
|
+
if (typeOperatorNode.operator === 143 /* KeyOfKeyword */) {
|
|
56474
|
+
return tryVisitKeyOf(typeOperatorNode);
|
|
56475
|
+
}
|
|
56476
|
+
}
|
|
56477
|
+
return visitNode(node, visitExistingNodeTreeSymbols, isTypeNode);
|
|
56478
|
+
}
|
|
56479
|
+
function tryVisitIndexedAccess(node) {
|
|
56480
|
+
const resultObjectType = tryVisitSimpleTypeNode(node.objectType);
|
|
56481
|
+
if (resultObjectType === void 0) {
|
|
56482
|
+
return void 0;
|
|
56483
|
+
}
|
|
56484
|
+
return factory.updateIndexedAccessTypeNode(node, resultObjectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
|
|
56485
|
+
}
|
|
56486
|
+
function tryVisitKeyOf(node) {
|
|
56487
|
+
Debug.assertEqual(node.operator, 143 /* KeyOfKeyword */);
|
|
56488
|
+
const type = tryVisitSimpleTypeNode(node.type);
|
|
56489
|
+
if (type === void 0) {
|
|
56490
|
+
return void 0;
|
|
56491
|
+
}
|
|
56492
|
+
return factory.updateTypeOperatorNode(node, type);
|
|
56493
|
+
}
|
|
56494
|
+
function tryVisitTypeQuery(node) {
|
|
56495
|
+
const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
|
|
56496
|
+
if (!introducesError) {
|
|
56497
|
+
return factory.updateTypeQueryNode(
|
|
56498
|
+
node,
|
|
56499
|
+
exprName,
|
|
56500
|
+
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
|
|
56501
|
+
);
|
|
56502
|
+
}
|
|
56503
|
+
const serializedName = serializeTypeName(
|
|
56504
|
+
context,
|
|
56505
|
+
node.exprName,
|
|
56506
|
+
/*isTypeOf*/
|
|
56507
|
+
true
|
|
56508
|
+
);
|
|
56509
|
+
if (serializedName) {
|
|
56510
|
+
return setTextRange2(context, serializedName, node.exprName);
|
|
56511
|
+
}
|
|
56512
|
+
}
|
|
56387
56513
|
function tryVisitTypeReference(node) {
|
|
56388
56514
|
if (canReuseTypeNode(context, node)) {
|
|
56389
56515
|
const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
|
|
@@ -56517,13 +56643,13 @@ function createTypeChecker(host) {
|
|
|
56517
56643
|
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
56518
56644
|
);
|
|
56519
56645
|
}
|
|
56520
|
-
if (isIndexedAccessTypeNode(node)
|
|
56521
|
-
const
|
|
56522
|
-
if (!
|
|
56646
|
+
if (isIndexedAccessTypeNode(node)) {
|
|
56647
|
+
const result = tryVisitIndexedAccess(node);
|
|
56648
|
+
if (!result) {
|
|
56523
56649
|
hadError = true;
|
|
56524
56650
|
return node;
|
|
56525
56651
|
}
|
|
56526
|
-
return
|
|
56652
|
+
return result;
|
|
56527
56653
|
}
|
|
56528
56654
|
if (isTypeReferenceNode(node)) {
|
|
56529
56655
|
const result = tryVisitTypeReference(node);
|
|
@@ -56566,25 +56692,12 @@ function createTypeChecker(host) {
|
|
|
56566
56692
|
return visited;
|
|
56567
56693
|
}
|
|
56568
56694
|
if (isTypeQueryNode(node)) {
|
|
56569
|
-
const
|
|
56570
|
-
if (
|
|
56571
|
-
const serializedName = serializeTypeName(
|
|
56572
|
-
context,
|
|
56573
|
-
node.exprName,
|
|
56574
|
-
/*isTypeOf*/
|
|
56575
|
-
true
|
|
56576
|
-
);
|
|
56577
|
-
if (serializedName) {
|
|
56578
|
-
return setTextRange2(context, serializedName, node.exprName);
|
|
56579
|
-
}
|
|
56695
|
+
const result = tryVisitTypeQuery(node);
|
|
56696
|
+
if (!result) {
|
|
56580
56697
|
hadError = true;
|
|
56581
56698
|
return node;
|
|
56582
56699
|
}
|
|
56583
|
-
return
|
|
56584
|
-
node,
|
|
56585
|
-
exprName,
|
|
56586
|
-
visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
|
|
56587
|
-
);
|
|
56700
|
+
return result;
|
|
56588
56701
|
}
|
|
56589
56702
|
if (isComputedPropertyName(node) && isEntityNameExpression(node.expression)) {
|
|
56590
56703
|
const { node: result, introducesError } = trackExistingEntityName(node.expression, context);
|
|
@@ -56649,14 +56762,12 @@ function createTypeChecker(host) {
|
|
|
56649
56762
|
return node;
|
|
56650
56763
|
}
|
|
56651
56764
|
} else if (node.operator === 143 /* KeyOfKeyword */) {
|
|
56652
|
-
|
|
56653
|
-
|
|
56654
|
-
|
|
56655
|
-
|
|
56656
|
-
return node;
|
|
56657
|
-
}
|
|
56658
|
-
return factory.updateTypeOperatorNode(node, type);
|
|
56765
|
+
const result = tryVisitKeyOf(node);
|
|
56766
|
+
if (!result) {
|
|
56767
|
+
hadError = true;
|
|
56768
|
+
return node;
|
|
56659
56769
|
}
|
|
56770
|
+
return result;
|
|
56660
56771
|
}
|
|
56661
56772
|
}
|
|
56662
56773
|
return visitEachChild2(node, visitExistingNodeTreeSymbols);
|
|
@@ -56896,9 +57007,10 @@ function createTypeChecker(host) {
|
|
|
56896
57007
|
if (index >= 0) {
|
|
56897
57008
|
const exportDecl = statements[index];
|
|
56898
57009
|
const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
|
|
56899
|
-
if (!e.propertyName) {
|
|
57010
|
+
if (!e.propertyName && e.name.kind !== 11 /* StringLiteral */) {
|
|
57011
|
+
const name = e.name;
|
|
56900
57012
|
const indices = indicesOf(statements);
|
|
56901
|
-
const associatedIndices = filter(indices, (i) => nodeHasName(statements[i],
|
|
57013
|
+
const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], name));
|
|
56902
57014
|
if (length(associatedIndices) && every(associatedIndices, (i) => canHaveExportModifier(statements[i]))) {
|
|
56903
57015
|
for (const index2 of associatedIndices) {
|
|
56904
57016
|
statements[index2] = addExportModifier(statements[index2]);
|
|
@@ -57532,7 +57644,7 @@ function createTypeChecker(host) {
|
|
|
57532
57644
|
function getSomeTargetNameFromDeclarations(declarations) {
|
|
57533
57645
|
return firstDefined(declarations, (d) => {
|
|
57534
57646
|
if (isImportSpecifier(d) || isExportSpecifier(d)) {
|
|
57535
|
-
return
|
|
57647
|
+
return moduleExportNameTextUnescaped(d.propertyName || d.name);
|
|
57536
57648
|
}
|
|
57537
57649
|
if (isBinaryExpression(d) || isExportAssignment(d)) {
|
|
57538
57650
|
const expression = isExportAssignment(d) ? d.expression : d.right;
|
|
@@ -57550,7 +57662,7 @@ function createTypeChecker(host) {
|
|
|
57550
57662
|
});
|
|
57551
57663
|
}
|
|
57552
57664
|
function serializeAsAlias(symbol, localName, modifierFlags) {
|
|
57553
|
-
var _a2, _b, _c, _d, _e
|
|
57665
|
+
var _a2, _b, _c, _d, _e;
|
|
57554
57666
|
const node = getDeclarationOfAliasSymbol(symbol);
|
|
57555
57667
|
if (!node) return Debug.fail();
|
|
57556
57668
|
const target = getMergedSymbol(getTargetOfAliasDeclaration(
|
|
@@ -57748,8 +57860,11 @@ function createTypeChecker(host) {
|
|
|
57748
57860
|
}
|
|
57749
57861
|
case 281 /* ExportSpecifier */:
|
|
57750
57862
|
const specifier = node.parent.parent.moduleSpecifier;
|
|
57751
|
-
if (specifier
|
|
57752
|
-
|
|
57863
|
+
if (specifier) {
|
|
57864
|
+
const propertyName = node.propertyName;
|
|
57865
|
+
if (propertyName && moduleExportNameIsDefault(propertyName)) {
|
|
57866
|
+
verbatimTargetName = "default" /* Default */;
|
|
57867
|
+
}
|
|
57753
57868
|
}
|
|
57754
57869
|
serializeExportSpecifier(
|
|
57755
57870
|
unescapeLeadingUnderscores(symbol.escapedName),
|
|
@@ -58462,7 +58577,7 @@ function createTypeChecker(host) {
|
|
|
58462
58577
|
}
|
|
58463
58578
|
function collectLinkedAliases(node, setVisibility) {
|
|
58464
58579
|
let exportSymbol;
|
|
58465
|
-
if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
|
|
58580
|
+
if (node.kind !== 11 /* StringLiteral */ && node.parent && node.parent.kind === 277 /* ExportAssignment */) {
|
|
58466
58581
|
exportSymbol = resolveName(
|
|
58467
58582
|
node,
|
|
58468
58583
|
node,
|
|
@@ -74035,9 +74150,10 @@ function createTypeChecker(host) {
|
|
|
74035
74150
|
return;
|
|
74036
74151
|
case 281 /* ExportSpecifier */:
|
|
74037
74152
|
const exportDeclaration = node.parent.parent;
|
|
74038
|
-
|
|
74153
|
+
const name = node.propertyName || node.name;
|
|
74154
|
+
if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier && name.kind !== 11 /* StringLiteral */) {
|
|
74039
74155
|
const symbol = resolveEntityName(
|
|
74040
|
-
|
|
74156
|
+
name,
|
|
74041
74157
|
111551 /* Value */,
|
|
74042
74158
|
/*ignoreErrors*/
|
|
74043
74159
|
true,
|
|
@@ -74331,6 +74447,9 @@ function createTypeChecker(host) {
|
|
|
74331
74447
|
function markExportSpecifierAliasReferenced(location) {
|
|
74332
74448
|
if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
|
|
74333
74449
|
const exportedName = location.propertyName || location.name;
|
|
74450
|
+
if (exportedName.kind === 11 /* StringLiteral */) {
|
|
74451
|
+
return;
|
|
74452
|
+
}
|
|
74334
74453
|
const symbol = resolveName(
|
|
74335
74454
|
exportedName,
|
|
74336
74455
|
exportedName.escapedText,
|
|
@@ -74345,7 +74464,7 @@ function createTypeChecker(host) {
|
|
|
74345
74464
|
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
|
|
74346
74465
|
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
|
|
74347
74466
|
markExportAsReferenced(location);
|
|
74348
|
-
markIdentifierAliasReferenced(
|
|
74467
|
+
markIdentifierAliasReferenced(exportedName);
|
|
74349
74468
|
}
|
|
74350
74469
|
}
|
|
74351
74470
|
return;
|
|
@@ -87941,6 +88060,16 @@ function createTypeChecker(host) {
|
|
|
87941
88060
|
}
|
|
87942
88061
|
return true;
|
|
87943
88062
|
}
|
|
88063
|
+
function checkModuleExportName(name, allowStringLiteral = true) {
|
|
88064
|
+
if (name === void 0 || name.kind !== 11 /* StringLiteral */) {
|
|
88065
|
+
return;
|
|
88066
|
+
}
|
|
88067
|
+
if (!allowStringLiteral) {
|
|
88068
|
+
grammarErrorOnNode(name, Diagnostics.Identifier_expected);
|
|
88069
|
+
} else if (moduleKind === 5 /* ES2015 */ || moduleKind === 6 /* ES2020 */) {
|
|
88070
|
+
grammarErrorOnNode(name, Diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020);
|
|
88071
|
+
}
|
|
88072
|
+
}
|
|
87944
88073
|
function checkAliasSymbol(node) {
|
|
87945
88074
|
var _a, _b, _c, _d;
|
|
87946
88075
|
let symbol = getSymbolOfDeclaration(node);
|
|
@@ -87952,7 +88081,7 @@ function createTypeChecker(host) {
|
|
|
87952
88081
|
Debug.assert(node.kind !== 280 /* NamespaceExport */);
|
|
87953
88082
|
if (node.kind === 281 /* ExportSpecifier */) {
|
|
87954
88083
|
const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
|
|
87955
|
-
const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name)
|
|
88084
|
+
const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get(moduleExportNameTextEscaped(node.propertyName || node.name));
|
|
87956
88085
|
if (alreadyExportedSymbol === target) {
|
|
87957
88086
|
const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
|
|
87958
88087
|
if (exportingDeclaration) {
|
|
@@ -88007,7 +88136,7 @@ function createTypeChecker(host) {
|
|
|
88007
88136
|
if (compilerOptions.verbatimModuleSyntax) {
|
|
88008
88137
|
Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name");
|
|
88009
88138
|
const message = compilerOptions.verbatimModuleSyntax && isInternalModuleImportEqualsDeclaration(node) ? Diagnostics.An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled : isType ? Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled;
|
|
88010
|
-
const name =
|
|
88139
|
+
const name = moduleExportNameTextUnescaped(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
|
|
88011
88140
|
addTypeOnlyDeclarationRelatedInfo(
|
|
88012
88141
|
error2(node, message, name),
|
|
88013
88142
|
isType ? void 0 : typeOnlyAlias,
|
|
@@ -88021,7 +88150,7 @@ function createTypeChecker(host) {
|
|
|
88021
88150
|
}
|
|
88022
88151
|
case 281 /* ExportSpecifier */: {
|
|
88023
88152
|
if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
|
|
88024
|
-
const name =
|
|
88153
|
+
const name = moduleExportNameTextUnescaped(node.propertyName || node.name);
|
|
88025
88154
|
const diagnostic = isType ? error2(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error2(node, Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled, name, isolatedModulesLikeFlagName);
|
|
88026
88155
|
addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
|
|
88027
88156
|
break;
|
|
@@ -88071,8 +88200,11 @@ function createTypeChecker(host) {
|
|
|
88071
88200
|
function checkImportBinding(node) {
|
|
88072
88201
|
checkCollisionsForDeclarationName(node, node.name);
|
|
88073
88202
|
checkAliasSymbol(node);
|
|
88074
|
-
if (node.kind === 276 /* ImportSpecifier */
|
|
88075
|
-
|
|
88203
|
+
if (node.kind === 276 /* ImportSpecifier */) {
|
|
88204
|
+
checkModuleExportName(node.propertyName);
|
|
88205
|
+
if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
88206
|
+
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
88207
|
+
}
|
|
88076
88208
|
}
|
|
88077
88209
|
}
|
|
88078
88210
|
function checkImportAttributes(declaration) {
|
|
@@ -88193,6 +88325,7 @@ function createTypeChecker(host) {
|
|
|
88193
88325
|
error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
|
88194
88326
|
} else if (node.exportClause) {
|
|
88195
88327
|
checkAliasSymbol(node.exportClause);
|
|
88328
|
+
checkModuleExportName(node.exportClause.name);
|
|
88196
88329
|
}
|
|
88197
88330
|
if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
|
|
88198
88331
|
if (node.exportClause) {
|
|
@@ -88223,6 +88356,9 @@ function createTypeChecker(host) {
|
|
|
88223
88356
|
}
|
|
88224
88357
|
function checkExportSpecifier(node) {
|
|
88225
88358
|
checkAliasSymbol(node);
|
|
88359
|
+
const hasModuleSpecifier = node.parent.parent.moduleSpecifier !== void 0;
|
|
88360
|
+
checkModuleExportName(node.propertyName, hasModuleSpecifier);
|
|
88361
|
+
checkModuleExportName(node.name);
|
|
88226
88362
|
if (getEmitDeclarations(compilerOptions)) {
|
|
88227
88363
|
collectLinkedAliases(
|
|
88228
88364
|
node.propertyName || node.name,
|
|
@@ -88230,8 +88366,11 @@ function createTypeChecker(host) {
|
|
|
88230
88366
|
true
|
|
88231
88367
|
);
|
|
88232
88368
|
}
|
|
88233
|
-
if (!
|
|
88369
|
+
if (!hasModuleSpecifier) {
|
|
88234
88370
|
const exportedName = node.propertyName || node.name;
|
|
88371
|
+
if (exportedName.kind === 11 /* StringLiteral */) {
|
|
88372
|
+
return;
|
|
88373
|
+
}
|
|
88235
88374
|
const symbol = resolveName(
|
|
88236
88375
|
exportedName,
|
|
88237
88376
|
exportedName.escapedText,
|
|
@@ -88247,7 +88386,7 @@ function createTypeChecker(host) {
|
|
|
88247
88386
|
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
88248
88387
|
}
|
|
88249
88388
|
} else {
|
|
88250
|
-
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ &&
|
|
88389
|
+
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
|
|
88251
88390
|
checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
|
|
88252
88391
|
}
|
|
88253
88392
|
}
|
|
@@ -89402,7 +89541,11 @@ function createTypeChecker(host) {
|
|
|
89402
89541
|
}
|
|
89403
89542
|
function getExportSpecifierLocalTargetSymbol(node) {
|
|
89404
89543
|
if (isExportSpecifier(node)) {
|
|
89405
|
-
|
|
89544
|
+
const name = node.propertyName || node.name;
|
|
89545
|
+
return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : name.kind === 11 /* StringLiteral */ ? void 0 : (
|
|
89546
|
+
// Skip for invalid syntax like this: export { "x" }
|
|
89547
|
+
resolveEntityName(name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)
|
|
89548
|
+
);
|
|
89406
89549
|
} else {
|
|
89407
89550
|
return resolveEntityName(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
|
|
89408
89551
|
}
|
|
@@ -90373,7 +90516,8 @@ function createTypeChecker(host) {
|
|
|
90373
90516
|
resolveExternalModuleSymbol(sym);
|
|
90374
90517
|
return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
|
|
90375
90518
|
},
|
|
90376
|
-
isImportRequiredByAugmentation
|
|
90519
|
+
isImportRequiredByAugmentation,
|
|
90520
|
+
isDefinitelyReferenceToGlobalSymbolObject
|
|
90377
90521
|
};
|
|
90378
90522
|
function isImportRequiredByAugmentation(node) {
|
|
90379
90523
|
const file = getSourceFileOfNode(node);
|
|
@@ -92212,7 +92356,7 @@ function isDeclarationNameOrImportPropertyName(name) {
|
|
|
92212
92356
|
switch (name.parent.kind) {
|
|
92213
92357
|
case 276 /* ImportSpecifier */:
|
|
92214
92358
|
case 281 /* ExportSpecifier */:
|
|
92215
|
-
return isIdentifier(name)
|
|
92359
|
+
return isIdentifier(name) || name.kind === 11 /* StringLiteral */;
|
|
92216
92360
|
default:
|
|
92217
92361
|
return isDeclarationName(name);
|
|
92218
92362
|
}
|
|
@@ -93457,7 +93601,7 @@ var visitEachChildTable = {
|
|
|
93457
93601
|
return context.factory.updateImportSpecifier(
|
|
93458
93602
|
node,
|
|
93459
93603
|
node.isTypeOnly,
|
|
93460
|
-
nodeVisitor(node.propertyName, visitor,
|
|
93604
|
+
nodeVisitor(node.propertyName, visitor, isModuleExportName),
|
|
93461
93605
|
Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
|
|
93462
93606
|
);
|
|
93463
93607
|
},
|
|
@@ -93488,8 +93632,8 @@ var visitEachChildTable = {
|
|
|
93488
93632
|
return context.factory.updateExportSpecifier(
|
|
93489
93633
|
node,
|
|
93490
93634
|
node.isTypeOnly,
|
|
93491
|
-
nodeVisitor(node.propertyName, visitor,
|
|
93492
|
-
Debug.checkDefined(nodeVisitor(node.name, visitor,
|
|
93635
|
+
nodeVisitor(node.propertyName, visitor, isModuleExportName),
|
|
93636
|
+
Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleExportName))
|
|
93493
93637
|
);
|
|
93494
93638
|
},
|
|
93495
93639
|
// Module references
|
|
@@ -94205,7 +94349,7 @@ function containsDefaultReference(node) {
|
|
|
94205
94349
|
return some(node.elements, isNamedDefaultReference);
|
|
94206
94350
|
}
|
|
94207
94351
|
function isNamedDefaultReference(e) {
|
|
94208
|
-
return e.propertyName
|
|
94352
|
+
return moduleExportNameIsDefault(e.propertyName || e.name);
|
|
94209
94353
|
}
|
|
94210
94354
|
function chainBundle(context, transformSourceFile) {
|
|
94211
94355
|
return transformSourceFileOrBundle;
|
|
@@ -94281,9 +94425,10 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
94281
94425
|
hasImportDefault || (hasImportDefault = containsDefaultReference(node.exportClause));
|
|
94282
94426
|
} else {
|
|
94283
94427
|
const name = node.exportClause.name;
|
|
94284
|
-
|
|
94428
|
+
const nameText = moduleExportNameTextUnescaped(name);
|
|
94429
|
+
if (!uniqueExports.get(nameText)) {
|
|
94285
94430
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
|
|
94286
|
-
uniqueExports.set(
|
|
94431
|
+
uniqueExports.set(nameText, true);
|
|
94287
94432
|
exportedNames = append(exportedNames, name);
|
|
94288
94433
|
}
|
|
94289
94434
|
hasImportStar = true;
|
|
@@ -94341,20 +94486,23 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
94341
94486
|
return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, exportedFunctions, externalHelpersImportDeclaration };
|
|
94342
94487
|
function addExportedNamesForExportDeclaration(node) {
|
|
94343
94488
|
for (const specifier of cast(node.exportClause, isNamedExports).elements) {
|
|
94344
|
-
|
|
94489
|
+
const specifierNameText = moduleExportNameTextUnescaped(specifier.name);
|
|
94490
|
+
if (!uniqueExports.get(specifierNameText)) {
|
|
94345
94491
|
const name = specifier.propertyName || specifier.name;
|
|
94346
|
-
if (
|
|
94347
|
-
|
|
94348
|
-
|
|
94349
|
-
|
|
94350
|
-
|
|
94351
|
-
if (decl
|
|
94352
|
-
|
|
94353
|
-
|
|
94492
|
+
if (name.kind !== 11 /* StringLiteral */) {
|
|
94493
|
+
if (!node.moduleSpecifier) {
|
|
94494
|
+
exportSpecifiers.add(name, specifier);
|
|
94495
|
+
}
|
|
94496
|
+
const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
|
|
94497
|
+
if (decl) {
|
|
94498
|
+
if (decl.kind === 262 /* FunctionDeclaration */) {
|
|
94499
|
+
addExportedFunctionDeclaration(decl, specifier.name, moduleExportNameIsDefault(specifier.name));
|
|
94500
|
+
continue;
|
|
94501
|
+
}
|
|
94502
|
+
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
|
|
94354
94503
|
}
|
|
94355
|
-
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
|
|
94356
94504
|
}
|
|
94357
|
-
uniqueExports.set(
|
|
94505
|
+
uniqueExports.set(specifierNameText, true);
|
|
94358
94506
|
exportedNames = append(exportedNames, specifier.name);
|
|
94359
94507
|
}
|
|
94360
94508
|
}
|
|
@@ -94368,9 +94516,10 @@ function collectExternalModuleInfo(context, sourceFile) {
|
|
|
94368
94516
|
}
|
|
94369
94517
|
} else {
|
|
94370
94518
|
name ?? (name = node.name);
|
|
94371
|
-
|
|
94519
|
+
const nameText = moduleExportNameTextUnescaped(name);
|
|
94520
|
+
if (!uniqueExports.get(nameText)) {
|
|
94372
94521
|
multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
|
|
94373
|
-
uniqueExports.set(
|
|
94522
|
+
uniqueExports.set(nameText, true);
|
|
94374
94523
|
}
|
|
94375
94524
|
}
|
|
94376
94525
|
}
|
|
@@ -111657,7 +111806,7 @@ function transformModule(context) {
|
|
|
111657
111806
|
factory2.createExpressionStatement(
|
|
111658
111807
|
reduceLeft(
|
|
111659
111808
|
currentModuleInfo.exportedNames.slice(i, i + chunkSize),
|
|
111660
|
-
(prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
|
|
111809
|
+
(prev, nextId) => nextId.kind === 11 /* StringLiteral */ ? factory2.createAssignment(factory2.createElementAccessExpression(factory2.createIdentifier("exports"), factory2.createStringLiteral(nextId.text)), prev) : factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
|
|
111661
111810
|
factory2.createVoidZero()
|
|
111662
111811
|
)
|
|
111663
111812
|
)
|
|
@@ -111980,7 +112129,10 @@ function transformModule(context) {
|
|
|
111980
112129
|
append(statements, createUnderscoreUnderscoreESModule());
|
|
111981
112130
|
}
|
|
111982
112131
|
if (some(currentModuleInfo.exportedNames)) {
|
|
111983
|
-
append(
|
|
112132
|
+
append(
|
|
112133
|
+
statements,
|
|
112134
|
+
factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => nextId.kind === 11 /* StringLiteral */ ? factory2.createAssignment(factory2.createElementAccessExpression(factory2.createIdentifier("exports"), factory2.createStringLiteral(nextId.text)), prev) : factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero()))
|
|
112135
|
+
);
|
|
111984
112136
|
}
|
|
111985
112137
|
for (const f of currentModuleInfo.exportedFunctions) {
|
|
111986
112138
|
appendExportsOfHoistedDeclaration(statements, f);
|
|
@@ -112851,17 +113003,16 @@ function transformModule(context) {
|
|
|
112851
113003
|
);
|
|
112852
113004
|
}
|
|
112853
113005
|
for (const specifier of node.exportClause.elements) {
|
|
112854
|
-
const
|
|
112855
|
-
const
|
|
112856
|
-
|
|
112857
|
-
|
|
112858
|
-
);
|
|
113006
|
+
const specifierName = specifier.propertyName || specifier.name;
|
|
113007
|
+
const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && moduleExportNameIsDefault(specifierName);
|
|
113008
|
+
const target = exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName;
|
|
113009
|
+
const exportedValue = specifierName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, specifierName) : factory2.createPropertyAccessExpression(target, specifierName);
|
|
112859
113010
|
statements.push(
|
|
112860
113011
|
setOriginalNode(
|
|
112861
113012
|
setTextRange(
|
|
112862
113013
|
factory2.createExpressionStatement(
|
|
112863
113014
|
createExportExpression(
|
|
112864
|
-
factory2.getExportName(specifier),
|
|
113015
|
+
specifier.name.kind === 11 /* StringLiteral */ ? factory2.cloneNode(specifier.name) : factory2.getExportName(specifier),
|
|
112865
113016
|
exportedValue,
|
|
112866
113017
|
/*location*/
|
|
112867
113018
|
void 0,
|
|
@@ -112886,7 +113037,7 @@ function transformModule(context) {
|
|
|
112886
113037
|
factory2.cloneNode(node.exportClause.name),
|
|
112887
113038
|
getHelperExpressionForExport(
|
|
112888
113039
|
node,
|
|
112889
|
-
moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
|
|
113040
|
+
moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : node.exportClause.name.kind === 11 /* StringLiteral */ ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
|
|
112890
113041
|
)
|
|
112891
113042
|
)
|
|
112892
113043
|
),
|
|
@@ -113216,10 +113367,13 @@ function transformModule(context) {
|
|
|
113216
113367
|
return statements;
|
|
113217
113368
|
}
|
|
113218
113369
|
function appendExportStatement(statements, seen, exportName, expression, location, allowComments, liveBinding) {
|
|
113219
|
-
if (
|
|
113370
|
+
if (exportName.kind !== 11 /* StringLiteral */) {
|
|
113371
|
+
if (seen.has(exportName)) {
|
|
113372
|
+
return statements;
|
|
113373
|
+
}
|
|
113220
113374
|
seen.set(exportName, true);
|
|
113221
|
-
statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
|
|
113222
113375
|
}
|
|
113376
|
+
statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
|
|
113223
113377
|
return statements;
|
|
113224
113378
|
}
|
|
113225
113379
|
function createUnderscoreUnderscoreESModule() {
|
|
@@ -113289,7 +113443,10 @@ function transformModule(context) {
|
|
|
113289
113443
|
])
|
|
113290
113444
|
]
|
|
113291
113445
|
) : factory2.createAssignment(
|
|
113292
|
-
factory2.
|
|
113446
|
+
name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(
|
|
113447
|
+
factory2.createIdentifier("exports"),
|
|
113448
|
+
factory2.cloneNode(name)
|
|
113449
|
+
) : factory2.createPropertyAccessExpression(
|
|
113293
113450
|
factory2.createIdentifier("exports"),
|
|
113294
113451
|
factory2.cloneNode(name)
|
|
113295
113452
|
),
|
|
@@ -113425,11 +113582,9 @@ function transformModule(context) {
|
|
|
113425
113582
|
);
|
|
113426
113583
|
} else if (isImportSpecifier(importDeclaration)) {
|
|
113427
113584
|
const name = importDeclaration.propertyName || importDeclaration.name;
|
|
113585
|
+
const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
|
|
113428
113586
|
return setTextRange(
|
|
113429
|
-
factory2.createPropertyAccessExpression(
|
|
113430
|
-
factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
|
|
113431
|
-
factory2.cloneNode(name)
|
|
113432
|
-
),
|
|
113587
|
+
name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(name)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(name)),
|
|
113433
113588
|
/*location*/
|
|
113434
113589
|
node
|
|
113435
113590
|
);
|
|
@@ -113717,7 +113872,7 @@ function transformSystemModule(context) {
|
|
|
113717
113872
|
const exportedNames = [];
|
|
113718
113873
|
if (moduleInfo.exportedNames) {
|
|
113719
113874
|
for (const exportedLocalName of moduleInfo.exportedNames) {
|
|
113720
|
-
if (exportedLocalName
|
|
113875
|
+
if (moduleExportNameIsDefault(exportedLocalName)) {
|
|
113721
113876
|
continue;
|
|
113722
113877
|
}
|
|
113723
113878
|
exportedNames.push(
|
|
@@ -113895,10 +114050,10 @@ function transformSystemModule(context) {
|
|
|
113895
114050
|
for (const e of entry.exportClause.elements) {
|
|
113896
114051
|
properties.push(
|
|
113897
114052
|
factory2.createPropertyAssignment(
|
|
113898
|
-
factory2.createStringLiteral(
|
|
114053
|
+
factory2.createStringLiteral(moduleExportNameTextUnescaped(e.name)),
|
|
113899
114054
|
factory2.createElementAccessExpression(
|
|
113900
114055
|
parameterName,
|
|
113901
|
-
factory2.createStringLiteral(
|
|
114056
|
+
factory2.createStringLiteral(moduleExportNameTextUnescaped(e.propertyName || e.name))
|
|
113902
114057
|
)
|
|
113903
114058
|
)
|
|
113904
114059
|
);
|
|
@@ -113925,7 +114080,7 @@ function transformSystemModule(context) {
|
|
|
113925
114080
|
/*typeArguments*/
|
|
113926
114081
|
void 0,
|
|
113927
114082
|
[
|
|
113928
|
-
factory2.createStringLiteral(
|
|
114083
|
+
factory2.createStringLiteral(moduleExportNameTextUnescaped(entry.exportClause.name)),
|
|
113929
114084
|
parameterName
|
|
113930
114085
|
]
|
|
113931
114086
|
)
|
|
@@ -114265,7 +114420,7 @@ function transformSystemModule(context) {
|
|
|
114265
114420
|
const exportSpecifiers = moduleInfo.exportSpecifiers.get(name);
|
|
114266
114421
|
if (exportSpecifiers) {
|
|
114267
114422
|
for (const exportSpecifier of exportSpecifiers) {
|
|
114268
|
-
if (exportSpecifier.name
|
|
114423
|
+
if (moduleExportNameTextUnescaped(exportSpecifier.name) !== excludeName) {
|
|
114269
114424
|
statements = appendExportStatement(statements, exportSpecifier.name, name);
|
|
114270
114425
|
}
|
|
114271
114426
|
}
|
|
@@ -114686,13 +114841,12 @@ function transformSystemModule(context) {
|
|
|
114686
114841
|
node
|
|
114687
114842
|
);
|
|
114688
114843
|
} else if (isImportSpecifier(importDeclaration)) {
|
|
114844
|
+
const importedName = importDeclaration.propertyName || importDeclaration.name;
|
|
114845
|
+
const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
|
|
114689
114846
|
return setTextRange(
|
|
114690
114847
|
factory2.createPropertyAssignment(
|
|
114691
114848
|
factory2.cloneNode(name),
|
|
114692
|
-
factory2.createPropertyAccessExpression(
|
|
114693
|
-
factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
|
|
114694
|
-
factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
|
|
114695
|
-
)
|
|
114849
|
+
importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName))
|
|
114696
114850
|
),
|
|
114697
114851
|
/*location*/
|
|
114698
114852
|
node
|
|
@@ -114735,11 +114889,10 @@ function transformSystemModule(context) {
|
|
|
114735
114889
|
node
|
|
114736
114890
|
);
|
|
114737
114891
|
} else if (isImportSpecifier(importDeclaration)) {
|
|
114892
|
+
const importedName = importDeclaration.propertyName || importDeclaration.name;
|
|
114893
|
+
const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
|
|
114738
114894
|
return setTextRange(
|
|
114739
|
-
factory2.createPropertyAccessExpression(
|
|
114740
|
-
factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
|
|
114741
|
-
factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
|
|
114742
|
-
),
|
|
114895
|
+
importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName)),
|
|
114743
114896
|
/*location*/
|
|
114744
114897
|
node
|
|
114745
114898
|
);
|
|
@@ -116330,15 +116483,17 @@ function transformDeclarations(context) {
|
|
|
116330
116483
|
if (isDeclarationAndNotVisible(input)) return;
|
|
116331
116484
|
if (hasDynamicName(input)) {
|
|
116332
116485
|
if (isolatedDeclarations) {
|
|
116333
|
-
if (
|
|
116334
|
-
|
|
116335
|
-
|
|
116336
|
-
|
|
116337
|
-
|
|
116338
|
-
|
|
116339
|
-
|
|
116340
|
-
|
|
116341
|
-
|
|
116486
|
+
if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
|
|
116487
|
+
if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
|
|
116488
|
+
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
|
|
116489
|
+
return;
|
|
116490
|
+
} else if (
|
|
116491
|
+
// Type declarations just need to double-check that the input computed name is an entity name expression
|
|
116492
|
+
(isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
|
|
116493
|
+
) {
|
|
116494
|
+
context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
|
|
116495
|
+
return;
|
|
116496
|
+
}
|
|
116342
116497
|
}
|
|
116343
116498
|
} else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
|
|
116344
116499
|
return;
|
|
@@ -117706,16 +117861,16 @@ function isBuildInfoFile(file) {
|
|
|
117706
117861
|
function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit = false, onlyBuildInfo, includeBuildInfo) {
|
|
117707
117862
|
const sourceFiles = isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit);
|
|
117708
117863
|
const options = host.getCompilerOptions();
|
|
117709
|
-
if (
|
|
117710
|
-
if (
|
|
117711
|
-
|
|
117712
|
-
|
|
117713
|
-
|
|
117714
|
-
|
|
117864
|
+
if (!onlyBuildInfo) {
|
|
117865
|
+
if (options.outFile) {
|
|
117866
|
+
if (sourceFiles.length) {
|
|
117867
|
+
const bundle = factory.createBundle(sourceFiles);
|
|
117868
|
+
const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
|
|
117869
|
+
if (result) {
|
|
117870
|
+
return result;
|
|
117871
|
+
}
|
|
117715
117872
|
}
|
|
117716
|
-
}
|
|
117717
|
-
} else {
|
|
117718
|
-
if (!onlyBuildInfo) {
|
|
117873
|
+
} else {
|
|
117719
117874
|
for (const sourceFile of sourceFiles) {
|
|
117720
117875
|
const result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile);
|
|
117721
117876
|
if (result) {
|
|
@@ -117723,14 +117878,14 @@ function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDt
|
|
|
117723
117878
|
}
|
|
117724
117879
|
}
|
|
117725
117880
|
}
|
|
117726
|
-
|
|
117727
|
-
|
|
117728
|
-
|
|
117729
|
-
|
|
117730
|
-
|
|
117731
|
-
|
|
117732
|
-
|
|
117733
|
-
|
|
117881
|
+
}
|
|
117882
|
+
if (includeBuildInfo) {
|
|
117883
|
+
const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
|
|
117884
|
+
if (buildInfoPath) return action(
|
|
117885
|
+
{ buildInfoPath },
|
|
117886
|
+
/*sourceFileOrBundle*/
|
|
117887
|
+
void 0
|
|
117888
|
+
);
|
|
117734
117889
|
}
|
|
117735
117890
|
}
|
|
117736
117891
|
function getTsBuildInfoEmitOutputFilePath(options) {
|
|
@@ -117759,8 +117914,7 @@ function getOutputPathsForBundle(options, forceDtsPaths) {
|
|
|
117759
117914
|
const sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options);
|
|
117760
117915
|
const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : void 0;
|
|
117761
117916
|
const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
|
|
117762
|
-
|
|
117763
|
-
return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath };
|
|
117917
|
+
return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
|
|
117764
117918
|
}
|
|
117765
117919
|
function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
|
|
117766
117920
|
const options = host.getCompilerOptions();
|
|
@@ -117774,7 +117928,7 @@ function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
|
|
|
117774
117928
|
const sourceMapFilePath = !jsFilePath || isJsonSourceFile(sourceFile) ? void 0 : getSourceMapFilePath(jsFilePath, options);
|
|
117775
117929
|
const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) && !isJsonFile ? getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : void 0;
|
|
117776
117930
|
const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
|
|
117777
|
-
return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath
|
|
117931
|
+
return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
|
|
117778
117932
|
}
|
|
117779
117933
|
}
|
|
117780
117934
|
function getSourceMapFilePath(jsFilePath, options) {
|
|
@@ -117823,7 +117977,7 @@ function createAddOutput() {
|
|
|
117823
117977
|
}
|
|
117824
117978
|
}
|
|
117825
117979
|
function getSingleOutputFileNames(configFile, addOutput) {
|
|
117826
|
-
const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath
|
|
117980
|
+
const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(
|
|
117827
117981
|
configFile.options,
|
|
117828
117982
|
/*forceDtsPaths*/
|
|
117829
117983
|
false
|
|
@@ -117832,7 +117986,6 @@ function getSingleOutputFileNames(configFile, addOutput) {
|
|
|
117832
117986
|
addOutput(sourceMapFilePath);
|
|
117833
117987
|
addOutput(declarationFilePath);
|
|
117834
117988
|
addOutput(declarationMapPath);
|
|
117835
|
-
addOutput(buildInfoPath);
|
|
117836
117989
|
}
|
|
117837
117990
|
function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2) {
|
|
117838
117991
|
if (isDeclarationFileName(inputFileName)) return;
|
|
@@ -117883,8 +118036,8 @@ function getAllProjectOutputs(configFile, ignoreCase) {
|
|
|
117883
118036
|
for (const inputFileName of configFile.fileNames) {
|
|
117884
118037
|
getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2);
|
|
117885
118038
|
}
|
|
117886
|
-
addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
|
|
117887
118039
|
}
|
|
118040
|
+
addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
|
|
117888
118041
|
return getOutputs();
|
|
117889
118042
|
}
|
|
117890
118043
|
function getOutputFileNames(commandLine, inputFileName, ignoreCase) {
|
|
@@ -117924,7 +118077,7 @@ function getFirstProjectOutput(configFile, ignoreCase) {
|
|
|
117924
118077
|
function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
|
|
117925
118078
|
return !!forceDtsEmit && !!emitOnly;
|
|
117926
118079
|
}
|
|
117927
|
-
function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
|
|
118080
|
+
function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit, skipBuildInfo) {
|
|
117928
118081
|
var compilerOptions = host.getCompilerOptions();
|
|
117929
118082
|
var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
|
|
117930
118083
|
var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
|
|
@@ -117940,7 +118093,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
117940
118093
|
getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit),
|
|
117941
118094
|
forceDtsEmit,
|
|
117942
118095
|
onlyBuildInfo,
|
|
117943
|
-
!targetSourceFile
|
|
118096
|
+
!targetSourceFile && !skipBuildInfo
|
|
117944
118097
|
);
|
|
117945
118098
|
exit();
|
|
117946
118099
|
return {
|
|
@@ -117962,15 +118115,12 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
117962
118115
|
(_f = tracing) == null ? void 0 : _f.pop();
|
|
117963
118116
|
}
|
|
117964
118117
|
function emitBuildInfo(buildInfoPath) {
|
|
117965
|
-
if (!buildInfoPath || targetSourceFile
|
|
118118
|
+
if (!buildInfoPath || targetSourceFile) return;
|
|
117966
118119
|
if (host.isEmitBlocked(buildInfoPath)) {
|
|
117967
118120
|
emitSkipped = true;
|
|
117968
118121
|
return;
|
|
117969
118122
|
}
|
|
117970
|
-
const buildInfo = host.getBuildInfo() ||
|
|
117971
|
-
/*program*/
|
|
117972
|
-
void 0
|
|
117973
|
-
);
|
|
118123
|
+
const buildInfo = host.getBuildInfo() || { version };
|
|
117974
118124
|
writeFile(
|
|
117975
118125
|
host,
|
|
117976
118126
|
emitterDiagnostics,
|
|
@@ -118253,9 +118403,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
|
|
|
118253
118403
|
return encodeURI(sourceMapFile);
|
|
118254
118404
|
}
|
|
118255
118405
|
}
|
|
118256
|
-
function createBuildInfo(program) {
|
|
118257
|
-
return { program, version };
|
|
118258
|
-
}
|
|
118259
118406
|
function getBuildInfoText(buildInfo) {
|
|
118260
118407
|
return JSON.stringify(buildInfo);
|
|
118261
118408
|
}
|
|
@@ -118300,7 +118447,8 @@ var notImplementedResolver = {
|
|
|
118300
118447
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
118301
118448
|
isBindingCapturedByNode: notImplemented,
|
|
118302
118449
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
118303
|
-
isImportRequiredByAugmentation: notImplemented
|
|
118450
|
+
isImportRequiredByAugmentation: notImplemented,
|
|
118451
|
+
isDefinitelyReferenceToGlobalSymbolObject: notImplemented
|
|
118304
118452
|
};
|
|
118305
118453
|
var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
|
|
118306
118454
|
var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
|
|
@@ -123041,7 +123189,7 @@ function isIgnoredFileFromWildCardWatching({
|
|
|
123041
123189
|
}
|
|
123042
123190
|
return false;
|
|
123043
123191
|
function hasSourceFile(file) {
|
|
123044
|
-
return realProgram ? !!realProgram.getSourceFileByPath(file) : builderProgram ? builderProgram.
|
|
123192
|
+
return realProgram ? !!realProgram.getSourceFileByPath(file) : builderProgram ? builderProgram.state.fileInfos.has(file) : !!find(program, (rootFile) => toPath3(rootFile) === file);
|
|
123045
123193
|
}
|
|
123046
123194
|
function isSupportedScriptKind() {
|
|
123047
123195
|
if (!getScriptKind2) return false;
|
|
@@ -123062,9 +123210,6 @@ function isIgnoredFileFromWildCardWatching({
|
|
|
123062
123210
|
}
|
|
123063
123211
|
}
|
|
123064
123212
|
}
|
|
123065
|
-
function isBuilderProgram(program) {
|
|
123066
|
-
return !!program.getState;
|
|
123067
|
-
}
|
|
123068
123213
|
function isEmittedFileOfProgram(program, file) {
|
|
123069
123214
|
if (!program) {
|
|
123070
123215
|
return false;
|
|
@@ -124961,7 +125106,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124961
125106
|
}
|
|
124962
125107
|
function emitBuildInfo(writeFileCallback) {
|
|
124963
125108
|
var _a2, _b2;
|
|
124964
|
-
Debug.assert(!options.outFile);
|
|
124965
125109
|
(_a2 = tracing) == null ? void 0 : _a2.push(
|
|
124966
125110
|
tracing.Phase.Emit,
|
|
124967
125111
|
"emitBuildInfo",
|
|
@@ -125016,7 +125160,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125016
125160
|
function getTypeChecker() {
|
|
125017
125161
|
return typeChecker || (typeChecker = createTypeChecker(program));
|
|
125018
125162
|
}
|
|
125019
|
-
function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit) {
|
|
125163
|
+
function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit, skipBuildInfo) {
|
|
125020
125164
|
var _a2, _b2;
|
|
125021
125165
|
(_a2 = tracing) == null ? void 0 : _a2.push(
|
|
125022
125166
|
tracing.Phase.Emit,
|
|
@@ -125025,14 +125169,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125025
125169
|
/*separateBeginAndEnd*/
|
|
125026
125170
|
true
|
|
125027
125171
|
);
|
|
125028
|
-
const result = runWithCancellationToken(
|
|
125172
|
+
const result = runWithCancellationToken(
|
|
125173
|
+
() => emitWorker(
|
|
125174
|
+
program,
|
|
125175
|
+
sourceFile,
|
|
125176
|
+
writeFileCallback,
|
|
125177
|
+
cancellationToken,
|
|
125178
|
+
emitOnly,
|
|
125179
|
+
transformers,
|
|
125180
|
+
forceDtsEmit,
|
|
125181
|
+
skipBuildInfo
|
|
125182
|
+
)
|
|
125183
|
+
);
|
|
125029
125184
|
(_b2 = tracing) == null ? void 0 : _b2.pop();
|
|
125030
125185
|
return result;
|
|
125031
125186
|
}
|
|
125032
125187
|
function isEmitBlocked(emitFileName) {
|
|
125033
125188
|
return hasEmitBlockingDiagnostics.has(toPath3(emitFileName));
|
|
125034
125189
|
}
|
|
125035
|
-
function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit) {
|
|
125190
|
+
function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit, skipBuildInfo) {
|
|
125036
125191
|
if (!forceDtsEmit) {
|
|
125037
125192
|
const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
|
|
125038
125193
|
if (result) return result;
|
|
@@ -125054,7 +125209,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125054
125209
|
emitOnly,
|
|
125055
125210
|
/*onlyBuildInfo*/
|
|
125056
125211
|
false,
|
|
125057
|
-
forceDtsEmit
|
|
125212
|
+
forceDtsEmit,
|
|
125213
|
+
skipBuildInfo
|
|
125058
125214
|
)
|
|
125059
125215
|
);
|
|
125060
125216
|
mark("afterEmit");
|
|
@@ -127186,7 +127342,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
|
|
|
127186
127342
|
const options = program.getCompilerOptions();
|
|
127187
127343
|
if (options.noEmit) {
|
|
127188
127344
|
program.getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
127189
|
-
return sourceFile
|
|
127345
|
+
return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
|
|
127190
127346
|
}
|
|
127191
127347
|
if (!options.noEmitOnError) return void 0;
|
|
127192
127348
|
let diagnostics = [
|
|
@@ -127204,7 +127360,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
|
|
|
127204
127360
|
}
|
|
127205
127361
|
if (!diagnostics.length) return void 0;
|
|
127206
127362
|
let emittedFiles;
|
|
127207
|
-
if (!sourceFile
|
|
127363
|
+
if (!sourceFile) {
|
|
127208
127364
|
const emitResult = program.emitBuildInfo(writeFile2, cancellationToken);
|
|
127209
127365
|
if (emitResult.diagnostics) diagnostics = [...diagnostics, ...emitResult.diagnostics];
|
|
127210
127366
|
emittedFiles = emitResult.emittedFiles;
|
|
@@ -127677,6 +127833,13 @@ var BuilderFileEmit = /* @__PURE__ */ ((BuilderFileEmit2) => {
|
|
|
127677
127833
|
BuilderFileEmit2[BuilderFileEmit2["All"] = 31] = "All";
|
|
127678
127834
|
return BuilderFileEmit2;
|
|
127679
127835
|
})(BuilderFileEmit || {});
|
|
127836
|
+
function isBuilderProgramStateWithDefinedProgram(state) {
|
|
127837
|
+
return state.program !== void 0;
|
|
127838
|
+
}
|
|
127839
|
+
function toBuilderProgramStateWithDefinedProgram(state) {
|
|
127840
|
+
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
127841
|
+
return state;
|
|
127842
|
+
}
|
|
127680
127843
|
function getBuilderFileEmit(options) {
|
|
127681
127844
|
let result = 1 /* Js */;
|
|
127682
127845
|
if (options.sourceMap) result = result | 2 /* JsMap */;
|
|
@@ -127712,17 +127875,17 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
127712
127875
|
const compilerOptions = newProgram.getCompilerOptions();
|
|
127713
127876
|
state.compilerOptions = compilerOptions;
|
|
127714
127877
|
const outFilePath = compilerOptions.outFile;
|
|
127715
|
-
|
|
127716
|
-
|
|
127717
|
-
} else if (compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
|
|
127878
|
+
state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
|
|
127879
|
+
if (outFilePath && compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
|
|
127718
127880
|
state.outSignature = oldState.outSignature && getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldState.outSignature);
|
|
127719
127881
|
}
|
|
127720
127882
|
state.changedFilesSet = /* @__PURE__ */ new Set();
|
|
127721
127883
|
state.latestChangedDtsFile = compilerOptions.composite ? oldState == null ? void 0 : oldState.latestChangedDtsFile : void 0;
|
|
127722
127884
|
const useOldState = BuilderState.canReuseOldState(state.referencedMap, oldState);
|
|
127723
127885
|
const oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0;
|
|
127724
|
-
|
|
127886
|
+
let canCopySemanticDiagnostics = useOldState && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
|
|
127725
127887
|
const canCopyEmitSignatures = compilerOptions.composite && (oldState == null ? void 0 : oldState.emitSignatures) && !outFilePath && !compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
|
|
127888
|
+
let canCopyEmitDiagnostics = true;
|
|
127726
127889
|
if (useOldState) {
|
|
127727
127890
|
(_a = oldState.changedFilesSet) == null ? void 0 : _a.forEach((value) => state.changedFilesSet.add(value));
|
|
127728
127891
|
if (!outFilePath && ((_b = oldState.affectedFilesPendingEmit) == null ? void 0 : _b.size)) {
|
|
@@ -127730,6 +127893,10 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
127730
127893
|
state.seenAffectedFiles = /* @__PURE__ */ new Set();
|
|
127731
127894
|
}
|
|
127732
127895
|
state.programEmitPending = oldState.programEmitPending;
|
|
127896
|
+
if (outFilePath && state.changedFilesSet.size) {
|
|
127897
|
+
canCopySemanticDiagnostics = false;
|
|
127898
|
+
canCopyEmitDiagnostics = false;
|
|
127899
|
+
}
|
|
127733
127900
|
} else {
|
|
127734
127901
|
state.buildInfoEmitPending = true;
|
|
127735
127902
|
}
|
|
@@ -127747,10 +127914,10 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
127747
127914
|
oldInfo.impliedFormat !== info.impliedFormat || // Referenced files changed
|
|
127748
127915
|
!hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
|
|
127749
127916
|
newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
|
|
127750
|
-
addFileToChangeSet(
|
|
127917
|
+
addFileToChangeSet(sourceFilePath);
|
|
127751
127918
|
} else {
|
|
127752
127919
|
const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
|
|
127753
|
-
const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
|
|
127920
|
+
const emitDiagnostics = canCopyEmitDiagnostics ? (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath) : void 0;
|
|
127754
127921
|
if (emitDiagnostics) {
|
|
127755
127922
|
(state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
|
|
127756
127923
|
sourceFilePath,
|
|
@@ -127779,16 +127946,16 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
127779
127946
|
});
|
|
127780
127947
|
if (useOldState && forEachEntry(oldState.fileInfos, (info, sourceFilePath) => {
|
|
127781
127948
|
if (state.fileInfos.has(sourceFilePath)) return false;
|
|
127782
|
-
if (
|
|
127949
|
+
if (info.affectsGlobalScope) return true;
|
|
127783
127950
|
state.buildInfoEmitPending = true;
|
|
127784
|
-
return
|
|
127951
|
+
return !!outFilePath;
|
|
127785
127952
|
})) {
|
|
127786
127953
|
BuilderState.getAllFilesExcludingDefaultLibraryFile(
|
|
127787
127954
|
state,
|
|
127788
127955
|
newProgram,
|
|
127789
127956
|
/*firstSourceFile*/
|
|
127790
127957
|
void 0
|
|
127791
|
-
).forEach((file) => addFileToChangeSet(
|
|
127958
|
+
).forEach((file) => addFileToChangeSet(file.resolvedPath));
|
|
127792
127959
|
} else if (oldCompilerOptions) {
|
|
127793
127960
|
const pendingEmitKind = compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions) ? getBuilderFileEmit(compilerOptions) : getPendingEmitKind(compilerOptions, oldCompilerOptions);
|
|
127794
127961
|
if (pendingEmitKind !== 0 /* None */) {
|
|
@@ -127804,18 +127971,25 @@ function createBuilderProgramState(newProgram, oldState) {
|
|
|
127804
127971
|
});
|
|
127805
127972
|
Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
|
|
127806
127973
|
state.seenAffectedFiles = state.seenAffectedFiles || /* @__PURE__ */ new Set();
|
|
127807
|
-
|
|
127808
|
-
} else {
|
|
127974
|
+
} else if (!state.changedFilesSet.size) {
|
|
127809
127975
|
state.programEmitPending = state.programEmitPending ? state.programEmitPending | pendingEmitKind : pendingEmitKind;
|
|
127810
127976
|
}
|
|
127977
|
+
state.buildInfoEmitPending = true;
|
|
127811
127978
|
}
|
|
127812
127979
|
}
|
|
127813
127980
|
return state;
|
|
127814
|
-
|
|
127815
|
-
|
|
127816
|
-
|
|
127817
|
-
|
|
127818
|
-
|
|
127981
|
+
function addFileToChangeSet(path) {
|
|
127982
|
+
state.changedFilesSet.add(path);
|
|
127983
|
+
if (outFilePath) {
|
|
127984
|
+
canCopySemanticDiagnostics = false;
|
|
127985
|
+
canCopyEmitDiagnostics = false;
|
|
127986
|
+
state.semanticDiagnosticsFromOldState = void 0;
|
|
127987
|
+
state.semanticDiagnosticsPerFile.clear();
|
|
127988
|
+
state.emitDiagnosticsPerFile = void 0;
|
|
127989
|
+
}
|
|
127990
|
+
state.buildInfoEmitPending = true;
|
|
127991
|
+
state.programEmitPending = void 0;
|
|
127992
|
+
}
|
|
127819
127993
|
}
|
|
127820
127994
|
function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature) {
|
|
127821
127995
|
return !!options.declarationMap === !!oldOptions.declarationMap ? (
|
|
@@ -127888,6 +128062,7 @@ function backupBuilderProgramEmitState(state) {
|
|
|
127888
128062
|
return {
|
|
127889
128063
|
affectedFilesPendingEmit: state.affectedFilesPendingEmit && new Map(state.affectedFilesPendingEmit),
|
|
127890
128064
|
seenEmittedFiles: state.seenEmittedFiles && new Map(state.seenEmittedFiles),
|
|
128065
|
+
seenProgramEmit: state.seenProgramEmit,
|
|
127891
128066
|
programEmitPending: state.programEmitPending,
|
|
127892
128067
|
emitSignatures: state.emitSignatures && new Map(state.emitSignatures),
|
|
127893
128068
|
outSignature: state.outSignature,
|
|
@@ -127901,6 +128076,7 @@ function backupBuilderProgramEmitState(state) {
|
|
|
127901
128076
|
function restoreBuilderProgramEmitState(state, savedEmitState) {
|
|
127902
128077
|
state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
|
|
127903
128078
|
state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
|
|
128079
|
+
state.seenProgramEmit = savedEmitState.seenProgramEmit;
|
|
127904
128080
|
state.programEmitPending = savedEmitState.programEmitPending;
|
|
127905
128081
|
state.emitSignatures = savedEmitState.emitSignatures;
|
|
127906
128082
|
state.outSignature = savedEmitState.outSignature;
|
|
@@ -127909,6 +128085,10 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
|
|
|
127909
128085
|
state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
|
|
127910
128086
|
state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
|
|
127911
128087
|
if (savedEmitState.changedFilesSet) state.changedFilesSet = savedEmitState.changedFilesSet;
|
|
128088
|
+
if (state.compilerOptions.outFile && state.changedFilesSet.size) {
|
|
128089
|
+
state.semanticDiagnosticsPerFile.clear();
|
|
128090
|
+
state.emitDiagnosticsPerFile = void 0;
|
|
128091
|
+
}
|
|
127912
128092
|
}
|
|
127913
128093
|
function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
127914
128094
|
Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
@@ -127924,7 +128104,11 @@ function getNextAffectedFile(state, cancellationToken, host) {
|
|
|
127924
128104
|
const affectedFile = affectedFiles[affectedFilesIndex];
|
|
127925
128105
|
if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
|
|
127926
128106
|
state.affectedFilesIndex = affectedFilesIndex;
|
|
127927
|
-
addToAffectedFilesPendingEmit(
|
|
128107
|
+
addToAffectedFilesPendingEmit(
|
|
128108
|
+
state,
|
|
128109
|
+
affectedFile.resolvedPath,
|
|
128110
|
+
getBuilderFileEmit(state.compilerOptions)
|
|
128111
|
+
);
|
|
127928
128112
|
handleDtsMayChangeOfAffectedFile(
|
|
127929
128113
|
state,
|
|
127930
128114
|
affectedFile,
|
|
@@ -127944,15 +128128,11 @@ function getNextAffectedFile(state, cancellationToken, host) {
|
|
|
127944
128128
|
if (nextKey.done) {
|
|
127945
128129
|
return void 0;
|
|
127946
128130
|
}
|
|
127947
|
-
const
|
|
127948
|
-
|
|
127949
|
-
if (compilerOptions.outFile) {
|
|
127950
|
-
Debug.assert(!state.semanticDiagnosticsPerFile);
|
|
127951
|
-
return program;
|
|
127952
|
-
}
|
|
128131
|
+
const compilerOptions = state.program.getCompilerOptions();
|
|
128132
|
+
if (compilerOptions.outFile) return state.program;
|
|
127953
128133
|
state.affectedFiles = BuilderState.getFilesAffectedByWithOldState(
|
|
127954
128134
|
state,
|
|
127955
|
-
program,
|
|
128135
|
+
state.program,
|
|
127956
128136
|
nextKey.value,
|
|
127957
128137
|
cancellationToken,
|
|
127958
128138
|
host
|
|
@@ -127963,14 +128143,22 @@ function getNextAffectedFile(state, cancellationToken, host) {
|
|
|
127963
128143
|
}
|
|
127964
128144
|
}
|
|
127965
128145
|
function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
|
|
127966
|
-
var _a;
|
|
127967
|
-
if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return;
|
|
127968
|
-
if (!emitOnlyDtsFiles)
|
|
127969
|
-
|
|
128146
|
+
var _a, _b;
|
|
128147
|
+
if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
|
|
128148
|
+
if (!emitOnlyDtsFiles) {
|
|
128149
|
+
state.affectedFilesPendingEmit = void 0;
|
|
128150
|
+
state.programEmitPending = void 0;
|
|
128151
|
+
}
|
|
128152
|
+
(_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
|
|
127970
128153
|
const pending = emitKind & 7 /* AllJs */;
|
|
127971
128154
|
if (!pending) state.affectedFilesPendingEmit.delete(path);
|
|
127972
128155
|
else state.affectedFilesPendingEmit.set(path, pending);
|
|
127973
128156
|
});
|
|
128157
|
+
if (state.programEmitPending) {
|
|
128158
|
+
const pending = state.programEmitPending & 7 /* AllJs */;
|
|
128159
|
+
if (!pending) state.programEmitPending = void 0;
|
|
128160
|
+
else state.programEmitPending = pending;
|
|
128161
|
+
}
|
|
127974
128162
|
}
|
|
127975
128163
|
function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
|
|
127976
128164
|
var _a;
|
|
@@ -128005,9 +128193,8 @@ function getNextPendingEmitDiagnosticsFile(state) {
|
|
|
128005
128193
|
function removeDiagnosticsOfLibraryFiles(state) {
|
|
128006
128194
|
if (!state.cleanedDiagnosticsOfLibFiles) {
|
|
128007
128195
|
state.cleanedDiagnosticsOfLibFiles = true;
|
|
128008
|
-
const
|
|
128009
|
-
|
|
128010
|
-
forEach(program.getSourceFiles(), (f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
|
|
128196
|
+
const options = state.program.getCompilerOptions();
|
|
128197
|
+
forEach(state.program.getSourceFiles(), (f) => state.program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, state.program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
|
|
128011
128198
|
}
|
|
128012
128199
|
}
|
|
128013
128200
|
function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
@@ -128016,7 +128203,7 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
|
|
|
128016
128203
|
removeDiagnosticsOfLibraryFiles(state);
|
|
128017
128204
|
BuilderState.updateShapeSignature(
|
|
128018
128205
|
state,
|
|
128019
|
-
|
|
128206
|
+
state.program,
|
|
128020
128207
|
affectedFile,
|
|
128021
128208
|
cancellationToken,
|
|
128022
128209
|
host
|
|
@@ -128034,12 +128221,11 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
|
|
|
128034
128221
|
function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken, host) {
|
|
128035
128222
|
removeSemanticDiagnosticsOf(state, path);
|
|
128036
128223
|
if (!state.changedFilesSet.has(path)) {
|
|
128037
|
-
const
|
|
128038
|
-
const sourceFile = program.getSourceFileByPath(path);
|
|
128224
|
+
const sourceFile = state.program.getSourceFileByPath(path);
|
|
128039
128225
|
if (sourceFile) {
|
|
128040
128226
|
BuilderState.updateShapeSignature(
|
|
128041
128227
|
state,
|
|
128042
|
-
program,
|
|
128228
|
+
state.program,
|
|
128043
128229
|
sourceFile,
|
|
128044
128230
|
cancellationToken,
|
|
128045
128231
|
host,
|
|
@@ -128047,9 +128233,17 @@ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken,
|
|
|
128047
128233
|
true
|
|
128048
128234
|
);
|
|
128049
128235
|
if (invalidateJsFiles) {
|
|
128050
|
-
addToAffectedFilesPendingEmit(
|
|
128236
|
+
addToAffectedFilesPendingEmit(
|
|
128237
|
+
state,
|
|
128238
|
+
path,
|
|
128239
|
+
getBuilderFileEmit(state.compilerOptions)
|
|
128240
|
+
);
|
|
128051
128241
|
} else if (getEmitDeclarations(state.compilerOptions)) {
|
|
128052
|
-
addToAffectedFilesPendingEmit(
|
|
128242
|
+
addToAffectedFilesPendingEmit(
|
|
128243
|
+
state,
|
|
128244
|
+
path,
|
|
128245
|
+
state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */
|
|
128246
|
+
);
|
|
128053
128247
|
}
|
|
128054
128248
|
}
|
|
128055
128249
|
}
|
|
@@ -128116,7 +128310,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
128116
128310
|
host
|
|
128117
128311
|
);
|
|
128118
128312
|
if (isChangedSignature(state, currentPath)) {
|
|
128119
|
-
const currentSourceFile =
|
|
128313
|
+
const currentSourceFile = state.program.getSourceFileByPath(currentPath);
|
|
128120
128314
|
queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
|
|
128121
128315
|
}
|
|
128122
128316
|
}
|
|
@@ -128162,33 +128356,33 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
|
|
|
128162
128356
|
);
|
|
128163
128357
|
return void 0;
|
|
128164
128358
|
}
|
|
128165
|
-
function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) {
|
|
128359
|
+
function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
|
|
128166
128360
|
return concatenate(
|
|
128167
|
-
getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken),
|
|
128168
|
-
|
|
128361
|
+
getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
|
|
128362
|
+
state.program.getProgramDiagnostics(sourceFile)
|
|
128169
128363
|
);
|
|
128170
128364
|
}
|
|
128171
|
-
function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) {
|
|
128365
|
+
function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
|
|
128366
|
+
semanticDiagnosticsPerFile ?? (semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile);
|
|
128172
128367
|
const path = sourceFile.resolvedPath;
|
|
128173
|
-
|
|
128174
|
-
|
|
128175
|
-
|
|
128176
|
-
return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
|
|
128177
|
-
}
|
|
128178
|
-
}
|
|
128179
|
-
const diagnostics = Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
|
|
128180
|
-
if (state.semanticDiagnosticsPerFile) {
|
|
128181
|
-
state.semanticDiagnosticsPerFile.set(path, diagnostics);
|
|
128368
|
+
const cachedDiagnostics = semanticDiagnosticsPerFile.get(path);
|
|
128369
|
+
if (cachedDiagnostics) {
|
|
128370
|
+
return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
|
|
128182
128371
|
}
|
|
128372
|
+
const diagnostics = state.program.getBindAndCheckDiagnostics(sourceFile, cancellationToken);
|
|
128373
|
+
semanticDiagnosticsPerFile.set(path, diagnostics);
|
|
128183
128374
|
return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
|
|
128184
128375
|
}
|
|
128185
|
-
function
|
|
128376
|
+
function isIncrementalBundleEmitBuildInfo(info) {
|
|
128186
128377
|
var _a;
|
|
128187
128378
|
return !!((_a = info.options) == null ? void 0 : _a.outFile);
|
|
128188
128379
|
}
|
|
128380
|
+
function isIncrementalBuildInfo(info) {
|
|
128381
|
+
return !!info.fileNames;
|
|
128382
|
+
}
|
|
128189
128383
|
function getBuildInfo2(state) {
|
|
128190
128384
|
var _a, _b;
|
|
128191
|
-
const currentDirectory =
|
|
128385
|
+
const currentDirectory = state.program.getCurrentDirectory();
|
|
128192
128386
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
128193
128387
|
const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
|
|
128194
128388
|
const fileNames = [];
|
|
@@ -128201,12 +128395,15 @@ function getBuildInfo2(state) {
|
|
|
128201
128395
|
tryAddRoot(key, fileId);
|
|
128202
128396
|
return value.impliedFormat ? { version: value.version, impliedFormat: value.impliedFormat, signature: void 0, affectsGlobalScope: void 0 } : value.version;
|
|
128203
128397
|
});
|
|
128204
|
-
|
|
128398
|
+
return {
|
|
128205
128399
|
fileNames,
|
|
128206
128400
|
fileInfos: fileInfos2,
|
|
128207
128401
|
root,
|
|
128208
128402
|
resolvedRoot: toResolvedRoot(),
|
|
128209
|
-
options:
|
|
128403
|
+
options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
|
|
128404
|
+
semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
|
|
128405
|
+
emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
|
|
128406
|
+
changeFileSet: toChangeFileSet(),
|
|
128210
128407
|
outSignature: state.outSignature,
|
|
128211
128408
|
latestChangedDtsFile,
|
|
128212
128409
|
pendingEmit: !state.programEmitPending ? void 0 : (
|
|
@@ -128215,10 +128412,10 @@ function getBuildInfo2(state) {
|
|
|
128215
128412
|
// Pending emit is same as deteremined by compilerOptions
|
|
128216
128413
|
state.programEmitPending
|
|
128217
128414
|
)
|
|
128218
|
-
)
|
|
128415
|
+
),
|
|
128219
128416
|
// Actual value
|
|
128417
|
+
version
|
|
128220
128418
|
};
|
|
128221
|
-
return createBuildInfo(program2);
|
|
128222
128419
|
}
|
|
128223
128420
|
let fileIdsList;
|
|
128224
128421
|
let fileNamesToFileIdListId;
|
|
@@ -128273,7 +128470,7 @@ function getBuildInfo2(state) {
|
|
|
128273
128470
|
toFileIdListId(state.referencedMap.getValues(key))
|
|
128274
128471
|
]);
|
|
128275
128472
|
}
|
|
128276
|
-
const semanticDiagnosticsPerFile =
|
|
128473
|
+
const semanticDiagnosticsPerFile = toIncrementalBuildInfoDiagnostics();
|
|
128277
128474
|
let affectedFilesPendingEmit;
|
|
128278
128475
|
if ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.size) {
|
|
128279
128476
|
const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
|
|
@@ -128297,29 +128494,22 @@ function getBuildInfo2(state) {
|
|
|
128297
128494
|
}
|
|
128298
128495
|
}
|
|
128299
128496
|
}
|
|
128300
|
-
|
|
128301
|
-
if (state.changedFilesSet.size) {
|
|
128302
|
-
for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
|
|
128303
|
-
changeFileSet = append(changeFileSet, toFileId(path));
|
|
128304
|
-
}
|
|
128305
|
-
}
|
|
128306
|
-
const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
|
|
128307
|
-
const program = {
|
|
128497
|
+
return {
|
|
128308
128498
|
fileNames,
|
|
128499
|
+
fileIdsList,
|
|
128309
128500
|
fileInfos,
|
|
128310
128501
|
root,
|
|
128311
128502
|
resolvedRoot: toResolvedRoot(),
|
|
128312
|
-
options:
|
|
128313
|
-
fileIdsList,
|
|
128503
|
+
options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
|
|
128314
128504
|
referencedMap,
|
|
128315
128505
|
semanticDiagnosticsPerFile,
|
|
128316
|
-
emitDiagnosticsPerFile,
|
|
128506
|
+
emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
|
|
128317
128507
|
affectedFilesPendingEmit,
|
|
128318
|
-
changeFileSet,
|
|
128508
|
+
changeFileSet: toChangeFileSet(),
|
|
128319
128509
|
emitSignatures,
|
|
128320
|
-
latestChangedDtsFile
|
|
128510
|
+
latestChangedDtsFile,
|
|
128511
|
+
version
|
|
128321
128512
|
};
|
|
128322
|
-
return createBuildInfo(program);
|
|
128323
128513
|
function relativeToBuildInfoEnsuringAbsolutePath(path) {
|
|
128324
128514
|
return relativeToBuildInfo(getNormalizedAbsolutePath(path, currentDirectory));
|
|
128325
128515
|
}
|
|
@@ -128367,13 +128557,13 @@ function getBuildInfo2(state) {
|
|
|
128367
128557
|
});
|
|
128368
128558
|
return result;
|
|
128369
128559
|
}
|
|
128370
|
-
function
|
|
128560
|
+
function toIncrementalBuildInfoCompilerOptions(options) {
|
|
128371
128561
|
let result;
|
|
128372
128562
|
const { optionsNameMap } = getOptionsNameMap();
|
|
128373
128563
|
for (const name of getOwnKeys(options).sort(compareStringsCaseSensitive)) {
|
|
128374
128564
|
const optionInfo = optionsNameMap.get(name.toLowerCase());
|
|
128375
128565
|
if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
|
|
128376
|
-
(result || (result = {}))[name] =
|
|
128566
|
+
(result || (result = {}))[name] = toReusableCompilerOptionValue(
|
|
128377
128567
|
optionInfo,
|
|
128378
128568
|
options[name]
|
|
128379
128569
|
);
|
|
@@ -128381,7 +128571,7 @@ function getBuildInfo2(state) {
|
|
|
128381
128571
|
}
|
|
128382
128572
|
return result;
|
|
128383
128573
|
}
|
|
128384
|
-
function
|
|
128574
|
+
function toReusableCompilerOptionValue(option, value) {
|
|
128385
128575
|
if (option) {
|
|
128386
128576
|
Debug.assert(option.type !== "listOrElement");
|
|
128387
128577
|
if (option.type === "list") {
|
|
@@ -128395,23 +128585,22 @@ function getBuildInfo2(state) {
|
|
|
128395
128585
|
}
|
|
128396
128586
|
return value;
|
|
128397
128587
|
}
|
|
128398
|
-
function
|
|
128588
|
+
function toIncrementalBuildInfoDiagnostics() {
|
|
128399
128589
|
let result;
|
|
128400
128590
|
state.fileInfos.forEach((_value, key) => {
|
|
128401
|
-
|
|
128402
|
-
const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
|
|
128591
|
+
const value = state.semanticDiagnosticsPerFile.get(key);
|
|
128403
128592
|
if (!value) {
|
|
128404
128593
|
if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
|
|
128405
128594
|
} else if (value.length) {
|
|
128406
128595
|
result = append(result, [
|
|
128407
128596
|
toFileId(key),
|
|
128408
|
-
|
|
128597
|
+
toReusableDiagnostic(value, key)
|
|
128409
128598
|
]);
|
|
128410
128599
|
}
|
|
128411
128600
|
});
|
|
128412
128601
|
return result;
|
|
128413
128602
|
}
|
|
128414
|
-
function
|
|
128603
|
+
function toIncrementalBuildInfoEmitDiagnostics() {
|
|
128415
128604
|
var _a2;
|
|
128416
128605
|
let result;
|
|
128417
128606
|
if (!((_a2 = state.emitDiagnosticsPerFile) == null ? void 0 : _a2.size)) return result;
|
|
@@ -128419,55 +128608,64 @@ function getBuildInfo2(state) {
|
|
|
128419
128608
|
const value = state.emitDiagnosticsPerFile.get(key);
|
|
128420
128609
|
result = append(result, [
|
|
128421
128610
|
toFileId(key),
|
|
128422
|
-
|
|
128611
|
+
toReusableDiagnostic(value, key)
|
|
128423
128612
|
]);
|
|
128424
128613
|
}
|
|
128425
128614
|
return result;
|
|
128426
128615
|
}
|
|
128427
|
-
function
|
|
128616
|
+
function toReusableDiagnostic(diagnostics, diagnosticFilePath) {
|
|
128428
128617
|
Debug.assert(!!diagnostics.length);
|
|
128429
128618
|
return diagnostics.map((diagnostic) => {
|
|
128430
|
-
const result =
|
|
128619
|
+
const result = toReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath);
|
|
128431
128620
|
result.reportsUnnecessary = diagnostic.reportsUnnecessary;
|
|
128432
128621
|
result.reportDeprecated = diagnostic.reportsDeprecated;
|
|
128433
128622
|
result.source = diagnostic.source;
|
|
128434
128623
|
result.skippedOn = diagnostic.skippedOn;
|
|
128435
128624
|
const { relatedInformation } = diagnostic;
|
|
128436
|
-
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) =>
|
|
128625
|
+
result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => toReusableDiagnosticRelatedInformation(r, diagnosticFilePath)) : [] : void 0;
|
|
128437
128626
|
return result;
|
|
128438
128627
|
});
|
|
128439
128628
|
}
|
|
128440
|
-
function
|
|
128629
|
+
function toReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath) {
|
|
128441
128630
|
const { file } = diagnostic;
|
|
128442
128631
|
return {
|
|
128443
128632
|
...diagnostic,
|
|
128444
128633
|
file: file ? file.resolvedPath === diagnosticFilePath ? void 0 : relativeToBuildInfo(file.resolvedPath) : false,
|
|
128445
|
-
messageText: isString(diagnostic.messageText) ? diagnostic.messageText :
|
|
128634
|
+
messageText: isString(diagnostic.messageText) ? diagnostic.messageText : toReusableDiagnosticMessageChain(diagnostic.messageText)
|
|
128446
128635
|
};
|
|
128447
128636
|
}
|
|
128448
|
-
function
|
|
128637
|
+
function toReusableDiagnosticMessageChain(chain) {
|
|
128449
128638
|
if (chain.repopulateInfo) {
|
|
128450
128639
|
return {
|
|
128451
128640
|
info: chain.repopulateInfo(),
|
|
128452
|
-
next:
|
|
128641
|
+
next: toReusableDiagnosticMessageChainArray(chain.next)
|
|
128453
128642
|
};
|
|
128454
128643
|
}
|
|
128455
|
-
const next =
|
|
128644
|
+
const next = toReusableDiagnosticMessageChainArray(chain.next);
|
|
128456
128645
|
return next === chain.next ? chain : { ...chain, next };
|
|
128457
128646
|
}
|
|
128458
|
-
function
|
|
128647
|
+
function toReusableDiagnosticMessageChainArray(array) {
|
|
128459
128648
|
if (!array) return array;
|
|
128460
128649
|
return forEach(array, (chain, index) => {
|
|
128461
|
-
const reusable =
|
|
128650
|
+
const reusable = toReusableDiagnosticMessageChain(chain);
|
|
128462
128651
|
if (chain === reusable) return void 0;
|
|
128463
128652
|
const result = index > 0 ? array.slice(0, index - 1) : [];
|
|
128464
128653
|
result.push(reusable);
|
|
128465
128654
|
for (let i = index + 1; i < array.length; i++) {
|
|
128466
|
-
result.push(
|
|
128655
|
+
result.push(toReusableDiagnosticMessageChain(array[i]));
|
|
128467
128656
|
}
|
|
128468
128657
|
return result;
|
|
128469
128658
|
}) || array;
|
|
128470
128659
|
}
|
|
128660
|
+
function toChangeFileSet() {
|
|
128661
|
+
let changeFileSet;
|
|
128662
|
+
if (state.changedFilesSet.size) {
|
|
128663
|
+
for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
|
|
128664
|
+
changeFileSet = append(changeFileSet, toFileId(path));
|
|
128665
|
+
}
|
|
128666
|
+
}
|
|
128667
|
+
return changeFileSet;
|
|
128668
|
+
}
|
|
128471
128669
|
}
|
|
128472
128670
|
var BuilderProgramKind = /* @__PURE__ */ ((BuilderProgramKind2) => {
|
|
128473
128671
|
BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
|
|
@@ -128531,24 +128729,27 @@ function computeSignature(text, host, data) {
|
|
|
128531
128729
|
return (host.createHash ?? generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
|
|
128532
128730
|
}
|
|
128533
128731
|
function createBuilderProgram(kind, { newProgram, host, oldProgram, configFileParsingDiagnostics }) {
|
|
128534
|
-
let oldState = oldProgram && oldProgram.
|
|
128732
|
+
let oldState = oldProgram && oldProgram.state;
|
|
128535
128733
|
if (oldState && newProgram === oldState.program && configFileParsingDiagnostics === newProgram.getConfigFileParsingDiagnostics()) {
|
|
128536
128734
|
newProgram = void 0;
|
|
128537
128735
|
oldState = void 0;
|
|
128538
128736
|
return oldProgram;
|
|
128539
128737
|
}
|
|
128540
128738
|
const state = createBuilderProgramState(newProgram, oldState);
|
|
128541
|
-
newProgram.getBuildInfo = () => getBuildInfo2(state);
|
|
128739
|
+
newProgram.getBuildInfo = () => getBuildInfo2(toBuilderProgramStateWithDefinedProgram(state));
|
|
128542
128740
|
newProgram = void 0;
|
|
128543
128741
|
oldProgram = void 0;
|
|
128544
128742
|
oldState = void 0;
|
|
128545
|
-
const
|
|
128546
|
-
|
|
128547
|
-
builderProgram.getState = getState;
|
|
128743
|
+
const builderProgram = createRedirectedBuilderProgram(state, configFileParsingDiagnostics);
|
|
128744
|
+
builderProgram.state = state;
|
|
128548
128745
|
builderProgram.saveEmitState = () => backupBuilderProgramEmitState(state);
|
|
128549
128746
|
builderProgram.restoreEmitState = (saved) => restoreBuilderProgramEmitState(state, saved);
|
|
128550
128747
|
builderProgram.hasChangedEmitSignature = () => !!state.hasChangedEmitSignature;
|
|
128551
|
-
builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(
|
|
128748
|
+
builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(
|
|
128749
|
+
state,
|
|
128750
|
+
Debug.checkDefined(state.program),
|
|
128751
|
+
sourceFile
|
|
128752
|
+
);
|
|
128552
128753
|
builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
|
|
128553
128754
|
builderProgram.emit = emit;
|
|
128554
128755
|
builderProgram.releaseProgram = () => releaseCache(state);
|
|
@@ -128563,22 +128764,29 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
128563
128764
|
}
|
|
128564
128765
|
return builderProgram;
|
|
128565
128766
|
function emitBuildInfo(writeFile2, cancellationToken) {
|
|
128767
|
+
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
128566
128768
|
if (state.buildInfoEmitPending) {
|
|
128567
|
-
const result =
|
|
128769
|
+
const result = state.program.emitBuildInfo(
|
|
128770
|
+
writeFile2 || maybeBind(host, host.writeFile),
|
|
128771
|
+
cancellationToken
|
|
128772
|
+
);
|
|
128568
128773
|
state.buildInfoEmitPending = false;
|
|
128569
128774
|
return result;
|
|
128570
128775
|
}
|
|
128571
128776
|
return emitSkippedWithNoDiagnostics;
|
|
128572
128777
|
}
|
|
128573
128778
|
function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
128574
|
-
var _a, _b, _c;
|
|
128779
|
+
var _a, _b, _c, _d;
|
|
128780
|
+
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
128575
128781
|
let affected = getNextAffectedFile(state, cancellationToken, host);
|
|
128576
128782
|
const programEmitKind = getBuilderFileEmit(state.compilerOptions);
|
|
128577
128783
|
let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
|
|
128578
128784
|
if (!affected) {
|
|
128579
128785
|
if (!state.compilerOptions.outFile) {
|
|
128580
128786
|
const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
|
|
128581
|
-
if (
|
|
128787
|
+
if (pendingAffectedFile) {
|
|
128788
|
+
({ affectedFile: affected, emitKind } = pendingAffectedFile);
|
|
128789
|
+
} else {
|
|
128582
128790
|
const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
|
|
128583
128791
|
if (pendingForDiagnostics) {
|
|
128584
128792
|
(state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
|
|
@@ -128587,52 +128795,81 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
128587
128795
|
affected: pendingForDiagnostics.affectedFile
|
|
128588
128796
|
};
|
|
128589
128797
|
}
|
|
128590
|
-
if (!state.buildInfoEmitPending) return void 0;
|
|
128591
|
-
const affected2 = state.program;
|
|
128592
|
-
const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
|
|
128593
|
-
state.buildInfoEmitPending = false;
|
|
128594
|
-
return { result: result2, affected: affected2 };
|
|
128595
128798
|
}
|
|
128596
|
-
({ affectedFile: affected, emitKind } = pendingAffectedFile);
|
|
128597
128799
|
} else {
|
|
128598
|
-
if (
|
|
128599
|
-
|
|
128600
|
-
|
|
128601
|
-
|
|
128602
|
-
|
|
128800
|
+
if (state.programEmitPending) {
|
|
128801
|
+
emitKind = state.programEmitPending;
|
|
128802
|
+
if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
|
|
128803
|
+
if (emitKind) affected = state.program;
|
|
128804
|
+
}
|
|
128805
|
+
if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
|
|
128806
|
+
const seenKind = state.seenProgramEmit || 0 /* None */;
|
|
128807
|
+
if (!(seenKind & 24 /* AllDts */)) {
|
|
128808
|
+
state.seenProgramEmit = 24 /* AllDts */ | seenKind;
|
|
128809
|
+
const diagnostics = [];
|
|
128810
|
+
state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
|
|
128811
|
+
return {
|
|
128812
|
+
result: { emitSkipped: true, diagnostics },
|
|
128813
|
+
affected: state.program
|
|
128814
|
+
};
|
|
128815
|
+
}
|
|
128816
|
+
}
|
|
128817
|
+
}
|
|
128818
|
+
if (!affected) {
|
|
128819
|
+
if (!state.buildInfoEmitPending) return void 0;
|
|
128820
|
+
const affected2 = state.program;
|
|
128821
|
+
const result2 = affected2.emitBuildInfo(
|
|
128822
|
+
writeFile2 || maybeBind(host, host.writeFile),
|
|
128823
|
+
cancellationToken
|
|
128824
|
+
);
|
|
128825
|
+
state.buildInfoEmitPending = false;
|
|
128826
|
+
return { result: result2, affected: affected2 };
|
|
128603
128827
|
}
|
|
128604
128828
|
}
|
|
128605
128829
|
let emitOnly;
|
|
128606
128830
|
if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
|
|
128607
128831
|
if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
|
|
128608
|
-
if (affected === state.program) {
|
|
128609
|
-
state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
|
|
128610
|
-
}
|
|
128611
128832
|
const result = state.program.emit(
|
|
128612
128833
|
affected === state.program ? void 0 : affected,
|
|
128613
128834
|
getWriteFileCallback(writeFile2, customTransformers),
|
|
128614
128835
|
cancellationToken,
|
|
128615
128836
|
emitOnly,
|
|
128616
|
-
customTransformers
|
|
128837
|
+
customTransformers,
|
|
128838
|
+
/*forceDtsEmit*/
|
|
128839
|
+
void 0,
|
|
128840
|
+
/*skipBuildInfo*/
|
|
128841
|
+
true
|
|
128617
128842
|
);
|
|
128618
128843
|
if (affected !== state.program) {
|
|
128619
128844
|
const affectedSourceFile = affected;
|
|
128620
128845
|
state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
|
|
128621
128846
|
if (state.affectedFilesIndex !== void 0) state.affectedFilesIndex++;
|
|
128622
128847
|
state.buildInfoEmitPending = true;
|
|
128623
|
-
const existing = ((
|
|
128848
|
+
const existing = ((_b = state.seenEmittedFiles) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
|
|
128624
128849
|
(state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, emitKind | existing);
|
|
128625
|
-
const existingPending = ((
|
|
128850
|
+
const existingPending = ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.get(affectedSourceFile.resolvedPath)) || programEmitKind;
|
|
128626
128851
|
const pendingKind = getPendingEmitKind(existingPending, emitKind | existing);
|
|
128627
128852
|
if (pendingKind) (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
|
|
128628
|
-
else (
|
|
128853
|
+
else (_d = state.affectedFilesPendingEmit) == null ? void 0 : _d.delete(affectedSourceFile.resolvedPath);
|
|
128629
128854
|
if (result.diagnostics.length) (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
|
|
128630
128855
|
} else {
|
|
128631
128856
|
state.changedFilesSet.clear();
|
|
128857
|
+
state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
|
|
128858
|
+
state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
|
|
128859
|
+
let emitDiagnosticsPerFile;
|
|
128860
|
+
result.diagnostics.forEach((d) => {
|
|
128861
|
+
if (!d.file) return;
|
|
128862
|
+
let diagnostics = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
|
|
128863
|
+
if (!diagnostics) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics = []);
|
|
128864
|
+
diagnostics.push(d);
|
|
128865
|
+
});
|
|
128866
|
+
if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
|
|
128867
|
+
state.buildInfoEmitPending = true;
|
|
128632
128868
|
}
|
|
128633
128869
|
return { result, affected };
|
|
128634
128870
|
}
|
|
128635
128871
|
function getWriteFileCallback(writeFile2, customTransformers) {
|
|
128872
|
+
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
128636
128873
|
if (!getEmitDeclarations(state.compilerOptions)) return writeFile2 || maybeBind(host, host.writeFile);
|
|
128637
128874
|
return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
128638
128875
|
var _a, _b, _c;
|
|
@@ -128699,6 +128936,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
128699
128936
|
};
|
|
128700
128937
|
}
|
|
128701
128938
|
function emit(targetSourceFile, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
|
128939
|
+
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
128702
128940
|
if (kind === 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
|
|
128703
128941
|
assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
|
|
128704
128942
|
}
|
|
@@ -128711,7 +128949,12 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
128711
128949
|
let diagnostics;
|
|
128712
128950
|
let emittedFiles = [];
|
|
128713
128951
|
let affectedEmitResult;
|
|
128714
|
-
while (affectedEmitResult = emitNextAffectedFile(
|
|
128952
|
+
while (affectedEmitResult = emitNextAffectedFile(
|
|
128953
|
+
writeFile2,
|
|
128954
|
+
cancellationToken,
|
|
128955
|
+
emitOnlyDtsFiles,
|
|
128956
|
+
customTransformers
|
|
128957
|
+
)) {
|
|
128715
128958
|
emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
|
|
128716
128959
|
diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics);
|
|
128717
128960
|
emittedFiles = addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
|
|
@@ -128727,7 +128970,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
128727
128970
|
clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles);
|
|
128728
128971
|
}
|
|
128729
128972
|
}
|
|
128730
|
-
return
|
|
128973
|
+
return state.program.emit(
|
|
128731
128974
|
targetSourceFile,
|
|
128732
128975
|
getWriteFileCallback(writeFile2, customTransformers),
|
|
128733
128976
|
cancellationToken,
|
|
@@ -128736,6 +128979,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
128736
128979
|
);
|
|
128737
128980
|
}
|
|
128738
128981
|
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
|
|
128982
|
+
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
128739
128983
|
while (true) {
|
|
128740
128984
|
const affected = getNextAffectedFile(state, cancellationToken, host);
|
|
128741
128985
|
let result;
|
|
@@ -128750,31 +128994,41 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
128750
128994
|
state.buildInfoEmitPending = true;
|
|
128751
128995
|
if (!result) continue;
|
|
128752
128996
|
} else {
|
|
128753
|
-
|
|
128754
|
-
|
|
128755
|
-
|
|
128756
|
-
|
|
128997
|
+
let diagnostics;
|
|
128998
|
+
const semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
|
|
128999
|
+
state.program.getSourceFiles().forEach(
|
|
129000
|
+
(sourceFile) => diagnostics = addRange(
|
|
129001
|
+
diagnostics,
|
|
129002
|
+
getSemanticDiagnosticsOfFile(
|
|
129003
|
+
state,
|
|
129004
|
+
sourceFile,
|
|
129005
|
+
cancellationToken,
|
|
129006
|
+
semanticDiagnosticsPerFile
|
|
129007
|
+
)
|
|
129008
|
+
)
|
|
128757
129009
|
);
|
|
129010
|
+
state.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile;
|
|
129011
|
+
result = diagnostics || emptyArray;
|
|
128758
129012
|
state.changedFilesSet.clear();
|
|
128759
129013
|
state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
|
|
129014
|
+
state.buildInfoEmitPending = true;
|
|
128760
129015
|
}
|
|
128761
129016
|
return { result, affected };
|
|
128762
129017
|
}
|
|
128763
129018
|
}
|
|
128764
129019
|
function getSemanticDiagnostics(sourceFile, cancellationToken) {
|
|
129020
|
+
Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
|
|
128765
129021
|
assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
|
|
128766
|
-
const compilerOptions = Debug.checkDefined(state.program).getCompilerOptions();
|
|
128767
|
-
if (compilerOptions.outFile) {
|
|
128768
|
-
Debug.assert(!state.semanticDiagnosticsPerFile);
|
|
128769
|
-
return Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken);
|
|
128770
|
-
}
|
|
128771
129022
|
if (sourceFile) {
|
|
128772
129023
|
return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken);
|
|
128773
129024
|
}
|
|
128774
|
-
while (
|
|
129025
|
+
while (true) {
|
|
129026
|
+
const affectedResult = getSemanticDiagnosticsOfNextAffectedFile(cancellationToken);
|
|
129027
|
+
if (!affectedResult) break;
|
|
129028
|
+
if (affectedResult.affected === state.program) return affectedResult.result;
|
|
128775
129029
|
}
|
|
128776
129030
|
let diagnostics;
|
|
128777
|
-
for (const sourceFile2 of
|
|
129031
|
+
for (const sourceFile2 of state.program.getSourceFiles()) {
|
|
128778
129032
|
diagnostics = addRange(diagnostics, getSemanticDiagnosticsOfFile(state, sourceFile2, cancellationToken));
|
|
128779
129033
|
}
|
|
128780
129034
|
return diagnostics || emptyArray;
|
|
@@ -128795,39 +129049,42 @@ function toBuilderFileEmit(value, fullEmitForOptions) {
|
|
|
128795
129049
|
function toProgramEmitPending(value, options) {
|
|
128796
129050
|
return !value ? getBuilderFileEmit(options || {}) : value;
|
|
128797
129051
|
}
|
|
128798
|
-
function
|
|
129052
|
+
function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath, host) {
|
|
128799
129053
|
var _a, _b, _c, _d;
|
|
128800
|
-
const program = buildInfo.program;
|
|
128801
129054
|
const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
128802
129055
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
128803
129056
|
let state;
|
|
128804
|
-
const filePaths = (_a =
|
|
129057
|
+
const filePaths = (_a = buildInfo.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
|
|
128805
129058
|
let filePathsSetList;
|
|
128806
|
-
const latestChangedDtsFile =
|
|
128807
|
-
|
|
128808
|
-
|
|
128809
|
-
|
|
129059
|
+
const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
|
|
129060
|
+
const fileInfos = /* @__PURE__ */ new Map();
|
|
129061
|
+
const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
|
|
129062
|
+
if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
|
|
129063
|
+
buildInfo.fileInfos.forEach((fileInfo, index) => {
|
|
128810
129064
|
const path = toFilePath(index + 1);
|
|
128811
129065
|
fileInfos.set(path, isString(fileInfo) ? { version: fileInfo, signature: void 0, affectsGlobalScope: void 0, impliedFormat: void 0 } : fileInfo);
|
|
128812
129066
|
});
|
|
128813
129067
|
state = {
|
|
128814
129068
|
fileInfos,
|
|
128815
|
-
compilerOptions:
|
|
129069
|
+
compilerOptions: buildInfo.options ? convertToOptionsWithAbsolutePaths(buildInfo.options, toAbsolutePath) : {},
|
|
129070
|
+
semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
|
|
129071
|
+
emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
|
|
129072
|
+
hasReusableDiagnostic: true,
|
|
129073
|
+
changedFilesSet,
|
|
128816
129074
|
latestChangedDtsFile,
|
|
128817
|
-
outSignature:
|
|
128818
|
-
programEmitPending:
|
|
129075
|
+
outSignature: buildInfo.outSignature,
|
|
129076
|
+
programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options)
|
|
128819
129077
|
};
|
|
128820
129078
|
} else {
|
|
128821
|
-
filePathsSetList = (_b =
|
|
128822
|
-
const
|
|
128823
|
-
|
|
128824
|
-
program.fileInfos.forEach((fileInfo, index) => {
|
|
129079
|
+
filePathsSetList = (_b = buildInfo.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
|
|
129080
|
+
const emitSignatures = ((_c = buildInfo.options) == null ? void 0 : _c.composite) && !buildInfo.options.outFile ? /* @__PURE__ */ new Map() : void 0;
|
|
129081
|
+
buildInfo.fileInfos.forEach((fileInfo, index) => {
|
|
128825
129082
|
const path = toFilePath(index + 1);
|
|
128826
129083
|
const stateFileInfo = toBuilderStateFileInfoForMultiEmit(fileInfo);
|
|
128827
129084
|
fileInfos.set(path, stateFileInfo);
|
|
128828
129085
|
if (emitSignatures && stateFileInfo.signature) emitSignatures.set(path, stateFileInfo.signature);
|
|
128829
129086
|
});
|
|
128830
|
-
(_d =
|
|
129087
|
+
(_d = buildInfo.emitSignatures) == null ? void 0 : _d.forEach((value) => {
|
|
128831
129088
|
if (isNumber(value)) emitSignatures.delete(toFilePath(value));
|
|
128832
129089
|
else {
|
|
128833
129090
|
const key = toFilePath(value[0]);
|
|
@@ -128840,23 +129097,22 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
128840
129097
|
);
|
|
128841
129098
|
}
|
|
128842
129099
|
});
|
|
128843
|
-
const
|
|
128844
|
-
const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
|
|
129100
|
+
const fullEmitForOptions = buildInfo.affectedFilesPendingEmit ? getBuilderFileEmit(buildInfo.options || {}) : void 0;
|
|
128845
129101
|
state = {
|
|
128846
129102
|
fileInfos,
|
|
128847
|
-
compilerOptions:
|
|
128848
|
-
referencedMap: toManyToManyPathMap(
|
|
128849
|
-
semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(
|
|
128850
|
-
emitDiagnosticsPerFile: toPerFileEmitDiagnostics(
|
|
129103
|
+
compilerOptions: buildInfo.options ? convertToOptionsWithAbsolutePaths(buildInfo.options, toAbsolutePath) : {},
|
|
129104
|
+
referencedMap: toManyToManyPathMap(buildInfo.referencedMap, buildInfo.options ?? {}),
|
|
129105
|
+
semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
|
|
129106
|
+
emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
|
|
128851
129107
|
hasReusableDiagnostic: true,
|
|
128852
|
-
affectedFilesPendingEmit:
|
|
129108
|
+
affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
|
|
128853
129109
|
changedFilesSet,
|
|
128854
129110
|
latestChangedDtsFile,
|
|
128855
129111
|
emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
|
|
128856
129112
|
};
|
|
128857
129113
|
}
|
|
128858
129114
|
return {
|
|
128859
|
-
|
|
129115
|
+
state,
|
|
128860
129116
|
saveEmitState: noop,
|
|
128861
129117
|
restoreEmitState: noop,
|
|
128862
129118
|
getProgram: notImplemented,
|
|
@@ -128898,7 +129154,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
128898
129154
|
referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
|
|
128899
129155
|
return map2;
|
|
128900
129156
|
}
|
|
128901
|
-
function toPerFileSemanticDiagnostics(diagnostics
|
|
129157
|
+
function toPerFileSemanticDiagnostics(diagnostics) {
|
|
128902
129158
|
const semanticDiagnostics = new Map(
|
|
128903
129159
|
mapDefinedIterator(
|
|
128904
129160
|
fileInfos.keys(),
|
|
@@ -128909,7 +129165,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
128909
129165
|
if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
|
|
128910
129166
|
else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
|
|
128911
129167
|
});
|
|
128912
|
-
return semanticDiagnostics
|
|
129168
|
+
return semanticDiagnostics;
|
|
128913
129169
|
}
|
|
128914
129170
|
function toPerFileEmitDiagnostics(diagnostics) {
|
|
128915
129171
|
return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
|
|
@@ -128950,15 +129206,15 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
|
128950
129206
|
}
|
|
128951
129207
|
}
|
|
128952
129208
|
}
|
|
128953
|
-
function createRedirectedBuilderProgram(
|
|
129209
|
+
function createRedirectedBuilderProgram(state, configFileParsingDiagnostics) {
|
|
128954
129210
|
return {
|
|
128955
|
-
|
|
129211
|
+
state: void 0,
|
|
128956
129212
|
saveEmitState: noop,
|
|
128957
129213
|
restoreEmitState: noop,
|
|
128958
129214
|
getProgram,
|
|
128959
|
-
getProgramOrUndefined: () =>
|
|
128960
|
-
releaseProgram: () =>
|
|
128961
|
-
getCompilerOptions: () =>
|
|
129215
|
+
getProgramOrUndefined: () => state.program,
|
|
129216
|
+
releaseProgram: () => state.program = void 0,
|
|
129217
|
+
getCompilerOptions: () => state.compilerOptions,
|
|
128962
129218
|
getSourceFile: (fileName) => getProgram().getSourceFile(fileName),
|
|
128963
129219
|
getSourceFiles: () => getProgram().getSourceFiles(),
|
|
128964
129220
|
getOptionsDiagnostics: (cancellationToken) => getProgram().getOptionsDiagnostics(cancellationToken),
|
|
@@ -128974,20 +129230,50 @@ function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics)
|
|
|
128974
129230
|
close: noop
|
|
128975
129231
|
};
|
|
128976
129232
|
function getProgram() {
|
|
128977
|
-
return Debug.checkDefined(
|
|
129233
|
+
return Debug.checkDefined(state.program);
|
|
128978
129234
|
}
|
|
128979
129235
|
}
|
|
128980
129236
|
|
|
128981
129237
|
// src/compiler/builderPublic.ts
|
|
128982
129238
|
function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
|
|
128983
|
-
return createBuilderProgram(
|
|
129239
|
+
return createBuilderProgram(
|
|
129240
|
+
0 /* SemanticDiagnosticsBuilderProgram */,
|
|
129241
|
+
getBuilderCreationParameters(
|
|
129242
|
+
newProgramOrRootNames,
|
|
129243
|
+
hostOrOptions,
|
|
129244
|
+
oldProgramOrHost,
|
|
129245
|
+
configFileParsingDiagnosticsOrOldProgram,
|
|
129246
|
+
configFileParsingDiagnostics,
|
|
129247
|
+
projectReferences
|
|
129248
|
+
)
|
|
129249
|
+
);
|
|
128984
129250
|
}
|
|
128985
129251
|
function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
|
|
128986
|
-
return createBuilderProgram(
|
|
129252
|
+
return createBuilderProgram(
|
|
129253
|
+
1 /* EmitAndSemanticDiagnosticsBuilderProgram */,
|
|
129254
|
+
getBuilderCreationParameters(
|
|
129255
|
+
newProgramOrRootNames,
|
|
129256
|
+
hostOrOptions,
|
|
129257
|
+
oldProgramOrHost,
|
|
129258
|
+
configFileParsingDiagnosticsOrOldProgram,
|
|
129259
|
+
configFileParsingDiagnostics,
|
|
129260
|
+
projectReferences
|
|
129261
|
+
)
|
|
129262
|
+
);
|
|
128987
129263
|
}
|
|
128988
129264
|
function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
|
|
128989
|
-
const { newProgram, configFileParsingDiagnostics: newConfigFileParsingDiagnostics } = getBuilderCreationParameters(
|
|
128990
|
-
|
|
129265
|
+
const { newProgram, configFileParsingDiagnostics: newConfigFileParsingDiagnostics } = getBuilderCreationParameters(
|
|
129266
|
+
newProgramOrRootNames,
|
|
129267
|
+
hostOrOptions,
|
|
129268
|
+
oldProgramOrHost,
|
|
129269
|
+
configFileParsingDiagnosticsOrOldProgram,
|
|
129270
|
+
configFileParsingDiagnostics,
|
|
129271
|
+
projectReferences
|
|
129272
|
+
);
|
|
129273
|
+
return createRedirectedBuilderProgram(
|
|
129274
|
+
{ program: newProgram, compilerOptions: newProgram.getCompilerOptions() },
|
|
129275
|
+
newConfigFileParsingDiagnostics
|
|
129276
|
+
);
|
|
128991
129277
|
}
|
|
128992
129278
|
|
|
128993
129279
|
// src/compiler/resolutionCache.ts
|
|
@@ -130262,13 +130548,13 @@ function createTabularErrorsDisplay(filesInError, host) {
|
|
|
130262
130548
|
});
|
|
130263
130549
|
return tabularData;
|
|
130264
130550
|
}
|
|
130265
|
-
function
|
|
130266
|
-
return !!program.
|
|
130551
|
+
function isBuilderProgram(program) {
|
|
130552
|
+
return !!program.state;
|
|
130267
130553
|
}
|
|
130268
130554
|
function listFiles(program, write) {
|
|
130269
130555
|
const options = program.getCompilerOptions();
|
|
130270
130556
|
if (options.explainFiles) {
|
|
130271
|
-
explainFiles(
|
|
130557
|
+
explainFiles(isBuilderProgram(program) ? program.getProgram() : program, write);
|
|
130272
130558
|
} else if (options.listFiles || options.listFilesOnly) {
|
|
130273
130559
|
forEach(program.getSourceFiles(), (file) => {
|
|
130274
130560
|
write(file.fileName);
|
|
@@ -130768,8 +131054,8 @@ function readBuilderProgram(compilerOptions, host) {
|
|
|
130768
131054
|
if (!content) return void 0;
|
|
130769
131055
|
buildInfo = getBuildInfo(buildInfoPath, content);
|
|
130770
131056
|
}
|
|
130771
|
-
if (!buildInfo || buildInfo.version !== version || !buildInfo
|
|
130772
|
-
return
|
|
131057
|
+
if (!buildInfo || buildInfo.version !== version || !isIncrementalBuildInfo(buildInfo)) return void 0;
|
|
131058
|
+
return createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath, host);
|
|
130773
131059
|
}
|
|
130774
131060
|
function createIncrementalCompilerHost(options, system = sys) {
|
|
130775
131061
|
const host = createCompilerHostWorker(
|
|
@@ -132085,8 +132371,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
132085
132371
|
({ buildResult, step } = buildErrors(
|
|
132086
132372
|
state,
|
|
132087
132373
|
projectPath,
|
|
132088
|
-
program,
|
|
132089
|
-
config,
|
|
132090
132374
|
diagnostics,
|
|
132091
132375
|
errorFlags,
|
|
132092
132376
|
errorType
|
|
@@ -132149,8 +132433,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
132149
132433
|
({ buildResult, step } = buildErrors(
|
|
132150
132434
|
state,
|
|
132151
132435
|
projectPath,
|
|
132152
|
-
program,
|
|
132153
|
-
config,
|
|
132154
132436
|
declDiagnostics,
|
|
132155
132437
|
32 /* DeclarationEmitErrors */,
|
|
132156
132438
|
"Declaration file"
|
|
@@ -132213,8 +132495,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
|
|
|
132213
132495
|
({ buildResult, step } = buildErrors(
|
|
132214
132496
|
state,
|
|
132215
132497
|
projectPath,
|
|
132216
|
-
program,
|
|
132217
|
-
config,
|
|
132218
132498
|
emitDiagnostics,
|
|
132219
132499
|
64 /* EmitErrors */,
|
|
132220
132500
|
"Emit"
|
|
@@ -132394,13 +132674,10 @@ function afterProgramDone(state, program) {
|
|
|
132394
132674
|
}
|
|
132395
132675
|
state.projectCompilerOptions = state.baseCompilerOptions;
|
|
132396
132676
|
}
|
|
132397
|
-
function buildErrors(state, resolvedPath,
|
|
132398
|
-
const canEmitBuildInfo = program && !program.getCompilerOptions().outFile;
|
|
132677
|
+
function buildErrors(state, resolvedPath, diagnostics, buildResult, errorType) {
|
|
132399
132678
|
reportAndStoreErrors(state, resolvedPath, diagnostics);
|
|
132400
132679
|
state.projectStatus.set(resolvedPath, { type: 0 /* Unbuildable */, reason: `${errorType} errors` });
|
|
132401
|
-
|
|
132402
|
-
afterProgramDone(state, program);
|
|
132403
|
-
return { buildResult, step: 5 /* QueueReferencingProjects */ };
|
|
132680
|
+
return { buildResult, step: 4 /* EmitBuildInfo */ };
|
|
132404
132681
|
}
|
|
132405
132682
|
function isFileWatcherWithModifiedTime(value) {
|
|
132406
132683
|
return !!value.watcher;
|
|
@@ -132543,7 +132820,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
132543
132820
|
let oldestOutputFileName;
|
|
132544
132821
|
let oldestOutputFileTime = maximumDate;
|
|
132545
132822
|
let buildInfoTime;
|
|
132546
|
-
let
|
|
132823
|
+
let incrementalBuildInfo;
|
|
132547
132824
|
let buildInfoVersionMap;
|
|
132548
132825
|
if (buildInfoPath) {
|
|
132549
132826
|
const buildInfoCacheEntry2 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
@@ -132568,26 +132845,26 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
132568
132845
|
fileName: buildInfoPath
|
|
132569
132846
|
};
|
|
132570
132847
|
}
|
|
132571
|
-
if (buildInfo
|
|
132848
|
+
if (isIncrementalBuildInfo(buildInfo) && buildInfo.version !== version) {
|
|
132572
132849
|
return {
|
|
132573
132850
|
type: 13 /* TsVersionOutputOfDate */,
|
|
132574
132851
|
version: buildInfo.version
|
|
132575
132852
|
};
|
|
132576
132853
|
}
|
|
132577
|
-
if (buildInfo
|
|
132578
|
-
if (((_a = buildInfo.
|
|
132854
|
+
if (isIncrementalBuildInfo(buildInfo)) {
|
|
132855
|
+
if (((_a = buildInfo.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.emitDiagnosticsPerFile) == null ? void 0 : _c.length) || buildInfo.pendingEmit !== void 0 : (_d = buildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
|
|
132579
132856
|
return {
|
|
132580
132857
|
type: 7 /* OutOfDateBuildInfo */,
|
|
132581
132858
|
buildInfoFile: buildInfoPath
|
|
132582
132859
|
};
|
|
132583
132860
|
}
|
|
132584
|
-
if (!project.options.noEmit && getPendingEmitKind(project.options, buildInfo.
|
|
132861
|
+
if (!project.options.noEmit && getPendingEmitKind(project.options, buildInfo.options || {})) {
|
|
132585
132862
|
return {
|
|
132586
132863
|
type: 8 /* OutOfDateOptions */,
|
|
132587
132864
|
buildInfoFile: buildInfoPath
|
|
132588
132865
|
};
|
|
132589
132866
|
}
|
|
132590
|
-
|
|
132867
|
+
incrementalBuildInfo = buildInfo;
|
|
132591
132868
|
}
|
|
132592
132869
|
oldestOutputFileTime = buildInfoTime;
|
|
132593
132870
|
oldestOutputFileName = buildInfoPath;
|
|
@@ -132604,12 +132881,12 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
132604
132881
|
reason: `${inputFile} does not exist`
|
|
132605
132882
|
};
|
|
132606
132883
|
}
|
|
132607
|
-
const inputPath =
|
|
132884
|
+
const inputPath = incrementalBuildInfo ? toPath2(state, inputFile) : void 0;
|
|
132608
132885
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
132609
132886
|
let version2;
|
|
132610
132887
|
let currentVersion;
|
|
132611
|
-
if (
|
|
132612
|
-
if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(
|
|
132888
|
+
if (incrementalBuildInfo) {
|
|
132889
|
+
if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
|
|
132613
132890
|
const resolvedInputPath = buildInfoVersionMap.roots.get(inputPath);
|
|
132614
132891
|
version2 = buildInfoVersionMap.fileInfos.get(resolvedInputPath ?? inputPath);
|
|
132615
132892
|
const text = version2 ? state.readFileWithCache(resolvedInputPath ?? inputFile) : void 0;
|
|
@@ -132628,10 +132905,10 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
|
|
|
132628
132905
|
newestInputFileName = inputFile;
|
|
132629
132906
|
newestInputFileTime = inputTime;
|
|
132630
132907
|
}
|
|
132631
|
-
if (
|
|
132908
|
+
if (incrementalBuildInfo) seenRoots.add(inputPath);
|
|
132632
132909
|
}
|
|
132633
|
-
if (
|
|
132634
|
-
if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(
|
|
132910
|
+
if (incrementalBuildInfo) {
|
|
132911
|
+
if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
|
|
132635
132912
|
const existingRoot = forEachEntry(
|
|
132636
132913
|
buildInfoVersionMap.roots,
|
|
132637
132914
|
// File was root file when project was built but its not any more
|
|
@@ -132778,7 +133055,7 @@ function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
|
|
|
132778
133055
|
if (!options.composite) return void 0;
|
|
132779
133056
|
const entry = Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
|
|
132780
133057
|
if (entry.latestChangedDtsTime !== void 0) return entry.latestChangedDtsTime || void 0;
|
|
132781
|
-
const latestChangedDtsTime = entry.buildInfo && entry.buildInfo
|
|
133058
|
+
const latestChangedDtsTime = entry.buildInfo && isIncrementalBuildInfo(entry.buildInfo) && entry.buildInfo.latestChangedDtsFile ? state.host.getModifiedTime(getNormalizedAbsolutePath(entry.buildInfo.latestChangedDtsFile, getDirectoryPath(entry.path))) : void 0;
|
|
132782
133059
|
entry.latestChangedDtsTime = latestChangedDtsTime || false;
|
|
132783
133060
|
return latestChangedDtsTime;
|
|
132784
133061
|
}
|
|
@@ -134748,7 +135025,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
134748
135025
|
expression,
|
|
134749
135026
|
/*includeBigInt*/
|
|
134750
135027
|
false
|
|
134751
|
-
)) {
|
|
135028
|
+
) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
|
|
134752
135029
|
context.tracker.reportInferenceFallback(prop.name);
|
|
134753
135030
|
result = false;
|
|
134754
135031
|
}
|
|
@@ -136856,12 +137133,12 @@ function isInReferenceCommentWorker(sourceFile, position, shouldBeReference) {
|
|
|
136856
137133
|
);
|
|
136857
137134
|
return !!range && shouldBeReference === tripleSlashDirectivePrefixRegex.test(sourceFile.text.substring(range.pos, range.end));
|
|
136858
137135
|
}
|
|
136859
|
-
function getReplacementSpanForContextToken(contextToken) {
|
|
137136
|
+
function getReplacementSpanForContextToken(contextToken, position) {
|
|
136860
137137
|
if (!contextToken) return void 0;
|
|
136861
137138
|
switch (contextToken.kind) {
|
|
136862
137139
|
case 11 /* StringLiteral */:
|
|
136863
137140
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
136864
|
-
return createTextSpanFromStringLiteralLikeContent(contextToken);
|
|
137141
|
+
return createTextSpanFromStringLiteralLikeContent(contextToken, position);
|
|
136865
137142
|
default:
|
|
136866
137143
|
return createTextSpanFromNode(contextToken);
|
|
136867
137144
|
}
|
|
@@ -136869,11 +137146,11 @@ function getReplacementSpanForContextToken(contextToken) {
|
|
|
136869
137146
|
function createTextSpanFromNode(node, sourceFile, endNode2) {
|
|
136870
137147
|
return createTextSpanFromBounds(node.getStart(sourceFile), (endNode2 || node).getEnd());
|
|
136871
137148
|
}
|
|
136872
|
-
function createTextSpanFromStringLiteralLikeContent(node) {
|
|
137149
|
+
function createTextSpanFromStringLiteralLikeContent(node, position) {
|
|
136873
137150
|
let replacementEnd = node.getEnd() - 1;
|
|
136874
137151
|
if (node.isUnterminated) {
|
|
136875
137152
|
if (node.getStart() === replacementEnd) return void 0;
|
|
136876
|
-
replacementEnd = node.getEnd();
|
|
137153
|
+
replacementEnd = Math.min(position, node.getEnd());
|
|
136877
137154
|
}
|
|
136878
137155
|
return createTextSpanFromBounds(node.getStart() + 1, replacementEnd);
|
|
136879
137156
|
}
|
|
@@ -142986,9 +143263,9 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
|
|
|
142986
143263
|
const namespaceImportName = namespaceNameConflicts ? getUniqueName(preferredName, sourceFile) : preferredName;
|
|
142987
143264
|
const neededNamedImports = /* @__PURE__ */ new Set();
|
|
142988
143265
|
for (const element of toConvert.elements) {
|
|
142989
|
-
const propertyName =
|
|
143266
|
+
const propertyName = element.propertyName || element.name;
|
|
142990
143267
|
ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, (id) => {
|
|
142991
|
-
const access = factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), propertyName);
|
|
143268
|
+
const access = propertyName.kind === 11 /* StringLiteral */ ? factory.createElementAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName)) : factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName));
|
|
142992
143269
|
if (isShorthandPropertyAssignment(id.parent)) {
|
|
142993
143270
|
changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access));
|
|
142994
143271
|
} else if (isExportSpecifier(id.parent)) {
|
|
@@ -143004,7 +143281,7 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
|
|
|
143004
143281
|
shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))
|
|
143005
143282
|
);
|
|
143006
143283
|
if (neededNamedImports.size && isImportDeclaration(importDecl)) {
|
|
143007
|
-
const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.
|
|
143284
|
+
const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.cloneNode(element.propertyName), factory.cloneNode(element.name)));
|
|
143008
143285
|
changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport(
|
|
143009
143286
|
importDecl,
|
|
143010
143287
|
/*defaultImportName*/
|
|
@@ -163303,7 +163580,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
163303
163580
|
var _a, _b;
|
|
163304
163581
|
let insertText;
|
|
163305
163582
|
let filterText;
|
|
163306
|
-
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
163583
|
+
let replacementSpan = getReplacementSpanForContextToken(replacementToken, position);
|
|
163307
163584
|
let data;
|
|
163308
163585
|
let isSnippet;
|
|
163309
163586
|
let source = getSourceFromOrigin(origin);
|
|
@@ -163420,10 +163697,18 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
163420
163697
|
hasAction = !importStatementCompletion;
|
|
163421
163698
|
}
|
|
163422
163699
|
const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
|
|
163423
|
-
if (
|
|
163424
|
-
const
|
|
163425
|
-
if (
|
|
163426
|
-
insertText =
|
|
163700
|
+
if (parentNamedImportOrExport) {
|
|
163701
|
+
const languageVersion = getEmitScriptTarget(host.getCompilationSettings());
|
|
163702
|
+
if (!isIdentifierText(name, languageVersion)) {
|
|
163703
|
+
insertText = JSON.stringify(name);
|
|
163704
|
+
if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
|
|
163705
|
+
insertText += " as " + generateIdentifierForArbitraryString(name, languageVersion);
|
|
163706
|
+
}
|
|
163707
|
+
} else if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
|
|
163708
|
+
const possibleToken = stringToToken(name);
|
|
163709
|
+
if (possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
|
|
163710
|
+
insertText = `${name} as ${name}_`;
|
|
163711
|
+
}
|
|
163427
163712
|
}
|
|
163428
163713
|
}
|
|
163429
163714
|
return {
|
|
@@ -163446,6 +163731,23 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
163446
163731
|
...includeSymbol ? { symbol } : void 0
|
|
163447
163732
|
};
|
|
163448
163733
|
}
|
|
163734
|
+
function generateIdentifierForArbitraryString(text, languageVersion) {
|
|
163735
|
+
let needsUnderscore = false;
|
|
163736
|
+
let identifier = "";
|
|
163737
|
+
let ch;
|
|
163738
|
+
for (let i = 0; i < text.length; i += ch !== void 0 && ch >= 65536 ? 2 : 1) {
|
|
163739
|
+
ch = text.codePointAt(i);
|
|
163740
|
+
if (ch !== void 0 && (i === 0 ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
|
|
163741
|
+
if (needsUnderscore) identifier += "_";
|
|
163742
|
+
identifier += String.fromCodePoint(ch);
|
|
163743
|
+
needsUnderscore = false;
|
|
163744
|
+
} else {
|
|
163745
|
+
needsUnderscore = true;
|
|
163746
|
+
}
|
|
163747
|
+
}
|
|
163748
|
+
if (needsUnderscore) identifier += "_";
|
|
163749
|
+
return identifier || "_";
|
|
163750
|
+
}
|
|
163449
163751
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
163450
163752
|
if (isInJSFile(location)) {
|
|
163451
163753
|
return false;
|
|
@@ -165277,7 +165579,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
165277
165579
|
completionKind = 3 /* MemberLike */;
|
|
165278
165580
|
isNewIdentifierLocation = false;
|
|
165279
165581
|
const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
|
|
165280
|
-
const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => (n.propertyName || n.name)
|
|
165582
|
+
const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
|
|
165281
165583
|
const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
|
|
165282
165584
|
symbols = concatenate(symbols, uniques);
|
|
165283
165585
|
if (!uniques.length) {
|
|
@@ -165768,6 +166070,9 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
|
|
|
165768
166070
|
if (isIdentifierText(name, target, jsxIdentifierExpected ? 1 /* JSX */ : 0 /* Standard */) || symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
|
|
165769
166071
|
return validNameResult;
|
|
165770
166072
|
}
|
|
166073
|
+
if (symbol.flags & 2097152 /* Alias */) {
|
|
166074
|
+
return { name, needsConvertPropertyAccess: true };
|
|
166075
|
+
}
|
|
165771
166076
|
switch (kind) {
|
|
165772
166077
|
case 3 /* MemberLike */:
|
|
165773
166078
|
return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
|
|
@@ -166297,7 +166602,7 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
166297
166602
|
if (completion === void 0) {
|
|
166298
166603
|
return void 0;
|
|
166299
166604
|
}
|
|
166300
|
-
const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken);
|
|
166605
|
+
const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken, position);
|
|
166301
166606
|
switch (completion.kind) {
|
|
166302
166607
|
case 0 /* Paths */:
|
|
166303
166608
|
return convertPathCompletions(completion.paths);
|
|
@@ -166351,7 +166656,7 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
166351
166656
|
kindModifiers: "" /* none */,
|
|
166352
166657
|
kind: "string" /* string */,
|
|
166353
166658
|
sortText: SortText.LocationPriority,
|
|
166354
|
-
replacementSpan: getReplacementSpanForContextToken(contextToken)
|
|
166659
|
+
replacementSpan: getReplacementSpanForContextToken(contextToken, position)
|
|
166355
166660
|
}));
|
|
166356
166661
|
return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan, entries };
|
|
166357
166662
|
}
|
|
@@ -166463,6 +166768,21 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
|
|
|
166463
166768
|
}
|
|
166464
166769
|
const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
|
|
166465
166770
|
return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
|
|
166771
|
+
case 276 /* ImportSpecifier */:
|
|
166772
|
+
case 281 /* ExportSpecifier */:
|
|
166773
|
+
const specifier = parent2;
|
|
166774
|
+
if (specifier.propertyName && node !== specifier.propertyName) {
|
|
166775
|
+
return;
|
|
166776
|
+
}
|
|
166777
|
+
const namedImportsOrExports = specifier.parent;
|
|
166778
|
+
const { moduleSpecifier } = namedImportsOrExports.kind === 275 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent;
|
|
166779
|
+
if (!moduleSpecifier) return;
|
|
166780
|
+
const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier);
|
|
166781
|
+
if (!moduleSpecifierSymbol) return;
|
|
166782
|
+
const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
|
|
166783
|
+
const existing = new Set(namedImportsOrExports.elements.map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
|
|
166784
|
+
const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
|
|
166785
|
+
return { kind: 1 /* Properties */, symbols: uniques, hasIndexSignature: false };
|
|
166466
166786
|
default:
|
|
166467
166787
|
return fromContextualType() || fromContextualType(0 /* None */);
|
|
166468
166788
|
}
|
|
@@ -167433,12 +167753,12 @@ function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, c
|
|
|
167433
167753
|
}
|
|
167434
167754
|
for (const element of namedBindings.elements) {
|
|
167435
167755
|
const { name, propertyName } = element;
|
|
167436
|
-
if (!isNameMatch((propertyName || name)
|
|
167756
|
+
if (!isNameMatch(moduleExportNameTextEscaped(propertyName || name))) {
|
|
167437
167757
|
continue;
|
|
167438
167758
|
}
|
|
167439
167759
|
if (propertyName) {
|
|
167440
167760
|
singleReferences.push(propertyName);
|
|
167441
|
-
if (!isForRename || name
|
|
167761
|
+
if (!isForRename || moduleExportNameTextEscaped(name) === exportSymbol.escapedName) {
|
|
167442
167762
|
addSearch(name, checker.getSymbolAtLocation(name));
|
|
167443
167763
|
}
|
|
167444
167764
|
} else {
|
|
@@ -168696,8 +169016,8 @@ var Core;
|
|
|
168696
169016
|
function shouldAddSingleReference(singleRef, state) {
|
|
168697
169017
|
if (!hasMatchingMeaning(singleRef, state)) return false;
|
|
168698
169018
|
if (state.options.use !== 2 /* Rename */) return true;
|
|
168699
|
-
if (!isIdentifier(singleRef)) return false;
|
|
168700
|
-
return !(isImportOrExportSpecifier(singleRef.parent) && singleRef
|
|
169019
|
+
if (!isIdentifier(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false;
|
|
169020
|
+
return !(isImportOrExportSpecifier(singleRef.parent) && moduleExportNameIsDefault(singleRef));
|
|
168701
169021
|
}
|
|
168702
169022
|
function searchForImportedSymbol(symbol, state) {
|
|
168703
169023
|
if (!symbol.declarations) return;
|
|
@@ -168859,7 +169179,7 @@ var Core;
|
|
|
168859
169179
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
168860
169180
|
case 11 /* StringLiteral */: {
|
|
168861
169181
|
const str = node;
|
|
168862
|
-
return (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node
|
|
169182
|
+
return str.text.length === searchSymbolName.length && (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node || isImportOrExportSpecifier(node.parent));
|
|
168863
169183
|
}
|
|
168864
169184
|
case 9 /* NumericLiteral */:
|
|
168865
169185
|
return isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
|
|
@@ -168925,7 +169245,7 @@ var Core;
|
|
|
168925
169245
|
return;
|
|
168926
169246
|
}
|
|
168927
169247
|
if (isExportSpecifier(parent2)) {
|
|
168928
|
-
Debug.assert(referenceLocation.kind === 80 /* Identifier */);
|
|
169248
|
+
Debug.assert(referenceLocation.kind === 80 /* Identifier */ || referenceLocation.kind === 11 /* StringLiteral */);
|
|
168929
169249
|
getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent2, search, state, addReferencesHere);
|
|
168930
169250
|
return;
|
|
168931
169251
|
}
|
|
@@ -168975,7 +169295,7 @@ var Core;
|
|
|
168975
169295
|
return;
|
|
168976
169296
|
}
|
|
168977
169297
|
if (!propertyName) {
|
|
168978
|
-
if (!(state.options.use === 2 /* Rename */ && name
|
|
169298
|
+
if (!(state.options.use === 2 /* Rename */ && moduleExportNameIsDefault(name))) {
|
|
168979
169299
|
addRef();
|
|
168980
169300
|
}
|
|
168981
169301
|
} else if (referenceLocation === propertyName) {
|
|
@@ -168991,7 +169311,7 @@ var Core;
|
|
|
168991
169311
|
}
|
|
168992
169312
|
}
|
|
168993
169313
|
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
|
|
168994
|
-
const isDefaultExport = referenceLocation
|
|
169314
|
+
const isDefaultExport = moduleExportNameIsDefault(referenceLocation) || moduleExportNameIsDefault(exportSpecifier.name);
|
|
168995
169315
|
const exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
|
|
168996
169316
|
const exportSymbol = Debug.checkDefined(exportSpecifier.symbol);
|
|
168997
169317
|
const exportInfo = getExportInfo(exportSymbol, exportKind, state.checker);
|
|
@@ -169948,7 +170268,7 @@ function getSymbol(node, checker, stopAtAlias) {
|
|
|
169948
170268
|
return { symbol, failedAliasResolution };
|
|
169949
170269
|
}
|
|
169950
170270
|
function shouldSkipAlias(node, declaration) {
|
|
169951
|
-
if (node.kind !== 80 /* Identifier */) {
|
|
170271
|
+
if (node.kind !== 80 /* Identifier */ && (node.kind !== 11 /* StringLiteral */ || !isImportOrExportSpecifier(node.parent))) {
|
|
169952
170272
|
return false;
|
|
169953
170273
|
}
|
|
169954
170274
|
if (node.parent === declaration) {
|
|
@@ -171961,7 +172281,7 @@ function hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier) {
|
|
|
171961
172281
|
return isString(moduleSpecifierText) && some(sourceFile.moduleAugmentations, (moduleName) => isStringLiteral(moduleName) && moduleName.text === moduleSpecifierText);
|
|
171962
172282
|
}
|
|
171963
172283
|
function getNewImportSpecifiers(namedImports) {
|
|
171964
|
-
return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && importSpecifier.name
|
|
172284
|
+
return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && moduleExportNameTextEscaped(importSpecifier.name) === moduleExportNameTextEscaped(importSpecifier.propertyName) ? factory.updateImportSpecifier(
|
|
171965
172285
|
importSpecifier,
|
|
171966
172286
|
importSpecifier.isTypeOnly,
|
|
171967
172287
|
/*propertyName*/
|
|
@@ -178462,7 +178782,7 @@ __export(ts_exports2, {
|
|
|
178462
178782
|
changeFullExtension: () => changeFullExtension,
|
|
178463
178783
|
changesAffectModuleResolution: () => changesAffectModuleResolution,
|
|
178464
178784
|
changesAffectingProgramStructure: () => changesAffectingProgramStructure,
|
|
178465
|
-
|
|
178785
|
+
characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
|
|
178466
178786
|
childIsDecorated: () => childIsDecorated,
|
|
178467
178787
|
classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
|
|
178468
178788
|
classHasClassThisAssignment: () => classHasClassThisAssignment,
|
|
@@ -178562,9 +178882,8 @@ __export(ts_exports2, {
|
|
|
178562
178882
|
createBaseNodeFactory: () => createBaseNodeFactory,
|
|
178563
178883
|
createBinaryExpressionTrampoline: () => createBinaryExpressionTrampoline,
|
|
178564
178884
|
createBindingHelper: () => createBindingHelper,
|
|
178565
|
-
createBuildInfo: () => createBuildInfo,
|
|
178566
178885
|
createBuilderProgram: () => createBuilderProgram,
|
|
178567
|
-
|
|
178886
|
+
createBuilderProgramUsingIncrementalBuildInfo: () => createBuilderProgramUsingIncrementalBuildInfo,
|
|
178568
178887
|
createBuilderStatusReporter: () => createBuilderStatusReporter,
|
|
178569
178888
|
createCacheWithRedirects: () => createCacheWithRedirects,
|
|
178570
178889
|
createCacheableExportInfoMap: () => createCacheableExportInfoMap,
|
|
@@ -179448,7 +179767,7 @@ __export(ts_exports2, {
|
|
|
179448
179767
|
isBreakStatement: () => isBreakStatement,
|
|
179449
179768
|
isBuild: () => isBuild,
|
|
179450
179769
|
isBuildInfoFile: () => isBuildInfoFile,
|
|
179451
|
-
isBuilderProgram: () =>
|
|
179770
|
+
isBuilderProgram: () => isBuilderProgram,
|
|
179452
179771
|
isBundle: () => isBundle,
|
|
179453
179772
|
isCallChain: () => isCallChain,
|
|
179454
179773
|
isCallExpression: () => isCallExpression,
|
|
@@ -179655,6 +179974,8 @@ __export(ts_exports2, {
|
|
|
179655
179974
|
isInTemplateString: () => isInTemplateString,
|
|
179656
179975
|
isInTopLevelContext: () => isInTopLevelContext,
|
|
179657
179976
|
isInTypeQuery: () => isInTypeQuery,
|
|
179977
|
+
isIncrementalBuildInfo: () => isIncrementalBuildInfo,
|
|
179978
|
+
isIncrementalBundleEmitBuildInfo: () => isIncrementalBundleEmitBuildInfo,
|
|
179658
179979
|
isIncrementalCompilation: () => isIncrementalCompilation,
|
|
179659
179980
|
isIndexSignatureDeclaration: () => isIndexSignatureDeclaration,
|
|
179660
179981
|
isIndexedAccessTypeNode: () => isIndexedAccessTypeNode,
|
|
@@ -179797,6 +180118,7 @@ __export(ts_exports2, {
|
|
|
179797
180118
|
isModuleBlock: () => isModuleBlock,
|
|
179798
180119
|
isModuleBody: () => isModuleBody,
|
|
179799
180120
|
isModuleDeclaration: () => isModuleDeclaration,
|
|
180121
|
+
isModuleExportName: () => isModuleExportName,
|
|
179800
180122
|
isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
|
|
179801
180123
|
isModuleIdentifier: () => isModuleIdentifier,
|
|
179802
180124
|
isModuleName: () => isModuleName,
|
|
@@ -179890,7 +180212,6 @@ __export(ts_exports2, {
|
|
|
179890
180212
|
isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
|
|
179891
180213
|
isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
|
|
179892
180214
|
isPrivateIdentifierSymbol: () => isPrivateIdentifierSymbol,
|
|
179893
|
-
isProgramBundleEmitBuildInfo: () => isProgramBundleEmitBuildInfo,
|
|
179894
180215
|
isProgramUptoDate: () => isProgramUptoDate,
|
|
179895
180216
|
isPrologueDirective: () => isPrologueDirective,
|
|
179896
180217
|
isPropertyAccessChain: () => isPropertyAccessChain,
|
|
@@ -180114,6 +180435,9 @@ __export(ts_exports2, {
|
|
|
180114
180435
|
missingFileModifiedTime: () => missingFileModifiedTime,
|
|
180115
180436
|
modifierToFlag: () => modifierToFlag,
|
|
180116
180437
|
modifiersToFlags: () => modifiersToFlags,
|
|
180438
|
+
moduleExportNameIsDefault: () => moduleExportNameIsDefault,
|
|
180439
|
+
moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
|
|
180440
|
+
moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
|
|
180117
180441
|
moduleOptionDeclaration: () => moduleOptionDeclaration,
|
|
180118
180442
|
moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
|
|
180119
180443
|
moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
|
|
@@ -180259,7 +180583,7 @@ __export(ts_exports2, {
|
|
|
180259
180583
|
reducePathComponents: () => reducePathComponents,
|
|
180260
180584
|
refactor: () => ts_refactor_exports,
|
|
180261
180585
|
regExpEscape: () => regExpEscape,
|
|
180262
|
-
|
|
180586
|
+
regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
|
|
180263
180587
|
relativeComplement: () => relativeComplement,
|
|
180264
180588
|
removeAllComments: () => removeAllComments,
|
|
180265
180589
|
removeEmitHelper: () => removeEmitHelper,
|
|
@@ -184681,23 +185005,8 @@ function findProjectByName(projectName, projects) {
|
|
|
184681
185005
|
}
|
|
184682
185006
|
var noopConfigFileWatcher = { close: noop };
|
|
184683
185007
|
function getConfigFileNameFromCache(info, cache) {
|
|
184684
|
-
if (!cache) return void 0;
|
|
184685
|
-
|
|
184686
|
-
if (configFileForOpenFile === void 0) return void 0;
|
|
184687
|
-
if (!isAncestorConfigFileInfo(info)) {
|
|
184688
|
-
return isString(configFileForOpenFile) || !configFileForOpenFile ? configFileForOpenFile : (
|
|
184689
|
-
// direct result
|
|
184690
|
-
configFileForOpenFile.get(
|
|
184691
|
-
/*key*/
|
|
184692
|
-
false
|
|
184693
|
-
)
|
|
184694
|
-
);
|
|
184695
|
-
} else {
|
|
184696
|
-
return configFileForOpenFile && !isString(configFileForOpenFile) ? (
|
|
184697
|
-
// Map with fileName as key
|
|
184698
|
-
configFileForOpenFile.get(info.fileName)
|
|
184699
|
-
) : void 0;
|
|
184700
|
-
}
|
|
185008
|
+
if (!cache || isAncestorConfigFileInfo(info)) return void 0;
|
|
185009
|
+
return cache.get(info.path);
|
|
184701
185010
|
}
|
|
184702
185011
|
function isOpenScriptInfo(infoOrFileNameOrConfig) {
|
|
184703
185012
|
return !!infoOrFileNameOrConfig.containingProjects;
|
|
@@ -184711,15 +185020,13 @@ var ConfiguredProjectLoadKind = /* @__PURE__ */ ((ConfiguredProjectLoadKind2) =>
|
|
|
184711
185020
|
ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 2] = "Reload";
|
|
184712
185021
|
return ConfiguredProjectLoadKind2;
|
|
184713
185022
|
})(ConfiguredProjectLoadKind || {});
|
|
184714
|
-
function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects,
|
|
185023
|
+
function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, delayReloadedConfiguredProjects) {
|
|
184715
185024
|
while (true) {
|
|
184716
|
-
if (!project.isInitialLoadPending() && (
|
|
184717
|
-
project.getCompilerOptions().disableSolutionSearching)) return;
|
|
185025
|
+
if (!project.isInitialLoadPending() && (!project.getCompilerOptions().composite || project.getCompilerOptions().disableSolutionSearching)) return;
|
|
184718
185026
|
const configFileName = project.projectService.getConfigFileNameForFile({
|
|
184719
185027
|
fileName: project.getConfigFilePath(),
|
|
184720
185028
|
path: info.path,
|
|
184721
|
-
configFileInfo: true
|
|
184722
|
-
isForDefaultProject: !searchOnlyPotentialSolution
|
|
185029
|
+
configFileInfo: true
|
|
184723
185030
|
}, kind === 0 /* Find */);
|
|
184724
185031
|
if (!configFileName) return;
|
|
184725
185032
|
const ancestor = project.projectService.findCreateOrReloadConfiguredProject(
|
|
@@ -184727,11 +185034,11 @@ function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredCl
|
|
|
184727
185034
|
kind,
|
|
184728
185035
|
reason,
|
|
184729
185036
|
allowDeferredClosed,
|
|
184730
|
-
|
|
184731
|
-
|
|
185037
|
+
/*triggerFile*/
|
|
185038
|
+
void 0,
|
|
184732
185039
|
reloadedProjects,
|
|
184733
|
-
|
|
184734
|
-
|
|
185040
|
+
/*delayLoad*/
|
|
185041
|
+
true,
|
|
184735
185042
|
delayReloadedConfiguredProjects
|
|
184736
185043
|
);
|
|
184737
185044
|
if (!ancestor) return;
|
|
@@ -185832,7 +186139,7 @@ var _ProjectService = class _ProjectService {
|
|
|
185832
186139
|
configFileExists(configFileName, canonicalConfigFilePath, info) {
|
|
185833
186140
|
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
185834
186141
|
let openFilesImpactedByConfigFile;
|
|
185835
|
-
if (this.openFiles.has(info.path) &&
|
|
186142
|
+
if (this.openFiles.has(info.path) && !isAncestorConfigFileInfo(info)) {
|
|
185836
186143
|
if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
|
|
185837
186144
|
else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
|
|
185838
186145
|
}
|
|
@@ -185960,31 +186267,24 @@ var _ProjectService = class _ProjectService {
|
|
|
185960
186267
|
let searchPath = asNormalizedPath(getDirectoryPath(info.fileName));
|
|
185961
186268
|
const isSearchPathInProjectRoot = () => containsPath(projectRootPath, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames);
|
|
185962
186269
|
const anySearchPathOk = !projectRootPath || !isSearchPathInProjectRoot();
|
|
185963
|
-
let
|
|
185964
|
-
let searchJsconfig = true;
|
|
185965
|
-
if (isAncestorConfigFileInfo(info)) {
|
|
185966
|
-
if (endsWith(info.fileName, "tsconfig.json")) searchTsconfig = false;
|
|
185967
|
-
else searchTsconfig = searchJsconfig = false;
|
|
185968
|
-
}
|
|
186270
|
+
let searchInDirectory = !isAncestorConfigFileInfo(info);
|
|
185969
186271
|
do {
|
|
185970
|
-
|
|
185971
|
-
|
|
186272
|
+
if (searchInDirectory) {
|
|
186273
|
+
const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
|
|
185972
186274
|
const tsconfigFileName = asNormalizedPath(combinePaths(searchPath, "tsconfig.json"));
|
|
185973
|
-
|
|
186275
|
+
let result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
|
|
185974
186276
|
if (result) return tsconfigFileName;
|
|
185975
|
-
}
|
|
185976
|
-
if (searchJsconfig) {
|
|
185977
186277
|
const jsconfigFileName = asNormalizedPath(combinePaths(searchPath, "jsconfig.json"));
|
|
185978
|
-
|
|
186278
|
+
result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
|
|
185979
186279
|
if (result) return jsconfigFileName;
|
|
185980
|
-
|
|
185981
|
-
|
|
185982
|
-
|
|
186280
|
+
if (isNodeModulesDirectory(canonicalSearchPath)) {
|
|
186281
|
+
break;
|
|
186282
|
+
}
|
|
185983
186283
|
}
|
|
185984
186284
|
const parentPath = asNormalizedPath(getDirectoryPath(searchPath));
|
|
185985
186285
|
if (parentPath === searchPath) break;
|
|
185986
186286
|
searchPath = parentPath;
|
|
185987
|
-
|
|
186287
|
+
searchInDirectory = true;
|
|
185988
186288
|
} while (anySearchPathOk || isSearchPathInProjectRoot());
|
|
185989
186289
|
return void 0;
|
|
185990
186290
|
}
|
|
@@ -186007,19 +186307,8 @@ var _ProjectService = class _ProjectService {
|
|
|
186007
186307
|
/** Caches the configFilename for script info or ancestor of open script info */
|
|
186008
186308
|
setConfigFileNameForFileInCache(info, configFileName) {
|
|
186009
186309
|
if (!this.openFiles.has(info.path)) return;
|
|
186010
|
-
|
|
186011
|
-
|
|
186012
|
-
this.configFileForOpenFiles.set(info.path, config);
|
|
186013
|
-
} else {
|
|
186014
|
-
let configFileForOpenFile = this.configFileForOpenFiles.get(info.path);
|
|
186015
|
-
if (!configFileForOpenFile || isString(configFileForOpenFile)) {
|
|
186016
|
-
this.configFileForOpenFiles.set(
|
|
186017
|
-
info.path,
|
|
186018
|
-
configFileForOpenFile = (/* @__PURE__ */ new Map()).set(false, configFileForOpenFile)
|
|
186019
|
-
);
|
|
186020
|
-
}
|
|
186021
|
-
configFileForOpenFile.set(info.fileName, config);
|
|
186022
|
-
}
|
|
186310
|
+
if (isAncestorConfigFileInfo(info)) return;
|
|
186311
|
+
this.configFileForOpenFiles.set(info.path, configFileName || false);
|
|
186023
186312
|
}
|
|
186024
186313
|
/**
|
|
186025
186314
|
* This function tries to search for a tsconfig.json for the given file.
|
|
@@ -187396,7 +187685,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
187396
187685
|
seenProjects
|
|
187397
187686
|
};
|
|
187398
187687
|
function tryFindDefaultConfiguredProject(project) {
|
|
187399
|
-
return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project)
|
|
187688
|
+
return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project);
|
|
187400
187689
|
}
|
|
187401
187690
|
function isDefaultProject(project) {
|
|
187402
187691
|
if (!tryAddToSet(seenProjects, project)) return;
|
|
@@ -187419,20 +187708,6 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
187419
187708
|
reloadedProjects
|
|
187420
187709
|
);
|
|
187421
187710
|
}
|
|
187422
|
-
function tryFindDefaultConfiguredProjectFromAncestor(project) {
|
|
187423
|
-
return forEachAncestorProject(
|
|
187424
|
-
// If not in referenced projects, try ancestors and its references
|
|
187425
|
-
info,
|
|
187426
|
-
project,
|
|
187427
|
-
tryFindDefaultConfiguredProject,
|
|
187428
|
-
kind,
|
|
187429
|
-
`Creating possible configured project for ${info.fileName} to open`,
|
|
187430
|
-
allowDeferredClosed,
|
|
187431
|
-
reloadedProjects,
|
|
187432
|
-
/*searchOnlyPotentialSolution*/
|
|
187433
|
-
false
|
|
187434
|
-
);
|
|
187435
|
-
}
|
|
187436
187711
|
}
|
|
187437
187712
|
tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(info, kind, reloadedProjects, delayReloadedConfiguredProjects) {
|
|
187438
187713
|
const allowDeferredClosed = kind === 0 /* Find */;
|
|
@@ -187455,8 +187730,6 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
187455
187730
|
`Creating project possibly referencing default composite project ${defaultProject.getProjectName()} of open file ${info.fileName}`,
|
|
187456
187731
|
allowDeferredClosed,
|
|
187457
187732
|
reloadedProjects,
|
|
187458
|
-
/*searchOnlyPotentialSolution*/
|
|
187459
|
-
true,
|
|
187460
187733
|
delayReloadedConfiguredProjects
|
|
187461
187734
|
);
|
|
187462
187735
|
}
|
|
@@ -192945,7 +193218,7 @@ if (typeof console !== "undefined") {
|
|
|
192945
193218
|
changeFullExtension,
|
|
192946
193219
|
changesAffectModuleResolution,
|
|
192947
193220
|
changesAffectingProgramStructure,
|
|
192948
|
-
|
|
193221
|
+
characterCodeToRegularExpressionFlag,
|
|
192949
193222
|
childIsDecorated,
|
|
192950
193223
|
classElementOrClassElementParameterIsDecorated,
|
|
192951
193224
|
classHasClassThisAssignment,
|
|
@@ -193045,9 +193318,8 @@ if (typeof console !== "undefined") {
|
|
|
193045
193318
|
createBaseNodeFactory,
|
|
193046
193319
|
createBinaryExpressionTrampoline,
|
|
193047
193320
|
createBindingHelper,
|
|
193048
|
-
createBuildInfo,
|
|
193049
193321
|
createBuilderProgram,
|
|
193050
|
-
|
|
193322
|
+
createBuilderProgramUsingIncrementalBuildInfo,
|
|
193051
193323
|
createBuilderStatusReporter,
|
|
193052
193324
|
createCacheWithRedirects,
|
|
193053
193325
|
createCacheableExportInfoMap,
|
|
@@ -194138,6 +194410,8 @@ if (typeof console !== "undefined") {
|
|
|
194138
194410
|
isInTemplateString,
|
|
194139
194411
|
isInTopLevelContext,
|
|
194140
194412
|
isInTypeQuery,
|
|
194413
|
+
isIncrementalBuildInfo,
|
|
194414
|
+
isIncrementalBundleEmitBuildInfo,
|
|
194141
194415
|
isIncrementalCompilation,
|
|
194142
194416
|
isIndexSignatureDeclaration,
|
|
194143
194417
|
isIndexedAccessTypeNode,
|
|
@@ -194280,6 +194554,7 @@ if (typeof console !== "undefined") {
|
|
|
194280
194554
|
isModuleBlock,
|
|
194281
194555
|
isModuleBody,
|
|
194282
194556
|
isModuleDeclaration,
|
|
194557
|
+
isModuleExportName,
|
|
194283
194558
|
isModuleExportsAccessExpression,
|
|
194284
194559
|
isModuleIdentifier,
|
|
194285
194560
|
isModuleName,
|
|
@@ -194373,7 +194648,6 @@ if (typeof console !== "undefined") {
|
|
|
194373
194648
|
isPrivateIdentifierClassElementDeclaration,
|
|
194374
194649
|
isPrivateIdentifierPropertyAccessExpression,
|
|
194375
194650
|
isPrivateIdentifierSymbol,
|
|
194376
|
-
isProgramBundleEmitBuildInfo,
|
|
194377
194651
|
isProgramUptoDate,
|
|
194378
194652
|
isPrologueDirective,
|
|
194379
194653
|
isPropertyAccessChain,
|
|
@@ -194597,6 +194871,9 @@ if (typeof console !== "undefined") {
|
|
|
194597
194871
|
missingFileModifiedTime,
|
|
194598
194872
|
modifierToFlag,
|
|
194599
194873
|
modifiersToFlags,
|
|
194874
|
+
moduleExportNameIsDefault,
|
|
194875
|
+
moduleExportNameTextEscaped,
|
|
194876
|
+
moduleExportNameTextUnescaped,
|
|
194600
194877
|
moduleOptionDeclaration,
|
|
194601
194878
|
moduleResolutionIsEqualTo,
|
|
194602
194879
|
moduleResolutionNameAndModeGetter,
|
|
@@ -194742,7 +195019,7 @@ if (typeof console !== "undefined") {
|
|
|
194742
195019
|
reducePathComponents,
|
|
194743
195020
|
refactor,
|
|
194744
195021
|
regExpEscape,
|
|
194745
|
-
|
|
195022
|
+
regularExpressionFlagToCharacterCode,
|
|
194746
195023
|
relativeComplement,
|
|
194747
195024
|
removeAllComments,
|
|
194748
195025
|
removeEmitHelper,
|