@typescript-deploys/pr-build 5.1.0-pr-54186-8 → 5.1.0-pr-54205-7

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.20230510`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -10916,7 +10916,6 @@ function isLeftHandSideExpressionKind(kind) {
10916
10916
  case 283 /* JsxElement */:
10917
10917
  case 284 /* JsxSelfClosingElement */:
10918
10918
  case 287 /* JsxFragment */:
10919
- case 294 /* JsxNamespacedName */:
10920
10919
  case 214 /* TaggedTemplateExpression */:
10921
10920
  case 208 /* ArrayLiteralExpression */:
10922
10921
  case 216 /* ParenthesizedExpression */:
@@ -11430,7 +11429,39 @@ function projectReferenceIsEqualTo(oldRef, newRef) {
11430
11429
  return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
11431
11430
  }
11432
11431
  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);
11432
+ 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;
11433
+ }
11434
+ function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
11435
+ var _a, _b;
11436
+ const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
11437
+ const result = node10Result ? chainDiagnosticMessages(
11438
+ /*details*/
11439
+ void 0,
11440
+ 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,
11441
+ node10Result,
11442
+ node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageName)}` : packageName
11443
+ ) : host.typesPackageExists(packageName) ? chainDiagnosticMessages(
11444
+ /*details*/
11445
+ void 0,
11446
+ 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,
11447
+ packageName,
11448
+ mangleScopedPackageName(packageName)
11449
+ ) : host.packageBundlesTypes(packageName) ? chainDiagnosticMessages(
11450
+ /*details*/
11451
+ void 0,
11452
+ Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,
11453
+ packageName,
11454
+ moduleReference
11455
+ ) : chainDiagnosticMessages(
11456
+ /*details*/
11457
+ void 0,
11458
+ Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
11459
+ moduleReference,
11460
+ mangleScopedPackageName(packageName)
11461
+ );
11462
+ if (result)
11463
+ result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
11464
+ return result;
11434
11465
  }
11435
11466
  function packageIdIsEqual(a, b) {
11436
11467
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
@@ -12282,6 +12313,8 @@ function tryGetTextOfPropertyName(name) {
12282
12313
  if (isStringOrNumericLiteralLike(name.expression))
12283
12314
  return escapeLeadingUnderscores(name.expression.text);
12284
12315
  return void 0;
12316
+ case 294 /* JsxNamespacedName */:
12317
+ return getEscapedTextOfJsxNamespacedName(name);
12285
12318
  default:
12286
12319
  return Debug.assertNever(name);
12287
12320
  }
@@ -14163,6 +14196,8 @@ function getPropertyNameForPropertyNameNode(name) {
14163
14196
  return nameExpression.operand.text;
14164
14197
  }
14165
14198
  return void 0;
14199
+ case 294 /* JsxNamespacedName */:
14200
+ return getEscapedTextOfJsxNamespacedName(name);
14166
14201
  default:
14167
14202
  return Debug.assertNever(name);
14168
14203
  }
@@ -14179,10 +14214,10 @@ function isPropertyNameLiteral(node) {
14179
14214
  }
14180
14215
  }
14181
14216
  function getTextOfIdentifierOrLiteral(node) {
14182
- return isMemberName(node) ? idText(node) : node.text;
14217
+ return isMemberName(node) ? idText(node) : isJsxNamespacedName(node) ? getTextOfJsxNamespacedName(node) : node.text;
14183
14218
  }
14184
14219
  function getEscapedTextOfIdentifierOrLiteral(node) {
14185
- return isMemberName(node) ? node.escapedText : escapeLeadingUnderscores(node.text);
14220
+ return isMemberName(node) ? node.escapedText : isJsxNamespacedName(node) ? getEscapedTextOfJsxNamespacedName(node) : escapeLeadingUnderscores(node.text);
14186
14221
  }
14187
14222
  function getSymbolNameForPrivateIdentifier(containingClassSymbol, description) {
14188
14223
  return `__#${getSymbolId(containingClassSymbol)}@${description}`;
@@ -15413,6 +15448,8 @@ function tryGetPropertyAccessOrIdentifierToString(expr) {
15413
15448
  }
15414
15449
  } else if (isIdentifier(expr)) {
15415
15450
  return unescapeLeadingUnderscores(expr.escapedText);
15451
+ } else if (isJsxNamespacedName(expr)) {
15452
+ return getTextOfJsxNamespacedName(expr);
15416
15453
  }
