@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/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.3";
38
- version = `${versionMajorMinor}.0-insiders.20231009`;
38
+ version = `${versionMajorMinor}.0-insiders.20231011`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -39253,7 +39253,7 @@ ${lanes.join("\n")}
39253
39253
  Debug.assert(extensionIsTS(resolved.extension));
39254
39254
  return { fileName: resolved.path, packageId: resolved.packageId };
39255
39255
  }
39256
- function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, legacyResult) {
39256
+ function createResolvedModuleWithFailedLookupLocationsHandlingSymlink(moduleName, resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state, cache, legacyResult) {
39257
39257
  if (!state.resultFromCache && !state.compilerOptions.preserveSymlinks && resolved && isExternalLibraryImport && !resolved.originalPath && !isExternalModuleNameRelative(moduleName)) {
39258
39258
  const { resolvedFileName, originalPath } = getOriginalAndResolvedFileName(resolved.path, state.host, state.traceEnabled);
39259
39259
  if (originalPath)
@@ -39266,15 +39266,25 @@ ${lanes.join("\n")}
39266
39266
  affectingLocations,
39267
39267
  diagnostics,
39268
39268
  state.resultFromCache,
39269
+ cache,
39269
39270
  legacyResult
39270
39271
  );
39271
39272
  }
39272
- function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, legacyResult) {
39273
+ function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, resultFromCache, cache, legacyResult) {
39273
39274
  if (resultFromCache) {
39274
- resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
39275
- resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
39276
- resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
39277
- return resultFromCache;
39275
+ if (!(cache == null ? void 0 : cache.isReadonly)) {
39276
+ resultFromCache.failedLookupLocations = updateResolutionField(resultFromCache.failedLookupLocations, failedLookupLocations);
39277
+ resultFromCache.affectingLocations = updateResolutionField(resultFromCache.affectingLocations, affectingLocations);
39278
+ resultFromCache.resolutionDiagnostics = updateResolutionField(resultFromCache.resolutionDiagnostics, diagnostics);
39279
+ return resultFromCache;
39280
+ } else {
39281
+ return {
39282
+ ...resultFromCache,
39283
+ failedLookupLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.failedLookupLocations, failedLookupLocations),
39284
+ affectingLocations: initializeResolutionFieldForReadonlyCache(resultFromCache.affectingLocations, affectingLocations),
39285
+ resolutionDiagnostics: initializeResolutionFieldForReadonlyCache(resultFromCache.resolutionDiagnostics, diagnostics)
39286
+ };
39287
+ }
39278
39288
  }
