@typescript-deploys/pr-build 5.3.0-pr-56020-20 → 5.3.0-pr-56072-6

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
@@ -58,7 +58,6 @@ __export(server_exports, {
58
58
  CompletionInfoFlags: () => CompletionInfoFlags,
59
59
  CompletionTriggerKind: () => CompletionTriggerKind,
60
60
  Completions: () => ts_Completions_exports,
61
- ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
62
61
  ContainerFlags: () => ContainerFlags,
63
62
  ContextFlags: () => ContextFlags,
64
63
  Debug: () => Debug,
@@ -145,6 +144,7 @@ __export(server_exports, {
145
144
  PragmaKindFlags: () => PragmaKindFlags,
146
145
  PrivateIdentifierKind: () => PrivateIdentifierKind,
147
146
  ProcessLevel: () => ProcessLevel,
147
+ ProgramUpdateLevel: () => ProgramUpdateLevel,
148
148
  QuotePreference: () => QuotePreference,
149
149
  RelationComparisonResult: () => RelationComparisonResult,
150
150
  Rename: () => ts_Rename_exports,
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(server_exports);
2328
2328
 
2329
2329
  // src/compiler/corePublic.ts
2330
2330
  var versionMajorMinor = "5.3";
2331
- var version = `${versionMajorMinor}.0-insiders.20231009`;
2331
+ var version = `${versionMajorMinor}.0-insiders.20231011`;
2332
2332
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2333
2333
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2334
2334
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -41393,7 +41393,7 @@ function resolvedTypeScriptOnly(resolved) {
41393
41393
  Debug.assert(extensionIsTS(resolved.extension));
41394
41394
  return { fileName: resolved.path, packageId: resolved.packageId };
41395
41395
  }
41396
- function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
41396
+ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache, legacyResult) {
41397
41397
  if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
41398
41398
  const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
41399
41399
  if (originalPath)
@@ -41406,15 +41406,25 @@ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName
41406
41406
  affectingLocations,
41407
41407
  diagnostics,
41408
41408
  state.resultFromCache,
41409
+ cache,
41409
41410
  legacyResult
41410
41411
  );
41411
41412
  }
41412
- function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
41413
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache, legacyResult) {
41413
41414
  if (resultFromCache) {
41414
- resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
41415
- resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
41416
- resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
41417
- return resultFromCache;
41415
+ if (!(cache == null ? void 0 : cache.isReadonly)) {
41416
+ resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
41417
+ resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
41418
+ resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
41419
+ return resultFromCache;
41420
+ } else {
41421
+ return {
41422
+ ...resultFromCache,
41423
+ failedLookupLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.failedLookupLocations, failedLookupLocations),
41424
+ affectingLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.affectingLocations, affectingLocations),
41425
+ resolutionDiagnostics: initializeResolutionFieldForReadonlyCache(resultFromCache.resolutionDiagnostics, diagnostics)
41426
+ };
41427
+ }
41418
41428
  }
