typescript 5.1.0-dev.20230412 → 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.
@@ -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.20230412`;
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 |= 4 /* ContainsESNext */;
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 |= 4 /* ContainsESNext */;
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) | 4 /* ContainsESNext */;
22636
+ node.transformFlags |= propagateChildFlags(node.name) | 32 /* ContainsES2020 */;
22637
22637
  node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */;
22638
22638
  return node;
22639
22639
  }
@@ -47200,11 +47200,6 @@ ${lanes.join("\n")}
47200
47200
  diagnosticMessage = error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName);
47201
47201
  } else if (result.flags & 256 /* RegularEnum */) {
47202
47202
  diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
47203
- } else {
47204
- Debug.assert(!!(result.flags & 128 /* ConstEnum */));
47205
- if (shouldPreserveConstEnums(compilerOptions)) {
47206
- diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName);
47207
- }
47208
47203
  }
47209
47204
  if (diagnosticMessage) {
47210
47205
  addRelatedInfo(
@@ -64032,40 +64027,31 @@ ${lanes.join("\n")}
64032
64027
  return getPropertiesOfType(type).filter((targetProp) => containsMissingType(getTypeOfSymbol(targetProp)));
64033
64028
  }
64034
64029
  function getBestMatchingType(source, target, isRelatedTo = compareTypesAssignable) {
64035
- return findMatchingDiscriminantType(
64036
- source,
64037
- target,
64038
- isRelatedTo,
64039
- /*skipPartial*/
64040
- true
64041
- ) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || findBestTypeForInvokable(source, target) || findMostOverlappyType(source, target);
64030
+ return findMatchingDiscriminantType(source, target, isRelatedTo) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || findBestTypeForInvokable(source, target) || findMostOverlappyType(source, target);
64042
64031
  }
64043
- function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue, skipPartial) {
64044
- const discriminable = target.types.map((_) => void 0);
64032
+ function discriminateTypeByDiscriminableItems(target, discriminators, related) {
64033
+ const types = target.types;
64034
+ const include = types.map((t) => t.flags & 402784252 /* Primitive */ ? 0 /* False */ : -1 /* True */);
64045
64035
  for (const [getDiscriminatingType, propertyName] of discriminators) {
64046
- const targetProp = getUnionOrIntersectionProperty(target, propertyName);
64047
- if (skipPartial && targetProp && getCheckFlags(targetProp) & 16 /* ReadPartial */) {
64048
- continue;
64036
+ let matched = false;
64037
+ for (let i = 0; i < types.length; i++) {
64038
+ if (include[i]) {
64039
+ const targetType = getTypeOfPropertyOfType(types[i], propertyName);
64040
+ if (targetType && related(getDiscriminatingType(), targetType)) {
64041
+ matched = true;
64042
+ } else {
64043
+ include[i] = 3 /* Maybe */;
64044
+ }
64045
+ }
64049
64046
  }
64050
- let i = 0;
64051
- for (const type of target.types) {
64052
- const targetType = getTypeOfPropertyOfType(type, propertyName);
64053
- if (targetType && related(getDiscriminatingType(), targetType)) {
64054
- discriminable[i] = discriminable[i] === void 0 ? true : discriminable[i];
64055
- } else {
64056
- discriminable[i] = false;
64047
+ for (let i = 0; i < types.length; i++) {
64048
+ if (include[i] === 3 /* Maybe */) {
64049
+ include[i] = matched ? 0 /* False */ : -1 /* True */;
64057
64050
  }
64058
- i++;
64059
64051
  }
64060
64052
  }
64061
- const match = discriminable.indexOf(
64062
- /*searchElement*/
64063
- true
64064
- );
64065
- if (match === -1) {
64066
- return defaultValue;
64067
- }
64068
- return getUnionType(target.types.filter((_, index) => discriminable[index]));
64053
+ const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])) : target;
64054
+ return filtered.flags & 131072 /* Never */ ? target : filtered;
64069
64055
  }
64070
64056
  function isWeakType(type) {
64071
64057
  if (type.flags & 524288 /* Object */) {
@@ -69369,8 +69355,7 @@ ${lanes.join("\n")}
69369
69355
  (s) => [() => undefinedType, s.escapedName]
69370
69356
  )
69371
69357
  ),
69372
- isTypeAssignableTo,
69373
- contextualType
69358
+ isTypeAssignableTo
69374
69359
  );
69375
69360
  }
69376
69361
  function discriminateContextualTypeByJSXAttributes(node, contextualType) {
@@ -69389,8 +69374,7 @@ ${lanes.join("\n")}
69389
69374
  (s) => [() => undefinedType, s.escapedName]
69390
69375
  )
69391
69376
  ),
69392
- isTypeAssignableTo,
69393
- contextualType
69377
+ isTypeAssignableTo
69394
69378
  );
69395
69379
  }
69396
69380
  function getApparentTypeOfContextualType(node, contextFlags) {
@@ -85404,7 +85388,7 @@ ${lanes.join("\n")}
85404
85388
  }
85405
85389
  return type;
85406
85390
  }
85407
- function findMatchingDiscriminantType(source, target, isRelatedTo, skipPartial) {
85391
+ function findMatchingDiscriminantType(source, target, isRelatedTo) {
85408
85392
  if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) {
85409
85393
  const match = getMatchingUnionConstituentForType(target, source);
85410
85394
  if (match) {
@@ -85414,14 +85398,10 @@ ${lanes.join("\n")}
85414
85398
  if (sourceProperties) {
85415
85399
  const sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
85416
85400
  if (sourcePropertiesFiltered) {
85417
- return discriminateTypeByDiscriminableItems(
85418
- target,
85419
- map(sourcePropertiesFiltered, (p) => [() => getTypeOfSymbol(p), p.escapedName]),
85420
- isRelatedTo,
85421
- /*defaultValue*/
85422
- void 0,
85423
- skipPartial
85424
- );
85401
+ const discriminated = discriminateTypeByDiscriminableItems(target, map(sourcePropertiesFiltered, (p) => [() => getTypeOfSymbol(p), p.escapedName]), isRelatedTo);
85402
+ if (discriminated !== target) {
85403
+ return discriminated;
85404
+ }
85425
85405
  }
85426
85406
  }
85427
85407
  }
@@ -121201,60 +121181,62 @@ ${lanes.join("\n")}
121201
121181
  }
121202
121182
  return some(ignoredPaths, (searchPath) => stringContains(path, searchPath)) ? void 0 : path;
121203
121183
  }
121204
- function canWatchDirectoryOrFile(dirPath) {
121205
- const rootLength = getRootLength(dirPath);
121206
- if (dirPath.length === rootLength) {
121207
- return false;
121208
- }
121209
- let nextDirectorySeparator = dirPath.indexOf(directorySeparator, rootLength);
121210
- if (nextDirectorySeparator === -1) {
121211
- return false;
121212
- }
121213
- let pathPartForUserCheck = dirPath.substring(rootLength, nextDirectorySeparator + 1);
121214
- const isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* slash */;
121215
- if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths
121216
- pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) {
121217
- nextDirectorySeparator = dirPath.indexOf(directorySeparator, nextDirectorySeparator + 1);
121218
- if (nextDirectorySeparator === -1) {
121219
- return false;
121220
- }
121221
- pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1);
121222
- }
121223
- if (isNonDirectorySeparatorRoot && pathPartForUserCheck.search(/users\//i) !== 0) {
121224
- 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;
121225
121195
  }
121226
- for (let searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--) {
121227
- searchIndex = dirPath.indexOf(directorySeparator, searchIndex) + 1;
121228
- if (searchIndex === 0) {
121229
- return false;
121230
- }
121196
+ if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) {
121197
+ return userCheckIndex;
121231
121198
  }
121232
- return true;
121199
+ return userCheckIndex + 2;
121233
121200
  }
121234
- function canWatchAtTypes(atTypes, rootPath) {
121235
- const dirPath = getDirectoryPath(getDirectoryPath(atTypes));
121236
- return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
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;
121237
121208
  }
121238
- function isInDirectoryPath(dir, file) {
121239
- if (dir === void 0 || file.length <= dir.length) {
121209
+ function canWatchAtTypes(atTypes) {
121210
+ return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes));
121211
+ }
121212
+ function isInDirectoryPath(dirComponents, fileOrDirComponents) {
121213
+ if (fileOrDirComponents.length < fileOrDirComponents.length)
121240
121214
  return false;
121215
+ for (let i = 0; i < dirComponents.length; i++) {
121216
+ if (fileOrDirComponents[i] !== dirComponents[i])
121217
+ return false;
121241
121218
  }
121242
- return startsWith(file, dir) && file[dir.length] === directorySeparator;
121219
+ return true;
121220
+ }
121221
+ function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) {
121222
+ return canWatchDirectoryOrFile(getPathComponents(fileOrDirPath));
121243
121223
  }
121244
121224
  function canWatchAffectingLocation(filePath) {
121245
- return canWatchDirectoryOrFile(filePath);
121246
- }
121247
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootSplitLength, getCurrentDirectory) {
121248
- if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
121249
- failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
121250
- const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
121251
- const failedLookupSplit = failedLookupLocation.split(directorySeparator);
121252
- Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
121253
- if (failedLookupPathSplit.length > rootSplitLength + 1) {
121254
- return {
121255
- dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
121256
- dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
121257
- };
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));
121258
121240
  } else {
121259
121241
  return {
121260
121242
  dir: rootDir,
@@ -121264,45 +121246,58 @@ ${lanes.join("\n")}
121264
121246
  }
121265
121247
  }
121266
121248
  return getDirectoryToWatchFromFailedLookupLocationDirectory(
121267
- getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
121268
- getDirectoryPath(failedLookupLocationPath),
121269
- rootPath
121249
+ failedLookupComponents,
121250
+ failedLookupPathComponents,
121251
+ failedLookupPathComponents.length - 1,
121252
+ perceivedOsRootLength,
121253
+ nodeModulesIndex,
121254
+ rootPathComponents
121270
121255
  );
121271
121256
  }
121272
- function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath, rootPath) {
121273
- while (pathContainsNodeModules(dirPath)) {
121274
- dir = getDirectoryPath(dir);
121275
- dirPath = getDirectoryPath(dirPath);
121276
- }
121277
- if (isNodeModulesDirectory(dirPath)) {
121278
- 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);
121279
121260
  }
121280
121261
  let nonRecursive = true;
121281
- let subDirectoryPath, subDirectory;
121282
- if (rootPath !== void 0) {
121283
- while (!isInDirectoryPath(dirPath, rootPath)) {
121284
- const parentPath = getDirectoryPath(dirPath);
121285
- if (parentPath === dirPath) {
121286
- break;
121287
- }
121262
+ let length2 = dirPathComponentsLength;
121263
+ for (let i = 0; i < dirPathComponentsLength; i++) {
121264
+ if (dirPathComponents[i] !== rootPathComponents[i]) {
121288
121265
  nonRecursive = false;
121289
- subDirectoryPath = dirPath;
121290
- subDirectory = dir;
121291
- dirPath = parentPath;
121292
- dir = getDirectoryPath(dir);
121266
+ length2 = Math.max(i + 1, perceivedOsRootLength + 1);
121267
+ break;
121293
121268
  }
121294
121269
  }
121295
- return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
121270
+ return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive);
121296
121271
  }
121297
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, filterCustomPath) {
121298
- if (isInDirectoryPath(rootPath, typeRootPath)) {
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)) {
121299
121282
  return rootPath;
121300
121283
  }
121301
- const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath, rootPath);
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
+ );
121302
121293
  return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
121303
121294
  }
121304
121295
  function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
121305
- return rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
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);
121306
121301
  }
121307
121302
  function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
121308
121303
  let filesWithChangedSetOfUnresolvedImports;
@@ -121334,13 +121329,11 @@ ${lanes.join("\n")}
121334
121329
  resolutionHost.getCompilationSettings(),
121335
121330
  moduleResolutionCache.getPackageJsonInfoCache()
121336
121331
  );
121337
- const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */];
121338
- const customFailedLookupPaths = /* @__PURE__ */ new Map();
121339
121332
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
121340
121333
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
121341
121334
  const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
121342
- const rootPath = rootDir && resolutionHost.toPath(rootDir);
121343
- const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0;
121335
+ const rootPath = resolutionHost.toPath(rootDir);
121336
+ const rootPathComponents = getPathComponents(rootPath);
121344
121337
  const typeRootsWatches = /* @__PURE__ */ new Map();
121345
121338
  return {
121346
121339
  getModuleResolutionCache: () => moduleResolutionCache,
@@ -121374,7 +121367,6 @@ ${lanes.join("\n")}
121374
121367
  function clear2() {
121375
121368
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
121376
121369
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
121377
- customFailedLookupPaths.clear();
121378
121370
  nonRelativeExternalModuleResolutions.clear();
121379
121371
  closeTypeRootsWatch();
121380
121372
  resolvedModuleNames.clear();
@@ -121654,9 +121646,6 @@ ${lanes.join("\n")}
121654
121646
  function isNodeModulesAtTypesDirectory(dirPath) {
121655
121647
  return endsWith(dirPath, "/node_modules/@types");
121656
121648
  }
121657
- function isPathWithDefaultFailedLookupExtension(path) {
121658
- return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
121659
- }
121660
121649
  function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
121661
121650
  var _a2, _b;
121662
121651
  if (resolution.refCount) {
@@ -121697,15 +121686,11 @@ ${lanes.join("\n")}
121697
121686
  failedLookupLocationPath,
121698
121687
  rootDir,
121699
121688
  rootPath,
121700
- rootSplitLength,
121689
+ rootPathComponents,
121701
121690
  getCurrentDirectory
121702
121691
  );
121703
121692
  if (toWatch) {
121704
121693
  const { dir, dirPath, nonRecursive } = toWatch;
121705
- if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
121706
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0;
121707
- customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1);
121708
- }
121709
121694
  if (dirPath === rootPath) {
121710
121695
  Debug.assert(nonRecursive);
121711
121696
  setAtRoot = true;
@@ -121840,20 +121825,11 @@ ${lanes.join("\n")}
121840
121825
  failedLookupLocationPath,
121841
121826
  rootDir,
121842
121827
  rootPath,
121843
- rootSplitLength,
121828
+ rootPathComponents,
121844
121829
  getCurrentDirectory
121845
121830
  );
121846
121831
  if (toWatch) {
121847
121832
  const { dirPath } = toWatch;
121848
- const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
121849
- if (refCount) {
121850
- if (refCount === 1) {
121851
- customFailedLookupPaths.delete(failedLookupLocationPath);
121852
- } else {
121853
- Debug.assert(refCount > 1);
121854
- customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1);
121855
- }
121856
- }
121857
121833
  if (dirPath === rootPath) {
121858
121834
  removeAtRoot = true;
121859
121835
  } else {
@@ -121951,10 +121927,10 @@ ${lanes.join("\n")}
121951
121927
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
121952
121928
  (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
121953
121929
  } else {
121954
- if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) {
121930
+ if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
121955
121931
  return false;
121956
121932
  }
121957
- if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) {
121933
+ if (fileExtensionIs(fileOrDirectoryPath, ".map")) {
121958
121934
  return false;
121959
121935
  }
121960
121936
  (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath);
@@ -122001,7 +121977,7 @@ ${lanes.join("\n")}
122001
121977
  return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
122002
121978
  }
122003
121979
  function isInvalidatedFailedLookup(locationPath) {
122004
- 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);
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);
122005
121981
  }
122006
121982
  function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
122007
121983
  var _a2;
@@ -122022,6 +121998,8 @@ ${lanes.join("\n")}
122022
121998
  typeRoot,
122023
121999
  typeRootPath,
122024
122000
  rootPath,
122001
+ rootPathComponents,
122002
+ getCurrentDirectory,
122025
122003
  (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
122026
122004
  );
122027
122005
  if (dirPath) {
@@ -122052,7 +122030,7 @@ ${lanes.join("\n")}
122052
122030
  function canWatchTypeRootPath(typeRoot) {
122053
122031
  if (resolutionHost.getCompilationSettings().typeRoots)
122054
122032
  return true;
122055
- return canWatchAtTypes(resolutionHost.toPath(typeRoot), rootPath);
122033
+ return canWatchAtTypes(resolutionHost.toPath(typeRoot));
122056
122034
  }
122057
122035
  }
122058
122036
  function resolutionIsSymlink(resolution) {
@@ -125983,7 +125961,8 @@ ${lanes.join("\n")}
125983
125961
  placeOpenBraceOnNewLineForFunctions: false,
125984
125962
  placeOpenBraceOnNewLineForControlBlocks: false,
125985
125963
  semicolons: "ignore" /* Ignore */,
125986
- trimTrailingWhitespace: true
125964
+ trimTrailingWhitespace: true,
125965
+ indentSwitchCase: true
125987
125966
  };
125988
125967
  }
125989
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;
@@ -127236,7 +127215,13 @@ ${lanes.join("\n")}
127236
127215
  sourceFile,
127237
127216
  n.kind
127238
127217
  );
127239
- return candidate2 && findRightmostToken(candidate2, sourceFile);
127218
+ if (candidate2) {
127219
+ if (!excludeJsdoc && isJSDocCommentContainingNode(candidate2) && candidate2.getChildren(sourceFile).length) {
127220
+ return find2(candidate2);
127221
+ }
127222
+ return findRightmostToken(candidate2, sourceFile);
127223
+ }
127224
+ return void 0;
127240
127225
  } else {
127241
127226
  return find2(child);
127242
127227
  }
@@ -155348,7 +155333,7 @@ ${lanes.join("\n")}
155348
155333
  false,
155349
155334
  failedAliasResolution
155350
155335
  )) : emptyArray;
155351
- return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || emptyArray);
155336
+ return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node));
155352
155337
  }
155353
155338
  if (isPropertyName(node) && isBindingElement(parent2) && isObjectBindingPattern(parent2.parent) && node === (parent2.propertyName || parent2.name)) {
155354
155339
  const name = getNameFromPropertyName(node);
@@ -155358,7 +155343,8 @@ ${lanes.join("\n")}
155358
155343
  return prop && getDefinitionFromSymbol(typeChecker, prop, node);
155359
155344
  });
155360
155345
  }
155361
- return concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
155346
+ const objectLiteralElementDefinition = getDefinitionFromObjectLiteralElement(typeChecker, node);
155347
+ return concatenate(fileReferenceDefinition, objectLiteralElementDefinition.length ? objectLiteralElementDefinition : getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution));
155362
155348
  }
155363
155349
  function symbolMatchesSignature(s, calledDeclaration) {
155364
155350
  var _a2;
@@ -155378,6 +155364,7 @@ ${lanes.join("\n")}
155378
155364
  ), (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node));
155379
155365
  }
155380
155366
  }
155367
+ return emptyArray;
155381
155368
  }
155382
155369
  function getDefinitionFromOverriddenMember(typeChecker, node) {
155383
155370
  const classElement = findAncestor(node, isClassElement);
@@ -168102,6 +168089,7 @@ ${options.prefix}` : "\n" : options.prefix
168102
168089
  }
