typescript 5.4.0-dev.20240213 → 5.4.0-dev.20240215

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.4";
21
- var version = `${versionMajorMinor}.0-dev.20240213`;
21
+ var version = `${versionMajorMinor}.0-dev.20240215`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -32496,7 +32496,7 @@ var Parser;
32496
32496
  if (!jsDocDiagnostics) {
32497
32497
  jsDocDiagnostics = [];
32498
32498
  }
32499
- jsDocDiagnostics.push(...parseDiagnostics);
32499
+ addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
32500
32500
  }
32501
32501
  currentToken = saveToken;
32502
32502
  parseDiagnostics.length = saveParseDiagnosticsLength;
@@ -65650,7 +65650,7 @@ function createTypeChecker(host) {
65650
65650
  function hasMatchingArgument(expression, reference) {
65651
65651
  if (expression.arguments) {
65652
65652
  for (const argument of expression.arguments) {
65653
- if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
65653
+ if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
65654
65654
  return true;
65655
65655
  }
65656
65656
  }
@@ -65660,6 +65660,36 @@ function createTypeChecker(host) {
65660
65660
  }
65661
65661
  return false;
65662
65662
  }
65663
+ function getCandidateDiscriminantPropertyAccess(expr, reference) {
65664
+ if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
65665
+ if (isIdentifier(expr)) {
65666
+ const symbol = getResolvedSymbol(expr);
65667
+ const declaration = symbol.valueDeclaration;
65668
+ if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
65669
+ return declaration;
65670
+ }
65671
+ }
65672
+ } else if (isAccessExpression(expr)) {
65673
+ if (isMatchingReference(reference, expr.expression)) {
65674
+ return expr;
65675
+ }
65676
+ } else if (isIdentifier(expr)) {
65677
+ const symbol = getResolvedSymbol(expr);
65678
+ if (isConstantVariable(symbol)) {
65679
+ const declaration = symbol.valueDeclaration;
65680
+ if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
65681
+ return declaration.initializer;
65682
+ }
65683
+ if (isBindingElement(declaration) && !declaration.initializer) {
65684
+ const parent = declaration.parent.parent;
65685
+ if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
65686
+ return declaration;
65687
+ }
65688
+ }
65689
+ }
65690
+ }
65691
+ return void 0;
65692
+ }
65663
65693
  function getFlowNodeId(flow) {
65664
65694
  if (!flow.id || flow.id < 0) {
65665
65695
  flow.id = nextFlowId;
@@ -66759,39 +66789,9 @@ function createTypeChecker(host) {
66759
66789
  }
66760
66790
  return result;
66761
66791
  }
66762
- function getCandidateDiscriminantPropertyAccess(expr) {
66763
- if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
66764
- if (isIdentifier(expr)) {
66765
- const symbol = getResolvedSymbol(expr);
66766
- const declaration = symbol.valueDeclaration;
66767
- if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
66768
- return declaration;
66769
- }
66770
- }
66771
- } else if (isAccessExpression(expr)) {
66772
- if (isMatchingReference(reference, expr.expression)) {
66773
- return expr;
66774
- }
66775
- } else if (isIdentifier(expr)) {
66776
- const symbol = getResolvedSymbol(expr);
66777
- if (isConstantVariable(symbol)) {
66778
- const declaration = symbol.valueDeclaration;
66779
- if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
66780
- return declaration.initializer;
66781
- }
66782
- if (isBindingElement(declaration) && !declaration.initializer) {
66783
- const parent = declaration.parent.parent;
66784
- if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
66785
- return declaration;
66786
- }
66787
- }
66788
- }
66789
- }
66790
- return void 0;
66791
- }
66792
66792
  function getDiscriminantPropertyAccess(expr, computedType) {
66793
66793
  if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
66794
- const access = getCandidateDiscriminantPropertyAccess(expr);
66794
+ const access = getCandidateDiscriminantPropertyAccess(expr, reference);
66795
66795
  if (access) {
66796
66796
  const name = getAccessedPropertyName(access);
66797
66797
  if (name) {
package/lib/tsserver.js CHANGED
@@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
2340
2340
 
2341
2341
  // src/compiler/corePublic.ts
2342
2342
  var versionMajorMinor = "5.4";
2343
- var version = `${versionMajorMinor}.0-dev.20240213`;
2343
+ var version = `${versionMajorMinor}.0-dev.20240215`;
2344
2344
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2345
2345
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2346
2346
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -36931,7 +36931,7 @@ var Parser;
36931
36931
  if (!jsDocDiagnostics) {
36932
36932
  jsDocDiagnostics = [];
36933
36933
  }
36934
- jsDocDiagnostics.push(...parseDiagnostics);
36934
+ addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
36935
36935
  }
36936
36936
  currentToken = saveToken;
36937
36937
  parseDiagnostics.length = saveParseDiagnosticsLength;
@@ -70394,7 +70394,7 @@ function createTypeChecker(host) {
70394
70394
  function hasMatchingArgument(expression, reference) {
70395
70395
  if (expression.arguments) {
70396
70396
  for (const argument of expression.arguments) {
70397
- if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
70397
+ if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
70398
70398
  return true;
70399
70399
  }
70400
70400
  }
@@ -70404,6 +70404,36 @@ function createTypeChecker(host) {
70404
70404
  }
70405
70405
  return false;
70406
70406
  }
70407
+ function getCandidateDiscriminantPropertyAccess(expr, reference) {
70408
+ if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
70409
+ if (isIdentifier(expr)) {
70410
+ const symbol = getResolvedSymbol(expr);
70411
+ const declaration = symbol.valueDeclaration;
70412
+ if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
70413
+ return declaration;
70414
+ }
70415
+ }
70416
+ } else if (isAccessExpression(expr)) {
70417
+ if (isMatchingReference(reference, expr.expression)) {
70418
+ return expr;
70419
+ }
70420
+ } else if (isIdentifier(expr)) {
70421
+ const symbol = getResolvedSymbol(expr);
70422
+ if (isConstantVariable(symbol)) {
70423
+ const declaration = symbol.valueDeclaration;
70424
+ if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
70425
+ return declaration.initializer;
70426
+ }
70427
+ if (isBindingElement(declaration) && !declaration.initializer) {
70428
+ const parent2 = declaration.parent.parent;
70429
+ if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
70430
+ return declaration;
70431
+ }
70432
+ }
70433
+ }
70434
+ }
70435
+ return void 0;
70436
+ }
70407
70437
  function getFlowNodeId(flow) {
70408
70438
  if (!flow.id || flow.id < 0) {
70409
70439
  flow.id = nextFlowId;
@@ -71503,39 +71533,9 @@ function createTypeChecker(host) {
71503
71533
  }
71504
71534
  return result;
71505
71535
  }
71506
- function getCandidateDiscriminantPropertyAccess(expr) {
71507
- if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
71508
- if (isIdentifier(expr)) {
71509
- const symbol = getResolvedSymbol(expr);
71510
- const declaration = symbol.valueDeclaration;
71511
- if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
71512
- return declaration;
71513
- }
71514
- }
71515
- } else if (isAccessExpression(expr)) {
71516
- if (isMatchingReference(reference, expr.expression)) {
71517
- return expr;
71518
- }
71519
- } else if (isIdentifier(expr)) {
71520
- const symbol = getResolvedSymbol(expr);
71521
- if (isConstantVariable(symbol)) {
71522
- const declaration = symbol.valueDeclaration;
71523
- if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
71524
- return declaration.initializer;
71525
- }
71526
- if (isBindingElement(declaration) && !declaration.initializer) {
71527
- const parent2 = declaration.parent.parent;
71528
- if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
71529
- return declaration;
71530
- }
71531
- }
71532
- }
71533
- }
71534
- return void 0;
71535
- }
71536
71536
  function getDiscriminantPropertyAccess(expr, computedType) {
71537
71537
  if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
71538
- const access = getCandidateDiscriminantPropertyAccess(expr);
71538
+ const access = getCandidateDiscriminantPropertyAccess(expr, reference);
71539
71539
  if (access) {
71540
71540
  const name = getAccessedPropertyName(access);
71541
71541
  if (name) {
@@ -178159,7 +178159,7 @@ var ScriptInfo = class {
178159
178159
  }
178160
178160
  break;
178161
178161
  default:
178162
- if (unorderedRemoveItem(this.containingProjects, project)) {
178162
+ if (orderedRemoveItem(this.containingProjects, project)) {
178163
178163
  project.onFileAddedOrRemoved(this.isSymlink());
178164
178164
  }
178165
178165
  break;
@@ -181831,7 +181831,7 @@ var _ProjectService = class _ProjectService {
181831
181831
  );
181832
181832
  project.addRoot(info);
181833
181833
  if (info.containingProjects[0] !== project) {
181834
- info.detachFromProject(project);
181834
+ orderedRemoveItem(info.containingProjects, project);
181835
181835
  info.containingProjects.unshift(project);
181836
181836
  }
181837
181837
  project.updateGraph();
@@ -182126,8 +182126,7 @@ var _ProjectService = class _ProjectService {
182126
182126
  * otherwise just file name
182127
182127
  */
182128
182128
  getConfigFileNameForFile(info) {
182129
- if (isOpenScriptInfo(info)) {
182130
- Debug.assert(info.isScriptOpen());
182129
+ if (!isAncestorConfigFileInfo(info)) {
182131
182130
  const result = this.configFileForOpenFiles.get(info.path);
182132
182131
  if (result !== void 0)
182133
182132
  return result || void 0;
@@ -183122,11 +183121,13 @@ Dynamic files must always be opened with service's current directory or service
183122
183121
  } = this.hostConfiguration.preferences;
183123
183122
  this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
183124
183123
  if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
183125
- this.configuredProjects.forEach((project) => {
183126
- if (project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
183127
- project.updateGraph();
183128
- }
183129
- });
183124
+ this.externalProjectToConfiguredProjectMap.forEach(
183125
+ (projects) => projects.forEach((project) => {
183126
+ if (!project.isClosed() && project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
183127
+ project.updateGraph();
183128
+ }
183129
+ })
183130
+ );
183130
183131
  }
183131
183132
  if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
183132
183133
  this.forEachProject((project) => {
@@ -183711,23 +183712,20 @@ Dynamic files must always be opened with service's current directory or service
183711
183712
  scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
183712
183713
  }
183713
183714
  }
183714
- closeConfiguredProjectReferencedFromExternalProject(configFile) {
183715
- const configuredProject = this.findConfiguredProjectByProjectName(configFile);
183716
- if (configuredProject) {
183717
- configuredProject.deleteExternalProjectReference();
183718
- if (!configuredProject.hasOpenRef()) {
183719
- this.removeProject(configuredProject);
183720
- return;
183715
+ closeConfiguredProjectReferencedFromExternalProject(configuredProjects) {
183716
+ configuredProjects == null ? void 0 : configuredProjects.forEach((configuredProject) => {
183717
+ if (!configuredProject.isClosed()) {
183718
+ configuredProject.deleteExternalProjectReference();
183719
+ if (!configuredProject.hasOpenRef())
183720
+ this.removeProject(configuredProject);
183721
183721
  }
183722
- }
183722
+ });
183723
183723
  }
183724
183724
  closeExternalProject(uncheckedFileName, print) {
183725
183725
  const fileName = toNormalizedPath(uncheckedFileName);
183726
- const configFiles = this.externalProjectToConfiguredProjectMap.get(fileName);
183727
- if (configFiles) {
183728
- for (const configFile of configFiles) {
183729
- this.closeConfiguredProjectReferencedFromExternalProject(configFile);
183730
- }
183726
+ const configuredProjects = this.externalProjectToConfiguredProjectMap.get(fileName);
183727
+ if (configuredProjects) {
183728
+ this.closeConfiguredProjectReferencedFromExternalProject(configuredProjects);
183731
183729
  this.externalProjectToConfiguredProjectMap.delete(fileName);
183732
183730
  } else {
183733
183731
  const externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
@@ -183767,16 +183765,18 @@ Dynamic files must always be opened with service's current directory or service
183767
183765
  this.safelist = defaultTypeSafeList;
183768
183766
  }
183769
183767
  applySafeList(proj) {
183770
- const { rootFiles } = proj;
183771
183768
  const typeAcquisition = proj.typeAcquisition;
183772
183769
  Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now");
183770
+ const result = this.applySafeListWorker(proj, proj.rootFiles, typeAcquisition);
183771
+ return (result == null ? void 0 : result.excludedFiles) ?? [];
183772
+ }
183773
+ applySafeListWorker(proj, rootFiles, typeAcquisition) {
183773
183774
  if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) {
183774
- return [];
183775
+ return void 0;
183775
183776
  }
183776
183777
  const typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []);
183777
183778
  const excludeRules = [];
183778
183779
  const normalizedNames = rootFiles.map((f) => normalizeSlashes(f.fileName));
183779
- const excludedFiles = [];
183780
183780
  for (const name of Object.keys(this.safelist)) {
183781
183781
  const rule2 = this.safelist[name];
183782
183782
  for (const root of normalizedNames) {
@@ -183817,12 +183817,12 @@ Dynamic files must always be opened with service's current directory or service
183817
183817
  }
183818
183818
  }
183819
183819
  const excludeRegexes = excludeRules.map((e) => new RegExp(e, "i"));
183820
- const filesToKeep = [];
183821
- for (let i = 0; i < proj.rootFiles.length; i++) {
183820
+ let filesToKeep;
183821
+ let excludedFiles;
183822
+ for (let i = 0; i < rootFiles.length; i++) {
183822
183823
  if (excludeRegexes.some((re) => re.test(normalizedNames[i]))) {
183823
- excludedFiles.push(normalizedNames[i]);
183824
+ addExcludedFile(i);
183824
183825
  } else {
183825
- let exclude = false;
183826
183826
  if (typeAcquisition.enable) {
183827
183827
  const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i]));
183828
183828
  if (fileExtensionIs(baseName, "js")) {
@@ -183831,120 +183831,91 @@ Dynamic files must always be opened with service's current directory or service
183831
183831
  const typeName = this.legacySafelist.get(cleanedTypingName);
183832
183832
  if (typeName !== void 0) {
183833
183833
  this.logger.info(`Excluded '${normalizedNames[i]}' because it matched ${cleanedTypingName} from the legacy safelist`);
183834
- excludedFiles.push(normalizedNames[i]);
183835
- exclude = true;
183834
+ addExcludedFile(i);
183836
183835
  if (!typeAcqInclude.includes(typeName)) {
183837
183836
  typeAcqInclude.push(typeName);
183838
183837
  }
183838
+ continue;
183839
183839
  }
183840
183840
  }
183841
183841
  }
183842
- if (!exclude) {
183843
- if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
183844
- excludedFiles.push(normalizedNames[i]);
183845
- } else {
183846
- filesToKeep.push(proj.rootFiles[i]);
183847
- }
183842
+ if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
183843
+ addExcludedFile(i);
183844
+ } else {
183845
+ filesToKeep == null ? void 0 : filesToKeep.push(rootFiles[i]);
183848
183846
  }
183849
183847
  }
183850
183848
  }
183851
- proj.rootFiles = filesToKeep;
183852
- return excludedFiles;
183849
+ return excludedFiles ? {
183850
+ rootFiles: filesToKeep,
183851
+ excludedFiles
183852
+ } : void 0;
183853
+ function addExcludedFile(index) {
183854
+ if (!excludedFiles) {
183855
+ Debug.assert(!filesToKeep);
183856
+ filesToKeep = rootFiles.slice(0, index);
183857
+ excludedFiles = [];
183858
+ }
183859
+ excludedFiles.push(normalizedNames[index]);
183860
+ }
183853
183861
  }
183854
183862
  openExternalProject(proj, print) {
183855
- proj.typeAcquisition = proj.typeAcquisition || {};
183856
- proj.typeAcquisition.include = proj.typeAcquisition.include || [];
183857
- proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || [];
183858
- if (proj.typeAcquisition.enable === void 0) {
183859
- proj.typeAcquisition.enable = hasNoTypeScriptSource(proj.rootFiles.map((f) => f.fileName));
183860
- }
183861
- const excludedFiles = this.applySafeList(proj);
183862
- let tsConfigFiles;
183863
- const rootFiles = [];
183863
+ const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
183864
+ const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
183865
+ let configuredProjects;
183866
+ let rootFiles = [];
183864
183867
  for (const file of proj.rootFiles) {
183865
183868
  const normalized = toNormalizedPath(file.fileName);
183866
183869
  if (getBaseConfigFileName(normalized)) {
183867
183870
  if (this.serverMode === 0 /* Semantic */ && this.host.fileExists(normalized)) {
183868
- (tsConfigFiles || (tsConfigFiles = [])).push(normalized);
183871
+ let project = this.findConfiguredProjectByProjectName(normalized);
183872
+ if (!project) {
183873
+ project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(normalized, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`);
183874
+ }
183875
+ if (!(existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.has(project))) {
183876
+ project.addExternalProjectReference();
183877
+ }
183878
+ (configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
183879
+ existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.delete(project);
183869
183880
  }
183870
183881
  } else {
183871
183882
  rootFiles.push(file);
183872
183883
  }
183873
183884
  }
183874
- if (tsConfigFiles) {
183875
- tsConfigFiles.sort();
183876
- }
183877
- const externalProject = this.findExternalProjectByProjectName(proj.projectFileName);
183878
- let exisingConfigFiles;
183879
- if (externalProject) {
183880
- externalProject.excludedFiles = excludedFiles;
183881
- if (!tsConfigFiles) {
183885
+ if (configuredProjects) {
183886
+ this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, configuredProjects);
183887
+ if (existingExternalProject)
183888
+ this.removeProject(existingExternalProject);
183889
+ } else {
183890
+ this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
183891
+ const typeAcquisition = proj.typeAcquisition || {};
183892
+ typeAcquisition.include = typeAcquisition.include || [];
183893
+ typeAcquisition.exclude = typeAcquisition.exclude || [];
183894
+ if (typeAcquisition.enable === void 0) {
183895
+ typeAcquisition.enable = hasNoTypeScriptSource(rootFiles.map((f) => f.fileName));
183896
+ }
183897
+ const excludeResult = this.applySafeListWorker(proj, rootFiles, typeAcquisition);
183898
+ const excludedFiles = (excludeResult == null ? void 0 : excludeResult.excludedFiles) ?? [];
183899
+ rootFiles = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles;
183900
+ if (existingExternalProject) {
183901
+ existingExternalProject.excludedFiles = excludedFiles;
183882
183902
  const compilerOptions = convertCompilerOptions(proj.options);
183883
- const watchOptionsAndErrors = convertWatchOptions(proj.options, externalProject.getCurrentDirectory());
183884
- const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, proj.rootFiles, externalFilePropertyReader);
183903
+ const watchOptionsAndErrors = convertWatchOptions(proj.options, existingExternalProject.getCurrentDirectory());
183904
+ const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles, externalFilePropertyReader);
183885
183905
  if (lastFileExceededProgramSize) {
183886
- externalProject.disableLanguageService(lastFileExceededProgramSize);
183906
+ existingExternalProject.disableLanguageService(lastFileExceededProgramSize);
183887
183907
  } else {
183888
- externalProject.enableLanguageService();
183908
+ existingExternalProject.enableLanguageService();
183889
183909
  }
183890
- externalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
183891
- this.updateRootAndOptionsOfNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
183892
- externalProject.updateGraph();
183893
- if (print)
183894
- this.printProjects();
183895
- return;
183896
- }
183897
- this.closeExternalProject(
183898
- proj.projectFileName,
183899
- /*print*/
183900
- false
183901
- );
183902
- } else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
183903
- if (!tsConfigFiles) {
183904
- this.closeExternalProject(
183905
- proj.projectFileName,
183906
- /*print*/
183907
- false
183908
- );
183910
+ existingExternalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
183911
+ this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
183912
+ existingExternalProject.updateGraph();
183909
183913
  } else {
183910
- const oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
183911
- let iNew = 0;
183912
- let iOld = 0;
183913
- while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {
183914
- const newConfig = tsConfigFiles[iNew];
183915
- const oldConfig = oldConfigFiles[iOld];
183916
- if (oldConfig < newConfig) {
183917
- this.closeConfiguredProjectReferencedFromExternalProject(oldConfig);
183918
- iOld++;
183919
- } else if (oldConfig > newConfig) {
183920
- iNew++;
183921
- } else {
183922
- (exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);
183923
- iOld++;
183924
- iNew++;
183925
- }
183926
- }
183927
- for (let i = iOld; i < oldConfigFiles.length; i++) {
183928
- this.closeConfiguredProjectReferencedFromExternalProject(oldConfigFiles[i]);
183929
- }
183914
+ const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles);
183915
+ project.updateGraph();
183930
183916
  }
183931
183917
  }
183932
- if (tsConfigFiles) {
183933
- this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles);
183934
- for (const tsconfigFile of tsConfigFiles) {
183935
- let project = this.findConfiguredProjectByProjectName(tsconfigFile);
183936
- if (!project) {
183937
- project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`);
183938
- }
183939
- if (project && !contains(exisingConfigFiles, tsconfigFile)) {
183940
- project.addExternalProjectReference();
183941
- }
183942
- }
183943
- } else {
183944
- this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
183945
- const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
183946
- project.updateGraph();
183947
- }
183918
+ this.closeConfiguredProjectReferencedFromExternalProject(existingConfiguredProjects);
183948
183919
  if (print)
183949
183920
  this.printProjects();
183950
183921
  }
@@ -3906,6 +3906,7 @@ declare namespace ts {
3906
3906
  private static escapeFilenameForRegex;
3907
3907
  resetSafeList(): void;
3908
3908
  applySafeList(proj: protocol.ExternalProject): NormalizedPath[];
3909
+ private applySafeListWorker;
3909
3910
  openExternalProject(proj: protocol.ExternalProject): void;
3910
3911
  hasDeferredExtension(): boolean;
3911
3912
  private enableRequestedPluginsAsync;
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.4";
38
- version = `${versionMajorMinor}.0-dev.20240213`;
38
+ version = `${versionMajorMinor}.0-dev.20240215`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -35009,7 +35009,7 @@ ${lanes.join("\n")}
35009
35009
  if (!jsDocDiagnostics) {
35010
35010
  jsDocDiagnostics = [];
35011
35011
  }
35012
- jsDocDiagnostics.push(...parseDiagnostics);
35012
+ addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
35013
35013
  }
35014
35014
  currentToken = saveToken;
35015
35015
  parseDiagnostics.length = saveParseDiagnosticsLength;
@@ -68149,7 +68149,7 @@ ${lanes.join("\n")}
68149
68149
  function hasMatchingArgument(expression, reference) {
68150
68150
  if (expression.arguments) {
68151
68151
  for (const argument of expression.arguments) {
68152
- if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
68152
+ if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
68153
68153
  return true;
68154
68154
  }
68155
68155
  }
@@ -68159,6 +68159,36 @@ ${lanes.join("\n")}
68159
68159
  }
68160
68160
  return false;
68161
68161
  }
68162
+ function getCandidateDiscriminantPropertyAccess(expr, reference) {
68163
+ if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
68164
+ if (isIdentifier(expr)) {
68165
+ const symbol = getResolvedSymbol(expr);
68166
+ const declaration = symbol.valueDeclaration;
68167
+ if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
68168
+ return declaration;
68169
+ }
68170
+ }
68171
+ } else if (isAccessExpression(expr)) {
68172
+ if (isMatchingReference(reference, expr.expression)) {
68173
+ return expr;
68174
+ }
68175
+ } else if (isIdentifier(expr)) {
68176
+ const symbol = getResolvedSymbol(expr);
68177
+ if (isConstantVariable(symbol)) {
68178
+ const declaration = symbol.valueDeclaration;
68179
+ if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
68180
+ return declaration.initializer;
68181
+ }
68182
+ if (isBindingElement(declaration) && !declaration.initializer) {
68183
+ const parent2 = declaration.parent.parent;
68184
+ if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
68185
+ return declaration;
68186
+ }
68187
+ }
68188
+ }
68189
+ }
68190
+ return void 0;
68191
+ }
68162
68192
  function getFlowNodeId(flow) {
68163
68193
  if (!flow.id || flow.id < 0) {
68164
68194
  flow.id = nextFlowId;
@@ -69258,39 +69288,9 @@ ${lanes.join("\n")}
69258
69288
  }
69259
69289
  return result;
69260
69290
  }
69261
- function getCandidateDiscriminantPropertyAccess(expr) {
69262
- if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
69263
- if (isIdentifier(expr)) {
69264
- const symbol = getResolvedSymbol(expr);
69265
- const declaration = symbol.valueDeclaration;
69266
- if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
69267
- return declaration;
69268
- }
69269
- }
69270
- } else if (isAccessExpression(expr)) {
69271
- if (isMatchingReference(reference, expr.expression)) {
69272
- return expr;
69273
- }
69274
- } else if (isIdentifier(expr)) {
69275
- const symbol = getResolvedSymbol(expr);
69276
- if (isConstantVariable(symbol)) {
69277
- const declaration = symbol.valueDeclaration;
69278
- if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
69279
- return declaration.initializer;
69280
- }
69281
- if (isBindingElement(declaration) && !declaration.initializer) {
69282
- const parent2 = declaration.parent.parent;
69283
- if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
69284
- return declaration;
69285
- }
69286
- }
69287
- }
69288
- }
69289
- return void 0;
69290
- }
69291
69291
  function getDiscriminantPropertyAccess(expr, computedType) {
69292
69292
  if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
69293
- const access = getCandidateDiscriminantPropertyAccess(expr);
69293
+ const access = getCandidateDiscriminantPropertyAccess(expr, reference);
69294
69294
  if (access) {
69295
69295
  const name = getAccessedPropertyName(access);
69296
69296
  if (name) {
@@ -175443,7 +175443,7 @@ ${options.prefix}` : "\n" : options.prefix
175443
175443
  }
175444
175444
  break;
175445
175445
  default:
175446
- if (unorderedRemoveItem(this.containingProjects, project)) {
175446
+ if (orderedRemoveItem(this.containingProjects, project)) {
175447
175447
  project.onFileAddedOrRemoved(this.isSymlink());
175448
175448
  }
175449
175449
  break;
@@ -179152,7 +179152,7 @@ ${options.prefix}` : "\n" : options.prefix
179152
179152
  );
179153
179153
  project.addRoot(info);
179154
179154
  if (info.containingProjects[0] !== project) {
179155
- info.detachFromProject(project);
179155
+ orderedRemoveItem(info.containingProjects, project);
179156
179156
  info.containingProjects.unshift(project);
179157
179157
  }
179158
179158
  project.updateGraph();
@@ -179447,8 +179447,7 @@ ${options.prefix}` : "\n" : options.prefix
179447
179447
  * otherwise just file name
179448
179448
  */
179449
179449
  getConfigFileNameForFile(info) {
179450
- if (isOpenScriptInfo(info)) {
179451
- Debug.assert(info.isScriptOpen());
179450
+ if (!isAncestorConfigFileInfo(info)) {
179452
179451
  const result = this.configFileForOpenFiles.get(info.path);
179453
179452
  if (result !== void 0)
179454
179453
  return result || void 0;
@@ -180443,11 +180442,13 @@ Dynamic files must always be opened with service's current directory or service
180443
180442
  } = this.hostConfiguration.preferences;
180444
180443
  this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
180445
180444
  if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
180446
- this.configuredProjects.forEach((project) => {
180447
- if (project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
180448
- project.updateGraph();
180449
- }
180450
- });
180445
+ this.externalProjectToConfiguredProjectMap.forEach(
180446
+ (projects) => projects.forEach((project) => {
180447
+ if (!project.isClosed() && project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
180448
+ project.updateGraph();
180449
+ }
180450
+ })
180451
+ );
180451
180452
  }
180452
180453
  if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
180453
180454
  this.forEachProject((project) => {
@@ -181032,23 +181033,20 @@ Dynamic files must always be opened with service's current directory or service
181032
181033
  scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
181033
181034
  }
181034
181035
  }
181035
- closeConfiguredProjectReferencedFromExternalProject(configFile) {
181036
- const configuredProject = this.findConfiguredProjectByProjectName(configFile);
181037
- if (configuredProject) {
181038
- configuredProject.deleteExternalProjectReference();
181039
- if (!configuredProject.hasOpenRef()) {
181040
- this.removeProject(configuredProject);
181041
- return;
181036
+ closeConfiguredProjectReferencedFromExternalProject(configuredProjects) {
181037
+ configuredProjects == null ? void 0 : configuredProjects.forEach((configuredProject) => {
181038
+ if (!configuredProject.isClosed()) {
181039
+ configuredProject.deleteExternalProjectReference();
181040
+ if (!configuredProject.hasOpenRef())
181041
+ this.removeProject(configuredProject);
181042
181042
  }
181043
- }
181043
+ });
181044
181044
  }
181045
181045
  closeExternalProject(uncheckedFileName, print) {
181046
181046
  const fileName = toNormalizedPath(uncheckedFileName);
181047
- const configFiles = this.externalProjectToConfiguredProjectMap.get(fileName);
181048
- if (configFiles) {
181049
- for (const configFile of configFiles) {
181050
- this.closeConfiguredProjectReferencedFromExternalProject(configFile);
181051
- }
181047
+ const configuredProjects = this.externalProjectToConfiguredProjectMap.get(fileName);
181048
+ if (configuredProjects) {
181049
+ this.closeConfiguredProjectReferencedFromExternalProject(configuredProjects);
181052
181050
  this.externalProjectToConfiguredProjectMap.delete(fileName);
181053
181051
  } else {
181054
181052
  const externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
@@ -181088,16 +181086,18 @@ Dynamic files must always be opened with service's current directory or service
181088
181086
  this.safelist = defaultTypeSafeList;
181089
181087
  }
181090
181088
  applySafeList(proj) {
181091
- const { rootFiles } = proj;
181092
181089
  const typeAcquisition = proj.typeAcquisition;
181093
181090
  Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now");
181091
+ const result = this.applySafeListWorker(proj, proj.rootFiles, typeAcquisition);
181092
+ return (result == null ? void 0 : result.excludedFiles) ?? [];
181093
+ }
181094
+ applySafeListWorker(proj, rootFiles, typeAcquisition) {
181094
181095
  if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) {
181095
- return [];
181096
+ return void 0;
181096
181097
  }
181097
181098
  const typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []);
181098
181099
  const excludeRules = [];
181099
181100
  const normalizedNames = rootFiles.map((f) => normalizeSlashes(f.fileName));
181100
- const excludedFiles = [];
181101
181101
  for (const name of Object.keys(this.safelist)) {
181102
181102
  const rule2 = this.safelist[name];
181103
181103
  for (const root of normalizedNames) {
@@ -181138,12 +181138,12 @@ Dynamic files must always be opened with service's current directory or service
181138
181138
  }
181139
181139
  }
181140
181140
  const excludeRegexes = excludeRules.map((e) => new RegExp(e, "i"));
181141
- const filesToKeep = [];
181142
- for (let i = 0; i < proj.rootFiles.length; i++) {
181141
+ let filesToKeep;
181142
+ let excludedFiles;
181143
+ for (let i = 0; i < rootFiles.length; i++) {
181143
181144
  if (excludeRegexes.some((re) => re.test(normalizedNames[i]))) {
181144
- excludedFiles.push(normalizedNames[i]);
181145
+ addExcludedFile(i);
181145
181146
  } else {
181146
- let exclude = false;
181147
181147
  if (typeAcquisition.enable) {
181148
181148
  const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i]));
181149
181149
  if (fileExtensionIs(baseName, "js")) {
@@ -181152,120 +181152,91 @@ Dynamic files must always be opened with service's current directory or service
181152
181152
  const typeName = this.legacySafelist.get(cleanedTypingName);
181153
181153
  if (typeName !== void 0) {
181154
181154
  this.logger.info(`Excluded '${normalizedNames[i]}' because it matched ${cleanedTypingName} from the legacy safelist`);
181155
- excludedFiles.push(normalizedNames[i]);
181156
- exclude = true;
181155
+ addExcludedFile(i);
181157
181156
  if (!typeAcqInclude.includes(typeName)) {
181158
181157
  typeAcqInclude.push(typeName);
181159
181158
  }
181159
+ continue;
181160
181160
  }
181161
181161
  }
181162
181162
  }
181163
- if (!exclude) {
181164
- if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
181165
- excludedFiles.push(normalizedNames[i]);
181166
- } else {
181167
- filesToKeep.push(proj.rootFiles[i]);
181168
- }
181163
+ if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
181164
+ addExcludedFile(i);
181165
+ } else {
181166
+ filesToKeep == null ? void 0 : filesToKeep.push(rootFiles[i]);
181169
181167
  }
181170
181168
  }
181171
181169
  }
181172
- proj.rootFiles = filesToKeep;
181173
- return excludedFiles;
181170
+ return excludedFiles ? {
181171
+ rootFiles: filesToKeep,
181172
+ excludedFiles
181173
+ } : void 0;
181174
+ function addExcludedFile(index) {
181175
+ if (!excludedFiles) {
181176
+ Debug.assert(!filesToKeep);
181177
+ filesToKeep = rootFiles.slice(0, index);
181178
+ excludedFiles = [];
181179
+ }
181180
+ excludedFiles.push(normalizedNames[index]);
181181
+ }
181174
181182
  }
181175
181183
  openExternalProject(proj, print) {
181176
- proj.typeAcquisition = proj.typeAcquisition || {};
181177
- proj.typeAcquisition.include = proj.typeAcquisition.include || [];
181178
- proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || [];
181179
- if (proj.typeAcquisition.enable === void 0) {
181180
- proj.typeAcquisition.enable = hasNoTypeScriptSource(proj.rootFiles.map((f) => f.fileName));
181181
- }
181182
- const excludedFiles = this.applySafeList(proj);
181183
- let tsConfigFiles;
181184
- const rootFiles = [];
181184
+ const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
181185
+ const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
181186
+ let configuredProjects;
181187
+ let rootFiles = [];
181185
181188
  for (const file of proj.rootFiles) {
181186
181189
  const normalized = toNormalizedPath(file.fileName);
181187
181190
  if (getBaseConfigFileName(normalized)) {
181188
181191
  if (this.serverMode === 0 /* Semantic */ && this.host.fileExists(normalized)) {
181189
- (tsConfigFiles || (tsConfigFiles = [])).push(normalized);
181192
+ let project = this.findConfiguredProjectByProjectName(normalized);
181193
+ if (!project) {
181194
+ project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(normalized, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`);
181195
+ }
181196
+ if (!(existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.has(project))) {
181197
+ project.addExternalProjectReference();
181198
+ }
181199
+ (configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
181200
+ existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.delete(project);
181190
181201
  }
