@typescript-deploys/pr-build 5.1.0-pr-54186-8 → 5.1.0-pr-54216-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.1";
21
- var version = `${versionMajorMinor}.0-insiders.20230508`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230512`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6971,6 +6971,7 @@ var Diagnostics = {
6971
6971
  List_of_folders_to_include_type_definitions_from: diag(6161, 3 /* Message */, "List_of_folders_to_include_type_definitions_from_6161", "List of folders to include type definitions from."),
6972
6972
  Disable_size_limitations_on_JavaScript_projects: diag(6162, 3 /* Message */, "Disable_size_limitations_on_JavaScript_projects_6162", "Disable size limitations on JavaScript projects."),
6973
6973
  The_character_set_of_the_input_files: diag(6163, 3 /* Message */, "The_character_set_of_the_input_files_6163", "The character set of the input files."),
6974
+ Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1: diag(6164, 3 /* Message */, "Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1_6164", "Skipping module '{0}' that looks like an absolute URI, target file types: {1}."),
6974
6975
  Do_not_truncate_error_messages: diag(6165, 3 /* Message */, "Do_not_truncate_error_messages_6165", "Do not truncate error messages."),
6975
6976
  Output_directory_for_generated_declaration_files: diag(6166, 3 /* Message */, "Output_directory_for_generated_declaration_files_6166", "Output directory for generated declaration files."),
6976
6977
  A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: diag(6167, 3 /* Message */, "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."),
@@ -10916,7 +10917,6 @@ function isLeftHandSideExpressionKind(kind) {
10916
10917
  case 283 /* JsxElement */:
10917
10918
  case 284 /* JsxSelfClosingElement */:
10918
10919
  case 287 /* JsxFragment */:
10919
- case 294 /* JsxNamespacedName */:
10920
10920
  case 214 /* TaggedTemplateExpression */:
10921
10921
  case 208 /* ArrayLiteralExpression */:
10922
10922
  case 216 /* ParenthesizedExpression */:
@@ -11430,7 +11430,39 @@ function projectReferenceIsEqualTo(oldRef, newRef) {
11430
11430
  return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
11431
11431
  }
11432
11432
  function moduleResolutionIsEqualTo(oldResolution, newResolution) {
11433
- return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
11433
+ return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.node10Result === newResolution.node10Result;
11434
+ }
11435
+ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
11436
+ var _a, _b;
11437
+ const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
11438
+ const result = node10Result ? chainDiagnosticMessages(
11439
+ /*details*/
11440
+ void 0,
11441
+ Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
11442
+ node10Result,
11443
+ node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageName)}` : packageName
11444
+ ) : host.typesPackageExists(packageName) ? chainDiagnosticMessages(
11445
+ /*details*/
11446
+ void 0,
11447
+ Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1,
11448
+ packageName,
11449
+ mangleScopedPackageName(packageName)
11450
+ ) : host.packageBundlesTypes(packageName) ? chainDiagnosticMessages(
11451
+ /*details*/
11452
+ void 0,
11453
+ Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,
11454
+ packageName,
11455
+ moduleReference
11456
+ ) : chainDiagnosticMessages(
11457
+ /*details*/
11458
+ void 0,
11459
+ Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
11460
+ moduleReference,
11461
+ mangleScopedPackageName(packageName)
11462
+ );
11463
+ if (result)
11464
+ result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
11465
+ return result;
11434
11466
  }
11435
11467
  function packageIdIsEqual(a, b) {
11436
11468
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
@@ -12282,6 +12314,8 @@ function tryGetTextOfPropertyName(name) {
12282
12314
  if (isStringOrNumericLiteralLike(name.expression))
12283
12315
  return escapeLeadingUnderscores(name.expression.text);
12284
12316
  return void 0;
12317
+ case 294 /* JsxNamespacedName */:
12318
+ return getEscapedTextOfJsxNamespacedName(name);
12285
12319
  default:
12286
12320
  return Debug.assertNever(name);
12287
12321
  }
@@ -14163,6 +14197,8 @@ function getPropertyNameForPropertyNameNode(name) {
14163
14197
  return nameExpression.operand.text;
14164
14198
  }
14165
14199
  return void 0;
14200
+ case 294 /* JsxNamespacedName */:
14201
+ return getEscapedTextOfJsxNamespacedName(name);
14166
14202
  default:
14167
14203
  return Debug.assertNever(name);
14168
14204
  }
@@ -14179,10 +14215,10 @@ function isPropertyNameLiteral(node) {
14179
14215
  }
14180
14216
  }
14181
14217
  function getTextOfIdentifierOrLiteral(node) {
14182
- return isMemberName(node) ? idText(node) : node.text;
14218
+ return isMemberName(node) ? idText(node) : isJsxNamespacedName(node) ? getTextOfJsxNamespacedName(node) : node.text;
14183
14219
  }
