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/tsc.js +209 -56
- package/lib/tsserver.js +223 -64
- package/lib/typescript.js +219 -64
- package/lib/typingsInstaller.js +8 -5
- package/package.json +2 -2
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.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20231222`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1049,9 +1049,9 @@ function levenshteinWithMax(s1, s2, max) {
|
|
|
1049
1049
|
const res = previous[s2.length];
|
|
1050
1050
|
return res > max ? void 0 : res;
|
|
1051
1051
|
}
|
|
1052
|
-
function endsWith(str, suffix) {
|
|
1052
|
+
function endsWith(str, suffix, ignoreCase) {
|
|
1053
1053
|
const expectedPos = str.length - suffix.length;
|
|
1054
|
-
return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
|
|
1054
|
+
return expectedPos >= 0 && (ignoreCase ? equateStringsCaseInsensitive(str.slice(expectedPos), suffix) : str.indexOf(suffix, expectedPos) === expectedPos);
|
|
1055
1055
|
}
|
|
1056
1056
|
function removeSuffix(str, suffix) {
|
|
1057
1057
|
return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : str;
|
|
@@ -1109,8 +1109,8 @@ function findBestPatternMatch(values, getPattern, candidate) {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
return matchedValue;
|
|
1111
1111
|
}
|
|
1112
|
-
function startsWith(str, prefix) {
|
|
1113
|
-
return str.lastIndexOf(prefix, 0) === 0;
|
|
1112
|
+
function startsWith(str, prefix, ignoreCase) {
|
|
1113
|
+
return ignoreCase ? equateStringsCaseInsensitive(str.slice(0, prefix.length), prefix) : str.lastIndexOf(prefix, 0) === 0;
|
|
1114
1114
|
}
|
|
1115
1115
|
function removePrefix(str, prefix) {
|
|
1116
1116
|
return startsWith(str, prefix) ? str.substr(prefix.length) : str;
|
|
@@ -3483,6 +3483,7 @@ var ModifierFlags = /* @__PURE__ */ ((ModifierFlags3) => {
|
|
|
3483
3483
|
return ModifierFlags3;
|
|
3484
3484
|
})(ModifierFlags || {});
|
|
3485
3485
|
var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
|
|
3486
|
+
RelationComparisonResult3[RelationComparisonResult3["None"] = 0] = "None";
|
|
3486
3487
|
RelationComparisonResult3[RelationComparisonResult3["Succeeded"] = 1] = "Succeeded";
|
|
3487
3488
|
RelationComparisonResult3[RelationComparisonResult3["Failed"] = 2] = "Failed";
|
|
3488
3489
|
RelationComparisonResult3[RelationComparisonResult3["Reported"] = 4] = "Reported";
|
|
@@ -6783,6 +6784,8 @@ var Diagnostics = {
|
|
|
6783
6784
|
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}'."),
|
|
6784
6785
|
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}'?"),
|
|
6785
6786
|
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'."),
|
|
6787
|
+
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."),
|
|
6788
|
+
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."),
|
|
6786
6789
|
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."),
|
|
6787
6790
|
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."),
|
|
6788
6791
|
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}'."),
|
|
@@ -15728,6 +15731,13 @@ function readJsonOrUndefined(path, hostOrText) {
|
|
|
15728
15731
|
function readJson(path, host) {
|
|
15729
15732
|
return readJsonOrUndefined(path, host) || {};
|
|
15730
15733
|
}
|
|
15734
|
+
function tryParseJson(text) {
|
|
15735
|
+
try {
|
|
15736
|
+
return JSON.parse(text);
|
|
15737
|
+
} catch {
|
|
15738
|
+
return void 0;
|
|
15739
|
+
}
|
|
15740
|
+
}
|
|
15731
15741
|
function directoryProbablyExists(directoryName, host) {
|
|
15732
15742
|
return !host.directoryExists || host.directoryExists(directoryName);
|
|
15733
15743
|
}
|
|
@@ -37603,6 +37613,9 @@ function getAutomaticTypeDirectiveNames(options, host) {
|
|
|
37603
37613
|
function isPackageJsonInfo(entry) {
|
|
37604
37614
|
return !!(entry == null ? void 0 : entry.contents);
|
|
37605
37615
|
}
|
|
37616
|
+
function isMissingPackageJsonInfo(entry) {
|
|
37617
|
+
return !!entry && !entry.contents;
|
|
37618
|
+
}
|
|
37606
37619
|
function compilerOptionValueToString(value) {
|
|
37607
37620
|
var _a;
|
|
37608
37621
|
if (value === null || typeof value !== "object") {
|
|
@@ -42746,7 +42759,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42746
42759
|
const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
|
|
42747
42760
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
42748
42761
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
42749
|
-
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
42762
|
+
if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
|
|
42750
42763
|
return pathsOnly ? void 0 : relativePath;
|
|
42751
42764
|
}
|
|
42752
42765
|
const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
|
|
@@ -42754,11 +42767,12 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42754
42767
|
if (!relativeToBaseUrl) {
|
|
42755
42768
|
return pathsOnly ? void 0 : relativePath;
|
|
42756
42769
|
}
|
|
42757
|
-
const
|
|
42770
|
+
const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
|
|
42771
|
+
const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
|
|
42758
42772
|
if (pathsOnly) {
|
|
42759
42773
|
return fromPaths;
|
|
42760
42774
|
}
|
|
42761
|
-
const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
|
|
42775
|
+
const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
|
|
42762
42776
|
if (!maybeNonRelative) {
|
|
42763
42777
|
return relativePath;
|
|
42764
42778
|
}
|
|
@@ -42797,8 +42811,8 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
|
|
|
42797
42811
|
if (host.getNearestAncestorDirectoryWithPackageJson) {
|
|
42798
42812
|
return host.getNearestAncestorDirectoryWithPackageJson(fileName);
|
|
42799
42813
|
}
|
|
42800
|
-
return
|
|
42801
|
-
return host.fileExists(combinePaths(directory, "package.json")) ?
|
|
42814
|
+
return forEachAncestorDirectory(fileName, (directory) => {
|
|
42815
|
+
return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
|
|
42802
42816
|
});
|
|
42803
42817
|
}
|
|
42804
42818
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
@@ -42972,8 +42986,12 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
42972
42986
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
42973
42987
|
}
|
|
42974
42988
|
}
|
|
42975
|
-
function
|
|
42989
|
+
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
|
|
42976
42990
|
if (typeof exports2 === "string") {
|
|
42991
|
+
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
|
|
42992
|
+
const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
|
|
42993
|
+
const outputFile = isImports && getOutputJSFileNameWorker(targetFilePath, options, ignoreCase, getCommonSourceDirectory2);
|
|
42994
|
+
const declarationFile = isImports && getOutputDeclarationFileNameWorker(targetFilePath, options, ignoreCase, getCommonSourceDirectory2);
|
|
42977
42995
|
const pathOrPattern = getNormalizedAbsolutePath(
|
|
42978
42996
|
combinePaths(packageDirectory, exports2),
|
|
42979
42997
|
/*currentDirectory*/
|
|
@@ -42982,12 +43000,25 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
42982
43000
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
42983
43001
|
switch (mode) {
|
|
42984
43002
|
case 0 /* Exact */:
|
|
42985
|
-
if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ ||
|
|
43003
|
+
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 */) {
|
|
42986
43004
|
return { moduleFileToTry: packageName };
|
|
42987
43005
|
}
|
|
42988
43006
|
break;
|
|
42989
43007
|
case 1 /* Directory */:
|
|
42990
|
-
if (containsPath(pathOrPattern,
|
|
43008
|
+
if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
|
|
43009
|
+
const fragment = getRelativePathFromDirectory(
|
|
43010
|
+
pathOrPattern,
|
|
43011
|
+
extensionSwappedTarget,
|
|
43012
|
+
/*ignoreCase*/
|
|
43013
|
+
false
|
|
43014
|
+
);
|
|
43015
|
+
return { moduleFileToTry: getNormalizedAbsolutePath(
|
|
43016
|
+
combinePaths(combinePaths(packageName, exports2), fragment),
|
|
43017
|
+
/*currentDirectory*/
|
|
43018
|
+
void 0
|
|
43019
|
+
) };
|
|
43020
|
+
}
|
|
43021
|
+
if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
|
|
42991
43022
|
const fragment = getRelativePathFromDirectory(
|
|
42992
43023
|
pathOrPattern,
|
|
42993
43024
|
targetFilePath,
|
|
@@ -43000,48 +43031,136 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
43000
43031
|
void 0
|
|
43001
43032
|
) };
|
|
43002
43033
|
}
|
|
43034
|
+
if (outputFile && containsPath(pathOrPattern, outputFile, ignoreCase)) {
|
|
43035
|
+
const fragment = getRelativePathFromDirectory(
|
|
43036
|
+
pathOrPattern,
|
|
43037
|
+
outputFile,
|
|
43038
|
+
/*ignoreCase*/
|
|
43039
|
+
false
|
|
43040
|
+
);
|
|
43041
|
+
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
43042
|
+
}
|
|
43043
|
+
if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
|
|
43044
|
+
const fragment = getRelativePathFromDirectory(
|
|
43045
|
+
pathOrPattern,
|
|
43046
|
+
declarationFile,
|
|
43047
|
+
/*ignoreCase*/
|
|
43048
|
+
false
|
|
43049
|
+
);
|
|
43050
|
+
return { moduleFileToTry: combinePaths(packageName, fragment) };
|
|
43051
|
+
}
|
|
43003
43052
|
break;
|
|
43004
43053
|
case 2 /* Pattern */:
|
|
43005
43054
|
const starPos = pathOrPattern.indexOf("*");
|
|
43006
43055
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
43007
43056
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
43008
|
-
if (startsWith(
|
|
43057
|
+
if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
|
|
43058
|
+
const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
|
|
43059
|
+
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
43060
|
+
}
|
|
43061
|
+
if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
|
|
43009
43062
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
43010
43063
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
43011
43064
|
}
|
|
43012
|
-
if (
|
|
43013
|
-
const starReplacement =
|
|
43065
|
+
if (outputFile && startsWith(outputFile, leadingSlice, ignoreCase) && endsWith(outputFile, trailingSlice, ignoreCase)) {
|
|
43066
|
+
const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
|
|
43067
|
+
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
43068
|
+
}
|
|
43069
|
+
if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
|
|
43070
|
+
const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
|
|
43014
43071
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
43015
43072
|
}
|
|
43016
43073
|
break;
|
|
43017
43074
|
}
|
|
43018
43075
|
} else if (Array.isArray(exports2)) {
|
|
43019
|
-
return forEach(exports2, (e) =>
|
|
43076
|
+
return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
43020
43077
|
} else if (typeof exports2 === "object" && exports2 !== null) {
|
|
43021
|
-
|
|
43022
|
-
|
|
43023
|
-
const
|
|
43024
|
-
|
|
43025
|
-
|
|
43026
|
-
|
|
43027
|
-
);
|
|
43028
|
-
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
43029
|
-
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports2[k], conditions, mode2);
|
|
43030
|
-
});
|
|
43031
|
-
} else {
|
|
43032
|
-
for (const key of getOwnKeys(exports2)) {
|
|
43033
|
-
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
43034
|
-
const subTarget = exports2[key];
|
|
43035
|
-
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
43036
|
-
if (result) {
|
|
43037
|
-
return result;
|
|
43038
|
-
}
|
|
43078
|
+
for (const key of getOwnKeys(exports2)) {
|
|
43079
|
+
if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
|
|
43080
|
+
const subTarget = exports2[key];
|
|
43081
|
+
const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
|
|
43082
|
+
if (result) {
|
|
43083
|
+
return result;
|
|
43039
43084
|
}
|
|
43040
43085
|
}
|
|
43041
43086
|
}
|
|
43042
43087
|
}
|
|
43043
43088
|
return void 0;
|
|
43044
43089
|
}
|
|
43090
|
+
function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions) {
|
|
43091
|
+
if (typeof exports2 === "object" && exports2 !== null && !Array.isArray(exports2) && allKeysStartWithDot(exports2)) {
|
|
43092
|
+
return forEach(getOwnKeys(exports2), (k) => {
|
|
43093
|
+
const subPackageName = getNormalizedAbsolutePath(
|
|
43094
|
+
combinePaths(packageName, k),
|
|
43095
|
+
/*currentDirectory*/
|
|
43096
|
+
void 0
|
|
43097
|
+
);
|
|
43098
|
+
const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
43099
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
43100
|
+
options,
|
|
43101
|
+
host,
|
|
43102
|
+
targetFilePath,
|
|
43103
|
+
packageDirectory,
|
|
43104
|
+
subPackageName,
|
|
43105
|
+
exports2[k],
|
|
43106
|
+
conditions,
|
|
43107
|
+
mode,
|
|
43108
|
+
/*isImports*/
|
|
43109
|
+
false
|
|
43110
|
+
);
|
|
43111
|
+
});
|
|
43112
|
+
}
|
|
43113
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
43114
|
+
options,
|
|
43115
|
+
host,
|
|
43116
|
+
targetFilePath,
|
|
43117
|
+
packageDirectory,
|
|
43118
|
+
packageName,
|
|
43119
|
+
exports2,
|
|
43120
|
+
conditions,
|
|
43121
|
+
0 /* Exact */,
|
|
43122
|
+
/*isImports*/
|
|
43123
|
+
false
|
|
43124
|
+
);
|
|
43125
|
+
}
|
|
43126
|
+
function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
|
|
43127
|
+
var _a, _b, _c;
|
|
43128
|
+
if (!host.readFile || !getResolvePackageJsonImports(options)) {
|
|
43129
|
+
return void 0;
|
|
43130
|
+
}
|
|
43131
|
+
const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
43132
|
+
if (!ancestorDirectoryWithPackageJson) {
|
|
43133
|
+
return void 0;
|
|
43134
|
+
}
|
|
43135
|
+
const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
|
|
43136
|
+
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
43137
|
+
if (isMissingPackageJsonInfo(cachedPackageJson) || !host.fileExists(packageJsonPath)) {
|
|
43138
|
+
return void 0;
|
|
43139
|
+
}
|
|
43140
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
43141
|
+
const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
|
|
43142
|
+
if (!imports) {
|
|
43143
|
+
return void 0;
|
|
43144
|
+
}
|
|
43145
|
+
const conditions = getConditions(options, importMode);
|
|
43146
|
+
return (_c = forEach(getOwnKeys(imports), (k) => {
|
|
43147
|
+
if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
|
|
43148
|
+
return void 0;
|
|
43149
|
+
const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
43150
|
+
return tryGetModuleNameFromExportsOrImports(
|
|
43151
|
+
options,
|
|
43152
|
+
host,
|
|
43153
|
+
moduleFileName,
|
|
43154
|
+
ancestorDirectoryWithPackageJson,
|
|
43155
|
+
k,
|
|
43156
|
+
imports[k],
|
|
43157
|
+
conditions,
|
|
43158
|
+
mode,
|
|
43159
|
+
/*isImports*/
|
|
43160
|
+
true
|
|
43161
|
+
);
|
|
43162
|
+
})) == null ? void 0 : _c.moduleFileToTry;
|
|
43163
|
+
}
|
|
43045
43164
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
|
|
43046
43165
|
const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
43047
43166
|
if (normalizedTargetPaths === void 0) {
|
|
@@ -43115,22 +43234,21 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43115
43234
|
let maybeBlockedByTypesVersions = false;
|
|
43116
43235
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
43117
43236
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
43118
|
-
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) ||
|
|
43237
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
43119
43238
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
43120
43239
|
if (getResolvePackageJsonExports(options)) {
|
|
43121
43240
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
43122
43241
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
43123
43242
|
const conditions = getConditions(options, importMode);
|
|
43124
|
-
const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
43243
|
+
const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
|
|
43125
43244
|
if (fromExports) {
|
|
43126
|
-
|
|
43127
|
-
return { ...withJsExtension, verbatimFromExports: true };
|
|
43245
|
+
return { ...fromExports, verbatimFromExports: true };
|
|
43128
43246
|
}
|
|
43129
|
-
if (packageJsonContent.exports) {
|
|
43247
|
+
if (packageJsonContent == null ? void 0 : packageJsonContent.exports) {
|
|
43130
43248
|
return { moduleFileToTry: path, blockedByExports: true };
|
|
43131
43249
|
}
|
|
43132
43250
|
}
|
|
43133
|
-
const versionPaths = packageJsonContent.typesVersions ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
|
|
43251
|
+
const versionPaths = (packageJsonContent == null ? void 0 : packageJsonContent.typesVersions) ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
|
|
43134
43252
|
if (versionPaths) {
|
|
43135
43253
|
const subModuleName = path.slice(packageRootPath.length + 1);
|
|
43136
43254
|
const fromPaths = tryGetModuleNameFromPaths(
|
|
@@ -43146,13 +43264,13 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43146
43264
|
moduleFileToTry = combinePaths(packageRootPath, fromPaths);
|
|
43147
43265
|
}
|
|
43148
43266
|
}
|
|
43149
|
-
const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
43267
|
+
const mainFileRelative = (packageJsonContent == null ? void 0 : packageJsonContent.typings) || (packageJsonContent == null ? void 0 : packageJsonContent.types) || (packageJsonContent == null ? void 0 : packageJsonContent.main) || "index.js";
|
|
43150
43268
|
if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
|
|
43151
43269
|
const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
43152
43270
|
const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
|
|
43153
43271
|
if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
|
|
43154
43272
|
return { packageRootPath, moduleFileToTry };
|
|
43155
|
-
} else if (packageJsonContent.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
|
|
43273
|
+
} else if ((packageJsonContent == null ? void 0 : packageJsonContent.type) !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
|
|
43156
43274
|
return { packageRootPath, moduleFileToTry };
|
|
43157
43275
|
}
|
|
43158
43276
|
}
|
|
@@ -60488,12 +60606,12 @@ function createTypeChecker(host) {
|
|
|
60488
60606
|
return !!(entry & 1 /* Succeeded */);
|
|
60489
60607
|
}
|
|
60490
60608
|
const targetEnumType = getTypeOfSymbol(targetSymbol);
|
|
60491
|
-
for (const
|
|
60492
|
-
if (
|
|
60493
|
-
const targetProperty = getPropertyOfType(targetEnumType,
|
|
60609
|
+
for (const sourceProperty of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
|
|
60610
|
+
if (sourceProperty.flags & 8 /* EnumMember */) {
|
|
60611
|
+
const targetProperty = getPropertyOfType(targetEnumType, sourceProperty.escapedName);
|
|
60494
60612
|
if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {
|
|
60495
60613
|
if (errorReporter) {
|
|
60496
|
-
errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(
|
|
60614
|
+
errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(sourceProperty), typeToString(
|
|
60497
60615
|
getDeclaredTypeOfSymbol(targetSymbol),
|
|
60498
60616
|
/*enclosingDeclaration*/
|
|
60499
60617
|
void 0,
|
|
@@ -60505,6 +60623,35 @@ function createTypeChecker(host) {
|
|
|
60505
60623
|
}
|
|
60506
60624
|
return false;
|
|
60507
60625
|
}
|
|
60626
|
+
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */));
|
|
60627
|
+
const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */));
|
|
60628
|
+
if (sourceValue !== targetValue) {
|
|
60629
|
+
const sourceIsString = typeof sourceValue === "string";
|
|
60630
|
+
const targetIsString = typeof targetValue === "string";
|
|
60631
|
+
if (sourceValue !== void 0 && targetValue !== void 0) {
|
|
60632
|
+
if (!errorReporter) {
|
|
60633
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
60634
|
+
} else {
|
|
60635
|
+
const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue;
|
|
60636
|
+
const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue;
|
|
60637
|
+
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);
|
|
60638
|
+
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
60639
|
+
}
|
|
60640
|
+
return false;
|
|
60641
|
+
}
|
|
60642
|
+
if (sourceIsString || targetIsString) {
|
|
60643
|
+
if (!errorReporter) {
|
|
60644
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
60645
|
+
} else {
|
|
60646
|
+
const knownStringValue = sourceValue ?? targetValue;
|
|
60647
|
+
Debug.assert(typeof knownStringValue === "string");
|
|
60648
|
+
const escapedValue = `"${escapeString(knownStringValue)}"`;
|
|
60649
|
+
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);
|
|
60650
|
+
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
60651
|
+
}
|
|
60652
|
+
return false;
|
|
60653
|
+
}
|
|
60654
|
+
}
|
|
60508
60655
|
}
|
|
60509
60656
|
}
|
|
60510
60657
|
enumRelation.set(id, 1 /* Succeeded */);
|
|
@@ -110415,28 +110562,34 @@ function getSourceMapFilePath(jsFilePath, options) {
|
|
|
110415
110562
|
function getOutputExtension(fileName, options) {
|
|
110416
110563
|
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 */;
|
|
110417
110564
|
}
|
|
110418
|
-
function getOutputPathWithoutChangingExt(inputFileName,
|
|
110565
|
+
function getOutputPathWithoutChangingExt(inputFileName, ignoreCase, outputDir, getCommonSourceDirectory2) {
|
|
110419
110566
|
return outputDir ? resolvePath(
|
|
110420
110567
|
outputDir,
|
|
110421
|
-
getRelativePathFromDirectory(getCommonSourceDirectory2
|
|
110568
|
+
getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)
|
|
110422
110569
|
) : inputFileName;
|
|
110423
110570
|
}
|
|
110424
|
-
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
|
|
110571
|
+
function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2 = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) {
|
|
110572
|
+
return getOutputDeclarationFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory2);
|
|
110573
|
+
}
|
|
110574
|
+
function getOutputDeclarationFileNameWorker(inputFileName, options, ignoreCase, getCommonSourceDirectory2) {
|
|
110425
110575
|
return changeExtension(
|
|
110426
|
-
getOutputPathWithoutChangingExt(inputFileName,
|
|
110576
|
+
getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.declarationDir || options.outDir, getCommonSourceDirectory2),
|
|
110427
110577
|
getDeclarationEmitExtensionForPath(inputFileName)
|
|
110428
110578
|
);
|
|
110429
110579
|
}
|
|
110430
|
-
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
|
|
110580
|
+
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2 = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) {
|
|
110431
110581
|
if (configFile.options.emitDeclarationOnly)
|
|
110432
110582
|
return void 0;
|
|
110433
110583
|
const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
|
|
110434
|
-
const outputFileName =
|
|
110435
|
-
getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory2),
|
|
110436
|
-
getOutputExtension(inputFileName, configFile.options)
|
|
110437
|
-
);
|
|
110584
|
+
const outputFileName = getOutputJSFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory2);
|
|
110438
110585
|
return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
|
|
110439
110586
|
}
|
|
110587
|
+
function getOutputJSFileNameWorker(inputFileName, options, ignoreCase, getCommonSourceDirectory2) {
|
|
110588
|
+
return changeExtension(
|
|
110589
|
+
getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.outDir, getCommonSourceDirectory2),
|
|
110590
|
+
getOutputExtension(inputFileName, options)
|
|
110591
|
+
);
|
|
110592
|
+
}
|
|
110440
110593
|
function createAddOutput() {
|
|
110441
110594
|
let outputs;
|
|
110442
110595
|
return { addOutput, getOutputs };
|