typescript 5.4.0-dev.20231220 → 5.4.0-dev.20231222

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.4";
38
- version = `${versionMajorMinor}.0-dev.20231220`;
38
+ version = `${versionMajorMinor}.0-dev.20231222`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -1388,9 +1388,9 @@ var ts = (() => {
1388
1388
  const res = previous[s2.length];
1389
1389
  return res > max ? void 0 : res;
1390
1390
  }
1391
- function endsWith(str, suffix) {
1391
+ function endsWith(str, suffix, ignoreCase) {
1392
1392
  const expectedPos = str.length - suffix.length;
1393
- return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
1393
+ return expectedPos >= 0 && (ignoreCase ? equateStringsCaseInsensitive(str.slice(expectedPos), suffix) : str.indexOf(suffix, expectedPos) === expectedPos);
1394
1394
  }
1395
1395
  function removeSuffix(str, suffix) {
1396
1396
  return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : str;
@@ -1483,8 +1483,8 @@ var ts = (() => {
1483
1483
  }
1484
1484
  return matchedValue;
1485
1485
  }
1486
- function startsWith(str, prefix) {
1487
- return str.lastIndexOf(prefix, 0) === 0;
1486
+ function startsWith(str, prefix, ignoreCase) {
1487
+ return ignoreCase ? equateStringsCaseInsensitive(str.slice(0, prefix.length), prefix) : str.lastIndexOf(prefix, 0) === 0;
1488
1488
  }
1489
1489
  function removePrefix(str, prefix) {
1490
1490
  return startsWith(str, prefix) ? str.substr(prefix.length) : str;
@@ -3997,6 +3997,7 @@ ${lanes.join("\n")}
3997
3997
  return JsxFlags2;
3998
3998
  })(JsxFlags || {});
3999
3999
  RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
4000
+ RelationComparisonResult3[RelationComparisonResult3["None"] = 0] = "None";
4000
4001
  RelationComparisonResult3[RelationComparisonResult3["Succeeded"] = 1] = "Succeeded";
4001
4002
  RelationComparisonResult3[RelationComparisonResult3["Failed"] = 2] = "Failed";
4002
4003
  RelationComparisonResult3[RelationComparisonResult3["Reported"] = 4] = "Reported";
@@ -8113,6 +8114,8 @@ ${lanes.join("\n")}
8113
8114
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
8114
8115
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
8115
8116
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
8117
+ Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
8118
+ One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
8116
8119
  The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
8117
8120
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
8118
8121
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -17097,6 +17100,13 @@ ${lanes.join("\n")}
17097
17100
  function readJson(path, host) {
17098
17101
  return readJsonOrUndefined(path, host) || {};
17099
17102
  }
17103
+ function tryParseJson(text) {
17104
+ try {
17105
+ return JSON.parse(text);
17106
+ } catch {
17107
+ return void 0;
17108
+ }
17109
+ }
17100
17110
  function directoryProbablyExists(directoryName, host) {
17101
17111
  return !host.directoryExists || host.directoryExists(directoryName);
17102
17112
  }
@@ -39969,6 +39979,9 @@ ${lanes.join("\n")}
39969
39979
  function isPackageJsonInfo(entry) {
39970
39980
  return !!(entry == null ? void 0 : entry.contents);
39971
39981
  }
39982
+ function isMissingPackageJsonInfo(entry) {
39983
+ return !!entry && !entry.contents;
39984
+ }
39972
39985
  function compilerOptionValueToString(value) {
39973
39986
  var _a;
39974
39987
  if (value === null || typeof value !== "object") {
@@ -45319,7 +45332,7 @@ ${lanes.join("\n")}
45319
45332
  const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
45320
45333
  const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
45321
45334
  const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
45322
- if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
45335
+ if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
45323
45336
  return pathsOnly ? void 0 : relativePath;
45324
45337
  }
45325
45338
  const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
@@ -45327,11 +45340,12 @@ ${lanes.join("\n")}
45327
45340
  if (!relativeToBaseUrl) {
45328
45341
  return pathsOnly ? void 0 : relativePath;
45329
45342
  }
45330
- const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions);
45343
+ const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
45344
+ const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
45331
45345
  if (pathsOnly) {
45332
45346
  return fromPaths;
45333
45347
  }
45334
- const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
45348
+ const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
45335
45349
  if (!maybeNonRelative) {
45336
45350
  return relativePath;
45337
45351
  }
@@ -45370,8 +45384,8 @@ ${lanes.join("\n")}
45370
45384
  if (host.getNearestAncestorDirectoryWithPackageJson) {
45371
45385
  return host.getNearestAncestorDirectoryWithPackageJson(fileName);
45372
45386
  }
45373
- return !!forEachAncestorDirectory(fileName, (directory) => {
45374
- return host.fileExists(combinePaths(directory, "package.json")) ? true : void 0;
45387
+ return forEachAncestorDirectory(fileName, (directory) => {
45388
+ return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
45375
45389
  });
45376
45390
  }
45377
45391
  function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
@@ -45545,8 +45559,12 @@ ${lanes.join("\n")}
45545
45559
  return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
45546
45560
  }
45547
45561
  }
45548
- function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode = 0 /* Exact */) {
45562
+ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, mode, isImports) {
45549
45563
  if (typeof exports === "string") {
45564
+ const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
45565
+ const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
45566
+ const outputFile = isImports && getOutputJSFileNameWorker(targetFilePath, options, ignoreCase, getCommonSourceDirectory2);
45567
+ const declarationFile = isImports && getOutputDeclarationFileNameWorker(targetFilePath, options, ignoreCase, getCommonSourceDirectory2);
45550
45568
  const pathOrPattern = getNormalizedAbsolutePath(
45551
45569
  combinePaths(packageDirectory, exports),
45552
45570
  /*currentDirectory*/
@@ -45555,12 +45573,25 @@ ${lanes.join("\n")}
45555
45573
  const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
45556
45574
  switch (mode) {
45557
45575
  case 0 /* Exact */:
45558
- if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */) {
45576
+ if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */) {
45559
45577
  return { moduleFileToTry: packageName };
45560
45578
  }
45561
45579
  break;
45562
45580
  case 1 /* Directory */:
45563
- if (containsPath(pathOrPattern, targetFilePath)) {
45581
+ if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
45582
+ const fragment = getRelativePathFromDirectory(
45583
+ pathOrPattern,
45584
+ extensionSwappedTarget,
45585
+ /*ignoreCase*/
45586
+ false
45587
+ );
45588
+ return { moduleFileToTry: getNormalizedAbsolutePath(
45589
+ combinePaths(combinePaths(packageName, exports), fragment),
45590
+ /*currentDirectory*/
45591
+ void 0
45592
+ ) };
45593
+ }
45594
+ if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
45564
45595
  const fragment = getRelativePathFromDirectory(
45565
45596
  pathOrPattern,
45566
45597
  targetFilePath,
@@ -45573,48 +45604,136 @@ ${lanes.join("\n")}
45573
45604
  void 0
45574
45605
  ) };
45575
45606
  }
45607
+ if (outputFile && containsPath(pathOrPattern, outputFile, ignoreCase)) {
45608
+ const fragment = getRelativePathFromDirectory(
45609
+ pathOrPattern,
45610
+ outputFile,
45611
+ /*ignoreCase*/
45612
+ false
45613
+ );
45614
+ return { moduleFileToTry: combinePaths(packageName, fragment) };
45615
+ }
45616
+ if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
45617
+ const fragment = getRelativePathFromDirectory(
45618
+ pathOrPattern,
45619
+ declarationFile,
45620
+ /*ignoreCase*/
45621
+ false
45622
+ );
45623
+ return { moduleFileToTry: combinePaths(packageName, fragment) };
45624
+ }
45576
45625
  break;
45577
45626
  case 2 /* Pattern */:
45578
45627
  const starPos = pathOrPattern.indexOf("*");
45579
45628
  const leadingSlice = pathOrPattern.slice(0, starPos);
45580
45629
  const trailingSlice = pathOrPattern.slice(starPos + 1);
45581
- if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
45630
+ if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
45631
+ const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
45632
+ return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
45633
+ }
45634
+ if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
45582
45635
  const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
