@typescript-deploys/pr-build 5.6.0-pr-58760-2 → 5.6.0-pr-58668-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/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,
@@ -377,9 +377,8 @@ __export(typescript_exports, {
377
377
  createBaseNodeFactory: () => createBaseNodeFactory,
378
378
  createBinaryExpressionTrampoline: () => createBinaryExpressionTrampoline,
379
379
  createBindingHelper: () => createBindingHelper,
380
- createBuildInfo: () => createBuildInfo,
381
380
  createBuilderProgram: () => createBuilderProgram,
382
- createBuilderProgramUsingProgramBuildInfo: () => createBuilderProgramUsingProgramBuildInfo,
381
+ createBuilderProgramUsingIncrementalBuildInfo: () => createBuilderProgramUsingIncrementalBuildInfo,
383
382
  createBuilderStatusReporter: () => createBuilderStatusReporter,
384
383
  createCacheWithRedirects: () => createCacheWithRedirects,
385
384
  createCacheableExportInfoMap: () => createCacheableExportInfoMap,
@@ -1263,7 +1262,7 @@ __export(typescript_exports, {
1263
1262
  isBreakStatement: () => isBreakStatement,
1264
1263
  isBuild: () => isBuild,
1265
1264
  isBuildInfoFile: () => isBuildInfoFile,
1266
- isBuilderProgram: () => isBuilderProgram2,
1265
+ isBuilderProgram: () => isBuilderProgram,
1267
1266
  isBundle: () => isBundle,
1268
1267
  isCallChain: () => isCallChain,
1269
1268
  isCallExpression: () => isCallExpression,
@@ -1470,6 +1469,8 @@ __export(typescript_exports, {
1470
1469
  isInTemplateString: () => isInTemplateString,
1471
1470
  isInTopLevelContext: () => isInTopLevelContext,
1472
1471
  isInTypeQuery: () => isInTypeQuery,
1472
+ isIncrementalBuildInfo: () => isIncrementalBuildInfo,
1473
+ isIncrementalBundleEmitBuildInfo: () => isIncrementalBundleEmitBuildInfo,
1473
1474
  isIncrementalCompilation: () => isIncrementalCompilation,
1474
1475
  isIndexSignatureDeclaration: () => isIndexSignatureDeclaration,
1475
1476
  isIndexedAccessTypeNode: () => isIndexedAccessTypeNode,
@@ -1612,6 +1613,7 @@ __export(typescript_exports, {
1612
1613
  isModuleBlock: () => isModuleBlock,
1613
1614
  isModuleBody: () => isModuleBody,
1614
1615
  isModuleDeclaration: () => isModuleDeclaration,
1616
+ isModuleExportName: () => isModuleExportName,
1615
1617
  isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
1616
1618
  isModuleIdentifier: () => isModuleIdentifier,
1617
1619
  isModuleName: () => isModuleName,
@@ -1705,7 +1707,6 @@ __export(typescript_exports, {
1705
1707
  isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
1706
1708
  isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
1707
1709
  isPrivateIdentifierSymbol: () => isPrivateIdentifierSymbol,
1708
- isProgramBundleEmitBuildInfo: () => isProgramBundleEmitBuildInfo,
1709
1710
  isProgramUptoDate: () => isProgramUptoDate,
1710
1711
  isPrologueDirective: () => isPrologueDirective,
1711
1712
  isPropertyAccessChain: () => isPropertyAccessChain,
@@ -1929,6 +1930,9 @@ __export(typescript_exports, {
1929
1930
  missingFileModifiedTime: () => missingFileModifiedTime,
1930
1931
  modifierToFlag: () => modifierToFlag,
1931
1932
  modifiersToFlags: () => modifiersToFlags,
1933
+ moduleExportNameIsDefault: () => moduleExportNameIsDefault,
1934
+ moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
1935
+ moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
1932
1936
  moduleOptionDeclaration: () => moduleOptionDeclaration,
1933
1937
  moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
1934
1938
  moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
@@ -2074,7 +2078,7 @@ __export(typescript_exports, {
2074
2078
  reducePathComponents: () => reducePathComponents,
2075
2079
  refactor: () => ts_refactor_exports,
2076
2080
  regExpEscape: () => regExpEscape,
2077
- regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
2081
+ regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
2078
2082
  relativeComplement: () => relativeComplement,
2079
2083
  removeAllComments: () => removeAllComments,
2080
2084
  removeEmitHelper: () => removeEmitHelper,
@@ -2332,7 +2336,6 @@ __export(typescript_exports, {
2332
2336
  unusedLabelIsError: () => unusedLabelIsError,
2333
2337
  unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
2334
2338
  unwrapParenthesizedExpression: () => unwrapParenthesizedExpression,
2335
- unwrapParenthesizedType: () => unwrapParenthesizedType,
2336
2339
  updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
2337
2340
  updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
2338
2341
  updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
@@ -2372,7 +2375,7 @@ module.exports = __toCommonJS(typescript_exports);
2372
2375
 
2373
2376
  // src/compiler/corePublic.ts
2374
2377
  var versionMajorMinor = "5.6";
2375
- var version = `${versionMajorMinor}.0-insiders.20240603`;
2378
+ var version = `${versionMajorMinor}.0-insiders.20240607`;
2376
2379
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2377
2380
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2378
2381
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -11457,7 +11460,8 @@ var Diagnostics = {
11457
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."),
11458
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."),
11459
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."),
11460
- 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'.")
11461
11465
  };
11462
11466
 
11463
11467
  // src/compiler/scanner.ts
@@ -11617,16 +11621,16 @@ var textToToken = new Map(Object.entries({
11617
11621
  "#": 63 /* HashToken */,
11618
11622
  "`": 62 /* BacktickToken */
11619
11623
  }));
11620
- var charToRegExpFlag = new Map(Object.entries({
11621
- d: 1 /* HasIndices */,
11622
- g: 2 /* Global */,
11623
- i: 4 /* IgnoreCase */,
11624
- m: 8 /* Multiline */,
11625
- s: 16 /* DotAll */,
11626
- u: 32 /* Unicode */,
11627
- v: 64 /* UnicodeSets */,
11628
- y: 128 /* Sticky */
11629
- }));
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
+ ]);
11630
11634
  var regExpFlagToFirstAvailableLanguageVersion = /* @__PURE__ */ new Map([
11631
11635
  [1 /* HasIndices */, 9 /* RegularExpressionFlagsHasIndices */],
11632
11636
  [16 /* DotAll */, 5 /* RegularExpressionFlagsDotAll */],
@@ -11682,12 +11686,12 @@ function tokenToString(t) {
11682
11686
  function stringToToken(s) {
11683
11687
  return textToToken.get(s);
11684
11688
  }
11685
- var regExpFlagChars = makeReverseMap(charToRegExpFlag);
11686
- function regularExpressionFlagToCharacter(f) {
11687
- return regExpFlagChars[f];
11689
+ var regExpFlagCharCodes = makeReverseMap(charCodeToRegExpFlag);
11690
+ function regularExpressionFlagToCharacterCode(f) {
11691
+ return regExpFlagCharCodes[f];
11688
11692
  }
11689
- function characterToRegularExpressionFlag(c) {
11690
- return charToRegExpFlag.get(c);
11693
+ function characterCodeToRegularExpressionFlag(ch) {
11694
+ return charCodeToRegExpFlag.get(ch);
11691
11695
  }
11692
11696
  function computeLineStarts(text) {
11693
11697
  const result = [];
@@ -13403,24 +13407,25 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13403
13407
  pos++;
13404
13408
  let regExpFlags = 0 /* None */;
13405
13409
  while (true) {
13406
- const ch = charCodeChecked(pos);
13410
+ const ch = codePointChecked(pos);
13407
13411
  if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
13408
13412
  break;
13409
13413
  }
13414
+ const size = charSize(ch);
13410
13415
  if (reportErrors2) {
13411
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13416
+ const flag = characterCodeToRegularExpressionFlag(ch);
13412
13417
  if (flag === void 0) {
13413
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13418
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
13414
13419
  } else if (regExpFlags & flag) {
13415
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13420
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, size);
13416
13421
  } else if (((regExpFlags | flag) & 96 /* AnyUnicodeMode */) === 96 /* AnyUnicodeMode */) {
13417
- 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);
13418
13423
  } else {
13419
13424
  regExpFlags |= flag;
13420
- checkRegularExpressionFlagAvailable(flag, pos);
13425
+ checkRegularExpressionFlagAvailability(flag, size);
13421
13426
  }
13422
13427
  }
13423
- pos++;
13428
+ pos += size;
13424
13429
  }
13425
13430
  if (reportErrors2) {
13426
13431
  scanRange(startOfRegExpBody, endOfRegExpBody - startOfRegExpBody, () => {
@@ -13635,22 +13640,23 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13635
13640
  }
13636
13641
  function scanPatternModifiers(currFlags) {
13637
13642
  while (true) {
13638
- const ch = charCodeChecked(pos);
13643
+ const ch = codePointChecked(pos);
13639
13644
  if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
13640
13645
  break;
13641
13646
  }
13642
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13647
+ const size = charSize(ch);
13648
+ const flag = characterCodeToRegularExpressionFlag(ch);
13643
13649
  if (flag === void 0) {
13644
- error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13650
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, size);
13645
13651
  } else if (currFlags & flag) {
13646
- error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13652
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, size);
13647
13653
  } else if (!(flag & 28 /* Modifiers */)) {
13648
- 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);
13649
13655
  } else {
13650
13656
  currFlags |= flag;
13651
- checkRegularExpressionFlagAvailable(flag, pos);
13657
+ checkRegularExpressionFlagAvailability(flag, size);
13652
13658
  }
13653
- pos++;
13659
+ pos += size;
13654
13660
  }
13655
13661
  return currFlags;
13656
13662
  }
@@ -14254,6 +14260,12 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14254
14260
  forEach(groupNameReferences, (reference) => {
14255
14261
  if (!(groupSpecifiers == null ? void 0 : groupSpecifiers.has(reference.name))) {
14256
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
+ }
14257
14269
  }
14258
14270
  });
14259
14271
  forEach(decimalEscapes, (escape) => {
@@ -14266,10 +14278,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14266
14278
  }
14267
14279
  });
14268
14280
  }
14269
- function checkRegularExpressionFlagAvailable(flag, pos2) {
14281
+ function checkRegularExpressionFlagAvailability(flag, size) {
14270
14282
  const availableFrom = regExpFlagToFirstAvailableLanguageVersion.get(flag);
14271
14283
  if (availableFrom && languageVersion < availableFrom) {
14272
- 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));
14273
14285
  }
14274
14286
  }
14275
14287
  function appendIfCommentDirective(commentDirectives2, text2, commentDirectiveRegEx, lineStart) {
@@ -16597,7 +16609,16 @@ function isJSDocTypeExpressionOrChild(node) {
16597
16609
  return !!findAncestor(node, isJSDocTypeExpression);
16598
16610
  }
16599
16611
  function isExportNamespaceAsDefaultDeclaration(node) {
16600
- 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 */;
16601
16622
  }
16602
16623
  function getTextOfNodeFromSourceText(sourceText, node, includeTrivia = false) {
16603
16624
  if (nodeIsMissing(node)) {
@@ -23573,12 +23594,6 @@ function unwrapParenthesizedExpression(o) {
23573
23594
  }
23574
23595
  return o;
23575
23596
  }
23576
- function unwrapParenthesizedType(o) {
23577
- while (o.kind === 196 /* ParenthesizedType */) {
23578
- o = o.type;
23579
- }
23580
- return o;
23581
- }
23582
23597
  function hasInferredType(node) {
23583
23598
  Debug.type(node);
23584
23599
  switch (node.kind) {
@@ -30398,6 +30413,9 @@ function isNamedExports(node) {
30398
30413
  function isExportSpecifier(node) {
30399
30414
  return node.kind === 281 /* ExportSpecifier */;
30400
30415
  }
30416
+ function isModuleExportName(node) {
30417
+ return node.kind === 80 /* Identifier */ || node.kind === 11 /* StringLiteral */;
30418
+ }
30401
30419
  function isMissingDeclaration(node) {
30402
30420
  return node.kind === 282 /* MissingDeclaration */;
30403
30421
  }
@@ -31143,6 +31161,9 @@ function getLocalNameForExternalImport(factory2, node, sourceFile) {
31143
31161
  const namespaceDeclaration = getNamespaceDeclarationNode(node);
31144
31162
  if (namespaceDeclaration && !isDefaultImport(node) && !isExportNamespaceAsDefaultDeclaration(node)) {
31145
31163
  const name = namespaceDeclaration.name;
31164
+ if (name.kind === 11 /* StringLiteral */) {
31165
+ return factory2.getGeneratedNameForNode(node);
31166
+ }
31146
31167
  return isGeneratedIdentifier(name) ? name : factory2.createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, name) || idText(name));
31147
31168
  }
31148
31169
  if (node.kind === 272 /* ImportDeclaration */ && node.importClause) {
@@ -33505,6 +33526,9 @@ var Parser;
33505
33526
  if (token() === 161 /* FromKeyword */ && lookAhead(nextTokenIsStringLiteral)) {
33506
33527
  return false;
33507
33528
  }
33529
+ if (token() === 11 /* StringLiteral */) {
33530
+ return true;
33531
+ }
33508
33532
  return tokenIsIdentifierOrKeyword(token());
33509
33533
  case 13 /* JsxAttributes */:
33510
33534
  return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */;
@@ -37953,6 +37977,12 @@ var Parser;
37953
37977
  const name = parseIdentifier();
37954
37978
  return finishNode(factory2.createNamespaceImport(name), pos);
37955
37979
  }
37980
+ function canParseModuleExportName() {
37981
+ return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */;
37982
+ }
37983
+ function parseModuleExportName(parseName) {
37984
+ return token() === 11 /* StringLiteral */ ? parseLiteralNode() : parseName();
37985
+ }
37956
37986
  function parseNamedImportsOrExports(kind) {
37957
37987
  const pos = getNodePos();
37958
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 */));
@@ -37973,42 +38003,51 @@ var Parser;
37973
38003
  let isTypeOnly = false;
37974
38004
  let propertyName;
37975
38005
  let canParseAsKeyword = true;
37976
- let name = parseIdentifierName();
37977
- if (name.escapedText === "type") {
38006
+ let name = parseModuleExportName(parseIdentifierName);
38007
+ if (name.kind === 80 /* Identifier */ && name.escapedText === "type") {
37978
38008
  if (token() === 130 /* AsKeyword */) {
37979
38009
  const firstAs = parseIdentifierName();
37980
38010
  if (token() === 130 /* AsKeyword */) {
37981
38011
  const secondAs = parseIdentifierName();
37982
- if (tokenIsIdentifierOrKeyword(token())) {
38012
+ if (canParseModuleExportName()) {
37983
38013
  isTypeOnly = true;
37984
38014
  propertyName = firstAs;
37985
- name = parseNameWithKeywordCheck();
38015
+ name = parseModuleExportName(parseNameWithKeywordCheck);
37986
38016
  canParseAsKeyword = false;
37987
38017
  } else {
37988
38018
  propertyName = name;
37989
38019
  name = secondAs;
37990
38020
  canParseAsKeyword = false;
37991
38021
  }
37992
- } else if (tokenIsIdentifierOrKeyword(token())) {
38022
+ } else if (canParseModuleExportName()) {
37993
38023
  propertyName = name;
37994
38024
  canParseAsKeyword = false;
37995
- name = parseNameWithKeywordCheck();
38025
+ name = parseModuleExportName(parseNameWithKeywordCheck);
37996
38026
  } else {
37997
38027
  isTypeOnly = true;
37998
38028
  name = firstAs;
37999
38029
  }
38000
- } else if (tokenIsIdentifierOrKeyword(token())) {
38030
+ } else if (canParseModuleExportName()) {
38001
38031
  isTypeOnly = true;
38002
- name = parseNameWithKeywordCheck();
38032
+ name = parseModuleExportName(parseNameWithKeywordCheck);
38003
38033
  }
38004
38034
  }
38005
38035
  if (canParseAsKeyword && token() === 130 /* AsKeyword */) {
38006
38036
  propertyName = name;
38007
38037
  parseExpected(130 /* AsKeyword */);
38008
- name = parseNameWithKeywordCheck();
38038
+ name = parseModuleExportName(parseNameWithKeywordCheck);
38009
38039
  }
38010
- if (kind === 276 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
38011
- 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
+ }
38012
38051
  }
38013
38052
  const node = kind === 276 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name);
38014
38053
  return finishNode(node, pos);
@@ -38020,7 +38059,7 @@ var Parser;
38020
38059
  }
38021
38060
  }
38022
38061
  function parseNamespaceExport(pos) {
38023
- return finishNode(factory2.createNamespaceExport(parseIdentifierName()), pos);
38062
+ return finishNode(factory2.createNamespaceExport(parseModuleExportName(parseIdentifierName)), pos);
38024
38063
  }
38025
38064
  function parseExportDeclaration(pos, hasJSDoc, modifiers) {
38026
38065
  const savedAwaitContext = inAwaitContext();
@@ -45781,6 +45820,9 @@ function getModuleInstanceStateWorker(node, visited) {
45781
45820
  }
45782
45821
  function getModuleInstanceStateForAliasTarget(specifier, visited) {
45783
45822
  const name = specifier.propertyName || specifier.name;
45823
+ if (name.kind !== 80 /* Identifier */) {
45824
+ return 1 /* Instantiated */;
45825
+ }
45784
45826
  let p = specifier.parent;
45785
45827
  while (p) {
45786
45828
  if (isBlock(p) || isModuleBlock(p) || isSourceFile(p)) {
@@ -46037,7 +46079,7 @@ function createBinder() {
46037
46079
  }
46038
46080
  function declareSymbol(symbolTable, parent3, node, includes, excludes, isReplaceableByMethod, isComputedName) {
46039
46081
  Debug.assert(isComputedName || !hasDynamicName(node));
46040
- const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && node.name.escapedText === "default";
46082
+ const isDefaultExport = hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) && moduleExportNameIsDefault(node.name);
46041
46083
  const name = isComputedName ? "__computed" /* Computed */ : isDefaultExport && parent3 ? "default" /* Default */ : getDeclarationName(node);
46042
46084
  let symbol;
46043
46085
  if (name === void 0) {
@@ -49925,7 +49967,8 @@ function createTypeChecker(host) {
49925
49967
  isUndefinedIdentifierExpression(node) {
49926
49968
  Debug.assert(isExpressionNode(node));
49927
49969
  return getSymbolAtLocation(node) === undefinedSymbol;
49928
- }
49970
+ },
49971
+ isDefinitelyReferenceToGlobalSymbolObject
49929
49972
  });
49930
49973
  var evaluate = createEvaluator({
49931
49974
  evaluateElementAccessExpression,
@@ -50882,6 +50925,21 @@ function createTypeChecker(host) {
50882
50925
  ];
50883
50926
  initializeTypeChecker();
50884
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
+ }
50885
50943
  function getCachedType(key) {
50886
50944
  return key ? cachedTypes.get(key) : void 0;
50887
50945
  }
@@ -51228,6 +51286,8 @@ function createTypeChecker(host) {
51228
51286
  moduleName,
51229
51287
  moduleName,
51230
51288
  moduleNotFoundError,
51289
+ /*ignoreErrors*/
51290
+ false,
51231
51291
  /*isForAugmentation*/
51232
51292
  true
51233
51293
  );
@@ -51910,7 +51970,7 @@ function createTypeChecker(host) {
51910
51970
  const isExport = typeOnlyDeclaration.kind === 281 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 278 /* ExportDeclaration */;
51911
51971
  const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type;
51912
51972
  const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here;
51913
- const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText);
51973
+ const name = typeOnlyDeclaration.kind === 278 /* ExportDeclaration */ ? "*" : moduleExportNameTextUnescaped(typeOnlyDeclaration.name);
51914
51974
  addRelatedInfo(error2(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name));
51915
51975
  }
51916
51976
  }
@@ -52154,12 +52214,12 @@ function createTypeChecker(host) {
52154
52214
  if (valueSymbol.exports) result.exports = new Map(valueSymbol.exports);
52155
52215
  return result;
52156
52216
  }
52157
- function getExportOfModule(symbol, name, specifier, dontResolveAlias) {
52217
+ function getExportOfModule(symbol, nameText, specifier, dontResolveAlias) {
52158
52218
  var _a;
52159
52219
  if (symbol.flags & 1536 /* Module */) {
52160
- const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText);
52220
+ const exportSymbol = getExportsOfSymbol(symbol).get(nameText);
52161
52221
  const resolved = resolveSymbol(exportSymbol, dontResolveAlias);
52162
- const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(name.escapedText);
52222
+ const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(nameText);
52163
52223
  markSymbolOfAliasDeclarationIfTypeOnly(
52164
52224
  specifier,
52165
52225
  exportSymbol,
@@ -52167,7 +52227,7 @@ function createTypeChecker(host) {
52167
52227
  /*overwriteEmpty*/
52168
52228
  false,
52169
52229
  exportStarDeclaration,
52170
- name.escapedText
52230
+ nameText
52171
52231
  );
52172
52232
  return resolved;
52173
52233
  }
@@ -52185,10 +52245,11 @@ function createTypeChecker(host) {
52185
52245
  const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier;
52186
52246
  const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier);
52187
52247
  const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name;
52188
- if (!isIdentifier(name)) {
52248
+ if (!isIdentifier(name) && name.kind !== 11 /* StringLiteral */) {
52189
52249
  return void 0;
52190
52250
  }
52191
- const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
52251
+ const nameText = moduleExportNameTextEscaped(name);
52252
+ const suppressInteropError = nameText === "default" /* Default */ && allowSyntheticDefaultImports;
52192
52253
  const targetSymbol = resolveESModuleSymbol(
52193
52254
  moduleSymbol,
52194
52255
  moduleSpecifier,
@@ -52197,7 +52258,7 @@ function createTypeChecker(host) {
52197
52258
  suppressInteropError
52198
52259
  );
52199
52260
  if (targetSymbol) {
52200
- if (name.escapedText) {
52261
+ if (nameText || name.kind === 11 /* StringLiteral */) {
52201
52262
  if (isShorthandAmbientModuleSymbol(moduleSymbol)) {
52202
52263
  return moduleSymbol;
52203
52264
  }
@@ -52205,16 +52266,16 @@ function createTypeChecker(host) {
52205
52266
  if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=" /* ExportEquals */)) {
52206
52267
  symbolFromVariable = getPropertyOfType(
52207
52268
  getTypeOfSymbol(targetSymbol),
52208
- name.escapedText,
52269
+ nameText,
52209
52270
  /*skipObjectFunctionPropertyAugment*/
52210
52271
  true
52211
52272
  );
52212
52273
  } else {
52213
- symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText);
52274
+ symbolFromVariable = getPropertyOfVariable(targetSymbol, nameText);
52214
52275
  }
52215
52276
  symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias);
52216
- let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
52217
- if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) {
52277
+ let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
52278
+ if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
52218
52279
  const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
52219
52280
  if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52220
52281
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -52232,7 +52293,7 @@ function createTypeChecker(host) {
52232
52293
  var _a;
52233
52294
  const moduleName = getFullyQualifiedName(moduleSymbol, node);
52234
52295
  const declarationName = declarationNameToString(name);
52235
- const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol);
52296
+ const suggestion = isIdentifier(name) ? getSuggestedSymbolForNonexistentModule(name, targetSymbol) : void 0;
52236
52297
  if (suggestion !== void 0) {
52237
52298
  const suggestionName = symbolToString(suggestion);
52238
52299
  const diagnostic = error2(name, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, moduleName, declarationName, suggestionName);
@@ -52254,7 +52315,7 @@ function createTypeChecker(host) {
52254
52315
  }
52255
52316
  function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) {
52256
52317
  var _a, _b;
52257
- const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name.escapedText);
52318
+ const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(moduleExportNameTextEscaped(name));
52258
52319
  const exports2 = moduleSymbol.exports;
52259
52320
  if (localSymbol) {
52260
52321
  const exportedEqualsSymbol = exports2 == null ? void 0 : exports2.get("export=" /* ExportEquals */);
@@ -52286,7 +52347,7 @@ function createTypeChecker(host) {
52286
52347
  }
52287
52348
  }
52288
52349
  function getTargetOfImportSpecifier(node, dontResolveAlias) {
52289
- if (isImportSpecifier(node) && idText(node.propertyName || node.name) === "default" /* Default */) {
52350
+ if (isImportSpecifier(node) && moduleExportNameIsDefault(node.propertyName || node.name)) {
52290
52351
  const specifier = getModuleSpecifierForImportOrExport(node);
52291
52352
  const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
52292
52353
  if (moduleSymbol) {
@@ -52330,19 +52391,23 @@ function createTypeChecker(host) {
52330
52391
  }
52331
52392
  }
52332
52393
  function getTargetOfExportSpecifier(node, meaning, dontResolveAlias) {
52333
- if (idText(node.propertyName || node.name) === "default" /* Default */) {
52394
+ const name = node.propertyName || node.name;
52395
+ if (moduleExportNameIsDefault(name)) {
52334
52396
  const specifier = getModuleSpecifierForImportOrExport(node);
52335
52397
  const moduleSymbol = specifier && resolveExternalModuleName(node, specifier);
52336
52398
  if (moduleSymbol) {
52337
52399
  return getTargetofModuleDefault(moduleSymbol, node, !!dontResolveAlias);
52338
52400
  }
52339
52401
  }
52340
- const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : resolveEntityName(
52341
- node.propertyName || node.name,
52342
- meaning,
52343
- /*ignoreErrors*/
52344
- false,
52345
- dontResolveAlias
52402
+ const resolved = node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node, dontResolveAlias) : name.kind === 11 /* StringLiteral */ ? void 0 : (
52403
+ // Skip for invalid syntax like this: export { "x" }
52404
+ resolveEntityName(
52405
+ name,
52406
+ meaning,
52407
+ /*ignoreErrors*/
52408
+ false,
52409
+ dontResolveAlias
52410
+ )
52346
52411
  );
52347
52412
  markSymbolOfAliasDeclarationIfTypeOnly(
52348
52413
  node,
@@ -52790,14 +52855,14 @@ function createTypeChecker(host) {
52790
52855
  function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
52791
52856
  const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
52792
52857
  const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
52793
- return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage);
52858
+ return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage, ignoreErrors);
52794
52859
  }
52795
- function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation = false) {
52796
- return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0;
52860
+ function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, ignoreErrors = false, isForAugmentation = false) {
52861
+ return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
52797
52862
  }
52798
52863
  function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) {
52799
52864
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
52800
- if (startsWith(moduleReference, "@types/")) {
52865
+ if (errorNode && startsWith(moduleReference, "@types/")) {
52801
52866
  const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
52802
52867
  const withoutAtTypePrefix = removePrefix(moduleReference, "@types/");
52803
52868
  error2(errorNode, diag2, withoutAtTypePrefix, moduleReference);
@@ -52819,7 +52884,7 @@ function createTypeChecker(host) {
52819
52884
  const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
52820
52885
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
52821
52886
  const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
52822
- const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
52887
+ const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
52823
52888
  const sourceFile = resolvedModule && (!resolutionDiagnostic || resolutionDiagnostic === Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set) && host.getSourceFile(resolvedModule.resolvedFileName);
52824
52889
  if (sourceFile) {
52825
52890
  if (resolutionDiagnostic) {
@@ -52827,7 +52892,7 @@ function createTypeChecker(host) {
52827
52892
  }
52828
52893
  if (resolvedModule.resolvedUsingTsExtension && isDeclarationFileName(moduleReference)) {
52829
52894
  const importOrExport = ((_h = findAncestor(location, isImportDeclaration)) == null ? void 0 : _h.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
52830
- if (importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
52895
+ if (errorNode && importOrExport && !importOrExport.isTypeOnly || findAncestor(location, isImportCall)) {
52831
52896
  error2(
52832
52897
  errorNode,
52833
52898
  Diagnostics.A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead,
@@ -52836,13 +52901,13 @@ function createTypeChecker(host) {
52836
52901
  }
52837
52902
  } else if (resolvedModule.resolvedUsingTsExtension && !shouldAllowImportingTsExtension(compilerOptions, currentSourceFile.fileName)) {
52838
52903
  const importOrExport = ((_i = findAncestor(location, isImportDeclaration)) == null ? void 0 : _i.importClause) || findAncestor(location, or(isImportEqualsDeclaration, isExportDeclaration));
52839
- if (!((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
52904
+ if (errorNode && !((importOrExport == null ? void 0 : importOrExport.isTypeOnly) || findAncestor(location, isImportTypeNode))) {
52840
52905
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
52841
52906
  error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
52842
52907
  }
52843
52908
  }
52844
52909
  if (sourceFile.symbol) {
52845
- if (resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
52910
+ if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
52846
52911
  errorOnImplicitAnyModule(
52847
52912
  /*isError*/
52848
52913
  false,
@@ -52853,7 +52918,7 @@ function createTypeChecker(host) {
52853
52918
  moduleReference
52854
52919
  );
52855
52920
  }
52856
- if (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */) {
52921
+ if (errorNode && (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */)) {
52857
52922
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
52858
52923
  const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l));
52859
52924
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
@@ -52913,7 +52978,7 @@ function createTypeChecker(host) {
52913
52978
  }
52914
52979
  return getMergedSymbol(sourceFile.symbol);
52915
52980
  }
52916
- if (moduleNotFoundError) {
52981
+ if (errorNode && moduleNotFoundError) {
52917
52982
  error2(errorNode, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
52918
52983
  }
52919
52984
  return void 0;
@@ -52928,6 +52993,9 @@ function createTypeChecker(host) {
52928
52993
  return getMergedSymbol(pattern.symbol);
52929
52994
  }
52930
52995
  }
52996
+ if (!errorNode) {
52997
+ return void 0;
52998
+ }
52931
52999
  if (resolvedModule && !resolutionExtensionIsTSOrJson(resolvedModule.extension) && resolutionDiagnostic === void 0 || resolutionDiagnostic === Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type) {
52932
53000
  if (isForAugmentation) {
52933
53001
  const diag2 = Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
@@ -56392,7 +56460,7 @@ function createTypeChecker(host) {
56392
56460
  return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
56393
56461
  }
56394
56462
  function tryVisitSimpleTypeNode(node) {
56395
- const innerNode = unwrapParenthesizedType(node);
56463
+ const innerNode = skipTypeParentheses(node);
56396
56464
  switch (innerNode.kind) {
56397
56465
  case 183 /* TypeReference */:
56398
56466
  return tryVisitTypeReference(innerNode);
@@ -56939,9 +57007,10 @@ function createTypeChecker(host) {
56939
57007
  if (index >= 0) {
56940
57008
  const exportDecl = statements[index];
56941
57009
  const replacements = mapDefined(exportDecl.exportClause.elements, (e) => {
56942
- if (!e.propertyName) {
57010
+ if (!e.propertyName && e.name.kind !== 11 /* StringLiteral */) {
57011
+ const name = e.name;
56943
57012
  const indices = indicesOf(statements);
56944
- const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], e.name));
57013
+ const associatedIndices = filter(indices, (i) => nodeHasName(statements[i], name));
56945
57014
  if (length(associatedIndices) && every(associatedIndices, (i) => canHaveExportModifier(statements[i]))) {
56946
57015
  for (const index2 of associatedIndices) {
56947
57016
  statements[index2] = addExportModifier(statements[index2]);
@@ -57575,7 +57644,7 @@ function createTypeChecker(host) {
57575
57644
  function getSomeTargetNameFromDeclarations(declarations) {
57576
57645
  return firstDefined(declarations, (d) => {
57577
57646
  if (isImportSpecifier(d) || isExportSpecifier(d)) {
57578
- return idText(d.propertyName || d.name);
57647
+ return moduleExportNameTextUnescaped(d.propertyName || d.name);
57579
57648
  }
57580
57649
  if (isBinaryExpression(d) || isExportAssignment(d)) {
57581
57650
  const expression = isExportAssignment(d) ? d.expression : d.right;
@@ -57593,7 +57662,7 @@ function createTypeChecker(host) {
57593
57662
  });
57594
57663
  }
57595
57664
  function serializeAsAlias(symbol, localName, modifierFlags) {
57596
- var _a2, _b, _c, _d, _e, _f;
57665
+ var _a2, _b, _c, _d, _e;
57597
57666
  const node = getDeclarationOfAliasSymbol(symbol);
57598
57667
  if (!node) return Debug.fail();
57599
57668
  const target = getMergedSymbol(getTargetOfAliasDeclaration(
@@ -57791,8 +57860,11 @@ function createTypeChecker(host) {
57791
57860
  }
57792
57861
  case 281 /* ExportSpecifier */:
57793
57862
  const specifier = node.parent.parent.moduleSpecifier;
57794
- if (specifier && ((_f = node.propertyName) == null ? void 0 : _f.escapedText) === "default" /* Default */) {
57795
- verbatimTargetName = "default" /* Default */;
57863
+ if (specifier) {
57864
+ const propertyName = node.propertyName;
57865
+ if (propertyName && moduleExportNameIsDefault(propertyName)) {
57866
+ verbatimTargetName = "default" /* Default */;
57867
+ }
57796
57868
  }
57797
57869
  serializeExportSpecifier(
57798
57870
  unescapeLeadingUnderscores(symbol.escapedName),
@@ -58505,7 +58577,7 @@ function createTypeChecker(host) {
58505
58577
  }
58506
58578
  function collectLinkedAliases(node, setVisibility) {
58507
58579
  let exportSymbol;
58508
- if (node.parent && node.parent.kind === 277 /* ExportAssignment */) {
58580
+ if (node.kind !== 11 /* StringLiteral */ && node.parent && node.parent.kind === 277 /* ExportAssignment */) {
58509
58581
  exportSymbol = resolveName(
58510
58582
  node,
58511
58583
  node,
@@ -74078,9 +74150,10 @@ function createTypeChecker(host) {
74078
74150
  return;
74079
74151
  case 281 /* ExportSpecifier */:
74080
74152
  const exportDeclaration = node.parent.parent;
74081
- if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
74153
+ const name = node.propertyName || node.name;
74154
+ if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier && name.kind !== 11 /* StringLiteral */) {
74082
74155
  const symbol = resolveEntityName(
74083
- node.propertyName || node.name,
74156
+ name,
74084
74157
  111551 /* Value */,
74085
74158
  /*ignoreErrors*/
74086
74159
  true,
@@ -74374,6 +74447,9 @@ function createTypeChecker(host) {
74374
74447
  function markExportSpecifierAliasReferenced(location) {
74375
74448
  if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
74376
74449
  const exportedName = location.propertyName || location.name;
74450
+ if (exportedName.kind === 11 /* StringLiteral */) {
74451
+ return;
74452
+ }
74377
74453
  const symbol = resolveName(
74378
74454
  exportedName,
74379
74455
  exportedName.escapedText,
@@ -74388,7 +74464,7 @@ function createTypeChecker(host) {
74388
74464
  const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
74389
74465
  if (!target || getSymbolFlags(target) & 111551 /* Value */) {
74390
74466
  markExportAsReferenced(location);
74391
- markIdentifierAliasReferenced(location.propertyName || location.name);
74467
+ markIdentifierAliasReferenced(exportedName);
74392
74468
  }
74393
74469
  }
74394
74470
  return;
@@ -87984,6 +88060,16 @@ function createTypeChecker(host) {
87984
88060
  }
87985
88061
  return true;
87986
88062
  }
88063
+ function checkModuleExportName(name, allowStringLiteral = true) {
88064
+ if (name === void 0 || name.kind !== 11 /* StringLiteral */) {
88065
+ return;
88066
+ }
88067
+ if (!allowStringLiteral) {
88068
+ grammarErrorOnNode(name, Diagnostics.Identifier_expected);
88069
+ } else if (moduleKind === 5 /* ES2015 */ || moduleKind === 6 /* ES2020 */) {
88070
+ grammarErrorOnNode(name, Diagnostics.String_literal_import_and_export_names_are_not_supported_when_the_module_flag_is_set_to_es2015_or_es2020);
88071
+ }
88072
+ }
87987
88073
  function checkAliasSymbol(node) {
87988
88074
  var _a, _b, _c, _d;
87989
88075
  let symbol = getSymbolOfDeclaration(node);
@@ -87995,7 +88081,7 @@ function createTypeChecker(host) {
87995
88081
  Debug.assert(node.kind !== 280 /* NamespaceExport */);
87996
88082
  if (node.kind === 281 /* ExportSpecifier */) {
87997
88083
  const diag2 = error2(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files);
87998
- const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText);
88084
+ const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get(moduleExportNameTextEscaped(node.propertyName || node.name));
87999
88085
  if (alreadyExportedSymbol === target) {
88000
88086
  const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode);
88001
88087
  if (exportingDeclaration) {
@@ -88050,7 +88136,7 @@ function createTypeChecker(host) {
88050
88136
  if (compilerOptions.verbatimModuleSyntax) {
88051
88137
  Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name");
88052
88138
  const message = compilerOptions.verbatimModuleSyntax && isInternalModuleImportEqualsDeclaration(node) ? Diagnostics.An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled : isType ? Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled;
88053
- const name = idText(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
88139
+ const name = moduleExportNameTextUnescaped(node.kind === 276 /* ImportSpecifier */ ? node.propertyName || node.name : node.name);
88054
88140
  addTypeOnlyDeclarationRelatedInfo(
88055
88141
  error2(node, message, name),
88056
88142
  isType ? void 0 : typeOnlyAlias,
@@ -88064,7 +88150,7 @@ function createTypeChecker(host) {
88064
88150
  }
88065
88151
  case 281 /* ExportSpecifier */: {
88066
88152
  if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) {
88067
- const name = idText(node.propertyName || node.name);
88153
+ const name = moduleExportNameTextUnescaped(node.propertyName || node.name);
88068
88154
  const diagnostic = isType ? error2(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error2(node, Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled, name, isolatedModulesLikeFlagName);
88069
88155
  addTypeOnlyDeclarationRelatedInfo(diagnostic, isType ? void 0 : typeOnlyAlias, name);
88070
88156
  break;
@@ -88114,8 +88200,11 @@ function createTypeChecker(host) {
88114
88200
  function checkImportBinding(node) {
88115
88201
  checkCollisionsForDeclarationName(node, node.name);
88116
88202
  checkAliasSymbol(node);
88117
- if (node.kind === 276 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88118
- checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88203
+ if (node.kind === 276 /* ImportSpecifier */) {
88204
+ checkModuleExportName(node.propertyName);
88205
+ if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88206
+ checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88207
+ }
88119
88208
  }
88120
88209
  }
88121
88210
  function checkImportAttributes(declaration) {
@@ -88236,6 +88325,7 @@ function createTypeChecker(host) {
88236
88325
  error2(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
88237
88326
  } else if (node.exportClause) {
88238
88327
  checkAliasSymbol(node.exportClause);
88328
+ checkModuleExportName(node.exportClause.name);
88239
88329
  }
88240
88330
  if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88241
88331
  if (node.exportClause) {
@@ -88266,6 +88356,9 @@ function createTypeChecker(host) {
88266
88356
  }
88267
88357
  function checkExportSpecifier(node) {
88268
88358
  checkAliasSymbol(node);
88359
+ const hasModuleSpecifier = node.parent.parent.moduleSpecifier !== void 0;
88360
+ checkModuleExportName(node.propertyName, hasModuleSpecifier);
88361
+ checkModuleExportName(node.name);
88269
88362
  if (getEmitDeclarations(compilerOptions)) {
88270
88363
  collectLinkedAliases(
88271
88364
  node.propertyName || node.name,
@@ -88273,8 +88366,11 @@ function createTypeChecker(host) {
88273
88366
  true
88274
88367
  );
88275
88368
  }
88276
- if (!node.parent.parent.moduleSpecifier) {
88369
+ if (!hasModuleSpecifier) {
88277
88370
  const exportedName = node.propertyName || node.name;
88371
+ if (exportedName.kind === 11 /* StringLiteral */) {
88372
+ return;
88373
+ }
88278
88374
  const symbol = resolveName(
88279
88375
  exportedName,
88280
88376
  exportedName.escapedText,
@@ -88290,7 +88386,7 @@ function createTypeChecker(host) {
88290
88386
  markLinkedReferences(node, 7 /* ExportSpecifier */);
88291
88387
  }
88292
88388
  } else {
88293
- if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
88389
+ if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
88294
88390
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88295
88391
  }
88296
88392
  }
@@ -89445,7 +89541,11 @@ function createTypeChecker(host) {
89445
89541
  }
89446
89542
  function getExportSpecifierLocalTargetSymbol(node) {
89447
89543
  if (isExportSpecifier(node)) {
89448
- return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : resolveEntityName(node.propertyName || node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
89544
+ const name = node.propertyName || node.name;
89545
+ return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : name.kind === 11 /* StringLiteral */ ? void 0 : (
89546
+ // Skip for invalid syntax like this: export { "x" }
89547
+ resolveEntityName(name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)
89548
+ );
89449
89549
  } else {
89450
89550
  return resolveEntityName(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
89451
89551
  }
@@ -90416,7 +90516,8 @@ function createTypeChecker(host) {
90416
90516
  resolveExternalModuleSymbol(sym);
90417
90517
  return !sym.exports ? [] : nodeBuilder.symbolTableToDeclarationStatements(sym.exports, node, flags, tracker);
90418
90518
  },
90419
- isImportRequiredByAugmentation
90519
+ isImportRequiredByAugmentation,
90520
+ isDefinitelyReferenceToGlobalSymbolObject
90420
90521
  };
90421
90522
  function isImportRequiredByAugmentation(node) {
90422
90523
  const file = getSourceFileOfNode(node);
@@ -92255,7 +92356,7 @@ function isDeclarationNameOrImportPropertyName(name) {
92255
92356
  switch (name.parent.kind) {
92256
92357
  case 276 /* ImportSpecifier */:
92257
92358
  case 281 /* ExportSpecifier */:
92258
- return isIdentifier(name);
92359
+ return isIdentifier(name) || name.kind === 11 /* StringLiteral */;
92259
92360
  default:
92260
92361
  return isDeclarationName(name);
92261
92362
  }
@@ -93500,7 +93601,7 @@ var visitEachChildTable = {
93500
93601
  return context.factory.updateImportSpecifier(
93501
93602
  node,
93502
93603
  node.isTypeOnly,
93503
- nodeVisitor(node.propertyName, visitor, isIdentifier),
93604
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
93504
93605
  Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
93505
93606
  );
93506
93607
  },
@@ -93531,8 +93632,8 @@ var visitEachChildTable = {
93531
93632
  return context.factory.updateExportSpecifier(
93532
93633
  node,
93533
93634
  node.isTypeOnly,
93534
- nodeVisitor(node.propertyName, visitor, isIdentifier),
93535
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier))
93635
+ nodeVisitor(node.propertyName, visitor, isModuleExportName),
93636
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isModuleExportName))
93536
93637
  );
93537
93638
  },
93538
93639
  // Module references
@@ -94248,7 +94349,7 @@ function containsDefaultReference(node) {
94248
94349
  return some(node.elements, isNamedDefaultReference);
94249
94350
  }
94250
94351
  function isNamedDefaultReference(e) {
94251
- return e.propertyName !== void 0 ? e.propertyName.escapedText === "default" /* Default */ : e.name.escapedText === "default" /* Default */;
94352
+ return moduleExportNameIsDefault(e.propertyName || e.name);
94252
94353
  }
94253
94354
  function chainBundle(context, transformSourceFile) {
94254
94355
  return transformSourceFileOrBundle;
@@ -94324,9 +94425,10 @@ function collectExternalModuleInfo(context, sourceFile) {
94324
94425
  hasImportDefault || (hasImportDefault = containsDefaultReference(node.exportClause));
94325
94426
  } else {
94326
94427
  const name = node.exportClause.name;
94327
- if (!uniqueExports.get(idText(name))) {
94428
+ const nameText = moduleExportNameTextUnescaped(name);
94429
+ if (!uniqueExports.get(nameText)) {
94328
94430
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
94329
- uniqueExports.set(idText(name), true);
94431
+ uniqueExports.set(nameText, true);
94330
94432
  exportedNames = append(exportedNames, name);
94331
94433
  }
94332
94434
  hasImportStar = true;
@@ -94384,20 +94486,23 @@ function collectExternalModuleInfo(context, sourceFile) {
94384
94486
  return { externalImports, exportSpecifiers, exportEquals, hasExportStarsToExportValues, exportedBindings, exportedNames, exportedFunctions, externalHelpersImportDeclaration };
94385
94487
  function addExportedNamesForExportDeclaration(node) {
94386
94488
  for (const specifier of cast(node.exportClause, isNamedExports).elements) {
94387
- if (!uniqueExports.get(idText(specifier.name))) {
94489
+ const specifierNameText = moduleExportNameTextUnescaped(specifier.name);
94490
+ if (!uniqueExports.get(specifierNameText)) {
94388
94491
  const name = specifier.propertyName || specifier.name;
94389
- if (!node.moduleSpecifier) {
94390
- exportSpecifiers.add(name, specifier);
94391
- }
94392
- const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
94393
- if (decl) {
94394
- if (decl.kind === 262 /* FunctionDeclaration */) {
94395
- addExportedFunctionDeclaration(decl, specifier.name, specifier.name.escapedText === "default" /* Default */);
94396
- continue;
94492
+ if (name.kind !== 11 /* StringLiteral */) {
94493
+ if (!node.moduleSpecifier) {
94494
+ exportSpecifiers.add(name, specifier);
94495
+ }
94496
+ const decl = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
94497
+ if (decl) {
94498
+ if (decl.kind === 262 /* FunctionDeclaration */) {
94499
+ addExportedFunctionDeclaration(decl, specifier.name, moduleExportNameIsDefault(specifier.name));
94500
+ continue;
94501
+ }
94502
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
94397
94503
  }
94398
- multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name);
94399
94504
  }
94400
- uniqueExports.set(idText(specifier.name), true);
94505
+ uniqueExports.set(specifierNameText, true);
94401
94506
  exportedNames = append(exportedNames, specifier.name);
94402
94507
  }
94403
94508
  }
@@ -94411,9 +94516,10 @@ function collectExternalModuleInfo(context, sourceFile) {
94411
94516
  }
94412
94517
  } else {
94413
94518
  name ?? (name = node.name);
94414
- if (!uniqueExports.get(idText(name))) {
94519
+ const nameText = moduleExportNameTextUnescaped(name);
94520
+ if (!uniqueExports.get(nameText)) {
94415
94521
  multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name);
94416
- uniqueExports.set(idText(name), true);
94522
+ uniqueExports.set(nameText, true);
94417
94523
  }
94418
94524
  }
94419
94525
  }
@@ -111700,7 +111806,7 @@ function transformModule(context) {
111700
111806
  factory2.createExpressionStatement(
111701
111807
  reduceLeft(
111702
111808
  currentModuleInfo.exportedNames.slice(i, i + chunkSize),
111703
- (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
111809
+ (prev, nextId) => nextId.kind === 11 /* StringLiteral */ ? factory2.createAssignment(factory2.createElementAccessExpression(factory2.createIdentifier("exports"), factory2.createStringLiteral(nextId.text)), prev) : factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev),
111704
111810
  factory2.createVoidZero()
111705
111811
  )
111706
111812
  )
@@ -112023,7 +112129,10 @@ function transformModule(context) {
112023
112129
  append(statements, createUnderscoreUnderscoreESModule());
112024
112130
  }
112025
112131
  if (some(currentModuleInfo.exportedNames)) {
112026
- append(statements, factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero())));
112132
+ append(
112133
+ statements,
112134
+ factory2.createExpressionStatement(reduceLeft(currentModuleInfo.exportedNames, (prev, nextId) => nextId.kind === 11 /* StringLiteral */ ? factory2.createAssignment(factory2.createElementAccessExpression(factory2.createIdentifier("exports"), factory2.createStringLiteral(nextId.text)), prev) : factory2.createAssignment(factory2.createPropertyAccessExpression(factory2.createIdentifier("exports"), factory2.createIdentifier(idText(nextId))), prev), factory2.createVoidZero()))
112135
+ );
112027
112136
  }
112028
112137
  for (const f of currentModuleInfo.exportedFunctions) {
112029
112138
  appendExportsOfHoistedDeclaration(statements, f);
@@ -112894,17 +113003,16 @@ function transformModule(context) {
112894
113003
  );
112895
113004
  }
112896
113005
  for (const specifier of node.exportClause.elements) {
112897
- const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && idText(specifier.propertyName || specifier.name) === "default";
112898
- const exportedValue = factory2.createPropertyAccessExpression(
112899
- exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName,
112900
- specifier.propertyName || specifier.name
112901
- );
113006
+ const specifierName = specifier.propertyName || specifier.name;
113007
+ const exportNeedsImportDefault = !!getESModuleInterop(compilerOptions) && !(getInternalEmitFlags(node) & 2 /* NeverApplyImportHelper */) && moduleExportNameIsDefault(specifierName);
113008
+ const target = exportNeedsImportDefault ? emitHelpers().createImportDefaultHelper(generatedName) : generatedName;
113009
+ const exportedValue = specifierName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, specifierName) : factory2.createPropertyAccessExpression(target, specifierName);
112902
113010
  statements.push(
112903
113011
  setOriginalNode(
112904
113012
  setTextRange(
112905
113013
  factory2.createExpressionStatement(
112906
113014
  createExportExpression(
112907
- factory2.getExportName(specifier),
113015
+ specifier.name.kind === 11 /* StringLiteral */ ? factory2.cloneNode(specifier.name) : factory2.getExportName(specifier),
112908
113016
  exportedValue,
112909
113017
  /*location*/
112910
113018
  void 0,
@@ -112929,7 +113037,7 @@ function transformModule(context) {
112929
113037
  factory2.cloneNode(node.exportClause.name),
112930
113038
  getHelperExpressionForExport(
112931
113039
  node,
112932
- moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
113040
+ moduleKind !== 2 /* AMD */ ? createRequireCall2(node) : isExportNamespaceAsDefaultDeclaration(node) ? generatedName : node.exportClause.name.kind === 11 /* StringLiteral */ ? generatedName : factory2.createIdentifier(idText(node.exportClause.name))
112933
113041
  )
112934
113042
  )
112935
113043
  ),
@@ -113259,10 +113367,13 @@ function transformModule(context) {
113259
113367
  return statements;
113260
113368
  }
113261
113369
  function appendExportStatement(statements, seen, exportName, expression, location, allowComments, liveBinding) {
113262
- if (!seen.has(exportName)) {
113370
+ if (exportName.kind !== 11 /* StringLiteral */) {
113371
+ if (seen.has(exportName)) {
113372
+ return statements;
113373
+ }
113263
113374
  seen.set(exportName, true);
113264
- statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
113265
113375
  }
113376
+ statements = append(statements, createExportStatement(exportName, expression, location, allowComments, liveBinding));
113266
113377
  return statements;
113267
113378
  }
113268
113379
  function createUnderscoreUnderscoreESModule() {
@@ -113332,7 +113443,10 @@ function transformModule(context) {
113332
113443
  ])
113333
113444
  ]
113334
113445
  ) : factory2.createAssignment(
113335
- factory2.createPropertyAccessExpression(
113446
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(
113447
+ factory2.createIdentifier("exports"),
113448
+ factory2.cloneNode(name)
113449
+ ) : factory2.createPropertyAccessExpression(
113336
113450
  factory2.createIdentifier("exports"),
113337
113451
  factory2.cloneNode(name)
113338
113452
  ),
@@ -113468,11 +113582,9 @@ function transformModule(context) {
113468
113582
  );
113469
113583
  } else if (isImportSpecifier(importDeclaration)) {
113470
113584
  const name = importDeclaration.propertyName || importDeclaration.name;
113585
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
113471
113586
  return setTextRange(
113472
- factory2.createPropertyAccessExpression(
113473
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
113474
- factory2.cloneNode(name)
113475
- ),
113587
+ name.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(name)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(name)),
113476
113588
  /*location*/
113477
113589
  node
113478
113590
  );
@@ -113760,7 +113872,7 @@ function transformSystemModule(context) {
113760
113872
  const exportedNames = [];
113761
113873
  if (moduleInfo.exportedNames) {
113762
113874
  for (const exportedLocalName of moduleInfo.exportedNames) {
113763
- if (exportedLocalName.escapedText === "default") {
113875
+ if (moduleExportNameIsDefault(exportedLocalName)) {
113764
113876
  continue;
113765
113877
  }
113766
113878
  exportedNames.push(
@@ -113938,10 +114050,10 @@ function transformSystemModule(context) {
113938
114050
  for (const e of entry.exportClause.elements) {
113939
114051
  properties.push(
113940
114052
  factory2.createPropertyAssignment(
113941
- factory2.createStringLiteral(idText(e.name)),
114053
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.name)),
113942
114054
  factory2.createElementAccessExpression(
113943
114055
  parameterName,
113944
- factory2.createStringLiteral(idText(e.propertyName || e.name))
114056
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(e.propertyName || e.name))
113945
114057
  )
113946
114058
  )
113947
114059
  );
@@ -113968,7 +114080,7 @@ function transformSystemModule(context) {
113968
114080
  /*typeArguments*/
113969
114081
  void 0,
113970
114082
  [
113971
- factory2.createStringLiteral(idText(entry.exportClause.name)),
114083
+ factory2.createStringLiteral(moduleExportNameTextUnescaped(entry.exportClause.name)),
113972
114084
  parameterName
113973
114085
  ]
113974
114086
  )
@@ -114308,7 +114420,7 @@ function transformSystemModule(context) {
114308
114420
  const exportSpecifiers = moduleInfo.exportSpecifiers.get(name);
114309
114421
  if (exportSpecifiers) {
114310
114422
  for (const exportSpecifier of exportSpecifiers) {
114311
- if (exportSpecifier.name.escapedText !== excludeName) {
114423
+ if (moduleExportNameTextUnescaped(exportSpecifier.name) !== excludeName) {
114312
114424
  statements = appendExportStatement(statements, exportSpecifier.name, name);
114313
114425
  }
114314
114426
  }
@@ -114729,13 +114841,12 @@ function transformSystemModule(context) {
114729
114841
  node
114730
114842
  );
114731
114843
  } else if (isImportSpecifier(importDeclaration)) {
114844
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
114845
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
114732
114846
  return setTextRange(
114733
114847
  factory2.createPropertyAssignment(
114734
114848
  factory2.cloneNode(name),
114735
- factory2.createPropertyAccessExpression(
114736
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
114737
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
114738
- )
114849
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName))
114739
114850
  ),
114740
114851
  /*location*/
114741
114852
  node
@@ -114778,11 +114889,10 @@ function transformSystemModule(context) {
114778
114889
  node
114779
114890
  );
114780
114891
  } else if (isImportSpecifier(importDeclaration)) {
114892
+ const importedName = importDeclaration.propertyName || importDeclaration.name;
114893
+ const target = factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration);
114781
114894
  return setTextRange(
114782
- factory2.createPropertyAccessExpression(
114783
- factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration),
114784
- factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name)
114785
- ),
114895
+ importedName.kind === 11 /* StringLiteral */ ? factory2.createElementAccessExpression(target, factory2.cloneNode(importedName)) : factory2.createPropertyAccessExpression(target, factory2.cloneNode(importedName)),
114786
114896
  /*location*/
114787
114897
  node
114788
114898
  );
@@ -116373,15 +116483,17 @@ function transformDeclarations(context) {
116373
116483
  if (isDeclarationAndNotVisible(input)) return;
116374
116484
  if (hasDynamicName(input)) {
116375
116485
  if (isolatedDeclarations) {
116376
- if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116377
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116378
- return;
116379
- } else if (
116380
- // Type declarations just need to double-check that the input computed name is an entity name expression
116381
- (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
116382
- ) {
116383
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116384
- return;
116486
+ if (!resolver.isDefinitelyReferenceToGlobalSymbolObject(input.name.expression)) {
116487
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
116488
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
116489
+ return;
116490
+ } else if (
116491
+ // Type declarations just need to double-check that the input computed name is an entity name expression
116492
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
116493
+ ) {
116494
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
116495
+ return;
116496
+ }
116385
116497
  }
116386
116498
  } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
116387
116499
  return;
@@ -118008,10 +118120,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118008
118120
  emitSkipped = true;
118009
118121
  return;
118010
118122
  }
118011
- const buildInfo = host.getBuildInfo() || createBuildInfo(
118012
- /*program*/
118013
- void 0
118014
- );
118123
+ const buildInfo = host.getBuildInfo() || { version };
118015
118124
  writeFile(
118016
118125
  host,
118017
118126
  emitterDiagnostics,
@@ -118294,9 +118403,6 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118294
118403
  return encodeURI(sourceMapFile);
118295
118404
  }
118296
118405
  }
118297
- function createBuildInfo(program) {
118298
- return { program, version };
118299
- }
118300
118406
  function getBuildInfoText(buildInfo) {
118301
118407
  return JSON.stringify(buildInfo);
118302
118408
  }
@@ -118341,7 +118447,8 @@ var notImplementedResolver = {
118341
118447
  getJsxFragmentFactoryEntity: notImplemented,
118342
118448
  isBindingCapturedByNode: notImplemented,
118343
118449
  getDeclarationStatementsForSourceFile: notImplemented,
118344
- isImportRequiredByAugmentation: notImplemented
118450
+ isImportRequiredByAugmentation: notImplemented,
118451
+ isDefinitelyReferenceToGlobalSymbolObject: notImplemented
118345
118452
  };
118346
118453
  var createPrinterWithDefaults = /* @__PURE__ */ memoize(() => createPrinter({}));
118347
118454
  var createPrinterWithRemoveComments = /* @__PURE__ */ memoize(() => createPrinter({ removeComments: true }));
@@ -123082,7 +123189,7 @@ function isIgnoredFileFromWildCardWatching({
123082
123189
  }
123083
123190
  return false;
123084
123191
  function hasSourceFile(file) {
123085
- return realProgram ? !!realProgram.getSourceFileByPath(file) : builderProgram ? builderProgram.getState().fileInfos.has(file) : !!find(program, (rootFile) => toPath3(rootFile) === file);
123192
+ return realProgram ? !!realProgram.getSourceFileByPath(file) : builderProgram ? builderProgram.state.fileInfos.has(file) : !!find(program, (rootFile) => toPath3(rootFile) === file);
123086
123193
  }
123087
123194
  function isSupportedScriptKind() {
123088
123195
  if (!getScriptKind2) return false;
@@ -123103,9 +123210,6 @@ function isIgnoredFileFromWildCardWatching({
123103
123210
  }
123104
123211
  }
123105
123212
  }
123106
- function isBuilderProgram(program) {
123107
- return !!program.getState;
123108
- }
123109
123213
  function isEmittedFileOfProgram(program, file) {
123110
123214
  if (!program) {
123111
123215
  return false;
@@ -127729,6 +127833,13 @@ var BuilderFileEmit = /* @__PURE__ */ ((BuilderFileEmit2) => {
127729
127833
  BuilderFileEmit2[BuilderFileEmit2["All"] = 31] = "All";
127730
127834
  return BuilderFileEmit2;
127731
127835
  })(BuilderFileEmit || {});
127836
+ function isBuilderProgramStateWithDefinedProgram(state) {
127837
+ return state.program !== void 0;
127838
+ }
127839
+ function toBuilderProgramStateWithDefinedProgram(state) {
127840
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
127841
+ return state;
127842
+ }
127732
127843
  function getBuilderFileEmit(options) {
127733
127844
  let result = 1 /* Js */;
127734
127845
  if (options.sourceMap) result = result | 2 /* JsMap */;
@@ -127993,7 +128104,11 @@ function getNextAffectedFile(state, cancellationToken, host) {
127993
128104
  const affectedFile = affectedFiles[affectedFilesIndex];
127994
128105
  if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
127995
128106
  state.affectedFilesIndex = affectedFilesIndex;
127996
- addToAffectedFilesPendingEmit(state, affectedFile.resolvedPath, getBuilderFileEmit(state.compilerOptions));
128107
+ addToAffectedFilesPendingEmit(
128108
+ state,
128109
+ affectedFile.resolvedPath,
128110
+ getBuilderFileEmit(state.compilerOptions)
128111
+ );
127997
128112
  handleDtsMayChangeOfAffectedFile(
127998
128113
  state,
127999
128114
  affectedFile,
@@ -128013,12 +128128,11 @@ function getNextAffectedFile(state, cancellationToken, host) {
128013
128128
  if (nextKey.done) {
128014
128129
  return void 0;
128015
128130
  }
128016
- const program = Debug.checkDefined(state.program);
128017
- const compilerOptions = program.getCompilerOptions();
128018
- if (compilerOptions.outFile) return program;
128131
+ const compilerOptions = state.program.getCompilerOptions();
128132
+ if (compilerOptions.outFile) return state.program;
128019
128133
  state.affectedFiles = BuilderState.getFilesAffectedByWithOldState(
128020
128134
  state,
128021
- program,
128135
+ state.program,
128022
128136
  nextKey.value,
128023
128137
  cancellationToken,
128024
128138
  host
@@ -128079,9 +128193,8 @@ function getNextPendingEmitDiagnosticsFile(state) {
128079
128193
  function removeDiagnosticsOfLibraryFiles(state) {
128080
128194
  if (!state.cleanedDiagnosticsOfLibFiles) {
128081
128195
  state.cleanedDiagnosticsOfLibFiles = true;
128082
- const program = Debug.checkDefined(state.program);
128083
- const options = program.getCompilerOptions();
128084
- forEach(program.getSourceFiles(), (f) => program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
128196
+ const options = state.program.getCompilerOptions();
128197
+ forEach(state.program.getSourceFiles(), (f) => state.program.isSourceFileDefaultLibrary(f) && !skipTypeChecking(f, options, state.program) && removeSemanticDiagnosticsOf(state, f.resolvedPath));
128085
128198
  }
128086
128199
  }
128087
128200
  function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, host) {
@@ -128090,7 +128203,7 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
128090
128203
  removeDiagnosticsOfLibraryFiles(state);
128091
128204
  BuilderState.updateShapeSignature(
128092
128205
  state,
128093
- Debug.checkDefined(state.program),
128206
+ state.program,
128094
128207
  affectedFile,
128095
128208
  cancellationToken,
128096
128209
  host
@@ -128108,12 +128221,11 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
128108
128221
  function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken, host) {
128109
128222
  removeSemanticDiagnosticsOf(state, path);
128110
128223
  if (!state.changedFilesSet.has(path)) {
128111
- const program = Debug.checkDefined(state.program);
128112
- const sourceFile = program.getSourceFileByPath(path);
128224
+ const sourceFile = state.program.getSourceFileByPath(path);
128113
128225
  if (sourceFile) {
128114
128226
  BuilderState.updateShapeSignature(
128115
128227
  state,
128116
- program,
128228
+ state.program,
128117
128229
  sourceFile,
128118
128230
  cancellationToken,
128119
128231
  host,
@@ -128121,9 +128233,17 @@ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken,
128121
128233
  true
128122
128234
  );
128123
128235
  if (invalidateJsFiles) {
128124
- addToAffectedFilesPendingEmit(state, path, getBuilderFileEmit(state.compilerOptions));
128236
+ addToAffectedFilesPendingEmit(
128237
+ state,
128238
+ path,
128239
+ getBuilderFileEmit(state.compilerOptions)
128240
+ );
128125
128241
  } else if (getEmitDeclarations(state.compilerOptions)) {
128126
- addToAffectedFilesPendingEmit(state, path, state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */);
128242
+ addToAffectedFilesPendingEmit(
128243
+ state,
128244
+ path,
128245
+ state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */
128246
+ );
128127
128247
  }
128128
128248
  }
128129
128249
  }
@@ -128190,7 +128310,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
128190
128310
  host
128191
128311
  );
128192
128312
  if (isChangedSignature(state, currentPath)) {
128193
- const currentSourceFile = Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
128313
+ const currentSourceFile = state.program.getSourceFileByPath(currentPath);
128194
128314
  queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
128195
128315
  }
128196
128316
  }
@@ -128239,7 +128359,7 @@ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsF
128239
128359
  function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
128240
128360
  return concatenate(
128241
128361
  getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile),
128242
- Debug.checkDefined(state.program).getProgramDiagnostics(sourceFile)
128362
+ state.program.getProgramDiagnostics(sourceFile)
128243
128363
  );
128244
128364
  }
128245
128365
  function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationToken, semanticDiagnosticsPerFile) {
@@ -128249,17 +128369,20 @@ function getBinderAndCheckerDiagnosticsOfFile(state, sourceFile, cancellationTok
128249
128369
  if (cachedDiagnostics) {
128250
128370
  return filterSemanticDiagnostics(cachedDiagnostics, state.compilerOptions);
128251
128371
  }
128252
- const diagnostics = Debug.checkDefined(state.program).getBindAndCheckDiagnostics(sourceFile, cancellationToken);
128372
+ const diagnostics = state.program.getBindAndCheckDiagnostics(sourceFile, cancellationToken);
128253
128373
  semanticDiagnosticsPerFile.set(path, diagnostics);
128254
128374
  return filterSemanticDiagnostics(diagnostics, state.compilerOptions);
128255
128375
  }
128256
- function isProgramBundleEmitBuildInfo(info) {
128376
+ function isIncrementalBundleEmitBuildInfo(info) {
128257
128377
  var _a;
128258
128378
  return !!((_a = info.options) == null ? void 0 : _a.outFile);
128259
128379
  }
128380
+ function isIncrementalBuildInfo(info) {
128381
+ return !!info.fileNames;
128382
+ }
128260
128383
  function getBuildInfo2(state) {
128261
128384
  var _a, _b;
128262
- const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory();
128385
+ const currentDirectory = state.program.getCurrentDirectory();
128263
128386
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
128264
128387
  const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
128265
128388
  const fileNames = [];
@@ -128272,14 +128395,14 @@ function getBuildInfo2(state) {
128272
128395
  tryAddRoot(key, fileId);
128273
128396
  return value.impliedFormat ? { version: value.version, impliedFormat: value.impliedFormat, signature: void 0, affectsGlobalScope: void 0 } : value.version;
128274
128397
  });
128275
- const program2 = {
128398
+ return {
128276
128399
  fileNames,
128277
128400
  fileInfos: fileInfos2,
128278
128401
  root,
128279
128402
  resolvedRoot: toResolvedRoot(),
128280
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
128281
- semanticDiagnosticsPerFile: convertToProgramBuildInfoDiagnostics(),
128282
- emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
128403
+ options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
128404
+ semanticDiagnosticsPerFile: toIncrementalBuildInfoDiagnostics(),
128405
+ emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
128283
128406
  changeFileSet: toChangeFileSet(),
128284
128407
  outSignature: state.outSignature,
128285
128408
  latestChangedDtsFile,
@@ -128289,10 +128412,10 @@ function getBuildInfo2(state) {
128289
128412
  // Pending emit is same as deteremined by compilerOptions
128290
128413
  state.programEmitPending
128291
128414
  )
128292
- )
128415
+ ),
128293
128416
  // Actual value
128417
+ version
128294
128418
  };
128295
- return createBuildInfo(program2);
128296
128419
  }
128297
128420
  let fileIdsList;
128298
128421
  let fileNamesToFileIdListId;
@@ -128347,7 +128470,7 @@ function getBuildInfo2(state) {
128347
128470
  toFileIdListId(state.referencedMap.getValues(key))
128348
128471
  ]);
128349
128472
  }
128350
- const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics();
128473
+ const semanticDiagnosticsPerFile = toIncrementalBuildInfoDiagnostics();
128351
128474
  let affectedFilesPendingEmit;
128352
128475
  if ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.size) {
128353
128476
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
@@ -128371,22 +128494,22 @@ function getBuildInfo2(state) {
128371
128494
  }
128372
128495
  }
128373
128496
  }
128374
- const program = {
128497
+ return {
128375
128498
  fileNames,
128499
+ fileIdsList,
128376
128500
  fileInfos,
128377
128501
  root,
128378
128502
  resolvedRoot: toResolvedRoot(),
128379
- options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
128380
- fileIdsList,
128503
+ options: toIncrementalBuildInfoCompilerOptions(state.compilerOptions),
128381
128504
  referencedMap,
128382
128505
  semanticDiagnosticsPerFile,
128383
- emitDiagnosticsPerFile: convertToProgramBuildInfoEmitDiagnostics(),
128506
+ emitDiagnosticsPerFile: toIncrementalBuildInfoEmitDiagnostics(),
128384
128507
  affectedFilesPendingEmit,
128385
128508
  changeFileSet: toChangeFileSet(),
128386
128509
  emitSignatures,
128387
- latestChangedDtsFile
128510
+ latestChangedDtsFile,
128511
+ version
128388
128512
  };
128389
- return createBuildInfo(program);
128390
128513
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
128391
128514
  return relativeToBuildInfo(getNormalizedAbsolutePath(path, currentDirectory));
128392
128515
  }
@@ -128434,13 +128557,13 @@ function getBuildInfo2(state) {
128434
128557
  });
128435
128558
  return result;
128436
128559
  }
128437
- function convertToProgramBuildInfoCompilerOptions(options) {
128560
+ function toIncrementalBuildInfoCompilerOptions(options) {
128438
128561
  let result;
128439
128562
  const { optionsNameMap } = getOptionsNameMap();
128440
128563
  for (const name of getOwnKeys(options).sort(compareStringsCaseSensitive)) {
128441
128564
  const optionInfo = optionsNameMap.get(name.toLowerCase());
128442
128565
  if (optionInfo == null ? void 0 : optionInfo.affectsBuildInfo) {
128443
- (result || (result = {}))[name] = convertToReusableCompilerOptionValue(
128566
+ (result || (result = {}))[name] = toReusableCompilerOptionValue(
128444
128567
  optionInfo,
128445
128568
  options[name]
128446
128569
  );
@@ -128448,7 +128571,7 @@ function getBuildInfo2(state) {
128448
128571
  }
128449
128572
  return result;
128450
128573
  }
128451
- function convertToReusableCompilerOptionValue(option, value) {
128574
+ function toReusableCompilerOptionValue(option, value) {
128452
128575
  if (option) {
128453
128576
  Debug.assert(option.type !== "listOrElement");
128454
128577
  if (option.type === "list") {
@@ -128462,7 +128585,7 @@ function getBuildInfo2(state) {
128462
128585
  }
128463
128586
  return value;
128464
128587
  }
128465
- function convertToProgramBuildInfoDiagnostics() {
128588
+ function toIncrementalBuildInfoDiagnostics() {
128466
128589
  let result;
128467
128590
  state.fileInfos.forEach((_value, key) => {
128468
128591
  const value = state.semanticDiagnosticsPerFile.get(key);
@@ -128471,13 +128594,13 @@ function getBuildInfo2(state) {
128471
128594
  } else if (value.length) {
128472
128595
  result = append(result, [
128473
128596
  toFileId(key),
128474
- convertToReusableDiagnostics(value, key)
128597
+ toReusableDiagnostic(value, key)
128475
128598
  ]);
128476
128599
  }
128477
128600
  });
128478
128601
  return result;
128479
128602
  }
128480
- function convertToProgramBuildInfoEmitDiagnostics() {
128603
+ function toIncrementalBuildInfoEmitDiagnostics() {
128481
128604
  var _a2;
128482
128605
  let result;
128483
128606
  if (!((_a2 = state.emitDiagnosticsPerFile) == null ? void 0 : _a2.size)) return result;
@@ -128485,51 +128608,51 @@ function getBuildInfo2(state) {
128485
128608
  const value = state.emitDiagnosticsPerFile.get(key);
128486
128609
  result = append(result, [
128487
128610
  toFileId(key),
128488
- convertToReusableDiagnostics(value, key)
128611
+ toReusableDiagnostic(value, key)
128489
128612
  ]);
128490
128613
  }
128491
128614
  return result;
128492
128615
  }
128493
- function convertToReusableDiagnostics(diagnostics, diagnosticFilePath) {
128616
+ function toReusableDiagnostic(diagnostics, diagnosticFilePath) {
128494
128617
  Debug.assert(!!diagnostics.length);
128495
128618
  return diagnostics.map((diagnostic) => {
128496
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath);
128619
+ const result = toReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath);
128497
128620
  result.reportsUnnecessary = diagnostic.reportsUnnecessary;
128498
128621
  result.reportDeprecated = diagnostic.reportsDeprecated;
128499
128622
  result.source = diagnostic.source;
128500
128623
  result.skippedOn = diagnostic.skippedOn;
128501
128624
  const { relatedInformation } = diagnostic;
128502
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, diagnosticFilePath)) : [] : void 0;
128625
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => toReusableDiagnosticRelatedInformation(r, diagnosticFilePath)) : [] : void 0;
128503
128626
  return result;
128504
128627
  });
128505
128628
  }
128506
- function convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath) {
128629
+ function toReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath) {
128507
128630
  const { file } = diagnostic;
128508
128631
  return {
128509
128632
  ...diagnostic,
128510
128633
  file: file ? file.resolvedPath === diagnosticFilePath ? void 0 : relativeToBuildInfo(file.resolvedPath) : false,
128511
- messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
128634
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : toReusableDiagnosticMessageChain(diagnostic.messageText)
128512
128635
  };
128513
128636
  }
128514
- function convertToReusableDiagnosticMessageChain(chain) {
128637
+ function toReusableDiagnosticMessageChain(chain) {
128515
128638
  if (chain.repopulateInfo) {
128516
128639
  return {
128517
128640
  info: chain.repopulateInfo(),
128518
- next: convertToReusableDiagnosticMessageChainArray(chain.next)
128641
+ next: toReusableDiagnosticMessageChainArray(chain.next)
128519
128642
  };
128520
128643
  }
128521
- const next = convertToReusableDiagnosticMessageChainArray(chain.next);
128644
+ const next = toReusableDiagnosticMessageChainArray(chain.next);
128522
128645
  return next === chain.next ? chain : { ...chain, next };
128523
128646
  }
128524
- function convertToReusableDiagnosticMessageChainArray(array) {
128647
+ function toReusableDiagnosticMessageChainArray(array) {
128525
128648
  if (!array) return array;
128526
128649
  return forEach(array, (chain, index) => {
128527
- const reusable = convertToReusableDiagnosticMessageChain(chain);
128650
+ const reusable = toReusableDiagnosticMessageChain(chain);
128528
128651
  if (chain === reusable) return void 0;
128529
128652
  const result = index > 0 ? array.slice(0, index - 1) : [];
128530
128653
  result.push(reusable);
128531
128654
  for (let i = index + 1; i < array.length; i++) {
128532
- result.push(convertToReusableDiagnosticMessageChain(array[i]));
128655
+ result.push(toReusableDiagnosticMessageChain(array[i]));
128533
128656
  }
128534
128657
  return result;
128535
128658
  }) || array;
@@ -128606,24 +128729,27 @@ function computeSignature(text, host, data) {
128606
128729
  return (host.createHash ?? generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
128607
128730
  }
128608
128731
  function createBuilderProgram(kind, { newProgram, host, oldProgram, configFileParsingDiagnostics }) {
128609
- let oldState = oldProgram && oldProgram.getState();
128732
+ let oldState = oldProgram && oldProgram.state;
128610
128733
  if (oldState && newProgram === oldState.program && configFileParsingDiagnostics === newProgram.getConfigFileParsingDiagnostics()) {
128611
128734
  newProgram = void 0;
128612
128735
  oldState = void 0;
128613
128736
  return oldProgram;
128614
128737
  }
128615
128738
  const state = createBuilderProgramState(newProgram, oldState);
128616
- newProgram.getBuildInfo = () => getBuildInfo2(state);
128739
+ newProgram.getBuildInfo = () => getBuildInfo2(toBuilderProgramStateWithDefinedProgram(state));
128617
128740
  newProgram = void 0;
128618
128741
  oldProgram = void 0;
128619
128742
  oldState = void 0;
128620
- const getState = () => state;
128621
- const builderProgram = createRedirectedBuilderProgram(getState, configFileParsingDiagnostics);
128622
- builderProgram.getState = getState;
128743
+ const builderProgram = createRedirectedBuilderProgram(state, configFileParsingDiagnostics);
128744
+ builderProgram.state = state;
128623
128745
  builderProgram.saveEmitState = () => backupBuilderProgramEmitState(state);
128624
128746
  builderProgram.restoreEmitState = (saved) => restoreBuilderProgramEmitState(state, saved);
128625
128747
  builderProgram.hasChangedEmitSignature = () => !!state.hasChangedEmitSignature;
128626
- builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(state, Debug.checkDefined(state.program), sourceFile);
128748
+ builderProgram.getAllDependencies = (sourceFile) => BuilderState.getAllDependencies(
128749
+ state,
128750
+ Debug.checkDefined(state.program),
128751
+ sourceFile
128752
+ );
128627
128753
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
128628
128754
  builderProgram.emit = emit;
128629
128755
  builderProgram.releaseProgram = () => releaseCache(state);
@@ -128638,8 +128764,12 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128638
128764
  }
128639
128765
  return builderProgram;
128640
128766
  function emitBuildInfo(writeFile2, cancellationToken) {
128767
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
128641
128768
  if (state.buildInfoEmitPending) {
128642
- const result = Debug.checkDefined(state.program).emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
128769
+ const result = state.program.emitBuildInfo(
128770
+ writeFile2 || maybeBind(host, host.writeFile),
128771
+ cancellationToken
128772
+ );
128643
128773
  state.buildInfoEmitPending = false;
128644
128774
  return result;
128645
128775
  }
@@ -128647,6 +128777,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128647
128777
  }
128648
128778
  function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
128649
128779
  var _a, _b, _c, _d;
128780
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
128650
128781
  let affected = getNextAffectedFile(state, cancellationToken, host);
128651
128782
  const programEmitKind = getBuilderFileEmit(state.compilerOptions);
128652
128783
  let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind;
@@ -128687,7 +128818,10 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128687
128818
  if (!affected) {
128688
128819
  if (!state.buildInfoEmitPending) return void 0;
128689
128820
  const affected2 = state.program;
128690
- const result2 = affected2.emitBuildInfo(writeFile2 || maybeBind(host, host.writeFile), cancellationToken);
128821
+ const result2 = affected2.emitBuildInfo(
128822
+ writeFile2 || maybeBind(host, host.writeFile),
128823
+ cancellationToken
128824
+ );
128691
128825
  state.buildInfoEmitPending = false;
128692
128826
  return { result: result2, affected: affected2 };
128693
128827
  }
@@ -128735,6 +128869,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128735
128869
  return { result, affected };
128736
128870
  }
128737
128871
  function getWriteFileCallback(writeFile2, customTransformers) {
128872
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
128738
128873
  if (!getEmitDeclarations(state.compilerOptions)) return writeFile2 || maybeBind(host, host.writeFile);
128739
128874
  return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
128740
128875
  var _a, _b, _c;
@@ -128801,6 +128936,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128801
128936
  };
128802
128937
  }
128803
128938
  function emit(targetSourceFile, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) {
128939
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
128804
128940
  if (kind === 1 /* EmitAndSemanticDiagnosticsBuilderProgram */) {
128805
128941
  assertSourceFileOkWithoutNextAffectedCall(state, targetSourceFile);
128806
128942
  }
@@ -128813,7 +128949,12 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128813
128949
  let diagnostics;
128814
128950
  let emittedFiles = [];
128815
128951
  let affectedEmitResult;
128816
- while (affectedEmitResult = emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers)) {
128952
+ while (affectedEmitResult = emitNextAffectedFile(
128953
+ writeFile2,
128954
+ cancellationToken,
128955
+ emitOnlyDtsFiles,
128956
+ customTransformers
128957
+ )) {
128817
128958
  emitSkipped = emitSkipped || affectedEmitResult.result.emitSkipped;
128818
128959
  diagnostics = addRange(diagnostics, affectedEmitResult.result.diagnostics);
128819
128960
  emittedFiles = addRange(emittedFiles, affectedEmitResult.result.emittedFiles);
@@ -128829,7 +128970,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128829
128970
  clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles);
128830
128971
  }
128831
128972
  }
128832
- return Debug.checkDefined(state.program).emit(
128973
+ return state.program.emit(
128833
128974
  targetSourceFile,
128834
128975
  getWriteFileCallback(writeFile2, customTransformers),
128835
128976
  cancellationToken,
@@ -128838,6 +128979,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128838
128979
  );
128839
128980
  }
128840
128981
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
128982
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
128841
128983
  while (true) {
128842
128984
  const affected = getNextAffectedFile(state, cancellationToken, host);
128843
128985
  let result;
@@ -128875,6 +129017,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128875
129017
  }
128876
129018
  }
128877
129019
  function getSemanticDiagnostics(sourceFile, cancellationToken) {
129020
+ Debug.assert(isBuilderProgramStateWithDefinedProgram(state));
128878
129021
  assertSourceFileOkWithoutNextAffectedCall(state, sourceFile);
128879
129022
  if (sourceFile) {
128880
129023
  return getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken);
@@ -128885,7 +129028,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
128885
129028
  if (affectedResult.affected === state.program) return affectedResult.result;
128886
129029
  }
128887
129030
  let diagnostics;
128888
- for (const sourceFile2 of Debug.checkDefined(state.program).getSourceFiles()) {
129031
+ for (const sourceFile2 of state.program.getSourceFiles()) {
128889
129032
  diagnostics = addRange(diagnostics, getSemanticDiagnosticsOfFile(state, sourceFile2, cancellationToken));
128890
129033
  }
128891
129034
  return diagnostics || emptyArray;
@@ -128906,43 +129049,42 @@ function toBuilderFileEmit(value, fullEmitForOptions) {
128906
129049
  function toProgramEmitPending(value, options) {
128907
129050
  return !value ? getBuilderFileEmit(options || {}) : value;
128908
129051
  }
128909
- function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host) {
129052
+ function createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath, host) {
128910
129053
  var _a, _b, _c, _d;
128911
- const program = buildInfo.program;
128912
129054
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
128913
129055
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
128914
129056
  let state;
128915
- const filePaths = (_a = program.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
129057
+ const filePaths = (_a = buildInfo.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory);
128916
129058
  let filePathsSetList;
128917
- const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0;
129059
+ const latestChangedDtsFile = buildInfo.latestChangedDtsFile ? toAbsolutePath(buildInfo.latestChangedDtsFile) : void 0;
128918
129060
  const fileInfos = /* @__PURE__ */ new Map();
128919
- const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
128920
- if (isProgramBundleEmitBuildInfo(program)) {
128921
- program.fileInfos.forEach((fileInfo, index) => {
129061
+ const changedFilesSet = new Set(map(buildInfo.changeFileSet, toFilePath));
129062
+ if (isIncrementalBundleEmitBuildInfo(buildInfo)) {
129063
+ buildInfo.fileInfos.forEach((fileInfo, index) => {
128922
129064
  const path = toFilePath(index + 1);
128923
129065
  fileInfos.set(path, isString(fileInfo) ? { version: fileInfo, signature: void 0, affectsGlobalScope: void 0, impliedFormat: void 0 } : fileInfo);
128924
129066
  });
128925
129067
  state = {
128926
129068
  fileInfos,
128927
- compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
128928
- semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
128929
- emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
129069
+ compilerOptions: buildInfo.options ? convertToOptionsWithAbsolutePaths(buildInfo.options, toAbsolutePath) : {},
129070
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
129071
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
128930
129072
  hasReusableDiagnostic: true,
128931
129073
  changedFilesSet,
128932
129074
  latestChangedDtsFile,
128933
- outSignature: program.outSignature,
128934
- programEmitPending: program.pendingEmit === void 0 ? void 0 : toProgramEmitPending(program.pendingEmit, program.options)
129075
+ outSignature: buildInfo.outSignature,
129076
+ programEmitPending: buildInfo.pendingEmit === void 0 ? void 0 : toProgramEmitPending(buildInfo.pendingEmit, buildInfo.options)
128935
129077
  };
128936
129078
  } else {
128937
- filePathsSetList = (_b = program.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
128938
- const emitSignatures = ((_c = program.options) == null ? void 0 : _c.composite) && !program.options.outFile ? /* @__PURE__ */ new Map() : void 0;
128939
- program.fileInfos.forEach((fileInfo, index) => {
129079
+ filePathsSetList = (_b = buildInfo.fileIdsList) == null ? void 0 : _b.map((fileIds) => new Set(fileIds.map(toFilePath)));
129080
+ const emitSignatures = ((_c = buildInfo.options) == null ? void 0 : _c.composite) && !buildInfo.options.outFile ? /* @__PURE__ */ new Map() : void 0;
129081
+ buildInfo.fileInfos.forEach((fileInfo, index) => {
128940
129082
  const path = toFilePath(index + 1);
128941
129083
  const stateFileInfo = toBuilderStateFileInfoForMultiEmit(fileInfo);
128942
129084
  fileInfos.set(path, stateFileInfo);
128943
129085
  if (emitSignatures && stateFileInfo.signature) emitSignatures.set(path, stateFileInfo.signature);
128944
129086
  });
128945
- (_d = program.emitSignatures) == null ? void 0 : _d.forEach((value) => {
129087
+ (_d = buildInfo.emitSignatures) == null ? void 0 : _d.forEach((value) => {
128946
129088
  if (isNumber(value)) emitSignatures.delete(toFilePath(value));
128947
129089
  else {
128948
129090
  const key = toFilePath(value[0]);
@@ -128955,22 +129097,22 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128955
129097
  );
128956
129098
  }
128957
129099
  });
128958
- const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
129100
+ const fullEmitForOptions = buildInfo.affectedFilesPendingEmit ? getBuilderFileEmit(buildInfo.options || {}) : void 0;
128959
129101
  state = {
128960
129102
  fileInfos,
128961
- compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
128962
- referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
128963
- semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile),
128964
- emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
129103
+ compilerOptions: buildInfo.options ? convertToOptionsWithAbsolutePaths(buildInfo.options, toAbsolutePath) : {},
129104
+ referencedMap: toManyToManyPathMap(buildInfo.referencedMap, buildInfo.options ?? {}),
129105
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(buildInfo.semanticDiagnosticsPerFile),
129106
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(buildInfo.emitDiagnosticsPerFile),
128965
129107
  hasReusableDiagnostic: true,
128966
- affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
129108
+ affectedFilesPendingEmit: buildInfo.affectedFilesPendingEmit && arrayToMap(buildInfo.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
128967
129109
  changedFilesSet,
128968
129110
  latestChangedDtsFile,
128969
129111
  emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
128970
129112
  };
128971
129113
  }
128972
129114
  return {
128973
- getState: () => state,
129115
+ state,
128974
129116
  saveEmitState: noop,
128975
129117
  restoreEmitState: noop,
128976
129118
  getProgram: notImplemented,
@@ -129064,15 +129206,15 @@ function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
129064
129206
  }
129065
129207
  }
129066
129208
  }
129067
- function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
129209
+ function createRedirectedBuilderProgram(state, configFileParsingDiagnostics) {
129068
129210
  return {
129069
- getState: notImplemented,
129211
+ state: void 0,
129070
129212
  saveEmitState: noop,
129071
129213
  restoreEmitState: noop,
129072
129214
  getProgram,
129073
- getProgramOrUndefined: () => getState().program,
129074
- releaseProgram: () => getState().program = void 0,
129075
- getCompilerOptions: () => getState().compilerOptions,
129215
+ getProgramOrUndefined: () => state.program,
129216
+ releaseProgram: () => state.program = void 0,
129217
+ getCompilerOptions: () => state.compilerOptions,
129076
129218
  getSourceFile: (fileName) => getProgram().getSourceFile(fileName),
129077
129219
  getSourceFiles: () => getProgram().getSourceFiles(),
129078
129220
  getOptionsDiagnostics: (cancellationToken) => getProgram().getOptionsDiagnostics(cancellationToken),
@@ -129088,20 +129230,50 @@ function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics)
129088
129230
  close: noop
129089
129231
  };
129090
129232
  function getProgram() {
129091
- return Debug.checkDefined(getState().program);
129233
+ return Debug.checkDefined(state.program);
129092
129234
  }
129093
129235
  }
129094
129236
 
129095
129237
  // src/compiler/builderPublic.ts
129096
129238
  function createSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
129097
- return createBuilderProgram(0 /* SemanticDiagnosticsBuilderProgram */, getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences));
129239
+ return createBuilderProgram(
129240
+ 0 /* SemanticDiagnosticsBuilderProgram */,
129241
+ getBuilderCreationParameters(
129242
+ newProgramOrRootNames,
129243
+ hostOrOptions,
129244
+ oldProgramOrHost,
129245
+ configFileParsingDiagnosticsOrOldProgram,
129246
+ configFileParsingDiagnostics,
129247
+ projectReferences
129248
+ )
129249
+ );
129098
129250
  }
129099
129251
  function createEmitAndSemanticDiagnosticsBuilderProgram(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
129100
- return createBuilderProgram(1 /* EmitAndSemanticDiagnosticsBuilderProgram */, getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences));
129252
+ return createBuilderProgram(
129253
+ 1 /* EmitAndSemanticDiagnosticsBuilderProgram */,
129254
+ getBuilderCreationParameters(
129255
+ newProgramOrRootNames,
129256
+ hostOrOptions,
129257
+ oldProgramOrHost,
129258
+ configFileParsingDiagnosticsOrOldProgram,
129259
+ configFileParsingDiagnostics,
129260
+ projectReferences
129261
+ )
129262
+ );
129101
129263
  }
129102
129264
  function createAbstractBuilder(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
129103
- const { newProgram, configFileParsingDiagnostics: newConfigFileParsingDiagnostics } = getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences);
129104
- return createRedirectedBuilderProgram(() => ({ program: newProgram, compilerOptions: newProgram.getCompilerOptions() }), newConfigFileParsingDiagnostics);
129265
+ const { newProgram, configFileParsingDiagnostics: newConfigFileParsingDiagnostics } = getBuilderCreationParameters(
129266
+ newProgramOrRootNames,
129267
+ hostOrOptions,
129268
+ oldProgramOrHost,
129269
+ configFileParsingDiagnosticsOrOldProgram,
129270
+ configFileParsingDiagnostics,
129271
+ projectReferences
129272
+ );
129273
+ return createRedirectedBuilderProgram(
129274
+ { program: newProgram, compilerOptions: newProgram.getCompilerOptions() },
129275
+ newConfigFileParsingDiagnostics
129276
+ );
129105
129277
  }
129106
129278
 
129107
129279
  // src/compiler/resolutionCache.ts
@@ -130376,13 +130548,13 @@ function createTabularErrorsDisplay(filesInError, host) {
130376
130548
  });
130377
130549
  return tabularData;
130378
130550
  }
130379
- function isBuilderProgram2(program) {
130380
- return !!program.getState;
130551
+ function isBuilderProgram(program) {
130552
+ return !!program.state;
130381
130553
  }
130382
130554
  function listFiles(program, write) {
130383
130555
  const options = program.getCompilerOptions();
130384
130556
  if (options.explainFiles) {
130385
- explainFiles(isBuilderProgram2(program) ? program.getProgram() : program, write);
130557
+ explainFiles(isBuilderProgram(program) ? program.getProgram() : program, write);
130386
130558
  } else if (options.listFiles || options.listFilesOnly) {
130387
130559
  forEach(program.getSourceFiles(), (file) => {
130388
130560
  write(file.fileName);
@@ -130882,8 +131054,8 @@ function readBuilderProgram(compilerOptions, host) {
130882
131054
  if (!content) return void 0;
130883
131055
  buildInfo = getBuildInfo(buildInfoPath, content);
130884
131056
  }
130885
- if (!buildInfo || buildInfo.version !== version || !buildInfo.program) return void 0;
130886
- return createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host);
131057
+ if (!buildInfo || buildInfo.version !== version || !isIncrementalBuildInfo(buildInfo)) return void 0;
131058
+ return createBuilderProgramUsingIncrementalBuildInfo(buildInfo, buildInfoPath, host);
130887
131059
  }
130888
131060
  function createIncrementalCompilerHost(options, system = sys) {
130889
131061
  const host = createCompilerHostWorker(
@@ -132648,7 +132820,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132648
132820
  let oldestOutputFileName;
132649
132821
  let oldestOutputFileTime = maximumDate;
132650
132822
  let buildInfoTime;
132651
- let buildInfoProgram;
132823
+ let incrementalBuildInfo;
132652
132824
  let buildInfoVersionMap;
132653
132825
  if (buildInfoPath) {
132654
132826
  const buildInfoCacheEntry2 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
@@ -132673,26 +132845,26 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132673
132845
  fileName: buildInfoPath
132674
132846
  };
132675
132847
  }
132676
- if (buildInfo.program && buildInfo.version !== version) {
132848
+ if (isIncrementalBuildInfo(buildInfo) && buildInfo.version !== version) {
132677
132849
  return {
132678
132850
  type: 13 /* TsVersionOutputOfDate */,
132679
132851
  version: buildInfo.version
132680
132852
  };
132681
132853
  }
132682
- if (buildInfo.program) {
132683
- 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)) {
132854
+ if (isIncrementalBuildInfo(buildInfo)) {
132855
+ if (((_a = buildInfo.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.emitDiagnosticsPerFile) == null ? void 0 : _c.length) || buildInfo.pendingEmit !== void 0 : (_d = buildInfo.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
132684
132856
  return {
132685
132857
  type: 7 /* OutOfDateBuildInfo */,
132686
132858
  buildInfoFile: buildInfoPath
132687
132859
  };
132688
132860
  }
132689
- if (!project.options.noEmit && getPendingEmitKind(project.options, buildInfo.program.options || {})) {
132861
+ if (!project.options.noEmit && getPendingEmitKind(project.options, buildInfo.options || {})) {
132690
132862
  return {
132691
132863
  type: 8 /* OutOfDateOptions */,
132692
132864
  buildInfoFile: buildInfoPath
132693
132865
  };
132694
132866
  }
132695
- buildInfoProgram = buildInfo.program;
132867
+ incrementalBuildInfo = buildInfo;
132696
132868
  }
132697
132869
  oldestOutputFileTime = buildInfoTime;
132698
132870
  oldestOutputFileName = buildInfoPath;
@@ -132709,12 +132881,12 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132709
132881
  reason: `${inputFile} does not exist`
132710
132882
  };
132711
132883
  }
132712
- const inputPath = buildInfoProgram ? toPath2(state, inputFile) : void 0;
132884
+ const inputPath = incrementalBuildInfo ? toPath2(state, inputFile) : void 0;
132713
132885
  if (buildInfoTime && buildInfoTime < inputTime) {
132714
132886
  let version2;
132715
132887
  let currentVersion;
132716
- if (buildInfoProgram) {
132717
- if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
132888
+ if (incrementalBuildInfo) {
132889
+ if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
132718
132890
  const resolvedInputPath = buildInfoVersionMap.roots.get(inputPath);
132719
132891
  version2 = buildInfoVersionMap.fileInfos.get(resolvedInputPath ?? inputPath);
132720
132892
  const text = version2 ? state.readFileWithCache(resolvedInputPath ?? inputFile) : void 0;
@@ -132733,10 +132905,10 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132733
132905
  newestInputFileName = inputFile;
132734
132906
  newestInputFileTime = inputTime;
132735
132907
  }
132736
- if (buildInfoProgram) seenRoots.add(inputPath);
132908
+ if (incrementalBuildInfo) seenRoots.add(inputPath);
132737
132909
  }
132738
- if (buildInfoProgram) {
132739
- if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
132910
+ if (incrementalBuildInfo) {
132911
+ if (!buildInfoVersionMap) buildInfoVersionMap = getBuildInfoFileVersionMap(incrementalBuildInfo, buildInfoPath, host);
132740
132912
  const existingRoot = forEachEntry(
132741
132913
  buildInfoVersionMap.roots,
132742
132914
  // File was root file when project was built but its not any more
@@ -132883,7 +133055,7 @@ function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
132883
133055
  if (!options.composite) return void 0;
132884
133056
  const entry = Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
132885
133057
  if (entry.latestChangedDtsTime !== void 0) return entry.latestChangedDtsTime || void 0;
132886
- const latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ? state.host.getModifiedTime(getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, getDirectoryPath(entry.path))) : void 0;
133058
+ const latestChangedDtsTime = entry.buildInfo && isIncrementalBuildInfo(entry.buildInfo) && entry.buildInfo.latestChangedDtsFile ? state.host.getModifiedTime(getNormalizedAbsolutePath(entry.buildInfo.latestChangedDtsFile, getDirectoryPath(entry.path))) : void 0;
132887
133059
  entry.latestChangedDtsTime = latestChangedDtsTime || false;
132888
133060
  return latestChangedDtsTime;
132889
133061
  }
@@ -134853,7 +135025,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
134853
135025
  expression,
134854
135026
  /*includeBigInt*/
134855
135027
  false
134856
- )) {
135028
+ ) && !resolver.isDefinitelyReferenceToGlobalSymbolObject(expression)) {
134857
135029
  context.tracker.reportInferenceFallback(prop.name);
134858
135030
  result = false;
134859
135031
  }
@@ -136961,12 +137133,12 @@ function isInReferenceCommentWorker(sourceFile, position, shouldBeReference) {
136961
137133
  );
136962
137134
  return !!range && shouldBeReference === tripleSlashDirectivePrefixRegex.test(sourceFile.text.substring(range.pos, range.end));
136963
137135
  }
136964
- function getReplacementSpanForContextToken(contextToken) {
137136
+ function getReplacementSpanForContextToken(contextToken, position) {
136965
137137
  if (!contextToken) return void 0;
136966
137138
  switch (contextToken.kind) {
136967
137139
  case 11 /* StringLiteral */:
136968
137140
  case 15 /* NoSubstitutionTemplateLiteral */:
136969
- return createTextSpanFromStringLiteralLikeContent(contextToken);
137141
+ return createTextSpanFromStringLiteralLikeContent(contextToken, position);
136970
137142
  default:
136971
137143
  return createTextSpanFromNode(contextToken);
136972
137144
  }
@@ -136974,11 +137146,11 @@ function getReplacementSpanForContextToken(contextToken) {
136974
137146
  function createTextSpanFromNode(node, sourceFile, endNode2) {
136975
137147
  return createTextSpanFromBounds(node.getStart(sourceFile), (endNode2 || node).getEnd());
136976
137148
  }
136977
- function createTextSpanFromStringLiteralLikeContent(node) {
137149
+ function createTextSpanFromStringLiteralLikeContent(node, position) {
136978
137150
  let replacementEnd = node.getEnd() - 1;
136979
137151
  if (node.isUnterminated) {
136980
137152
  if (node.getStart() === replacementEnd) return void 0;
136981
- replacementEnd = node.getEnd();
137153
+ replacementEnd = Math.min(position, node.getEnd());
136982
137154
  }
136983
137155
  return createTextSpanFromBounds(node.getStart() + 1, replacementEnd);
136984
137156
  }
@@ -143091,9 +143263,9 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
143091
143263
  const namespaceImportName = namespaceNameConflicts ? getUniqueName(preferredName, sourceFile) : preferredName;
143092
143264
  const neededNamedImports = /* @__PURE__ */ new Set();
143093
143265
  for (const element of toConvert.elements) {
143094
- const propertyName = (element.propertyName || element.name).text;
143266
+ const propertyName = element.propertyName || element.name;
143095
143267
  ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, (id) => {
143096
- const access = factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), propertyName);
143268
+ const access = propertyName.kind === 11 /* StringLiteral */ ? factory.createElementAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName)) : factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), factory.cloneNode(propertyName));
143097
143269
  if (isShorthandPropertyAssignment(id.parent)) {
143098
143270
  changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access));
143099
143271
  } else if (isExportSpecifier(id.parent)) {
@@ -143109,7 +143281,7 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
143109
143281
  shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))
143110
143282
  );
143111
143283
  if (neededNamedImports.size && isImportDeclaration(importDecl)) {
143112
- const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.createIdentifier(element.propertyName.text), factory.createIdentifier(element.name.text)));
143284
+ const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.cloneNode(element.propertyName), factory.cloneNode(element.name)));
143113
143285
  changes.insertNodeAfter(sourceFile, toConvert.parent.parent, createImport(
143114
143286
  importDecl,
143115
143287
  /*defaultImportName*/
@@ -163408,7 +163580,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163408
163580
  var _a, _b;
163409
163581
  let insertText;
163410
163582
  let filterText;
163411
- let replacementSpan = getReplacementSpanForContextToken(replacementToken);
163583
+ let replacementSpan = getReplacementSpanForContextToken(replacementToken, position);
163412
163584
  let data;
163413
163585
  let isSnippet;
163414
163586
  let source = getSourceFromOrigin(origin);
@@ -163525,10 +163697,18 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163525
163697
  hasAction = !importStatementCompletion;
163526
163698
  }
163527
163699
  const parentNamedImportOrExport = findAncestor(location, isNamedImportsOrExports);
163528
- if ((parentNamedImportOrExport == null ? void 0 : parentNamedImportOrExport.kind) === 275 /* NamedImports */) {
163529
- const possibleToken = stringToToken(name);
163530
- if (parentNamedImportOrExport && possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
163531
- insertText = `${name} as ${name}_`;
163700
+ if (parentNamedImportOrExport) {
163701
+ const languageVersion = getEmitScriptTarget(host.getCompilationSettings());
163702
+ if (!isIdentifierText(name, languageVersion)) {
163703
+ insertText = JSON.stringify(name);
163704
+ if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
163705
+ insertText += " as " + generateIdentifierForArbitraryString(name, languageVersion);
163706
+ }
163707
+ } else if (parentNamedImportOrExport.kind === 275 /* NamedImports */) {
163708
+ const possibleToken = stringToToken(name);
163709
+ if (possibleToken && (possibleToken === 135 /* AwaitKeyword */ || isNonContextualKeyword(possibleToken))) {
163710
+ insertText = `${name} as ${name}_`;
163711
+ }
163532
163712
  }
163533
163713
  }
163534
163714
  return {
@@ -163551,6 +163731,23 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163551
163731
  ...includeSymbol ? { symbol } : void 0
163552
163732
  };
163553
163733
  }
163734
+ function generateIdentifierForArbitraryString(text, languageVersion) {
163735
+ let needsUnderscore = false;
163736
+ let identifier = "";
163737
+ let ch;
163738
+ for (let i = 0; i < text.length; i += ch !== void 0 && ch >= 65536 ? 2 : 1) {
163739
+ ch = text.codePointAt(i);
163740
+ if (ch !== void 0 && (i === 0 ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) {
163741
+ if (needsUnderscore) identifier += "_";
163742
+ identifier += String.fromCodePoint(ch);
163743
+ needsUnderscore = false;
163744
+ } else {
163745
+ needsUnderscore = true;
163746
+ }
163747
+ }
163748
+ if (needsUnderscore) identifier += "_";
163749
+ return identifier || "_";
163750
+ }
163554
163751
  function isClassLikeMemberCompletion(symbol, location, sourceFile) {
163555
163752
  if (isInJSFile(location)) {
163556
163753
  return false;
@@ -165382,7 +165579,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
165382
165579
  completionKind = 3 /* MemberLike */;
165383
165580
  isNewIdentifierLocation = false;
165384
165581
  const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
165385
- const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => (n.propertyName || n.name).escapedText));
165582
+ const existing = new Set(namedImportsOrExports.elements.filter((n) => !isCurrentlyEditingNode(n)).map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
165386
165583
  const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
165387
165584
  symbols = concatenate(symbols, uniques);
165388
165585
  if (!uniques.length) {
@@ -165873,6 +166070,9 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
165873
166070
  if (isIdentifierText(name, target, jsxIdentifierExpected ? 1 /* JSX */ : 0 /* Standard */) || symbol.valueDeclaration && isPrivateIdentifierClassElementDeclaration(symbol.valueDeclaration)) {
165874
166071
  return validNameResult;
165875
166072
  }
166073
+ if (symbol.flags & 2097152 /* Alias */) {
166074
+ return { name, needsConvertPropertyAccess: true };
166075
+ }
165876
166076
  switch (kind) {
165877
166077
  case 3 /* MemberLike */:
165878
166078
  return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
@@ -166402,7 +166602,7 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
166402
166602
  if (completion === void 0) {
166403
166603
  return void 0;
166404
166604
  }
166405
- const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken);
166605
+ const optionalReplacementSpan = createTextSpanFromStringLiteralLikeContent(contextToken, position);
166406
166606
  switch (completion.kind) {
166407
166607
  case 0 /* Paths */:
166408
166608
  return convertPathCompletions(completion.paths);
@@ -166456,7 +166656,7 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
166456
166656
  kindModifiers: "" /* none */,
166457
166657
  kind: "string" /* string */,
166458
166658
  sortText: SortText.LocationPriority,
166459
- replacementSpan: getReplacementSpanForContextToken(contextToken)
166659
+ replacementSpan: getReplacementSpanForContextToken(contextToken, position)
166460
166660
  }));
166461
166661
  return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan, entries };
166462
166662
  }
@@ -166568,6 +166768,21 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program,
166568
166768
  }
166569
166769
  const literals = contextualTypes.types.filter((literal) => !tracker.hasValue(literal.value));
166570
166770
  return { kind: 2 /* Types */, types: literals, isNewIdentifier: false };
166771
+ case 276 /* ImportSpecifier */:
166772
+ case 281 /* ExportSpecifier */:
166773
+ const specifier = parent2;
166774
+ if (specifier.propertyName && node !== specifier.propertyName) {
166775
+ return;
166776
+ }
166777
+ const namedImportsOrExports = specifier.parent;
166778
+ const { moduleSpecifier } = namedImportsOrExports.kind === 275 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent;
166779
+ if (!moduleSpecifier) return;
166780
+ const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier);
166781
+ if (!moduleSpecifierSymbol) return;
166782
+ const exports2 = typeChecker.getExportsAndPropertiesOfModule(moduleSpecifierSymbol);
166783
+ const existing = new Set(namedImportsOrExports.elements.map((n) => moduleExportNameTextEscaped(n.propertyName || n.name)));
166784
+ const uniques = exports2.filter((e) => e.escapedName !== "default" /* Default */ && !existing.has(e.escapedName));
166785
+ return { kind: 1 /* Properties */, symbols: uniques, hasIndexSignature: false };
166571
166786
  default:
166572
166787
  return fromContextualType() || fromContextualType(0 /* None */);
166573
166788
  }
@@ -167538,12 +167753,12 @@ function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, c
167538
167753
  }
167539
167754
  for (const element of namedBindings.elements) {
167540
167755
  const { name, propertyName } = element;
167541
- if (!isNameMatch((propertyName || name).escapedText)) {
167756
+ if (!isNameMatch(moduleExportNameTextEscaped(propertyName || name))) {
167542
167757
  continue;
167543
167758
  }
167544
167759
  if (propertyName) {
167545
167760
  singleReferences.push(propertyName);
167546
- if (!isForRename || name.escapedText === exportSymbol.escapedName) {
167761
+ if (!isForRename || moduleExportNameTextEscaped(name) === exportSymbol.escapedName) {
167547
167762
  addSearch(name, checker.getSymbolAtLocation(name));
167548
167763
  }
167549
167764
  } else {
@@ -168801,8 +169016,8 @@ var Core;
168801
169016
  function shouldAddSingleReference(singleRef, state) {
168802
169017
  if (!hasMatchingMeaning(singleRef, state)) return false;
168803
169018
  if (state.options.use !== 2 /* Rename */) return true;
168804
- if (!isIdentifier(singleRef)) return false;
168805
- return !(isImportOrExportSpecifier(singleRef.parent) && singleRef.escapedText === "default" /* Default */);
169019
+ if (!isIdentifier(singleRef) && !isImportOrExportSpecifier(singleRef.parent)) return false;
169020
+ return !(isImportOrExportSpecifier(singleRef.parent) && moduleExportNameIsDefault(singleRef));
168806
169021
  }
168807
169022
  function searchForImportedSymbol(symbol, state) {
168808
169023
  if (!symbol.declarations) return;
@@ -168964,7 +169179,7 @@ var Core;
168964
169179
  case 15 /* NoSubstitutionTemplateLiteral */:
168965
169180
  case 11 /* StringLiteral */: {
168966
169181
  const str = node;
168967
- return (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node) && str.text.length === searchSymbolName.length;
169182
+ return str.text.length === searchSymbolName.length && (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node || isImportOrExportSpecifier(node.parent));
168968
169183
  }
168969
169184
  case 9 /* NumericLiteral */:
168970
169185
  return isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
@@ -169030,7 +169245,7 @@ var Core;
169030
169245
  return;
169031
169246
  }
169032
169247
  if (isExportSpecifier(parent2)) {
169033
- Debug.assert(referenceLocation.kind === 80 /* Identifier */);
169248
+ Debug.assert(referenceLocation.kind === 80 /* Identifier */ || referenceLocation.kind === 11 /* StringLiteral */);
169034
169249
  getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent2, search, state, addReferencesHere);
169035
169250
  return;
169036
169251
  }
@@ -169080,7 +169295,7 @@ var Core;
169080
169295
  return;
169081
169296
  }
169082
169297
  if (!propertyName) {
169083
- if (!(state.options.use === 2 /* Rename */ && name.escapedText === "default" /* Default */)) {
169298
+ if (!(state.options.use === 2 /* Rename */ && moduleExportNameIsDefault(name))) {
169084
169299
  addRef();
169085
169300
  }
169086
169301
  } else if (referenceLocation === propertyName) {
@@ -169096,7 +169311,7 @@ var Core;
169096
169311
  }
169097
169312
  }
169098
169313
  if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
169099
- const isDefaultExport = referenceLocation.escapedText === "default" || exportSpecifier.name.escapedText === "default";
169314
+ const isDefaultExport = moduleExportNameIsDefault(referenceLocation) || moduleExportNameIsDefault(exportSpecifier.name);
169100
169315
  const exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
169101
169316
  const exportSymbol = Debug.checkDefined(exportSpecifier.symbol);
169102
169317
  const exportInfo = getExportInfo(exportSymbol, exportKind, state.checker);
@@ -170053,7 +170268,7 @@ function getSymbol(node, checker, stopAtAlias) {
170053
170268
  return { symbol, failedAliasResolution };
170054
170269
  }
170055
170270
  function shouldSkipAlias(node, declaration) {
170056
- if (node.kind !== 80 /* Identifier */) {
170271
+ if (node.kind !== 80 /* Identifier */ && (node.kind !== 11 /* StringLiteral */ || !isImportOrExportSpecifier(node.parent))) {
170057
170272
  return false;
170058
170273
  }
170059
170274
  if (node.parent === declaration) {
@@ -172066,7 +172281,7 @@ function hasModuleDeclarationMatchingSpecifier(sourceFile, moduleSpecifier) {
172066
172281
  return isString(moduleSpecifierText) && some(sourceFile.moduleAugmentations, (moduleName) => isStringLiteral(moduleName) && moduleName.text === moduleSpecifierText);
172067
172282
  }
172068
172283
  function getNewImportSpecifiers(namedImports) {
172069
- return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && importSpecifier.name.escapedText === importSpecifier.propertyName.escapedText ? factory.updateImportSpecifier(
172284
+ return flatMap(namedImports, (namedImport) => map(tryGetNamedBindingElements(namedImport), (importSpecifier) => importSpecifier.name && importSpecifier.propertyName && moduleExportNameTextEscaped(importSpecifier.name) === moduleExportNameTextEscaped(importSpecifier.propertyName) ? factory.updateImportSpecifier(
172070
172285
  importSpecifier,
172071
172286
  importSpecifier.isTypeOnly,
172072
172287
  /*propertyName*/
@@ -178567,7 +178782,7 @@ __export(ts_exports2, {
178567
178782
  changeFullExtension: () => changeFullExtension,
178568
178783
  changesAffectModuleResolution: () => changesAffectModuleResolution,
178569
178784
  changesAffectingProgramStructure: () => changesAffectingProgramStructure,
178570
- characterToRegularExpressionFlag: () => characterToRegularExpressionFlag,
178785
+ characterCodeToRegularExpressionFlag: () => characterCodeToRegularExpressionFlag,
178571
178786
  childIsDecorated: () => childIsDecorated,
178572
178787
  classElementOrClassElementParameterIsDecorated: () => classElementOrClassElementParameterIsDecorated,
178573
178788
  classHasClassThisAssignment: () => classHasClassThisAssignment,
@@ -178667,9 +178882,8 @@ __export(ts_exports2, {
178667
178882
  createBaseNodeFactory: () => createBaseNodeFactory,
178668
178883
  createBinaryExpressionTrampoline: () => createBinaryExpressionTrampoline,
178669
178884
  createBindingHelper: () => createBindingHelper,
178670
- createBuildInfo: () => createBuildInfo,
178671
178885
  createBuilderProgram: () => createBuilderProgram,
178672
- createBuilderProgramUsingProgramBuildInfo: () => createBuilderProgramUsingProgramBuildInfo,
178886
+ createBuilderProgramUsingIncrementalBuildInfo: () => createBuilderProgramUsingIncrementalBuildInfo,
178673
178887
  createBuilderStatusReporter: () => createBuilderStatusReporter,
178674
178888
  createCacheWithRedirects: () => createCacheWithRedirects,
178675
178889
  createCacheableExportInfoMap: () => createCacheableExportInfoMap,
@@ -179553,7 +179767,7 @@ __export(ts_exports2, {
179553
179767
  isBreakStatement: () => isBreakStatement,
179554
179768
  isBuild: () => isBuild,
179555
179769
  isBuildInfoFile: () => isBuildInfoFile,
179556
- isBuilderProgram: () => isBuilderProgram2,
179770
+ isBuilderProgram: () => isBuilderProgram,
179557
179771
  isBundle: () => isBundle,
179558
179772
  isCallChain: () => isCallChain,
179559
179773
  isCallExpression: () => isCallExpression,
@@ -179760,6 +179974,8 @@ __export(ts_exports2, {
179760
179974
  isInTemplateString: () => isInTemplateString,
179761
179975
  isInTopLevelContext: () => isInTopLevelContext,
179762
179976
  isInTypeQuery: () => isInTypeQuery,
179977
+ isIncrementalBuildInfo: () => isIncrementalBuildInfo,
179978
+ isIncrementalBundleEmitBuildInfo: () => isIncrementalBundleEmitBuildInfo,
179763
179979
  isIncrementalCompilation: () => isIncrementalCompilation,
179764
179980
  isIndexSignatureDeclaration: () => isIndexSignatureDeclaration,
179765
179981
  isIndexedAccessTypeNode: () => isIndexedAccessTypeNode,
@@ -179902,6 +180118,7 @@ __export(ts_exports2, {
179902
180118
  isModuleBlock: () => isModuleBlock,
179903
180119
  isModuleBody: () => isModuleBody,
179904
180120
  isModuleDeclaration: () => isModuleDeclaration,
180121
+ isModuleExportName: () => isModuleExportName,
179905
180122
  isModuleExportsAccessExpression: () => isModuleExportsAccessExpression,
179906
180123
  isModuleIdentifier: () => isModuleIdentifier,
179907
180124
  isModuleName: () => isModuleName,
@@ -179995,7 +180212,6 @@ __export(ts_exports2, {
179995
180212
  isPrivateIdentifierClassElementDeclaration: () => isPrivateIdentifierClassElementDeclaration,
179996
180213
  isPrivateIdentifierPropertyAccessExpression: () => isPrivateIdentifierPropertyAccessExpression,
179997
180214
  isPrivateIdentifierSymbol: () => isPrivateIdentifierSymbol,
179998
- isProgramBundleEmitBuildInfo: () => isProgramBundleEmitBuildInfo,
179999
180215
  isProgramUptoDate: () => isProgramUptoDate,
180000
180216
  isPrologueDirective: () => isPrologueDirective,
180001
180217
  isPropertyAccessChain: () => isPropertyAccessChain,
@@ -180219,6 +180435,9 @@ __export(ts_exports2, {
180219
180435
  missingFileModifiedTime: () => missingFileModifiedTime,
180220
180436
  modifierToFlag: () => modifierToFlag,
180221
180437
  modifiersToFlags: () => modifiersToFlags,
180438
+ moduleExportNameIsDefault: () => moduleExportNameIsDefault,
180439
+ moduleExportNameTextEscaped: () => moduleExportNameTextEscaped,
180440
+ moduleExportNameTextUnescaped: () => moduleExportNameTextUnescaped,
180222
180441
  moduleOptionDeclaration: () => moduleOptionDeclaration,
180223
180442
  moduleResolutionIsEqualTo: () => moduleResolutionIsEqualTo,
180224
180443
  moduleResolutionNameAndModeGetter: () => moduleResolutionNameAndModeGetter,
@@ -180364,7 +180583,7 @@ __export(ts_exports2, {
180364
180583
  reducePathComponents: () => reducePathComponents,
180365
180584
  refactor: () => ts_refactor_exports,
180366
180585
  regExpEscape: () => regExpEscape,
180367
- regularExpressionFlagToCharacter: () => regularExpressionFlagToCharacter,
180586
+ regularExpressionFlagToCharacterCode: () => regularExpressionFlagToCharacterCode,
180368
180587
  relativeComplement: () => relativeComplement,
180369
180588
  removeAllComments: () => removeAllComments,
180370
180589
  removeEmitHelper: () => removeEmitHelper,
@@ -180622,7 +180841,6 @@ __export(ts_exports2, {
180622
180841
  unusedLabelIsError: () => unusedLabelIsError,
180623
180842
  unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel,
180624
180843
  unwrapParenthesizedExpression: () => unwrapParenthesizedExpression,
180625
- unwrapParenthesizedType: () => unwrapParenthesizedType,
180626
180844
  updateErrorForNoInputFiles: () => updateErrorForNoInputFiles,
180627
180845
  updateLanguageServiceSourceFile: () => updateLanguageServiceSourceFile,
180628
180846
  updateMissingFilePathsWatch: () => updateMissingFilePathsWatch,
@@ -193000,7 +193218,7 @@ if (typeof console !== "undefined") {
193000
193218
  changeFullExtension,
193001
193219
  changesAffectModuleResolution,
193002
193220
  changesAffectingProgramStructure,
193003
- characterToRegularExpressionFlag,
193221
+ characterCodeToRegularExpressionFlag,
193004
193222
  childIsDecorated,
193005
193223
  classElementOrClassElementParameterIsDecorated,
193006
193224
  classHasClassThisAssignment,
@@ -193100,9 +193318,8 @@ if (typeof console !== "undefined") {
193100
193318
  createBaseNodeFactory,
193101
193319
  createBinaryExpressionTrampoline,
193102
193320
  createBindingHelper,
193103
- createBuildInfo,
193104
193321
  createBuilderProgram,
193105
- createBuilderProgramUsingProgramBuildInfo,
193322
+ createBuilderProgramUsingIncrementalBuildInfo,
193106
193323
  createBuilderStatusReporter,
193107
193324
  createCacheWithRedirects,
193108
193325
  createCacheableExportInfoMap,
@@ -194193,6 +194410,8 @@ if (typeof console !== "undefined") {
194193
194410
  isInTemplateString,
194194
194411
  isInTopLevelContext,
194195
194412
  isInTypeQuery,
194413
+ isIncrementalBuildInfo,
194414
+ isIncrementalBundleEmitBuildInfo,
194196
194415
  isIncrementalCompilation,
194197
194416
  isIndexSignatureDeclaration,
194198
194417
  isIndexedAccessTypeNode,
@@ -194335,6 +194554,7 @@ if (typeof console !== "undefined") {
194335
194554
  isModuleBlock,
194336
194555
  isModuleBody,
194337
194556
  isModuleDeclaration,
194557
+ isModuleExportName,
194338
194558
  isModuleExportsAccessExpression,
194339
194559
  isModuleIdentifier,
194340
194560
  isModuleName,
@@ -194428,7 +194648,6 @@ if (typeof console !== "undefined") {
194428
194648
  isPrivateIdentifierClassElementDeclaration,
194429
194649
  isPrivateIdentifierPropertyAccessExpression,
194430
194650
  isPrivateIdentifierSymbol,
194431
- isProgramBundleEmitBuildInfo,
194432
194651
  isProgramUptoDate,
194433
194652
  isPrologueDirective,
194434
194653
  isPropertyAccessChain,
@@ -194652,6 +194871,9 @@ if (typeof console !== "undefined") {
194652
194871
  missingFileModifiedTime,
194653
194872
  modifierToFlag,
194654
194873
  modifiersToFlags,
194874
+ moduleExportNameIsDefault,
194875
+ moduleExportNameTextEscaped,
194876
+ moduleExportNameTextUnescaped,
194655
194877
  moduleOptionDeclaration,
194656
194878
  moduleResolutionIsEqualTo,
194657
194879
  moduleResolutionNameAndModeGetter,
@@ -194797,7 +195019,7 @@ if (typeof console !== "undefined") {
194797
195019
  reducePathComponents,
194798
195020
  refactor,
194799
195021
  regExpEscape,
194800
- regularExpressionFlagToCharacter,
195022
+ regularExpressionFlagToCharacterCode,
194801
195023
  relativeComplement,
194802
195024
  removeAllComments,
194803
195025
  removeEmitHelper,
@@ -195055,7 +195277,6 @@ if (typeof console !== "undefined") {
195055
195277
  unusedLabelIsError,
195056
195278
  unwrapInnermostStatementOfLabel,
195057
195279
  unwrapParenthesizedExpression,
195058
- unwrapParenthesizedType,
195059
195280
  updateErrorForNoInputFiles,
195060
195281
  updateLanguageServiceSourceFile,
195061
195282
  updateMissingFilePathsWatch,