181191
181202
  } else {
181192
181203
  rootFiles.push(file);
181193
181204
  }
181194
181205
  }
181195
- if (tsConfigFiles) {
181196
- tsConfigFiles.sort();
181197
- }
181198
- const externalProject = this.findExternalProjectByProjectName(proj.projectFileName);
181199
- let exisingConfigFiles;
181200
- if (externalProject) {
181201
- externalProject.excludedFiles = excludedFiles;
181202
- if (!tsConfigFiles) {
181206
+ if (configuredProjects) {
181207
+ this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, configuredProjects);
181208
+ if (existingExternalProject)
181209
+ this.removeProject(existingExternalProject);
181210
+ } else {
181211
+ this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
181212
+ const typeAcquisition = proj.typeAcquisition || {};
181213
+ typeAcquisition.include = typeAcquisition.include || [];
181214
+ typeAcquisition.exclude = typeAcquisition.exclude || [];
181215
+ if (typeAcquisition.enable === void 0) {
181216
+ typeAcquisition.enable = hasNoTypeScriptSource(rootFiles.map((f) => f.fileName));
181217
+ }
181218
+ const excludeResult = this.applySafeListWorker(proj, rootFiles, typeAcquisition);
181219
+ const excludedFiles = (excludeResult == null ? void 0 : excludeResult.excludedFiles) ?? [];
181220
+ rootFiles = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles;
181221
+ if (existingExternalProject) {
181222
+ existingExternalProject.excludedFiles = excludedFiles;
181203
181223
  const compilerOptions = convertCompilerOptions(proj.options);
181204
- const watchOptionsAndErrors = convertWatchOptions(proj.options, externalProject.getCurrentDirectory());
181205
- const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, proj.rootFiles, externalFilePropertyReader);
181224
+ const watchOptionsAndErrors = convertWatchOptions(proj.options, existingExternalProject.getCurrentDirectory());
181225
+ const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles, externalFilePropertyReader);
181206
181226
  if (lastFileExceededProgramSize) {
181207
- externalProject.disableLanguageService(lastFileExceededProgramSize);
181227
+ existingExternalProject.disableLanguageService(lastFileExceededProgramSize);
181208
181228
  } else {
181209
- externalProject.enableLanguageService();
181229
+ existingExternalProject.enableLanguageService();
181210
181230
  }
181211
- externalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
181212
- this.updateRootAndOptionsOfNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
181213
- externalProject.updateGraph();
181214
- if (print)
181215
- this.printProjects();
181216
- return;
181217
- }
181218
- this.closeExternalProject(
181219
- proj.projectFileName,
181220
- /*print*/
181221
- false
181222
- );
181223
- } else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
181224
- if (!tsConfigFiles) {
181225
- this.closeExternalProject(
181226
- proj.projectFileName,
181227
- /*print*/
181228
- false
181229
- );
181231
+ existingExternalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
181232
+ this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
181233
+ existingExternalProject.updateGraph();
181230
181234
  } else {
181231
- const oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
181232
- let iNew = 0;
181233
- let iOld = 0;
181234
- while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {
181235
- const newConfig = tsConfigFiles[iNew];
181236
- const oldConfig = oldConfigFiles[iOld];
181237
- if (oldConfig < newConfig) {
181238
- this.closeConfiguredProjectReferencedFromExternalProject(oldConfig);
181239
- iOld++;
181240
- } else if (oldConfig > newConfig) {
181241
- iNew++;
181242
- } else {
181243
- (exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);
181244
- iOld++;
181245
- iNew++;
181246
- }
181247
- }
181248
- for (let i = iOld; i < oldConfigFiles.length; i++) {
181249
- this.closeConfiguredProjectReferencedFromExternalProject(oldConfigFiles[i]);
181250
- }
181235
+ const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles);
181236
+ project.updateGraph();
181251
181237
  }
