typescript 5.1.0-dev.20230303 → 5.1.0-dev.20230305
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 +5 -2
- package/lib/tsserver.js +50 -19
- package/lib/tsserverlibrary.js +50 -19
- package/lib/typescript.js +50 -19
- package/lib/typingsInstaller.js +1 -1
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.1";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230305`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -58177,6 +58177,9 @@ function createTypeChecker(host) {
|
|
|
58177
58177
|
function isTypeSubtypeOf(source, target) {
|
|
58178
58178
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
58179
58179
|
}
|
|
58180
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
58181
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
58182
|
+
}
|
|
58180
58183
|
function isTypeAssignableTo(source, target) {
|
|
58181
58184
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
58182
58185
|
}
|
|
@@ -65273,7 +65276,7 @@ function createTypeChecker(host) {
|
|
|
65273
65276
|
const narrowedType = mapType(candidate, (c) => {
|
|
65274
65277
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
65275
65278
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
65276
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
65279
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
65277
65280
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
65278
65281
|
});
|
|
65279
65282
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
package/lib/tsserver.js
CHANGED
|
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2286
2286
|
|
|
2287
2287
|
// src/compiler/corePublic.ts
|
|
2288
2288
|
var versionMajorMinor = "5.1";
|
|
2289
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2289
|
+
var version = `${versionMajorMinor}.0-dev.20230305`;
|
|
2290
2290
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2291
2291
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2292
2292
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -62782,6 +62782,9 @@ function createTypeChecker(host) {
|
|
|
62782
62782
|
function isTypeSubtypeOf(source, target) {
|
|
62783
62783
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
62784
62784
|
}
|
|
62785
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
62786
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
62787
|
+
}
|
|
62785
62788
|
function isTypeAssignableTo(source, target) {
|
|
62786
62789
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
62787
62790
|
}
|
|
@@ -69878,7 +69881,7 @@ function createTypeChecker(host) {
|
|
|
69878
69881
|
const narrowedType = mapType(candidate, (c) => {
|
|
69879
69882
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
69880
69883
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
69881
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
69884
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
69882
69885
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
69883
69886
|
});
|
|
69884
69887
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -151437,6 +151440,8 @@ function tryGetObjectLikeCompletionContainer(contextToken) {
|
|
|
151437
151440
|
break;
|
|
151438
151441
|
case 41 /* AsteriskToken */:
|
|
151439
151442
|
return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression) : void 0;
|
|
151443
|
+
case 132 /* AsyncKeyword */:
|
|
151444
|
+
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
151440
151445
|
case 79 /* Identifier */:
|
|
151441
151446
|
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
151442
151447
|
}
|
|
@@ -156457,7 +156462,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
156457
156462
|
const shouldSort = mode === "SortAndCombine" /* SortAndCombine */ || mode === "All" /* All */;
|
|
156458
156463
|
const shouldCombine = shouldSort;
|
|
156459
156464
|
const shouldRemove = mode === "RemoveUnused" /* RemoveUnused */ || mode === "All" /* All */;
|
|
156460
|
-
const topLevelImportGroupDecls =
|
|
156465
|
+
const topLevelImportGroupDecls = groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration));
|
|
156461
156466
|
const comparer = getOrganizeImportsComparerWithDetection(preferences, shouldSort ? () => detectSortingWorker(topLevelImportGroupDecls, preferences) === 2 /* CaseInsensitive */ : void 0);
|
|
156462
156467
|
const processImportsOfSameModuleSpecifier = (importGroup) => {
|
|
156463
156468
|
if (shouldRemove)
|
|
@@ -156470,13 +156475,12 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
156470
156475
|
};
|
|
156471
156476
|
topLevelImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
156472
156477
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
156473
|
-
|
|
156474
|
-
organizeImportsWorker(topLevelExportDecls, (group2) => coalesceExportsWorker(group2, comparer));
|
|
156478
|
+
getTopLevelExportGroups(sourceFile).forEach((exportGroupDecl) => organizeImportsWorker(exportGroupDecl, (group2) => coalesceExportsWorker(group2, comparer)));
|
|
156475
156479
|
}
|
|
156476
156480
|
for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) {
|
|
156477
156481
|
if (!ambientModule.body)
|
|
156478
156482
|
continue;
|
|
156479
|
-
const ambientModuleImportGroupDecls =
|
|
156483
|
+
const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration));
|
|
156480
156484
|
ambientModuleImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
156481
156485
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
156482
156486
|
const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration);
|
|
@@ -156491,7 +156495,7 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
156491
156495
|
suppressLeadingTrivia(oldImportDecls[0]);
|
|
156492
156496
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
156493
156497
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
156494
|
-
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup);
|
|
156498
|
+
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
156495
156499
|
if (newImportDecls.length === 0) {
|
|
156496
156500
|
changeTracker.deleteNodes(
|
|
156497
156501
|
sourceFile,
|
|
@@ -156518,29 +156522,29 @@ function organizeImports(sourceFile, formatContext, host, program, preferences,
|
|
|
156518
156522
|
}
|
|
156519
156523
|
}
|
|
156520
156524
|
}
|
|
156521
|
-
function
|
|
156525
|
+
function groupByNewlineContiguous(sourceFile, decls) {
|
|
156522
156526
|
const scanner2 = createScanner(
|
|
156523
156527
|
sourceFile.languageVersion,
|
|
156524
156528
|
/*skipTrivia*/
|
|
156525
156529
|
false,
|
|
156526
156530
|
sourceFile.languageVariant
|
|
156527
156531
|
);
|
|
156528
|
-
const
|
|
156532
|
+
const group2 = [];
|
|
156529
156533
|
let groupIndex = 0;
|
|
156530
|
-
for (const
|
|
156531
|
-
if (
|
|
156534
|
+
for (const decl of decls) {
|
|
156535
|
+
if (group2[groupIndex] && isNewGroup(sourceFile, decl, scanner2)) {
|
|
156532
156536
|
groupIndex++;
|
|
156533
156537
|
}
|
|
156534
|
-
if (!
|
|
156535
|
-
|
|
156538
|
+
if (!group2[groupIndex]) {
|
|
156539
|
+
group2[groupIndex] = [];
|
|
156536
156540
|
}
|
|
156537
|
-
|
|
156541
|
+
group2[groupIndex].push(decl);
|
|
156538
156542
|
}
|
|
156539
|
-
return
|
|
156543
|
+
return group2;
|
|
156540
156544
|
}
|
|
156541
|
-
function isNewGroup(sourceFile,
|
|
156542
|
-
const startPos =
|
|
156543
|
-
const endPos =
|
|
156545
|
+
function isNewGroup(sourceFile, decl, scanner2) {
|
|
156546
|
+
const startPos = decl.getFullStart();
|
|
156547
|
+
const endPos = decl.getStart();
|
|
156544
156548
|
scanner2.setText(sourceFile.text, startPos, endPos - startPos);
|
|
156545
156549
|
let numberOfNewLines = 0;
|
|
156546
156550
|
while (scanner2.getTokenPos() < endPos) {
|
|
@@ -156821,7 +156825,7 @@ function getModuleSpecifierExpression(declaration) {
|
|
|
156821
156825
|
}
|
|
156822
156826
|
function detectSorting(sourceFile, preferences) {
|
|
156823
156827
|
return detectSortingWorker(
|
|
156824
|
-
|
|
156828
|
+
groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)),
|
|
156825
156829
|
preferences
|
|
156826
156830
|
);
|
|
156827
156831
|
}
|
|
@@ -157025,6 +157029,33 @@ function getOrganizeImportsComparerWithDetection(preferences, detectIgnoreCase)
|
|
|
157025
157029
|
const ignoreCase = typeof preferences.organizeImportsIgnoreCase === "boolean" ? preferences.organizeImportsIgnoreCase : (_a2 = detectIgnoreCase == null ? void 0 : detectIgnoreCase()) != null ? _a2 : false;
|
|
157026
157030
|
return getOrganizeImportsComparer(preferences, ignoreCase);
|
|
157027
157031
|
}
|
|
157032
|
+
function getTopLevelExportGroups(sourceFile) {
|
|
157033
|
+
const topLevelExportGroups = [];
|
|
157034
|
+
const statements = sourceFile.statements;
|
|
157035
|
+
const len = length(statements);
|
|
157036
|
+
let i = 0;
|
|
157037
|
+
let groupIndex = 0;
|
|
157038
|
+
while (i < len) {
|
|
157039
|
+
if (isExportDeclaration(statements[i])) {
|
|
157040
|
+
if (topLevelExportGroups[groupIndex] === void 0) {
|
|
157041
|
+
topLevelExportGroups[groupIndex] = [];
|
|
157042
|
+
}
|
|
157043
|
+
const exportDecl = statements[i];
|
|
157044
|
+
if (exportDecl.moduleSpecifier) {
|
|
157045
|
+
topLevelExportGroups[groupIndex].push(exportDecl);
|
|
157046
|
+
i++;
|
|
157047
|
+
} else {
|
|
157048
|
+
while (i < len && isExportDeclaration(statements[i])) {
|
|
157049
|
+
topLevelExportGroups[groupIndex].push(statements[i++]);
|
|
157050
|
+
}
|
|
157051
|
+
groupIndex++;
|
|
157052
|
+
}
|
|
157053
|
+
} else {
|
|
157054
|
+
i++;
|
|
157055
|
+
}
|
|
157056
|
+
}
|
|
157057
|
+
return flatMap(topLevelExportGroups, (exportGroupDecls) => groupByNewlineContiguous(sourceFile, exportGroupDecls));
|
|
157058
|
+
}
|
|
157028
157059
|
|
|
157029
157060
|
// src/services/_namespaces/ts.OutliningElementsCollector.ts
|
|
157030
157061
|
var ts_OutliningElementsCollector_exports = {};
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230305`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -60592,6 +60592,9 @@ ${lanes.join("\n")}
|
|
|
60592
60592
|
function isTypeSubtypeOf(source, target) {
|
|
60593
60593
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
60594
60594
|
}
|
|
60595
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
60596
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
60597
|
+
}
|
|
60595
60598
|
function isTypeAssignableTo(source, target) {
|
|
60596
60599
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
60597
60600
|
}
|
|
@@ -67688,7 +67691,7 @@ ${lanes.join("\n")}
|
|
|
67688
67691
|
const narrowedType = mapType(candidate, (c) => {
|
|
67689
67692
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
67690
67693
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
67691
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
67694
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
67692
67695
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
67693
67696
|
});
|
|
67694
67697
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -150490,6 +150493,8 @@ ${lanes.join("\n")}
|
|
|
150490
150493
|
break;
|
|
150491
150494
|
case 41 /* AsteriskToken */:
|
|
150492
150495
|
return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression) : void 0;
|
|
150496
|
+
case 132 /* AsyncKeyword */:
|
|
150497
|
+
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
150493
150498
|
case 79 /* Identifier */:
|
|
150494
150499
|
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
150495
150500
|
}
|
|
@@ -155654,7 +155659,7 @@ ${lanes.join("\n")}
|
|
|
155654
155659
|
const shouldSort = mode === "SortAndCombine" /* SortAndCombine */ || mode === "All" /* All */;
|
|
155655
155660
|
const shouldCombine = shouldSort;
|
|
155656
155661
|
const shouldRemove = mode === "RemoveUnused" /* RemoveUnused */ || mode === "All" /* All */;
|
|
155657
|
-
const topLevelImportGroupDecls =
|
|
155662
|
+
const topLevelImportGroupDecls = groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration));
|
|
155658
155663
|
const comparer = getOrganizeImportsComparerWithDetection(preferences, shouldSort ? () => detectSortingWorker(topLevelImportGroupDecls, preferences) === 2 /* CaseInsensitive */ : void 0);
|
|
155659
155664
|
const processImportsOfSameModuleSpecifier = (importGroup) => {
|
|
155660
155665
|
if (shouldRemove)
|
|
@@ -155667,13 +155672,12 @@ ${lanes.join("\n")}
|
|
|
155667
155672
|
};
|
|
155668
155673
|
topLevelImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
155669
155674
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
155670
|
-
|
|
155671
|
-
organizeImportsWorker(topLevelExportDecls, (group2) => coalesceExportsWorker(group2, comparer));
|
|
155675
|
+
getTopLevelExportGroups(sourceFile).forEach((exportGroupDecl) => organizeImportsWorker(exportGroupDecl, (group2) => coalesceExportsWorker(group2, comparer)));
|
|
155672
155676
|
}
|
|
155673
155677
|
for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) {
|
|
155674
155678
|
if (!ambientModule.body)
|
|
155675
155679
|
continue;
|
|
155676
|
-
const ambientModuleImportGroupDecls =
|
|
155680
|
+
const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration));
|
|
155677
155681
|
ambientModuleImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
155678
155682
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
155679
155683
|
const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration);
|
|
@@ -155688,7 +155692,7 @@ ${lanes.join("\n")}
|
|
|
155688
155692
|
suppressLeadingTrivia(oldImportDecls[0]);
|
|
155689
155693
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
155690
155694
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
155691
|
-
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup);
|
|
155695
|
+
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
155692
155696
|
if (newImportDecls.length === 0) {
|
|
155693
155697
|
changeTracker.deleteNodes(
|
|
155694
155698
|
sourceFile,
|
|
@@ -155715,29 +155719,29 @@ ${lanes.join("\n")}
|
|
|
155715
155719
|
}
|
|
155716
155720
|
}
|
|
155717
155721
|
}
|
|
155718
|
-
function
|
|
155722
|
+
function groupByNewlineContiguous(sourceFile, decls) {
|
|
155719
155723
|
const scanner2 = createScanner(
|
|
155720
155724
|
sourceFile.languageVersion,
|
|
155721
155725
|
/*skipTrivia*/
|
|
155722
155726
|
false,
|
|
155723
155727
|
sourceFile.languageVariant
|
|
155724
155728
|
);
|
|
155725
|
-
const
|
|
155729
|
+
const group2 = [];
|
|
155726
155730
|
let groupIndex = 0;
|
|
155727
|
-
for (const
|
|
155728
|
-
if (
|
|
155731
|
+
for (const decl of decls) {
|
|
155732
|
+
if (group2[groupIndex] && isNewGroup(sourceFile, decl, scanner2)) {
|
|
155729
155733
|
groupIndex++;
|
|
155730
155734
|
}
|
|
155731
|
-
if (!
|
|
155732
|
-
|
|
155735
|
+
if (!group2[groupIndex]) {
|
|
155736
|
+
group2[groupIndex] = [];
|
|
155733
155737
|
}
|
|
155734
|
-
|
|
155738
|
+
group2[groupIndex].push(decl);
|
|
155735
155739
|
}
|
|
155736
|
-
return
|
|
155740
|
+
return group2;
|
|
155737
155741
|
}
|
|
155738
|
-
function isNewGroup(sourceFile,
|
|
155739
|
-
const startPos =
|
|
155740
|
-
const endPos =
|
|
155742
|
+
function isNewGroup(sourceFile, decl, scanner2) {
|
|
155743
|
+
const startPos = decl.getFullStart();
|
|
155744
|
+
const endPos = decl.getStart();
|
|
155741
155745
|
scanner2.setText(sourceFile.text, startPos, endPos - startPos);
|
|
155742
155746
|
let numberOfNewLines = 0;
|
|
155743
155747
|
while (scanner2.getTokenPos() < endPos) {
|
|
@@ -156018,7 +156022,7 @@ ${lanes.join("\n")}
|
|
|
156018
156022
|
}
|
|
156019
156023
|
function detectSorting(sourceFile, preferences) {
|
|
156020
156024
|
return detectSortingWorker(
|
|
156021
|
-
|
|
156025
|
+
groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)),
|
|
156022
156026
|
preferences
|
|
156023
156027
|
);
|
|
156024
156028
|
}
|
|
@@ -156185,6 +156189,33 @@ ${lanes.join("\n")}
|
|
|
156185
156189
|
const ignoreCase = typeof preferences.organizeImportsIgnoreCase === "boolean" ? preferences.organizeImportsIgnoreCase : (_a2 = detectIgnoreCase == null ? void 0 : detectIgnoreCase()) != null ? _a2 : false;
|
|
156186
156190
|
return getOrganizeImportsComparer(preferences, ignoreCase);
|
|
156187
156191
|
}
|
|
156192
|
+
function getTopLevelExportGroups(sourceFile) {
|
|
156193
|
+
const topLevelExportGroups = [];
|
|
156194
|
+
const statements = sourceFile.statements;
|
|
156195
|
+
const len = length(statements);
|
|
156196
|
+
let i = 0;
|
|
156197
|
+
let groupIndex = 0;
|
|
156198
|
+
while (i < len) {
|
|
156199
|
+
if (isExportDeclaration(statements[i])) {
|
|
156200
|
+
if (topLevelExportGroups[groupIndex] === void 0) {
|
|
156201
|
+
topLevelExportGroups[groupIndex] = [];
|
|
156202
|
+
}
|
|
156203
|
+
const exportDecl = statements[i];
|
|
156204
|
+
if (exportDecl.moduleSpecifier) {
|
|
156205
|
+
topLevelExportGroups[groupIndex].push(exportDecl);
|
|
156206
|
+
i++;
|
|
156207
|
+
} else {
|
|
156208
|
+
while (i < len && isExportDeclaration(statements[i])) {
|
|
156209
|
+
topLevelExportGroups[groupIndex].push(statements[i++]);
|
|
156210
|
+
}
|
|
156211
|
+
groupIndex++;
|
|
156212
|
+
}
|
|
156213
|
+
} else {
|
|
156214
|
+
i++;
|
|
156215
|
+
}
|
|
156216
|
+
}
|
|
156217
|
+
return flatMap(topLevelExportGroups, (exportGroupDecls) => groupByNewlineContiguous(sourceFile, exportGroupDecls));
|
|
156218
|
+
}
|
|
156188
156219
|
var ImportSpecifierSortingCache, detectImportSpecifierSorting;
|
|
156189
156220
|
var init_organizeImports = __esm({
|
|
156190
156221
|
"src/services/organizeImports.ts"() {
|
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.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230305`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -60592,6 +60592,9 @@ ${lanes.join("\n")}
|
|
|
60592
60592
|
function isTypeSubtypeOf(source, target) {
|
|
60593
60593
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
60594
60594
|
}
|
|
60595
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
60596
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
60597
|
+
}
|
|
60595
60598
|
function isTypeAssignableTo(source, target) {
|
|
60596
60599
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
60597
60600
|
}
|
|
@@ -67688,7 +67691,7 @@ ${lanes.join("\n")}
|
|
|
67688
67691
|
const narrowedType = mapType(candidate, (c) => {
|
|
67689
67692
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
67690
67693
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
67691
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
67694
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
67692
67695
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
67693
67696
|
});
|
|
67694
67697
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -150504,6 +150507,8 @@ ${lanes.join("\n")}
|
|
|
150504
150507
|
break;
|
|
150505
150508
|
case 41 /* AsteriskToken */:
|
|
150506
150509
|
return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression) : void 0;
|
|
150510
|
+
case 132 /* AsyncKeyword */:
|
|
150511
|
+
return tryCast(parent2.parent, isObjectLiteralExpression);
|
|
150507
150512
|
case 79 /* Identifier */:
|
|
150508
150513
|
return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
|
|
150509
150514
|
}
|
|
@@ -155668,7 +155673,7 @@ ${lanes.join("\n")}
|
|
|
155668
155673
|
const shouldSort = mode === "SortAndCombine" /* SortAndCombine */ || mode === "All" /* All */;
|
|
155669
155674
|
const shouldCombine = shouldSort;
|
|
155670
155675
|
const shouldRemove = mode === "RemoveUnused" /* RemoveUnused */ || mode === "All" /* All */;
|
|
155671
|
-
const topLevelImportGroupDecls =
|
|
155676
|
+
const topLevelImportGroupDecls = groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration));
|
|
155672
155677
|
const comparer = getOrganizeImportsComparerWithDetection(preferences, shouldSort ? () => detectSortingWorker(topLevelImportGroupDecls, preferences) === 2 /* CaseInsensitive */ : void 0);
|
|
155673
155678
|
const processImportsOfSameModuleSpecifier = (importGroup) => {
|
|
155674
155679
|
if (shouldRemove)
|
|
@@ -155681,13 +155686,12 @@ ${lanes.join("\n")}
|
|
|
155681
155686
|
};
|
|
155682
155687
|
topLevelImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
155683
155688
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
155684
|
-
|
|
155685
|
-
organizeImportsWorker(topLevelExportDecls, (group2) => coalesceExportsWorker(group2, comparer));
|
|
155689
|
+
getTopLevelExportGroups(sourceFile).forEach((exportGroupDecl) => organizeImportsWorker(exportGroupDecl, (group2) => coalesceExportsWorker(group2, comparer)));
|
|
155686
155690
|
}
|
|
155687
155691
|
for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) {
|
|
155688
155692
|
if (!ambientModule.body)
|
|
155689
155693
|
continue;
|
|
155690
|
-
const ambientModuleImportGroupDecls =
|
|
155694
|
+
const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration));
|
|
155691
155695
|
ambientModuleImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier));
|
|
155692
155696
|
if (mode !== "RemoveUnused" /* RemoveUnused */) {
|
|
155693
155697
|
const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration);
|
|
@@ -155702,7 +155706,7 @@ ${lanes.join("\n")}
|
|
|
155702
155706
|
suppressLeadingTrivia(oldImportDecls[0]);
|
|
155703
155707
|
const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls];
|
|
155704
155708
|
const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups;
|
|
155705
|
-
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup);
|
|
155709
|
+
const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup);
|
|
155706
155710
|
if (newImportDecls.length === 0) {
|
|
155707
155711
|
changeTracker.deleteNodes(
|
|
155708
155712
|
sourceFile,
|
|
@@ -155729,29 +155733,29 @@ ${lanes.join("\n")}
|
|
|
155729
155733
|
}
|
|
155730
155734
|
}
|
|
155731
155735
|
}
|
|
155732
|
-
function
|
|
155736
|
+
function groupByNewlineContiguous(sourceFile, decls) {
|
|
155733
155737
|
const scanner2 = createScanner(
|
|
155734
155738
|
sourceFile.languageVersion,
|
|
155735
155739
|
/*skipTrivia*/
|
|
155736
155740
|
false,
|
|
155737
155741
|
sourceFile.languageVariant
|
|
155738
155742
|
);
|
|
155739
|
-
const
|
|
155743
|
+
const group2 = [];
|
|
155740
155744
|
let groupIndex = 0;
|
|
155741
|
-
for (const
|
|
155742
|
-
if (
|
|
155745
|
+
for (const decl of decls) {
|
|
155746
|
+
if (group2[groupIndex] && isNewGroup(sourceFile, decl, scanner2)) {
|
|
155743
155747
|
groupIndex++;
|
|
155744
155748
|
}
|
|
155745
|
-
if (!
|
|
155746
|
-
|
|
155749
|
+
if (!group2[groupIndex]) {
|
|
155750
|
+
group2[groupIndex] = [];
|
|
155747
155751
|
}
|
|
155748
|
-
|
|
155752
|
+
group2[groupIndex].push(decl);
|
|
155749
155753
|
}
|
|
155750
|
-
return
|
|
155754
|
+
return group2;
|
|
155751
155755
|
}
|
|
155752
|
-
function isNewGroup(sourceFile,
|
|
155753
|
-
const startPos =
|
|
155754
|
-
const endPos =
|
|
155756
|
+
function isNewGroup(sourceFile, decl, scanner2) {
|
|
155757
|
+
const startPos = decl.getFullStart();
|
|
155758
|
+
const endPos = decl.getStart();
|
|
155755
155759
|
scanner2.setText(sourceFile.text, startPos, endPos - startPos);
|
|
155756
155760
|
let numberOfNewLines = 0;
|
|
155757
155761
|
while (scanner2.getTokenPos() < endPos) {
|
|
@@ -156032,7 +156036,7 @@ ${lanes.join("\n")}
|
|
|
156032
156036
|
}
|
|
156033
156037
|
function detectSorting(sourceFile, preferences) {
|
|
156034
156038
|
return detectSortingWorker(
|
|
156035
|
-
|
|
156039
|
+
groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)),
|
|
156036
156040
|
preferences
|
|
156037
156041
|
);
|
|
156038
156042
|
}
|
|
@@ -156199,6 +156203,33 @@ ${lanes.join("\n")}
|
|
|
156199
156203
|
const ignoreCase = typeof preferences.organizeImportsIgnoreCase === "boolean" ? preferences.organizeImportsIgnoreCase : (_a2 = detectIgnoreCase == null ? void 0 : detectIgnoreCase()) != null ? _a2 : false;
|
|
156200
156204
|
return getOrganizeImportsComparer(preferences, ignoreCase);
|
|
156201
156205
|
}
|
|
156206
|
+
function getTopLevelExportGroups(sourceFile) {
|
|
156207
|
+
const topLevelExportGroups = [];
|
|
156208
|
+
const statements = sourceFile.statements;
|
|
156209
|
+
const len = length(statements);
|
|
156210
|
+
let i = 0;
|
|
156211
|
+
let groupIndex = 0;
|
|
156212
|
+
while (i < len) {
|
|
156213
|
+
if (isExportDeclaration(statements[i])) {
|
|
156214
|
+
if (topLevelExportGroups[groupIndex] === void 0) {
|
|
156215
|
+
topLevelExportGroups[groupIndex] = [];
|
|
156216
|
+
}
|
|
156217
|
+
const exportDecl = statements[i];
|
|
156218
|
+
if (exportDecl.moduleSpecifier) {
|
|
156219
|
+
topLevelExportGroups[groupIndex].push(exportDecl);
|
|
156220
|
+
i++;
|
|
156221
|
+
} else {
|
|
156222
|
+
while (i < len && isExportDeclaration(statements[i])) {
|
|
156223
|
+
topLevelExportGroups[groupIndex].push(statements[i++]);
|
|
156224
|
+
}
|
|
156225
|
+
groupIndex++;
|
|
156226
|
+
}
|
|
156227
|
+
} else {
|
|
156228
|
+
i++;
|
|
156229
|
+
}
|
|
156230
|
+
}
|
|
156231
|
+
return flatMap(topLevelExportGroups, (exportGroupDecls) => groupByNewlineContiguous(sourceFile, exportGroupDecls));
|
|
156232
|
+
}
|
|
156202
156233
|
var ImportSpecifierSortingCache, detectImportSpecifierSorting;
|
|
156203
156234
|
var init_organizeImports = __esm({
|
|
156204
156235
|
"src/services/organizeImports.ts"() {
|
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.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230305`;
|
|
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.1.0-dev.
|
|
5
|
+
"version": "5.1.0-dev.20230305",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|