@typescript-deploys/pr-build 5.7.0-pr-60122-16 → 5.7.0-pr-57718-9

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
@@ -945,6 +945,7 @@ __export(typescript_exports, {
945
945
  getPositionOfLineAndCharacter: () => getPositionOfLineAndCharacter,
946
946
  getPossibleGenericSignatures: () => getPossibleGenericSignatures,
947
947
  getPossibleOriginalInputExtensionForExtension: () => getPossibleOriginalInputExtensionForExtension,
948
+ getPossibleOriginalInputPathWithoutChangingExt: () => getPossibleOriginalInputPathWithoutChangingExt,
948
949
  getPossibleTypeArgumentsInfo: () => getPossibleTypeArgumentsInfo,
949
950
  getPreEmitDiagnostics: () => getPreEmitDiagnostics,
950
951
  getPrecedingNonSpaceCharacterPosition: () => getPrecedingNonSpaceCharacterPosition,
@@ -2277,7 +2278,7 @@ module.exports = __toCommonJS(typescript_exports);
2277
2278
 
2278
2279
  // src/compiler/corePublic.ts
2279
2280
  var versionMajorMinor = "5.7";
2280
- var version = `${versionMajorMinor}.0-insiders.20241004`;
2281
+ var version = `${versionMajorMinor}.0-insiders.20241031`;
2281
2282
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2282
2283
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2283
2284
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10959,7 +10960,7 @@ var Diagnostics = {
10959
10960
  Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations: diag(9021, 1 /* Error */, "Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations_9021", "Extends clause can't contain an expression with --isolatedDeclarations."),
10960
10961
  Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations: diag(9022, 1 /* Error */, "Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations_9022", "Inference from class expressions is not supported with --isolatedDeclarations."),
10961
10962
  Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function: diag(9023, 1 /* Error */, "Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations__9023", "Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function."),
10962
- Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations: diag(9025, 1 /* Error */, "Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025", "Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations."),
10963
+ Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations: diag(9025, 1 /* Error */, "Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025", "Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations."),
10963
10964
  Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations: diag(9026, 1 /* Error */, "Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_support_9026", "Declaration emit for this file requires preserving this import for augmentations. This is not supported with --isolatedDeclarations."),
10964
10965
  Add_a_type_annotation_to_the_variable_0: diag(9027, 1 /* Error */, "Add_a_type_annotation_to_the_variable_0_9027", "Add a type annotation to the variable {0}."),
10965
10966
  Add_a_type_annotation_to_the_parameter_0: diag(9028, 1 /* Error */, "Add_a_type_annotation_to_the_parameter_0_9028", "Add a type annotation to the parameter {0}."),
@@ -19884,7 +19885,7 @@ function hasInvalidEscape(template) {
19884
19885
  }
19885
19886
  var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
19886
19887
  var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
19887
- var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
19888
+ var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u0009\u000b-\u001f\u2028\u2029\u0085]/g;
19888
19889
  var escapedCharsMap = new Map(Object.entries({
19889
19890
  " ": "\\t",
19890
19891
  "\v": "\\v",
@@ -20204,6 +20205,12 @@ function getDeclarationEmitExtensionForPath(path) {
20204
20205
  function getPossibleOriginalInputExtensionForExtension(path) {
20205
20206
  return fileExtensionIsOneOf(path, [".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".mts" /* Mts */]) ? [".mts" /* Mts */, ".mjs" /* Mjs */] : fileExtensionIsOneOf(path, [".d.cts" /* Dcts */, ".cjs" /* Cjs */, ".cts" /* Cts */]) ? [".cts" /* Cts */, ".cjs" /* Cjs */] : fileExtensionIsOneOf(path, [`.d.json.ts`]) ? [".json" /* Json */] : [".tsx" /* Tsx */, ".ts" /* Ts */, ".jsx" /* Jsx */, ".js" /* Js */];
20206
20207
  }
20208
+ function getPossibleOriginalInputPathWithoutChangingExt(filePath, ignoreCase, outputDir, getCommonSourceDirectory2) {
20209
+ return outputDir ? resolvePath(
20210
+ getCommonSourceDirectory2(),
20211
+ getRelativePathFromDirectory(outputDir, filePath, ignoreCase)
20212
+ ) : filePath;
20213
+ }
20207
20214
  function getPathsBasePath(options, host) {
20208
20215
  var _a;
20209
20216
  if (!options.paths) return void 0;
@@ -21262,11 +21269,11 @@ function getLastChild(node) {
21262
21269
  });
21263
21270
  return lastChild;
21264
21271
  }
21265
- function addToSeen(seen, key, value = true) {
21272
+ function addToSeen(seen, key) {
21266
21273
  if (seen.has(key)) {
21267
21274
  return false;
21268
21275
  }
21269
- seen.set(key, value);
21276
+ seen.add(key);
21270
21277
  return true;
21271
21278
  }
21272
21279
  function isObjectTypeDeclaration(node) {
@@ -30139,13 +30146,23 @@ var importStarHelper = {
30139
30146
  dependencies: [createBindingHelper, setModuleDefaultHelper],
30140
30147
  priority: 2,
30141
30148
  text: `
30142
- var __importStar = (this && this.__importStar) || function (mod) {
30143
- if (mod && mod.__esModule) return mod;
30144
- var result = {};
30145
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
30146
- __setModuleDefault(result, mod);
30147
- return result;
30148
- };`
30149
+ var __importStar = (this && this.__importStar) || (function () {
30150
+ var ownKeys = function(o) {
30151
+ ownKeys = Object.getOwnPropertyNames || function (o) {
30152
+ var ar = [];
30153
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30154
+ return ar;
30155
+ };
30156
+ return ownKeys(o);
30157
+ };
30158
+ return function (mod) {
30159
+ if (mod && mod.__esModule) return mod;
30160
+ var result = {};
30161
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
30162
+ __setModuleDefault(result, mod);
30163
+ return result;
30164
+ };
30165
+ })();`
30149
30166
  };
30150
30167
  var importDefaultHelper = {
30151
30168
  name: "typescript:commonjsimportdefault",
@@ -33783,10 +33800,12 @@ var Parser;
33783
33800
  case 90 /* DefaultKeyword */:
33784
33801
  return nextTokenCanFollowDefaultKeyword();
33785
33802
  case 126 /* StaticKeyword */:
33803
+ nextToken();
33804
+ return canFollowModifier();
33786
33805
  case 139 /* GetKeyword */:
33787
33806
  case 153 /* SetKeyword */:
33788
33807
  nextToken();
33789
- return canFollowModifier();
33808
+ return canFollowGetOrSetKeyword();
33790
33809
  default:
33791
33810
  return nextTokenIsOnSameLineAndCanFollowModifier();
33792
33811
  }
@@ -33804,6 +33823,9 @@ var Parser;
33804
33823
  function canFollowModifier() {
33805
33824
  return token() === 23 /* OpenBracketToken */ || token() === 19 /* OpenBraceToken */ || token() === 42 /* AsteriskToken */ || token() === 26 /* DotDotDotToken */ || isLiteralPropertyName();
33806
33825
  }
33826
+ function canFollowGetOrSetKeyword() {
33827
+ return token() === 23 /* OpenBracketToken */ || isLiteralPropertyName();
33828
+ }
33807
33829
  function nextTokenCanFollowDefaultKeyword() {
33808
33830
  nextToken();
33809
33831
  return token() === 86 /* ClassKeyword */ || token() === 100 /* FunctionKeyword */ || token() === 120 /* InterfaceKeyword */ || token() === 60 /* AtToken */ || token() === 128 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine) || token() === 134 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine);
@@ -42424,7 +42446,7 @@ function convertToTSConfig(configParseResult, configFileName, host) {
42424
42446
  const providedKeys = new Set(optionMap.keys());
42425
42447
  const impliedCompilerOptions = {};
42426
42448
  for (const option in computedOptions) {
42427
- if (!providedKeys.has(option) && some(computedOptions[option].dependencies, (dep) => providedKeys.has(dep))) {
42449
+ if (!providedKeys.has(option) && optionDependsOn(option, providedKeys)) {
42428
42450
  const implied = computedOptions[option].computeValue(configParseResult.options);
42429
42451
  const defaultValue = computedOptions[option].computeValue({});
42430
42452
  if (implied !== defaultValue) {
@@ -42435,6 +42457,17 @@ function convertToTSConfig(configParseResult, configFileName, host) {
42435
42457
  assign(config.compilerOptions, optionMapToObject(serializeCompilerOptions(impliedCompilerOptions, pathOptions)));
42436
42458
  return config;
42437
42459
  }
42460
+ function optionDependsOn(option, dependsOn) {
42461
+ const seen = /* @__PURE__ */ new Set();
42462
+ return optionDependsOnRecursive(option);
42463
+ function optionDependsOnRecursive(option2) {
42464
+ var _a;
42465
+ if (addToSeen(seen, option2)) {
42466
+ return some((_a = computedOptions[option2]) == null ? void 0 : _a.dependencies, (dep) => dependsOn.has(dep) || optionDependsOnRecursive(dep));
42467
+ }
42468
+ return false;
42469
+ }
42470
+ }
42438
42471
  function optionMapToObject(optionMap) {
42439
42472
  return Object.fromEntries(optionMap);
42440
42473
  }
@@ -44843,25 +44876,28 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
44843
44876
  return toSearchResult({ resolved, isExternalLibraryImport: pathContainsNodeModules(resolved.path) });
44844
44877
  }
44845
44878
  if (!isExternalModuleNameRelative(moduleName)) {
44846
- let resolved2;
44847
44879
  if (features & 2 /* Imports */ && startsWith(moduleName, "#")) {
44848
- resolved2 = loadModuleFromImports(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
44849
- }
44850
- if (!resolved2 && features & 4 /* SelfName */) {
44851
- resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
44880
+ const resolved3 = loadModuleFromImports(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
44881
+ if (resolved3) {
44882
+ return resolved3.value && { value: { resolved: resolved3.value, isExternalLibraryImport: false } };
44883
+ }
44852
44884
  }
44853
- if (!resolved2) {
44854
- if (moduleName.includes(":")) {
44855
- if (traceEnabled) {
44856
- trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
44857
- }
44858
- return void 0;
44885
+ if (features & 4 /* SelfName */) {
44886
+ const resolved3 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
44887
+ if (resolved3) {
44888
+ return resolved3.value && { value: { resolved: resolved3.value, isExternalLibraryImport: false } };
44859
44889
  }
44890
+ }
44891
+ if (moduleName.includes(":")) {
44860
44892
  if (traceEnabled) {
44861
- trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
44893
+ trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
44862
44894
  }
44863
- resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
44895
+ return void 0;
44896
+ }
44897
+ if (traceEnabled) {
44898
+ trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
44864
44899
  }
44900
+ let resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
44865
44901
  if (extensions2 & 4 /* Declaration */) {
44866
44902
  resolved2 ?? (resolved2 = resolveFromTypeRoot(moduleName, state2));
44867
44903
  }
@@ -45404,7 +45440,7 @@ function loadModuleFromExports(scope, extensions, subpath, state, cache, redirec
45404
45440
  mainExport = scope.contents.packageJsonContent.exports["."];
45405
45441
  }
45406
45442
  if (mainExport) {
45407
- const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(
45443
+ const loadModuleFromTargetExportOrImport = getLoadModuleFromTargetExportOrImport(
45408
45444
  extensions,
45409
45445
  state,
45410
45446
  cache,
@@ -45414,7 +45450,7 @@ function loadModuleFromExports(scope, extensions, subpath, state, cache, redirec
45414
45450
  /*isImports*/
45415
45451
  false
45416
45452
  );
45417
- return loadModuleFromTargetImportOrExport(
45453
+ return loadModuleFromTargetExportOrImport(
45418
45454
  mainExport,
45419
45455
  "",
45420
45456
  /*pattern*/
@@ -45432,7 +45468,7 @@ function loadModuleFromExports(scope, extensions, subpath, state, cache, redirec
45432
45468
  void 0
45433
45469
  );
45434
45470
  }
45435
- const result = loadModuleFromImportsOrExports(
45471
+ const result = loadModuleFromExportsOrImports(
45436
45472
  extensions,
45437
45473
  state,
45438
45474
  cache,
@@ -45486,7 +45522,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
45486
45522
  void 0
45487
45523
  );
45488
45524
  }
45489
- const result = loadModuleFromImportsOrExports(
45525
+ const result = loadModuleFromExportsOrImports(
45490
45526
  extensions,
45491
45527
  state,
45492
45528
  cache,
@@ -45521,11 +45557,11 @@ function comparePatternKeys(a, b) {
45521
45557
  if (b.length > a.length) return 1 /* GreaterThan */;
45522
45558
  return 0 /* EqualTo */;
45523
45559
  }
45524
- function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
45525
- const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
45560
+ function loadModuleFromExportsOrImports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
45561
+ const loadModuleFromTargetExportOrImport = getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
45526
45562
  if (!endsWith(moduleName, directorySeparator) && !moduleName.includes("*") && hasProperty(lookupTable, moduleName)) {
45527
45563
  const target = lookupTable[moduleName];
45528
- return loadModuleFromTargetImportOrExport(
45564
+ return loadModuleFromTargetExportOrImport(
45529
45565
  target,
45530
45566
  /*subpath*/
45531
45567
  "",
@@ -45540,7 +45576,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
45540
45576
  const target = lookupTable[potentialTarget];
45541
45577
  const starPos = potentialTarget.indexOf("*");
45542
45578
  const subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
45543
- return loadModuleFromTargetImportOrExport(
45579
+ return loadModuleFromTargetExportOrImport(
45544
45580
  target,
45545
45581
  subpath,
45546
45582
  /*pattern*/
@@ -45550,7 +45586,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
45550
45586
  } else if (endsWith(potentialTarget, "*") && startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
45551
45587
  const target = lookupTable[potentialTarget];
45552
45588
  const subpath = moduleName.substring(potentialTarget.length - 1);
45553
- return loadModuleFromTargetImportOrExport(
45589
+ return loadModuleFromTargetExportOrImport(
45554
45590
  target,
45555
45591
  subpath,
45556
45592
  /*pattern*/
@@ -45560,7 +45596,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
45560
45596
  } else if (startsWith(moduleName, potentialTarget)) {
45561
45597
  const target = lookupTable[potentialTarget];
45562
45598
  const subpath = moduleName.substring(potentialTarget.length);
45563
- return loadModuleFromTargetImportOrExport(
45599
+ return loadModuleFromTargetExportOrImport(
45564
45600
  target,
45565
45601
  subpath,
45566
45602
  /*pattern*/
@@ -45580,9 +45616,9 @@ function hasOneAsterisk(patternKey) {
45580
45616
  const firstStar = patternKey.indexOf("*");
45581
45617
  return firstStar !== -1 && firstStar === patternKey.lastIndexOf("*");
45582
45618
  }
45583
- function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
45584
- return loadModuleFromTargetImportOrExport;
45585
- function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
45619
+ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
45620
+ return loadModuleFromTargetExportOrImport;
45621
+ function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
45586
45622
  if (typeof target === "string") {
45587
45623
  if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
45588
45624
  if (state.traceEnabled) {
@@ -45672,7 +45708,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
45672
45708
  if (condition === "default" || state.conditions.includes(condition) || isApplicableVersionedTypesKey(state.conditions, condition)) {
45673
45709
  traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
45674
45710
  const subTarget = target[condition];
45675
- const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
45711
+ const result = loadModuleFromTargetExportOrImport(subTarget, subpath, pattern, key);
45676
45712
  if (result) {
45677
45713
  traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
45678
45714
  traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
@@ -45697,7 +45733,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
45697
45733
  );
45698
45734
  }
45699
45735
  for (const elem of target) {
45700
- const result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key);
45736
+ const result = loadModuleFromTargetExportOrImport(elem, subpath, pattern, key);
45701
45737
  if (result) {
45702
45738
  return result;
45703
45739
  }
@@ -49593,31 +49629,29 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
49593
49629
  return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
49594
49630
  }
49595
49631
  }
49596
- if (!specifier) {
49597
- const local = getLocalModuleSpecifier(
49598
- modulePath.path,
49599
- info,
49600
- compilerOptions,
49601
- host,
49602
- options.overrideImportMode || importingSourceFile.impliedNodeFormat,
49603
- preferences,
49604
- /*pathsOnly*/
49605
- modulePath.isRedirect
49606
- );
49607
- if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
49608
- continue;
49609
- }
49610
- if (modulePath.isRedirect) {
49611
- redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
49612
- } else if (pathIsBareSpecifier(local)) {
49613
- if (pathContainsNodeModules(local)) {
49614
- relativeSpecifiers = append(relativeSpecifiers, local);
49615
- } else {
49616
- pathsSpecifiers = append(pathsSpecifiers, local);
49617
- }
49618
- } else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
49632
+ const local = getLocalModuleSpecifier(
49633
+ modulePath.path,
49634
+ info,
49635
+ compilerOptions,
49636
+ host,
49637
+ options.overrideImportMode || importingSourceFile.impliedNodeFormat,
49638
+ preferences,
49639
+ /*pathsOnly*/
49640
+ modulePath.isRedirect || !!specifier
49641
+ );
49642
+ if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
49643
+ continue;
49644
+ }
49645
+ if (modulePath.isRedirect) {
49646
+ redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
49647
+ } else if (pathIsBareSpecifier(local)) {
49648
+ if (pathContainsNodeModules(local)) {
49619
49649
  relativeSpecifiers = append(relativeSpecifiers, local);
49650
+ } else {
49651
+ pathsSpecifiers = append(pathsSpecifiers, local);
49620
49652
  }
49653
+ } else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
49654
+ relativeSpecifiers = append(relativeSpecifiers, local);
49621
49655
  }
49622
49656
  }
49623
49657
  return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
@@ -49663,7 +49697,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
49663
49697
  importMode,
49664
49698
  prefersTsExtension(allowedEndings)
49665
49699
  );
49666
- const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
49700
+ const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, baseDirectory, getCanonicalFileName, host, compilerOptions) : void 0;
49667
49701
  if (pathsOnly) {
49668
49702
  return fromPaths;
49669
49703
  }
@@ -49892,10 +49926,11 @@ function tryGetModuleNameFromAmbientModule(moduleSymbol, checker) {
49892
49926
  return ambientModuleDeclare.name.text;
49893
49927
  }
49894
49928
  }
49895
- function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
49929
+ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, baseDirectory, getCanonicalFileName, host, compilerOptions) {
49896
49930
  for (const key in paths) {
49897
49931
  for (const patternText2 of paths[key]) {
49898
- const pattern = normalizePath(patternText2);
49932
+ const normalized = normalizePath(patternText2);
49933
+ const pattern = getRelativePathIfInSameVolume(normalized, baseDirectory, getCanonicalFileName) ?? normalized;
49899
49934
  const indexOfStar = pattern.indexOf("*");
49900
49935
  const candidates = allowedEndings.map((ending) => ({
49901
49936
  ending,
@@ -50224,6 +50259,8 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
50224
50259
  subModuleName,
50225
50260
  versionPaths.paths,
50226
50261
  allowedEndings,
50262
+ packageRootPath,
50263
+ getCanonicalFileName,
50227
50264
  host,
50228
50265
  options
50229
50266
  );
@@ -50519,7 +50556,7 @@ function createTypeChecker(host) {
50519
50556
  var scanner2;
50520
50557
  var Symbol48 = objectAllocator.getSymbolConstructor();
50521
50558
  var Type29 = objectAllocator.getTypeConstructor();
50522
- var Signature14 = objectAllocator.getSignatureConstructor();
50559
+ var Signature13 = objectAllocator.getSignatureConstructor();
50523
50560
  var typeCount = 0;
50524
50561
  var symbolCount = 0;
50525
50562
  var totalInstantiationCount = 0;
@@ -54881,6 +54918,9 @@ function createTypeChecker(host) {
54881
54918
  }
54882
54919
  }
54883
54920
  let annotationType = getTypeFromTypeNodeWithoutContext(existing);
54921
+ if (isErrorType(annotationType)) {
54922
+ return true;
54923
+ }
54884
54924
  if (requiresAddingUndefined && annotationType) {
54885
54925
  annotationType = getOptionalType(annotationType, !isParameter(node));
54886
54926
  }
@@ -55907,7 +55947,7 @@ function createTypeChecker(host) {
55907
55947
  const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */);
55908
55948
  for (const signature of signatures) {
55909
55949
  const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 173 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
55910
- typeElements.push(preserveCommentsOn(methodDeclaration));
55950
+ typeElements.push(preserveCommentsOn(methodDeclaration, signature.declaration || propertySymbol.valueDeclaration));
55911
55951
  }
55912
55952
  if (signatures.length || !optionalToken) {
55913
55953
  return;
@@ -55942,8 +55982,8 @@ function createTypeChecker(host) {
55942
55982
  optionalToken,
55943
55983
  propertyTypeNode
55944
55984
  );
55945
- typeElements.push(preserveCommentsOn(propertySignature));
55946
- function preserveCommentsOn(node) {
55985
+ typeElements.push(preserveCommentsOn(propertySignature, propertySymbol.valueDeclaration));
55986
+ function preserveCommentsOn(node, range) {
55947
55987
  var _a2;
55948
55988
  const jsdocPropertyTag = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 348 /* JSDocPropertyTag */);
55949
55989
  if (jsdocPropertyTag) {
@@ -55951,8 +55991,8 @@ function createTypeChecker(host) {
55951
55991
  if (commentText) {
55952
55992
  setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
55953
55993
  }
55954
- } else if (propertySymbol.valueDeclaration) {
55955
- setCommentRange2(context, node, propertySymbol.valueDeclaration);
55994
+ } else if (range) {
55995
+ setCommentRange2(context, node, range);
55956
55996
  }
55957
55997
  return node;
55958
55998
  }
@@ -60064,7 +60104,7 @@ function createTypeChecker(host) {
60064
60104
  const getter = getDeclarationOfKind(symbol, 177 /* GetAccessor */);
60065
60105
  const setter = getDeclarationOfKind(symbol, 178 /* SetAccessor */);
60066
60106
  const accessor = tryCast(getDeclarationOfKind(symbol, 172 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration);
60067
- let type = getter && isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || getAnnotatedAccessorType(accessor) || getter && getter.body && getReturnTypeFromBody(getter) || accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(
60107
+ let type = getter && isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || getAnnotatedAccessorType(accessor) || getter && getter.body && getReturnTypeFromBody(getter) || accessor && getWidenedTypeForVariableLikeDeclaration(
60068
60108
  accessor,
60069
60109
  /*reportErrors*/
60070
60110
  true
@@ -61163,7 +61203,7 @@ function createTypeChecker(host) {
61163
61203
  resolveObjectTypeMembers(type, source, typeParameters, paddedTypeArguments);
61164
61204
  }
61165
61205
  function createSignature(declaration, typeParameters, thisParameter, parameters, resolvedReturnType, resolvedTypePredicate, minArgumentCount, flags) {
61166
- const sig = new Signature14(checker, flags);
61206
+ const sig = new Signature13(checker, flags);
61167
61207
  sig.declaration = declaration;
61168
61208
  sig.typeParameters = typeParameters;
61169
61209
  sig.parameters = parameters;
@@ -66209,7 +66249,7 @@ function createTypeChecker(host) {
66209
66249
  const links = getNodeLinks(node);
66210
66250
  if (!links.resolvedType) {
66211
66251
  const aliasSymbol = getAliasSymbolForTypeNode(node);
66212
- if (getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) {
66252
+ if (!node.symbol || getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) {
66213
66253
  links.resolvedType = emptyTypeLiteralType;
66214
66254
  } else {
66215
66255
  let type = createObjectType(16 /* Anonymous */, node.symbol);
@@ -87140,7 +87180,7 @@ function createTypeChecker(host) {
87140
87180
  return anyIterationTypes;
87141
87181
  }
87142
87182
  if (!(type.flags & 1048576 /* Union */)) {
87143
- const errorOutputContainer = errorNode ? { errors: void 0 } : void 0;
87183
+ const errorOutputContainer = errorNode ? { errors: void 0, skipLogging: true } : void 0;
87144
87184
  const iterationTypes2 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer);
87145
87185
  if (iterationTypes2 === noIterationTypes) {
87146
87186
  if (errorNode) {
@@ -87308,11 +87348,27 @@ function createTypeChecker(host) {
87308
87348
  if (isTypeAny(methodType)) {
87309
87349
  return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
87310
87350
  }
87311
- const signatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : void 0;
87312
- if (!some(signatures)) {
87351
+ const allSignatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : void 0;
87352
+ const validSignatures = filter(allSignatures, (sig) => getMinArgumentCount(sig) === 0);
87353
+ if (!some(validSignatures)) {
87354
+ if (errorNode && some(allSignatures)) {
87355
+ checkTypeAssignableTo(
87356
+ type,
87357
+ resolver.getGlobalIterableType(
87358
+ /*reportErrors*/
87359
+ true
87360
+ ),
87361
+ errorNode,
87362
+ /*headMessage*/
87363
+ void 0,
87364
+ /*containingMessageChain*/
87365
+ void 0,
87366
+ errorOutputContainer
87367
+ );
87368
+ }
87313
87369
  return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
87314
87370
  }
87315
- const iteratorType = getIntersectionType(map(signatures, getReturnTypeOfSignature));
87371
+ const iteratorType = getIntersectionType(map(validSignatures, getReturnTypeOfSignature));
87316
87372
  const iterationTypes = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache) ?? noIterationTypes;
87317
87373
  return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
87318
87374
  }
@@ -88546,6 +88602,9 @@ function createTypeChecker(host) {
88546
88602
  }
88547
88603
  function checkInterfaceDeclaration(node) {
88548
88604
  if (!checkGrammarModifiers(node)) checkGrammarInterfaceDeclaration(node);
88605
+ if (!allowBlockDeclarations(node.parent)) {
88606
+ grammarErrorOnNode(node, Diagnostics._0_declarations_can_only_be_declared_inside_a_block, "interface");
88607
+ }
88549
88608
  checkTypeParameters(node.typeParameters);
88550
88609
  addLazyDiagnostic(() => {
88551
88610
  checkTypeNameIsReserved(node.name, Diagnostics.Interface_name_cannot_be_0);
@@ -88580,6 +88639,9 @@ function createTypeChecker(host) {
88580
88639
  function checkTypeAliasDeclaration(node) {
88581
88640
  checkGrammarModifiers(node);
88582
88641
  checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
88642
+ if (!allowBlockDeclarations(node.parent)) {
88643
+ grammarErrorOnNode(node, Diagnostics._0_declarations_can_only_be_declared_inside_a_block, "type");
88644
+ }
88583
88645
  checkExportsOnMergedDeclarations(node);
88584
88646
  checkTypeParameters(node.typeParameters);
88585
88647
  if (node.type.kind === 141 /* IntrinsicKeyword */) {
@@ -90966,7 +91028,7 @@ function createTypeChecker(host) {
90966
91028
  const typeNode = getNonlocalEffectiveTypeAnnotationNode(parameter);
90967
91029
  if (!typeNode) return false;
90968
91030
  const type = getTypeFromTypeNode(typeNode);
90969
- return containsUndefinedType(type);
91031
+ return isErrorType(type) || containsUndefinedType(type);
90970
91032
  }
90971
91033
  function requiresAddingImplicitUndefined(parameter, enclosingDeclaration) {
90972
91034
  return (isRequiredInitializedParameter(parameter, enclosingDeclaration) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
@@ -92992,7 +93054,7 @@ function createTypeChecker(host) {
92992
93054
  }
92993
93055
  return false;
92994
93056
  }
92995
- function allowLetAndConstDeclarations(parent2) {
93057
+ function allowBlockDeclarations(parent2) {
92996
93058
  switch (parent2.kind) {
92997
93059
  case 245 /* IfStatement */:
92998
93060
  case 246 /* DoStatement */:
@@ -93003,12 +93065,12 @@ function createTypeChecker(host) {
93003
93065
  case 250 /* ForOfStatement */:
93004
93066
  return false;
93005
93067
  case 256 /* LabeledStatement */:
93006
- return allowLetAndConstDeclarations(parent2.parent);
93068
+ return allowBlockDeclarations(parent2.parent);
93007
93069
  }
93008
93070
  return true;
93009
93071
  }
93010
93072
  function checkGrammarForDisallowedBlockScopedVariableStatement(node) {
93011
- if (!allowLetAndConstDeclarations(node.parent)) {
93073
+ if (!allowBlockDeclarations(node.parent)) {
93012
93074
  const blockScopeKind = getCombinedNodeFlagsCached(node.declarationList) & 7 /* BlockScoped */;
93013
93075
  if (blockScopeKind) {
93014
93076
  const keyword = blockScopeKind === 1 /* Let */ ? "let" : blockScopeKind === 2 /* Const */ ? "const" : blockScopeKind === 4 /* Using */ ? "using" : blockScopeKind === 6 /* AwaitUsing */ ? "await using" : Debug.fail("Unknown BlockScope flag");
@@ -95786,9 +95848,9 @@ function getDecoratorsOfParameters(node) {
95786
95848
  }
95787
95849
  return decorators;
95788
95850
  }
95789
- function getAllDecoratorsOfClass(node) {
95851
+ function getAllDecoratorsOfClass(node, useLegacyDecorators) {
95790
95852
  const decorators = getDecorators(node);
95791
- const parameters = getDecoratorsOfParameters(getFirstConstructorWithBody(node));
95853
+ const parameters = useLegacyDecorators ? getDecoratorsOfParameters(getFirstConstructorWithBody(node)) : void 0;
95792
95854
  if (!some(decorators) && !some(parameters)) {
95793
95855
  return void 0;
95794
95856
  }
@@ -95802,18 +95864,27 @@ function getAllDecoratorsOfClassElement(member, parent2, useLegacyDecorators) {
95802
95864
  case 177 /* GetAccessor */:
95803
95865
  case 178 /* SetAccessor */:
95804
95866
  if (!useLegacyDecorators) {
95805
- return getAllDecoratorsOfMethod(member);
95867
+ return getAllDecoratorsOfMethod(
95868
+ member,
95869
+ /*useLegacyDecorators*/
95870
+ false
95871
+ );
95806
95872
  }
95807
- return getAllDecoratorsOfAccessors(member, parent2);
95873
+ return getAllDecoratorsOfAccessors(
95874
+ member,
95875
+ parent2,
95876
+ /*useLegacyDecorators*/
95877
+ true
95878
+ );
95808
95879
  case 174 /* MethodDeclaration */:
95809
- return getAllDecoratorsOfMethod(member);
95880
+ return getAllDecoratorsOfMethod(member, useLegacyDecorators);
95810
95881
  case 172 /* PropertyDeclaration */:
95811
95882
  return getAllDecoratorsOfProperty(member);
95812
95883
  default:
95813
95884
  return void 0;
95814
95885
  }
95815
95886
  }
95816
- function getAllDecoratorsOfAccessors(accessor, parent2) {
95887
+ function getAllDecoratorsOfAccessors(accessor, parent2, useLegacyDecorators) {
95817
95888
  if (!accessor.body) {
95818
95889
  return void 0;
95819
95890
  }
@@ -95823,7 +95894,7 @@ function getAllDecoratorsOfAccessors(accessor, parent2) {
95823
95894
  return void 0;
95824
95895
  }
95825
95896
  const decorators = getDecorators(firstAccessorWithDecorators);
95826
- const parameters = getDecoratorsOfParameters(setAccessor);
95897
+ const parameters = useLegacyDecorators ? getDecoratorsOfParameters(setAccessor) : void 0;
95827
95898
  if (!some(decorators) && !some(parameters)) {
95828
95899
  return void 0;
95829
95900
  }
@@ -95834,12 +95905,12 @@ function getAllDecoratorsOfAccessors(accessor, parent2) {
95834
95905
  setDecorators: setAccessor && getDecorators(setAccessor)
95835
95906
  };
95836
95907
  }
95837
- function getAllDecoratorsOfMethod(method) {
95908
+ function getAllDecoratorsOfMethod(method, useLegacyDecorators) {
95838
95909
  if (!method.body) {
95839
95910
  return void 0;
95840
95911
  }
95841
95912
  const decorators = getDecorators(method);
95842
- const parameters = getDecoratorsOfParameters(method);
95913
+ const parameters = useLegacyDecorators ? getDecoratorsOfParameters(method) : void 0;
95843
95914
  if (!some(decorators) && !some(parameters)) {
95844
95915
  return void 0;
95845
95916
  }
@@ -101483,7 +101554,11 @@ function transformLegacyDecorators(context) {
101483
101554
  }
101484
101555
  }
101485
101556
  function generateConstructorDecorationExpression(node) {
101486
- const allDecorators = getAllDecoratorsOfClass(node);
101557
+ const allDecorators = getAllDecoratorsOfClass(
101558
+ node,
101559
+ /*useLegacyDecorators*/
101560
+ true
101561
+ );
101487
101562
  const decoratorExpressions = transformAllDecoratorsOfDeclaration(allDecorators);
101488
101563
  if (!decoratorExpressions) {
101489
101564
  return void 0;
@@ -101995,7 +102070,11 @@ function transformESDecorators(context) {
101995
102070
  let syntheticConstructor;
101996
102071
  let heritageClauses;
101997
102072
  let shouldTransformPrivateStaticElementsInClass = false;
101998
- const classDecorators = transformAllDecoratorsOfDeclaration(getAllDecoratorsOfClass(node));
102073
+ const classDecorators = transformAllDecoratorsOfDeclaration(getAllDecoratorsOfClass(
102074
+ node,
102075
+ /*useLegacyDecorators*/
102076
+ false
102077
+ ));
101999
102078
  if (classDecorators) {
102000
102079
  classInfo2.classDecoratorsName = factory2.createUniqueName("_classDecorators", 16 /* Optimistic */ | 32 /* FileLevel */);
102001
102080
  classInfo2.classDescriptorName = factory2.createUniqueName("_classDescriptor", 16 /* Optimistic */ | 32 /* FileLevel */);
@@ -116917,7 +116996,7 @@ function createGetIsolatedDeclarationErrors(resolver) {
116917
116996
  if (!addUndefined && node.initializer) {
116918
116997
  return createExpressionError(node.initializer);
116919
116998
  }
116920
- const message = addUndefined ? Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations : errorByDeclarationKind[node.kind];
116999
+ const message = addUndefined ? Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations : errorByDeclarationKind[node.kind];
116921
117000
  const diag2 = createDiagnosticForNode(node, message);
116922
117001
  const targetStr = getTextOfNode(
116923
117002
  node.name,
@@ -121501,15 +121580,88 @@ function createPrinter(printerOptions = {}, handlers = {}) {
121501
121580
  return false;
121502
121581
  }
121503
121582
  function parenthesizeExpressionForNoAsi(node) {
121504
- if (!commentsDisabled && isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) {
121505
- const parseNode = getParseTreeNode(node);
121506
- if (parseNode && isParenthesizedExpression(parseNode)) {
121507
- const parens = factory.createParenthesizedExpression(node.expression);
121508
- setOriginalNode(parens, node);
121509
- setTextRange(parens, parseNode);
121510
- return parens;
121583
+ if (!commentsDisabled) {
121584
+ switch (node.kind) {
121585
+ case 355 /* PartiallyEmittedExpression */:
121586
+ if (willEmitLeadingNewLine(node)) {
121587
+ const parseNode = getParseTreeNode(node);
121588
+ if (parseNode && isParenthesizedExpression(parseNode)) {
121589
+ const parens = factory.createParenthesizedExpression(node.expression);
121590
+ setOriginalNode(parens, node);
121591
+ setTextRange(parens, parseNode);
121592
+ return parens;
121593
+ }
121594
+ return factory.createParenthesizedExpression(node);
121595
+ }
121596
+ return factory.updatePartiallyEmittedExpression(
121597
+ node,
121598
+ parenthesizeExpressionForNoAsi(node.expression)
121599
+ );
121600
+ case 211 /* PropertyAccessExpression */:
121601
+ return factory.updatePropertyAccessExpression(
121602
+ node,
121603
+ parenthesizeExpressionForNoAsi(node.expression),
121604
+ node.name
121605
+ );
121606
+ case 212 /* ElementAccessExpression */:
121607
+ return factory.updateElementAccessExpression(
121608
+ node,
121609
+ parenthesizeExpressionForNoAsi(node.expression),
121610
+ node.argumentExpression
121611
+ );
121612
+ case 213 /* CallExpression */:
121613
+ return factory.updateCallExpression(
121614
+ node,
121615
+ parenthesizeExpressionForNoAsi(node.expression),
121616
+ node.typeArguments,
121617
+ node.arguments
121618
+ );
121619
+ case 215 /* TaggedTemplateExpression */:
121620
+ return factory.updateTaggedTemplateExpression(
121621
+ node,
121622
+ parenthesizeExpressionForNoAsi(node.tag),
121623
+ node.typeArguments,
121624
+ node.template
121625
+ );
121626
+ case 225 /* PostfixUnaryExpression */:
121627
+ return factory.updatePostfixUnaryExpression(
121628
+ node,
121629
+ parenthesizeExpressionForNoAsi(node.operand)
121630
+ );
121631
+ case 226 /* BinaryExpression */:
121632
+ return factory.updateBinaryExpression(
121633
+ node,
121634
+ parenthesizeExpressionForNoAsi(node.left),
121635
+ node.operatorToken,
121636
+ node.right
121637
+ );
121638
+ case 227 /* ConditionalExpression */:
121639
+ return factory.updateConditionalExpression(
121640
+ node,
121641
+ parenthesizeExpressionForNoAsi(node.condition),
121642
+ node.questionToken,
121643
+ node.whenTrue,
121644
+ node.colonToken,
121645
+ node.whenFalse
121646
+ );
121647
+ case 234 /* AsExpression */:
121648
+ return factory.updateAsExpression(
121649
+ node,
121650
+ parenthesizeExpressionForNoAsi(node.expression),
121651
+ node.type
121652
+ );
121653
+ case 238 /* SatisfiesExpression */:
121654
+ return factory.updateSatisfiesExpression(
121655
+ node,
121656
+ parenthesizeExpressionForNoAsi(node.expression),
121657
+ node.type
121658
+ );
121659
+ case 235 /* NonNullExpression */:
121660
+ return factory.updateNonNullExpression(
121661
+ node,
121662
+ parenthesizeExpressionForNoAsi(node.expression)
121663
+ );
121511
121664
  }
121512
- return factory.createParenthesizedExpression(node);
121513
121665
  }
121514
121666
  return node;
121515
121667
  }
@@ -140349,7 +140501,13 @@ function getDefaultLikeExportNameFromDeclaration(symbol) {
140349
140501
  if (isExportSpecifier(d) && d.symbol.flags === 2097152 /* Alias */) {
140350
140502
  return (_b = tryCast(d.propertyName, isIdentifier)) == null ? void 0 : _b.text;
140351
140503
  }
140352
- return (_c = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _c.text;
140504
+ const name = (_c = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _c.text;
140505
+ if (name) {
140506
+ return name;
140507
+ }
140508
+ if (symbol.parent && !isExternalModuleSymbol(symbol.parent)) {
140509
+ return symbol.parent.getName();
140510
+ }
140353
140511
  });
140354
140512
  }
140355
140513
  function getSymbolParentOrFail(symbol) {
@@ -140940,7 +141098,7 @@ function getExportInfoMap(importingFile, host, program, preferences, cancellatio
140940
141098
  true,
140941
141099
  (moduleSymbol, moduleFile, program2, isFromPackageJson) => {
140942
141100
  if (++moduleCount % 100 === 0) cancellationToken == null ? void 0 : cancellationToken.throwIfCancellationRequested();
140943
- const seenExports = /* @__PURE__ */ new Map();
141101
+ const seenExports = /* @__PURE__ */ new Set();
140944
141102
  const checker = program2.getTypeChecker();
140945
141103
  const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
140946
141104
  if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
@@ -140980,7 +141138,11 @@ function getExportInfoMap(importingFile, host, program, preferences, cancellatio
140980
141138
  }
140981
141139
  function getDefaultLikeExportInfo(moduleSymbol, checker) {
140982
141140
  const exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol);
140983
- if (exportEquals !== moduleSymbol) return { symbol: exportEquals, exportKind: 2 /* ExportEquals */ };
141141
+ if (exportEquals !== moduleSymbol) {
141142
+ const defaultExport2 = checker.tryGetMemberInModuleExports("default" /* Default */, exportEquals);
141143
+ if (defaultExport2) return { symbol: defaultExport2, exportKind: 1 /* Default */ };
141144
+ return { symbol: exportEquals, exportKind: 2 /* ExportEquals */ };
141145
+ }
140984
141146
  const defaultExport = checker.tryGetMemberInModuleExports("default" /* Default */, moduleSymbol);
140985
141147
  if (defaultExport) return { symbol: defaultExport, exportKind: 1 /* Default */ };
140986
141148
  }
@@ -140998,7 +141160,7 @@ function getNamesForExportedSymbol(defaultExport, checker, scriptTarget) {
140998
141160
  function forEachNameOfDefaultExport(defaultExport, checker, scriptTarget, cb) {
140999
141161
  let chain;
141000
141162
  let current = defaultExport;
141001
- const seen = /* @__PURE__ */ new Map();
141163
+ const seen = /* @__PURE__ */ new Set();
141002
141164
  while (current) {
141003
141165
  const fromDeclaration = getDefaultLikeExportNameFromDeclaration(current);
141004
141166
  if (fromDeclaration) {
@@ -144547,6 +144709,7 @@ function isSynthesized(node) {
144547
144709
  return !!(node.flags & 16 /* Synthesized */);
144548
144710
  }
144549
144711
  function isOwnChild(n, parent2) {
144712
+ if (n.parent === void 0) return false;
144550
144713
  const par = isModuleBlock(n.parent) ? n.parent.parent : n.parent;
144551
144714
  return par === parent2.node || contains(parent2.additionalNodes, par);
144552
144715
  }
@@ -145463,7 +145626,7 @@ function flattenTypeLiteralNodeReference(checker, selection) {
145463
145626
  }
145464
145627
  if (isIntersectionTypeNode(selection)) {
145465
145628
  const result = [];
145466
- const seen = /* @__PURE__ */ new Map();
145629
+ const seen = /* @__PURE__ */ new Set();
145467
145630
  for (const type of selection.types) {
145468
145631
  const flattenedTypeMembers = flattenTypeLiteralNodeReference(checker, type);
145469
145632
  if (!flattenedTypeMembers || !flattenedTypeMembers.every((type2) => type2.name && addToSeen(seen, getNameFromPropertyName(type2.name)))) {
@@ -156135,7 +156298,7 @@ registerCodeFix({
156135
156298
  },
156136
156299
  fixIds: [fixId13],
156137
156300
  getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) {
156138
- const fixedExportDeclarations = /* @__PURE__ */ new Map();
156301
+ const fixedExportDeclarations = /* @__PURE__ */ new Set();
156139
156302
  return codeFixAll(context, errorCodes14, (changes, diag2) => {
156140
156303
  const exportSpecifier = getExportSpecifierForDiagnosticSpan(diag2, context.sourceFile);
156141
156304
  if (exportSpecifier && addToSeen(fixedExportDeclarations, getNodeId(exportSpecifier.parent.parent))) {
@@ -156614,7 +156777,7 @@ registerCodeFix({
156614
156777
  },
156615
156778
  fixIds: [fixId17],
156616
156779
  getAllCodeActions(context) {
156617
- const seenClassDeclarations = /* @__PURE__ */ new Map();
156780
+ const seenClassDeclarations = /* @__PURE__ */ new Set();
156618
156781
  return codeFixAll(context, errorCodes18, (changes, diag2) => {
156619
156782
  const classDeclaration = getClass(diag2.file, diag2.start);
156620
156783
  if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
@@ -156995,7 +157158,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
156995
157158
  function writeFixes(changeTracker, oldFileQuotePreference) {
156996
157159
  var _a, _b;
156997
157160
  let quotePreference;
156998
- if (isFullSourceFile(sourceFile) && sourceFile.imports.length === 0 && oldFileQuotePreference !== void 0) {
157161
+ if (sourceFile.imports !== void 0 && sourceFile.imports.length === 0 && oldFileQuotePreference !== void 0) {
156999
157162
  quotePreference = oldFileQuotePreference;
157000
157163
  } else {
157001
157164
  quotePreference = getQuotePreference(sourceFile, preferences);
@@ -158241,7 +158404,7 @@ registerCodeFix({
158241
158404
  fixIds: [fixId18],
158242
158405
  getAllCodeActions: (context) => {
158243
158406
  const { program, preferences, host } = context;
158244
- const seen = /* @__PURE__ */ new Map();
158407
+ const seen = /* @__PURE__ */ new Set();
158245
158408
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
158246
158409
  eachDiagnostic(context, errorCodes20, (diag2) => {
158247
158410
  const info = getInfo6(program, diag2.file, createTextSpan(diag2.start, diag2.length));
@@ -159175,7 +159338,7 @@ registerCodeFix({
159175
159338
  getAllCodeActions: (context) => {
159176
159339
  const { program, fixId: fixId56 } = context;
159177
159340
  const checker = program.getTypeChecker();
159178
- const seen = /* @__PURE__ */ new Map();
159341
+ const seen = /* @__PURE__ */ new Set();
159179
159342
  const typeDeclToMembers = /* @__PURE__ */ new Map();
159180
159343
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
159181
159344
  eachDiagnostic(context, errorCodes28, (diag2) => {
@@ -159226,7 +159389,7 @@ registerCodeFix({
159226
159389
  }
159227
159390
  });
159228
159391
  function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
159229
- var _a;
159392
+ var _a, _b, _c;
159230
159393
  const token = getTokenAtPosition(sourceFile, tokenPos);
159231
159394
  const parent2 = token.parent;
159232
159395
  if (errorCode === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) {
@@ -159239,7 +159402,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
159239
159402
  if (!(param && isParameter(param) && isIdentifier(param.name))) return void 0;
159240
159403
  const properties = arrayFrom(checker.getUnmatchedProperties(
159241
159404
  checker.getTypeAtLocation(parent2),
159242
- checker.getParameterType(signature, argIndex),
159405
+ checker.getParameterType(signature, argIndex).getNonNullableType(),
159243
159406
  /*requireOptionalProperties*/
159244
159407
  false,
159245
159408
  /*matchDiscriminantProperties*/
@@ -159249,7 +159412,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
159249
159412
  return { kind: 3 /* ObjectLiteral */, token: param.name, identifier: param.name.text, properties, parentDeclaration: parent2 };
159250
159413
  }
159251
159414
  if (token.kind === 19 /* OpenBraceToken */ && isObjectLiteralExpression(parent2)) {
159252
- const targetType = checker.getContextualType(parent2) || checker.getTypeAtLocation(parent2);
159415
+ const targetType = (_a = checker.getContextualType(parent2) || checker.getTypeAtLocation(parent2)) == null ? void 0 : _a.getNonNullableType();
159253
159416
  const properties = arrayFrom(checker.getUnmatchedProperties(
159254
159417
  checker.getTypeAtLocation(parent2),
159255
159418
  targetType,
@@ -159264,7 +159427,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
159264
159427
  }
159265
159428
  if (!isMemberName(token)) return void 0;
159266
159429
  if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
159267
- const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token);
159430
+ const targetType = (_b = checker.getContextualType(token) || checker.getTypeAtLocation(token)) == null ? void 0 : _b.getNonNullableType();
159268
159431
  const properties = arrayFrom(checker.getUnmatchedProperties(
159269
159432
  checker.getTypeAtLocation(parent2.initializer),
159270
159433
  targetType,
@@ -159283,7 +159446,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
159283
159446
  return { kind: 4 /* JsxAttributes */, token, attributes, parentDeclaration: token.parent };
159284
159447
  }
159285
159448
  if (isIdentifier(token)) {
159286
- const type = (_a = checker.getContextualType(token)) == null ? void 0 : _a.getNonNullableType();
159449
+ const type = (_c = checker.getContextualType(token)) == null ? void 0 : _c.getNonNullableType();
159287
159450
  if (type && getObjectFlags(type) & 16 /* Anonymous */) {
159288
159451
  const signature = firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
159289
159452
  if (signature === void 0) return void 0;
@@ -159604,8 +159767,9 @@ function tryGetValueFromType(context, checker, importAdder, quotePreference, typ
159604
159767
  }
159605
159768
  if (type.flags & 1056 /* EnumLike */) {
159606
159769
  const enumMember = type.symbol.exports ? firstOrUndefinedIterator(type.symbol.exports.values()) : type.symbol;
159770
+ const symbol = type.symbol.parent && type.symbol.parent.flags & 256 /* RegularEnum */ ? type.symbol.parent : type.symbol;
159607
159771
  const name = checker.symbolToExpression(
159608
- type.symbol.parent ? type.symbol.parent : type.symbol,
159772
+ symbol,
159609
159773
  111551 /* Value */,
159610
159774
  /*enclosingDeclaration*/
159611
159775
  void 0,
@@ -160099,7 +160263,7 @@ registerCodeFix({
160099
160263
  },
160100
160264
  fixIds: [fixId26],
160101
160265
  getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
160102
- const seenClassDeclarations = /* @__PURE__ */ new Map();
160266
+ const seenClassDeclarations = /* @__PURE__ */ new Set();
160103
160267
  return codeFixAll(context, errorCodes32, (changes, diag2) => {
160104
160268
  const classDeclaration = getClass2(diag2.file, diag2.start);
160105
160269
  if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
@@ -160142,7 +160306,7 @@ registerCodeFix({
160142
160306
  fixIds: [fixId27],
160143
160307
  getAllCodeActions(context) {
160144
160308
  const { sourceFile } = context;
160145
- const seenClasses = /* @__PURE__ */ new Map();
160309
+ const seenClasses = /* @__PURE__ */ new Set();
160146
160310
  return codeFixAll(context, errorCodes33, (changes, diag2) => {
160147
160311
  const nodes = getNodes(diag2.file, diag2.start);
160148
160312
  if (!nodes) return;
@@ -161194,7 +161358,7 @@ var errorCodes48 = [
161194
161358
  Diagnostics.Default_exports_can_t_be_inferred_with_isolatedDeclarations.code,
161195
161359
  Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations.code,
161196
161360
  Diagnostics.Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function.code,
161197
- Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations.code,
161361
+ Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations.code,
161198
161362
  Diagnostics.Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations.code,
161199
161363
  Diagnostics.Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit.code
161200
161364
  ];
@@ -162086,7 +162250,7 @@ registerCodeFix({
162086
162250
  },
162087
162251
  fixIds: [fixId38],
162088
162252
  getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
162089
- const seen = /* @__PURE__ */ new Map();
162253
+ const seen = /* @__PURE__ */ new Set();
162090
162254
  return codeFixAll(context, errorCodes49, (changes, diag2) => {
162091
162255
  const nodes = getNodes3(diag2.file, diag2.start);
162092
162256
  if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore))) return;
@@ -164952,7 +165116,7 @@ registerCodeFix({
164952
165116
  },
164953
165117
  getAllCodeActions: (context) => {
164954
165118
  const { program } = context;
164955
- const seen = /* @__PURE__ */ new Map();
165119
+ const seen = /* @__PURE__ */ new Set();
164956
165120
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
164957
165121
  eachDiagnostic(context, errorCodes65, (diag2) => {
164958
165122
  const info = getInfo21(diag2.file, diag2.start, program);
@@ -167391,7 +167555,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
167391
167555
  let importSpecifierResolver;
167392
167556
  const symbolToOriginInfoMap = [];
167393
167557
  const symbolToSortTextMap = [];
167394
- const seenPropertySymbols = /* @__PURE__ */ new Map();
167558
+ const seenPropertySymbols = /* @__PURE__ */ new Set();
167395
167559
  const isTypeOnlyLocation = isTypeOnlyCompletion();
167396
167560
  const getModuleSpecifierResolutionHost = memoizeOne((isFromPackageJson) => {
167397
167561
  return createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host);
@@ -169155,10 +169319,10 @@ function isArrowFunctionBody(node) {
169155
169319
  return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
169156
169320
  node.kind === 39 /* EqualsGreaterThanToken */);
169157
169321
  }
169158
- function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules = /* @__PURE__ */ new Map()) {
169322
+ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules = /* @__PURE__ */ new Set()) {
169159
169323
  return nonAliasCanBeReferencedAtTypeLocation(symbol) || nonAliasCanBeReferencedAtTypeLocation(skipAlias(symbol.exportSymbol || symbol, checker));
169160
169324
  function nonAliasCanBeReferencedAtTypeLocation(symbol2) {
169161
- return !!(symbol2.flags & 788968 /* Type */) || checker.isUnknownSymbol(symbol2) || !!(symbol2.flags & 1536 /* Module */) && addToSeen(seenModules, getSymbolId(symbol2)) && checker.getExportsOfModule(symbol2).some((e) => symbolCanBeReferencedAtTypeLocation(e, checker, seenModules));
169325
+ return !!(symbol2.flags & 788968 /* Type */) || checker.isUnknownSymbol(symbol2) || !!(symbol2.flags & 1536 /* Module */) && addToSeen(seenModules, symbol2) && checker.getExportsOfModule(symbol2).some((e) => symbolCanBeReferencedAtTypeLocation(e, checker, seenModules));
169162
169326
  }
169163
169327
  }
169164
169328
  function isDeprecated(symbol, checker) {
@@ -169230,7 +169394,7 @@ function createNameAndKindSet() {
169230
169394
  }
169231
169395
  function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
169232
169396
  if (isInReferenceComment(sourceFile, position)) {
169233
- const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host);
169397
+ const entries = getTripleSlashReferenceCompletion(sourceFile, position, program, host, createModuleSpecifierResolutionHost(program, host));
169234
169398
  return entries && convertPathCompletions(entries);
169235
169399
  }
169236
169400
  if (isInString(sourceFile, position, contextToken)) {
@@ -169503,7 +169667,7 @@ function getAlreadyUsedTypesInStringLiteralUnion(union, current) {
169503
169667
  }
169504
169668
  function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, checker) {
169505
169669
  let isNewIdentifier = false;
169506
- const uniques = /* @__PURE__ */ new Map();
169670
+ const uniques = /* @__PURE__ */ new Set();
169507
169671
  const editingArgument = isJsxOpeningLikeElement(call) ? Debug.checkDefined(findAncestor(arg.parent, isJsxAttribute)) : arg;
169508
169672
  const candidates = checker.getCandidateSignaturesForStringLiteralCompletions(call, editingArgument);
169509
169673
  const types = flatMap(candidates, (candidate) => {
@@ -169543,7 +169707,7 @@ function stringLiteralCompletionsForObjectLiteral(checker, objectLiteralExpressi
169543
169707
  hasIndexSignature: hasIndexSignature(contextualType)
169544
169708
  };
169545
169709
  }
169546
- function getStringLiteralTypes(type, uniques = /* @__PURE__ */ new Map()) {
169710
+ function getStringLiteralTypes(type, uniques = /* @__PURE__ */ new Set()) {
169547
169711
  if (!type) return emptyArray;
169548
169712
  type = skipConstraint(type);
169549
169713
  return type.isUnion() ? flatMap(type.types, (t) => getStringLiteralTypes(t, uniques)) : type.isStringLiteral() && !(type.flags & 1024 /* EnumLiteral */) && addToSeen(uniques, type.value) ? [type] : emptyArray;
@@ -169574,8 +169738,9 @@ function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, prog
169574
169738
  const scriptDirectory = getDirectoryPath(scriptPath);
169575
169739
  const compilerOptions = program.getCompilerOptions();
169576
169740
  const typeChecker = program.getTypeChecker();
169741
+ const moduleSpecifierResolutionHost = createModuleSpecifierResolutionHost(program, host);
169577
169742
  const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
169578
- 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);
169743
+ return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, moduleSpecifierResolutionHost, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, program, host, moduleSpecifierResolutionHost, extensionOptions);
169579
169744
  }
169580
169745
  function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) {
169581
169746
  return {
@@ -169586,7 +169751,7 @@ function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile
169586
169751
  resolutionMode
169587
169752
  };
169588
169753
  }
169589
- function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, scriptPath, extensionOptions) {
169754
+ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, program, host, moduleSpecifierResolutionHost, scriptPath, extensionOptions) {
169590
169755
  const compilerOptions = program.getCompilerOptions();
169591
169756
  if (compilerOptions.rootDirs) {
169592
169757
  return getCompletionEntriesForDirectoryFragmentWithRootDirs(
@@ -169596,6 +169761,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, p
169596
169761
  extensionOptions,
169597
169762
  program,
169598
169763
  host,
169764
+ moduleSpecifierResolutionHost,
169599
169765
  scriptPath
169600
169766
  );
169601
169767
  } else {
@@ -169605,6 +169771,7 @@ function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, p
169605
169771
  extensionOptions,
169606
169772
  program,
169607
169773
  host,
169774
+ moduleSpecifierResolutionHost,
169608
169775
  /*moduleSpecifierIsRelative*/
169609
169776
  true,
169610
169777
  scriptPath
@@ -169630,7 +169797,7 @@ function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ign
169630
169797
  compareStringsCaseSensitive
169631
169798
  );
169632
169799
  }
169633
- function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, exclude) {
169800
+ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierResolutionHost, exclude) {
169634
169801
  const compilerOptions = program.getCompilerOptions();
169635
169802
  const basePath = compilerOptions.project || host.getCurrentDirectory();
169636
169803
  const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
@@ -169642,6 +169809,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
169642
169809
  extensionOptions,
169643
169810
  program,
169644
169811
  host,
169812
+ moduleSpecifierResolutionHost,
169645
169813
  /*moduleSpecifierIsRelative*/
169646
169814
  true,
169647
169815
  exclude
@@ -169649,7 +169817,7 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
169649
169817
  (itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
169650
169818
  );
169651
169819
  }
169652
- function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
169820
+ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, program, host, moduleSpecifierResolutionHost, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
169653
169821
  var _a;
169654
169822
  if (fragment === void 0) {
169655
169823
  fragment = "";
@@ -169674,7 +169842,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
169674
169842
  if (versionPaths) {
169675
169843
  const packageDirectory = getDirectoryPath(packageJsonPath);
169676
169844
  const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length);
169677
- if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, versionPaths)) {
169845
+ if (addCompletionEntriesFromPaths(result, pathInPackage, packageDirectory, extensionOptions, program, host, moduleSpecifierResolutionHost, versionPaths)) {
169678
169846
  return result;
169679
169847
  }
169680
169848
  }
@@ -169702,7 +169870,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
169702
169870
  getBaseFileName(filePath),
169703
169871
  program,
169704
169872
  extensionOptions,
169705
- /*isExportsWildcard*/
169873
+ /*isExportsOrImportsWildcard*/
169706
169874
  false
169707
169875
  );
169708
169876
  result.add(nameAndKind(name, "script" /* scriptElement */, extension));
@@ -169719,7 +169887,7 @@ function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, ext
169719
169887
  }
169720
169888
  return result;
169721
169889
  }
169722
- function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsWildcard) {
169890
+ function getFilenameWithExtensionOption(name, program, extensionOptions, isExportsOrImportsWildcard) {
169723
169891
  const nonJsResult = ts_moduleSpecifiers_exports.tryGetRealFileNameForNonJsDeclarationFileName(name);
169724
169892
  if (nonJsResult) {
169725
169893
  return { name: nonJsResult, extension: tryGetExtensionFromPath2(nonJsResult) };
@@ -169733,7 +169901,7 @@ function getFilenameWithExtensionOption(name, program, extensionOptions, isExpor
169733
169901
  program.getCompilerOptions(),
169734
169902
  extensionOptions.importingSourceFile
169735
169903
  ).getAllowedEndingsInPreferredOrder(extensionOptions.resolutionMode);
169736
- if (isExportsWildcard) {
169904
+ if (isExportsOrImportsWildcard) {
169737
169905
  allowedEndings = allowedEndings.filter((e) => e !== 0 /* Minimal */ && e !== 1 /* Index */);
169738
169906
  }
169739
169907
  if (allowedEndings[0] === 3 /* TsExtension */) {
@@ -169743,13 +169911,13 @@ function getFilenameWithExtensionOption(name, program, extensionOptions, isExpor
169743
169911
  const outputExtension2 = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
169744
169912
  return outputExtension2 ? { name: changeExtension(name, outputExtension2), extension: outputExtension2 } : { name, extension: tryGetExtensionFromPath2(name) };
169745
169913
  }
169746
- if (!isExportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
169914
+ if (!isExportsOrImportsWildcard && (allowedEndings[0] === 0 /* Minimal */ || allowedEndings[0] === 1 /* Index */) && fileExtensionIsOneOf(name, [".js" /* Js */, ".jsx" /* Jsx */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */])) {
169747
169915
  return { name: removeFileExtension(name), extension: tryGetExtensionFromPath2(name) };
169748
169916
  }
169749
169917
  const outputExtension = ts_moduleSpecifiers_exports.tryGetJSExtensionForFile(name, program.getCompilerOptions());
169750
169918
  return outputExtension ? { name: changeExtension(name, outputExtension), extension: outputExtension } : { name, extension: tryGetExtensionFromPath2(name) };
169751
169919
  }
169752
- function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, paths) {
169920
+ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensionOptions, program, host, moduleSpecifierResolutionHost, paths) {
169753
169921
  const getPatternsForKey = (key) => paths[key];
169754
169922
  const comparePaths2 = (a, b) => {
169755
169923
  const patternA = tryParsePattern(a);
@@ -169758,40 +169926,43 @@ function addCompletionEntriesFromPaths(result, fragment, baseDirectory, extensio
169758
169926
  const lengthB = typeof patternB === "object" ? patternB.prefix.length : b.length;
169759
169927
  return compareValues(lengthB, lengthA);
169760
169928
  };
169761
- return addCompletionEntriesFromPathsOrExports(
169929
+ return addCompletionEntriesFromPathsOrExportsOrImports(
169762
169930
  result,
169763
169931
  /*isExports*/
169764
169932
  false,
169933
+ /*isImports*/
169934
+ false,
169765
169935
  fragment,
169766
169936
  baseDirectory,
169767
169937
  extensionOptions,
169768
169938
  program,
169769
169939
  host,
169940
+ moduleSpecifierResolutionHost,
169770
169941
  getOwnKeys(paths),
169771
169942
  getPatternsForKey,
169772
169943
  comparePaths2
169773
169944
  );
169774
169945
  }
169775
- function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, baseDirectory, extensionOptions, program, host, keys, getPatternsForKey, comparePaths2) {
169946
+ function addCompletionEntriesFromPathsOrExportsOrImports(result, isExports, isImports, fragment, baseDirectory, extensionOptions, program, host, moduleSpecifierResolutionHost, keys, getPatternsForKey, comparePaths2) {
169776
169947
  let pathResults = [];
169777
169948
  let matchedPath;
169778
169949
  for (const key of keys) {
169779
169950
  if (key === ".") continue;
169780
- const keyWithoutLeadingDotSlash = key.replace(/^\.\//, "");
169951
+ const keyWithoutLeadingDotSlash = key.replace(/^\.\//, "") + ((isExports || isImports) && endsWith(key, "/") ? "*" : "");
169781
169952
  const patterns = getPatternsForKey(key);
169782
169953
  if (patterns) {
169783
169954
  const pathPattern = tryParsePattern(keyWithoutLeadingDotSlash);
169784
169955
  if (!pathPattern) continue;
169785
169956
  const isMatch = typeof pathPattern === "object" && isPatternMatch(pathPattern, fragment);
169786
- const isLongestMatch = isMatch && (matchedPath === void 0 || comparePaths2(key, matchedPath) === -1 /* LessThan */);
169957
+ const isLongestMatch = isMatch && (matchedPath === void 0 || comparePaths2(keyWithoutLeadingDotSlash, matchedPath) === -1 /* LessThan */);
169787
169958
  if (isLongestMatch) {
169788
- matchedPath = key;
169959
+ matchedPath = keyWithoutLeadingDotSlash;
169789
169960
  pathResults = pathResults.filter((r) => !r.matchedPattern);
169790
169961
  }
169791
- if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(key, matchedPath) !== 1 /* GreaterThan */) {
169962
+ if (typeof pathPattern === "string" || matchedPath === void 0 || comparePaths2(keyWithoutLeadingDotSlash, matchedPath) !== 1 /* GreaterThan */) {
169792
169963
  pathResults.push({
169793
169964
  matchedPattern: isMatch,
169794
- results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports && isMatch, program, host).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
169965
+ results: getCompletionsForPathMapping(keyWithoutLeadingDotSlash, patterns, fragment, baseDirectory, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost).map(({ name, kind, extension }) => nameAndKind(name, kind, extension))
169795
169966
  });
169796
169967
  }
169797
169968
  }
@@ -169799,7 +169970,7 @@ function addCompletionEntriesFromPathsOrExports(result, isExports, fragment, bas
169799
169970
  pathResults.forEach((pathResult) => pathResult.results.forEach((r) => result.add(r)));
169800
169971
  return matchedPath !== void 0;
169801
169972
  }
169802
- function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, extensionOptions) {
169973
+ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, program, host, moduleSpecifierResolutionHost, extensionOptions) {
169803
169974
  const typeChecker = program.getTypeChecker();
169804
169975
  const compilerOptions = program.getCompilerOptions();
169805
169976
  const { baseUrl, paths } = compilerOptions;
@@ -169813,6 +169984,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
169813
169984
  extensionOptions,
169814
169985
  program,
169815
169986
  host,
169987
+ moduleSpecifierResolutionHost,
169816
169988
  /*moduleSpecifierIsRelative*/
169817
169989
  false,
169818
169990
  /*exclude*/
@@ -169822,7 +169994,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
169822
169994
  }
169823
169995
  if (paths) {
169824
169996
  const absolute = getPathsBasePath(compilerOptions, host);
169825
- addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, paths);
169997
+ addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, program, host, moduleSpecifierResolutionHost, paths);
169826
169998
  }
169827
169999
  const fragmentDirectory = getFragmentDirectory(fragment);
169828
170000
  for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) {
@@ -169833,7 +170005,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
169833
170005
  void 0
169834
170006
  ));
169835
170007
  }
169836
- getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result);
170008
+ getCompletionEntriesFromTypings(program, host, moduleSpecifierResolutionHost, scriptPath, fragmentDirectory, extensionOptions, result);
169837
170009
  if (moduleResolutionUsesNodeModules(moduleResolution)) {
169838
170010
  let foundGlobal = false;
169839
170011
  if (fragmentDirectory === void 0) {
@@ -169851,6 +170023,26 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
169851
170023
  }
169852
170024
  }
169853
170025
  if (!foundGlobal) {
170026
+ const resolvePackageJsonExports = getResolvePackageJsonExports(compilerOptions);
170027
+ const resolvePackageJsonImports = getResolvePackageJsonImports(compilerOptions);
170028
+ let seenPackageScope = false;
170029
+ const importsLookup = (directory) => {
170030
+ if (resolvePackageJsonImports && !seenPackageScope) {
170031
+ const packageFile = combinePaths(directory, "package.json");
170032
+ if (seenPackageScope = tryFileExists(host, packageFile)) {
170033
+ const packageJson = readJson(packageFile, host);
170034
+ exportsOrImportsLookup(
170035
+ packageJson.imports,
170036
+ fragment,
170037
+ directory,
170038
+ /*isExports*/
170039
+ false,
170040
+ /*isImports*/
170041
+ true
170042
+ );
170043
+ }
170044
+ }
170045
+ };
169854
170046
  let ancestorLookup = (ancestor) => {
169855
170047
  const nodeModules = combinePaths(ancestor, "node_modules");
169856
170048
  if (tryDirectoryExists(host, nodeModules)) {
@@ -169860,6 +170052,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
169860
170052
  extensionOptions,
169861
170053
  program,
169862
170054
  host,
170055
+ moduleSpecifierResolutionHost,
169863
170056
  /*moduleSpecifierIsRelative*/
169864
170057
  false,
169865
170058
  /*exclude*/
@@ -169867,58 +170060,77 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p
169867
170060
  result
169868
170061
  );
169869
170062
  }
170063
+ importsLookup(ancestor);
169870
170064
  };
169871
- if (fragmentDirectory && getResolvePackageJsonExports(compilerOptions)) {
169872
- const nodeModulesDirectoryLookup = ancestorLookup;
170065
+ if (fragmentDirectory && resolvePackageJsonExports) {
170066
+ const nodeModulesDirectoryOrImportsLookup = ancestorLookup;
169873
170067
  ancestorLookup = (ancestor) => {
169874
170068
  const components = getPathComponents(fragment);
169875
170069
  components.shift();
169876
170070
  let packagePath = components.shift();
169877
170071
  if (!packagePath) {
169878
- return nodeModulesDirectoryLookup(ancestor);
170072
+ return nodeModulesDirectoryOrImportsLookup(ancestor);
169879
170073
  }
169880
170074
  if (startsWith(packagePath, "@")) {
169881
170075
  const subName = components.shift();
169882
170076
  if (!subName) {
169883
- return nodeModulesDirectoryLookup(ancestor);
170077
+ return nodeModulesDirectoryOrImportsLookup(ancestor);
169884
170078
  }
169885
170079
  packagePath = combinePaths(packagePath, subName);
169886
170080
  }
170081
+ if (resolvePackageJsonImports && startsWith(packagePath, "#")) {
170082
+ return importsLookup(ancestor);
170083
+ }
169887
170084
  const packageDirectory = combinePaths(ancestor, "node_modules", packagePath);
169888
170085
  const packageFile = combinePaths(packageDirectory, "package.json");
169889
170086
  if (tryFileExists(host, packageFile)) {
169890
170087
  const packageJson = readJson(packageFile, host);
169891
- const exports2 = packageJson.exports;
169892
- if (exports2) {
169893
- if (typeof exports2 !== "object" || exports2 === null) {
169894
- return;
169895
- }
169896
- const keys = getOwnKeys(exports2);
169897
- const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
169898
- const conditions = getConditions(compilerOptions, mode);
169899
- addCompletionEntriesFromPathsOrExports(
169900
- result,
169901
- /*isExports*/
169902
- true,
169903
- fragmentSubpath,
169904
- packageDirectory,
169905
- extensionOptions,
169906
- program,
169907
- host,
169908
- keys,
169909
- (key) => singleElementArray(getPatternFromFirstMatchingCondition(exports2[key], conditions)),
169910
- comparePatternKeys
169911
- );
169912
- return;
169913
- }
170088
+ const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
170089
+ exportsOrImportsLookup(
170090
+ packageJson.exports,
170091
+ fragmentSubpath,
170092
+ packageDirectory,
170093
+ /*isExports*/
170094
+ true,
170095
+ /*isImports*/
170096
+ false
170097
+ );
170098
+ return;
169914
170099
  }
169915
- return nodeModulesDirectoryLookup(ancestor);
170100
+ return nodeModulesDirectoryOrImportsLookup(ancestor);
169916
170101
  };
169917
170102
  }
169918
170103
  forEachAncestorDirectoryStoppingAtGlobalCache(host, scriptPath, ancestorLookup);
169919
170104
  }
169920
170105
  }
169921
170106
  return arrayFrom(result.values());
170107
+ function exportsOrImportsLookup(lookupTable, fragment2, baseDirectory, isExports, isImports) {
170108
+ if (typeof lookupTable !== "object" || lookupTable === null) {
170109
+ return;
170110
+ }
170111
+ const keys = getOwnKeys(lookupTable);
170112
+ const conditions = getConditions(compilerOptions, mode);
170113
+ addCompletionEntriesFromPathsOrExportsOrImports(
170114
+ result,
170115
+ isExports,
170116
+ isImports,
170117
+ fragment2,
170118
+ baseDirectory,
170119
+ extensionOptions,
170120
+ program,
170121
+ host,
170122
+ moduleSpecifierResolutionHost,
170123
+ keys,
170124
+ (key) => {
170125
+ const pattern = getPatternFromFirstMatchingCondition(lookupTable[key], conditions);
170126
+ if (pattern === void 0) {
170127
+ return void 0;
170128
+ }
170129
+ return singleElementArray(endsWith(key, "/") && endsWith(pattern, "/") ? pattern + "*" : pattern);
170130
+ },
170131
+ comparePatternKeys
170132
+ );
170133
+ }
169922
170134
  }
169923
170135
  function getPatternFromFirstMatchingCondition(target, conditions) {
169924
170136
  if (typeof target === "string") {
@@ -169936,25 +170148,28 @@ function getPatternFromFirstMatchingCondition(target, conditions) {
169936
170148
  function getFragmentDirectory(fragment) {
169937
170149
  return containsSlash(fragment) ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
169938
170150
  }
169939
- function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExportsWildcard, program, host) {
169940
- if (!endsWith(path, "*")) {
169941
- return !path.includes("*") ? justPathMappingName(path, "script" /* scriptElement */) : emptyArray;
170151
+ function getCompletionsForPathMapping(path, patterns, fragment, packageDirectory, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost) {
170152
+ const parsedPath = tryParsePattern(path);
170153
+ if (!parsedPath) {
170154
+ return emptyArray;
170155
+ }
170156
+ if (typeof parsedPath === "string") {
170157
+ return justPathMappingName(path, "script" /* scriptElement */);
169942
170158
  }
169943
- const pathPrefix = path.slice(0, path.length - 1);
169944
- const remainingFragment = tryRemovePrefix(fragment, pathPrefix);
170159
+ const remainingFragment = tryRemovePrefix(fragment, parsedPath.prefix);
169945
170160
  if (remainingFragment === void 0) {
169946
- const starIsFullPathComponent = path[path.length - 2] === "/";
169947
- return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
170161
+ const starIsFullPathComponent = endsWith(path, "/*");
170162
+ return starIsFullPathComponent ? justPathMappingName(parsedPath.prefix, "directory" /* directory */) : flatMap(patterns, (pattern) => {
169948
170163
  var _a;
169949
- return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest }));
170164
+ return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: parsedPath.prefix + name + parsedPath.suffix, ...rest }));
169950
170165
  });
169951
170166
  }
169952
- return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host));
170167
+ return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost));
169953
170168
  function justPathMappingName(name, kind) {
169954
170169
  return startsWith(name, fragment) ? [{ name: removeTrailingDirectorySeparator(name), kind, extension: void 0 }] : emptyArray;
169955
170170
  }
169956
170171
  }
169957
- function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExportsWildcard, program, host) {
170172
+ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensionOptions, isExports, isImports, program, host, moduleSpecifierResolutionHost) {
169958
170173
  if (!host.readDirectory) {
169959
170174
  return void 0;
169960
170175
  }
@@ -169967,35 +170182,67 @@ function getModulesForPathsPattern(fragment, packageDirectory, pattern, extensio
169967
170182
  const normalizedPrefixBase = hasTrailingDirectorySeparator(parsed.prefix) ? "" : getBaseFileName(normalizedPrefix);
169968
170183
  const fragmentHasPath = containsSlash(fragment);
169969
170184
  const fragmentDirectory = fragmentHasPath ? hasTrailingDirectorySeparator(fragment) ? fragment : getDirectoryPath(fragment) : void 0;
170185
+ const getCommonSourceDirectory2 = () => moduleSpecifierResolutionHost.getCommonSourceDirectory();
170186
+ const ignoreCase = !hostUsesCaseSensitiveFileNames(moduleSpecifierResolutionHost);
170187
+ const outDir = program.getCompilerOptions().outDir;
170188
+ const declarationDir = program.getCompilerOptions().declarationDir;
169970
170189
  const expandedPrefixDirectory = fragmentHasPath ? combinePaths(normalizedPrefixDirectory, normalizedPrefixBase + fragmentDirectory) : normalizedPrefixDirectory;
170190
+ const baseDirectory = normalizePath(combinePaths(packageDirectory, expandedPrefixDirectory));
170191
+ const possibleInputBaseDirectoryForOutDir = isImports && outDir && getPossibleOriginalInputPathWithoutChangingExt(baseDirectory, ignoreCase, outDir, getCommonSourceDirectory2);
170192
+ const possibleInputBaseDirectoryForDeclarationDir = isImports && declarationDir && getPossibleOriginalInputPathWithoutChangingExt(baseDirectory, ignoreCase, declarationDir, getCommonSourceDirectory2);
169971
170193
  const normalizedSuffix = normalizePath(parsed.suffix);
169972
170194
  const declarationExtension = normalizedSuffix && getDeclarationEmitExtensionForPath("_" + normalizedSuffix);
169973
- const matchingSuffixes = declarationExtension ? [changeExtension(normalizedSuffix, declarationExtension), normalizedSuffix] : [normalizedSuffix];
169974
- const baseDirectory = normalizePath(combinePaths(packageDirectory, expandedPrefixDirectory));
169975
- const completePrefix = fragmentHasPath ? baseDirectory : ensureTrailingDirectorySeparator(baseDirectory) + normalizedPrefixBase;
170195
+ const inputExtension = normalizedSuffix ? getPossibleOriginalInputExtensionForExtension("_" + normalizedSuffix) : void 0;
170196
+ const matchingSuffixes = [
170197
+ declarationExtension && changeExtension(normalizedSuffix, declarationExtension),
170198
+ ...inputExtension ? inputExtension.map((ext) => changeExtension(normalizedSuffix, ext)) : [],
170199
+ normalizedSuffix
170200
+ ].filter(isString);
169976
170201
  const includeGlobs = normalizedSuffix ? matchingSuffixes.map((suffix) => "**/*" + suffix) : ["./*"];
169977
- const matches = mapDefined(tryReadDirectory(
169978
- host,
169979
- baseDirectory,
169980
- extensionOptions.extensionsToSearch,
169981
- /*exclude*/
169982
- void 0,
169983
- includeGlobs
169984
- ), (match) => {
169985
- const trimmedWithPattern = trimPrefixAndSuffix(match);
169986
- if (trimmedWithPattern) {
169987
- if (containsSlash(trimmedWithPattern)) {
169988
- return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
169989
- }
169990
- const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsWildcard);
169991
- return nameAndKind(name, "script" /* scriptElement */, extension);
170202
+ const isExportsOrImportsWildcard = (isExports || isImports) && endsWith(pattern, "/*");
170203
+ let matches = getMatchesWithPrefix(baseDirectory);
170204
+ if (possibleInputBaseDirectoryForOutDir) {
170205
+ matches = concatenate(matches, getMatchesWithPrefix(possibleInputBaseDirectoryForOutDir));
170206
+ }
170207
+ if (possibleInputBaseDirectoryForDeclarationDir) {
170208
+ matches = concatenate(matches, getMatchesWithPrefix(possibleInputBaseDirectoryForDeclarationDir));
170209
+ }
170210
+ if (!normalizedSuffix) {
170211
+ matches = concatenate(matches, getDirectoryMatches(baseDirectory));
170212
+ if (possibleInputBaseDirectoryForOutDir) {
170213
+ matches = concatenate(matches, getDirectoryMatches(possibleInputBaseDirectoryForOutDir));
169992
170214
  }
169993
- });
169994
- const directories = normalizedSuffix ? emptyArray : mapDefined(tryGetDirectories(host, baseDirectory), (dir) => dir === "node_modules" ? void 0 : directoryResult(dir));
169995
- return [...matches, ...directories];
169996
- function trimPrefixAndSuffix(path) {
170215
+ if (possibleInputBaseDirectoryForDeclarationDir) {
170216
+ matches = concatenate(matches, getDirectoryMatches(possibleInputBaseDirectoryForDeclarationDir));
170217
+ }
170218
+ }
170219
+ return matches;
170220
+ function getMatchesWithPrefix(directory) {
170221
+ const completePrefix = fragmentHasPath ? directory : ensureTrailingDirectorySeparator(directory) + normalizedPrefixBase;
170222
+ return mapDefined(tryReadDirectory(
170223
+ host,
170224
+ directory,
170225
+ extensionOptions.extensionsToSearch,
170226
+ /*exclude*/
170227
+ void 0,
170228
+ includeGlobs
170229
+ ), (match) => {
170230
+ const trimmedWithPattern = trimPrefixAndSuffix(match, completePrefix);
170231
+ if (trimmedWithPattern) {
170232
+ if (containsSlash(trimmedWithPattern)) {
170233
+ return directoryResult(getPathComponents(removeLeadingDirectorySeparator(trimmedWithPattern))[1]);
170234
+ }
170235
+ const { name, extension } = getFilenameWithExtensionOption(trimmedWithPattern, program, extensionOptions, isExportsOrImportsWildcard);
170236
+ return nameAndKind(name, "script" /* scriptElement */, extension);
170237
+ }
170238
+ });
170239
+ }
170240
+ function getDirectoryMatches(directoryName) {
170241
+ return mapDefined(tryGetDirectories(host, directoryName), (dir) => dir === "node_modules" ? void 0 : directoryResult(dir));
170242
+ }
170243
+ function trimPrefixAndSuffix(path, prefix) {
169997
170244
  return firstDefined(matchingSuffixes, (suffix) => {
169998
- const inner = withoutStartAndEnd(normalizePath(path), completePrefix, suffix);
170245
+ const inner = withoutStartAndEnd(normalizePath(path), prefix, suffix);
169999
170246
  return inner === void 0 ? void 0 : removeLeadingDirectorySeparator(inner);
170000
170247
  });
170001
170248
  }
@@ -170015,7 +170262,7 @@ function getAmbientModuleCompletions(fragment, fragmentDirectory, checker) {
170015
170262
  }
170016
170263
  return nonRelativeModuleNames;
170017
170264
  }
170018
- function getTripleSlashReferenceCompletion(sourceFile, position, program, host) {
170265
+ function getTripleSlashReferenceCompletion(sourceFile, position, program, host, moduleSpecifierResolutionHost) {
170019
170266
  const compilerOptions = program.getCompilerOptions();
170020
170267
  const token = getTokenAtPosition(sourceFile, position);
170021
170268
  const commentRanges = getLeadingCommentRanges(sourceFile.text, token.pos);
@@ -170036,13 +170283,14 @@ function getTripleSlashReferenceCompletion(sourceFile, position, program, host)
170036
170283
  getExtensionOptions(compilerOptions, 0 /* Filename */, sourceFile),
170037
170284
  program,
170038
170285
  host,
170286
+ moduleSpecifierResolutionHost,
170039
170287
  /*moduleSpecifierIsRelative*/
170040
170288
  true,
170041
170289
  sourceFile.path
170042
- ) : kind === "types" ? getCompletionEntriesFromTypings(host, program, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
170290
+ ) : kind === "types" ? getCompletionEntriesFromTypings(program, host, moduleSpecifierResolutionHost, scriptPath, getFragmentDirectory(toComplete), getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile)) : Debug.fail();
170043
170291
  return addReplacementSpans(toComplete, range.pos + prefix.length, arrayFrom(names.values()));
170044
170292
  }
170045
- function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
170293
+ function getCompletionEntriesFromTypings(program, host, moduleSpecifierResolutionHost, scriptPath, fragmentDirectory, extensionOptions, result = createNameAndKindSet()) {
170046
170294
  const options = program.getCompilerOptions();
170047
170295
  const seen = /* @__PURE__ */ new Map();
170048
170296
  const typeRoots = tryAndIgnoreErrors(() => getEffectiveTypeRoots(options, host)) || emptyArray;
@@ -170079,6 +170327,7 @@ function getCompletionEntriesFromTypings(host, program, scriptPath, fragmentDire
170079
170327
  extensionOptions,
170080
170328
  program,
170081
170329
  host,
170330
+ moduleSpecifierResolutionHost,
170082
170331
  /*moduleSpecifierIsRelative*/
170083
170332
  false,
170084
170333
  /*exclude*/
@@ -170831,7 +171080,7 @@ function getImplementationsAtPosition(program, cancellationToken, sourceFiles, s
170831
171080
  referenceEntries = entries && [...entries];
170832
171081
  } else if (entries) {
170833
171082
  const queue = createQueue(entries);
170834
- const seenNodes = /* @__PURE__ */ new Map();
171083
+ const seenNodes = /* @__PURE__ */ new Set();
170835
171084
  while (!queue.isEmpty()) {
170836
171085
  const entry = queue.dequeue();
170837
171086
  if (!addToSeen(seenNodes, getNodeId(entry.node))) {
@@ -172483,10 +172732,10 @@ var Core;
172483
172732
  }
172484
172733
  }
172485
172734
  function getPropertySymbolsFromBaseTypes(symbol, propertyName, checker, cb) {
172486
- const seen = /* @__PURE__ */ new Map();
172735
+ const seen = /* @__PURE__ */ new Set();
172487
172736
  return recur(symbol);
172488
172737
  function recur(symbol2) {
172489
- if (!(symbol2.flags & (32 /* Class */ | 64 /* Interface */)) || !addToSeen(seen, getSymbolId(symbol2))) return;
172738
+ if (!(symbol2.flags & (32 /* Class */ | 64 /* Interface */)) || !addToSeen(seen, symbol2)) return;
172490
172739
  return firstDefined(symbol2.declarations, (declaration) => firstDefined(getAllSuperTypeNodes(declaration), (typeReference) => {
172491
172740
  const type = checker.getTypeAtLocation(typeReference);
172492
172741
  const propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName);
@@ -173272,11 +173521,8 @@ function provideInlayHints(context) {
173272
173521
  if (!args || !args.length) {
173273
173522
  return;
173274
173523
  }
173275
- const candidates = [];
173276
- const signature = checker.getResolvedSignatureForSignatureHelp(expr, candidates);
173277
- if (!signature || !candidates.length) {
173278
- return;
173279
- }
173524
+ const signature = checker.getResolvedSignature(expr);
173525
+ if (signature === void 0) return;
173280
173526
  let signatureParamPos = 0;
173281
173527
  for (const originalArg of args) {
173282
173528
  const arg = skipParentheses(originalArg);
@@ -177134,6 +177380,7 @@ __export(ts_textChanges_exports, {
177134
177380
  assignPositionsToNode: () => assignPositionsToNode,
177135
177381
  createWriter: () => createWriter,
177136
177382
  deleteNode: () => deleteNode,
177383
+ getAdjustedEndPosition: () => getAdjustedEndPosition,
177137
177384
  isThisTypeAnnotatable: () => isThisTypeAnnotatable,
177138
177385
  isValidLocationToAddComment: () => isValidLocationToAddComment
177139
177386
  });
@@ -177633,7 +177880,10 @@ var ChangeTracker = class _ChangeTracker {
177633
177880
  getInsertNodeAtStartInsertOptions(sourceFile, node, indentation) {
177634
177881
  const members = getMembersOrProperties(node);
177635
177882
  const isEmpty = members.length === 0;
177636
- const isFirstInsertion = addToSeen(this.classesWithNodesInsertedAtStart, getNodeId(node), { node, sourceFile });
177883
+ const isFirstInsertion = !this.classesWithNodesInsertedAtStart.has(getNodeId(node));
177884
+ if (isFirstInsertion) {
177885
+ this.classesWithNodesInsertedAtStart.set(getNodeId(node), { node, sourceFile });
177886
+ }
177637
177887
  const insertTrailingComma = isObjectLiteralExpression(node) && (!isJsonSourceFile(sourceFile) || !isEmpty);
177638
177888
  const insertLeadingComma = isObjectLiteralExpression(node) && isJsonSourceFile(sourceFile) && isEmpty && !isFirstInsertion;
177639
177889
  return {
@@ -179543,6 +179793,9 @@ function isSemicolonDeletionContext(context) {
179543
179793
  if (startLine === endLine) {
179544
179794
  return nextTokenKind === 20 /* CloseBraceToken */ || nextTokenKind === 1 /* EndOfFileToken */;
179545
179795
  }
179796
+ if (nextTokenKind === 27 /* SemicolonToken */ && context.currentTokenSpan.kind === 27 /* SemicolonToken */) {
179797
+ return true;
179798
+ }
179546
179799
  if (nextTokenKind === 240 /* SemicolonClassElement */ || nextTokenKind === 27 /* SemicolonToken */) {
179547
179800
  return false;
179548
179801
  }
@@ -181288,11 +181541,13 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
181288
181541
  }
181289
181542
  statements.push(...statementsInSourceFile.slice(startNodeIndex, endNodeIndex === -1 ? statementsInSourceFile.length : endNodeIndex + 1));
181290
181543
  });
181291
- const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()), { pos: copiedFrom.range[0].pos, end: copiedFrom.range[copiedFrom.range.length - 1].end });
181292
- Debug.assertIsDefined(originalProgram);
181544
+ Debug.assertIsDefined(originalProgram, "no original program found");
181545
+ const originalProgramTypeChecker = originalProgram.getTypeChecker();
181546
+ const usageInfoRange = getUsageInfoRangeForPasteEdits(copiedFrom);
181547
+ const usage = getUsageInfo(copiedFrom.file, statements, originalProgramTypeChecker, getExistingLocals(updatedFile, statements, originalProgramTypeChecker), usageInfoRange);
181293
181548
  const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, originalProgram, host, !!copiedFrom.file.commonJsModuleIndicator);
181294
181549
  addExportsInOldFile(copiedFrom.file, usage.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
181295
- addTargetFileImports(copiedFrom.file, usage.oldImportsNeededByTargetFile, usage.targetFileImportsFromOldFile, originalProgram.getTypeChecker(), updatedProgram, importAdder);
181550
+ addTargetFileImports(copiedFrom.file, usage.oldImportsNeededByTargetFile, usage.targetFileImportsFromOldFile, originalProgramTypeChecker, updatedProgram, importAdder);
181296
181551
  } else {
181297
181552
  const context = {
181298
181553
  sourceFile: updatedFile,
@@ -181348,6 +181603,16 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
181348
181603
  );
181349
181604
  });
181350
181605
  }
181606
+ function getUsageInfoRangeForPasteEdits({ file: sourceFile, range }) {
181607
+ const pos = range[0].pos;
181608
+ const end = range[range.length - 1].end;
181609
+ const startToken = getTokenAtPosition(sourceFile, pos);
181610
+ const endToken = findTokenOnLeftOfPosition(sourceFile, pos) ?? getTokenAtPosition(sourceFile, end);
181611
+ return {
181612
+ pos: isIdentifier(startToken) && pos <= startToken.getStart(sourceFile) ? startToken.getFullStart() : pos,
181613
+ end: isIdentifier(endToken) && end === endToken.getEnd() ? ts_textChanges_exports.getAdjustedEndPosition(sourceFile, endToken, {}) : end
181614
+ };
181615
+ }
181351
181616
 
181352
181617
  // src/server/_namespaces/ts.ts
181353
181618
  var ts_exports2 = {};
@@ -182261,6 +182526,7 @@ __export(ts_exports2, {
182261
182526
  getPositionOfLineAndCharacter: () => getPositionOfLineAndCharacter,
182262
182527
  getPossibleGenericSignatures: () => getPossibleGenericSignatures,
182263
182528
  getPossibleOriginalInputExtensionForExtension: () => getPossibleOriginalInputExtensionForExtension,
182529
+ getPossibleOriginalInputPathWithoutChangingExt: () => getPossibleOriginalInputPathWithoutChangingExt,
182264
182530
  getPossibleTypeArgumentsInfo: () => getPossibleTypeArgumentsInfo,
182265
182531
  getPreEmitDiagnostics: () => getPreEmitDiagnostics,
182266
182532
  getPrecedingNonSpaceCharacterPosition: () => getPrecedingNonSpaceCharacterPosition,
@@ -188019,7 +188285,7 @@ var _ProjectService = class _ProjectService {
188019
188285
  */
188020
188286
  this.filenameToScriptInfoVersion = /* @__PURE__ */ new Map();
188021
188287
  // Set of all '.js' files ever opened.
188022
- this.allJsFilesForOpenFileTelemetry = /* @__PURE__ */ new Map();
188288
+ this.allJsFilesForOpenFileTelemetry = /* @__PURE__ */ new Set();
188023
188289
  /**
188024
188290
  * maps external project file name to list of config files that were the part of this project
188025
188291
  */
@@ -195601,6 +195867,7 @@ var LineNode = class _LineNode {
195601
195867
  }
195602
195868
  }
195603
195869
  walk(rangeStart, rangeLength, walkFns) {
195870
+ if (this.children.length === 0) return;
195604
195871
  let childIndex = 0;
195605
195872
  let childCharCount = this.children[childIndex].charCount();
195606
195873
  let adjustedStart = rangeStart;
@@ -197005,6 +197272,7 @@ if (typeof console !== "undefined") {
197005
197272
  getPositionOfLineAndCharacter,
197006
197273
  getPossibleGenericSignatures,
197007
197274
  getPossibleOriginalInputExtensionForExtension,
197275
+ getPossibleOriginalInputPathWithoutChangingExt,
197008
197276
  getPossibleTypeArgumentsInfo,
197009
197277
  getPreEmitDiagnostics,
197010
197278
  getPrecedingNonSpaceCharacterPosition,