41419
41429
  return {
41420
41430
  resolvedModule: resolved && {
@@ -41442,6 +41452,13 @@ function updateResolutionField(to, value) {
41442
41452
  to.push(...value);
41443
41453
  return to;
41444
41454
  }
41455
+ function initializeResolutionFieldForReadonlyCache(fromCache, value) {
41456
+ if (!(fromCache == null ? void 0 : fromCache.length))
41457
+ return initializeResolutionField(value);
41458
+ if (!value.length)
41459
+ return fromCache.slice();
41460
+ return [...fromCache, ...value];
41461
+ }
41445
41462
  function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
41446
41463
  if (!hasProperty(jsonContent, fieldName)) {
41447
41464
  if (state.traceEnabled) {
@@ -41669,15 +41686,15 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
41669
41686
  affectingLocations: initializeResolutionField(affectingLocations),
41670
41687
  resolutionDiagnostics: initializeResolutionField(diagnostics)
41671
41688
  };
41672
- if (containingDirectory) {
41673
- cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
41689
+ if (containingDirectory && cache && !cache.isReadonly) {
41690
+ cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
41674
41691
  typeReferenceDirectiveName,
41675
41692
  /*mode*/
41676
41693
  resolutionMode,
41677
41694
  result
41678
41695
  );
41679
41696
  if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
41680
- cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
41697
+ cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
41681
41698
  }
41682
41699
  }
41683
41700
  if (traceEnabled)
@@ -41884,7 +41901,8 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
41884
41901
  getMapOfCacheRedirects,
41885
41902
  getOrCreateMapOfCacheRedirects,
41886
41903
  update,
41887
- clear: clear2
41904
+ clear: clear2,
41905
+ getOwnMap: () => ownMap
41888
41906
  };
41889
41907
  function getMapOfCacheRedirects(redirectedReference) {
41890
41908
  return redirectedReference ? getOrCreateMap(
@@ -41991,7 +42009,8 @@ function createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileNam
41991
42009
  getFromDirectoryCache,
41992
42010
  getOrCreateCacheForDirectory,
41993
42011
  clear: clear2,
41994
- update
42012
+ update,
42013
+ directoryToModuleNameMap
41995
42014
  };
41996
42015
  function clear2() {
41997
42016
  directoryToModuleNameMap.clear();
@@ -42265,9 +42284,11 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
42265
42284
  if (result && result.resolvedModule)
42266
42285
  (_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
42267
42286
  (_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
42268
- cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
42269
- if (!isExternalModuleNameRelative(moduleName)) {
42270
- cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
42287
+ if (cache && !cache.isReadonly) {
42288
+ cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
42289
+ if (!isExternalModuleNameRelative(moduleName)) {
42290
+ cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
42291
+ }
42271
42292
  }
42272
42293
  }
42273
42294
  if (traceEnabled) {
@@ -42582,6 +42603,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
42582
42603
  affectingLocations,
42583
42604
  diagnostics,
42584
42605
  state,
42606
+ cache,
42585
42607
  legacyResult
42586
42608
  );
42587
42609
  function tryResolve(extensions2, state2) {
@@ -42983,7 +43005,7 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
42983
43005
  return packageJsonInfo.contents.versionPaths || void 0;
42984
43006
  }
42985
43007
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
42986
- var _a, _b, _c, _d, _e, _f, _g, _h;
43008
+ var _a, _b, _c, _d, _e, _f;
42987
43009
  const { host, traceEnabled } = state;
42988
43010
  const packageJsonPath = combinePaths(packageDirectory, "package.json");
42989
43011
  if (onlyRecordFailures) {
@@ -43011,15 +43033,17 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
43011
43033
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
43012
43034
  }
43013
43035
  const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
43014
- (_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
43015
- (_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
43036
+ if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
43037
+ state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, result);
43038
+ (_e = state.affectingLocations) == null ? void 0 : _e.push(packageJsonPath);
43016
43039
  return result;
43017
43040
  } else {
43018
43041
  if (directoryExists && traceEnabled) {
43019
43042
  trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
43020
43043
  }
43021
- (_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
43022
- (_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
43044
+ if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
43045
+ state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
43046
+ (_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
43023
43047
  }
43024
43048
  }
43025
43049
  function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
@@ -43809,7 +43833,8 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
43809
43833
  failedLookupLocations,
43810
43834
  affectingLocations,
43811
43835
  diagnostics,
43812
- state
43836
+ state,
43837
+ cache
43813
43838
  );
43814
43839
  function tryResolve(extensions) {
43815
43840
  const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -43928,7 +43953,9 @@ function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, hos
43928
43953
  failedLookupLocations,
43929
43954
  affectingLocations,
43930
43955
  diagnostics,
43931
- state.resultFromCache
43956
+ state.resultFromCache,
43957
+ /*cache*/
43958
+ void 0
43932
43959
  );
43933
43960
  }
43934
43961
  function toSearchResult(value) {
@@ -71147,7 +71174,25 @@ function createTypeChecker(host) {
71147
71174
  const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
71148
71175
  const directlyRelated = mapType(
71149
71176
  matching || type,
71150
- checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType
71177
+ checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => {
71178
+ if (t.flags & 2944 /* Literal */ && c.flags & 2944 /* Literal */) {
71179
+ if (t.flags & 512 /* BooleanLiteral */ && c.flags & 512 /* BooleanLiteral */) {
71180
+ return t === c ? t : neverType;
71181
+ }
71182
+ return t.value === c.value ? t : neverType;
71183
+ }
71184
+ if (isTypeStrictSubtypeOf(t, c))
71185
+ return t;
71186
+ if (isTypeStrictSubtypeOf(c, t))
71187
+ return c;
71188
+ if (t.flags & 109472 /* Unit */ && c.flags & 109472 /* Unit */)
71189
+ return neverType;
71190
+ if (isTypeSubtypeOf(t, c))
71191
+ return t;
71192
+ if (isTypeSubtypeOf(c, t))
71193
+ return c;
71194
+ return neverType;
71195
+ }
71151
71196
  );
71152
71197
  return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
71153
71198
  });
@@ -119779,12 +119824,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
119779
119824
  cachedReadDirectoryResult.clear();
119780
119825
  }
119781
119826
  }
119782
- var ConfigFileProgramReloadLevel = /* @__PURE__ */ ((ConfigFileProgramReloadLevel2) => {
119783
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["None"] = 0] = "None";
119784
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Partial"] = 1] = "Partial";
119785
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Full"] = 2] = "Full";
119786
- return ConfigFileProgramReloadLevel2;
119787
- })(ConfigFileProgramReloadLevel || {});
119827
+ var ProgramUpdateLevel = /* @__PURE__ */ ((ProgramUpdateLevel2) => {
119828
+ ProgramUpdateLevel2[ProgramUpdateLevel2["Update"] = 0] = "Update";
119829
+ ProgramUpdateLevel2[ProgramUpdateLevel2["RootNamesAndUpdate"] = 1] = "RootNamesAndUpdate";
119830
+ ProgramUpdateLevel2[ProgramUpdateLevel2["Full"] = 2] = "Full";
119831
+ return ProgramUpdateLevel2;
119832
+ })(ProgramUpdateLevel || {});
119788
119833
  function updateSharedExtendedConfigFileWatcher(projectPath, options, extendedConfigFilesMap, createExtendedConfigFileWatch, toPath3) {
119789
119834
  var _a;
119790
119835
  const extendedConfigs = arrayToMap(((_a = options == null ? void 0 : options.configFile) == null ? void 0 : _a.extendedSourceFiles) || emptyArray, toPath3);
@@ -125995,6 +126040,10 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
125995
126040
  function getRootPathSplitLength(rootPath) {
125996
126041
  return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
125997
126042
  }
126043
+ function getModuleResolutionHost(resolutionHost) {
126044
+ var _a;
126045
+ return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126046
+ }
125998
126047
  function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
125999
126048
  return {
126000
126049
  nameAndMode: moduleResolutionNameAndModeGetter,
@@ -126010,8 +126059,7 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
126010
126059
  };
126011
126060
  }
126012
126061
  function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
126013
- var _a;
126014
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126062
+ const host = getModuleResolutionHost(resolutionHost);
126015
126063
  const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
126016
126064
  if (!resolutionHost.getGlobalCache) {
126017
126065
  return primaryResult;
@@ -126182,6 +126230,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126182
126230
  };
126183
126231
  }
126184
126232
  function startCachingPerDirectoryResolution() {
126233
+ moduleResolutionCache.isReadonly = void 0;
126234
+ typeReferenceDirectiveResolutionCache.isReadonly = void 0;
126235
+ libraryResolutionCache.isReadonly = void 0;
126236
+ moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
126185
126237
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
126186
126238
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
126187
126239
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
@@ -126239,6 +126291,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126239
126291
  directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
126240
126292
  fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
126241
126293
  hasChangedAutomaticTypeDirectiveNames = false;
126294
+ moduleResolutionCache.isReadonly = true;
126295
+ typeReferenceDirectiveResolutionCache.isReadonly = true;
126296
+ libraryResolutionCache.isReadonly = true;
126297
+ moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
126242
126298
  }
126243
126299
  function closeDirectoryWatchesOfFailedLookup(watcher, path) {
126244
126300
  if (watcher.refCount === 0) {
@@ -126267,7 +126323,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126267
126323
  shouldRetryResolution,
126268
126324
  logChanges
126269
126325
  }) {
126270
- var _a;
126271
126326
  const path = resolutionHost.toPath(containingFile);
126272
126327
  const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
126273
126328
  const resolvedModules = [];
@@ -126299,7 +126354,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126299
126354
  logChanges = false;
126300
126355
  }
126301
126356
  } else {
126302
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126357
+ const host = getModuleResolutionHost(resolutionHost);
126303
126358
  if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
126304
126359
  const resolved = getResolutionWithResolvedFileName(resolution);
126305
126360
  trace(
@@ -126351,7 +126406,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126351
126406
  }
126352
126407
  }
126353
126408
  function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
126354
- var _a;
126355
126409
  return resolveNamesWithLocalCache({
126356
126410
  entries: typeDirectiveReferences,
126357
126411
  containingFile,
@@ -126364,7 +126418,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126364
126418
  containingFile,
126365
126419
  redirectedReference,
126366
126420
  options,
126367
- ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
126421
+ getModuleResolutionHost(resolutionHost),
126368
126422
  typeReferenceDirectiveResolutionCache
126369
126423
  ),
126370
126424
  getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
@@ -126396,8 +126450,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126396
126450
  });
126397
126451
  }
126398
126452
  function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
126399
- var _a;
126400
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126453
+ const host = getModuleResolutionHost(resolutionHost);
126401
126454
  let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
