@typescript-deploys/pr-build 5.6.0-pr-59285-2 → 5.6.0-pr-58296-32

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
@@ -248,6 +248,7 @@ __export(typescript_exports, {
248
248
  canHaveJSDoc: () => canHaveJSDoc,
249
249
  canHaveLocals: () => canHaveLocals,
250
250
  canHaveModifiers: () => canHaveModifiers,
251
+ canHaveModuleSpecifier: () => canHaveModuleSpecifier,
251
252
  canHaveSymbol: () => canHaveSymbol,
252
253
  canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
253
254
  canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
@@ -410,6 +411,7 @@ __export(typescript_exports, {
410
411
  createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
411
412
  createModeAwareCache: () => createModeAwareCache,
412
413
  createModeAwareCacheKey: () => createModeAwareCacheKey,
414
+ createModeMismatchDetails: () => createModeMismatchDetails,
413
415
  createModuleNotFoundChain: () => createModuleNotFoundChain,
414
416
  createModuleResolutionCache: () => createModuleResolutionCache,
415
417
  createModuleResolutionLoader: () => createModuleResolutionLoader,
@@ -691,6 +693,7 @@ __export(typescript_exports, {
691
693
  getDefaultLibFilePath: () => getDefaultLibFilePath,
692
694
  getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
693
695
  getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
696
+ getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
694
697
  getDiagnosticText: () => getDiagnosticText,
695
698
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
696
699
  getDirectoryPath: () => getDirectoryPath,
@@ -721,6 +724,7 @@ __export(typescript_exports, {
721
724
  getEmitFlags: () => getEmitFlags,
722
725
  getEmitHelpers: () => getEmitHelpers,
723
726
  getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
727
+ getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
724
728
  getEmitModuleKind: () => getEmitModuleKind,
725
729
  getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
726
730
  getEmitScriptTarget: () => getEmitScriptTarget,
@@ -771,6 +775,7 @@ __export(typescript_exports, {
771
775
  getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
772
776
  getIdentifierTypeArguments: () => getIdentifierTypeArguments,
773
777
  getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
778
+ getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
774
779
  getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
775
780
  getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
776
781
  getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
@@ -876,7 +881,6 @@ __export(typescript_exports, {
876
881
  getNameOfScriptTarget: () => getNameOfScriptTarget,
877
882
  getNameOrArgument: () => getNameOrArgument,
878
883
  getNameTable: () => getNameTable,
879
- getNamesForExportedSymbol: () => getNamesForExportedSymbol,
880
884
  getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
881
885
  getNewLineCharacter: () => getNewLineCharacter,
882
886
  getNewLineKind: () => getNewLineKind,
@@ -1113,6 +1117,7 @@ __export(typescript_exports, {
1113
1117
  ignoreSourceNewlines: () => ignoreSourceNewlines,
1114
1118
  ignoredPaths: () => ignoredPaths,
1115
1119
  importFromModuleSpecifier: () => importFromModuleSpecifier,
1120
+ importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
1116
1121
  indexOfAnyCharCode: () => indexOfAnyCharCode,
1117
1122
  indexOfNode: () => indexOfNode,
1118
1123
  indicesOf: () => indicesOf,
@@ -2158,11 +2163,11 @@ __export(typescript_exports, {
2158
2163
  transformESDecorators: () => transformESDecorators,
2159
2164
  transformESNext: () => transformESNext,
2160
2165
  transformGenerators: () => transformGenerators,
2166
+ transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
2161
2167
  transformJsx: () => transformJsx,
2162
2168
  transformLegacyDecorators: () => transformLegacyDecorators,
2163
2169
  transformModule: () => transformModule,
2164
2170
  transformNamedEvaluation: () => transformNamedEvaluation,
2165
- transformNodeModule: () => transformNodeModule,
2166
2171
  transformNodes: () => transformNodes,
2167
2172
  transformSystemModule: () => transformSystemModule,
2168
2173
  transformTypeScript: () => transformTypeScript,
@@ -2251,7 +2256,7 @@ module.exports = __toCommonJS(typescript_exports);
2251
2256
 
2252
2257
  // src/compiler/corePublic.ts
2253
2258
  var versionMajorMinor = "5.6";
2254
- var version = `${versionMajorMinor}.0-insiders.20240715`;
2259
+ var version = `${versionMajorMinor}.0-insiders.20240718`;
2255
2260
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2256
2261
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2257
2262
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -5051,10 +5056,12 @@ function tryGetPerformance() {
5051
5056
  if (isNodeLikeSystem()) {
5052
5057
  try {
5053
5058
  const { performance: performance2 } = require("perf_hooks");
5054
- return {
5055
- shouldWriteNativeEvents: false,
5056
- performance: performance2
5057
- };
5059
+ if (performance2) {
5060
+ return {
5061
+ shouldWriteNativeEvents: false,
5062
+ performance: performance2
5063
+ };
5064
+ }
5058
5065
  } catch {
5059
5066
  }
5060
5067
  }
@@ -6085,6 +6092,7 @@ var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagno
6085
6092
  var EmitOnly = /* @__PURE__ */ ((EmitOnly4) => {
6086
6093
  EmitOnly4[EmitOnly4["Js"] = 0] = "Js";
6087
6094
  EmitOnly4[EmitOnly4["Dts"] = 1] = "Dts";
6095
+ EmitOnly4[EmitOnly4["BuilderSignature"] = 2] = "BuilderSignature";
6088
6096
  return EmitOnly4;
6089
6097
  })(EmitOnly || {});
6090
6098
  var StructureIsReused = /* @__PURE__ */ ((StructureIsReused2) => {
@@ -6722,22 +6730,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
6722
6730
  ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
6723
6731
  return ScriptKind7;
6724
6732
  })(ScriptKind || {});
6725
- var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
6726
- ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
6727
- ScriptTarget11[ScriptTarget11["ES5"] = 1] = "ES5";
6728
- ScriptTarget11[ScriptTarget11["ES2015"] = 2] = "ES2015";
6729
- ScriptTarget11[ScriptTarget11["ES2016"] = 3] = "ES2016";
6730
- ScriptTarget11[ScriptTarget11["ES2017"] = 4] = "ES2017";
6731
- ScriptTarget11[ScriptTarget11["ES2018"] = 5] = "ES2018";
6732
- ScriptTarget11[ScriptTarget11["ES2019"] = 6] = "ES2019";
6733
- ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
6734
- ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
6735
- ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
6736
- ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
6737
- ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
6738
- ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
6739
- ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
6740
- return ScriptTarget11;
6733
+ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => {
6734
+ ScriptTarget12[ScriptTarget12["ES3"] = 0] = "ES3";
6735
+ ScriptTarget12[ScriptTarget12["ES5"] = 1] = "ES5";
6736
+ ScriptTarget12[ScriptTarget12["ES2015"] = 2] = "ES2015";
6737
+ ScriptTarget12[ScriptTarget12["ES2016"] = 3] = "ES2016";
6738
+ ScriptTarget12[ScriptTarget12["ES2017"] = 4] = "ES2017";
6739
+ ScriptTarget12[ScriptTarget12["ES2018"] = 5] = "ES2018";
6740
+ ScriptTarget12[ScriptTarget12["ES2019"] = 6] = "ES2019";
6741
+ ScriptTarget12[ScriptTarget12["ES2020"] = 7] = "ES2020";
6742
+ ScriptTarget12[ScriptTarget12["ES2021"] = 8] = "ES2021";
6743
+ ScriptTarget12[ScriptTarget12["ES2022"] = 9] = "ES2022";
6744
+ ScriptTarget12[ScriptTarget12["ES2023"] = 10] = "ES2023";
6745
+ ScriptTarget12[ScriptTarget12["ESNext"] = 99] = "ESNext";
6746
+ ScriptTarget12[ScriptTarget12["JSON"] = 100] = "JSON";
6747
+ ScriptTarget12[ScriptTarget12["Latest"] = 99 /* ESNext */] = "Latest";
6748
+ return ScriptTarget12;
6741
6749
  })(ScriptTarget || {});
6742
6750
  var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
6743
6751
  LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
@@ -9292,6 +9300,7 @@ var Diagnostics = {
9292
9300
  _0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1290, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_marked_type_only_in_this_file_before_re_exporting_1290", "'{0}' resolves to a type-only declaration and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
9293
9301
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
9294
9302
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
9303
+ ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
9295
9304
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
9296
9305
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
9297
9306
  The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
@@ -9500,6 +9509,7 @@ var Diagnostics = {
9500
9509
  This_character_cannot_be_escaped_in_a_regular_expression: diag(1535, 1 /* Error */, "This_character_cannot_be_escaped_in_a_regular_expression_1535", "This character cannot be escaped in a regular expression."),
9501
9510
  Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead: diag(1536, 1 /* Error */, "Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended__1536", "Octal escape sequences and backreferences are not allowed in a character class. If this was intended as an escape sequence, use the syntax '{0}' instead."),
9502
9511
  Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."),
9512
+ Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1538, 1 /* Error */, "Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_se_1538", "Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."),
9503
9513
  The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
9504
9514
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
9505
9515
  Call_signature_return_types_0_and_1_are_incompatible: diag(
@@ -10175,6 +10185,8 @@ var Diagnostics = {
10175
10185
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
10176
10186
  Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
10177
10187
  One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
10188
+ Property_0_is_readonly_in_the_source_but_not_in_the_target: diag(4127, 1 /* Error */, "Property_0_is_readonly_in_the_source_but_not_in_the_target_4127", "Property '{0}' is 'readonly' in the source but not in the target."),
10189
+ _0_index_signature_is_readonly_in_the_source_but_not_in_the_target: diag(4128, 1 /* Error */, "_0_index_signature_is_readonly_in_the_source_but_not_in_the_target_4128", "'{0}' index signature is 'readonly' in the source but not in the target."),
10178
10190
  The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
10179
10191
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
10180
10192
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -10741,6 +10753,7 @@ var Diagnostics = {
10741
10753
  Require_undeclared_properties_from_index_signatures_to_use_element_accesses: diag(6717, 3 /* Message */, "Require_undeclared_properties_from_index_signatures_to_use_element_accesses_6717", "Require undeclared properties from index signatures to use element accesses."),
10742
10754
  Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
10743
10755
  Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
10756
+ Ensure_that_readonly_properties_remain_read_only_in_type_relationships: diag(6720, 3 /* Message */, "Ensure_that_readonly_properties_remain_read_only_in_type_relationships_6720", "Ensure that 'readonly' properties remain read-only in type relationships."),
10744
10757
  Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
10745
10758
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
10746
10759
  Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
@@ -12371,9 +12384,16 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12371
12384
  case 34 /* doubleQuote */:
12372
12385
  return '"';
12373
12386
  case 117 /* u */:
12374
- if (flags & 17 /* ScanExtendedUnicodeEscape */ && pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
12387
+ if (pos < end && charCodeUnchecked(pos) === 123 /* openBrace */) {
12375
12388
  pos -= 2;
12376
- return scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
12389
+ const result = scanExtendedUnicodeEscape(!!(flags & 6 /* ReportInvalidEscapeErrors */));
12390
+ if (!(flags & 17 /* AllowExtendedUnicodeEscape */)) {
12391
+ tokenFlags |= 2048 /* ContainsInvalidEscape */;
12392
+ if (flags & 6 /* ReportInvalidEscapeErrors */) {
12393
+ error2(Diagnostics.Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
12394
+ }
12395
+ }
12396
+ return result;
12377
12397
  }
12378
12398
  for (; pos < start2 + 6; pos++) {
12379
12399
  if (!(pos < end && isHexDigit(charCodeUnchecked(pos)))) {
@@ -12391,7 +12411,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
12391
12411
  const nextStart = pos;
12392
12412
  let nextPos = pos + 2;
12393
12413
  for (; nextPos < nextStart + 6; nextPos++) {
12394
- if (!isHexDigit(charCodeUnchecked(pos))) {
12414
+ if (!isHexDigit(charCodeUnchecked(nextPos))) {
12395
12415
  return escapedValueString;
12396
12416
  }
12397
12417
  }
@@ -14019,7 +14039,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14019
14039
  return value;
14020
14040
  }
14021
14041
  function scanSourceCharacter() {
14022
- const size = anyUnicodeMode ? charSize(charCodeChecked(pos)) : 1;
14042
+ const size = anyUnicodeMode ? charSize(codePointChecked(pos)) : 1;
14023
14043
  pos += size;
14024
14044
  return size > 0 ? text.substring(pos - size, pos) : "";
14025
14045
  }
@@ -16169,6 +16189,34 @@ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, pack
16169
16189
  if (result) result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
16170
16190
  return result;
16171
16191
  }
16192
+ function createModeMismatchDetails(currentSourceFile) {
16193
+ const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
16194
+ const scope = currentSourceFile.packageJsonScope;
16195
+ const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
16196
+ const result = scope && !scope.contents.packageJsonContent.type ? targetExt ? chainDiagnosticMessages(
16197
+ /*details*/
16198
+ void 0,
16199
+ Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
16200
+ targetExt,
16201
+ combinePaths(scope.packageDirectory, "package.json")
16202
+ ) : chainDiagnosticMessages(
16203
+ /*details*/
16204
+ void 0,
16205
+ Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
16206
+ combinePaths(scope.packageDirectory, "package.json")
16207
+ ) : targetExt ? chainDiagnosticMessages(
16208
+ /*details*/
16209
+ void 0,
16210
+ Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
16211
+ targetExt
16212
+ ) : chainDiagnosticMessages(
16213
+ /*details*/
16214
+ void 0,
16215
+ Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
16216
+ );
16217
+ result.repopulateInfo = () => true;
16218
+ return result;
16219
+ }
16172
16220
  function packageIdIsEqual(a, b) {
16173
16221
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version && a.peerDependencies === b.peerDependencies;
16174
16222
  }
@@ -18141,7 +18189,7 @@ function isInExpressionContext(node) {
18141
18189
  case 233 /* ExpressionWithTypeArguments */:
18142
18190
  return parent2.expression === node && !isPartOfTypeNode(parent2);
18143
18191
  case 304 /* ShorthandPropertyAssignment */:
18144
- return (parent2.objectAssignmentInitializer ?? parent2.name) === node;
18192
+ return parent2.objectAssignmentInitializer === node;
18145
18193
  case 238 /* SatisfiesExpression */:
18146
18194
  return node === parent2.expression;
18147
18195
  default:
@@ -18477,6 +18525,23 @@ function isFunctionSymbol(symbol) {
18477
18525
  const decl = symbol.valueDeclaration;
18478
18526
  return decl.kind === 262 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer);
18479
18527
  }
18528
+ function canHaveModuleSpecifier(node) {
18529
+ switch (node == null ? void 0 : node.kind) {
18530
+ case 260 /* VariableDeclaration */:
18531
+ case 208 /* BindingElement */:
18532
+ case 272 /* ImportDeclaration */:
18533
+ case 278 /* ExportDeclaration */:
18534
+ case 271 /* ImportEqualsDeclaration */:
18535
+ case 273 /* ImportClause */:
18536
+ case 280 /* NamespaceExport */:
18537
+ case 274 /* NamespaceImport */:
18538
+ case 281 /* ExportSpecifier */:
18539
+ case 276 /* ImportSpecifier */:
18540
+ case 205 /* ImportType */:
18541
+ return true;
18542
+ }
18543
+ return false;
18544
+ }
18480
18545
  function tryGetModuleSpecifierFromDeclaration(node) {
18481
18546
  var _a, _b;
18482
18547
  switch (node.kind) {
@@ -21460,8 +21525,8 @@ function walkTreeForJSXTags(node) {
21460
21525
  function isFileModuleFromUsingJSXTag(file) {
21461
21526
  return !file.isDeclarationFile ? walkTreeForJSXTags(file) : void 0;
21462
21527
  }
21463
- function isFileForcedToBeModuleByFormat(file) {
21464
- return (file.impliedNodeFormat === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
21528
+ function isFileForcedToBeModuleByFormat(file, options) {
21529
+ return (getImpliedNodeFormatForEmitWorker(file, options) === 99 /* ESNext */ || fileExtensionIsOneOf(file.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */, ".mjs" /* Mjs */, ".mts" /* Mts */])) && !file.isDeclarationFile ? true : void 0;
21465
21530
  }
21466
21531
  function getSetExternalModuleIndicator(options) {
21467
21532
  switch (getEmitModuleDetectionKind(options)) {
@@ -21480,10 +21545,14 @@ function getSetExternalModuleIndicator(options) {
21480
21545
  }
21481
21546
  checks.push(isFileForcedToBeModuleByFormat);
21482
21547
  const combined = or(...checks);
21483
- const callback = (file) => void (file.externalModuleIndicator = combined(file));
21548
+ const callback = (file) => void (file.externalModuleIndicator = combined(file, options));
21484
21549
  return callback;
21485
21550
  }
21486
21551
  }
21552
+ function importSyntaxAffectsModuleResolution(options) {
21553
+ const moduleResolution = getEmitModuleResolutionKind(options);
21554
+ return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options);
21555
+ }
21487
21556
  function createComputedCompilerOptions(options) {
21488
21557
  return options;
21489
21558
  }
@@ -30970,7 +31039,7 @@ function createExternalHelpersImportDeclarationIfNeeded(nodeFactory, helperFacto
30970
31039
  if (compilerOptions.importHelpers && isEffectiveExternalModule(sourceFile, compilerOptions)) {
30971
31040
  let namedBindings;
30972
31041
  const moduleKind = getEmitModuleKind(compilerOptions);
30973
- if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || sourceFile.impliedNodeFormat === 99 /* ESNext */) {
31042
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind <= 99 /* ESNext */ || getImpliedNodeFormatForEmitWorker(sourceFile, compilerOptions) === 99 /* ESNext */) {
30974
31043
  const helpers = getEmitHelpers(sourceFile);
30975
31044
  if (helpers) {
30976
31045
  const helperNames = [];
@@ -31035,8 +31104,7 @@ function getOrCreateExternalHelpersModuleNameIfNeeded(factory2, node, compilerOp
31035
31104
  if (externalHelpersModuleName) {
31036
31105
  return externalHelpersModuleName;
31037
31106
  }
31038
- const moduleKind = getEmitModuleKind(compilerOptions);
31039
- let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || node.impliedNodeFormat === 1 /* CommonJS */);
31107
+ let create = (hasExportStarsToExportValues || getESModuleInterop(compilerOptions) && hasImportStarOrImportDefault) && getEmitModuleFormatOfFileWorker(node, compilerOptions) < 4 /* System */;
31040
31108
  if (!create) {
31041
31109
  const helpers = getEmitHelpers(node);
31042
31110
  if (helpers) {
@@ -40009,7 +40077,6 @@ var commonOptionsWithBuild = [
40009
40077
  affectsBuildInfo: true,
40010
40078
  showInSimplifiedHelpView: true,
40011
40079
  category: Diagnostics.Emit,
40012
- transpileOptionValue: void 0,
40013
40080
  defaultValueDescription: false,
40014
40081
  description: Diagnostics.Create_sourcemaps_for_d_ts_files
40015
40082
  },
@@ -40556,6 +40623,15 @@ var commandOptionsWithoutBuild = [
40556
40623
  description: Diagnostics.Enforces_using_indexed_accessors_for_keys_declared_using_an_indexed_type,
40557
40624
  defaultValueDescription: false
40558
40625
  },
40626
+ {
40627
+ name: "enforceReadonly",
40628
+ type: "boolean",
40629
+ affectsSemanticDiagnostics: true,
40630
+ affectsBuildInfo: true,
40631
+ category: Diagnostics.Type_Checking,
40632
+ description: Diagnostics.Ensure_that_readonly_properties_remain_read_only_in_type_relationships,
40633
+ defaultValueDescription: false
40634
+ },
40559
40635
  // Module Resolution
40560
40636
  {
40561
40637
  name: "moduleResolution",
@@ -44617,22 +44693,16 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
44617
44693
  resolvedPackageDirectory: false
44618
44694
  };
44619
44695
  }
44620
- function getPackageScopeForPath(fileName, state) {
44621
- const parts = getPathComponents(fileName);
44622
- parts.pop();
44623
- while (parts.length > 0) {
44624
- const pkg = getPackageJsonInfo(
44625
- getPathFromPathComponents(parts),
44696
+ function getPackageScopeForPath(directory, state) {
44697
+ return forEachAncestorDirectory(
44698
+ directory,
44699
+ (dir) => getPackageJsonInfo(
44700
+ dir,
44626
44701
  /*onlyRecordFailures*/
44627
44702
  false,
44628
44703
  state
44629
- );
44630
- if (pkg) {
44631
- return pkg;
44632
- }
44633
- parts.pop();
44634
- }
44635
- return void 0;
44704
+ )
44705
+ );
44636
44706
  }
44637
44707
  function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
44638
44708
  if (packageJsonInfo.contents.versionPaths === void 0) {
@@ -44795,7 +44865,7 @@ function noKeyStartsWithDot(obj) {
44795
44865
  }
44796
44866
  function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) {
44797
44867
  var _a, _b;
44798
- const directoryPath = getNormalizedAbsolutePath(combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
44868
+ const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
44799
44869
  const scope = getPackageScopeForPath(directoryPath, state);
44800
44870
  if (!scope || !scope.contents.packageJsonContent.exports) {
44801
44871
  return void 0;
@@ -44891,7 +44961,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
44891
44961
  void 0
44892
44962
  );
44893
44963
  }
44894
- const directoryPath = getNormalizedAbsolutePath(combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
44964
+ const directoryPath = getNormalizedAbsolutePath(directory, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
44895
44965
  const scope = getPackageScopeForPath(directoryPath, state);
44896
44966
  if (!scope) {
44897
44967
  if (state.traceEnabled) {
@@ -48752,13 +48822,15 @@ var RelativePreference = /* @__PURE__ */ ((RelativePreference2) => {
48752
48822
  RelativePreference2[RelativePreference2["ExternalNonRelative"] = 3] = "ExternalNonRelative";
48753
48823
  return RelativePreference2;
48754
48824
  })(RelativePreference || {});
48755
- function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, compilerOptions, importingSourceFile, oldImportSpecifier) {
48825
+ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, importModuleSpecifierEnding }, host, compilerOptions, importingSourceFile, oldImportSpecifier) {
48756
48826
  const filePreferredEnding = getPreferredEnding();
48757
48827
  return {
48758
48828
  relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */,
48759
48829
  getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => {
48760
- const preferredEnding = syntaxImpliedNodeFormat !== importingSourceFile.impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
48761
- if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) {
48830
+ const impliedNodeFormat = getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions);
48831
+ const preferredEnding = syntaxImpliedNodeFormat !== impliedNodeFormat ? getPreferredEnding(syntaxImpliedNodeFormat) : filePreferredEnding;
48832
+ const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
48833
+ if ((syntaxImpliedNodeFormat ?? impliedNodeFormat) === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
48762
48834
  if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) {
48763
48835
  return [3 /* TsExtension */, 2 /* JsExtension */];
48764
48836
  }
@@ -48789,19 +48861,19 @@ function getModuleSpecifierPreferences({ importModuleSpecifierPreference, import
48789
48861
  }
48790
48862
  return getModuleSpecifierEndingPreference(
48791
48863
  importModuleSpecifierEnding,
48792
- resolutionMode ?? importingSourceFile.impliedNodeFormat,
48864
+ resolutionMode ?? getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions),
48793
48865
  compilerOptions,
48794
48866
  isFullSourceFile(importingSourceFile) ? importingSourceFile : void 0
48795
48867
  );
48796
48868
  }
48797
48869
  }
48798
48870
  function updateModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, oldImportSpecifier, options = {}) {
48799
- const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
48871
+ const res = getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile, oldImportSpecifier), {}, options);
48800
48872
  if (res === oldImportSpecifier) return void 0;
48801
48873
  return res;
48802
48874
  }
48803
48875
  function getModuleSpecifier(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, options = {}) {
48804
- return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, compilerOptions, importingSourceFile), {}, options);
48876
+ return getModuleSpecifierWorker(compilerOptions, importingSourceFile, importingSourceFileName, toFileName2, host, getModuleSpecifierPreferences({}, host, compilerOptions, importingSourceFile), {}, options);
48805
48877
  }
48806
48878
  function getNodeModulesPackageName(compilerOptions, importingSourceFile, nodeModulesFileName, host, preferences, options = {}) {
48807
48879
  const info = getInfo(importingSourceFile.fileName, host);
@@ -48831,7 +48903,7 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
48831
48903
  /*packageNameOnly*/
48832
48904
  void 0,
48833
48905
  options.overrideImportMode
48834
- )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
48906
+ )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
48835
48907
  }
48836
48908
  function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
48837
48909
  const result = tryGetModuleSpecifiersFromCacheWorker(
@@ -48902,17 +48974,21 @@ function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName,
48902
48974
  compilerOptions,
48903
48975
  host,
48904
48976
  importMode,
48905
- getModuleSpecifierPreferences({}, compilerOptions, importingFile)
48977
+ getModuleSpecifierPreferences({}, host, compilerOptions, importingFile)
48906
48978
  );
48907
48979
  }
48908
48980
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
48909
48981
  const info = getInfo(importingSourceFile.fileName, host);
48910
- const preferences = getModuleSpecifierPreferences(userPreferences, compilerOptions, importingSourceFile);
48982
+ const preferences = getModuleSpecifierPreferences(userPreferences, host, compilerOptions, importingSourceFile);
48911
48983
  const existingSpecifier = isFullSourceFile(importingSourceFile) && forEach(modulePaths, (modulePath) => forEach(
48912
48984
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
48913
48985
  (reason) => {
48914
48986
  if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path) return void 0;
48915
- if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions)) return void 0;
48987
+ const existingMode = host.getModeForResolutionAtIndex(importingSourceFile, reason.index);
48988
+ const targetMode = options.overrideImportMode ?? host.getDefaultResolutionModeForFile(importingSourceFile);
48989
+ if (existingMode !== targetMode && existingMode !== void 0 && targetMode !== void 0) {
48990
+ return void 0;
48991
+ }
48916
48992
  const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
48917
48993
  return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
48918
48994
  }
@@ -49120,7 +49196,7 @@ function getAllModulePathsWorker(info, importedFileName, host, compilerOptions,
49120
49196
  if (cache && links && host.readFile && !pathContainsNodeModules(info.importingSourceFileName)) {
49121
49197
  Debug.type(host);
49122
49198
  const state = getTemporaryModuleResolutionState(cache.getPackageJsonInfoCache(), host, {});
49123
- const packageJson = getPackageScopeForPath(info.importingSourceFileName, state);
49199
+ const packageJson = getPackageScopeForPath(getDirectoryPath(info.importingSourceFileName), state);
49124
49200
  if (packageJson) {
49125
49201
  const toResolve = getAllRuntimeDependencies(packageJson.contents.packageJsonContent);
49126
49202
  for (const depName of toResolve || emptyArray) {
@@ -49442,7 +49518,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
49442
49518
  if (!parts) {
49443
49519
  return void 0;
49444
49520
  }
49445
- const preferences = getModuleSpecifierPreferences(userPreferences, options, importingSourceFile);
49521
+ const preferences = getModuleSpecifierPreferences(userPreferences, host, options, importingSourceFile);
49446
49522
  const allowedEndings = preferences.getAllowedEndingsInPreferredOrder();
49447
49523
  let moduleSpecifier = path;
49448
49524
  let isPackageRootPath = false;
@@ -49492,7 +49568,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
49492
49568
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
49493
49569
  if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
49494
49570
  const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
49495
- const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
49571
+ const importMode = overrideMode || getDefaultResolutionModeForFile(importingSourceFile, host, options);
49496
49572
  if (getResolvePackageJsonExports(options)) {
49497
49573
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
49498
49574
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
@@ -49642,6 +49718,9 @@ function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName
49642
49718
  function isPathRelativeToParent(path) {
49643
49719
  return startsWith(path, "..");
49644
49720
  }
49721
+ function getDefaultResolutionModeForFile(file, host, compilerOptions) {
49722
+ return isFullSourceFile(file) ? host.getDefaultResolutionModeForFile(file) : getDefaultResolutionModeForFileWorker(file, compilerOptions);
49723
+ }
49645
49724
 
49646
49725
  // src/compiler/checker.ts
49647
49726
  var ambientModuleSymbolRegex = /^".+"$/;
@@ -49827,6 +49906,7 @@ function createTypeChecker(host) {
49827
49906
  var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
49828
49907
  var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
49829
49908
  var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
49909
+ var enforceReadonly = compilerOptions.enforceReadonly;
49830
49910
  var checkBinaryExpression = createCheckBinaryExpression();
49831
49911
  var emitResolver = createResolver();
49832
49912
  var nodeBuilder = createNodeBuilder();
@@ -51862,22 +51942,28 @@ function createTypeChecker(host) {
51862
51942
  function isSyntacticDefault(node) {
51863
51943
  return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
51864
51944
  }
51865
- function getUsageModeForExpression(usage) {
51866
- return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
51945
+ function getEmitSyntaxForModuleSpecifierExpression(usage) {
51946
+ return isStringLiteralLike(usage) ? host.getEmitSyntaxForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
51867
51947
  }
51868
51948
  function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
51869
51949
  return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
51870
51950
  }
51871
- function isOnlyImportedAsDefault(usage) {
51872
- const usageMode = getUsageModeForExpression(usage);
51873
- return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
51951
+ function isOnlyImportableAsDefault(usage) {
51952
+ if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
51953
+ const usageMode = getEmitSyntaxForModuleSpecifierExpression(usage);
51954
+ return usageMode === 99 /* ESNext */ && endsWith(usage.text, ".json" /* Json */);
51955
+ }
51956
+ return false;
51874
51957
  }
51875
51958
  function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
51876
- const usageMode = file && getUsageModeForExpression(usage);
51877
- if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
51878
- const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
51879
- if (usageMode === 99 /* ESNext */ || result) {
51880
- return result;
51959
+ const usageMode = file && getEmitSyntaxForModuleSpecifierExpression(usage);
51960
+ if (file && usageMode !== void 0) {
51961
+ const targetMode = host.getImpliedNodeFormatForEmit(file);
51962
+ if (usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */ && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
51963
+ return true;
51964
+ }
51965
+ if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) {
51966
+ return false;
51881
51967
  }
51882
51968
  }
51883
51969
  if (!allowSyntheticDefaultImports) {
@@ -51936,7 +52022,7 @@ function createTypeChecker(host) {
51936
52022
  if (!specifier) {
51937
52023
  return exportDefaultSymbol;
51938
52024
  }
51939
- const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
52025
+ const hasDefaultOnly = isOnlyImportableAsDefault(specifier);
51940
52026
  const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
51941
52027
  if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
51942
52028
  if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
@@ -52138,7 +52224,7 @@ function createTypeChecker(host) {
52138
52224
  let symbolFromModule = getExportOfModule(targetSymbol, nameText, specifier, dontResolveAlias);
52139
52225
  if (symbolFromModule === void 0 && nameText === "default" /* Default */) {
52140
52226
  const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
52141
- if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52227
+ if (isOnlyImportableAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
52142
52228
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
52143
52229
  }
52144
52230
  }
@@ -52742,7 +52828,7 @@ function createTypeChecker(host) {
52742
52828
  /*requireStringLiteralLikeArgument*/
52743
52829
  true
52744
52830
  ) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
52745
- const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
52831
+ const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile);
52746
52832
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
52747
52833
  const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
52748
52834
  const resolutionDiagnostic = errorNode && resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
@@ -52789,41 +52875,7 @@ function createTypeChecker(host) {
52789
52875
  let diagnosticDetails;
52790
52876
  const ext = tryGetExtensionFromPath2(currentSourceFile.fileName);
52791
52877
  if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
52792
- const scope = currentSourceFile.packageJsonScope;
52793
- const targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : void 0;
52794
- if (scope && !scope.contents.packageJsonContent.type) {
52795
- if (targetExt) {
52796
- diagnosticDetails = chainDiagnosticMessages(
52797
- /*details*/
52798
- void 0,
52799
- Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1,
52800
- targetExt,
52801
- combinePaths(scope.packageDirectory, "package.json")
52802
- );
52803
- } else {
52804
- diagnosticDetails = chainDiagnosticMessages(
52805
- /*details*/
52806
- void 0,
52807
- Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0,
52808
- combinePaths(scope.packageDirectory, "package.json")
52809
- );
52810
- }
52811
- } else {
52812
- if (targetExt) {
52813
- diagnosticDetails = chainDiagnosticMessages(
52814
- /*details*/
52815
- void 0,
52816
- Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module,
52817
- targetExt
52818
- );
52819
- } else {
52820
- diagnosticDetails = chainDiagnosticMessages(
52821
- /*details*/
52822
- void 0,
52823
- Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module
52824
- );
52825
- }
52826
- }
52878
+ diagnosticDetails = createModeMismatchDetails(currentSourceFile);
52827
52879
  }
52828
52880
  diagnostics.add(createDiagnosticForNodeFromMessageChain(
52829
52881
  getSourceFileOfNode(errorNode),
@@ -52989,7 +53041,7 @@ function createTypeChecker(host) {
52989
53041
  return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent);
52990
53042
  }
52991
53043
  const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile);
52992
- const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat);
53044
+ const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getEmitSyntaxForModuleSpecifierExpression(reference), host.getImpliedNodeFormatForEmit(targetFile));
52993
53045
  if (getESModuleInterop(compilerOptions) || isEsmCjsRef) {
52994
53046
  let sigs = getSignaturesOfStructuredType(type, 0 /* Call */);
52995
53047
  if (!sigs || !sigs.length) {
@@ -55609,8 +55661,10 @@ function createTypeChecker(host) {
55609
55661
  }
55610
55662
  return getSourceFileOfNode(getNonAugmentationDeclaration(symbol)).fileName;
55611
55663
  }
55664
+ const enclosingDeclaration = getOriginalNode(context.enclosingDeclaration);
55665
+ const originalModuleSpecifier = canHaveModuleSpecifier(enclosingDeclaration) ? tryGetModuleSpecifierFromDeclaration(enclosingDeclaration) : void 0;
55612
55666
  const contextFile = context.enclosingFile;
55613
- const resolutionMode = overrideImportMode || (contextFile == null ? void 0 : contextFile.impliedNodeFormat);
55667
+ const resolutionMode = overrideImportMode || originalModuleSpecifier && host.getModeForUsageLocation(contextFile, originalModuleSpecifier) || contextFile && host.getDefaultResolutionModeForFile(contextFile);
55614
55668
  const cacheKey = createModeAwareCacheKey(contextFile.path, resolutionMode);
55615
55669
  const links = getSymbolLinks(symbol);
55616
55670
  let specifier = links.specifierCache && links.specifierCache.get(cacheKey);
@@ -56683,7 +56737,7 @@ function createTypeChecker(host) {
56683
56737
  if (result) {
56684
56738
  if (result.pos !== -1 || result.end !== -1) {
56685
56739
  if (result === nodes) {
56686
- result = factory.createNodeArray(nodes, nodes.hasTrailingComma);
56740
+ result = factory.createNodeArray(nodes.slice(), nodes.hasTrailingComma);
56687
56741
  }
56688
56742
  setTextRangePosEnd(result, -1, -1);
56689
56743
  }
@@ -60659,18 +60713,18 @@ function createTypeChecker(host) {
60659
60713
  function getExpandedParameters(sig, skipUnionExpanding) {
60660
60714
  if (signatureHasRestParameter(sig)) {
60661
60715
  const restIndex = sig.parameters.length - 1;
60662
- const restName = sig.parameters[restIndex].escapedName;
60663
- const restType = getTypeOfSymbol(sig.parameters[restIndex]);
60716
+ const restSymbol = sig.parameters[restIndex];
60717
+ const restType = getTypeOfSymbol(restSymbol);
60664
60718
  if (isTupleType(restType)) {
60665
- return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
60719
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol)];
60666
60720
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
60667
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
60721
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restSymbol));
60668
60722
  }
60669
60723
  }
60670
60724
  return [sig.parameters];
60671
- function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
60725
+ function expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol) {
60672
60726
  const elementTypes = getTypeArguments(restType);
60673
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
60727
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restSymbol);
60674
60728
  const restParams = map(elementTypes, (t, i) => {
60675
60729
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
60676
60730
  const flags = restType.target.elementFlags[i];
@@ -60681,19 +60735,29 @@ function createTypeChecker(host) {
60681
60735
  });
60682
60736
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
60683
60737
  }
60684
- function getUniqAssociatedNamesFromTupleType(type, restName) {
60685
- const associatedNamesMap = /* @__PURE__ */ new Map();
60686
- return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
60687
- const name = getTupleElementLabel(labeledElement, i, restName);
60688
- const prevCounter = associatedNamesMap.get(name);
60689
- if (prevCounter === void 0) {
60690
- associatedNamesMap.set(name, 1);
60691
- return name;
60692
- } else {
60693
- associatedNamesMap.set(name, prevCounter + 1);
60694
- return `${name}_${prevCounter}`;
60738
+ function getUniqAssociatedNamesFromTupleType(type, restSymbol) {
60739
+ const names = map(type.target.labeledElementDeclarations, (labeledElement, i) => getTupleElementLabel(labeledElement, i, type.target.elementFlags[i], restSymbol));
60740
+ if (names) {
60741
+ const duplicates = [];
60742
+ const uniqueNames = /* @__PURE__ */ new Set();
60743
+ for (let i = 0; i < names.length; i++) {
60744
+ const name = names[i];
60745
+ if (!tryAddToSet(uniqueNames, name)) {
60746
+ duplicates.push(i);
60747
+ }
60695
60748
  }
60696
- });
60749
+ const counters = /* @__PURE__ */ new Map();
60750
+ for (const i of duplicates) {
60751
+ let counter = counters.get(names[i]) ?? 1;
60752
+ let name;
60753
+ while (!tryAddToSet(uniqueNames, name = `${names[i]}_${counter}`)) {
60754
+ counter++;
60755
+ }
60756
+ names[i] = name;
60757
+ counters.set(names[i], counter + 1);
60758
+ }
60759
+ }
60760
+ return names;
60697
60761
  }
60698
60762
  }
60699
60763
  function getDefaultConstructSignatures(classType) {
@@ -61377,20 +61441,20 @@ function createTypeChecker(host) {
61377
61441
  const declaration = type.declaration;
61378
61442
  return (declaration.readonlyToken ? declaration.readonlyToken.kind === 41 /* MinusToken */ ? 2 /* ExcludeReadonly */ : 1 /* IncludeReadonly */ : 0) | (declaration.questionToken ? declaration.questionToken.kind === 41 /* MinusToken */ ? 8 /* ExcludeOptional */ : 4 /* IncludeOptional */ : 0);
61379
61443
  }
61380
- function getMappedTypeOptionality(type) {
61381
- const modifiers = getMappedTypeModifiers(type);
61382
- return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
61383
- }
61384
- function getCombinedMappedTypeOptionality(type) {
61444
+ function getEffectiveMappedTypeModifiers(type, mask2) {
61385
61445
  if (getObjectFlags(type) & 32 /* Mapped */) {
61386
- return getMappedTypeOptionality(type) || getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(type));
61446
+ return getMappedTypeModifiers(type) & mask2 || getEffectiveMappedTypeModifiers(getModifiersTypeFromMappedType(type), mask2);
61387
61447
  }
61388
61448
  if (type.flags & 2097152 /* Intersection */) {
61389
- const optionality = getCombinedMappedTypeOptionality(type.types[0]);
61390
- return every(type.types, (t, i) => i === 0 || getCombinedMappedTypeOptionality(t) === optionality) ? optionality : 0;
61449
+ const modifiers = getEffectiveMappedTypeModifiers(type.types[0], mask2);
61450
+ return every(type.types, (t, i) => i === 0 || getEffectiveMappedTypeModifiers(t, mask2) === modifiers) ? modifiers : 0;
61391
61451
  }
61392
61452
  return 0;
61393
61453
  }
61454
+ function getMappedTypeModifiersRank(type, mask2) {
61455
+ const modifiers = getEffectiveMappedTypeModifiers(type, mask2);
61456
+ return modifiers & 10 /* Exclude */ ? -1 : modifiers & 5 /* Include */ ? 1 : 0;
61457
+ }
61394
61458
  function isPartialMappedType(type) {
61395
61459
  return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
61396
61460
  }
@@ -65196,12 +65260,12 @@ function createTypeChecker(host) {
65196
65260
  const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
65197
65261
  const templateMapper = combineTypeMappers(objectType.mapper, mapper);
65198
65262
  const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
65199
- const isOptional = getMappedTypeOptionality(objectType) > 0 || (isGenericType(objectType) ? getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(objectType)) > 0 : couldAccessOptionalProperty(objectType, index));
65263
+ const isOptional = getMappedTypeModifiers(objectType) & 4 /* IncludeOptional */ || (isGenericType(objectType) ? getEffectiveMappedTypeModifiers(getModifiersTypeFromMappedType(objectType), 12 /* Optional */) & 4 /* IncludeOptional */ : couldAccessOptionalProperty(objectType, index));
65200
65264
  return addOptionality(
65201
65265
  instantiatedTemplateType,
65202
65266
  /*isProperty*/
65203
65267
  true,
65204
- isOptional
65268
+ !!isOptional
65205
65269
  );
65206
65270
  }
65207
65271
  function couldAccessOptionalProperty(objectType, indexType) {
@@ -68699,7 +68763,7 @@ function createTypeChecker(host) {
68699
68763
  }
68700
68764
  if (targetFlags & 262144 /* TypeParameter */) {
68701
68765
  if (getObjectFlags(source2) & 32 /* Mapped */ && !source2.declaration.nameType && isRelatedTo(getIndexType(target2), getConstraintTypeFromMappedType(source2), 3 /* Both */)) {
68702
- if (!(getMappedTypeModifiers(source2) & 4 /* IncludeOptional */)) {
68766
+ if (!(getMappedTypeModifiers(source2) & 4 /* IncludeOptional */) && !(enforceReadonly && relation !== comparableRelation && getMappedTypeModifiers(source2) & 1 /* IncludeReadonly */)) {
68703
68767
  const templateType = getTemplateTypeFromMappedType(source2);
68704
68768
  const indexedAccessType = getIndexedAccessType(target2, getTypeParameterFromMappedType(source2));
68705
68769
  if (result2 = isRelatedTo(templateType, indexedAccessType, 3 /* Both */, reportErrors2)) {
@@ -68811,7 +68875,7 @@ function createTypeChecker(host) {
68811
68875
  const keysRemapped = !!target2.declaration.nameType;
68812
68876
  const templateType = getTemplateTypeFromMappedType(target2);
68813
68877
  const modifiers = getMappedTypeModifiers(target2);
68814
- if (!(modifiers & 8 /* ExcludeOptional */)) {
68878
+ if (!(modifiers & 8 /* ExcludeOptional */) && !(enforceReadonly && relation !== comparableRelation && modifiers & 2 /* ExcludeReadonly */)) {
68815
68879
  if (!keysRemapped && templateType.flags & 8388608 /* IndexedAccess */ && templateType.objectType === source2 && templateType.indexType === getTypeParameterFromMappedType(target2)) {
68816
68880
  return -1 /* True */;
68817
68881
  }
@@ -69108,11 +69172,11 @@ function createTypeChecker(host) {
69108
69172
  }
69109
69173
  }
69110
69174
  function mappedTypeRelatedTo(source2, target2, reportErrors2) {
69111
- const modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source2) === getMappedTypeModifiers(target2) : getCombinedMappedTypeOptionality(source2) <= getCombinedMappedTypeOptionality(target2));
69175
+ const modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source2) === getMappedTypeModifiers(target2) : getMappedTypeModifiersRank(source2, 12 /* Optional */) <= getMappedTypeModifiersRank(target2, 12 /* Optional */) && (!enforceReadonly || relation === comparableRelation || getMappedTypeModifiersRank(source2, 3 /* Readonly */) <= getMappedTypeModifiersRank(target2, 3 /* Readonly */)));
69112
69176
  if (modifiersRelated) {
69113
69177
  let result2;
69114
69178
  const targetConstraint = getConstraintTypeFromMappedType(target2);
69115
- const sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source2), getCombinedMappedTypeOptionality(source2) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
69179
+ const sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source2), getEffectiveMappedTypeModifiers(source2, 12 /* Optional */) & 8 /* ExcludeOptional */ ? reportUnmeasurableMapper : reportUnreliableMapper);
69116
69180
  if (result2 = isRelatedTo(targetConstraint, sourceConstraint, 3 /* Both */, reportErrors2)) {
69117
69181
  const mapper = createTypeMapper([getTypeParameterFromMappedType(source2)], [getTypeParameterFromMappedType(target2)]);
69118
69182
  if (instantiateType(getNameTypeFromMappedType(source2), mapper) === instantiateType(getNameTypeFromMappedType(target2), mapper)) {
@@ -69286,7 +69350,10 @@ function createTypeChecker(host) {
69286
69350
  }
69287
69351
  return 0 /* False */;
69288
69352
  }
69289
- if (relation === strictSubtypeRelation && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp)) {
69353
+ if ((relation === strictSubtypeRelation || enforceReadonly && relation !== comparableRelation) && isReadonlySymbol(sourceProp) && !isReadonlySymbol(targetProp) && !(targetProp.flags & 8192 /* Method */)) {
69354
+ if (reportErrors2) {
69355
+ reportError(Diagnostics.Property_0_is_readonly_in_the_source_but_not_in_the_target, symbolToString(targetProp));
69356
+ }
69290
69357
  return 0 /* False */;
69291
69358
  }
69292
69359
  const related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors2, intersectionState);
@@ -69754,12 +69821,21 @@ function createTypeChecker(host) {
69754
69821
  void 0,
69755
69822
  intersectionState
69756
69823
  );
69757
- if (!related && reportErrors2) {
69758
- if (sourceInfo.keyType === targetInfo.keyType) {
69759
- reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
69760
- } else {
69761
- reportError(Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType));
69824
+ if (!related) {
69825
+ if (reportErrors2) {
69826
+ if (sourceInfo.keyType === targetInfo.keyType) {
69827
+ reportError(Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
69828
+ } else {
69829
+ reportError(Diagnostics._0_and_1_index_signatures_are_incompatible, typeToString(sourceInfo.keyType), typeToString(targetInfo.keyType));
69830
+ }
69762
69831
  }
69832
+ return 0 /* False */;
69833
+ }
69834
+ if (enforceReadonly && relation !== comparableRelation && sourceInfo.isReadonly && !targetInfo.isReadonly) {
69835
+ if (reportErrors2) {
69836
+ reportError(Diagnostics._0_index_signature_is_readonly_in_the_source_but_not_in_the_target, typeToString(sourceInfo.keyType));
69837
+ }
69838
+ return 0 /* False */;
69763
69839
  }
69764
69840
  return related;
69765
69841
  }
@@ -74185,7 +74261,7 @@ function createTypeChecker(host) {
74185
74261
  if (!canCollectSymbolAliasAccessabilityData) {
74186
74262
  return;
74187
74263
  }
74188
- if (location.flags & 33554432 /* Ambient */) {
74264
+ if (location.flags & 33554432 /* Ambient */ && !isPropertySignature(location) && !isPropertyDeclaration(location)) {
74189
74265
  return;
74190
74266
  }
74191
74267
  switch (hint) {
@@ -75615,10 +75691,9 @@ function createTypeChecker(host) {
75615
75691
  (t) => {
75616
75692
  var _a;
75617
75693
  if (isGenericMappedType(t) && !t.declaration.nameType) {
75618
- const constraint = getConstraintTypeFromMappedType(t);
75619
- const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
75694
+ const constraint = getBaseConstraintOrType(getConstraintTypeFromMappedType(t));
75620
75695
  const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
75621
- if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
75696
+ if (isTypeAssignableTo(propertyNameType, constraint)) {
75622
75697
  return substituteIndexedMappedType(t, propertyNameType);
75623
75698
  }
75624
75699
  } else if (t.flags & 3670016 /* StructuredType */) {
@@ -75668,23 +75743,17 @@ function createTypeChecker(host) {
75668
75743
  const symbol = getSymbolOfDeclaration(element);
75669
75744
  return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
75670
75745
  }
75671
- if (hasDynamicName(element)) {
75672
- const name = getNameOfDeclaration(element);
75673
- if (name && isComputedPropertyName(name)) {
75674
- const exprType = checkExpression(name.expression);
75675
- const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
75676
- if (propType) {
75677
- return propType;
75678
- }
75746
+ const name = getNameOfDeclaration(element);
75747
+ if (name && isComputedPropertyName(name)) {
75748
+ const exprType = checkExpression(name.expression);
75749
+ if (isTypeUsableAsPropertyName(exprType)) {
75750
+ return getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType), exprType);
75679
75751
  }
75680
- }
75681
- if (element.name) {
75682
- const nameType = getLiteralTypeFromPropertyName(element.name);
75683
75752
  return mapType(
75684
75753
  type,
75685
75754
  (t) => {
75686
75755
  var _a;
75687
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType)) == null ? void 0 : _a.type;
75756
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), exprType)) == null ? void 0 : _a.type;
75688
75757
  },
75689
75758
  /*noReductions*/
75690
75759
  true
@@ -75693,6 +75762,20 @@ function createTypeChecker(host) {
75693
75762
  }
75694
75763
  return void 0;
75695
75764
  }
75765
+ function isContextualPropertyMutable(type, name, nameType) {
75766
+ return someType(type, (t) => {
75767
+ const propName = nameType ? isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : void 0 : name;
75768
+ const prop = propName && getPropertyOfType(t, propName);
75769
+ if (prop) {
75770
+ return !isReadonlySymbol(prop);
75771
+ }
75772
+ const indexInfo = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)));
75773
+ if (indexInfo) {
75774
+ return !indexInfo.isReadonly;
75775
+ }
75776
+ return false;
75777
+ });
75778
+ }
75696
75779
  function getSpreadIndices(elements) {
75697
75780
  let first2, last2;
75698
75781
  for (let i = 0; i < elements.length; i++) {
@@ -76538,7 +76621,6 @@ function createTypeChecker(host) {
76538
76621
  );
76539
76622
  const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
76540
76623
  const inConstContext = isConstContext(node);
76541
- const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
76542
76624
  const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
76543
76625
  const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0;
76544
76626
  const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag;
@@ -76574,6 +76656,7 @@ function createTypeChecker(host) {
76574
76656
  }
76575
76657
  objectFlags |= getObjectFlags(type) & 458752 /* PropagatingFlags */;
76576
76658
  const nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : void 0;
76659
+ const checkFlags = inConstContext && !(enforceReadonly && contextualType && isContextualPropertyMutable(contextualType, member.escapedName, nameType)) ? 8 /* Readonly */ : 0;
76577
76660
  const prop = nameType ? createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) : createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
76578
76661
  if (nameType) {
76579
76662
  prop.links.nameType = nameType;
@@ -77176,7 +77259,7 @@ function createTypeChecker(host) {
77176
77259
  checkGrammarJsxElement(node);
77177
77260
  }
77178
77261
  checkJsxPreconditions(node);
77179
- markLinkedReferences(node, 4 /* Jsx */);
77262
+ markJsxAliasReferenced(node);
77180
77263
  if (isNodeOpeningLikeElement) {
77181
77264
  const jsxOpeningLikeNode = node;
77182
77265
  const sig = getResolvedSignature(jsxOpeningLikeNode);
@@ -80107,7 +80190,7 @@ function createTypeChecker(host) {
80107
80190
  return createAnonymousType(anonymousSymbol, memberTable, emptyArray, emptyArray, emptyArray);
80108
80191
  }
80109
80192
  function getTypeWithSyntheticDefaultOnly(type, symbol, originalSymbol, moduleSpecifier) {
80110
- const hasDefaultOnly = isOnlyImportedAsDefault(moduleSpecifier);
80193
+ const hasDefaultOnly = isOnlyImportableAsDefault(moduleSpecifier);
80111
80194
  if (hasDefaultOnly && type && !isErrorType(type)) {
80112
80195
  const synthType = type;
80113
80196
  if (!synthType.defaultOnlyType) {
@@ -80433,14 +80516,45 @@ function createTypeChecker(host) {
80433
80516
  !!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
80434
80517
  );
80435
80518
  }
80436
- function getTupleElementLabel(d, index, restParameterName = "arg") {
80519
+ function getTupleElementLabelFromBindingElement(node, index, elementFlags) {
80520
+ switch (node.name.kind) {
80521
+ case 80 /* Identifier */: {
80522
+ const name = node.name.escapedText;
80523
+ if (node.dotDotDotToken) {
80524
+ return elementFlags & 12 /* Variable */ ? name : `${name}_${index}`;
80525
+ } else {
80526
+ return elementFlags & 3 /* Fixed */ ? name : `${name}_n`;
80527
+ }
80528
+ }
80529
+ case 207 /* ArrayBindingPattern */: {
80530
+ if (node.dotDotDotToken) {
80531
+ const elements = node.name.elements;
80532
+ const lastElement = tryCast(lastOrUndefined(elements), isBindingElement);
80533
+ const elementCount = elements.length - ((lastElement == null ? void 0 : lastElement.dotDotDotToken) ? 1 : 0);
80534
+ if (index < elementCount) {
80535
+ const element = elements[index];
80536
+ if (isBindingElement(element)) {
80537
+ return getTupleElementLabelFromBindingElement(element, index, elementFlags);
80538
+ }
80539
+ } else if (lastElement == null ? void 0 : lastElement.dotDotDotToken) {
80540
+ return getTupleElementLabelFromBindingElement(lastElement, index - elementCount, elementFlags);
80541
+ }
80542
+ }
80543
+ break;
80544
+ }
80545
+ }
80546
+ return `arg_${index}`;
80547
+ }
80548
+ function getTupleElementLabel(d, index = 0, elementFlags = 3 /* Fixed */, restSymbol) {
80437
80549
  if (!d) {
80438
- return `${restParameterName}_${index}`;
80550
+ const restParameter = tryCast(restSymbol == null ? void 0 : restSymbol.valueDeclaration, isParameter);
80551
+ return restParameter ? getTupleElementLabelFromBindingElement(restParameter, index, elementFlags) : `${(restSymbol == null ? void 0 : restSymbol.escapedName) ?? "arg"}_${index}`;
80439
80552
  }
80440
80553
  Debug.assert(isIdentifier(d.name));
80441
80554
  return d.name.escapedText;
80442
80555
  }
80443
80556
  function getParameterNameAtPosition(signature, pos, overrideRestType) {
80557
+ var _a;
80444
80558
  const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
80445
80559
  if (pos < paramCount) {
80446
80560
  return signature.parameters[pos].escapedName;
@@ -80448,9 +80562,11 @@ function createTypeChecker(host) {
80448
80562
  const restParameter = signature.parameters[paramCount] || unknownSymbol;
80449
80563
  const restType = overrideRestType || getTypeOfSymbol(restParameter);
80450
80564
  if (isTupleType(restType)) {
80451
- const associatedNames = restType.target.labeledElementDeclarations;
80565
+ const tupleType = restType.target;
80452
80566
  const index = pos - paramCount;
80453
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
80567
+ const associatedName = (_a = tupleType.labeledElementDeclarations) == null ? void 0 : _a[index];
80568
+ const elementFlags = tupleType.elementFlags[index];
80569
+ return getTupleElementLabel(associatedName, index, elementFlags, restParameter);
80454
80570
  }
80455
80571
  return restParameter.escapedName;
80456
80572
  }
@@ -85381,7 +85497,7 @@ function createTypeChecker(host) {
85381
85497
  });
85382
85498
  }
85383
85499
  function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
85384
- if (moduleKind >= 5 /* ES2015 */ && !(moduleKind >= 100 /* Node16 */ && getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
85500
+ if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) >= 5 /* ES2015 */) {
85385
85501
  return;
85386
85502
  }
85387
85503
  if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
@@ -86802,7 +86918,7 @@ function createTypeChecker(host) {
86802
86918
  }
86803
86919
  }
86804
86920
  function checkClassNameCollisionWithObject(name) {
86805
- if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(name).impliedNodeFormat === 1 /* CommonJS */)) {
86921
+ if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) {
86806
86922
  error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_with_module_0, ModuleKind[moduleKind]);
86807
86923
  }
86808
86924
  }
@@ -87882,7 +87998,7 @@ function createTypeChecker(host) {
87882
87998
  getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */;
87883
87999
  }
87884
88000
  }
87885
- if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) {
88001
+ if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(node.parent) === 1 /* CommonJS */) {
87886
88002
  const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */);
87887
88003
  if (exportModifier) {
87888
88004
  error2(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
@@ -88102,8 +88218,10 @@ function createTypeChecker(host) {
88102
88218
  }
88103
88219
  }
88104
88220
  }
88105
- if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88221
+ if (compilerOptions.verbatimModuleSyntax && node.kind !== 271 /* ImportEqualsDeclaration */ && !isInJSFile(node) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
88106
88222
  error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
88223
+ } else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
88224
+ error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
88107
88225
  }
88108
88226
  }
88109
88227
  if (isImportSpecifier(node)) {
@@ -88144,7 +88262,7 @@ function createTypeChecker(host) {
88144
88262
  checkAliasSymbol(node);
88145
88263
  if (node.kind === 276 /* ImportSpecifier */) {
88146
88264
  checkModuleExportName(node.propertyName);
88147
- if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88265
+ if (moduleExportNameIsDefault(node.propertyName || node.name) && getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88148
88266
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88149
88267
  }
88150
88268
  }
@@ -88166,7 +88284,7 @@ function createTypeChecker(host) {
88166
88284
  if (validForTypeAttributes && override) {
88167
88285
  return;
88168
88286
  }
88169
- const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
88287
+ const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
88170
88288
  if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
88171
88289
  const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
88172
88290
  return grammarErrorOnNode(node, message);
@@ -88199,7 +88317,7 @@ function createTypeChecker(host) {
88199
88317
  if (importClause.namedBindings) {
88200
88318
  if (importClause.namedBindings.kind === 274 /* NamespaceImport */) {
88201
88319
  checkImportBinding(importClause.namedBindings);
88202
- if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) {
88320
+ if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && getESModuleInterop(compilerOptions)) {
88203
88321
  checkExternalEmitHelpers(node, 65536 /* ImportStar */);
88204
88322
  }
88205
88323
  } else {
@@ -88239,7 +88357,7 @@ function createTypeChecker(host) {
88239
88357
  grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
88240
88358
  }
88241
88359
  } else {
88242
- if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
88360
+ if (5 /* ES2015 */ <= moduleKind && moduleKind <= 99 /* ESNext */ && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
88243
88361
  grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
88244
88362
  }
88245
88363
  }
@@ -88269,7 +88387,7 @@ function createTypeChecker(host) {
88269
88387
  checkAliasSymbol(node.exportClause);
88270
88388
  checkModuleExportName(node.exportClause.name);
88271
88389
  }
88272
- if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
88390
+ if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */) {
88273
88391
  if (node.exportClause) {
88274
88392
  if (getESModuleInterop(compilerOptions)) {
88275
88393
  checkExternalEmitHelpers(node, 65536 /* ImportStar */);
@@ -88328,7 +88446,7 @@ function createTypeChecker(host) {
88328
88446
  markLinkedReferences(node, 7 /* ExportSpecifier */);
88329
88447
  }
88330
88448
  } else {
88331
- if (getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleExportNameIsDefault(node.propertyName || node.name)) {
88449
+ if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && moduleExportNameIsDefault(node.propertyName || node.name)) {
88332
88450
  checkExternalEmitHelpers(node, 131072 /* ImportDefault */);
88333
88451
  }
88334
88452
  }
@@ -88354,7 +88472,7 @@ function createTypeChecker(host) {
88354
88472
  if (typeAnnotationNode) {
88355
88473
  checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
88356
88474
  }
88357
- const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
88475
+ const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */;
88358
88476
  if (node.expression.kind === 80 /* Identifier */) {
88359
88477
  const id = node.expression;
88360
88478
  const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
@@ -88434,7 +88552,7 @@ function createTypeChecker(host) {
88434
88552
  grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
88435
88553
  }
88436
88554
  if (node.isExportEquals) {
88437
- if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
88555
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && host.getImpliedNodeFormatForEmit(getSourceFileOfNode(node)) !== 1 /* CommonJS */)) {
88438
88556
  grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
88439
88557
  } else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
88440
88558
  grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
@@ -90025,10 +90143,13 @@ function createTypeChecker(host) {
90025
90143
  function checkChildIdentifiers(node2) {
90026
90144
  forEachNodeRecursively(node2, checkIdentifiers);
90027
90145
  }
90146
+ function isExpressionNodeOrShorthandPropertyAssignmentName(node2) {
90147
+ return isExpressionNode(node2) || isShorthandPropertyAssignment(node2.parent) && (node2.parent.objectAssignmentInitializer ?? node2.parent.name) === node2;
90148
+ }
90028
90149
  function checkSingleIdentifier(node2) {
90029
90150
  const nodeLinks2 = getNodeLinks(node2);
90030
90151
  nodeLinks2.calculatedFlags |= 536870912 /* ConstructorReference */ | 16384 /* CapturedBlockScopedBinding */ | 32768 /* BlockScopedBindingInLoop */;
90031
- if (isIdentifier(node2) && isExpressionNode(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
90152
+ if (isIdentifier(node2) && isExpressionNodeOrShorthandPropertyAssignmentName(node2) && !(isPropertyAccessExpression(node2.parent) && node2.parent.name === node2)) {
90032
90153
  const s = getResolvedSymbol(node2);
90033
90154
  if (s && s !== unknownSymbol) {
90034
90155
  checkIdentifierCalculateNodeCheckFlags(node2, s);
@@ -90976,7 +91097,7 @@ function createTypeChecker(host) {
90976
91097
  break;
90977
91098
  case 95 /* ExportKeyword */:
90978
91099
  if (compilerOptions.verbatimModuleSyntax && !(node.flags & 33554432 /* Ambient */) && node.kind !== 265 /* TypeAliasDeclaration */ && node.kind !== 264 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later
90979
- node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) {
91100
+ node.kind !== 267 /* ModuleDeclaration */ && node.parent.kind === 307 /* SourceFile */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
90980
91101
  return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
90981
91102
  }
90982
91103
  if (flags & 32 /* Export */) {
@@ -91886,7 +92007,7 @@ function createTypeChecker(host) {
91886
92007
  const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
91887
92008
  return grammarErrorOnNode(node.exclamationToken, message);
91888
92009
  }
91889
- if ((moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && moduleKind !== 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
92010
+ if (host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && !(node.parent.parent.flags & 33554432 /* Ambient */) && hasSyntacticModifier(node.parent.parent, 32 /* Export */)) {
91890
92011
  checkESModuleMarker(node.name);
91891
92012
  }
91892
92013
  return !!blockScopeKind && checkGrammarNameInLetOrConstDeclarations(node.name);
@@ -92387,7 +92508,9 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) {
92387
92508
  isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName),
92388
92509
  fileExists: (fileName) => host.fileExists(fileName),
92389
92510
  getFileIncludeReasons: () => host.getFileIncludeReasons(),
92390
- readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0
92511
+ readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0,
92512
+ getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file),
92513
+ getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index)
92391
92514
  };
92392
92515
  }
92393
92516
  var SymbolTrackerImpl = class _SymbolTrackerImpl {
@@ -112240,7 +112363,7 @@ function transformModule(context) {
112240
112363
  case 354 /* PartiallyEmittedExpression */:
112241
112364
  return visitPartiallyEmittedExpression(node, valueIsDiscarded);
112242
112365
  case 213 /* CallExpression */:
112243
- if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) {
112366
+ if (isImportCall(node) && host.shouldTransformImportCall(currentSourceFile)) {
112244
112367
  return visitImportCallExpression(node);
112245
112368
  }
112246
112369
  break;
@@ -115236,8 +115359,8 @@ function transformECMAScriptModule(context) {
115236
115359
  }
115237
115360
  }
115238
115361
 
115239
- // src/compiler/transformers/module/node.ts
115240
- function transformNodeModule(context) {
115362
+ // src/compiler/transformers/module/impliedNodeFormatDependent.ts
115363
+ function transformImpliedNodeFormatDependentModule(context) {
115241
115364
  const previousOnSubstituteNode = context.onSubstituteNode;
115242
115365
  const previousOnEmitNode = context.onEmitNode;
115243
115366
  const esmTransform = transformECMAScriptModule(context);
@@ -115248,6 +115371,7 @@ function transformNodeModule(context) {
115248
115371
  const cjsTransform = transformModule(context);
115249
115372
  const cjsOnSubstituteNode = context.onSubstituteNode;
115250
115373
  const cjsOnEmitNode = context.onEmitNode;
115374
+ const getEmitModuleFormatOfFile2 = (file) => context.getEmitHost().getEmitModuleFormatOfFile(file);
115251
115375
  context.onSubstituteNode = onSubstituteNode;
115252
115376
  context.onEmitNode = onEmitNode;
115253
115377
  context.enableSubstitution(307 /* SourceFile */);
@@ -115262,7 +115386,7 @@ function transformNodeModule(context) {
115262
115386
  if (!currentSourceFile) {
115263
115387
  return previousOnSubstituteNode(hint, node);
115264
115388
  }
115265
- if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
115389
+ if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
115266
115390
  return esmOnSubstituteNode(hint, node);
115267
115391
  }
115268
115392
  return cjsOnSubstituteNode(hint, node);
@@ -115275,13 +115399,13 @@ function transformNodeModule(context) {
115275
115399
  if (!currentSourceFile) {
115276
115400
  return previousOnEmitNode(hint, node, emitCallback);
115277
115401
  }
115278
- if (currentSourceFile.impliedNodeFormat === 99 /* ESNext */) {
115402
+ if (getEmitModuleFormatOfFile2(currentSourceFile) >= 5 /* ES2015 */) {
115279
115403
  return esmOnEmitNode(hint, node, emitCallback);
115280
115404
  }
115281
115405
  return cjsOnEmitNode(hint, node, emitCallback);
115282
115406
  }
115283
115407
  function getModuleTransformForFile(file) {
115284
- return file.impliedNodeFormat === 99 /* ESNext */ ? esmTransform : cjsTransform;
115408
+ return getEmitModuleFormatOfFile2(file) >= 5 /* ES2015 */ ? esmTransform : cjsTransform;
115285
115409
  }
115286
115410
  function transformSourceFile(node) {
115287
115411
  if (node.isDeclarationFile) {
@@ -117406,17 +117530,18 @@ function isProcessedComponent(node) {
117406
117530
  // src/compiler/transformer.ts
117407
117531
  function getModuleTransformer(moduleKind) {
117408
117532
  switch (moduleKind) {
117533
+ case 200 /* Preserve */:
117534
+ return transformECMAScriptModule;
117409
117535
  case 99 /* ESNext */:
117410
117536
  case 7 /* ES2022 */:
117411
117537
  case 6 /* ES2020 */:
117412
117538
  case 5 /* ES2015 */:
117413
- case 200 /* Preserve */:
117414
- return transformECMAScriptModule;
117415
- case 4 /* System */:
117416
- return transformSystemModule;
117417
117539
  case 100 /* Node16 */:
117418
117540
  case 199 /* NodeNext */:
117419
- return transformNodeModule;
117541
+ case 1 /* CommonJS */:
117542
+ return transformImpliedNodeFormatDependentModule;
117543
+ case 4 /* System */:
117544
+ return transformSystemModule;
117420
117545
  default:
117421
117546
  return transformModule;
117422
117547
  }
@@ -118144,6 +118269,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118144
118269
  newLine: compilerOptions.newLine,
118145
118270
  noEmitHelpers: compilerOptions.noEmitHelpers,
118146
118271
  module: getEmitModuleKind(compilerOptions),
118272
+ moduleResolution: getEmitModuleResolutionKind(compilerOptions),
118147
118273
  target: getEmitScriptTarget(compilerOptions),
118148
118274
  sourceMap: compilerOptions.sourceMap,
118149
118275
  inlineSourceMap: compilerOptions.inlineSourceMap,
@@ -118206,8 +118332,9 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
118206
118332
  newLine: compilerOptions.newLine,
118207
118333
  noEmitHelpers: true,
118208
118334
  module: compilerOptions.module,
118335
+ moduleResolution: compilerOptions.moduleResolution,
118209
118336
  target: compilerOptions.target,
118210
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
118337
+ sourceMap: emitOnly !== 2 /* BuilderSignature */ && compilerOptions.declarationMap,
118211
118338
  inlineSourceMap: compilerOptions.inlineSourceMap,
118212
118339
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
118213
118340
  onlyPrintJsDocStyle: true,
@@ -123724,7 +123851,6 @@ function getModeForUsageLocation(file, usage, compilerOptions) {
123724
123851
  return getModeForUsageLocationWorker(file, usage, compilerOptions);
123725
123852
  }
123726
123853
  function getModeForUsageLocationWorker(file, usage, compilerOptions) {
123727
- var _a;
123728
123854
  if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent) || isJSDocImportTag(usage.parent)) {
123729
123855
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
123730
123856
  if (isTypeOnly) {
@@ -123740,19 +123866,28 @@ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
123740
123866
  return override;
123741
123867
  }
123742
123868
  }
123743
- if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
123744
- return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
123745
- usage.parent,
123746
- /*requireStringLiteralLikeArgument*/
123747
- false
123748
- ) ? 1 /* CommonJS */ : 99 /* ESNext */;
123869
+ if (compilerOptions && importSyntaxAffectsModuleResolution(compilerOptions)) {
123870
+ return getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions);
123749
123871
  }
123750
- if (file.impliedNodeFormat === void 0) return void 0;
123751
- if (file.impliedNodeFormat !== 99 /* ESNext */) {
123752
- return isImportCall(walkUpParenthesizedExpressions(usage.parent)) ? 99 /* ESNext */ : 1 /* CommonJS */;
123872
+ }
123873
+ function getEmitSyntaxForUsageLocationWorker(file, usage, compilerOptions) {
123874
+ var _a;
123875
+ if (!compilerOptions) {
123876
+ return void 0;
123753
123877
  }
123754
123878
  const exprParentParent = (_a = walkUpParenthesizedExpressions(usage.parent)) == null ? void 0 : _a.parent;
123755
- return exprParentParent && isImportEqualsDeclaration(exprParentParent) ? 1 /* CommonJS */ : 99 /* ESNext */;
123879
+ if (exprParentParent && isImportEqualsDeclaration(exprParentParent) || isRequireCall(
123880
+ usage.parent,
123881
+ /*requireStringLiteralLikeArgument*/
123882
+ false
123883
+ )) {
123884
+ return 1 /* CommonJS */;
123885
+ }
123886
+ if (isImportCall(walkUpParenthesizedExpressions(usage.parent))) {
123887
+ return shouldTransformImportCallWorker(file, compilerOptions) ? 1 /* CommonJS */ : 99 /* ESNext */;
123888
+ }
123889
+ const fileEmitMode = getEmitModuleFormatOfFileWorker(file, compilerOptions);
123890
+ return fileEmitMode === 1 /* CommonJS */ ? 1 /* CommonJS */ : emitModuleKindIsNonNodeESM(fileEmitMode) || fileEmitMode === 200 /* Preserve */ ? 99 /* ESNext */ : void 0;
123756
123891
  }
123757
123892
  function getResolutionModeOverride(node, grammarErrorOnNode) {
123758
123893
  if (!node) return void 0;
@@ -123809,7 +123944,7 @@ function getTypeReferenceResolutionName(entry) {
123809
123944
  }
123810
123945
  var typeReferenceResolutionNameAndModeGetter = {
123811
123946
  getName: getTypeReferenceResolutionName,
123812
- getMode: (entry, file) => getModeForFileReference(entry, file == null ? void 0 : file.impliedNodeFormat)
123947
+ getMode: (entry, file, compilerOptions) => getModeForFileReference(entry, file && getDefaultResolutionModeForFileWorker(file, compilerOptions))
123813
123948
  };
123814
123949
  function createTypeReferenceResolutionLoader(containingFile, redirectedReference, options, host, cache) {
123815
123950
  return {
@@ -123995,7 +124130,7 @@ function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host,
123995
124130
  const packageJsonLocations = [];
123996
124131
  state.failedLookupLocations = packageJsonLocations;
123997
124132
  state.affectingLocations = packageJsonLocations;
123998
- const packageJsonScope = getPackageScopeForPath(fileName, state);
124133
+ const packageJsonScope = getPackageScopeForPath(getDirectoryPath(fileName), state);
123999
124134
  const impliedNodeFormat = (packageJsonScope == null ? void 0 : packageJsonScope.contents.packageJsonContent.type) === "module" ? 99 /* ESNext */ : 1 /* CommonJS */;
124000
124135
  return { impliedNodeFormat, packageJsonLocations, packageJsonScope };
124001
124136
  }
@@ -124449,6 +124584,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124449
124584
  isSourceFileFromExternalLibrary,
124450
124585
  isSourceFileDefaultLibrary,
124451
124586
  getModeForUsageLocation: getModeForUsageLocation2,
124587
+ getEmitSyntaxForUsageLocation,
124452
124588
  getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
124453
124589
  getSourceFileFromReference,
124454
124590
  getLibFileFromReference,
@@ -124477,6 +124613,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124477
124613
  forEachResolvedProjectReference: forEachResolvedProjectReference2,
124478
124614
  isSourceOfProjectReferenceRedirect,
124479
124615
  getRedirectReferenceForResolutionFromSourceOfProject,
124616
+ getCompilerOptionsForFile,
124617
+ getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
124618
+ getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
124619
+ getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
124620
+ shouldTransformImportCall,
124480
124621
  emitBuildInfo,
124481
124622
  fileExists,
124482
124623
  readFile,
@@ -125031,6 +125172,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125031
125172
  getSymlinkCache,
125032
125173
  writeFile: writeFileCallback || writeFile2,
125033
125174
  isEmitBlocked,
125175
+ shouldTransformImportCall,
125176
+ getEmitModuleFormatOfFile: getEmitModuleFormatOfFile2,
125177
+ getDefaultResolutionModeForFile: getDefaultResolutionModeForFile2,
125178
+ getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
125034
125179
  readFile: (f) => host.readFile(f),
125035
125180
  fileExists: (f) => {
125036
125181
  const path = toPath3(f);
@@ -126110,10 +126255,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126110
126255
  const resolvedTypeReferenceDirective = resolutions[index];
126111
126256
  const fileName = ref.fileName;
126112
126257
  resolutionsInFile.set(fileName, getModeForFileReference(ref, file.impliedNodeFormat), resolvedTypeReferenceDirective);
126113
- const mode = ref.resolutionMode || file.impliedNodeFormat;
126258
+ const mode = ref.resolutionMode || getDefaultResolutionModeForFile2(file);
126114
126259
  processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: 5 /* TypeReferenceDirective */, file: file.path, index });
126115
126260
  }
126116
126261
  }
126262
+ function getCompilerOptionsForFile(file) {
126263
+ var _a2;
126264
+ return ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
126265
+ }
126117
126266
  function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) {
126118
126267
  var _a2, _b2;
126119
126268
  (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 });
@@ -126214,13 +126363,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126214
126363
  return host.getCanonicalFileName(fileName);
126215
126364
  }
126216
126365
  function processImportedModules(file) {
126217
- var _a2;
126218
126366
  collectExternalModuleReferences(file);
126219
126367
  if (file.imports.length || file.moduleAugmentations.length) {
126220
126368
  const moduleNames = getModuleNames(file);
126221
126369
  const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
126222
126370
  Debug.assert(resolutions.length === moduleNames.length);
126223
- const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
126371
+ const optionsForFile = getCompilerOptionsForFile(file);
126224
126372
  const resolutionsInFile = createModeAwareCache();
126225
126373
  (resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
126226
126374
  for (let index = 0; index < moduleNames.length; index++) {
@@ -126769,7 +126917,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126769
126917
  redirectInfo = cachedChain.redirectInfo;
126770
126918
  } else {
126771
126919
  reasons == null ? void 0 : reasons.forEach(processReason);
126772
- redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file);
126920
+ redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
126773
126921
  }
126774
126922
  if (fileProcessingReason) processReason(fileProcessingReason);
126775
126923
  const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
@@ -127127,13 +127275,53 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127127
127275
  return symlinks;
127128
127276
  }
127129
127277
  function getModeForUsageLocation2(file, usage) {
127130
- var _a2;
127131
- const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
127132
- return getModeForUsageLocationWorker(file, usage, optionsForFile);
127278
+ return getModeForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
127279
+ }
127280
+ function getEmitSyntaxForUsageLocation(file, usage) {
127281
+ return getEmitSyntaxForUsageLocationWorker(file, usage, getCompilerOptionsForFile(file));
127133
127282
  }
127134
127283
  function getModeForResolutionAtIndex2(file, index) {
127135
127284
  return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
127136
127285
  }
127286
+ function getDefaultResolutionModeForFile2(sourceFile) {
127287
+ return getDefaultResolutionModeForFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
127288
+ }
127289
+ function getImpliedNodeFormatForEmit2(sourceFile) {
127290
+ return getImpliedNodeFormatForEmitWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
127291
+ }
127292
+ function getEmitModuleFormatOfFile2(sourceFile) {
127293
+ return getEmitModuleFormatOfFileWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
127294
+ }
127295
+ function shouldTransformImportCall(sourceFile) {
127296
+ return shouldTransformImportCallWorker(sourceFile, getCompilerOptionsForFile(sourceFile));
127297
+ }
127298
+ }
127299
+ function shouldTransformImportCallWorker(sourceFile, options) {
127300
+ const moduleKind = getEmitModuleKind(options);
127301
+ if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */) {
127302
+ return false;
127303
+ }
127304
+ return getEmitModuleFormatOfFileWorker(sourceFile, options) < 5 /* ES2015 */;
127305
+ }
127306
+ function getEmitModuleFormatOfFileWorker(sourceFile, options) {
127307
+ return getImpliedNodeFormatForEmitWorker(sourceFile, options) ?? getEmitModuleKind(options);
127308
+ }
127309
+ function getImpliedNodeFormatForEmitWorker(sourceFile, options) {
127310
+ var _a, _b;
127311
+ const moduleKind = getEmitModuleKind(options);
127312
+ if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
127313
+ return sourceFile.impliedNodeFormat;
127314
+ }
127315
+ if (sourceFile.impliedNodeFormat === 1 /* CommonJS */ && (((_a = sourceFile.packageJsonScope) == null ? void 0 : _a.contents.packageJsonContent.type) === "commonjs" || fileExtensionIsOneOf(sourceFile.fileName, [".cjs" /* Cjs */, ".cts" /* Cts */]))) {
127316
+ return 1 /* CommonJS */;
127317
+ }
127318
+ if (sourceFile.impliedNodeFormat === 99 /* ESNext */ && (((_b = sourceFile.packageJsonScope) == null ? void 0 : _b.contents.packageJsonContent.type) === "module" || fileExtensionIsOneOf(sourceFile.fileName, [".mjs" /* Mjs */, ".mts" /* Mts */]))) {
127319
+ return 99 /* ESNext */;
127320
+ }
127321
+ return void 0;
127322
+ }
127323
+ function getDefaultResolutionModeForFileWorker(sourceFile, options) {
127324
+ return importSyntaxAffectsModuleResolution(options) ? getImpliedNodeFormatForEmitWorker(sourceFile, options) : void 0;
127137
127325
  }
127138
127326
  function updateHostForUseSourceOfProjectReferenceRedirect(host) {
127139
127327
  let setOfDeclarationDirectories;
@@ -127602,8 +127790,7 @@ var BuilderState;
127602
127790
  );
127603
127791
  },
127604
127792
  cancellationToken,
127605
- /*emitOnly*/
127606
- true,
127793
+ 2 /* BuilderSignature */,
127607
127794
  /*customTransformers*/
127608
127795
  void 0,
127609
127796
  /*forceDtsEmit*/
@@ -127939,7 +128126,12 @@ function repopulateDiagnostics(diagnostics, newProgram) {
127939
128126
  }
127940
128127
  function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
127941
128128
  const info = repopulateInfo(chain);
127942
- if (info) {
128129
+ if (info === true) {
128130
+ return {
128131
+ ...createModeMismatchDetails(sourceFile),
128132
+ next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
128133
+ };
128134
+ } else if (info) {
127943
128135
  return {
127944
128136
  ...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
127945
128137
  next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
@@ -129702,7 +129894,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
129702
129894
  cleanupLibResolutionWatching(newProgram);
129703
129895
  newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => {
129704
129896
  var _a;
129705
- const expected = isExternalOrCommonJsModule(newFile) ? ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0 : 0;
129897
+ const expected = ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0;
129706
129898
  const existing = impliedFormatPackageJsons.get(newFile.resolvedPath) ?? emptyArray;
129707
129899
  for (let i = existing.length; i < expected; i++) {
129708
129900
  createFileWatcherOfAffectingLocation(
@@ -130594,10 +130786,10 @@ function explainFiles(program, write) {
130594
130786
  for (const file of program.getSourceFiles()) {
130595
130787
  write(`${toFileName(file, relativeFileName)}`);
130596
130788
  (_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`));
130597
- (_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
130789
+ (_b = explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file), relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`));
130598
130790
  }
130599
130791
  }
130600
- function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
130792
+ function explainIfFileIsRedirectAndImpliedFormat(file, options, fileNameConvertor) {
130601
130793
  var _a;
130602
130794
  let result;
130603
130795
  if (file.path !== file.resolvedPath) {
@@ -130617,7 +130809,7 @@ function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
130617
130809
  ));
130618
130810
  }
130619
130811
  if (isExternalOrCommonJsModule(file)) {
130620
- switch (file.impliedNodeFormat) {
130812
+ switch (getImpliedNodeFormatForEmitWorker(file, options)) {
130621
130813
  case 99 /* ESNext */:
130622
130814
  if (file.packageJsonScope) {
130623
130815
  (result ?? (result = [])).push(chainDiagnosticMessages(
@@ -137154,7 +137346,9 @@ function createModuleSpecifierResolutionHost(program, host) {
137154
137346
  isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
137155
137347
  getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
137156
137348
  getFileIncludeReasons: () => program.getFileIncludeReasons(),
137157
- getCommonSourceDirectory: () => program.getCommonSourceDirectory()
137349
+ getCommonSourceDirectory: () => program.getCommonSourceDirectory(),
137350
+ getDefaultResolutionModeForFile: (file) => program.getDefaultResolutionModeForFile(file),
137351
+ getModeForResolutionAtIndex: (file, index) => program.getModeForResolutionAtIndex(file, index)
137158
137352
  };
137159
137353
  }
137160
137354
  function getModuleSpecifierResolverHost(program, host) {
@@ -138251,36 +138445,12 @@ function mapOneOrMany(valueOrArray, f, resultSelector = identity) {
138251
138445
  function firstOrOnly(valueOrArray) {
138252
138446
  return isArray(valueOrArray) ? first(valueOrArray) : valueOrArray;
138253
138447
  }
138254
- function getNamesForExportedSymbol(symbol, scriptTarget) {
138255
- if (needsNameFromDeclaration(symbol)) {
138256
- const fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol);
138257
- if (fromDeclaration) return fromDeclaration;
138258
- const fileNameCase = moduleSymbolToValidIdentifier(
138259
- getSymbolParentOrFail(symbol),
138260
- scriptTarget,
138261
- /*forceCapitalize*/
138262
- false
138263
- );
138264
- const capitalized = moduleSymbolToValidIdentifier(
138265
- getSymbolParentOrFail(symbol),
138266
- scriptTarget,
138267
- /*forceCapitalize*/
138268
- true
138269
- );
138270
- if (fileNameCase === capitalized) return fileNameCase;
138271
- return [fileNameCase, capitalized];
138272
- }
138273
- return symbol.name;
138274
- }
138275
138448
  function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
138276
- if (needsNameFromDeclaration(symbol)) {
138449
+ if (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */) {
138277
138450
  return getDefaultLikeExportNameFromDeclaration(symbol) || moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
138278
138451
  }
138279
138452
  return symbol.name;
138280
138453
  }
138281
- function needsNameFromDeclaration(symbol) {
138282
- return !(symbol.flags & 33554432 /* Transient */) && (symbol.escapedName === "export=" /* ExportEquals */ || symbol.escapedName === "default" /* Default */);
138283
- }
138284
138454
  function getDefaultLikeExportNameFromDeclaration(symbol) {
138285
138455
  return firstDefined(symbol.declarations, (d) => {
138286
138456
  var _a, _b, _c;
@@ -138443,9 +138613,13 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
138443
138613
  if (!hasJSFileExtension(fileName)) {
138444
138614
  return false;
138445
138615
  }
138446
- const compilerOptions = program.getCompilerOptions();
138616
+ const compilerOptions = typeof file === "string" ? program.getCompilerOptions() : program.getCompilerOptionsForFile(file);
138447
138617
  const moduleKind = getEmitModuleKind(compilerOptions);
138448
- const impliedNodeFormat = typeof file === "string" ? getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions) : file.impliedNodeFormat;
138618
+ const sourceFileLike = typeof file === "string" ? {
138619
+ fileName: file,
138620
+ impliedNodeFormat: getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions)
138621
+ } : file;
138622
+ const impliedNodeFormat = getImpliedNodeFormatForEmitWorker(sourceFileLike, compilerOptions);
138449
138623
  if (impliedNodeFormat === 99 /* ESNext */) {
138450
138624
  return false;
138451
138625
  }
@@ -138557,6 +138731,7 @@ function createCacheableExportInfoMap(host) {
138557
138731
  const namedSymbol = isDefault && getLocalSymbolForExportDefault(symbol) || symbol;
138558
138732
  const names = exportKind === 0 /* Named */ || isExternalModuleSymbol(namedSymbol) ? unescapeLeadingUnderscores(symbolTableKey) : getNamesForExportedSymbol(
138559
138733
  namedSymbol,
138734
+ checker,
138560
138735
  /*scriptTarget*/
138561
138736
  void 0
138562
138737
  );
@@ -138892,7 +139067,15 @@ function getDefaultLikeExportInfo(moduleSymbol, checker) {
138892
139067
  function isImportableSymbol(symbol, checker) {
138893
139068
  return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
138894
139069
  }
138895
- function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
139070
+ function getNamesForExportedSymbol(defaultExport, checker, scriptTarget) {
139071
+ let names;
139072
+ forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, (name, capitalizedName) => {
139073
+ names = capitalizedName ? [name, capitalizedName] : name;
139074
+ return true;
139075
+ });
139076
+ return Debug.checkDefined(names);
139077
+ }
139078
+ function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
138896
139079
  let chain;
138897
139080
  let current = defaultExport;
138898
139081
  const seen = /* @__PURE__ */ new Map();
@@ -138912,7 +139095,20 @@ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, pre
138912
139095
  }
138913
139096
  for (const symbol of chain ?? emptyArray) {
138914
139097
  if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
138915
- const final = cb(moduleSymbolToValidIdentifier(symbol.parent, getEmitScriptTarget(compilerOptions), preferCapitalizedNames));
139098
+ const final = cb(
139099
+ moduleSymbolToValidIdentifier(
139100
+ symbol.parent,
139101
+ scriptTarget,
139102
+ /*forceCapitalize*/
139103
+ false
139104
+ ),
139105
+ moduleSymbolToValidIdentifier(
139106
+ symbol.parent,
139107
+ scriptTarget,
139108
+ /*forceCapitalize*/
139109
+ true
139110
+ )
139111
+ );
138916
139112
  if (final) return final;
138917
139113
  }
138918
139114
  }
@@ -141438,7 +141634,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
141438
141634
  program.getSemanticDiagnostics(sourceFile, cancellationToken);
141439
141635
  const diags = [];
141440
141636
  const checker = program.getTypeChecker();
141441
- const isCommonJSFile = sourceFile.impliedNodeFormat === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
141637
+ const isCommonJSFile = program.getImpliedNodeFormatForEmit(sourceFile) === 1 /* CommonJS */ || fileExtensionIsOneOf(sourceFile.fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]);
141442
141638
  if (!isCommonJSFile && sourceFile.commonJsModuleIndicator && (programContainsEsModules(program) || compilerOptionsIndicateEsModules(program.getCompilerOptions())) && containsTopLevelCommonjs(sourceFile)) {
141443
141639
  diags.push(createDiagnosticForNode(getErrorNodeFromCommonJsIndicator(sourceFile.commonJsModuleIndicator), Diagnostics.File_is_a_CommonJS_module_it_may_be_converted_to_an_ES_module));
141444
141640
  }
@@ -154552,7 +154748,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154552
154748
  compilerOptions,
154553
154749
  createModuleSpecifierResolutionHost(program, host)
154554
154750
  );
154555
- const importKind = getImportKind(futureExportingSourceFile, exportKind, compilerOptions);
154751
+ const importKind = getImportKind(futureExportingSourceFile, exportKind, program);
154556
154752
  const addAsTypeOnly = getAddAsTypeOnly(
154557
154753
  isImportUsageValidAsTypeOnly,
154558
154754
  /*isForNewImportDeclaration*/
@@ -154892,7 +155088,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
154892
155088
  }
154893
155089
  function createImportSpecifierResolver(importingFile, program, host, preferences) {
154894
155090
  const packageJsonImportFilter = createPackageJsonImportFilter(importingFile, preferences, host);
154895
- const importMap = createExistingImportMap(program.getTypeChecker(), importingFile, program.getCompilerOptions());
155091
+ const importMap = createExistingImportMap(importingFile, program);
154896
155092
  return { getModuleSpecifierForBestExportInfo };
154897
155093
  function getModuleSpecifierForBestExportInfo(exportInfo, position, isValidTypeOnlyUseSite, fromCacheOnly) {
154898
155094
  const { fixes, computedWithoutCacheCount } = getImportFixes(
@@ -154999,7 +155195,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
154999
155195
  }
155000
155196
  }
155001
155197
  }
155002
- function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(program.getTypeChecker(), sourceFile, program.getCompilerOptions()) : void 0, fromCacheOnly) {
155198
+ function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
155003
155199
  const checker = program.getTypeChecker();
155004
155200
  const existingImports = importMap ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
155005
155201
  const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
@@ -155114,7 +155310,8 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
155114
155310
  };
155115
155311
  }
155116
155312
  }
155117
- function createExistingImportMap(checker, importingFile, compilerOptions) {
155313
+ function createExistingImportMap(importingFile, program) {
155314
+ const checker = program.getTypeChecker();
155118
155315
  let importMap;
155119
155316
  for (const moduleSpecifier of importingFile.imports) {
155120
155317
  const i = importFromModuleSpecifier(moduleSpecifier);
@@ -155135,7 +155332,7 @@ function createExistingImportMap(checker, importingFile, compilerOptions) {
155135
155332
  const matchingDeclarations = importMap == null ? void 0 : importMap.get(getSymbolId(moduleSymbol));
155136
155333
  if (!matchingDeclarations) return emptyArray;
155137
155334
  if (isSourceFileJS(importingFile) && !(targetFlags & 111551 /* Value */) && !every(matchingDeclarations, isJSDocImportTag)) return emptyArray;
155138
- const importKind = getImportKind(importingFile, exportKind, compilerOptions);
155335
+ const importKind = getImportKind(importingFile, exportKind, program);
155139
155336
  return matchingDeclarations.map((declaration) => ({ declaration, importKind, symbol, targetFlags }));
155140
155337
  }
155141
155338
  };
@@ -155150,8 +155347,8 @@ function shouldUseRequire(sourceFile, program) {
155150
155347
  if (compilerOptions.configFile) {
155151
155348
  return getEmitModuleKind(compilerOptions) < 5 /* ES2015 */;
155152
155349
  }
155153
- if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) return true;
155154
- if (sourceFile.impliedNodeFormat === 99 /* ESNext */) return false;
155350
+ if (getImpliedNodeFormatForEmit(sourceFile, program) === 1 /* CommonJS */) return true;
155351
+ if (getImpliedNodeFormatForEmit(sourceFile, program) === 99 /* ESNext */) return false;
155155
155352
  for (const otherFile of program.getSourceFiles()) {
155156
155353
  if (otherFile === sourceFile || !isSourceFileJS(otherFile) || program.isSourceFileFromExternalLibrary(otherFile)) continue;
155157
155354
  if (otherFile.commonJsModuleIndicator && !otherFile.externalModuleIndicator) return true;
@@ -155203,20 +155400,13 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
155203
155400
  if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
155204
155401
  return { kind: 1 /* JsdocTypeImport */, moduleSpecifierKind, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
155205
155402
  }
155206
- const importKind = getImportKind(sourceFile, exportInfo2.exportKind, compilerOptions);
155403
+ const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
155207
155404
  let qualification;
155208
155405
  if (usagePosition !== void 0 && importKind === 3 /* CommonJS */ && exportInfo2.exportKind === 0 /* Named */) {
155209
155406
  const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
155210
155407
  let namespacePrefix;
155211
155408
  if (exportEquals !== exportInfo2.moduleSymbol) {
155212
- namespacePrefix = forEachNameOfDefaultExport(
155213
- exportEquals,
155214
- checker,
155215
- compilerOptions,
155216
- /*preferCapitalizedNames*/
155217
- false,
155218
- identity
155219
- );
155409
+ namespacePrefix = forEachNameOfDefaultExport(exportEquals, checker, getEmitScriptTarget(compilerOptions), identity);
155220
155410
  }
155221
155411
  namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier(
155222
155412
  exportInfo2.moduleSymbol,
@@ -155389,8 +155579,8 @@ function getUmdSymbol(token, checker) {
155389
155579
  }
155390
155580
  return void 0;
155391
155581
  }
155392
- function getImportKind(importingFile, exportKind, compilerOptions, forceImportKeyword) {
155393
- if (compilerOptions.verbatimModuleSyntax && (getEmitModuleKind(compilerOptions) === 1 /* CommonJS */ || importingFile.impliedNodeFormat === 1 /* CommonJS */)) {
155582
+ function getImportKind(importingFile, exportKind, program, forceImportKeyword) {
155583
+ if (program.getCompilerOptions().verbatimModuleSyntax && getEmitModuleFormatOfFile(importingFile, program) === 1 /* CommonJS */) {
155394
155584
  return 3 /* CommonJS */;
155395
155585
  }
155396
155586
  switch (exportKind) {
@@ -155399,18 +155589,18 @@ function getImportKind(importingFile, exportKind, compilerOptions, forceImportKe
155399
155589
  case 1 /* Default */:
155400
155590
  return 1 /* Default */;
155401
155591
  case 2 /* ExportEquals */:
155402
- return getExportEqualsImportKind(importingFile, compilerOptions, !!forceImportKeyword);
155592
+ return getExportEqualsImportKind(importingFile, program.getCompilerOptions(), !!forceImportKeyword);
155403
155593
  case 3 /* UMD */:
155404
- return getUmdImportKind(importingFile, compilerOptions, !!forceImportKeyword);
155594
+ return getUmdImportKind(importingFile, program, !!forceImportKeyword);
155405
155595
  default:
155406
155596
  return Debug.assertNever(exportKind);
155407
155597
  }
155408
155598
  }
155409
- function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
155410
- if (getAllowSyntheticDefaultImports(compilerOptions)) {
155599
+ function getUmdImportKind(importingFile, program, forceImportKeyword) {
155600
+ if (getAllowSyntheticDefaultImports(program.getCompilerOptions())) {
155411
155601
  return 1 /* Default */;
155412
155602
  }
155413
- const moduleKind = getEmitModuleKind(compilerOptions);
155603
+ const moduleKind = getEmitModuleKind(program.getCompilerOptions());
155414
155604
  switch (moduleKind) {
155415
155605
  case 2 /* AMD */:
155416
155606
  case 1 /* CommonJS */:
@@ -155429,7 +155619,7 @@ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
155429
155619
  return 2 /* Namespace */;
155430
155620
  case 100 /* Node16 */:
155431
155621
  case 199 /* NodeNext */:
155432
- return importingFile.impliedNodeFormat === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
155622
+ return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
155433
155623
  default:
155434
155624
  return Debug.assertNever(moduleKind, `Unexpected moduleKind ${moduleKind}`);
155435
155625
  }
@@ -155512,7 +155702,7 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
155512
155702
  cancellationToken.throwIfCancellationRequested();
155513
155703
  const compilerOptions = program2.getCompilerOptions();
155514
155704
  const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
155515
- if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, compilerOptions, isJsxTagName, (name) => name === symbolName2)) {
155705
+ if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, getEmitScriptTarget(compilerOptions), (name, capitalizedName) => (isJsxTagName ? capitalizedName ?? name : name) === symbolName2)) {
155516
155706
  addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson);
155517
155707
  }
155518
155708
  const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
@@ -155913,6 +156103,12 @@ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
155913
156103
  function symbolFlagsHaveMeaning(flags, meaning) {
155914
156104
  return meaning === 7 /* All */ ? true : meaning & 1 /* Value */ ? !!(flags & 111551 /* Value */) : meaning & 2 /* Type */ ? !!(flags & 788968 /* Type */) : meaning & 4 /* Namespace */ ? !!(flags & 1920 /* Namespace */) : false;
155915
156105
  }
156106
+ function getImpliedNodeFormatForEmit(file, program) {
156107
+ return isFullSourceFile(file) ? program.getImpliedNodeFormatForEmit(file) : getImpliedNodeFormatForEmitWorker(file, program.getCompilerOptions());
156108
+ }
156109
+ function getEmitModuleFormatOfFile(file, program) {
156110
+ return isFullSourceFile(file) ? program.getEmitModuleFormatOfFile(file) : getEmitModuleFormatOfFileWorker(file, program.getCompilerOptions());
156111
+ }
155916
156112
 
155917
156113
  // src/services/codefixes/fixAddMissingConstraint.ts
155918
156114
  var fixId17 = "addMissingConstraint";
@@ -161567,6 +161763,14 @@ function tryGetAutoImportableReferenceFromTypeNode(importTypeNode, scriptTarget)
161567
161763
  function visit(node) {
161568
161764
  if (isLiteralImportTypeNode(node) && node.qualifier) {
161569
161765
  const firstIdentifier = getFirstIdentifier(node.qualifier);
161766
+ if (!firstIdentifier.symbol) {
161767
+ return visitEachChild(
161768
+ node,
161769
+ visit,
161770
+ /*context*/
161771
+ void 0
161772
+ );
161773
+ }
161570
161774
  const name = getNameForExportedSymbol(firstIdentifier.symbol, scriptTarget);
161571
161775
  const qualifier = name !== firstIdentifier.text ? replaceFirstIdentifierOfEntityName(node.qualifier, factory.createIdentifier(name)) : node.qualifier;
161572
161776
  symbols = append(symbols, firstIdentifier.symbol);
@@ -162069,7 +162273,7 @@ var errorCodes54 = [Diagnostics.require_call_may_be_converted_to_an_import.code]
162069
162273
  registerCodeFix({
162070
162274
  errorCodes: errorCodes54,
162071
162275
  getCodeActions(context) {
162072
- const info = getInfo18(context.sourceFile, context.program, context.span.start);
162276
+ const info = getInfo18(context.sourceFile, context.program, context.span.start, context.preferences);
162073
162277
  if (!info) {
162074
162278
  return void 0;
162075
162279
  }
@@ -162078,14 +162282,14 @@ registerCodeFix({
162078
162282
  },
162079
162283
  fixIds: [fixId42],
162080
162284
  getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
162081
- const info = getInfo18(diag2.file, context.program, diag2.start);
162285
+ const info = getInfo18(diag2.file, context.program, diag2.start, context.preferences);
162082
162286
  if (info) {
162083
162287
  doChange35(changes, context.sourceFile, info);
162084
162288
  }
162085
162289
  })
162086
162290
  });
162087
162291
  function doChange35(changes, sourceFile, info) {
162088
- const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
162292
+ const { allowSyntheticDefaults, defaultImportName, namedImports, statement, moduleSpecifier } = info;
162089
162293
  changes.replaceNode(
162090
162294
  sourceFile,
162091
162295
  statement,
@@ -162095,7 +162299,7 @@ function doChange35(changes, sourceFile, info) {
162095
162299
  /*isTypeOnly*/
162096
162300
  false,
162097
162301
  defaultImportName,
162098
- factory.createExternalModuleReference(required)
162302
+ factory.createExternalModuleReference(moduleSpecifier)
162099
162303
  ) : factory.createImportDeclaration(
162100
162304
  /*modifiers*/
162101
162305
  void 0,
@@ -162105,13 +162309,13 @@ function doChange35(changes, sourceFile, info) {
162105
162309
  defaultImportName,
162106
162310
  namedImports
162107
162311
  ),
162108
- required,
162312
+ moduleSpecifier,
162109
162313
  /*attributes*/
162110
162314
  void 0
162111
162315
  )
162112
162316
  );
162113
162317
  }
162114
- function getInfo18(sourceFile, program, pos) {
162318
+ function getInfo18(sourceFile, program, pos, preferences) {
162115
162319
  const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
162116
162320
  if (!isRequireCall(
162117
162321
  parent2,
@@ -162121,15 +162325,17 @@ function getInfo18(sourceFile, program, pos) {
162121
162325
  Debug.failBadSyntaxKind(parent2);
162122
162326
  }
162123
162327
  const decl = cast(parent2.parent, isVariableDeclaration);
162328
+ const quotePreference = getQuotePreference(sourceFile, preferences);
162124
162329
  const defaultImportName = tryCast(decl.name, isIdentifier);
162125
162330
  const namedImports = isObjectBindingPattern(decl.name) ? tryCreateNamedImportsFromObjectBindingPattern(decl.name) : void 0;
162126
162331
  if (defaultImportName || namedImports) {
162332
+ const moduleSpecifier = first(parent2.arguments);
162127
162333
  return {
162128
162334
  allowSyntheticDefaults: getAllowSyntheticDefaultImports(program.getCompilerOptions()),
162129
162335
  defaultImportName,
162130
162336
  namedImports,
162131
162337
  statement: cast(decl.parent.parent, isVariableStatement),
162132
- required: first(parent2.arguments)
162338
+ moduleSpecifier: isNoSubstitutionTemplateLiteral(moduleSpecifier) ? factory.createStringLiteral(moduleSpecifier.text, quotePreference === 0 /* Single */) : moduleSpecifier
162133
162339
  };
162134
162340
  }
162135
162341
  }
@@ -163185,10 +163391,12 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i
163185
163391
  const printer = isSnippet ? createSnippetPrinter({
163186
163392
  removeComments: true,
163187
163393
  module: options.module,
163394
+ moduleResolution: options.moduleResolution,
163188
163395
  target: options.target
163189
163396
  }) : createPrinter({
163190
163397
  removeComments: true,
163191
163398
  module: options.module,
163399
+ moduleResolution: options.moduleResolution,
163192
163400
  target: options.target
163193
163401
  });
163194
163402
  setEmitFlags(typeNode, 1 /* SingleLine */);
@@ -163444,6 +163652,7 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options,
163444
163652
  const printer = createSnippetPrinter({
163445
163653
  removeComments: true,
163446
163654
  module: options.module,
163655
+ moduleResolution: options.moduleResolution,
163447
163656
  target: options.target,
163448
163657
  newLine: getNewLineKind(newLineChar)
163449
163658
  });
@@ -163630,7 +163839,7 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
163630
163839
  if (originIsResolvedExport(origin)) {
163631
163840
  sourceDisplay = [textPart(origin.moduleSpecifier)];
163632
163841
  if (importStatementCompletion) {
163633
- ({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences));
163842
+ ({ insertText, replacementSpan } = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences));
163634
163843
  isSnippet = preferences.includeCompletionsWithSnippetText ? true : void 0;
163635
163844
  }
163636
163845
  }
@@ -163771,6 +163980,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
163771
163980
  const printer = createSnippetPrinter({
163772
163981
  removeComments: true,
163773
163982
  module: options.module,
163983
+ moduleResolution: options.moduleResolution,
163774
163984
  target: options.target,
163775
163985
  omitTrailingSemicolon: false,
163776
163986
  newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
@@ -163921,6 +164131,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
163921
164131
  const printer = createSnippetPrinter({
163922
164132
  removeComments: true,
163923
164133
  module: options.module,
164134
+ moduleResolution: options.moduleResolution,
163924
164135
  target: options.target,
163925
164136
  omitTrailingSemicolon: false,
163926
164137
  newLine: getNewLineKind(getNewLineOrDefaultFromHost(host, formatContext == null ? void 0 : formatContext.options))
@@ -163941,6 +164152,7 @@ function getEntryForObjectLiteralMethodCompletion(symbol, name, enclosingDeclara
163941
164152
  const signaturePrinter = createPrinter({
163942
164153
  removeComments: true,
163943
164154
  module: options.module,
164155
+ moduleResolution: options.moduleResolution,
163944
164156
  target: options.target,
163945
164157
  omitTrailingSemicolon: true
163946
164158
  });
@@ -164202,7 +164414,7 @@ function completionEntryDataToSymbolOriginInfo(data, completionName, moduleSymbo
164202
164414
  };
164203
164415
  return unresolvedOrigin;
164204
164416
  }
164205
- function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) {
164417
+ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, program, preferences) {
164206
164418
  const replacementSpan = importStatementCompletion.replacementSpan;
164207
164419
  const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier));
164208
164420
  const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */;
@@ -164210,7 +164422,7 @@ function getInsertTextAndReplacementSpanForImportCompletion(name, importStatemen
164210
164422
  const importKind = ts_codefix_exports.getImportKind(
164211
164423
  sourceFile,
164212
164424
  exportKind,
164213
- options,
164425
+ program,
164214
164426
  /*forceImportKeyword*/
164215
164427
  true
164216
164428
  );
@@ -166589,7 +166801,7 @@ function createNameAndKindSet() {
166589
166801
  }
166590
166802
  function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
166591
166803
  if (isInReferenceComment(sourceFile, position)) {
166592
- const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
166804
+ const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
166593
166805
  return entries && convertPathCompletions(entries);
166594
166806
  }
166595
166807
  if (isInString(sourceFile, position, contextToken)) {
@@ -166912,7 +167124,7 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
166912
167124
  const compilerOptions = program.getCompilerOptions();
166913
167125
  const typeChecker = program.getTypeChecker();
166914
167126
  const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
166915
- return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
167127
+ return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, program, host, extensionOptions);
166916
167128
  }
166917
167129
  function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
166918
167130
  return {
@@ -166923,14 +167135,15 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
166923
167135
  resolutionMode
166924
167136
  };
166925
167137
  }
166926
- function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) {
167138
+ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
167139
+ const compilerOptions = program.getCompilerOptions();
166927
167140
  if (compilerOptions.rootDirs) {
166928
167141
  return getCompletionEntriesForDirectoryFragmentWithRootDirs(
166929
167142
  compilerOptions.rootDirs,
166930
167143
  literalValue,
166931
167144
  scriptDirectory,
166932
167145
  extensionOptions,
166933
- compilerOptions,
167146
+ program,
166934
167147
  host,
166935
167148
  scriptPath
166936
167149
  );
@@ -166939,6 +167152,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, c
166939
167152
  literalValue,
166940
167153
  scriptDirectory,
166941
167154
  extensionOptions,
167155
+ program,
166942
167156
  host,
166943
167157
  /*moduleSpecifierIsRelative*/
166944
167158
  true,
@@ -166965,7 +167179,8 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
166965
167179
  compareStringsCaseSensitive
166966
167180
  );
166967
167181
  }
166968
- function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, compilerOptions, host, exclude) {
167182
+ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
167183
+ const compilerOptions = program.getCompilerOptions();
166969
167184
  const basePath = compilerOptions.project || host.getCurrentDirectory();
166970
167185
  const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
166971
167186
  const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
@@ -166974,6 +167189,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
166974
167189
  fragment,
166975
167190
  baseDirectory,
166976
167191
  extensionOptions,
167192
+ program,
166977
167193
  host,
166978
167194
  /*moduleSpecifierIsRelative*/
166979
167195
  true,
@@ -166982,7 +167198,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
166982
167198
  (itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
166983
167199
  );
166984
167200
  }
166985
- function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
167201
+ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
166986
167202
  var _a;
166987
167203
  if (fragment === void 0) {
166988
167204
  fragment = "";
@@ -167007,7 +167223,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167007
167223
  if (versionPaths) {
167008
167224
  const packageDirectory = getDirectoryPath(packageJsonPath);
167009
167225
  const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
167010
- if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, host, versionPaths)) {
167226
+ if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
167011
167227
  return result;
167012
167228
  }
167013
167229
  }
@@ -167033,7 +167249,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167033
167249
  }
167034
167250
  const { name, extension } = getFilenameWithExtensionOption(
167035
167251
  getBaseFileName(filePath),
167036
- host.getCompilationSettings(),
167252
+ program,
167037
167253
  extensionOptions,
167038
167254
  /*isExportsWildcard*/
167039
167255
  false
@@ -167052,7 +167268,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
167052
167268
  }
167053
167269
  return result;
167054
167270
  }
167055
- function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions, isExportsWildcard) {
167271
+ function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
167056
167272
  const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
167057
167273
  if (nonJsResult) {
167058
167274
  return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
@@ -167062,7 +167278,8 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
167062
167278
  }
167063
167279
  let allowedEndings = getModuleSpecifierPreferences(
167064
167280
  { importModuleSpecifierEnding: extensionOptions.endingPreference },
167065
- compilerOptions,
167281
+ program,
167282
+ program.getCompilerOptions(),
167066
167283
  extensionOptions.importingSourceFile
167067
167284
  ).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
167068
167285
  if (isExportsWildcard) {
@@ -167072,16 +167289,16 @@ function getFilenameWithExtensionOption(name, compilerOptions, extensionOptions,
167072
167289
  if (fileExtensionIsOneOf(name, supportedTSImplementationExtensions)) {
167073
167290
  return { name, extension: tryGetExtensionFromPath2(name) };
167074
167291
  }
167075
- const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
167292
+ const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
167076
167293
  return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
167077
167294
  }
167078
167295
  if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
167079
167296
  return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
167080
167297
  }
167081
- const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, compilerOptions);
167298
+ const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
167082
167299
  return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
167083
167300
  }
167084
- function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, host, paths) {
167301
+ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
167085
167302
  const getPatternsForKey = (key) => paths[key];
167086
167303
  const comparePaths2 = (a, b) => {
167087
167304
  const patternA = tryParsePattern(a);
@@ -167097,13 +167314,14 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
167097
167314
  fragment,
167098
167315
  baseDirectory,
167099
167316
  extensionOptions,
167317
+ program,
167100
167318
  host,
167101
167319
  getOwnKeys(paths),
167102
167320
  getPatternsForKey,
167103
167321
  comparePaths2
167104
167322
  );
167105
167323
  }
167106
- function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, host, keys, getPatternsForKey, comparePaths2) {
167324
+ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
167107
167325
  let pathResults = [];
167108
167326
  let matchedPath;
167109
167327
  for (const key of keys) {
@@ -167122,7 +167340,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
167122
167340
  if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
167123
167341
  pathResults.push({
167124
167342
  matchedPattern: isMatch,
167125
- results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
167343
+ results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, program, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
167126
167344
  });
167127
167345
  }
167128
167346
  }
@@ -167130,7 +167348,9 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
167130
167348
  pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
167131
167349
  return matchedPath !== void 0;
167132
167350
  }
167133
- function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, compilerOptions, host, extensionOptions, typeChecker) {
167351
+ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
167352
+ const typeChecker = program.getTypeChecker();
167353
+ const compilerOptions = program.getCompilerOptions();
167134
167354
  const { baseUrl, paths } = compilerOptions;
167135
167355
  const result = createNameAndKindSet();
167136
167356
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
@@ -167140,6 +167360,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
167140
167360
  fragment,
167141
167361
  absolute,
167142
167362
  extensionOptions,
167363
+ program,
167143
167364
  host,
167144
167365
  /*moduleSpecifierIsRelative*/
167145
167366
  false,
@@ -167150,7 +167371,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
167150
167371
  }
167151
167372
  if (paths) {
167152
167373
  const absolute = getPathsBasePath(compilerOptions, host);
167153
- addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths);
167374
+ addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
167154
167375
  }
167155
167376
  const fragmentDirectory = getFragmentDirectory(fragment);
167156
167377
  for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
@@ -167161,7 +167382,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
167161
167382
  void 0
167162
167383
  ));
167163
167384
  }
167164
- getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, fragmentDirectory, extensionOptions, result);
167385
+ getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
167165
167386
  if (moduleResolutionUsesNodeModules(moduleResolution)) {
167166
167387
  let foundGlobal = false;
167167
167388
  if (fragmentDirectory === void 0) {
@@ -167186,6 +167407,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
167186
167407
  fragment,
167187
167408
  nodeModules,
167188
167409
  extensionOptions,
167410
+ program,
167189
167411
  host,
167190
167412
  /*moduleSpecifierIsRelative*/
167191
167413
  false,
@@ -167230,6 +167452,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, c
167230
167452
  fragmentSubpath,
167231
167453
  packageDirectory,
167232
167454
  extensionOptions,
167455
+ program,
167233
167456
  host,
167234
167457
  keys,
167235
167458
  (key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
@@ -167262,7 +167485,7 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
167262
167485
  function getFragmentDirectory(fragment) {
167263
167486
  return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
167264
167487
  }
167265
- function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, host) {
167488
+ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
167266
167489
  if (!endsWith(path, "*")) {
167267
167490
  return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
167268
167491
  }
@@ -167272,15 +167495,15 @@ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory
167272
167495
  const starIsFullPathComponent = path[path.length - 2] === "/";
167273
167496
  return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
167274
167497
  var _a;
167275
- return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
167498
+ return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
167276
167499
  });
167277
167500
  }
167278
- return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host));
167501
+ return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
167279
167502
  function justPathMappingName(name, kind) {
167280
167503
  return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
167281
167504
  }
167282
167505
  }
167283
- function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, host) {
167506
+ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
167284
167507
  if (!host.readDirectory) {
167285
167508
  return void 0;
167286
167509
  }
@@ -167313,7 +167536,7 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
167313
167536
  if (containsSlash(trimmedWithPattern)) {
167314
167537
  return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
167315
167538
  }
167316
- const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, host.getCompilationSettings(), extensionOptions, isExportsWildcard);
167539
+ const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
167317
167540
  return nameAndKind(name, "script" /* scriptElement */, extension);
167318
167541
  }
167319
167542
  });
@@ -167341,7 +167564,8 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
167341
167564
  }
167342
167565
  return nonRelativeModuleNames;
167343
167566
  }
167344
- function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host) {
167567
+ function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
167568
+ const compilerOptions = program.getCompilerOptions();
167345
167569
  const token = getTokenAtPosition(sourceFile, position);
167346
167570
  const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
167347
167571
  const range = commentRanges && find(commentRanges, (commentRange) => position >= commentRange.pos && position <= commentRange.end);
@@ -167359,14 +167583,16 @@ function getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions
167359
167583
  toComplete,
167360
167584
  scriptPath,
167361
167585
  getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
167586
+ program,
167362
167587
  host,
167363
167588
  /*moduleSpecifierIsRelative*/
167364
167589
  true,
167365
167590
  sourceFile.path
167366
- ) : kind === "types" ? getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
167591
+ ) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
167367
167592
  return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
167368
167593
  }
167369
- function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
167594
+ function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
167595
+ const options = program.getCompilerOptions();
167370
167596
  const seen = /* @__PURE__ */ new Map();
167371
167597
  const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
167372
167598
  for (const root of typeRoots) {
@@ -167400,6 +167626,7 @@ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDire
167400
167626
  remainingFragment,
167401
167627
  baseDirectory,
167402
167628
  extensionOptions,
167629
+ program,
167403
167630
  host,
167404
167631
  /*moduleSpecifierIsRelative*/
167405
167632
  false,
@@ -178732,6 +178959,7 @@ __export(ts_exports2, {
178732
178959
  canHaveJSDoc: () => canHaveJSDoc,
178733
178960
  canHaveLocals: () => canHaveLocals,
178734
178961
  canHaveModifiers: () => canHaveModifiers,
178962
+ canHaveModuleSpecifier: () => canHaveModuleSpecifier,
178735
178963
  canHaveSymbol: () => canHaveSymbol,
178736
178964
  canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics,
178737
178965
  canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
@@ -178894,6 +179122,7 @@ __export(ts_exports2, {
178894
179122
  createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
178895
179123
  createModeAwareCache: () => createModeAwareCache,
178896
179124
  createModeAwareCacheKey: () => createModeAwareCacheKey,
179125
+ createModeMismatchDetails: () => createModeMismatchDetails,
178897
179126
  createModuleNotFoundChain: () => createModuleNotFoundChain,
178898
179127
  createModuleResolutionCache: () => createModuleResolutionCache,
178899
179128
  createModuleResolutionLoader: () => createModuleResolutionLoader,
@@ -179175,6 +179404,7 @@ __export(ts_exports2, {
179175
179404
  getDefaultLibFilePath: () => getDefaultLibFilePath,
179176
179405
  getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
179177
179406
  getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
179407
+ getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
179178
179408
  getDiagnosticText: () => getDiagnosticText,
179179
179409
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
179180
179410
  getDirectoryPath: () => getDirectoryPath,
@@ -179205,6 +179435,7 @@ __export(ts_exports2, {
179205
179435
  getEmitFlags: () => getEmitFlags,
179206
179436
  getEmitHelpers: () => getEmitHelpers,
179207
179437
  getEmitModuleDetectionKind: () => getEmitModuleDetectionKind,
179438
+ getEmitModuleFormatOfFileWorker: () => getEmitModuleFormatOfFileWorker,
179208
179439
  getEmitModuleKind: () => getEmitModuleKind,
179209
179440
  getEmitModuleResolutionKind: () => getEmitModuleResolutionKind,
179210
179441
  getEmitScriptTarget: () => getEmitScriptTarget,
@@ -179255,6 +179486,7 @@ __export(ts_exports2, {
179255
179486
  getIdentifierGeneratedImportReference: () => getIdentifierGeneratedImportReference,
179256
179487
  getIdentifierTypeArguments: () => getIdentifierTypeArguments,
179257
179488
  getImmediatelyInvokedFunctionExpression: () => getImmediatelyInvokedFunctionExpression,
179489
+ getImpliedNodeFormatForEmitWorker: () => getImpliedNodeFormatForEmitWorker,
179258
179490
  getImpliedNodeFormatForFile: () => getImpliedNodeFormatForFile,
179259
179491
  getImpliedNodeFormatForFileWorker: () => getImpliedNodeFormatForFileWorker,
179260
179492
  getImportNeedsImportDefaultHelper: () => getImportNeedsImportDefaultHelper,
@@ -179360,7 +179592,6 @@ __export(ts_exports2, {
179360
179592
  getNameOfScriptTarget: () => getNameOfScriptTarget,
179361
179593
  getNameOrArgument: () => getNameOrArgument,
179362
179594
  getNameTable: () => getNameTable,
179363
- getNamesForExportedSymbol: () => getNamesForExportedSymbol,
179364
179595
  getNamespaceDeclarationNode: () => getNamespaceDeclarationNode,
179365
179596
  getNewLineCharacter: () => getNewLineCharacter,
179366
179597
  getNewLineKind: () => getNewLineKind,
@@ -179597,6 +179828,7 @@ __export(ts_exports2, {
179597
179828
  ignoreSourceNewlines: () => ignoreSourceNewlines,
179598
179829
  ignoredPaths: () => ignoredPaths,
179599
179830
  importFromModuleSpecifier: () => importFromModuleSpecifier,
179831
+ importSyntaxAffectsModuleResolution: () => importSyntaxAffectsModuleResolution,
179600
179832
  indexOfAnyCharCode: () => indexOfAnyCharCode,
179601
179833
  indexOfNode: () => indexOfNode,
179602
179834
  indicesOf: () => indicesOf,
@@ -180642,11 +180874,11 @@ __export(ts_exports2, {
180642
180874
  transformESDecorators: () => transformESDecorators,
180643
180875
  transformESNext: () => transformESNext,
180644
180876
  transformGenerators: () => transformGenerators,
180877
+ transformImpliedNodeFormatDependentModule: () => transformImpliedNodeFormatDependentModule,
180645
180878
  transformJsx: () => transformJsx,
180646
180879
  transformLegacyDecorators: () => transformLegacyDecorators,
180647
180880
  transformModule: () => transformModule,
180648
180881
  transformNamedEvaluation: () => transformNamedEvaluation,
180649
- transformNodeModule: () => transformNodeModule,
180650
180882
  transformNodes: () => transformNodes,
180651
180883
  transformSystemModule: () => transformSystemModule,
180652
180884
  transformTypeScript: () => transformTypeScript,
@@ -181517,7 +181749,7 @@ __export(ts_server_protocol_exports, {
181517
181749
  NewLineKind: () => NewLineKind2,
181518
181750
  OrganizeImportsMode: () => OrganizeImportsMode,
181519
181751
  PollingWatchKind: () => PollingWatchKind2,
181520
- ScriptTarget: () => ScriptTarget10,
181752
+ ScriptTarget: () => ScriptTarget11,
181521
181753
  SemicolonPreference: () => SemicolonPreference,
181522
181754
  WatchDirectoryKind: () => WatchDirectoryKind2,
181523
181755
  WatchFileKind: () => WatchFileKind2
@@ -181708,24 +181940,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
181708
181940
  NewLineKind3["Lf"] = "Lf";
181709
181941
  return NewLineKind3;
181710
181942
  })(NewLineKind2 || {});
181711
- var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
181712
- ScriptTarget11["ES3"] = "es3";
181713
- ScriptTarget11["ES5"] = "es5";
181714
- ScriptTarget11["ES6"] = "es6";
181715
- ScriptTarget11["ES2015"] = "es2015";
181716
- ScriptTarget11["ES2016"] = "es2016";
181717
- ScriptTarget11["ES2017"] = "es2017";
181718
- ScriptTarget11["ES2018"] = "es2018";
181719
- ScriptTarget11["ES2019"] = "es2019";
181720
- ScriptTarget11["ES2020"] = "es2020";
181721
- ScriptTarget11["ES2021"] = "es2021";
181722
- ScriptTarget11["ES2022"] = "es2022";
181723
- ScriptTarget11["ES2023"] = "es2023";
181724
- ScriptTarget11["ESNext"] = "esnext";
181725
- ScriptTarget11["JSON"] = "json";
181726
- ScriptTarget11["Latest"] = "esnext" /* ESNext */;
181727
- return ScriptTarget11;
181728
- })(ScriptTarget10 || {});
181943
+ var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
181944
+ ScriptTarget12["ES3"] = "es3";
181945
+ ScriptTarget12["ES5"] = "es5";
181946
+ ScriptTarget12["ES6"] = "es6";
181947
+ ScriptTarget12["ES2015"] = "es2015";
181948
+ ScriptTarget12["ES2016"] = "es2016";
181949
+ ScriptTarget12["ES2017"] = "es2017";
181950
+ ScriptTarget12["ES2018"] = "es2018";
181951
+ ScriptTarget12["ES2019"] = "es2019";
181952
+ ScriptTarget12["ES2020"] = "es2020";
181953
+ ScriptTarget12["ES2021"] = "es2021";
181954
+ ScriptTarget12["ES2022"] = "es2022";
181955
+ ScriptTarget12["ES2023"] = "es2023";
181956
+ ScriptTarget12["ESNext"] = "esnext";
181957
+ ScriptTarget12["JSON"] = "json";
181958
+ ScriptTarget12["Latest"] = "esnext" /* ESNext */;
181959
+ return ScriptTarget12;
181960
+ })(ScriptTarget11 || {});
181729
181961
  {
181730
181962
  }
181731
181963
 
@@ -190213,7 +190445,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
190213
190445
  const packageDirectory = fileName.substring(0, nodeModulesPathParts.packageRootIndex);
190214
190446
  const packageJsonCache = (_a2 = project.getModuleResolutionCache()) == null ? void 0 : _a2.getPackageJsonInfoCache();
190215
190447
  const compilerOptions = project.getCompilationSettings();
190216
- const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory + "/package.json", project.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
190448
+ const packageJson = getPackageScopeForPath(getNormalizedAbsolutePath(packageDirectory, project.getCurrentDirectory()), getTemporaryModuleResolutionState(packageJsonCache, project, compilerOptions));
190217
190449
  if (!packageJson) return void 0;
190218
190450
  const entrypoints = getEntrypointsFromPackageJsonInfo(
190219
190451
  packageJson,
@@ -193090,6 +193322,7 @@ if (typeof console !== "undefined") {
193090
193322
  canHaveJSDoc,
193091
193323
  canHaveLocals,
193092
193324
  canHaveModifiers,
193325
+ canHaveModuleSpecifier,
193093
193326
  canHaveSymbol,
193094
193327
  canIncludeBindAndCheckDiagnostics,
193095
193328
  canJsonReportNoInputFiles,
@@ -193252,6 +193485,7 @@ if (typeof console !== "undefined") {
193252
193485
  createMemberAccessForPropertyName,
193253
193486
  createModeAwareCache,
193254
193487
  createModeAwareCacheKey,
193488
+ createModeMismatchDetails,
193255
193489
  createModuleNotFoundChain,
193256
193490
  createModuleResolutionCache,
193257
193491
  createModuleResolutionLoader,
@@ -193533,6 +193767,7 @@ if (typeof console !== "undefined") {
193533
193767
  getDefaultLibFilePath,
193534
193768
  getDefaultLikeExportInfo,
193535
193769
  getDefaultLikeExportNameFromDeclaration,
193770
+ getDefaultResolutionModeForFileWorker,
193536
193771
  getDiagnosticText,
193537
193772
  getDiagnosticsWithinSpan,
193538
193773
  getDirectoryPath,
@@ -193563,6 +193798,7 @@ if (typeof console !== "undefined") {
193563
193798
  getEmitFlags,
193564
193799
  getEmitHelpers,
193565
193800
  getEmitModuleDetectionKind,
193801
+ getEmitModuleFormatOfFileWorker,
193566
193802
  getEmitModuleKind,
193567
193803
  getEmitModuleResolutionKind,
193568
193804
  getEmitScriptTarget,
@@ -193613,6 +193849,7 @@ if (typeof console !== "undefined") {
193613
193849
  getIdentifierGeneratedImportReference,
193614
193850
  getIdentifierTypeArguments,
193615
193851
  getImmediatelyInvokedFunctionExpression,
193852
+ getImpliedNodeFormatForEmitWorker,
193616
193853
  getImpliedNodeFormatForFile,
193617
193854
  getImpliedNodeFormatForFileWorker,
193618
193855
  getImportNeedsImportDefaultHelper,
@@ -193718,7 +193955,6 @@ if (typeof console !== "undefined") {
193718
193955
  getNameOfScriptTarget,
193719
193956
  getNameOrArgument,
193720
193957
  getNameTable,
193721
- getNamesForExportedSymbol,
193722
193958
  getNamespaceDeclarationNode,
193723
193959
  getNewLineCharacter,
193724
193960
  getNewLineKind,
@@ -193955,6 +194191,7 @@ if (typeof console !== "undefined") {
193955
194191
  ignoreSourceNewlines,
193956
194192
  ignoredPaths,
193957
194193
  importFromModuleSpecifier,
194194
+ importSyntaxAffectsModuleResolution,
193958
194195
  indexOfAnyCharCode,
193959
194196
  indexOfNode,
193960
194197
  indicesOf,
@@ -195000,11 +195237,11 @@ if (typeof console !== "undefined") {
195000
195237
  transformESDecorators,
195001
195238
  transformESNext,
195002
195239
  transformGenerators,
195240
+ transformImpliedNodeFormatDependentModule,
195003
195241
  transformJsx,
195004
195242
  transformLegacyDecorators,
195005
195243
  transformModule,
195006
195244
  transformNamedEvaluation,
195007
- transformNodeModule,
195008
195245
  transformNodes,
195009
195246
  transformSystemModule,
195010
195247
  transformTypeScript,