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/tsserver.js CHANGED
@@ -980,6 +980,7 @@ __export(server_exports, {
980
980
  getRootDeclaration: () => getRootDeclaration,
981
981
  getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
982
982
  getRootLength: () => getRootLength,
983
+ getRootPathSplitLength: () => getRootPathSplitLength,
983
984
  getScriptKind: () => getScriptKind,
984
985
  getScriptKindFromFileName: () => getScriptKindFromFileName,
985
986
  getScriptTargetFeatures: () => getScriptTargetFeatures,
@@ -2293,7 +2294,7 @@ module.exports = __toCommonJS(server_exports);
2293
2294
 
2294
2295
  // src/compiler/corePublic.ts
2295
2296
  var versionMajorMinor = "5.1";
2296
- var version = `${versionMajorMinor}.0-dev.20230413`;
2297
+ var version = `${versionMajorMinor}.0-dev.20230414`;
2297
2298
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2298
2299
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2299
2300
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8937,11 +8938,11 @@ function getPathComponents(path, currentDirectory = "") {
8937
8938
  path = combinePaths(currentDirectory, path);
8938
8939
  return pathComponents(path, getRootLength(path));
8939
8940
  }
8940
- function getPathFromPathComponents(pathComponents2) {
8941
+ function getPathFromPathComponents(pathComponents2, length2) {
8941
8942
  if (pathComponents2.length === 0)
8942
8943
  return "";
8943
8944
  const root = pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0]);
8944
- return root + pathComponents2.slice(1).join(directorySeparator);
8945
+ return root + pathComponents2.slice(1, length2).join(directorySeparator);
8945
8946
  }
8946
8947
  function normalizeSlashes(path) {
8947
8948
  return path.indexOf("\\") !== -1 ? path.replace(backslashRegExp, directorySeparator) : path;
@@ -22747,7 +22748,7 @@ function createNodeFactory(flags, baseFactory2) {
22747
22748
  function createBigIntLiteral(value) {
22748
22749
  const node = createBaseToken(10 /* BigIntLiteral */);
22749
22750
  node.text = typeof value === "string" ? value : pseudoBigIntToString(value) + "n";
22750
- node.transformFlags |= 4 /* ContainsESNext */;
22751
+ node.transformFlags |= 32 /* ContainsES2020 */;
22751
22752
  return node;
22752
22753
  }
22753
22754
  function createBaseStringLiteral(text, isSingleQuote) {
@@ -24257,7 +24258,7 @@ function createNodeFactory(flags, baseFactory2) {
24257
24258
  node.transformFlags |= 1024 /* ContainsES2015 */;
24258
24259
  break;
24259
24260
  case 102 /* ImportKeyword */:
24260
- node.transformFlags |= 4 /* ContainsESNext */;
24261
+ node.transformFlags |= 32 /* ContainsES2020 */;
24261
24262
  break;
24262
24263
  default:
24263
24264
  return Debug.assertNever(keywordToken);
@@ -24785,7 +24786,7 @@ function createNodeFactory(flags, baseFactory2) {
24785
24786
  function createNamespaceExport(name) {
24786
24787
  const node = createBaseDeclaration(279 /* NamespaceExport */);
24787
24788
  node.name = name;
24788
- node.transformFlags |= propagateChildFlags(node.name) | 4 /* ContainsESNext */;
24789
+ node.transformFlags |= propagateChildFlags(node.name) | 32 /* ContainsES2020 */;
24789
24790
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
24790
24791
  return node;
24791
24792
  }
@@ -123017,60 +123018,62 @@ function removeIgnoredPath(path) {
123017
123018
  }
123018
123019
  return some(ignoredPaths, (searchPath) => stringContains(path, searchPath)) ? void 0 : path;
123019
123020
  }
123020
- function canWatchDirectoryOrFile(dirPath) {
123021
- const rootLength = getRootLength(dirPath);
123022
- if (dirPath.length === rootLength) {
123023
- return false;
123024
- }
123025
- let nextDirectorySeparator = dirPath.indexOf(directorySeparator, rootLength);
123026
- if (nextDirectorySeparator === -1) {
123027
- return false;
123028
- }
123029
- let pathPartForUserCheck = dirPath.substring(rootLength, nextDirectorySeparator + 1);
123030
- const isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* slash */;
123031
- if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
123032
- pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) {
123033
- nextDirectorySeparator = dirPath.indexOf(directorySeparator, nextDirectorySeparator + 1);
123034
- if (nextDirectorySeparator === -1) {
123035
- return false;
123036
- }
123037
- pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1);
123038
- }
123039
- if (isNonDirectorySeparatorRoot && pathPartForUserCheck.search(/users\//i) !== 0) {
123040
- return true;
123021
+ function perceivedOsRootLengthForWatching(pathComponents2, length2) {
123022
+ if (length2 <= 1)
123023
+ return 1;
123024
+ let userCheckIndex = 1;
123025
+ let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0;
123026
+ if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
123027
+ pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) {
123028
+ if (length2 === 2)
123029
+ return 2;
123030
+ userCheckIndex = 2;
123031
+ isDosStyle = true;
123041
123032
  }
123042
- for (let searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--) {
123043
- searchIndex = dirPath.indexOf(directorySeparator, searchIndex) + 1;
123044
- if (searchIndex === 0) {
123045
- return false;
123046
- }
123033
+ if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
123034
+ return userCheckIndex;
123047
123035
  }
123048
- return true;
123036
+ return userCheckIndex + 2;
123037
+ }
123038
+ function canWatchDirectoryOrFile(pathComponents2, length2) {
123039
+ if (length2 === void 0)
123040
+ length2 = pathComponents2.length;
123041
+ if (length2 <= 2)
123042
+ return false;
123043
+ const perceivedOsRootLength = perceivedOsRootLengthForWatching(pathComponents2, length2);
123044
+ return length2 > perceivedOsRootLength + 1;
123049
123045
  }
123050
- function canWatchAtTypes(atTypes, rootPath) {
123051
- const dirPath = getDirectoryPath(getDirectoryPath(atTypes));
123052
- return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
123046
+ function canWatchAtTypes(atTypes) {
123047
+ return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes));
123053
123048
  }
123054
- function isInDirectoryPath(dir, file) {
123055
- if (dir === void 0 || file.length <= dir.length) {
123049
+ function isInDirectoryPath(dirComponents, fileOrDirComponents) {
123050
+ if (fileOrDirComponents.length < fileOrDirComponents.length)
123056
123051
  return false;
123052
+ for (let i = 0; i < dirComponents.length; i++) {
123053
+ if (fileOrDirComponents[i] !== dirComponents[i])
123054
+ return false;
123057
123055
  }
123058
- return startsWith(file, dir) && file[dir.length] === directorySeparator;
123056
+ return true;
123057
+ }
123058
+ function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
123059
+ return canWatchDirectoryOrFile(getPathComponents(fileOrDirPath));
123059
123060
  }
123060
123061
  function canWatchAffectingLocation(filePath) {
123061
- return canWatchDirectoryOrFile(filePath);
123062
- }
123063
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootSplitLength, getCurrentDirectory) {
123064
- if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
123065
- failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
123066
- const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
123067
- const failedLookupSplit = failedLookupLocation.split(directorySeparator);
123068
- Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
123069
- if (failedLookupPathSplit.length > rootSplitLength + 1) {
123070
- return {
123071
- dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
123072
- dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
123073
- };
123062
+ return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath);
123063
+ }
123064
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory) {
123065
+ const failedLookupPathComponents = getPathComponents(failedLookupLocationPath);
123066
+ failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
123067
+ const failedLookupComponents = getPathComponents(failedLookupLocation);
123068
+ const perceivedOsRootLength = perceivedOsRootLengthForWatching(failedLookupPathComponents, failedLookupPathComponents.length);
123069
+ if (failedLookupPathComponents.length <= perceivedOsRootLength + 1)
123070
+ return void 0;
123071
+ const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules");
123072
+ if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1)
123073
+ return void 0;
123074
+ if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) {
123075
+ if (failedLookupPathComponents.length > rootPathComponents.length + 1) {
123076
+ return getDirectoryOfFailedLookupWatch(failedLookupComponents, failedLookupPathComponents, Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1));
123074
123077
  } else {
123075
123078
  return {
123076
123079
  dir: rootDir,
@@ -123080,45 +123083,58 @@ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLoo
123080
123083
  }
123081
123084
  }
123082
123085
  return getDirectoryToWatchFromFailedLookupLocationDirectory(
123083
- getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
123084
- getDirectoryPath(failedLookupLocationPath),
123085
- rootPath
123086
+ failedLookupComponents,
123087
+ failedLookupPathComponents,
123088
+ failedLookupPathComponents.length - 1,
123089
+ perceivedOsRootLength,
123090
+ nodeModulesIndex,
123091
+ rootPathComponents
123086
123092
  );
123087
123093
  }
123088
- function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath, rootPath) {
123089
- while (pathContainsNodeModules(dirPath)) {
123090
- dir = getDirectoryPath(dir);
123091
- dirPath = getDirectoryPath(dirPath);
123092
- }
123093
- if (isNodeModulesDirectory(dirPath)) {
123094
- return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
123094
+ function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents) {
123095
+ if (nodeModulesIndex !== -1) {
123096
+ return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, nodeModulesIndex + 1);
123095
123097
  }
123096
123098
  let nonRecursive = true;
123097
- let subDirectoryPath, subDirectory;
123098
- if (rootPath !== void 0) {
123099
- while (!isInDirectoryPath(dirPath, rootPath)) {
123100
- const parentPath = getDirectoryPath(dirPath);
123101
- if (parentPath === dirPath) {
123102
- break;
123103
- }
123099
+ let length2 = dirPathComponentsLength;
123100
+ for (let i = 0; i < dirPathComponentsLength; i++) {
123101
+ if (dirPathComponents[i] !== rootPathComponents[i]) {
123104
123102
  nonRecursive = false;
123105
- subDirectoryPath = dirPath;
123106
- subDirectory = dir;
123107
- dirPath = parentPath;
123108
- dir = getDirectoryPath(dir);
123103
+ length2 = Math.max(i + 1, perceivedOsRootLength + 1);
123104
+ break;
123109
123105
  }
123110
123106
  }
123111
- return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
123107
+ return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive);
123112
123108
  }
123113
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, filterCustomPath) {
123114
- if (isInDirectoryPath(rootPath, typeRootPath)) {
123109
+ function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive) {
123110
+ return {
123111
+ dir: getPathFromPathComponents(dirComponents, length2),
123112
+ dirPath: getPathFromPathComponents(dirPathComponents, length2),
123113
+ nonRecursive
123114
+ };
123115
+ }
123116
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) {
123117
+ const typeRootPathComponents = getPathComponents(typeRootPath);
123118
+ if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) {
123115
123119
  return rootPath;
123116
123120
  }
