@typescript-deploys/pr-build 5.3.0-pr-56048-8 → 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) {
@@ -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 */:
@@ -71150,7 +71174,25 @@ function createTypeChecker(host) {
71150
71174
  const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
71151
71175
  const directlyRelated = mapType(
71152
71176
  matching || type,
71153
- 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
+ }
71154
71196
  );
71155
71197
  return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
71156
71198
  });
@@ -78066,8 +78108,20 @@ function createTypeChecker(host) {
78066
78108
  let hasReturnWithNoExpression = functionHasImplicitReturn(func);
78067
78109
  let hasReturnOfTypeNever = false;
78068
78110
  forEachReturnStatement(func.body, (returnStatement) => {
78069
- const expr = returnStatement.expression;
78111
+ let expr = returnStatement.expression;
78070
78112
  if (expr) {
78113
+ expr = skipParentheses(
78114
+ expr,
78115
+ /*excludeJSDocTypeAssertions*/
78116
+ true
78117
+ );
78118
+ if (functionFlags & 2 /* Async */ && expr.kind === 223 /* AwaitExpression */) {
78119
+ expr = skipParentheses(
78120
+ expr.expression,
78121
+ /*excludeJSDocTypeAssertions*/
78122
+ true
78123
+ );
78124
+ }
78071
78125
  if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
78072
78126
  hasReturnOfTypeNever = true;
78073
78127
  return;
@@ -119770,12 +119824,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
119770
119824
  cachedReadDirectoryResult.clear();
119771
119825
  }
119772
119826
  }
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 || {});
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 || {});
119779
119833
  function updateSharedExtendedConfigFileWatcher(projectPath, options, extendedConfigFilesMap, createExtendedConfigFileWatch, toPath3) {
119780
119834
  var _a;
119781
119835
  const extendedConfigs = arrayToMap(((_a = options == null ? void 0 : options.configFile) == null ? void 0 : _a.extendedSourceFiles) || emptyArray, toPath3);
@@ -125986,6 +126040,10 @@ function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirec
125986
126040
  function getRootPathSplitLength(rootPath) {
125987
126041
  return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
125988
126042
  }
126043
+ function getModuleResolutionHost(resolutionHost) {
126044
+ var _a;
126045
+ return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126046
+ }
125989
126047
  function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
125990
126048
  return {
125991
126049
  nameAndMode: moduleResolutionNameAndModeGetter,
@@ -126001,8 +126059,7 @@ function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirected
126001
126059
  };
126002
126060
  }
126003
126061
  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;
126062
+ const host = getModuleResolutionHost(resolutionHost);
126006
126063
  const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
126007
126064
  if (!resolutionHost.getGlobalCache) {
126008
126065
  return primaryResult;
@@ -126173,6 +126230,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126173
126230
  };
126174
126231
  }
126175
126232
  function startCachingPerDirectoryResolution() {
126233
+ moduleResolutionCache.isReadonly = void 0;
126234
+ typeReferenceDirectiveResolutionCache.isReadonly = void 0;
126235
+ libraryResolutionCache.isReadonly = void 0;
126236
+ moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
126176
126237
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
126177
126238
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
126178
126239
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
@@ -126230,6 +126291,10 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126230
126291
  directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
126231
126292
  fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
126232
126293
  hasChangedAutomaticTypeDirectiveNames = false;
126294
+ moduleResolutionCache.isReadonly = true;
126295
+ typeReferenceDirectiveResolutionCache.isReadonly = true;
126296
+ libraryResolutionCache.isReadonly = true;
126297
+ moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
126233
126298
  }
126234
126299
  function closeDirectoryWatchesOfFailedLookup(watcher, path) {
126235
126300
  if (watcher.refCount === 0) {
@@ -126258,7 +126323,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126258
126323
  shouldRetryResolution,
126259
126324
  logChanges
126260
126325
  }) {
126261
- var _a;
126262
126326
  const path = resolutionHost.toPath(containingFile);
126263
126327
  const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
126264
126328
  const resolvedModules = [];
@@ -126290,7 +126354,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126290
126354
  logChanges = false;
126291
126355
  }
126292
126356
  } else {
126293
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126357
+ const host = getModuleResolutionHost(resolutionHost);
126294
126358
  if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
126295
126359
  const resolved = getResolutionWithResolvedFileName(resolution);
126296
126360
  trace(
@@ -126342,7 +126406,6 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126342
126406
  }
126343
126407
  }
126344
126408
  function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
126345
- var _a;
126346
126409
  return resolveNamesWithLocalCache({
126347
126410
  entries: typeDirectiveReferences,
126348
126411
  containingFile,
@@ -126355,7 +126418,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126355
126418
  containingFile,
126356
126419
  redirectedReference,
126357
126420
  options,
126358
- ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
126421
+ getModuleResolutionHost(resolutionHost),
126359
126422
  typeReferenceDirectiveResolutionCache
126360
126423
  ),
126361
126424
  getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
@@ -126387,8 +126450,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126387
126450
  });
126388
126451
  }
126389
126452
  function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
126390
- var _a;
126391
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
126453
+ const host = getModuleResolutionHost(resolutionHost);
126392
126454
  let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
126393
126455
  if (!resolution || resolution.isInvalidated) {
126394
126456
  const existingResolution = resolution;
@@ -126422,6 +126484,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126422
126484
  return resolution;
126423
126485
  }
126424
126486
  function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
126487
+ var _a, _b;
126425
126488
  const path = resolutionHost.toPath(containingFile);