126402
126455
  if (!resolution || resolution.isInvalidated) {
126403
126456
  const existingResolution = resolution;
@@ -126431,6 +126484,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126431
126484
  return resolution;
126432
126485
  }
126433
126486
  function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
126487
+ var _a, _b;
126434
126488
  const path = resolutionHost.toPath(containingFile);
126435
126489
  const resolutionsInFile = resolvedModuleNames.get(path);
126436
126490
  const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(
@@ -126440,7 +126494,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126440
126494
  );
126441
126495
  if (resolution && !resolution.isInvalidated)
126442
126496
  return resolution;
126443
- return resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, resolutionHost.getCompilationSettings());
126497
+ const data = (_a = resolutionHost.beforeResolveSingleModuleNameWithoutWatching) == null ? void 0 : _a.call(resolutionHost, moduleResolutionCache);
126498
+ const host = getModuleResolutionHost(resolutionHost);
126499
+ const result = resolveModuleName(
126500
+ moduleName,
126501
+ containingFile,
126502
+ resolutionHost.getCompilationSettings(),
126503
+ host,
126504
+ moduleResolutionCache
126505
+ );
126506
+ (_b = resolutionHost.afterResolveSingleModuleNameWithoutWatching) == null ? void 0 : _b.call(resolutionHost, moduleResolutionCache, moduleName, containingFile, result, data);
126507
+ return result;
126444
126508
  }
