typescript 5.4.0-dev.20231221 → 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 +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/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.
|
|
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;
|
|
@@ -17100,6 +17100,13 @@ ${lanes.join("\n")}
|
|
|
17100
17100
|
function readJson(path, host) {
|
|
17101
17101
|
return readJsonOrUndefined(path, host) || {};
|
|
17102
17102
|
}
|
|
17103
|
+
function tryParseJson(text) {
|
|
17104
|
+
try {
|
|
17105
|
+
return JSON.parse(text);
|
|
17106
|
+
} catch {
|
|
17107
|
+
return void 0;
|
|
17108
|
+
}
|
|
17109
|
+
}
|
|
17103
17110
|
function directoryProbablyExists(directoryName, host) {
|
|
17104
17111
|
return !host.directoryExists || host.directoryExists(directoryName);
|
|
17105
17112
|
}
|
|
@@ -39972,6 +39979,9 @@ ${lanes.join("\n")}
|
|
|
39972
39979
|
function isPackageJsonInfo(entry) {
|
|
39973
39980
|
return !!(entry == null ? void 0 : entry.contents);
|
|
39974
39981
|
}
|
|
39982
|
+
function isMissingPackageJsonInfo(entry) {
|
|
39983
|
+
return !!entry && !entry.contents;
|
|
39984
|
+
}
|
|
39975
39985
|
function compilerOptionValueToString(value) {
|
|
39976
39986
|
var _a;
|
|
39977
39987
|
if (value === null || typeof value !== "object") {
|
|
@@ -45322,7 +45332,7 @@ ${lanes.join("\n")}
|
|
|
45322
45332
|
const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
|
|
45323
45333
|
const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
|
|
45324
45334
|
const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
|
|
45325
|
-
if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
|
|
45335
|
+
if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
|
|
45326
45336
|
return pathsOnly ? void 0 : relativePath;
|
|
45327
45337
|
}
|
|
45328
45338
|
const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
|
|
@@ -45330,11 +45340,12 @@ ${lanes.join("\n")}
|
|
|
45330
45340
|
if (!relativeToBaseUrl) {
|
|
45331
45341
|
return pathsOnly ? void 0 : relativePath;
|
|
45332
45342
|
}
|
|
45333
|
-
const
|
|
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;
|
|
45334
45345
|
if (pathsOnly) {
|
|
45335
45346
|
return fromPaths;
|
|
45336
45347
|
}
|
|
45337
|
-
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);
|
|
45338
45349
|
if (!maybeNonRelative) {
|
|
45339
45350
|
return relativePath;
|
|
45340
45351
|
}
|
|
@@ -45373,8 +45384,8 @@ ${lanes.join("\n")}
|
|
|
45373
45384
|
if (host.getNearestAncestorDirectoryWithPackageJson) {
|
|
45374
45385
|
return host.getNearestAncestorDirectoryWithPackageJson(fileName);
|
|
45375
45386
|
}
|
|
45376
|
-
return
|
|
45377
|
-
return host.fileExists(combinePaths(directory, "package.json")) ?
|
|
45387
|
+
return forEachAncestorDirectory(fileName, (directory) => {
|
|
45388
|
+
return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
|
|
45378
45389
|
});
|
|
45379
45390
|
}
|
|
45380
45391
|
function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
|
|
@@ -45548,8 +45559,12 @@ ${lanes.join("\n")}
|
|
|
45548
45559
|
return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
|
|
45549
45560
|
}
|
|
45550
45561
|
}
|
|
45551
|
-
function
|
|
45562
|
+
function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports, conditions, mode, isImports) {
|
|
45552
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);
|
|
45553
45568
|
const pathOrPattern = getNormalizedAbsolutePath(
|
|
45554
45569
|
combinePaths(packageDirectory, exports),
|
|
45555
45570
|
/*currentDirectory*/
|
|
@@ -45558,12 +45573,25 @@ ${lanes.join("\n")}
|
|
|
45558
45573
|
const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
|
|
45559
45574
|
switch (mode) {
|
|
45560
45575
|
case 0 /* Exact */:
|
|
45561
|
-
if (comparePaths(targetFilePath, 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 */) {
|
|
45562
45577
|
return { moduleFileToTry: packageName };
|
|
45563
45578
|
}
|
|
45564
45579
|
break;
|
|
45565
45580
|
case 1 /* Directory */:
|
|
45566
|
-
if (containsPath(pathOrPattern,
|
|
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)) {
|
|
45567
45595
|
const fragment = getRelativePathFromDirectory(
|
|
45568
45596
|
pathOrPattern,
|
|
45569
45597
|
targetFilePath,
|
|
@@ -45576,48 +45604,136 @@ ${lanes.join("\n")}
|
|
|
45576
45604
|
void 0
|
|
45577
45605
|
) };
|
|
45578
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
|
+
}
|
|
45579
45625
|
break;
|
|
45580
45626
|
case 2 /* Pattern */:
|
|
45581
45627
|
const starPos = pathOrPattern.indexOf("*");
|
|
45582
45628
|
const leadingSlice = pathOrPattern.slice(0, starPos);
|
|
45583
45629
|
const trailingSlice = pathOrPattern.slice(starPos + 1);
|
|
45584
|
-
if (startsWith(
|
|
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)) {
|
|
45585
45635
|
const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
|
|
45586
45636
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
45587
45637
|
}
|
|
45588
|
-
if (
|
|
45589
|
-
const starReplacement =
|
|
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);
|
|
45590
45644
|
return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
|
|
45591
45645
|
}
|
|
45592
45646
|
break;
|
|
45593
45647
|
}
|
|
45594
45648
|
} else if (Array.isArray(exports)) {
|
|
45595
|
-
return forEach(exports, (e) =>
|
|
45649
|
+
return forEach(exports, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
|
|
45596
45650
|
} else if (typeof exports === "object" && exports !== null) {
|
|
45597
|
-
|
|
45598
|
-
|
|
45599
|
-
const
|
|
45600
|
-
|
|
45601
|
-
|
|
45602
|
-
|
|
45603
|
-
);
|
|
45604
|
-
const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
|
|
45605
|
-
return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode2);
|
|
45606
|
-
});
|
|
45607
|
-
} else {
|
|
45608
|
-
for (const key of getOwnKeys(exports)) {
|
|
45609
|
-
if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
|
|
45610
|
-
const subTarget = exports[key];
|
|
45611
|
-
const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
|
|
45612
|
-
if (result) {
|
|
45613
|
-
return result;
|
|
45614
|
-
}
|
|
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;
|
|
45615
45657
|
}
|
|
45616
45658
|
}
|
|
45617
45659
|
}
|
|
45618
45660
|
}
|
|
45619
45661
|
return void 0;
|
|
45620
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
|
+
}
|
|
45621
45737
|
function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
|
|
45622
45738
|
const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
|
|
45623
45739
|
if (normalizedTargetPaths === void 0) {
|
|
@@ -45691,22 +45807,21 @@ ${lanes.join("\n")}
|
|
|
45691
45807
|
let maybeBlockedByTypesVersions = false;
|
|
45692
45808
|
const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
45693
45809
|
if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
|
|
45694
|
-
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) ||
|
|
45810
|
+
const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
|
|
45695
45811
|
const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
45696
45812
|
if (getResolvePackageJsonExports(options)) {
|
|
45697
45813
|
const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
|
|
45698
45814
|
const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
|
|
45699
45815
|
const conditions = getConditions(options, importMode);
|
|
45700
|
-
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;
|
|
45701
45817
|
if (fromExports) {
|
|
45702
|
-
|
|
45703
|
-
return { ...withJsExtension, verbatimFromExports: true };
|
|
45818
|
+
return { ...fromExports, verbatimFromExports: true };
|
|
45704
45819
|
}
|
|
45705
|
-
if (packageJsonContent.exports) {
|
|
45820
|
+
if (packageJsonContent == null ? void 0 : packageJsonContent.exports) {
|
|
45706
45821
|
return { moduleFileToTry: path, blockedByExports: true };
|
|
45707
45822
|
}
|
|
45708
45823
|
}
|
|
45709
|
-
const versionPaths = packageJsonContent.typesVersions ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
|
|
45824
|
+
const versionPaths = (packageJsonContent == null ? void 0 : packageJsonContent.typesVersions) ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
|
|
45710
45825
|
if (versionPaths) {
|
|
45711
45826
|
const subModuleName = path.slice(packageRootPath.length + 1);
|
|
45712
45827
|
const fromPaths = tryGetModuleNameFromPaths(
|
|
@@ -45722,13 +45837,13 @@ ${lanes.join("\n")}
|
|
|
45722
45837
|
moduleFileToTry = combinePaths(packageRootPath, fromPaths);
|
|
45723
45838
|
}
|
|
45724
45839
|
}
|
|
45725
|
-
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";
|
|
45726
45841
|
if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
|
|
45727
45842
|
const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
45728
45843
|
const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
|
|
45729
45844
|
if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
|
|
45730
45845
|
return { packageRootPath, moduleFileToTry };
|
|
45731
|
-
} 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") {
|
|
45732
45847
|
return { packageRootPath, moduleFileToTry };
|
|
45733
45848
|
}
|
|
45734
45849
|
}
|
|
@@ -113418,28 +113533,34 @@ ${lanes.join("\n")}
|
|
|
113418
113533
|
function getOutputExtension(fileName, options) {
|
|
113419
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 */;
|
|
113420
113535
|
}
|
|
113421
|
-
function getOutputPathWithoutChangingExt(inputFileName,
|
|
113536
|
+
function getOutputPathWithoutChangingExt(inputFileName, ignoreCase, outputDir, getCommonSourceDirectory2) {
|
|
113422
113537
|
return outputDir ? resolvePath(
|
|
113423
113538
|
outputDir,
|
|
113424
|
-
getRelativePathFromDirectory(getCommonSourceDirectory2
|
|
113539
|
+
getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)
|
|
113425
113540
|
) : inputFileName;
|
|
113426
113541
|
}
|
|
113427
|
-
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) {
|
|
113428
113546
|
return changeExtension(
|
|
113429
|
-
getOutputPathWithoutChangingExt(inputFileName,
|
|
113547
|
+
getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.declarationDir || options.outDir, getCommonSourceDirectory2),
|
|
113430
113548
|
getDeclarationEmitExtensionForPath(inputFileName)
|
|
113431
113549
|
);
|
|
113432
113550
|
}
|
|
113433
|
-
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
|
|
113551
|
+
function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2 = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) {
|
|
113434
113552
|
if (configFile.options.emitDeclarationOnly)
|
|
113435
113553
|
return void 0;
|
|
113436
113554
|
const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
|
|
113437
|
-
const outputFileName =
|
|
113438
|
-
getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory2),
|
|
113439
|
-
getOutputExtension(inputFileName, configFile.options)
|
|
113440
|
-
);
|
|
113555
|
+
const outputFileName = getOutputJSFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory2);
|
|
113441
113556
|
return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
|
|
113442
113557
|
}
|
|
113558
|
+
function getOutputJSFileNameWorker(inputFileName, options, ignoreCase, getCommonSourceDirectory2) {
|
|
113559
|
+
return changeExtension(
|
|
113560
|
+
getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.outDir, getCommonSourceDirectory2),
|
|
113561
|
+
getOutputExtension(inputFileName, options)
|
|
113562
|
+
);
|
|
113563
|
+
}
|
|
113443
113564
|
function createAddOutput() {
|
|
113444
113565
|
let outputs;
|
|
113445
113566
|
return { addOutput, getOutputs };
|
|
@@ -131963,7 +132084,8 @@ ${lanes.join("\n")}
|
|
|
131963
132084
|
getProjectReferenceRedirect: (fileName) => program.getProjectReferenceRedirect(fileName),
|
|
131964
132085
|
isSourceOfProjectReferenceRedirect: (fileName) => program.isSourceOfProjectReferenceRedirect(fileName),
|
|
131965
132086
|
getNearestAncestorDirectoryWithPackageJson: maybeBind(host, host.getNearestAncestorDirectoryWithPackageJson),
|
|
131966
|
-
getFileIncludeReasons: () => program.getFileIncludeReasons()
|
|
132087
|
+
getFileIncludeReasons: () => program.getFileIncludeReasons(),
|
|
132088
|
+
getCommonSourceDirectory: () => program.getCommonSourceDirectory()
|
|
131967
132089
|
};
|
|
131968
132090
|
}
|
|
131969
132091
|
function getModuleSpecifierResolverHost(program, host) {
|
|
@@ -133010,13 +133132,6 @@ ${lanes.join("\n")}
|
|
|
133010
133132
|
return components[0];
|
|
133011
133133
|
}
|
|
133012
133134
|
}
|
|
133013
|
-
function tryParseJson(text) {
|
|
133014
|
-
try {
|
|
133015
|
-
return JSON.parse(text);
|
|
133016
|
-
} catch {
|
|
133017
|
-
return void 0;
|
|
133018
|
-
}
|
|
133019
|
-
}
|
|
133020
133135
|
function consumesNodeCoreModules(sourceFile) {
|
|
133021
133136
|
return some(sourceFile.imports, ({ text }) => ts_JsTyping_exports.nodeCoreModules.has(text));
|
|
133022
133137
|
}
|
|
@@ -186044,8 +186159,10 @@ ${e.message}`;
|
|
|
186044
186159
|
getOriginalNodeId: () => getOriginalNodeId,
|
|
186045
186160
|
getOriginalSourceFile: () => getOriginalSourceFile,
|
|
186046
186161
|
getOutputDeclarationFileName: () => getOutputDeclarationFileName,
|
|
186162
|
+
getOutputDeclarationFileNameWorker: () => getOutputDeclarationFileNameWorker,
|
|
186047
186163
|
getOutputExtension: () => getOutputExtension,
|
|
186048
186164
|
getOutputFileNames: () => getOutputFileNames,
|
|
186165
|
+
getOutputJSFileNameWorker: () => getOutputJSFileNameWorker,
|
|
186049
186166
|
getOutputPathsFor: () => getOutputPathsFor,
|
|
186050
186167
|
getOutputPathsForBundle: () => getOutputPathsForBundle,
|
|
186051
186168
|
getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
|
|
@@ -186676,6 +186793,7 @@ ${e.message}`;
|
|
|
186676
186793
|
isMethodSignature: () => isMethodSignature,
|
|
186677
186794
|
isMinusToken: () => isMinusToken,
|
|
186678
186795
|
isMissingDeclaration: () => isMissingDeclaration,
|
|
186796
|
+
isMissingPackageJsonInfo: () => isMissingPackageJsonInfo,
|
|
186679
186797
|
isModifier: () => isModifier,
|
|
186680
186798
|
isModifierKind: () => isModifierKind,
|
|
186681
186799
|
isModifierLike: () => isModifierLike,
|
|
@@ -187377,6 +187495,7 @@ ${e.message}`;
|
|
|
187377
187495
|
tryGetSourceMappingURL: () => tryGetSourceMappingURL,
|
|
187378
187496
|
tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
|
|
187379
187497
|
tryIOAndConsumeErrors: () => tryIOAndConsumeErrors,
|
|
187498
|
+
tryParseJson: () => tryParseJson,
|
|
187380
187499
|
tryParsePattern: () => tryParsePattern,
|
|
187381
187500
|
tryParsePatterns: () => tryParsePatterns,
|
|
187382
187501
|
tryParseRawSourceMap: () => tryParseRawSourceMap,
|
|
@@ -188460,8 +188579,10 @@ ${e.message}`;
|
|
|
188460
188579
|
getOriginalNodeId: () => getOriginalNodeId,
|
|
188461
188580
|
getOriginalSourceFile: () => getOriginalSourceFile,
|
|
188462
188581
|
getOutputDeclarationFileName: () => getOutputDeclarationFileName,
|
|
188582
|
+
getOutputDeclarationFileNameWorker: () => getOutputDeclarationFileNameWorker,
|
|
188463
188583
|
getOutputExtension: () => getOutputExtension,
|
|
188464
188584
|
getOutputFileNames: () => getOutputFileNames,
|
|
188585
|
+
getOutputJSFileNameWorker: () => getOutputJSFileNameWorker,
|
|
188465
188586
|
getOutputPathsFor: () => getOutputPathsFor,
|
|
188466
188587
|
getOutputPathsForBundle: () => getOutputPathsForBundle,
|
|
188467
188588
|
getOwnEmitOutputFilePath: () => getOwnEmitOutputFilePath,
|
|
@@ -189092,6 +189213,7 @@ ${e.message}`;
|
|
|
189092
189213
|
isMethodSignature: () => isMethodSignature,
|
|
189093
189214
|
isMinusToken: () => isMinusToken,
|
|
189094
189215
|
isMissingDeclaration: () => isMissingDeclaration,
|
|
189216
|
+
isMissingPackageJsonInfo: () => isMissingPackageJsonInfo,
|
|
189095
189217
|
isModifier: () => isModifier,
|
|
189096
189218
|
isModifierKind: () => isModifierKind,
|
|
189097
189219
|
isModifierLike: () => isModifierLike,
|
|
@@ -189793,6 +189915,7 @@ ${e.message}`;
|
|
|
189793
189915
|
tryGetSourceMappingURL: () => tryGetSourceMappingURL,
|
|
189794
189916
|
tryGetTextOfPropertyName: () => tryGetTextOfPropertyName,
|
|
189795
189917
|
tryIOAndConsumeErrors: () => tryIOAndConsumeErrors,
|
|
189918
|
+
tryParseJson: () => tryParseJson,
|
|
189796
189919
|
tryParsePattern: () => tryParsePattern,
|
|
189797
189920
|
tryParsePatterns: () => tryParsePatterns,
|
|
189798
189921
|
tryParseRawSourceMap: () => tryParseRawSourceMap,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -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.
|
|
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);
|
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.
|
|
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": "
|
|
116
|
+
"gitHead": "fbcdb8cf4fbbbea0111a9adeb9d0d2983c088b7c"
|
|
117
117
|
}
|