123117
- const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath, rootPath);
123121
+ typeRoot = isRootedDiskPath(typeRoot) ? normalizePath(typeRoot) : getNormalizedAbsolutePath(typeRoot, getCurrentDirectory());
123122
+ const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(
123123
+ getPathComponents(typeRoot),
123124
+ typeRootPathComponents,
123125
+ typeRootPathComponents.length,
123126
+ perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length),
123127
+ typeRootPathComponents.indexOf("node_modules"),
123128
+ rootPathComponents
123129
+ );
123118
123130
  return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
123119
123131
  }
123120
123132
  function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
123121
- return rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
123133
+ const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory());
123134
+ return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized;
123135
+ }
123136
+ function getRootPathSplitLength(rootPath) {
123137
+ return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
123122
123138
  }
123123
123139
  function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
123124
123140
  let filesWithChangedSetOfUnresolvedImports;
@@ -123150,13 +123166,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123150
123166
  resolutionHost.getCompilationSettings(),
123151
123167
  moduleResolutionCache.getPackageJsonInfoCache()
123152
123168
  );
123153
- const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
123154
- const customFailedLookupPaths = /* @__PURE__ */ new Map();
123155
123169
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
123156
123170
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
123157
123171
  const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
123158
- const rootPath = rootDir && resolutionHost.toPath(rootDir);
123159
- const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0;
123172
+ const rootPath = resolutionHost.toPath(rootDir);
123173
+ const rootPathComponents = getPathComponents(rootPath);
123160
123174
  const typeRootsWatches = /* @__PURE__ */ new Map();