168103
168090
  SmartIndenter2.findFirstNonWhitespaceColumn = findFirstNonWhitespaceColumn;
168104
168091
  function nodeWillIndentChild(settings, parent2, child, sourceFile, indentByDefault) {
168092
+ var _a2;
168105
168093
  const childKind = child ? child.kind : 0 /* Unknown */;
168106
168094
  switch (parent2.kind) {
168107
168095
  case 243 /* ExpressionStatement */:
@@ -168117,9 +168105,6 @@ ${options.prefix}` : "\n" : options.prefix
168117
168105
  case 186 /* TypeLiteral */:
168118
168106
  case 199 /* MappedType */:
168119
168107
  case 188 /* TupleType */:
168120
- case 268 /* CaseBlock */:
168121
- case 295 /* DefaultClause */:
168122
- case 294 /* CaseClause */:
168123
168108
  case 216 /* ParenthesizedExpression */:
168124
168109
  case 210 /* PropertyAccessExpression */:
168125
168110
  case 212 /* CallExpression */:
@@ -168148,7 +168133,11 @@ ${options.prefix}` : "\n" : options.prefix
168148
168133
  case 280 /* ExportSpecifier */:
168149
168134
  case 275 /* ImportSpecifier */:
168150
168135
  case 171 /* PropertyDeclaration */:
168136
+ case 294 /* CaseClause */:
168137
+ case 295 /* DefaultClause */:
168151
168138
  return true;
168139
+ case 268 /* CaseBlock */:
168140
+ return (_a2 = settings.indentSwitchCase) != null ? _a2 : true;
168152
168141
  case 259 /* VariableDeclaration */:
168153
168142
  case 301 /* PropertyAssignment */:
168154
168143
  case 225 /* BinaryExpression */:
@@ -170183,7 +170172,7 @@ ${options.prefix}` : "\n" : options.prefix
170183
170172
  this.globalCacheResolutionModuleName = ts_JsTyping_exports.nonRelativeModuleNameForTypingCache;
170184
170173
  this.projectName = projectName;
170185
170174
  this.directoryStructureHost = directoryStructureHost;
170186
- this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory || "");
170175
+ this.currentDirectory = this.projectService.getNormalizedAbsolutePath(currentDirectory);
170187
170176
  this.getCanonicalFileName = this.projectService.toCanonicalFileName;
170188
170177
  this.cancellationToken = new ThrottledCancellationToken(this.projectService.cancellationToken, this.projectService.throttleWaitMilliseconds);
170189
170178
  if (!this.compilerOptions) {
@@ -170220,7 +170209,7 @@ ${options.prefix}` : "\n" : options.prefix
170220
170209
  this.realpath = maybeBind(host, host.realpath);
170221
170210
  this.resolutionCache = createResolutionCache(
170222
170211
  this,
170223
- currentDirectory && this.currentDirectory,
170212
+ this.currentDirectory,
170224
170213
  /*logChangesWhenResolvingModule*/
170225
170214
  true
170226
170215
  );
@@ -171606,7 +171595,7 @@ ${options.prefix}` : "\n" : options.prefix
171606
171595
  getNoDtsResolutionProject(rootFileNames) {
171607
171596
  Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
171608
171597
  if (!this.noDtsResolutionProject) {
171609
- this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject());
171598
+ this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
171610
171599
  }
171611
171600
  enumerateInsertsAndDeletes(
171612
171601
  rootFileNames.map(toNormalizedPath),
@@ -171737,7 +171726,7 @@ ${options.prefix}` : "\n" : options.prefix
171737
171726
  }
171738
171727
  };