15417
15454
  return void 0;
15418
15455
  }
@@ -29582,7 +29619,11 @@ var Parser;
29582
29619
  }
29583
29620
  function parseJsxElementName() {
29584
29621
  const pos = getNodePos();
29585
- let expression = parseJsxTagName();
29622
+ const initialExpression = parseJsxTagName();
29623
+ if (isJsxNamespacedName(initialExpression)) {
29624
+ return initialExpression;
29625
+ }
29626
+ let expression = initialExpression;
29586
29627
  while (parseOptional(25 /* DotToken */)) {
29587
29628
  expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
29588
29629
  /*allowIdentifierNames*/
@@ -37524,8 +37565,6 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
37524
37565
  const diagnosticState = {
37525
37566
  ...state,
37526
37567
  features: state.features & ~8 /* Exports */,
37527
- failedLookupLocations: [],
37528
- affectingLocations: [],
37529
37568
  reportDiagnostic: noop
37530
37569
  };
37531
37570
  const diagnosticResult = tryResolve(extensions & (1 /* TypeScript */ | 4 /* Declaration */), diagnosticState);
@@ -42378,7 +42417,10 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
42378
42417
  const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
42379
42418
  if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
42380
42419
  const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
42381
- if (removeFileExtension(mainExportFile) === removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
42420
+ const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
42421
+ if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
42422
+ return { packageRootPath, moduleFileToTry };
42423
+ } else if (packageJsonContent.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
42382
42424
  return { packageRootPath, moduleFileToTry };
42383
42425
  }
42384
42426
  }
@@ -42598,10 +42640,9 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
42598
42640
  CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
42599
42641
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
42600
42642
  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";
42643
+ CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
42644
+ CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
42645
+ CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
42605
42646
  return CheckMode3;
42606
42647
  })(CheckMode || {});
42607
42648
  var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -42645,18 +42686,6 @@ function isInstantiatedModule(node, preserveConstEnums) {
42645
42686
  return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
42646
42687
  }
42647
42688
  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
42689
  var deferredDiagnosticsCallbacks = [];
42661
42690
  var addLazyDiagnostic = (arg) => {
42662
42691
  deferredDiagnosticsCallbacks.push(arg);
@@ -42893,9 +42922,9 @@ function createTypeChecker(host) {
42893
42922
  candidatesOutArray,
42894
42923
  /*argumentCount*/
42895
42924
  void 0,
42896
- 64 /* IsForStringLiteralArgumentCompletions */
42925
+ 32 /* IsForStringLiteralArgumentCompletions */
42897
42926
  )),
42898
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
42927
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
42899
42928
  getExpandedParameters,
42900
42929
  hasEffectiveRestParameter,
42901
42930
  containsArgumentsReference,
