typescript 5.4.0-dev.20240131 → 5.4.0-dev.20240202

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.20240131`;
21
+ var version = `${versionMajorMinor}.0-dev.20240202`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -88604,9 +88604,50 @@ function transformTypeScript(context) {
88604
88604
  return visitorWorker(node);
88605
88605
  }
88606
88606
  }
88607
- function visitElidableStatement(node) {
88607
+ function isElisionBlocked(node) {
88608
88608
  const parsed = getParseTreeNode(node);
88609
- if (parsed !== node) {
88609
+ if (parsed === node || isExportAssignment(node)) {
88610
+ return false;
88611
+ }
88612
+ if (!parsed || parsed.kind !== node.kind) {
88613
+ return true;
88614
+ }
88615
+ switch (node.kind) {
88616
+ case 272 /* ImportDeclaration */:
88617
+ Debug.assertNode(parsed, isImportDeclaration);
88618
+ if (node.importClause !== parsed.importClause) {
88619
+ return true;
88620
+ }
88621
+ if (node.attributes !== parsed.attributes) {
88622
+ return true;
88623
+ }
88624
+ break;
88625
+ case 271 /* ImportEqualsDeclaration */:
88626
+ Debug.assertNode(parsed, isImportEqualsDeclaration);
88627
+ if (node.name !== parsed.name) {
88628
+ return true;
88629
+ }
88630
+ if (node.isTypeOnly !== parsed.isTypeOnly) {
88631
+ return true;
88632
+ }
88633
+ if (node.moduleReference !== parsed.moduleReference && (isEntityName(node.moduleReference) || isEntityName(parsed.moduleReference))) {
88634
+ return true;
88635
+ }
88636
+ break;
88637
+ case 278 /* ExportDeclaration */:
88638
+ Debug.assertNode(parsed, isExportDeclaration);
88639
+ if (node.exportClause !== parsed.exportClause) {
88640
+ return true;
88641
+ }
88642
+ if (node.attributes !== parsed.attributes) {
88643
+ return true;
88644
+ }
88645
+ break;
88646
+ }
88647
+ return false;
88648
+ }
88649
+ function visitElidableStatement(node) {
88650
+ if (isElisionBlocked(node)) {
88610
88651
  if (node.transformFlags & 1 /* ContainsTypeScript */) {
88611
88652
  return visitEachChild(node, visitor, context);
88612
88653
  }
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.20240131`;
2343
+ var version = `${versionMajorMinor}.0-dev.20240202`;
2344
2344
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2345
2345
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2346
2346
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -93510,9 +93510,50 @@ function transformTypeScript(context) {
93510
93510
  return visitorWorker(node);
93511
93511
  }
93512
93512
  }