45583
45636
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
45584
45637
  }
45585
- if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
45586
- const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
45638
+ if (outputFile && startsWith(outputFile, leadingSlice, ignoreCase) && endsWith(outputFile, trailingSlice, ignoreCase)) {
45639
+ const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
45640
+ return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
45641
+ }
45642
+ if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
45643
+ const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
45587
45644
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
45588
45645
  }
45589
45646
  break;
45590
45647
  }
45591
45648
  } else if (Array.isArray(exports)) {
45592
- return forEach(exports, (e) => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions));
45649
+ return forEach(exports, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
45593
45650
  } else if (typeof exports === "object" && exports !== null) {
45594
- if (allKeysStartWithDot(exports)) {
45595
- return forEach(getOwnKeys(exports), (k) => {
45596
- const subPackageName = getNormalizedAbsolutePath(
45597
- combinePaths(packageName, k),
45598
- /*currentDirectory*/
45599
- void 0
45600
- );
45601
- const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
45602
- return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
45603
- });
45604
- } else {
45605
- for (const key of getOwnKeys(exports)) {
45606
- if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
45607
- const subTarget = exports[key];
45608
- const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
45609
- if (result) {
45610
- return result;
45611
- }
45651
+ for (const key of getOwnKeys(exports)) {
45652
+ if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
45653
+ const subTarget = exports[key];
45654
+ const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
45655
+ if (result) {
45656
+ return result;
45612
45657
  }
45613
45658
  }
45614
45659
  }
45615
45660
  }
45616
45661
  return void 0;
45617
45662
  }