123161
123175
  return {
123162
123176
  getModuleResolutionCache: () => moduleResolutionCache,
@@ -123190,7 +123204,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123190
123204
  function clear2() {
123191
123205
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
123192
123206
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
123193
- customFailedLookupPaths.clear();
123194
123207
  nonRelativeExternalModuleResolutions.clear();
123195
123208
  closeTypeRootsWatch();
123196
123209
  resolvedModuleNames.clear();
@@ -123470,9 +123483,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123470
123483
  function isNodeModulesAtTypesDirectory(dirPath) {
123471
123484
  return endsWith(dirPath, "/node_modules/@types");
123472
123485
  }
123473
- function isPathWithDefaultFailedLookupExtension(path) {
123474
- return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
123475
- }
123476
123486
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
123477
123487
  var _a2, _b;
123478
123488
  if (resolution.refCount) {
@@ -123513,15 +123523,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123513
123523
  failedLookupLocationPath,
123514
123524
  rootDir,
123515
123525
  rootPath,
123516
- rootSplitLength,
123526
+ rootPathComponents,
123517
123527
  getCurrentDirectory
123518
123528
  );
123519
123529
  if (toWatch) {
123520
123530
  const { dir, dirPath, nonRecursive } = toWatch;
123521
- if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
123522
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
123523
- customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
123524
- }
123525
123531
  if (dirPath === rootPath) {
123526
123532
  Debug.assert(nonRecursive);
123527
123533
  setAtRoot = true;
@@ -123656,20 +123662,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123656
123662
  failedLookupLocationPath,
123657
123663
  rootDir,
123658
123664
  rootPath,
123659
- rootSplitLength,
123665
+ rootPathComponents,
123660
123666
  getCurrentDirectory
123661
123667
  );
123662
123668
  if (toWatch) {
123663
123669
  const { dirPath } = toWatch;
123664
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
123665
- if (refCount) {
123666
- if (refCount === 1) {
123667
- customFailedLookupPaths.delete(failedLookupLocationPath);
123668
- } else {
123669
- Debug.assert(refCount > 1);
123670
- customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
123671
- }
123672
- }
123673
123670
  if (dirPath === rootPath) {
123674
123671
  removeAtRoot = true;
123675
123672
  } else {
@@ -123767,10 +123764,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123767
123764
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
123768
123765
  (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
123769
123766
  } else {
123770
- if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
123767
+ if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
123771
123768
  return false;
123772
123769
  }
123773
- if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
123770
+ if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
123774
123771
  return false;
123775
123772
  }
123776
123773
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
@@ -123817,7 +123814,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123817
123814
  return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
123818
123815
  }
123819
123816
  function isInvalidatedFailedLookup(locationPath) {
123820
- 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()) || [], (fileOrDirectoryPath) => isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0);
123817
+ 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);
123821
123818
  }
