typescript 5.1.0-dev.20230508 → 5.1.0-dev.20230510

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-dev.20230508`;
21
+ var version = `${versionMajorMinor}.0-dev.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
  }
@@ -42644,18 +42686,6 @@ function isInstantiatedModule(node, preserveConstEnums) {
42644
42686
  return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
42645
42687
  }
42646
42688
  function createTypeChecker(host) {
42647
- var getPackagesMap = memoize(() => {
42648
- var map2 = /* @__PURE__ */ new Map();
42649
- host.getSourceFiles().forEach((sf) => {
42650
- if (!sf.resolvedModules)
42651
- return;
42652
- sf.resolvedModules.forEach(({ resolvedModule }) => {
42653
- if (resolvedModule == null ? void 0 : resolvedModule.packageId)
42654
- map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name));
42655
- });
42656
- });
42657
- return map2;
42658
- });
42659
42689
  var deferredDiagnosticsCallbacks = [];
42660
42690
  var addLazyDiagnostic = (arg) => {
42661
42691
  deferredDiagnosticsCallbacks.push(arg);
@@ -44438,7 +44468,7 @@ function createTypeChecker(host) {
44438
44468
  if (!result) {
44439
44469
  if (nameNotFoundMessage) {
44440
44470
  addLazyDiagnostic(() => {
44441
- if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
44471
+ if (!errorLocation || errorLocation.parent.kind !== 330 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
44442
44472
  !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
44443
44473
  let suggestion;
44444
44474
  let suggestedLib;
@@ -45991,35 +46021,9 @@ function createTypeChecker(host) {
45991
46021
  }
45992
46022
  }
45993
46023
  function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) {
45994
- var _a, _b;
45995
46024
  let errorInfo;
45996
46025
  if (!isExternalModuleNameRelative(moduleReference) && packageId) {
45997
- const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
45998
- errorInfo = node10Result ? chainDiagnosticMessages(
45999
- /*details*/
46000
- void 0,
46001
- 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,
46002
- node10Result,
46003
- node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageId.name)}` : packageId.name
46004
- ) : typesPackageExists(packageId.name) ? chainDiagnosticMessages(
46005
- /*details*/
46006
- void 0,
46007
- 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,
46008
- packageId.name,
46009
- mangleScopedPackageName(packageId.name)
46010
- ) : packageBundlesTypes(packageId.name) ? chainDiagnosticMessages(
46011
- /*details*/
46012
- void 0,
46013
- Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,
46014
- packageId.name,
46015
- moduleReference
46016
- ) : chainDiagnosticMessages(
46017
- /*details*/
46018
- void 0,
46019
- Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
46020
- moduleReference,
46021
- mangleScopedPackageName(packageId.name)
46022
- );
46026
+ errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
46023
46027
  }
46024
46028
  errorOrSuggestion(isError, errorNode, chainDiagnosticMessages(
46025
46029
  errorInfo,
@@ -46028,12 +46032,6 @@ function createTypeChecker(host) {
46028
46032
  resolvedFileName
46029
46033
  ));
46030
46034
  }
46031
- function typesPackageExists(packageName) {
46032
- return getPackagesMap().has(getTypesPackageName(packageName));
46033
- }
46034
- function packageBundlesTypes(packageName) {
46035
- return !!getPackagesMap().get(packageName);
46036
- }
46037
46035
  function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
46038
46036
  if (moduleSymbol == null ? void 0 : moduleSymbol.exports) {
46039
46037
  const exportEquals = resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias);
@@ -56544,7 +56542,20 @@ function createTypeChecker(host) {
56544
56542
  if (isPrivateIdentifier(name)) {
56545
56543
  return neverType;
56546
56544
  }
56547
- 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;
56548
56559
  }
56549
56560
  function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
56550
56561
  if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) & 24 /* NonPublicAccessibilityModifier */)) {
@@ -67647,7 +67658,7 @@ function createTypeChecker(host) {
67647
67658
  }
67648
67659
  return links.immediateTarget;
67649
67660
  }
67650
- function checkObjectLiteral(node, checkMode) {
67661
+ function checkObjectLiteral(node, checkMode = 0 /* Normal */) {
67651
67662
  var _a;
67652
67663
  const inDestructuringPattern = isAssignmentTarget(node);
67653
67664
  checkGrammarObjectLiteralExpression(node, inDestructuringPattern);
@@ -67730,7 +67741,7 @@ function createTypeChecker(host) {
67730
67741
  prop.links.target = member;
67731
67742
  member = prop;
67732
67743
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
67733
- if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
67744
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
67734
67745
  const inferenceContext = getInferenceContext(node);
67735
67746
  Debug.assert(inferenceContext);
67736
67747
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -67748,7 +67759,7 @@ function createTypeChecker(host) {
67748
67759
  hasComputedNumberProperty = false;
67749
67760
  hasComputedSymbolProperty = false;
67750
67761
  }
67751
- const type = getReducedType(checkExpression(memberDecl.expression));
67762
+ const type = getReducedType(checkExpression(memberDecl.expression, checkMode & 2 /* Inferential */));
67752
67763
  if (isValidSpreadType(type)) {
67753
67764
  const mergedType = tryMergeUnionOfObjectTypeAndEmptyObject(type, inConstContext);
67754
67765
  if (allPropertiesTable) {
@@ -67889,7 +67900,7 @@ function createTypeChecker(host) {
67889
67900
  function checkJsxAttribute(node, checkMode) {
67890
67901
  return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType;
67891
67902
  }
67892
- function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) {
67903
+ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) {
67893
67904
  const attributes = openingLikeElement.attributes;
67894
67905
  const contextualType = getContextualType(attributes, 0 /* None */);
67895
67906
  const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0;
@@ -67924,7 +67935,7 @@ function createTypeChecker(host) {
67924
67935
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
67925
67936
  }
67926
67937
  }
67927
- if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
67938
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
67928
67939
  const inferenceContext = getInferenceContext(attributes);
67929
67940
  Debug.assert(inferenceContext);
67930
67941
  const inferenceNode = attributeDecl.initializer.expression;
@@ -67943,7 +67954,7 @@ function createTypeChecker(host) {
67943
67954
  );
67944
67955
  attributesTable = createSymbolTable();
67945
67956
  }
67946
- const exprType = getReducedType(checkExpressionCached(attributeDecl.expression, checkMode));
67957
+ const exprType = getReducedType(checkExpression(attributeDecl.expression, checkMode & 2 /* Inferential */));
67947
67958
  if (isTypeAny(exprType)) {
67948
67959
  hasSpreadAnyType = true;
67949
67960
  }
@@ -69674,7 +69685,7 @@ function createTypeChecker(host) {
69674
69685
  if (getJsxNamespaceContainerForImplicitImport(node)) {
69675
69686
  return true;
69676
69687
  }
69677
- 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;
69678
69689
  if (!tagType) {
69679
69690
  return true;
69680
69691
  }
@@ -80256,7 +80267,7 @@ function createTypeChecker(host) {
80256
80267
  name,
80257
80268
  meaning,
80258
80269
  /*ignoreErrors*/
80259
- false,
80270
+ true,
80260
80271
  /*dontResolveAlias*/
80261
80272
  true,
80262
80273
  getHostSignatureFromJSDoc(name)
@@ -80267,7 +80278,7 @@ function createTypeChecker(host) {
80267
80278
  return resolveJSDocMemberName(
80268
80279
  name,
80269
80280
  /*ignoreErrors*/
80270
- false,
80281
+ true,
80271
80282
  getSymbolOfDeclaration(container)
80272
80283
  );
80273
80284
  }
@@ -108392,6 +108403,8 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108392
108403
  return emitJsxSpreadAttribute(node);
108393
108404
  case 293 /* JsxExpression */:
108394
108405
  return emitJsxExpression(node);
108406
+ case 294 /* JsxNamespacedName */:
108407
+ return emitJsxNamespacedName(node);
108395
108408
  case 295 /* CaseClause */:
108396
108409
  return emitCaseClause(node);
108397
108410
  case 296 /* DefaultClause */:
@@ -108587,8 +108600,6 @@ function createPrinter(printerOptions = {}, handlers = {}) {
108587
108600
  return emitJsxSelfClosingElement(node);
108588
108601
  case 287 /* JsxFragment */:
108589
108602
  return emitJsxFragment(node);
108590
- case 294 /* JsxNamespacedName */:
108591
- return emitJsxNamespacedName(node);
108592
108603
  case 357 /* SyntaxList */:
108593
108604
  return Debug.fail("SyntaxList should not be printed");
108594
108605
  case 358 /* NotEmittedStatement */:
@@ -111420,6 +111431,10 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111420
111431
  if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
111421
111432
  return idText(node);
111422
111433
  }
111434
+ } else if (isJsxNamespacedName(node)) {
111435
+ if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
111436
+ return getTextOfJsxNamespacedName(node);
111437
+ }
111423
111438
  } else {
111424
111439
  Debug.assertNode(node, isLiteralExpression);
111425
111440
  if (!canUseSourceFile) {
@@ -111431,7 +111446,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
111431
111446
  function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
111432
111447
  if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) {
111433
111448
  const textSourceNode = node.textSourceNode;
111434
- if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
111449
+ if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) {
111435
111450
  const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
111436
111451
  return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
111437
111452
  } else {
@@ -113643,6 +113658,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113643
113658
  let automaticTypeDirectiveResolutions;
113644
113659
  let resolvedLibReferences;
113645
113660
  let resolvedLibProcessing;
113661
+ let packageMap;
113646
113662
  const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
113647
113663
  let currentNodeModulesDepth = 0;
113648
113664
  const modulesWithElidedImports = /* @__PURE__ */ new Map();
@@ -113947,6 +113963,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113947
113963
  redirectTargetsMap,
113948
113964
  usesUriStyleNodeCoreModules,
113949
113965
  resolvedLibReferences,
113966
+ getCurrentPackagesMap: () => packageMap,
113967
+ typesPackageExists,
113968
+ packageBundlesTypes,
113950
113969
  isEmittedFile,
113951
113970
  getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
113952
113971
  getProjectReferences,
@@ -113987,6 +114006,26 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
113987
114006
  measure("Program", "beforeProgram", "afterProgram");
113988
114007
  (_p = tracing) == null ? void 0 : _p.pop();
113989
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
+ }
113990
114029
  function addResolutionDiagnostics(resolution) {
113991
114030
  var _a2;
113992
114031
  if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length))
@@ -114475,6 +114514,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114475
114514
  redirectTargetsMap = oldProgram.redirectTargetsMap;
114476
114515
  usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
114477
114516
  resolvedLibReferences = oldProgram.resolvedLibReferences;
114517
+ packageMap = oldProgram.getCurrentPackagesMap();
114478
114518
  return 2 /* Completely */;
114479
114519
  }
114480
114520
  function getEmitHost(writeFileCallback) {
@@ -117330,7 +117370,10 @@ function createBuilderProgramState(newProgram, oldState) {
117330
117370
  return;
117331
117371
  const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
117332
117372
  if (diagnostics) {
117333
- 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
+ );
117334
117377
  if (!state.semanticDiagnosticsFromOldState) {
117335
117378
  state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
117336
117379
  }
@@ -117401,6 +117444,33 @@ function getEmitSignatureFromOldSignature(options, oldOptions, oldEmitSignature)
117401
117444
  isString(oldEmitSignature) ? [oldEmitSignature] : oldEmitSignature[0]
117402
117445
  );
117403
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
+ }
117404
117474
  function convertToDiagnostics(diagnostics, newProgram) {
117405
117475
  if (!diagnostics.length)
117406
117476
  return emptyArray;
@@ -117422,9 +117492,11 @@ function convertToDiagnostics(diagnostics, newProgram) {
117422
117492
  }
117423
117493
  function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
117424
117494
  const { file } = diagnostic;
117495
+ const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0;
117425
117496
  return {
117426
117497
  ...diagnostic,
117427
- 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)
117428
117500
  };
117429
117501
  }
117430
117502
  function releaseCache(state) {
@@ -117966,9 +118038,35 @@ function convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBui
117966
118038
  const { file } = diagnostic;
117967
118039
  return {
117968
118040
  ...diagnostic,
117969
- 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)
117970
118043
  };
117971
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
+ }
117972
118070
  function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
117973
118071
  let host;
117974
118072
  let newProgram;
@@ -119055,45 +119153,51 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119055
119153
  }
119056
119154
  (resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
119057
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
+ }
119058
119177
  function watchFailedLookupLocationOfResolution(resolution) {
119059
119178
  Debug.assert(!!resolution.refCount);
119060
- const { failedLookupLocations, affectingLocations } = resolution;
119061
- 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)
119062
119181
  return;
119063
- if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
119182
+ if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || node10Result)
119064
119183
  resolutionsWithFailedLookups.add(resolution);
119065
119184
  let setAtRoot = false;
119066
119185
  if (failedLookupLocations) {
119067
119186
  for (const failedLookupLocation of failedLookupLocations) {
119068
- const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119069
- const toWatch = getDirectoryToWatchFailedLookupLocation(
119070
- failedLookupLocation,
119071
- failedLookupLocationPath,
119072
- rootDir,
119073
- rootPath,
119074
- rootPathComponents,
119075
- getCurrentDirectory
119076
- );
119077
- if (toWatch) {
119078
- const { dir, dirPath, nonRecursive } = toWatch;
119079
- if (dirPath === rootPath) {
119080
- Debug.assert(nonRecursive);
119081
- setAtRoot = true;
119082
- } else {
119083
- setDirectoryWatcher(dir, dirPath, nonRecursive);
119084
- }
119085
- }
119086
- }
119087
- if (setAtRoot) {
119088
- setDirectoryWatcher(
119089
- rootDir,
119090
- rootPath,
119091
- /*nonRecursive*/
119092
- true
119093
- );
119187
+ setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
119094
119188
  }
119095
119189
  }
119096
- 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);
119097
119201
  }
119098
119202
  function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
119099
119203
  Debug.assert(!!resolution.refCount);
@@ -119187,6 +119291,26 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119187
119291
  directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
119188
119292
  }
119189
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
+ }
119190
119314
  function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
119191
119315
  Debug.checkDefined(resolution.files).delete(filePath);
119192
119316
  resolution.refCount--;
@@ -119200,31 +119324,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119200
119324
  if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
119201
119325
  resolvedFileToResolution.delete(key);
119202
119326
  }
119203
- const { failedLookupLocations, affectingLocations } = resolution;
119327
+ const { failedLookupLocations, affectingLocations, node10Result } = resolution;
119204
119328
  if (resolutionsWithFailedLookups.delete(resolution)) {
119205
119329
  let removeAtRoot = false;
119206
- for (const failedLookupLocation of failedLookupLocations) {
119207
- const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
119208
- const toWatch = getDirectoryToWatchFailedLookupLocation(
119209
- failedLookupLocation,
119210
- failedLookupLocationPath,
119211
- rootDir,
119212
- rootPath,
119213
- rootPathComponents,
119214
- getCurrentDirectory
119215
- );
119216
- if (toWatch) {
119217
- const { dirPath } = toWatch;
119218
- if (dirPath === rootPath) {
119219
- removeAtRoot = true;
119220
- } else {
119221
- removeDirectoryWatcher(dirPath);
119222
- }
119330
+ if (failedLookupLocations) {
119331
+ for (const failedLookupLocation of failedLookupLocations) {
119332
+ removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
119223
119333
  }
119224
119334
  }
119225
- if (removeAtRoot) {
119335
+ if (node10Result)
119336
+ removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
119337
+ if (removeAtRoot)
119226
119338
  removeDirectoryWatcher(rootPath);
119227
- }
119228
119339
  } else if (affectingLocations == null ? void 0 : affectingLocations.length) {
119229
119340
  resolutionsWithOnlyAffectingLocations.delete(resolution);
119230
119341
  }
@@ -119378,7 +119489,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
119378
119489
  return true;
119379
119490
  if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
119380
119491
  return false;
119381
- 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));
119382
119493
  }
119383
119494
  function isInvalidatedFailedLookup(locationPath) {
119384
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);