typescript 5.5.0-dev.20240521 → 5.5.0-dev.20240523

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
@@ -112,6 +112,7 @@ __export(typescript_exports, {
112
112
  LexicalEnvironmentFlags: () => LexicalEnvironmentFlags,
113
113
  ListFormat: () => ListFormat,
114
114
  LogLevel: () => LogLevel,
115
+ MapCode: () => ts_MapCode_exports,
115
116
  MemberOverrideStatus: () => MemberOverrideStatus,
116
117
  ModifierFlags: () => ModifierFlags,
117
118
  ModuleDetectionKind: () => ModuleDetectionKind,
@@ -532,6 +533,7 @@ __export(typescript_exports, {
532
533
  emitNewLineBeforeLeadingCommentOfPosition: () => emitNewLineBeforeLeadingCommentOfPosition,
533
534
  emitNewLineBeforeLeadingComments: () => emitNewLineBeforeLeadingComments,
534
535
  emitNewLineBeforeLeadingCommentsOfPosition: () => emitNewLineBeforeLeadingCommentsOfPosition,
536
+ emitResolverSkipsTypeChecking: () => emitResolverSkipsTypeChecking,
535
537
  emitSkippedWithNoDiagnostics: () => emitSkippedWithNoDiagnostics,
536
538
  emptyArray: () => emptyArray,
537
539
  emptyFileSystemEntries: () => emptyFileSystemEntries,
@@ -2368,7 +2370,7 @@ module.exports = __toCommonJS(typescript_exports);
2368
2370
 
2369
2371
  // src/compiler/corePublic.ts
2370
2372
  var versionMajorMinor = "5.5";
2371
- var version = `${versionMajorMinor}.0-dev.20240521`;
2373
+ var version = `${versionMajorMinor}.0-dev.20240523`;
2372
2374
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2373
2375
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2374
2376
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -11115,6 +11117,8 @@ var Diagnostics = {
11115
11117
  Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit: diag(9035, 1 /* Error */, "Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit_9035", "Add satisfies and a type assertion to this expression (satisfies T as T) to make the type explicit."),
11116
11118
  Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it: diag(9036, 1 /* Error */, "Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it_9036", "Move the expression in default export to a variable and add a type annotation to it."),
11117
11119
  Default_exports_can_t_be_inferred_with_isolatedDeclarations: diag(9037, 1 /* Error */, "Default_exports_can_t_be_inferred_with_isolatedDeclarations_9037", "Default exports can't be inferred with --isolatedDeclarations."),
11120
+ Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations: diag(9038, 1 /* Error */, "Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations_9038", "Computed property names on class or object literals cannot be inferred with --isolatedDeclarations."),
11121
+ Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations: diag(9039, 1 /* Error */, "Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations_9039", "Type containing private name '{0}' can't be used with --isolatedDeclarations."),
11118
11122
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
11119
11123
  JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, 1 /* Error */, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
11120
11124
  Expected_corresponding_JSX_closing_tag_for_0: diag(17002, 1 /* Error */, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
@@ -15259,7 +15263,7 @@ function getTextOfJSDocComment(comment) {
15259
15263
  function formatJSDocLink(link) {
15260
15264
  const kind = link.kind === 324 /* JSDocLink */ ? "link" : link.kind === 325 /* JSDocLinkCode */ ? "linkcode" : "linkplain";
15261
15265
  const name = link.name ? entityNameToString(link.name) : "";
15262
- const space = link.name && link.text.startsWith("://") ? "" : " ";
15266
+ const space = link.name && (link.text === "" || link.text.startsWith("://")) ? "" : " ";
15263
15267
  return `{@${kind} ${name}${space}${link.text}}`;
15264
15268
  }
15265
15269
  function getEffectiveTypeParameterDeclarations(node) {
@@ -48837,13 +48841,14 @@ function getModuleSpecifierWorker(compilerOptions, importingSourceFile, importin
48837
48841
  )) || getLocalModuleSpecifier(toFileName2, info, compilerOptions, host, options.overrideImportMode || getDefaultResolutionModeForFile(importingSourceFile, host, compilerOptions), preferences);
48838
48842
  }
48839
48843
  function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
48840
- return tryGetModuleSpecifiersFromCacheWorker(
48844
+ const result = tryGetModuleSpecifiersFromCacheWorker(
48841
48845
  moduleSymbol,
48842
48846
  importingSourceFile,
48843
48847
  host,
48844
48848
  userPreferences,
48845
48849
  options
48846
- )[0];
48850
+ );
48851
+ return result[1] && { kind: result[0], moduleSpecifiers: result[1], computedWithoutCache: false };
48847
48852
  }
48848
48853
  function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) {
48849
48854
  var _a;
@@ -48853,7 +48858,7 @@ function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile
48853
48858
  }
48854
48859
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
48855
48860
  const cached = cache == null ? void 0 : cache.get(importingSourceFile.path, moduleSourceFile.path, userPreferences, options);
48856
- return [cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths, cache];
48861
+ return [cached == null ? void 0 : cached.kind, cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths, cache];
48857
48862
  }
48858
48863
  function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}) {
48859
48864
  return getModuleSpecifiersWithCacheInfo(
@@ -48871,16 +48876,16 @@ function getModuleSpecifiers(moduleSymbol, checker, compilerOptions, importingSo
48871
48876
  function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
48872
48877
  let computedWithoutCache = false;
48873
48878
  const ambient = tryGetModuleNameFromAmbientModule(moduleSymbol, checker);
48874
- if (ambient) return { moduleSpecifiers: [ambient], computedWithoutCache };
48875
- let [specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
48879
+ if (ambient) return { kind: "ambient", moduleSpecifiers: [ambient], computedWithoutCache };
48880
+ let [kind, specifiers, moduleSourceFile, modulePaths, cache] = tryGetModuleSpecifiersFromCacheWorker(
48876
48881
  moduleSymbol,
48877
48882
  importingSourceFile,
48878
48883
  host,
48879
48884
  userPreferences,
48880
48885
  options
48881
48886
  );
48882
- if (specifiers) return { moduleSpecifiers: specifiers, computedWithoutCache };
48883
- if (!moduleSourceFile) return { moduleSpecifiers: emptyArray, computedWithoutCache };
48887
+ if (specifiers) return { kind, moduleSpecifiers: specifiers, computedWithoutCache };
48888
+ if (!moduleSourceFile) return { kind: void 0, moduleSpecifiers: emptyArray, computedWithoutCache };
48884
48889
  computedWithoutCache = true;
48885
48890
  modulePaths || (modulePaths = getAllModulePathsWorker(getInfo(importingSourceFile.fileName, host), moduleSourceFile.originalFileName, host, compilerOptions, options));
48886
48891
  const result = computeModuleSpecifiers(
@@ -48892,8 +48897,8 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
48892
48897
  options,
48893
48898
  forAutoImport
48894
48899
  );
48895
- cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, modulePaths, result);
48896
- return { moduleSpecifiers: result, computedWithoutCache };
48900
+ cache == null ? void 0 : cache.set(importingSourceFile.path, moduleSourceFile.path, userPreferences, options, result.kind, modulePaths, result.moduleSpecifiers);
48901
+ return result;
48897
48902
  }
48898
48903
  function getLocalModuleSpecifierBetweenFileNames(importingFile, targetFileName, compilerOptions, host, options = {}) {
48899
48904
  const info = getInfo(importingFile.fileName, host);
@@ -48924,8 +48929,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
48924
48929
  }
48925
48930
  ));
48926
48931
  if (existingSpecifier) {
48927
- const moduleSpecifiers = [existingSpecifier];
48928
- return moduleSpecifiers;
48932
+ return { kind: void 0, moduleSpecifiers: [existingSpecifier], computedWithoutCache: true };
48929
48933
  }
48930
48934
  const importedFileIsInNodeModules = some(modulePaths, (p) => p.isInNodeModules);
48931
48935
  let nodeModulesSpecifiers;
@@ -48946,7 +48950,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
48946
48950
  ) : void 0;
