typescript 5.5.0-dev.20240603 → 5.6.0-dev.20240605

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/typescript.js CHANGED
@@ -277,7 +277,7 @@ __export(typescript_exports, {
277
277
  changeFullExtension: () => changeFullExtension,
278
278
  changesAffectModuleResolution: () => changesAffectModuleResolution,
279
279
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
280
- characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
280
+ characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
281
281
  childIsDecorated: () => childIsDecorated,
282
282
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
283
283
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -1612,6 +1612,7 @@ __export(typescript_exports, {
1612
1612
  isModuleBlock: () => isModuleBlock,
1613
1613
  isModuleBody: () => isModuleBody,
1614
1614
  isModuleDeclaration: () => isModuleDeclaration,
1615
+ isModuleExportName: () => isModuleExportName,
1615
1616
  isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
1616
1617
  isModuleIdentifier: () => isModuleIdentifier,
1617
1618
  isModuleName: () => isModuleName,
@@ -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
- regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
2081
+ regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
2078
2082
  relativeComplement: () => relativeComplement,
2079
2083
  removeAllComments: () => removeAllComments,
2080
2084
  removeEmitHelper: () => removeEmitHelper,
@@ -2370,8 +2374,8 @@ __export(typescript_exports, {
2370
2374
  module.exports = __toCommonJS(typescript_exports);
2371
2375
 
2372
2376
  // src/compiler/corePublic.ts
2373
- var versionMajorMinor = "5.5";
2374
- var version = `${versionMajorMinor}.0-dev.20240603`;
2377
+ var versionMajorMinor = "5.6";
2378
+ var version = `${versionMajorMinor}.0-dev.20240605`;
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 charToRegExpFlag = new Map(Object.entries({
11620
- d: 1 /* HasIndices */,
11621
- g: 2 /* Global */,
11622
- i: 4 /* IgnoreCase */,
11623
- m: 8 /* Multiline */,
11624
- s: 16 /* DotAll */,
11625
- u: 32 /* Unicode */,
11626
- v: 64 /* UnicodeSets */,
11627
- y: 128 /* Sticky */
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 regExpFlagChars = makeReverseMap(charToRegExpFlag);
11685
- function regularExpressionFlagToCharacter(f) {
11686
- return regExpFlagChars[f];
11689
+ var regExpFlagCharCodes = makeReverseMap(charCodeToRegExpFlag);
11690
+ function regularExpressionFlagToCharacterCode(f) {
11691
+ return regExpFlagCharCodes[f];
11687
11692
  }
11688
- function characterToRegularExpressionFlag(c) {
11689
- return charToRegExpFlag.get(c);
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 = charCodeChecked(pos);
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 = characterToRegularExpressionFlag(String.fromCharCode(ch));
13416
+ const flag = characterCodeToRegularExpressionFlag(ch);
13411
13417
  if (flag === void 0) {
13412
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13418
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
13413
13419
  } else if (regExpFlags & flag) {
13414
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
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, 1);
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
- checkRegularExpressionFlagAvailable(flag, pos);
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 = charCodeChecked(pos);
13643
+ const ch = codePointChecked(pos);
13638
13644
  if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
13639
13645
  break;
13640
13646
  }
13641
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13647
+ const size = charSize(ch);
13648
+ const flag = characterCodeToRegularExpressionFlag(ch);
13642
13649
  if (flag === void 0) {
13643
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13650
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
13644
13651
  } else if (currFlags & flag) {
13645
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
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, 1);
13654
+ error2(Diagnostics.This_regular_expression_flag_cannot_be_toggled_within_a_subpattern, pos, size);
13648
13655
  } else {
13649
13656
  currFlags |= flag;
13650
- checkRegularExpressionFlagAvailable(flag, pos);
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 checkRegularExpressionFlagAvailable(flag, pos2) {
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, pos2, 1, getNameOfScriptTarget(availableFrom));
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.escapedText === "default");
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 (tokenIsIdentifierOrKeyword(token())) {
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 (tokenIsIdentifierOrKeyword(token())) {
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 (tokenIsIdentifierOrKeyword(token())) {
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 */ && checkIdentifierIsKeyword) {
38004
- parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected);
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()), pos);
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.escapedText === "default";
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
  }
@@ -51903,7 +51968,7 @@ function createTypeChecker(host) {
51903
51968
  const isExport = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */;
51904
51969
  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
51970
  const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
51906
- const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
51971
+ const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : moduleExportNameTextUnescaped(typeOnlyDeclaration.name);
51907
51972
  addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
51908
51973
  }
51909
51974
  }
@@ -52147,12 +52212,12 @@ function createTypeChecker(host) {
52147
52212
  if (valueSymbol.exports) result.exports = new Map(valueSymbol.exports);
52148
52213
  return result;
52149
52214
  }
52150
- function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
52215
+ function getExportOfModule(symbol, nameText, specifier, dontResolveAlias) {
52151
52216
  var _a;
52152
52217
  if (symbol.flags & 1536 /* Module */) {
52153
- const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
52218
+ const exportSymbol = getExportsOfSymbol(symbol).get(nameText);
52154
52219
  const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
52155
- const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(name.escapedText);
52220
+ const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(nameText);
52156
52221
  markSymbolOfAliasDeclarationIfTypeOnly(
52157
52222
  specifier,
52158
52223
  exportSymbol,
@@ -52160,7 +52225,7 @@ function createTypeChecker(host) {
52160
52225
  /*overwriteEmpty*/
52161
52226
  false,
52162
52227
  exportStarDeclaration,
52163
- name.escapedText
52228
+ nameText
52164
52229
  );
52165
52230
  return resolved;
52166
52231
  }
@@ -52178,10 +52243,11 @@ function createTypeChecker(host) {
52178
52243
  const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
52179
52244
  const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
52180
52245
  const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
52181
- if (!isIdentifier(name)) {
52246
+ if (!isIdentifier(name) && name.kind !== 11 /* StringLiteral */) {
52182
52247
  return void 0;
52183
52248
  }
52184
- const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
52249
+ const nameText = moduleExportNameTextEscaped(name);
52250
+ const suppressInteropError = nameText === "default" /* Default */ && allowSyntheticDefaultImports;
52185
52251
  const targetSymbol = resolveESModuleSymbol(
52186
52252
  moduleSymbol,
52187
52253
  moduleSpecifier,
@@ -52190,7 +52256,7 @@ function createTypeChecker(host) {
52190
52256
  suppressInteropError
52191
52257
  );
52192
52258
  if (targetSymbol) {
52193
- if (name.escapedText) {
52259
+ if (nameText || name.kind === 11 /* StringLiteral */) {
52194
52260
  if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
52195
52261
  return moduleSymbol;
52196
52262
  }
@@ -52198,16 +52264,16 @@ function createTypeChecker(host) {
52198
52264
  if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=" /* ExportEquals */)) {
52199
52265
  symbolFromVariable = getPropertyOfType(
52200
52266
  getTypeOfSymbol(targetSymbol),
52201
- name.escapedText,
52267
+ nameText,
52202
52268
  /*skipObjectFunctionPropertyAugment*/
52203
52269
  true
52204
52270
  );
52205
52271
  } else {
52206
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText);
52272
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, nameText);
52207
52273
  }
52208
52274
  symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
52209
- let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
52210
- if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
52275
+ let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
52276
+ if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
52211
52277
  const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
52212
52278
  if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52213
52279
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -52225,7 +52291,7 @@ function createTypeChecker(host) {
52225
52291
  var _a;
52226
52292
  const moduleName = getFullyQualifiedName(moduleSymbol, node);
52227
52293
  const declarationName = declarationNameToString(name);
52228
- const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
52294
+ const suggestion = isIdentifier(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0;
52229
52295
  if (suggestion !== void 0) {
52230
52296
  const suggestionName = symbolToString(suggestion);
52231
52297
  const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
@@ -52247,7 +52313,7 @@ function createTypeChecker(host) {
52247
52313
  }
52248
52314
  function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
52249
52315
  var _a, _b;
52250
- const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name.escapedText);
52316
+ const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(moduleExportNameTextEscaped(name));
52251
52317
  const exports2 = moduleSymbol.exports;
52252
52318
  if (localSymbol) {
52253
52319
  const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
@@ -52279,7 +52345,7 @@ function createTypeChecker(host) {
52279
52345
  }
52280
52346
  }
52281
52347
  function getTargetOfImportSpecifier(node, dontResolveAlias) {
52282
- if (isImportSpecifier(node) && idText(node.propertyName || node.name) === "default" /* Default */) {
52348
+ if (isImportSpecifier(node) && moduleExportNameIsDefault(node.propertyName || node.name)) {
52283
52349
  const specifier = getModuleSpecifierForImportOrExport(node);
52284
52350
  const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
52285
52351
  if (moduleSymbol) {
@@ -52323,19 +52389,23 @@ function createTypeChecker(host) {
52323
52389
  }
52324
52390
  }
52325
52391
  function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
52326
- if (idText(node.propertyName || node.name) === "default" /* Default */) {
52392
+ const name = node.propertyName || node.name;
52393
+ if (moduleExportNameIsDefault(name)) {
52327
52394
  const specifier = getModuleSpecifierForImportOrExport(node);
52328
52395
  const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
52329
52396
  if (moduleSymbol) {
52330
52397
  return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
52331
52398
  }
52332
52399
  }
52333
- const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : resolveEntityName(
52334
- node.propertyName || node.name,
52335
- meaning,
52336
- /*ignoreErrors*/
52337
- false,
52338
- dontResolveAlias
52400
+ const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : name.kind === 11 /* StringLiteral */ ? void 0 : (
52401
+ // Skip for invalid syntax like this: export { "x" }
52402
+ resolveEntityName(
52403
+ name,
52404
+ meaning,
52405
+ /*ignoreErrors*/
52406
+ false,
52407
+ dontResolveAlias
52408
+ )
52339
52409
  );
52340
52410
  markSymbolOfAliasDeclarationIfTypeOnly(
52341
52411
  node,
@@ -56313,10 +56383,11 @@ function createTypeChecker(host) {
56313
56383
  return result ? setTextRange2(context, result, node) : void 0;
56314
56384
  }
56315
56385
  function createRecoveryBoundary() {
56386
+ let trackedSymbols;
56316
56387
  let unreportedErrors;
56317
56388
  const oldTracker = context.tracker;
56318
56389
  const oldTrackedSymbols = context.trackedSymbols;
56319
- context.trackedSymbols = [];
56390
+ context.trackedSymbols = void 0;
56320
56391
  const oldEncounteredError = context.encounteredError;
56321
56392
  context.tracker = new SymbolTrackerImpl(context, {
56322
56393
  ...oldTracker.inner,
@@ -56336,17 +56407,7 @@ function createTypeChecker(host) {
56336
56407
  markError(() => oldTracker.reportNonSerializableProperty(name));
56337
56408
  },
56338
56409
  trackSymbol(sym, decl, meaning) {
56339
- const accessibility = isSymbolAccessible(
56340
- sym,
56341
- decl,
56342
- meaning,
56343
- /*shouldComputeAliasesToMakeVisible*/
56344
- false
56345
- );
56346
- if (accessibility.accessibility !== 0 /* Accessible */) {
56347
- (context.trackedSymbols ?? (context.trackedSymbols = [])).push([sym, decl, meaning]);
56348
- return true;
56349
- }
56410
+ (trackedSymbols ?? (trackedSymbols = [])).push([sym, decl, meaning]);
56350
56411
  return false;
56351
56412
  },
56352
56413
  moduleResolverHost: context.tracker.moduleResolverHost
@@ -56360,13 +56421,12 @@ function createTypeChecker(host) {
56360
56421
  (unreportedErrors ?? (unreportedErrors = [])).push(unreportedError);
56361
56422
  }
56362
56423
  function startRecoveryScope2() {
56363
- var _a;
56364
- const initialTrackedSymbolsTop = ((_a = context.trackedSymbols) == null ? void 0 : _a.length) ?? 0;
56424
+ const trackedSymbolsTop = (trackedSymbols == null ? void 0 : trackedSymbols.length) ?? 0;
56365
56425
  const unreportedErrorsTop = (unreportedErrors == null ? void 0 : unreportedErrors.length) ?? 0;
56366
56426
  return () => {
56367
56427
  hadError = false;
56368
- if (context.trackedSymbols) {
56369
- context.trackedSymbols.length = initialTrackedSymbolsTop;
56428
+ if (trackedSymbols) {
56429
+ trackedSymbols.length = trackedSymbolsTop;
56370
56430
  }
56371
56431
  if (unreportedErrors) {
56372
56432
  unreportedErrors.length = unreportedErrorsTop;
@@ -56375,14 +56435,13 @@ function createTypeChecker(host) {
56375
56435
  }
56376
56436
  function finalizeBoundary2() {
56377
56437
  context.tracker = oldTracker;
56378
- const newTrackedSymbols = context.trackedSymbols;
56379
56438
  context.trackedSymbols = oldTrackedSymbols;
56380
56439
  context.encounteredError = oldEncounteredError;
56381
56440
  unreportedErrors == null ? void 0 : unreportedErrors.forEach((fn) => fn());
56382
56441
  if (hadError) {
56383
56442
  return false;
56384
56443
  }
56385
- newTrackedSymbols == null ? void 0 : newTrackedSymbols.forEach(
56444
+ trackedSymbols == null ? void 0 : trackedSymbols.forEach(
56386
56445
  ([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
56387
56446
  symbol,
56388
56447
  enclosingDeclaration,
@@ -56395,6 +56454,57 @@ function createTypeChecker(host) {
56395
56454
  function onEnterNewScope(node) {
56396
56455
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
56397
56456
  }
56457
+ function tryVisitSimpleTypeNode(node) {
56458
+ const innerNode = skipTypeParentheses(node);
56459
+ switch (innerNode.kind) {
56460
+ case 183 /* TypeReference */:
56461
+ return tryVisitTypeReference(innerNode);
56462
+ case 186 /* TypeQuery */:
56463
+ return tryVisitTypeQuery(innerNode);
56464
+ case 199 /* IndexedAccessType */:
56465
+ return tryVisitIndexedAccess(innerNode);
56466
+ case 198 /* TypeOperator */:
56467
+ const typeOperatorNode = innerNode;
56468
+ if (typeOperatorNode.operator === 143 /* KeyOfKeyword */) {
56469
+ return tryVisitKeyOf(typeOperatorNode);
56470
+ }
56471
+ }
56472
+ return visitNode(node, visitExistingNodeTreeSymbols, isTypeNode);
56473
+ }
56474
+ function tryVisitIndexedAccess(node) {
56475
+ const resultObjectType = tryVisitSimpleTypeNode(node.objectType);
56476
+ if (resultObjectType === void 0) {
56477
+ return void 0;
56478
+ }
56479
+ return factory.updateIndexedAccessTypeNode(node, resultObjectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
56480
+ }
56481
+ function tryVisitKeyOf(node) {
56482
+ Debug.assertEqual(node.operator, 143 /* KeyOfKeyword */);
56483
+ const type = tryVisitSimpleTypeNode(node.type);
56484
+ if (type === void 0) {
56485
+ return void 0;
56486
+ }
56487
+ return factory.updateTypeOperatorNode(node, type);
56488
+ }
56489
+ function tryVisitTypeQuery(node) {
56490
+ const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
56491
+ if (!introducesError) {
56492
+ return factory.updateTypeQueryNode(
56493
+ node,
56494
+ exprName,
56495
+ visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
56496
+ );
56497
+ }
56498
+ const serializedName = serializeTypeName(
56499
+ context,
56500
+ node.exprName,
56501
+ /*isTypeOf*/
56502
+ true
56503
+ );
56504
+ if (serializedName) {
56505
+ return setTextRange2(context, serializedName, node.exprName);
56506
+ }
56507
+ }
56398
56508
  function tryVisitTypeReference(node) {
56399
56509
  if (canReuseTypeNode(context, node)) {
56400
56510
  const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
@@ -56528,13 +56638,13 @@ function createTypeChecker(host) {
56528
56638
  visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
56529
56639
  );
56530
56640
  }
56531
- if (isIndexedAccessTypeNode(node) && isTypeReferenceNode(node.objectType)) {
56532
- const objectType = tryVisitTypeReference(node.objectType);
56533
- if (!objectType) {
56641
+ if (isIndexedAccessTypeNode(node)) {
56642
+ const result = tryVisitIndexedAccess(node);
56643
+ if (!result) {
56534
56644
  hadError = true;
56535
56645
  return node;
56536
56646
  }
56537
- return factory.updateIndexedAccessTypeNode(node, objectType, visitNode(node.indexType, visitExistingNodeTreeSymbols, isTypeNode));
56647
+ return result;
56538
56648
  }
56539
56649
  if (isTypeReferenceNode(node)) {
56540
56650
  const result = tryVisitTypeReference(node);
@@ -56577,25 +56687,12 @@ function createTypeChecker(host) {
56577
56687
  return visited;
56578
56688
  }
56579
56689
  if (isTypeQueryNode(node)) {
56580
- const { introducesError, node: exprName } = trackExistingEntityName(node.exprName, context);
56581
- if (introducesError) {
56582
- const serializedName = serializeTypeName(
56583
- context,
56584
- node.exprName,
56585
- /*isTypeOf*/
56586
- true
56587
- );
56588
- if (serializedName) {
56589
- return setTextRange2(context, serializedName, node.exprName);
56590
- }
56690
+ const result = tryVisitTypeQuery(node);
56691
+ if (!result) {
56591
56692
  hadError = true;
56592
56693
  return node;
56593
56694
  }
56594
- return factory.updateTypeQueryNode(
56595
- node,
56596
- exprName,
56597
- visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode)
56598
- );
56695
+ return result;
56599
56696
  }
56600
56697
  if (isComputedPropertyName(node) && isEntityNameExpression(node.expression)) {
56601
56698
  const { node: result, introducesError } = trackExistingEntityName(node.expression, context);
@@ -56660,14 +56757,12 @@ function createTypeChecker(host) {
56660
56757
  return node;
56661
56758
  }
56662
56759
  } else if (node.operator === 143 /* KeyOfKeyword */) {
56663
- if (isTypeReferenceNode(node.type)) {
56664
- const type = tryVisitTypeReference(node.type);
56665
- if (!type) {
56666
- hadError = true;
56667
- return node;
56668
- }
56669
- return factory.updateTypeOperatorNode(node, type);
56760
+ const result = tryVisitKeyOf(node);
56761
+ if (!result) {
56762
+ hadError = true;
56763
+ return node;
56670
56764
  }
56765
+ return result;
56671
56766
  }
56672
56767
  }
56673
56768
  return visitEachChild2(node, visitExistingNodeTreeSymbols);
@@ -56907,9 +57002,10 @@ function createTypeChecker(host) {
56907
57002
  if (index >= 0) {
56908
57003
  const exportDecl = statements[index];
56909
57004
  const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
56910
- if (!e.propertyName) {
57005
+ if (!e.propertyName && e.name.kind !== 11 /* StringLiteral */) {
57006
+ const name = e.name;
56911
57007
  const indices = indicesOf(statements);
56912
- const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], e.name));
57008
+ const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], name));
56913
57009
  if (length(associatedIndices) && every(associatedIndices, (i) => canHaveExportModifier(statements[i]))) {
56914
57010
  for (const index2 of associatedIndices) {
56915
57011
  statements[index2] = addExportModifier(statements[index2]);
@@ -57543,7 +57639,7 @@ function createTypeChecker(host) {
57543
57639
  function getSomeTargetNameFromDeclarations(declarations) {
57544
57640
  return firstDefined(declarations, (d) => {
57545
57641
  if (isImportSpecifier(d) || isExportSpecifier(d)) {
57546
- return idText(d.propertyName || d.name);
57642
+ return moduleExportNameTextUnescaped(d.propertyName || d.name);
57547
57643
  }
57548
57644
  if (isBinaryExpression(d) || isExportAssignment(d)) {
57549
57645
  const expression = isExportAssignment(d) ? d.expression : d.right;
@@ -57561,7 +57657,7 @@ function createTypeChecker(host) {
57561
57657
  });
57562
57658
  }
57563
57659
  function serializeAsAlias(symbol, localName, modifierFlags) {
57564
- var _a2, _b, _c, _d, _e, _f;
57660
+ var _a2, _b, _c, _d, _e;
57565
57661
  const node = getDeclarationOfAliasSymbol(symbol);
57566
57662
  if (!node) return Debug.fail();
57567
57663
  const target = getMergedSymbol(getTargetOfAliasDeclaration(
@@ -57759,8 +57855,11 @@ function createTypeChecker(host) {
57759
57855
  }
57760
57856
  case 281 /* ExportSpecifier */:
57761
57857
  const specifier = node.parent.parent.moduleSpecifier;
57762
- if (specifier && ((_f = node.propertyName) == null ? void 0 : _f.escapedText) === "default" /* Default */) {
57763
- verbatimTargetName = "default" /* Default */;
57858
+ if (specifier) {
57859
+ const propertyName = node.propertyName;
57860
+ if (propertyName && moduleExportNameIsDefault(propertyName)) {
57861
+ verbatimTargetName = "default" /* Default */;
57862
+ }
57764
57863
  }
57765
57864
  serializeExportSpecifier(
57766
57865
  unescapeLeadingUnderscores(symbol.escapedName),
@@ -58473,7 +58572,7 @@ function createTypeChecker(host) {
58473
58572
  }
58474
58573
  function collectLinkedAliases(node, setVisibility) {
58475
58574
  let exportSymbol;
58476
- if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
58575
+ if (node.kind !== 11 /* StringLiteral */ && node.parent && node.parent.kind === 277 /* ExportAssignment */) {
58477
58576
  exportSymbol = resolveName(
58478
58577
  node,
58479
58578
  node,
@@ -74046,9 +74145,10 @@ function createTypeChecker(host) {
74046
74145
  return;
74047
74146
  case 281 /* ExportSpecifier */:
74048
74147
  const exportDeclaration = node.parent.parent;
74049
- if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
74148
+ const name = node.propertyName || node.name;
74149
+ if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier && name.kind !== 11 /* StringLiteral */) {
74050
74150
  const symbol = resolveEntityName(
74051
- node.propertyName || node.name,
74151
+ name,
74052
74152
  111551 /* Value */,
74053
74153
  /*ignoreErrors*/
74054
74154
  true,
@@ -74342,6 +74442,9 @@ function createTypeChecker(host) {
74342
74442
  function markExportSpecifierAliasReferenced(location) {
74343
74443
  if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
74344
74444
  const exportedName = location.propertyName || location.name;
74445
+ if (exportedName.kind === 11 /* StringLiteral */) {
74446
+ return;
74447
+ }
74345
74448
  const symbol = resolveName(
74346
74449
  exportedName,
74347
74450
  exportedName.escapedText,
@@ -74356,7 +74459,7 @@ function createTypeChecker(host) {
74356
74459
  const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
74357
74460
  if (!target || getSymbolFlags(target) & 111551 /* Value */) {
74358
74461
  markExportAsReferenced(location);
74359
- markIdentifierAliasReferenced(location.propertyName || location.name);
74462
+ markIdentifierAliasReferenced(exportedName);
74360
74463
  }
74361
74464
  }
74362
74465
  return;
@@ -87952,6 +88055,16 @@ function createTypeChecker(host) {
87952
88055
  }
87953
88056
  return true;
87954
88057
  }
88058
+ function checkModuleExportName(name, allowStringLiteral = true) {
88059
+ if (name === void 0 || name.kind !== 11 /* StringLiteral */) {
88060
+ return;
88061
+ }
88062
+ if (!allowStringLiteral) {
88063
+ grammarErrorOnNode(name, Diagnostics.Identifier_expected);
88064
+ } else if (moduleKind === 5 /* ES2015 */ || moduleKind === 6 /* ES2020 */) {
88065
+ grammarErrorOnNode(name, Diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020);
88066
+ }
88067
+ }
87955
88068
  function checkAliasSymbol(node) {
87956
88069
  var _a, _b, _c, _d;
87957
88070
  let symbol = getSymbolOfDeclaration(node);
@@ -87963,7 +88076,7 @@ function createTypeChecker(host) {
87963
88076
  Debug.assert(node.kind !== 280 /* NamespaceExport */);
87964
88077
  if (node.kind === 281 /* ExportSpecifier */) {
87965
88078
  const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
87966
- const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
88079
+ const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get(moduleExportNameTextEscaped(node.propertyName || node.name));
87967
88080
  if (alreadyExportedSymbol === target) {
87968
88081
  const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
87969
88082
  if (exportingDeclaration) {
@@ -88018,7 +88131,7 @@ function createTypeChecker(host) {
88018
88131
  if (compilerOptions.verbatimModuleSyntax) {
88019
88132
  Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name");
88020
88133
  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;
88021
- const name = idText(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
88134
+ const name = moduleExportNameTextUnescaped(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
88022
88135
  addTypeOnlyDeclarationRelatedInfo(
88023
88136
  error2(node, message, name),
88024
88137
  isType ? void 0 : typeOnlyAlias,
@@ -88032,7 +88145,7 @@ function createTypeChecker(host) {
88032
88145
  }
88033
88146
  case 281 /* ExportSpecifier */: {
88034
88147
  if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
88035
- const name = idText(node.propertyName || node.name);
88148
+ const name = moduleExportNameTextUnescaped(node.propertyName || node.name);
88036
88149
  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);
88037
88150
  addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
88038
88151
  break;
@@ -88082,8 +88195,11 @@ function createTypeChecker(host) {
88082
88195
  function checkImportBinding(node) {
88083
88196
  checkCollisionsForDeclarationName(node, node.name);
88084
88197
  checkAliasSymbol(node);
88085
- if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88086
- checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88198
+ if (node.kind === 276 /* ImportSpecifier */) {
88199
+ checkModuleExportName(node.propertyName);
88200
+ if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88201
+ checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88202
+ }
88087
88203
  }
88088
88204
  }
88089
88205
  function checkImportAttributes(declaration) {
@@ -88204,6 +88320,7 @@ function createTypeChecker(host) {
88204
88320
  error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
88205
88321
  } else if (node.exportClause) {
88206
88322
  checkAliasSymbol(node.exportClause);
88323
+ checkModuleExportName(node.exportClause.name);
88207
88324
  }
88208
88325
  if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88209
88326
  if (node.exportClause) {
@@ -88234,6 +88351,9 @@ function createTypeChecker(host) {
88234
88351
  }
88235
88352
  function checkExportSpecifier(node) {
88236
88353
  checkAliasSymbol(node);
88354
+ const hasModuleSpecifier = node.parent.parent.moduleSpecifier !== void 0;
88355
+ checkModuleExportName(node.propertyName, hasModuleSpecifier);
88356
+ checkModuleExportName(node.name);
88237
88357
  if (getEmitDeclarations(compilerOptions)) {
88238
88358
  collectLinkedAliases(
88239
88359
  node.propertyName || node.name,
@@ -88241,8 +88361,11 @@ function createTypeChecker(host) {
88241
88361
  true
88242
88362
  );
88243
88363
  }
88244
- if (!node.parent.parent.moduleSpecifier) {
88364
+ if (!hasModuleSpecifier) {
88245
88365
  const exportedName = node.propertyName || node.name;
88366
+ if (exportedName.kind === 11 /* StringLiteral */) {
88367
+ return;
88368
+ }
88246
88369
  const symbol = resolveName(
88247
88370
  exportedName,
88248
88371
  exportedName.escapedText,
@@ -88258,7 +88381,7 @@ function createTypeChecker(host) {
88258
88381
  markLinkedReferences(node, 7 /* ExportSpecifier */);
88259
88382
  }
88260
88383
  } else {
88261
- if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
88384
+ if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
88262
88385
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88263
88386
  }
88264
88387
  }
@@ -89413,7 +89536,11 @@ function createTypeChecker(host) {
89413
89536
  }
89414
89537
  function getExportSpecifierLocalTargetSymbol(node) {
89415
89538
  if (isExportSpecifier(node)) {
89416
- return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
89539
+ const name = node.propertyName || node.name;
89540
+ return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : name.kind === 11 /* StringLiteral */ ? void 0 : (
89541
+ // Skip for invalid syntax like this: export { "x" }
89542
+ resolveEntityName(name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)
89543
+ );
89417
89544
  } else {
89418
89545
  return resolveEntityName(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
89419
89546
  }
@@ -90384,7 +90511,8 @@ function createTypeChecker(host) {
90384
90511
  resolveExternalModuleSymbol(sym);
90385
90512
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
90386
90513
  },
90387
- isImportRequiredByAugmentation
90514
+ isImportRequiredByAugmentation,
90515
+ isDefinitelyReferenceToGlobalSymbolObject
90388
90516
  };
90389
90517
  function isImportRequiredByAugmentation(node) {
90390
90518
  const file = getSourceFileOfNode(node);
@@ -92223,7 +92351,7 @@ function isDeclarationNameOrImportPropertyName(name) {
92223
92351
  switch (name.parent.kind) {
92224
92352
  case 276 /* ImportSpecifier */:
92225
92353
  case 281 /* ExportSpecifier */:
92226
- return isIdentifier(name);
92354
+ return isIdentifier(name) || name.kind === 11 /* StringLiteral */;
92227
92355
  default:
92228
92356
  return isDeclarationName(name);
92229
92357
  }
@@ -93468,7 +93596,7 @@ var visitEachChildTable = {
93468
93596
  return context.factory.updateImportSpecifier(
93469
93597
  node,
93470
93598
  node.isTypeOnly,
93471
- nodeVisitor(node.propertyName, visitor, isIdentifier),
93599
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
93472
93600
  Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
93473
93601
  );
93474
93602
  },
@@ -93499,8 +93627,8 @@ var visitEachChildTable = {
93499
93627
  return context.factory.updateExportSpecifier(
93500
93628
  node,
93501
93629
  node.isTypeOnly,
93502
- nodeVisitor(node.propertyName, visitor, isIdentifier),
93503
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
93630
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
93631
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleExportName))
93504
93632
  );
93505
93633
  },
93506
93634
  // Module references
@@ -94216,7 +94344,7 @@ function containsDefaultReference(node) {
94216
94344
  return some(node.elements, isNamedDefaultReference);
94217
94345
  }
94218
94346
  function isNamedDefaultReference(e) {
94219
- return e.propertyName !== void 0 ? e.propertyName.escapedText === "default" /* Default */ : e.name.escapedText === "default" /* Default */;
94347
+ return moduleExportNameIsDefault(e.propertyName || e.name);
94220
94348
  }
94221
94349
  function chainBundle(context, transformSourceFile) {
94222
94350
  return transformSourceFileOrBundle;
@@ -94292,9 +94420,10 @@ function collectExternalModuleInfo(context, sourceFile) {
94292
94420
  hasImportDefault || (hasImportDefault = containsDefaultReference(node.exportClause));
94293
94421
  } else {
94294
94422
  const name = node.exportClause.name;
94295
- if (!uniqueExports.get(idText(name))) {
94423
+ const nameText = moduleExportNameTextUnescaped(name);
94424
+ if (!uniqueExports.get(nameText)) {
94296
94425
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
94297
- uniqueExports.set(idText(name), true);
94426
+ uniqueExports.set(nameText, true);
94298
94427
  exportedNames = append(exportedNames, name);
94299
94428
  }
94300
94429
  hasImportStar = true;
@@ -94352,20 +94481,23 @@ function collectExternalModuleInfo(context, sourceFile) {
94352
94481
  return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, exportedFunctions, externalHelpersImportDeclaration };
94353
94482
  function addExportedNamesForExportDeclaration(node) {
94354
94483
  for (const specifier of cast(node.exportClause, isNamedExports).elements) {
94355
- if (!uniqueExports.get(idText(specifier.name))) {
94484
+ const specifierNameText = moduleExportNameTextUnescaped(specifier.name);
94485
+ if (!uniqueExports.get(specifierNameText)) {
94356
94486
  const name = specifier.propertyName || specifier.name;
94357
- if (!node.moduleSpecifier) {
94358
- exportSpecifiers.add(name, specifier);
94359
- }
94360
- const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
94361
- if (decl) {
94362
- if (decl.kind === 262 /* FunctionDeclaration */) {
94363
- addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
94364
- continue;
94487
+ if (name.kind !== 11 /* StringLiteral */) {
94488
+ if (!node.moduleSpecifier) {
94489
+ exportSpecifiers.add(name, specifier);
94490
+ }
94491
+ const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
94492
+ if (decl) {
94493
+ if (decl.kind === 262 /* FunctionDeclaration */) {
94494
+ addExportedFunctionDeclaration(decl, specifier.name, moduleExportNameIsDefault(specifier.name));
94495
+ continue;
94496
+ }
94497
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
94365
94498
  }
94366
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
94367
94499
  }
94368
- uniqueExports.set(idText(specifier.name), true);
94500
+ uniqueExports.set(specifierNameText, true);
94369
94501
  exportedNames = append(exportedNames, specifier.name);
94370
94502
  }
94371
94503
  }
@@ -94379,9 +94511,10 @@ function collectExternalModuleInfo(context, sourceFile) {
94379
94511
  }
94380
94512
  } else {
94381
94513
  name ?? (name = node.name);
94382
- if (!uniqueExports.get(idText(name))) {
94514
+ const nameText = moduleExportNameTextUnescaped(name);
94515
+ if (!uniqueExports.get(nameText)) {
94383
94516
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
94384
- uniqueExports.set(idText(name), true);
94517
+ uniqueExports.set(nameText, true);
94385
94518
  }
94386
94519
  }
94387
94520
  }
@@ -111668,7 +111801,7 @@ function transformModule(context) {
111668
111801
  factory2.createExpressionStatement(
111669
111802
  reduceLeft(
111670
111803
  currentModuleInfo.exportedNames.slice(i, i + chunkSize),
111671
- (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
111804
+ (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),
111672
111805
  factory2.createVoidZero()
111673
111806
  )
111674
111807
  )
@@ -111991,7 +112124,10 @@ function transformModule(context) {
111991
112124
  append(statements, createUnderscoreUnderscoreESModule());
111992
112125
  }
111993
112126
  if (some(currentModuleInfo.exportedNames)) {
111994
- append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
112127
+ append(
112128
+ statements,
112129
+ 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()))
112130
+ );
111995
112131
  }
111996
112132
  for (const f of currentModuleInfo.exportedFunctions) {
111997
112133
  appendExportsOfHoistedDeclaration(statements, f);
@@ -112862,17 +112998,16 @@ function transformModule(context) {
112862
112998
  );
112863
112999
  }
112864
113000
  for (const specifier of node.exportClause.elements) {
112865
- const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && idText(specifier.propertyName || specifier.name) === "default";
112866
- const exportedValue = factory2.createPropertyAccessExpression(
112867
- exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName,
112868
- specifier.propertyName || specifier.name
112869
- );
113001
+ const specifierName = specifier.propertyName || specifier.name;
113002
+ const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && moduleExportNameIsDefault(specifierName);
113003
+ const target = exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName;
113004
+ const exportedValue = specifierName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, specifierName) : factory2.createPropertyAccessExpression(target, specifierName);
112870
113005
  statements.push(
112871
113006
  setOriginalNode(
112872
113007
  setTextRange(
112873
113008
  factory2.createExpressionStatement(
112874
113009
  createExportExpression(
112875
- factory2.getExportName(specifier),
113010
+ specifier.name.kind === 11 /* StringLiteral */ ? factory2.cloneNode(specifier.name) : factory2.getExportName(specifier),
112876
113011
  exportedValue,
112877
113012
  /*location*/
112878
113013
  void 0,
@@ -112897,7 +113032,7 @@ function transformModule(context) {
112897
113032
  factory2.cloneNode(node.exportClause.name),
112898
113033
  getHelperExpressionForExport(
112899
113034
  node,
112900
- moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
113035
+ moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : node.exportClause.name.kind === 11 /* StringLiteral */ ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
112901
113036
  )
112902
113037
  )
112903
113038
  ),
@@ -113227,10 +113362,13 @@ function transformModule(context) {
113227
113362
  return statements;
113228
113363
  }
113229
113364
  function appendExportStatement(statements, seen, exportName, expression, location, allowComments, liveBinding) {
113230
- if (!seen.has(exportName)) {
113365
+ if (exportName.kind !== 11 /* StringLiteral */) {
113366
+ if (seen.has(exportName)) {
113367
+ return statements;
113368
+ }
113231
113369
  seen.set(exportName, true);
113232
- statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
113233
113370
  }
113371
+ statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
113234
113372
  return statements;
113235
113373
  }
113236
113374
  function createUnderscoreUnderscoreESModule() {
@@ -113300,7 +113438,10 @@ function transformModule(context) {
113300
113438
  ])
113301
113439
  ]
113302
113440
  ) : factory2.createAssignment(
113303
- factory2.createPropertyAccessExpression(
113441
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(
113442
+ factory2.createIdentifier("exports"),
113443
+ factory2.cloneNode(name)
113444
+ ) : factory2.createPropertyAccessExpression(
113304
113445
  factory2.createIdentifier("exports"),
113305
113446
  factory2.cloneNode(name)
113306
113447
  ),
@@ -113436,11 +113577,9 @@ function transformModule(context) {
113436
113577
  );
113437
113578
  } else if (isImportSpecifier(importDeclaration)) {
113438
113579
  const name = importDeclaration.propertyName || importDeclaration.name;
113580
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
113439
113581
  return setTextRange(
113440
- factory2.createPropertyAccessExpression(
113441
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
113442
- factory2.cloneNode(name)
113443
- ),
113582
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(name)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(name)),
113444
113583
  /*location*/
113445
113584
  node
113446
113585
  );
@@ -113728,7 +113867,7 @@ function transformSystemModule(context) {
113728
113867
  const exportedNames = [];
113729
113868
  if (moduleInfo.exportedNames) {
113730
113869
  for (const exportedLocalName of moduleInfo.exportedNames) {
113731
- if (exportedLocalName.escapedText === "default") {
113870
+ if (moduleExportNameIsDefault(exportedLocalName)) {
113732
113871
  continue;
113733
113872
  }
113734
113873
  exportedNames.push(
@@ -113906,10 +114045,10 @@ function transformSystemModule(context) {
113906
114045
  for (const e of entry.exportClause.elements) {
113907
114046
  properties.push(
113908
114047
  factory2.createPropertyAssignment(
113909
- factory2.createStringLiteral(idText(e.name)),
114048
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.name)),
113910
114049
  factory2.createElementAccessExpression(
113911
114050
  parameterName,
113912
- factory2.createStringLiteral(idText(e.propertyName || e.name))
114051
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.propertyName || e.name))
113913
114052
  )
113914
114053
  )
113915
114054
  );
@@ -113936,7 +114075,7 @@ function transformSystemModule(context) {
113936
114075
  /*typeArguments*/
113937
114076
  void 0,
113938
114077
  [
113939
- factory2.createStringLiteral(idText(entry.exportClause.name)),
114078
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(entry.exportClause.name)),
113940
114079
  parameterName
113941
114080
  ]
113942
114081
  )
@@ -114276,7 +114415,7 @@ function transformSystemModule(context) {
114276
114415
  const exportSpecifiers = moduleInfo.exportSpecifiers.get(name);
114277
114416
  if (exportSpecifiers) {
114278
114417
  for (const exportSpecifier of exportSpecifiers) {
114279
- if (exportSpecifier.name.escapedText !== excludeName) {
114418
+ if (moduleExportNameTextUnescaped(exportSpecifier.name) !== excludeName) {
114280
114419
  statements = appendExportStatement(statements, exportSpecifier.name, name);
114281
114420
  }
114282
114421
  }
@@ -114697,13 +114836,12 @@ function transformSystemModule(context) {
114697
114836
  node
114698
114837
  );
114699
114838
  } else if (isImportSpecifier(importDeclaration)) {
114839
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
114840
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
114700
114841
  return setTextRange(
114701
114842
  factory2.createPropertyAssignment(
114702
114843
  factory2.cloneNode(name),
114703
- factory2.createPropertyAccessExpression(
114704
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
114705
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
114706
- )
114844
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName))
114707
114845
  ),
114708
114846
  /*location*/
114709
114847
  node
@@ -114746,11 +114884,10 @@ function transformSystemModule(context) {
114746
114884
  node
114747
114885
  );
114748
114886
  } else if (isImportSpecifier(importDeclaration)) {
114887
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
114888
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
114749
114889
  return setTextRange(
114750
- factory2.createPropertyAccessExpression(
114751
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
114752
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
114753
- ),
114890
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName)),
114754
114891
  /*location*/
114755
114892
  node
114756
114893
  );
@@ -116341,15 +116478,17 @@ function transformDeclarations(context) {
116341
116478
  if (isDeclarationAndNotVisible(input)) return;
116342
116479
  if (hasDynamicName(input)) {
116343
116480
  if (isolatedDeclarations) {
116344
- if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116345
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116346
- return;
116347
- } else if (
116348
- // Type declarations just need to double-check that the input computed name is an entity name expression
116349
- (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
116350
- ) {
116351
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116352
- return;
116481
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
116482
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116483
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116484
+ return;
116485
+ } else if (
116486
+ // Type declarations just need to double-check that the input computed name is an entity name expression
116487
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
116488
+ ) {
116489
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116490
+ return;
116491
+ }
116353
116492
  }
116354
116493
  } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
116355
116494
  return;
@@ -117717,16 +117856,16 @@ function isBuildInfoFile(file) {
117717
117856
  function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit = false, onlyBuildInfo, includeBuildInfo) {
117718
117857
  const sourceFiles = isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit);
117719
117858
  const options = host.getCompilerOptions();
117720
- if (options.outFile) {
117721
- if (sourceFiles.length) {
117722
- const bundle = factory.createBundle(sourceFiles);
117723
- const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
117724
- if (result) {
117725
- return result;
117859
+ if (!onlyBuildInfo) {
117860
+ if (options.outFile) {
117861
+ if (sourceFiles.length) {
117862
+ const bundle = factory.createBundle(sourceFiles);
117863
+ const result = action(getOutputPathsFor(bundle, host, forceDtsEmit), bundle);
117864
+ if (result) {
117865
+ return result;
117866
+ }
117726
117867
  }
117727
- }
117728
- } else {
117729
- if (!onlyBuildInfo) {
117868
+ } else {
117730
117869
  for (const sourceFile of sourceFiles) {
117731
117870
  const result = action(getOutputPathsFor(sourceFile, host, forceDtsEmit), sourceFile);
117732
117871
  if (result) {
@@ -117734,14 +117873,14 @@ function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDt
117734
117873
  }
117735
117874
  }
117736
117875
  }
117737
- if (includeBuildInfo) {
117738
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
117739
- if (buildInfoPath) return action(
117740
- { buildInfoPath },
117741
- /*sourceFileOrBundle*/
117742
- void 0
117743
- );
117744
- }
117876
+ }
117877
+ if (includeBuildInfo) {
117878
+ const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
117879
+ if (buildInfoPath) return action(
117880
+ { buildInfoPath },
117881
+ /*sourceFileOrBundle*/
117882
+ void 0
117883
+ );
117745
117884
  }
117746
117885
  }
117747
117886
  function getTsBuildInfoEmitOutputFilePath(options) {
@@ -117770,8 +117909,7 @@ function getOutputPathsForBundle(options, forceDtsPaths) {
117770
117909
  const sourceMapFilePath = jsFilePath && getSourceMapFilePath(jsFilePath, options);
117771
117910
  const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) ? removeFileExtension(outPath) + ".d.ts" /* Dts */ : void 0;
117772
117911
  const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
117773
- const buildInfoPath = getTsBuildInfoEmitOutputFilePath(options);
117774
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath };
117912
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
117775
117913
  }
117776
117914
  function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
117777
117915
  const options = host.getCompilerOptions();
@@ -117785,7 +117923,7 @@ function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
117785
117923
  const sourceMapFilePath = !jsFilePath || isJsonSourceFile(sourceFile) ? void 0 : getSourceMapFilePath(jsFilePath, options);
117786
117924
  const declarationFilePath = forceDtsPaths || getEmitDeclarations(options) && !isJsonFile ? getDeclarationEmitOutputFilePath(sourceFile.fileName, host) : void 0;
117787
117925
  const declarationMapPath = declarationFilePath && getAreDeclarationMapsEnabled(options) ? declarationFilePath + ".map" : void 0;
117788
- return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath: void 0 };
117926
+ return { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath };
117789
117927
  }
117790
117928
  }
117791
117929
  function getSourceMapFilePath(jsFilePath, options) {
@@ -117834,7 +117972,7 @@ function createAddOutput() {
117834
117972
  }
117835
117973
  }
117836
117974
  function getSingleOutputFileNames(configFile, addOutput) {
117837
- const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath } = getOutputPathsForBundle(
117975
+ const { jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath } = getOutputPathsForBundle(
117838
117976
  configFile.options,
117839
117977
  /*forceDtsPaths*/
117840
117978
  false
@@ -117843,7 +117981,6 @@ function getSingleOutputFileNames(configFile, addOutput) {
117843
117981
  addOutput(sourceMapFilePath);
117844
117982
  addOutput(declarationFilePath);
117845
117983
  addOutput(declarationMapPath);
117846
- addOutput(buildInfoPath);
117847
117984
  }
117848
117985
  function getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2) {
117849
117986
  if (isDeclarationFileName(inputFileName)) return;
@@ -117894,8 +118031,8 @@ function getAllProjectOutputs(configFile, ignoreCase) {
117894
118031
  for (const inputFileName of configFile.fileNames) {
117895
118032
  getOwnOutputFileNames(configFile, inputFileName, ignoreCase, addOutput, getCommonSourceDirectory2);
117896
118033
  }
117897
- addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
117898
118034
  }
118035
+ addOutput(getTsBuildInfoEmitOutputFilePath(configFile.options));
117899
118036
  return getOutputs();
117900
118037
  }
117901
118038
  function getOutputFileNames(commandLine, inputFileName, ignoreCase) {
@@ -117935,7 +118072,7 @@ function getFirstProjectOutput(configFile, ignoreCase) {
117935
118072
  function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
117936
118073
  return !!forceDtsEmit && !!emitOnly;
117937
118074
  }
117938
- function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
118075
+ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit, skipBuildInfo) {
117939
118076
  var compilerOptions = host.getCompilerOptions();
117940
118077
  var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
117941
118078
  var emittedFilesList = compilerOptions.listEmittedFiles ? [] : void 0;
@@ -117951,7 +118088,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
117951
118088
  getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit),
117952
118089
  forceDtsEmit,
117953
118090
  onlyBuildInfo,
117954
- !targetSourceFile
118091
+ !targetSourceFile && !skipBuildInfo
117955
118092
  );
117956
118093
  exit();
117957
118094
  return {
@@ -117973,7 +118110,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
117973
118110
  (_f = tracing) == null ? void 0 : _f.pop();
117974
118111
  }
117975
118112
  function emitBuildInfo(buildInfoPath) {
117976
- if (!buildInfoPath || targetSourceFile || emitSkipped) return;
118113
+ if (!buildInfoPath || targetSourceFile) return;
117977
118114
  if (host.isEmitBlocked(buildInfoPath)) {
117978
118115
  emitSkipped = true;
117979
118116
  return;
@@ -118311,7 +118448,8 @@ var notImplementedResolver = {
118311
118448
  getJsxFragmentFactoryEntity: notImplemented,
118312
118449
  isBindingCapturedByNode: notImplemented,
118313
118450
  getDeclarationStatementsForSourceFile: notImplemented,
118314
- isImportRequiredByAugmentation: notImplemented
118451
+ isImportRequiredByAugmentation: notImplemented,
118452
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented
118315
118453
  };
118316
118454
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
118317
118455
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -124972,7 +125110,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124972
125110
  }
124973
125111
  function emitBuildInfo(writeFileCallback) {
124974
125112
  var _a2, _b2;
124975
- Debug.assert(!options.outFile);
124976
125113
  (_a2 = tracing) == null ? void 0 : _a2.push(
124977
125114
  tracing.Phase.Emit,
124978
125115
  "emitBuildInfo",
@@ -125027,7 +125164,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125027
125164
  function getTypeChecker() {
125028
125165
  return typeChecker || (typeChecker = createTypeChecker(program));
125029
125166
  }
125030
- function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit) {
125167
+ function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit, skipBuildInfo) {
125031
125168
  var _a2, _b2;
125032
125169
  (_a2 = tracing) == null ? void 0 : _a2.push(
125033
125170
  tracing.Phase.Emit,
@@ -125036,14 +125173,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125036
125173
  /*separateBeginAndEnd*/
125037
125174
  true
125038
125175
  );
125039
- const result = runWithCancellationToken(() => emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit));
125176
+ const result = runWithCancellationToken(
125177
+ () => emitWorker(
125178
+ program,
125179
+ sourceFile,
125180
+ writeFileCallback,
125181
+ cancellationToken,
125182
+ emitOnly,
125183
+ transformers,
125184
+ forceDtsEmit,
125185
+ skipBuildInfo
125186
+ )
125187
+ );
125040
125188
  (_b2 = tracing) == null ? void 0 : _b2.pop();
125041
125189
  return result;
125042
125190
  }
125043
125191
  function isEmitBlocked(emitFileName) {
125044
125192
  return hasEmitBlockingDiagnostics.has(toPath3(emitFileName));
125045
125193
  }
125046
- function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit) {
125194
+ function emitWorker(program2, sourceFile, writeFileCallback, cancellationToken, emitOnly, customTransformers, forceDtsEmit, skipBuildInfo) {
125047
125195
  if (!forceDtsEmit) {
125048
125196
  const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
125049
125197
  if (result) return result;
@@ -125065,7 +125213,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125065
125213
  emitOnly,
125066
125214
  /*onlyBuildInfo*/
125067
125215
  false,
125068
- forceDtsEmit
125216
+ forceDtsEmit,
125217
+ skipBuildInfo
125069
125218
  )
125070
125219
  );
125071
125220
  mark("afterEmit");
@@ -127197,7 +127346,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
127197
127346
  const options = program.getCompilerOptions();
127198
127347
  if (options.noEmit) {
127199
127348
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
127200
- return sourceFile || options.outFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
127349
+ return sourceFile ? emitSkippedWithNoDiagnostics : program.emitBuildInfo(writeFile2, cancellationToken);
127201
127350
  }
127202
127351
  if (!options.noEmitOnError) return void 0;
127203
127352
  let diagnostics = [
@@ -127215,7 +127364,7 @@ function handleNoEmitOptions(program, sourceFile, writeFile2, cancellationToken)
127215
127364
  }
127216
127365
  if (!diagnostics.length) return void 0;
127217
127366
  let emittedFiles;
127218
- if (!sourceFile && !options.outFile) {
127367
+ if (!sourceFile) {
127219
127368
  const emitResult = program.emitBuildInfo(writeFile2, cancellationToken);
127220
127369
  if (emitResult.diagnostics) diagnostics = [...diagnostics, ...emitResult.diagnostics];
127221
127370
  emittedFiles = emitResult.emittedFiles;
@@ -127723,17 +127872,17 @@ function createBuilderProgramState(newProgram, oldState) {
127723
127872
  const compilerOptions = newProgram.getCompilerOptions();
127724
127873
  state.compilerOptions = compilerOptions;
127725
127874
  const outFilePath = compilerOptions.outFile;
127726
- if (!outFilePath) {
127727
- state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
127728
- } else if (compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
127875
+ state.semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
127876
+ if (outFilePath && compilerOptions.composite && (oldState == null ? void 0 : oldState.outSignature) && outFilePath === oldState.compilerOptions.outFile) {
127729
127877
  state.outSignature = oldState.outSignature && getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldState.outSignature);
127730
127878
  }
127731
127879
  state.changedFilesSet = /* @__PURE__ */ new Set();
127732
127880
  state.latestChangedDtsFile = compilerOptions.composite ? oldState == null ? void 0 : oldState.latestChangedDtsFile : void 0;
127733
127881
  const useOldState = BuilderState.canReuseOldState(state.referencedMap, oldState);
127734
127882
  const oldCompilerOptions = useOldState ? oldState.compilerOptions : void 0;
127735
- const canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
127883
+ let canCopySemanticDiagnostics = useOldState && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
127736
127884
  const canCopyEmitSignatures = compilerOptions.composite && (oldState == null ? void 0 : oldState.emitSignatures) && !outFilePath && !compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
127885
+ let canCopyEmitDiagnostics = true;
127737
127886
  if (useOldState) {
127738
127887
  (_a = oldState.changedFilesSet) == null ? void 0 : _a.forEach((value) => state.changedFilesSet.add(value));
127739
127888
  if (!outFilePath && ((_b = oldState.affectedFilesPendingEmit) == null ? void 0 : _b.size)) {
@@ -127741,6 +127890,10 @@ function createBuilderProgramState(newProgram, oldState) {
127741
127890
  state.seenAffectedFiles = /* @__PURE__ */ new Set();
127742
127891
  }
127743
127892
  state.programEmitPending = oldState.programEmitPending;
127893
+ if (outFilePath && state.changedFilesSet.size) {
127894
+ canCopySemanticDiagnostics = false;
127895
+ canCopyEmitDiagnostics = false;
127896
+ }
127744
127897
  } else {
127745
127898
  state.buildInfoEmitPending = true;
127746
127899
  }
@@ -127758,10 +127911,10 @@ function createBuilderProgramState(newProgram, oldState) {
127758
127911
  oldInfo.impliedFormat !== info.impliedFormat || // Referenced files changed
127759
127912
  !hasSameKeys(newReferences = referencedMap && referencedMap.getValues(sourceFilePath), oldReferencedMap && oldReferencedMap.getValues(sourceFilePath)) || // Referenced file was deleted in the new program
127760
127913
  newReferences && forEachKey(newReferences, (path) => !state.fileInfos.has(path) && oldState.fileInfos.has(path))) {
127761
- addFileToChangeSet(state, sourceFilePath);
127914
+ addFileToChangeSet(sourceFilePath);
127762
127915
  } else {
127763
127916
  const sourceFile = newProgram.getSourceFileByPath(sourceFilePath);
127764
- const emitDiagnostics = (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath);
127917
+ const emitDiagnostics = canCopyEmitDiagnostics ? (_a2 = oldState.emitDiagnosticsPerFile) == null ? void 0 : _a2.get(sourceFilePath) : void 0;
127765
127918
  if (emitDiagnostics) {
127766
127919
  (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
127767
127920
  sourceFilePath,
@@ -127790,16 +127943,16 @@ function createBuilderProgramState(newProgram, oldState) {
127790
127943
  });
127791
127944
  if (useOldState && forEachEntry(oldState.fileInfos, (info, sourceFilePath) => {
127792
127945
  if (state.fileInfos.has(sourceFilePath)) return false;
127793
- if (outFilePath || info.affectsGlobalScope) return true;
127946
+ if (info.affectsGlobalScope) return true;
127794
127947
  state.buildInfoEmitPending = true;
127795
- return false;
127948
+ return !!outFilePath;
127796
127949
  })) {
127797
127950
  BuilderState.getAllFilesExcludingDefaultLibraryFile(
127798
127951
  state,
127799
127952
  newProgram,
127800
127953
  /*firstSourceFile*/
127801
127954
  void 0
127802
- ).forEach((file) => addFileToChangeSet(state, file.resolvedPath));
127955
+ ).forEach((file) => addFileToChangeSet(file.resolvedPath));
127803
127956
  } else if (oldCompilerOptions) {
127804
127957
  const pendingEmitKind = compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions) ? getBuilderFileEmit(compilerOptions) : getPendingEmitKind(compilerOptions, oldCompilerOptions);
127805
127958
  if (pendingEmitKind !== 0 /* None */) {
@@ -127815,18 +127968,25 @@ function createBuilderProgramState(newProgram, oldState) {
127815
127968
  });
127816
127969
  Debug.assert(!state.seenAffectedFiles || !state.seenAffectedFiles.size);
127817
127970
  state.seenAffectedFiles = state.seenAffectedFiles || /* @__PURE__ */ new Set();
127818
- state.buildInfoEmitPending = true;
127819
- } else {
127971
+ } else if (!state.changedFilesSet.size) {
127820
127972
  state.programEmitPending = state.programEmitPending ? state.programEmitPending | pendingEmitKind : pendingEmitKind;
127821
127973
  }
127974
+ state.buildInfoEmitPending = true;
127822
127975
  }
127823
127976
  }
127824
127977
  return state;
127825
- }
127826
- function addFileToChangeSet(state, path) {
127827
- state.changedFilesSet.add(path);
127828
- state.buildInfoEmitPending = true;
127829
- state.programEmitPending = void 0;
127978
+ function addFileToChangeSet(path) {
127979
+ state.changedFilesSet.add(path);
127980
+ if (outFilePath) {
127981
+ canCopySemanticDiagnostics = false;
127982
+ canCopyEmitDiagnostics = false;
127983
+ state.semanticDiagnosticsFromOldState = void 0;
127984
+ state.semanticDiagnosticsPerFile.clear();
127985
+ state.emitDiagnosticsPerFile = void 0;
127986
+ }
127987
+ state.buildInfoEmitPending = true;
127988
+ state.programEmitPending = void 0;
127989
+ }
127830
127990
  }
127831
127991
  function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature) {
127832
127992
  return !!options.declarationMap === !!oldOptions.declarationMap ? (
@@ -127899,6 +128059,7 @@ function backupBuilderProgramEmitState(state) {
127899
128059
  return {
127900
128060
  affectedFilesPendingEmit: state.affectedFilesPendingEmit && new Map(state.affectedFilesPendingEmit),
127901
128061
  seenEmittedFiles: state.seenEmittedFiles && new Map(state.seenEmittedFiles),
128062
+ seenProgramEmit: state.seenProgramEmit,
127902
128063
  programEmitPending: state.programEmitPending,
127903
128064
  emitSignatures: state.emitSignatures && new Map(state.emitSignatures),
127904
128065
  outSignature: state.outSignature,
@@ -127912,6 +128073,7 @@ function backupBuilderProgramEmitState(state) {
127912
128073
  function restoreBuilderProgramEmitState(state, savedEmitState) {
127913
128074
  state.affectedFilesPendingEmit = savedEmitState.affectedFilesPendingEmit;
127914
128075
  state.seenEmittedFiles = savedEmitState.seenEmittedFiles;
128076
+ state.seenProgramEmit = savedEmitState.seenProgramEmit;
127915
128077
  state.programEmitPending = savedEmitState.programEmitPending;
127916
128078
  state.emitSignatures = savedEmitState.emitSignatures;
127917
128079
  state.outSignature = savedEmitState.outSignature;
@@ -127920,6 +128082,10 @@ function restoreBuilderProgramEmitState(state, savedEmitState) {
127920
128082
  state.buildInfoEmitPending = savedEmitState.buildInfoEmitPending;
127921
128083
  state.emitDiagnosticsPerFile = savedEmitState.emitDiagnosticsPerFile;
127922
128084
  if (savedEmitState.changedFilesSet) state.changedFilesSet = savedEmitState.changedFilesSet;
128085
+ if (state.compilerOptions.outFile && state.changedFilesSet.size) {
128086
+ state.semanticDiagnosticsPerFile.clear();
128087
+ state.emitDiagnosticsPerFile = void 0;
128088
+ }
127923
128089
  }
127924
128090
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
127925
128091
  Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
@@ -127957,10 +128123,7 @@ function getNextAffectedFile(state, cancellationToken, host) {
127957
128123
  }
127958
128124
  const program = Debug.checkDefined(state.program);
127959
128125
  const compilerOptions = program.getCompilerOptions();
127960
- if (compilerOptions.outFile) {
127961
- Debug.assert(!state.semanticDiagnosticsPerFile);
127962
- return program;
127963
- }
128126
+ if (compilerOptions.outFile) return program;
127964
128127
  state.affectedFiles = BuilderState.getFilesAffectedByWithOldState(
127965
128128
  state,
127966
128129
  program,
@@ -127974,14 +128137,22 @@ function getNextAffectedFile(state, cancellationToken, host) {
127974
128137
  }
127975
128138
  }
127976
128139
  function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) {
127977
- var _a;
127978
- if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return;
127979
- if (!emitOnlyDtsFiles) return state.affectedFilesPendingEmit = void 0;
127980
- state.affectedFilesPendingEmit.forEach((emitKind, path) => {
128140
+ var _a, _b;
128141
+ if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) && !state.programEmitPending) return;
128142
+ if (!emitOnlyDtsFiles) {
128143
+ state.affectedFilesPendingEmit = void 0;
128144
+ state.programEmitPending = void 0;
128145
+ }
128146
+ (_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.forEach((emitKind, path) => {
127981
128147
  const pending = emitKind & 7 /* AllJs */;
127982
128148
  if (!pending) state.affectedFilesPendingEmit.delete(path);
127983
128149
  else state.affectedFilesPendingEmit.set(path, pending);
127984
128150
  });
128151
+ if (state.programEmitPending) {
128152
+ const pending = state.programEmitPending & 7 /* AllJs */;
128153
+ if (!pending) state.programEmitPending = void 0;
128154
+ else state.programEmitPending = pending;
128155
+ }
127985
128156
  }
127986
128157
  function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) {
127987
128158
  var _a;
@@ -128173,24 +128344,21 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
128173
128344
  );
128174
128345
  return void 0;
128175
128346
  }
128176
- function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) {
128347
+ function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
128177
128348
  return concatenate(
128178
- getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken),
128349
+ getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
128179
128350
  Debug.checkDefined(state.program).getProgramDiagnostics(sourceFile)
128180
128351
  );
128181
128352
  }
128182
- function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken) {
128353
+ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
128354
+ semanticDiagnosticsPerFile ?? (semanticDiagnosticsPerFile = state.semanticDiagnosticsPerFile);
128183
128355
  const path = sourceFile.resolvedPath;
128184
- if (state.semanticDiagnosticsPerFile) {
128185
- const cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path);
128186
- if (cachedDiagnostics) {
128187
- return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
128188
- }
128356
+ const cachedDiagnostics = semanticDiagnosticsPerFile.get(path);
128357
+ if (cachedDiagnostics) {
128358
+ return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
128189
128359
  }
128190
128360
  const diagnostics = Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
128191
- if (state.semanticDiagnosticsPerFile) {
128192
- state.semanticDiagnosticsPerFile.set(path, diagnostics);
128193
- }
128361
+ semanticDiagnosticsPerFile.set(path, diagnostics);
128194
128362
  return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
128195
128363
  }
128196
128364
  function isProgramBundleEmitBuildInfo(info) {
@@ -128218,6 +128386,9 @@ function getBuildInfo2(state) {
128218
128386
  root,
128219
128387
  resolvedRoot: toResolvedRoot(),
128220
128388
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
128389
+ semanticDiagnosticsPerFile: convertToProgramBuildInfoDiagnostics(),
128390
+ emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
128391
+ changeFileSet: toChangeFileSet(),
128221
128392
  outSignature: state.outSignature,
128222
128393
  latestChangedDtsFile,
128223
128394
  pendingEmit: !state.programEmitPending ? void 0 : (
@@ -128308,13 +128479,6 @@ function getBuildInfo2(state) {
128308
128479
  }
128309
128480
  }
128310
128481
  }
128311
- let changeFileSet;
128312
- if (state.changedFilesSet.size) {
128313
- for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
128314
- changeFileSet = append(changeFileSet, toFileId(path));
128315
- }
128316
- }
128317
- const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
128318
128482
  const program = {
128319
128483
  fileNames,
128320
128484
  fileInfos,
@@ -128324,9 +128488,9 @@ function getBuildInfo2(state) {
128324
128488
  fileIdsList,
128325
128489
  referencedMap,
128326
128490
  semanticDiagnosticsPerFile,
128327
- emitDiagnosticsPerFile,
128491
+ emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
128328
128492
  affectedFilesPendingEmit,
128329
- changeFileSet,
128493
+ changeFileSet: toChangeFileSet(),
128330
128494
  emitSignatures,
128331
128495
  latestChangedDtsFile
128332
128496
  };
@@ -128409,8 +128573,7 @@ function getBuildInfo2(state) {
128409
128573
  function convertToProgramBuildInfoDiagnostics() {
128410
128574
  let result;
128411
128575
  state.fileInfos.forEach((_value, key) => {
128412
- var _a2;
128413
- const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
128576
+ const value = state.semanticDiagnosticsPerFile.get(key);
128414
128577
  if (!value) {
128415
128578
  if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
128416
128579
  } else if (value.length) {
@@ -128479,6 +128642,15 @@ function getBuildInfo2(state) {
128479
128642
  return result;
128480
128643
  }) || array;
128481
128644
  }
128645
+ function toChangeFileSet() {
128646
+ let changeFileSet;
128647
+ if (state.changedFilesSet.size) {
128648
+ for (const path of arrayFrom(state.changedFilesSet.keys()).sort(compareStringsCaseSensitive)) {
128649
+ changeFileSet = append(changeFileSet, toFileId(path));
128650
+ }
128651
+ }
128652
+ return changeFileSet;
128653
+ }
128482
128654
  }
128483
128655
  var BuilderProgramKind = /* @__PURE__ */ ((BuilderProgramKind2) => {
128484
128656
  BuilderProgramKind2[BuilderProgramKind2["SemanticDiagnosticsBuilderProgram"] = 0] = "SemanticDiagnosticsBuilderProgram";
@@ -128582,14 +128754,16 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128582
128754
  return emitSkippedWithNoDiagnostics;
128583
128755
  }
128584
128756
  function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
128585
- var _a, _b, _c;
128757
+ var _a, _b, _c, _d;
128586
128758
  let affected = getNextAffectedFile(state, cancellationToken, host);
128587
128759
  const programEmitKind = getBuilderFileEmit(state.compilerOptions);
128588
128760
  let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
128589
128761
  if (!affected) {
128590
128762
  if (!state.compilerOptions.outFile) {
128591
128763
  const pendingAffectedFile = getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles);
128592
- if (!pendingAffectedFile) {
128764
+ if (pendingAffectedFile) {
128765
+ ({ affectedFile: affected, emitKind } = pendingAffectedFile);
128766
+ } else {
128593
128767
  const pendingForDiagnostics = getNextPendingEmitDiagnosticsFile(state);
128594
128768
  if (pendingForDiagnostics) {
128595
128769
  (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(pendingForDiagnostics.affectedFile.resolvedPath, pendingForDiagnostics.seenKind | 24 /* AllDts */);
@@ -128598,48 +128772,73 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128598
128772
  affected: pendingForDiagnostics.affectedFile
128599
128773
  };
128600
128774
  }
128601
- if (!state.buildInfoEmitPending) return void 0;
128602
- const affected2 = state.program;
128603
- const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
128604
- state.buildInfoEmitPending = false;
128605
- return { result: result2, affected: affected2 };
128606
128775
  }
128607
- ({ affectedFile: affected, emitKind } = pendingAffectedFile);
128608
128776
  } else {
128609
- if (!state.programEmitPending) return void 0;
128610
- emitKind = state.programEmitPending;
128611
- if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
128612
- if (!emitKind) return void 0;
128613
- affected = state.program;
128777
+ if (state.programEmitPending) {
128778
+ emitKind = state.programEmitPending;
128779
+ if (emitOnlyDtsFiles) emitKind = emitKind & 24 /* AllDts */;
128780
+ if (emitKind) affected = state.program;
128781
+ }
128782
+ if (!affected && ((_a = state.emitDiagnosticsPerFile) == null ? void 0 : _a.size)) {
128783
+ const seenKind = state.seenProgramEmit || 0 /* None */;
128784
+ if (!(seenKind & 24 /* AllDts */)) {
128785
+ state.seenProgramEmit = 24 /* AllDts */ | seenKind;
128786
+ const diagnostics = [];
128787
+ state.emitDiagnosticsPerFile.forEach((d) => addRange(diagnostics, d));
128788
+ return {
128789
+ result: { emitSkipped: true, diagnostics },
128790
+ affected: state.program
128791
+ };
128792
+ }
128793
+ }
128794
+ }
128795
+ if (!affected) {
128796
+ if (!state.buildInfoEmitPending) return void 0;
128797
+ const affected2 = state.program;
128798
+ const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
128799
+ state.buildInfoEmitPending = false;
128800
+ return { result: result2, affected: affected2 };
128614
128801
  }
128615
128802
  }
128616
128803
  let emitOnly;
128617
128804
  if (emitKind & 7 /* AllJs */) emitOnly = 0 /* Js */;
128618
128805
  if (emitKind & 24 /* AllDts */) emitOnly = emitOnly === void 0 ? 1 /* Dts */ : void 0;
128619
- if (affected === state.program) {
128620
- state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
128621
- }
128622
128806
  const result = state.program.emit(
128623
128807
  affected === state.program ? void 0 : affected,
128624
128808
  getWriteFileCallback(writeFile2, customTransformers),
128625
128809
  cancellationToken,
128626
128810
  emitOnly,
128627
- customTransformers
128811
+ customTransformers,
128812
+ /*forceDtsEmit*/
128813
+ void 0,
128814
+ /*skipBuildInfo*/
128815
+ true
128628
128816
  );
128629
128817
  if (affected !== state.program) {
128630
128818
  const affectedSourceFile = affected;
128631
128819
  state.seenAffectedFiles.add(affectedSourceFile.resolvedPath);
128632
128820
  if (state.affectedFilesIndex !== void 0) state.affectedFilesIndex++;
128633
128821
  state.buildInfoEmitPending = true;
128634
- const existing = ((_a = state.seenEmittedFiles) == null ? void 0 : _a.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
128822
+ const existing = ((_b = state.seenEmittedFiles) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || 0 /* None */;
128635
128823
  (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, emitKind | existing);
128636
- const existingPending = ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || programEmitKind;
128824
+ const existingPending = ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.get(affectedSourceFile.resolvedPath)) || programEmitKind;
128637
128825
  const pendingKind = getPendingEmitKind(existingPending, emitKind | existing);
128638
128826
  if (pendingKind) (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind);
128639
- else (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath);
128827
+ else (_d = state.affectedFilesPendingEmit) == null ? void 0 : _d.delete(affectedSourceFile.resolvedPath);
128640
128828
  if (result.diagnostics.length) (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, result.diagnostics);
128641
128829
  } else {
128642
128830
  state.changedFilesSet.clear();
128831
+ state.programEmitPending = state.changedFilesSet.size ? getPendingEmitKind(programEmitKind, emitKind) : state.programEmitPending ? getPendingEmitKind(state.programEmitPending, emitKind) : void 0;
128832
+ state.seenProgramEmit = emitKind | (state.seenProgramEmit || 0 /* None */);
128833
+ let emitDiagnosticsPerFile;
128834
+ result.diagnostics.forEach((d) => {
128835
+ if (!d.file) return;
128836
+ let diagnostics = emitDiagnosticsPerFile == null ? void 0 : emitDiagnosticsPerFile.get(d.file.resolvedPath);
128837
+ if (!diagnostics) (emitDiagnosticsPerFile ?? (emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(d.file.resolvedPath, diagnostics = []);
128838
+ diagnostics.push(d);
128839
+ });
128840
+ if (emitDiagnosticsPerFile) state.emitDiagnosticsPerFile = emitDiagnosticsPerFile;
128841
+ state.buildInfoEmitPending = true;
128643
128842
  }
128644
128843
  return { result, affected };
128645
128844
  }
@@ -128761,28 +128960,37 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128761
128960
  state.buildInfoEmitPending = true;
128762
128961
  if (!result) continue;
128763
128962
  } else {
128764
- result = state.program.getSemanticDiagnostics(
128765
- /*sourceFile*/
128766
- void 0,
128767
- cancellationToken
128963
+ let diagnostics;
128964
+ const semanticDiagnosticsPerFile = /* @__PURE__ */ new Map();
128965
+ state.program.getSourceFiles().forEach(
128966
+ (sourceFile) => diagnostics = addRange(
128967
+ diagnostics,
128968
+ getSemanticDiagnosticsOfFile(
128969
+ state,
128970
+ sourceFile,
128971
+ cancellationToken,
128972
+ semanticDiagnosticsPerFile
128973
+ )
128974
+ )
128768
128975
  );
128976
+ state.semanticDiagnosticsPerFile = semanticDiagnosticsPerFile;
128977
+ result = diagnostics || emptyArray;
128769
128978
  state.changedFilesSet.clear();
128770
128979
  state.programEmitPending = getBuilderFileEmit(state.compilerOptions);
128980
+ state.buildInfoEmitPending = true;
128771
128981
  }
128772
128982
  return { result, affected };
128773
128983
  }
128774
128984
  }
128775
128985
  function getSemanticDiagnostics(sourceFile, cancellationToken) {
128776
128986
  assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
128777
- const compilerOptions = Debug.checkDefined(state.program).getCompilerOptions();
128778
- if (compilerOptions.outFile) {
128779
- Debug.assert(!state.semanticDiagnosticsPerFile);
128780
- return Debug.checkDefined(state.program).getSemanticDiagnostics(sourceFile, cancellationToken);
128781
- }
128782
128987
  if (sourceFile) {
128783
128988
  return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken);
128784
128989
  }
128785
- while (getSemanticDiagnosticsOfNextAffectedFile(cancellationToken)) {
128990
+ while (true) {
128991
+ const affectedResult = getSemanticDiagnosticsOfNextAffectedFile(cancellationToken);
128992
+ if (!affectedResult) break;
128993
+ if (affectedResult.affected === state.program) return affectedResult.result;
128786
128994
  }
128787
128995
  let diagnostics;
128788
128996
  for (const sourceFile2 of Debug.checkDefined(state.program).getSourceFiles()) {
@@ -128815,8 +129023,9 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128815
129023
  const filePaths = (_a = program.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
128816
129024
  let filePathsSetList;
128817
129025
  const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
129026
+ const fileInfos = /* @__PURE__ */ new Map();
129027
+ const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
128818
129028
  if (isProgramBundleEmitBuildInfo(program)) {
128819
- const fileInfos = /* @__PURE__ */ new Map();
128820
129029
  program.fileInfos.forEach((fileInfo, index) => {
128821
129030
  const path = toFilePath(index + 1);
128822
129031
  fileInfos.set(path, isString(fileInfo) ? { version: fileInfo, signature: void 0, affectsGlobalScope: void 0, impliedFormat: void 0 } : fileInfo);
@@ -128824,13 +129033,16 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128824
129033
  state = {
128825
129034
  fileInfos,
128826
129035
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
129036
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
129037
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
129038
+ hasReusableDiagnostic: true,
129039
+ changedFilesSet,
128827
129040
  latestChangedDtsFile,
128828
129041
  outSignature: program.outSignature,
128829
129042
  programEmitPending: program.pendingEmit === void 0 ? void 0 : toProgramEmitPending(program.pendingEmit, program.options)
128830
129043
  };
128831
129044
  } else {
128832
129045
  filePathsSetList = (_b = program.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
128833
- const fileInfos = /* @__PURE__ */ new Map();
128834
129046
  const emitSignatures = ((_c = program.options) == null ? void 0 : _c.composite) && !program.options.outFile ? /* @__PURE__ */ new Map() : void 0;
128835
129047
  program.fileInfos.forEach((fileInfo, index) => {
128836
129048
  const path = toFilePath(index + 1);
@@ -128851,13 +129063,12 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128851
129063
  );
128852
129064
  }
128853
129065
  });
128854
- const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
128855
129066
  const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
128856
129067
  state = {
128857
129068
  fileInfos,
128858
129069
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
128859
129070
  referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
128860
- semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile, fileInfos, changedFilesSet),
129071
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
128861
129072
  emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
128862
129073
  hasReusableDiagnostic: true,
128863
129074
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
@@ -128909,7 +129120,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128909
129120
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
128910
129121
  return map2;
128911
129122
  }
128912
- function toPerFileSemanticDiagnostics(diagnostics, fileInfos, changedFilesSet) {
129123
+ function toPerFileSemanticDiagnostics(diagnostics) {
128913
129124
  const semanticDiagnostics = new Map(
128914
129125
  mapDefinedIterator(
128915
129126
  fileInfos.keys(),
@@ -128920,7 +129131,7 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128920
129131
  if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
128921
129132
  else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
128922
129133
  });
128923
- return semanticDiagnostics.size ? semanticDiagnostics : void 0;
129134
+ return semanticDiagnostics;
128924
129135
  }
128925
129136
  function toPerFileEmitDiagnostics(diagnostics) {
128926
129137
  return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
@@ -132096,8 +132307,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132096
132307
  ({ buildResult, step } = buildErrors(
132097
132308
  state,
132098
132309
  projectPath,
132099
- program,
132100
- config,
132101
132310
  diagnostics,
132102
132311
  errorFlags,
132103
132312
  errorType
@@ -132160,8 +132369,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132160
132369
  ({ buildResult, step } = buildErrors(
132161
132370
  state,
132162
132371
  projectPath,
132163
- program,
132164
- config,
132165
132372
  declDiagnostics,
132166
132373
  32 /* DeclarationEmitErrors */,
132167
132374
  "Declaration file"
@@ -132224,8 +132431,6 @@ function createBuildOrUpdateInvalidedProject(state, project, projectPath, projec
132224
132431
  ({ buildResult, step } = buildErrors(
132225
132432
  state,
132226
132433
  projectPath,
132227
- program,
132228
- config,
132229
132434
  emitDiagnostics,
132230
132435
  64 /* EmitErrors */,
132231
132436
  "Emit"
@@ -132405,13 +132610,10 @@ function afterProgramDone(state, program) {
132405
132610
  }
132406
132611
  state.projectCompilerOptions = state.baseCompilerOptions;
132407
132612
  }
132408
- function buildErrors(state, resolvedPath, program, config, diagnostics, buildResult, errorType) {
132409
- const canEmitBuildInfo = program && !program.getCompilerOptions().outFile;
132613
+ function buildErrors(state, resolvedPath, diagnostics, buildResult, errorType) {
132410
132614
  reportAndStoreErrors(state, resolvedPath, diagnostics);
132411
132615
  state.projectStatus.set(resolvedPath, { type: 0 /* Unbuildable */, reason: `${errorType} errors` });
132412
- if (canEmitBuildInfo) return { buildResult, step: 4 /* EmitBuildInfo */ };
132413
- afterProgramDone(state, program);
132414
- return { buildResult, step: 5 /* QueueReferencingProjects */ };
132616
+ return { buildResult, step: 4 /* EmitBuildInfo */ };
132415
132617
  }
132416
132618
  function isFileWatcherWithModifiedTime(value) {
132417
132619
  return !!value.watcher;
@@ -132586,7 +132788,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132586
132788
  };
132587
132789
  }
132588
132790
  if (buildInfo.program) {
132589
- if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
132791
+ if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) || buildInfo.program.pendingEmit !== void 0 : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
132590
132792
  return {
132591
132793
  type: 7 /* OutOfDateBuildInfo */,
132592
132794
  buildInfoFile: buildInfoPath
@@ -134759,7 +134961,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
134759
134961
  expression,
134760
134962
  /*includeBigInt*/
134761
134963
  false
134762
- )) {
134964
+ ) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
134763
134965
  context.tracker.reportInferenceFallback(prop.name);
134764
134966
  result = false;
134765
134967
  }
@@ -136867,12 +137069,12 @@ function isInReferenceCommentWorker(sourceFile, position, shouldBeReference) {
136867
137069
  );
136868
137070
  return !!range && shouldBeReference === tripleSlashDirectivePrefixRegex.test(sourceFile.text.substring(range.pos, range.end));
136869
137071
  }
136870
- function getReplacementSpanForContextToken(contextToken) {
137072
+ function getReplacementSpanForContextToken(contextToken, position) {
136871
137073
  if (!contextToken) return void 0;
136872
137074
  switch (contextToken.kind) {
136873
137075
  case 11 /* StringLiteral */:
136874
137076
  case 15 /* NoSubstitutionTemplateLiteral */:
136875
- return createTextSpanFromStringLiteralLikeContent(contextToken);
137077
+ return createTextSpanFromStringLiteralLikeContent(contextToken, position);
136876
137078
  default:
136877
137079
  return createTextSpanFromNode(contextToken);
136878
137080
  }
@@ -136880,11 +137082,11 @@ function getReplacementSpanForContextToken(contextToken) {
136880
137082
  function createTextSpanFromNode(node, sourceFile, endNode2) {
136881
137083
  return createTextSpanFromBounds(node.getStart(sourceFile), (endNode2 || node).getEnd());
136882
137084
  }
136883
- function createTextSpanFromStringLiteralLikeContent(node) {
137085
+ function createTextSpanFromStringLiteralLikeContent(node, position) {
136884
137086
  let replacementEnd = node.getEnd() - 1;
136885
137087
  if (node.isUnterminated) {
136886
137088
  if (node.getStart() === replacementEnd) return void 0;
136887
- replacementEnd = node.getEnd();
137089
+ replacementEnd = Math.min(position, node.getEnd());
136888
137090
  }
136889
137091
  return createTextSpanFromBounds(node.getStart() + 1, replacementEnd);
136890
137092
  }
@@ -142997,9 +143199,9 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
142997
143199
  const namespaceImportName = namespaceNameConflicts ? getUniqueName(preferredName, sourceFile) : preferredName;
142998
143200
  const neededNamedImports = /* @__PURE__ */ new Set();
142999
143201
  for (const element of toConvert.elements) {
143000
- const propertyName = (element.propertyName || element.name).text;
143202
+ const propertyName = element.propertyName || element.name;
143001
143203
  ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, (id) => {
143002
- const access = factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), propertyName);
143204
+ const access = propertyName.kind === 11 /* StringLiteral */ ? factory.createElementAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName)) : factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName));
143003
143205
  if (isShorthandPropertyAssignment(id.parent)) {
143004
143206
  changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access));
143005
143207
  } else if (isExportSpecifier(id.parent)) {
@@ -143015,7 +143217,7 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
143015
143217
  shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))
143016
143218
  );
143017
143219
  if (neededNamedImports.size && isImportDeclaration(importDecl)) {
143018
- const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.createIdentifier(element.propertyName.text), factory.createIdentifier(element.name.text)));
143220
+ const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.cloneNode(element.propertyName), factory.cloneNode(element.name)));
143019
143221
  changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport(
143020
143222
  importDecl,
143021
143223
  /*defaultImportName*/
@@ -158687,6 +158889,7 @@ function withContext(context, typePrintMode, cb) {
158687
158889
  textChanges: changeTracker.getChanges()
158688
158890
  };
158689
158891
  function addTypeAnnotation(span) {
158892
+ context.cancellationToken.throwIfCancellationRequested();
158690
158893
  const nodeWithDiag = getTokenAtPosition(sourceFile, span.start);
158691
158894
  const expandoFunction = findExpandoFunction(nodeWithDiag);
158692
158895
  if (expandoFunction) {
@@ -158758,6 +158961,7 @@ function withContext(context, typePrintMode, cb) {
158758
158961
  return factory.createAsExpression(factory.createSatisfiesExpression(node, getSynthesizedDeepClone(type)), type);
158759
158962
  }
158760
158963
  function addInlineAssertion(span) {
158964
+ context.cancellationToken.throwIfCancellationRequested();
158761
158965
  const nodeWithDiag = getTokenAtPosition(sourceFile, span.start);
158762
158966
  const expandoFunction = findExpandoFunction(nodeWithDiag);
158763
158967
  if (expandoFunction) return;
@@ -158815,6 +159019,7 @@ function withContext(context, typePrintMode, cb) {
158815
159019
  return [Diagnostics.Add_satisfies_and_an_inline_type_assertion_with_0, typeToStringForDiag(typeNode)];
158816
159020
  }
158817
159021
  function extractAsVariable(span) {
159022
+ context.cancellationToken.throwIfCancellationRequested();
158818
159023
  const nodeWithDiag = getTokenAtPosition(sourceFile, span.start);
158819
159024
  const targetNode = findBestFittingNode(nodeWithDiag, span);
158820
159025
  if (!targetNode || isValueSignatureDeclaration(targetNode) || isValueSignatureDeclaration(targetNode.parent)) return;
@@ -163311,7 +163516,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163311
163516
  var _a, _b;
163312
163517
  let insertText;
163313
163518
  let filterText;
163314
- let replacementSpan = getReplacementSpanForContextToken(replacementToken);
163519
+ let replacementSpan = getReplacementSpanForContextToken(replacementToken, position);
163315
163520
  let data;
163316
163521
  let isSnippet;
163317
163522
  let source = getSourceFromOrigin(origin);
@@ -163428,10 +163633,18 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163428
163633
  hasAction = !importStatementCompletion;
163429
163634
  }
163430
163635
  const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
163431
- if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) {
163432
- const possibleToken = stringToToken(name);
163433
- if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
163434
- insertText = `${name} as ${name}_`;
163636
+ if (parentNamedImportOrExport) {
163637
+ const languageVersion = getEmitScriptTarget(host.getCompilationSettings());
163638
+ if (!isIdentifierText(name, languageVersion)) {
163639
+ insertText = JSON.stringify(name);
163640
+ if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
163641
+ insertText += " as " + generateIdentifierForArbitraryString(name, languageVersion);
163642
+ }
163643
+ } else if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
163644
+ const possibleToken = stringToToken(name);
163645
+ if (possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
163646
+ insertText = `${name} as ${name}_`;
163647
+ }
163435
163648
  }
163436
163649
  }
163437
163650
  return {
@@ -163454,6 +163667,23 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163454
163667
  ...includeSymbol ? { symbol } : void 0
163455
163668
  };
163456
163669
  }
163670
+ function generateIdentifierForArbitraryString(text, languageVersion) {
163671
+ let needsUnderscore = false;
163672
+ let identifier = "";
163673
+ let ch;
163674
+ for (let i = 0; i < text.length; i += ch !== void 0 && ch >= 65536 ? 2 : 1) {
163675
+ ch = text.codePointAt(i);
163676
+ if (ch !== void 0 && (i === 0 ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
163677
+ if (needsUnderscore) identifier += "_";
163678
+ identifier += String.fromCodePoint(ch);
163679
+ needsUnderscore = false;
163680
+ } else {
163681
+ needsUnderscore = true;
163682
+ }
163683
+ }
163684
+ if (needsUnderscore) identifier += "_";
163685
+ return identifier || "_";
163686
+ }
163457
163687
  function isClassLikeMemberCompletion(symbol, location, sourceFile) {
163458
163688
  if (isInJSFile(location)) {
163459
163689
  return false;
@@ -165285,7 +165515,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
165285
165515
  completionKind = 3 /* MemberLike */;
165286
165516
  isNewIdentifierLocation = false;
165287
165517
  const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
165288
- const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => (n.propertyName || n.name).escapedText));
165518
+ const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
165289
165519
  const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
165290
165520
  symbols = concatenate(symbols, uniques);
165291
165521
  if (!uniques.length) {
@@ -165776,6 +166006,9 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
165776
166006
  if (isIdentifierText(name, target, jsxIdentifierExpected ? 1 /* JSX */ : 0 /* Standard */) || symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
165777
166007
  return validNameResult;
165778
166008
  }
166009
+ if (symbol.flags & 2097152 /* Alias */) {
166010
+ return { name, needsConvertPropertyAccess: true };
166011
+ }
165779
166012
  switch (kind) {
165780
166013
  case 3 /* MemberLike */:
165781
166014
  return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
@@ -166305,7 +166538,7 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
166305
166538
  if (completion === void 0) {
166306
166539
  return void 0;
166307
166540
  }
166308
- const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken);
166541
+ const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken, position);
166309
166542
  switch (completion.kind) {
166310
166543
  case 0 /* Paths */:
166311
166544
  return convertPathCompletions(completion.paths);
@@ -166359,7 +166592,7 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
166359
166592
  kindModifiers: "" /* none */,
166360
166593
  kind: "string" /* string */,
166361
166594
  sortText: SortText.LocationPriority,
166362
- replacementSpan: getReplacementSpanForContextToken(contextToken)
166595
+ replacementSpan: getReplacementSpanForContextToken(contextToken, position)
166363
166596
  }));
166364
166597
  return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan, entries };
166365
166598
  }
@@ -166471,6 +166704,21 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
166471
166704
  }
166472
166705
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
166473
166706
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
166707
+ case 276 /* ImportSpecifier */:
166708
+ case 281 /* ExportSpecifier */:
166709
+ const specifier = parent2;
166710
+ if (specifier.propertyName && node !== specifier.propertyName) {
166711
+ return;
166712
+ }
166713
+ const namedImportsOrExports = specifier.parent;
166714
+ const { moduleSpecifier } = namedImportsOrExports.kind === 275 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent;
166715
+ if (!moduleSpecifier) return;
166716
+ const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier);
166717
+ if (!moduleSpecifierSymbol) return;
166718
+ const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
166719
+ const existing = new Set(namedImportsOrExports.elements.map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
166720
+ const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
166721
+ return { kind: 1 /* Properties */, symbols: uniques, hasIndexSignature: false };
166474
166722
  default:
166475
166723
  return fromContextualType() || fromContextualType(0 /* None */);
166476
166724
  }
@@ -167441,12 +167689,12 @@ function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, c
167441
167689
  }
167442
167690
  for (const element of namedBindings.elements) {
167443
167691
  const { name, propertyName } = element;
167444
- if (!isNameMatch((propertyName || name).escapedText)) {
167692
+ if (!isNameMatch(moduleExportNameTextEscaped(propertyName || name))) {
167445
167693
  continue;
167446
167694
  }
167447
167695
  if (propertyName) {
167448
167696
  singleReferences.push(propertyName);
167449
- if (!isForRename || name.escapedText === exportSymbol.escapedName) {
167697
+ if (!isForRename || moduleExportNameTextEscaped(name) === exportSymbol.escapedName) {
167450
167698
  addSearch(name, checker.getSymbolAtLocation(name));
167451
167699
  }
167452
167700
  } else {
@@ -168704,8 +168952,8 @@ var Core;
168704
168952
  function shouldAddSingleReference(singleRef, state) {
168705
168953
  if (!hasMatchingMeaning(singleRef, state)) return false;
168706
168954
  if (state.options.use !== 2 /* Rename */) return true;
168707
- if (!isIdentifier(singleRef)) return false;
168708
- return !(isImportOrExportSpecifier(singleRef.parent) && singleRef.escapedText === "default" /* Default */);
168955
+ if (!isIdentifier(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false;
168956
+ return !(isImportOrExportSpecifier(singleRef.parent) && moduleExportNameIsDefault(singleRef));
168709
168957
  }
168710
168958
  function searchForImportedSymbol(symbol, state) {
168711
168959
  if (!symbol.declarations) return;
@@ -168867,7 +169115,7 @@ var Core;
168867
169115
  case 15 /* NoSubstitutionTemplateLiteral */:
168868
169116
  case 11 /* StringLiteral */: {
168869
169117
  const str = node;
168870
- return (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node) && str.text.length === searchSymbolName.length;
169118
+ 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));
168871
169119
  }
168872
169120
  case 9 /* NumericLiteral */:
168873
169121
  return isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
@@ -168933,7 +169181,7 @@ var Core;
168933
169181
  return;
168934
169182
  }
168935
169183
  if (isExportSpecifier(parent2)) {
168936
- Debug.assert(referenceLocation.kind === 80 /* Identifier */);
169184
+ Debug.assert(referenceLocation.kind === 80 /* Identifier */ || referenceLocation.kind === 11 /* StringLiteral */);
168937
169185
  getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent2, search, state, addReferencesHere);
168938
169186
  return;
168939
169187
  }
@@ -168983,7 +169231,7 @@ var Core;
168983
169231
  return;
168984
169232
  }
168985
169233
  if (!propertyName) {
168986
- if (!(state.options.use === 2 /* Rename */ && name.escapedText === "default" /* Default */)) {
169234
+ if (!(state.options.use === 2 /* Rename */ && moduleExportNameIsDefault(name))) {
168987
169235
  addRef();
168988
169236
  }
168989
169237
  } else if (referenceLocation === propertyName) {
@@ -168999,7 +169247,7 @@ var Core;
168999
169247
  }
169000
169248
  }
169001
169249
  if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
169002
- const isDefaultExport = referenceLocation.escapedText === "default" || exportSpecifier.name.escapedText === "default";
169250
+ const isDefaultExport = moduleExportNameIsDefault(referenceLocation) || moduleExportNameIsDefault(exportSpecifier.name);
169003
169251
  const exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
169004
169252
  const exportSymbol = Debug.checkDefined(exportSpecifier.symbol);
169005
169253
  const exportInfo = getExportInfo(exportSymbol, exportKind, state.checker);
@@ -169956,7 +170204,7 @@ function getSymbol(node, checker, stopAtAlias) {
169956
170204
  return { symbol, failedAliasResolution };
169957
170205
  }
169958
170206
  function shouldSkipAlias(node, declaration) {
169959
- if (node.kind !== 80 /* Identifier */) {
170207
+ if (node.kind !== 80 /* Identifier */ && (node.kind !== 11 /* StringLiteral */ || !isImportOrExportSpecifier(node.parent))) {
169960
170208
  return false;
169961
170209
  }
169962
170210
  if (node.parent === declaration) {
@@ -171969,7 +172217,7 @@ function hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier) {
171969
172217
  return isString(moduleSpecifierText) && some(sourceFile.moduleAugmentations, (moduleName) => isStringLiteral(moduleName) && moduleName.text === moduleSpecifierText);
171970
172218
  }
171971
172219
  function getNewImportSpecifiers(namedImports) {
171972
- return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && importSpecifier.name.escapedText === importSpecifier.propertyName.escapedText ? factory.updateImportSpecifier(
172220
+ return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && moduleExportNameTextEscaped(importSpecifier.name) === moduleExportNameTextEscaped(importSpecifier.propertyName) ? factory.updateImportSpecifier(
171973
172221
  importSpecifier,
171974
172222
  importSpecifier.isTypeOnly,
171975
172223
  /*propertyName*/
@@ -178470,7 +178718,7 @@ __export(ts_exports2, {
178470
178718
  changeFullExtension: () => changeFullExtension,
178471
178719
  changesAffectModuleResolution: () => changesAffectModuleResolution,
178472
178720
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
178473
- characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
178721
+ characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
178474
178722
  childIsDecorated: () => childIsDecorated,
178475
178723
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
178476
178724
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -179805,6 +180053,7 @@ __export(ts_exports2, {
179805
180053
  isModuleBlock: () => isModuleBlock,
179806
180054
  isModuleBody: () => isModuleBody,
179807
180055
  isModuleDeclaration: () => isModuleDeclaration,
180056
+ isModuleExportName: () => isModuleExportName,
179808
180057
  isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
179809
180058
  isModuleIdentifier: () => isModuleIdentifier,
179810
180059
  isModuleName: () => isModuleName,
@@ -180122,6 +180371,9 @@ __export(ts_exports2, {
180122
180371
  missingFileModifiedTime: () => missingFileModifiedTime,
180123
180372
  modifierToFlag: () => modifierToFlag,
180124
180373
  modifiersToFlags: () => modifiersToFlags,
180374
+ moduleExportNameIsDefault: () => moduleExportNameIsDefault,
180375
+ moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
180376
+ moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
180125
180377
  moduleOptionDeclaration: () => moduleOptionDeclaration,
180126
180378
  moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
180127
180379
  moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
@@ -180267,7 +180519,7 @@ __export(ts_exports2, {
180267
180519
  reducePathComponents: () => reducePathComponents,
180268
180520
  refactor: () => ts_refactor_exports,
180269
180521
  regExpEscape: () => regExpEscape,
180270
- regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
180522
+ regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
180271
180523
  relativeComplement: () => relativeComplement,
180272
180524
  removeAllComments: () => removeAllComments,
180273
180525
  removeEmitHelper: () => removeEmitHelper,
@@ -192902,7 +193154,7 @@ if (typeof console !== "undefined") {
192902
193154
  changeFullExtension,
192903
193155
  changesAffectModuleResolution,
192904
193156
  changesAffectingProgramStructure,
192905
- characterToRegularExpressionFlag,
193157
+ characterCodeToRegularExpressionFlag,
192906
193158
  childIsDecorated,
192907
193159
  classElementOrClassElementParameterIsDecorated,
192908
193160
  classHasClassThisAssignment,
@@ -194237,6 +194489,7 @@ if (typeof console !== "undefined") {
194237
194489
  isModuleBlock,
194238
194490
  isModuleBody,
194239
194491
  isModuleDeclaration,
194492
+ isModuleExportName,
194240
194493
  isModuleExportsAccessExpression,
194241
194494
  isModuleIdentifier,
194242
194495
  isModuleName,
@@ -194554,6 +194807,9 @@ if (typeof console !== "undefined") {
194554
194807
  missingFileModifiedTime,
194555
194808
  modifierToFlag,
194556
194809
  modifiersToFlags,
194810
+ moduleExportNameIsDefault,
194811
+ moduleExportNameTextEscaped,
194812
+ moduleExportNameTextUnescaped,
194557
194813
  moduleOptionDeclaration,
194558
194814
  moduleResolutionIsEqualTo,
194559
194815
  moduleResolutionNameAndModeGetter,
@@ -194699,7 +194955,7 @@ if (typeof console !== "undefined") {
194699
194955
  reducePathComponents,
194700
194956
  refactor,
194701
194957
  regExpEscape,
194702
- regularExpressionFlagToCharacter,
194958
+ regularExpressionFlagToCharacterCode,
194703
194959
  relativeComplement,
194704
194960
  removeAllComments,
194705
194961
  removeEmitHelper,