typescript 5.7.0-dev.20240927 → 5.7.0-dev.20240928

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
@@ -595,6 +595,7 @@ __export(typescript_exports, {
595
595
  forEachAncestorDirectoryStoppingAtGlobalCache: () => forEachAncestorDirectoryStoppingAtGlobalCache,
596
596
  forEachChild: () => forEachChild,
597
597
  forEachChildRecursively: () => forEachChildRecursively,
598
+ forEachDynamicImportOrRequireCall: () => forEachDynamicImportOrRequireCall,
598
599
  forEachEmittedFile: () => forEachEmittedFile,
599
600
  forEachEnclosingBlockScopeContainer: () => forEachEnclosingBlockScopeContainer,
600
601
  forEachEntry: () => forEachEntry,
@@ -635,6 +636,7 @@ __export(typescript_exports, {
635
636
  getAllKeys: () => getAllKeys,
636
637
  getAllProjectOutputs: () => getAllProjectOutputs,
637
638
  getAllSuperTypeNodes: () => getAllSuperTypeNodes,
639
+ getAllowImportingTsExtensions: () => getAllowImportingTsExtensions,
638
640
  getAllowJSCompilerOption: () => getAllowJSCompilerOption,
639
641
  getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
640
642
  getAncestor: () => getAncestor,
@@ -1492,6 +1494,7 @@ __export(typescript_exports, {
1492
1494
  isJsxAttributeLike: () => isJsxAttributeLike,
1493
1495
  isJsxAttributeName: () => isJsxAttributeName,
1494
1496
  isJsxAttributes: () => isJsxAttributes,
1497
+ isJsxCallLike: () => isJsxCallLike,
1495
1498
  isJsxChild: () => isJsxChild,
1496
1499
  isJsxClosingElement: () => isJsxClosingElement,
1497
1500
  isJsxClosingFragment: () => isJsxClosingFragment,
@@ -1622,6 +1625,7 @@ __export(typescript_exports, {
1622
1625
  isParseTreeNode: () => isParseTreeNode,
1623
1626
  isPartOfParameterDeclaration: () => isPartOfParameterDeclaration,
1624
1627
  isPartOfTypeNode: () => isPartOfTypeNode,
1628
+ isPartOfTypeOnlyImportOrExportDeclaration: () => isPartOfTypeOnlyImportOrExportDeclaration,
1625
1629
  isPartOfTypeQuery: () => isPartOfTypeQuery,
1626
1630
  isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
1627
1631
  isPatternMatch: () => isPatternMatch,
@@ -2021,6 +2025,7 @@ __export(typescript_exports, {
2021
2025
  returnTrue: () => returnTrue,
2022
2026
  returnUndefined: () => returnUndefined,
2023
2027
  returnsPromise: () => returnsPromise,
2028
+ rewriteModuleSpecifier: () => rewriteModuleSpecifier,
2024
2029
  sameFlatMap: () => sameFlatMap,
2025
2030
  sameMap: () => sameMap,
2026
2031
  sameMapping: () => sameMapping,
@@ -2066,6 +2071,7 @@ __export(typescript_exports, {
2066
2071
  setValueDeclaration: () => setValueDeclaration,
2067
2072
  shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
2068
2073
  shouldPreserveConstEnums: () => shouldPreserveConstEnums,
2074
+ shouldRewriteModuleSpecifier: () => shouldRewriteModuleSpecifier,
2069
2075
  shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
2070
2076
  showModuleSpecifier: () => showModuleSpecifier,
2071
2077
  signatureHasRestParameter: () => signatureHasRestParameter,
@@ -2271,7 +2277,7 @@ module.exports = __toCommonJS(typescript_exports);
2271
2277
 
2272
2278
  // src/compiler/corePublic.ts
2273
2279
  var versionMajorMinor = "5.7";
2274
- var version = `${versionMajorMinor}.0-dev.20240927`;
2280
+ var version = `${versionMajorMinor}.0-dev.20240928`;
2275
2281
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2276
2282
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2277
2283
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6767,6 +6773,7 @@ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => {
6767
6773
  ScriptTarget12[ScriptTarget12["ES2021"] = 8] = "ES2021";
6768
6774
  ScriptTarget12[ScriptTarget12["ES2022"] = 9] = "ES2022";
6769
6775
  ScriptTarget12[ScriptTarget12["ES2023"] = 10] = "ES2023";
6776
+ ScriptTarget12[ScriptTarget12["ES2024"] = 11] = "ES2024";
6770
6777
  ScriptTarget12[ScriptTarget12["ESNext"] = 99] = "ESNext";
6771
6778
  ScriptTarget12[ScriptTarget12["JSON"] = 100] = "JSON";
6772
6779
  ScriptTarget12[ScriptTarget12["Latest"] = 99 /* ESNext */] = "Latest";
@@ -7074,10 +7081,10 @@ var LanguageFeatureMinimumTarget = {
7074
7081
  ClassFields: 9 /* ES2022 */,
7075
7082
  PrivateNamesAndClassStaticBlocks: 9 /* ES2022 */,
7076
7083
  RegularExpressionFlagsHasIndices: 9 /* ES2022 */,
7077
- ShebangComments: 99 /* ESNext */,
7084
+ ShebangComments: 10 /* ES2023 */,
7085
+ RegularExpressionFlagsUnicodeSets: 11 /* ES2024 */,
7078
7086
  UsingAndAwaitUsing: 99 /* ESNext */,
7079
- ClassAndClassElementDecorators: 99 /* ESNext */,
7080
- RegularExpressionFlagsUnicodeSets: 99 /* ESNext */
7087
+ ClassAndClassElementDecorators: 99 /* ESNext */
7081
7088
  };
7082
7089
  var ExternalEmitHelpers = /* @__PURE__ */ ((ExternalEmitHelpers2) => {
7083
7090
  ExternalEmitHelpers2[ExternalEmitHelpers2["Extends"] = 1] = "Extends";
@@ -7106,6 +7113,7 @@ var ExternalEmitHelpers = /* @__PURE__ */ ((ExternalEmitHelpers2) => {
7106
7113
  ExternalEmitHelpers2[ExternalEmitHelpers2["SetFunctionName"] = 4194304] = "SetFunctionName";
7107
7114
  ExternalEmitHelpers2[ExternalEmitHelpers2["PropKey"] = 8388608] = "PropKey";
7108
7115
  ExternalEmitHelpers2[ExternalEmitHelpers2["AddDisposableResourceAndDisposeResources"] = 16777216] = "AddDisposableResourceAndDisposeResources";
7116
+ ExternalEmitHelpers2[ExternalEmitHelpers2["RewriteRelativeImportExtension"] = 33554432] = "RewriteRelativeImportExtension";
7109
7117
  ExternalEmitHelpers2[ExternalEmitHelpers2["FirstEmitHelper"] = 1 /* Extends */] = "FirstEmitHelper";
7110
7118
  ExternalEmitHelpers2[ExternalEmitHelpers2["LastEmitHelper"] = 16777216 /* AddDisposableResourceAndDisposeResources */] = "LastEmitHelper";
7111
7119
  ExternalEmitHelpers2[ExternalEmitHelpers2["ForOfIncludes"] = 256 /* Values */] = "ForOfIncludes";
@@ -10105,6 +10113,10 @@ var Diagnostics = {
10105
10113
  This_kind_of_expression_is_always_falsy: diag(2873, 1 /* Error */, "This_kind_of_expression_is_always_falsy_2873", "This kind of expression is always falsy."),
10106
10114
  This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found: diag(2874, 1 /* Error */, "This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found_2874", "This JSX tag requires '{0}' to be in scope, but it could not be found."),
10107
10115
  This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed: diag(2875, 1 /* Error */, "This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_fo_2875", "This JSX tag requires the module path '{0}' to exist, but none could be found. Make sure you have types for the appropriate package installed."),
10116
+ This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolves_to_0: diag(2876, 1 /* Error */, "This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolv_2876", 'This relative import path is unsafe to rewrite because it looks like a file name, but actually resolves to "{0}".'),
10117
+ This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path: diag(2877, 1 /* Error */, "This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_duri_2877", "This import uses a '{0}' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path."),
10118
+ This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2878, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2878", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
10119
+ Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."),
10108
10120
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
10109
10121
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
10110
10122
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -10661,6 +10673,7 @@ var Diagnostics = {
10661
10673
  Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0: diag(6418, 3 /* Message */, "Searching_all_ancestor_node_modules_directories_for_fallback_extensions_Colon_0_6418", "Searching all ancestor node_modules directories for fallback extensions: {0}."),
10662
10674
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors: diag(6419, 3 /* Message */, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_program_needs_to_report_errors_6419", "Project '{0}' is out of date because buildinfo file '{1}' indicates that program needs to report errors."),
10663
10675
  Project_0_is_out_of_date_because_1: diag(6420, 3 /* Message */, "Project_0_is_out_of_date_because_1_6420", "Project '{0}' is out of date because {1}."),
10676
+ Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files: diag(6421, 3 /* Message */, "Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_i_6421", "Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files."),
10664
10677
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, 3 /* Message */, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
10665
10678
  The_expected_type_comes_from_this_index_signature: diag(6501, 3 /* Message */, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
10666
10679
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, 3 /* Message */, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -15350,6 +15363,9 @@ function isTypeOnlyExportDeclaration(node) {
15350
15363
  function isTypeOnlyImportOrExportDeclaration(node) {
15351
15364
  return isTypeOnlyImportDeclaration(node) || isTypeOnlyExportDeclaration(node);
15352
15365
  }
15366
+ function isPartOfTypeOnlyImportOrExportDeclaration(node) {
15367
+ return findAncestor(node, isTypeOnlyImportOrExportDeclaration) !== void 0;
15368
+ }
15353
15369
  function isStringTextContainingNode(node) {
15354
15370
  return node.kind === 11 /* StringLiteral */ || isTemplateLiteralKind(node.kind);
15355
15371
  }
@@ -15613,13 +15629,16 @@ function isCallLikeOrFunctionLikeExpression(node) {
15613
15629
  }
15614
15630
  function isCallLikeExpression(node) {
15615
15631
  switch (node.kind) {
15616
- case 286 /* JsxOpeningElement */:
15617
- case 285 /* JsxSelfClosingElement */:
15618
15632
  case 213 /* CallExpression */:
15619
15633
  case 214 /* NewExpression */:
15620
15634
  case 215 /* TaggedTemplateExpression */:
15621
15635
  case 170 /* Decorator */:
15636
+ case 286 /* JsxOpeningElement */:
15637
+ case 285 /* JsxSelfClosingElement */:
15638
+ case 289 /* JsxOpeningFragment */:
15622
15639
  return true;
15640
+ case 226 /* BinaryExpression */:
15641
+ return node.operatorToken.kind === 104 /* InstanceOfKeyword */;
15623
15642
  default:
15624
15643
  return false;
15625
15644
  }
@@ -15962,6 +15981,10 @@ function isJsxOpeningLikeElement(node) {
15962
15981
  const kind = node.kind;
15963
15982
  return kind === 286 /* JsxOpeningElement */ || kind === 285 /* JsxSelfClosingElement */;
15964
15983
  }
15984
+ function isJsxCallLike(node) {
15985
+ const kind = node.kind;
15986
+ return kind === 286 /* JsxOpeningElement */ || kind === 285 /* JsxSelfClosingElement */ || kind === 289 /* JsxOpeningFragment */;
15987
+ }
15965
15988
  function isCaseOrDefaultClause(node) {
15966
15989
  const kind = node.kind;
15967
15990
  return kind === 296 /* CaseClause */ || kind === 297 /* DefaultClause */;
@@ -16602,11 +16625,45 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16602
16625
  AsyncIterator: new Map(Object.entries({
16603
16626
  es2015: emptyArray
16604
16627
  })),
16628
+ ArrayBuffer: new Map(Object.entries({
16629
+ es2024: [
16630
+ "maxByteLength",
16631
+ "resizable",
16632
+ "resize",
16633
+ "detached",
16634
+ "transfer",
16635
+ "transferToFixedLength"
16636
+ ]
16637
+ })),
16605
16638
  Atomics: new Map(Object.entries({
16606
- es2017: emptyArray
16639
+ es2017: [
16640
+ "add",
16641
+ "and",
16642
+ "compareExchange",
16643
+ "exchange",
16644
+ "isLockFree",
16645
+ "load",
16646
+ "or",
16647
+ "store",
16648
+ "sub",
16649
+ "wait",
16650
+ "notify",
16651
+ "xor"
16652
+ ],
16653
+ es2024: [
16654
+ "waitAsync"
16655
+ ]
16607
16656
  })),
16608
16657
  SharedArrayBuffer: new Map(Object.entries({
16609
- es2017: emptyArray
16658
+ es2017: [
16659
+ "byteLength",
16660
+ "slice"
16661
+ ],
16662
+ es2024: [
16663
+ "growable",
16664
+ "maxByteLength",
16665
+ "grow"
16666
+ ]
16610
16667
  })),
16611
16668
  AsyncIterable: new Map(Object.entries({
16612
16669
  es2018: emptyArray
@@ -16628,6 +16685,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16628
16685
  ],
16629
16686
  es2018: [
16630
16687
  "dotAll"
16688
+ ],
16689
+ es2024: [
16690
+ "unicodeSets"
16631
16691
  ]
16632
16692
  })),
16633
16693
  Reflect: new Map(Object.entries({
@@ -16674,6 +16734,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16674
16734
  ],
16675
16735
  es2022: [
16676
16736
  "hasOwn"
16737
+ ],
16738
+ es2024: [
16739
+ "groupBy"
16677
16740
  ]
16678
16741
  })),
16679
16742
  NumberConstructor: new Map(Object.entries({
@@ -16714,11 +16777,25 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16714
16777
  "values"
16715
16778
  ]
16716
16779
  })),
16780
+ MapConstructor: new Map(Object.entries({
16781
+ es2024: [
16782
+ "groupBy"
16783
+ ]
16784
+ })),
16717
16785
  Set: new Map(Object.entries({
16718
16786
  es2015: [
16719
16787
  "entries",
16720
16788
  "keys",
16721
16789
  "values"
16790
+ ],
16791
+ esnext: [
16792
+ "union",
16793
+ "intersection",
16794
+ "difference",
16795
+ "symmetricDifference",
16796
+ "isSubsetOf",
16797
+ "isSupersetOf",
16798
+ "isDisjointFrom"
16722
16799
  ]
16723
16800
  })),
16724
16801
  PromiseConstructor: new Map(Object.entries({
@@ -16733,6 +16810,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16733
16810
  ],
16734
16811
  es2021: [
16735
16812
  "any"
16813
+ ],
16814
+ es2024: [
16815
+ "withResolvers"
16736
16816
  ]
16737
16817
  })),
16738
16818
  Symbol: new Map(Object.entries({
@@ -16799,7 +16879,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16799
16879
  es2022: [
16800
16880
  "at"
16801
16881
  ],
16802
- esnext: [
16882
+ es2024: [
16803
16883
  "isWellFormed",
16804
16884
  "toWellFormed"
16805
16885
  ]
@@ -16844,6 +16924,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16844
16924
  SymbolConstructor: new Map(Object.entries({
16845
16925
  es2020: [
16846
16926
  "matchAll"
16927
+ ],
16928
+ esnext: [
16929
+ "metadata",
16930
+ "dispose",
16931
+ "asyncDispose"
16847
16932
  ]
16848
16933
  })),
16849
16934
  DataView: new Map(Object.entries({
@@ -18076,6 +18161,8 @@ function getInvokedExpression(node) {
18076
18161
  return node.tagName;
18077
18162
  case 226 /* BinaryExpression */:
18078
18163
  return node.right;
18164
+ case 289 /* JsxOpeningFragment */:
18165
+ return node;
18079
18166
  default:
18080
18167
  return node.expression;
18081
18168
  }
@@ -18688,6 +18775,9 @@ function tryGetImportFromModuleSpecifier(node) {
18688
18775
  return void 0;
18689
18776
  }
18690
18777
  }
18778
+ function shouldRewriteModuleSpecifier(specifier, compilerOptions) {
18779
+ return !!compilerOptions.rewriteRelativeImportExtensions && pathIsRelative(specifier) && !isDeclarationFileName(specifier);
18780
+ }
18691
18781
  function getExternalModuleName(node) {
18692
18782
  switch (node.kind) {
18693
18783
  case 272 /* ImportDeclaration */:
@@ -20990,6 +21080,12 @@ function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos, stopPos, sour
20990
21080
  );
20991
21081
  return getLinesBetweenPositions(sourceFile, pos, Math.min(stopPos, nextPos));
20992
21082
  }
21083
+ function rangeContainsRange(r1, r2) {
21084
+ return startEndContainsRange(r1.pos, r1.end, r2);
21085
+ }
21086
+ function startEndContainsRange(start, end, range) {
21087
+ return start <= range.pos && end >= range.end;
21088
+ }
20993
21089
  function getPreviousNonWhitespacePosition(pos, stopPos = 0, sourceFile) {
20994
21090
  while (pos-- > stopPos) {
20995
21091
  if (!isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) {
@@ -21655,6 +21751,12 @@ function createComputedCompilerOptions(options) {
21655
21751
  return options;
21656
21752
  }
21657
21753
  var _computedOptions = createComputedCompilerOptions({
21754
+ allowImportingTsExtensions: {
21755
+ dependencies: ["rewriteRelativeImportExtensions"],
21756
+ computeValue: (compilerOptions) => {
21757
+ return !!(compilerOptions.allowImportingTsExtensions || compilerOptions.rewriteRelativeImportExtensions);
21758
+ }
21759
+ },
21658
21760
  target: {
21659
21761
  dependencies: ["module"],
21660
21762
  computeValue: (compilerOptions) => {
@@ -21869,6 +21971,7 @@ var _computedOptions = createComputedCompilerOptions({
21869
21971
  }
21870
21972
  });
21871
21973
  var computedOptions = _computedOptions;
21974
+ var getAllowImportingTsExtensions = _computedOptions.allowImportingTsExtensions.computeValue;
21872
21975
  var getEmitScriptTarget = _computedOptions.target.computeValue;
21873
21976
  var getEmitModuleKind = _computedOptions.module.computeValue;
21874
21977
  var getEmitModuleResolutionKind = _computedOptions.moduleResolution.computeValue;
@@ -23782,6 +23885,46 @@ var nodeCoreModules = /* @__PURE__ */ new Set([
23782
23885
  ...unprefixedNodeCoreModulesList.map((name) => `node:${name}`),
23783
23886
  ...exclusivelyPrefixedNodeCoreModules
23784
23887
  ]);
23888
+ function forEachDynamicImportOrRequireCall(file, includeTypeSpaceImports, requireStringLiteralLikeArgument, cb) {
23889
+ const isJavaScriptFile = isInJSFile(file);
23890
+ const r = /import|require/g;
23891
+ while (r.exec(file.text) !== null) {
23892
+ const node = getNodeAtPosition(
23893
+ file,
23894
+ r.lastIndex,
23895
+ /*includeJSDoc*/
23896
+ includeTypeSpaceImports
23897
+ );
23898
+ if (isJavaScriptFile && isRequireCall(node, requireStringLiteralLikeArgument)) {
23899
+ cb(node, node.arguments[0]);
23900
+ } else if (isImportCall(node) && node.arguments.length >= 1 && (!requireStringLiteralLikeArgument || isStringLiteralLike(node.arguments[0]))) {
23901
+ cb(node, node.arguments[0]);
23902
+ } else if (includeTypeSpaceImports && isLiteralImportTypeNode(node)) {
23903
+ cb(node, node.argument.literal);
23904
+ } else if (includeTypeSpaceImports && isJSDocImportTag(node)) {
23905
+ const moduleNameExpr = getExternalModuleName(node);
23906
+ if (moduleNameExpr && isStringLiteral(moduleNameExpr) && moduleNameExpr.text) {
23907
+ cb(node, moduleNameExpr);
23908
+ }
23909
+ }
23910
+ }
23911
+ }
23912
+ function getNodeAtPosition(sourceFile, position, includeJSDoc) {
23913
+ const isJavaScriptFile = isInJSFile(sourceFile);
23914
+ let current = sourceFile;
23915
+ const getContainingChild = (child) => {
23916
+ if (child.pos <= position && (position < child.end || position === child.end && child.kind === 1 /* EndOfFileToken */)) {
23917
+ return child;
23918
+ }
23919
+ };
23920
+ while (true) {
23921
+ const child = isJavaScriptFile && includeJSDoc && hasJSDocNodes(current) && forEach(current.jsDoc, getContainingChild) || forEachChild(current, getContainingChild);
23922
+ if (!child) {
23923
+ return current;
23924
+ }
23925
+ current = child;
23926
+ }
23927
+ }
23785
23928
 
23786
23929
  // src/compiler/factory/baseNodeFactory.ts
23787
23930
  function createBaseNodeFactory() {
@@ -29113,7 +29256,9 @@ function createEmitHelperFactory(context) {
29113
29256
  createClassPrivateFieldInHelper,
29114
29257
  // 'using' helpers
29115
29258
  createAddDisposableResourceHelper,
29116
- createDisposeResourcesHelper
29259
+ createDisposeResourcesHelper,
29260
+ // --rewriteRelativeImportExtensions helpers
29261
+ createRewriteRelativeImportExtensionsHelper
29117
29262
  };
29118
29263
  function getUnscopedHelperName(name) {
29119
29264
  return setEmitFlags(factory2.createIdentifier(name), 8192 /* HelperName */ | 4 /* AdviseOnEmitNode */);
@@ -29602,6 +29747,15 @@ function createEmitHelperFactory(context) {
29602
29747
  [envBinding]
29603
29748
  );
29604
29749
  }
29750
+ function createRewriteRelativeImportExtensionsHelper(expression) {
29751
+ context.requestEmitHelper(rewriteRelativeImportExtensionsHelper);
29752
+ return factory2.createCallExpression(
29753
+ getUnscopedHelperName("__rewriteRelativeImportExtension"),
29754
+ /*typeArguments*/
29755
+ void 0,
29756
+ context.getCompilerOptions().jsx === 1 /* Preserve */ ? [expression, factory2.createTrue()] : [expression]
29757
+ );
29758
+ }
29605
29759
  }
29606
29760
  function compareEmitHelpers(x, y) {
29607
29761
  if (x === y) return 0 /* EqualTo */;
@@ -30107,6 +30261,20 @@ var disposeResourcesHelper = {
30107
30261
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
30108
30262
  });`
30109
30263
  };
30264
+ var rewriteRelativeImportExtensionsHelper = {
30265
+ name: "typescript:rewriteRelativeImportExtensions",
30266
+ importName: "__rewriteRelativeImportExtension",
30267
+ scoped: false,
30268
+ text: `
30269
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
30270
+ if (typeof path === "string" && /^\\.\\.?\\//.test(path)) {
30271
+ return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
30272
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
30273
+ });
30274
+ }
30275
+ return path;
30276
+ };`
30277
+ };
30110
30278
  var asyncSuperHelper = {
30111
30279
  name: "typescript:async-super",
30112
30280
  scoped: true,
@@ -40074,6 +40242,7 @@ var libEntries = [
40074
40242
  ["es2021", "lib.es2021.d.ts"],
40075
40243
  ["es2022", "lib.es2022.d.ts"],
40076
40244
  ["es2023", "lib.es2023.d.ts"],
40245
+ ["es2024", "lib.es2024.d.ts"],
40077
40246
  ["esnext", "lib.esnext.d.ts"],
40078
40247
  // Host only
40079
40248
  ["dom", "lib.dom.d.ts"],
@@ -40096,6 +40265,7 @@ var libEntries = [
40096
40265
  ["es2015.symbol.wellknown", "lib.es2015.symbol.wellknown.d.ts"],
40097
40266
  ["es2016.array.include", "lib.es2016.array.include.d.ts"],
40098
40267
  ["es2016.intl", "lib.es2016.intl.d.ts"],
40268
+ ["es2017.arraybuffer", "lib.es2017.arraybuffer.d.ts"],
40099
40269
  ["es2017.date", "lib.es2017.date.d.ts"],
40100
40270
  ["es2017.object", "lib.es2017.object.d.ts"],
40101
40271
  ["es2017.sharedmemory", "lib.es2017.sharedmemory.d.ts"],
@@ -40128,12 +40298,18 @@ var libEntries = [
40128
40298
  ["es2022.error", "lib.es2022.error.d.ts"],
40129
40299
  ["es2022.intl", "lib.es2022.intl.d.ts"],
40130
40300
  ["es2022.object", "lib.es2022.object.d.ts"],
40131
- ["es2022.sharedmemory", "lib.es2022.sharedmemory.d.ts"],
40132
40301
  ["es2022.string", "lib.es2022.string.d.ts"],
40133
40302
  ["es2022.regexp", "lib.es2022.regexp.d.ts"],
40134
40303
  ["es2023.array", "lib.es2023.array.d.ts"],
40135
40304
  ["es2023.collection", "lib.es2023.collection.d.ts"],
40136
40305
  ["es2023.intl", "lib.es2023.intl.d.ts"],
40306
+ ["es2024.arraybuffer", "lib.es2024.arraybuffer.d.ts"],
40307
+ ["es2024.collection", "lib.es2024.collection.d.ts"],
40308
+ ["es2024.object", "lib.es2024.object.d.ts"],
40309
+ ["es2024.promise", "lib.es2024.promise.d.ts"],
40310
+ ["es2024.regexp", "lib.es2024.regexp.d.ts"],
40311
+ ["es2024.sharedmemory", "lib.es2024.sharedmemory.d.ts"],
40312
+ ["es2024.string", "lib.es2024.string.d.ts"],
40137
40313
  ["esnext.array", "lib.es2023.array.d.ts"],
40138
40314
  ["esnext.collection", "lib.esnext.collection.d.ts"],
40139
40315
  ["esnext.symbol", "lib.es2019.symbol.d.ts"],
@@ -40142,13 +40318,13 @@ var libEntries = [
40142
40318
  ["esnext.disposable", "lib.esnext.disposable.d.ts"],
40143
40319
  ["esnext.bigint", "lib.es2020.bigint.d.ts"],
40144
40320
  ["esnext.string", "lib.es2022.string.d.ts"],
40145
- ["esnext.promise", "lib.esnext.promise.d.ts"],
40321
+ ["esnext.promise", "lib.es2024.promise.d.ts"],
40146
40322
  ["esnext.weakref", "lib.es2021.weakref.d.ts"],
40147
40323
  ["esnext.decorators", "lib.esnext.decorators.d.ts"],
40148
- ["esnext.object", "lib.esnext.object.d.ts"],
40324
+ ["esnext.object", "lib.es2024.object.d.ts"],
40149
40325
  ["esnext.array", "lib.esnext.array.d.ts"],
40150
- ["esnext.regexp", "lib.esnext.regexp.d.ts"],
40151
- ["esnext.string", "lib.esnext.string.d.ts"],
40326
+ ["esnext.regexp", "lib.es2024.regexp.d.ts"],
40327
+ ["esnext.string", "lib.es2024.string.d.ts"],
40152
40328
  ["esnext.iterator", "lib.esnext.iterator.d.ts"],
40153
40329
  ["decorators", "lib.decorators.d.ts"],
40154
40330
  ["decorators.legacy", "lib.decorators.legacy.d.ts"]
@@ -40447,6 +40623,7 @@ var targetOptionDeclaration = {
40447
40623
  es2021: 8 /* ES2021 */,
40448
40624
  es2022: 9 /* ES2022 */,
40449
40625
  es2023: 10 /* ES2023 */,
40626
+ es2024: 11 /* ES2024 */,
40450
40627
  esnext: 99 /* ESNext */
40451
40628
  })),
40452
40629
  affectsSourceFile: true,
@@ -41049,6 +41226,15 @@ var commandOptionsWithoutBuild = [
41049
41226
  defaultValueDescription: false,
41050
41227
  transpileOptionValue: void 0
41051
41228
  },
41229
+ {
41230
+ name: "rewriteRelativeImportExtensions",
41231
+ type: "boolean",
41232
+ affectsSemanticDiagnostics: true,
41233
+ affectsBuildInfo: true,
41234
+ category: Diagnostics.Modules,
41235
+ description: Diagnostics.Rewrite_ts_tsx_mts_and_cts_file_extensions_in_relative_import_paths_to_their_JavaScript_equivalent_in_output_files,
41236
+ defaultValueDescription: false
41237
+ },
41052
41238
  {
41053
41239
  name: "resolvePackageJsonExports",
41054
41240
  type: "boolean",
@@ -44800,10 +44986,11 @@ function loadModuleFromFileNoImplicitExtensions(extensions, candidate, onlyRecor
44800
44986
  }
44801
44987
  return tryAddingExtensions(extensionless, extensions, extension, onlyRecordFailures, state);
44802
44988
  }
44803
- function loadFileNameFromPackageJsonField(extensions, candidate, onlyRecordFailures, state) {
44989
+ function loadFileNameFromPackageJsonField(extensions, candidate, packageJsonValue, onlyRecordFailures, state) {
44804
44990
  if (extensions & 1 /* TypeScript */ && fileExtensionIsOneOf(candidate, supportedTSImplementationExtensions) || extensions & 4 /* Declaration */ && fileExtensionIsOneOf(candidate, supportedDeclarationExtensions)) {
44805
44991
  const result = tryFile(candidate, onlyRecordFailures, state);
44806
- return result !== void 0 ? { path: candidate, ext: tryExtractTSExtension(candidate), resolvedUsingTsExtension: void 0 } : void 0;
44992
+ const ext = tryExtractTSExtension(candidate);
44993
+ return result !== void 0 ? { path: candidate, ext, resolvedUsingTsExtension: packageJsonValue ? !endsWith(packageJsonValue, ext) : void 0 } : void 0;
44807
44994
  }
44808
44995
  if (state.isConfigLookup && extensions === 8 /* Json */ && fileExtensionIs(candidate, ".json" /* Json */)) {
44809
44996
  const result = tryFile(candidate, onlyRecordFailures, state);
@@ -44965,6 +45152,7 @@ function loadEntrypointsFromExportMap(scope, exports2, state, extensions) {
44965
45152
  const result = loadFileNameFromPackageJsonField(
44966
45153
  extensions,
44967
45154
  finalPath,
45155
+ target,
44968
45156
  /*onlyRecordFailures*/
44969
45157
  false,
44970
45158
  state
@@ -45106,7 +45294,14 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
45106
45294
  }
45107
45295
  }
45108
45296
  const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
45109
- const fromFile = loadFileNameFromPackageJsonField(extensions2, candidate2, onlyRecordFailures2, state2);
45297
+ const fromFile = loadFileNameFromPackageJsonField(
45298
+ extensions2,
45299
+ candidate2,
45300
+ /*packageJsonValue*/
45301
+ void 0,
45302
+ onlyRecordFailures2,
45303
+ state2
45304
+ );
45110
45305
  if (fromFile) {
45111
45306
  return noPackageId(fromFile);
45112
45307
  }
@@ -45462,6 +45657,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
45462
45657
  return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
45463
45658
  extensions,
45464
45659
  finalPath,
45660
+ target,
45465
45661
  /*onlyRecordFailures*/
45466
45662
  false,
45467
45663
  state
@@ -45574,6 +45770,8 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
45574
45770
  return toSearchResult(withPackageId(scope, loadFileNameFromPackageJsonField(
45575
45771
  extensions,
45576
45772
  possibleInputWithInputExtension,
45773
+ /*packageJsonValue*/
45774
+ void 0,
45577
45775
  /*onlyRecordFailures*/
45578
45776
  false,
45579
45777
  state
@@ -45936,7 +46134,7 @@ function resolveFromTypeRoot(moduleName, state) {
45936
46134
  }
45937
46135
  }
45938
46136
  function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
45939
- return !!compilerOptions.allowImportingTsExtensions || !!fromFileName && isDeclarationFileName(fromFileName);
46137
+ return getAllowImportingTsExtensions(compilerOptions) || !!fromFileName && isDeclarationFileName(fromFileName);
45940
46138
  }
45941
46139
  function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache, packageJsonInfoCache) {
45942
46140
  const traceEnabled = isTraceEnabled(compilerOptions, host);
@@ -51018,6 +51216,15 @@ function createTypeChecker(host) {
51018
51216
  emptyArray
51019
51217
  );
51020
51218
  emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
51219
+ var emptyFreshJsxObjectType = createAnonymousType(
51220
+ /*symbol*/
51221
+ void 0,
51222
+ emptySymbols,
51223
+ emptyArray,
51224
+ emptyArray,
51225
+ emptyArray
51226
+ );
51227
+ emptyFreshJsxObjectType.objectFlags |= 2048 /* JsxAttributes */ | 8192 /* FreshLiteral */ | 128 /* ObjectLiteral */ | 131072 /* ContainsObjectOrArrayLiteral */;
51021
51228
  var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */);
51022
51229
  emptyTypeLiteralSymbol.members = createSymbolTable();
51023
51230
  var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray);
@@ -53316,6 +53523,36 @@ function createTypeChecker(host) {
53316
53523
  const tsExtension = Debug.checkDefined(tryExtractTSExtension(moduleReference));
53317
53524
  error2(errorNode, Diagnostics.An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled, tsExtension);
53318
53525
  }
53526
+ } else if (compilerOptions.rewriteRelativeImportExtensions && !(location.flags & 33554432 /* Ambient */) && !isDeclarationFileName(moduleReference) && !isLiteralImportTypeNode(location) && !isPartOfTypeOnlyImportOrExportDeclaration(location)) {
53527
+ const shouldRewrite = shouldRewriteModuleSpecifier(moduleReference, compilerOptions);
53528
+ if (!resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
53529
+ error2(
53530
+ errorNode,
53531
+ Diagnostics.This_relative_import_path_is_unsafe_to_rewrite_because_it_looks_like_a_file_name_but_actually_resolves_to_0,
53532
+ getRelativePathFromFile(getNormalizedAbsolutePath(currentSourceFile.fileName, host.getCurrentDirectory()), resolvedModule.resolvedFileName, hostGetCanonicalFileName(host))
53533
+ );
53534
+ } else if (resolvedModule.resolvedUsingTsExtension && !shouldRewrite && sourceFileMayBeEmitted(sourceFile, host)) {
53535
+ error2(
53536
+ errorNode,
53537
+ Diagnostics.This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path,
53538
+ getAnyExtensionFromPath(moduleReference)
53539
+ );
53540
+ } else if (resolvedModule.resolvedUsingTsExtension && shouldRewrite) {
53541
+ const redirect = host.getResolvedProjectReferenceToRedirect(sourceFile.path);
53542
+ if (redirect) {
53543
+ const ignoreCase = !host.useCaseSensitiveFileNames();
53544
+ const ownRootDir = host.getCommonSourceDirectory();
53545
+ const otherRootDir = getCommonSourceDirectoryOfConfig(redirect.commandLine, ignoreCase);
53546
+ const rootDirPath = getRelativePathFromDirectory(ownRootDir, otherRootDir, ignoreCase);
53547
+ const outDirPath = getRelativePathFromDirectory(compilerOptions.outDir || ownRootDir, redirect.commandLine.options.outDir || otherRootDir, ignoreCase);
53548
+ if (rootDirPath !== outDirPath) {
53549
+ error2(
53550
+ errorNode,
53551
+ Diagnostics.This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files
53552
+ );
53553
+ }
53554
+ }
53555
+ }
53319
53556
  }
53320
53557
  if (sourceFile.symbol) {
53321
53558
  if (errorNode && resolvedModule.isExternalLibraryImport && !resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
@@ -57133,7 +57370,7 @@ function createTypeChecker(host) {
57133
57370
  }
57134
57371
  return factory.updateImportTypeNode(
57135
57372
  node,
57136
- factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
57373
+ factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier2(node, node.argument.literal)),
57137
57374
  visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
57138
57375
  visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
57139
57376
  visitNodes2(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
@@ -57287,7 +57524,7 @@ function createTypeChecker(host) {
57287
57524
  function getNameForJSDocFunctionParameter(p, index) {
57288
57525
  return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`;
57289
57526
  }
57290
- function rewriteModuleSpecifier(parent2, lit) {
57527
+ function rewriteModuleSpecifier2(parent2, lit) {
57291
57528
  if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
57292
57529
  let name = lit.text;
57293
57530
  const nodeSymbol = getNodeLinks(node).resolvedSymbol;
@@ -76930,7 +77167,7 @@ function createTypeChecker(host) {
76930
77167
  return getContextualTypeForArgumentAtIndex(node, 0);
76931
77168
  }
76932
77169
  function getEffectiveFirstArgumentForJsxSignature(signature, node) {
76933
- return getJsxReferenceKind(node) !== 0 /* Component */ ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node);
77170
+ return isJsxOpeningFragment(node) || getJsxReferenceKind(node) !== 0 /* Component */ ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node);
76934
77171
  }
76935
77172
  function getJsxPropsTypeFromCallSignature(sig, context) {
76936
77173
  let propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
@@ -76961,6 +77198,7 @@ function createTypeChecker(host) {
76961
77198
  return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation);
76962
77199
  }
76963
77200
  function getStaticTypeOfReferencedJsxConstructor(context) {
77201
+ if (isJsxOpeningFragment(context)) return getJSXFragmentType(context);
76964
77202
  if (isJsxIntrinsicTagName(context.tagName)) {
76965
77203
  const result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(context);
76966
77204
  const fakeSignature = createSignatureForJSXIntrinsic(context, result);
@@ -77609,8 +77847,6 @@ function createTypeChecker(host) {
77609
77847
  return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
77610
77848
  }
77611
77849
  function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
77612
- const attributes = openingLikeElement.attributes;
77613
- const contextualType = getContextualType2(attributes, 0 /* None */);
77614
77850
  const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
77615
77851
  let attributesTable = createSymbolTable();
77616
77852
  let spread = emptyJsxObjectType;
@@ -77619,96 +77855,105 @@ function createTypeChecker(host) {
77619
77855
  let explicitlySpecifyChildrenAttribute = false;
77620
77856
  let objectFlags = 2048 /* JsxAttributes */;
77621
77857
  const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(openingLikeElement));
77622
- for (const attributeDecl of attributes.properties) {
77623
- const member = attributeDecl.symbol;
77624
- if (isJsxAttribute(attributeDecl)) {
77625
- const exprType = checkJsxAttribute(attributeDecl, checkMode);
77626
- objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
77627
- const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
77628
- attributeSymbol.declarations = member.declarations;
77629
- attributeSymbol.parent = member.parent;
77630
- if (member.valueDeclaration) {
77631
- attributeSymbol.valueDeclaration = member.valueDeclaration;
77632
- }
77633
- attributeSymbol.links.type = exprType;
77634
- attributeSymbol.links.target = member;
77635
- attributesTable.set(attributeSymbol.escapedName, attributeSymbol);
77636
- allAttributesTable == null ? void 0 : allAttributesTable.set(attributeSymbol.escapedName, attributeSymbol);
77637
- if (getEscapedTextOfJsxAttributeName(attributeDecl.name) === jsxChildrenPropertyName) {
77638
- explicitlySpecifyChildrenAttribute = true;
77639
- }
77640
- if (contextualType) {
77641
- const prop = getPropertyOfType(contextualType, member.escapedName);
77642
- if (prop && prop.declarations && isDeprecatedSymbol(prop) && isIdentifier(attributeDecl.name)) {
77643
- addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
77858
+ const isJsxOpenFragment = isJsxOpeningFragment(openingLikeElement);
77859
+ let attributesSymbol;
77860
+ let attributeParent = openingLikeElement;
77861
+ if (!isJsxOpenFragment) {
77862
+ const attributes = openingLikeElement.attributes;
77863
+ attributesSymbol = attributes.symbol;
77864
+ attributeParent = attributes;
77865
+ const contextualType = getContextualType2(attributes, 0 /* None */);
77866
+ for (const attributeDecl of attributes.properties) {
77867
+ const member = attributeDecl.symbol;
77868
+ if (isJsxAttribute(attributeDecl)) {
77869
+ const exprType = checkJsxAttribute(attributeDecl, checkMode);
77870
+ objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
77871
+ const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
77872
+ attributeSymbol.declarations = member.declarations;
77873
+ attributeSymbol.parent = member.parent;
77874
+ if (member.valueDeclaration) {
77875
+ attributeSymbol.valueDeclaration = member.valueDeclaration;
77876
+ }
77877
+ attributeSymbol.links.type = exprType;
77878
+ attributeSymbol.links.target = member;
77879
+ attributesTable.set(attributeSymbol.escapedName, attributeSymbol);
77880
+ allAttributesTable == null ? void 0 : allAttributesTable.set(attributeSymbol.escapedName, attributeSymbol);
77881
+ if (getEscapedTextOfJsxAttributeName(attributeDecl.name) === jsxChildrenPropertyName) {
77882
+ explicitlySpecifyChildrenAttribute = true;
77883
+ }
77884
+ if (contextualType) {
77885
+ const prop = getPropertyOfType(contextualType, member.escapedName);
77886
+ if (prop && prop.declarations && isDeprecatedSymbol(prop) && isIdentifier(attributeDecl.name)) {
77887
+ addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
77888
+ }
77889
+ }
77890
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
77891
+ const inferenceContext = getInferenceContext(attributes);
77892
+ Debug.assert(inferenceContext);
77893
+ const inferenceNode = attributeDecl.initializer.expression;
77894
+ addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType);
77895
+ }
77896
+ } else {
77897
+ Debug.assert(attributeDecl.kind === 293 /* JsxSpreadAttribute */);
77898
+ if (attributesTable.size > 0) {
77899
+ spread = getSpreadType(
77900
+ spread,
77901
+ createJsxAttributesTypeHelper(),
77902
+ attributes.symbol,
77903
+ objectFlags,
77904
+ /*readonly*/
77905
+ false
77906
+ );
77907
+ attributesTable = createSymbolTable();
77908
+ }
77909
+ const exprType = getReducedType(checkExpression(attributeDecl.expression, checkMode & 2 /* Inferential */));
77910
+ if (isTypeAny(exprType)) {
77911
+ hasSpreadAnyType = true;
77912
+ }
77913
+ if (isValidSpreadType(exprType)) {
77914
+ spread = getSpreadType(
77915
+ spread,
77916
+ exprType,
77917
+ attributes.symbol,
77918
+ objectFlags,
77919
+ /*readonly*/
77920
+ false
77921
+ );
77922
+ if (allAttributesTable) {
77923
+ checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl);
77924
+ }
77925
+ } else {
77926
+ error2(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types);
77927
+ typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
77644
77928
  }
77645
77929
  }
77646
- if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
77647
- const inferenceContext = getInferenceContext(attributes);
77648
- Debug.assert(inferenceContext);
77649
- const inferenceNode = attributeDecl.initializer.expression;
77650
- addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType);
77651
- }
77652
- } else {
77653
- Debug.assert(attributeDecl.kind === 293 /* JsxSpreadAttribute */);
77930
+ }
77931
+ if (!hasSpreadAnyType) {
77654
77932
  if (attributesTable.size > 0) {
77655
77933
  spread = getSpreadType(
77656
77934
  spread,
77657
- createJsxAttributesType(),
77935
+ createJsxAttributesTypeHelper(),
77658
77936
  attributes.symbol,
77659
77937
  objectFlags,
77660
77938
  /*readonly*/
77661
77939
  false
77662
77940
  );
77663
- attributesTable = createSymbolTable();
77664
- }
77665
- const exprType = getReducedType(checkExpression(attributeDecl.expression, checkMode & 2 /* Inferential */));
77666
- if (isTypeAny(exprType)) {
77667
- hasSpreadAnyType = true;
77668
- }
77669
- if (isValidSpreadType(exprType)) {
77670
- spread = getSpreadType(
77671
- spread,
77672
- exprType,
77673
- attributes.symbol,
77674
- objectFlags,
77675
- /*readonly*/
77676
- false
77677
- );
77678
- if (allAttributesTable) {
77679
- checkSpreadPropOverrides(exprType, allAttributesTable, attributeDecl);
77680
- }
77681
- } else {
77682
- error2(attributeDecl.expression, Diagnostics.Spread_types_may_only_be_created_from_object_types);
77683
- typeToIntersect = typeToIntersect ? getIntersectionType([typeToIntersect, exprType]) : exprType;
77684
77941
  }
77685
77942
  }
77686
77943
  }
77687
- if (!hasSpreadAnyType) {
77688
- if (attributesTable.size > 0) {
77689
- spread = getSpreadType(
77690
- spread,
77691
- createJsxAttributesType(),
77692
- attributes.symbol,
77693
- objectFlags,
77694
- /*readonly*/
77695
- false
77696
- );
77697
- }
77698
- }
77699
- const parent2 = openingLikeElement.parent.kind === 284 /* JsxElement */ ? openingLikeElement.parent : void 0;
77700
- if (parent2 && parent2.openingElement === openingLikeElement && getSemanticJsxChildren(parent2.children).length > 0) {
77944
+ const parent2 = openingLikeElement.parent;
77945
+ if ((isJsxElement(parent2) && parent2.openingElement === openingLikeElement || isJsxFragment(parent2) && parent2.openingFragment === openingLikeElement) && getSemanticJsxChildren(parent2.children).length > 0) {
77701
77946
  const childrenTypes = checkJsxChildren(parent2, checkMode);
77702
77947
  if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
77703
77948
  if (explicitlySpecifyChildrenAttribute) {
77704
- error2(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
77949
+ error2(attributeParent, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName));
77705
77950
  }
77706
- const contextualType2 = getApparentTypeOfContextualType(
77951
+ const contextualType = isJsxOpeningElement(openingLikeElement) ? getApparentTypeOfContextualType(
77707
77952
  openingLikeElement.attributes,
77708
77953
  /*contextFlags*/
77709
77954
  void 0
77710
- );
77711
- const childrenContextualType = contextualType2 && getTypeOfPropertyOfContextualType(contextualType2, jsxChildrenPropertyName);
77955
+ ) : void 0;
77956
+ const childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
77712
77957
  const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName);
77713
77958
  childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes));
77714
77959
  childrenPropSymbol.valueDeclaration = factory.createPropertySignature(
@@ -77720,14 +77965,14 @@ function createTypeChecker(host) {
77720
77965
  /*type*/
77721
77966
  void 0
77722
77967
  );
77723
- setParent(childrenPropSymbol.valueDeclaration, attributes);
77968
+ setParent(childrenPropSymbol.valueDeclaration, attributeParent);
77724
77969
  childrenPropSymbol.valueDeclaration.symbol = childrenPropSymbol;
77725
77970
  const childPropMap = createSymbolTable();
77726
77971
  childPropMap.set(jsxChildrenPropertyName, childrenPropSymbol);
77727
77972
  spread = getSpreadType(
77728
77973
  spread,
77729
- createAnonymousType(attributes.symbol, childPropMap, emptyArray, emptyArray, emptyArray),
77730
- attributes.symbol,
77974
+ createAnonymousType(attributesSymbol, childPropMap, emptyArray, emptyArray, emptyArray),
77975
+ attributesSymbol,
77731
77976
  objectFlags,
77732
77977
  /*readonly*/
77733
77978
  false
@@ -77740,14 +77985,17 @@ function createTypeChecker(host) {
77740
77985
  if (typeToIntersect && spread !== emptyJsxObjectType) {
77741
77986
  return getIntersectionType([typeToIntersect, spread]);
77742
77987
  }
77743
- return typeToIntersect || (spread === emptyJsxObjectType ? createJsxAttributesType() : spread);
77744
- function createJsxAttributesType() {
77988
+ return typeToIntersect || (spread === emptyJsxObjectType ? createJsxAttributesTypeHelper() : spread);
77989
+ function createJsxAttributesTypeHelper() {
77745
77990
  objectFlags |= 8192 /* FreshLiteral */;
77746
- const result = createAnonymousType(attributes.symbol, attributesTable, emptyArray, emptyArray, emptyArray);
77747
- result.objectFlags |= objectFlags | 128 /* ObjectLiteral */ | 131072 /* ContainsObjectOrArrayLiteral */;
77748
- return result;
77991
+ return createJsxAttributesType(objectFlags, attributesSymbol, attributesTable);
77749
77992
  }
77750
77993
  }
77994
+ function createJsxAttributesType(objectFlags, attributesSymbol, attributesTable) {
77995
+ const result = createAnonymousType(attributesSymbol, attributesTable, emptyArray, emptyArray, emptyArray);
77996
+ result.objectFlags |= objectFlags | 8192 /* FreshLiteral */ | 128 /* ObjectLiteral */ | 131072 /* ContainsObjectOrArrayLiteral */;
77997
+ return result;
77998
+ }
77751
77999
  function checkJsxChildren(node, checkMode) {
77752
78000
  const childrenTypes = [];
77753
78001
  for (const child of node.children) {
@@ -78053,10 +78301,10 @@ function createTypeChecker(host) {
78053
78301
  }
78054
78302
  checkJsxPreconditions(node);
78055
78303
  markJsxAliasReferenced(node);
78304
+ const sig = getResolvedSignature(node);
78305
+ checkDeprecatedSignature(sig, node);
78056
78306
  if (isNodeOpeningLikeElement) {
78057
78307
  const jsxOpeningLikeNode = node;
78058
- const sig = getResolvedSignature(jsxOpeningLikeNode);
78059
- checkDeprecatedSignature(sig, node);
78060
78308
  const elementTypeConstraint = getJsxElementTypeTypeAt(jsxOpeningLikeNode);
78061
78309
  if (elementTypeConstraint !== void 0) {
78062
78310
  const tagName = jsxOpeningLikeNode.tagName;
@@ -79080,6 +79328,7 @@ function createTypeChecker(host) {
79080
79328
  return !!(t.flags & (16384 /* Void */ | 32768 /* Undefined */ | 2 /* Unknown */ | 1 /* Any */));
79081
79329
  }
79082
79330
  function hasCorrectArity(node, args, signature, signatureHelpTrailingComma = false) {
79331
+ if (isJsxOpeningFragment(node)) return true;
79083
79332
  let argCount;
79084
79333
  let callIsIncomplete = false;
79085
79334
  let effectiveParameterCount = getParameterCount(signature);
@@ -79353,9 +79602,9 @@ function createTypeChecker(host) {
79353
79602
  }
79354
79603
  return 2 /* Mixed */;
79355
79604
  }
79356
- function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer) {
79605
+ function checkApplicableSignatureForJsxCallLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer) {
79357
79606
  const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
79358
- const attributesType = checkExpressionWithContextualType(
79607
+ const attributesType = isJsxOpeningFragment(node) ? createJsxAttributesTypeFromAttributesProperty(node) : checkExpressionWithContextualType(
79359
79608
  node.attributes,
79360
79609
  paramType,
79361
79610
  /*inferenceContext*/
@@ -79367,8 +79616,8 @@ function createTypeChecker(host) {
79367
79616
  checkAttributesType,
79368
79617
  paramType,
79369
79618
  relation,
79370
- reportErrors2 ? node.tagName : void 0,
79371
- node.attributes,
79619
+ reportErrors2 ? isJsxOpeningFragment(node) ? node : node.tagName : void 0,
79620
+ isJsxOpeningFragment(node) ? void 0 : node.attributes,
79372
79621
  /*headMessage*/
79373
79622
  void 0,
79374
79623
  containingMessageChain,
@@ -79439,10 +79688,11 @@ function createTypeChecker(host) {
79439
79688
  return true;
79440
79689
  }
79441
79690
  if (reportErrors2) {
79442
- const diag2 = createDiagnosticForNode(node.tagName, Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, entityNameToString(node.tagName), absoluteMinArgCount, entityNameToString(factory2), maxParamCount);
79443
- const tagNameDeclaration = (_a = getSymbolAtLocation(node.tagName)) == null ? void 0 : _a.valueDeclaration;
79691
+ const tagName = node.tagName;
79692
+ const diag2 = createDiagnosticForNode(tagName, Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, entityNameToString(tagName), absoluteMinArgCount, entityNameToString(factory2), maxParamCount);
79693
+ const tagNameDeclaration = (_a = getSymbolAtLocation(tagName)) == null ? void 0 : _a.valueDeclaration;
79444
79694
  if (tagNameDeclaration) {
79445
- addRelatedInfo(diag2, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(node.tagName)));
79695
+ addRelatedInfo(diag2, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(tagName)));
79446
79696
  }
79447
79697
  if (errorOutputContainer && errorOutputContainer.skipLogging) {
79448
79698
  (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2);
@@ -79460,8 +79710,8 @@ function createTypeChecker(host) {
79460
79710
  }
79461
79711
  function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
79462
79712
  const errorOutputContainer = { errors: void 0, skipLogging: true };
79463
- if (isJsxOpeningLikeElement(node)) {
79464
- if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
79713
+ if (isJsxCallLike(node)) {
79714
+ if (!checkApplicableSignatureForJsxCallLikeElement(node, signature, relation, checkMode, reportErrors2, containingMessageChain, errorOutputContainer)) {
79465
79715
  Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
79466
79716
  return errorOutputContainer.errors || emptyArray;
79467
79717
  }
@@ -79561,6 +79811,9 @@ function createTypeChecker(host) {
79561
79811
  return result;
79562
79812
  }
79563
79813
  function getEffectiveCallArguments(node) {
79814
+ if (isJsxOpeningFragment(node)) {
79815
+ return [createSyntheticExpression(node, emptyFreshJsxObjectType)];
79816
+ }
79564
79817
  if (node.kind === 215 /* TaggedTemplateExpression */) {
79565
79818
  const template = node.template;
79566
79819
  const args2 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
@@ -79845,25 +80098,32 @@ function createTypeChecker(host) {
79845
80098
  const isTaggedTemplate = node.kind === 215 /* TaggedTemplateExpression */;
79846
80099
  const isDecorator2 = node.kind === 170 /* Decorator */;
79847
80100
  const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
80101
+ const isJsxOpenFragment = isJsxOpeningFragment(node);
79848
80102
  const isInstanceof = node.kind === 226 /* BinaryExpression */;
79849
80103
  const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
80104
+ let candidatesForArgumentError;
80105
+ let candidateForArgumentArityError;
80106
+ let candidateForTypeArgumentError;
80107
+ let result;
80108
+ let argCheckMode = 0 /* Normal */;
80109
+ let candidates = [];
79850
80110
  let typeArguments;
79851
- if (!isDecorator2 && !isInstanceof && !isSuperCall(node)) {
80111
+ if (!isDecorator2 && !isInstanceof && !isSuperCall(node) && !isJsxOpenFragment) {
79852
80112
  typeArguments = node.typeArguments;
79853
80113
  if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 108 /* SuperKeyword */) {
79854
80114
  forEach(typeArguments, checkSourceElement);
79855
80115
  }
79856
80116
  }
79857
- const candidates = candidatesOutArray || [];
80117
+ candidates = candidatesOutArray || [];
79858
80118
  reorderCandidates(signatures, candidates, callChainFlags);
79859
- Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
80119
+ if (!isJsxOpenFragment) {
80120
+ Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
80121
+ }
79860
80122
  const args = getEffectiveCallArguments(node);
79861
80123
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
79862
- let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
79863
- let candidatesForArgumentError;
79864
- let candidateForArgumentArityError;
79865
- let candidateForTypeArgumentError;
79866
- let result;
80124
+ if (!isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive)) {
80125
+ argCheckMode = 4 /* SkipContextSensitive */;
80126
+ }
79867
80127
  const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 213 /* CallExpression */ && node.arguments.hasTrailingComma;
79868
80128
  if (candidates.length > 1) {
79869
80129
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
@@ -79983,7 +80243,7 @@ function createTypeChecker(host) {
79983
80243
  true,
79984
80244
  headMessage
79985
80245
  );
79986
- } else {
80246
+ } else if (!isJsxOpenFragment) {
79987
80247
  const signaturesWithCorrectTypeArgumentArity = filter(signatures, (s) => hasCorrectTypeArgumentArity(s, typeArguments));
79988
80248
  if (signaturesWithCorrectTypeArgumentArity.length === 0) {
79989
80249
  diagnostics.add(getTypeArgumentArityError(node, signatures, typeArguments, headMessage));
@@ -80631,24 +80891,52 @@ function createTypeChecker(host) {
80631
80891
  0 /* None */
80632
80892
  );
80633
80893
  }
80894
+ function getJSXFragmentType(node) {
80895
+ const sourceFileLinks = getNodeLinks(getSourceFileOfNode(node));
80896
+ if (sourceFileLinks.jsxFragmentType !== void 0) return sourceFileLinks.jsxFragmentType;
80897
+ const jsxFragmentFactoryName = getJsxNamespace(node);
80898
+ const jsxFactoryRefErr = diagnostics ? Diagnostics.Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found : void 0;
80899
+ const jsxFactorySymbol = getJsxNamespaceContainerForImplicitImport(node) ?? resolveName(
80900
+ node,
80901
+ jsxFragmentFactoryName,
80902
+ 111551 /* Value */,
80903
+ /*nameNotFoundMessage*/
80904
+ jsxFactoryRefErr,
80905
+ /*isUse*/
80906
+ true
80907
+ );
80908
+ if (jsxFactorySymbol === void 0) return sourceFileLinks.jsxFragmentType = errorType;
80909
+ if (jsxFactorySymbol.escapedName === ReactNames.Fragment) return sourceFileLinks.jsxFragmentType = getTypeOfSymbol(jsxFactorySymbol);
80910
+ const resolvedAlias = (jsxFactorySymbol.flags & 2097152 /* Alias */) === 0 ? jsxFactorySymbol : resolveAlias(jsxFactorySymbol);
80911
+ const reactExports = jsxFactorySymbol && getExportsOfSymbol(resolvedAlias);
80912
+ const typeSymbol = reactExports && getSymbol2(reactExports, ReactNames.Fragment, 2 /* BlockScopedVariable */);
80913
+ const type = typeSymbol && getTypeOfSymbol(typeSymbol);
80914
+ return sourceFileLinks.jsxFragmentType = type === void 0 ? errorType : type;
80915
+ }
80634
80916
  function resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode) {
80635
- if (isJsxIntrinsicTagName(node.tagName)) {
80636
- const result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node);
80637
- const fakeSignature = createSignatureForJSXIntrinsic(node, result);
80638
- checkTypeAssignableToAndOptionallyElaborate(checkExpressionWithContextualType(
80639
- node.attributes,
80640
- getEffectiveFirstArgumentForJsxSignature(fakeSignature, node),
80641
- /*inferenceContext*/
80642
- void 0,
80643
- 0 /* Normal */
80644
- ), result, node.tagName, node.attributes);
80645
- if (length(node.typeArguments)) {
80646
- forEach(node.typeArguments, checkSourceElement);
80647
- diagnostics.add(createDiagnosticForNodeArray(getSourceFileOfNode(node), node.typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, 0, length(node.typeArguments)));
80917
+ const isJsxOpenFragment = isJsxOpeningFragment(node);
80918
+ let exprTypes;
80919
+ if (!isJsxOpenFragment) {
80920
+ if (isJsxIntrinsicTagName(node.tagName)) {
80921
+ const result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node);
80922
+ const fakeSignature = createSignatureForJSXIntrinsic(node, result);
80923
+ checkTypeAssignableToAndOptionallyElaborate(checkExpressionWithContextualType(
80924
+ node.attributes,
80925
+ getEffectiveFirstArgumentForJsxSignature(fakeSignature, node),
80926
+ /*inferenceContext*/
80927
+ void 0,
80928
+ 0 /* Normal */
80929
+ ), result, node.tagName, node.attributes);
80930
+ if (length(node.typeArguments)) {
80931
+ forEach(node.typeArguments, checkSourceElement);
80932
+ diagnostics.add(createDiagnosticForNodeArray(getSourceFileOfNode(node), node.typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, 0, length(node.typeArguments)));
80933
+ }
80934
+ return fakeSignature;
80648
80935
  }
80649
- return fakeSignature;
80936
+ exprTypes = checkExpression(node.tagName);
80937
+ } else {
80938
+ exprTypes = getJSXFragmentType(node);
80650
80939
  }
80651
- const exprTypes = checkExpression(node.tagName);
80652
80940
  const apparentType = getApparentType(exprTypes);
80653
80941
  if (isErrorType(apparentType)) {
80654
80942
  return resolveErrorCall(node);
@@ -80664,7 +80952,11 @@ function createTypeChecker(host) {
80664
80952
  return resolveUntypedCall(node);
80665
80953
  }
80666
80954
  if (signatures.length === 0) {
80667
- error2(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName));
80955
+ if (isJsxOpenFragment) {
80956
+ error2(node, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node));
80957
+ } else {
80958
+ error2(node.tagName, Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, getTextOfNode(node.tagName));
80959
+ }
80668
80960
  return resolveErrorCall(node);
80669
80961
  }
80670
80962
  return resolveCall(node, signatures, candidatesOutArray, checkMode, 0 /* None */);
@@ -80706,6 +80998,7 @@ function createTypeChecker(host) {
80706
80998
  return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
80707
80999
  case 170 /* Decorator */:
80708
81000
  return resolveDecorator(node, candidatesOutArray, checkMode);
81001
+ case 289 /* JsxOpeningFragment */:
80709
81002
  case 286 /* JsxOpeningElement */:
80710
81003
  case 285 /* JsxSelfClosingElement */:
80711
81004
  return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
@@ -91925,6 +92218,8 @@ function createTypeChecker(host) {
91925
92218
  return ["__propKey"];
91926
92219
  case 16777216 /* AddDisposableResourceAndDisposeResources */:
91927
92220
  return ["__addDisposableResource", "__disposeResources"];
92221
+ case 33554432 /* RewriteRelativeImportExtension */:
92222
+ return ["__rewriteRelativeImportExtension"];
91928
92223
  default:
91929
92224
  return Debug.fail("Unrecognized helper");
91930
92225
  }
@@ -93489,6 +93784,10 @@ var JsxNames;
93489
93784
  JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes";
93490
93785
  JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes";
93491
93786
  })(JsxNames || (JsxNames = {}));
93787
+ var ReactNames;
93788
+ ((ReactNames2) => {
93789
+ ReactNames2.Fragment = "Fragment";
93790
+ })(ReactNames || (ReactNames = {}));
93492
93791
  function getIterationTypesKeyFromIterationTypeKind(typeKind) {
93493
93792
  switch (typeKind) {
93494
93793
  case 0 /* Yield */:
@@ -93514,7 +93813,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
93514
93813
  var _a;
93515
93814
  return (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host);
93516
93815
  },
93517
- useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames),
93816
+ useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
93518
93817
  redirectTargetsMap: host.redirectTargetsMap,
93519
93818
  getProjectReferenceRedirect: (fileName) => host.getProjectReferenceRedirect(fileName),
93520
93819
  isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
@@ -95961,6 +96260,13 @@ function isSimpleParameter(node) {
95961
96260
  function isSimpleParameterList(nodes) {
95962
96261
  return every(nodes, isSimpleParameter);
95963
96262
  }
96263
+ function rewriteModuleSpecifier(node, compilerOptions) {
96264
+ if (!node || !isStringLiteral(node) || !shouldRewriteModuleSpecifier(node.text, compilerOptions)) {
96265
+ return node;
96266
+ }
96267
+ const updatedText = changeExtension(node.text, getOutputExtension(node.text, compilerOptions));
96268
+ return updatedText !== node.text ? setOriginalNode(setTextRange(factory.createStringLiteral(updatedText, node.singleQuote), node), node) : node;
96269
+ }
95964
96270
 
95965
96271
  // src/compiler/transformers/destructuring.ts
95966
96272
  var FlattenLevel = /* @__PURE__ */ ((FlattenLevel2) => {
@@ -98289,7 +98595,14 @@ function transformTypeScript(context) {
98289
98595
  return void 0;
98290
98596
  }
98291
98597
  if (!node.exportClause || isNamespaceExport(node.exportClause)) {
98292
- return node;
98598
+ return factory2.updateExportDeclaration(
98599
+ node,
98600
+ node.modifiers,
98601
+ node.isTypeOnly,
98602
+ node.exportClause,
98603
+ node.moduleSpecifier,
98604
+ node.attributes
98605
+ );
98293
98606
  }
98294
98607
  const allowEmpty = !!compilerOptions.verbatimModuleSyntax;
98295
98608
  const exportClause = visitNode(
@@ -98328,8 +98641,10 @@ function transformTypeScript(context) {
98328
98641
  return void 0;
98329
98642
  }
98330
98643
  if (isExternalModuleImportEqualsDeclaration(node)) {
98331
- const isReferenced = shouldEmitAliasDeclaration(node);
98332
- return isReferenced ? visitEachChild(node, visitor, context) : void 0;
98644
+ if (!shouldEmitAliasDeclaration(node)) {
98645
+ return void 0;
98646
+ }
98647
+ return visitEachChild(node, visitor, context);
98333
98648
  }
98334
98649
  if (!shouldEmitImportEqualsDeclaration(node)) {
98335
98650
  return void 0;
@@ -112899,6 +113214,7 @@ function transformModule(context) {
112899
113214
  const moduleInfoMap = [];
112900
113215
  let currentSourceFile;
112901
113216
  let currentModuleInfo;
113217
+ let importsAndRequiresToRewriteOrShim;
112902
113218
  const noSubstitution = [];
112903
113219
  let needUMDDynamicImportHelper;
112904
113220
  return chainBundle(context, transformSourceFile);
@@ -112909,6 +113225,20 @@ function transformModule(context) {
112909
113225
  currentSourceFile = node;
112910
113226
  currentModuleInfo = collectExternalModuleInfo(context, node);
112911
113227
  moduleInfoMap[getOriginalNodeId(node)] = currentModuleInfo;
113228
+ if (compilerOptions.rewriteRelativeImportExtensions) {
113229
+ forEachDynamicImportOrRequireCall(
113230
+ node,
113231
+ /*includeTypeSpaceImports*/
113232
+ false,
113233
+ /*requireStringLiteralLikeArgument*/
113234
+ false,
113235
+ (node2) => {
113236
+ if (!isStringLiteralLike(node2.arguments[0]) || shouldRewriteModuleSpecifier(node2.arguments[0].text, compilerOptions)) {
113237
+ importsAndRequiresToRewriteOrShim = append(importsAndRequiresToRewriteOrShim, node2);
113238
+ }
113239
+ }
113240
+ );
113241
+ }
112912
113242
  const transformModule2 = getTransformModuleDelegate(moduleKind);
112913
113243
  const updated = transformModule2(node);
112914
113244
  currentSourceFile = void 0;
@@ -113380,7 +113710,7 @@ function transformModule(context) {
113380
113710
  }
113381
113711
  }
113382
113712
  function visitorWorker(node, valueIsDiscarded) {
113383
- if (!(node.transformFlags & (8388608 /* ContainsDynamicImport */ | 4096 /* ContainsDestructuringAssignment */ | 268435456 /* ContainsUpdateExpressionForIdentifier */))) {
113713
+ if (!(node.transformFlags & (8388608 /* ContainsDynamicImport */ | 4096 /* ContainsDestructuringAssignment */ | 268435456 /* ContainsUpdateExpressionForIdentifier */)) && !(importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim.length)) {
113384
113714
  return node;
113385
113715
  }
113386
113716
  switch (node.kind) {
@@ -113397,8 +113727,14 @@ function transformModule(context) {
113397
113727
  case 355 /* PartiallyEmittedExpression */:
113398
113728
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
113399
113729
  case 213 /* CallExpression */:
113730
+ const needsRewrite = node === firstOrUndefined(importsAndRequiresToRewriteOrShim);
113731
+ if (needsRewrite) {
113732
+ importsAndRequiresToRewriteOrShim.shift();
113733
+ }
113400
113734
  if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
113401
- return visitImportCallExpression(node);
113735
+ return visitImportCallExpression(node, needsRewrite);
113736
+ } else if (needsRewrite) {
113737
+ return shimOrRewriteImportOrRequireCall(node);
113402
113738
  }
113403
113739
  break;
113404
113740
  case 226 /* BinaryExpression */:
@@ -113690,13 +114026,27 @@ function transformModule(context) {
113690
114026
  }
113691
114027
  return visitEachChild(node, visitor, context);
113692
114028
  }
113693
- function visitImportCallExpression(node) {
114029
+ function shimOrRewriteImportOrRequireCall(node) {
114030
+ return factory2.updateCallExpression(
114031
+ node,
114032
+ node.expression,
114033
+ /*typeArguments*/
114034
+ void 0,
114035
+ visitNodes2(node.arguments, (arg) => {
114036
+ if (arg === node.arguments[0]) {
114037
+ return isStringLiteralLike(arg) ? rewriteModuleSpecifier(arg, compilerOptions) : emitHelpers().createRewriteRelativeImportExtensionsHelper(arg);
114038
+ }
114039
+ return visitor(arg);
114040
+ }, isExpression)
114041
+ );
114042
+ }
114043
+ function visitImportCallExpression(node, rewriteOrShim) {
113694
114044
  if (moduleKind === 0 /* None */ && languageVersion >= 7 /* ES2020 */) {
113695
114045
  return visitEachChild(node, visitor, context);
113696
114046
  }
113697
114047
  const externalModuleName = getExternalModuleNameLiteral(factory2, node, currentSourceFile, host, resolver, compilerOptions);
113698
114048
  const firstArgument = visitNode(firstOrUndefined(node.arguments), visitor, isExpression);
113699
- const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument;
114049
+ const argument = externalModuleName && (!firstArgument || !isStringLiteral(firstArgument) || firstArgument.text !== externalModuleName.text) ? externalModuleName : firstArgument && rewriteOrShim ? isStringLiteral(firstArgument) ? rewriteModuleSpecifier(firstArgument, compilerOptions) : emitHelpers().createRewriteRelativeImportExtensionsHelper(firstArgument) : firstArgument;
113700
114050
  const containsLexicalThis = !!(node.transformFlags & 16384 /* ContainsLexicalThis */);
113701
114051
  switch (compilerOptions.module) {
113702
114052
  case 2 /* AMD */:
@@ -114027,7 +114377,7 @@ function transformModule(context) {
114027
114377
  const moduleName = getExternalModuleNameLiteral(factory2, importNode, currentSourceFile, host, resolver, compilerOptions);
114028
114378
  const args = [];
114029
114379
  if (moduleName) {
114030
- args.push(moduleName);
114380
+ args.push(rewriteModuleSpecifier(moduleName, compilerOptions));
114031
114381
  }
114032
114382
  return factory2.createCallExpression(
114033
114383
  factory2.createIdentifier("require"),
@@ -116123,6 +116473,7 @@ function transformECMAScriptModule(context) {
116123
116473
  context.enableEmitNotification(307 /* SourceFile */);
116124
116474
  context.enableSubstitution(80 /* Identifier */);
116125
116475
  const noSubstitution = /* @__PURE__ */ new Set();
116476
+ let importsAndRequiresToRewriteOrShim;
116126
116477
  let helperNameSubstitutions;
116127
116478
  let currentSourceFile;
116128
116479
  let importRequireStatements;
@@ -116134,7 +116485,22 @@ function transformECMAScriptModule(context) {
116134
116485
  if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
116135
116486
  currentSourceFile = node;
116136
116487
  importRequireStatements = void 0;
116488
+ if (compilerOptions.rewriteRelativeImportExtensions && (currentSourceFile.flags & 4194304 /* PossiblyContainsDynamicImport */ || isInJSFile(node))) {
116489
+ forEachDynamicImportOrRequireCall(
116490
+ node,
116491
+ /*includeTypeSpaceImports*/
116492
+ false,
116493
+ /*requireStringLiteralLikeArgument*/
116494
+ false,
116495
+ (node2) => {
116496
+ if (!isStringLiteralLike(node2.arguments[0]) || shouldRewriteModuleSpecifier(node2.arguments[0].text, compilerOptions)) {
116497
+ importsAndRequiresToRewriteOrShim = append(importsAndRequiresToRewriteOrShim, node2);
116498
+ }
116499
+ }
116500
+ );
116501
+ }
116137
116502
  let result = updateExternalModule(node);
116503
+ addEmitHelpers(result, context.readEmitHelpers());
116138
116504
  currentSourceFile = void 0;
116139
116505
  if (importRequireStatements) {
116140
116506
  result = factory2.updateSourceFile(
@@ -116176,14 +116542,52 @@ function transformECMAScriptModule(context) {
116176
116542
  case 278 /* ExportDeclaration */:
116177
116543
  const exportDecl = node;
116178
116544
  return visitExportDeclaration(exportDecl);
116545
+ case 272 /* ImportDeclaration */:
116546
+ return visitImportDeclaration(node);
116547
+ case 213 /* CallExpression */:
116548
+ if (node === (importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim[0])) {
116549
+ return visitImportOrRequireCall(importsAndRequiresToRewriteOrShim.shift());
116550
+ }
116551
+ break;
116552
+ default:
116553
+ if ((importsAndRequiresToRewriteOrShim == null ? void 0 : importsAndRequiresToRewriteOrShim.length) && rangeContainsRange(node, importsAndRequiresToRewriteOrShim[0])) {
116554
+ return visitEachChild(node, visitor, context);
116555
+ }
116179
116556
  }
116180
116557
  return node;
116181
116558
  }
116559
+ function visitImportDeclaration(node) {
116560
+ if (!compilerOptions.rewriteRelativeImportExtensions) {
116561
+ return node;
116562
+ }
116563
+ const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleSpecifier, compilerOptions);
116564
+ if (updatedModuleSpecifier === node.moduleSpecifier) {
116565
+ return node;
116566
+ }
116567
+ return factory2.updateImportDeclaration(
116568
+ node,
116569
+ node.modifiers,
116570
+ node.importClause,
116571
+ updatedModuleSpecifier,
116572
+ node.attributes
116573
+ );
116574
+ }
116575
+ function visitImportOrRequireCall(node) {
116576
+ return factory2.updateCallExpression(
116577
+ node,
116578
+ node.expression,
116579
+ node.typeArguments,
116580
+ [
116581
+ isStringLiteralLike(node.arguments[0]) ? rewriteModuleSpecifier(node.arguments[0], compilerOptions) : emitHelpers().createRewriteRelativeImportExtensionsHelper(node.arguments[0]),
116582
+ ...node.arguments.slice(1)
116583
+ ]
116584
+ );
116585
+ }
116182
116586
  function createRequireCall2(importNode) {
116183
116587
  const moduleName = getExternalModuleNameLiteral(factory2, importNode, Debug.checkDefined(currentSourceFile), host, resolver, compilerOptions);
116184
116588
  const args = [];
116185
116589
  if (moduleName) {
116186
- args.push(moduleName);
116590
+ args.push(rewriteModuleSpecifier(moduleName, compilerOptions));
116187
116591
  }
116188
116592
  if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
116189
116593
  return factory2.createCallExpression(
@@ -116328,11 +116732,16 @@ function transformECMAScriptModule(context) {
116328
116732
  return node;
116329
116733
  }
116330
116734
  function visitExportDeclaration(node) {
116331
- if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */) {
116332
- return node;
116333
- }
116334
- if (!node.exportClause || !isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
116335
- return node;
116735
+ const updatedModuleSpecifier = rewriteModuleSpecifier(node.moduleSpecifier, compilerOptions);
116736
+ if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */ || !node.exportClause || !isNamespaceExport(node.exportClause) || !node.moduleSpecifier) {
116737
+ return !node.moduleSpecifier || updatedModuleSpecifier === node.moduleSpecifier ? node : factory2.updateExportDeclaration(
116738
+ node,
116739
+ node.modifiers,
116740
+ node.isTypeOnly,
116741
+ node.exportClause,
116742
+ updatedModuleSpecifier,
116743
+ node.attributes
116744
+ );
116336
116745
  }
116337
116746
  const oldIdentifier = node.exportClause.name;
116338
116747
  const synthName = factory2.getGeneratedNameForNode(oldIdentifier);
@@ -116348,7 +116757,7 @@ function transformECMAScriptModule(context) {
116348
116757
  synthName
116349
116758
  )
116350
116759
  ),
116351
- node.moduleSpecifier,
116760
+ updatedModuleSpecifier,
116352
116761
  node.attributes
116353
116762
  );
116354
116763
  setOriginalNode(importDecl, node.exportClause);
@@ -117507,7 +117916,7 @@ function transformDeclarations(context) {
117507
117916
  }
117508
117917
  return setCommentRange(updated, getCommentRange(original));
117509
117918
  }
117510
- function rewriteModuleSpecifier(parent2, input) {
117919
+ function rewriteModuleSpecifier2(parent2, input) {
117511
117920
  if (!input) return void 0;
117512
117921
  resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 267 /* ModuleDeclaration */ && parent2.kind !== 205 /* ImportType */;
117513
117922
  if (isStringLiteralLike(input)) {
@@ -117529,7 +117938,7 @@ function transformDeclarations(context) {
117529
117938
  decl.modifiers,
117530
117939
  decl.isTypeOnly,
117531
117940
  decl.name,
117532
- factory2.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))
117941
+ factory2.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier2(decl, specifier))
117533
117942
  );
117534
117943
  } else {
117535
117944
  const oldDiag = getSymbolAccessibilityDiagnostic;
@@ -117545,7 +117954,7 @@ function transformDeclarations(context) {
117545
117954
  decl,
117546
117955
  decl.modifiers,
117547
117956
  decl.importClause,
117548
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
117957
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117549
117958
  tryGetResolutionModeOverride(decl.attributes)
117550
117959
  );
117551
117960
  }
@@ -117561,7 +117970,7 @@ function transformDeclarations(context) {
117561
117970
  /*namedBindings*/
117562
117971
  void 0
117563
117972
  ),
117564
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
117973
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117565
117974
  tryGetResolutionModeOverride(decl.attributes)
117566
117975
  );
117567
117976
  }
@@ -117579,7 +117988,7 @@ function transformDeclarations(context) {
117579
117988
  visibleDefaultBinding,
117580
117989
  namedBindings
117581
117990
  ),
117582
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
117991
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117583
117992
  tryGetResolutionModeOverride(decl.attributes)
117584
117993
  ) : void 0;
117585
117994
  }
@@ -117594,7 +118003,7 @@ function transformDeclarations(context) {
117594
118003
  visibleDefaultBinding,
117595
118004
  bindingList && bindingList.length ? factory2.updateNamedImports(decl.importClause.namedBindings, bindingList) : void 0
117596
118005
  ),
117597
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
118006
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117598
118007
  tryGetResolutionModeOverride(decl.attributes)
117599
118008
  );
117600
118009
  }
@@ -117607,7 +118016,7 @@ function transformDeclarations(context) {
117607
118016
  decl.modifiers,
117608
118017
  /*importClause*/
117609
118018
  void 0,
117610
- rewriteModuleSpecifier(decl, decl.moduleSpecifier),
118019
+ rewriteModuleSpecifier2(decl, decl.moduleSpecifier),
117611
118020
  tryGetResolutionModeOverride(decl.attributes)
117612
118021
  );
117613
118022
  }
@@ -117921,7 +118330,7 @@ function transformDeclarations(context) {
117921
118330
  if (!isLiteralImportTypeNode(input)) return cleanup(input);
117922
118331
  return cleanup(factory2.updateImportTypeNode(
117923
118332
  input,
117924
- factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)),
118333
+ factory2.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier2(input, input.argument.literal)),
117925
118334
  input.attributes,
117926
118335
  input.qualifier,
117927
118336
  visitNodes2(input.typeArguments, visitDeclarationSubtree, isTypeNode),
@@ -117974,7 +118383,7 @@ function transformDeclarations(context) {
117974
118383
  input.modifiers,
117975
118384
  input.isTypeOnly,
117976
118385
  input.exportClause,
117977
- rewriteModuleSpecifier(input, input.moduleSpecifier),
118386
+ rewriteModuleSpecifier2(input, input.moduleSpecifier),
117978
118387
  tryGetResolutionModeOverride(input.attributes)
117979
118388
  );
117980
118389
  }
@@ -118224,7 +118633,7 @@ function transformDeclarations(context) {
118224
118633
  return cleanup(updateModuleDeclarationAndKeyword(
118225
118634
  input,
118226
118635
  mods,
118227
- isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name,
118636
+ isExternalModuleAugmentation(input) ? rewriteModuleSpecifier2(input, input.name) : input.name,
118228
118637
  body
118229
118638
  ));
118230
118639
  } else {
@@ -126928,7 +127337,21 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126928
127337
  );
126929
127338
  }
126930
127339
  if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
126931
- collectDynamicImportOrRequireOrJsDocImportCalls(file);
127340
+ forEachDynamicImportOrRequireCall(
127341
+ file,
127342
+ /*includeTypeSpaceImports*/
127343
+ true,
127344
+ /*requireStringLiteralLikeArgument*/
127345
+ true,
127346
+ (node, moduleSpecifier) => {
127347
+ setParentRecursive(
127348
+ node,
127349
+ /*incremental*/
127350
+ false
127351
+ );
127352
+ imports = append(imports, moduleSpecifier);
127353
+ }
127354
+ );
126932
127355
  }
126933
127356
  file.imports = imports || emptyArray;
126934
127357
  file.moduleAugmentations = moduleAugmentations || emptyArray;
@@ -126976,63 +127399,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126976
127399
  }
126977
127400
  }
126978
127401
  }
126979
- function collectDynamicImportOrRequireOrJsDocImportCalls(file2) {
126980
- const r = /import|require/g;
126981
- while (r.exec(file2.text) !== null) {
126982
- const node = getNodeAtPosition(file2, r.lastIndex);
126983
- if (isJavaScriptFile && isRequireCall(
126984
- node,
126985
- /*requireStringLiteralLikeArgument*/
126986
- true
126987
- )) {
126988
- setParentRecursive(
126989
- node,
126990
- /*incremental*/
126991
- false
126992
- );
126993
- imports = append(imports, node.arguments[0]);
126994
- } else if (isImportCall(node) && node.arguments.length >= 1 && isStringLiteralLike(node.arguments[0])) {
126995
- setParentRecursive(
126996
- node,
126997
- /*incremental*/
126998
- false
126999
- );
127000
- imports = append(imports, node.arguments[0]);
127001
- } else if (isLiteralImportTypeNode(node)) {
127002
- setParentRecursive(
127003
- node,
127004
- /*incremental*/
127005
- false
127006
- );
127007
- imports = append(imports, node.argument.literal);
127008
- } else if (isJavaScriptFile && isJSDocImportTag(node)) {
127009
- const moduleNameExpr = getExternalModuleName(node);
127010
- if (moduleNameExpr && isStringLiteral(moduleNameExpr) && moduleNameExpr.text) {
127011
- setParentRecursive(
127012
- node,
127013
- /*incremental*/
127014
- false
127015
- );
127016
- imports = append(imports, moduleNameExpr);
127017
- }
127018
- }
127019
- }
127020
- }
127021
- function getNodeAtPosition(sourceFile, position) {
127022
- let current = sourceFile;
127023
- const getContainingChild = (child) => {
127024
- if (child.pos <= position && (position < child.end || position === child.end && child.kind === 1 /* EndOfFileToken */)) {
127025
- return child;
127026
- }
127027
- };
127028
- while (true) {
127029
- const child = isJavaScriptFile && hasJSDocNodes(current) && forEach(current.jsDoc, getContainingChild) || forEachChild(current, getContainingChild);
127030
- if (!child) {
127031
- return current;
127032
- }
127033
- current = child;
127034
- }
127035
- }
127036
127402
  }
127037
127403
  function getLibFileFromReference(ref) {
127038
127404
  var _a2;
@@ -127857,7 +128223,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127857
128223
  createDiagnosticForOptionName(Diagnostics.Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System, "verbatimModuleSyntax");
127858
128224
  }
127859
128225
  }
127860
- if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly)) {
128226
+ if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
127861
128227
  createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set);
127862
128228
  }
127863
128229
  const moduleResolution = getEmitModuleResolutionKind(options);
@@ -137463,9 +137829,6 @@ function getLineStartPositionForPosition(position, sourceFile) {
137463
137829
  const line = sourceFile.getLineAndCharacterOfPosition(position).line;
137464
137830
  return lineStarts[line];
137465
137831
  }
137466
- function rangeContainsRange(r1, r2) {
137467
- return startEndContainsRange(r1.pos, r1.end, r2);
137468
- }
137469
137832
  function rangeContainsRangeExclusive(r1, r2) {
137470
137833
  return rangeContainsPositionExclusive(r1, r2.pos) && rangeContainsPositionExclusive(r1, r2.end);
137471
137834
  }
@@ -137475,9 +137838,6 @@ function rangeContainsPosition(r, pos) {
137475
137838
  function rangeContainsPositionExclusive(r, pos) {
137476
137839
  return r.pos < pos && pos < r.end;
137477
137840
  }
137478
- function startEndContainsRange(start, end, range) {
137479
- return start <= range.pos && end >= range.end;
137480
- }
137481
137841
  function rangeContainsStartEnd(range, start, end) {
137482
137842
  return range.pos <= start && range.end >= end;
137483
137843
  }
@@ -138497,7 +138857,7 @@ function createModuleSpecifierResolutionHost(program, host) {
138497
138857
  fileExists: (fileName) => program.fileExists(fileName),
138498
138858
  getCurrentDirectory: () => host.getCurrentDirectory(),
138499
138859
  readFile: maybeBind(host, host.readFile),
138500
- useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames),
138860
+ useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames) || program.useCaseSensitiveFileNames,
138501
138861
  getSymlinkCache: maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache,
138502
138862
  getModuleSpecifierCache: maybeBind(host, host.getModuleSpecifierCache),
138503
138863
  getPackageJsonInfoCache: () => {
@@ -181197,6 +181557,7 @@ __export(ts_exports2, {
181197
181557
  forEachAncestorDirectoryStoppingAtGlobalCache: () => forEachAncestorDirectoryStoppingAtGlobalCache,
181198
181558
  forEachChild: () => forEachChild,
181199
181559
  forEachChildRecursively: () => forEachChildRecursively,
181560
+ forEachDynamicImportOrRequireCall: () => forEachDynamicImportOrRequireCall,
181200
181561
  forEachEmittedFile: () => forEachEmittedFile,
181201
181562
  forEachEnclosingBlockScopeContainer: () => forEachEnclosingBlockScopeContainer,
181202
181563
  forEachEntry: () => forEachEntry,
@@ -181237,6 +181598,7 @@ __export(ts_exports2, {
181237
181598
  getAllKeys: () => getAllKeys,
181238
181599
  getAllProjectOutputs: () => getAllProjectOutputs,
181239
181600
  getAllSuperTypeNodes: () => getAllSuperTypeNodes,
181601
+ getAllowImportingTsExtensions: () => getAllowImportingTsExtensions,
181240
181602
  getAllowJSCompilerOption: () => getAllowJSCompilerOption,
181241
181603
  getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports,
181242
181604
  getAncestor: () => getAncestor,
@@ -182094,6 +182456,7 @@ __export(ts_exports2, {
182094
182456
  isJsxAttributeLike: () => isJsxAttributeLike,
182095
182457
  isJsxAttributeName: () => isJsxAttributeName,
182096
182458
  isJsxAttributes: () => isJsxAttributes,
182459
+ isJsxCallLike: () => isJsxCallLike,
182097
182460
  isJsxChild: () => isJsxChild,
182098
182461
  isJsxClosingElement: () => isJsxClosingElement,
182099
182462
  isJsxClosingFragment: () => isJsxClosingFragment,
@@ -182224,6 +182587,7 @@ __export(ts_exports2, {
182224
182587
  isParseTreeNode: () => isParseTreeNode,
182225
182588
  isPartOfParameterDeclaration: () => isPartOfParameterDeclaration,
182226
182589
  isPartOfTypeNode: () => isPartOfTypeNode,
182590
+ isPartOfTypeOnlyImportOrExportDeclaration: () => isPartOfTypeOnlyImportOrExportDeclaration,
182227
182591
  isPartOfTypeQuery: () => isPartOfTypeQuery,
182228
182592
  isPartiallyEmittedExpression: () => isPartiallyEmittedExpression,
182229
182593
  isPatternMatch: () => isPatternMatch,
@@ -182623,6 +182987,7 @@ __export(ts_exports2, {
182623
182987
  returnTrue: () => returnTrue,
182624
182988
  returnUndefined: () => returnUndefined,
182625
182989
  returnsPromise: () => returnsPromise,
182990
+ rewriteModuleSpecifier: () => rewriteModuleSpecifier,
182626
182991
  sameFlatMap: () => sameFlatMap,
182627
182992
  sameMap: () => sameMap,
182628
182993
  sameMapping: () => sameMapping,
@@ -182668,6 +183033,7 @@ __export(ts_exports2, {
182668
183033
  setValueDeclaration: () => setValueDeclaration,
182669
183034
  shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
182670
183035
  shouldPreserveConstEnums: () => shouldPreserveConstEnums,
183036
+ shouldRewriteModuleSpecifier: () => shouldRewriteModuleSpecifier,
182671
183037
  shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
182672
183038
  showModuleSpecifier: () => showModuleSpecifier,
182673
183039
  signatureHasRestParameter: () => signatureHasRestParameter,
@@ -183864,6 +184230,7 @@ var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
183864
184230
  ScriptTarget12["ES2021"] = "es2021";
183865
184231
  ScriptTarget12["ES2022"] = "es2022";
183866
184232
  ScriptTarget12["ES2023"] = "es2023";
184233
+ ScriptTarget12["ES2024"] = "es2024";
183867
184234
  ScriptTarget12["ESNext"] = "esnext";
183868
184235
  ScriptTarget12["JSON"] = "json";
183869
184236
  ScriptTarget12["Latest"] = "esnext" /* ESNext */;
@@ -195934,6 +196301,7 @@ if (typeof console !== "undefined") {
195934
196301
  forEachAncestorDirectoryStoppingAtGlobalCache,
195935
196302
  forEachChild,
195936
196303
  forEachChildRecursively,
196304
+ forEachDynamicImportOrRequireCall,
195937
196305
  forEachEmittedFile,
195938
196306
  forEachEnclosingBlockScopeContainer,
195939
196307
  forEachEntry,
@@ -195974,6 +196342,7 @@ if (typeof console !== "undefined") {
195974
196342
  getAllKeys,
195975
196343
  getAllProjectOutputs,
195976
196344
  getAllSuperTypeNodes,
196345
+ getAllowImportingTsExtensions,
195977
196346
  getAllowJSCompilerOption,
195978
196347
  getAllowSyntheticDefaultImports,
195979
196348
  getAncestor,
@@ -196831,6 +197200,7 @@ if (typeof console !== "undefined") {
196831
197200
  isJsxAttributeLike,
196832
197201
  isJsxAttributeName,
196833
197202
  isJsxAttributes,
197203
+ isJsxCallLike,
196834
197204
  isJsxChild,
196835
197205
  isJsxClosingElement,
196836
197206
  isJsxClosingFragment,
@@ -196961,6 +197331,7 @@ if (typeof console !== "undefined") {
196961
197331
  isParseTreeNode,
196962
197332
  isPartOfParameterDeclaration,
196963
197333
  isPartOfTypeNode,
197334
+ isPartOfTypeOnlyImportOrExportDeclaration,
196964
197335
  isPartOfTypeQuery,
196965
197336
  isPartiallyEmittedExpression,
196966
197337
  isPatternMatch,
@@ -197360,6 +197731,7 @@ if (typeof console !== "undefined") {
197360
197731
  returnTrue,
197361
197732
  returnUndefined,
197362
197733
  returnsPromise,
197734
+ rewriteModuleSpecifier,
197363
197735
  sameFlatMap,
197364
197736
  sameMap,
197365
197737
  sameMapping,
@@ -197405,6 +197777,7 @@ if (typeof console !== "undefined") {
197405
197777
  setValueDeclaration,
197406
197778
  shouldAllowImportingTsExtension,
197407
197779
  shouldPreserveConstEnums,
197780
+ shouldRewriteModuleSpecifier,
197408
197781
  shouldUseUriStyleNodeCoreModules,
197409
197782
  showModuleSpecifier,
197410
197783
  signatureHasRestParameter,