@@ -44439,7 +44468,7 @@ function createTypeChecker(host) {
44439
44468
  if (!result) {
44440
44469
  if (nameNotFoundMessage) {
44441
44470
  addLazyDiagnostic(() => {
44442
- if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
44471
+ if (!errorLocation || errorLocation.parent.kind !== 330 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
44443
44472
  !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
44444
44473
  let suggestion;
44445
44474
  let suggestedLib;
@@ -45992,35 +46021,9 @@ function createTypeChecker(host) {
45992
46021
  }
45993
46022
  }
45994
46023
  function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) {
45995
- var _a, _b;
45996
46024
  let errorInfo;
45997
46025
  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
- );
46026
+ errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
46024
46027
  }
46025
46028
  errorOrSuggestion(isError, errorNode, chainDiagnosticMessages(
46026
46029
  errorInfo,
@@ -46029,12 +46032,6 @@ function createTypeChecker(host) {
46029
46032
  resolvedFileName
46030
46033
  ));
46031
46034
  }
46032
- function typesPackageExists(packageName) {
46033
- return getPackagesMap().has(getTypesPackageName(packageName));
46034
- }
46035
- function packageBundlesTypes(packageName) {
46036
- return !!getPackagesMap().get(packageName);
46037
- }
46038
46035
  function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
46039
46036
  if (moduleSymbol == null ? void 0 : moduleSymbol.exports) {
46040
46037
  const exportEquals = resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias);
@@ -50880,7 +50877,7 @@ function createTypeChecker(host) {
50880
50877
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
50881
50878
  }
50882
50879
  function getTypeForBindingElement(declaration) {
50883
- const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
50880
+ const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
50884
50881
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
50885
50882
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
50886
50883
  }
@@ -56545,7 +56542,20 @@ function createTypeChecker(host) {
56545
56542
  if (isPrivateIdentifier(name)) {
56546
56543
  return neverType;
56547
56544
  }
56548
- return isIdentifier(name) ? getStringLiteralType(unescapeLeadingUnderscores(name.escapedText)) : getRegularTypeOfLiteralType(isComputedPropertyName(name) ? checkComputedPropertyName(name) : checkExpression(name));
56545
+ if (isNumericLiteral(name)) {
56546
+ return getRegularTypeOfLiteralType(checkExpression(name));
56547
+ }
56548
+ if (isComputedPropertyName(name)) {
56549
+ return getRegularTypeOfLiteralType(checkComputedPropertyName(name));
56550
+ }
56551
+ const propertyName = getPropertyNameForPropertyNameNode(name);
56552
+ if (propertyName !== void 0) {
56553
+ return getStringLiteralType(unescapeLeadingUnderscores(propertyName));
56554
+ }
56555
+ if (isExpression(name)) {
56556
+ return getRegularTypeOfLiteralType(checkExpression(name));
56557
+ }
56558
+ return neverType;
56549
56559
  }
56550
56560
  function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
56551
56561
  if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) & 24 /* NonPublicAccessibilityModifier */)) {
@@ -57193,7 +57203,7 @@ function createTypeChecker(host) {
57193
57203
  }
57194
57204
  function maybeCloneTypeParameter(p) {
57195
57205
  const constraint = getConstraintOfTypeParameter(p);
57196
- return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
57206
+ return constraint && couldContainTypeVariables(constraint) ? cloneTypeParameter(p) : p;
57197
57207
  }
57198
57208
  function isSimpleTupleType(node) {
57199
57209
  return isTupleTypeNode(node) && length(node.elements) > 0 && !some(node.elements, (e) => isOptionalTypeNode(e) || isRestTypeNode(e) || isNamedTupleMember(e) && !!(e.questionToken || e.dotDotDotToken));
@@ -65729,7 +65739,7 @@ function createTypeChecker(host) {
65729
65739
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
65730
65740
  }
65731
65741
  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(
65742
+ 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
65743
  node,
65734
65744
  /*contextFlags*/
65735
65745
  void 0
@@ -66486,7 +66496,7 @@ function createTypeChecker(host) {
66486
66496
  function getContextualTypeForBindingElement(declaration, contextFlags) {
66487
66497
  const parent = declaration.parent.parent;
66488
66498
  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 */);
66499
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || parent.kind !== 207 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
66490
66500
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
66491
66501
  return void 0;
66492
66502
  if (parent.name.kind === 206 /* ArrayBindingPattern */) {
@@ -67534,9 +67544,7 @@ function createTypeChecker(host) {
67534
67544
  elementTypes.push(undefinedOrMissingType);
67535
67545
  elementFlags.push(2 /* Optional */);
67536
67546
  } 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);
67547
+ const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
67540
67548
  elementTypes.push(addOptionality(
67541
67549
  type,
67542
67550
  /*isProperty*/
@@ -67544,7 +67552,7 @@ function createTypeChecker(host) {
67544
67552
  hasOmittedExpression
67545
67553
  ));
67546
67554
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
67547
- if (shouldAddAsIntraExpressionInferenceSite) {
67555
+ if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
67548
67556
  const inferenceContext = getInferenceContext(node);
67549
67557
  Debug.assert(inferenceContext);
67550
67558
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -67685,13 +67693,11 @@ function createTypeChecker(host) {
67685
67693
  let member = getSymbolOfDeclaration(memberDecl);
67686
67694
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
67687
67695
  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) : (
67696
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
67691
67697
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
67692
67698
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
67693
67699
  // 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)
67700
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
67695
67701
  );
67696
67702
  if (isInJavascript) {
67697
67703
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -67735,7 +67741,7 @@ function createTypeChecker(host) {
67735
67741
  prop.links.target = member;
67736
67742
  member = prop;
67737
67743
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
67738
- if (shouldAddAsIntraExpressionInferenceSite) {
67744
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
67739
67745
  const inferenceContext = getInferenceContext(node);
67740
67746
  Debug.assert(inferenceContext);
67741
67747
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -67753,7 +67759,7 @@ function createTypeChecker(host) {
67753
67759
  hasComputedNumberProperty = false;
67754
67760
  hasComputedSymbolProperty = false;
67755
67761
  }
67756
- const type = getReducedType(checkExpression(memberDecl.expression));
67762
+ const type = getReducedType(checkExpression(memberDecl.expression, checkMode & 2 /* Inferential */));
67757
67763
  if (isValidSpreadType(type)) {
67758
67764
  const mergedType = tryMergeUnionOfObjectTypeAndEmptyObject(type, inConstContext);
67759
67765
  if (allPropertiesTable) {
@@ -67908,9 +67914,7 @@ function createTypeChecker(host) {
67908
67914
  for (const attributeDecl of attributes.properties) {
67909
67915
  const member = attributeDecl.symbol;
67910
67916
  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);
67917
+ const exprType = checkJsxAttribute(attributeDecl, checkMode);
67914
67918
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
67915
67919
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
67916
67920
  attributeSymbol.declarations = member.declarations;
@@ -67931,7 +67935,7 @@ function createTypeChecker(host) {
67931
67935
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
67932
67936
  }
67933
67937
  }
67934
- if (shouldAddAsIntraExpressionInferenceSite) {
67938
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
67935
67939
  const inferenceContext = getInferenceContext(attributes);
67936
67940
  Debug.assert(inferenceContext);
67937
67941
  const inferenceNode = attributeDecl.initializer.expression;
@@ -67950,7 +67954,7 @@ function createTypeChecker(host) {
67950
67954
  );
67951
67955
  attributesTable = createSymbolTable();
67952
67956
  }
67953
- const exprType = getReducedType(checkExpressionCached(attributeDecl.expression, checkMode));
67957
+ const exprType = getReducedType(checkExpression(attributeDecl.expression, checkMode & 2 /* Inferential */));
67954
67958
  if (isTypeAny(exprType)) {
67955
67959
  hasSpreadAnyType = true;
67956
67960
  }
@@ -69549,7 +69553,7 @@ function createTypeChecker(host) {
69549
69553
  }
69550
69554
  for (let i = 0; i < argCount; i++) {
69551
69555
  const arg = args[i];
69552
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
69556
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
69553
69557
  const paramType = getTypeAtPosition(signature, i);
69554
69558
  if (couldContainTypeVariables(paramType)) {
69555
69559
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -69681,7 +69685,7 @@ function createTypeChecker(host) {
69681
69685
  if (getJsxNamespaceContainerForImplicitImport(node)) {
69682
69686
  return true;
69683
69687
  }
69684
- const tagType = isJsxOpeningElement(node) || isJsxSelfClosingElement(node) && !isJsxIntrinsicTagName(node.tagName) ? checkExpression(node.tagName) : void 0;
69688
+ const tagType = (isJsxOpeningElement(node) || isJsxSelfClosingElement(node)) && !(isJsxIntrinsicTagName(node.tagName) || isJsxNamespacedName(node.tagName)) ? checkExpression(node.tagName) : void 0;
69685
69689
  if (!tagType) {
69686
69690
  return true;
69687
69691
  }
@@ -70161,12 +70165,12 @@ function createTypeChecker(host) {
70161
70165
  const args = getEffectiveCallArguments(node);
70162
70166
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
70163
70167
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
70164
- argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
70168
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70165
70169
  let candidatesForArgumentError;
70166
70170
  let candidateForArgumentArityError;
70167
70171
  let candidateForTypeArgumentError;
70168
70172
  let result;
70169
- const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
70173
+ const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
70170
70174
  if (candidates.length > 1) {
70171
70175
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
70172
70176
  }
@@ -70385,7 +70389,7 @@ function createTypeChecker(host) {
70385
70389
  continue;
70386
70390
  }
70387
70391
  if (argCheckMode) {
70388
- argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
70392
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
70389
70393
  if (inferenceContext) {
70390
70394
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
70391
70395
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -76580,7 +76584,7 @@ function createTypeChecker(host) {
76580
76584
  checkComputedPropertyName(node.propertyName);
76581
76585
  }
76582
76586
  const parent = node.parent.parent;
76583
- const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
76587
+ const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
76584
76588
  const parentType = getTypeForBindingElementParent(parent, parentCheckMode);
76585
76589
  const name = node.propertyName || node.name;
76586
76590
  if (parentType && !isBindingPattern(name)) {
@@ -80263,7 +80267,7 @@ function createTypeChecker(host) {
80263
80267
  name,
80264
80268
  meaning,
80265
80269
  /*ignoreErrors*/
80266
- false,
80270
+ true,
80267
80271
  /*dontResolveAlias*/
80268
80272
  true,
80269
80273
  getHostSignatureFromJSDoc(name)
@@ -80274,7 +80278,7 @@ function createTypeChecker(host) {
80274
80278
  return resolveJSDocMemberName(
80275
80279
  name,
80276
80280
  /*ignoreErrors*/
80277
- false,
80281
+ true,
80278
80282
  getSymbolOfDeclaration(container)
80279
80283
  );
80280
80284
  }
@@ -108399,6 +108403,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108399
108403
  return emitJsxSpreadAttribute(node);
108400
108404
  case 293 /* JsxExpression */:
108401
108405
  return emitJsxExpression(node);
108406
+ case 294 /* JsxNamespacedName */:
108407
+ return emitJsxNamespacedName(node);
108402
108408
  case 295 /* CaseClause */:
108403
108409
  return emitCaseClause(node);
108404
108410
  case 296 /* DefaultClause */:
@@ -108594,8 +108600,6 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108594
108600
  return emitJsxSelfClosingElement(node);
108595
108601
  case 287 /* JsxFragment */:
108596
108602
  return emitJsxFragment(node);
108597
- case 294 /* JsxNamespacedName */:
108598
- return emitJsxNamespacedName(node);
108599
108603
  case 357 /* SyntaxList */:
108600
108604
  return Debug.fail("SyntaxList should not be printed");
108601
108605
  case 358 /* NotEmittedStatement */:
@@ -111427,6 +111431,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111427
111431
  if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
111428
111432
  return idText(node);
111429
111433
  }
111434
+ } else if (isJsxNamespacedName(node)) {
111435
+ if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
111436
+ return getTextOfJsxNamespacedName(node);
111437
+ }
111430
111438
  } else {
111431
111439
  Debug.assertNode(node, isLiteralExpression);
111432
111440
  if (!canUseSourceFile) {
@@ -111438,7 +111446,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111438
111446
  function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
111439
111447
  if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) {
111440
111448
  const textSourceNode = node.textSourceNode;
111441
- if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
111449
+ if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) {
111442
111450
  const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
111443
111451
  return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
111444
111452
  } else {
@@ -113650,6 +113658,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113650
113658
  let automaticTypeDirectiveResolutions;
113651
113659
  let resolvedLibReferences;
113652
113660
  let resolvedLibProcessing;
113661
+ let packageMap;
113653
113662
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
113654
113663
  let currentNodeModulesDepth = 0;
113655
113664
  const modulesWithElidedImports = /* @__PURE__ */ new Map();
@@ -113954,6 +113963,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113954
113963
  redirectTargetsMap,
113955
113964
  usesUriStyleNodeCoreModules,
113956
113965
  resolvedLibReferences,
113966
+ getCurrentPackagesMap: () => packageMap,
113967
+ typesPackageExists,
113968
+ packageBundlesTypes,
113957
113969
  isEmittedFile,
113958
113970
  getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
113959
113971
  getProjectReferences,
@@ -113994,6 +114006,26 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113994
114006
  measure("Program", "beforeProgram", "afterProgram");
113995
114007
  (_p = tracing) == null ? void 0 : _p.pop();
113996
114008
  return program;
114009
+ function getPackagesMap() {
114010
+ if (packageMap)
114011
+ return packageMap;
114012
+ packageMap = /* @__PURE__ */ new Map();
114013
+ files.forEach((sf) => {
114014
+ if (!sf.resolvedModules)
114015
+ return;
114016
+ sf.resolvedModules.forEach(({ resolvedModule }) => {
114017
+ if (resolvedModule == null ? void 0 : resolvedModule.packageId)
114018
+ packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
114019
+ });
114020
+ });
114021
+ return packageMap;
114022
+ }
114023
+ function typesPackageExists(packageName) {
114024
+ return getPackagesMap().has(getTypesPackageName(packageName));
114025
+ }
114026
+ function packageBundlesTypes(packageName) {
114027
+ return !!getPackagesMap().get(packageName);
114028
+ }
113997
114029
  function addResolutionDiagnostics(resolution) {
113998
114030
  var _a2;
113999
114031
  if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length))
@@ -114482,6 +114514,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114482
114514
  redirectTargetsMap = oldProgram.redirectTargetsMap;
114483
114515
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
114484
114516
  resolvedLibReferences = oldProgram.resolvedLibReferences;
114517
+ packageMap = oldProgram.getCurrentPackagesMap();
114485
114518
  return 2 /* Completely */;
114486
114519
  }
114487
114520
  function getEmitHost(writeFileCallback) {
@@ -117337,7 +117370,10 @@ function createBuilderProgramState(newProgram, oldState) {
117337
117370
  return;
117338
117371
  const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
117339
117372
  if (diagnostics) {
117340
- state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics);
117373
+ state.semanticDiagnosticsPerFile.set(
117374
+ sourceFilePath,
117375
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
117376
+ );
117341
117377
  if (!state.semanticDiagnosticsFromOldState) {
117342
117378
  state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
117343
117379
  }
@@ -117408,6 +117444,33 @@ function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature)
117408
117444
  isString(oldEmitSignature) ? [oldEmitSignature] : oldEmitSignature[0]
117409
117445
  );
117410
117446
  }
117447
+ function repopulateDiagnostics(diagnostics, newProgram) {
117448
+ if (!diagnostics.length)
117449
+ return diagnostics;
117450
+ return sameMap(diagnostics, (diag2) => {
117451
+ if (isString(diag2.messageText))
117452
+ return diag2;
117453
+ const repopulatedChain = convertOrRepopulateDiagnosticMessageChain(diag2.messageText, diag2.file, newProgram, (chain) => {
117454
+ var _a;
117455
+ return (_a = chain.repopulateInfo) == null ? void 0 : _a.call(chain);
117456
+ });
117457
+ return repopulatedChain === diag2.messageText ? diag2 : { ...diag2, messageText: repopulatedChain };
117458
+ });
117459
+ }
117460
+ function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
117461
+ const info = repopulateInfo(chain);
117462
+ if (info) {
117463
+ return {
117464
+ ...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
117465
+ next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
117466
+ };
117467
+ }
117468
+ const next = convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo);
117469
+ return next === chain.next ? chain : { ...chain, next };
117470
+ }
117471
+ function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) {
117472
+ return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo));
117473
+ }
117411
117474
  function convertToDiagnostics(diagnostics, newProgram) {
117412
117475
  if (!diagnostics.length)
117413
117476
  return emptyArray;
@@ -117429,9 +117492,11 @@ function convertToDiagnostics(diagnostics, newProgram) {
117429
117492
  }
117430
117493
  function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
117431
117494
  const { file } = diagnostic;
117495
+ const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0;
117432
117496
  return {
117433
117497
  ...diagnostic,
117434
- file: file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0
117498
+ file: sourceFile,
117499
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertOrRepopulateDiagnosticMessageChain(diagnostic.messageText, sourceFile, newProgram, (chain) => chain.info)
117435
117500
  };
117436
117501
  }
117437
117502
  function releaseCache(state) {
@@ -117973,9 +118038,35 @@ function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBui
117973
118038
  const { file } = diagnostic;
117974
118039
  return {
117975
118040
  ...diagnostic,
117976
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0
118041
+ file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
118042
+ messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
117977
118043
  };
117978
118044
  }
118045
+ function convertToReusableDiagnosticMessageChain(chain) {
118046
+ if (chain.repopulateInfo) {
118047
+ return {
118048
+ info: chain.repopulateInfo(),
118049
+ next: convertToReusableDiagnosticMessageChainArray(chain.next)
118050
+ };
118051
+ }
118052
+ const next = convertToReusableDiagnosticMessageChainArray(chain.next);
118053
+ return next === chain.next ? chain : { ...chain, next };
118054
+ }
118055
+ function convertToReusableDiagnosticMessageChainArray(array) {
118056
+ if (!array)
118057
+ return array;
118058
+ return forEach(array, (chain, index) => {
118059
+ const reusable = convertToReusableDiagnosticMessageChain(chain);
118060
+ if (chain === reusable)
118061
+ return void 0;
118062
+ const result = index > 0 ? array.slice(0, index - 1) : [];
118063
+ result.push(reusable);
118064
+ for (let i = index + 1; i < array.length; i++) {
118065
+ result.push(convertToReusableDiagnosticMessageChain(array[i]));
118066
+ }
118067
+ return result;
118068
+ }) || array;
118069
+ }
117979
118070
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
117980
118071
  let host;
117981
118072
  let newProgram;
@@ -119062,45 +119153,51 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119062
119153
  }
119063
119154
  (resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
119064
119155
  }
119156
+ function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
119157
+ const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119158
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
119159
+ failedLookupLocation,
119160
+ failedLookupLocationPath,
119161
+ rootDir,
119162
+ rootPath,
119163
+ rootPathComponents,
119164
+ getCurrentDirectory
119165
+ );
119166
+ if (toWatch) {
119167
+ const { dir, dirPath, nonRecursive } = toWatch;
119168
+ if (dirPath === rootPath) {
119169
+ Debug.assert(nonRecursive);
119170
+ setAtRoot = true;
119171
+ } else {
119172
+ setDirectoryWatcher(dir, dirPath, nonRecursive);
119173
+ }
119174
+ }
119175
+ return setAtRoot;
119176
+ }
119065
119177
  function watchFailedLookupLocationOfResolution(resolution) {
119066
119178
  Debug.assert(!!resolution.refCount);
119067
- const { failedLookupLocations, affectingLocations } = resolution;
119068
- if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
119179
+ const { failedLookupLocations, affectingLocations, node10Result } = resolution;
119180
+ if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !node10Result)
119069
119181
  return;
119070
- if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
119182
+ if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || node10Result)
119071
119183
  resolutionsWithFailedLookups.add(resolution);
119072
119184
  let setAtRoot = false;
119073
119185
  if (failedLookupLocations) {
119074
119186
  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
- );
119187
+ setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
119101
119188
  }
119102
119189
  }
119103
- watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length));
119190
+ if (node10Result)
119191
+ setAtRoot = watchFailedLookupLocation(node10Result, setAtRoot);
119192
+ if (setAtRoot) {
119193
+ setDirectoryWatcher(
119194
+ rootDir,
119195
+ rootPath,
119196
+ /*nonRecursive*/
119197
+ true
119198
+ );
119199
+ }
119200
+ watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !node10Result);
119104
119201
  }
