typescript 5.1.0-dev.20230330 → 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/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.1";
21
- var version = `${versionMajorMinor}.0-dev.20230330`;
21
+ var version = `${versionMajorMinor}.0-dev.20230401`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -4076,7 +4076,7 @@ function createDynamicPriorityPollingWatchFile(host) {
4076
4076
  queue.pollScheduled = false;
4077
4077
  return queue;
4078
4078
  }
4079
- function pollPollingIntervalQueue(queue) {
4079
+ function pollPollingIntervalQueue(_timeoutType, queue) {
4080
4080
  queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]);
4081
4081
  if (queue.length) {
4082
4082
  scheduleNextPoll(queue.pollingInterval);
@@ -4085,7 +4085,7 @@ function createDynamicPriorityPollingWatchFile(host) {
4085
4085
  queue.pollScheduled = false;
4086
4086
  }
4087
4087
  }
4088
- function pollLowPollingIntervalQueue(queue) {
4088
+ function pollLowPollingIntervalQueue(_timeoutType, queue) {
4089
4089
  pollQueue(
4090
4090
  changedFilesInLastPoll,
4091
4091
  250 /* Low */,
@@ -4093,7 +4093,7 @@ function createDynamicPriorityPollingWatchFile(host) {
4093
4093
  0,
4094
4094
  changedFilesInLastPoll.length
4095
4095
  );
4096
- pollPollingIntervalQueue(queue);
4096
+ pollPollingIntervalQueue(_timeoutType, queue);
4097
4097
  if (!queue.pollScheduled && changedFilesInLastPoll.length) {
4098
4098
  scheduleNextPoll(250 /* Low */);
4099
4099
  }
@@ -4150,7 +4150,7 @@ function createDynamicPriorityPollingWatchFile(host) {
4150
4150
  }
4151
4151
  }
4152
4152
  function scheduleNextPoll(pollingInterval) {
4153
- pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval));
4153
+ pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval));
4154
4154
  }
4155
4155
  }
4156
4156
  function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) {
@@ -4229,7 +4229,7 @@ function createFixedChunkSizePollingWatchFile(host) {
4229
4229
  function scheduleNextPoll() {
4230
4230
  if (!watchedFiles.length || pollScheduled)
4231
4231
  return;
4232
- pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */);
4232
+ pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue");
4233
4233
  }
4234
4234
  }
4235
4235
  function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) {
@@ -4397,7 +4397,7 @@ function createDirectoryWatcherSupportingRecursive({
4397
4397
  clearTimeout2(timerToUpdateChildWatches);
4398
4398
  timerToUpdateChildWatches = void 0;
4399
4399
  }
4400
- timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3);
4400
+ timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches");
4401
4401
  }
