typescript 5.4.0-dev.20231221 → 5.4.0-dev.20231223
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 +173 -52
- package/lib/tsserver.js +187 -60
- package/lib/typescript.js +183 -60
- package/lib/typingsInstaller.js +5 -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.20231223`;
|
|
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;
|
|
@@ -15731,6 +15731,13 @@ function readJsonOrUndefined(path, hostOrText) {
|
|
|
15731
15731
|
function readJson(path, host) {
|
|
15732
15732
|
return readJsonOrUndefined(path, host) || {};
|
|
15733
15733
|
}
|
|
15734
|
+
function tryParseJson(text) {
|
|
15735
|
+
try {
|
|
15736
|
+
return JSON.parse(text);
|
|
15737
|
+
} catch {
|
|
15738
|
+
return void 0;
|
|
15739
|
+
}
|
|
15740
|
+
}
|
|
15734
15741
|
function directoryProbablyExists(directoryName, host) {
|
|
15735
15742
|
return !host.directoryExists || host.directoryExists(directoryName);
|
|
15736
15743
|
}
|
|
@@ -37606,6 +37613,9 @@ function getAutomaticTypeDirectiveNames(options, host) {
|
|
|
37606
37613
|
function isPackageJsonInfo(entry) {
|
|
37607
37614
|
return !!(entry == null ? void 0 : entry.contents);
|
|
37608
37615
|
}
|
|
37616
|
+
function isMissingPackageJsonInfo(entry) {
|
|
37617
|
+
return !!entry && !entry.contents;
|
|
37618
|
+
}
|
|
37609
37619
|
function compilerOptionValueToString(value) {
|
|
37610
37620
|
var _a;
|
|
37611
37621
|
if (value === null || typeof value !== "object") {
|
|
@@ -42749,7 +42759,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42749
42759
|
const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
|
|
42750
42760
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
42751
42761
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
42752
|
-
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
42762
|
+
if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
|
|
42753
42763
|
return pathsOnly ? void 0 : relativePath;
|
|
42754
42764
|
}
|
|
42755
42765
|
const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
|
|
@@ -42757,11 +42767,12 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42757
42767
|
if (!relativeToBaseUrl) {
|
|
42758
42768
|
return pathsOnly ? void 0 : relativePath;
|
|
42759
42769
|
}
|
|
42760
|
-
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;
|
|
42761
42772
|
if (pathsOnly) {
|
|
42762
42773
|
return fromPaths;
|
|
42763
42774
|
}
|
|
42764
|
-
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);
|
|
42765
42776
|
if (!maybeNonRelative) {
|
|
42766
42777
|
return relativePath;
|
|
42767
42778
|
}
|
|
@@ -42800,8 +42811,8 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
|
|
|
42800
42811
|
if (host.getNearestAncestorDirectoryWithPackageJson) {
|
|
42801
42812
|
return host.getNearestAncestorDirectoryWithPackageJson(fileName);
|
|
42802
42813
|
}
|
|
42803
|
-
return
|
|
42804
|
-
return host.fileExists(combinePaths(directory, "package.json")) ?
|
|
42814
|
+
return forEachAncestorDirectory(fileName, (directory) => {
|
|
42815
|
+
return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
|
|
42805
42816
|
});
|
|
42806
42817
|
}
|
|
42807
42818
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
@@ -42975,8 +42986,12 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
|
|
|
42975
42986
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
42976
42987
|
}
|
|
42977
42988
|
}
|
|
42978
|
-
function
|
|
42989
|
+
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
|
|
42979
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);
|
|
42980
42995
|
const pathOrPattern = getNormalizedAbsolutePath(
|
|
42981
42996
|
combinePaths(packageDirectory, exports2),
|
|
42982
42997
|
/*currentDirectory*/
|
|
@@ -42985,12 +43000,25 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
42985
43000
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
42986
43001
|
switch (mode) {
|
|
42987
43002
|
case 0 /* Exact */:
|
|
42988
|
-
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 */) {
|
|
42989
43004
|
return { moduleFileToTry: packageName };
|
|
42990
43005
|
}
|
|
42991
43006
|
break;
|
|
42992
43007
|
case 1 /* Directory */:
|
|
42993
|
-
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)) {
|
|
42994
43022
|
const fragment = getRelativePathFromDirectory(
|
|
42995
43023
|
pathOrPattern,
|
|
42996
43024
|
targetFilePath,
|
|
@@ -43003,48 +43031,136 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
|
|
|
43003
43031
|
void 0
|
|
43004
43032
|
) };
|
|
43005
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
|
+
}
|
|
43006
43052
|
break;
|
|
43007
43053
|
case 2 /* Pattern */:
|
|
43008
43054
|
const starPos = pathOrPattern.indexOf("*");
|
|
43009
43055
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
43010
43056
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
43011
|
-
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)) {
|
|
43012
43062
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
43013
43063
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
43014
43064
|
}
|
|
43015
|
-
if (
|
|
43016
|
-
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);
|
|
43017
43071
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
43018
43072
|
}
|
|
43019
43073
|
break;
|
|
43020
43074
|
}
|
|
43021
43075
|
} else if (Array.isArray(exports2)) {
|
|
43022
|
-
return forEach(exports2, (e) =>
|
|
43076
|
+
return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
43023
43077
|
} else if (typeof exports2 === "object" && exports2 !== null) {
|
|
43024
|
-
|
|
43025
|
-
|
|
43026
|
-
const
|
|
43027
|
-
|
|
43028
|
-
|
|
43029
|
-
|
|
43030
|
-
);
|
|
43031
|
-
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
43032
|
-
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports2[k], conditions, mode2);
|
|
43033
|
-
});
|
|
43034
|
-
} else {
|
|
43035
|
-
for (const key of getOwnKeys(exports2)) {
|
|
43036
|
-
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
43037
|
-
const subTarget = exports2[key];
|
|
43038
|
-
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
43039
|
-
if (result) {
|
|
43040
|
-
return result;
|
|
43041
|
-
}
|
|
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;
|
|
43042
43084
|
}
|
|
43043
43085
|
}
|
|
43044
43086
|
}
|
|
43045
43087
|
}
|
|
43046
43088
|
return void 0;
|
|
43047
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
|
+
}
|
|
43048
43164
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
|
|
43049
43165
|
const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
43050
43166
|
if (normalizedTargetPaths === void 0) {
|
|
@@ -43118,22 +43234,21 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43118
43234
|
let maybeBlockedByTypesVersions = false;
|
|
43119
43235
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
43120
43236
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
43121
|
-
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) ||
|
|
43237
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
43122
43238
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
43123
43239
|
if (getResolvePackageJsonExports(options)) {
|
|
43124
43240
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
43125
43241
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
43126
43242
|
const conditions = getConditions(options, importMode);
|
|
43127
|
-
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;
|
|
43128
43244
|
if (fromExports) {
|
|
43129
|
-
|
|
43130
|
-
return { ...withJsExtension, verbatimFromExports: true };
|
|
43245
|
+
return { ...fromExports, verbatimFromExports: true };
|
|
43131
43246
|
}
|
|
43132
|
-
if (packageJsonContent.exports) {
|
|
43247
|
+
if (packageJsonContent == null ? void 0 : packageJsonContent.exports) {
|
|
43133
43248
|
return { moduleFileToTry: path, blockedByExports: true };
|
|
43134
43249
|
}
|
|
43135
43250
|
}
|
|
43136
|
-
const versionPaths = packageJsonContent.typesVersions ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
|
|
43251
|
+
const versionPaths = (packageJsonContent == null ? void 0 : packageJsonContent.typesVersions) ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
|
|
43137
43252
|
if (versionPaths) {
|
|
43138
43253
|
const subModuleName = path.slice(packageRootPath.length + 1);
|
|
43139
43254
|
const fromPaths = tryGetModuleNameFromPaths(
|
|
@@ -43149,13 +43264,13 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
43149
43264
|
moduleFileToTry = combinePaths(packageRootPath, fromPaths);
|
|
43150
43265
|
}
|
|
43151
43266
|
}
|
|
43152
|
-
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";
|
|
43153
43268
|
if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
|
|
43154
43269
|
const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
43155
43270
|
const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
|
|
43156
43271
|
if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
|
|
43157
43272
|
return { packageRootPath, moduleFileToTry };
|
|
43158
|
-
} 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") {
|
|
43159
43274
|
return { packageRootPath, moduleFileToTry };
|
|
43160
43275
|
}
|
|
43161
43276
|
}
|
|
@@ -110447,28 +110562,34 @@ function getSourceMapFilePath(jsFilePath, options) {
|
|
|
110447
110562
|
function getOutputExtension(fileName, options) {
|
|
110448
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 */;
|
|
110449
110564
|
}
|
|
110450
|
-
function getOutputPathWithoutChangingExt(inputFileName,
|
|
110565
|
+
function getOutputPathWithoutChangingExt(inputFileName, ignoreCase, outputDir, getCommonSourceDirectory2) {
|
|
110451
110566
|
return outputDir ? resolvePath(
|
|
110452
110567
|
outputDir,
|
|
110453
|
-
getRelativePathFromDirectory(getCommonSourceDirectory2
|
|
110568
|
+
getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)
|
|
110454
110569
|
) : inputFileName;
|
|
110455
110570
|
}
|
|
110456
|
-
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) {
|
|
110457
110575
|
return changeExtension(
|
|
110458
|
-
getOutputPathWithoutChangingExt(inputFileName,
|
|
110576
|
+
getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.declarationDir || options.outDir, getCommonSourceDirectory2),
|
|
110459
110577
|
getDeclarationEmitExtensionForPath(inputFileName)
|
|
110460
110578
|
);
|
|
110461
110579
|
}
|
|
110462
|
-
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
|
|
110580
|
+
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2 = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) {
|
|
110463
110581
|
if (configFile.options.emitDeclarationOnly)
|
|
110464
110582
|
return void 0;
|
|
110465
110583
|
const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
|
|
110466
|
-
const outputFileName =
|
|
110467
|
-
getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory2),
|
|
110468
|
-
getOutputExtension(inputFileName, configFile.options)
|
|
110469
|
-
);
|
|
110584
|
+
const outputFileName = getOutputJSFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory2);
|
|
110470
110585
|
return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
|
|
110471
110586
|
}
|
|
110587
|
+
function getOutputJSFileNameWorker(inputFileName, options, ignoreCase, getCommonSourceDirectory2) {
|
|
110588
|
+
return changeExtension(
|
|
110589
|
+
getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.outDir, getCommonSourceDirectory2),
|
|
110590
|
+
getOutputExtension(inputFileName, options)
|
|
110591
|
+
);
|
|
110592
|
+
}
|
|
110472
110593
|
function createAddOutput() {
|
|
110473
110594
|
let outputs;
|
|
110474
110595
|
return { addOutput, getOutputs };
|