45663
+ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions) {
45664
+ if (typeof exports === "object" && exports !== null && !Array.isArray(exports) && allKeysStartWithDot(exports)) {
45665
+ return forEach(getOwnKeys(exports), (k) => {
45666
+ const subPackageName = getNormalizedAbsolutePath(
45667
+ combinePaths(packageName, k),
45668
+ /*currentDirectory*/
45669
+ void 0
45670
+ );
45671
+ const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
45672
+ return tryGetModuleNameFromExportsOrImports(
45673
+ options,
45674
+ host,
45675
+ targetFilePath,
45676
+ packageDirectory,
45677
+ subPackageName,
45678
+ exports[k],
45679
+ conditions,
45680
+ mode,
45681
+ /*isImports*/
45682
+ false
45683
+ );
45684
+ });
45685
+ }
45686
+ return tryGetModuleNameFromExportsOrImports(
45687
+ options,
45688
+ host,
45689
+ targetFilePath,
45690
+ packageDirectory,
45691
+ packageName,
45692
+ exports,
45693
+ conditions,
45694
+ 0 /* Exact */,
45695
+ /*isImports*/
45696
+ false
45697
+ );
45698
+ }
45699
+ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
45700
+ var _a, _b, _c;
45701
+ if (!host.readFile || !getResolvePackageJsonImports(options)) {
45702
+ return void 0;
45703
+ }
45704
+ const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
45705
+ if (!ancestorDirectoryWithPackageJson) {
45706
+ return void 0;
45707
+ }
45708
+ const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
45709
+ const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
45710
+ if (isMissingPackageJsonInfo(cachedPackageJson) || !host.fileExists(packageJsonPath)) {
45711
+ return void 0;
45712
+ }
45713
+ const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
45714
+ const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
45715
+ if (!imports) {
45716
+ return void 0;
45717
+ }
45718
+ const conditions = getConditions(options, importMode);
45719
+ return (_c = forEach(getOwnKeys(imports), (k) => {
45720
+ if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
45721
+ return void 0;
45722
+ const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
45723
+ return tryGetModuleNameFromExportsOrImports(
45724
+ options,
45725
+ host,
45726
+ moduleFileName,
45727
+ ancestorDirectoryWithPackageJson,
45728
+ k,
45729
+ imports[k],
45730
+ conditions,
45731
+ mode,
45732
+ /*isImports*/
45733
+ true
45734
+ );
45735
+ })) == null ? void 0 : _c.moduleFileToTry;
45736
+ }
45618
45737
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
45619
45738
  const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