4402
4402
  function onTimerToUpdateChildWatches() {
4403
4403
  timerToUpdateChildWatches = void 0;
@@ -6216,7 +6216,6 @@ var Diagnostics = {
6216
6216
  Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, 1 /* Error */, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."),
6217
6217
  A_get_accessor_must_return_a_value: diag(2378, 1 /* Error */, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."),
6218
6218
  Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."),
6219
- The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, 1 /* Error */, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"),
6220
6219
  Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, 1 /* Error */, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."),
6221
6220
  Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, 1 /* Error */, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."),
6222
6221
  Overload_signatures_must_all_be_public_private_or_protected: diag(2385, 1 /* Error */, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."),
@@ -16220,6 +16219,9 @@ function getAllowSyntheticDefaultImports(compilerOptions) {
16220
16219
  function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
16221
16220
  return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
16222
16221
  }
16222
+ function shouldResolveJsRequire(compilerOptions) {
16223
+ return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
16224
+ }
16223
16225
  function getResolvePackageJsonExports(compilerOptions) {
16224
16226
  const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
16225
16227
  if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
@@ -34132,7 +34134,8 @@ var commandOptionsWithoutBuild = [
34132
34134
  affectsBuildInfo: true,
34133
34135
  category: Diagnostics.Modules,
34134
34136
  description: Diagnostics.Allow_imports_to_include_TypeScript_file_extensions_Requires_moduleResolution_bundler_and_either_noEmit_or_emitDeclarationOnly_to_be_set,
34135
- defaultValueDescription: false
34137
+ defaultValueDescription: false,
34138
+ transpileOptionValue: void 0
34136
34139
  },
34137
34140
  {
34138
34141
  name: "resolvePackageJsonExports",
@@ -41293,7 +41296,7 @@ function createBinder() {
41293
41296
  }
41294
41297
  if (!isBindingPattern(node.name)) {
41295
41298
  const possibleVariableDecl = node.kind === 258 /* VariableDeclaration */ ? node : node.parent.parent;
41296
- if (isInJSFile(node) && getEmitModuleResolutionKind(options) !== 100 /* Bundler */ && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
41299
+ if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) {
41297
41300
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
41298
41301
  } else if (isBlockOrCatchScoped(node)) {
41299
41302
  bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
@@ -44904,7 +44907,7 @@ function createTypeChecker(host) {
44904
44907
  const hasDefaultOnly = isOnlyImportedAsDefault(specifier);
44905
44908
  const hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, specifier);
44906
44909
  if (!exportDefaultSymbol && !hasSyntheticDefault && !hasDefaultOnly) {
44907
- if (hasExportAssignmentSymbol(moduleSymbol) && !(getAllowSyntheticDefaultImports(compilerOptions) || getESModuleInterop(compilerOptions))) {
44910
+ if (hasExportAssignmentSymbol(moduleSymbol) && !allowSyntheticDefaultImports) {
44908
44911
  const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop";
44909
44912
  const exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
44910
44913
  const exportAssignment = exportEqualsSymbol.valueDeclaration;
@@ -45072,7 +45075,7 @@ function createTypeChecker(host) {
45072
45075
  if (!isIdentifier(name)) {
45073
45076
  return void 0;
45074
45077
  }
45075
- const suppressInteropError = name.escapedText === "default" /* Default */ && !!(compilerOptions.allowSyntheticDefaultImports || getESModuleInterop(compilerOptions));
45078
+ const suppressInteropError = name.escapedText === "default" /* Default */ && allowSyntheticDefaultImports;
45076
45079
  const targetSymbol = resolveESModuleSymbol(
45077
45080
  moduleSymbol,
45078
45081
  moduleSpecifier,
@@ -49714,7 +49717,7 @@ function createTypeChecker(host) {
49714
49717
  return;
49715
49718
  }
49716
49719
  let verbatimTargetName = isShorthandAmbientModuleSymbol(target) && getSomeTargetNameFromDeclarations(symbol.declarations) || unescapeLeadingUnderscores(target.escapedName);
49717
- if (verbatimTargetName === "export=" /* ExportEquals */ && (getESModuleInterop(compilerOptions) || compilerOptions.allowSyntheticDefaultImports)) {
49720
+ if (verbatimTargetName === "export=" /* ExportEquals */ && allowSyntheticDefaultImports) {
49718
49721
  verbatimTargetName = "default" /* Default */;
49719
49722
  }
49720
49723
  const targetName = getInternalSymbolName(target, verbatimTargetName);
@@ -70937,7 +70940,7 @@ function createTypeChecker(host) {
70937
70940
  return anyType;
70938
70941
  }
70939
70942
  }
70940
- if (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isCommonJsRequire(node)) {
70943
+ if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
70941
70944
  return resolveExternalModuleTypeByLiteral(node.arguments[0]);
70942
70945
  }
70943
70946
  const returnType = getReturnTypeOfSignature(signature);
@@ -74642,11 +74645,6 @@ function createTypeChecker(host) {
74642
74645
  error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
74643
74646
  error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter);
74644
74647
  }
74645
- const getterType = getAnnotatedAccessorType(getter);
74646
- const setterType = getAnnotatedAccessorType(setter);
74647
- if (getterType && setterType) {
74648
- checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type);
74649
- }
74650
74648
  }
74651
74649
  }
74652
74650
  const returnType = getTypeOfAccessors(getSymbolOfDeclaration(node));
@@ -114683,7 +114681,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
114683
114681
  false
114684
114682
  );
114685
114683
  }
114686
- const shouldProcessRequires = isJavaScriptFile && getEmitModuleResolutionKind(options) !== 100 /* Bundler */;
114684
+ const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
114687
114685
  if (file.flags & 2097152 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
114688
114686
  collectDynamicImportOrRequireCalls(file);
114689
114687
  }
@@ -118096,6 +118094,79 @@ function canWatchDirectoryOrFile(dirPath) {
118096
118094
  }
118097
118095
  return true;
118098
118096
  }
118097
+ function canWatchAtTypes(atTypes, rootPath) {
118098
+ const dirPath = getDirectoryPath(getDirectoryPath(atTypes));
118099
+ return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
118100
+ }
118101
+ function isInDirectoryPath(dir, file) {
118102
+ if (dir === void 0 || file.length <= dir.length) {
118103
+ return false;
118104
+ }
118105
+ return startsWith(file, dir) && file[dir.length] === directorySeparator;
118106
+ }
118107
+ function canWatchAffectingLocation(filePath) {
118108
+ return canWatchDirectoryOrFile(filePath);
118109
+ }
118110
+ function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootSplitLength, getCurrentDirectory) {
118111
+ if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
118112
+ failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
118113
+ const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
118114
+ const failedLookupSplit = failedLookupLocation.split(directorySeparator);
118115
+ Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
118116
+ if (failedLookupPathSplit.length > rootSplitLength + 1) {
118117
+ return {
118118
+ dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
118119
+ dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
118120
+ };
118121
+ } else {
118122
+ return {
118123
+ dir: rootDir,
118124
+ dirPath: rootPath,
118125
+ nonRecursive: false
118126
+ };
118127
+ }
118128
+ }
118129
+ return getDirectoryToWatchFromFailedLookupLocationDirectory(
118130
+ getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
118131
+ getDirectoryPath(failedLookupLocationPath),
118132
+ rootPath
118133
+ );
118134
+ }
118135
+ function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath, rootPath) {
118136
+ while (pathContainsNodeModules(dirPath)) {
118137
+ dir = getDirectoryPath(dir);
118138
+ dirPath = getDirectoryPath(dirPath);
118139
+ }
118140
+ if (isNodeModulesDirectory(dirPath)) {
118141
+ return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
118142
+ }
118143
+ let nonRecursive = true;
118144
+ let subDirectoryPath, subDirectory;
118145
+ if (rootPath !== void 0) {
118146
+ while (!isInDirectoryPath(dirPath, rootPath)) {
118147
+ const parentPath = getDirectoryPath(dirPath);
118148
+ if (parentPath === dirPath) {
118149
+ break;
118150
+ }
118151
+ nonRecursive = false;
118152
+ subDirectoryPath = dirPath;
118153
+ subDirectory = dir;
118154
+ dirPath = parentPath;
118155
+ dir = getDirectoryPath(dir);
118156
+ }
118157
+ }
118158
+ return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
118159
+ }
118160
+ function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, filterCustomPath) {
118161
+ if (isInDirectoryPath(rootPath, typeRootPath)) {
118162
+ return rootPath;
118163
+ }
118164
+ const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath, rootPath);
118165
+ return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0;
118166
+ }
118167
+ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) {
118168
+ return rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
118169
+ }
118099
118170
  function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
