@typescript-deploys/pr-build 5.3.0-pr-56048-8 → 5.3.0-pr-55267-31

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) {
@@ -44634,9 +44661,6 @@ function createBinder() {
44634
44661
  case 213 /* CallExpression */:
44635
44662
  return hasNarrowableArgument(expr);
44636
44663
  case 217 /* ParenthesizedExpression */:
44637
- if (isJSDocTypeAssertion(expr)) {
44638
- return false;
44639
- }
44640
44664
  case 235 /* NonNullExpression */:
44641
44665
  return isNarrowingExpression(expr.expression);
44642
44666
  case 226 /* BinaryExpression */:
@@ -78066,8 +78090,20 @@ function createTypeChecker(host) {
78066
78090
  let hasReturnWithNoExpression = functionHasImplicitReturn(func);
78067
78091
  let hasReturnOfTypeNever = false;
78068
78092
  forEachReturnStatement(func.body, (returnStatement) => {
78069
- const expr = returnStatement.expression;
78093
+ let expr = returnStatement.expression;
78070
78094
  if (expr) {
78095
+ expr = skipParentheses(
78096
+ expr,
78097
+ /*excludeJSDocTypeAssertions*/
78098
+ true
78099
+ );
78100
+ if (functionFlags & 2 /* Async */ && expr.kind === 223 /* AwaitExpression */) {
78101
+ expr = skipParentheses(
78102
+ expr.expression,
78103
+ /*excludeJSDocTypeAssertions*/
78104
+ true
78105
+ );
78106
+ }
78071
78107
  if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
78072
78108
  hasReturnOfTypeNever = true;
78073
78109
  return;
@@ -119770,12 +119806,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
119770
119806
  cachedReadDirectoryResult.clear();
119771
119807
  }
119772
119808
  }
119773
- var ConfigFileProgramReloadLevel = /* @__PURE__ */ ((ConfigFileProgramReloadLevel2) => {
119774
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["None"] = 0] = "None";
119775
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Partial"] = 1] = "Partial";
119776
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Full"] = 2] = "Full";
119777
- return ConfigFileProgramReloadLevel2;
119778
- })(ConfigFileProgramReloadLevel || {});
119809
+ var ProgramUpdateLevel = /* @__PURE__ */ ((ProgramUpdateLevel2) => {
119810
+ ProgramUpdateLevel2[ProgramUpdateLevel2["Update"] = 0] = "Update";
119811
+ ProgramUpdateLevel2[ProgramUpdateLevel2["RootNamesAndUpdate"] = 1] = "RootNamesAndUpdate";
119812
+ ProgramUpdateLevel2[ProgramUpdateLevel2["Full"] = 2] = "Full";
119813
+ return ProgramUpdateLevel2;
119814
+ })(ProgramUpdateLevel || {});
119779
119815
  function updateSharedExtendedConfigFileWatcher(projectPath, options, extendedConfigFilesMap, createExtendedConfigFileWatch, toPath3) {
119780
119816
  var _a;
119781
119817
  const extendedConfigs = arrayToMap(((_a = options == null ? void 0 : options.configFile) == null ? void 0 : _a.extendedSourceFiles) || emptyArray, toPath3);
@@ -125986,6 +126022,10 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
125986
126022
  function getRootPathSplitLength(rootPath) {
125987
126023
  return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
125988
126024
  }
126025
+ function getModuleResolutionHost(resolutionHost) {
126026
+ var _a;
126027
+ return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126028
+ }
125989
126029
  function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
125990
126030
  return {
125991
126031
  nameAndMode: moduleResolutionNameAndModeGetter,
@@ -126001,8 +126041,7 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
126001
126041
  };
126002
126042
  }
126003
126043
  function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
126004
- var _a;
126005
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126044
+ const host = getModuleResolutionHost(resolutionHost);
126006
126045
  const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
126007
126046
  if (!resolutionHost.getGlobalCache) {
126008
126047
  return primaryResult;
@@ -126173,6 +126212,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126173
126212
  };
126174
126213
  }
126175
126214
  function startCachingPerDirectoryResolution() {
126215
+ moduleResolutionCache.isReadonly = void 0;
126216
+ typeReferenceDirectiveResolutionCache.isReadonly = void 0;
126217
+ libraryResolutionCache.isReadonly = void 0;
126218
+ moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
126176
126219
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
126177
126220
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
126178
126221
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
@@ -126230,6 +126273,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126230
126273
  directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
126231
126274
  fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
126232
126275
  hasChangedAutomaticTypeDirectiveNames = false;
126276
+ moduleResolutionCache.isReadonly = true;
126277
+ typeReferenceDirectiveResolutionCache.isReadonly = true;
126278
+ libraryResolutionCache.isReadonly = true;
126279
+ moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
126233
126280
  }
126234
126281
  function closeDirectoryWatchesOfFailedLookup(watcher, path) {
126235
126282
  if (watcher.refCount === 0) {
@@ -126258,7 +126305,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126258
126305
  shouldRetryResolution,
126259
126306
  logChanges
126260
126307
  }) {
126261
- var _a;
126262
126308
  const path = resolutionHost.toPath(containingFile);
126263
126309
  const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
126264
126310
  const resolvedModules = [];
@@ -126290,7 +126336,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126290
126336
  logChanges = false;
126291
126337
  }
126292
126338
  } else {
126293
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126339
+ const host = getModuleResolutionHost(resolutionHost);
126294
126340
  if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
126295
126341
  const resolved = getResolutionWithResolvedFileName(resolution);
126296
126342
  trace(
@@ -126342,7 +126388,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126342
126388
  }
126343
126389
  }
126344
126390
  function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
126345
- var _a;
126346
126391
  return resolveNamesWithLocalCache({
126347
126392
  entries: typeDirectiveReferences,
126348
126393
  containingFile,
@@ -126355,7 +126400,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126355
126400
  containingFile,
126356
126401
  redirectedReference,
126357
126402
  options,
126358
- ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
126403
+ getModuleResolutionHost(resolutionHost),
126359
126404
  typeReferenceDirectiveResolutionCache
126360
126405
  ),
126361
126406
  getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
@@ -126387,8 +126432,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126387
126432
  });