119105
119202
  function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
119106
119203
  Debug.assert(!!resolution.refCount);
@@ -119194,6 +119291,26 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119194
119291
  directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
119195
119292
  }
119196
119293
  }
119294
+ function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
119295
+ const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119296
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
119297
+ failedLookupLocation,
119298
+ failedLookupLocationPath,
119299
+ rootDir,
119300
+ rootPath,
119301
+ rootPathComponents,
119302
+ getCurrentDirectory
119303
+ );
119304
+ if (toWatch) {
119305
+ const { dirPath } = toWatch;
119306
+ if (dirPath === rootPath) {
119307
+ removeAtRoot = true;
119308
+ } else {
119309
+ removeDirectoryWatcher(dirPath);
119310
+ }
119311
+ }
119312
+ return removeAtRoot;
119313
+ }
119197
119314
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
119198
119315
  Debug.checkDefined(resolution.files).delete(filePath);
119199
119316
  resolution.refCount--;
@@ -119207,31 +119324,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119207
119324
  if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
119208
119325
  resolvedFileToResolution.delete(key);
119209
119326
  }
119210
- const { failedLookupLocations, affectingLocations } = resolution;
119327
+ const { failedLookupLocations, affectingLocations, node10Result } = resolution;
119211
119328
  if (resolutionsWithFailedLookups.delete(resolution)) {
119212
119329
  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
- }
119330
+ if (failedLookupLocations) {
119331
+ for (const failedLookupLocation of failedLookupLocations) {
119332
+ removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
119230
119333
  }
119231
119334
  }
119232
- if (removeAtRoot) {
119335
+ if (node10Result)
119336
+ removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
119337
+ if (removeAtRoot)
119233
119338
  removeDirectoryWatcher(rootPath);
119234
- }
119235
119339
  } else if (affectingLocations == null ? void 0 : affectingLocations.length) {
119236
119340
  resolutionsWithOnlyAffectingLocations.delete(resolution);
119237
119341
  }
@@ -119385,7 +119489,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119385
119489
  return true;
119386
119490
  if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
119387
119491
  return false;
119388
- return (_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
119492
+ return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.node10Result && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.node10Result));
119389
119493
  }
119390
119494
  function isInvalidatedFailedLookup(locationPath) {
119391
119495
  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);