48947
48951
  nodeModulesSpecifiers = append(nodeModulesSpecifiers, specifier);
48948
48952
  if (specifier && modulePath.isRedirect) {
48949
- return nodeModulesSpecifiers;
48953
+ return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
48950
48954
  }
48951
48955
  if (!specifier) {
48952
48956
  const local = getLocalModuleSpecifier(
@@ -48975,7 +48979,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
48975
48979
  }
48976
48980
  }
48977
48981
  }
48978
- return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? redirectPathsSpecifiers : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : Debug.checkDefined(relativeSpecifiers);
48982
+ 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: Debug.checkDefined(relativeSpecifiers), computedWithoutCache: true };
48979
48983
  }
48980
48984
  function getInfo(importingSourceFileName, host) {
48981
48985
  importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
@@ -49846,7 +49850,6 @@ function createTypeChecker(host) {
49846
49850
  var syntacticNodeBuilder = createSyntacticTypeNodeBuilder(compilerOptions, {
49847
49851
  isEntityNameVisible,
49848
49852
  isExpandoFunctionDeclaration,
49849
- isNonNarrowedBindableName,
49850
49853
  getAllAccessorDeclarations: getAllAccessorDeclarationsForDeclaration,
49851
49854
  requiresAddingImplicitUndefined,
49852
49855
  isUndefinedIdentifierExpression(node) {
@@ -50885,8 +50888,8 @@ function createTypeChecker(host) {
50885
50888
  void 0
50886
50889
  );
50887
50890
  }
50888
- function getEmitResolver(sourceFile, cancellationToken2) {
50889
- getDiagnostics2(sourceFile, cancellationToken2);
50891
+ function getEmitResolver(sourceFile, cancellationToken2, skipDiagnostics) {
50892
+ if (!skipDiagnostics) getDiagnostics2(sourceFile, cancellationToken2);
50890
50893
  return emitResolver;
50891
50894
  }
50892
50895
  function lookupOrIssueError(location, message, ...args) {
@@ -53814,8 +53817,15 @@ function createTypeChecker(host) {
53814
53817
  ).accessibility === 0 /* Accessible */) {
53815
53818
  return { accessibility: 0 /* Accessible */ };
53816
53819
  }
53817
- return symbol && hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
53818
- accessibility: 3 /* NotResolved */,
53820
+ if (!symbol) {
53821
+ return {
53822
+ accessibility: 3 /* NotResolved */,
53823
+ errorSymbolName: getTextOfNode(firstIdentifier),
53824
+ errorNode: firstIdentifier
53825
+ };
53826
+ }
53827
+ return hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) || {
53828
+ accessibility: 1 /* NotAccessible */,
53819
53829
  errorSymbolName: getTextOfNode(firstIdentifier),
53820
53830
  errorNode: firstIdentifier
53821
53831
  };
@@ -54014,6 +54024,7 @@ function createTypeChecker(host) {
54014
54024
  return result;
54015
54025
  }
54016
54026
  }
54027
+ context.tracker.reportInferenceFallback(existing);
54017
54028
  return void 0;
54018
54029
  }
54019
54030
  function symbolToNode(symbol, context, meaning) {
@@ -56049,6 +56060,9 @@ function createTypeChecker(host) {
56049
56060
  symAtLocation === void 0 && sym !== void 0 || // If the symbol is found both in declaration scope and in current scope then it shoudl point to the same reference
56050
56061
  symAtLocation && sym && !getSymbolIfSameReference(getExportSymbolOfValueSymbolIfExported(symAtLocation), sym)
56051
56062
  ) {
56063
+ if (symAtLocation !== unknownSymbol) {
56064
+ context.tracker.reportInferenceFallback(node);
56065
+ }
56052
56066
  introducesError = true;
56053
56067
  return { introducesError, node, sym };
56054
56068
  }
@@ -56067,6 +56081,7 @@ function createTypeChecker(host) {
56067
56081
  /*shouldComputeAliasesToMakeVisible*/
56068
56082
  false
56069
56083
  ).accessibility !== 0 /* Accessible */) {
56084
+ context.tracker.reportInferenceFallback(node);
56070
56085
  introducesError = true;
56071
56086
  } else {
56072
56087
  context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
@@ -89761,22 +89776,6 @@ function createTypeChecker(host) {
89761
89776
  }
89762
89777
  return false;
89763
89778
  }
89764
- function isNonNarrowedBindableName(node) {
89765
- if (!hasBindableName(node.parent)) {
89766
- return false;
89767
- }
89768
- const expression = node.expression;
89769
- if (!isEntityNameExpression(expression)) {
89770
- return true;
89771
- }
89772
- const type = getTypeOfExpression(expression);
89773
- const symbol = getSymbolAtLocation(expression);
89774
- if (!symbol) {
89775
- return false;
89776
- }
89777
- const declaredType = getTypeOfSymbol(symbol);
89778
- return declaredType === type;
89779
- }
89780
89779
  function literalTypeToNode(type, enclosing, tracker) {
89781
89780
  const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
89782
89781
  type.symbol,
@@ -89895,7 +89894,6 @@ function createTypeChecker(host) {
89895
89894
  return node && getExternalModuleFileFromDeclaration(node);
89896
89895
  },
89897
89896
  isLiteralConstDeclaration,
89898
- isNonNarrowedBindableName,
89899
89897
  isLateBound: (nodeIn) => {
89900
89898
  const node = getParseTreeNode(nodeIn, isDeclaration);
89901
89899
  const symbol = node && getSymbolOfDeclaration(node);
@@ -114997,7 +114995,7 @@ function createGetIsolatedDeclarationErrors(resolver) {
114997
114995
  [260 /* VariableDeclaration */]: Diagnostics.Variable_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
114998
114996
  [172 /* PropertyDeclaration */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
114999
114997
  [171 /* PropertySignature */]: Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations,
115000
- [167 /* ComputedPropertyName */]: Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations,
114998
+ [167 /* ComputedPropertyName */]: Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations,
115001
114999
  [305 /* SpreadAssignment */]: Diagnostics.Objects_that_contain_spread_assignments_can_t_be_inferred_with_isolatedDeclarations,
115002
115000
  [304 /* ShorthandPropertyAssignment */]: Diagnostics.Objects_that_contain_shorthand_properties_can_t_be_inferred_with_isolatedDeclarations,
115003
115001
  [209 /* ArrayLiteralExpression */]: Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations,
@@ -115010,6 +115008,9 @@ function createGetIsolatedDeclarationErrors(resolver) {
115010
115008
  if (heritageClause) {
115011
115009
  return createDiagnosticForNode(node, Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations);
115012
115010
  }
115011
+ if ((isPartOfTypeNode(node) || isTypeQueryNode(node.parent)) && (isEntityName(node) || isEntityNameExpression(node))) {
115012
+ return createEntityInTypeNodeError(node);
115013
+ }
115013
115014
  Debug.type(node);
115014
115015
  switch (node.kind) {
115015
115016
  case 177 /* GetAccessor */:
@@ -115045,8 +115046,13 @@ function createGetIsolatedDeclarationErrors(resolver) {
115045
115046
  }
115046
115047
  }
115047
115048
  function findNearestDeclaration(node) {
115048
- const result = findAncestor(node, (n) => isExportAssignment(n) || (isStatement(n) ? "quit" : isVariableDeclaration(n) || isPropertyDeclaration(n) || isParameter(n)));
115049
- return result;
115049
+ const result = findAncestor(node, (n) => isExportAssignment(n) || isStatement(n) || isVariableDeclaration(n) || isPropertyDeclaration(n) || isParameter(n));
115050
+ if (!result) return void 0;
115051
+ if (isExportAssignment(result)) return result;
115052
+ if (isReturnStatement(result)) {
115053
+ return findAncestor(result, (n) => isFunctionLikeDeclaration(n) && !isConstructorDeclaration(n));
115054
+ }
115055
+ return isStatement(result) ? void 0 : result;
115050
115056
  }
115051
115057
  function createAccessorTypeError(node) {
115052
115058
  const { getAccessor, setAccessor } = getAllAccessorDeclarations(node.symbol.declarations, node);
@@ -115060,11 +115066,10 @@ function createGetIsolatedDeclarationErrors(resolver) {
115060
115066
  }
115061
115067
  return diag2;
115062
115068
  }
115063
- function createObjectLiteralError(node) {
115064
- const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
115069
+ function addParentDeclarationRelatedInfo(node, diag2) {
115065
115070
  const parentDeclaration = findNearestDeclaration(node);
115066
115071
  if (parentDeclaration) {
115067
- const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
115072
+ const targetStr = isExportAssignment(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode(
115068
115073
  parentDeclaration.name,
115069
115074
  /*includeTrivia*/
115070
115075
  false
@@ -115073,30 +115078,19 @@ function createGetIsolatedDeclarationErrors(resolver) {
115073
115078
  }
115074
115079
  return diag2;
115075
115080
  }
115081
+ function createObjectLiteralError(node) {
115082
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
115083
+ addParentDeclarationRelatedInfo(node, diag2);
115084
+ return diag2;
115085
+ }
115076
115086
  function createArrayLiteralError(node) {
115077
115087
  const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
115078
- const parentDeclaration = findNearestDeclaration(node);
115079
- if (parentDeclaration) {
115080
- const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
115081
- parentDeclaration.name,
115082
- /*includeTrivia*/
115083
- false
115084
- );
115085
- addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
115086
- }
115088
+ addParentDeclarationRelatedInfo(node, diag2);
115087
115089
  return diag2;
115088
115090
  }
115089
115091
  function createReturnTypeError(node) {
115090
115092
  const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
115091
- const parentDeclaration = findNearestDeclaration(node);
115092
- if (parentDeclaration) {
115093
- const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
115094
- parentDeclaration.name,
115095
- /*includeTrivia*/
115096
- false
115097
- );
115098
- addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
115099
- }
115093
+ addParentDeclarationRelatedInfo(node, diag2);
115100
115094
  addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind]));
115101
115095
  return diag2;
115102
115096
  }
@@ -115134,11 +115128,20 @@ function createGetIsolatedDeclarationErrors(resolver) {
115134
115128
  function createClassExpressionError(node) {
115135
115129
  return createExpressionError(node, Diagnostics.Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations);
115136
115130
  }
115131
+ function createEntityInTypeNodeError(node) {
115132
+ const diag2 = createDiagnosticForNode(node, Diagnostics.Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations, getTextOfNode(
115133
+ node,
115134
+ /*includeTrivia*/
115135
+ false
115136
+ ));
115137
+ addParentDeclarationRelatedInfo(node, diag2);
115138
+ return diag2;
115139
+ }
115137
115140
  function createExpressionError(node, diagnosticMessage) {
115138
115141
  const parentDeclaration = findNearestDeclaration(node);
115139
115142
  let diag2;
115140
115143
  if (parentDeclaration) {
115141
- const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
115144
+ const targetStr = isExportAssignment(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode(
115142
115145
  parentDeclaration.name,
115143
115146
  /*includeTrivia*/
115144
115147
  false
@@ -115863,8 +115866,11 @@ function transformDeclarations(context) {
115863
115866
  if (shouldStripInternal(input)) return;
115864
115867
  if (isDeclaration(input)) {
115865
115868
  if (isDeclarationAndNotVisible(input)) return;
115866
- if (hasDynamicName(input) && !resolver.isLateBound(getParseTreeNode(input))) {
115867
- if (isolatedDeclarations && isClassDeclaration(input.parent) && isEntityNameExpression(input.name.expression) && resolver.isEntityNameVisible(input.name.expression, input.parent).accessibility === 0 /* Accessible */ && !resolver.isNonNarrowedBindableName(input.name)) {
115869
+ if (hasDynamicName(input)) {
115870
+ if (isolatedDeclarations && (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent))) {
115871
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
115872
+ }
115873
+ if (isolatedDeclarations && (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)) {
115868
115874
  context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
115869
115875
  }
115870
115876
  if (!isEntityNameExpression(input.name.expression)) {
@@ -117448,6 +117454,9 @@ function getFirstProjectOutput(configFile, ignoreCase) {
117448
117454
  if (buildInfoPath) return buildInfoPath;
117449
117455
  return Debug.fail(`project ${configFile.options.configFilePath} expected to have at least one output`);
117450
117456
  }
117457
+ function emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit) {
117458
+ return !!forceDtsEmit && !!emitOnly;
117459
+ }
117451
117460
  function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, declarationTransformers }, emitOnly, onlyBuildInfo, forceDtsEmit) {
117452
117461
  var compilerOptions = host.getCompilerOptions();
117453
117462
  var sourceMapDataList = compilerOptions.sourceMap || compilerOptions.inlineSourceMap || getAreDeclarationMapsEnabled(compilerOptions) ? [] : void 0;
@@ -117565,7 +117574,7 @@ function emitFiles(resolver, host, targetSourceFile, { scriptTransformers, decla
117565
117574
  const sourceFiles = isSourceFile(sourceFileOrBundle) ? [sourceFileOrBundle] : sourceFileOrBundle.sourceFiles;
117566
117575
  const filesForEmit = forceDtsEmit ? sourceFiles : filter(sourceFiles, isSourceFileNotJson);
117567
117576
  const inputListOrBundle = compilerOptions.outFile ? [factory.createBundle(filesForEmit)] : filesForEmit;
117568
- if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck) {
117577
+ if (emitOnly && !getEmitDeclarations(compilerOptions) || compilerOptions.noCheck || emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit)) {
117569
117578
  filesForEmit.forEach(collectLinkedAliases);
117570
117579
  }
117571
117580
  const declarationTransform = transformNodes(
@@ -117805,7 +117814,6 @@ var notImplementedResolver = {
117805
117814
  isArgumentsLocalBinding: notImplemented,
117806
117815
  getExternalModuleFileFromDeclaration: notImplemented,
117807
117816
  isLiteralConstDeclaration: notImplemented,
117808
- isNonNarrowedBindableName: notImplemented,
117809
117817
  getJsxFactoryEntity: notImplemented,
117810
117818
  getJsxFragmentFactoryEntity: notImplemented,
117811
117819
  isBindingCapturedByNode: notImplemented,
@@ -124547,17 +124555,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124547
124555
  const result = handleNoEmitOptions(program2, sourceFile, writeFileCallback, cancellationToken);
124548
124556
  if (result) return result;
124549
124557
  }
124550
- const emitResolver = getTypeChecker().getEmitResolver(options.outFile ? void 0 : sourceFile, cancellationToken);
124558
+ const typeChecker2 = getTypeChecker();
124559
+ const emitResolver = typeChecker2.getEmitResolver(
124560
+ options.outFile ? void 0 : sourceFile,
124561
+ cancellationToken,
124562
+ emitResolverSkipsTypeChecking(emitOnly, forceDtsEmit)
124563
+ );
124551
124564
  mark("beforeEmit");
124552
- const emitResult = emitFiles(
124553
- emitResolver,
124554
- getEmitHost(writeFileCallback),
124555
- sourceFile,
124556
- getTransformers(options, customTransformers, emitOnly),
124557
- emitOnly,
124558
- /*onlyBuildInfo*/
124559
- false,
124560
- forceDtsEmit
124565
+ const emitResult = typeChecker2.runWithCancellationToken(
124566
+ cancellationToken,
124567
+ () => emitFiles(
124568
+ emitResolver,
124569
+ getEmitHost(writeFileCallback),
124570
+ sourceFile,
124571
+ getTransformers(options, customTransformers, emitOnly),
124572
+ emitOnly,
124573
+ /*onlyBuildInfo*/
124574
+ false,
124575
+ forceDtsEmit
124576
+ )
124561
124577
  );
124562
124578
  mark("afterEmit");
124563
124579
  measure("Emit", "beforeEmit", "afterEmit");
@@ -127534,7 +127550,7 @@ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken
127534
127550
  host
127535
127551
  );
127536
127552
  }
127537
- function handleDtsMayChangeOf(state, path, cancellationToken, host) {
127553
+ function handleDtsMayChangeOf(state, path, invalidateJsFiles, cancellationToken, host) {
127538
127554
  removeSemanticDiagnosticsOf(state, path);
127539
127555
  if (!state.changedFilesSet.has(path)) {
127540
127556
  const program = Debug.checkDefined(state.program);
@@ -127549,7 +127565,9 @@ function handleDtsMayChangeOf(state, path, cancellationToken, host) {
127549
127565
  /*useFileVersionAsSignature*/
127550
127566
  true
127551
127567
  );
127552
- if (getEmitDeclarations(state.compilerOptions)) {
127568
+ if (invalidateJsFiles) {
127569
+ addToAffectedFilesPendingEmit(state, path, getBuilderFileEmit(state.compilerOptions));
127570
+ } else if (getEmitDeclarations(state.compilerOptions)) {
127553
127571
  addToAffectedFilesPendingEmit(state, path, state.compilerOptions.declarationMap ? 24 /* AllDts */ : 8 /* Dts */);
127554
127572
  }
127555
127573
  }
@@ -127568,7 +127586,7 @@ function isChangedSignature(state, path) {
127568
127586
  const newSignature = Debug.checkDefined(state.fileInfos.get(path)).signature;
127569
127587
  return newSignature !== oldSignature;
127570
127588
  }
127571
- function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) {
127589
+ function handleDtsMayChangeOfGlobalScope(state, filePath, invalidateJsFiles, cancellationToken, host) {
127572
127590
  var _a;
127573
127591
  if (!((_a = state.fileInfos.get(filePath)) == null ? void 0 : _a.affectsGlobalScope)) return false;
127574
127592
  BuilderState.getAllFilesExcludingDefaultLibraryFile(
@@ -127580,6 +127598,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
127580
127598
  (file) => handleDtsMayChangeOf(
127581
127599
  state,
127582
127600
  file.resolvedPath,
127601
+ invalidateJsFiles,
127583
127602
  cancellationToken,
127584
127603
  host
127585
127604
  )
@@ -127588,7 +127607,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
127588
127607
  return true;
127589
127608
  }
127590
127609
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
127591
- var _a;
127610
+ var _a, _b;
127592
127611
  if (!state.referencedMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) return;
127593
127612
  if (!isChangedSignature(state, affectedFile.resolvedPath)) return;
127594
127613
  if (getIsolatedModules(state.compilerOptions)) {
@@ -127599,8 +127618,22 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
127599
127618
  const currentPath = queue.pop();
127600
127619
  if (!seenFileNamesMap.has(currentPath)) {
127601
127620
  seenFileNamesMap.set(currentPath, true);
127602
- if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, host)) return;
127603
- handleDtsMayChangeOf(state, currentPath, cancellationToken, host);
127621
+ if (handleDtsMayChangeOfGlobalScope(
127622
+ state,
127623
+ currentPath,
127624
+ /*invalidateJsFiles*/
127625
+ false,
127626
+ cancellationToken,
127627
+ host
127628
+ )) return;
127629
+ handleDtsMayChangeOf(
127630
+ state,
127631
+ currentPath,
127632
+ /*invalidateJsFiles*/
127633
+ false,
127634
+ cancellationToken,
127635
+ host
127636
+ );
127604
127637
  if (isChangedSignature(state, currentPath)) {
127605
127638
  const currentSourceFile = Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
127606
127639
  queue.push(...BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -127609,27 +127642,38 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
127609
127642
  }
127610
127643
  }
127611
127644
  const seenFileAndExportsOfFile = /* @__PURE__ */ new Set();
127612
- (_a = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a.forEach((exportedFromPath) => {
127613
- if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host)) return true;
127645
+ const invalidateJsFiles = !!((_a = affectedFile.symbol) == null ? void 0 : _a.exports) && !!forEachEntry(
127646
+ affectedFile.symbol.exports,
127647
+ (exported) => {
127648
+ if ((exported.flags & 128 /* ConstEnum */) !== 0) return true;
127649
+ const aliased = skipAlias(exported, state.program.getTypeChecker());
127650
+ if (aliased === exported) return false;
127651
+ return (aliased.flags & 128 /* ConstEnum */) !== 0 && some(aliased.declarations, (d) => getSourceFileOfNode(d) === affectedFile);
127652
+ }
127653
+ );
127654
+ (_b = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _b.forEach((exportedFromPath) => {
127655
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, invalidateJsFiles, cancellationToken, host)) return true;
127614
127656
  const references = state.referencedMap.getKeys(exportedFromPath);
127615
127657
  return references && forEachKey(references, (filePath) => handleDtsMayChangeOfFileAndExportsOfFile(
127616
127658
  state,
127617
127659
  filePath,
127660
+ invalidateJsFiles,
127618
127661
  seenFileAndExportsOfFile,
127619
127662
  cancellationToken,
127620
127663
  host
127621
127664
  ));
127622
127665
  });
127623
127666
  }
127624
- function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
127667
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, invalidateJsFiles, seenFileAndExportsOfFile, cancellationToken, host) {
127625
127668
  var _a;
127626
127669
  if (!tryAddToSet(seenFileAndExportsOfFile, filePath)) return void 0;
127627
- if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host)) return true;
127628
- handleDtsMayChangeOf(state, filePath, cancellationToken, host);
127670
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, invalidateJsFiles, cancellationToken, host)) return true;
127671
+ handleDtsMayChangeOf(state, filePath, invalidateJsFiles, cancellationToken, host);
127629
127672
  (_a = state.referencedMap.getKeys(filePath)) == null ? void 0 : _a.forEach(
127630
127673
  (referencingFilePath) => handleDtsMayChangeOfFileAndExportsOfFile(
127631
127674
  state,
127632
127675
  referencingFilePath,
127676
+ invalidateJsFiles,
127633
127677
  seenFileAndExportsOfFile,
127634
127678
  cancellationToken,
127635
127679
  host
@@ -134193,7 +134237,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
134193
134237
  expression,
134194
134238
  /*includeBigInt*/
134195
134239
  false
134196
- ) && !isEntityNameExpression(expression)) {
134240
+ )) {
134197
134241
  context.tracker.reportInferenceFallback(prop.name);
134198
134242
  result = false;
134199
134243
  }
@@ -134207,21 +134251,6 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
134207
134251
  for (const prop of objectLiteral.properties) {
134208
134252
  Debug.assert(!isShorthandPropertyAssignment(prop) && !isSpreadAssignment(prop));
134209
134253
  const name = prop.name;
134210
- if (prop.name.kind === 167 /* ComputedPropertyName */) {
134211
- if (!resolver.isNonNarrowedBindableName(prop.name)) {
134212
- context.tracker.reportInferenceFallback(prop.name);
134213
- } else if (isEntityNameExpression(prop.name.expression)) {
134214
- const visibilityResult = resolver.isEntityNameVisible(
134215
- prop.name.expression,
134216
- context.enclosingDeclaration,
134217
- /*shouldComputeAliasToMakeVisible*/
134218
- false
134219
- );
134220
- if (visibilityResult.accessibility !== 0 /* Accessible */) {
134221
- context.tracker.reportInferenceFallback(prop.name);
134222
- }
134223
- }
134224
- }
134225
134254
  switch (prop.kind) {
134226
134255
  case 174 /* MethodDeclaration */:
134227
134256
  canInferObjectLiteral = !!typeFromObjectLiteralMethod(prop, name, context) && canInferObjectLiteral;
@@ -149376,6 +149405,16 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
149376
149405
  const sourceFile = getValidSourceFile(fileName);
149377
149406
  return ts_InlayHints_exports.provideInlayHints(getInlayHintsContext(sourceFile, span, preferences));
149378
149407
  }
149408
+ function mapCode2(sourceFile, contents, focusLocations, formatOptions, preferences) {
149409
+ return ts_MapCode_exports.mapCode(
149410
+ syntaxTreeCache.getCurrentSourceFile(sourceFile),
149411
+ contents,
149412
+ focusLocations,
149413
+ host,
149414
+ ts_formatting_exports.getFormatContext(formatOptions, host),
149415
+ preferences
149416
+ );
149417
+ }
149379
149418
  const ls = {
149380
149419
  dispose,
149381
149420
  cleanupSemanticCache,
@@ -149446,7 +149485,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
149446
149485
  uncommentSelection,
149447
149486
  provideInlayHints: provideInlayHints2,
149448
149487
  getSupportedCodeFixes,
149449
- getPasteEdits
149488
+ getPasteEdits,
149489
+ mapCode: mapCode2
149450
149490
  };
149451
149491
  switch (languageServiceMode) {
149452
149492
  case 0 /* Semantic */:
@@ -153720,6 +153760,7 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
153720
153760
  );
153721
153761
  const fix = {
153722
153762
  kind: 3 /* AddNew */,
153763
+ moduleSpecifierKind: "relative",
153723
153764
  moduleSpecifier,
153724
153765
  importKind,
153725
153766
  addAsTypeOnly,
@@ -154062,7 +154103,7 @@ function createImportSpecifierResolver(importingFile, program, host, preferences
154062
154103
  importMap,
154063
154104
  fromCacheOnly
154064
154105
  );
154065
- const result = getBestFix(fixes, importingFile, program, packageJsonImportFilter, host);
154106
+ const result = getBestFix(fixes, importingFile, program, packageJsonImportFilter, host, preferences);
154066
154107
  return result && { ...result, computedWithoutCacheCount };
154067
154108
  }
154068
154109
  }
@@ -154109,7 +154150,7 @@ function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, ho
154109
154150
  }
154110
154151
  function getImportFixForSymbol(sourceFile, exportInfos, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
154111
154152
  const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host);
154112
- return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host);
154153
+ return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host, preferences);
154113
154154
  }
154114
154155
  function codeFixActionToCodeAction({ description: description3, changes, commands }) {
154115
154156
  return { description: description3, changes, commands };
@@ -154184,7 +154225,7 @@ function tryUseExistingNamespaceImport(existingImports, position) {
154184
154225
  const namespacePrefix = getNamespaceLikeImportText(declaration);
154185
154226
  const moduleSpecifier = namespacePrefix && ((_a = tryGetModuleSpecifierFromDeclaration(declaration)) == null ? void 0 : _a.text);
154186
154227
  if (moduleSpecifier) {
154187
- return { kind: 0 /* UseNamespace */, namespacePrefix, usagePosition: position, moduleSpecifier };
154228
+ return { kind: 0 /* UseNamespace */, namespacePrefix, usagePosition: position, moduleSpecifierKind: void 0, moduleSpecifier };
154188
154229
  }
154189
154230
  });
154190
154231
  }
@@ -154228,7 +154269,7 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
154228
154269
  return void 0;
154229
154270
  }
154230
154271
  if (declaration.kind === 260 /* VariableDeclaration */) {
154231
- return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 206 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0;
154272
+ return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 206 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifierKind: void 0, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0;
154232
154273
  }
154233
154274
  const { importClause } = declaration;
154234
154275
  if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) {
@@ -154258,6 +154299,7 @@ function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker
154258
154299
  kind: 2 /* AddToExisting */,
154259
154300
  importClauseOrBindingPattern: importClause,
154260
154301
  importKind,
154302
+ moduleSpecifierKind: void 0,
154261
154303
  moduleSpecifier: declaration.moduleSpecifier.text,
154262
154304
  addAsTypeOnly
154263
154305
  };
@@ -154319,7 +154361,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154319
154361
  const getChecker = createGetChecker(program, host);
154320
154362
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
154321
154363
  const rejectNodeModulesRelativePaths = moduleResolutionUsesNodeModules(moduleResolution);
154322
- const getModuleSpecifiers2 = fromCacheOnly ? (exportInfo2) => ({ moduleSpecifiers: ts_moduleSpecifiers_exports.tryGetModuleSpecifiersFromCache(exportInfo2.moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }) : (exportInfo2, checker) => ts_moduleSpecifiers_exports.getModuleSpecifiersWithCacheInfo(
154364
+ const getModuleSpecifiers2 = fromCacheOnly ? (exportInfo2) => ts_moduleSpecifiers_exports.tryGetModuleSpecifiersFromCache(exportInfo2.moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences) : (exportInfo2, checker) => ts_moduleSpecifiers_exports.getModuleSpecifiersWithCacheInfo(
154323
154365
  exportInfo2.moduleSymbol,
154324
154366
  checker,
154325
154367
  compilerOptions,
@@ -154334,7 +154376,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154334
154376
  let computedWithoutCacheCount = 0;
154335
154377
  const fixes = flatMap(exportInfo, (exportInfo2, i) => {
154336
154378
  const checker = getChecker(exportInfo2.isFromPackageJson);
154337
- const { computedWithoutCache, moduleSpecifiers } = getModuleSpecifiers2(exportInfo2, checker);
154379
+ const { computedWithoutCache, moduleSpecifiers, kind: moduleSpecifierKind } = getModuleSpecifiers2(exportInfo2, checker) ?? {};
154338
154380
  const importedSymbolHasValueMeaning = !!(exportInfo2.targetFlags & 111551 /* Value */);
154339
154381
  const addAsTypeOnly = getAddAsTypeOnly(
154340
154382
  isValidTypeOnlyUseSite,
@@ -154351,7 +154393,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154351
154393
  return void 0;
154352
154394
  }
154353
154395
  if (!importedSymbolHasValueMeaning && isJs && usagePosition !== void 0) {
154354
- return { kind: 1 /* JsdocTypeImport */, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
154396
+ return { kind: 1 /* JsdocTypeImport */, moduleSpecifierKind, moduleSpecifier, usagePosition, exportInfo: exportInfo2, isReExport: i > 0 };
154355
154397
  }
154356
154398
  const importKind = getImportKind(sourceFile, exportInfo2.exportKind, program);
154357
154399
  let qualification;
@@ -154378,6 +154420,7 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154378
154420
  }
154379
154421
  return {
154380
154422
  kind: 3 /* AddNew */,
154423
+ moduleSpecifierKind,
154381
154424
  moduleSpecifier,
154382
154425
  importKind,
154383
154426
  useRequire,
@@ -154407,7 +154450,7 @@ function newImportInfoFromExistingSpecifier({ declaration, importKind, symbol, t
154407
154450
  checker,
154408
154451
  compilerOptions
154409
154452
  );
154410
- return { kind: 3 /* AddNew */, moduleSpecifier, importKind, addAsTypeOnly, useRequire };
154453
+ return { kind: 3 /* AddNew */, moduleSpecifierKind: void 0, moduleSpecifier, importKind, addAsTypeOnly, useRequire };
154411
154454
  }
154412
154455
  }
154413
154456
  function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
@@ -154425,18 +154468,18 @@ function getFixInfos(context, errorCode, pos, useAutoImportProvider) {
154425
154468
  info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
154426
154469
  }
154427
154470
  const packageJsonImportFilter = createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
154428
- return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host);
154471
+ return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host, context.preferences);
154429
154472
  }
154430
- function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) {
154473
+ function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host, preferences) {
154431
154474
  const _toPath = (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
154432
- return sort(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath));
154475
+ return sort(fixes, (a, b) => compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || compareValues(a.fix.kind, b.fix.kind) || compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, preferences, packageJsonImportFilter.allowsImportingSpecifier, _toPath));
154433
154476
  }
154434
154477
  function getFixInfosWithoutDiagnostic(context, symbolToken, useAutoImportProvider) {
154435
154478
  const info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider);
154436
154479
  const packageJsonImportFilter = createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
154437
- return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host);
154480
+ return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host, context.preferences);
154438
154481
  }
154439
- function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
154482
+ function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host, preferences) {
154440
154483
  if (!some(fixes)) return;
154441
154484
  if (fixes[0].kind === 0 /* UseNamespace */ || fixes[0].kind === 2 /* AddToExisting */) {
154442
154485
  return fixes[0];
@@ -154449,21 +154492,31 @@ function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) {
154449
154492
  best,
154450
154493
  sourceFile,
154451
154494
  program,
154495
+ preferences,
154452
154496
  packageJsonImportFilter.allowsImportingSpecifier,
154453
154497
  (fileName) => toPath(fileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host))
154454
154498
  ) === -1 /* LessThan */ ? fix : best
154455
154499
  )
154456
154500
  );