45620
45739
  if (normalizedTargetPaths === void 0) {
@@ -45688,22 +45807,21 @@ ${lanes.join("\n")}
45688
45807
  let maybeBlockedByTypesVersions = false;
45689
45808
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
45690
45809
  if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
45691
- const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
45810
+ const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
45692
45811
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
45693
45812
  if (getResolvePackageJsonExports(options)) {
45694
45813
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
45695
45814
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
45696
45815
  const conditions = getConditions(options, importMode);
45697
- const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
45816
+ const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
45698
45817
  if (fromExports) {
45699
- const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
45700
- return { ...withJsExtension, verbatimFromExports: true };
45818
+ return { ...fromExports, verbatimFromExports: true };
45701
45819
  }
45702
- if (packageJsonContent.exports) {
45820
+ if (packageJsonContent == null ? void 0 : packageJsonContent.exports) {
45703
45821
  return { moduleFileToTry: path, blockedByExports: true };
45704
45822
  }
45705
45823
  }
45706
- const versionPaths = packageJsonContent.typesVersions ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
45824
+ const versionPaths = (packageJsonContent == null ? void 0 : packageJsonContent.typesVersions) ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
45707
45825
  if (versionPaths) {
45708
45826
  const subModuleName = path.slice(packageRootPath.length + 1);
45709
45827
  const fromPaths = tryGetModuleNameFromPaths(
@@ -45719,13 +45837,13 @@ ${lanes.join("\n")}
45719
45837
  moduleFileToTry = combinePaths(packageRootPath, fromPaths);
45720
45838
  }
45721
45839
  }
45722
- const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
45840
+ const mainFileRelative = (packageJsonContent == null ? void 0 : packageJsonContent.typings) || (packageJsonContent == null ? void 0 : packageJsonContent.types) || (packageJsonContent == null ? void 0 : packageJsonContent.main) || "index.js";
45723
45841
  if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
45724
45842
  const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
45725
45843
  const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
45726
45844
  if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
45727
45845
  return { packageRootPath, moduleFileToTry };
45728
- } else if (packageJsonContent.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
45846
+ } else if ((packageJsonContent == null ? void 0 : packageJsonContent.type) !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
45729
45847
  return { packageRootPath, moduleFileToTry };
45730
45848
  }
45731
45849
  }
@@ -62963,12 +63081,12 @@ ${lanes.join("\n")}
62963
63081
  return !!(entry & 1 /* Succeeded */);
62964
63082
  }
62965
63083
  const targetEnumType = getTypeOfSymbol(targetSymbol);