126388
126433
  }
126389
126434
  function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
126390
- var _a;
126391
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126435
+ const host = getModuleResolutionHost(resolutionHost);
126392
126436
  let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
126393
126437
  if (!resolution || resolution.isInvalidated) {
126394
126438
  const existingResolution = resolution;
@@ -126422,6 +126466,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126422
126466
  return resolution;
126423
126467
  }
126424
126468
  function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
126469
+ var _a, _b;
126425
126470
  const path = resolutionHost.toPath(containingFile);
126426
126471
  const resolutionsInFile = resolvedModuleNames.get(path);
126427
126472
  const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(
@@ -126431,7 +126476,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126431
126476
  );
126432
126477
  if (resolution && !resolution.isInvalidated)
126433
126478
  return resolution;
126434
- return resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, resolutionHost.getCompilationSettings());
126479
+ const data = (_a = resolutionHost.beforeResolveSingleModuleNameWithoutWatching) == null ? void 0 : _a.call(resolutionHost, moduleResolutionCache);
126480
+ const host = getModuleResolutionHost(resolutionHost);
126481
+ const result = resolveModuleName(
126482
+ moduleName,
126483
+ containingFile,
126484
+ resolutionHost.getCompilationSettings(),
126485
+ host,
126486
+ moduleResolutionCache
126487
+ );
126488
+ (_b = resolutionHost.afterResolveSingleModuleNameWithoutWatching) == null ? void 0 : _b.call(resolutionHost, moduleResolutionCache, moduleName, containingFile, result, data);
126489
+ return result;
126435
126490
  }
