typescript 5.1.0-dev.20230331 → 5.1.0-dev.20230401

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
@@ -257,6 +257,8 @@ __export(server_exports, {
257
257
  canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
258
258
  canProduceDiagnostics: () => canProduceDiagnostics,
259
259
  canUsePropertyAccess: () => canUsePropertyAccess,
260
+ canWatchAffectingLocation: () => canWatchAffectingLocation,
261
+ canWatchAtTypes: () => canWatchAtTypes,
260
262
  canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
261
263
  cartesianProduct: () => cartesianProduct,
262
264
  cast: () => cast,
@@ -704,6 +706,8 @@ __export(server_exports, {
704
706
  getDiagnosticText: () => getDiagnosticText,
705
707
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
706
708
  getDirectoryPath: () => getDirectoryPath,
709
+ getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
710
+ getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
707
711
  getDocumentPositionMapper: () => getDocumentPositionMapper,
708
712
  getESModuleInterop: () => getESModuleInterop,
709
713
  getEditsForFileRename: () => getEditsForFileRename,
@@ -973,6 +977,7 @@ __export(server_exports, {
973
977
  getRestParameterElementType: () => getRestParameterElementType,
974
978
  getRightMostAssignedExpression: () => getRightMostAssignedExpression,
975
979
  getRootDeclaration: () => getRootDeclaration,
980
+ getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
976
981
  getRootLength: () => getRootLength,
977
982
  getScriptKind: () => getScriptKind,
978
983
  getScriptKindFromFileName: () => getScriptKindFromFileName,
@@ -2070,6 +2075,7 @@ __export(server_exports, {
2070
2075
  setValueDeclaration: () => setValueDeclaration,
2071
2076
  shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
2072
2077
  shouldPreserveConstEnums: () => shouldPreserveConstEnums,
2078
+ shouldResolveJsRequire: () => shouldResolveJsRequire,
2073
2079
  shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
2074
2080
  showModuleSpecifier: () => showModuleSpecifier,
2075
2081
  signatureHasLiteralTypes: () => signatureHasLiteralTypes,
@@ -2286,7 +2292,7 @@ module.exports = __toCommonJS(server_exports);
2286
2292
 
2287
2293
  // src/compiler/corePublic.ts
2288
2294
  var versionMajorMinor = "5.1";
2289
- var version = `${versionMajorMinor}.0-dev.20230331`;
2295
+ var version = `${versionMajorMinor}.0-dev.20230401`;
2290
2296
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2297
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2298
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -20328,6 +20334,9 @@ function getAllowSyntheticDefaultImports(compilerOptions) {
20328
20334
  function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
20329
20335
  return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
20330
20336
  }
20337
+ function shouldResolveJsRequire(compilerOptions) {
20338
+ return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
20339
+ }
20331
20340
  function getResolvePackageJsonExports(compilerOptions) {
20332
20341
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
20333
20342
  if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
@@ -38507,7 +38516,8 @@ var commandOptionsWithoutBuild = [
38507
38516
  affectsBuildInfo: true,
38508
38517
  category: Diagnostics.Modules,
38509
38518
  description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
38510
- defaultValueDescription: false
38519
+ defaultValueDescription: false,
38520
+ transpileOptionValue: void 0
38511
38521
  },
38512
38522
  {
38513
38523
  name: "resolvePackageJsonExports",
@@ -45886,7 +45896,7 @@ function createBinder() {
45886
45896
  }
45887
45897
  if (!isBindingPattern(node.name)) {
45888
45898
  const possibleVariableDecl = node.kind === 258 /* VariableDeclaration */ ? node : node.parent.parent;
45889
- if (isInJSFile(node) && getEmitModuleResolutionKind(options) !== 100 /* Bundler */ && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
45899
+ if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
45890
45900
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
45891
45901
  } else if (isBlockOrCatchScoped(node)) {
45892
45902
  bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
@@ -49545,7 +49555,7 @@ function createTypeChecker(host) {
49545
49555
  const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
49546
49556
  const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
49547
49557
  if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
49548
- if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
49558
+ if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
49549
49559
  const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
49550
49560
  const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
49551
49561
  const exportAssignment = exportEqualsSymbol.valueDeclaration;
@@ -49713,7 +49723,7 @@ function createTypeChecker(host) {
49713
49723
  if (!isIdentifier(name)) {
49714
49724
  return void 0;
49715
49725
  }
49716
- const suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || getESModuleInterop(compilerOptions));
49726
+ const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
49717
49727
  const targetSymbol = resolveESModuleSymbol(
49718
49728
  moduleSymbol,
49719
49729
  moduleSpecifier,
@@ -54355,7 +54365,7 @@ function createTypeChecker(host) {
54355
54365
  return;
54356
54366
  }
54357
54367
  let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
54358
- if (verbatimTargetName === "export=" /* ExportEquals */ && (getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
54368
+ if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
54359
54369
  verbatimTargetName = "default" /* Default */;
54360
54370
  }
54361
54371
  const targetName = getInternalSymbolName(target, verbatimTargetName);
@@ -75578,7 +75588,7 @@ function createTypeChecker(host) {
75578
75588
  return anyType;
75579
75589
  }
75580
75590
  }
75581
- if (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isCommonJsRequire(node)) {
75591
+ if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
75582
75592
  return resolveExternalModuleTypeByLiteral(node.arguments[0]);
75583
75593
  }
75584
75594
  const returnType = getReturnTypeOfSignature(signature);
@@ -119555,7 +119565,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119555
119565
  false
119556
119566
  );
119557
119567
  }
119558
- const shouldProcessRequires = isJavaScriptFile && getEmitModuleResolutionKind(options) !== 100 /* Bundler */;
119568
+ const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
119559
119569
  if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
119560
119570
  collectDynamicImportOrRequireCalls(file);
119561
119571
  }
@@ -123000,6 +123010,79 @@ function canWatchDirectoryOrFile(dirPath) {
123000
123010
  }
123001
123011
  return true;
123002
123012
  }
123013
+ function canWatchAtTypes(atTypes, rootPath) {
123014
+ const dirPath = getDirectoryPath(getDirectoryPath(atTypes));
123015
+ return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
123016
+ }
123017
+ function isInDirectoryPath(dir, file) {
123018
+ if (dir === void 0 || file.length <= dir.length) {
123019
+ return false;
123020
+ }
123021
+ return startsWith(file, dir) && file[dir.length] === directorySeparator;
123022
+ }
123023
+ function canWatchAffectingLocation(filePath) {
123024
+ return canWatchDirectoryOrFile(filePath);
123025
+ }
123026
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootSplitLength, getCurrentDirectory) {
123027
+ if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
123028
+ failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
123029
+ const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
123030
+ const failedLookupSplit = failedLookupLocation.split(directorySeparator);
123031
+ Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
123032
+ if (failedLookupPathSplit.length > rootSplitLength + 1) {
123033
+ return {
123034
+ dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
123035
+ dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
123036
+ };
123037
+ } else {
123038
+ return {
123039
+ dir: rootDir,
123040
+ dirPath: rootPath,
123041
+ nonRecursive: false
123042
+ };
123043
+ }
123044
+ }
123045
+ return getDirectoryToWatchFromFailedLookupLocationDirectory(
123046
+ getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
123047
+ getDirectoryPath(failedLookupLocationPath),
123048
+ rootPath
123049
+ );
123050
+ }
123051
+ function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath, rootPath) {
123052
+ while (pathContainsNodeModules(dirPath)) {
123053
+ dir = getDirectoryPath(dir);
123054
+ dirPath = getDirectoryPath(dirPath);
123055
+ }
123056
+ if (isNodeModulesDirectory(dirPath)) {
123057
+ return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
123058
+ }
123059
+ let nonRecursive = true;
123060
+ let subDirectoryPath, subDirectory;
123061
+ if (rootPath !== void 0) {
123062
+ while (!isInDirectoryPath(dirPath, rootPath)) {
123063
+ const parentPath = getDirectoryPath(dirPath);
123064
+ if (parentPath === dirPath) {
123065
+ break;
123066
+ }
123067
+ nonRecursive = false;
123068
+ subDirectoryPath = dirPath;
123069
+ subDirectory = dir;
123070
+ dirPath = parentPath;
123071
+ dir = getDirectoryPath(dir);
123072
+ }
123073
+ }
123074
+ return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
123075
+ }
123076
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, filterCustomPath) {
123077
+ if (isInDirectoryPath(rootPath, typeRootPath)) {
123078
+ return rootPath;
123079
+ }
123080
+ const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath, rootPath);
123081
+ return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
123082
+ }
123083
+ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
123084
+ return rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
123085
+ }
123003
123086
  function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
123004
123087
  let filesWithChangedSetOfUnresolvedImports;
123005
123088
  let filesWithInvalidatedResolutions;
@@ -123034,7 +123117,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123034
123117
  const customFailedLookupPaths = /* @__PURE__ */ new Map();
123035
123118
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
123036
123119
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
123037
- const rootDir = rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
123120
+ const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
123038
123121
  const rootPath = rootDir && resolutionHost.toPath(rootDir);
123039
123122
  const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0;
123040
123123
  const typeRootsWatches = /* @__PURE__ */ new Map();
@@ -123067,12 +123150,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123067
123150
  function getResolvedTypeReferenceDirective2(resolution) {
123068
123151
  return resolution.resolvedTypeReferenceDirective;
123069
123152
  }
123070
- function isInDirectoryPath(dir, file) {
123071
- if (dir === void 0 || file.length <= dir.length) {
123072
- return false;
123073
- }
123074
- return startsWith(file, dir) && file[dir.length] === directorySeparator;
123075
- }
123076
123153
  function clear2() {
123077
123154
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
123078
123155
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
@@ -123356,55 +123433,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123356
123433
  function isNodeModulesAtTypesDirectory(dirPath) {
123357
123434
  return endsWith(dirPath, "/node_modules/@types");
123358
123435
  }
123359
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath) {
123360
- if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
123361
- failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
123362
- const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
123363
- const failedLookupSplit = failedLookupLocation.split(directorySeparator);
123364
- Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
123365
- if (failedLookupPathSplit.length > rootSplitLength + 1) {
123366
- return {
123367
- dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
123368
- dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
123369
- };
123370
- } else {
123371
- return {
123372
- dir: rootDir,
123373
- dirPath: rootPath,
123374
- nonRecursive: false
123375
- };
123376
- }
123377
- }
123378
- return getDirectoryToWatchFromFailedLookupLocationDirectory(
123379
- getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
123380
- getDirectoryPath(failedLookupLocationPath)
123381
- );
123382
- }
123383
- function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
123384
- while (pathContainsNodeModules(dirPath)) {
123385
- dir = getDirectoryPath(dir);
123386
- dirPath = getDirectoryPath(dirPath);
123387
- }
123388
- if (isNodeModulesDirectory(dirPath)) {
123389
- return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
123390
- }
123391
- let nonRecursive = true;
123392
- let subDirectoryPath, subDirectory;
123393
- if (rootPath !== void 0) {
123394
- while (!isInDirectoryPath(dirPath, rootPath)) {
123395
- const parentPath = getDirectoryPath(dirPath);
123396
- if (parentPath === dirPath) {
123397
- break;
123398
- }
123399
- nonRecursive = false;
123400
- subDirectoryPath = dirPath;
123401
- subDirectory = dir;
123402
- dirPath = parentPath;
123403
- dir = getDirectoryPath(dir);
123404
- }
123405
- }
123406
- return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
123407
- }
123408
123436
  function isPathWithDefaultFailedLookupExtension(path) {
123409
123437
  return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
123410
123438
  }
@@ -123443,7 +123471,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123443
123471
  if (failedLookupLocations) {
123444
123472
  for (const failedLookupLocation of failedLookupLocations) {
123445
123473
  const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
123446
- const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
123474
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
123475
+ failedLookupLocation,
123476
+ failedLookupLocationPath,
123477
+ rootDir,
123478
+ rootPath,
123479
+ rootSplitLength,
123480
+ getCurrentDirectory
123481
+ );
123447
123482
  if (toWatch) {
123448
123483
  const { dir, dirPath, nonRecursive } = toWatch;
123449
123484
  if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
@@ -123511,7 +123546,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123511
123546
  }
123512
123547
  const paths = /* @__PURE__ */ new Set();
123513
123548
  paths.add(locationToWatch);
123514
- let actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
123549
+ let actualWatcher = canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
123515
123550
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
123516
123551
  const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
123517
123552
  paths.forEach((path) => {
@@ -123579,7 +123614,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123579
123614
  let removeAtRoot = false;
123580
123615
  for (const failedLookupLocation of failedLookupLocations) {
123581
123616
  const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
123582
- const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
123617
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
123618
+ failedLookupLocation,
123619
+ failedLookupLocationPath,
123620
+ rootDir,
123621
+ rootPath,
123622
+ rootSplitLength,
123623
+ getCurrentDirectory
123624
+ );
123583
123625
  if (toWatch) {
123584
123626
  const { dirPath } = toWatch;
123585
123627
  const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
@@ -123747,13 +123789,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123747
123789
  function closeTypeRootsWatch() {
123748
123790
  clearMap(typeRootsWatches, closeFileWatcher);
123749
123791
  }
123750
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
123751
- if (isInDirectoryPath(rootPath, typeRootPath)) {
123752
- return rootPath;
123753
- }
123754
- const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath);
123755
- return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
123756
- }
123757
123792
  function createTypeRootsWatch(typeRootPath, typeRoot) {
123758
123793
  return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
123759
123794
  const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
@@ -123762,7 +123797,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123762
123797
  }
123763
123798
  hasChangedAutomaticTypeDirectiveNames = true;
123764
123799
  resolutionHost.onChangedAutomaticTypeDirectiveNames();
123765
- const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
123800
+ const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
123801
+ typeRoot,
123802
+ typeRootPath,
123803
+ rootPath,
123804
+ (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
123805
+ );
123766
123806
  if (dirPath) {
123767
123807
  scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
123768
123808
  }
@@ -123788,12 +123828,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123788
123828
  closeTypeRootsWatch();
123789
123829
  }
123790
123830
  }
123791
- function canWatchTypeRootPath(nodeTypesDirectory) {
123831
+ function canWatchTypeRootPath(typeRoot) {
123792
123832
  if (resolutionHost.getCompilationSettings().typeRoots)
123793
123833
  return true;
123794
- const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
123795
- const dirPath = resolutionHost.toPath(dir);
123796
- return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
123834
+ return canWatchAtTypes(resolutionHost.toPath(typeRoot), rootPath);
123797
123835
  }
123798
123836
  }
123799
123837
  function resolutionIsSymlink(resolution) {
@@ -130721,7 +130759,7 @@ function createCacheableExportInfoMap(host) {
130721
130759
  // Adding or removing imports from node could change the outcome of that guess, so could change the suggestions list.
130722
130760
  typeAcquisitionEnabled && consumesNodeCoreModules(oldSourceFile) !== consumesNodeCoreModules(newSourceFile) || // Module agumentation and ambient module changes can add or remove exports available to be auto-imported.
130723
130761
  // Changes elsewhere in the file can change the *type* of an export in a module augmentation,
130724
- // but type info is gathered in getCompletionEntryDetails, which doesnt use the cache.
130762
+ // but type info is gathered in getCompletionEntryDetails, which doesn't use the cache.
130725
130763
  !arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations) || !ambientModuleDeclarationsAreEqual(oldSourceFile, newSourceFile)) {
130726
130764
  cache.clear();
130727
130765
  return true;
@@ -139390,7 +139428,7 @@ function getIdentifiersFromErrorSpanExpression(expression, checker) {
139390
139428
  function symbolReferenceIsAlsoMissingAwait(reference, diagnostics, sourceFile, checker) {
139391
139429
  const errorNode = isPropertyAccessExpression(reference.parent) ? reference.parent.name : isBinaryExpression(reference.parent) ? reference.parent : reference;
139392
139430
  const diagnostic = find(diagnostics, (diagnostic2) => diagnostic2.start === errorNode.getStart(sourceFile) && diagnostic2.start + diagnostic2.length === errorNode.getEnd());
139393
- return diagnostic && contains(errorCodes3, diagnostic.code) || // A Promise is usually not correct in a binary expression (its not valid
139431
+ return diagnostic && contains(errorCodes3, diagnostic.code) || // A Promise is usually not correct in a binary expression (it's not valid
139394
139432
  // in an arithmetic expression and an equality comparison seems unusual),
139395
139433
  // but if the other side of the binary expression has an error, the side
139396
139434
  // is typed `any` which will squash the error that would identify this
@@ -154636,7 +154674,7 @@ var Core;
154636
154674
  */
154637
154675
  this.markSeenReExportRHS = nodeSeenTracker();
154638
154676
  this.symbolIdToReferences = [];
154639
- // Source file ID symbol ID Whether the symbol has been searched for in the source file.
154677
+ // Source file ID -> symbol ID -> Whether the symbol has been searched for in the source file.
154640
154678
  this.sourceFileToSeenSymbols = [];
154641
154679
  }
154642
154680
  includesSourceFile(sourceFile) {
@@ -163477,7 +163515,7 @@ function getSmartSelectionRange(pos, sourceFile) {
163477
163515
  if (start2 !== end) {
163478
163516
  const textSpan = createTextSpanFromBounds(start2, end);
163479
163517
  if (!selectionRange || // Skip ranges that are identical to the parent
163480
- !textSpansEqual(textSpan, selectionRange.textSpan) && // Skip ranges that dont contain the original position
163518
+ !textSpansEqual(textSpan, selectionRange.textSpan) && // Skip ranges that don't contain the original position
163481
163519
  textSpanIntersectsWithPosition(textSpan, pos)) {
163482
163520
  selectionRange = { textSpan, ...selectionRange && { parent: selectionRange } };
163483
163521
  }
@@ -168528,6 +168566,8 @@ __export(ts_exports2, {
168528
168566
  canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
168529
168567
  canProduceDiagnostics: () => canProduceDiagnostics,
168530
168568
  canUsePropertyAccess: () => canUsePropertyAccess,
168569
+ canWatchAffectingLocation: () => canWatchAffectingLocation,
168570
+ canWatchAtTypes: () => canWatchAtTypes,
168531
168571
  canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
168532
168572
  cartesianProduct: () => cartesianProduct,
168533
168573
  cast: () => cast,
@@ -168975,6 +169015,8 @@ __export(ts_exports2, {
168975
169015
  getDiagnosticText: () => getDiagnosticText,
168976
169016
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
168977
169017
  getDirectoryPath: () => getDirectoryPath,
169018
+ getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation,
169019
+ getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot,
168978
169020
  getDocumentPositionMapper: () => getDocumentPositionMapper,
168979
169021
  getESModuleInterop: () => getESModuleInterop,
168980
169022
  getEditsForFileRename: () => getEditsForFileRename,
@@ -169244,6 +169286,7 @@ __export(ts_exports2, {
169244
169286
  getRestParameterElementType: () => getRestParameterElementType,
169245
169287
  getRightMostAssignedExpression: () => getRightMostAssignedExpression,
169246
169288
  getRootDeclaration: () => getRootDeclaration,
169289
+ getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache,
169247
169290
  getRootLength: () => getRootLength,
169248
169291
  getScriptKind: () => getScriptKind,
169249
169292
  getScriptKindFromFileName: () => getScriptKindFromFileName,
@@ -170341,6 +170384,7 @@ __export(ts_exports2, {
170341
170384
  setValueDeclaration: () => setValueDeclaration,
170342
170385
  shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
170343
170386
  shouldPreserveConstEnums: () => shouldPreserveConstEnums,
170387
+ shouldResolveJsRequire: () => shouldResolveJsRequire,
170344
170388
  shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
170345
170389
  showModuleSpecifier: () => showModuleSpecifier,
170346
170390
  signatureHasLiteralTypes: () => signatureHasLiteralTypes,
@@ -182494,6 +182538,8 @@ start(initializeNodeSystem(), require("os").platform());
182494
182538
  canJsonReportNoInputFiles,
182495
182539
  canProduceDiagnostics,
182496
182540
  canUsePropertyAccess,
182541
+ canWatchAffectingLocation,
182542
+ canWatchAtTypes,
182497
182543
  canWatchDirectoryOrFile,
182498
182544
  cartesianProduct,
182499
182545
  cast,
@@ -182941,6 +182987,8 @@ start(initializeNodeSystem(), require("os").platform());
182941
182987
  getDiagnosticText,
182942
182988
  getDiagnosticsWithinSpan,
182943
182989
  getDirectoryPath,
182990
+ getDirectoryToWatchFailedLookupLocation,
182991
+ getDirectoryToWatchFailedLookupLocationFromTypeRoot,
182944
182992
  getDocumentPositionMapper,
182945
182993
  getESModuleInterop,
182946
182994
  getEditsForFileRename,
@@ -183210,6 +183258,7 @@ start(initializeNodeSystem(), require("os").platform());
183210
183258
  getRestParameterElementType,
183211
183259
  getRightMostAssignedExpression,
183212
183260
  getRootDeclaration,
183261
+ getRootDirectoryOfResolutionCache,
183213
183262
  getRootLength,
183214
183263
  getScriptKind,
183215
183264
  getScriptKindFromFileName,
@@ -184307,6 +184356,7 @@ start(initializeNodeSystem(), require("os").platform());
184307
184356
  setValueDeclaration,
184308
184357
  shouldAllowImportingTsExtension,
184309
184358
  shouldPreserveConstEnums,
184359
+ shouldResolveJsRequire,
184310
184360
  shouldUseUriStyleNodeCoreModules,
184311
184361
  showModuleSpecifier,
184312
184362
  signatureHasLiteralTypes,