62966
- for (const property of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
62967
- if (property.flags & 8 /* EnumMember */) {
62968
- const targetProperty = getPropertyOfType(targetEnumType, property.escapedName);
63084
+ for (const sourceProperty of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
63085
+ if (sourceProperty.flags & 8 /* EnumMember */) {
63086
+ const targetProperty = getPropertyOfType(targetEnumType, sourceProperty.escapedName);
62969
63087
  if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {
62970
63088
  if (errorReporter) {
62971
- errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), typeToString(
63089
+ errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(sourceProperty), typeToString(
62972
63090
  getDeclaredTypeOfSymbol(targetSymbol),
62973
63091
  /*enclosingDeclaration*/
62974
63092
  void 0,
@@ -62980,6 +63098,35 @@ ${lanes.join("\n")}
62980
63098
  }
62981
63099
  return false;
62982
63100
  }
63101
+ const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */));
63102
+ const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */));
63103
+ if (sourceValue !== targetValue) {
63104
+ const sourceIsString = typeof sourceValue === "string";
63105
+ const targetIsString = typeof targetValue === "string";
63106
+ if (sourceValue !== void 0 && targetValue !== void 0) {
63107
+ if (!errorReporter) {
63108
+ enumRelation.set(id, 2 /* Failed */);
63109
+ } else {
63110
+ const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue;
63111
+ const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue;
63112
+ errorReporter(Diagnostics.Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource);
63113
+ enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
63114
+ }
63115
+ return false;
63116
+ }
63117
+ if (sourceIsString || targetIsString) {
63118
+ if (!errorReporter) {
63119
+ enumRelation.set(id, 2 /* Failed */);
63120
+ } else {
63121
+ const knownStringValue = sourceValue ?? targetValue;
63122
+ Debug.assert(typeof knownStringValue === "string");
63123
+ const escapedValue = `"${escapeString(knownStringValue)}"`;
63124
+ errorReporter(Diagnostics.One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value, symbolName(targetSymbol), symbolName(targetProperty), escapedValue);
63125
+ enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
63126
+ }
63127
+ return false;
63128
+ }
63129
+ }
62983
63130
  }
62984
63131
  }
62985
63132
  enumRelation.set(id, 1 /* Succeeded */);
@@ -113386,28 +113533,34 @@ ${lanes.join("\n")}
113386
113533
  function getOutputExtension(fileName, options) {
113387
113534
  return fileExtensionIs(fileName, ".json" /* Json */) ? ".json" /* Json */ : options.jsx === 1 /* Preserve */ && fileExtensionIsOneOf(fileName, [".jsx" /* Jsx */, ".tsx" /* Tsx */]) ? ".jsx" /* Jsx */ : fileExtensionIsOneOf(fileName, [".mts" /* Mts */, ".mjs" /* Mjs */]) ? ".mjs" /* Mjs */ : fileExtensionIsOneOf(fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]) ? ".cjs" /* Cjs */ : ".js" /* Js */;
113388
113535
  }
113389
- function getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, outputDir, getCommonSourceDirectory2) {
113536
+ function getOutputPathWithoutChangingExt(inputFileName, ignoreCase, outputDir, getCommonSourceDirectory2) {
113390
113537
  return outputDir ? resolvePath(
113391
113538
  outputDir,
113392
- getRelativePathFromDirectory(getCommonSourceDirectory2 ? getCommonSourceDirectory2() : getCommonSourceDirectoryOfConfig(configFile, ignoreCase), inputFileName, ignoreCase)
113539
+ getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)
113393
113540
  ) : inputFileName;
113394
113541
  }
113395
- function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
113542
+ function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2 = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) {
113543
+ return getOutputDeclarationFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory2);
113544
+ }
113545
+ function getOutputDeclarationFileNameWorker(inputFileName, options, ignoreCase, getCommonSourceDirectory2) {
113396
113546
  return changeExtension(
113397
- getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory2),
113547
+ getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.declarationDir || options.outDir, getCommonSourceDirectory2),
113398
113548
  getDeclarationEmitExtensionForPath(inputFileName)
113399
113549
  );
113400
113550
  }
113401
- function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
113551
+ function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2 = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) {
113402
113552
  if (configFile.options.emitDeclarationOnly)
113403
113553
  return void 0;
113404
113554
  const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
113405
- const outputFileName = changeExtension(
113406
- getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory2),
113407
- getOutputExtension(inputFileName, configFile.options)
113408
- );
113555
+ const outputFileName = getOutputJSFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory2);
113409
113556
  return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
113410
113557
  }