93513
- function visitElidableStatement(node) {
93513
+ function isElisionBlocked(node) {
93514
93514
  const parsed = getParseTreeNode(node);
93515
- if (parsed !== node) {
93515
+ if (parsed === node || isExportAssignment(node)) {
93516
+ return false;
93517
+ }
93518
+ if (!parsed || parsed.kind !== node.kind) {
93519
+ return true;
93520
+ }
93521
+ switch (node.kind) {
93522
+ case 272 /* ImportDeclaration */:
93523
+ Debug.assertNode(parsed, isImportDeclaration);
93524
+ if (node.importClause !== parsed.importClause) {
93525
+ return true;
93526
+ }
93527
+ if (node.attributes !== parsed.attributes) {
93528
+ return true;
93529
+ }
93530
+ break;
93531
+ case 271 /* ImportEqualsDeclaration */:
93532
+ Debug.assertNode(parsed, isImportEqualsDeclaration);
93533
+ if (node.name !== parsed.name) {
93534
+ return true;
93535
+ }
93536
+ if (node.isTypeOnly !== parsed.isTypeOnly) {
93537
+ return true;
93538
+ }
93539
+ if (node.moduleReference !== parsed.moduleReference && (isEntityName(node.moduleReference) || isEntityName(parsed.moduleReference))) {
93540
+ return true;
93541
+ }
93542
+ break;
93543
+ case 278 /* ExportDeclaration */:
93544
+ Debug.assertNode(parsed, isExportDeclaration);
93545
+ if (node.exportClause !== parsed.exportClause) {
93546
+ return true;
93547
+ }
93548
+ if (node.attributes !== parsed.attributes) {
93549
+ return true;
93550
+ }
93551
+ break;
93552
+ }
93553
+ return false;
93554
+ }
93555
+ function visitElidableStatement(node) {
93556
+ if (isElisionBlocked(node)) {
93516
93557
  if (node.transformFlags & 1 /* ContainsTypeScript */) {
93517
93558
  return visitEachChild(node, visitor, context);
93518
93559
  }
@@ -167864,84 +167905,98 @@ function coalesceImportsWorker(importGroup, comparer, sourceFile, preferences) {
167864
167905
  if (importGroup.length === 0) {
167865
167906
  return importGroup;
167866
167907
  }
167867
- const { importWithoutClause, typeOnlyImports, regularImports } = getCategorizedImports(importGroup);
167868
- const coalescedImports = [];
167869
- if (importWithoutClause) {
167870
- coalescedImports.push(importWithoutClause);
167871
- }
167872
- for (const group2 of [regularImports, typeOnlyImports]) {
167873
- const isTypeOnly = group2 === typeOnlyImports;
167874
- const { defaultImports, namespaceImports, namedImports } = group2;
167875
- if (!isTypeOnly && defaultImports.length === 1 && namespaceImports.length === 1 && namedImports.length === 0) {
167876
- const defaultImport = defaultImports[0];
167877
- coalescedImports.push(
167878
- updateImportDeclarationAndClause(defaultImport, defaultImport.importClause.name, namespaceImports[0].importClause.namedBindings)
167879
- );
167880
- continue;
167881
- }
167882
- const sortedNamespaceImports = stableSort(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
167883
- for (const namespaceImport of sortedNamespaceImports) {
167884
- coalescedImports.push(
167885
- updateImportDeclarationAndClause(
167886
- namespaceImport,
167887
- /*name*/
167888
- void 0,
167889
- namespaceImport.importClause.namedBindings
167890
- )
167891
- );
167892
- }
167893
- const firstDefaultImport = firstOrUndefined(defaultImports);
167894
- const firstNamedImport = firstOrUndefined(namedImports);
167895
- const importDecl = firstDefaultImport ?? firstNamedImport;
167896
- if (!importDecl) {
167897
- continue;
167908
+ const importGroupsByAttributes = groupBy(importGroup, (decl) => {
167909
+ if (decl.attributes) {
167910
+ let attrs = decl.attributes.token + " ";
167911
+ for (const x of sort(decl.attributes.elements, (x2, y) => compareStringsCaseSensitive(x2.name.text, y.name.text))) {
167912
+ attrs += x.name.text + ":";
167913
+ attrs += isStringLiteralLike(x.value) ? `"${x.value.text}"` : x.value.getText() + " ";
167914
+ }
167915
+ return attrs;
167898
167916
  }
167899
- let newDefaultImport;
167900
- const newImportSpecifiers = [];
167901
- if (defaultImports.length === 1) {
167902
- newDefaultImport = defaultImports[0].importClause.name;
167903
- } else {
167904
- for (const defaultImport of defaultImports) {
167905
- newImportSpecifiers.push(
167906
- factory.createImportSpecifier(
167907
- /*isTypeOnly*/
167908
- false,
167909
- factory.createIdentifier("default"),
167910
- defaultImport.importClause.name
167917
+ return "";
167918
+ });
167919
+ const coalescedImports = [];
167920
+ for (const attribute in importGroupsByAttributes) {
167921
+ const importGroupSameAttrs = importGroupsByAttributes[attribute];
167922
+ const { importWithoutClause, typeOnlyImports, regularImports } = getCategorizedImports(importGroupSameAttrs);
167923
+ if (importWithoutClause) {
167924
+ coalescedImports.push(importWithoutClause);
167925
+ }
167926
+ for (const group2 of [regularImports, typeOnlyImports]) {
167927
+ const isTypeOnly = group2 === typeOnlyImports;
167928
+ const { defaultImports, namespaceImports, namedImports } = group2;
167929
+ if (!isTypeOnly && defaultImports.length === 1 && namespaceImports.length === 1 && namedImports.length === 0) {
167930
+ const defaultImport = defaultImports[0];
167931
+ coalescedImports.push(
167932
+ updateImportDeclarationAndClause(defaultImport, defaultImport.importClause.name, namespaceImports[0].importClause.namedBindings)
167933
+ );
167934
+ continue;
167935
+ }
167936
+ const sortedNamespaceImports = stableSort(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
167937
+ for (const namespaceImport of sortedNamespaceImports) {
167938
+ coalescedImports.push(
167939
+ updateImportDeclarationAndClause(
167940
+ namespaceImport,
167941
+ /*name*/
167942
+ void 0,
167943
+ namespaceImport.importClause.namedBindings
167911
167944
  )
167912
167945
  );
167913
167946
  }
167914
- }
167915
- newImportSpecifiers.push(...getNewImportSpecifiers(namedImports));
167916
- const sortedImportSpecifiers = factory.createNodeArray(
167917
- sortSpecifiers(newImportSpecifiers, comparer, preferences),
167918
- firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings.elements.hasTrailingComma
167919
- );
167920
- const newNamedImports = sortedImportSpecifiers.length === 0 ? newDefaultImport ? void 0 : factory.createNamedImports(emptyArray) : firstNamedImport ? factory.updateNamedImports(firstNamedImport.importClause.namedBindings, sortedImportSpecifiers) : factory.createNamedImports(sortedImportSpecifiers);
167921
- if (sourceFile && newNamedImports && (firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings) && !rangeIsOnSingleLine(firstNamedImport.importClause.namedBindings, sourceFile)) {
167922
- setEmitFlags(newNamedImports, 2 /* MultiLine */);
167923
- }
167924
- if (isTypeOnly && newDefaultImport && newNamedImports) {
167925
- coalescedImports.push(
167926
- updateImportDeclarationAndClause(
167927
- importDecl,
167928
- newDefaultImport,
167929
- /*namedBindings*/
167930
- void 0
167931
- )
167932
- );
167933
- coalescedImports.push(
167934
- updateImportDeclarationAndClause(
167935
- firstNamedImport ?? importDecl,
167936
- /*name*/
167937
- void 0,
167938
- newNamedImports
167939
- )
167940
- );
167941
- } else {
167942
- coalescedImports.push(
167943
- updateImportDeclarationAndClause(importDecl, newDefaultImport, newNamedImports)
167947
+ const firstDefaultImport = firstOrUndefined(defaultImports);
167948
+ const firstNamedImport = firstOrUndefined(namedImports);
167949
+ const importDecl = firstDefaultImport ?? firstNamedImport;
167950
+ if (!importDecl) {
167951
+ continue;
167952
+ }
167953
+ let newDefaultImport;
167954
+ const newImportSpecifiers = [];
167955
+ if (defaultImports.length === 1) {
167956
+ newDefaultImport = defaultImports[0].importClause.name;
167957
+ } else {
167958
+ for (const defaultImport of defaultImports) {
167959
+ newImportSpecifiers.push(
167960
+ factory.createImportSpecifier(
167961
+ /*isTypeOnly*/
167962
+ false,
167963
+ factory.createIdentifier("default"),
167964
+ defaultImport.importClause.name
167965
+ )
167966
+ );
167967
+ }
167968
+ }
167969
+ newImportSpecifiers.push(...getNewImportSpecifiers(namedImports));
167970
+ const sortedImportSpecifiers = factory.createNodeArray(
167971
+ sortSpecifiers(newImportSpecifiers, comparer, preferences),
167972
+ firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings.elements.hasTrailingComma
167944
167973
  );
167974
+ const newNamedImports = sortedImportSpecifiers.length === 0 ? newDefaultImport ? void 0 : factory.createNamedImports(emptyArray) : firstNamedImport ? factory.updateNamedImports(firstNamedImport.importClause.namedBindings, sortedImportSpecifiers) : factory.createNamedImports(sortedImportSpecifiers);
167975
+ if (sourceFile && newNamedImports && (firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings) && !rangeIsOnSingleLine(firstNamedImport.importClause.namedBindings, sourceFile)) {
167976
+ setEmitFlags(newNamedImports, 2 /* MultiLine */);
167977
+ }
167978
+ if (isTypeOnly && newDefaultImport && newNamedImports) {
167979
+ coalescedImports.push(
167980
+ updateImportDeclarationAndClause(
167981
+ importDecl,
167982
+ newDefaultImport,
167983
+ /*namedBindings*/
167984
+ void 0
167985
+ )
167986
+ );
167987
+ coalescedImports.push(
167988
+ updateImportDeclarationAndClause(
167989
+ firstNamedImport ?? importDecl,
167990
+ /*name*/
167991
+ void 0,
167992
+ newNamedImports
167993
+ )
167994
+ );
167995
+ } else {
167996
+ coalescedImports.push(
167997
+ updateImportDeclarationAndClause(importDecl, newDefaultImport, newNamedImports)
167998
+ );
167999
+ }
167945
168000
  }
167946
168001
  }
167947
168002
  return coalescedImports;
@@ -178434,6 +178489,7 @@ var Project3 = class _Project {
178434
178489
  /**
178435
178490
  * Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
178436
178491
  * This property is changed in 'updateGraph' based on the set of files in program
178492
+ * @internal
178437
178493
  */
178438
178494
  this.projectProgramVersion = 0;
178439
178495
  /**
@@ -178441,6 +178497,7 @@ var Project3 = class _Project {
178441
178497
  * - new root file was added/removed
178442
178498
  * - edit happen in some file that is currently included in the project.
178443
178499
  * This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
178500
+ * @internal
178444
178501
  */
178445
178502
  this.projectStateVersion = 0;
178446
178503
  this.isInitialLoadPending = returnFalse;
@@ -179478,7 +179535,7 @@ var Project3 = class _Project {
179478
179535
  );
179479
179536
  const elapsed = timestamp() - start2;
179480
179537
  this.sendPerformanceEvent("UpdateGraph", elapsed);
179481
- this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
179538
+ this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} projectStateVersion: ${this.projectStateVersion} projectProgramVersion: ${this.projectProgramVersion} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
179482
179539
  if (this.projectService.logger.isTestLogger) {
179483
179540
  if (this.program !== oldProgram) {
179484
179541
  this.print(
@@ -179641,6 +179698,7 @@ var Project3 = class _Project {
179641
179698
  }
179642
179699
  /** @internal */
179643
179700
  print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
179701
+ var _a;
179644
179702
  this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
179645
179703
  this.writeLog(this.filesToStringWorker(
179646
179704
  writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
@@ -179658,6 +179716,14 @@ var Project3 = class _Project {
179658
179716
  false
179659
179717
  );
179660
179718
  }
179719
+ (_a = this.noDtsResolutionProject) == null ? void 0 : _a.print(
179720
+ /*writeProjectFileNames*/
179721
+ false,
179722
+ /*writeFileExplaination*/
179723
+ false,
179724
+ /*writeFileVersionAndText*/
179725
+ false
179726
+ );
179661
179727
  }
179662
179728
  setCompilerOptions(compilerOptions) {
179663
179729
  var _a;
@@ -181098,6 +181164,8 @@ var _ProjectService = class _ProjectService {
181098
181164
  /** @internal */
181099
181165
  this.extendedConfigCache = /* @__PURE__ */ new Map();
181100
181166
  /** @internal */
181167
+ this.baseline = noop;
181168
+ /** @internal */
181101
181169
  this.verifyDocumentRegistry = noop;
181102
181170
  /** @internal */
181103
181171
  this.verifyProgram = noop;
@@ -183087,6 +183155,8 @@ Dynamic files must always be opened with service's current directory or service
183087
183155
  });
183088
183156
  this.inferredProjects.forEach((project) => this.clearSemanticCache(project));
183089
183157
  this.ensureProjectForOpenFiles();
183158
+ this.logger.info("After reloading projects..");
183159
+ this.printProjects();
183090
183160
  }
183091
183161
  /**
183092
183162
  * This function goes through all the openFiles and tries to file the config file for them.
@@ -183612,7 +183682,7 @@ Dynamic files must always be opened with service's current directory or service
183612
183682
  }
183613
183683
  }
183614
183684
  }
183615
- closeExternalProject(uncheckedFileName) {
183685
+ closeExternalProject(uncheckedFileName, print) {
183616
183686
  const fileName = toNormalizedPath(uncheckedFileName);
183617
183687
  const configFiles = this.externalProjectToConfiguredProjectMap.get(fileName);
183618
183688
  if (configFiles) {
@@ -183626,6 +183696,8 @@ Dynamic files must always be opened with service's current directory or service
183626
183696
  this.removeProject(externalProject);
183627
183697
  }
183628
183698
  }
183699
+ if (print)
183700
+ this.printProjects();
183629
183701
  }
183630
183702
  openExternalProjects(projects) {
183631
183703
  const projectsToClose = arrayToMap(this.externalProjects, (p) => p.getProjectName(), (_) => true);
@@ -183633,12 +183705,21 @@ Dynamic files must always be opened with service's current directory or service
183633
183705
  projectsToClose.set(externalProjectName, true);
183634
183706
  });
183635
183707
  for (const externalProject of projects) {
183636
- this.openExternalProject(externalProject);
183708
+ this.openExternalProject(
183709
+ externalProject,
183710
+ /*print*/
183711
+ false
183712
+ );
183637
183713
  projectsToClose.delete(externalProject.projectFileName);
183638
183714
  }
183639
183715
  forEachKey(projectsToClose, (externalProjectName) => {
183640
- this.closeExternalProject(externalProjectName);
183716
+ this.closeExternalProject(
183717
+ externalProjectName,
183718
+ /*print*/
183719
+ false
183720
+ );
183641
183721
  });
183722
+ this.printProjects();
183642
183723
  }
183643
183724
  static escapeFilenameForRegex(filename) {
183644
183725
  return filename.replace(this.filenameEscapeRegexp, "\\$&");
@@ -183731,7 +183812,7 @@ Dynamic files must always be opened with service's current directory or service
183731
183812
  proj.rootFiles = filesToKeep;
183732
183813
  return excludedFiles;
183733
183814
  }
183734
- openExternalProject(proj) {
183815
+ openExternalProject(proj, print) {
183735
183816
  proj.typeAcquisition = proj.typeAcquisition || {};
183736
183817
  proj.typeAcquisition.include = proj.typeAcquisition.include || [];
183737
183818
  proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || [];
@@ -183770,12 +183851,22 @@ Dynamic files must always be opened with service's current directory or service
183770
183851
  externalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
183771
183852
  this.updateRootAndOptionsOfNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
183772
183853
  externalProject.updateGraph();
183854
+ if (print)
183855
+ this.printProjects();
183773
183856
  return;
183774
183857
  }
183775
- this.closeExternalProject(proj.projectFileName);
183858
+ this.closeExternalProject(
183859
+ proj.projectFileName,
183860
+ /*print*/
183861
+ false
183862
+ );
183776
183863
  } else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
183777
183864
  if (!tsConfigFiles) {
183778
- this.closeExternalProject(proj.projectFileName);
183865
+ this.closeExternalProject(
183866
+ proj.projectFileName,
183867
+ /*print*/
183868
+ false
183869
+ );
183779
183870
  } else {
183780
183871
  const oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
183781
183872
  let iNew = 0;
@@ -183815,6 +183906,8 @@ Dynamic files must always be opened with service's current directory or service
183815
183906
  const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
183816
183907
  project.updateGraph();
183817
183908
  }
183909
+ if (print)
183910
+ this.printProjects();
183818
183911
  }
183819
183912
  hasDeferredExtension() {
183820
183913
  for (const extension of this.hostConfiguration.extraFileExtensions) {
@@ -184741,7 +184834,11 @@ var Session3 = class _Session {
184741
184834
  return this.requiredResponse(response);
184742
184835
  },
184743
184836
  ["openExternalProject" /* OpenExternalProject */]: (request) => {
184744
- this.projectService.openExternalProject(request.arguments);
184837
+ this.projectService.openExternalProject(
184838
+ request.arguments,
184839
+ /*print*/
184840
+ true
184841
+ );
184745
184842
  return this.requiredResponse(
184746
184843
  /*response*/
184747
184844
  true
@@ -184755,7 +184852,11 @@ var Session3 = class _Session {
184755
184852
  );
184756
184853
  },
184757
184854
  ["closeExternalProject" /* CloseExternalProject */]: (request) => {
184758
- this.projectService.closeExternalProject(request.arguments.projectFileName);
184855
+ this.projectService.closeExternalProject(
184856
+ request.arguments.projectFileName,
184857
+ /*print*/
184858
+ true
184859
+ );
184759
184860
  return this.requiredResponse(
184760
184861
  /*response*/
184761
184862
  true
@@ -3332,18 +3332,6 @@ declare namespace ts {
3332
3332
  * Last version that was reported.
3333
3333
  */
3334
3334
  private lastReportedVersion;
3335
- /**
3336
- * Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
3337
- * This property is changed in 'updateGraph' based on the set of files in program
3338
- */
3339
- private projectProgramVersion;
3340
- /**
3341
- * Current version of the project state. It is changed when:
3342
- * - new root file was added/removed
3343
- * - edit happen in some file that is currently included in the project.
3344
- * This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
3345
- */
3346
- private projectStateVersion;
3347
3335
  protected projectErrors: Diagnostic[] | undefined;
3348
3336
  protected isInitialLoadPending: () => boolean;
3349
3337
  private readonly cancellationToken;
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.20240131`;
38
+ version = `${versionMajorMinor}.0-dev.20240202`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -91445,9 +91445,50 @@ ${lanes.join("\n")}
91445
91445
  return visitorWorker(node);
91446
91446
  }
91447
91447
  }
91448
- function visitElidableStatement(node) {
91448
+ function isElisionBlocked(node) {
91449
91449
  const parsed = getParseTreeNode(node);
91450
- if (parsed !== node) {
91450
+ if (parsed === node || isExportAssignment(node)) {
91451
+ return false;
91452
+ }
91453
+ if (!parsed || parsed.kind !== node.kind) {
91454
+ return true;
91455
+ }
91456
+ switch (node.kind) {
91457
+ case 272 /* ImportDeclaration */:
91458
+ Debug.assertNode(parsed, isImportDeclaration);
91459
+ if (node.importClause !== parsed.importClause) {
91460
+ return true;
91461
+ }
91462
+ if (node.attributes !== parsed.attributes) {
91463
+ return true;
91464
+ }
91465
+ break;
91466
+ case 271 /* ImportEqualsDeclaration */:
91467
+ Debug.assertNode(parsed, isImportEqualsDeclaration);
91468
+ if (node.name !== parsed.name) {
91469
+ return true;
91470
+ }
91471
+ if (node.isTypeOnly !== parsed.isTypeOnly) {
91472
+ return true;
91473
+ }
91474
+ if (node.moduleReference !== parsed.moduleReference && (isEntityName(node.moduleReference) || isEntityName(parsed.moduleReference))) {
91475
+ return true;
91476
+ }
91477
+ break;
91478
+ case 278 /* ExportDeclaration */:
91479
+ Debug.assertNode(parsed, isExportDeclaration);
91480
+ if (node.exportClause !== parsed.exportClause) {
91481
+ return true;
91482
+ }
91483
+ if (node.attributes !== parsed.attributes) {
91484
+ return true;
91485
+ }
91486
+ break;
91487
+ }
91488
+ return false;
91489
+ }
91490
+ function visitElidableStatement(node) {
91491
+ if (isElisionBlocked(node)) {
91451
91492
  if (node.transformFlags & 1 /* ContainsTypeScript */) {
91452
91493
  return visitEachChild(node, visitor, context);
91453
91494
  }
@@ -167224,84 +167265,98 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
167224
167265
  if (importGroup.length === 0) {
167225
167266
  return importGroup;
167226
167267
  }
167227
- const { importWithoutClause, typeOnlyImports, regularImports } = getCategorizedImports(importGroup);
167228
- const coalescedImports = [];
167229
- if (importWithoutClause) {
167230
- coalescedImports.push(importWithoutClause);
167231
- }
167232
- for (const group2 of [regularImports, typeOnlyImports]) {
167233
- const isTypeOnly = group2 === typeOnlyImports;
167234
- const { defaultImports, namespaceImports, namedImports } = group2;
167235
- if (!isTypeOnly && defaultImports.length === 1 && namespaceImports.length === 1 && namedImports.length === 0) {
167236
- const defaultImport = defaultImports[0];
167237
- coalescedImports.push(
167238
- updateImportDeclarationAndClause(defaultImport, defaultImport.importClause.name, namespaceImports[0].importClause.namedBindings)
167239
- );
167240
- continue;
167241
- }
167242
- const sortedNamespaceImports = stableSort(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
167243
- for (const namespaceImport of sortedNamespaceImports) {
167244
- coalescedImports.push(
167245
- updateImportDeclarationAndClause(
167246
- namespaceImport,
167247
- /*name*/
167248
- void 0,
167249
- namespaceImport.importClause.namedBindings
167250
- )
167251
- );
167252
- }
167253
- const firstDefaultImport = firstOrUndefined(defaultImports);
167254
- const firstNamedImport = firstOrUndefined(namedImports);
167255
- const importDecl = firstDefaultImport ?? firstNamedImport;
167256
- if (!importDecl) {
167257
- continue;
167268
+ const importGroupsByAttributes = groupBy(importGroup, (decl) => {
167269
+ if (decl.attributes) {
167270
+ let attrs = decl.attributes.token + " ";
167271
+ for (const x of sort(decl.attributes.elements, (x2, y) => compareStringsCaseSensitive(x2.name.text, y.name.text))) {
167272
+ attrs += x.name.text + ":";
167273
+ attrs += isStringLiteralLike(x.value) ? `"${x.value.text}"` : x.value.getText() + " ";
167274
+ }
167275
+ return attrs;
167258
167276
  }
167259
- let newDefaultImport;
167260
- const newImportSpecifiers = [];
167261
- if (defaultImports.length === 1) {
167262
- newDefaultImport = defaultImports[0].importClause.name;
167263
- } else {
167264
- for (const defaultImport of defaultImports) {
167265
- newImportSpecifiers.push(
167266
- factory.createImportSpecifier(
167267
- /*isTypeOnly*/
167268
- false,
167269
- factory.createIdentifier("default"),
167270
- defaultImport.importClause.name
167277
+ return "";
167278
+ });
167279
+ const coalescedImports = [];
167280
+ for (const attribute in importGroupsByAttributes) {
167281
+ const importGroupSameAttrs = importGroupsByAttributes[attribute];
167282
+ const { importWithoutClause, typeOnlyImports, regularImports } = getCategorizedImports(importGroupSameAttrs);
167283
+ if (importWithoutClause) {
167284
+ coalescedImports.push(importWithoutClause);
167285
+ }
167286
+ for (const group2 of [regularImports, typeOnlyImports]) {
167287
+ const isTypeOnly = group2 === typeOnlyImports;
167288
+ const { defaultImports, namespaceImports, namedImports } = group2;
167289
+ if (!isTypeOnly && defaultImports.length === 1 && namespaceImports.length === 1 && namedImports.length === 0) {
167290
+ const defaultImport = defaultImports[0];
167291
+ coalescedImports.push(
167292
+ updateImportDeclarationAndClause(defaultImport, defaultImport.importClause.name, namespaceImports[0].importClause.namedBindings)
167293
+ );
167294
+ continue;
167295
+ }
167296
+ const sortedNamespaceImports = stableSort(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
167297
+ for (const namespaceImport of sortedNamespaceImports) {
167298
+ coalescedImports.push(
167299
+ updateImportDeclarationAndClause(
167300
+ namespaceImport,
167301
+ /*name*/
167302
+ void 0,
167303
+ namespaceImport.importClause.namedBindings
167271
167304
  )
167272
167305
  );
167273
167306
  }
167274
- }
167275
- newImportSpecifiers.push(...getNewImportSpecifiers(namedImports));
167276
- const sortedImportSpecifiers = factory.createNodeArray(
167277
- sortSpecifiers(newImportSpecifiers, comparer, preferences),
167278
- firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings.elements.hasTrailingComma
167279
- );
167280
- const newNamedImports = sortedImportSpecifiers.length === 0 ? newDefaultImport ? void 0 : factory.createNamedImports(emptyArray) : firstNamedImport ? factory.updateNamedImports(firstNamedImport.importClause.namedBindings, sortedImportSpecifiers) : factory.createNamedImports(sortedImportSpecifiers);
167281
- if (sourceFile && newNamedImports && (firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings) && !rangeIsOnSingleLine(firstNamedImport.importClause.namedBindings, sourceFile)) {
167282
- setEmitFlags(newNamedImports, 2 /* MultiLine */);
167283
- }
167284
- if (isTypeOnly && newDefaultImport && newNamedImports) {
167285
- coalescedImports.push(
167286
- updateImportDeclarationAndClause(
167287
- importDecl,
167288
- newDefaultImport,
167289
- /*namedBindings*/
167290
- void 0
167291
- )
167292
- );
167293
- coalescedImports.push(
167294
- updateImportDeclarationAndClause(
167295
- firstNamedImport ?? importDecl,
167296
- /*name*/
167297
- void 0,
167298
- newNamedImports
167299
- )
167300
- );
167301
- } else {
167302
- coalescedImports.push(
167303
- updateImportDeclarationAndClause(importDecl, newDefaultImport, newNamedImports)
167307
+ const firstDefaultImport = firstOrUndefined(defaultImports);
167308
+ const firstNamedImport = firstOrUndefined(namedImports);
167309
+ const importDecl = firstDefaultImport ?? firstNamedImport;
167310
+ if (!importDecl) {
167311
+ continue;
167312
+ }
167313
+ let newDefaultImport;
167314
+ const newImportSpecifiers = [];
167315
+ if (defaultImports.length === 1) {
167316
+ newDefaultImport = defaultImports[0].importClause.name;
167317
+ } else {
167318
+ for (const defaultImport of defaultImports) {
167319
+ newImportSpecifiers.push(
167320
+ factory.createImportSpecifier(
167321
+ /*isTypeOnly*/
167322
+ false,
167323
+ factory.createIdentifier("default"),
167324
+ defaultImport.importClause.name
167325
+ )
167326
+ );
167327
+ }
167328
+ }
167329
+ newImportSpecifiers.push(...getNewImportSpecifiers(namedImports));
167330
+ const sortedImportSpecifiers = factory.createNodeArray(
167331
+ sortSpecifiers(newImportSpecifiers, comparer, preferences),
167332
+ firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings.elements.hasTrailingComma
167304
167333
  );
167334
+ const newNamedImports = sortedImportSpecifiers.length === 0 ? newDefaultImport ? void 0 : factory.createNamedImports(emptyArray) : firstNamedImport ? factory.updateNamedImports(firstNamedImport.importClause.namedBindings, sortedImportSpecifiers) : factory.createNamedImports(sortedImportSpecifiers);
167335
+ if (sourceFile && newNamedImports && (firstNamedImport == null ? void 0 : firstNamedImport.importClause.namedBindings) && !rangeIsOnSingleLine(firstNamedImport.importClause.namedBindings, sourceFile)) {
167336
+ setEmitFlags(newNamedImports, 2 /* MultiLine */);
167337
+ }
167338
+ if (isTypeOnly && newDefaultImport && newNamedImports) {
167339
+ coalescedImports.push(
167340
+ updateImportDeclarationAndClause(
167341
+ importDecl,
167342
+ newDefaultImport,
167343
+ /*namedBindings*/
167344
+ void 0
167345
+ )
167346
+ );
167347
+ coalescedImports.push(
167348
+ updateImportDeclarationAndClause(
167349
+ firstNamedImport ?? importDecl,
167350
+ /*name*/
167351
+ void 0,
167352
+ newNamedImports
167353
+ )
167354
+ );
167355
+ } else {
167356
+ coalescedImports.push(
167357
+ updateImportDeclarationAndClause(importDecl, newDefaultImport, newNamedImports)
167358
+ );
167359
+ }
167305
167360
  }
167306
167361
  }
167307
167362
  return coalescedImports;
@@ -175754,6 +175809,7 @@ ${options.prefix}` : "\n" : options.prefix
175754
175809
  /**
175755
175810
  * Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
175756
175811
  * This property is changed in 'updateGraph' based on the set of files in program
175812
+ * @internal
175757
175813
  */
175758
175814
  this.projectProgramVersion = 0;
175759
175815
  /**
@@ -175761,6 +175817,7 @@ ${options.prefix}` : "\n" : options.prefix
175761
175817
  * - new root file was added/removed
175762
175818
  * - edit happen in some file that is currently included in the project.
175763
175819
  * This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
175820
+ * @internal
175764
175821
  */
175765
175822
  this.projectStateVersion = 0;
175766
175823
  this.isInitialLoadPending = returnFalse;
@@ -176798,7 +176855,7 @@ ${options.prefix}` : "\n" : options.prefix
176798
176855
  );
176799
176856
  const elapsed = timestamp() - start;
176800
176857
  this.sendPerformanceEvent("UpdateGraph", elapsed);
176801
- this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
176858
+ this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} projectStateVersion: ${this.projectStateVersion} projectProgramVersion: ${this.projectProgramVersion} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
176802
176859
  if (this.projectService.logger.isTestLogger) {
176803
176860
  if (this.program !== oldProgram) {
176804
176861
  this.print(
@@ -176961,6 +177018,7 @@ ${options.prefix}` : "\n" : options.prefix
176961
177018
  }
176962
177019
  /** @internal */
176963
177020
  print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
177021
+ var _a;
176964
177022
  this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
176965
177023
  this.writeLog(this.filesToStringWorker(
176966
177024
  writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
@@ -176978,6 +177036,14 @@ ${options.prefix}` : "\n" : options.prefix
176978
177036
  false
176979
177037
  );
176980
177038
  }
177039
+ (_a = this.noDtsResolutionProject) == null ? void 0 : _a.print(
177040
+ /*writeProjectFileNames*/
177041
+ false,
177042
+ /*writeFileExplaination*/
177043
+ false,
177044
+ /*writeFileVersionAndText*/
177045
+ false
177046
+ );
176981
177047
  }
176982
177048
  setCompilerOptions(compilerOptions) {
176983
177049
  var _a;
@@ -178417,6 +178483,8 @@ ${options.prefix}` : "\n" : options.prefix
178417
178483
  /** @internal */
178418
178484
  this.extendedConfigCache = /* @__PURE__ */ new Map();
178419
178485
  /** @internal */
178486
+ this.baseline = noop;
178487
+ /** @internal */
178420
178488
  this.verifyDocumentRegistry = noop;
178421
178489
  /** @internal */
178422
178490
  this.verifyProgram = noop;
@@ -180406,6 +180474,8 @@ Dynamic files must always be opened with service's current directory or service
180406
180474
  });
180407
180475
  this.inferredProjects.forEach((project) => this.clearSemanticCache(project));
180408
180476
  this.ensureProjectForOpenFiles();
180477
+ this.logger.info("After reloading projects..");
180478
+ this.printProjects();
180409
180479
  }
180410
180480
  /**
180411
180481
  * This function goes through all the openFiles and tries to file the config file for them.
@@ -180931,7 +181001,7 @@ Dynamic files must always be opened with service's current directory or service
180931
181001
  }
180932
181002
  }
180933
181003
  }
180934
- closeExternalProject(uncheckedFileName) {
181004
+ closeExternalProject(uncheckedFileName, print) {
180935
181005
  const fileName = toNormalizedPath(uncheckedFileName);
180936
181006
  const configFiles = this.externalProjectToConfiguredProjectMap.get(fileName);
180937
181007
  if (configFiles) {
@@ -180945,6 +181015,8 @@ Dynamic files must always be opened with service's current directory or service
180945
181015
  this.removeProject(externalProject);
180946
181016
  }
180947
181017
  }
181018
+ if (print)
181019
+ this.printProjects();
180948
181020
  }
180949
181021
  openExternalProjects(projects) {
180950
181022
  const projectsToClose = arrayToMap(this.externalProjects, (p) => p.getProjectName(), (_) => true);
@@ -180952,12 +181024,21 @@ Dynamic files must always be opened with service's current directory or service
180952
181024
  projectsToClose.set(externalProjectName, true);
180953
181025
  });
180954
181026
  for (const externalProject of projects) {
180955
- this.openExternalProject(externalProject);
181027
+ this.openExternalProject(
181028
+ externalProject,
181029
+ /*print*/
181030
+ false
181031
+ );
180956
181032
  projectsToClose.delete(externalProject.projectFileName);
180957
181033
  }
180958
181034
  forEachKey(projectsToClose, (externalProjectName) => {
180959
- this.closeExternalProject(externalProjectName);
181035
+ this.closeExternalProject(
181036
+ externalProjectName,
181037
+ /*print*/
181038
+ false
181039
+ );
180960
181040
  });
181041
+ this.printProjects();
180961
181042
  }
180962
181043
  static escapeFilenameForRegex(filename) {
180963
181044
  return filename.replace(this.filenameEscapeRegexp, "\\$&");
@@ -181050,7 +181131,7 @@ Dynamic files must always be opened with service's current directory or service
181050
181131
  proj.rootFiles = filesToKeep;
181051
181132
  return excludedFiles;
181052
181133
  }
181053
- openExternalProject(proj) {
181134
+ openExternalProject(proj, print) {
181054
181135
  proj.typeAcquisition = proj.typeAcquisition || {};
181055
181136
  proj.typeAcquisition.include = proj.typeAcquisition.include || [];
181056
181137
  proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || [];
@@ -181089,12 +181170,22 @@ Dynamic files must always be opened with service's current directory or service
181089
181170
  externalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
181090
181171
  this.updateRootAndOptionsOfNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
181091
181172
  externalProject.updateGraph();
181173
+ if (print)
181174
+ this.printProjects();
181092
181175
  return;
181093
181176
  }
181094
- this.closeExternalProject(proj.projectFileName);
181177
+ this.closeExternalProject(
181178
+ proj.projectFileName,
181179
+ /*print*/
181180
+ false
181181
+ );
181095
181182
  } else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
181096
181183
  if (!tsConfigFiles) {
181097
- this.closeExternalProject(proj.projectFileName);
181184
+ this.closeExternalProject(
181185
+ proj.projectFileName,
181186
+ /*print*/
181187
+ false
181188
+ );
181098
181189
  } else {
181099
181190
  const oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
181100
181191
  let iNew = 0;
@@ -181134,6 +181225,8 @@ Dynamic files must always be opened with service's current directory or service
181134
181225
  const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
181135
181226
  project.updateGraph();
181136
181227
  }
181228
+ if (print)
181229
+ this.printProjects();
181137
181230
  }
181138
181231
  hasDeferredExtension() {
181139
181232
  for (const extension of this.hostConfiguration.extraFileExtensions) {
@@ -182129,7 +182222,11 @@ ${json}${newLine}`;
182129
182222
  return this.requiredResponse(response);
182130
182223
  },
182131
182224
  ["openExternalProject" /* OpenExternalProject */]: (request) => {
182132
- this.projectService.openExternalProject(request.arguments);
182225
+ this.projectService.openExternalProject(
182226
+ request.arguments,
182227
+ /*print*/
182228
+ true
182229
+ );
182133
182230
  return this.requiredResponse(
182134
182231
  /*response*/
182135
182232
  true
@@ -182143,7 +182240,11 @@ ${json}${newLine}`;
182143
182240
  );
182144
182241
  },
182145
182242
  ["closeExternalProject" /* CloseExternalProject */]: (request) => {
182146
- this.projectService.closeExternalProject(request.arguments.projectFileName);
182243
+ this.projectService.closeExternalProject(
182244
+ request.arguments.projectFileName,
182245
+ /*print*/
182246
+ true
182247
+ );
182147
182248
  return this.requiredResponse(
182148
182249
  /*response*/
182149
182250
  true
@@ -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.20240131`;
57
+ var version = `${versionMajorMinor}.0-dev.20240202`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
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.20240131",
5
+ "version": "5.4.0-dev.20240202",
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": "104b0a6495cd6903a455f8438d9cdda20adeafff"
116
+ "gitHead": "593af47fa122a8017b956580856faa0e87aab4b6"
117
117
  }