154457
154501
  }
154458
- function compareModuleSpecifiers(a, b, importingFile, program, allowsImportingSpecifier, toPath3) {
154502
+ function compareModuleSpecifiers(a, b, importingFile, program, preferences, allowsImportingSpecifier, toPath3) {
154459
154503
  if (a.kind !== 0 /* UseNamespace */ && b.kind !== 0 /* UseNamespace */) {
154460
- return compareBooleans(allowsImportingSpecifier(b.moduleSpecifier), allowsImportingSpecifier(a.moduleSpecifier)) || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program) || compareBooleans(
154504
+ return compareBooleans(
154505
+ b.moduleSpecifierKind !== "node_modules" || allowsImportingSpecifier(b.moduleSpecifier),
154506
+ a.moduleSpecifierKind !== "node_modules" || allowsImportingSpecifier(a.moduleSpecifier)
154507
+ ) || compareModuleSpecifierRelativity(a, b, preferences) || compareNodeCoreModuleSpecifiers(a.moduleSpecifier, b.moduleSpecifier, importingFile, program) || compareBooleans(
154461
154508
  isFixPossiblyReExportingImportingFile(a, importingFile.path, toPath3),
154462
154509
  isFixPossiblyReExportingImportingFile(b, importingFile.path, toPath3)
154463
154510
  ) || compareNumberOfDirectorySeparators(a.moduleSpecifier, b.moduleSpecifier);
154464
154511
  }
154465
154512
  return 0 /* EqualTo */;
154466
154513
  }
154514
+ function compareModuleSpecifierRelativity(a, b, preferences) {
154515
+ if (preferences.importModuleSpecifierPreference === "non-relative" || preferences.importModuleSpecifierPreference === "project-relative") {
154516
+ return compareBooleans(a.moduleSpecifierKind === "relative", b.moduleSpecifierKind === "relative");
154517
+ }
154518
+ return 0 /* EqualTo */;
154519
+ }
154467
154520
  function isFixPossiblyReExportingImportingFile(fix, importingFilePath, toPath3) {
154468
154521
  var _a;
154469
154522
  if (fix.isReExport && ((_a = fix.exportInfo) == null ? void 0 : _a.moduleFileName) && isIndexFileName(fix.exportInfo.moduleFileName)) {
@@ -158020,6 +158073,7 @@ var errorCodes47 = [
158020
158073
  Diagnostics.Property_must_have_an_explicit_type_annotation_with_isolatedDeclarations.code,
158021
158074
  Diagnostics.Expression_type_can_t_be_inferred_with_isolatedDeclarations.code,
158022
158075
  Diagnostics.Binding_elements_can_t_be_exported_directly_with_isolatedDeclarations.code,
158076
+ Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations.code,
158023
158077
  Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations.code,
158024
158078
  Diagnostics.Enum_member_initializers_must_be_computable_without_references_to_external_symbols_with_isolatedDeclarations.code,
158025
158079
  Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations.code,
@@ -158030,6 +158084,7 @@ var errorCodes47 = [
158030
158084
  Diagnostics.Only_const_arrays_can_be_inferred_with_isolatedDeclarations.code,
158031
158085
  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,
158032
158086
  Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations.code,
158087
+ Diagnostics.Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations.code,
158033
158088
  Diagnostics.Add_satisfies_and_a_type_assertion_to_this_expression_satisfies_T_as_T_to_make_the_type_explicit.code
158034
158089
  ];
158035
158090
  var canHaveTypeAnnotation = /* @__PURE__ */ new Set([
@@ -158190,7 +158245,7 @@ function withContext(context, typePrintMode, cb) {
158190
158245
  if (findAncestor(targetNode, isEnumMember)) {
158191
158246
  return void 0;
158192
158247
  }
158193
- if (isExpressionTarget && findAncestor(targetNode, isHeritageClause)) {
158248
+ if (isExpressionTarget && (findAncestor(targetNode, isHeritageClause) || findAncestor(targetNode, isTypeNode))) {
158194
158249
  return void 0;
158195
158250
  }
158196
158251
  if (isSpreadElement(targetNode)) {
@@ -170719,6 +170774,213 @@ function getRightHandSideOfAssignment(rightHandSide) {
170719
170774
  }
170720
170775
  }
170721
170776
 
170777
+ // src/services/_namespaces/ts.MapCode.ts
170778
+ var ts_MapCode_exports = {};
170779
+ __export(ts_MapCode_exports, {
170780
+ mapCode: () => mapCode
170781
+ });
170782
+
170783
+ // src/services/mapCode.ts
170784
+ function mapCode(sourceFile, contents, focusLocations, host, formatContext, preferences) {
170785
+ return ts_textChanges_exports.ChangeTracker.with(
170786
+ { host, formatContext, preferences },
170787
+ (changeTracker) => {
170788
+ const parsed = contents.map((c) => parse(sourceFile, c));
170789
+ const flattenedLocations = focusLocations && flatten(focusLocations);
170790
+ for (const nodes of parsed) {
170791
+ placeNodeGroup(
170792
+ sourceFile,
170793
+ changeTracker,
170794
+ nodes,
170795
+ flattenedLocations
170796
+ );
170797
+ }
170798
+ }
170799
+ );
170800
+ }
170801
+ function parse(sourceFile, content) {
170802
+ const nodeKinds = [
170803
+ {
170804
+ parse: () => createSourceFile(
170805
+ "__mapcode_content_nodes.ts",
170806
+ content,
170807
+ sourceFile.languageVersion,
170808
+ /*setParentNodes*/
170809
+ true,
170810
+ sourceFile.scriptKind
170811
+ ),
170812
+ body: (sf) => sf.statements
170813
+ },
170814
+ {
170815
+ parse: () => createSourceFile(
170816
+ "__mapcode_class_content_nodes.ts",
170817
+ `class __class {
170818
+ ${content}
170819
+ }`,
170820
+ sourceFile.languageVersion,
170821
+ /*setParentNodes*/
170822
+ true,
170823
+ sourceFile.scriptKind
170824
+ ),
170825
+ body: (cw) => cw.statements[0].members
170826
+ }
170827
+ ];
170828
+ const parsedNodes = [];
170829
+ for (const { parse: parse2, body: body2 } of nodeKinds) {
170830
+ const sourceFile2 = parse2();
170831
+ const bod = body2(sourceFile2);
170832
+ if (bod.length && sourceFile2.parseDiagnostics.length === 0) {
170833
+ return bod;
170834
+ } else if (bod.length) {
170835
+ parsedNodes.push({ sourceFile: sourceFile2, body: bod });
170836
+ }
170837
+ }
170838
+ const { body } = parsedNodes.sort(
170839
+ (a, b) => a.sourceFile.parseDiagnostics.length - b.sourceFile.parseDiagnostics.length
170840
+ )[0];
170841
+ return body;
170842
+ }
170843
+ function placeNodeGroup(originalFile, changeTracker, changes, focusLocations) {
170844
+ if (isClassElement(changes[0]) || isTypeElement(changes[0])) {
170845
+ placeClassNodeGroup(
170846
+ originalFile,
170847
+ changeTracker,
170848
+ changes,
170849
+ focusLocations
170850
+ );
170851
+ } else {
170852
+ placeStatements(
170853
+ originalFile,
170854
+ changeTracker,
170855
+ changes,
170856
+ focusLocations
170857
+ );
170858
+ }
170859
+ }
170860
+ function placeClassNodeGroup(originalFile, changeTracker, changes, focusLocations) {
170861
+ let classOrInterface;
170862
+ if (!focusLocations || !focusLocations.length) {
170863
+ classOrInterface = find(originalFile.statements, or(isClassLike, isInterfaceDeclaration));
170864
+ } else {
170865
+ classOrInterface = forEach(focusLocations, (location) => findAncestor(
170866
+ getTokenAtPosition(originalFile, location.start),
170867
+ or(isClassLike, isInterfaceDeclaration)
170868
+ ));
170869
+ }
170870
+ if (!classOrInterface) {
170871
+ return;
170872
+ }
170873
+ const firstMatch = classOrInterface.members.find((member) => changes.some((change) => matchNode(change, member)));
170874
+ if (firstMatch) {
170875
+ const lastMatch = findLast(
170876
+ classOrInterface.members,
170877
+ (member) => changes.some((change) => matchNode(change, member))
170878
+ );
170879
+ forEach(changes, wipeNode);
170880
+ changeTracker.replaceNodeRangeWithNodes(
170881
+ originalFile,
170882
+ firstMatch,
170883
+ lastMatch,
170884
+ changes
170885
+ );
170886
+ return;
170887
+ }
170888
+ forEach(changes, wipeNode);
170889
+ changeTracker.insertNodesAfter(
170890
+ originalFile,
170891
+ classOrInterface.members[classOrInterface.members.length - 1],
170892
+ changes
170893
+ );
170894
+ }
170895
+ function placeStatements(originalFile, changeTracker, changes, focusLocations) {
170896
+ if (!(focusLocations == null ? void 0 : focusLocations.length)) {
170897
+ changeTracker.insertNodesAtEndOfFile(
170898
+ originalFile,
170899
+ changes,
170900
+ /*blankLineBetween*/
170901
+ false
170902
+ );
170903
+ return;
170904
+ }
170905
+ for (const location of focusLocations) {
170906
+ const scope = findAncestor(
170907
+ getTokenAtPosition(originalFile, location.start),
170908
+ (block) => or(isBlock, isSourceFile)(block) && some(block.statements, (origStmt) => changes.some((newStmt) => matchNode(newStmt, origStmt)))
170909
+ );
170910
+ if (scope) {
170911
+ const start = scope.statements.find((stmt) => changes.some((node) => matchNode(node, stmt)));
170912
+ if (start) {
170913
+ const end = findLast(scope.statements, (stmt) => changes.some((node) => matchNode(node, stmt)));
170914
+ forEach(changes, wipeNode);
170915
+ changeTracker.replaceNodeRangeWithNodes(
170916
+ originalFile,
170917
+ start,
170918
+ end,
170919
+ changes
170920
+ );
170921
+ return;
170922
+ }
170923
+ }
170924
+ }
170925
+ let scopeStatements = originalFile.statements;
170926
+ for (const location of focusLocations) {
170927
+ const block = findAncestor(
170928
+ getTokenAtPosition(originalFile, location.start),
170929
+ isBlock
170930
+ );
170931
+ if (block) {
170932
+ scopeStatements = block.statements;
170933
+ break;
170934
+ }
170935
+ }
170936
+ forEach(changes, wipeNode);
170937
+ changeTracker.insertNodesAfter(
170938
+ originalFile,
170939
+ scopeStatements[scopeStatements.length - 1],
170940
+ changes
170941
+ );
170942
+ }
170943
+ function matchNode(a, b) {
170944
+ var _a, _b, _c, _d, _e, _f;
170945
+ if (a.kind !== b.kind) {
170946
+ return false;
170947
+ }
170948
+ if (a.kind === 176 /* Constructor */) {
170949
+ return a.kind === b.kind;
170950
+ }
170951
+ if (isNamedDeclaration(a) && isNamedDeclaration(b)) {
170952
+ return a.name.getText() === b.name.getText();
170953
+ }
170954
+ if (isIfStatement(a) && isIfStatement(b)) {
170955
+ return a.expression.getText() === b.expression.getText();
170956
+ }
170957
+ if (isWhileStatement(a) && isWhileStatement(b)) {
170958
+ return a.expression.getText() === b.expression.getText();
170959
+ }
170960
+ if (isForStatement(a) && isForStatement(b)) {
170961
+ return ((_a = a.initializer) == null ? void 0 : _a.getText()) === ((_b = b.initializer) == null ? void 0 : _b.getText()) && ((_c = a.incrementor) == null ? void 0 : _c.getText()) === ((_d = b.incrementor) == null ? void 0 : _d.getText()) && ((_e = a.condition) == null ? void 0 : _e.getText()) === ((_f = b.condition) == null ? void 0 : _f.getText());
170962
+ }
170963
+ if (isForInOrOfStatement(a) && isForInOrOfStatement(b)) {
170964
+ return a.expression.getText() === b.expression.getText() && a.initializer.getText() === b.initializer.getText();
170965
+ }
170966
+ if (isLabeledStatement(a) && isLabeledStatement(b)) {
170967
+ return a.label.getText() === b.label.getText();
170968
+ }
170969
+ if (a.getText() === b.getText()) {
170970
+ return true;
170971
+ }
170972
+ return false;
170973
+ }
170974
+ function wipeNode(node) {
170975
+ resetNodePositions(node);
170976
+ node.parent = void 0;
170977
+ }
170978
+ function resetNodePositions(node) {
170979
+ node.pos = -1;
170980
+ node.end = -1;
170981
+ node.forEachChild(resetNodePositions);
170982
+ }
170983
+
170722
170984
  // src/services/_namespaces/ts.OrganizeImports.ts
170723
170985
  var ts_OrganizeImports_exports = {};
170724
170986
  __export(ts_OrganizeImports_exports, {
@@ -177371,13 +177633,6 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
177371
177633
  if (pastedText.length !== pasteLocations.length) {
177372
177634
  actualPastedText = pastedText.length === 1 ? pastedText : [pastedText.join("\n")];
177373
177635
  }
177374
- pasteLocations.forEach((paste, i) => {
177375
- changes.replaceRangeWithText(
177376
- targetFile,
177377
- { pos: paste.pos, end: paste.end },
177378
- actualPastedText ? actualPastedText[0] : pastedText[i]
177379
- );
177380
- });
177381
177636
  const statements = [];
177382
177637
  let newText = targetFile.text;
177383
177638
  for (let i = pasteLocations.length - 1; i >= 0; i--) {
@@ -177425,6 +177680,13 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
177425
177680
  }
177426
177681
  importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
177427
177682
  });
177683
+ pasteLocations.forEach((paste, i) => {
177684
+ changes.replaceRangeWithText(
177685
+ targetFile,
177686
+ { pos: paste.pos, end: paste.end },
177687
+ actualPastedText ? actualPastedText[0] : pastedText[i]
177688
+ );
177689
+ });
177428
177690
  }
177429
177691
 
177430
177692
  // src/server/_namespaces/ts.ts
@@ -177506,6 +177768,7 @@ __export(ts_exports2, {
177506
177768
  LexicalEnvironmentFlags: () => LexicalEnvironmentFlags,
177507
177769
  ListFormat: () => ListFormat,
177508
177770
  LogLevel: () => LogLevel,
177771
+ MapCode: () => ts_MapCode_exports,
177509
177772
  MemberOverrideStatus: () => MemberOverrideStatus,
177510
177773
  ModifierFlags: () => ModifierFlags,
177511
177774
  ModuleDetectionKind: () => ModuleDetectionKind,
@@ -177926,6 +178189,7 @@ __export(ts_exports2, {
177926
178189
  emitNewLineBeforeLeadingCommentOfPosition: () => emitNewLineBeforeLeadingCommentOfPosition,
177927
178190
  emitNewLineBeforeLeadingComments: () => emitNewLineBeforeLeadingComments,
177928
178191
  emitNewLineBeforeLeadingCommentsOfPosition: () => emitNewLineBeforeLeadingCommentsOfPosition,
178192
+ emitResolverSkipsTypeChecking: () => emitResolverSkipsTypeChecking,
177929
178193
  emitSkippedWithNoDiagnostics: () => emitSkippedWithNoDiagnostics,
177930
178194
  emptyArray: () => emptyArray,
177931
178195
  emptyFileSystemEntries: () => emptyFileSystemEntries,
@@ -180686,6 +180950,7 @@ var CommandTypes = /* @__PURE__ */ ((CommandTypes2) => {
180686
180950
  CommandTypes2["ProvideCallHierarchyOutgoingCalls"] = "provideCallHierarchyOutgoingCalls";
180687
180951
  CommandTypes2["ProvideInlayHints"] = "provideInlayHints";
180688
180952
  CommandTypes2["WatchChange"] = "watchChange";
180953
+ CommandTypes2["MapCode"] = "mapCode";
180689
180954
  return CommandTypes2;
180690
180955
  })(CommandTypes || {});
180691
180956
  var WatchFileKind2 = /* @__PURE__ */ ((WatchFileKind3) => {
@@ -183032,14 +183297,14 @@ var Project3 = class _Project {
183032
183297
  }
183033
183298
  /** @internal */
183034
183299
  runWithTemporaryFileUpdate(rootFile, updatedText, cb) {
183035
- var _a, _b, _c, _d, _e;
183300
+ var _a, _b, _c, _d;
183036
183301
  const originalProgram = this.program;
183037
- const originalText = (_b = (_a = this.program) == null ? void 0 : _a.getSourceFile(rootFile)) == null ? void 0 : _b.getText();
183038
- Debug.assert(this.program && this.program.getSourceFile(rootFile) && originalText);
183039
- (_c = this.getScriptInfo(rootFile)) == null ? void 0 : _c.editContent(0, this.program.getSourceFile(rootFile).getText().length, updatedText);
183302
+ const rootSourceFile = Debug.checkDefined((_a = this.program) == null ? void 0 : _a.getSourceFile(rootFile), "Expected file to be part of program");
183303
+ const originalText = Debug.checkDefined(rootSourceFile.getText());
183304
+ (_b = this.getScriptInfo(rootFile)) == null ? void 0 : _b.editContent(0, originalText.length, updatedText);
183040
183305
  this.updateGraph();
183041
- cb(this.program, originalProgram, (_d = this.program) == null ? void 0 : _d.getSourceFile(rootFile));
183042
- (_e = this.getScriptInfo(rootFile)) == null ? void 0 : _e.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
183306
+ cb(this.program, originalProgram, (_c = this.program) == null ? void 0 : _c.getSourceFile(rootFile));
183307
+ (_d = this.getScriptInfo(rootFile)) == null ? void 0 : _d.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
183043
183308
  }
183044
183309
  /** @internal */
183045
183310
  getCompilerOptionsForNoDtsResolutionProject() {
@@ -187340,8 +187605,9 @@ function createModuleSpecifierCache(host) {
187340
187605
  if (!cache || currentKey !== key(fromFileName, preferences, options)) return void 0;
187341
187606
  return cache.get(toFileName2);
187342
187607
  },
187343
- set(fromFileName, toFileName2, preferences, options, modulePaths, moduleSpecifiers) {
187608
+ set(fromFileName, toFileName2, preferences, options, kind, modulePaths, moduleSpecifiers) {
187344
187609
  ensureCache(fromFileName, preferences, options).set(toFileName2, createInfo(
187610
+ kind,
187345
187611
  modulePaths,
187346
187612
  moduleSpecifiers,
187347
187613
  /*isBlockedByPackageJsonDependencies*/
@@ -187369,6 +187635,8 @@ function createModuleSpecifierCache(host) {
187369
187635
  info.modulePaths = modulePaths;
187370
187636
  } else {
187371
187637
  cache2.set(toFileName2, createInfo(
187638
+ /*kind*/
187639
+ void 0,
187372
187640
  modulePaths,
187373
187641
  /*moduleSpecifiers*/
187374
187642
  void 0,
@@ -187384,6 +187652,8 @@ function createModuleSpecifierCache(host) {
187384
187652
  info.isBlockedByPackageJsonDependencies = isBlockedByPackageJsonDependencies;
187385
187653
  } else {
187386
187654
  cache2.set(toFileName2, createInfo(
187655
+ /*kind*/
187656
+ void 0,
187387
187657
  /*modulePaths*/
187388
187658
  void 0,
187389
187659
  /*moduleSpecifiers*/
@@ -187417,8 +187687,8 @@ function createModuleSpecifierCache(host) {
187417
187687
  function key(fromFileName, preferences, options) {
187418
187688
  return `${fromFileName},${preferences.importModuleSpecifierEnding},${preferences.importModuleSpecifierPreference},${options.overrideImportMode}`;
187419
187689
  }
187420
- function createInfo(modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
187421
- return { modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies };
187690
+ function createInfo(kind, modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
187691
+ return { kind, modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies };
187422
187692
  }
187423
187693
  }
187424
187694
 
@@ -188621,6 +188891,9 @@ var Session3 = class _Session {
188621
188891
  },
188622
188892
  ["provideInlayHints" /* ProvideInlayHints */]: (request) => {
188623
188893
  return this.requiredResponse(this.provideInlayHints(request.arguments));
188894
+ },
188895
+ ["mapCode" /* MapCode */]: (request) => {
188896
+ return this.requiredResponse(this.mapCode(request.arguments));
188624
188897
  }
188625
188898
  }));
188626
188899
  this.host = opts.host;
@@ -189483,6 +189756,25 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
189483
189756
  };
189484
189757
  });
189485
189758
  }
189759
+ mapCode(args) {
189760
+ var _a;
189761
+ const formatOptions = this.getHostFormatOptions();
189762
+ const preferences = this.getHostPreferences();
189763
+ const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
189764
+ const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
189765
+ const focusLocations = (_a = args.mapping.focusLocations) == null ? void 0 : _a.map((spans) => {
189766
+ return spans.map((loc) => {
189767
+ const start = scriptInfo.lineOffsetToPosition(loc.start.line, loc.start.offset);
189768
+ const end = scriptInfo.lineOffsetToPosition(loc.end.line, loc.end.offset);
189769
+ return {
189770
+ start,
189771
+ length: end - start
189772
+ };
189773
+ });
189774
+ });
189775
+ const changes = languageService.mapCode(file, args.mapping.contents, focusLocations, formatOptions, preferences);
189776
+ return this.mapTextChangesToCodeEdits(changes);
189777
+ }
189486
189778
  setCompilerOptionsForInferredProjects(args) {
189487
189779
  this.projectService.setCompilerOptionsForInferredProjects(args.options, args.projectRootPath);
189488
189780
  }
@@ -191907,6 +192199,7 @@ if (typeof console !== "undefined") {
191907
192199
  LexicalEnvironmentFlags,
191908
192200
  ListFormat,
191909
192201
  LogLevel,
192202
+ MapCode,
191910
192203
  MemberOverrideStatus,
191911
192204
  ModifierFlags,
191912
192205
  ModuleDetectionKind,
@@ -192327,6 +192620,7 @@ if (typeof console !== "undefined") {
192327
192620
  emitNewLineBeforeLeadingCommentOfPosition,
192328
192621
  emitNewLineBeforeLeadingComments,
192329
192622
  emitNewLineBeforeLeadingCommentsOfPosition,
192623
+ emitResolverSkipsTypeChecking,
192330
192624
  emitSkippedWithNoDiagnostics,
192331
192625
  emptyArray,
192332
192626
  emptyFileSystemEntries,