typescript 5.4.0-dev.20240201 → 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 +1 -1
- package/lib/tsserver.js +143 -83
- package/lib/typescript.d.ts +0 -12
- package/lib/typescript.js +143 -83
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
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.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240202`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
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.
|
|
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";
|
|
@@ -167905,84 +167905,98 @@ function coalesceImportsWorker(importGroup, comparer, sourceFile, preferences) {
|
|
|
167905
167905
|
if (importGroup.length === 0) {
|
|
167906
167906
|
return importGroup;
|
|
167907
167907
|
}
|
|
167908
|
-
const
|
|
167909
|
-
|
|
167910
|
-
|
|
167911
|
-
|
|
167912
|
-
|
|
167913
|
-
|
|
167914
|
-
|
|
167915
|
-
|
|
167916
|
-
if (!isTypeOnly && defaultImports.length === 1 && namespaceImports.length === 1 && namedImports.length === 0) {
|
|
167917
|
-
const defaultImport = defaultImports[0];
|
|
167918
|
-
coalescedImports.push(
|
|
167919
|
-
updateImportDeclarationAndClause(defaultImport, defaultImport.importClause.name, namespaceImports[0].importClause.namedBindings)
|
|
167920
|
-
);
|
|
167921
|
-
continue;
|
|
167922
|
-
}
|
|
167923
|
-
const sortedNamespaceImports = stableSort(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
|
|
167924
|
-
for (const namespaceImport of sortedNamespaceImports) {
|
|
167925
|
-
coalescedImports.push(
|
|
167926
|
-
updateImportDeclarationAndClause(
|
|
167927
|
-
namespaceImport,
|
|
167928
|
-
/*name*/
|
|
167929
|
-
void 0,
|
|
167930
|
-
namespaceImport.importClause.namedBindings
|
|
167931
|
-
)
|
|
167932
|
-
);
|
|
167933
|
-
}
|
|
167934
|
-
const firstDefaultImport = firstOrUndefined(defaultImports);
|
|
167935
|
-
const firstNamedImport = firstOrUndefined(namedImports);
|
|
167936
|
-
const importDecl = firstDefaultImport ?? firstNamedImport;
|
|
167937
|
-
if (!importDecl) {
|
|
167938
|
-
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;
|
|
167939
167916
|
}
|
|
167940
|
-
|
|
167941
|
-
|
|
167942
|
-
|
|
167943
|
-
|
|
167944
|
-
|
|
167945
|
-
|
|
167946
|
-
|
|
167947
|
-
|
|
167948
|
-
|
|
167949
|
-
|
|
167950
|
-
|
|
167951
|
-
|
|
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
|
|
167952
167944
|
)
|
|
167953
167945
|
);
|
|
167954
167946
|
}
|
|
167955
|
-
|
|
167956
|
-
|
|
167957
|
-
|
|
167958
|
-
|
|
167959
|
-
|
|
167960
|
-
|
|
167961
|
-
|
|
167962
|
-
|
|
167963
|
-
|
|
167964
|
-
|
|
167965
|
-
|
|
167966
|
-
|
|
167967
|
-
|
|
167968
|
-
|
|
167969
|
-
|
|
167970
|
-
|
|
167971
|
-
|
|
167972
|
-
|
|
167973
|
-
|
|
167974
|
-
|
|
167975
|
-
|
|
167976
|
-
|
|
167977
|
-
|
|
167978
|
-
|
|
167979
|
-
|
|
167980
|
-
|
|
167981
|
-
);
|
|
167982
|
-
} else {
|
|
167983
|
-
coalescedImports.push(
|
|
167984
|
-
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
|
|
167985
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
|
+
}
|
|
167986
168000
|
}
|
|
167987
168001
|
}
|
|
167988
168002
|
return coalescedImports;
|
|
@@ -178475,6 +178489,7 @@ var Project3 = class _Project {
|
|
|
178475
178489
|
/**
|
|
178476
178490
|
* Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
|
|
178477
178491
|
* This property is changed in 'updateGraph' based on the set of files in program
|
|
178492
|
+
* @internal
|
|
178478
178493
|
*/
|
|
178479
178494
|
this.projectProgramVersion = 0;
|
|
178480
178495
|
/**
|
|
@@ -178482,6 +178497,7 @@ var Project3 = class _Project {
|
|
|
178482
178497
|
* - new root file was added/removed
|
|
178483
178498
|
* - edit happen in some file that is currently included in the project.
|
|
178484
178499
|
* This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
|
|
178500
|
+
* @internal
|
|
178485
178501
|
*/
|
|
178486
178502
|
this.projectStateVersion = 0;
|
|
178487
178503
|
this.isInitialLoadPending = returnFalse;
|
|
@@ -179519,7 +179535,7 @@ var Project3 = class _Project {
|
|
|
179519
179535
|
);
|
|
179520
179536
|
const elapsed = timestamp() - start2;
|
|
179521
179537
|
this.sendPerformanceEvent("UpdateGraph", elapsed);
|
|
179522
|
-
this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()}
|
|
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`);
|
|
179523
179539
|
if (this.projectService.logger.isTestLogger) {
|
|
179524
179540
|
if (this.program !== oldProgram) {
|
|
179525
179541
|
this.print(
|
|
@@ -179682,6 +179698,7 @@ var Project3 = class _Project {
|
|
|
179682
179698
|
}
|
|
179683
179699
|
/** @internal */
|
|
179684
179700
|
print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
|
|
179701
|
+
var _a;
|
|
179685
179702
|
this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
|
|
179686
179703
|
this.writeLog(this.filesToStringWorker(
|
|
179687
179704
|
writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
|
|
@@ -179699,6 +179716,14 @@ var Project3 = class _Project {
|
|
|
179699
179716
|
false
|
|
179700
179717
|
);
|
|
179701
179718
|
}
|
|
179719
|
+
(_a = this.noDtsResolutionProject) == null ? void 0 : _a.print(
|
|
179720
|
+
/*writeProjectFileNames*/
|
|
179721
|
+
false,
|
|
179722
|
+
/*writeFileExplaination*/
|
|
179723
|
+
false,
|
|
179724
|
+
/*writeFileVersionAndText*/
|
|
179725
|
+
false
|
|
179726
|
+
);
|
|
179702
179727
|
}
|
|
179703
179728
|
setCompilerOptions(compilerOptions) {
|
|
179704
179729
|
var _a;
|
|
@@ -181139,6 +181164,8 @@ var _ProjectService = class _ProjectService {
|
|
|
181139
181164
|
/** @internal */
|
|
181140
181165
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
181141
181166
|
/** @internal */
|
|
181167
|
+
this.baseline = noop;
|
|
181168
|
+
/** @internal */
|
|
181142
181169
|
this.verifyDocumentRegistry = noop;
|
|
181143
181170
|
/** @internal */
|
|
181144
181171
|
this.verifyProgram = noop;
|
|
@@ -183128,6 +183155,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183128
183155
|
});
|
|
183129
183156
|
this.inferredProjects.forEach((project) => this.clearSemanticCache(project));
|
|
183130
183157
|
this.ensureProjectForOpenFiles();
|
|
183158
|
+
this.logger.info("After reloading projects..");
|
|
183159
|
+
this.printProjects();
|
|
183131
183160
|
}
|
|
183132
183161
|
/**
|
|
183133
183162
|
* This function goes through all the openFiles and tries to file the config file for them.
|
|
@@ -183653,7 +183682,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183653
183682
|
}
|
|
183654
183683
|
}
|
|
183655
183684
|
}
|
|
183656
|
-
closeExternalProject(uncheckedFileName) {
|
|
183685
|
+
closeExternalProject(uncheckedFileName, print) {
|
|
183657
183686
|
const fileName = toNormalizedPath(uncheckedFileName);
|
|
183658
183687
|
const configFiles = this.externalProjectToConfiguredProjectMap.get(fileName);
|
|
183659
183688
|
if (configFiles) {
|
|
@@ -183667,6 +183696,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183667
183696
|
this.removeProject(externalProject);
|
|
183668
183697
|
}
|
|
183669
183698
|
}
|
|
183699
|
+
if (print)
|
|
183700
|
+
this.printProjects();
|
|
183670
183701
|
}
|
|
183671
183702
|
openExternalProjects(projects) {
|
|
183672
183703
|
const projectsToClose = arrayToMap(this.externalProjects, (p) => p.getProjectName(), (_) => true);
|
|
@@ -183674,12 +183705,21 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183674
183705
|
projectsToClose.set(externalProjectName, true);
|
|
183675
183706
|
});
|
|
183676
183707
|
for (const externalProject of projects) {
|
|
183677
|
-
this.openExternalProject(
|
|
183708
|
+
this.openExternalProject(
|
|
183709
|
+
externalProject,
|
|
183710
|
+
/*print*/
|
|
183711
|
+
false
|
|
183712
|
+
);
|
|
183678
183713
|
projectsToClose.delete(externalProject.projectFileName);
|
|
183679
183714
|
}
|
|
183680
183715
|
forEachKey(projectsToClose, (externalProjectName) => {
|
|
183681
|
-
this.closeExternalProject(
|
|
183716
|
+
this.closeExternalProject(
|
|
183717
|
+
externalProjectName,
|
|
183718
|
+
/*print*/
|
|
183719
|
+
false
|
|
183720
|
+
);
|
|
183682
183721
|
});
|
|
183722
|
+
this.printProjects();
|
|
183683
183723
|
}
|
|
183684
183724
|
static escapeFilenameForRegex(filename) {
|
|
183685
183725
|
return filename.replace(this.filenameEscapeRegexp, "\\$&");
|
|
@@ -183772,7 +183812,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183772
183812
|
proj.rootFiles = filesToKeep;
|
|
183773
183813
|
return excludedFiles;
|
|
183774
183814
|
}
|
|
183775
|
-
openExternalProject(proj) {
|
|
183815
|
+
openExternalProject(proj, print) {
|
|
183776
183816
|
proj.typeAcquisition = proj.typeAcquisition || {};
|
|
183777
183817
|
proj.typeAcquisition.include = proj.typeAcquisition.include || [];
|
|
183778
183818
|
proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || [];
|
|
@@ -183811,12 +183851,22 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183811
183851
|
externalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
183812
183852
|
this.updateRootAndOptionsOfNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
|
|
183813
183853
|
externalProject.updateGraph();
|
|
183854
|
+
if (print)
|
|
183855
|
+
this.printProjects();
|
|
183814
183856
|
return;
|
|
183815
183857
|
}
|
|
183816
|
-
this.closeExternalProject(
|
|
183858
|
+
this.closeExternalProject(
|
|
183859
|
+
proj.projectFileName,
|
|
183860
|
+
/*print*/
|
|
183861
|
+
false
|
|
183862
|
+
);
|
|
183817
183863
|
} else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
|
|
183818
183864
|
if (!tsConfigFiles) {
|
|
183819
|
-
this.closeExternalProject(
|
|
183865
|
+
this.closeExternalProject(
|
|
183866
|
+
proj.projectFileName,
|
|
183867
|
+
/*print*/
|
|
183868
|
+
false
|
|
183869
|
+
);
|
|
183820
183870
|
} else {
|
|
183821
183871
|
const oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
|
|
183822
183872
|
let iNew = 0;
|
|
@@ -183856,6 +183906,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183856
183906
|
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
|
|
183857
183907
|
project.updateGraph();
|
|
183858
183908
|
}
|
|
183909
|
+
if (print)
|
|
183910
|
+
this.printProjects();
|
|
183859
183911
|
}
|
|
183860
183912
|
hasDeferredExtension() {
|
|
183861
183913
|
for (const extension of this.hostConfiguration.extraFileExtensions) {
|
|
@@ -184782,7 +184834,11 @@ var Session3 = class _Session {
|
|
|
184782
184834
|
return this.requiredResponse(response);
|
|
184783
184835
|
},
|
|
184784
184836
|
["openExternalProject" /* OpenExternalProject */]: (request) => {
|
|
184785
|
-
this.projectService.openExternalProject(
|
|
184837
|
+
this.projectService.openExternalProject(
|
|
184838
|
+
request.arguments,
|
|
184839
|
+
/*print*/
|
|
184840
|
+
true
|
|
184841
|
+
);
|
|
184786
184842
|
return this.requiredResponse(
|
|
184787
184843
|
/*response*/
|
|
184788
184844
|
true
|
|
@@ -184796,7 +184852,11 @@ var Session3 = class _Session {
|
|
|
184796
184852
|
);
|
|
184797
184853
|
},
|
|
184798
184854
|
["closeExternalProject" /* CloseExternalProject */]: (request) => {
|
|
184799
|
-
this.projectService.closeExternalProject(
|
|
184855
|
+
this.projectService.closeExternalProject(
|
|
184856
|
+
request.arguments.projectFileName,
|
|
184857
|
+
/*print*/
|
|
184858
|
+
true
|
|
184859
|
+
);
|
|
184800
184860
|
return this.requiredResponse(
|
|
184801
184861
|
/*response*/
|
|
184802
184862
|
true
|
package/lib/typescript.d.ts
CHANGED
|
@@ -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.
|
|
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";
|
|
@@ -167265,84 +167265,98 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167265
167265
|
if (importGroup.length === 0) {
|
|
167266
167266
|
return importGroup;
|
|
167267
167267
|
}
|
|
167268
|
-
const
|
|
167269
|
-
|
|
167270
|
-
|
|
167271
|
-
|
|
167272
|
-
|
|
167273
|
-
|
|
167274
|
-
|
|
167275
|
-
|
|
167276
|
-
if (!isTypeOnly && defaultImports.length === 1 && namespaceImports.length === 1 && namedImports.length === 0) {
|
|
167277
|
-
const defaultImport = defaultImports[0];
|
|
167278
|
-
coalescedImports.push(
|
|
167279
|
-
updateImportDeclarationAndClause(defaultImport, defaultImport.importClause.name, namespaceImports[0].importClause.namedBindings)
|
|
167280
|
-
);
|
|
167281
|
-
continue;
|
|
167282
|
-
}
|
|
167283
|
-
const sortedNamespaceImports = stableSort(namespaceImports, (i1, i2) => comparer(i1.importClause.namedBindings.name.text, i2.importClause.namedBindings.name.text));
|
|
167284
|
-
for (const namespaceImport of sortedNamespaceImports) {
|
|
167285
|
-
coalescedImports.push(
|
|
167286
|
-
updateImportDeclarationAndClause(
|
|
167287
|
-
namespaceImport,
|
|
167288
|
-
/*name*/
|
|
167289
|
-
void 0,
|
|
167290
|
-
namespaceImport.importClause.namedBindings
|
|
167291
|
-
)
|
|
167292
|
-
);
|
|
167293
|
-
}
|
|
167294
|
-
const firstDefaultImport = firstOrUndefined(defaultImports);
|
|
167295
|
-
const firstNamedImport = firstOrUndefined(namedImports);
|
|
167296
|
-
const importDecl = firstDefaultImport ?? firstNamedImport;
|
|
167297
|
-
if (!importDecl) {
|
|
167298
|
-
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;
|
|
167299
167276
|
}
|
|
167300
|
-
|
|
167301
|
-
|
|
167302
|
-
|
|
167303
|
-
|
|
167304
|
-
|
|
167305
|
-
|
|
167306
|
-
|
|
167307
|
-
|
|
167308
|
-
|
|
167309
|
-
|
|
167310
|
-
|
|
167311
|
-
|
|
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
|
|
167312
167304
|
)
|
|
167313
167305
|
);
|
|
167314
167306
|
}
|
|
167315
|
-
|
|
167316
|
-
|
|
167317
|
-
|
|
167318
|
-
|
|
167319
|
-
|
|
167320
|
-
|
|
167321
|
-
|
|
167322
|
-
|
|
167323
|
-
|
|
167324
|
-
|
|
167325
|
-
|
|
167326
|
-
|
|
167327
|
-
|
|
167328
|
-
|
|
167329
|
-
|
|
167330
|
-
|
|
167331
|
-
|
|
167332
|
-
|
|
167333
|
-
|
|
167334
|
-
|
|
167335
|
-
|
|
167336
|
-
|
|
167337
|
-
|
|
167338
|
-
|
|
167339
|
-
|
|
167340
|
-
|
|
167341
|
-
);
|
|
167342
|
-
} else {
|
|
167343
|
-
coalescedImports.push(
|
|
167344
|
-
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
|
|
167345
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
|
+
}
|
|
167346
167360
|
}
|
|
167347
167361
|
}
|
|
167348
167362
|
return coalescedImports;
|
|
@@ -175795,6 +175809,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175795
175809
|
/**
|
|
175796
175810
|
* Current project's program version. (incremented everytime new program is created that is not complete reuse from the old one)
|
|
175797
175811
|
* This property is changed in 'updateGraph' based on the set of files in program
|
|
175812
|
+
* @internal
|
|
175798
175813
|
*/
|
|
175799
175814
|
this.projectProgramVersion = 0;
|
|
175800
175815
|
/**
|
|
@@ -175802,6 +175817,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175802
175817
|
* - new root file was added/removed
|
|
175803
175818
|
* - edit happen in some file that is currently included in the project.
|
|
175804
175819
|
* This property is different from projectStructureVersion since in most cases edits don't affect set of files in the project
|
|
175820
|
+
* @internal
|
|
175805
175821
|
*/
|
|
175806
175822
|
this.projectStateVersion = 0;
|
|
175807
175823
|
this.isInitialLoadPending = returnFalse;
|
|
@@ -176839,7 +176855,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
176839
176855
|
);
|
|
176840
176856
|
const elapsed = timestamp() - start;
|
|
176841
176857
|
this.sendPerformanceEvent("UpdateGraph", elapsed);
|
|
176842
|
-
this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()}
|
|
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`);
|
|
176843
176859
|
if (this.projectService.logger.isTestLogger) {
|
|
176844
176860
|
if (this.program !== oldProgram) {
|
|
176845
176861
|
this.print(
|
|
@@ -177002,6 +177018,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
177002
177018
|
}
|
|
177003
177019
|
/** @internal */
|
|
177004
177020
|
print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
|
|
177021
|
+
var _a;
|
|
177005
177022
|
this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
|
|
177006
177023
|
this.writeLog(this.filesToStringWorker(
|
|
177007
177024
|
writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
|
|
@@ -177019,6 +177036,14 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
177019
177036
|
false
|
|
177020
177037
|
);
|
|
177021
177038
|
}
|
|
177039
|
+
(_a = this.noDtsResolutionProject) == null ? void 0 : _a.print(
|
|
177040
|
+
/*writeProjectFileNames*/
|
|
177041
|
+
false,
|
|
177042
|
+
/*writeFileExplaination*/
|
|
177043
|
+
false,
|
|
177044
|
+
/*writeFileVersionAndText*/
|
|
177045
|
+
false
|
|
177046
|
+
);
|
|
177022
177047
|
}
|
|
177023
177048
|
setCompilerOptions(compilerOptions) {
|
|
177024
177049
|
var _a;
|
|
@@ -178458,6 +178483,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
178458
178483
|
/** @internal */
|
|
178459
178484
|
this.extendedConfigCache = /* @__PURE__ */ new Map();
|
|
178460
178485
|
/** @internal */
|
|
178486
|
+
this.baseline = noop;
|
|
178487
|
+
/** @internal */
|
|
178461
178488
|
this.verifyDocumentRegistry = noop;
|
|
178462
178489
|
/** @internal */
|
|
178463
178490
|
this.verifyProgram = noop;
|
|
@@ -180447,6 +180474,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
180447
180474
|
});
|
|
180448
180475
|
this.inferredProjects.forEach((project) => this.clearSemanticCache(project));
|
|
180449
180476
|
this.ensureProjectForOpenFiles();
|
|
180477
|
+
this.logger.info("After reloading projects..");
|
|
180478
|
+
this.printProjects();
|
|
180450
180479
|
}
|
|
180451
180480
|
/**
|
|
180452
180481
|
* This function goes through all the openFiles and tries to file the config file for them.
|
|
@@ -180972,7 +181001,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
180972
181001
|
}
|
|
180973
181002
|
}
|
|
180974
181003
|
}
|
|
180975
|
-
closeExternalProject(uncheckedFileName) {
|
|
181004
|
+
closeExternalProject(uncheckedFileName, print) {
|
|
180976
181005
|
const fileName = toNormalizedPath(uncheckedFileName);
|
|
180977
181006
|
const configFiles = this.externalProjectToConfiguredProjectMap.get(fileName);
|
|
180978
181007
|
if (configFiles) {
|
|
@@ -180986,6 +181015,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
180986
181015
|
this.removeProject(externalProject);
|
|
180987
181016
|
}
|
|
180988
181017
|
}
|
|
181018
|
+
if (print)
|
|
181019
|
+
this.printProjects();
|
|
180989
181020
|
}
|
|
180990
181021
|
openExternalProjects(projects) {
|
|
180991
181022
|
const projectsToClose = arrayToMap(this.externalProjects, (p) => p.getProjectName(), (_) => true);
|
|
@@ -180993,12 +181024,21 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
180993
181024
|
projectsToClose.set(externalProjectName, true);
|
|
180994
181025
|
});
|
|
180995
181026
|
for (const externalProject of projects) {
|
|
180996
|
-
this.openExternalProject(
|
|
181027
|
+
this.openExternalProject(
|
|
181028
|
+
externalProject,
|
|
181029
|
+
/*print*/
|
|
181030
|
+
false
|
|
181031
|
+
);
|
|
180997
181032
|
projectsToClose.delete(externalProject.projectFileName);
|
|
180998
181033
|
}
|
|
180999
181034
|
forEachKey(projectsToClose, (externalProjectName) => {
|
|
181000
|
-
this.closeExternalProject(
|
|
181035
|
+
this.closeExternalProject(
|
|
181036
|
+
externalProjectName,
|
|
181037
|
+
/*print*/
|
|
181038
|
+
false
|
|
181039
|
+
);
|
|
181001
181040
|
});
|
|
181041
|
+
this.printProjects();
|
|
181002
181042
|
}
|
|
181003
181043
|
static escapeFilenameForRegex(filename) {
|
|
181004
181044
|
return filename.replace(this.filenameEscapeRegexp, "\\$&");
|
|
@@ -181091,7 +181131,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181091
181131
|
proj.rootFiles = filesToKeep;
|
|
181092
181132
|
return excludedFiles;
|
|
181093
181133
|
}
|
|
181094
|
-
openExternalProject(proj) {
|
|
181134
|
+
openExternalProject(proj, print) {
|
|
181095
181135
|
proj.typeAcquisition = proj.typeAcquisition || {};
|
|
181096
181136
|
proj.typeAcquisition.include = proj.typeAcquisition.include || [];
|
|
181097
181137
|
proj.typeAcquisition.exclude = proj.typeAcquisition.exclude || [];
|
|
@@ -181130,12 +181170,22 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181130
181170
|
externalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
181131
181171
|
this.updateRootAndOptionsOfNonInferredProject(externalProject, proj.rootFiles, externalFilePropertyReader, compilerOptions, proj.typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
|
|
181132
181172
|
externalProject.updateGraph();
|
|
181173
|
+
if (print)
|
|
181174
|
+
this.printProjects();
|
|
181133
181175
|
return;
|
|
181134
181176
|
}
|
|
181135
|
-
this.closeExternalProject(
|
|
181177
|
+
this.closeExternalProject(
|
|
181178
|
+
proj.projectFileName,
|
|
181179
|
+
/*print*/
|
|
181180
|
+
false
|
|
181181
|
+
);
|
|
181136
181182
|
} else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
|
|
181137
181183
|
if (!tsConfigFiles) {
|
|
181138
|
-
this.closeExternalProject(
|
|
181184
|
+
this.closeExternalProject(
|
|
181185
|
+
proj.projectFileName,
|
|
181186
|
+
/*print*/
|
|
181187
|
+
false
|
|
181188
|
+
);
|
|
181139
181189
|
} else {
|
|
181140
181190
|
const oldConfigFiles = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
|
|
181141
181191
|
let iNew = 0;
|
|
@@ -181175,6 +181225,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181175
181225
|
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
|
|
181176
181226
|
project.updateGraph();
|
|
181177
181227
|
}
|
|
181228
|
+
if (print)
|
|
181229
|
+
this.printProjects();
|
|
181178
181230
|
}
|
|
181179
181231
|
hasDeferredExtension() {
|
|
181180
181232
|
for (const extension of this.hostConfiguration.extraFileExtensions) {
|
|
@@ -182170,7 +182222,11 @@ ${json}${newLine}`;
|
|
|
182170
182222
|
return this.requiredResponse(response);
|
|
182171
182223
|
},
|
|
182172
182224
|
["openExternalProject" /* OpenExternalProject */]: (request) => {
|
|
182173
|
-
this.projectService.openExternalProject(
|
|
182225
|
+
this.projectService.openExternalProject(
|
|
182226
|
+
request.arguments,
|
|
182227
|
+
/*print*/
|
|
182228
|
+
true
|
|
182229
|
+
);
|
|
182174
182230
|
return this.requiredResponse(
|
|
182175
182231
|
/*response*/
|
|
182176
182232
|
true
|
|
@@ -182184,7 +182240,11 @@ ${json}${newLine}`;
|
|
|
182184
182240
|
);
|
|
182185
182241
|
},
|
|
182186
182242
|
["closeExternalProject" /* CloseExternalProject */]: (request) => {
|
|
182187
|
-
this.projectService.closeExternalProject(
|
|
182243
|
+
this.projectService.closeExternalProject(
|
|
182244
|
+
request.arguments.projectFileName,
|
|
182245
|
+
/*print*/
|
|
182246
|
+
true
|
|
182247
|
+
);
|
|
182188
182248
|
return this.requiredResponse(
|
|
182189
182249
|
/*response*/
|
|
182190
182250
|
true
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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": "
|
|
116
|
+
"gitHead": "593af47fa122a8017b956580856faa0e87aab4b6"
|
|
117
117
|
}
|