118100
118171
  let filesWithChangedSetOfUnresolvedImports;
118101
118172
  let filesWithInvalidatedResolutions;
@@ -118130,7 +118201,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118130
118201
  const customFailedLookupPaths = /* @__PURE__ */ new Map();
118131
118202
  const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map();
118132
118203
  const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map();
118133
- const rootDir = rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()));
118204
+ const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory);
118134
118205
  const rootPath = rootDir && resolutionHost.toPath(rootDir);
118135
118206
  const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0;
118136
118207
  const typeRootsWatches = /* @__PURE__ */ new Map();
@@ -118163,12 +118234,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118163
118234
  function getResolvedTypeReferenceDirective(resolution) {
118164
118235
  return resolution.resolvedTypeReferenceDirective;
118165
118236
  }
118166
- function isInDirectoryPath(dir, file) {
118167
- if (dir === void 0 || file.length <= dir.length) {
118168
- return false;
118169
- }
118170
- return startsWith(file, dir) && file[dir.length] === directorySeparator;
118171
- }
118172
118237
  function clear2() {
118173
118238
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
118174
118239
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
@@ -118452,55 +118517,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118452
118517
  function isNodeModulesAtTypesDirectory(dirPath) {
118453
118518
  return endsWith(dirPath, "/node_modules/@types");
118454
118519
  }
118455
- function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath) {
118456
- if (isInDirectoryPath(rootPath, failedLookupLocationPath)) {
118457
- failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory());
118458
- const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator);
118459
- const failedLookupSplit = failedLookupLocation.split(directorySeparator);
118460
- Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`);
118461
- if (failedLookupPathSplit.length > rootSplitLength + 1) {
118462
- return {
118463
- dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator),
118464
- dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator)
118465
- };
118466
- } else {
118467
- return {
118468
- dir: rootDir,
118469
- dirPath: rootPath,
118470
- nonRecursive: false
118471
- };
118472
- }
118473
- }
118474
- return getDirectoryToWatchFromFailedLookupLocationDirectory(
118475
- getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())),
118476
- getDirectoryPath(failedLookupLocationPath)
118477
- );
118478
- }
118479
- function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) {
118480
- while (pathContainsNodeModules(dirPath)) {
118481
- dir = getDirectoryPath(dir);
118482
- dirPath = getDirectoryPath(dirPath);
118483
- }
118484
- if (isNodeModulesDirectory(dirPath)) {
118485
- return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0;
118486
- }
118487
- let nonRecursive = true;
118488
- let subDirectoryPath, subDirectory;
118489
- if (rootPath !== void 0) {
118490
- while (!isInDirectoryPath(dirPath, rootPath)) {
118491
- const parentPath = getDirectoryPath(dirPath);
118492
- if (parentPath === dirPath) {
118493
- break;
118494
- }
118495
- nonRecursive = false;
118496
- subDirectoryPath = dirPath;
118497
- subDirectory = dir;
118498
- dirPath = parentPath;
118499
- dir = getDirectoryPath(dir);
118500
- }
118501
- }
118502
- return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0;
118503
- }
118504
118520
  function isPathWithDefaultFailedLookupExtension(path) {
118505
118521
  return fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
118506
118522
  }
@@ -118539,7 +118555,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118539
118555
  if (failedLookupLocations) {
118540
118556
  for (const failedLookupLocation of failedLookupLocations) {
118541
118557
  const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
118542
- const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
118558
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
118559
+ failedLookupLocation,
118560
+ failedLookupLocationPath,
118561
+ rootDir,
118562
+ rootPath,
118563
+ rootSplitLength,
118564
+ getCurrentDirectory
118565
+ );
118543
118566
  if (toWatch) {
118544
118567
  const { dir, dirPath, nonRecursive } = toWatch;
118545
118568
  if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) {
@@ -118607,7 +118630,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118607
118630
  }
118608
118631
  const paths = /* @__PURE__ */ new Set();
118609
118632
  paths.add(locationToWatch);
118610
- let actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
118633
+ let actualWatcher = canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
118611
118634
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
118612
118635
  const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
118613
118636
  paths.forEach((path) => {
@@ -118675,7 +118698,14 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118675
118698
  let removeAtRoot = false;
118676
118699
  for (const failedLookupLocation of failedLookupLocations) {
118677
118700
  const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
118678
- const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath);
118701
+ const toWatch = getDirectoryToWatchFailedLookupLocation(
118702
+ failedLookupLocation,
118703
+ failedLookupLocationPath,
118704
+ rootDir,
118705
+ rootPath,
118706
+ rootSplitLength,
118707
+ getCurrentDirectory
118708
+ );
118679
118709
  if (toWatch) {
118680
118710
  const { dirPath } = toWatch;
118681
118711
  const refCount = customFailedLookupPaths.get(failedLookupLocationPath);
@@ -118843,13 +118873,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118843
118873
  function closeTypeRootsWatch() {
118844
118874
  clearMap(typeRootsWatches, closeFileWatcher);
118845
118875
  }
118846
- function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) {
118847
- if (isInDirectoryPath(rootPath, typeRootPath)) {
118848
- return rootPath;
118849
- }
118850
- const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath);
118851
- return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
118852
- }
118853
118876
  function createTypeRootsWatch(typeRootPath, typeRoot) {
118854
118877
  return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
118855
118878
  const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
@@ -118858,7 +118881,12 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118858
118881
  }
118859
118882
  hasChangedAutomaticTypeDirectiveNames = true;
118860
118883
  resolutionHost.onChangedAutomaticTypeDirectiveNames();
118861
- const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath);
118884
+ const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(
118885
+ typeRoot,
118886
+ typeRootPath,
118887
+ rootPath,
118888
+ (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2)
118889
+ );
118862
118890
  if (dirPath) {
118863
118891
  scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
118864
118892
  }
@@ -118884,12 +118912,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
118884
118912
  closeTypeRootsWatch();
118885
118913
  }
118886
118914
  }
118887
- function canWatchTypeRootPath(nodeTypesDirectory) {
118915
+ function canWatchTypeRootPath(typeRoot) {
118888
118916
  if (resolutionHost.getCompilationSettings().typeRoots)
118889
118917
  return true;
118890
- const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
118891
- const dirPath = resolutionHost.toPath(dir);
118892
- return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
118918
+ return canWatchAtTypes(resolutionHost.toPath(typeRoot), rootPath);
118893
118919
  }
118894
118920
  }
118895
118921
  function resolutionIsSymlink(resolution) {
@@ -119924,7 +119950,7 @@ function createWatchProgram(host) {
119924
119950
  }
119925
119951
  const pending = clearInvalidateResolutionsOfFailedLookupLocations();
119926
119952
  writeLog(`Scheduling invalidateFailedLookup${pending ? ", Cancelled earlier one" : ""}`);
119927
- timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250);
119953
+ timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions");
119928
119954
  }
119929
119955
  function invalidateResolutionsOfFailedLookup() {
119930
119956
  timerToInvalidateFailedLookupResolutions = void 0;
@@ -119940,7 +119966,7 @@ function createWatchProgram(host) {
119940
119966
  host.clearTimeout(timerToUpdateProgram);
119941
119967
  }
119942
119968
  writeLog("Scheduling update");
119943
- timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250);
119969
+ timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250, "timerToUpdateProgram");
119944
119970
  }
119945
119971
  function scheduleProgramReload() {
119946
119972
  Debug.assert(!!configFileName);
@@ -121818,9 +121844,9 @@ function scheduleBuildInvalidatedProject(state, time, changeDetected) {
121818
121844
  if (state.timerToBuildInvalidatedProject) {
121819
121845
  hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject);
121820
121846
  }
121821
- state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
121847
+ state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, "timerToBuildInvalidatedProject", state, changeDetected);
121822
121848
  }
121823
- function buildNextInvalidatedProject(state, changeDetected) {
121849
+ function buildNextInvalidatedProject(_timeoutType, state, changeDetected) {
121824
121850
  mark("SolutionBuilder::beforeBuild");
121825
121851
  const buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
121826
121852
  mark("SolutionBuilder::afterBuild");