181252
181238
  }
181253
- if (tsConfigFiles) {
181254
- this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles);
181255
- for (const tsconfigFile of tsConfigFiles) {
181256
- let project = this.findConfiguredProjectByProjectName(tsconfigFile);
181257
- if (!project) {
181258
- project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`);
181259
- }
181260
- if (project && !contains(exisingConfigFiles, tsconfigFile)) {
181261
- project.addExternalProjectReference();
181262
- }
181263
- }
181264
- } else {
181265
- this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
181266
- const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
181267
- project.updateGraph();
181268
- }
181239
+ this.closeConfiguredProjectReferencedFromExternalProject(existingConfiguredProjects);
181269
181240
  if (print)
181270
181241
  this.printProjects();
181271
181242
  }
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.4";
57
- var version = `${versionMajorMinor}.0-dev.20240213`;
57
+ var version = `${versionMajorMinor}.0-dev.20240215`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -24326,7 +24326,7 @@ var Parser;
24326
24326
  if (!jsDocDiagnostics) {
24327
24327
  jsDocDiagnostics = [];
24328
24328
  }
24329
- jsDocDiagnostics.push(...parseDiagnostics);
24329
+ addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
24330
24330
  }
24331
24331
  currentToken = saveToken;
24332
24332
  parseDiagnostics.length = saveParseDiagnosticsLength;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.4.0-dev.20240213",
5
+ "version": "5.4.0-dev.20240215",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -113,5 +113,5 @@
113
113
  "node": "20.1.0",
114
114
  "npm": "8.19.4"
115
115
  },
116
- "gitHead": "2a0edf7949ad8427e3ef233a4c549ecbe32953e1"
116
+ "gitHead": "67542c4c1f125e458ba69fb317b74122324502fa"
117
117
  }