123822
123819
  function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
123823
123820
  var _a2;
@@ -123838,6 +123835,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123838
123835
  typeRoot,
123839
123836
  typeRootPath,
123840
123837
  rootPath,
123838
+ rootPathComponents,
123839
+ getCurrentDirectory,
123841
123840
  (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
123842
123841
  );
123843
123842
  if (dirPath) {
@@ -123868,7 +123867,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123868
123867
  function canWatchTypeRootPath(typeRoot) {
123869
123868
  if (resolutionHost.getCompilationSettings().typeRoots)
123870
123869
  return true;
123871
- return canWatchAtTypes(resolutionHost.toPath(typeRoot), rootPath);
123870
+ return canWatchAtTypes(resolutionHost.toPath(typeRoot));
123872
123871
  }
123873
123872
  }
123874
123873
  function resolutionIsSymlink(resolution) {
@@ -127726,7 +127725,8 @@ function getDefaultFormatCodeSettings(newLineCharacter) {
127726
127725
  placeOpenBraceOnNewLineForFunctions: false,
127727
127726
  placeOpenBraceOnNewLineForControlBlocks: false,
127728
127727
  semicolons: "ignore" /* Ignore */,
127729
- trimTrailingWhitespace: true
127728
+ trimTrailingWhitespace: true,
127729
+ indentSwitchCase: true
127730
127730
  };
127731
127731
  }
127732
127732
  var testFormatSettings = getDefaultFormatCodeSettings("\n");
@@ -156182,7 +156182,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
156182
156182
  false,
156183
156183
  failedAliasResolution
156184
156184
  )) : emptyArray;
156185
- return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || emptyArray);
156185
+ return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node));
156186
156186
  }
156187
156187
  if (isPropertyName(node) && isBindingElement(parent2) && isObjectBindingPattern(parent2.parent) && node === (parent2.propertyName || parent2.name)) {
156188
156188
  const name = getNameFromPropertyName(node);
@@ -156192,7 +156192,8 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
156192
156192
  return prop && getDefinitionFromSymbol(typeChecker, prop, node);
156193
156193
  });
156194
156194
  }
156195
- return concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
156195
+ const objectLiteralElementDefinition = getDefinitionFromObjectLiteralElement(typeChecker, node);
156196
+ return concatenate(fileReferenceDefinition, objectLiteralElementDefinition.length ? objectLiteralElementDefinition : getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
156196
156197
  }