113558
+ function getOutputJSFileNameWorker(inputFileName, options, ignoreCase, getCommonSourceDirectory2) {
113559
+ return changeExtension(
113560
+ getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.outDir, getCommonSourceDirectory2),
113561
+ getOutputExtension(inputFileName, options)
113562
+ );
113563
+ }
113411
113564
  function createAddOutput() {
113412
113565
  let outputs;
113413
113566
  return { addOutput, getOutputs };
@@ -131931,7 +132084,8 @@ ${lanes.join("\n")}
131931
132084
  getProjectReferenceRedirect: (fileName) => program.getProjectReferenceRedirect(fileName),
131932
132085
  isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
131933
132086
  getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
131934
- getFileIncludeReasons: () => program.getFileIncludeReasons()
132087
+ getFileIncludeReasons: () => program.getFileIncludeReasons(),
132088
+ getCommonSourceDirectory: () => program.getCommonSourceDirectory()
131935
132089
  };
131936
132090
  }
131937
132091
  function getModuleSpecifierResolverHost(program, host) {
@@ -132978,13 +133132,6 @@ ${lanes.join("\n")}
132978
133132
  return components[0];
132979
133133
  }
132980
133134
  }
132981
- function tryParseJson(text) {
132982
- try {
132983
- return JSON.parse(text);
132984
- } catch {
132985
- return void 0;
132986
- }
132987
- }
132988
133135
  function consumesNodeCoreModules(sourceFile) {
132989
133136
  return some(sourceFile.imports, ({ text }) => ts_JsTyping_exports.nodeCoreModules.has(text));
132990
133137
  }
@@ -186012,8 +186159,10 @@ ${e.message}`;
186012
186159
  getOriginalNodeId: () => getOriginalNodeId,
186013
186160
  getOriginalSourceFile: () => getOriginalSourceFile,
186014
186161
  getOutputDeclarationFileName: () => getOutputDeclarationFileName,
186162
+ getOutputDeclarationFileNameWorker: () => getOutputDeclarationFileNameWorker,
186015
186163
  getOutputExtension: () => getOutputExtension,
186016
186164
  getOutputFileNames: () => getOutputFileNames,
186165
+ getOutputJSFileNameWorker: () => getOutputJSFileNameWorker,
186017
186166
  getOutputPathsFor: () => getOutputPathsFor,
186018
186167
  getOutputPathsForBundle: () => getOutputPathsForBundle,
186019
186168
  getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
@@ -186644,6 +186793,7 @@ ${e.message}`;
186644
186793
  isMethodSignature: () => isMethodSignature,
186645
186794
  isMinusToken: () => isMinusToken,
186646
186795
  isMissingDeclaration: () => isMissingDeclaration,
186796
+ isMissingPackageJsonInfo: () => isMissingPackageJsonInfo,
186647
186797
  isModifier: () => isModifier,
186648
186798
  isModifierKind: () => isModifierKind,
186649
186799
  isModifierLike: () => isModifierLike,
@@ -187345,6 +187495,7 @@ ${e.message}`;
187345
187495
  tryGetSourceMappingURL: () => tryGetSourceMappingURL,
187346
187496
  tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
187347
187497
  tryIOAndConsumeErrors: () => tryIOAndConsumeErrors,
187498
+ tryParseJson: () => tryParseJson,
187348
187499
  tryParsePattern: () => tryParsePattern,
187349
187500
  tryParsePatterns: () => tryParsePatterns,
187350
187501
  tryParseRawSourceMap: () => tryParseRawSourceMap,
@@ -188428,8 +188579,10 @@ ${e.message}`;
188428
188579
  getOriginalNodeId: () => getOriginalNodeId,
188429
188580
  getOriginalSourceFile: () => getOriginalSourceFile,
188430
188581
  getOutputDeclarationFileName: () => getOutputDeclarationFileName,
188582
+ getOutputDeclarationFileNameWorker: () => getOutputDeclarationFileNameWorker,
188431
188583
  getOutputExtension: () => getOutputExtension,
188432
188584
  getOutputFileNames: () => getOutputFileNames,
188585
+ getOutputJSFileNameWorker: () => getOutputJSFileNameWorker,
188433
188586
  getOutputPathsFor: () => getOutputPathsFor,