126445
126509
  function isNodeModulesAtTypesDirectory(dirPath) {
126446
126510
  return endsWith(dirPath, "/node_modules/@types");
@@ -127611,7 +127675,7 @@ function createWatchCompilerHost2(rootFilesOrConfigFileName, options, system, cr
127611
127675
  }
127612
127676
  function createWatchProgram(host) {
127613
127677
  let builderProgram;
127614
- let reloadLevel;
127678
+ let updateLevel;
127615
127679
  let missingFilesMap;
127616
127680
  let watchedWildcardDirectories;
127617
127681
  let timerToUpdateProgram;
@@ -127970,7 +128034,7 @@ function createWatchProgram(host) {
127970
128034
  }
127971
128035
  function scheduleProgramReload() {
127972
128036
  Debug.assert(!!configFileName);
127973
- reloadLevel = 2 /* Full */;
128037
+ updateLevel = 2 /* Full */;
127974
128038
  scheduleProgramUpdate();
127975
128039
  }
127976
128040
  function updateProgramWithWatchStatus() {
@@ -127980,8 +128044,8 @@ function createWatchProgram(host) {
127980
128044
  }
127981
128045
  function updateProgram() {
127982
128046
  var _a, _b, _c, _d;
127983
- switch (reloadLevel) {
127984
- case 1 /* Partial */:
128047
+ switch (updateLevel) {
128048
+ case 1 /* RootNamesAndUpdate */:
127985
128049
  (_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
127986
128050
  reloadFileNamesFromConfigFile();
127987
128051
  break;
@@ -128001,7 +128065,7 @@ function createWatchProgram(host) {
128001
128065
  writeLog("Reloading new file names and options");
128002
128066
  Debug.assert(compilerOptions);
128003
128067
  Debug.assert(configFileName);
128004
- reloadLevel = 0 /* None */;
128068
+ updateLevel = 0 /* Update */;
128005
128069
  rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
128006
128070
  if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
128007
128071
  hasChangedConfigFileParsingErrors = true;
@@ -128011,7 +128075,7 @@ function createWatchProgram(host) {
128011
128075
  function reloadConfigFile() {
128012
128076
  Debug.assert(configFileName);
128013
128077
  writeLog(`Reloading config file: ${configFileName}`);
128014
- reloadLevel = 0 /* None */;
128078
+ updateLevel = 0 /* Update */;
128015
128079
  if (cachedDirectoryStructureHost) {
128016
128080
  cachedDirectoryStructureHost.clearCache();
128017
128081
  }
@@ -128048,9 +128112,9 @@ function createWatchProgram(host) {
128048
128112
  const configPath = toPath3(configFileName2);
128049
128113
  let config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
128050
128114
  if (config) {
128051
- if (!config.reloadLevel)
128115
+ if (!config.updateLevel)
128052
128116
  return config.parsedCommandLine;
128053
- if (config.parsedCommandLine && config.reloadLevel === 1 /* Partial */ && !host.getParsedCommandLine) {
128117
+ if (config.parsedCommandLine && config.updateLevel === 1 /* RootNamesAndUpdate */ && !host.getParsedCommandLine) {
128054
128118
  writeLog("Reloading new file names and options");
128055
128119
  Debug.assert(compilerOptions);
128056
128120
  const fileNames = getFileNamesFromConfigSpecs(
@@ -128060,7 +128124,7 @@ function createWatchProgram(host) {
128060
128124
  parseConfigFileHost
128061
128125
  );
128062
128126
  config.parsedCommandLine = { ...config.parsedCommandLine, fileNames };
128063
- config.reloadLevel = void 0;
128127
+ config.updateLevel = void 0;
128064
128128
  return config.parsedCommandLine;
128065
128129
  }
128066
128130
  }
@@ -128068,7 +128132,7 @@ function createWatchProgram(host) {
128068
128132
  const parsedCommandLine = host.getParsedCommandLine ? host.getParsedCommandLine(configFileName2) : getParsedCommandLineFromConfigFileHost(configFileName2);
128069
128133
  if (config) {
128070
128134
  config.parsedCommandLine = parsedCommandLine;
128071
- config.reloadLevel = void 0;
128135
+ config.updateLevel = void 0;
128072
128136
  } else {
128073
128137
  (parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config = { parsedCommandLine });
128074
128138
  }
@@ -128165,8 +128229,8 @@ function createWatchProgram(host) {
128165
128229
  toPath: toPath3
128166
128230
  }))
128167
128231
  return;
128168
- if (reloadLevel !== 2 /* Full */) {
128169
- reloadLevel = 1 /* Partial */;
128232
+ if (updateLevel !== 2 /* Full */) {
128233
+ updateLevel = 1 /* RootNamesAndUpdate */;
128170
128234
  scheduleProgramUpdate();
128171
128235
  }
128172
128236
  },
@@ -128192,11 +128256,11 @@ function createWatchProgram(host) {
128192
128256
  return;
128193
128257
  projects.forEach((projectPath) => {
128194
128258
  if (configFileName && toPath3(configFileName) === projectPath) {
128195
- reloadLevel = 2 /* Full */;
128259
+ updateLevel = 2 /* Full */;
128196
128260
  } else {
128197
128261
  const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
128198
128262
  if (config)
128199
- config.reloadLevel = 2 /* Full */;
128263
+ config.updateLevel = 2 /* Full */;
128200
128264
  resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
128201
128265
  }
128202
128266
  scheduleProgramUpdate();
@@ -128217,7 +128281,7 @@ function createWatchProgram(host) {
128217
128281
  updateCachedSystemWithFile(configFileName2, configPath, eventKind);
128218
128282
  const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
128219
128283
  if (config)
128220
- config.reloadLevel = 2 /* Full */;
128284
+ config.updateLevel = 2 /* Full */;
128221
128285
  resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
128222
128286
  scheduleProgramUpdate();
128223
128287
  },
@@ -128255,8 +128319,8 @@ function createWatchProgram(host) {
128255
128319
  toPath: toPath3
128256
128320
  }))
128257
128321
  return;
128258
- if (config.reloadLevel !== 2 /* Full */) {
128259
- config.reloadLevel = 1 /* Partial */;
128322
+ if (config.updateLevel !== 2 /* Full */) {
128323
+ config.updateLevel = 1 /* RootNamesAndUpdate */;
128260
128324
  scheduleProgramUpdate();
128261
128325
  }
128262
128326
  },
@@ -128719,12 +128783,12 @@ function clearProjectStatus(state, resolved) {
128719
128783
  state.projectStatus.delete(resolved);
128720
128784
  state.diagnostics.delete(resolved);
128721
128785
  }
128722
- function addProjToQueue({ projectPendingBuild }, proj, reloadLevel) {
128786
+ function addProjToQueue({ projectPendingBuild }, proj, updateLevel) {
128723
128787
  const value = projectPendingBuild.get(proj);
128724
128788
  if (value === void 0) {
128725
- projectPendingBuild.set(proj, reloadLevel);
128726
- } else if (value < reloadLevel) {
128727
- projectPendingBuild.set(proj, reloadLevel);
128789
+ projectPendingBuild.set(proj, updateLevel);
128790
+ } else if (value < updateLevel) {
128791
+ projectPendingBuild.set(proj, updateLevel);
128728
128792
  }
128729
128793
  }
128730
128794
  function setupInitialBuild(state, cancellationToken) {
@@ -128738,7 +128802,7 @@ function setupInitialBuild(state, cancellationToken) {
128738
128802
  buildOrder.forEach(
128739
128803
  (configFileName) => state.projectPendingBuild.set(
128740
128804
  toResolvedConfigFilePath(state, configFileName),
128741
- 0 /* None */
128805
+ 0 /* Update */
128742
128806
  )
128743
128807
  );
128744
128808
  if (cancellationToken) {
@@ -129180,8 +129244,8 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
129180
129244
  for (let projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) {
129181
129245
  const project = buildOrder[projectIndex];
129182
129246
  const projectPath = toResolvedConfigFilePath(state, project);
129183
- const reloadLevel = state.projectPendingBuild.get(projectPath);
129184
- if (reloadLevel === void 0)
129247
+ const updateLevel = state.projectPendingBuild.get(projectPath);
129248
+ if (updateLevel === void 0)
129185
129249
  continue;
129186
129250
  if (reportQueue) {
129187
129251
  reportQueue = false;
@@ -129193,13 +129257,13 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
129193
129257
  projectPendingBuild.delete(projectPath);
129194
129258
  continue;
129195
129259
  }
129196
- if (reloadLevel === 2 /* Full */) {
129260
+ if (updateLevel === 2 /* Full */) {
129197
129261
  watchConfigFile(state, project, projectPath, config);
129198
129262
  watchExtendedConfigFiles(state, projectPath, config);
129199
129263
  watchWildCardDirectories(state, project, projectPath, config);
129200
129264
  watchInputFiles(state, project, projectPath, config);
129201
129265
  watchPackageJsonFiles(state, project, projectPath, config);
129202
- } else if (reloadLevel === 1 /* Partial */) {
129266
+ } else if (updateLevel === 1 /* RootNamesAndUpdate */) {
129203
129267
  config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, getDirectoryPath(project), config.options, state.parseConfigFileHost);
129204
129268
  updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, canJsonReportNoInputFiles(config.raw));
129205
129269
  watchInputFiles(state, project, projectPath, config);
@@ -129786,7 +129850,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
129786
129850
  break;
129787
129851
  }
129788
129852
  }
129789
- addProjToQueue(state, nextProjectPath, 0 /* None */);
129853
+ addProjToQueue(state, nextProjectPath, 0 /* Update */);
129790
129854
  break;
129791
129855
  }
129792
129856
  }
@@ -129855,7 +129919,7 @@ function cleanWorker(state, project, onlyReferences) {
129855
129919
  filesToDelete.push(output);
129856
129920
  } else {
129857
129921
  host.deleteFile(output);
129858
- invalidateProject(state, resolvedPath, 0 /* None */);
129922
+ invalidateProject(state, resolvedPath, 0 /* Update */);
129859
129923
  }
129860
129924
  }
129861
129925
  }
@@ -129866,22 +129930,22 @@ function cleanWorker(state, project, onlyReferences) {
129866
129930
  }
129867
129931
  return 0 /* Success */;
129868
129932
  }
129869
- function invalidateProject(state, resolved, reloadLevel) {
129870
- if (state.host.getParsedCommandLine && reloadLevel === 1 /* Partial */) {
129871
- reloadLevel = 2 /* Full */;
129933
+ function invalidateProject(state, resolved, updateLevel) {
129934
+ if (state.host.getParsedCommandLine && updateLevel === 1 /* RootNamesAndUpdate */) {
129935
+ updateLevel = 2 /* Full */;
129872
129936
  }
129873
- if (reloadLevel === 2 /* Full */) {
129937
+ if (updateLevel === 2 /* Full */) {
129874
129938
  state.configFileCache.delete(resolved);
129875
129939
  state.buildOrder = void 0;
129876
129940
  }
129877
129941
  state.needsSummary = true;
129878
129942
  clearProjectStatus(state, resolved);
129879
- addProjToQueue(state, resolved, reloadLevel);
129943
+ addProjToQueue(state, resolved, updateLevel);
129880
129944
  enableCache(state);
129881
129945
  }
129882
- function invalidateProjectAndScheduleBuilds(state, resolvedPath, reloadLevel) {
129946
+ function invalidateProjectAndScheduleBuilds(state, resolvedPath, updateLevel) {
129883
129947
  state.reportFileChangeDetected = true;
129884
- invalidateProject(state, resolvedPath, reloadLevel);
129948
+ invalidateProject(state, resolvedPath, updateLevel);
129885
129949
  scheduleBuildInvalidatedProject(
129886
129950
  state,
129887
129951
  250,
@@ -130012,7 +130076,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
130012
130076
  toPath: (fileName) => toPath2(state, fileName)
130013
130077
  }))
130014
130078
  return;
130015
- invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* Partial */);
130079
+ invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* RootNamesAndUpdate */);
130016
130080
  },
130017
130081
  flags,
130018
130082
  parsed == null ? void 0 : parsed.watchOptions,
@@ -130031,7 +130095,7 @@ function watchInputFiles(state, resolved, resolvedPath, parsed) {
130031
130095
  createNewValue: (_path, input) => watchFile(
130032
130096
  state,
130033
130097
  input,
130034
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* None */),
130098
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130035
130099
  250 /* Low */,
130036
130100
  parsed == null ? void 0 : parsed.watchOptions,
130037
130101
  WatchType.SourceFile,
@@ -130051,7 +130115,7 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
130051
130115
  createNewValue: (path, _input) => watchFile(
130052
130116
  state,
130053
130117
  path,
130054
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* None */),
130118
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130055
130119
  2e3 /* High */,
130056
130120
  parsed == null ? void 0 : parsed.watchOptions,
130057
130121
  WatchType.PackageJson,
@@ -130122,7 +130186,7 @@ function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, opti
130122
130186
  const configFilePath = toResolvedConfigFilePath(state, configFileName);
130123
130187
  return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath);
130124
130188
  },
130125
- invalidateProject: (configFilePath, reloadLevel) => invalidateProject(state, configFilePath, reloadLevel || 0 /* None */),
130189
+ invalidateProject: (configFilePath, updateLevel) => invalidateProject(state, configFilePath, updateLevel || 0 /* Update */),
130126
130190
  close: () => stopWatching(state)
130127
130191
  };
130128
130192
  }
@@ -172066,7 +172130,6 @@ __export(ts_exports2, {
172066
172130
  CompletionInfoFlags: () => CompletionInfoFlags,
172067
172131
  CompletionTriggerKind: () => CompletionTriggerKind,
172068
172132
  Completions: () => ts_Completions_exports,
172069
- ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
172070
172133
  ContainerFlags: () => ContainerFlags,
172071
172134
  ContextFlags: () => ContextFlags,
172072
172135
  Debug: () => Debug,
@@ -172153,6 +172216,7 @@ __export(ts_exports2, {
172153
172216
  PragmaKindFlags: () => PragmaKindFlags,
172154
172217
  PrivateIdentifierKind: () => PrivateIdentifierKind,
172155
172218
  ProcessLevel: () => ProcessLevel,
172219
+ ProgramUpdateLevel: () => ProgramUpdateLevel,
172156
172220
  QuotePreference: () => QuotePreference,
172157
172221
  RelationComparisonResult: () => RelationComparisonResult,
172158
172222
  Rename: () => ts_Rename_exports,
@@ -174544,6 +174608,7 @@ __export(ts_server_exports3, {
174544
174608
  hasArgument: () => hasArgument,
174545
174609
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
174546
174610
  indent: () => indent2,
174611
+ isBackgroundProject: () => isBackgroundProject,
174547
174612
  isConfigFile: () => isConfigFile,
174548
174613
  isConfiguredProject: () => isConfiguredProject,
174549
174614
  isDynamicFileName: () => isDynamicFileName,
@@ -175811,7 +175876,7 @@ var ScriptInfo = class {
175811
175876
  isContainedByBackgroundProject() {
175812
175877
  return some(
175813
175878
  this.containingProjects,
175814
- (p) => p.projectKind === 3 /* AutoImportProvider */ || p.projectKind === 4 /* Auxiliary */
175879
+ isBackgroundProject
175815
175880
  );
175816
175881
  }
175817
175882
  /**
@@ -175842,7 +175907,7 @@ var ScriptInfo = class {
175842
175907
  }
175843
175908
  };
175844
175909
  function ensurePrimaryProjectKind(project) {
175845
- if (!project || project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */) {
175910
+ if (!project || isBackgroundProject(project)) {
175846
175911
  return Errors.ThrowNoProject();
175847
175912
  }
175848
175913
  return project;
@@ -176128,9 +176193,10 @@ var Project3 = class _Project {
176128
176193
  this.disableLanguageService(lastFileExceededProgramSize);
176129
176194
  }
176130
176195
  this.markAsDirty();
176131
- if (projectKind !== 3 /* AutoImportProvider */) {
176196
+ if (!isBackgroundProject(this)) {
176132
176197
  this.projectService.pendingEnsureProjectForOpenFiles = true;
176133
176198
  }
176199
+ this.projectService.onProjectCreation(this);
176134
176200
  }
176135
176201
  /** @internal */
176136
176202
  getResolvedProjectReferenceToRedirect(_fileName) {
@@ -176300,6 +176366,7 @@ var Project3 = class _Project {
176300
176366
  resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
176301
176367
  return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
176302
176368
  }
176369
+ /** @internal */
176303
176370
  getModuleResolutionCache() {
176304
176371
  return this.resolutionCache.getModuleResolutionCache();
176305
176372
  }
@@ -176565,12 +176632,12 @@ var Project3 = class _Project {
176565
176632
  }
176566
176633
  return { ...newTypeAcquisition, include: this.removeExistingTypings(newTypeAcquisition.include) };
176567
176634
  }
176568
- getExternalFiles() {
176635
+ getExternalFiles(updateLevel) {
176569
176636
  return sort(flatMap(this.plugins, (plugin) => {
176570
176637
  if (typeof plugin.module.getExternalFiles !== "function")
176571
176638
  return;
176572
176639
  try {
176573
- return plugin.module.getExternalFiles(this);
176640
+ return plugin.module.getExternalFiles(this, updateLevel || 0 /* Update */);
176574
176641
  } catch (e) {
176575
176642
  this.projectService.logger.info(`A plugin threw an exception in getExternalFiles: ${e}`);
176576
176643
  if (e.stack) {
@@ -177305,6 +177372,7 @@ var Project3 = class _Project {
177305
177372
  }
177306
177373
  /** @internal */
177307
177374
  getChangesSinceVersion(lastKnownVersion, includeProjectReferenceRedirectInfo) {
177375
+ var _a, _b;
177308
177376
  const includeProjectReferenceRedirectInfoIfRequested = includeProjectReferenceRedirectInfo ? (files) => arrayFrom(files.entries(), ([fileName, isSourceOfProjectReferenceRedirect]) => ({
177309
177377
  fileName,
177310
177378
  isSourceOfProjectReferenceRedirect
@@ -177327,10 +177395,10 @@ var Project3 = class _Project {
177327
177395
  return { info, projectErrors: this.getGlobalProjectErrors() };
177328
177396
  }
177329
177397
  const lastReportedFileNames = this.lastReportedFileNames;
177330
- const externalFiles = this.getExternalFiles().map((f) => ({
177398
+ const externalFiles = ((_a = this.externalFiles) == null ? void 0 : _a.map((f) => ({
177331
177399
  fileName: toNormalizedPath(f),
177332
177400
  isSourceOfProjectReferenceRedirect: false
177333
- }));
177401
+ }))) || emptyArray2;
177334
177402
  const currentFiles = arrayToMap(
177335
177403
  this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo).concat(externalFiles),
177336
177404
  (info2) => info2.fileName,
@@ -177372,10 +177440,10 @@ var Project3 = class _Project {
177372
177440
  };
177373
177441
  } else {
177374
177442
  const projectFileNames = this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo);
177375
- const externalFiles = this.getExternalFiles().map((f) => ({
177443
+ const externalFiles = ((_b = this.externalFiles) == null ? void 0 : _b.map((f) => ({
177376
177444
  fileName: toNormalizedPath(f),
177377
177445
  isSourceOfProjectReferenceRedirect: false
177378
- }));
177446
+ }))) || emptyArray2;
177379
177447
  const allFiles = projectFileNames.concat(externalFiles);
177380
177448
  this.lastReportedFileNames = arrayToMap(
177381
177449
  allFiles,
@@ -177577,32 +177645,15 @@ var Project3 = class _Project {
177577
177645
  return this.projectService.getIncompleteCompletionsCache();
177578
177646
  }
177579
177647
  /** @internal */
177580
- getNoDtsResolutionProject(rootFileNames) {
177648
+ getNoDtsResolutionProject(rootFile) {
177581
177649
  Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
177582
177650
  if (!this.noDtsResolutionProject) {
177583
177651
  this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
177584
177652
  }
177585
- enumerateInsertsAndDeletes(
177586
- rootFileNames.map(toNormalizedPath),
177587
- this.noDtsResolutionProject.getRootFiles(),
177588
- getStringComparer(!this.useCaseSensitiveFileNames()),
177589
- (pathToAdd) => {
177590
- const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
177591
- pathToAdd,
177592
- this.currentDirectory,
177593
- this.noDtsResolutionProject.directoryStructureHost
177594
- );
177595
- if (info) {
177596
- this.noDtsResolutionProject.addRoot(info, pathToAdd);
177597
- }
177598
- },
177599
- (pathToRemove) => {
177600
- const info = this.noDtsResolutionProject.getScriptInfo(pathToRemove);
177601
- if (info) {
177602
- this.noDtsResolutionProject.removeRoot(info);
177603
- }
177604
- }
177605
- );
177653
+ if (this.noDtsResolutionProject.rootFile !== rootFile) {
177654
+ this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this.noDtsResolutionProject, [rootFile]);
177655
+ this.noDtsResolutionProject.rootFile = rootFile;
177656
+ }
177606
177657
  return this.noDtsResolutionProject;
177607
177658
  }
177608
177659
  /** @internal */
@@ -177934,7 +177985,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177934
177985
  this.getCompilationSettings()
177935
177986
  );
177936
177987
  }
177937
- this.projectService.setFileNamesOfAutoImportProviderProject(this, rootFileNames);
177988
+ this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this, rootFileNames);
177938
177989
  this.rootFileNames = rootFileNames;
177939
177990
  const oldProgram = this.getCurrentProgram();
177940
177991
  const hasSameSetOfFiles = super.updateGraph();
@@ -178079,18 +178130,18 @@ var ConfiguredProject2 = class extends Project3 {
178079
178130
  updateGraph() {
178080
178131
  const isInitialLoad = this.isInitialLoadPending();
178081
178132
  this.isInitialLoadPending = returnFalse;
178082
- const reloadLevel = this.pendingReload;
178083
- this.pendingReload = 0 /* None */;
178133
+ const updateLevel = this.pendingUpdateLevel;
178134
+ this.pendingUpdateLevel = 0 /* Update */;
178084
178135
  let result;
178085
- switch (reloadLevel) {
178086
- case 1 /* Partial */:
178136
+ switch (updateLevel) {
178137
+ case 1 /* RootNamesAndUpdate */:
178087
178138
  this.openFileWatchTriggered.clear();
178088
178139
  result = this.projectService.reloadFileNamesOfConfiguredProject(this);
178089
178140
  break;
178090
178141
  case 2 /* Full */:
178091
178142
  this.openFileWatchTriggered.clear();
178092
- const reason = Debug.checkDefined(this.pendingReloadReason);
178093
- this.pendingReloadReason = void 0;
178143
+ const reason = Debug.checkDefined(this.pendingUpdateReason);
178144
+ this.pendingUpdateReason = void 0;
178094
178145
  this.projectService.reloadConfiguredProject(
178095
178146
  this,
178096
178147
  reason,
@@ -178290,6 +178341,9 @@ function isConfiguredProject(project) {
178290
178341
  function isExternalProject(project) {
178291
178342
  return project.projectKind === 2 /* External */;
178292
178343
  }
178344
+ function isBackgroundProject(project) {
178345
+ return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
178346
+ }
178293
178347
 
178294
178348
  // src/server/editorServices.ts
178295
178349
  var maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
@@ -178730,6 +178784,8 @@ var _ProjectService = class _ProjectService {
178730
178784
  this.verifyDocumentRegistry = noop;
178731
178785
  /** @internal */
178732
178786
  this.verifyProgram = noop;
178787
+ /** @internal */
178788
+ this.onProjectCreation = noop;
178733
178789
  var _a;
178734
178790
  this.host = opts.host;
178735
178791
  this.logger = opts.logger;
@@ -178897,20 +178953,20 @@ var _ProjectService = class _ProjectService {
178897
178953
  }
178898
178954
  delayUpdateProjectGraph(project) {
178899
178955
  project.markAsDirty();
178900
- if (project.projectKind !== 3 /* AutoImportProvider */ && project.projectKind !== 4 /* Auxiliary */) {
178901
- const projectName = project.getProjectName();
178902
- this.pendingProjectUpdates.set(projectName, project);
178903
- this.throttledOperations.schedule(
178904
- projectName,
178905
- /*delay*/
178906
- 250,
178907
- () => {
178908
- if (this.pendingProjectUpdates.delete(projectName)) {
178909
- updateProjectIfDirty(project);
178910
- }
178956
+ if (isBackgroundProject(project))
178957
+ return;
178958
+ const projectName = project.getProjectName();
178959
+ this.pendingProjectUpdates.set(projectName, project);
178960
+ this.throttledOperations.schedule(
178961
+ projectName,
178962
+ /*delay*/
178963
+ 250,
178964
+ () => {
178965
+ if (this.pendingProjectUpdates.delete(projectName)) {
178966
+ updateProjectIfDirty(project);
178911
178967
  }
178912
- );
178913
- }
178968
+ }
178969
+ );
178914
178970
  }
178915
178971
  /** @internal */
178916
178972
  hasPendingProjectUpdate(project) {
@@ -179186,28 +179242,28 @@ var _ProjectService = class _ProjectService {
179186
179242
  getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
179187
179243
  }))
179188
179244
  return;
179189
- if (config.reloadLevel !== 2 /* Full */)
179190
- config.reloadLevel = 1 /* Partial */;
179245
+ if (config.updateLevel !== 2 /* Full */)
179246
+ config.updateLevel = 1 /* RootNamesAndUpdate */;
179191
179247
  config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
179192
179248
  if (!watchWildcardDirectories)
179193
179249
  return;
179194
179250
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
179195
179251
  if (!project)
179196
179252
  return;
179197
- const reloadLevel = configuredProjectForConfig === project ? 1 /* Partial */ : 0 /* None */;
179198
- if (project.pendingReload !== void 0 && project.pendingReload > reloadLevel)
179253
+ const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
179254
+ if (project.pendingUpdateLevel !== void 0 && project.pendingUpdateLevel > updateLevel)
179199
179255
  return;
179200
179256
  if (this.openFiles.has(fileOrDirectoryPath)) {
179201
179257
  const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
179202
179258
  if (info.isAttached(project)) {
179203
- const loadLevelToSet = Math.max(reloadLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* None */);
179259
+ const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
179204
179260
  project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
179205
179261
  } else {
179206
- project.pendingReload = reloadLevel;
179262
+ project.pendingUpdateLevel = updateLevel;
179207
179263
  this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
179208
179264
  }
179209
179265
  } else {
179210
- project.pendingReload = reloadLevel;
179266
+ project.pendingUpdateLevel = updateLevel;
179211
179267
  this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
179212
179268
  }
179213
179269
  });
@@ -179219,12 +179275,12 @@ var _ProjectService = class _ProjectService {
179219
179275
  );
179220
179276
  }
179221
179277
  /** @internal */
179222
- delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, reloadReason) {
179278
+ delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
179223
179279
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
179224
179280
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config))
179225
179281
  return false;
179226
179282
  let scheduledAnyProjectUpdate = false;
179227
- configFileExistenceInfo.config.reloadLevel = 2 /* Full */;
179283
+ configFileExistenceInfo.config.updateLevel = 2 /* Full */;
179228
179284
  configFileExistenceInfo.config.projects.forEach((_watchWildcardDirectories, projectCanonicalPath) => {
179229
179285
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
179230
179286
  if (!project)
@@ -179233,8 +179289,8 @@ var _ProjectService = class _ProjectService {
179233
179289
  if (projectCanonicalPath === canonicalConfigFilePath) {
179234
179290
  if (project.isInitialLoadPending())
179235
179291
  return;
179236
- project.pendingReload = 2 /* Full */;
179237
- project.pendingReloadReason = reloadReason;
179292
+ project.pendingUpdateLevel = 2 /* Full */;
179293
+ project.pendingUpdateReason = loadReason;
179238
179294
  this.delayUpdateProjectGraph(project);
179239
179295
  } else {
179240
179296
  project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(this.toPath(canonicalConfigFilePath));
@@ -179383,11 +179439,11 @@ var _ProjectService = class _ProjectService {
179383
179439
  if (info.hasMixedContent) {
179384
179440
  info.registerFileUpdate();
179385
179441
  }
179386
- const reloadLevel = p.openFileWatchTriggered.get(info.path);
179387
- if (reloadLevel !== void 0) {
179442
+ const updateLevel = p.openFileWatchTriggered.get(info.path);
179443
+ if (updateLevel !== void 0) {
179388
179444
  p.openFileWatchTriggered.delete(info.path);
179389
- if (p.pendingReload !== void 0 && p.pendingReload < reloadLevel) {
179390
- p.pendingReload = reloadLevel;
179445
+ if (p.pendingUpdateLevel !== void 0 && p.pendingUpdateLevel < updateLevel) {
179446
+ p.pendingUpdateLevel = updateLevel;
179391
179447
  p.markFileAsDirty(info.path);
179392
179448
  }
179393
179449
  }
@@ -179767,6 +179823,7 @@ var _ProjectService = class _ProjectService {
179767
179823
  addFilesToNonInferredProject(project, files, propertyReader, typeAcquisition) {
179768
179824
  this.updateNonInferredProjectFiles(project, files, propertyReader);
179769
179825
  project.setTypeAcquisition(typeAcquisition);
179826
+ project.markAsDirty();
179770
179827
  }
179771
179828
  /** @internal */
179772
179829
  createConfiguredProject(configFileName) {
@@ -179784,7 +179841,7 @@ var _ProjectService = class _ProjectService {
179784
179841
  configFileExistenceInfo.config = {
179785
179842
  cachedDirectoryStructureHost: createCachedDirectoryStructureHost(this.host, this.host.getCurrentDirectory(), this.host.useCaseSensitiveFileNames),
179786
179843
  projects: /* @__PURE__ */ new Map(),
179787
- reloadLevel: 2 /* Full */
179844
+ updateLevel: 2 /* Full */
179788
179845
  };
179789
179846
  }
179790
179847
  const project = new ConfiguredProject2(
@@ -179801,8 +179858,8 @@ var _ProjectService = class _ProjectService {
179801
179858
  /** @internal */
179802
179859
  createConfiguredProjectWithDelayLoad(configFileName, reason) {
179803
179860
  const project = this.createConfiguredProject(configFileName);
179804
- project.pendingReload = 2 /* Full */;
179805
- project.pendingReloadReason = reason;
179861
+ project.pendingUpdateLevel = 2 /* Full */;
179862
+ project.pendingUpdateReason = reason;
179806
179863
  return project;
179807
179864
  }
179808
179865
  /** @internal */
@@ -179858,7 +179915,7 @@ var _ProjectService = class _ProjectService {
179858
179915
  this.watchWildcards(configFilename, configFileExistenceInfo, project);
179859
179916
  }
179860
179917
  project.enablePluginsWithOptions(compilerOptions);
179861
- const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles());
179918
+ const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles(2 /* Full */));
179862
179919
  this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
179863
179920
  (_b = tracing) == null ? void 0 : _b.pop();
179864
179921
  }
@@ -179866,9 +179923,9 @@ var _ProjectService = class _ProjectService {
179866
179923
  ensureParsedConfigUptoDate(configFilename, canonicalConfigFilePath, configFileExistenceInfo, forProject) {
179867
179924
  var _a, _b, _c;
179868
179925
  if (configFileExistenceInfo.config) {
179869
- if (!configFileExistenceInfo.config.reloadLevel)
179926
+ if (!configFileExistenceInfo.config.updateLevel)
179870
179927
  return configFileExistenceInfo;
179871
- if (configFileExistenceInfo.config.reloadLevel === 1 /* Partial */) {
179928
+ if (configFileExistenceInfo.config.updateLevel === 1 /* RootNamesAndUpdate */) {
179872
179929
  this.reloadFileNamesOfParsedConfig(configFilename, configFileExistenceInfo.config);
179873
179930
  return configFileExistenceInfo;
179874
179931
  }
@@ -179911,7 +179968,7 @@ var _ProjectService = class _ProjectService {
179911
179968
  } else {
179912
179969
  configFileExistenceInfo.config.parsedCommandLine = parsedCommandLine;
179913
179970
  configFileExistenceInfo.config.watchedDirectoriesStale = true;
179914
- configFileExistenceInfo.config.reloadLevel = void 0;
179971
+ configFileExistenceInfo.config.updateLevel = void 0;
179915
179972
  }
179916
179973
  if (!oldCommandLine && !isJsonEqual(
179917
179974
  // Old options
@@ -180052,7 +180109,6 @@ var _ProjectService = class _ProjectService {
180052
180109
  }
180053
180110
  });
180054
180111
  }
180055
- project.markAsDirty();
180056
180112
  }
180057
180113
  updateRootAndOptionsOfNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) {
180058
180114
  project.setCompilerOptions(newOptions);
@@ -180070,14 +180126,15 @@ var _ProjectService = class _ProjectService {
180070
180126
  reloadFileNamesOfConfiguredProject(project) {
180071
180127
  const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
180072
180128
  project.updateErrorOnNoInputFiles(fileNames);
180073
- this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles()), fileNamePropertyReader);
180129
+ this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
180130
+ project.markAsDirty();
180074
180131
  return project.updateGraph();
180075
180132
  }
180076
180133
  /** @internal */
180077
180134
  reloadFileNamesOfParsedConfig(configFileName, config) {
180078
- if (config.reloadLevel === void 0)
180135
+ if (config.updateLevel === void 0)
180079
180136
  return config.parsedCommandLine.fileNames;
180080
- Debug.assert(config.reloadLevel === 1 /* Partial */);
180137
+ Debug.assert(config.updateLevel === 1 /* RootNamesAndUpdate */);
180081
180138
  const configFileSpecs = config.parsedCommandLine.options.configFile.configFileSpecs;
180082
180139
  const fileNames = getFileNamesFromConfigSpecs(
180083
180140
  configFileSpecs,
@@ -180090,7 +180147,7 @@ var _ProjectService = class _ProjectService {
180090
180147
  return fileNames;
180091
180148
  }
180092
180149
  /** @internal */
180093
- setFileNamesOfAutoImportProviderProject(project, fileNames) {
180150
+ setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
180094
180151
  this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
180095
180152
  }
180096
180153
  /**
@@ -180619,7 +180676,7 @@ Dynamic files must always be opened with service's current directory or service
180619
180676
  this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
180620
180677
  if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
180621
180678
  this.configuredProjects.forEach((project) => {
180622
- if (project.hasExternalProjectRef() && project.pendingReload === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
180679
+ if (project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
180623
180680
  project.updateGraph();
180624
180681
  }
180625
180682
  });
@@ -180674,7 +180731,7 @@ Dynamic files must always be opened with service's current directory or service
180674
180731
  this.pendingEnsureProjectForOpenFiles = false;
180675
180732
  this.configFileExistenceInfoCache.forEach((info) => {
180676
180733
  if (info.config)
180677
- info.config.reloadLevel = 2 /* Full */;
180734
+ info.config.updateLevel = 2 /* Full */;
180678
180735
  });
180679
180736
  this.reloadConfiguredProjectForFiles(
180680
180737
  this.openFiles,
@@ -180726,8 +180783,8 @@ Dynamic files must always be opened with service's current directory or service
180726
180783
  if (!updatedProjects.has(project.canonicalConfigFilePath)) {
180727
180784
  updatedProjects.set(project.canonicalConfigFilePath, true);
180728
180785
  if (delayReload) {
180729
- project.pendingReload = 2 /* Full */;
180730
- project.pendingReloadReason = reason;
180786
+ project.pendingUpdateLevel = 2 /* Full */;
180787
+ project.pendingUpdateReason = reason;
180731
180788
  if (clearSemanticCache)
180732
180789
  this.clearSemanticCache(project);
180733
180790
  this.delayUpdateProjectGraph(project);
@@ -183486,7 +183543,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183486
183543
  if (needsJsResolution) {
183487
183544
  const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
183488
183545
  definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
183489
- const noDtsProject = project.getNoDtsResolutionProject([file]);
183546
+ const noDtsProject = project.getNoDtsResolutionProject(file);
183490
183547
  const ls = noDtsProject.getLanguageService();
183491
183548
  const jsDefinitions = (_a = ls.getDefinitionAtPosition(
183492
183549
  file,
@@ -183513,8 +183570,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183513
183570
  const ambientCandidates = definitions.filter((d) => toNormalizedPath(d.fileName) !== file && d.isAmbient);
183514
183571
  for (const candidate of some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain()) {
183515
183572
  const fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
183516
- if (!fileNameToSearch || !ensureRoot(noDtsProject, fileNameToSearch)) {
183573
+ if (!fileNameToSearch)
183517
183574
  continue;
183575
+ const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
183576
+ fileNameToSearch,
183577
+ noDtsProject.currentDirectory,
183578
+ noDtsProject.directoryStructureHost
183579
+ );
183580
+ if (!info)
183581
+ continue;
183582
+ if (!noDtsProject.containsScriptInfo(info)) {
183583
+ noDtsProject.addRoot(info);
183584
+ noDtsProject.updateGraph();
183518
183585
  }
183519
183586
  const noDtsProgram = ls.getProgram();
183520
183587
  const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
@@ -183617,16 +183684,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183617
183684
  }
183618
183685
  });
183619
183686
  }
183620
- function ensureRoot(project2, fileName) {
183621
- const info = project2.getScriptInfo(fileName);
183622
- if (!info)
183623
- return false;
183624
- if (!project2.containsScriptInfo(info)) {
183625
- project2.addRoot(info);
183626
- project2.updateGraph();
183627
- }
183628
- return true;
183629
- }
183630
183687
  }
183631
183688
  getEmitOutput(args) {
183632
183689
  const { file, project } = this.getFileAndProject(args);
@@ -185953,6 +186010,7 @@ __export(ts_server_exports4, {
185953
186010
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
185954
186011
  indent: () => indent2,
185955
186012
  initializeNodeSystem: () => initializeNodeSystem,
186013
+ isBackgroundProject: () => isBackgroundProject,
185956
186014
  isConfigFile: () => isConfigFile,
185957
186015
  isConfiguredProject: () => isConfiguredProject,
185958
186016
  isDynamicFileName: () => isDynamicFileName,
@@ -186745,7 +186803,6 @@ start(initializeNodeSystem(), require("os").platform());
186745
186803
  CompletionInfoFlags,
186746
186804
  CompletionTriggerKind,
186747
186805
  Completions,
186748
- ConfigFileProgramReloadLevel,
186749
186806
  ContainerFlags,
186750
186807
  ContextFlags,
186751
186808
  Debug,
@@ -186832,6 +186889,7 @@ start(initializeNodeSystem(), require("os").platform());
186832
186889
  PragmaKindFlags,
186833
186890
  PrivateIdentifierKind,
186834
186891
  ProcessLevel,
186892
+ ProgramUpdateLevel,
186835
186893
  QuotePreference,
186836
186894
  RelationComparisonResult,
186837
186895
  Rename,