171739
171728
  AuxiliaryProject = class extends Project3 {
171740
- constructor(projectService, documentRegistry, compilerOptions) {
171729
+ constructor(projectService, documentRegistry, compilerOptions, currentDirectory) {
171741
171730
  super(
171742
171731
  projectService.newAuxiliaryProjectName(),
171743
171732
  4 /* Auxiliary */,
@@ -171753,8 +171742,7 @@ ${options.prefix}` : "\n" : options.prefix
171753
171742
  /*watchOptions*/
171754
171743
  void 0,
171755
171744
  projectService.host,
171756
- /*currentDirectory*/
171757
- void 0
171745
+ currentDirectory
171758
171746
  );
171759
171747
  }
171760
171748
  isOrphan() {
@@ -173400,7 +173388,7 @@ ${options.prefix}` : "\n" : options.prefix
173400
173388
  Debug.checkDefined(configFileExistenceInfo.watcher);
173401
173389
  if ((_c = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _c.size) {
173402
173390
  if (this.configFileExistenceImpactsRootOfInferredProject(configFileExistenceInfo)) {
173403
- if (!canWatchDirectoryOrFile(getDirectoryPath(canonicalConfigFilePath))) {
173391
+ if (!canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath)))) {
173404
173392
  configFileExistenceInfo.watcher.close();
173405
173393
  configFileExistenceInfo.watcher = noopConfigFileWatcher;
173406
173394
  }
@@ -173460,7 +173448,7 @@ ${options.prefix}` : "\n" : options.prefix
173460
173448
  this.configFileExistenceInfoCache.set(canonicalConfigFilePath, configFileExistenceInfo);
173461
173449
  }
173462
173450
  (configFileExistenceInfo.openFilesImpactedByConfigFile || (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Map())).set(info.path, true);
173463
- configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getDirectoryPath(canonicalConfigFilePath)) ? this.watchFactory.watchFile(
173451
+ configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath))) ? this.watchFactory.watchFile(
173464
173452
  configFileName,
173465
173453
  (_filename, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind),
173466
173454
  2e3 /* High */,
@@ -174089,15 +174077,14 @@ ${options.prefix}` : "\n" : options.prefix
174089
174077
  return this.inferredProjects[0];
174090
174078
  }
174091
174079
  return this.createInferredProject(
174092
- /*currentDirectory*/
174093
- void 0,
174080
+ "",
174094
174081
  /*isSingleInferredProject*/
174095
174082
  true
174096
174083
  );
174097
174084
  }
174098
174085
  getOrCreateSingleInferredWithoutProjectRoot(currentDirectory) {
174099
174086
  Debug.assert(!this.useSingleInferredProject);
174100
- const expectedCurrentDirectory = this.toCanonicalFileName(this.getNormalizedAbsolutePath(currentDirectory || ""));
174087
+ const expectedCurrentDirectory = this.toCanonicalFileName(this.getNormalizedAbsolutePath(currentDirectory));
174101
174088
  for (const inferredProject of this.inferredProjects) {
174102
174089
  if (!inferredProject.projectRootPath && inferredProject.isOrphan() && inferredProject.canonicalCurrentDirectory === expectedCurrentDirectory) {
174103
174090
  return inferredProject;
@@ -180775,6 +180762,7 @@ ${e.message}`;
180775
180762
  getRootDeclaration: () => getRootDeclaration,
180776
180763
  getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
180777
180764
  getRootLength: () => getRootLength,
180765
+ getRootPathSplitLength: () => getRootPathSplitLength,
180778
180766
  getScriptKind: () => getScriptKind,
180779
180767
  getScriptKindFromFileName: () => getScriptKindFromFileName,
180780
180768
  getScriptTargetFeatures: () => getScriptTargetFeatures,
@@ -183142,6 +183130,7 @@ ${e.message}`;
183142
183130
  getRootDeclaration: () => getRootDeclaration,
183143
183131
  getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
183144
183132
  getRootLength: () => getRootLength,
183133
+ getRootPathSplitLength: () => getRootPathSplitLength,
183145
183134
  getScriptKind: () => getScriptKind,
183146
183135
  getScriptKindFromFileName: () => getScriptKindFromFileName,
183147
183136
  getScriptTargetFeatures: () => getScriptTargetFeatures,