188434
188587
  getOutputPathsForBundle: () => getOutputPathsForBundle,
188435
188588
  getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
@@ -189060,6 +189213,7 @@ ${e.message}`;
189060
189213
  isMethodSignature: () => isMethodSignature,
189061
189214
  isMinusToken: () => isMinusToken,
189062
189215
  isMissingDeclaration: () => isMissingDeclaration,
189216
+ isMissingPackageJsonInfo: () => isMissingPackageJsonInfo,
189063
189217
  isModifier: () => isModifier,
189064
189218
  isModifierKind: () => isModifierKind,
189065
189219
  isModifierLike: () => isModifierLike,
@@ -189761,6 +189915,7 @@ ${e.message}`;
189761
189915
  tryGetSourceMappingURL: () => tryGetSourceMappingURL,
189762
189916
  tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
189763
189917
  tryIOAndConsumeErrors: () => tryIOAndConsumeErrors,
189918
+ tryParseJson: () => tryParseJson,
189764
189919
  tryParsePattern: () => tryParsePattern,
189765
189920
  tryParsePatterns: () => tryParsePatterns,
189766
189921
  tryParseRawSourceMap: () => tryParseRawSourceMap,
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-dev.20231220`;
57
+ var version = `${versionMajorMinor}.0-dev.20231222`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -634,9 +634,9 @@ function levenshteinWithMax(s1, s2, max) {
634
634
  const res = previous[s2.length];
635
635
  return res > max ? void 0 : res;
636
636
  }
637
- function endsWith(str, suffix) {
637
+ function endsWith(str, suffix, ignoreCase) {
638
638
  const expectedPos = str.length - suffix.length;
639
- return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
639
+ return expectedPos >= 0 && (ignoreCase ? equateStringsCaseInsensitive(str.slice(expectedPos), suffix) : str.indexOf(suffix, expectedPos) === expectedPos);
640
640
  }
641
641
  function removeMinAndVersionNumbers(fileName) {
642
642
  let end = fileName.length;
@@ -723,8 +723,8 @@ function findBestPatternMatch(values, getPattern, candidate) {
723
723
  }
724
724
  return matchedValue;
725
725
  }
726
- function startsWith(str, prefix) {
727
- return str.lastIndexOf(prefix, 0) === 0;
726
+ function startsWith(str, prefix, ignoreCase) {
727
+ return ignoreCase ? equateStringsCaseInsensitive(str.slice(0, prefix.length), prefix) : str.lastIndexOf(prefix, 0) === 0;
728
728
  }
729
729
  function isPatternMatch({ prefix, suffix }, candidate) {
730
730
  return candidate.length >= prefix.length + suffix.length && startsWith(candidate, prefix) && endsWith(candidate, suffix);
@@ -2944,6 +2944,7 @@ var ModifierFlags = /* @__PURE__ */ ((ModifierFlags3) => {
2944
2944
  return ModifierFlags3;
2945
2945
  })(ModifierFlags || {});
2946
2946
  var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
2947
+ RelationComparisonResult3[RelationComparisonResult3["None"] = 0] = "None";
2947
2948
  RelationComparisonResult3[RelationComparisonResult3["Succeeded"] = 1] = "Succeeded";
2948
2949
  RelationComparisonResult3[RelationComparisonResult3["Failed"] = 2] = "Failed";
2949
2950
  RelationComparisonResult3[RelationComparisonResult3["Reported"] = 4] = "Reported";
@@ -6160,6 +6161,8 @@ var Diagnostics = {
6160
6161
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
6161
6162
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
6162
6163
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
6164
+ Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
6165
+ One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
6163
6166
  The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
6164
6167
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
6165
6168
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.4.0-dev.20231220",
5
+ "version": "5.4.0-dev.20231222",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "63babdf7dacebcca2673a9e2b8d5dd2d7dcc6017"
116
+ "gitHead": "fbcdb8cf4fbbbea0111a9adeb9d0d2983c088b7c"
117
117
  }