14184
14220
  function getEscapedTextOfIdentifierOrLiteral(node) {
14185
- return isMemberName(node) ? node.escapedText : escapeLeadingUnderscores(node.text);
14221
+ return isMemberName(node) ? node.escapedText : isJsxNamespacedName(node) ? getEscapedTextOfJsxNamespacedName(node) : escapeLeadingUnderscores(node.text);
14186
14222
  }
14187
14223
  function getSymbolNameForPrivateIdentifier(containingClassSymbol, description) {
14188
14224
  return `__#${getSymbolId(containingClassSymbol)}@${description}`;
@@ -15413,6 +15449,8 @@ function tryGetPropertyAccessOrIdentifierToString(expr) {
15413
15449
  }
15414
15450
  } else if (isIdentifier(expr)) {
15415
15451
  return unescapeLeadingUnderscores(expr.escapedText);
15452
+ } else if (isJsxNamespacedName(expr)) {
15453
+ return getTextOfJsxNamespacedName(expr);
15416
15454
  }
15417
15455
  return void 0;
15418
15456
  }
@@ -29582,7 +29620,11 @@ var Parser;
29582
29620
  }
29583
29621
  function parseJsxElementName() {
29584
29622
  const pos = getNodePos();
29585
- let expression = parseJsxTagName();
29623
+ const initialExpression = parseJsxTagName();
29624
+ if (isJsxNamespacedName(initialExpression)) {
29625
+ return initialExpression;
29626
+ }
29627
+ let expression = initialExpression;
29586
29628
  while (parseOptional(25 /* DotToken */)) {
29587
29629
  expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
29588
29630
  /*allowIdentifierNames*/
@@ -37524,8 +37566,6 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
37524
37566
  const diagnosticState = {
37525
37567
  ...state,
37526
37568
  features: state.features & ~8 /* Exports */,
37527
- failedLookupLocations: [],
37528
- affectingLocations: [],
37529
37569
  reportDiagnostic: noop
37530
37570
  };
37531
37571
  const diagnosticResult = tryResolve(extensions & (1 /* TypeScript */ | 4 /* Declaration */), diagnosticState);
@@ -37565,6 +37605,12 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
37565
37605
  resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
37566
37606
  }
37567
37607
  if (!resolved2) {
37608
+ if (moduleName.indexOf(":") > -1) {
37609
+ if (traceEnabled) {
37610
+ trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
37611
+ }
37612
+ return void 0;
37613
+ }
37568
37614
  if (traceEnabled) {
37569
37615
  trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
37570
37616
  }
@@ -38497,7 +38543,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
38497
38543
  return withPackageId(packageInfo, fromDirectory);
38498
38544
  }
38499
38545
  const loader = (extensions2, candidate2, onlyRecordFailures, state2) => {
38500
- let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
38546
+ let pathAndExtension = (rest || !(state2.features & 32 /* EsmMode */)) && loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker(
38501
38547
  extensions2,
38502
38548
  candidate2,
38503
38549
  onlyRecordFailures,
@@ -42378,7 +42424,10 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
42378
42424
  const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
42379
42425
  if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
42380
42426
  const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
42381
- if (removeFileExtension(mainExportFile) === removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
42427
+ const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
42428
+ if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
42429
+ return { packageRootPath, moduleFileToTry };
42430
+ } else if (packageJsonContent.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
42382
42431
  return { packageRootPath, moduleFileToTry };
42383
42432
  }
42384
42433
  }
@@ -42598,10 +42647,9 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
42598
42647
  CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
42599
42648
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
42600
42649
  CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
42601
- CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
42602
- CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
42603
- CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
42604
- CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
42650
+ CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
42651
+ CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
42652
+ CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
42605
42653
  return CheckMode3;
42606
42654
  })(CheckMode || {});
42607
42655
  var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -42645,18 +42693,6 @@ function isInstantiatedModule(node, preserveConstEnums) {
42645
42693
  return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
42646
42694
  }
42647
42695
  function createTypeChecker(host) {
42648
- var getPackagesMap = memoize(() => {
42649
- var map2 = /* @__PURE__ */ new Map();
42650
- host.getSourceFiles().forEach((sf) => {
42651
- if (!sf.resolvedModules)
42652
- return;
42653
- sf.resolvedModules.forEach(({ resolvedModule }) => {
42654
- if (resolvedModule == null ? void 0 : resolvedModule.packageId)
42655
- map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name));
42656
- });
42657
- });
42658
- return map2;
42659
- });
42660
42696
  var deferredDiagnosticsCallbacks = [];