126426
126489
  const resolutionsInFile = resolvedModuleNames.get(path);
126427
126490
  const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(
@@ -126431,7 +126494,17 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
126431
126494
  );
126432
126495
  if (resolution && !resolution.isInvalidated)
126433
126496
  return resolution;
126434
- 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;
126435
126508
  }
126436
126509
  function isNodeModulesAtTypesDirectory(dirPath) {
126437
126510
  return endsWith(dirPath, "/node_modules/@types");
@@ -127602,7 +127675,7 @@ function createWatchCompilerHost2(rootFilesOrConfigFileName, options, system, cr
127602
127675
  }
127603
127676
  function createWatchProgram(host) {
127604
127677
  let builderProgram;
127605
- let reloadLevel;
127678
+ let updateLevel;
127606
127679
  let missingFilesMap;
127607
127680
  let watchedWildcardDirectories;
127608
127681
  let timerToUpdateProgram;
@@ -127961,7 +128034,7 @@ function createWatchProgram(host) {
127961
128034
  }
127962
128035
  function scheduleProgramReload() {
127963
128036
  Debug.assert(!!configFileName);
127964
- reloadLevel = 2 /* Full */;
128037
+ updateLevel = 2 /* Full */;
127965
128038
  scheduleProgramUpdate();
127966
128039
  }
127967
128040
  function updateProgramWithWatchStatus() {
@@ -127971,8 +128044,8 @@ function createWatchProgram(host) {
127971
128044
  }
127972
128045
  function updateProgram() {
127973
128046
  var _a, _b, _c, _d;
127974
- switch (reloadLevel) {
127975
- case 1 /* Partial */:
128047
+ switch (updateLevel) {
128048
+ case 1 /* RootNamesAndUpdate */:
127976
128049
  (_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
127977
128050
  reloadFileNamesFromConfigFile();
127978
128051
  break;
@@ -127992,7 +128065,7 @@ function createWatchProgram(host) {
127992
128065
  writeLog("Reloading new file names and options");
127993
128066
  Debug.assert(compilerOptions);
127994
128067
  Debug.assert(configFileName);
127995
- reloadLevel = 0 /* None */;
128068
+ updateLevel = 0 /* Update */;
127996
128069
  rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
127997
128070
  if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
127998
128071
  hasChangedConfigFileParsingErrors = true;
@@ -128002,7 +128075,7 @@ function createWatchProgram(host) {
128002
128075
  function reloadConfigFile() {
128003
128076
  Debug.assert(configFileName);
128004
128077
  writeLog(`Reloading config file: ${configFileName}`);
128005
- reloadLevel = 0 /* None */;
128078
+ updateLevel = 0 /* Update */;
128006
128079
  if (cachedDirectoryStructureHost) {
128007
128080
  cachedDirectoryStructureHost.clearCache();
128008
128081
  }
@@ -128039,9 +128112,9 @@ function createWatchProgram(host) {
128039
128112
  const configPath = toPath3(configFileName2);
128040
128113
  let config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
128041
128114
  if (config) {
128042
- if (!config.reloadLevel)
128115
+ if (!config.updateLevel)
128043
128116
  return config.parsedCommandLine;
128044
- if (config.parsedCommandLine && config.reloadLevel === 1 /* Partial */ && !host.getParsedCommandLine) {
128117
+ if (config.parsedCommandLine && config.updateLevel === 1 /* RootNamesAndUpdate */ && !host.getParsedCommandLine) {
128045
128118
  writeLog("Reloading new file names and options");
128046
128119
  Debug.assert(compilerOptions);
128047
128120
  const fileNames = getFileNamesFromConfigSpecs(
@@ -128051,7 +128124,7 @@ function createWatchProgram(host) {
128051
128124
  parseConfigFileHost
128052
128125
  );
128053
128126
  config.parsedCommandLine = { ...config.parsedCommandLine, fileNames };
128054
- config.reloadLevel = void 0;
128127
+ config.updateLevel = void 0;
128055
128128
  return config.parsedCommandLine;
128056
128129
  }
128057
128130
  }
@@ -128059,7 +128132,7 @@ function createWatchProgram(host) {
128059
128132
  const parsedCommandLine = host.getParsedCommandLine ? host.getParsedCommandLine(configFileName2) : getParsedCommandLineFromConfigFileHost(configFileName2);
128060
128133
  if (config) {
128061
128134
  config.parsedCommandLine = parsedCommandLine;
128062
- config.reloadLevel = void 0;
128135
+ config.updateLevel = void 0;
128063
128136
  } else {
128064
128137
  (parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config = { parsedCommandLine });
128065
128138
  }
@@ -128156,8 +128229,8 @@ function createWatchProgram(host) {
128156
128229
  toPath: toPath3
128157
128230
  }))
128158
128231
  return;
128159
- if (reloadLevel !== 2 /* Full */) {
128160
- reloadLevel = 1 /* Partial */;
128232
+ if (updateLevel !== 2 /* Full */) {
128233
+ updateLevel = 1 /* RootNamesAndUpdate */;
128161
128234
  scheduleProgramUpdate();
128162
128235
  }
128163
128236
  },
@@ -128183,11 +128256,11 @@ function createWatchProgram(host) {
128183
128256
  return;
128184
128257
  projects.forEach((projectPath) => {
128185
128258
  if (configFileName && toPath3(configFileName) === projectPath) {
128186
- reloadLevel = 2 /* Full */;
128259
+ updateLevel = 2 /* Full */;
128187
128260
  } else {
128188
128261
  const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
128189
128262
  if (config)
128190
- config.reloadLevel = 2 /* Full */;
128263
+ config.updateLevel = 2 /* Full */;
128191
128264
  resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
128192
128265
  }
128193
128266
  scheduleProgramUpdate();
@@ -128208,7 +128281,7 @@ function createWatchProgram(host) {
128208
128281
  updateCachedSystemWithFile(configFileName2, configPath, eventKind);
128209
128282
  const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
128210
128283
  if (config)
128211
- config.reloadLevel = 2 /* Full */;
128284
+ config.updateLevel = 2 /* Full */;
128212
128285
  resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
128213
128286
  scheduleProgramUpdate();
128214
128287
  },
@@ -128246,8 +128319,8 @@ function createWatchProgram(host) {
128246
128319
  toPath: toPath3
128247
128320
  }))
128248
128321
  return;
128249
- if (config.reloadLevel !== 2 /* Full */) {
128250
- config.reloadLevel = 1 /* Partial */;
128322
+ if (config.updateLevel !== 2 /* Full */) {
128323
+ config.updateLevel = 1 /* RootNamesAndUpdate */;
128251
128324
  scheduleProgramUpdate();
128252
128325
  }
128253
128326
  },
@@ -128710,12 +128783,12 @@ function clearProjectStatus(state, resolved) {
128710
128783
  state.projectStatus.delete(resolved);
128711
128784
  state.diagnostics.delete(resolved);
128712
128785
  }
128713
- function addProjToQueue({ projectPendingBuild }, proj, reloadLevel) {
128786
+ function addProjToQueue({ projectPendingBuild }, proj, updateLevel) {
128714
128787
  const value = projectPendingBuild.get(proj);
128715
128788
  if (value === void 0) {
128716
- projectPendingBuild.set(proj, reloadLevel);
128717
- } else if (value < reloadLevel) {
128718
- projectPendingBuild.set(proj, reloadLevel);
128789
+ projectPendingBuild.set(proj, updateLevel);
128790
+ } else if (value < updateLevel) {
128791
+ projectPendingBuild.set(proj, updateLevel);
128719
128792
  }
128720
128793
  }
128721
128794
  function setupInitialBuild(state, cancellationToken) {
@@ -128729,7 +128802,7 @@ function setupInitialBuild(state, cancellationToken) {
128729
128802
  buildOrder.forEach(
128730
128803
  (configFileName) => state.projectPendingBuild.set(
128731
128804
  toResolvedConfigFilePath(state, configFileName),
128732
- 0 /* None */
128805
+ 0 /* Update */
128733
128806
  )
128734
128807
  );
128735
128808
  if (cancellationToken) {
@@ -129171,8 +129244,8 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
129171
129244
  for (let projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) {
129172
129245
  const project = buildOrder[projectIndex];
129173
129246
  const projectPath = toResolvedConfigFilePath(state, project);
129174
- const reloadLevel = state.projectPendingBuild.get(projectPath);
129175
- if (reloadLevel === void 0)
129247
+ const updateLevel = state.projectPendingBuild.get(projectPath);
129248
+ if (updateLevel === void 0)
129176
129249
  continue;
129177
129250
  if (reportQueue) {
129178
129251
  reportQueue = false;
@@ -129184,13 +129257,13 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
129184
129257
  projectPendingBuild.delete(projectPath);
129185
129258
  continue;
129186
129259
  }
129187
- if (reloadLevel === 2 /* Full */) {
129260
+ if (updateLevel === 2 /* Full */) {
129188
129261
  watchConfigFile(state, project, projectPath, config);
129189
129262
  watchExtendedConfigFiles(state, projectPath, config);
129190
129263
  watchWildCardDirectories(state, project, projectPath, config);
129191
129264
  watchInputFiles(state, project, projectPath, config);
129192
129265
  watchPackageJsonFiles(state, project, projectPath, config);
129193
- } else if (reloadLevel === 1 /* Partial */) {
129266
+ } else if (updateLevel === 1 /* RootNamesAndUpdate */) {
129194
129267
  config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, getDirectoryPath(project), config.options, state.parseConfigFileHost);
129195
129268
  updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, canJsonReportNoInputFiles(config.raw));
129196
129269
  watchInputFiles(state, project, projectPath, config);
@@ -129777,7 +129850,7 @@ function queueReferencingProjects(state, project, projectPath, projectIndex, con
129777
129850
  break;
129778
129851
  }
129779
129852
  }
129780
- addProjToQueue(state, nextProjectPath, 0 /* None */);
129853
+ addProjToQueue(state, nextProjectPath, 0 /* Update */);
129781
129854
  break;
129782
129855
  }
129783
129856
  }
@@ -129846,7 +129919,7 @@ function cleanWorker(state, project, onlyReferences) {
129846
129919
  filesToDelete.push(output);
129847
129920
  } else {
129848
129921
  host.deleteFile(output);
129849
- invalidateProject(state, resolvedPath, 0 /* None */);
129922
+ invalidateProject(state, resolvedPath, 0 /* Update */);
129850
129923
  }
129851
129924
  }
129852
129925
  }
@@ -129857,22 +129930,22 @@ function cleanWorker(state, project, onlyReferences) {
129857
129930
  }
129858
129931
  return 0 /* Success */;
129859
129932
  }
129860
- function invalidateProject(state, resolved, reloadLevel) {
129861
- if (state.host.getParsedCommandLine && reloadLevel === 1 /* Partial */) {
129862
- reloadLevel = 2 /* Full */;
129933
+ function invalidateProject(state, resolved, updateLevel) {
129934
+ if (state.host.getParsedCommandLine && updateLevel === 1 /* RootNamesAndUpdate */) {
129935
+ updateLevel = 2 /* Full */;
129863
129936
  }
129864
- if (reloadLevel === 2 /* Full */) {
129937
+ if (updateLevel === 2 /* Full */) {
129865
129938
  state.configFileCache.delete(resolved);
129866
129939
  state.buildOrder = void 0;
129867
129940
  }
129868
129941
  state.needsSummary = true;
129869
129942
  clearProjectStatus(state, resolved);
129870
- addProjToQueue(state, resolved, reloadLevel);
129943
+ addProjToQueue(state, resolved, updateLevel);
129871
129944
  enableCache(state);
129872
129945
  }
129873
- function invalidateProjectAndScheduleBuilds(state, resolvedPath, reloadLevel) {
129946
+ function invalidateProjectAndScheduleBuilds(state, resolvedPath, updateLevel) {
129874
129947
  state.reportFileChangeDetected = true;
129875
- invalidateProject(state, resolvedPath, reloadLevel);
129948
+ invalidateProject(state, resolvedPath, updateLevel);
129876
129949
  scheduleBuildInvalidatedProject(
129877
129950
  state,
129878
129951
  250,
@@ -130003,7 +130076,7 @@ function watchWildCardDirectories(state, resolved, resolvedPath, parsed) {
130003
130076
  toPath: (fileName) => toPath2(state, fileName)
130004
130077
  }))
130005
130078
  return;
130006
- invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* Partial */);
130079
+ invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* RootNamesAndUpdate */);
130007
130080
  },
130008
130081
  flags,
130009
130082
  parsed == null ? void 0 : parsed.watchOptions,
@@ -130022,7 +130095,7 @@ function watchInputFiles(state, resolved, resolvedPath, parsed) {
130022
130095
  createNewValue: (_path, input) => watchFile(
130023
130096
  state,
130024
130097
  input,
130025
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* None */),
130098
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130026
130099
  250 /* Low */,
130027
130100
  parsed == null ? void 0 : parsed.watchOptions,
130028
130101
  WatchType.SourceFile,
@@ -130042,7 +130115,7 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
130042
130115
  createNewValue: (path, _input) => watchFile(
130043
130116
  state,
130044
130117
  path,
130045
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* None */),
130118
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
130046
130119
  2e3 /* High */,
130047
130120
  parsed == null ? void 0 : parsed.watchOptions,
130048
130121
  WatchType.PackageJson,
@@ -130113,7 +130186,7 @@ function createSolutionBuilderWorker(watch, hostOrHostWithWatch, rootNames, opti
130113
130186
  const configFilePath = toResolvedConfigFilePath(state, configFileName);
130114
130187
  return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath);
130115
130188
  },
130116
- invalidateProject: (configFilePath, reloadLevel) => invalidateProject(state, configFilePath, reloadLevel || 0 /* None */),
130189
+ invalidateProject: (configFilePath, updateLevel) => invalidateProject(state, configFilePath, updateLevel || 0 /* Update */),
130117
130190
  close: () => stopWatching(state)
130118
130191
  };
130119
130192
  }
@@ -172057,7 +172130,6 @@ __export(ts_exports2, {
172057
172130
  CompletionInfoFlags: () => CompletionInfoFlags,
172058
172131
  CompletionTriggerKind: () => CompletionTriggerKind,
172059
172132
  Completions: () => ts_Completions_exports,
172060
- ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
172061
172133
  ContainerFlags: () => ContainerFlags,
172062
172134
  ContextFlags: () => ContextFlags,
172063
172135
  Debug: () => Debug,
@@ -172144,6 +172216,7 @@ __export(ts_exports2, {
172144
172216
  PragmaKindFlags: () => PragmaKindFlags,
172145
172217
  PrivateIdentifierKind: () => PrivateIdentifierKind,
172146
172218
  ProcessLevel: () => ProcessLevel,
172219
+ ProgramUpdateLevel: () => ProgramUpdateLevel,
172147
172220
  QuotePreference: () => QuotePreference,
172148
172221
  RelationComparisonResult: () => RelationComparisonResult,
172149
172222
  Rename: () => ts_Rename_exports,
@@ -174535,6 +174608,7 @@ __export(ts_server_exports3, {
174535
174608
  hasArgument: () => hasArgument,
174536
174609
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
174537
174610
  indent: () => indent2,
174611
+ isBackgroundProject: () => isBackgroundProject,
174538
174612
  isConfigFile: () => isConfigFile,
174539
174613
  isConfiguredProject: () => isConfiguredProject,
174540
174614
  isDynamicFileName: () => isDynamicFileName,
@@ -175802,7 +175876,7 @@ var ScriptInfo = class {
175802
175876
  isContainedByBackgroundProject() {
175803
175877
  return some(
175804
175878
  this.containingProjects,
175805
- (p) => p.projectKind === 3 /* AutoImportProvider */ || p.projectKind === 4 /* Auxiliary */
175879
+ isBackgroundProject
175806
175880
  );
175807
175881
  }
175808
175882
  /**
@@ -175833,7 +175907,7 @@ var ScriptInfo = class {
175833
175907
  }
175834
175908
  };
175835
175909
  function ensurePrimaryProjectKind(project) {
175836
- if (!project || project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */) {
175910
+ if (!project || isBackgroundProject(project)) {
175837
175911
  return Errors.ThrowNoProject();
175838
175912
  }
175839
175913
  return project;
@@ -176119,9 +176193,10 @@ var Project3 = class _Project {
176119
176193
  this.disableLanguageService(lastFileExceededProgramSize);
176120
176194
  }
176121
176195
  this.markAsDirty();
176122
- if (projectKind !== 3 /* AutoImportProvider */) {
176196
+ if (!isBackgroundProject(this)) {
176123
176197
  this.projectService.pendingEnsureProjectForOpenFiles = true;
176124
176198
  }
176199
+ this.projectService.onProjectCreation(this);
176125
176200
  }
176126
176201
  /** @internal */
176127
176202
  getResolvedProjectReferenceToRedirect(_fileName) {
@@ -176291,6 +176366,7 @@ var Project3 = class _Project {
176291
176366
  resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
176292
176367
  return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
176293
176368
  }
176369
+ /** @internal */
176294
176370
  getModuleResolutionCache() {
176295
176371
  return this.resolutionCache.getModuleResolutionCache();
176296
176372
  }
@@ -176556,12 +176632,12 @@ var Project3 = class _Project {
176556
176632
  }
176557
176633
  return { ...newTypeAcquisition, include: this.removeExistingTypings(newTypeAcquisition.include) };
176558
176634
  }
176559
- getExternalFiles() {
176635
+ getExternalFiles(updateLevel) {
176560
176636
  return sort(flatMap(this.plugins, (plugin) => {
176561
176637
  if (typeof plugin.module.getExternalFiles !== "function")
176562
176638
  return;
176563
176639
  try {
176564
- return plugin.module.getExternalFiles(this);
176640
+ return plugin.module.getExternalFiles(this, updateLevel || 0 /* Update */);
176565
176641
  } catch (e) {
176566
176642
  this.projectService.logger.info(`A plugin threw an exception in getExternalFiles: ${e}`);
176567
176643
  if (e.stack) {
@@ -177296,6 +177372,7 @@ var Project3 = class _Project {
177296
177372
  }
177297
177373
  /** @internal */
177298
177374
  getChangesSinceVersion(lastKnownVersion, includeProjectReferenceRedirectInfo) {
177375
+ var _a, _b;
177299
177376
  const includeProjectReferenceRedirectInfoIfRequested = includeProjectReferenceRedirectInfo ? (files) => arrayFrom(files.entries(), ([fileName, isSourceOfProjectReferenceRedirect]) => ({
177300
177377
  fileName,
177301
177378
  isSourceOfProjectReferenceRedirect
@@ -177318,10 +177395,10 @@ var Project3 = class _Project {
177318
177395
  return { info, projectErrors: this.getGlobalProjectErrors() };
177319
177396
  }
177320
177397
  const lastReportedFileNames = this.lastReportedFileNames;
177321
- const externalFiles = this.getExternalFiles().map((f) => ({
177398
+ const externalFiles = ((_a = this.externalFiles) == null ? void 0 : _a.map((f) => ({
177322
177399
  fileName: toNormalizedPath(f),
177323
177400
  isSourceOfProjectReferenceRedirect: false
177324
- }));
177401
+ }))) || emptyArray2;
177325
177402
  const currentFiles = arrayToMap(
177326
177403
  this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo).concat(externalFiles),
177327
177404
  (info2) => info2.fileName,
@@ -177363,10 +177440,10 @@ var Project3 = class _Project {
177363
177440
  };
177364
177441
  } else {
177365
177442
  const projectFileNames = this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo);
177366
- const externalFiles = this.getExternalFiles().map((f) => ({
177443
+ const externalFiles = ((_b = this.externalFiles) == null ? void 0 : _b.map((f) => ({
177367
177444
  fileName: toNormalizedPath(f),
177368
177445
  isSourceOfProjectReferenceRedirect: false
177369
- }));
177446
+ }))) || emptyArray2;
177370
177447
  const allFiles = projectFileNames.concat(externalFiles);
177371
177448
  this.lastReportedFileNames = arrayToMap(
177372
177449
  allFiles,
@@ -177568,32 +177645,15 @@ var Project3 = class _Project {
177568
177645
  return this.projectService.getIncompleteCompletionsCache();
177569
177646
  }
177570
177647
  /** @internal */
177571
- getNoDtsResolutionProject(rootFileNames) {
177648
+ getNoDtsResolutionProject(rootFile) {
177572
177649
  Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
177573
177650
  if (!this.noDtsResolutionProject) {
177574
177651
  this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
177575
177652
  }
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
- );
177653
+ if (this.noDtsResolutionProject.rootFile !== rootFile) {
177654
+ this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this.noDtsResolutionProject, [rootFile]);
177655
+ this.noDtsResolutionProject.rootFile = rootFile;
177656
+ }
177597
177657
  return this.noDtsResolutionProject;
177598
177658
  }
177599
177659
  /** @internal */
@@ -177925,7 +177985,7 @@ var _AutoImportProviderProject = class _AutoImportProviderProject extends Projec
177925
177985
  this.getCompilationSettings()
177926
177986
  );
177927
177987
  }
177928
- this.projectService.setFileNamesOfAutoImportProviderProject(this, rootFileNames);
177988
+ this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this, rootFileNames);
177929
177989
  this.rootFileNames = rootFileNames;
177930
177990
  const oldProgram = this.getCurrentProgram();
177931
177991
  const hasSameSetOfFiles = super.updateGraph();
@@ -178070,18 +178130,18 @@ var ConfiguredProject2 = class extends Project3 {
178070
178130
  updateGraph() {
178071
178131
  const isInitialLoad = this.isInitialLoadPending();
178072
178132
  this.isInitialLoadPending = returnFalse;
178073
- const reloadLevel = this.pendingReload;
178074
- this.pendingReload = 0 /* None */;
178133
+ const updateLevel = this.pendingUpdateLevel;
178134
+ this.pendingUpdateLevel = 0 /* Update */;
178075
178135
  let result;
178076
- switch (reloadLevel) {
178077
- case 1 /* Partial */:
178136
+ switch (updateLevel) {
178137
+ case 1 /* RootNamesAndUpdate */:
178078
178138
  this.openFileWatchTriggered.clear();
178079
178139
  result = this.projectService.reloadFileNamesOfConfiguredProject(this);
178080
178140
  break;
178081
178141
  case 2 /* Full */:
178082
178142
  this.openFileWatchTriggered.clear();
178083
- const reason = Debug.checkDefined(this.pendingReloadReason);
178084
- this.pendingReloadReason = void 0;
178143
+ const reason = Debug.checkDefined(this.pendingUpdateReason);
178144
+ this.pendingUpdateReason = void 0;
178085
178145
  this.projectService.reloadConfiguredProject(
178086
178146
  this,
178087
178147
  reason,
@@ -178281,6 +178341,9 @@ function isConfiguredProject(project) {
178281
178341
  function isExternalProject(project) {
178282
178342
  return project.projectKind === 2 /* External */;
178283
178343
  }
178344
+ function isBackgroundProject(project) {
178345
+ return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
178346
+ }
178284
178347
 
178285
178348
  // src/server/editorServices.ts
178286
178349
  var maxProgramSizeForNonTsFiles = 20 * 1024 * 1024;
@@ -178721,6 +178784,8 @@ var _ProjectService = class _ProjectService {
178721
178784
  this.verifyDocumentRegistry = noop;
178722
178785
  /** @internal */
178723
178786
  this.verifyProgram = noop;
178787
+ /** @internal */
178788
+ this.onProjectCreation = noop;
178724
178789
  var _a;
178725
178790
  this.host = opts.host;
178726
178791
  this.logger = opts.logger;
@@ -178888,20 +178953,20 @@ var _ProjectService = class _ProjectService {
178888
178953
  }
178889
178954
  delayUpdateProjectGraph(project) {
178890
178955
  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
- }
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);
178902
178967
  }
178903
- );
178904
- }
178968
+ }
178969
+ );
178905
178970
  }
178906
178971
  /** @internal */
178907
178972
  hasPendingProjectUpdate(project) {
@@ -179177,28 +179242,28 @@ var _ProjectService = class _ProjectService {
179177
179242
  getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
179178
179243
  }))
179179
179244
  return;
179180
- if (config.reloadLevel !== 2 /* Full */)
179181
- config.reloadLevel = 1 /* Partial */;
179245
+ if (config.updateLevel !== 2 /* Full */)
179246
+ config.updateLevel = 1 /* RootNamesAndUpdate */;
179182
179247
  config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
179183
179248
  if (!watchWildcardDirectories)
179184
179249
  return;
179185
179250
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
179186
179251
  if (!project)
179187
179252
  return;
179188
- const reloadLevel = configuredProjectForConfig === project ? 1 /* Partial */ : 0 /* None */;
179189
- 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)
179190
179255
  return;
179191
179256
  if (this.openFiles.has(fileOrDirectoryPath)) {
179192
179257
  const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
179193
179258
  if (info.isAttached(project)) {
179194
- const loadLevelToSet = Math.max(reloadLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* None */);
179259
+ const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
179195
179260
  project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
179196
179261
  } else {
179197
- project.pendingReload = reloadLevel;
179262
+ project.pendingUpdateLevel = updateLevel;
179198
179263
  this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
179199
179264
  }
179200
179265
  } else {
179201
- project.pendingReload = reloadLevel;
179266
+ project.pendingUpdateLevel = updateLevel;
179202
179267
  this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
179203
179268
  }
179204
179269
  });
@@ -179210,12 +179275,12 @@ var _ProjectService = class _ProjectService {
179210
179275
  );
179211
179276
  }
179212
179277
  /** @internal */
179213
- delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, reloadReason) {
179278
+ delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
179214
179279
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
179215
179280
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config))
179216
179281
  return false;
179217
179282
  let scheduledAnyProjectUpdate = false;
179218
- configFileExistenceInfo.config.reloadLevel = 2 /* Full */;
179283
+ configFileExistenceInfo.config.updateLevel = 2 /* Full */;
179219
179284
  configFileExistenceInfo.config.projects.forEach((_watchWildcardDirectories, projectCanonicalPath) => {
179220
179285
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
179221
179286
  if (!project)
@@ -179224,8 +179289,8 @@ var _ProjectService = class _ProjectService {
179224
179289
  if (projectCanonicalPath === canonicalConfigFilePath) {
179225
179290
  if (project.isInitialLoadPending())
179226
179291
  return;
179227
- project.pendingReload = 2 /* Full */;
179228
- project.pendingReloadReason = reloadReason;
179292
+ project.pendingUpdateLevel = 2 /* Full */;
179293
+ project.pendingUpdateReason = loadReason;
179229
179294
  this.delayUpdateProjectGraph(project);
179230
179295
  } else {
179231
179296
  project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(this.toPath(canonicalConfigFilePath));
@@ -179374,11 +179439,11 @@ var _ProjectService = class _ProjectService {
179374
179439
  if (info.hasMixedContent) {
179375
179440
  info.registerFileUpdate();
179376
179441
  }
179377
- const reloadLevel = p.openFileWatchTriggered.get(info.path);
179378
- if (reloadLevel !== void 0) {
179442
+ const updateLevel = p.openFileWatchTriggered.get(info.path);
179443
+ if (updateLevel !== void 0) {
179379
179444
  p.openFileWatchTriggered.delete(info.path);
179380
- if (p.pendingReload !== void 0 && p.pendingReload < reloadLevel) {
179381
- p.pendingReload = reloadLevel;
179445
+ if (p.pendingUpdateLevel !== void 0 && p.pendingUpdateLevel < updateLevel) {
179446
+ p.pendingUpdateLevel = updateLevel;
179382
179447
  p.markFileAsDirty(info.path);
179383
179448
  }
179384
179449
  }
@@ -179758,6 +179823,7 @@ var _ProjectService = class _ProjectService {
179758
179823
  addFilesToNonInferredProject(project, files, propertyReader, typeAcquisition) {
179759
179824
  this.updateNonInferredProjectFiles(project, files, propertyReader);
179760
179825
  project.setTypeAcquisition(typeAcquisition);
179826
+ project.markAsDirty();
179761
179827
  }
179762
179828
  /** @internal */
179763
179829
  createConfiguredProject(configFileName) {
@@ -179775,7 +179841,7 @@ var _ProjectService = class _ProjectService {
179775
179841
  configFileExistenceInfo.config = {
179776
179842
  cachedDirectoryStructureHost: createCachedDirectoryStructureHost(this.host, this.host.getCurrentDirectory(), this.host.useCaseSensitiveFileNames),
179777
179843
  projects: /* @__PURE__ */ new Map(),
179778
- reloadLevel: 2 /* Full */
179844
+ updateLevel: 2 /* Full */
179779
179845
  };
179780
179846
  }
179781
179847
  const project = new ConfiguredProject2(
@@ -179792,8 +179858,8 @@ var _ProjectService = class _ProjectService {
179792
179858
  /** @internal */
179793
179859
  createConfiguredProjectWithDelayLoad(configFileName, reason) {
179794
179860
  const project = this.createConfiguredProject(configFileName);
179795
- project.pendingReload = 2 /* Full */;
179796
- project.pendingReloadReason = reason;
179861
+ project.pendingUpdateLevel = 2 /* Full */;
179862
+ project.pendingUpdateReason = reason;
179797
179863
  return project;
179798
179864
  }
179799
179865
  /** @internal */
@@ -179849,7 +179915,7 @@ var _ProjectService = class _ProjectService {
179849
179915
  this.watchWildcards(configFilename, configFileExistenceInfo, project);
179850
179916
  }
179851
179917
  project.enablePluginsWithOptions(compilerOptions);
179852
- const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles());
179918
+ const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles(2 /* Full */));
179853
179919
  this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
179854
179920
  (_b = tracing) == null ? void 0 : _b.pop();
179855
179921
  }
@@ -179857,9 +179923,9 @@ var _ProjectService = class _ProjectService {
179857
179923
  ensureParsedConfigUptoDate(configFilename, canonicalConfigFilePath, configFileExistenceInfo, forProject) {
179858
179924
  var _a, _b, _c;
179859
179925
  if (configFileExistenceInfo.config) {
179860
- if (!configFileExistenceInfo.config.reloadLevel)
179926
+ if (!configFileExistenceInfo.config.updateLevel)
179861
179927
  return configFileExistenceInfo;
179862
- if (configFileExistenceInfo.config.reloadLevel === 1 /* Partial */) {
179928
+ if (configFileExistenceInfo.config.updateLevel === 1 /* RootNamesAndUpdate */) {
179863
179929
  this.reloadFileNamesOfParsedConfig(configFilename, configFileExistenceInfo.config);
179864
179930
  return configFileExistenceInfo;
179865
179931
  }
@@ -179902,7 +179968,7 @@ var _ProjectService = class _ProjectService {
179902
179968
  } else {
179903
179969
  configFileExistenceInfo.config.parsedCommandLine = parsedCommandLine;
179904
179970
  configFileExistenceInfo.config.watchedDirectoriesStale = true;
179905
- configFileExistenceInfo.config.reloadLevel = void 0;
179971
+ configFileExistenceInfo.config.updateLevel = void 0;
179906
179972
  }
179907
179973
  if (!oldCommandLine && !isJsonEqual(
179908
179974
  // Old options
@@ -180043,7 +180109,6 @@ var _ProjectService = class _ProjectService {
180043
180109
  }
180044
180110
  });
180045
180111
  }
180046
- project.markAsDirty();
180047
180112
  }
180048
180113
  updateRootAndOptionsOfNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) {
180049
180114
  project.setCompilerOptions(newOptions);
@@ -180061,14 +180126,15 @@ var _ProjectService = class _ProjectService {
180061
180126
  reloadFileNamesOfConfiguredProject(project) {
180062
180127
  const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
180063
180128
  project.updateErrorOnNoInputFiles(fileNames);
180064
- this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles()), fileNamePropertyReader);
180129
+ this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
180130
+ project.markAsDirty();
180065
180131
  return project.updateGraph();
180066
180132
  }
180067
180133
  /** @internal */
180068
180134
  reloadFileNamesOfParsedConfig(configFileName, config) {
180069
- if (config.reloadLevel === void 0)
180135
+ if (config.updateLevel === void 0)
180070
180136
  return config.parsedCommandLine.fileNames;
180071
- Debug.assert(config.reloadLevel === 1 /* Partial */);
180137
+ Debug.assert(config.updateLevel === 1 /* RootNamesAndUpdate */);
180072
180138
  const configFileSpecs = config.parsedCommandLine.options.configFile.configFileSpecs;
180073
180139
  const fileNames = getFileNamesFromConfigSpecs(
180074
180140
  configFileSpecs,
@@ -180081,7 +180147,7 @@ var _ProjectService = class _ProjectService {
180081
180147
  return fileNames;
180082
180148
  }
180083
180149
  /** @internal */
180084
- setFileNamesOfAutoImportProviderProject(project, fileNames) {
180150
+ setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
180085
180151
  this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
180086
180152
  }
180087
180153
  /**
@@ -180610,7 +180676,7 @@ Dynamic files must always be opened with service's current directory or service
180610
180676
  this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
180611
180677
  if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
180612
180678
  this.configuredProjects.forEach((project) => {
180613
- 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())) {
180614
180680
  project.updateGraph();
180615
180681
  }
180616
180682
  });
@@ -180665,7 +180731,7 @@ Dynamic files must always be opened with service's current directory or service
180665
180731
  this.pendingEnsureProjectForOpenFiles = false;
180666
180732
  this.configFileExistenceInfoCache.forEach((info) => {
180667
180733
  if (info.config)
180668
- info.config.reloadLevel = 2 /* Full */;
180734
+ info.config.updateLevel = 2 /* Full */;
180669
180735
  });
180670
180736
  this.reloadConfiguredProjectForFiles(
180671
180737
  this.openFiles,
@@ -180717,8 +180783,8 @@ Dynamic files must always be opened with service's current directory or service
180717
180783
  if (!updatedProjects.has(project.canonicalConfigFilePath)) {
180718
180784
  updatedProjects.set(project.canonicalConfigFilePath, true);
180719
180785
  if (delayReload) {
180720
- project.pendingReload = 2 /* Full */;
180721
- project.pendingReloadReason = reason;
180786
+ project.pendingUpdateLevel = 2 /* Full */;
180787
+ project.pendingUpdateReason = reason;
180722
180788
  if (clearSemanticCache)
180723
180789
  this.clearSemanticCache(project);
180724
180790
  this.delayUpdateProjectGraph(project);
@@ -183477,7 +183543,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183477
183543
  if (needsJsResolution) {
183478
183544
  const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
183479
183545
  definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
183480
- const noDtsProject = project.getNoDtsResolutionProject([file]);
183546
+ const noDtsProject = project.getNoDtsResolutionProject(file);
183481
183547
  const ls = noDtsProject.getLanguageService();
183482
183548
  const jsDefinitions = (_a = ls.getDefinitionAtPosition(
183483
183549
  file,
@@ -183504,8 +183570,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183504
183570
  const ambientCandidates = definitions.filter((d) => toNormalizedPath(d.fileName) !== file && d.isAmbient);
183505
183571
  for (const candidate of some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain()) {
183506
183572
  const fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
183507
- if (!fileNameToSearch || !ensureRoot(noDtsProject, fileNameToSearch)) {
183573
+ if (!fileNameToSearch)
183574
+ continue;
183575
+ const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
183576
+ fileNameToSearch,
183577
+ noDtsProject.currentDirectory,
183578
+ noDtsProject.directoryStructureHost
183579
+ );
183580
+ if (!info)
183508
183581
  continue;
183582
+ if (!noDtsProject.containsScriptInfo(info)) {
183583
+ noDtsProject.addRoot(info);
183584
+ noDtsProject.updateGraph();
183509
183585
  }
183510
183586
  const noDtsProgram = ls.getProgram();
183511
183587
  const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
@@ -183608,16 +183684,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183608
183684
  }
183609
183685
  });
183610
183686
  }
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
183687
  }
183622
183688
  getEmitOutput(args) {
183623
183689
  const { file, project } = this.getFileAndProject(args);
@@ -185944,6 +186010,7 @@ __export(ts_server_exports4, {
185944
186010
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
185945
186011
  indent: () => indent2,
185946
186012
  initializeNodeSystem: () => initializeNodeSystem,
186013
+ isBackgroundProject: () => isBackgroundProject,
185947
186014
  isConfigFile: () => isConfigFile,
185948
186015
  isConfiguredProject: () => isConfiguredProject,
185949
186016
  isDynamicFileName: () => isDynamicFileName,
@@ -186736,7 +186803,6 @@ start(initializeNodeSystem(), require("os").platform());
186736
186803
  CompletionInfoFlags,
186737
186804
  CompletionTriggerKind,
186738
186805
  Completions,
186739
- ConfigFileProgramReloadLevel,
186740
186806
  ContainerFlags,
186741
186807
  ContextFlags,
186742
186808
  Debug,
@@ -186823,6 +186889,7 @@ start(initializeNodeSystem(), require("os").platform());
186823
186889
  PragmaKindFlags,
186824
186890
  PrivateIdentifierKind,
186825
186891
  ProcessLevel,
186892
+ ProgramUpdateLevel,
186826
186893
  QuotePreference,
186827
186894
  RelationComparisonResult,
186828
186895
  Rename,