39279
39289
  return {
39280
39290
  resolvedModule: resolved && {
@@ -39302,6 +39312,13 @@ ${lanes.join("\n")}
39302
39312
  to.push(...value);
39303
39313
  return to;
39304
39314
  }
39315
+ function initializeResolutionFieldForReadonlyCache(fromCache, value) {
39316
+ if (!(fromCache == null ? void 0 : fromCache.length))
39317
+ return initializeResolutionField(value);
39318
+ if (!value.length)
39319
+ return fromCache.slice();
39320
+ return [...fromCache, ...value];
39321
+ }
39305
39322
  function readPackageJsonField(jsonContent, fieldName, typeOfTag, state) {
39306
39323
  if (!hasProperty(jsonContent, fieldName)) {
39307
39324
  if (state.traceEnabled) {
@@ -39527,15 +39544,15 @@ ${lanes.join("\n")}
39527
39544
  affectingLocations: initializeResolutionField(affectingLocations),
39528
39545
  resolutionDiagnostics: initializeResolutionField(diagnostics)
39529
39546
  };
39530
- if (containingDirectory) {
39531
- cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
39547
+ if (containingDirectory && cache && !cache.isReadonly) {
39548
+ cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(
39532
39549
  typeReferenceDirectiveName,
39533
39550
  /*mode*/
39534
39551
  resolutionMode,
39535
39552
  result
39536
39553
  );
39537
39554
  if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
39538
- cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
39555
+ cache.getOrCreateCacheForNonRelativeName(typeReferenceDirectiveName, resolutionMode, redirectedReference).set(containingDirectory, result);
39539
39556
  }
39540
39557
  }
39541
39558
  if (traceEnabled)
@@ -39742,7 +39759,8 @@ ${lanes.join("\n")}
39742
39759
  getMapOfCacheRedirects,
39743
39760
  getOrCreateMapOfCacheRedirects,
39744
39761
  update,
39745
- clear: clear2
39762
+ clear: clear2,
39763
+ getOwnMap: () => ownMap
39746
39764
  };
39747
39765
  function getMapOfCacheRedirects(redirectedReference) {
39748
39766
  return redirectedReference ? getOrCreateMap(
@@ -39849,7 +39867,8 @@ ${lanes.join("\n")}
39849
39867
  getFromDirectoryCache,
39850
39868
  getOrCreateCacheForDirectory,
39851
39869
  clear: clear2,
39852
- update
39870
+ update,
39871
+ directoryToModuleNameMap
39853
39872
  };
39854
39873
  function clear2() {
39855
39874
  directoryToModuleNameMap.clear();
@@ -40123,9 +40142,11 @@ ${lanes.join("\n")}
40123
40142
  if (result && result.resolvedModule)
40124
40143
  (_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`);
40125
40144
  (_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null");
40126
- cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
40127
- if (!isExternalModuleNameRelative(moduleName)) {
40128
- cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
40145
+ if (cache && !cache.isReadonly) {
40146
+ cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result);
40147
+ if (!isExternalModuleNameRelative(moduleName)) {
40148
+ cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result);
40149
+ }
40129
40150
  }
40130
40151
  }
40131
40152
  if (traceEnabled) {
@@ -40427,6 +40448,7 @@ ${lanes.join("\n")}
40427
40448
  affectingLocations,
40428
40449
  diagnostics,
40429
40450
  state,
40451
+ cache,
40430
40452
  legacyResult
40431
40453
  );
40432
40454
  function tryResolve(extensions2, state2) {
@@ -40827,7 +40849,7 @@ ${lanes.join("\n")}
40827
40849
  return packageJsonInfo.contents.versionPaths || void 0;
40828
40850
  }
40829
40851
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
40830
- var _a, _b, _c, _d, _e, _f, _g, _h;
40852
+ var _a, _b, _c, _d, _e, _f;
40831
40853
  const { host, traceEnabled } = state;
40832
40854
  const packageJsonPath = combinePaths(packageDirectory, "package.json");
40833
40855
  if (onlyRecordFailures) {
@@ -40855,15 +40877,17 @@ ${lanes.join("\n")}
40855
40877
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
40856
40878
  }
40857
40879
  const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
40858
- (_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
40859
- (_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
40880
+ if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
40881
+ state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, result);
40882
+ (_e = state.affectingLocations) == null ? void 0 : _e.push(packageJsonPath);
40860
40883
  return result;
40861
40884
  } else {
40862
40885
  if (directoryExists && traceEnabled) {
40863
40886
  trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
40864
40887
  }
40865
- (_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
40866
- (_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
40888
+ if (state.packageJsonInfoCache && !state.packageJsonInfoCache.isReadonly)
40889
+ state.packageJsonInfoCache.setPackageJsonInfo(packageJsonPath, directoryExists);
40890
+ (_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
40867
40891
  }
40868
40892
  }
40869
40893
  function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
@@ -41652,7 +41676,8 @@ ${lanes.join("\n")}
41652
41676
  failedLookupLocations,
41653
41677
  affectingLocations,
41654
41678
  diagnostics,
41655
- state
41679
+ state,
41680
+ cache
41656
41681
  );
41657
41682
  function tryResolve(extensions) {
41658
41683
  const resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, state);
@@ -41771,7 +41796,9 @@ ${lanes.join("\n")}
41771
41796
  failedLookupLocations,
41772
41797
  affectingLocations,
41773
41798
  diagnostics,
41774
- state.resultFromCache
41799
+ state.resultFromCache,
41800
+ /*cache*/
41801
+ void 0
41775
41802
  );
41776
41803
  }
41777
41804
  function toSearchResult(value) {
@@ -42481,9 +42508,6 @@ ${lanes.join("\n")}
42481
42508
  case 213 /* CallExpression */:
42482
42509
  return hasNarrowableArgument(expr);
42483
42510
  case 217 /* ParenthesizedExpression */:
42484
- if (isJSDocTypeAssertion(expr)) {
42485
- return false;
42486
- }
42487
42511
  case 235 /* NonNullExpression */:
42488
42512
  return isNarrowingExpression(expr.expression);
42489
42513
  case 226 /* BinaryExpression */:
@@ -68917,7 +68941,25 @@ ${lanes.join("\n")}
68917
68941
  const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
68918
68942
  const directlyRelated = mapType(
68919
68943
  matching || type,
68920
- 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
68944
+ checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => {
68945
+ if (t.flags & 2944 /* Literal */ && c.flags & 2944 /* Literal */) {
68946
+ if (t.flags & 512 /* BooleanLiteral */ && c.flags & 512 /* BooleanLiteral */) {
68947
+ return t === c ? t : neverType;
68948
+ }
68949
+ return t.value === c.value ? t : neverType;
68950
+ }
68951
+ if (isTypeStrictSubtypeOf(t, c))
68952
+ return t;
68953
+ if (isTypeStrictSubtypeOf(c, t))
68954
+ return c;
68955
+ if (t.flags & 109472 /* Unit */ && c.flags & 109472 /* Unit */)
68956
+ return neverType;
68957
+ if (isTypeSubtypeOf(t, c))
68958
+ return t;
68959
+ if (isTypeSubtypeOf(c, t))
68960
+ return c;
68961
+ return neverType;
68962
+ }
68921
68963
  );
68922
68964
  return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
68923
68965
  });
@@ -75833,8 +75875,20 @@ ${lanes.join("\n")}
75833
75875
  let hasReturnWithNoExpression = functionHasImplicitReturn(func);
75834
75876
  let hasReturnOfTypeNever = false;
75835
75877
  forEachReturnStatement(func.body, (returnStatement) => {
75836
- const expr = returnStatement.expression;
75878
+ let expr = returnStatement.expression;
75837
75879
  if (expr) {
75880
+ expr = skipParentheses(
75881
+ expr,
75882
+ /*excludeJSDocTypeAssertions*/
75883
+ true
75884
+ );
75885
+ if (functionFlags & 2 /* Async */ && expr.kind === 223 /* AwaitExpression */) {
75886
+ expr = skipParentheses(
75887
+ expr.expression,
75888
+ /*excludeJSDocTypeAssertions*/
75889
+ true
75890
+ );
75891
+ }
75838
75892
  if (expr.kind === 213 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) {
75839
75893
  hasReturnOfTypeNever = true;
75840
75894
  return;
@@ -118156,17 +118210,17 @@ ${lanes.join("\n")}
118156
118210
  function closeFileWatcherOf(objWithWatcher) {
118157
118211
  objWithWatcher.watcher.close();
118158
118212
  }
118159
- var ConfigFileProgramReloadLevel, WatchLogLevel;
118213
+ var ProgramUpdateLevel, WatchLogLevel;
118160
118214
  var init_watchUtilities = __esm({
118161
118215
  "src/compiler/watchUtilities.ts"() {
118162
118216
  "use strict";
118163
118217
  init_ts2();
118164
- ConfigFileProgramReloadLevel = /* @__PURE__ */ ((ConfigFileProgramReloadLevel2) => {
118165
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["None"] = 0] = "None";
118166
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Partial"] = 1] = "Partial";
118167
- ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Full"] = 2] = "Full";
118168
- return ConfigFileProgramReloadLevel2;
118169
- })(ConfigFileProgramReloadLevel || {});
118218
+ ProgramUpdateLevel = /* @__PURE__ */ ((ProgramUpdateLevel2) => {
118219
+ ProgramUpdateLevel2[ProgramUpdateLevel2["Update"] = 0] = "Update";
118220
+ ProgramUpdateLevel2[ProgramUpdateLevel2["RootNamesAndUpdate"] = 1] = "RootNamesAndUpdate";
118221
+ ProgramUpdateLevel2[ProgramUpdateLevel2["Full"] = 2] = "Full";
118222
+ return ProgramUpdateLevel2;
118223
+ })(ProgramUpdateLevel || {});
118170
118224
  WatchLogLevel = /* @__PURE__ */ ((WatchLogLevel2) => {
118171
118225
  WatchLogLevel2[WatchLogLevel2["None"] = 0] = "None";
118172
118226
  WatchLogLevel2[WatchLogLevel2["TriggerOnly"] = 1] = "TriggerOnly";
@@ -124129,6 +124183,10 @@ ${lanes.join("\n")}
124129
124183
  function getRootPathSplitLength(rootPath) {
124130
124184
  return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0);
124131
124185
  }
124186
+ function getModuleResolutionHost(resolutionHost) {
124187
+ var _a;
124188
+ return ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
124189
+ }
124132
124190
  function createModuleResolutionLoaderUsingGlobalCache(containingFile, redirectedReference, options, resolutionHost, moduleResolutionCache) {
124133
124191
  return {
124134
124192
  nameAndMode: moduleResolutionNameAndModeGetter,
@@ -124144,8 +124202,7 @@ ${lanes.join("\n")}
124144
124202
  };
124145
124203
  }
124146
124204
  function resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, compilerOptions, redirectedReference, mode) {
124147
- var _a;
124148
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
124205
+ const host = getModuleResolutionHost(resolutionHost);
124149
124206
  const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode);
124150
124207
  if (!resolutionHost.getGlobalCache) {
124151
124208
  return primaryResult;
@@ -124316,6 +124373,10 @@ ${lanes.join("\n")}
124316
124373
  };
124317
124374
  }
124318
124375
  function startCachingPerDirectoryResolution() {
124376
+ moduleResolutionCache.isReadonly = void 0;
124377
+ typeReferenceDirectiveResolutionCache.isReadonly = void 0;
124378
+ libraryResolutionCache.isReadonly = void 0;
124379
+ moduleResolutionCache.getPackageJsonInfoCache().isReadonly = void 0;
124319
124380
  moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
124320
124381
  typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
124321
124382
  libraryResolutionCache.clearAllExceptPackageJsonInfoCache();
@@ -124373,6 +124434,10 @@ ${lanes.join("\n")}
124373
124434
  directoryWatchesOfFailedLookups.forEach(closeDirectoryWatchesOfFailedLookup);
124374
124435
  fileWatchesOfAffectingLocations.forEach(closeFileWatcherOfAffectingLocation);
124375
124436
  hasChangedAutomaticTypeDirectiveNames = false;
124437
+ moduleResolutionCache.isReadonly = true;
124438
+ typeReferenceDirectiveResolutionCache.isReadonly = true;
124439
+ libraryResolutionCache.isReadonly = true;
124440
+ moduleResolutionCache.getPackageJsonInfoCache().isReadonly = true;
124376
124441
  }
124377
124442
  function closeDirectoryWatchesOfFailedLookup(watcher, path) {
124378
124443
  if (watcher.refCount === 0) {
@@ -124401,7 +124466,6 @@ ${lanes.join("\n")}
124401
124466
  shouldRetryResolution,
124402
124467
  logChanges
124403
124468
  }) {
124404
- var _a;
124405
124469
  const path = resolutionHost.toPath(containingFile);
124406
124470
  const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path);
124407
124471
  const resolvedModules = [];
@@ -124433,7 +124497,7 @@ ${lanes.join("\n")}
124433
124497
  logChanges = false;
124434
124498
  }
124435
124499
  } else {
124436
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
124500
+ const host = getModuleResolutionHost(resolutionHost);
124437
124501
  if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) {
124438
124502
  const resolved = getResolutionWithResolvedFileName(resolution);
124439
124503
  trace(
@@ -124485,7 +124549,6 @@ ${lanes.join("\n")}
124485
124549
  }
124486
124550
  }
124487
124551
  function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
124488
- var _a;
124489
124552
  return resolveNamesWithLocalCache({
124490
124553
  entries: typeDirectiveReferences,
124491
124554
  containingFile,
@@ -124498,7 +124561,7 @@ ${lanes.join("\n")}
124498
124561
  containingFile,
124499
124562
  redirectedReference,
124500
124563
  options,
124501
- ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost,
124564
+ getModuleResolutionHost(resolutionHost),
124502
124565
  typeReferenceDirectiveResolutionCache
124503
124566
  ),
124504
124567
  getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective,
@@ -124530,8 +124593,7 @@ ${lanes.join("\n")}
124530
124593
  });
124531
124594
  }
124532
124595
  function resolveLibrary2(libraryName, resolveFrom, options, libFileName) {
124533
- var _a;
124534
- const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost;
124596
+ const host = getModuleResolutionHost(resolutionHost);
124535
124597
  let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName);
124536
124598
  if (!resolution || resolution.isInvalidated) {
124537
124599
  const existingResolution = resolution;
@@ -124565,6 +124627,7 @@ ${lanes.join("\n")}
124565
124627
  return resolution;
124566
124628
  }
124567
124629
  function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) {
124630
+ var _a, _b;
124568
124631
  const path = resolutionHost.toPath(containingFile);
124569
124632
  const resolutionsInFile = resolvedModuleNames.get(path);
124570
124633
  const resolution = resolutionsInFile == null ? void 0 : resolutionsInFile.get(
@@ -124574,7 +124637,17 @@ ${lanes.join("\n")}
124574
124637
  );
124575
124638
  if (resolution && !resolution.isInvalidated)
124576
124639
  return resolution;
124577
- return resolveModuleNameUsingGlobalCache(resolutionHost, moduleResolutionCache, moduleName, containingFile, resolutionHost.getCompilationSettings());
124640
+ const data = (_a = resolutionHost.beforeResolveSingleModuleNameWithoutWatching) == null ? void 0 : _a.call(resolutionHost, moduleResolutionCache);
124641
+ const host = getModuleResolutionHost(resolutionHost);
124642
+ const result = resolveModuleName(
124643
+ moduleName,
124644
+ containingFile,
124645
+ resolutionHost.getCompilationSettings(),
124646
+ host,
124647
+ moduleResolutionCache
124648
+ );
124649
+ (_b = resolutionHost.afterResolveSingleModuleNameWithoutWatching) == null ? void 0 : _b.call(resolutionHost, moduleResolutionCache, moduleName, containingFile, result, data);
124650
+ return result;
124578
124651
  }
124579
124652
  function isNodeModulesAtTypesDirectory(dirPath) {
124580
124653
  return endsWith(dirPath, "/node_modules/@types");
@@ -125758,7 +125831,7 @@ ${lanes.join("\n")}
125758
125831
  }
125759
125832
  function createWatchProgram(host) {
125760
125833
  let builderProgram;
125761
- let reloadLevel;
125834
+ let updateLevel;
125762
125835
  let missingFilesMap;
125763
125836
  let watchedWildcardDirectories;
125764
125837
  let timerToUpdateProgram;
@@ -126117,7 +126190,7 @@ ${lanes.join("\n")}
126117
126190
  }
126118
126191
  function scheduleProgramReload() {
126119
126192
  Debug.assert(!!configFileName);
126120
- reloadLevel = 2 /* Full */;
126193
+ updateLevel = 2 /* Full */;
126121
126194
  scheduleProgramUpdate();
126122
126195
  }
126123
126196
  function updateProgramWithWatchStatus() {
@@ -126127,8 +126200,8 @@ ${lanes.join("\n")}
126127
126200
  }
126128
126201
  function updateProgram() {
126129
126202
  var _a, _b, _c, _d;
126130
- switch (reloadLevel) {
126131
- case 1 /* Partial */:
126203
+ switch (updateLevel) {
126204
+ case 1 /* RootNamesAndUpdate */:
126132
126205
  (_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload");
126133
126206
  reloadFileNamesFromConfigFile();
126134
126207
  break;
@@ -126148,7 +126221,7 @@ ${lanes.join("\n")}
126148
126221
  writeLog("Reloading new file names and options");
126149
126222
  Debug.assert(compilerOptions);
126150
126223
  Debug.assert(configFileName);
126151
- reloadLevel = 0 /* None */;
126224
+ updateLevel = 0 /* Update */;
126152
126225
  rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
126153
126226
  if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
126154
126227
  hasChangedConfigFileParsingErrors = true;
@@ -126158,7 +126231,7 @@ ${lanes.join("\n")}
126158
126231
  function reloadConfigFile() {
126159
126232
  Debug.assert(configFileName);
126160
126233
  writeLog(`Reloading config file: ${configFileName}`);
126161
- reloadLevel = 0 /* None */;
126234
+ updateLevel = 0 /* Update */;
126162
126235
  if (cachedDirectoryStructureHost) {
126163
126236
  cachedDirectoryStructureHost.clearCache();
126164
126237
  }
@@ -126195,9 +126268,9 @@ ${lanes.join("\n")}
126195
126268
  const configPath = toPath3(configFileName2);
126196
126269
  let config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
126197
126270
  if (config) {
126198
- if (!config.reloadLevel)
126271
+ if (!config.updateLevel)
126199
126272
  return config.parsedCommandLine;
126200
- if (config.parsedCommandLine && config.reloadLevel === 1 /* Partial */ && !host.getParsedCommandLine) {
126273
+ if (config.parsedCommandLine && config.updateLevel === 1 /* RootNamesAndUpdate */ && !host.getParsedCommandLine) {
126201
126274
  writeLog("Reloading new file names and options");
126202
126275
  Debug.assert(compilerOptions);
126203
126276
  const fileNames = getFileNamesFromConfigSpecs(
@@ -126207,7 +126280,7 @@ ${lanes.join("\n")}
126207
126280
  parseConfigFileHost
126208
126281
  );
126209
126282
  config.parsedCommandLine = { ...config.parsedCommandLine, fileNames };
126210
- config.reloadLevel = void 0;
126283
+ config.updateLevel = void 0;
126211
126284
  return config.parsedCommandLine;
126212
126285
  }
126213
126286
  }
@@ -126215,7 +126288,7 @@ ${lanes.join("\n")}
126215
126288
  const parsedCommandLine = host.getParsedCommandLine ? host.getParsedCommandLine(configFileName2) : getParsedCommandLineFromConfigFileHost(configFileName2);
126216
126289
  if (config) {
126217
126290
  config.parsedCommandLine = parsedCommandLine;
126218
- config.reloadLevel = void 0;
126291
+ config.updateLevel = void 0;
126219
126292
  } else {
126220
126293
  (parsedConfigs || (parsedConfigs = /* @__PURE__ */ new Map())).set(configPath, config = { parsedCommandLine });
126221
126294
  }
@@ -126312,8 +126385,8 @@ ${lanes.join("\n")}
126312
126385
  toPath: toPath3
126313
126386
  }))
126314
126387
  return;
126315
- if (reloadLevel !== 2 /* Full */) {
126316
- reloadLevel = 1 /* Partial */;
126388
+ if (updateLevel !== 2 /* Full */) {
126389
+ updateLevel = 1 /* RootNamesAndUpdate */;
126317
126390
  scheduleProgramUpdate();
126318
126391
  }
126319
126392
  },
@@ -126339,11 +126412,11 @@ ${lanes.join("\n")}
126339
126412
  return;
126340
126413
  projects.forEach((projectPath) => {
126341
126414
  if (configFileName && toPath3(configFileName) === projectPath) {
126342
- reloadLevel = 2 /* Full */;
126415
+ updateLevel = 2 /* Full */;
126343
126416
  } else {
126344
126417
  const config = parsedConfigs == null ? void 0 : parsedConfigs.get(projectPath);
126345
126418
  if (config)
126346
- config.reloadLevel = 2 /* Full */;
126419
+ config.updateLevel = 2 /* Full */;
126347
126420
  resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath);
126348
126421
  }
126349
126422
  scheduleProgramUpdate();
@@ -126364,7 +126437,7 @@ ${lanes.join("\n")}
126364
126437
  updateCachedSystemWithFile(configFileName2, configPath, eventKind);
126365
126438
  const config = parsedConfigs == null ? void 0 : parsedConfigs.get(configPath);
126366
126439
  if (config)
126367
- config.reloadLevel = 2 /* Full */;
126440
+ config.updateLevel = 2 /* Full */;
126368
126441
  resolutionCache.removeResolutionsFromProjectReferenceRedirects(configPath);
126369
126442
  scheduleProgramUpdate();
126370
126443
  },
@@ -126402,8 +126475,8 @@ ${lanes.join("\n")}
126402
126475
  toPath: toPath3
126403
126476
  }))
126404
126477
  return;
126405
- if (config.reloadLevel !== 2 /* Full */) {
126406
- config.reloadLevel = 1 /* Partial */;
126478
+ if (config.updateLevel !== 2 /* Full */) {
126479
+ config.updateLevel = 1 /* RootNamesAndUpdate */;
126407
126480
  scheduleProgramUpdate();
126408
126481
  }
126409
126482
  },
@@ -126877,12 +126950,12 @@ ${lanes.join("\n")}
126877
126950
  state.projectStatus.delete(resolved);
126878
126951
  state.diagnostics.delete(resolved);
126879
126952
  }
126880
- function addProjToQueue({ projectPendingBuild }, proj, reloadLevel) {
126953
+ function addProjToQueue({ projectPendingBuild }, proj, updateLevel) {
126881
126954
  const value = projectPendingBuild.get(proj);
126882
126955
  if (value === void 0) {
126883
- projectPendingBuild.set(proj, reloadLevel);
126884
- } else if (value < reloadLevel) {
126885
- projectPendingBuild.set(proj, reloadLevel);
126956
+ projectPendingBuild.set(proj, updateLevel);
126957
+ } else if (value < updateLevel) {
126958
+ projectPendingBuild.set(proj, updateLevel);
126886
126959
  }
126887
126960
  }
126888
126961
  function setupInitialBuild(state, cancellationToken) {
@@ -126896,7 +126969,7 @@ ${lanes.join("\n")}
126896
126969
  buildOrder.forEach(
126897
126970
  (configFileName) => state.projectPendingBuild.set(
126898
126971
  toResolvedConfigFilePath(state, configFileName),
126899
- 0 /* None */
126972
+ 0 /* Update */
126900
126973
  )
126901
126974
  );
126902
126975
  if (cancellationToken) {
@@ -127332,8 +127405,8 @@ ${lanes.join("\n")}
127332
127405
  for (let projectIndex = 0; projectIndex < buildOrder.length; projectIndex++) {
127333
127406
  const project = buildOrder[projectIndex];
127334
127407
  const projectPath = toResolvedConfigFilePath(state, project);
127335
- const reloadLevel = state.projectPendingBuild.get(projectPath);
127336
- if (reloadLevel === void 0)
127408
+ const updateLevel = state.projectPendingBuild.get(projectPath);
127409
+ if (updateLevel === void 0)
127337
127410
  continue;
127338
127411
  if (reportQueue) {
127339
127412
  reportQueue = false;
@@ -127345,13 +127418,13 @@ ${lanes.join("\n")}
127345
127418
  projectPendingBuild.delete(projectPath);
127346
127419
  continue;
127347
127420
  }
127348
- if (reloadLevel === 2 /* Full */) {
127421
+ if (updateLevel === 2 /* Full */) {
127349
127422
  watchConfigFile(state, project, projectPath, config);
127350
127423
  watchExtendedConfigFiles(state, projectPath, config);
127351
127424
  watchWildCardDirectories(state, project, projectPath, config);
127352
127425
  watchInputFiles(state, project, projectPath, config);
127353
127426
  watchPackageJsonFiles(state, project, projectPath, config);
127354
- } else if (reloadLevel === 1 /* Partial */) {
127427
+ } else if (updateLevel === 1 /* RootNamesAndUpdate */) {
127355
127428
  config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, getDirectoryPath(project), config.options, state.parseConfigFileHost);
127356
127429
  updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, canJsonReportNoInputFiles(config.raw));
127357
127430
  watchInputFiles(state, project, projectPath, config);
@@ -127938,7 +128011,7 @@ ${lanes.join("\n")}
127938
128011
  break;
127939
128012
  }
127940
128013
  }
127941
- addProjToQueue(state, nextProjectPath, 0 /* None */);
128014
+ addProjToQueue(state, nextProjectPath, 0 /* Update */);
127942
128015
  break;
127943
128016
  }
127944
128017
  }
@@ -128007,7 +128080,7 @@ ${lanes.join("\n")}
128007
128080
  filesToDelete.push(output);
128008
128081
  } else {
128009
128082
  host.deleteFile(output);
128010
- invalidateProject(state, resolvedPath, 0 /* None */);
128083
+ invalidateProject(state, resolvedPath, 0 /* Update */);
128011
128084
  }
128012
128085
  }
128013
128086
  }
@@ -128018,22 +128091,22 @@ ${lanes.join("\n")}
128018
128091
  }
128019
128092
  return 0 /* Success */;
128020
128093
  }
128021
- function invalidateProject(state, resolved, reloadLevel) {
128022
- if (state.host.getParsedCommandLine && reloadLevel === 1 /* Partial */) {
128023
- reloadLevel = 2 /* Full */;
128094
+ function invalidateProject(state, resolved, updateLevel) {
128095
+ if (state.host.getParsedCommandLine && updateLevel === 1 /* RootNamesAndUpdate */) {
128096
+ updateLevel = 2 /* Full */;
128024
128097
  }
128025
- if (reloadLevel === 2 /* Full */) {
128098
+ if (updateLevel === 2 /* Full */) {
128026
128099
  state.configFileCache.delete(resolved);
128027
128100
  state.buildOrder = void 0;
128028
128101
  }
128029
128102
  state.needsSummary = true;
128030
128103
  clearProjectStatus(state, resolved);
128031
- addProjToQueue(state, resolved, reloadLevel);
128104
+ addProjToQueue(state, resolved, updateLevel);
128032
128105
  enableCache(state);
128033
128106
  }
128034
- function invalidateProjectAndScheduleBuilds(state, resolvedPath, reloadLevel) {
128107
+ function invalidateProjectAndScheduleBuilds(state, resolvedPath, updateLevel) {
128035
128108
  state.reportFileChangeDetected = true;
128036
- invalidateProject(state, resolvedPath, reloadLevel);
128109
+ invalidateProject(state, resolvedPath, updateLevel);
128037
128110
  scheduleBuildInvalidatedProject(
128038
128111
  state,
128039
128112
  250,
@@ -128164,7 +128237,7 @@ ${lanes.join("\n")}
128164
128237
  toPath: (fileName) => toPath2(state, fileName)
128165
128238
  }))
128166
128239
  return;
128167
- invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* Partial */);
128240
+ invalidateProjectAndScheduleBuilds(state, resolvedPath, 1 /* RootNamesAndUpdate */);
128168
128241
  },
128169
128242
  flags,
128170
128243
  parsed == null ? void 0 : parsed.watchOptions,
@@ -128183,7 +128256,7 @@ ${lanes.join("\n")}
128183
128256
  createNewValue: (_path, input) => watchFile(
128184
128257
  state,
128185
128258
  input,
128186
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* None */),
128259
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
128187
128260
  250 /* Low */,
128188
128261
  parsed == null ? void 0 : parsed.watchOptions,
128189
128262
  WatchType.SourceFile,
@@ -128203,7 +128276,7 @@ ${lanes.join("\n")}
128203
128276
  createNewValue: (path, _input) => watchFile(
128204
128277
  state,
128205
128278
  path,
128206
- () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* None */),
128279
+ () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
128207
128280
  2e3 /* High */,
128208
128281
  parsed == null ? void 0 : parsed.watchOptions,
128209
128282
  WatchType.PackageJson,
@@ -128274,7 +128347,7 @@ ${lanes.join("\n")}
128274
128347
  const configFilePath = toResolvedConfigFilePath(state, configFileName);
128275
128348
  return getUpToDateStatus(state, parseConfigFile(state, configFileName, configFilePath), configFilePath);
128276
128349
  },
128277
- invalidateProject: (configFilePath, reloadLevel) => invalidateProject(state, configFilePath, reloadLevel || 0 /* None */),
128350
+ invalidateProject: (configFilePath, updateLevel) => invalidateProject(state, configFilePath, updateLevel || 0 /* Update */),
128278
128351
  close: () => stopWatching(state)
128279
128352
  };
128280
128353
  }
@@ -172637,7 +172710,7 @@ ${options.prefix}` : "\n" : options.prefix
172637
172710
  return fileName[0] === "^" || (fileName.includes("walkThroughSnippet:/") || fileName.includes("untitled:/")) && getBaseFileName(fileName)[0] === "^" || fileName.includes(":^") && !fileName.includes(directorySeparator);
172638
172711
  }
172639
172712
  function ensurePrimaryProjectKind(project) {
172640
- if (!project || project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */) {
172713
+ if (!project || isBackgroundProject(project)) {
172641
172714
  return Errors.ThrowNoProject();
172642
172715
  }
172643
172716
  return project;
@@ -173099,7 +173172,7 @@ ${options.prefix}` : "\n" : options.prefix
173099
173172
  isContainedByBackgroundProject() {
173100
173173
  return some(
173101
173174
  this.containingProjects,
173102
- (p) => p.projectKind === 3 /* AutoImportProvider */ || p.projectKind === 4 /* Auxiliary */
173175
+ isBackgroundProject
173103
173176
  );
173104
173177
  }
173105
173178
  /**
@@ -173335,6 +173408,9 @@ ${options.prefix}` : "\n" : options.prefix
173335
173408
  function isExternalProject(project) {
173336
173409
  return project.projectKind === 2 /* External */;
173337
173410
  }
173411
+ function isBackgroundProject(project) {
173412
+ return project.projectKind === 3 /* AutoImportProvider */ || project.projectKind === 4 /* Auxiliary */;
173413
+ }
173338
173414
  var ProjectKind, Project3, InferredProject2, AuxiliaryProject, _AutoImportProviderProject, AutoImportProviderProject, ConfiguredProject2, ExternalProject2;
173339
173415
  var init_project = __esm({
173340
173416
  "src/server/project.ts"() {
@@ -173451,9 +173527,10 @@ ${options.prefix}` : "\n" : options.prefix
173451
173527
  this.disableLanguageService(lastFileExceededProgramSize);
173452
173528
  }
173453
173529
  this.markAsDirty();
173454
- if (projectKind !== 3 /* AutoImportProvider */) {
173530
+ if (!isBackgroundProject(this)) {
173455
173531
  this.projectService.pendingEnsureProjectForOpenFiles = true;
173456
173532
  }
173533
+ this.projectService.onProjectCreation(this);
173457
173534
  }
173458
173535
  /** @internal */
173459
173536
  getResolvedProjectReferenceToRedirect(_fileName) {
@@ -173623,6 +173700,7 @@ ${options.prefix}` : "\n" : options.prefix
173623
173700
  resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) {
173624
173701
  return this.resolutionCache.resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames);
173625
173702
  }
173703
+ /** @internal */
173626
173704
  getModuleResolutionCache() {
173627
173705
  return this.resolutionCache.getModuleResolutionCache();
173628
173706
  }
@@ -173888,12 +173966,12 @@ ${options.prefix}` : "\n" : options.prefix
173888
173966
  }
173889
173967
  return { ...newTypeAcquisition, include: this.removeExistingTypings(newTypeAcquisition.include) };
173890
173968
  }
173891
- getExternalFiles() {
173969
+ getExternalFiles(updateLevel) {
173892
173970
  return sort(flatMap(this.plugins, (plugin) => {
173893
173971
  if (typeof plugin.module.getExternalFiles !== "function")
173894
173972
  return;
173895
173973
  try {
173896
- return plugin.module.getExternalFiles(this);
173974
+ return plugin.module.getExternalFiles(this, updateLevel || 0 /* Update */);
173897
173975
  } catch (e) {
173898
173976
  this.projectService.logger.info(`A plugin threw an exception in getExternalFiles: ${e}`);
173899
173977
  if (e.stack) {
@@ -174628,6 +174706,7 @@ ${options.prefix}` : "\n" : options.prefix
174628
174706
  }
174629
174707
  /** @internal */
174630
174708
  getChangesSinceVersion(lastKnownVersion, includeProjectReferenceRedirectInfo) {
174709
+ var _a, _b;
174631
174710
  const includeProjectReferenceRedirectInfoIfRequested = includeProjectReferenceRedirectInfo ? (files) => arrayFrom(files.entries(), ([fileName, isSourceOfProjectReferenceRedirect]) => ({
174632
174711
  fileName,
174633
174712
  isSourceOfProjectReferenceRedirect
@@ -174650,10 +174729,10 @@ ${options.prefix}` : "\n" : options.prefix
174650
174729
  return { info, projectErrors: this.getGlobalProjectErrors() };
174651
174730
  }
174652
174731
  const lastReportedFileNames = this.lastReportedFileNames;
174653
- const externalFiles = this.getExternalFiles().map((f) => ({
174732
+ const externalFiles = ((_a = this.externalFiles) == null ? void 0 : _a.map((f) => ({
174654
174733
  fileName: toNormalizedPath(f),
174655
174734
  isSourceOfProjectReferenceRedirect: false
174656
- }));
174735
+ }))) || emptyArray2;
174657
174736
  const currentFiles = arrayToMap(
174658
174737
  this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo).concat(externalFiles),
174659
174738
  (info2) => info2.fileName,
@@ -174695,10 +174774,10 @@ ${options.prefix}` : "\n" : options.prefix
174695
174774
  };
174696
174775
  } else {
174697
174776
  const projectFileNames = this.getFileNamesWithRedirectInfo(!!includeProjectReferenceRedirectInfo);
174698
- const externalFiles = this.getExternalFiles().map((f) => ({
174777
+ const externalFiles = ((_b = this.externalFiles) == null ? void 0 : _b.map((f) => ({
174699
174778
  fileName: toNormalizedPath(f),
174700
174779
  isSourceOfProjectReferenceRedirect: false
174701
- }));
174780
+ }))) || emptyArray2;
174702
174781
  const allFiles = projectFileNames.concat(externalFiles);
174703
174782
  this.lastReportedFileNames = arrayToMap(
174704
174783
  allFiles,
@@ -174900,32 +174979,15 @@ ${options.prefix}` : "\n" : options.prefix
174900
174979
  return this.projectService.getIncompleteCompletionsCache();
174901
174980
  }
174902
174981
  /** @internal */
174903
- getNoDtsResolutionProject(rootFileNames) {
174982
+ getNoDtsResolutionProject(rootFile) {
174904
174983
  Debug.assert(this.projectService.serverMode === 0 /* Semantic */);
174905
174984
  if (!this.noDtsResolutionProject) {
174906
174985
  this.noDtsResolutionProject = new AuxiliaryProject(this.projectService, this.documentRegistry, this.getCompilerOptionsForNoDtsResolutionProject(), this.currentDirectory);
174907
174986
  }
174908
- enumerateInsertsAndDeletes(
174909
- rootFileNames.map(toNormalizedPath),
174910
- this.noDtsResolutionProject.getRootFiles(),
174911
- getStringComparer(!this.useCaseSensitiveFileNames()),
174912
- (pathToAdd) => {
174913
- const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
174914
- pathToAdd,
174915
- this.currentDirectory,
174916
- this.noDtsResolutionProject.directoryStructureHost
174917
- );
174918
- if (info) {
174919
- this.noDtsResolutionProject.addRoot(info, pathToAdd);
174920
- }
174921
- },
174922
- (pathToRemove) => {
174923
- const info = this.noDtsResolutionProject.getScriptInfo(pathToRemove);
174924
- if (info) {
174925
- this.noDtsResolutionProject.removeRoot(info);
174926
- }
174927
- }
174928
- );
174987
+ if (this.noDtsResolutionProject.rootFile !== rootFile) {
174988
+ this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this.noDtsResolutionProject, [rootFile]);
174989
+ this.noDtsResolutionProject.rootFile = rootFile;
174990
+ }
174929
174991
  return this.noDtsResolutionProject;
174930
174992
  }
174931
174993
  /** @internal */
@@ -175232,7 +175294,7 @@ ${options.prefix}` : "\n" : options.prefix
175232
175294
  this.getCompilationSettings()
175233
175295
  );
175234
175296
  }
175235
- this.projectService.setFileNamesOfAutoImportProviderProject(this, rootFileNames);
175297
+ this.projectService.setFileNamesOfAutpImportProviderOrAuxillaryProject(this, rootFileNames);
175236
175298
  this.rootFileNames = rootFileNames;
175237
175299
  const oldProgram = this.getCurrentProgram();
175238
175300
  const hasSameSetOfFiles = super.updateGraph();
@@ -175377,18 +175439,18 @@ ${options.prefix}` : "\n" : options.prefix
175377
175439
  updateGraph() {
175378
175440
  const isInitialLoad = this.isInitialLoadPending();
175379
175441
  this.isInitialLoadPending = returnFalse;
175380
- const reloadLevel = this.pendingReload;
175381
- this.pendingReload = 0 /* None */;
175442
+ const updateLevel = this.pendingUpdateLevel;
175443
+ this.pendingUpdateLevel = 0 /* Update */;
175382
175444
  let result;
175383
- switch (reloadLevel) {
175384
- case 1 /* Partial */:
175445
+ switch (updateLevel) {
175446
+ case 1 /* RootNamesAndUpdate */:
175385
175447
  this.openFileWatchTriggered.clear();
175386
175448
  result = this.projectService.reloadFileNamesOfConfiguredProject(this);
175387
175449
  break;
175388
175450
  case 2 /* Full */:
175389
175451
  this.openFileWatchTriggered.clear();
175390
- const reason = Debug.checkDefined(this.pendingReloadReason);
175391
- this.pendingReloadReason = void 0;
175452
+ const reason = Debug.checkDefined(this.pendingUpdateReason);
175453
+ this.pendingUpdateReason = void 0;
175392
175454
  this.projectService.reloadConfiguredProject(
175393
175455
  this,
175394
175456
  reason,
@@ -176055,6 +176117,8 @@ ${options.prefix}` : "\n" : options.prefix
176055
176117
  this.verifyDocumentRegistry = noop;
176056
176118
  /** @internal */
176057
176119
  this.verifyProgram = noop;
176120
+ /** @internal */
176121
+ this.onProjectCreation = noop;
176058
176122
  var _a;
176059
176123
  this.host = opts.host;
176060
176124
  this.logger = opts.logger;
@@ -176222,20 +176286,20 @@ ${options.prefix}` : "\n" : options.prefix
176222
176286
  }
176223
176287
  delayUpdateProjectGraph(project) {
176224
176288
  project.markAsDirty();
176225
- if (project.projectKind !== 3 /* AutoImportProvider */ && project.projectKind !== 4 /* Auxiliary */) {
176226
- const projectName = project.getProjectName();
176227
- this.pendingProjectUpdates.set(projectName, project);
176228
- this.throttledOperations.schedule(
176229
- projectName,
176230
- /*delay*/
176231
- 250,
176232
- () => {
176233
- if (this.pendingProjectUpdates.delete(projectName)) {
176234
- updateProjectIfDirty(project);
176235
- }
176289
+ if (isBackgroundProject(project))
176290
+ return;
176291
+ const projectName = project.getProjectName();
176292
+ this.pendingProjectUpdates.set(projectName, project);
176293
+ this.throttledOperations.schedule(
176294
+ projectName,
176295
+ /*delay*/
176296
+ 250,
176297
+ () => {
176298
+ if (this.pendingProjectUpdates.delete(projectName)) {
176299
+ updateProjectIfDirty(project);
176236
176300
  }
176237
- );
176238
- }
176301
+ }
176302
+ );
176239
176303
  }
176240
176304
  /** @internal */
176241
176305
  hasPendingProjectUpdate(project) {
@@ -176511,28 +176575,28 @@ ${options.prefix}` : "\n" : options.prefix
176511
176575
  getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0
176512
176576
  }))
176513
176577
  return;
176514
- if (config.reloadLevel !== 2 /* Full */)
176515
- config.reloadLevel = 1 /* Partial */;
176578
+ if (config.updateLevel !== 2 /* Full */)
176579
+ config.updateLevel = 1 /* RootNamesAndUpdate */;
176516
176580
  config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => {
176517
176581
  if (!watchWildcardDirectories)
176518
176582
  return;
176519
176583
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
176520
176584
  if (!project)
176521
176585
  return;
176522
- const reloadLevel = configuredProjectForConfig === project ? 1 /* Partial */ : 0 /* None */;
176523
- if (project.pendingReload !== void 0 && project.pendingReload > reloadLevel)
176586
+ const updateLevel = configuredProjectForConfig === project ? 1 /* RootNamesAndUpdate */ : 0 /* Update */;
176587
+ if (project.pendingUpdateLevel !== void 0 && project.pendingUpdateLevel > updateLevel)
176524
176588
  return;
176525
176589
  if (this.openFiles.has(fileOrDirectoryPath)) {
176526
176590
  const info = Debug.checkDefined(this.getScriptInfoForPath(fileOrDirectoryPath));
176527
176591
  if (info.isAttached(project)) {
176528
- const loadLevelToSet = Math.max(reloadLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* None */);
176592
+ const loadLevelToSet = Math.max(updateLevel, project.openFileWatchTriggered.get(fileOrDirectoryPath) || 0 /* Update */);
176529
176593
  project.openFileWatchTriggered.set(fileOrDirectoryPath, loadLevelToSet);
176530
176594
  } else {
176531
- project.pendingReload = reloadLevel;
176595
+ project.pendingUpdateLevel = updateLevel;
176532
176596
  this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
176533
176597
  }
176534
176598
  } else {
176535
- project.pendingReload = reloadLevel;
176599
+ project.pendingUpdateLevel = updateLevel;
176536
176600
  this.delayUpdateProjectGraphAndEnsureProjectStructureForOpenFiles(project);
176537
176601
  }
176538
176602
  });
@@ -176544,12 +176608,12 @@ ${options.prefix}` : "\n" : options.prefix
176544
176608
  );
176545
176609
  }
176546
176610
  /** @internal */
176547
- delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, reloadReason) {
176611
+ delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
176548
176612
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
176549
176613
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config))
176550
176614
  return false;
176551
176615
  let scheduledAnyProjectUpdate = false;
176552
- configFileExistenceInfo.config.reloadLevel = 2 /* Full */;
176616
+ configFileExistenceInfo.config.updateLevel = 2 /* Full */;
176553
176617
  configFileExistenceInfo.config.projects.forEach((_watchWildcardDirectories, projectCanonicalPath) => {
176554
176618
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
176555
176619
  if (!project)
@@ -176558,8 +176622,8 @@ ${options.prefix}` : "\n" : options.prefix
176558
176622
  if (projectCanonicalPath === canonicalConfigFilePath) {
176559
176623
  if (project.isInitialLoadPending())
176560
176624
  return;
176561
- project.pendingReload = 2 /* Full */;
176562
- project.pendingReloadReason = reloadReason;
176625
+ project.pendingUpdateLevel = 2 /* Full */;
176626
+ project.pendingUpdateReason = loadReason;
176563
176627
  this.delayUpdateProjectGraph(project);
176564
176628
  } else {
176565
176629
  project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(this.toPath(canonicalConfigFilePath));
@@ -176708,11 +176772,11 @@ ${options.prefix}` : "\n" : options.prefix
176708
176772
  if (info.hasMixedContent) {
176709
176773
  info.registerFileUpdate();
176710
176774
  }
176711
- const reloadLevel = p.openFileWatchTriggered.get(info.path);
176712
- if (reloadLevel !== void 0) {
176775
+ const updateLevel = p.openFileWatchTriggered.get(info.path);
176776
+ if (updateLevel !== void 0) {
176713
176777
  p.openFileWatchTriggered.delete(info.path);
176714
- if (p.pendingReload !== void 0 && p.pendingReload < reloadLevel) {
176715
- p.pendingReload = reloadLevel;
176778
+ if (p.pendingUpdateLevel !== void 0 && p.pendingUpdateLevel < updateLevel) {
176779
+ p.pendingUpdateLevel = updateLevel;
176716
176780
  p.markFileAsDirty(info.path);
176717
176781
  }
176718
176782
  }
@@ -177092,6 +177156,7 @@ ${options.prefix}` : "\n" : options.prefix
177092
177156
  addFilesToNonInferredProject(project, files, propertyReader, typeAcquisition) {
177093
177157
  this.updateNonInferredProjectFiles(project, files, propertyReader);
177094
177158
  project.setTypeAcquisition(typeAcquisition);
177159
+ project.markAsDirty();
177095
177160
  }
177096
177161
  /** @internal */
177097
177162
  createConfiguredProject(configFileName) {
@@ -177109,7 +177174,7 @@ ${options.prefix}` : "\n" : options.prefix
177109
177174
  configFileExistenceInfo.config = {
177110
177175
  cachedDirectoryStructureHost: createCachedDirectoryStructureHost(this.host, this.host.getCurrentDirectory(), this.host.useCaseSensitiveFileNames),
177111
177176
  projects: /* @__PURE__ */ new Map(),
177112
- reloadLevel: 2 /* Full */
177177
+ updateLevel: 2 /* Full */
177113
177178
  };
177114
177179
  }
177115
177180
  const project = new ConfiguredProject2(
@@ -177126,8 +177191,8 @@ ${options.prefix}` : "\n" : options.prefix
177126
177191
  /** @internal */
177127
177192
  createConfiguredProjectWithDelayLoad(configFileName, reason) {
177128
177193
  const project = this.createConfiguredProject(configFileName);
177129
- project.pendingReload = 2 /* Full */;
177130
- project.pendingReloadReason = reason;
177194
+ project.pendingUpdateLevel = 2 /* Full */;
177195
+ project.pendingUpdateReason = reason;
177131
177196
  return project;
177132
177197
  }
177133
177198
  /** @internal */
@@ -177183,7 +177248,7 @@ ${options.prefix}` : "\n" : options.prefix
177183
177248
  this.watchWildcards(configFilename, configFileExistenceInfo, project);
177184
177249
  }
177185
177250
  project.enablePluginsWithOptions(compilerOptions);
177186
- const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles());
177251
+ const filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles(2 /* Full */));
177187
177252
  this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
177188
177253
  (_b = tracing) == null ? void 0 : _b.pop();
177189
177254
  }
@@ -177191,9 +177256,9 @@ ${options.prefix}` : "\n" : options.prefix
177191
177256
  ensureParsedConfigUptoDate(configFilename, canonicalConfigFilePath, configFileExistenceInfo, forProject) {
177192
177257
  var _a, _b, _c;
177193
177258
  if (configFileExistenceInfo.config) {
177194
- if (!configFileExistenceInfo.config.reloadLevel)
177259
+ if (!configFileExistenceInfo.config.updateLevel)
177195
177260
  return configFileExistenceInfo;
177196
- if (configFileExistenceInfo.config.reloadLevel === 1 /* Partial */) {
177261
+ if (configFileExistenceInfo.config.updateLevel === 1 /* RootNamesAndUpdate */) {
177197
177262
  this.reloadFileNamesOfParsedConfig(configFilename, configFileExistenceInfo.config);
177198
177263
  return configFileExistenceInfo;
177199
177264
  }
@@ -177236,7 +177301,7 @@ ${options.prefix}` : "\n" : options.prefix
177236
177301
  } else {
177237
177302
  configFileExistenceInfo.config.parsedCommandLine = parsedCommandLine;
177238
177303
  configFileExistenceInfo.config.watchedDirectoriesStale = true;
177239
- configFileExistenceInfo.config.reloadLevel = void 0;
177304
+ configFileExistenceInfo.config.updateLevel = void 0;
177240
177305
  }
177241
177306
  if (!oldCommandLine && !isJsonEqual(
177242
177307
  // Old options
@@ -177377,7 +177442,6 @@ ${options.prefix}` : "\n" : options.prefix
177377
177442
  }
177378
177443
  });
177379
177444
  }
177380
- project.markAsDirty();
177381
177445
  }
177382
177446
  updateRootAndOptionsOfNonInferredProject(project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, watchOptions) {
177383
177447
  project.setCompilerOptions(newOptions);
@@ -177395,14 +177459,15 @@ ${options.prefix}` : "\n" : options.prefix
177395
177459
  reloadFileNamesOfConfiguredProject(project) {
177396
177460
  const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
177397
177461
  project.updateErrorOnNoInputFiles(fileNames);
177398
- this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles()), fileNamePropertyReader);
177462
+ this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
177463
+ project.markAsDirty();
177399
177464
  return project.updateGraph();
177400
177465
  }
177401
177466
  /** @internal */
177402
177467
  reloadFileNamesOfParsedConfig(configFileName, config) {
177403
- if (config.reloadLevel === void 0)
177468
+ if (config.updateLevel === void 0)
177404
177469
  return config.parsedCommandLine.fileNames;
177405
- Debug.assert(config.reloadLevel === 1 /* Partial */);
177470
+ Debug.assert(config.updateLevel === 1 /* RootNamesAndUpdate */);
177406
177471
  const configFileSpecs = config.parsedCommandLine.options.configFile.configFileSpecs;
177407
177472
  const fileNames = getFileNamesFromConfigSpecs(
177408
177473
  configFileSpecs,
@@ -177415,7 +177480,7 @@ ${options.prefix}` : "\n" : options.prefix
177415
177480
  return fileNames;
177416
177481
  }
177417
177482
  /** @internal */
177418
- setFileNamesOfAutoImportProviderProject(project, fileNames) {
177483
+ setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
177419
177484
  this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
177420
177485
  }
177421
177486
  /**
@@ -177944,7 +178009,7 @@ Dynamic files must always be opened with service's current directory or service
177944
178009
  this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
177945
178010
  if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
177946
178011
  this.configuredProjects.forEach((project) => {
177947
- if (project.hasExternalProjectRef() && project.pendingReload === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
178012
+ if (project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
177948
178013
  project.updateGraph();
177949
178014
  }
177950
178015
  });
@@ -177999,7 +178064,7 @@ Dynamic files must always be opened with service's current directory or service
177999
178064
  this.pendingEnsureProjectForOpenFiles = false;
178000
178065
  this.configFileExistenceInfoCache.forEach((info) => {
178001
178066
  if (info.config)
178002
- info.config.reloadLevel = 2 /* Full */;
178067
+ info.config.updateLevel = 2 /* Full */;
178003
178068
  });
178004
178069
  this.reloadConfiguredProjectForFiles(
178005
178070
  this.openFiles,
@@ -178051,8 +178116,8 @@ Dynamic files must always be opened with service's current directory or service
178051
178116
  if (!updatedProjects.has(project.canonicalConfigFilePath)) {
178052
178117
  updatedProjects.set(project.canonicalConfigFilePath, true);
178053
178118
  if (delayReload) {
178054
- project.pendingReload = 2 /* Full */;
178055
- project.pendingReloadReason = reason;
178119
+ project.pendingUpdateLevel = 2 /* Full */;
178120
+ project.pendingUpdateReason = reason;
178056
178121
  if (clearSemanticCache)
178057
178122
  this.clearSemanticCache(project);
178058
178123
  this.delayUpdateProjectGraph(project);
@@ -180880,7 +180945,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
180880
180945
  if (needsJsResolution) {
180881
180946
  const definitionSet = createSet((d) => d.textSpan.start, documentSpansEqual);
180882
180947
  definitions == null ? void 0 : definitions.forEach((d) => definitionSet.add(d));
180883
- const noDtsProject = project.getNoDtsResolutionProject([file]);
180948
+ const noDtsProject = project.getNoDtsResolutionProject(file);
180884
180949
  const ls = noDtsProject.getLanguageService();
180885
180950
  const jsDefinitions = (_a = ls.getDefinitionAtPosition(
180886
180951
  file,
@@ -180907,8 +180972,18 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
180907
180972
  const ambientCandidates = definitions.filter((d) => toNormalizedPath(d.fileName) !== file && d.isAmbient);
180908
180973
  for (const candidate of some(ambientCandidates) ? ambientCandidates : getAmbientCandidatesByClimbingAccessChain()) {
180909
180974
  const fileNameToSearch = findImplementationFileFromDtsFileName(candidate.fileName, file, noDtsProject);
180910
- if (!fileNameToSearch || !ensureRoot(noDtsProject, fileNameToSearch)) {
180975
+ if (!fileNameToSearch)
180976
+ continue;
180977
+ const info = this.projectService.getOrCreateScriptInfoNotOpenedByClient(
180978
+ fileNameToSearch,
180979
+ noDtsProject.currentDirectory,
180980
+ noDtsProject.directoryStructureHost
180981
+ );
180982
+ if (!info)
180911
180983
  continue;
180984
+ if (!noDtsProject.containsScriptInfo(info)) {
180985
+ noDtsProject.addRoot(info);
180986
+ noDtsProject.updateGraph();
180912
180987
  }
180913
180988
  const noDtsProgram = ls.getProgram();
180914
180989
  const fileToSearch = Debug.checkDefined(noDtsProgram.getSourceFile(fileNameToSearch));
@@ -181011,16 +181086,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
181011
181086
  }
181012
181087
  });
181013
181088
  }
181014
- function ensureRoot(project2, fileName) {
181015
- const info = project2.getScriptInfo(fileName);
181016
- if (!info)
181017
- return false;
181018
- if (!project2.containsScriptInfo(info)) {
181019
- project2.addRoot(info);
181020
- project2.updateGraph();
181021
- }
181022
- return true;
181023
- }
181024
181089
  }
181025
181090
  getEmitOutput(args) {
181026
181091
  const { file, project } = this.getFileAndProject(args);
@@ -183280,6 +183345,7 @@ ${e.message}`;
183280
183345
  hasArgument: () => hasArgument,
183281
183346
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
183282
183347
  indent: () => indent2,
183348
+ isBackgroundProject: () => isBackgroundProject,
183283
183349
  isConfigFile: () => isConfigFile,
183284
183350
  isConfiguredProject: () => isConfiguredProject,
183285
183351
  isDynamicFileName: () => isDynamicFileName,
@@ -183350,7 +183416,6 @@ ${e.message}`;
183350
183416
  CompletionInfoFlags: () => CompletionInfoFlags,
183351
183417
  CompletionTriggerKind: () => CompletionTriggerKind,
183352
183418
  Completions: () => ts_Completions_exports,
183353
- ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
183354
183419
  ContainerFlags: () => ContainerFlags,
183355
183420
  ContextFlags: () => ContextFlags,
183356
183421
  Debug: () => Debug,
@@ -183437,6 +183502,7 @@ ${e.message}`;
183437
183502
  PragmaKindFlags: () => PragmaKindFlags,
183438
183503
  PrivateIdentifierKind: () => PrivateIdentifierKind,
183439
183504
  ProcessLevel: () => ProcessLevel,
183505
+ ProgramUpdateLevel: () => ProgramUpdateLevel,
183440
183506
  QuotePreference: () => QuotePreference,
183441
183507
  RelationComparisonResult: () => RelationComparisonResult,
183442
183508
  Rename: () => ts_Rename_exports,
@@ -185699,6 +185765,7 @@ ${e.message}`;
185699
185765
  hasArgument: () => hasArgument,
185700
185766
  hasNoTypeScriptSource: () => hasNoTypeScriptSource,
185701
185767
  indent: () => indent2,
185768
+ isBackgroundProject: () => isBackgroundProject,
185702
185769
  isConfigFile: () => isConfigFile,
185703
185770
  isConfiguredProject: () => isConfiguredProject,
185704
185771
  isDynamicFileName: () => isDynamicFileName,
@@ -185757,7 +185824,6 @@ ${e.message}`;
185757
185824
  CompletionInfoFlags: () => CompletionInfoFlags,
185758
185825
  CompletionTriggerKind: () => CompletionTriggerKind,
185759
185826
  Completions: () => ts_Completions_exports,
185760
- ConfigFileProgramReloadLevel: () => ConfigFileProgramReloadLevel,
185761
185827
  ContainerFlags: () => ContainerFlags,
185762
185828
  ContextFlags: () => ContextFlags,
185763
185829
  Debug: () => Debug,
@@ -185844,6 +185910,7 @@ ${e.message}`;
185844
185910
  PragmaKindFlags: () => PragmaKindFlags,
185845
185911
  PrivateIdentifierKind: () => PrivateIdentifierKind,
185846
185912
  ProcessLevel: () => ProcessLevel,
185913
+ ProgramUpdateLevel: () => ProgramUpdateLevel,
185847
185914
  QuotePreference: () => QuotePreference,
185848
185915
  RelationComparisonResult: () => RelationComparisonResult,
185849
185916
  Rename: () => ts_Rename_exports,