42661
42697
  var addLazyDiagnostic = (arg) => {
42662
42698
  deferredDiagnosticsCallbacks.push(arg);
@@ -42893,9 +42929,9 @@ function createTypeChecker(host) {
42893
42929
  candidatesOutArray,
42894
42930
  /*argumentCount*/
42895
42931
  void 0,
42896
- 64 /* IsForStringLiteralArgumentCompletions */
42932
+ 32 /* IsForStringLiteralArgumentCompletions */
42897
42933
  )),
42898
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
42934
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
42899
42935
  getExpandedParameters,
42900
42936
  hasEffectiveRestParameter,
42901
42937
  containsArgumentsReference,
@@ -44439,7 +44475,7 @@ function createTypeChecker(host) {
44439
44475
  if (!result) {
44440
44476
  if (nameNotFoundMessage) {
44441
44477
  addLazyDiagnostic(() => {
44442
- if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
44478
+ if (!errorLocation || errorLocation.parent.kind !== 330 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
44443
44479
  !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
44444
44480
  let suggestion;
44445
44481
  let suggestedLib;
@@ -45992,35 +46028,9 @@ function createTypeChecker(host) {
45992
46028
  }
45993
46029
  }
45994
46030
  function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) {
45995
- var _a, _b;
45996
46031
  let errorInfo;
45997
46032
  if (!isExternalModuleNameRelative(moduleReference) && packageId) {
45998
- const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
45999
- errorInfo = node10Result ? chainDiagnosticMessages(
46000
- /*details*/
46001
- void 0,
46002
- Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
46003
- node10Result,
46004
- node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageId.name)}` : packageId.name
46005
- ) : typesPackageExists(packageId.name) ? chainDiagnosticMessages(
46006
- /*details*/
46007
- void 0,
46008
- Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1,
46009
- packageId.name,
46010
- mangleScopedPackageName(packageId.name)
46011
- ) : packageBundlesTypes(packageId.name) ? chainDiagnosticMessages(
46012
- /*details*/
46013
- void 0,
46014
- Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,
46015
- packageId.name,
46016
- moduleReference
46017
- ) : chainDiagnosticMessages(
46018
- /*details*/
46019
- void 0,
46020
- Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
46021
- moduleReference,
46022
- mangleScopedPackageName(packageId.name)
46023
- );
46033
+ errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
46024
46034
  }
46025
46035
  errorOrSuggestion(isError, errorNode, chainDiagnosticMessages(
46026
46036
  errorInfo,
@@ -46029,12 +46039,6 @@ function createTypeChecker(host) {
46029
46039
  resolvedFileName
46030
46040
  ));
46031
46041
  }
46032
- function typesPackageExists(packageName) {
46033
- return getPackagesMap().has(getTypesPackageName(packageName));
46034
- }
46035
- function packageBundlesTypes(packageName) {
46036
- return !!getPackagesMap().get(packageName);
46037
- }
46038
46042
  function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
46039
46043
  if (moduleSymbol == null ? void 0 : moduleSymbol.exports) {
46040
46044
  const exportEquals = resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias);
@@ -50880,7 +50884,7 @@ function createTypeChecker(host) {
50880
50884
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
50881
50885
  }
50882
50886
  function getTypeForBindingElement(declaration) {
50883
- const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
50887
+ const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
50884
50888
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
50885
50889
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
50886
50890
  }
@@ -56545,7 +56549,20 @@ function createTypeChecker(host) {
56545
56549
  if (isPrivateIdentifier(name)) {
56546
56550
  return neverType;
56547
56551
  }
56548
- return isIdentifier(name) ? getStringLiteralType(unescapeLeadingUnderscores(name.escapedText)) : getRegularTypeOfLiteralType(isComputedPropertyName(name) ? checkComputedPropertyName(name) : checkExpression(name));
56552
+ if (isNumericLiteral(name)) {
56553
+ return getRegularTypeOfLiteralType(checkExpression(name));
56554
+ }
56555
+ if (isComputedPropertyName(name)) {
56556
+ return getRegularTypeOfLiteralType(checkComputedPropertyName(name));
56557
+ }
56558
+ const propertyName = getPropertyNameForPropertyNameNode(name);
56559
+ if (propertyName !== void 0) {
56560
+ return getStringLiteralType(unescapeLeadingUnderscores(propertyName));
56561
+ }
56562
+ if (isExpression(name)) {
56563
+ return getRegularTypeOfLiteralType(checkExpression(name));
56564
+ }
56565
+ return neverType;
56549
56566
  }
56550
56567
  function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
56551
56568
  if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) & 24 /* NonPublicAccessibilityModifier */)) {
@@ -65729,7 +65746,7 @@ function createTypeChecker(host) {
65729
65746
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
65730
65747
  }
65731
65748
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
65732
- const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
65749
+ const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
65733
65750
  node,
65734
65751
  /*contextFlags*/
65735
65752
  void 0
@@ -66486,7 +66503,7 @@ function createTypeChecker(host) {
66486
66503
  function getContextualTypeForBindingElement(declaration, contextFlags) {
66487
66504
  const parent = declaration.parent.parent;
66488
66505
  const name = declaration.propertyName || declaration.name;
66489
- const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
66506
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
66490
66507
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
66491
66508
  return void 0;
66492
66509
  if (parent.name.kind === 206 /* ArrayBindingPattern */) {
@@ -67534,9 +67551,7 @@ function createTypeChecker(host) {
67534
67551
  elementTypes.push(undefinedOrMissingType);
67535
67552
  elementFlags.push(2 /* Optional */);
67536
67553
  } else {
67537
- const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
67538
- const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
67539
- const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
67554
+ const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
67540
67555
  elementTypes.push(addOptionality(
67541
67556
  type,
67542
67557
  /*isProperty*/
@@ -67544,7 +67559,7 @@ function createTypeChecker(host) {
67544
67559
  hasOmittedExpression
67545
67560
  ));
67546
67561
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
67547
- if (shouldAddAsIntraExpressionInferenceSite) {
67562
+ if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
67548
67563
  const inferenceContext = getInferenceContext(node);
67549
67564
  Debug.assert(inferenceContext);
67550
67565
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -67685,13 +67700,11 @@ function createTypeChecker(host) {
67685
67700
  let member = getSymbolOfDeclaration(memberDecl);
67686
67701
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
67687
67702
  if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
67688
- const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
67689
- const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
67690
- let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
67703
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
67691
67704
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
67692
67705
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
67693
67706
  // we don't want to say "could not find 'a'".
67694
- memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
67707
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
67695
67708
  );
67696
67709
  if (isInJavascript) {
67697
67710
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -67735,7 +67748,7 @@ function createTypeChecker(host) {
67735
67748
  prop.links.target = member;
67736
67749
  member = prop;
67737
67750
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
67738
- if (shouldAddAsIntraExpressionInferenceSite) {
67751
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
67739
67752
  const inferenceContext = getInferenceContext(node);
67740
67753
  Debug.assert(inferenceContext);
67741
67754
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -67753,7 +67766,7 @@ function createTypeChecker(host) {
67753
67766
  hasComputedNumberProperty = false;
67754
67767
  hasComputedSymbolProperty = false;
67755
67768
  }
67756
- const type = getReducedType(checkExpression(memberDecl.expression));
67769
+ const type = getReducedType(checkExpression(memberDecl.expression, checkMode & 2 /* Inferential */));
67757
67770
  if (isValidSpreadType(type)) {
67758
67771
  const mergedType = tryMergeUnionOfObjectTypeAndEmptyObject(type, inConstContext);
67759
67772
  if (allPropertiesTable) {
@@ -67908,9 +67921,7 @@ function createTypeChecker(host) {
67908
67921
  for (const attributeDecl of attributes.properties) {
67909
67922
  const member = attributeDecl.symbol;
67910
67923
  if (isJsxAttribute(attributeDecl)) {
67911
- const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
67912
- const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
67913
- const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
67924
+ const exprType = checkJsxAttribute(attributeDecl, checkMode);
67914
67925
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
67915
67926
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
67916
67927
  attributeSymbol.declarations = member.declarations;
@@ -67931,7 +67942,7 @@ function createTypeChecker(host) {
67931
67942
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
67932
67943
  }
67933
67944
  }
67934
- if (shouldAddAsIntraExpressionInferenceSite) {
67945
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
67935
67946
  const inferenceContext = getInferenceContext(attributes);
67936
67947
  Debug.assert(inferenceContext);
67937
67948
  const inferenceNode = attributeDecl.initializer.expression;
@@ -67950,7 +67961,7 @@ function createTypeChecker(host) {
67950
67961
  );
67951
67962
  attributesTable = createSymbolTable();
67952
67963
  }
67953
- const exprType = getReducedType(checkExpressionCached(attributeDecl.expression, checkMode));
67964
+ const exprType = getReducedType(checkExpression(attributeDecl.expression, checkMode & 2 /* Inferential */));
67954
67965
  if (isTypeAny(exprType)) {
67955
67966
  hasSpreadAnyType = true;
67956
67967
  }
@@ -69549,7 +69560,7 @@ function createTypeChecker(host) {
69549
69560
  }
69550
69561
  for (let i = 0; i < argCount; i++) {
69551
69562
  const arg = args[i];
69552
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
69563
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
69553
69564
  const paramType = getTypeAtPosition(signature, i);
69554
69565
  if (couldContainTypeVariables(paramType)) {
69555
69566
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -69681,7 +69692,7 @@ function createTypeChecker(host) {
69681
69692
  if (getJsxNamespaceContainerForImplicitImport(node)) {
69682
69693
  return true;
69683
69694
  }
69684
- const tagType = isJsxOpeningElement(node) || isJsxSelfClosingElement(node) && !isJsxIntrinsicTagName(node.tagName) ? checkExpression(node.tagName) : void 0;
69695
+ const tagType = (isJsxOpeningElement(node) || isJsxSelfClosingElement(node)) && !(isJsxIntrinsicTagName(node.tagName) || isJsxNamespacedName(node.tagName)) ? checkExpression(node.tagName) : void 0;
69685
69696
  if (!tagType) {
69686
69697
  return true;
69687
69698
  }
@@ -70161,12 +70172,12 @@ function createTypeChecker(host) {
70161
70172
  const args = getEffectiveCallArguments(node);
70162
70173
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
70163
70174
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
70164
- argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
70175
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70165
70176
  let candidatesForArgumentError;
70166
70177
  let candidateForArgumentArityError;
70167
70178
  let candidateForTypeArgumentError;
70168
70179
  let result;
70169
- const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
70180
+ const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
70170
70181
  if (candidates.length > 1) {
70171
70182
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
70172
70183
  }
@@ -70385,7 +70396,7 @@ function createTypeChecker(host) {
70385
70396
  continue;
70386
70397
  }
70387
70398
  if (argCheckMode) {
70388
- argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
70399
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70389
70400
  if (inferenceContext) {
70390
70401
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
70391
70402
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -76580,7 +76591,7 @@ function createTypeChecker(host) {
76580
76591
  checkComputedPropertyName(node.propertyName);
76581
76592
  }
76582
76593
  const parent = node.parent.parent;
76583
- const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
76594
+ const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
76584
76595
  const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
76585
76596
  const name = node.propertyName || node.name;
76586
76597
  if (parentType && !isBindingPattern(name)) {
@@ -80263,7 +80274,7 @@ function createTypeChecker(host) {
80263
80274
  name,
80264
80275
  meaning,
80265
80276
  /*ignoreErrors*/
80266
- false,
80277
+ true,
80267
80278
  /*dontResolveAlias*/
80268
80279
  true,
80269
80280
  getHostSignatureFromJSDoc(name)
@@ -80274,7 +80285,7 @@ function createTypeChecker(host) {
80274
80285
  return resolveJSDocMemberName(
80275
80286
  name,
80276
80287
  /*ignoreErrors*/
80277
- false,
80288
+ true,
80278
80289
  getSymbolOfDeclaration(container)
80279
80290
  );
80280
80291
  }
@@ -108399,6 +108410,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108399
108410
  return emitJsxSpreadAttribute(node);
108400
108411
  case 293 /* JsxExpression */:
108401
108412
  return emitJsxExpression(node);
108413
+ case 294 /* JsxNamespacedName */:
108414
+ return emitJsxNamespacedName(node);
108402
108415
  case 295 /* CaseClause */:
108403
108416
  return emitCaseClause(node);
108404
108417
  case 296 /* DefaultClause */:
@@ -108594,8 +108607,6 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108594
108607
  return emitJsxSelfClosingElement(node);
108595
108608
  case 287 /* JsxFragment */:
108596
108609
  return emitJsxFragment(node);
108597
- case 294 /* JsxNamespacedName */:
108598
- return emitJsxNamespacedName(node);
108599
108610
  case 357 /* SyntaxList */:
108600
108611
  return Debug.fail("SyntaxList should not be printed");
108601
108612
  case 358 /* NotEmittedStatement */:
@@ -111427,6 +111438,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111427
111438
  if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
111428
111439
  return idText(node);
111429
111440
  }
111441
+ } else if (isJsxNamespacedName(node)) {
111442
+ if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
111443
+ return getTextOfJsxNamespacedName(node);
111444
+ }
111430
111445
  } else {
111431
111446
  Debug.assertNode(node, isLiteralExpression);
111432
111447
  if (!canUseSourceFile) {
@@ -111438,7 +111453,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111438
111453
  function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
111439
111454
  if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) {
111440
111455
  const textSourceNode = node.textSourceNode;
111441
- if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
111456
+ if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) {
111442
111457
  const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
111443
111458
  return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
111444
111459
  } else {
@@ -112985,7 +113000,8 @@ function createCompilerHostWorker(options, setParentNodes, system = sys) {
112985
113000
  realpath,
112986
113001
  readDirectory: (path, extensions, include, exclude, depth) => system.readDirectory(path, extensions, include, exclude, depth),
112987
113002
  createDirectory: (d) => system.createDirectory(d),
112988
- createHash: maybeBind(system, system.createHash)
113003
+ createHash: maybeBind(system, system.createHash),
113004
+ useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
112989
113005
  };
112990
113006
  return compilerHost;
112991
113007
  }
@@ -113650,6 +113666,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113650
113666
  let automaticTypeDirectiveResolutions;
113651
113667
  let resolvedLibReferences;
113652
113668
  let resolvedLibProcessing;
113669
+ let packageMap;
113653
113670
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
113654
113671
  let currentNodeModulesDepth = 0;
113655
113672
  const modulesWithElidedImports = /* @__PURE__ */ new Map();
@@ -113756,7 +113773,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113756
113773
  let projectReferenceRedirects;
113757
113774
  let mapFromFileToProjectReferenceRedirects;
113758
113775
  let mapFromToProjectReferenceRedirectSource;
113759
- const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
113776
+ const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host, projectReferences)) && !options.disableSourceOfProjectReferenceRedirect;
113760
113777
  const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
113761
113778
  compilerHost: host,
113762
113779
  getSymlinkCache,
@@ -113954,6 +113971,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113954
113971
  redirectTargetsMap,
113955
113972
  usesUriStyleNodeCoreModules,
113956
113973
  resolvedLibReferences,
113974
+ getCurrentPackagesMap: () => packageMap,
113975
+ typesPackageExists,
113976
+ packageBundlesTypes,
113957
113977
  isEmittedFile,
113958
113978
  getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
113959
113979
  getProjectReferences,
@@ -113994,6 +114014,26 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113994
114014
  measure("Program", "beforeProgram", "afterProgram");
113995
114015
  (_p = tracing) == null ? void 0 : _p.pop();
113996
114016
  return program;
114017
+ function getPackagesMap() {
114018
+ if (packageMap)
114019
+ return packageMap;
114020
+ packageMap = /* @__PURE__ */ new Map();
114021
+ files.forEach((sf) => {
114022
+ if (!sf.resolvedModules)
114023
+ return;
114024
+ sf.resolvedModules.forEach(({ resolvedModule }) => {
114025
+ if (resolvedModule == null ? void 0 : resolvedModule.packageId)
114026
+ packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
114027
+ });
114028
+ });
114029
+ return packageMap;
114030
+ }
114031
+ function typesPackageExists(packageName) {
114032
+ return getPackagesMap().has(getTypesPackageName(packageName));
114033
+ }
114034
+ function packageBundlesTypes(packageName) {
114035
+ return !!getPackagesMap().get(packageName);
114036
+ }
113997
114037
  function addResolutionDiagnostics(resolution) {
113998
114038
  var _a2;
113999
114039
  if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length))
@@ -114482,6 +114522,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114482
114522
  redirectTargetsMap = oldProgram.redirectTargetsMap;
114483
114523
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
114484
114524
  resolvedLibReferences = oldProgram.resolvedLibReferences;
114525
+ packageMap = oldProgram.getCurrentPackagesMap();
114485
114526
  return 2 /* Completely */;
114486
114527
  }
114487
114528
  function getEmitHost(writeFileCallback) {
@@ -117337,7 +117378,10 @@ function createBuilderProgramState(newProgram, oldState) {
117337
117378
  return;
117338
117379
  const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
117339
117380
  if (diagnostics) {
117340
- state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
117381
+ state.semanticDiagnosticsPerFile.set(
117382
+ sourceFilePath,
117383
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
117384
+ );
117341
117385
  if (!state.semanticDiagnosticsFromOldState) {
117342
117386
  state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
117343
117387
  }
@@ -117408,6 +117452,33 @@ function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature)
117408
117452
  isString(oldEmitSignature) ? [oldEmitSignature] : oldEmitSignature[0]
117409
117453
  );
117410
117454
  }
117455
+ function repopulateDiagnostics(diagnostics, newProgram) {
117456
+ if (!diagnostics.length)
117457
+ return diagnostics;
117458
+ return sameMap(diagnostics, (diag2) => {
117459
+ if (isString(diag2.messageText))
117460
+ return diag2;
117461
+ const repopulatedChain = convertOrRepopulateDiagnosticMessageChain(diag2.messageText, diag2.file, newProgram, (chain) => {
117462
+ var _a;
117463
+ return (_a = chain.repopulateInfo) == null ? void 0 : _a.call(chain);
117464
+ });
117465
+ return repopulatedChain === diag2.messageText ? diag2 : { ...diag2, messageText: repopulatedChain };
117466
+ });
117467
+ }
117468
+ function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
117469
+ const info = repopulateInfo(chain);
117470
+ if (info) {
117471
+ return {
117472
+ ...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
117473
+ next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
117474
+ };
117475
+ }
117476
+ const next = convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo);
117477
+ return next === chain.next ? chain : { ...chain, next };
117478
+ }
117479
+ function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) {
117480
+ return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo));
117481
+ }
117411
117482
  function convertToDiagnostics(diagnostics, newProgram) {
117412
117483
  if (!diagnostics.length)
117413
117484
  return emptyArray;
@@ -117429,9 +117500,11 @@ function convertToDiagnostics(diagnostics, newProgram) {
117429
117500
  }
117430
117501
  function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
117431
117502
  const { file } = diagnostic;
117503
+ const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0;
117432
117504
  return {
117433
117505
  ...diagnostic,
117434
- file: file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0
117506
+ file: sourceFile,
117507
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertOrRepopulateDiagnosticMessageChain(diagnostic.messageText, sourceFile, newProgram, (chain) => chain.info)
117435
117508
  };
117436
117509
  }
117437
117510
  function releaseCache(state) {
@@ -117973,9 +118046,35 @@ function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBui
117973
118046
  const { file } = diagnostic;
117974
118047
  return {
117975
118048
  ...diagnostic,
117976
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0
118049
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
118050
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
117977
118051
  };
117978
118052
  }
118053
+ function convertToReusableDiagnosticMessageChain(chain) {
118054
+ if (chain.repopulateInfo) {
118055
+ return {
118056
+ info: chain.repopulateInfo(),
118057
+ next: convertToReusableDiagnosticMessageChainArray(chain.next)
118058
+ };
118059
+ }
118060
+ const next = convertToReusableDiagnosticMessageChainArray(chain.next);
118061
+ return next === chain.next ? chain : { ...chain, next };
118062
+ }
118063
+ function convertToReusableDiagnosticMessageChainArray(array) {
118064
+ if (!array)
118065
+ return array;
118066
+ return forEach(array, (chain, index) => {
118067
+ const reusable = convertToReusableDiagnosticMessageChain(chain);
118068
+ if (chain === reusable)
118069
+ return void 0;
118070
+ const result = index > 0 ? array.slice(0, index - 1) : [];
118071
+ result.push(reusable);
118072
+ for (let i = index + 1; i < array.length; i++) {
118073
+ result.push(convertToReusableDiagnosticMessageChain(array[i]));
118074
+ }
118075
+ return result;
118076
+ }) || array;
118077
+ }
117979
118078
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
117980
118079
  let host;
117981
118080
  let newProgram;
@@ -119062,45 +119161,51 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119062
119161
  }
119063
119162
  (resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
119064
119163
  }
119164
+ function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
119165
+ const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119166
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
119167
+ failedLookupLocation,
119168
+ failedLookupLocationPath,
119169
+ rootDir,
119170
+ rootPath,
119171
+ rootPathComponents,
119172
+ getCurrentDirectory
119173
+ );
119174
+ if (toWatch) {
119175
+ const { dir, dirPath, nonRecursive } = toWatch;
119176
+ if (dirPath === rootPath) {
119177
+ Debug.assert(nonRecursive);
119178
+ setAtRoot = true;
119179
+ } else {
119180
+ setDirectoryWatcher(dir, dirPath, nonRecursive);
119181
+ }
119182
+ }
119183
+ return setAtRoot;
119184
+ }
119065
119185
  function watchFailedLookupLocationOfResolution(resolution) {
119066
119186
  Debug.assert(!!resolution.refCount);
119067
- const { failedLookupLocations, affectingLocations } = resolution;
119068
- if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
119187
+ const { failedLookupLocations, affectingLocations, node10Result } = resolution;
119188
+ if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !node10Result)
119069
119189
  return;
119070
- if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
119190
+ if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || node10Result)
119071
119191
  resolutionsWithFailedLookups.add(resolution);
119072
119192
  let setAtRoot = false;
119073
119193
  if (failedLookupLocations) {
119074
119194
  for (const failedLookupLocation of failedLookupLocations) {
119075
- const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119076
- const toWatch = getDirectoryToWatchFailedLookupLocation(
119077
- failedLookupLocation,
119078
- failedLookupLocationPath,
119079
- rootDir,
119080
- rootPath,
119081
- rootPathComponents,
119082
- getCurrentDirectory
119083
- );
119084
- if (toWatch) {
119085
- const { dir, dirPath, nonRecursive } = toWatch;
119086
- if (dirPath === rootPath) {
119087
- Debug.assert(nonRecursive);
119088
- setAtRoot = true;
119089
- } else {
119090
- setDirectoryWatcher(dir, dirPath, nonRecursive);
119091
- }
119092
- }
119093
- }
119094
- if (setAtRoot) {
119095
- setDirectoryWatcher(
119096
- rootDir,
119097
- rootPath,
119098
- /*nonRecursive*/
119099
- true
119100
- );
119195
+ setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
119101
119196
  }
119102
119197
  }
119103
- watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length));
119198
+ if (node10Result)
119199
+ setAtRoot = watchFailedLookupLocation(node10Result, setAtRoot);
119200
+ if (setAtRoot) {
119201
+ setDirectoryWatcher(
119202
+ rootDir,
119203
+ rootPath,
119204
+ /*nonRecursive*/
119205
+ true
119206
+ );
119207
+ }
119208
+ watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !node10Result);
119104
119209
  }
119105
119210
  function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
119106
119211
  Debug.assert(!!resolution.refCount);
@@ -119194,6 +119299,26 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119194
119299
  directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
119195
119300
  }
119196
119301
  }
119302
+ function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
119303
+ const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119304
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
119305
+ failedLookupLocation,
119306
+ failedLookupLocationPath,
119307
+ rootDir,
119308
+ rootPath,
119309
+ rootPathComponents,
119310
+ getCurrentDirectory
119311
+ );
119312
+ if (toWatch) {
119313
+ const { dirPath } = toWatch;
119314
+ if (dirPath === rootPath) {
119315
+ removeAtRoot = true;
119316
+ } else {
119317
+ removeDirectoryWatcher(dirPath);
119318
+ }
119319
+ }
119320
+ return removeAtRoot;
119321
+ }
119197
119322
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
119198
119323
  Debug.checkDefined(resolution.files).delete(filePath);
119199
119324
  resolution.refCount--;
@@ -119207,31 +119332,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119207
119332
  if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
119208
119333
  resolvedFileToResolution.delete(key);
119209
119334
  }
119210
- const { failedLookupLocations, affectingLocations } = resolution;
119335
+ const { failedLookupLocations, affectingLocations, node10Result } = resolution;
119211
119336
  if (resolutionsWithFailedLookups.delete(resolution)) {
119212
119337
  let removeAtRoot = false;
119213
- for (const failedLookupLocation of failedLookupLocations) {
119214
- const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119215
- const toWatch = getDirectoryToWatchFailedLookupLocation(
119216
- failedLookupLocation,
119217
- failedLookupLocationPath,
119218
- rootDir,
119219
- rootPath,
119220
- rootPathComponents,
119221
- getCurrentDirectory
119222
- );
119223
- if (toWatch) {
119224
- const { dirPath } = toWatch;
119225
- if (dirPath === rootPath) {
119226
- removeAtRoot = true;
119227
- } else {
119228
- removeDirectoryWatcher(dirPath);
119229
- }
119338
+ if (failedLookupLocations) {
119339
+ for (const failedLookupLocation of failedLookupLocations) {
119340
+ removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
119230
119341
  }
119231
119342
  }
119232
- if (removeAtRoot) {
119343
+ if (node10Result)
119344
+ removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
119345
+ if (removeAtRoot)
119233
119346
  removeDirectoryWatcher(rootPath);
119234
- }
119235
119347
  } else if (affectingLocations == null ? void 0 : affectingLocations.length) {
119236
119348
  resolutionsWithOnlyAffectingLocations.delete(resolution);
119237
119349
  }
@@ -119385,7 +119497,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119385
119497
  return true;
119386
119498
  if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
119387
119499
  return false;
119388
- return (_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
119500
+ return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.node10Result && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.node10Result));
119389
119501
  }
119390
119502
  function isInvalidatedFailedLookup(locationPath) {
119391
119503
  return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
@@ -119954,7 +120066,8 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
119954
120066
  getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
119955
120067
  createHash: maybeBind(host, host.createHash),
119956
120068
  readDirectory: maybeBind(host, host.readDirectory),
119957
- storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit
120069
+ storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
120070
+ useSourceOfProjectReferenceRedirect: (projectReferences) => (projectReferences == null ? void 0 : projectReferences.some((x) => x.circular)) || false
119958
120071
  };
119959
120072
  return compilerHost;
119960
120073
  }
@@ -121093,6 +121206,9 @@ function createBuildOrder(state, roots) {
121093
121206
  const parsed = parseConfigFile(state, configFileName, projPath);
121094
121207
  if (parsed && parsed.projectReferences) {
121095
121208
  for (const ref of parsed.projectReferences) {
121209
+ if (ref.circular) {
121210
+ continue;
121211
+ }
121096
121212
  const resolvedRefPath = resolveProjectName(state, ref.path);
121097
121213
  visit(resolvedRefPath, inCircularContext || ref.circular);
121098
121214
  }