126436
126491
  function isNodeModulesAtTypesDirectory(dirPath) {
126437
126492
  return endsWith(dirPath, "/node_modules/@types");
@@ -127602,7 +127657,7 @@ function createWatchCompilerHost2(rootFilesOrConfigFileName, options, system, cr
127602
127657
  }
127603
127658
  function createWatchProgram(host) {
127604
127659
  let builderProgram;
127605
- let reloadLevel;
127660
+ let updateLevel;
127606
127661
  let missingFilesMap;
127607
127662
  let watchedWildcardDirectories;
127608
127663
  let timerToUpdateProgram;
@@ -127961,7 +128016,7 @@ function createWatchProgram(host) {
127961
128016
  }
127962
128017
  function scheduleProgramReload() {
127963
128018
  Debug.assert(!!configFileName);
127964
- reloadLevel = 2 /* Full */;
128019
+ updateLevel = 2 /* Full */;
127965
128020
  scheduleProgramUpdate();
127966
128021
  }
127967
128022
  function updateProgramWithWatchStatus() {
@@ -127971,8 +128026,8 @@ function createWatchProgram(host) {
127971
128026
  }
127972
128027
  function updateProgram() {
127973
128028
  var _a, _b, _c, _d;
127974
- switch (reloadLevel) {
127975
- case 1 /* Partial */:
128029
+ switch (updateLevel) {
128030
+ case 1 /* RootNamesAndUpdate */:
127976
128031
  (_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
127977
128032
  reloadFileNamesFromConfigFile();
127978
128033
  break;
@@ -127992,7 +128047,7 @@ function createWatchProgram(host) {
127992
128047
  writeLog("Reloading new file names and options");
127993
128048
  Debug.assert(compilerOptions);
127994
128049
  Debug.assert(configFileName);
127995
- reloadLevel = 0 /* None */;
128050
+ updateLevel = 0 /* Update */;
127996
128051
  rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
127997
128052
  if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
127998
128053
  hasChangedConfigFileParsingErrors = true;
@@ -128002,7 +128057,7 @@ function createWatchProgram(host) {
128002
128057
  function reloadConfigFile() {
128003
128058
  Debug.assert(configFileName);
128004
128059
  writeLog(`Reloading config file: ${configFileName}`);
128005
- reloadLevel = 0 /* None */;
128060
+ updateLevel = 0 /* Update */;
128006
128061
  if (cachedDirectoryStructureHost) {
128007
128062
  cachedDirectoryStructureHost.clearCache();
128008
128063
  }
@@ -128039,9 +128094,9 @@ function createWatchProgram(host) {
128039
128094
  const configPath = toPath3(configFileName2);
128040
128095
  let config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
128041
128096
  if (config) {
128042
- if (!config.reloadLevel)
128097
+ if (!config.updateLevel)
128043
128098
  return config.parsedCommandLine;
128044
- if (config.parsedCommandLine && config.reloadLevel === 1 /* Partial */ && !host.getParsedCommandLine) {
128099
+ if (config.parsedCommandLine && config.updateLevel === 1 /* RootNamesAndUpdate */ && !host.getParsedCommandLine) {
128045
128100
  writeLog("Reloading new file names and options");
128046
128101
  Debug.assert(compilerOptions);
128047
128102
  const fileNames = getFileNamesFromConfigSpecs(
@@ -128051,7 +128106,7 @@ function createWatchProgram(host) {
128051
128106
  parseConfigFileHost
128052
128107
  );
128053
128108
  config.parsedCommandLine = { ...config.parsedCommandLine, fileNames };
128054
- config.reloadLevel = void 0;
128109
+ config.updateLevel = void 0;
128055
128110
  return config.parsedCommandLine;
128056
128111
  }
128057
128112
  }
@@ -128059,7 +128114,7 @@ function createWatchProgram(host) {
128059
128114
  const parsedCommandLine = host.getParsedCommandLine ? host.getParsedCommandLine(configFileName2) : getParsedCommandLineFromConfigFileHost(configFileName2);
128060
128115
  if (config) {
128061
128116
  config.parsedCommandLine = parsedCommandLine;
128062
- config.reloadLevel = void 0;
128117
+ config.updateLevel = void 0;
128063
128118
  } else {
128064
128119
  (parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config = { parsedCommandLine });
128065
128120
  }
@@ -128156,8 +128211,8 @@ function createWatchProgram(host) {
128156
128211
  toPath: toPath3
128157
128212
  }))
128158
128213
  return;
128159
- if (reloadLevel !== 2 /* Full */) {
128160
- reloadLevel = 1 /* Partial */;
128214
+ if (updateLevel !== 2 /* Full */) {
128215
+ updateLevel = 1 /* RootNamesAndUpdate */;
128161
128216
  scheduleProgramUpdate();
128162
128217
  }
128163
128218
  },
@@ -128183,11 +128238,11 @@ function createWatchProgram(host) {
128183
128238
  return;
128184
128239
  projects.forEach((projectPath) => {
128185
128240
  if (configFileName && toPath3(configFileName) === projectPath) {
128186
- reloadLevel = 2 /* Full */;
128241
+ updateLevel = 2 /* Full */;
128187
128242
  } else {
128188
128243
  const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
128189
128244
  if (config)
128190
- config.reloadLevel = 2 /* Full */;
128245
+ config.updateLevel = 2 /* Full */;
128191
128246
  resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
128192
128247
  }
128193
128248
  scheduleProgramUpdate();
@@ -128208,7 +128263,7 @@ function createWatchProgram(host) {
128208
128263
  updateCachedSystemWithFile(configFileName2, configPath, eventKind);
128209
128264
  const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
128210
128265
  if (config)
128211
- config.reloadLevel = 2 /* Full */;
128266
+ config.updateLevel = 2 /* Full */;
128212
128267
  resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
128213
128268
  scheduleProgramUpdate();
128214
128269
  },
@@ -128246,8 +128301,8 @@ function createWatchProgram(host) {
128246
128301
  toPath: toPath3
128247
128302
  }))
128248
128303
  return;
128249
- if (config.reloadLevel !== 2 /* Full */) {
128250
- config.reloadLevel = 1 /* Partial */;
128304
+ if (config.updateLevel !== 2 /* Full */) {
128305
+ config.updateLevel = 1 /* RootNamesAndUpdate */;
128251
128306
  scheduleProgramUpdate();
128252
128307
  }
128253
128308
  },
@@ -128710,12 +128765,12 @@ function clearProjectStatus(state, resolved) {
128710
128765
  state.projectStatus.delete(resolved);
128711
128766
  state.diagnostics.delete(resolved);
128712
128767
  }
128713
- function addProjToQueue({ projectPendingBuild }, proj, reloadLevel) {
128768
+ function addProjToQueue({ projectPendingBuild }, proj, updateLevel) {
128714
128769
  const value = projectPendingBuild.get(proj);
128715
128770
  if (value === void 0) {
128716
- projectPendingBuild.set(proj, reloadLevel);
128717
- } else if (value < reloadLevel) {
128718
- projectPendingBuild.set(proj, reloadLevel);
128771
+ projectPendingBuild.set(proj, updateLevel);
128772
+ } else if (value < updateLevel) {
128773
+ projectPendingBuild.set(proj, updateLevel);
128719
128774
  }
128720
128775
  }
128721
128776
  function setupInitialBuild(state, cancellationToken) {
@@ -128729,7 +128784,7 @@ function setupInitialBuild(state, cancellationToken) {
128729
128784
  buildOrder.forEach(
128730
128785
  (configFileName) => state.projectPendingBuild.set(
128731
128786
  toResolvedConfigFilePath(state, configFileName),
128732
- 0 /* None */
128787
+ 0 /* Update */
128733
128788
  )
128734
128789
  );
128735
128790
  if (cancellationToken) {
@@ -129171,8 +129226,8 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
129171
129226
  for (let projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) {
129172
129227
  const project = buildOrder[projectIndex];
129173
129228
  const projectPath = toResolvedConfigFilePath(state, project);
129174
- const reloadLevel = state.projectPendingBuild.get(projectPath);
129175
- if (reloadLevel === void 0)
129229
+ const updateLevel = state.projectPendingBuild.get(projectPath);
129230
+ if (updateLevel === void 0)
129176
129231
  continue;
129177
129232
  if (reportQueue) {
129178
129233
  reportQueue = false;
@@ -129184,13 +129239,13 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
129184
129239
  projectPendingBuild.delete(projectPath);
129185
129240
  continue;
129186
129241
  }
129187
- if (reloadLevel === 2 /* Full */) {
129242
+ if (updateLevel === 2 /* Full */) {
129188
129243
  watchConfigFile(state, project, projectPath, config);
129189
129244
  watchExtendedConfigFiles(state, projectPath, config);
129190
129245
  watchWildCardDirectories(state, project, projectPath, config);
129191
129246
  watchInputFiles(state, project, projectPath, config);
129192
129247
  watchPackageJsonFiles(state, project, projectPath, config);
129193
- } else if (reloadLevel === 1 /* Partial */) {
129248
+ } else if (updateLevel === 1 /* RootNamesAndUpdate */) {
129194
129249
  config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, getDirectoryPath(project), config.options, state.parseConfigFileHost);
129195
129250
  updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, canJsonReportNoInputFiles(config.raw));
129196
129251
  watchInputFiles(state, project, projectPath, config);
@@ -129777,7 +129832,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
129777
129832
  break;
129778
129833
  }
129779
129834
  }
129780
- addProjToQueue(state, nextProjectPath, 0 /* None */);
129835
+ addProjToQueue(state, nextProjectPath, 0 /* Update */);
129781
129836
  break;
129782
129837
  }
129783
129838
  }
@@ -129846,7 +129901,7 @@ function cleanWorker(state, project, onlyReferences) {
129846
129901
  filesToDelete.push(output);
129847
129902
  } else {
129848
129903
  host.deleteFile(output);
129849
- invalidateProject(state, resolvedPath, 0 /* None */);
129904
+ invalidateProject(state, resolvedPath, 0 /* Update */);
129850
129905
  }
129851
129906
  }
129852
129907
  }
@@ -129857,22 +129912,22 @@ function cleanWorker(state, project, onlyReferences) {
129857
129912
  }
129858
129913
  return 0 /* Success */;
129859
129914
  }
129860
- function invalidateProject(state, resolved, reloadLevel) {
129861
- if (state.host.getParsedCommandLine && reloadLevel === 1 /* Partial */) {
129862
- reloadLevel = 2 /* Full */;
129915
+ function invalidateProject(state, resolved, updateLevel) {
129916
+ if (state.host.getParsedCommandLine && updateLevel === 1 /* RootNamesAndUpdate */) {
129917
+ updateLevel = 2 /* Full */;
129863
129918
  }
129864
- if (reloadLevel === 2 /* Full */) {
129919
+ if (updateLevel === 2 /* Full */) {
129865
129920
  state.configFileCache.delete(resolved);
129866
129921
  state.buildOrder = void 0;
129867
129922
  }
129868
129923
  state.needsSummary = true;
129869
129924
  clearProjectStatus(state, resolved);
129870
- addProjToQueue(state, resolved, reloadLevel);
129925
+ addProjToQueue(state, resolved, updateLevel);
129871
129926
  enableCache(state);
129872
129927
  }
129873
- function invalidateProjectAndScheduleBuilds(state, resolvedPath, reloadLevel) {
129928
+ function invalidateProjectAndScheduleBuilds(state, resolvedPath, updateLevel) {
129874
129929
  state.reportFileChangeDetected = true;
129875
- invalidateProject(state, resolvedPath, reloadLevel);
129930
+ invalidateProject(state, resolvedPath, updateLevel);
129876
129931
  scheduleBuildInvalidatedProject(
129877
129932
  state,
129878
129933
  250,
@@ -130003,7 +130058,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
130003
130058
  toPath: (fileName) => toPath2(state, fileName)
130004
130059
  }))
130005
130060
  return;
130006
- invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* Partial */);
130061
+ invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* RootNamesAndUpdate */);
130007
130062
  },
130008
130063
  flags,
130009
130064
  parsed == null ? void 0 : parsed.watchOptions,
@@ -130022,7 +130077,7 @@ function watchInputFiles(state, resolved, resolvedPath, parsed) {
130022
130077
  createNewValue: (_path, input) => watchFile(
130023
130078
  state,
130024
130079
  input,
130025
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* None */),
130080
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130026
130081
  250 /* Low */,
130027
130082
  parsed == null ? void 0 : parsed.watchOptions,
130028
130083
  WatchType.SourceFile,
@@ -130042,7 +130097,7 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
130042
130097
  createNewValue: (path, _input) => watchFile(
130043
130098
  state,
130044
130099
  path,
130045
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* None */),
130100
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130046
130101
  2e3 /* High */,
130047
130102
  parsed == null ? void 0 : parsed.watchOptions,
130048
130103
  WatchType.PackageJson,
@@ -130113,7 +130168,7 @@ function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, opti
130113
130168
  const configFilePath = toResolvedConfigFilePath(state, configFileName);
130114
130169
  return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath);
130115
130170
  },
130116
- invalidateProject: (configFilePath, reloadLevel) => invalidateProject(state, configFilePath, reloadLevel || 0 /* None */),
130171
+ invalidateProject: (configFilePath, updateLevel) => invalidateProject(state, configFilePath, updateLevel || 0 /* Update */),
130117
130172
  close: () => stopWatching(state)
130118
130173
  };
130119
130174
  }
@@ -172057,7 +172112,6 @@ __export(ts_exports2, {
172057
172112
  CompletionInfoFlags: () => CompletionInfoFlags,
172058
172113
  CompletionTriggerKind: () => CompletionTriggerKind,
172059
172114
  Completions: () => ts_Completions_exports,
172060
- ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
172061
172115
  ContainerFlags: () => ContainerFlags,
172062
172116
  ContextFlags: () => ContextFlags,
172063
172117
  Debug: () => Debug,
@@ -172144,6 +172198,7 @@ __export(ts_exports2, {
172144
172198
  PragmaKindFlags: () => PragmaKindFlags,
172145
172199
  PrivateIdentifierKind: () => PrivateIdentifierKind,
172146
172200
  ProcessLevel: () => ProcessLevel,
172201
+ ProgramUpdateLevel: () => ProgramUpdateLevel,
172147
172202
  QuotePreference: () => QuotePreference,
172148
172203
  RelationComparisonResult: () => RelationComparisonResult,
172149
172204
  Rename: () => ts_Rename_exports,
@@ -174535,6 +174590,7 @@ __export(ts_server_exports3, {
174535
174590
  hasArgument: () => hasArgument,
174536
174591
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
174537
174592
  indent: () => indent2,
174593
+ isBackgroundProject: () => isBackgroundProject,
174538
174594
  isConfigFile: () => isConfigFile,
174539
174595
  isConfiguredProject: () => isConfiguredProject,
174540
174596
  isDynamicFileName: () => isDynamicFileName,
@@ -175802,7 +175858,7 @@ var ScriptInfo = class {
175802
175858
  isContainedByBackgroundProject() {
175803
175859
  return some(
175804
175860
  this.containingProjects,
175805
- (p) => p.projectKind === 3 /* AutoImportProvider */ || p.projectKind === 4 /* Auxiliary */
175861
+ isBackgroundProject
175806
175862
  );
175807
175863
  }
175808
175864
  /**
@@ -175833,7 +175889,7 @@ var ScriptInfo = class {
175833
175889
  }
175834
175890
  };
175835
175891
  function ensurePrimaryProjectKind(project) {
175836
- if (!project || project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */) {
175892
+ if (!project || isBackgroundProject(project)) {
175837
175893
  return Errors.ThrowNoProject();
175838
175894
  }
175839
175895
  return project;
@@ -176119,9 +176175,10 @@ var Project3 = class _Project {
176119
176175
  this.disableLanguageService(lastFileExceededProgramSize);
176120
176176
  }
176121
176177
  this.markAsDirty();
176122
- if (projectKind !== 3 /* AutoImportProvider */) {
176178
+ if (!isBackgroundProject(this)) {
176123
176179
  this.projectService.pendingEnsureProjectForOpenFiles = true;
176124
176180
  }
176181
+ this.projectService.onProjectCreation(this);
176125
176182
  }
176126
176183
  /** @internal */
176127
176184
  getResolvedProjectReferenceToRedirect(_fileName) {
@@ -176291,6 +176348,7 @@ var Project3 = class _Project {
176291
176348
  resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
176292
176349
  return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
176293
176350
  }
176351
+ /** @internal */
176294
176352
  getModuleResolutionCache() {
176295
176353
  return this.resolutionCache.getModuleResolutionCache();
176296
176354
  }
@@ -176556,12 +176614,12 @@ var Project3 = class _Project {
176556
176614
  }
176557
176615
  return { ...newTypeAcquisition, include: this.removeExistingTypings(newTypeAcquisition.include) };
176558
176616
  }
176559
- getExternalFiles() {
176617
+ getExternalFiles(updateLevel) {
176560
176618
  return sort(flatMap(this.plugins, (plugin) => {
176561
176619
  if (typeof plugin.module.getExternalFiles !== "function")
176562
176620
  return;
176563
176621
  try {
176564
- return plugin.module.getExternalFiles(this);
176622
+ return plugin.module.getExternalFiles(this, updateLevel || 0 /* Update */);
176565
176623
  } catch (e) {
176566
176624
  this.projectService.logger.info(`A plugin threw an exception in getExternalFiles: ${e}`);
176567
176625
  if (e.stack) {
@@ -177296,6 +177354,7 @@ var Project3 = class _Project {
177296
177354
  }
177297
177355
  /** @internal */
177298
177356
  getChangesSinceVersion(lastKnownVersion, includeProjectReferenceRedirectInfo) {
177357
+ var _a, _b;
177299
177358
  const includeProjectReferenceRedirectInfoIfRequested = includeProjectReferenceRedirectInfo ? (files) => arrayFrom(files.entries(), ([fileName, isSourceOfProjectReferenceRedirect]) => ({
177300
177359
  fileName,
177301
177360
  isSourceOfProjectReferenceRedirect
@@ -177318,10 +177377,10 @@ var Project3 = class _Project {
177318
177377
  return { info, projectErrors: this.getGlobalProjectErrors() };
177319
177378
  }
177320
177379
  const lastReportedFileNames = this.lastReportedFileNames;
177321
- const externalFiles = this.getExternalFiles().map((f) => ({
177380
+ const externalFiles = ((_a = this.externalFiles) == null ? void 0 : _a.map((f) => ({
177322
177381
  fileName: toNormalizedPath(f),
177323
177382
  isSourceOfProjectReferenceRedirect: false
177324
- }));
177383
+ }))) || emptyArray2;
177325
177384
  const currentFiles = arrayToMap(
177326
177385
  this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo).concat(externalFiles),
177327
177386
  (info2) => info2.fileName,
@@ -177363,10 +177422,10 @@ var Project3 = class _Project {
177363
177422
  };
177364
177423
  } else {
177365
177424
  const projectFileNames = this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo);
177366
- const externalFiles = this.getExternalFiles().map((f) => ({
177425
+ const externalFiles = ((_b = this.externalFiles) == null ? void 0 : _b.map((f) => ({
177367
177426
  fileName: toNormalizedPath(f),
177368
177427
  isSourceOfProjectReferenceRedirect: false
177369
- }));
177428
+ }))) || emptyArray2;
177370
177429
  const allFiles = projectFileNames.concat(externalFiles);
177371
177430
  this.lastReportedFileNames = arrayToMap(
177372
177431
  allFiles,
@@ -177568,32 +177627,15 @@ var Project3 = class _Project {
177568
177627
  return this.projectService.getIncompleteCompletionsCache();
177569
177628
  }
177570
177629
  /** @internal */
177571
- getNoDtsResolutionProject(rootFileNames) {
177630
+ getNoDtsResolutionProject(rootFile) {
177572
177631
  Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
177573
177632
  if (!this.noDtsResolutionProject) {
177574
177633
  this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
177575
177634
  }
177576
- enumerateInsertsAndDeletes(
177577
- rootFileNames.map(toNormalizedPath),
177578
- this.noDtsResolutionProject.getRootFiles(),
177579
- getStringComparer(!this.useCaseSensitiveFileNames()),
177580
- (pathToAdd) => {
177581
- const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
177582
- pathToAdd,
177583
- this.currentDirectory,
177584
- this.noDtsResolutionProject.directoryStructureHost
177585
- );
177586
- if (info) {
177587
- this.noDtsResolutionProject.addRoot(info, pathToAdd);
177588
- }
177589
- },
177590
- (pathToRemove) => {
177591
- const info = this.noDtsResolutionProject.getScriptInfo(pathToRemove);
177592
- if (info) {
177593
- this.noDtsResolutionProject.removeRoot(info);
177594
- }
177595
- }
177596
- );
177635
+ if (this.noDtsResolutionProject.rootFile !== rootFile) {
177636
+ this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this.noDtsResolutionProject, [rootFile]);
177637
+ this.noDtsResolutionProject.rootFile = rootFile;
177638
+ }
177597
177639
  return this.noDtsResolutionProject;
177598
177640
  }
177599
177641
  /** @internal */
@@ -177925,7 +177967,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177925
177967
  this.getCompilationSettings()
177926
177968
  );
177927
177969
  }
177928
- this.projectService.setFileNamesOfAutoImportProviderProject(this, rootFileNames);
177970
+ this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this, rootFileNames);
177929
177971
  this.rootFileNames = rootFileNames;
177930
177972
  const oldProgram = this.getCurrentProgram();
177931
177973
  const hasSameSetOfFiles = super.updateGraph();
@@ -178070,18 +178112,18 @@ var ConfiguredProject2 = class extends Project3 {
178070
178112
  updateGraph() {
178071
178113
  const isInitialLoad = this.isInitialLoadPending();
178072
178114
  this.isInitialLoadPending = returnFalse;
178073
- const reloadLevel = this.pendingReload;
178074
- this.pendingReload = 0 /* None */;
178115
+ const updateLevel = this.pendingUpdateLevel;
178116
+ this.pendingUpdateLevel = 0 /* Update */;
178075
178117
  let result;
178076
- switch (reloadLevel) {
178077
- case 1 /* Partial */:
178118
+ switch (updateLevel) {
178119
+ case 1 /* RootNamesAndUpdate */:
178078
178120
  this.openFileWatchTriggered.clear();
178079
178121
  result = this.projectService.reloadFileNamesOfConfiguredProject(this);
178080
178122
  break;
178081
178123
  case 2 /* Full */:
178082
178124
  this.openFileWatchTriggered.clear();
178083
- const reason = Debug.checkDefined(this.pendingReloadReason);
178084
- this.pendingReloadReason = void 0;
178125
+ const reason = Debug.checkDefined(this.pendingUpdateReason);
178126
+ this.pendingUpdateReason = void 0;
178085
178127
  this.projectService.reloadConfiguredProject(
178086
178128
  this,
178087
178129
  reason,
@@ -178281,6 +178323,9 @@ function isConfiguredProject(project) {
178281
178323
  function isExternalProject(project) {
178282
178324
  return project.projectKind === 2 /* External */;
178283
178325
  }
178326
+ function isBackgroundProject(project) {
178327
+ return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
178328
+ }
178284
178329
 
178285
178330
  // src/server/editorServices.ts
178286
178331
  var maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
@@ -178721,6 +178766,8 @@ var _ProjectService = class _ProjectService {
178721
178766
  this.verifyDocumentRegistry = noop;
178722
178767
  /** @internal */
178723
178768
  this.verifyProgram = noop;
178769
+ /** @internal */
178770
+ this.onProjectCreation = noop;
178724
178771
  var _a;
178725
178772
  this.host = opts.host;
178726
178773
  this.logger = opts.logger;
@@ -178888,20 +178935,20 @@ var _ProjectService = class _ProjectService {
178888
178935
  }
178889
178936
  delayUpdateProjectGraph(project) {
178890
178937
  project.markAsDirty();
178891
- if (project.projectKind !== 3 /* AutoImportProvider */ && project.projectKind !== 4 /* Auxiliary */) {
178892
- const projectName = project.getProjectName();
178893
- this.pendingProjectUpdates.set(projectName, project);
178894
- this.throttledOperations.schedule(
178895
- projectName,
178896
- /*delay*/
178897
- 250,
178898
- () => {
178899
- if (this.pendingProjectUpdates.delete(projectName)) {
178900
- updateProjectIfDirty(project);
178901
- }
178938
+ if (isBackgroundProject(project))
178939
+ return;
178940
+ const projectName = project.getProjectName();
178941
+ this.pendingProjectUpdates.set(projectName, project);
178942
+ this.throttledOperations.schedule(
178943
+ projectName,
178944
+ /*delay*/
178945
+ 250,
178946
+ () => {
178947
+ if (this.pendingProjectUpdates.delete(projectName)) {
178948
+ updateProjectIfDirty(project);
178902
178949
  }
178903
- );
178904
- }
178950
+ }
178951
+ );
178905
178952
  }
178906
178953
  /** @internal */
178907
178954
  hasPendingProjectUpdate(project) {
@@ -179177,28 +179224,28 @@ var _ProjectService = class _ProjectService {
179177
179224
  getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
179178
179225
  }))
179179
179226
  return;
179180
- if (config.reloadLevel !== 2 /* Full */)
179181
- config.reloadLevel = 1 /* Partial */;
179227
+ if (config.updateLevel !== 2 /* Full */)
179228
+ config.updateLevel = 1 /* RootNamesAndUpdate */;
179182
179229
  config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
179183
179230
  if (!watchWildcardDirectories)
179184
179231
  return;
179185
179232
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
179186
179233
  if (!project)
179187
179234
  return;
179188
- const reloadLevel = configuredProjectForConfig === project ? 1 /* Partial */ : 0 /* None */;
179189
- if (project.pendingReload !== void 0 && project.pendingReload > reloadLevel)
179235
+ const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
179236
+ if (project.pendingUpdateLevel !== void 0 && project.pendingUpdateLevel > updateLevel)
179190
179237
  return;
179191
179238
  if (this.openFiles.has(fileOrDirectoryPath)) {
179192
179239
  const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
179193
179240
  if (info.isAttached(project)) {
179194
- const loadLevelToSet = Math.max(reloadLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* None */);
179241
+ const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
179195
179242
  project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
179196
179243
  } else {
179197
- project.pendingReload = reloadLevel;
179244
+ project.pendingUpdateLevel = updateLevel;
179198
179245
  this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
179199
179246
  }
179200
179247
  } else {
179201
- project.pendingReload = reloadLevel;
179248
+ project.pendingUpdateLevel = updateLevel;
179202
179249
  this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
179203
179250
  }
179204
179251
  });
@@ -179210,12 +179257,12 @@ var _ProjectService = class _ProjectService {
179210
179257
  );
179211
179258
  }
179212
179259
  /** @internal */
179213
- delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, reloadReason) {
179260
+ delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
179214
179261
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
179215
179262
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config))
179216
179263
  return false;
179217
179264
  let scheduledAnyProjectUpdate = false;
179218
- configFileExistenceInfo.config.reloadLevel = 2 /* Full */;
179265
+ configFileExistenceInfo.config.updateLevel = 2 /* Full */;
179219
179266
  configFileExistenceInfo.config.projects.forEach((_watchWildcardDirectories, projectCanonicalPath) => {
179220
179267
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
179221
179268
  if (!project)
@@ -179224,8 +179271,8 @@ var _ProjectService = class _ProjectService {
179224
179271
  if (projectCanonicalPath === canonicalConfigFilePath) {
179225
179272
  if (project.isInitialLoadPending())
179226
179273
  return;
179227
- project.pendingReload = 2 /* Full */;
179228
- project.pendingReloadReason = reloadReason;
179274
+ project.pendingUpdateLevel = 2 /* Full */;
179275
+ project.pendingUpdateReason = loadReason;
179229
179276
  this.delayUpdateProjectGraph(project);
179230
179277
  } else {
179231
179278
  project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(this.toPath(canonicalConfigFilePath));
@@ -179374,11 +179421,11 @@ var _ProjectService = class _ProjectService {
179374
179421
  if (info.hasMixedContent) {
179375
179422
  info.registerFileUpdate();
179376
179423
  }
179377
- const reloadLevel = p.openFileWatchTriggered.get(info.path);
179378
- if (reloadLevel !== void 0) {
179424
+ const updateLevel = p.openFileWatchTriggered.get(info.path);
179425
+ if (updateLevel !== void 0) {
179379
179426
  p.openFileWatchTriggered.delete(info.path);
179380
- if (p.pendingReload !== void 0 && p.pendingReload < reloadLevel) {
179381
- p.pendingReload = reloadLevel;
179427
+ if (p.pendingUpdateLevel !== void 0 && p.pendingUpdateLevel < updateLevel) {
179428
+ p.pendingUpdateLevel = updateLevel;
179382
179429
  p.markFileAsDirty(info.path);
179383
179430
  }
179384
179431
  }
@@ -179758,6 +179805,7 @@ var _ProjectService = class _ProjectService {
179758
179805
  addFilesToNonInferredProject(project, files, propertyReader, typeAcquisition) {
179759
179806
  this.updateNonInferredProjectFiles(project, files, propertyReader);
179760
179807
  project.setTypeAcquisition(typeAcquisition);
179808
+ project.markAsDirty();
179761
179809
  }
179762
179810
  /** @internal */
179763
179811
  createConfiguredProject(configFileName) {
@@ -179775,7 +179823,7 @@ var _ProjectService = class _ProjectService {
179775
179823
  configFileExistenceInfo.config = {
179776
179824
  cachedDirectoryStructureHost: createCachedDirectoryStructureHost(this.host, this.host.getCurrentDirectory(), this.host.useCaseSensitiveFileNames),
179777
179825
  projects: /* @__PURE__ */ new Map(),
179778
- reloadLevel: 2 /* Full */
179826
+ updateLevel: 2 /* Full */
179779
179827
  };
179780
179828
  }
179781
179829
  const project = new ConfiguredProject2(
@@ -179792,8 +179840,8 @@ var _ProjectService = class _ProjectService {
179792
179840
  /** @internal */
179793
179841
  createConfiguredProjectWithDelayLoad(configFileName, reason) {
179794
179842
  const project = this.createConfiguredProject(configFileName);
179795
- project.pendingReload = 2 /* Full */;
179796
- project.pendingReloadReason = reason;
179843
+ project.pendingUpdateLevel = 2 /* Full */;
179844
+ project.pendingUpdateReason = reason;
179797
179845
  return project;
179798
179846
  }
179799
179847
  /** @internal */
@@ -179849,7 +179897,7 @@ var _ProjectService = class _ProjectService {
179849
179897
  this.watchWildcards(configFilename, configFileExistenceInfo, project);
179850
179898
  }
179851
179899
  project.enablePluginsWithOptions(compilerOptions);
179852
- const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles());
179900
+ const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles(2 /* Full */));
179853
179901
  this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
179854
179902
  (_b = tracing) == null ? void 0 : _b.pop();
179855
179903
  }
@@ -179857,9 +179905,9 @@ var _ProjectService = class _ProjectService {
179857
179905
  ensureParsedConfigUptoDate(configFilename, canonicalConfigFilePath, configFileExistenceInfo, forProject) {
179858
179906
  var _a, _b, _c;
179859
179907
  if (configFileExistenceInfo.config) {
179860
- if (!configFileExistenceInfo.config.reloadLevel)
179908
+ if (!configFileExistenceInfo.config.updateLevel)
179861
179909
  return configFileExistenceInfo;
179862
- if (configFileExistenceInfo.config.reloadLevel === 1 /* Partial */) {
179910
+ if (configFileExistenceInfo.config.updateLevel === 1 /* RootNamesAndUpdate */) {
179863
179911
  this.reloadFileNamesOfParsedConfig(configFilename, configFileExistenceInfo.config);
179864
179912
  return configFileExistenceInfo;
179865
179913
  }
@@ -179902,7 +179950,7 @@ var _ProjectService = class _ProjectService {
179902
179950
  } else {
179903
179951
  configFileExistenceInfo.config.parsedCommandLine = parsedCommandLine;
179904
179952
  configFileExistenceInfo.config.watchedDirectoriesStale = true;
179905
- configFileExistenceInfo.config.reloadLevel = void 0;
179953
+ configFileExistenceInfo.config.updateLevel = void 0;
179906
179954
  }
179907
179955
  if (!oldCommandLine && !isJsonEqual(
179908
179956
  // Old options
@@ -180043,7 +180091,6 @@ var _ProjectService = class _ProjectService {
180043
180091
  }
180044
180092
  });
180045
180093
  }
180046
- project.markAsDirty();
180047
180094
  }
180048
180095
  updateRootAndOptionsOfNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) {
180049
180096
  project.setCompilerOptions(newOptions);
@@ -180061,14 +180108,15 @@ var _ProjectService = class _ProjectService {
180061
180108
  reloadFileNamesOfConfiguredProject(project) {
180062
180109
  const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
180063
180110
  project.updateErrorOnNoInputFiles(fileNames);
180064
- this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles()), fileNamePropertyReader);
180111
+ this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
180112
+ project.markAsDirty();
180065
180113
  return project.updateGraph();
180066
180114
  }
180067
180115
  /** @internal */
180068
180116
  reloadFileNamesOfParsedConfig(configFileName, config) {
180069
- if (config.reloadLevel === void 0)
180117
+ if (config.updateLevel === void 0)
180070
180118
  return config.parsedCommandLine.fileNames;
180071
- Debug.assert(config.reloadLevel === 1 /* Partial */);
180119
+ Debug.assert(config.updateLevel === 1 /* RootNamesAndUpdate */);
180072
180120
  const configFileSpecs = config.parsedCommandLine.options.configFile.configFileSpecs;
180073
180121
  const fileNames = getFileNamesFromConfigSpecs(
180074
180122
  configFileSpecs,
@@ -180081,7 +180129,7 @@ var _ProjectService = class _ProjectService {
180081
180129
  return fileNames;
180082
180130
  }
180083
180131
  /** @internal */
180084
- setFileNamesOfAutoImportProviderProject(project, fileNames) {
180132
+ setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
180085
180133
  this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
180086
180134
  }
180087
180135
  /**
@@ -180610,7 +180658,7 @@ Dynamic files must always be opened with service's current directory or service
180610
180658
  this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
180611
180659
  if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
180612
180660
  this.configuredProjects.forEach((project) => {
180613
- if (project.hasExternalProjectRef() && project.pendingReload === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
180661
+ if (project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
180614
180662
  project.updateGraph();
180615
180663
  }
180616
180664
  });
@@ -180665,7 +180713,7 @@ Dynamic files must always be opened with service's current directory or service
180665
180713
  this.pendingEnsureProjectForOpenFiles = false;
180666
180714
  this.configFileExistenceInfoCache.forEach((info) => {
180667
180715
  if (info.config)
180668
- info.config.reloadLevel = 2 /* Full */;
180716
+ info.config.updateLevel = 2 /* Full */;
180669
180717
  });
180670
180718
  this.reloadConfiguredProjectForFiles(
180671
180719
  this.openFiles,
@@ -180717,8 +180765,8 @@ Dynamic files must always be opened with service's current directory or service
180717
180765
  if (!updatedProjects.has(project.canonicalConfigFilePath)) {
180718
180766
  updatedProjects.set(project.canonicalConfigFilePath, true);
180719
180767
  if (delayReload) {
180720
- project.pendingReload = 2 /* Full */;
180721
- project.pendingReloadReason = reason;
180768
+ project.pendingUpdateLevel = 2 /* Full */;
180769
+ project.pendingUpdateReason = reason;
180722
180770
  if (clearSemanticCache)
180723
180771
  this.clearSemanticCache(project);
180724
180772
  this.delayUpdateProjectGraph(project);
@@ -183477,7 +183525,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183477
183525
  if (needsJsResolution) {
183478
183526
  const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
183479
183527
  definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
183480
- const noDtsProject = project.getNoDtsResolutionProject([file]);
183528
+ const noDtsProject = project.getNoDtsResolutionProject(file);
183481
183529
  const ls = noDtsProject.getLanguageService();
183482
183530
  const jsDefinitions = (_a = ls.getDefinitionAtPosition(
183483
183531
  file,
@@ -183504,8 +183552,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183504
183552
  const ambientCandidates = definitions.filter((d) => toNormalizedPath(d.fileName) !== file && d.isAmbient);
183505
183553
  for (const candidate of some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain()) {
183506
183554
  const fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
183507
- if (!fileNameToSearch || !ensureRoot(noDtsProject, fileNameToSearch)) {
183555
+ if (!fileNameToSearch)
183508
183556
  continue;
183557
+ const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
183558
+ fileNameToSearch,
183559
+ noDtsProject.currentDirectory,
183560
+ noDtsProject.directoryStructureHost
183561
+ );
183562
+ if (!info)
183563
+ continue;
183564
+ if (!noDtsProject.containsScriptInfo(info)) {
183565
+ noDtsProject.addRoot(info);
183566
+ noDtsProject.updateGraph();
183509
183567
  }
183510
183568
  const noDtsProgram = ls.getProgram();
183511
183569
  const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
@@ -183608,16 +183666,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183608
183666
  }
183609
183667
  });
183610
183668
  }
183611
- function ensureRoot(project2, fileName) {
183612
- const info = project2.getScriptInfo(fileName);
183613
- if (!info)
183614
- return false;
183615
- if (!project2.containsScriptInfo(info)) {
183616
- project2.addRoot(info);
183617
- project2.updateGraph();
183618
- }
183619
- return true;
183620
- }
183621
183669
  }
183622
183670
  getEmitOutput(args) {
183623
183671
  const { file, project } = this.getFileAndProject(args);
@@ -185944,6 +185992,7 @@ __export(ts_server_exports4, {
185944
185992
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
185945
185993
  indent: () => indent2,
185946
185994
  initializeNodeSystem: () => initializeNodeSystem,
185995
+ isBackgroundProject: () => isBackgroundProject,
185947
185996
  isConfigFile: () => isConfigFile,
185948
185997
  isConfiguredProject: () => isConfiguredProject,
185949
185998
  isDynamicFileName: () => isDynamicFileName,
@@ -186736,7 +186785,6 @@ start(initializeNodeSystem(), require("os").platform());
186736
186785
  CompletionInfoFlags,
186737
186786
  CompletionTriggerKind,
186738
186787
  Completions,
186739
- ConfigFileProgramReloadLevel,
186740
186788
  ContainerFlags,
186741
186789
  ContextFlags,
186742
186790
  Debug,
@@ -186823,6 +186871,7 @@ start(initializeNodeSystem(), require("os").platform());
186823
186871
  PragmaKindFlags,
186824
186872
  PrivateIdentifierKind,
186825
186873
  ProcessLevel,
186874
+ ProgramUpdateLevel,
186826
186875
  QuotePreference,
186827
186876
  RelationComparisonResult,
186828
186877
  Rename,