typescript 5.1.0-dev.20230413 → 5.1.0-dev.20230414
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 +104 -105
- package/lib/tsserver.js +126 -122
- package/lib/tsserverlibrary.d.ts +2 -0
- package/lib/tsserverlibrary.js +125 -122
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +115 -111
- package/lib/typingsInstaller.js +6 -6
- package/package.json +2 -2
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230414`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6737,11 +6737,11 @@ ${lanes.join("\n")}
|
|
|
6737
6737
|
path = combinePaths(currentDirectory, path);
|
|
6738
6738
|
return pathComponents(path, getRootLength(path));
|
|
6739
6739
|
}
|
|
6740
|
-
function getPathFromPathComponents(pathComponents2) {
|
|
6740
|
+
function getPathFromPathComponents(pathComponents2, length2) {
|
|
6741
6741
|
if (pathComponents2.length === 0)
|
|
6742
6742
|
return "";
|
|
6743
6743
|
const root = pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0]);
|
|
6744
|
-
return root + pathComponents2.slice(1).join(directorySeparator);
|
|
6744
|
+
return root + pathComponents2.slice(1, length2).join(directorySeparator);
|
|
6745
6745
|
}
|
|
6746
6746
|
function normalizeSlashes(path) {
|
|
6747
6747
|
return path.indexOf("\\") !== -1 ? path.replace(backslashRegExp, directorySeparator) : path;
|
|
@@ -20595,7 +20595,7 @@ ${lanes.join("\n")}
|
|
|
20595
20595
|
function createBigIntLiteral(value) {
|
|
20596
20596
|
const node = createBaseToken(10 /* BigIntLiteral */);
|
|
20597
20597
|
node.text = typeof value === "string" ? value : pseudoBigIntToString(value) + "n";
|
|
20598
|
-
node.transformFlags |=
|
|
20598
|
+
node.transformFlags |= 32 /* ContainsES2020 */;
|
|
20599
20599
|
return node;
|
|
20600
20600
|
}
|
|
20601
20601
|
function createBaseStringLiteral(text, isSingleQuote) {
|
|
@@ -22105,7 +22105,7 @@ ${lanes.join("\n")}
|
|
|
22105
22105
|
node.transformFlags |= 1024 /* ContainsES2015 */;
|
|
22106
22106
|
break;
|
|
22107
22107
|
case 102 /* ImportKeyword */:
|
|
22108
|
-
node.transformFlags |=
|
|
22108
|
+
node.transformFlags |= 32 /* ContainsES2020 */;
|
|
22109
22109
|
break;
|
|
22110
22110
|
default:
|
|
22111
22111
|
return Debug.assertNever(keywordToken);
|
|
@@ -22633,7 +22633,7 @@ ${lanes.join("\n")}
|
|
|
22633
22633
|
function createNamespaceExport(name) {
|
|
22634
22634
|
const node = createBaseDeclaration(279 /* NamespaceExport */);
|
|
22635
22635
|
node.name = name;
|
|
22636
|
-
node.transformFlags |= propagateChildFlags(node.name) |
|
|
22636
|
+
node.transformFlags |= propagateChildFlags(node.name) | 32 /* ContainsES2020 */;
|
|
22637
22637
|
node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
|
|
22638
22638
|
return node;
|
|
22639
22639
|
}
|
|
@@ -121181,60 +121181,62 @@ ${lanes.join("\n")}
|
|
|
121181
121181
|
}
|
|
121182
121182
|
return some(ignoredPaths, (searchPath) => stringContains(path, searchPath)) ? void 0 : path;
|
|
121183
121183
|
}
|
|
121184
|
-
function
|
|
121185
|
-
|
|
121186
|
-
|
|
121187
|
-
|
|
121188
|
-
|
|
121189
|
-
|
|
121190
|
-
|
|
121191
|
-
|
|
121192
|
-
|
|
121193
|
-
|
|
121194
|
-
|
|
121195
|
-
if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
|
|
121196
|
-
pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) {
|
|
121197
|
-
nextDirectorySeparator = dirPath.indexOf(directorySeparator, nextDirectorySeparator + 1);
|
|
121198
|
-
if (nextDirectorySeparator === -1) {
|
|
121199
|
-
return false;
|
|
121200
|
-
}
|
|
121201
|
-
pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1);
|
|
121202
|
-
}
|
|
121203
|
-
if (isNonDirectorySeparatorRoot && pathPartForUserCheck.search(/users\//i) !== 0) {
|
|
121204
|
-
return true;
|
|
121184
|
+
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
121185
|
+
if (length2 <= 1)
|
|
121186
|
+
return 1;
|
|
121187
|
+
let userCheckIndex = 1;
|
|
121188
|
+
let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
|
|
121189
|
+
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
121190
|
+
pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
|
|
121191
|
+
if (length2 === 2)
|
|
121192
|
+
return 2;
|
|
121193
|
+
userCheckIndex = 2;
|
|
121194
|
+
isDosStyle = true;
|
|
121205
121195
|
}
|
|
121206
|
-
|
|
121207
|
-
|
|
121208
|
-
if (searchIndex === 0) {
|
|
121209
|
-
return false;
|
|
121210
|
-
}
|
|
121196
|
+
if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
|
|
121197
|
+
return userCheckIndex;
|
|
121211
121198
|
}
|
|
121212
|
-
return
|
|
121199
|
+
return userCheckIndex + 2;
|
|
121200
|
+
}
|
|
121201
|
+
function canWatchDirectoryOrFile(pathComponents2, length2) {
|
|
121202
|
+
if (length2 === void 0)
|
|
121203
|
+
length2 = pathComponents2.length;
|
|
121204
|
+
if (length2 <= 2)
|
|
121205
|
+
return false;
|
|
121206
|
+
const perceivedOsRootLength = perceivedOsRootLengthForWatching(pathComponents2, length2);
|
|
121207
|
+
return length2 > perceivedOsRootLength + 1;
|
|
121213
121208
|
}
|
|
121214
|
-
function canWatchAtTypes(atTypes
|
|
121215
|
-
|
|
121216
|
-
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
121209
|
+
function canWatchAtTypes(atTypes) {
|
|
121210
|
+
return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes));
|
|
121217
121211
|
}
|
|
121218
|
-
function isInDirectoryPath(
|
|
121219
|
-
if (
|
|
121212
|
+
function isInDirectoryPath(dirComponents, fileOrDirComponents) {
|
|
121213
|
+
if (fileOrDirComponents.length < fileOrDirComponents.length)
|
|
121220
121214
|
return false;
|
|
121215
|
+
for (let i = 0; i < dirComponents.length; i++) {
|
|
121216
|
+
if (fileOrDirComponents[i] !== dirComponents[i])
|
|
121217
|
+
return false;
|
|
121221
121218
|
}
|
|
121222
|
-
return
|
|
121219
|
+
return true;
|
|
121220
|
+
}
|
|
121221
|
+
function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
|
|
121222
|
+
return canWatchDirectoryOrFile(getPathComponents(fileOrDirPath));
|
|
121223
121223
|
}
|
|
121224
121224
|
function canWatchAffectingLocation(filePath) {
|
|
121225
|
-
return
|
|
121226
|
-
}
|
|
121227
|
-
function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath,
|
|
121228
|
-
|
|
121229
|
-
|
|
121230
|
-
|
|
121231
|
-
|
|
121232
|
-
|
|
121233
|
-
|
|
121234
|
-
|
|
121235
|
-
|
|
121236
|
-
|
|
121237
|
-
|
|
121225
|
+
return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
|
|
121226
|
+
}
|
|
121227
|
+
function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory) {
|
|
121228
|
+
const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
|
|
121229
|
+
failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
|
|
121230
|
+
const failedLookupComponents = getPathComponents(failedLookupLocation);
|
|
121231
|
+
const perceivedOsRootLength = perceivedOsRootLengthForWatching(failedLookupPathComponents, failedLookupPathComponents.length);
|
|
121232
|
+
if (failedLookupPathComponents.length <= perceivedOsRootLength + 1)
|
|
121233
|
+
return void 0;
|
|
121234
|
+
const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
|
|
121235
|
+
if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1)
|
|
121236
|
+
return void 0;
|
|
121237
|
+
if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
|
|
121238
|
+
if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
|
|
121239
|
+
return getDirectoryOfFailedLookupWatch(failedLookupComponents, failedLookupPathComponents, Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1));
|
|
121238
121240
|
} else {
|
|
121239
121241
|
return {
|
|
121240
121242
|
dir: rootDir,
|
|
@@ -121244,45 +121246,58 @@ ${lanes.join("\n")}
|
|
|
121244
121246
|
}
|
|
121245
121247
|
}
|
|
121246
121248
|
return getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
121247
|
-
|
|
121248
|
-
|
|
121249
|
-
|
|
121249
|
+
failedLookupComponents,
|
|
121250
|
+
failedLookupPathComponents,
|
|
121251
|
+
failedLookupPathComponents.length - 1,
|
|
121252
|
+
perceivedOsRootLength,
|
|
121253
|
+
nodeModulesIndex,
|
|
121254
|
+
rootPathComponents
|
|
121250
121255
|
);
|
|
121251
121256
|
}
|
|
121252
|
-
function getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
121253
|
-
|
|
121254
|
-
|
|
121255
|
-
dirPath = getDirectoryPath(dirPath);
|
|
121256
|
-
}
|
|
121257
|
-
if (isNodeModulesDirectory(dirPath)) {
|
|
121258
|
-
return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
|
|
121257
|
+
function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents) {
|
|
121258
|
+
if (nodeModulesIndex !== -1) {
|
|
121259
|
+
return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, nodeModulesIndex + 1);
|
|
121259
121260
|
}
|
|
121260
121261
|
let nonRecursive = true;
|
|
121261
|
-
let
|
|
121262
|
-
|
|
121263
|
-
|
|
121264
|
-
const parentPath = getDirectoryPath(dirPath);
|
|
121265
|
-
if (parentPath === dirPath) {
|
|
121266
|
-
break;
|
|
121267
|
-
}
|
|
121262
|
+
let length2 = dirPathComponentsLength;
|
|
121263
|
+
for (let i = 0; i < dirPathComponentsLength; i++) {
|
|
121264
|
+
if (dirPathComponents[i] !== rootPathComponents[i]) {
|
|
121268
121265
|
nonRecursive = false;
|
|
121269
|
-
|
|
121270
|
-
|
|
121271
|
-
dirPath = parentPath;
|
|
121272
|
-
dir = getDirectoryPath(dir);
|
|
121266
|
+
length2 = Math.max(i + 1, perceivedOsRootLength + 1);
|
|
121267
|
+
break;
|
|
121273
121268
|
}
|
|
121274
121269
|
}
|
|
121275
|
-
return
|
|
121270
|
+
return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive);
|
|
121276
121271
|
}
|
|
121277
|
-
function
|
|
121278
|
-
|
|
121272
|
+
function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive) {
|
|
121273
|
+
return {
|
|
121274
|
+
dir: getPathFromPathComponents(dirComponents, length2),
|
|
121275
|
+
dirPath: getPathFromPathComponents(dirPathComponents, length2),
|
|
121276
|
+
nonRecursive
|
|
121277
|
+
};
|
|
121278
|
+
}
|
|
121279
|
+
function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
|
|
121280
|
+
const typeRootPathComponents = getPathComponents(typeRootPath);
|
|
121281
|
+
if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
|
|
121279
121282
|
return rootPath;
|
|
121280
121283
|
}
|
|
121281
|
-
|
|
121284
|
+
typeRoot = isRootedDiskPath(typeRoot) ? normalizePath(typeRoot) : getNormalizedAbsolutePath(typeRoot, getCurrentDirectory());
|
|
121285
|
+
const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(
|
|
121286
|
+
getPathComponents(typeRoot),
|
|
121287
|
+
typeRootPathComponents,
|
|
121288
|
+
typeRootPathComponents.length,
|
|
121289
|
+
perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
|
|
121290
|
+
typeRootPathComponents.indexOf("node_modules"),
|
|
121291
|
+
rootPathComponents
|
|
121292
|
+
);
|
|
121282
121293
|
return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
121283
121294
|
}
|
|
121284
121295
|
function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
|
|
121285
|
-
|
|
121296
|
+
const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
|
|
121297
|
+
return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
|
|
121298
|
+
}
|
|
121299
|
+
function getRootPathSplitLength(rootPath) {
|
|
121300
|
+
return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
|
|
121286
121301
|
}
|
|
121287
121302
|
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
|
|
121288
121303
|
let filesWithChangedSetOfUnresolvedImports;
|
|
@@ -121314,13 +121329,11 @@ ${lanes.join("\n")}
|
|
|
121314
121329
|
resolutionHost.getCompilationSettings(),
|
|
121315
121330
|
moduleResolutionCache.getPackageJsonInfoCache()
|
|
121316
121331
|
);
|
|
121317
|
-
const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
|
|
121318
|
-
const customFailedLookupPaths = /* @__PURE__ */ new Map();
|
|
121319
121332
|
const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
|
|
121320
121333
|
const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
|
|
121321
121334
|
const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
|
|
121322
|
-
const rootPath =
|
|
121323
|
-
const
|
|
121335
|
+
const rootPath = resolutionHost.toPath(rootDir);
|
|
121336
|
+
const rootPathComponents = getPathComponents(rootPath);
|
|
121324
121337
|
const typeRootsWatches = /* @__PURE__ */ new Map();
|
|
121325
121338
|
return {
|
|
121326
121339
|
getModuleResolutionCache: () => moduleResolutionCache,
|
|
@@ -121354,7 +121367,6 @@ ${lanes.join("\n")}
|
|
|
121354
121367
|
function clear2() {
|
|
121355
121368
|
clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
|
|
121356
121369
|
clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
|
|
121357
|
-
customFailedLookupPaths.clear();
|
|
121358
121370
|
nonRelativeExternalModuleResolutions.clear();
|
|
121359
121371
|
closeTypeRootsWatch();
|
|
121360
121372
|
resolvedModuleNames.clear();
|
|
@@ -121634,9 +121646,6 @@ ${lanes.join("\n")}
|
|
|
121634
121646
|
function isNodeModulesAtTypesDirectory(dirPath) {
|
|
121635
121647
|
return endsWith(dirPath, "/node_modules/@types");
|
|
121636
121648
|
}
|
|
121637
|
-
function isPathWithDefaultFailedLookupExtension(path) {
|
|
121638
|
-
return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
|
|
121639
|
-
}
|
|
121640
121649
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
121641
121650
|
var _a2, _b;
|
|
121642
121651
|
if (resolution.refCount) {
|
|
@@ -121677,15 +121686,11 @@ ${lanes.join("\n")}
|
|
|
121677
121686
|
failedLookupLocationPath,
|
|
121678
121687
|
rootDir,
|
|
121679
121688
|
rootPath,
|
|
121680
|
-
|
|
121689
|
+
rootPathComponents,
|
|
121681
121690
|
getCurrentDirectory
|
|
121682
121691
|
);
|
|
121683
121692
|
if (toWatch) {
|
|
121684
121693
|
const { dir, dirPath, nonRecursive } = toWatch;
|
|
121685
|
-
if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
|
|
121686
|
-
const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
|
|
121687
|
-
customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
|
|
121688
|
-
}
|
|
121689
121694
|
if (dirPath === rootPath) {
|
|
121690
121695
|
Debug.assert(nonRecursive);
|
|
121691
121696
|
setAtRoot = true;
|
|
@@ -121820,20 +121825,11 @@ ${lanes.join("\n")}
|
|
|
121820
121825
|
failedLookupLocationPath,
|
|
121821
121826
|
rootDir,
|
|
121822
121827
|
rootPath,
|
|
121823
|
-
|
|
121828
|
+
rootPathComponents,
|
|
121824
121829
|
getCurrentDirectory
|
|
121825
121830
|
);
|
|
121826
121831
|
if (toWatch) {
|
|
121827
121832
|
const { dirPath } = toWatch;
|
|
121828
|
-
const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
|
|
121829
|
-
if (refCount) {
|
|
121830
|
-
if (refCount === 1) {
|
|
121831
|
-
customFailedLookupPaths.delete(failedLookupLocationPath);
|
|
121832
|
-
} else {
|
|
121833
|
-
Debug.assert(refCount > 1);
|
|
121834
|
-
customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
|
|
121835
|
-
}
|
|
121836
|
-
}
|
|
121837
121833
|
if (dirPath === rootPath) {
|
|
121838
121834
|
removeAtRoot = true;
|
|
121839
121835
|
} else {
|
|
@@ -121931,10 +121927,10 @@ ${lanes.join("\n")}
|
|
|
121931
121927
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
121932
121928
|
(startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
121933
121929
|
} else {
|
|
121934
|
-
if (
|
|
121930
|
+
if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
|
|
121935
121931
|
return false;
|
|
121936
121932
|
}
|
|
121937
|
-
if (
|
|
121933
|
+
if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
|
|
121938
121934
|
return false;
|
|
121939
121935
|
}
|
|
121940
121936
|
(failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
|
|
@@ -121981,7 +121977,7 @@ ${lanes.join("\n")}
|
|
|
121981
121977
|
return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
121982
121978
|
}
|
|
121983
121979
|
function isInvalidatedFailedLookup(locationPath) {
|
|
121984
|
-
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (
|
|
121980
|
+
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
|
|
121985
121981
|
}
|
|
121986
121982
|
function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
|
|
121987
121983
|
var _a2;
|
|
@@ -122002,6 +121998,8 @@ ${lanes.join("\n")}
|
|
|
122002
121998
|
typeRoot,
|
|
122003
121999
|
typeRootPath,
|
|
122004
122000
|
rootPath,
|
|
122001
|
+
rootPathComponents,
|
|
122002
|
+
getCurrentDirectory,
|
|
122005
122003
|
(dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
|
|
122006
122004
|
);
|
|
122007
122005
|
if (dirPath) {
|
|
@@ -122032,7 +122030,7 @@ ${lanes.join("\n")}
|
|
|
122032
122030
|
function canWatchTypeRootPath(typeRoot) {
|
|
122033
122031
|
if (resolutionHost.getCompilationSettings().typeRoots)
|
|
122034
122032
|
return true;
|
|
122035
|
-
return canWatchAtTypes(resolutionHost.toPath(typeRoot)
|
|
122033
|
+
return canWatchAtTypes(resolutionHost.toPath(typeRoot));
|
|
122036
122034
|
}
|
|
122037
122035
|
}
|
|
122038
122036
|
function resolutionIsSymlink(resolution) {
|
|
@@ -125963,7 +125961,8 @@ ${lanes.join("\n")}
|
|
|
125963
125961
|
placeOpenBraceOnNewLineForFunctions: false,
|
|
125964
125962
|
placeOpenBraceOnNewLineForControlBlocks: false,
|
|
125965
125963
|
semicolons: "ignore" /* Ignore */,
|
|
125966
|
-
trimTrailingWhitespace: true
|
|
125964
|
+
trimTrailingWhitespace: true,
|
|
125965
|
+
indentSwitchCase: true
|
|
125967
125966
|
};
|
|
125968
125967
|
}
|
|
125969
125968
|
var ScriptSnapshot, PackageJsonDependencyGroup, PackageJsonAutoImportPreference, LanguageServiceMode, emptyOptions, SemanticClassificationFormat, OrganizeImportsMode, CompletionTriggerKind, InlayHintKind, HighlightSpanKind, IndentStyle, SemicolonPreference, testFormatSettings, SymbolDisplayPartKind, CompletionInfoFlags, OutliningSpanKind, OutputFileType, EndOfLineState, TokenClass, ScriptElementKind, ScriptElementKindModifier, ClassificationTypeNames, ClassificationType;
|
|
@@ -155334,7 +155333,7 @@ ${lanes.join("\n")}
|
|
|
155334
155333
|
false,
|
|
155335
155334
|
failedAliasResolution
|
|
155336
155335
|
)) : emptyArray;
|
|
155337
|
-
return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node)
|
|
155336
|
+
return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node));
|
|
155338
155337
|
}
|
|
155339
155338
|
if (isPropertyName(node) && isBindingElement(parent2) && isObjectBindingPattern(parent2.parent) && node === (parent2.propertyName || parent2.name)) {
|
|
155340
155339
|
const name = getNameFromPropertyName(node);
|
|
@@ -155344,7 +155343,8 @@ ${lanes.join("\n")}
|
|
|
155344
155343
|
return prop && getDefinitionFromSymbol(typeChecker, prop, node);
|
|
155345
155344
|
});
|
|
155346
155345
|
}
|
|
155347
|
-
|
|
155346
|
+
const objectLiteralElementDefinition = getDefinitionFromObjectLiteralElement(typeChecker, node);
|
|
155347
|
+
return concatenate(fileReferenceDefinition, objectLiteralElementDefinition.length ? objectLiteralElementDefinition : getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
|
|
155348
155348
|
}
|
|
155349
155349
|
function symbolMatchesSignature(s, calledDeclaration) {
|
|
155350
155350
|
var _a2;
|
|
@@ -155364,6 +155364,7 @@ ${lanes.join("\n")}
|
|
|
155364
155364
|
), (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node));
|
|
155365
155365
|
}
|
|
155366
155366
|
}
|
|
155367
|
+
return emptyArray;
|
|
155367
155368
|
}
|
|
155368
155369
|
function getDefinitionFromOverriddenMember(typeChecker, node) {
|
|
155369
155370
|
const classElement = findAncestor(node, isClassElement);
|
|
@@ -168088,6 +168089,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168088
168089
|
}
|
|
168089
168090
|
SmartIndenter2.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;
|
|
168090
168091
|
function nodeWillIndentChild(settings, parent2, child, sourceFile, indentByDefault) {
|
|
168092
|
+
var _a2;
|
|
168091
168093
|
const childKind = child ? child.kind : 0 /* Unknown */;
|
|
168092
168094
|
switch (parent2.kind) {
|
|
168093
168095
|
case 243 /* ExpressionStatement */:
|
|
@@ -168103,9 +168105,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168103
168105
|
case 186 /* TypeLiteral */:
|
|
168104
168106
|
case 199 /* MappedType */:
|
|
168105
168107
|
case 188 /* TupleType */:
|
|
168106
|
-
case 268 /* CaseBlock */:
|
|
168107
|
-
case 295 /* DefaultClause */:
|
|
168108
|
-
case 294 /* CaseClause */:
|
|
168109
168108
|
case 216 /* ParenthesizedExpression */:
|
|
168110
168109
|
case 210 /* PropertyAccessExpression */:
|
|
168111
168110
|
case 212 /* CallExpression */:
|
|
@@ -168134,7 +168133,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168134
168133
|
case 280 /* ExportSpecifier */:
|
|
168135
168134
|
case 275 /* ImportSpecifier */:
|
|
168136
168135
|
case 171 /* PropertyDeclaration */:
|
|
168136
|
+
case 294 /* CaseClause */:
|
|
168137
|
+
case 295 /* DefaultClause */:
|
|
168137
168138
|
return true;
|
|
168139
|
+
case 268 /* CaseBlock */:
|
|
168140
|
+
return (_a2 = settings.indentSwitchCase) != null ? _a2 : true;
|
|
168138
168141
|
case 259 /* VariableDeclaration */:
|
|
168139
168142
|
case 301 /* PropertyAssignment */:
|
|
168140
168143
|
case 225 /* BinaryExpression */:
|
|
@@ -170169,7 +170172,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170169
170172
|
this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
|
|
170170
170173
|
this.projectName = projectName;
|
|
170171
170174
|
this.directoryStructureHost = directoryStructureHost;
|
|
170172
|
-
this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory
|
|
170175
|
+
this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
|
|
170173
170176
|
this.getCanonicalFileName = this.projectService.toCanonicalFileName;
|
|
170174
170177
|
this.cancellationToken = new ThrottledCancellationToken(this.projectService.cancellationToken, this.projectService.throttleWaitMilliseconds);
|
|
170175
170178
|
if (!this.compilerOptions) {
|
|
@@ -170206,7 +170209,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
170206
170209
|
this.realpath = maybeBind(host, host.realpath);
|
|
170207
170210
|
this.resolutionCache = createResolutionCache(
|
|
170208
170211
|
this,
|
|
170209
|
-
|
|
170212
|
+
this.currentDirectory,
|
|
170210
170213
|
/*logChangesWhenResolvingModule*/
|
|
170211
170214
|
true
|
|
170212
170215
|
);
|
|
@@ -171592,7 +171595,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171592
171595
|
getNoDtsResolutionProject(rootFileNames) {
|
|
171593
171596
|
Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
|
|
171594
171597
|
if (!this.noDtsResolutionProject) {
|
|
171595
|
-
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject());
|
|
171598
|
+
this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
|
|
171596
171599
|
}
|
|
171597
171600
|
enumerateInsertsAndDeletes(
|
|
171598
171601
|
rootFileNames.map(toNormalizedPath),
|
|
@@ -171723,7 +171726,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171723
171726
|
}
|
|
171724
171727
|
};
|
|
171725
171728
|
AuxiliaryProject = class extends Project3 {
|
|
171726
|
-
constructor(projectService, documentRegistry, compilerOptions) {
|
|
171729
|
+
constructor(projectService, documentRegistry, compilerOptions, currentDirectory) {
|
|
171727
171730
|
super(
|
|
171728
171731
|
projectService.newAuxiliaryProjectName(),
|
|
171729
171732
|
4 /* Auxiliary */,
|
|
@@ -171739,8 +171742,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171739
171742
|
/*watchOptions*/
|
|
171740
171743
|
void 0,
|
|
171741
171744
|
projectService.host,
|
|
171742
|
-
|
|
171743
|
-
void 0
|
|
171745
|
+
currentDirectory
|
|
171744
171746
|
);
|
|
171745
171747
|
}
|
|
171746
171748
|
isOrphan() {
|
|
@@ -173386,7 +173388,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173386
173388
|
Debug.checkDefined(configFileExistenceInfo.watcher);
|
|
173387
173389
|
if ((_c = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _c.size) {
|
|
173388
173390
|
if (this.configFileExistenceImpactsRootOfInferredProject(configFileExistenceInfo)) {
|
|
173389
|
-
if (!canWatchDirectoryOrFile(getDirectoryPath(canonicalConfigFilePath))) {
|
|
173391
|
+
if (!canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath)))) {
|
|
173390
173392
|
configFileExistenceInfo.watcher.close();
|
|
173391
173393
|
configFileExistenceInfo.watcher = noopConfigFileWatcher;
|
|
173392
173394
|
}
|
|
@@ -173446,7 +173448,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173446
173448
|
this.configFileExistenceInfoCache.set(canonicalConfigFilePath, configFileExistenceInfo);
|
|
173447
173449
|
}
|
|
173448
173450
|
(configFileExistenceInfo.openFilesImpactedByConfigFile || (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Map())).set(info.path, true);
|
|
173449
|
-
configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getDirectoryPath(canonicalConfigFilePath)) ? this.watchFactory.watchFile(
|
|
173451
|
+
configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath))) ? this.watchFactory.watchFile(
|
|
173450
173452
|
configFileName,
|
|
173451
173453
|
(_filename, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind),
|
|
173452
173454
|
2e3 /* High */,
|
|
@@ -174075,15 +174077,14 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174075
174077
|
return this.inferredProjects[0];
|
|
174076
174078
|
}
|
|
174077
174079
|
return this.createInferredProject(
|
|
174078
|
-
|
|
174079
|
-
void 0,
|
|
174080
|
+
"",
|
|
174080
174081
|
/*isSingleInferredProject*/
|
|
174081
174082
|
true
|
|
174082
174083
|
);
|
|
174083
174084
|
}
|
|
174084
174085
|
getOrCreateSingleInferredWithoutProjectRoot(currentDirectory) {
|
|
174085
174086
|
Debug.assert(!this.useSingleInferredProject);
|
|
174086
|
-
const expectedCurrentDirectory = this.toCanonicalFileName(this.getNormalizedAbsolutePath(currentDirectory
|
|
174087
|
+
const expectedCurrentDirectory = this.toCanonicalFileName(this.getNormalizedAbsolutePath(currentDirectory));
|
|
174087
174088
|
for (const inferredProject of this.inferredProjects) {
|
|
174088
174089
|
if (!inferredProject.projectRootPath && inferredProject.isOrphan() && inferredProject.canonicalCurrentDirectory === expectedCurrentDirectory) {
|
|
174089
174090
|
return inferredProject;
|
|
@@ -180761,6 +180762,7 @@ ${e.message}`;
|
|
|
180761
180762
|
getRootDeclaration: () => getRootDeclaration,
|
|
180762
180763
|
getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
|
|
180763
180764
|
getRootLength: () => getRootLength,
|
|
180765
|
+
getRootPathSplitLength: () => getRootPathSplitLength,
|
|
180764
180766
|
getScriptKind: () => getScriptKind,
|
|
180765
180767
|
getScriptKindFromFileName: () => getScriptKindFromFileName,
|
|
180766
180768
|
getScriptTargetFeatures: () => getScriptTargetFeatures,
|
|
@@ -183128,6 +183130,7 @@ ${e.message}`;
|
|
|
183128
183130
|
getRootDeclaration: () => getRootDeclaration,
|
|
183129
183131
|
getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
|
|
183130
183132
|
getRootLength: () => getRootLength,
|
|
183133
|
+
getRootPathSplitLength: () => getRootPathSplitLength,
|
|
183131
183134
|
getScriptKind: () => getScriptKind,
|
|
183132
183135
|
getScriptKindFromFileName: () => getScriptKindFromFileName,
|
|
183133
183136
|
getScriptTargetFeatures: () => getScriptTargetFeatures,
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6594,6 +6594,7 @@ declare namespace ts {
|
|
|
6594
6594
|
readonly insertSpaceBeforeTypeAnnotation?: boolean;
|
|
6595
6595
|
readonly indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean;
|
|
6596
6596
|
readonly semicolons?: SemicolonPreference;
|
|
6597
|
+
readonly indentSwitchCase?: boolean;
|
|
6597
6598
|
}
|
|
6598
6599
|
interface DefinitionInfo extends DocumentSpan {
|
|
6599
6600
|
kind: ScriptElementKind;
|