typescript 5.1.0-dev.20230421 → 5.1.0-dev.20230423

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.1";
21
- var version = `${versionMajorMinor}.0-dev.20230421`;
21
+ var version = `${versionMajorMinor}.0-dev.20230423`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3396,10 +3396,8 @@ var SyntaxKind = /* @__PURE__ */ ((SyntaxKind4) => {
3396
3396
  SyntaxKind4[SyntaxKind4["NotEmittedStatement"] = 358] = "NotEmittedStatement";
3397
3397
  SyntaxKind4[SyntaxKind4["PartiallyEmittedExpression"] = 359] = "PartiallyEmittedExpression";
3398
3398
  SyntaxKind4[SyntaxKind4["CommaListExpression"] = 360] = "CommaListExpression";
3399
- SyntaxKind4[SyntaxKind4["MergeDeclarationMarker"] = 361] = "MergeDeclarationMarker";
3400
- SyntaxKind4[SyntaxKind4["EndOfDeclarationMarker"] = 362] = "EndOfDeclarationMarker";
3401
- SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 363] = "SyntheticReferenceExpression";
3402
- SyntaxKind4[SyntaxKind4["Count"] = 364] = "Count";
3399
+ SyntaxKind4[SyntaxKind4["SyntheticReferenceExpression"] = 361] = "SyntheticReferenceExpression";
3400
+ SyntaxKind4[SyntaxKind4["Count"] = 362] = "Count";
3403
3401
  SyntaxKind4[SyntaxKind4["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment";
3404
3402
  SyntaxKind4[SyntaxKind4["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment";
3405
3403
  SyntaxKind4[SyntaxKind4["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment";
@@ -3891,9 +3889,8 @@ var EmitFlags = /* @__PURE__ */ ((EmitFlags3) => {
3891
3889
  EmitFlags3[EmitFlags3["ReuseTempVariableScope"] = 1048576] = "ReuseTempVariableScope";
3892
3890
  EmitFlags3[EmitFlags3["CustomPrologue"] = 2097152] = "CustomPrologue";
3893
3891
  EmitFlags3[EmitFlags3["NoHoisting"] = 4194304] = "NoHoisting";
3894
- EmitFlags3[EmitFlags3["HasEndOfDeclarationMarker"] = 8388608] = "HasEndOfDeclarationMarker";
3895
- EmitFlags3[EmitFlags3["Iterator"] = 16777216] = "Iterator";
3896
- EmitFlags3[EmitFlags3["NoAsciiEscaping"] = 33554432] = "NoAsciiEscaping";
3892
+ EmitFlags3[EmitFlags3["Iterator"] = 8388608] = "Iterator";
3893
+ EmitFlags3[EmitFlags3["NoAsciiEscaping"] = 16777216] = "NoAsciiEscaping";
3897
3894
  return EmitFlags3;
3898
3895
  })(EmitFlags || {});
3899
3896
  var commentPragmas = {
@@ -7704,6 +7701,7 @@ var Diagnostics = {
7704
7701
  Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
7705
7702
  Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
7706
7703
  Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
7704
+ Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"),
7707
7705
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
7708
7706
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
7709
7707
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -11159,7 +11157,7 @@ function isDeclarationStatementKind(kind) {
11159
11157
  return kind === 261 /* FunctionDeclaration */ || kind === 281 /* MissingDeclaration */ || kind === 262 /* ClassDeclaration */ || kind === 263 /* InterfaceDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 265 /* EnumDeclaration */ || kind === 266 /* ModuleDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 277 /* ExportDeclaration */ || kind === 276 /* ExportAssignment */ || kind === 269 /* NamespaceExportDeclaration */;
11160
11158
  }
11161
11159
  function isStatementKindButNotDeclarationKind(kind) {
11162
- return kind === 251 /* BreakStatement */ || kind === 250 /* ContinueStatement */ || kind === 258 /* DebuggerStatement */ || kind === 245 /* DoStatement */ || kind === 243 /* ExpressionStatement */ || kind === 241 /* EmptyStatement */ || kind === 248 /* ForInStatement */ || kind === 249 /* ForOfStatement */ || kind === 247 /* ForStatement */ || kind === 244 /* IfStatement */ || kind === 255 /* LabeledStatement */ || kind === 252 /* ReturnStatement */ || kind === 254 /* SwitchStatement */ || kind === 256 /* ThrowStatement */ || kind === 257 /* TryStatement */ || kind === 242 /* VariableStatement */ || kind === 246 /* WhileStatement */ || kind === 253 /* WithStatement */ || kind === 358 /* NotEmittedStatement */ || kind === 362 /* EndOfDeclarationMarker */ || kind === 361 /* MergeDeclarationMarker */;
11160
+ return kind === 251 /* BreakStatement */ || kind === 250 /* ContinueStatement */ || kind === 258 /* DebuggerStatement */ || kind === 245 /* DoStatement */ || kind === 243 /* ExpressionStatement */ || kind === 241 /* EmptyStatement */ || kind === 248 /* ForInStatement */ || kind === 249 /* ForOfStatement */ || kind === 247 /* ForStatement */ || kind === 244 /* IfStatement */ || kind === 255 /* LabeledStatement */ || kind === 252 /* ReturnStatement */ || kind === 254 /* SwitchStatement */ || kind === 256 /* ThrowStatement */ || kind === 257 /* TryStatement */ || kind === 242 /* VariableStatement */ || kind === 246 /* WhileStatement */ || kind === 253 /* WithStatement */ || kind === 358 /* NotEmittedStatement */;
11163
11161
  }
11164
11162
  function isDeclaration(node) {
11165
11163
  if (node.kind === 167 /* TypeParameter */) {
@@ -12059,7 +12057,7 @@ function getLiteralText(node, sourceFile, flags) {
12059
12057
  }
12060
12058
  switch (node.kind) {
12061
12059
  case 11 /* StringLiteral */: {
12062
- const escapeText = flags & 2 /* JsxAttributeEscape */ ? escapeJsxAttributeString : flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString;
12060
+ const escapeText = flags & 2 /* JsxAttributeEscape */ ? escapeJsxAttributeString : flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString;
12063
12061
  if (node.singleQuote) {
12064
12062
  return "'" + escapeText(node.text, 39 /* singleQuote */) + "'";
12065
12063
  } else {
@@ -12070,7 +12068,7 @@ function getLiteralText(node, sourceFile, flags) {
12070
12068
  case 16 /* TemplateHead */:
12071
12069
  case 17 /* TemplateMiddle */:
12072
12070
  case 18 /* TemplateTail */: {
12073
- const escapeText = flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString;
12071
+ const escapeText = flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString;
12074
12072
  const rawText = node.rawText ?? escapeTemplateSubstitution(escapeText(node.text, 96 /* backtick */));
12075
12073
  switch (node.kind) {
12076
12074
  case 15 /* NoSubstitutionTemplateLiteral */:
@@ -18383,8 +18381,6 @@ function createNodeFactory(flags, baseFactory2) {
18383
18381
  updatePartiallyEmittedExpression,
18384
18382
  createCommaListExpression,
18385
18383
  updateCommaListExpression,
18386
- createEndOfDeclarationMarker,
18387
- createMergeDeclarationMarker,
18388
18384
  createSyntheticReferenceExpression,
18389
18385
  updateSyntheticReferenceExpression,
18390
18386
  cloneNode,
@@ -21452,20 +21448,8 @@ function createNodeFactory(flags, baseFactory2) {
21452
21448
  function updateCommaListExpression(node, elements) {
21453
21449
  return node.elements !== elements ? update(createCommaListExpression(elements), node) : node;
21454
21450
  }
21455
- function createEndOfDeclarationMarker(original) {
21456
- const node = createBaseNode(362 /* EndOfDeclarationMarker */);
21457
- node.emitNode = {};
21458
- node.original = original;
21459
- return node;
21460
- }
21461
- function createMergeDeclarationMarker(original) {
21462
- const node = createBaseNode(361 /* MergeDeclarationMarker */);
21463
- node.emitNode = {};
21464
- node.original = original;
21465
- return node;
21466
- }
21467
21451
  function createSyntheticReferenceExpression(expression, thisArg) {
21468
- const node = createBaseNode(363 /* SyntheticReferenceExpression */);
21452
+ const node = createBaseNode(361 /* SyntheticReferenceExpression */);
21469
21453
  node.expression = expression;
21470
21454
  node.thisArg = thisArg;
21471
21455
  node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg);
@@ -21857,8 +21841,8 @@ function createNodeFactory(flags, baseFactory2) {
21857
21841
  function inlineExpressions(expressions) {
21858
21842
  return expressions.length > 10 ? createCommaListExpression(expressions) : reduceLeft(expressions, factory2.createComma);
21859
21843
  }
21860
- function getName(node, allowComments, allowSourceMaps, emitFlags = 0) {
21861
- const nodeName = getNameOfDeclaration(node);
21844
+ function getName(node, allowComments, allowSourceMaps, emitFlags = 0, ignoreAssignedName) {
21845
+ const nodeName = ignoreAssignedName ? node && getNonAssignedNameOfDeclaration(node) : getNameOfDeclaration(node);
21862
21846
  if (nodeName && isIdentifier(nodeName) && !isGeneratedIdentifier(nodeName)) {
21863
21847
  const name = setParent(setTextRange(cloneNode(nodeName), nodeName), nodeName.parent);
21864
21848
  emitFlags |= getEmitFlags(nodeName);
@@ -21875,8 +21859,8 @@ function createNodeFactory(flags, baseFactory2) {
21875
21859
  function getInternalName(node, allowComments, allowSourceMaps) {
21876
21860
  return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */ | 65536 /* InternalName */);
21877
21861
  }
21878
- function getLocalName(node, allowComments, allowSourceMaps) {
21879
- return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */);
21862
+ function getLocalName(node, allowComments, allowSourceMaps, ignoreAssignedName) {
21863
+ return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */, ignoreAssignedName);
21880
21864
  }
21881
21865
  function getExportName(node, allowComments, allowSourceMaps) {
21882
21866
  return getName(node, allowComments, allowSourceMaps, 16384 /* ExportName */);
@@ -24169,7 +24153,7 @@ function isNotEmittedStatement(node) {
24169
24153
  return node.kind === 358 /* NotEmittedStatement */;
24170
24154
  }
24171
24155
  function isSyntheticReference(node) {
24172
- return node.kind === 363 /* SyntheticReferenceExpression */;
24156
+ return node.kind === 361 /* SyntheticReferenceExpression */;
24173
24157
  }
24174
24158
  function isExternalModuleReference(node) {
24175
24159
  return node.kind === 282 /* ExternalModuleReference */;
@@ -41798,15 +41782,16 @@ function getPreferences({ importModuleSpecifierPreference, importModuleSpecifier
41798
41782
  if (getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */) {
41799
41783
  return preferredEnding === 2 /* JsExtension */ ? [2 /* JsExtension */, 1 /* Index */] : [1 /* Index */, 2 /* JsExtension */];
41800
41784
  }
41785
+ const allowImportingTsExtension = shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName);
41801
41786
  switch (preferredEnding) {
41802
41787
  case 2 /* JsExtension */:
41803
- return [2 /* JsExtension */, 0 /* Minimal */, 1 /* Index */];
41788
+ return allowImportingTsExtension ? [2 /* JsExtension */, 3 /* TsExtension */, 0 /* Minimal */, 1 /* Index */] : [2 /* JsExtension */, 0 /* Minimal */, 1 /* Index */];
41804
41789
  case 3 /* TsExtension */:
41805
41790
  return [3 /* TsExtension */, 0 /* Minimal */, 2 /* JsExtension */, 1 /* Index */];
41806
41791
  case 1 /* Index */:
41807
- return [1 /* Index */, 0 /* Minimal */, 2 /* JsExtension */];
41792
+ return allowImportingTsExtension ? [1 /* Index */, 0 /* Minimal */, 3 /* TsExtension */, 2 /* JsExtension */] : [1 /* Index */, 0 /* Minimal */, 2 /* JsExtension */];
41808
41793
  case 0 /* Minimal */:
41809
- return [0 /* Minimal */, 1 /* Index */, 2 /* JsExtension */];
41794
+ return allowImportingTsExtension ? [0 /* Minimal */, 1 /* Index */, 3 /* TsExtension */, 2 /* JsExtension */] : [0 /* Minimal */, 1 /* Index */, 2 /* JsExtension */];
41810
41795
  default:
41811
41796
  Debug.assertNever(preferredEnding);
41812
41797
  }
@@ -41969,7 +41954,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
41969
41954
  return pathsOnly ? void 0 : relativePath;
41970
41955
  }
41971
41956
  const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
41972
- const relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseDirectory, getCanonicalFileName);
41957
+ const relativeToBaseUrl = getRelativePathIfInSameVolume(moduleFileName, baseDirectory, getCanonicalFileName);
41973
41958
  if (!relativeToBaseUrl) {
41974
41959
  return pathsOnly ? void 0 : relativePath;
41975
41960
  }
@@ -42177,7 +42162,7 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
42177
42162
  for (const { ending, value } of candidates) {
42178
42163
  if (value.length >= prefix.length + suffix.length && startsWith(value, prefix) && endsWith(value, suffix) && validateEnding({ ending, value })) {
42179
42164
  const matchedStar = value.substring(prefix.length, value.length - suffix.length);
42180
- return key.replace("*", matchedStar);
42165
+ return pathIsRelative(matchedStar) ? void 0 : key.replace("*", matchedStar);
42181
42166
  }
42182
42167
  }
42183
42168
  } else if (some(candidates, (c) => c.ending !== 0 /* Minimal */ && pattern === c.value) || some(candidates, (c) => c.ending === 0 /* Minimal */ && pattern === c.value && validateEnding(c))) {
@@ -42392,7 +42377,7 @@ function tryGetAnyFileFromPath(host, path) {
42392
42377
  }
42393
42378
  function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) {
42394
42379
  return mapDefined(rootDirs, (rootDir) => {
42395
- const relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName);
42380
+ const relativePath = getRelativePathIfInSameVolume(path, rootDir, getCanonicalFileName);
42396
42381
  return relativePath !== void 0 && isPathRelativeToParent(relativePath) ? void 0 : relativePath;
42397
42382
  });
42398
42383
  }
@@ -42404,7 +42389,11 @@ function processEnding(fileName, allowedEndings, options, host) {
42404
42389
  if (fileName === noExtension) {
42405
42390
  return fileName;
42406
42391
  }
42407
- if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) {
42392
+ const jsPriority = allowedEndings.indexOf(2 /* JsExtension */);
42393
+ const tsPriority = allowedEndings.indexOf(3 /* TsExtension */);
42394
+ if (fileExtensionIsOneOf(fileName, [".mts" /* Mts */, ".cts" /* Cts */]) && tsPriority !== -1 && tsPriority < jsPriority) {
42395
+ return fileName;
42396
+ } else if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) {
42408
42397
  return noExtension + getJSExtensionForFile(fileName, options);
42409
42398
  } else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) && stringContains(fileName, ".d.")) {
42410
42399
  return tryGetRealFileNameForNonJsDeclarationFileName(fileName);
@@ -42423,7 +42412,6 @@ function processEnding(fileName, allowedEndings, options, host) {
42423
42412
  case 3 /* TsExtension */:
42424
42413
  if (isDeclarationFileName(fileName)) {
42425
42414
  const extensionlessPriority = allowedEndings.findIndex((e) => e === 0 /* Minimal */ || e === 1 /* Index */);
42426
- const jsPriority = allowedEndings.indexOf(2 /* JsExtension */);
42427
42415
  return extensionlessPriority !== -1 && extensionlessPriority < jsPriority ? noExtension : noExtension + getJSExtensionForFile(fileName, options);
42428
42416
  }
42429
42417
  return fileName;
@@ -42466,7 +42454,7 @@ function tryGetJSExtensionForFile(fileName, options) {
42466
42454
  return void 0;
42467
42455
  }
42468
42456
  }
42469
- function getRelativePathIfInDirectory(path, directoryPath, getCanonicalFileName) {
42457
+ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName) {
42470
42458
  const relativePath = getRelativePathToDirectoryOrUrl(
42471
42459
  directoryPath,
42472
42460
  path,
@@ -44176,6 +44164,10 @@ function createTypeChecker(host) {
44176
44164
  if (name === "const" && isConstAssertion(location)) {
44177
44165
  return void 0;
44178
44166
  }
44167
+ if (isModuleDeclaration(location) && lastLocation && location.name === lastLocation) {
44168
+ lastLocation = location;
44169
+ location = location.parent;
44170
+ }
44179
44171
  if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) {
44180
44172
  if (result = lookup(location.locals, name, meaning)) {
44181
44173
  let useResult = true;
@@ -44366,6 +44358,11 @@ function createTypeChecker(host) {
44366
44358
  }
44367
44359
  }
44368
44360
  break;
44361
+ case 280 /* ExportSpecifier */:
44362
+ if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) {
44363
+ location = location.parent.parent.parent;
44364
+ }
44365
+ break;
44369
44366
  }
44370
44367
  if (isSelfReferenceLocation(location)) {
44371
44368
  lastSelfReferenceLocation = location;
@@ -47171,7 +47168,7 @@ function createTypeChecker(host) {
47171
47168
  }
47172
47169
  if (type.flags & 128 /* StringLiteral */) {
47173
47170
  context.approximateLength += type.value.length + 2;
47174
- return factory.createLiteralTypeNode(setEmitFlags(factory.createStringLiteral(type.value, !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */)), 33554432 /* NoAsciiEscaping */));
47171
+ return factory.createLiteralTypeNode(setEmitFlags(factory.createStringLiteral(type.value, !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */)), 16777216 /* NoAsciiEscaping */));
47175
47172
  }
47176
47173
  if (type.flags & 256 /* NumberLiteral */) {
47177
47174
  const value = type.value;
@@ -48059,7 +48056,7 @@ function createTypeChecker(host) {
48059
48056
  const typePredicate = getTypePredicateOfSignature(signature);
48060
48057
  if (typePredicate) {
48061
48058
  const assertsModifier = typePredicate.kind === 2 /* AssertsThis */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? factory.createToken(131 /* AssertsKeyword */) : void 0;
48062
- const parameterName = typePredicate.kind === 1 /* Identifier */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? setEmitFlags(factory.createIdentifier(typePredicate.parameterName), 33554432 /* NoAsciiEscaping */) : factory.createThisTypeNode();
48059
+ const parameterName = typePredicate.kind === 1 /* Identifier */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? setEmitFlags(factory.createIdentifier(typePredicate.parameterName), 16777216 /* NoAsciiEscaping */) : factory.createThisTypeNode();
48063
48060
  const typeNode = typePredicate.type && typeToTypeNodeHelper(typePredicate.type, context);
48064
48061
  returnTypeNode = factory.createTypePredicateNode(assertsModifier, parameterName, typeNode);
48065
48062
  } else {
@@ -48186,7 +48183,7 @@ function createTypeChecker(host) {
48186
48183
  const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
48187
48184
  const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
48188
48185
  const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
48189
- const name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 33554432 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 165 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 33554432 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol);
48186
+ const name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 165 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol);
48190
48187
  const isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */;
48191
48188
  const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0;
48192
48189
  const parameterNode = factory.createParameterDeclaration(
@@ -48227,7 +48224,7 @@ function createTypeChecker(host) {
48227
48224
  if (!nodeIsSynthesized(visited)) {
48228
48225
  visited = factory.cloneNode(visited);
48229
48226
  }
48230
- return setEmitFlags(visited, 1 /* SingleLine */ | 33554432 /* NoAsciiEscaping */);
48227
+ return setEmitFlags(visited, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */);
48231
48228
  }
48232
48229
  }
48233
48230
  }
@@ -48552,7 +48549,7 @@ function createTypeChecker(host) {
48552
48549
  return factory.createIndexedAccessTypeNode(factory.createTypeReferenceNode(LHS, typeParameterNodes), factory.createLiteralTypeNode(factory.createStringLiteral(symbolName2)));
48553
48550
  }
48554
48551
  }
48555
- const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 33554432 /* NoAsciiEscaping */);
48552
+ const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */);
48556
48553
  if (typeParameterNodes)
48557
48554
  setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
48558
48555
  identifier.symbol = symbol2;
@@ -48638,7 +48635,7 @@ function createTypeChecker(host) {
48638
48635
  if (index === 0) {
48639
48636
  context.flags ^= 16777216 /* InInitialEntityName */;
48640
48637
  }
48641
- const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 33554432 /* NoAsciiEscaping */);
48638
+ const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */);
48642
48639
  if (typeParameterNodes)
48643
48640
  setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
48644
48641
  identifier.symbol = symbol2;
@@ -48663,7 +48660,7 @@ function createTypeChecker(host) {
48663
48660
  return factory.createStringLiteral(getSpecifierForModuleSymbol(symbol2, context));
48664
48661
  }
48665
48662
  if (index === 0 || canUsePropertyAccess(symbolName2, languageVersion)) {
48666
- const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 33554432 /* NoAsciiEscaping */);
48663
+ const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */);
48667
48664
  if (typeParameterNodes)
48668
48665
  setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
48669
48666
  identifier.symbol = symbol2;
@@ -48680,7 +48677,7 @@ function createTypeChecker(host) {
48680
48677
  expression = factory.createNumericLiteral(+symbolName2);
48681
48678
  }
48682
48679
  if (!expression) {
48683
- const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 33554432 /* NoAsciiEscaping */);
48680
+ const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */);
48684
48681
  if (typeParameterNodes)
48685
48682
  setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes));
48686
48683
  identifier.symbol = symbol2;
@@ -48833,7 +48830,7 @@ function createTypeChecker(host) {
48833
48830
  const type = getDeclaredTypeOfSymbol(sym);
48834
48831
  const name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : factory.cloneNode(node);
48835
48832
  name.symbol = sym;
48836
- return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 33554432 /* NoAsciiEscaping */) };
48833
+ return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
48837
48834
  }
48838
48835
  }
48839
48836
  return { introducesError, node };
@@ -81046,6 +81043,41 @@ function createTypeChecker(host) {
81046
81043
  }
81047
81044
  return void 0;
81048
81045
  }
81046
+ function getReferencedValueDeclarations(referenceIn) {
81047
+ if (!isGeneratedIdentifier(referenceIn)) {
81048
+ const reference = getParseTreeNode(referenceIn, isIdentifier);
81049
+ if (reference) {
81050
+ const symbol = getReferencedValueSymbol(reference);
81051
+ if (symbol) {
81052
+ return filter(getExportSymbolOfValueSymbolIfExported(symbol).declarations, (declaration) => {
81053
+ switch (declaration.kind) {
81054
+ case 259 /* VariableDeclaration */:
81055
+ case 168 /* Parameter */:
81056
+ case 207 /* BindingElement */:
81057
+ case 171 /* PropertyDeclaration */:
81058
+ case 302 /* PropertyAssignment */:
81059
+ case 303 /* ShorthandPropertyAssignment */:
81060
+ case 305 /* EnumMember */:
81061
+ case 209 /* ObjectLiteralExpression */:
81062
+ case 261 /* FunctionDeclaration */:
81063
+ case 217 /* FunctionExpression */:
81064
+ case 218 /* ArrowFunction */:
81065
+ case 262 /* ClassDeclaration */:
81066
+ case 230 /* ClassExpression */:
81067
+ case 265 /* EnumDeclaration */:
81068
+ case 173 /* MethodDeclaration */:
81069
+ case 176 /* GetAccessor */:
81070
+ case 177 /* SetAccessor */:
81071
+ case 266 /* ModuleDeclaration */:
81072
+ return true;
81073
+ }
81074
+ return false;
81075
+ });
81076
+ }
81077
+ }
81078
+ }
81079
+ return void 0;
81080
+ }
81049
81081
  function isLiteralConstDeclaration(node) {
81050
81082
  if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConst(node)) {
81051
81083
  return isFreshLiteralType(getTypeOfSymbol(getSymbolOfDeclaration(node)));
@@ -81144,6 +81176,7 @@ function createTypeChecker(host) {
81144
81176
  },
81145
81177
  collectLinkedAliases,
81146
81178
  getReferencedValueDeclaration,
81179
+ getReferencedValueDeclarations,
81147
81180
  getTypeReferenceSerializationKind,
81148
81181
  isOptionalParameter,
81149
81182
  moduleExportsSomeValue,
@@ -85016,7 +85049,7 @@ function collectExternalModuleInfo(context, sourceFile, resolver, compilerOption
85016
85049
  case 242 /* VariableStatement */:
85017
85050
  if (hasSyntacticModifier(node, 1 /* Export */)) {
85018
85051
  for (const decl of node.declarationList.declarations) {
85019
- exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames);
85052
+ exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings);
85020
85053
  }
85021
85054
  }
85022
85055
  break;
@@ -85078,11 +85111,11 @@ function collectExternalModuleInfo(context, sourceFile, resolver, compilerOption
85078
85111
  }
85079
85112
  }
85080
85113
  }
85081
- function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {
85114
+ function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) {
85082
85115
  if (isBindingPattern(decl.name)) {
85083
85116
  for (const element of decl.name.elements) {
85084
85117
  if (!isOmittedExpression(element)) {
85085
- exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames);
85118
+ exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames, exportedBindings);
85086
85119
  }
85087
85120
  }
85088
85121
  } else if (!isGeneratedIdentifier(decl.name)) {
@@ -85090,6 +85123,9 @@ function collectExportedVariableInfo(decl, uniqueExports, exportedNames) {
85090
85123
  if (!uniqueExports.get(text)) {
85091
85124
  uniqueExports.set(text, true);
85092
85125
  exportedNames = append(exportedNames, decl.name);
85126
+ if (isLocalName(decl.name)) {
85127
+ multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), decl.name);
85128
+ }
85093
85129
  }
85094
85130
  }
85095
85131
  return exportedNames;
@@ -86204,7 +86240,7 @@ function transformTypeScript(context) {
86204
86240
  if (promoteToIIFE) {
86205
86241
  context.startLexicalEnvironment();
86206
86242
  }
86207
- const moveModifiers = promoteToIIFE || facts & 8 /* IsExportOfNamespace */ || facts & 2 /* HasClassOrConstructorParameterDecorators */ && legacyDecorators || facts & 1 /* HasStaticInitializedProperties */;
86243
+ const moveModifiers = promoteToIIFE || facts & 8 /* IsExportOfNamespace */;
86208
86244
  let modifiers = moveModifiers ? visitNodes2(node.modifiers, modifierElidingVisitor, isModifierLike) : visitNodes2(node.modifiers, visitor, isModifierLike);
86209
86245
  if (facts & 2 /* HasClassOrConstructorParameterDecorators */) {
86210
86246
  modifiers = injectClassTypeMetadata(modifiers, node);
@@ -86270,13 +86306,13 @@ function transformTypeScript(context) {
86270
86306
  }
86271
86307
  if (moveModifiers) {
86272
86308
  if (facts & 8 /* IsExportOfNamespace */) {
86273
- return demarcateMultiStatementExport(
86309
+ return [
86274
86310
  statement,
86275
86311
  createExportMemberAssignmentStatement(node)
86276
- );
86312
+ ];
86277
86313
  }
86278
86314
  if (facts & 32 /* IsDefaultExternalExport */) {
86279
- return demarcateMultiStatementExport(
86315
+ return [
86280
86316
  statement,
86281
86317
  factory2.createExportDefault(factory2.getLocalName(
86282
86318
  node,
@@ -86285,10 +86321,10 @@ function transformTypeScript(context) {
86285
86321
  /*allowSourceMaps*/
86286
86322
  true
86287
86323
  ))
86288
- );
86324
+ ];
86289
86325
  }
86290
86326
  if (facts & 16 /* IsNamedExternalExport */ && !promoteToIIFE) {
86291
- return demarcateMultiStatementExport(
86327
+ return [
86292
86328
  statement,
86293
86329
  factory2.createExternalModuleExport(factory2.getLocalName(
86294
86330
  node,
@@ -86297,19 +86333,11 @@ function transformTypeScript(context) {
86297
86333
  /*allowSourceMaps*/
86298
86334
  true
86299
86335
  ))
86300
- );
86336
+ ];
86301
86337
  }
86302
86338
  }
86303
86339
  return statement;
86304
86340
  }
86305
- function demarcateMultiStatementExport(declarationStatement, exportStatement) {
86306
- addEmitFlags(declarationStatement, 8388608 /* HasEndOfDeclarationMarker */);
86307
- return [
86308
- declarationStatement,
86309
- exportStatement,
86310
- factory2.createEndOfDeclarationMarker(declarationStatement)
86311
- ];
86312
- }
86313
86341
  function visitClassExpression(node) {
86314
86342
  let modifiers = visitNodes2(node.modifiers, modifierElidingVisitor, isModifierLike);
86315
86343
  if (classOrConstructorParameterIsDecorated(legacyDecorators, node)) {
@@ -86927,14 +86955,14 @@ function transformTypeScript(context) {
86927
86955
  }
86928
86956
  const parameterName = getNamespaceParameterName(node);
86929
86957
  const containerName = getNamespaceContainerName(node);
86930
- const exportName = hasSyntacticModifier(node, 1 /* Export */) ? factory2.getExternalModuleOrNamespaceExportName(
86958
+ const exportName = isExportOfNamespace(node) ? factory2.getExternalModuleOrNamespaceExportName(
86931
86959
  currentNamespaceContainerName,
86932
86960
  node,
86933
86961
  /*allowComments*/
86934
86962
  false,
86935
86963
  /*allowSourceMaps*/
86936
86964
  true
86937
- ) : factory2.getLocalName(
86965
+ ) : factory2.getDeclarationName(
86938
86966
  node,
86939
86967
  /*allowComments*/
86940
86968
  false,
@@ -86948,7 +86976,7 @@ function transformTypeScript(context) {
86948
86976
  factory2.createObjectLiteralExpression()
86949
86977
  )
86950
86978
  );
86951
- if (hasNamespaceQualifiedExportName(node)) {
86979
+ if (isExportOfNamespace(node)) {
86952
86980
  const localName = factory2.getLocalName(
86953
86981
  node,
86954
86982
  /*allowComments*/
@@ -86993,7 +87021,6 @@ function transformTypeScript(context) {
86993
87021
  setTextRange(enumStatement, node);
86994
87022
  addEmitFlags(enumStatement, emitFlags);
86995
87023
  statements.push(enumStatement);
86996
- statements.push(factory2.createEndOfDeclarationMarker(node));
86997
87024
  return statements;
86998
87025
  }
86999
87026
  function transformEnumBody(node, localName) {
@@ -87066,9 +87093,6 @@ function transformTypeScript(context) {
87066
87093
  }
87067
87094
  return isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions));
87068
87095
  }
87069
- function hasNamespaceQualifiedExportName(node) {
87070
- return isExportOfNamespace(node) || isExternalModuleExport(node) && moduleKind !== 5 /* ES2015 */ && moduleKind !== 6 /* ES2020 */ && moduleKind !== 7 /* ES2022 */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 4 /* System */;
87071
- }
87072
87096
  function recordEmittedDeclarationInScope(node) {
87073
87097
  if (!currentScopeFirstDeclarationsOfName) {
87074
87098
  currentScopeFirstDeclarationsOfName = /* @__PURE__ */ new Map();
@@ -87090,20 +87114,21 @@ function transformTypeScript(context) {
87090
87114
  return node.name.escapedText;
87091
87115
  }
87092
87116
  function addVarForEnumOrModuleDeclaration(statements, node) {
87117
+ const varDecl = factory2.createVariableDeclaration(factory2.getLocalName(
87118
+ node,
87119
+ /*allowComments*/
87120
+ false,
87121
+ /*allowSourceMaps*/
87122
+ true
87123
+ ));
87124
+ const varFlags = currentLexicalScope.kind === 311 /* SourceFile */ ? 0 /* None */ : 1 /* Let */;
87093
87125
  const statement = factory2.createVariableStatement(
87094
87126
  visitNodes2(node.modifiers, modifierVisitor, isModifier),
87095
- factory2.createVariableDeclarationList([
87096
- factory2.createVariableDeclaration(
87097
- factory2.getLocalName(
87098
- node,
87099
- /*allowComments*/
87100
- false,
87101
- /*allowSourceMaps*/
87102
- true
87103
- )
87104
- )
87105
- ], currentLexicalScope.kind === 311 /* SourceFile */ ? 0 /* None */ : 1 /* Let */)
87127
+ factory2.createVariableDeclarationList([varDecl], varFlags)
87106
87128
  );
87129
+ setOriginalNode(varDecl, node);
87130
+ setSyntheticLeadingComments(varDecl, void 0);
87131
+ setSyntheticTrailingComments(varDecl, void 0);
87107
87132
  setOriginalNode(statement, node);
87108
87133
  recordEmittedDeclarationInScope(node);
87109
87134
  if (isFirstEmittedDeclarationInScope(node)) {
@@ -87113,15 +87138,11 @@ function transformTypeScript(context) {
87113
87138
  setSourceMapRange(statement, node);
87114
87139
  }
87115
87140
  setCommentRange(statement, node);
87116
- addEmitFlags(statement, 2048 /* NoTrailingComments */ | 8388608 /* HasEndOfDeclarationMarker */);
87141
+ addEmitFlags(statement, 2048 /* NoTrailingComments */);
87117
87142
  statements.push(statement);
87118
87143
  return true;
87119
- } else {
87120
- const mergeMarker = factory2.createMergeDeclarationMarker(statement);
87121
- setEmitFlags(mergeMarker, 3072 /* NoComments */ | 8388608 /* HasEndOfDeclarationMarker */);
87122
- statements.push(mergeMarker);
87123
- return false;
87124
87144
  }
87145
+ return false;
87125
87146
  }
87126
87147
  function visitModuleDeclaration(node) {
87127
87148
  if (!shouldEmitModuleDeclaration(node)) {
@@ -87139,14 +87160,14 @@ function transformTypeScript(context) {
87139
87160
  }
87140
87161
  const parameterName = getNamespaceParameterName(node);
87141
87162
  const containerName = getNamespaceContainerName(node);
87142
- const exportName = hasSyntacticModifier(node, 1 /* Export */) ? factory2.getExternalModuleOrNamespaceExportName(
87163
+ const exportName = isExportOfNamespace(node) ? factory2.getExternalModuleOrNamespaceExportName(
87143
87164
  currentNamespaceContainerName,
87144
87165
  node,
87145
87166
  /*allowComments*/
87146
87167
  false,
87147
87168
  /*allowSourceMaps*/
87148
87169
  true
87149
- ) : factory2.getLocalName(
87170
+ ) : factory2.getDeclarationName(
87150
87171
  node,
87151
87172
  /*allowComments*/
87152
87173
  false,
@@ -87160,7 +87181,7 @@ function transformTypeScript(context) {
87160
87181
  factory2.createObjectLiteralExpression()
87161
87182
  )
87162
87183
  );
87163
- if (hasNamespaceQualifiedExportName(node)) {
87184
+ if (isExportOfNamespace(node)) {
87164
87185
  const localName = factory2.getLocalName(
87165
87186
  node,
87166
87187
  /*allowComments*/
@@ -87205,7 +87226,6 @@ function transformTypeScript(context) {
87205
87226
  setTextRange(moduleStatement, node);
87206
87227
  addEmitFlags(moduleStatement, emitFlags);
87207
87228
  statements.push(moduleStatement);
87208
- statements.push(factory2.createEndOfDeclarationMarker(node));
87209
87229
  return statements;
87210
87230
  }
87211
87231
  function transformModuleBody(node, namespaceLocalName) {
@@ -88791,23 +88811,12 @@ function transformClassFields(context) {
88791
88811
  getClassLexicalEnvironment().classThis = node.emitNode.classThis;
88792
88812
  }
88793
88813
  }
88794
- const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
88814
+ const isExport = hasSyntacticModifier(node, 1 /* Export */);
88815
+ const isDefault = hasSyntacticModifier(node, 1024 /* Default */);
88816
+ let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier);
88795
88817
  const heritageClauses = visitNodes2(node.heritageClauses, heritageClauseVisitor, isHeritageClause);
88796
88818
  const { members, prologue } = transformClassMembers(node);
88797
- const classDecl = factory2.updateClassDeclaration(
88798
- node,
88799
- modifiers,
88800
- node.name,
88801
- /*typeParameters*/
88802
- void 0,
88803
- heritageClauses,
88804
- members
88805
- );
88806
88819
  const statements = [];
88807
- if (prologue) {
88808
- statements.push(factory2.createExpressionStatement(prologue));
88809
- }
88810
- statements.push(classDecl);
88811
88820
  if (pendingClassReferenceAssignment) {
88812
88821
  getPendingExpressions().unshift(pendingClassReferenceAssignment);
88813
88822
  }
@@ -88820,6 +88829,35 @@ function transformClassFields(context) {
88820
88829
  addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory2.getInternalName(node));
88821
88830
  }
88822
88831
  }
88832
+ if (statements.length > 0 && isExport && isDefault) {
88833
+ modifiers = visitNodes2(modifiers, (node2) => isExportOrDefaultModifier(node2) ? void 0 : node2, isModifier);
88834
+ statements.push(factory2.createExportAssignment(
88835
+ /*modifiers*/
88836
+ void 0,
88837
+ /*isExportEquals*/
88838
+ false,
88839
+ factory2.getLocalName(
88840
+ node,
88841
+ /*allowComments*/
88842
+ false,
88843
+ /*allowSourceMaps*/
88844
+ true
88845
+ )
88846
+ ));
88847
+ }
88848
+ const classDecl = factory2.updateClassDeclaration(
88849
+ node,
88850
+ modifiers,
88851
+ node.name,
88852
+ /*typeParameters*/
88853
+ void 0,
88854
+ heritageClauses,
88855
+ members
88856
+ );
88857
+ statements.unshift(classDecl);
88858
+ if (prologue) {
88859
+ statements.unshift(factory2.createExpressionStatement(prologue));
88860
+ }
88823
88861
  return statements;
88824
88862
  }
88825
88863
  function visitClassExpression(node, referencedName) {
@@ -90257,10 +90295,6 @@ function transformLegacyDecorators(context) {
90257
90295
  true,
90258
90296
  node
90259
90297
  ) ? transformClassDeclarationWithClassDecorators(node, node.name) : transformClassDeclarationWithoutClassDecorators(node, node.name);
90260
- if (statements.length > 1) {
90261
- statements.push(factory2.createEndOfDeclarationMarker(node));
90262
- setEmitFlags(statements[0], getEmitFlags(statements[0]) | 8388608 /* HasEndOfDeclarationMarker */);
90263
- }
90264
90298
  return singleOrMany(statements);
90265
90299
  }
90266
90300
  function decoratorContainsPrivateIdentifierInExpression(decorator) {
@@ -90333,9 +90367,12 @@ function transformLegacyDecorators(context) {
90333
90367
  return addRange([updated], decorationStatements);
90334
90368
  }
90335
90369
  function transformClassDeclarationWithClassDecorators(node, name) {
90370
+ const isExport = hasSyntacticModifier(node, 1 /* Export */);
90371
+ const isDefault = hasSyntacticModifier(node, 1024 /* Default */);
90372
+ const modifiers = visitNodes2(node.modifiers, (node2) => isExportOrDefaultModifier(node2) || isDecorator(node2) ? void 0 : node2, isModifierLike);
90336
90373
  const location = moveRangePastModifiers(node);
90337
90374
  const classAlias = getClassAliasIfNeeded(node);
90338
- const declName = languageVersion <= 2 /* ES2015 */ ? factory2.getInternalName(
90375
+ const declName = languageVersion < 2 /* ES2015 */ ? factory2.getInternalName(
90339
90376
  node,
90340
90377
  /*allowComments*/
90341
90378
  false,
@@ -90353,8 +90390,7 @@ function transformLegacyDecorators(context) {
90353
90390
  let decorationStatements = [];
90354
90391
  ({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members));
90355
90392
  const classExpression = factory2.createClassExpression(
90356
- /*modifiers*/
90357
- void 0,
90393
+ modifiers,
90358
90394
  name && isGeneratedIdentifier(name) ? void 0 : name,
90359
90395
  /*typeParameters*/
90360
90396
  void 0,
@@ -90363,18 +90399,23 @@ function transformLegacyDecorators(context) {
90363
90399
  );
90364
90400
  setOriginalNode(classExpression, node);
90365
90401
  setTextRange(classExpression, location);
90366
- const statement = factory2.createVariableStatement(
90367
- /*modifiers*/
90402
+ const varDecl = factory2.createVariableDeclaration(
90403
+ declName,
90404
+ /*exclamationToken*/
90368
90405
  void 0,
90406
+ /*type*/
90407
+ void 0,
90408
+ classAlias ? factory2.createAssignment(classAlias, classExpression) : classExpression
90409
+ );
90410
+ setOriginalNode(varDecl, node);
90411
+ let varModifiers;
90412
+ if (isExport && !isDefault) {
90413
+ varModifiers = factory2.createModifiersFromModifierFlags(1 /* Export */);
90414
+ }
90415
+ const statement = factory2.createVariableStatement(
90416
+ varModifiers,
90369
90417
  factory2.createVariableDeclarationList([
90370
- factory2.createVariableDeclaration(
90371
- declName,
90372
- /*exclamationToken*/
90373
- void 0,
90374
- /*type*/
90375
- void 0,
90376
- classAlias ? factory2.createAssignment(classAlias, classExpression) : classExpression
90377
- )
90418
+ varDecl
90378
90419
  ], 1 /* Let */)
90379
90420
  );
90380
90421
  setOriginalNode(statement, node);
@@ -90383,6 +90424,15 @@ function transformLegacyDecorators(context) {
90383
90424
  const statements = [statement];
90384
90425
  addRange(statements, decorationStatements);
90385
90426
  addConstructorDecorationStatement(statements, node);
90427
+ if (isExport && isDefault) {
90428
+ statements.push(factory2.createExportAssignment(
90429
+ /*modifiers*/
90430
+ void 0,
90431
+ /*isExportEquals*/
90432
+ false,
90433
+ declName
90434
+ ));
90435
+ }
90386
90436
  return statements;
90387
90437
  }
90388
90438
  function visitClassExpression(node) {
@@ -90559,13 +90609,13 @@ function transformLegacyDecorators(context) {
90559
90609
  return void 0;
90560
90610
  }
90561
90611
  const classAlias = classAliases && classAliases[getOriginalNodeId(node)];
90562
- const localName = languageVersion <= 2 /* ES2015 */ ? factory2.getInternalName(
90612
+ const localName = languageVersion < 2 /* ES2015 */ ? factory2.getInternalName(
90563
90613
  node,
90564
90614
  /*allowComments*/
90565
90615
  false,
90566
90616
  /*allowSourceMaps*/
90567
90617
  true
90568
- ) : factory2.getLocalName(
90618
+ ) : factory2.getDeclarationName(
90569
90619
  node,
90570
90620
  /*allowComments*/
90571
90621
  false,
@@ -91054,7 +91104,15 @@ function transformESDecorators(context) {
91054
91104
  function transformClassLike(node, className) {
91055
91105
  var _a;
91056
91106
  startLexicalEnvironment();
91057
- const classReference = node.name ?? factory2.getGeneratedNameForNode(node);
91107
+ const classReference = factory2.getLocalName(
91108
+ node,
91109
+ /*allowComments*/
91110
+ false,
91111
+ /*allowSourceMaps*/
91112
+ false,
91113
+ /*ignoreAssignedName*/
91114
+ true
91115
+ );
91058
91116
  const classInfo2 = createClassInfo(node);
91059
91117
  const classDefinitionStatements = [];
91060
91118
  let leadingBlockStatements;
@@ -91370,6 +91428,7 @@ function transformESDecorators(context) {
91370
91428
  void 0,
91371
91429
  iife
91372
91430
  );
91431
+ setOriginalNode(varDecl, node);
91373
91432
  const varDecls = factory2.createVariableDeclarationList([varDecl], 1 /* Let */);
91374
91433
  const statement = factory2.createVariableStatement(modifiers, varDecls);
91375
91434
  setOriginalNode(statement, node);
@@ -96062,11 +96121,6 @@ function transformES2015(context) {
96062
96121
  setOriginalNode(exportStatement, statement);
96063
96122
  statements.push(exportStatement);
96064
96123
  }
96065
- const emitFlags = getEmitFlags(node);
96066
- if ((emitFlags & 8388608 /* HasEndOfDeclarationMarker */) === 0) {
96067
- statements.push(factory2.createEndOfDeclarationMarker(node));
96068
- setEmitFlags(statement, emitFlags | 8388608 /* HasEndOfDeclarationMarker */);
96069
- }
96070
96124
  return singleOrMany(statements);
96071
96125
  }
96072
96126
  function visitClassExpression(node) {
@@ -98029,7 +98083,7 @@ function transformES2015(context) {
98029
98083
  );
98030
98084
  const callResult = containsYield ? factory2.createYieldExpression(
98031
98085
  factory2.createToken(42 /* AsteriskToken */),
98032
- setEmitFlags(call, 16777216 /* Iterator */)
98086
+ setEmitFlags(call, 8388608 /* Iterator */)
98033
98087
  ) : call;
98034
98088
  return factory2.createExpressionStatement(callResult);
98035
98089
  }
@@ -98044,7 +98098,7 @@ function transformES2015(context) {
98044
98098
  );
98045
98099
  const callResult = containsYield ? factory2.createYieldExpression(
98046
98100
  factory2.createToken(42 /* AsteriskToken */),
98047
- setEmitFlags(call, 16777216 /* Iterator */)
98101
+ setEmitFlags(call, 8388608 /* Iterator */)
98048
98102
  ) : call;
98049
98103
  if (isSimpleLoop) {
98050
98104
  statements.push(factory2.createExpressionStatement(callResult));
@@ -99368,7 +99422,7 @@ function transformGenerators(context) {
99368
99422
  const resumeLabel = defineLabel();
99369
99423
  const expression = visitNode(node.expression, visitor, isExpression);
99370
99424
  if (node.asteriskToken) {
99371
- const iterator = (getEmitFlags(node.expression) & 16777216 /* Iterator */) === 0 ? setTextRange(emitHelpers().createValuesHelper(expression), node) : expression;
99425
+ const iterator = (getEmitFlags(node.expression) & 8388608 /* Iterator */) === 0 ? setTextRange(emitHelpers().createValuesHelper(expression), node) : expression;
99372
99426
  emitYieldStar(
99373
99427
  iterator,
99374
99428
  /*location*/
@@ -100916,7 +100970,6 @@ function transformModule(context) {
100916
100970
  context.enableSubstitution(303 /* ShorthandPropertyAssignment */);
100917
100971
  context.enableEmitNotification(311 /* SourceFile */);
100918
100972
  const moduleInfoMap = [];
100919
- const deferredExports = [];
100920
100973
  let currentSourceFile;
100921
100974
  let currentModuleInfo;
100922
100975
  const noSubstitution = [];
@@ -101341,10 +101394,6 @@ function transformModule(context) {
101341
101394
  return visitFunctionDeclaration(node);
101342
101395
  case 262 /* ClassDeclaration */:
101343
101396
  return visitClassDeclaration(node);
101344
- case 361 /* MergeDeclarationMarker */:
101345
- return visitMergeDeclarationMarker(node);
101346
- case 362 /* EndOfDeclarationMarker */:
101347
- return visitEndOfDeclarationMarker(node);
101348
101397
  default:
101349
101398
  return visitor(node);
101350
101399
  }
@@ -101821,12 +101870,7 @@ function transformModule(context) {
101821
101870
  )
101822
101871
  );
101823
101872
  }
101824
- if (hasAssociatedEndOfDeclarationMarker(node)) {
101825
- const id = getOriginalNodeId(node);
101826
- deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);
101827
- } else {
101828
- statements = appendExportsOfImportDeclaration(statements, node);
101829
- }
101873
+ statements = appendExportsOfImportDeclaration(statements, node);
101830
101874
  return singleOrMany(statements);
101831
101875
  }
101832
101876
  function createRequireCall(importNode) {
@@ -101907,12 +101951,7 @@ function transformModule(context) {
101907
101951
  );
101908
101952
  }
101909
101953
  }
101910
- if (hasAssociatedEndOfDeclarationMarker(node)) {
101911
- const id = getOriginalNodeId(node);
101912
- deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);
101913
- } else {
101914
- statements = appendExportsOfImportEqualsDeclaration(statements, node);
101915
- }
101954
+ statements = appendExportsOfImportEqualsDeclaration(statements, node);
101916
101955
  return singleOrMany(statements);
101917
101956
  }
101918
101957
  function visitExportDeclaration(node) {
@@ -102021,31 +102060,14 @@ function transformModule(context) {
102021
102060
  if (node.isExportEquals) {
102022
102061
  return void 0;
102023
102062
  }
102024
- let statements;
102025
- const original = node.original;
102026
- if (original && hasAssociatedEndOfDeclarationMarker(original)) {
102027
- const id = getOriginalNodeId(node);
102028
- deferredExports[id] = appendExportStatement(
102029
- deferredExports[id],
102030
- factory2.createIdentifier("default"),
102031
- visitNode(node.expression, visitor, isExpression),
102032
- /*location*/
102033
- node,
102034
- /*allowComments*/
102035
- true
102036
- );
102037
- } else {
102038
- statements = appendExportStatement(
102039
- statements,
102040
- factory2.createIdentifier("default"),
102041
- visitNode(node.expression, visitor, isExpression),
102042
- /*location*/
102043
- node,
102044
- /*allowComments*/
102045
- true
102046
- );
102047
- }
102048
- return singleOrMany(statements);
102063
+ return createExportStatement(
102064
+ factory2.createIdentifier("default"),
102065
+ visitNode(node.expression, visitor, isExpression),
102066
+ /*location*/
102067
+ node,
102068
+ /*allowComments*/
102069
+ true
102070
+ );
102049
102071
  }
102050
102072
  function visitFunctionDeclaration(node) {
102051
102073
  let statements;
@@ -102081,12 +102103,7 @@ function transformModule(context) {
102081
102103
  } else {
102082
102104
  statements = append(statements, visitEachChild(node, visitor, context));
102083
102105
  }
102084
- if (hasAssociatedEndOfDeclarationMarker(node)) {
102085
- const id = getOriginalNodeId(node);
102086
- deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
102087
- } else {
102088
- statements = appendExportsOfHoistedDeclaration(statements, node);
102089
- }
102106
+ statements = appendExportsOfHoistedDeclaration(statements, node);
102090
102107
  return singleOrMany(statements);
102091
102108
  }
102092
102109
  function visitClassDeclaration(node) {
@@ -102118,12 +102135,7 @@ function transformModule(context) {
102118
102135
  } else {
102119
102136
  statements = append(statements, visitEachChild(node, visitor, context));
102120
102137
  }
102121
- if (hasAssociatedEndOfDeclarationMarker(node)) {
102122
- const id = getOriginalNodeId(node);
102123
- deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
102124
- } else {
102125
- statements = appendExportsOfHoistedDeclaration(statements, node);
102126
- }
102138
+ statements = appendExportsOfHoistedDeclaration(statements, node);
102127
102139
  return singleOrMany(statements);
102128
102140
  }
102129
102141
  function visitVariableStatement(node) {
@@ -102195,12 +102207,7 @@ function transformModule(context) {
102195
102207
  } else {
102196
102208
  statements = append(statements, visitEachChild(node, visitor, context));
102197
102209
  }
102198
- if (hasAssociatedEndOfDeclarationMarker(node)) {
102199
- const id = getOriginalNodeId(node);
102200
- deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node);
102201
- } else {
102202
- statements = appendExportsOfVariableStatement(statements, node);
102203
- }
102210
+ statements = appendExportsOfVariableStatement(statements, node);
102204
102211
  return singleOrMany(statements);
102205
102212
  }
102206
102213
  function createAllExportExpressions(name, value, location) {
@@ -102245,25 +102252,6 @@ function transformModule(context) {
102245
102252
  );
102246
102253
  }
102247
102254
  }
102248
- function visitMergeDeclarationMarker(node) {
102249
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 242 /* VariableStatement */) {
102250
- const id = getOriginalNodeId(node);
102251
- deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
102252
- }
102253
- return node;
102254
- }
102255
- function hasAssociatedEndOfDeclarationMarker(node) {
102256
- return (getEmitFlags(node) & 8388608 /* HasEndOfDeclarationMarker */) !== 0;
102257
- }
102258
- function visitEndOfDeclarationMarker(node) {
102259
- const id = getOriginalNodeId(node);
102260
- const statements = deferredExports[id];
102261
- if (statements) {
102262
- delete deferredExports[id];
102263
- return append(statements, node);
102264
- }
102265
- return node;
102266
- }
102267
102255
  function appendExportsOfImportDeclaration(statements, decl) {
102268
102256
  if (currentModuleInfo.exportEquals) {
102269
102257
  return statements;
@@ -102320,7 +102308,7 @@ function transformModule(context) {
102320
102308
  statements = appendExportsOfBindingElement(statements, element);
102321
102309
  }
102322
102310
  }
102323
- } else if (!isGeneratedIdentifier(decl.name)) {
102311
+ } else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer)) {
102324
102312
  statements = appendExportsOfDeclaration(statements, decl);
102325
102313
  }
102326
102314
  return statements;
@@ -102591,7 +102579,7 @@ function transformModule(context) {
102591
102579
  return node;
102592
102580
  }
102593
102581
  function substituteBinaryExpression(node) {
102594
- if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left) && !isDeclarationNameOfEnumOrNamespace(node.left)) {
102582
+ if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left)) {
102595
102583
  const exportedNames = getExports(node.left);
102596
102584
  if (exportedNames) {
102597
102585
  let expression = node;
@@ -102611,9 +102599,24 @@ function transformModule(context) {
102611
102599
  }
102612
102600
  function getExports(name) {
102613
102601
  if (!isGeneratedIdentifier(name)) {
102614
- const valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
102615
- if (valueDeclaration) {
102616
- return currentModuleInfo && currentModuleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)];
102602
+ const importDeclaration = resolver.getReferencedImportDeclaration(name);
102603
+ if (importDeclaration) {
102604
+ return currentModuleInfo == null ? void 0 : currentModuleInfo.exportedBindings[getOriginalNodeId(importDeclaration)];
102605
+ }
102606
+ const bindingsSet = /* @__PURE__ */ new Set();
102607
+ const declarations = resolver.getReferencedValueDeclarations(name);
102608
+ if (declarations) {
102609
+ for (const declaration of declarations) {
102610
+ const bindings = currentModuleInfo == null ? void 0 : currentModuleInfo.exportedBindings[getOriginalNodeId(declaration)];
102611
+ if (bindings) {
102612
+ for (const binding of bindings) {
102613
+ bindingsSet.add(binding);
102614
+ }
102615
+ }
102616
+ }
102617
+ if (bindingsSet.size) {
102618
+ return arrayFrom(bindingsSet);
102619
+ }
102617
102620
  }
102618
102621
  }
102619
102622
  }
@@ -102646,7 +102649,6 @@ function transformSystemModule(context) {
102646
102649
  context.enableSubstitution(235 /* MetaProperty */);
102647
102650
  context.enableEmitNotification(311 /* SourceFile */);
102648
102651
  const moduleInfoMap = [];
102649
- const deferredExports = [];
102650
102652
  const exportFunctionsMap = [];
102651
102653
  const noSubstitutionMap = [];
102652
102654
  const contextObjectMap = [];
@@ -103119,13 +103121,7 @@ function transformSystemModule(context) {
103119
103121
  if (node.importClause) {
103120
103122
  hoistVariableDeclaration(getLocalNameForExternalImport(factory2, node, currentSourceFile));
103121
103123
  }
103122
- if (hasAssociatedEndOfDeclarationMarker(node)) {
103123
- const id = getOriginalNodeId(node);
103124
- deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node);
103125
- } else {
103126
- statements = appendExportsOfImportDeclaration(statements, node);
103127
- }
103128
- return singleOrMany(statements);
103124
+ return singleOrMany(appendExportsOfImportDeclaration(statements, node));
103129
103125
  }
103130
103126
  function visitExportDeclaration(node) {
103131
103127
  Debug.assertIsDefined(node);
@@ -103135,37 +103131,19 @@ function transformSystemModule(context) {
103135
103131
  Debug.assert(isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer.");
103136
103132
  let statements;
103137
103133
  hoistVariableDeclaration(getLocalNameForExternalImport(factory2, node, currentSourceFile));
103138
- if (hasAssociatedEndOfDeclarationMarker(node)) {
103139
- const id = getOriginalNodeId(node);
103140
- deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node);
103141
- } else {
103142
- statements = appendExportsOfImportEqualsDeclaration(statements, node);
103143
- }
103144
- return singleOrMany(statements);
103134
+ return singleOrMany(appendExportsOfImportEqualsDeclaration(statements, node));
103145
103135
  }
103146
103136
  function visitExportAssignment(node) {
103147
103137
  if (node.isExportEquals) {
103148
103138
  return void 0;
103149
103139
  }
103150
103140
  const expression = visitNode(node.expression, visitor, isExpression);
103151
- const original = node.original;
103152
- if (original && hasAssociatedEndOfDeclarationMarker(original)) {
103153
- const id = getOriginalNodeId(node);
103154
- deferredExports[id] = appendExportStatement(
103155
- deferredExports[id],
103156
- factory2.createIdentifier("default"),
103157
- expression,
103158
- /*allowComments*/
103159
- true
103160
- );
103161
- } else {
103162
- return createExportStatement(
103163
- factory2.createIdentifier("default"),
103164
- expression,
103165
- /*allowComments*/
103166
- true
103167
- );
103168
- }
103141
+ return createExportStatement(
103142
+ factory2.createIdentifier("default"),
103143
+ expression,
103144
+ /*allowComments*/
103145
+ true
103146
+ );
103169
103147
  }
103170
103148
  function visitFunctionDeclaration(node) {
103171
103149
  if (hasSyntacticModifier(node, 1 /* Export */)) {
@@ -103193,12 +103171,7 @@ function transformSystemModule(context) {
103193
103171
  } else {
103194
103172
  hoistedStatements = append(hoistedStatements, visitEachChild(node, visitor, context));
103195
103173
  }
103196
- if (hasAssociatedEndOfDeclarationMarker(node)) {
103197
- const id = getOriginalNodeId(node);
103198
- deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
103199
- } else {
103200
- hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node);
103201
- }
103174
+ hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node);
103202
103175
  return void 0;
103203
103176
  }
103204
103177
  function visitClassDeclaration(node) {
@@ -103227,12 +103200,7 @@ function transformSystemModule(context) {
103227
103200
  node
103228
103201
  )
103229
103202
  );
103230
- if (hasAssociatedEndOfDeclarationMarker(node)) {
103231
- const id = getOriginalNodeId(node);
103232
- deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node);
103233
- } else {
103234
- statements = appendExportsOfHoistedDeclaration(statements, node);
103235
- }
103203
+ statements = appendExportsOfHoistedDeclaration(statements, node);
103236
103204
  return singleOrMany(statements);
103237
103205
  }
103238
103206
  function visitVariableStatement(node) {
@@ -103241,10 +103209,9 @@ function transformSystemModule(context) {
103241
103209
  }
103242
103210
  let expressions;
103243
103211
  const isExportedDeclaration = hasSyntacticModifier(node, 1 /* Export */);
103244
- const isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node);
103245
103212
  for (const variable of node.declarationList.declarations) {
103246
103213
  if (variable.initializer) {
103247
- expressions = append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration));
103214
+ expressions = append(expressions, transformInitializedVariable(variable, isExportedDeclaration));
103248
103215
  } else {
103249
103216
  hoistBindingElement(variable);
103250
103217
  }
@@ -103253,17 +103220,12 @@ function transformSystemModule(context) {
103253
103220
  if (expressions) {
103254
103221
  statements = append(statements, setTextRange(factory2.createExpressionStatement(factory2.inlineExpressions(expressions)), node));
103255
103222
  }
103256
- if (isMarkedDeclaration) {
103257
- const id = getOriginalNodeId(node);
103258
- deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration);
103259
- } else {
103260
- statements = appendExportsOfVariableStatement(
103261
- statements,
103262
- node,
103263
- /*exportSelf*/
103264
- false
103265
- );
103266
- }
103223
+ statements = appendExportsOfVariableStatement(
103224
+ statements,
103225
+ node,
103226
+ /*exportSelf*/
103227
+ false
103228
+ );
103267
103229
  return singleOrMany(statements);
103268
103230
  }
103269
103231
  function hoistBindingElement(node) {
@@ -103314,31 +103276,6 @@ function transformSystemModule(context) {
103314
103276
  hoistVariableDeclaration(factory2.cloneNode(name));
103315
103277
  return isExportedDeclaration ? createExportExpression(name, preventSubstitution(setTextRange(factory2.createAssignment(name, value), location))) : preventSubstitution(setTextRange(factory2.createAssignment(name, value), location));
103316
103278
  }
103317
- function visitMergeDeclarationMarker(node) {
103318
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 242 /* VariableStatement */) {
103319
- const id = getOriginalNodeId(node);
103320
- const isExportedDeclaration = hasSyntacticModifier(node.original, 1 /* Export */);
103321
- deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
103322
- }
103323
- return node;
103324
- }
103325
- function hasAssociatedEndOfDeclarationMarker(node) {
103326
- return (getEmitFlags(node) & 8388608 /* HasEndOfDeclarationMarker */) !== 0;
103327
- }
103328
- function visitEndOfDeclarationMarker(node) {
103329
- const id = getOriginalNodeId(node);
103330
- const statements = deferredExports[id];
103331
- if (statements) {
103332
- delete deferredExports[id];
103333
- return append(statements, node);
103334
- } else {
103335
- const original = getOriginalNode(node);
103336
- if (isModuleOrEnumDeclaration(original)) {
103337
- return append(appendExportsOfDeclaration(statements, original), node);
103338
- }
103339
- }
103340
- return node;
103341
- }
103342
103279
  function appendExportsOfImportDeclaration(statements, decl) {
103343
103280
  if (moduleInfo.exportEquals) {
103344
103281
  return statements;
@@ -103494,10 +103431,6 @@ function transformSystemModule(context) {
103494
103431
  return visitCatchClause(node);
103495
103432
  case 240 /* Block */:
103496
103433
  return visitBlock(node);
103497
- case 361 /* MergeDeclarationMarker */:
103498
- return visitMergeDeclarationMarker(node);
103499
- case 362 /* EndOfDeclarationMarker */:
103500
- return visitEndOfDeclarationMarker(node);
103501
103434
  default:
103502
103435
  return visitor(node);
103503
103436
  }
@@ -103903,7 +103836,7 @@ function transformSystemModule(context) {
103903
103836
  return node;
103904
103837
  }
103905
103838
  function substituteBinaryExpression(node) {
103906
- if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left) && !isDeclarationNameOfEnumOrNamespace(node.left)) {
103839
+ if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left)) {
103907
103840
  const exportedNames = getExports(node.left);
103908
103841
  if (exportedNames) {
103909
103842
  let expression = node;
@@ -103923,21 +103856,37 @@ function transformSystemModule(context) {
103923
103856
  }
103924
103857
  function getExports(name) {
103925
103858
  let exportedNames;
103859
+ const valueDeclaration = getReferencedDeclaration(name);
103860
+ if (valueDeclaration) {
103861
+ const exportContainer = resolver.getReferencedExportContainer(
103862
+ name,
103863
+ /*prefixLocals*/
103864
+ false
103865
+ );
103866
+ if (exportContainer && exportContainer.kind === 311 /* SourceFile */) {
103867
+ exportedNames = append(exportedNames, factory2.getDeclarationName(valueDeclaration));
103868
+ }
103869
+ exportedNames = addRange(exportedNames, moduleInfo == null ? void 0 : moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]);
103870
+ }
103871
+ return exportedNames;
103872
+ }
103873
+ function getReferencedDeclaration(name) {
103926
103874
  if (!isGeneratedIdentifier(name)) {
103927
- const valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name);
103928
- if (valueDeclaration) {
103929
- const exportContainer = resolver.getReferencedExportContainer(
103930
- name,
103931
- /*prefixLocals*/
103932
- false
103933
- );
103934
- if (exportContainer && exportContainer.kind === 311 /* SourceFile */) {
103935
- exportedNames = append(exportedNames, factory2.getDeclarationName(valueDeclaration));
103875
+ const importDeclaration = resolver.getReferencedImportDeclaration(name);
103876
+ if (importDeclaration)
103877
+ return importDeclaration;
103878
+ const valueDeclaration = resolver.getReferencedValueDeclaration(name);
103879
+ if (valueDeclaration && (moduleInfo == null ? void 0 : moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]))
103880
+ return valueDeclaration;
103881
+ const declarations = resolver.getReferencedValueDeclarations(name);
103882
+ if (declarations) {
103883
+ for (const declaration of declarations) {
103884
+ if (declaration !== valueDeclaration && (moduleInfo == null ? void 0 : moduleInfo.exportedBindings[getOriginalNodeId(declaration)]))
103885
+ return declaration;
103936
103886
  }
103937
- exportedNames = addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]);
103938
103887
  }
103888
+ return valueDeclaration;
103939
103889
  }
103940
- return exportedNames;
103941
103890
  }
103942
103891
  function preventSubstitution(node) {
103943
103892
  if (noSubstitution === void 0)
@@ -106351,7 +106300,7 @@ function noEmitNotification(hint, node, callback) {
106351
106300
  }
106352
106301
  function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) {
106353
106302
  var _a, _b;
106354
- const enabledSyntaxKindFeatures = new Array(364 /* Count */);
106303
+ const enabledSyntaxKindFeatures = new Array(362 /* Count */);
106355
106304
  let lexicalEnvironmentVariableDeclarations;
106356
106305
  let lexicalEnvironmentFunctionDeclarations;
106357
106306
  let lexicalEnvironmentStatements;
@@ -107284,6 +107233,7 @@ var notImplementedResolver = {
107284
107233
  // Returns the constant value this property access resolves to: notImplemented, or 'undefined' for a non-constant
107285
107234
  getConstantValue: notImplemented,
107286
107235
  getReferencedValueDeclaration: notImplemented,
107236
+ getReferencedValueDeclarations: notImplemented,
107287
107237
  getTypeReferenceSerializationKind: notImplemented,
107288
107238
  isOptionalParameter: notImplemented,
107289
107239
  moduleExportsSomeValue: notImplemented,
@@ -108237,8 +108187,6 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108237
108187
  case 353 /* JSDocSeeTag */:
108238
108188
  return emitJSDocSeeTag(node);
108239
108189
  case 358 /* NotEmittedStatement */:
108240
- case 362 /* EndOfDeclarationMarker */:
108241
- case 361 /* MergeDeclarationMarker */:
108242
108190
  return;
108243
108191
  }
108244
108192
  if (isExpression(node)) {
@@ -108349,10 +108297,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108349
108297
  return emitPartiallyEmittedExpression(node);
108350
108298
  case 360 /* CommaListExpression */:
108351
108299
  return emitCommaList(node);
108352
- case 361 /* MergeDeclarationMarker */:
108353
- case 362 /* EndOfDeclarationMarker */:
108354
- return;
108355
- case 363 /* SyntheticReferenceExpression */:
108300
+ case 361 /* SyntheticReferenceExpression */:
108356
108301
  return Debug.fail("SyntheticReferenceExpression should not be printed");
108357
108302
  }
108358
108303
  }
@@ -111188,7 +111133,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111188
111133
  const textSourceNode = node.textSourceNode;
111189
111134
  if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
111190
111135
  const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
111191
- return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
111136
+ return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
111192
111137
  } else {
111193
111138
  return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape);
111194
111139
  }