156197
156198
  function symbolMatchesSignature(s, calledDeclaration) {
156198
156199
  var _a2;
@@ -156212,6 +156213,7 @@ function getDefinitionFromObjectLiteralElement(typeChecker, node) {
156212
156213
  ), (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node));
156213
156214
  }
156214
156215
  }
156216
+ return emptyArray;
156215
156217
  }
156216
156218
  function getDefinitionFromOverriddenMember(typeChecker, node) {
156217
156219
  const classElement = findAncestor(node, isClassElement);
@@ -168594,6 +168596,7 @@ var SmartIndenter;
168594
168596
  }
168595
168597
  SmartIndenter2.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;
168596
168598
  function nodeWillIndentChild(settings, parent2, child, sourceFile, indentByDefault) {
168599
+ var _a2;
168597
168600
  const childKind = child ? child.kind : 0 /* Unknown */;
168598
168601
  switch (parent2.kind) {
168599
168602
  case 243 /* ExpressionStatement */:
@@ -168609,9 +168612,6 @@ var SmartIndenter;
168609
168612
  case 186 /* TypeLiteral */:
168610
168613
  case 199 /* MappedType */:
168611
168614
  case 188 /* TupleType */:
168612
- case 268 /* CaseBlock */:
168613
- case 295 /* DefaultClause */:
168614
- case 294 /* CaseClause */:
168615
168615
  case 216 /* ParenthesizedExpression */:
168616
168616
  case 210 /* PropertyAccessExpression */:
168617
168617
  case 212 /* CallExpression */:
@@ -168640,7 +168640,11 @@ var SmartIndenter;
168640
168640
  case 280 /* ExportSpecifier */:
168641
168641
  case 275 /* ImportSpecifier */:
168642
168642
  case 171 /* PropertyDeclaration */:
168643
+ case 294 /* CaseClause */:
168644
+ case 295 /* DefaultClause */:
168643
168645
  return true;
168646
+ case 268 /* CaseBlock */:
168647
+ return (_a2 = settings.indentSwitchCase) != null ? _a2 : true;
168644
168648
  case 259 /* VariableDeclaration */:
168645
168649
  case 301 /* PropertyAssignment */:
168646
168650
  case 225 /* BinaryExpression */:
@@ -169669,6 +169673,7 @@ __export(ts_exports2, {
169669
169673
  getRootDeclaration: () => getRootDeclaration,
169670
169674
  getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
169671
169675
  getRootLength: () => getRootLength,
169676
+ getRootPathSplitLength: () => getRootPathSplitLength,
169672
169677
  getScriptKind: () => getScriptKind,
169673
169678
  getScriptKindFromFileName: () => getScriptKindFromFileName,
169674
169679
  getScriptTargetFeatures: () => getScriptTargetFeatures,
@@ -172793,7 +172798,7 @@ var Project3 = class {
172793
172798
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
172794
172799
  this.projectName = projectName;
172795
172800
  this.directoryStructureHost = directoryStructureHost;
172796
- this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory || "");
172801
+ this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
172797
172802
  this.getCanonicalFileName = this.projectService.toCanonicalFileName;
172798
172803
  this.cancellationToken = new ThrottledCancellationToken(this.projectService.cancellationToken, this.projectService.throttleWaitMilliseconds);
172799
172804
  if (!this.compilerOptions) {
@@ -172830,7 +172835,7 @@ var Project3 = class {
172830
172835
  this.realpath = maybeBind(host, host.realpath);
172831
172836
  this.resolutionCache = createResolutionCache(
172832
172837
  this,
172833
- currentDirectory && this.currentDirectory,
172838
+ this.currentDirectory,
172834
172839
  /*logChangesWhenResolvingModule*/
172835
172840
  true
172836
172841
  );
@@ -174216,7 +174221,7 @@ var Project3 = class {
174216
174221
  getNoDtsResolutionProject(rootFileNames) {
174217
174222
  Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
174218
174223
  if (!this.noDtsResolutionProject) {
174219
- this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject());
174224
+ this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
174220
174225
  }
174221
174226
  enumerateInsertsAndDeletes(
174222
174227
  rootFileNames.map(toNormalizedPath),
@@ -174369,7 +174374,7 @@ var InferredProject2 = class extends Project3 {
174369
174374
  }
174370
174375
  };
174371
174376
  var AuxiliaryProject = class extends Project3 {
174372
- constructor(projectService, documentRegistry, compilerOptions) {
174377
+ constructor(projectService, documentRegistry, compilerOptions, currentDirectory) {
174373
174378
  super(
174374
174379
  projectService.newAuxiliaryProjectName(),
174375
174380
  4 /* Auxiliary */,
@@ -174385,8 +174390,7 @@ var AuxiliaryProject = class extends Project3 {
174385
174390
  /*watchOptions*/
174386
174391
  void 0,
174387
174392
  projectService.host,
174388
- /*currentDirectory*/
174389
- void 0
174393
+ currentDirectory
174390
174394
  );
174391
174395
  }
174392
174396
  isOrphan() {
@@ -176006,7 +176010,7 @@ var _ProjectService = class {
176006
176010
  Debug.checkDefined(configFileExistenceInfo.watcher);
176007
176011
  if ((_c = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _c.size) {
176008
176012
  if (this.configFileExistenceImpactsRootOfInferredProject(configFileExistenceInfo)) {
176009
- if (!canWatchDirectoryOrFile(getDirectoryPath(canonicalConfigFilePath))) {
176013
+ if (!canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath)))) {
176010
176014
  configFileExistenceInfo.watcher.close();
176011
176015
  configFileExistenceInfo.watcher = noopConfigFileWatcher;
176012
176016
  }
@@ -176066,7 +176070,7 @@ var _ProjectService = class {
176066
176070
  this.configFileExistenceInfoCache.set(canonicalConfigFilePath, configFileExistenceInfo);
176067
176071
  }
176068
176072
  (configFileExistenceInfo.openFilesImpactedByConfigFile || (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Map())).set(info.path, true);
176069
- configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getDirectoryPath(canonicalConfigFilePath)) ? this.watchFactory.watchFile(
176073
+ configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath))) ? this.watchFactory.watchFile(
176070
176074
  configFileName,
176071
176075
  (_filename, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind),
176072
176076
  2e3 /* High */,
@@ -176695,15 +176699,14 @@ var _ProjectService = class {
176695
176699
  return this.inferredProjects[0];
176696
176700
  }
176697
176701
  return this.createInferredProject(
176698
- /*currentDirectory*/
176699
- void 0,
176702
+ "",
176700
176703
  /*isSingleInferredProject*/
176701
176704
  true
176702
176705
  );
176703
176706
  }
176704
176707
  getOrCreateSingleInferredWithoutProjectRoot(currentDirectory) {
176705
176708
  Debug.assert(!this.useSingleInferredProject);
176706
- const expectedCurrentDirectory = this.toCanonicalFileName(this.getNormalizedAbsolutePath(currentDirectory || ""));
176709
+ const expectedCurrentDirectory = this.toCanonicalFileName(this.getNormalizedAbsolutePath(currentDirectory));
176707
176710
  for (const inferredProject of this.inferredProjects) {
176708
176711
  if (!inferredProject.projectRootPath && inferredProject.isOrphan() && inferredProject.canonicalCurrentDirectory === expectedCurrentDirectory) {
176709
176712
  return inferredProject;
@@ -184104,6 +184107,7 @@ start(initializeNodeSystem(), require("os").platform());
184104
184107
  getRootDeclaration,
184105
184108
  getRootDirectoryOfResolutionCache,
184106
184109
  getRootLength,
184110
+ getRootPathSplitLength,
184107
184111
  getScriptKind,
184108
184112
  getScriptKindFromFileName,
184109
184113
  getScriptTargetFeatures,
@@ -2718,6 +2718,7 @@ declare namespace ts {
2718
2718
  placeOpenBraceOnNewLineForControlBlocks?: boolean;
2719
2719
  insertSpaceBeforeTypeAnnotation?: boolean;
2720
2720
  semicolons?: SemicolonPreference;
2721
+ indentSwitchCase?: boolean;
2721
2722
  }
2722
2723
  interface UserPreferences {
2723
2724
  readonly disableSuggestions?: boolean;
@@ -10524,6 +10525,7 @@ declare namespace ts {
10524
10525
  readonly insertSpaceBeforeTypeAnnotation?: boolean;
10525
10526
  readonly indentMultiLineObjectLiteralBeginningOnBlankLine?: boolean;
10526
10527
  readonly semicolons?: SemicolonPreference;
10528
+ readonly indentSwitchCase?: boolean;
10527
10529
  }
10528
10530
  interface DefinitionInfo extends DocumentSpan {
10529
10531
  kind: ScriptElementKind;