typescript 5.4.0-dev.20240212 → 5.4.0-dev.20240214
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 +36 -34
- package/lib/tsserver.js +135 -159
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +135 -159
- package/lib/typingsInstaller.js +2 -2
- 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.20240214`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -32496,7 +32496,7 @@ var Parser;
|
|
|
32496
32496
|
if (!jsDocDiagnostics) {
|
|
32497
32497
|
jsDocDiagnostics = [];
|
|
32498
32498
|
}
|
|
32499
|
-
jsDocDiagnostics
|
|
32499
|
+
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
32500
32500
|
}
|
|
32501
32501
|
currentToken = saveToken;
|
|
32502
32502
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
|
@@ -54466,6 +54466,8 @@ function createTypeChecker(host) {
|
|
|
54466
54466
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
54467
54467
|
if (paramMapper) {
|
|
54468
54468
|
result.mapper = left.compositeKind !== 2097152 /* Intersection */ && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper;
|
|
54469
|
+
} else if (left.compositeKind !== 2097152 /* Intersection */ && left.mapper && left.compositeSignatures) {
|
|
54470
|
+
result.mapper = left.mapper;
|
|
54469
54471
|
}
|
|
54470
54472
|
return result;
|
|
54471
54473
|
}
|
|
@@ -65648,7 +65650,7 @@ function createTypeChecker(host) {
|
|
|
65648
65650
|
function hasMatchingArgument(expression, reference) {
|
|
65649
65651
|
if (expression.arguments) {
|
|
65650
65652
|
for (const argument of expression.arguments) {
|
|
65651
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
65653
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
|
|
65652
65654
|
return true;
|
|
65653
65655
|
}
|
|
65654
65656
|
}
|
|
@@ -65658,6 +65660,36 @@ function createTypeChecker(host) {
|
|
|
65658
65660
|
}
|
|
65659
65661
|
return false;
|
|
65660
65662
|
}
|
|
65663
|
+
function getCandidateDiscriminantPropertyAccess(expr, reference) {
|
|
65664
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
65665
|
+
if (isIdentifier(expr)) {
|
|
65666
|
+
const symbol = getResolvedSymbol(expr);
|
|
65667
|
+
const declaration = symbol.valueDeclaration;
|
|
65668
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
65669
|
+
return declaration;
|
|
65670
|
+
}
|
|
65671
|
+
}
|
|
65672
|
+
} else if (isAccessExpression(expr)) {
|
|
65673
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
65674
|
+
return expr;
|
|
65675
|
+
}
|
|
65676
|
+
} else if (isIdentifier(expr)) {
|
|
65677
|
+
const symbol = getResolvedSymbol(expr);
|
|
65678
|
+
if (isConstantVariable(symbol)) {
|
|
65679
|
+
const declaration = symbol.valueDeclaration;
|
|
65680
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
65681
|
+
return declaration.initializer;
|
|
65682
|
+
}
|
|
65683
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
65684
|
+
const parent = declaration.parent.parent;
|
|
65685
|
+
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
|
|
65686
|
+
return declaration;
|
|
65687
|
+
}
|
|
65688
|
+
}
|
|
65689
|
+
}
|
|
65690
|
+
}
|
|
65691
|
+
return void 0;
|
|
65692
|
+
}
|
|
65661
65693
|
function getFlowNodeId(flow) {
|
|
65662
65694
|
if (!flow.id || flow.id < 0) {
|
|
65663
65695
|
flow.id = nextFlowId;
|
|
@@ -66757,39 +66789,9 @@ function createTypeChecker(host) {
|
|
|
66757
66789
|
}
|
|
66758
66790
|
return result;
|
|
66759
66791
|
}
|
|
66760
|
-
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
66761
|
-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
66762
|
-
if (isIdentifier(expr)) {
|
|
66763
|
-
const symbol = getResolvedSymbol(expr);
|
|
66764
|
-
const declaration = symbol.valueDeclaration;
|
|
66765
|
-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
66766
|
-
return declaration;
|
|
66767
|
-
}
|
|
66768
|
-
}
|
|
66769
|
-
} else if (isAccessExpression(expr)) {
|
|
66770
|
-
if (isMatchingReference(reference, expr.expression)) {
|
|
66771
|
-
return expr;
|
|
66772
|
-
}
|
|
66773
|
-
} else if (isIdentifier(expr)) {
|
|
66774
|
-
const symbol = getResolvedSymbol(expr);
|
|
66775
|
-
if (isConstantVariable(symbol)) {
|
|
66776
|
-
const declaration = symbol.valueDeclaration;
|
|
66777
|
-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
66778
|
-
return declaration.initializer;
|
|
66779
|
-
}
|
|
66780
|
-
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
66781
|
-
const parent = declaration.parent.parent;
|
|
66782
|
-
if (isVariableDeclaration(parent) && !parent.type && parent.initializer && (isIdentifier(parent.initializer) || isAccessExpression(parent.initializer)) && isMatchingReference(reference, parent.initializer)) {
|
|
66783
|
-
return declaration;
|
|
66784
|
-
}
|
|
66785
|
-
}
|
|
66786
|
-
}
|
|
66787
|
-
}
|
|
66788
|
-
return void 0;
|
|
66789
|
-
}
|
|
66790
66792
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
66791
66793
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
66792
|
-
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
66794
|
+
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
|
|
66793
66795
|
if (access) {
|
|
66794
66796
|
const name = getAccessedPropertyName(access);
|
|
66795
66797
|
if (name) {
|
package/lib/tsserver.js
CHANGED
|
@@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2340
2340
|
|
|
2341
2341
|
// src/compiler/corePublic.ts
|
|
2342
2342
|
var versionMajorMinor = "5.4";
|
|
2343
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2343
|
+
var version = `${versionMajorMinor}.0-dev.20240214`;
|
|
2344
2344
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2345
2345
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2346
2346
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -36931,7 +36931,7 @@ var Parser;
|
|
|
36931
36931
|
if (!jsDocDiagnostics) {
|
|
36932
36932
|
jsDocDiagnostics = [];
|
|
36933
36933
|
}
|
|
36934
|
-
jsDocDiagnostics
|
|
36934
|
+
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
36935
36935
|
}
|
|
36936
36936
|
currentToken = saveToken;
|
|
36937
36937
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
|
@@ -59210,6 +59210,8 @@ function createTypeChecker(host) {
|
|
|
59210
59210
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
59211
59211
|
if (paramMapper) {
|
|
59212
59212
|
result.mapper = left.compositeKind !== 2097152 /* Intersection */ && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper;
|
|
59213
|
+
} else if (left.compositeKind !== 2097152 /* Intersection */ && left.mapper && left.compositeSignatures) {
|
|
59214
|
+
result.mapper = left.mapper;
|
|
59213
59215
|
}
|
|
59214
59216
|
return result;
|
|
59215
59217
|
}
|
|
@@ -70392,7 +70394,7 @@ function createTypeChecker(host) {
|
|
|
70392
70394
|
function hasMatchingArgument(expression, reference) {
|
|
70393
70395
|
if (expression.arguments) {
|
|
70394
70396
|
for (const argument of expression.arguments) {
|
|
70395
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
70397
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
|
|
70396
70398
|
return true;
|
|
70397
70399
|
}
|
|
70398
70400
|
}
|
|
@@ -70402,6 +70404,36 @@ function createTypeChecker(host) {
|
|
|
70402
70404
|
}
|
|
70403
70405
|
return false;
|
|
70404
70406
|
}
|
|
70407
|
+
function getCandidateDiscriminantPropertyAccess(expr, reference) {
|
|
70408
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
70409
|
+
if (isIdentifier(expr)) {
|
|
70410
|
+
const symbol = getResolvedSymbol(expr);
|
|
70411
|
+
const declaration = symbol.valueDeclaration;
|
|
70412
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
70413
|
+
return declaration;
|
|
70414
|
+
}
|
|
70415
|
+
}
|
|
70416
|
+
} else if (isAccessExpression(expr)) {
|
|
70417
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
70418
|
+
return expr;
|
|
70419
|
+
}
|
|
70420
|
+
} else if (isIdentifier(expr)) {
|
|
70421
|
+
const symbol = getResolvedSymbol(expr);
|
|
70422
|
+
if (isConstantVariable(symbol)) {
|
|
70423
|
+
const declaration = symbol.valueDeclaration;
|
|
70424
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
70425
|
+
return declaration.initializer;
|
|
70426
|
+
}
|
|
70427
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
70428
|
+
const parent2 = declaration.parent.parent;
|
|
70429
|
+
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
70430
|
+
return declaration;
|
|
70431
|
+
}
|
|
70432
|
+
}
|
|
70433
|
+
}
|
|
70434
|
+
}
|
|
70435
|
+
return void 0;
|
|
70436
|
+
}
|
|
70405
70437
|
function getFlowNodeId(flow) {
|
|
70406
70438
|
if (!flow.id || flow.id < 0) {
|
|
70407
70439
|
flow.id = nextFlowId;
|
|
@@ -71501,39 +71533,9 @@ function createTypeChecker(host) {
|
|
|
71501
71533
|
}
|
|
71502
71534
|
return result;
|
|
71503
71535
|
}
|
|
71504
|
-
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
71505
|
-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
71506
|
-
if (isIdentifier(expr)) {
|
|
71507
|
-
const symbol = getResolvedSymbol(expr);
|
|
71508
|
-
const declaration = symbol.valueDeclaration;
|
|
71509
|
-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
71510
|
-
return declaration;
|
|
71511
|
-
}
|
|
71512
|
-
}
|
|
71513
|
-
} else if (isAccessExpression(expr)) {
|
|
71514
|
-
if (isMatchingReference(reference, expr.expression)) {
|
|
71515
|
-
return expr;
|
|
71516
|
-
}
|
|
71517
|
-
} else if (isIdentifier(expr)) {
|
|
71518
|
-
const symbol = getResolvedSymbol(expr);
|
|
71519
|
-
if (isConstantVariable(symbol)) {
|
|
71520
|
-
const declaration = symbol.valueDeclaration;
|
|
71521
|
-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
71522
|
-
return declaration.initializer;
|
|
71523
|
-
}
|
|
71524
|
-
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
71525
|
-
const parent2 = declaration.parent.parent;
|
|
71526
|
-
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
71527
|
-
return declaration;
|
|
71528
|
-
}
|
|
71529
|
-
}
|
|
71530
|
-
}
|
|
71531
|
-
}
|
|
71532
|
-
return void 0;
|
|
71533
|
-
}
|
|
71534
71536
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
71535
71537
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
71536
|
-
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
71538
|
+
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
|
|
71537
71539
|
if (access) {
|
|
71538
71540
|
const name = getAccessedPropertyName(access);
|
|
71539
71541
|
if (name) {
|
|
@@ -163052,15 +163054,18 @@ function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment
|
|
|
163052
163054
|
const basePath = compilerOptions.project || host.getCurrentDirectory();
|
|
163053
163055
|
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
163054
163056
|
const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
|
|
163055
|
-
return
|
|
163056
|
-
|
|
163057
|
-
|
|
163058
|
-
|
|
163059
|
-
|
|
163060
|
-
|
|
163061
|
-
|
|
163062
|
-
|
|
163063
|
-
|
|
163057
|
+
return deduplicate(
|
|
163058
|
+
flatMap(baseDirectories, (baseDirectory) => arrayFrom(getCompletionEntriesForDirectoryFragment(
|
|
163059
|
+
fragment,
|
|
163060
|
+
baseDirectory,
|
|
163061
|
+
extensionOptions,
|
|
163062
|
+
host,
|
|
163063
|
+
/*moduleSpecifierIsRelative*/
|
|
163064
|
+
true,
|
|
163065
|
+
exclude
|
|
163066
|
+
).values())),
|
|
163067
|
+
(itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
|
|
163068
|
+
);
|
|
163064
163069
|
}
|
|
163065
163070
|
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
163066
163071
|
var _a;
|
|
@@ -178154,7 +178159,7 @@ var ScriptInfo = class {
|
|
|
178154
178159
|
}
|
|
178155
178160
|
break;
|
|
178156
178161
|
default:
|
|
178157
|
-
if (
|
|
178162
|
+
if (orderedRemoveItem(this.containingProjects, project)) {
|
|
178158
178163
|
project.onFileAddedOrRemoved(this.isSymlink());
|
|
178159
178164
|
}
|
|
178160
178165
|
break;
|
|
@@ -181826,7 +181831,7 @@ var _ProjectService = class _ProjectService {
|
|
|
181826
181831
|
);
|
|
181827
181832
|
project.addRoot(info);
|
|
181828
181833
|
if (info.containingProjects[0] !== project) {
|
|
181829
|
-
info.
|
|
181834
|
+
orderedRemoveItem(info.containingProjects, project);
|
|
181830
181835
|
info.containingProjects.unshift(project);
|
|
181831
181836
|
}
|
|
181832
181837
|
project.updateGraph();
|
|
@@ -182121,8 +182126,7 @@ var _ProjectService = class _ProjectService {
|
|
|
182121
182126
|
* otherwise just file name
|
|
182122
182127
|
*/
|
|
182123
182128
|
getConfigFileNameForFile(info) {
|
|
182124
|
-
if (
|
|
182125
|
-
Debug.assert(info.isScriptOpen());
|
|
182129
|
+
if (!isAncestorConfigFileInfo(info)) {
|
|
182126
182130
|
const result = this.configFileForOpenFiles.get(info.path);
|
|
182127
182131
|
if (result !== void 0)
|
|
182128
182132
|
return result || void 0;
|
|
@@ -183117,11 +183121,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183117
183121
|
} = this.hostConfiguration.preferences;
|
|
183118
183122
|
this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
|
|
183119
183123
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
183120
|
-
this.
|
|
183121
|
-
|
|
183122
|
-
project.
|
|
183123
|
-
|
|
183124
|
-
|
|
183124
|
+
this.externalProjectToConfiguredProjectMap.forEach(
|
|
183125
|
+
(projects) => projects.forEach((project) => {
|
|
183126
|
+
if (!project.isClosed() && project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
|
|
183127
|
+
project.updateGraph();
|
|
183128
|
+
}
|
|
183129
|
+
})
|
|
183130
|
+
);
|
|
183125
183131
|
}
|
|
183126
183132
|
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
183127
183133
|
this.forEachProject((project) => {
|
|
@@ -183706,23 +183712,20 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183706
183712
|
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
|
|
183707
183713
|
}
|
|
183708
183714
|
}
|
|
183709
|
-
closeConfiguredProjectReferencedFromExternalProject(
|
|
183710
|
-
|
|
183711
|
-
|
|
183712
|
-
|
|
183713
|
-
|
|
183714
|
-
|
|
183715
|
-
return;
|
|
183715
|
+
closeConfiguredProjectReferencedFromExternalProject(configuredProjects) {
|
|
183716
|
+
configuredProjects == null ? void 0 : configuredProjects.forEach((configuredProject) => {
|
|
183717
|
+
if (!configuredProject.isClosed()) {
|
|
183718
|
+
configuredProject.deleteExternalProjectReference();
|
|
183719
|
+
if (!configuredProject.hasOpenRef())
|
|
183720
|
+
this.removeProject(configuredProject);
|
|
183716
183721
|
}
|
|
183717
|
-
}
|
|
183722
|
+
});
|
|
183718
183723
|
}
|
|
183719
183724
|
closeExternalProject(uncheckedFileName, print) {
|
|
183720
183725
|
const fileName = toNormalizedPath(uncheckedFileName);
|
|
183721
|
-
const
|
|
183722
|
-
if (
|
|
183723
|
-
|
|
183724
|
-
this.closeConfiguredProjectReferencedFromExternalProject(configFile);
|
|
183725
|
-
}
|
|
183726
|
+
const configuredProjects = this.externalProjectToConfiguredProjectMap.get(fileName);
|
|
183727
|
+
if (configuredProjects) {
|
|
183728
|
+
this.closeConfiguredProjectReferencedFromExternalProject(configuredProjects);
|
|
183726
183729
|
this.externalProjectToConfiguredProjectMap.delete(fileName);
|
|
183727
183730
|
} else {
|
|
183728
183731
|
const externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
|
|
@@ -183762,16 +183765,18 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183762
183765
|
this.safelist = defaultTypeSafeList;
|
|
183763
183766
|
}
|
|
183764
183767
|
applySafeList(proj) {
|
|
183765
|
-
const { rootFiles } = proj;
|
|
183766
183768
|
const typeAcquisition = proj.typeAcquisition;
|
|
183767
183769
|
Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now");
|
|
183770
|
+
const result = this.applySafeListWorker(proj, proj.rootFiles, typeAcquisition);
|
|
183771
|
+
return (result == null ? void 0 : result.excludedFiles) ?? [];
|
|
183772
|
+
}
|
|
183773
|
+
applySafeListWorker(proj, rootFiles, typeAcquisition) {
|
|
183768
183774
|
if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) {
|
|
183769
|
-
return
|
|
183775
|
+
return void 0;
|
|
183770
183776
|
}
|
|
183771
183777
|
const typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []);
|
|
183772
183778
|
const excludeRules = [];
|
|
183773
183779
|
const normalizedNames = rootFiles.map((f) => normalizeSlashes(f.fileName));
|
|
183774
|
-
const excludedFiles = [];
|
|
183775
183780
|
for (const name of Object.keys(this.safelist)) {
|
|
183776
183781
|
const rule2 = this.safelist[name];
|
|
183777
183782
|
for (const root of normalizedNames) {
|
|
@@ -183812,12 +183817,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183812
183817
|
}
|
|
183813
183818
|
}
|
|
183814
183819
|
const excludeRegexes = excludeRules.map((e) => new RegExp(e, "i"));
|
|
183815
|
-
|
|
183816
|
-
|
|
183820
|
+
let filesToKeep;
|
|
183821
|
+
let excludedFiles;
|
|
183822
|
+
for (let i = 0; i < rootFiles.length; i++) {
|
|
183817
183823
|
if (excludeRegexes.some((re) => re.test(normalizedNames[i]))) {
|
|
183818
|
-
|
|
183824
|
+
addExcludedFile(i);
|
|
183819
183825
|
} else {
|
|
183820
|
-
let exclude = false;
|
|
183821
183826
|
if (typeAcquisition.enable) {
|
|
183822
183827
|
const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i]));
|
|
183823
183828
|
if (fileExtensionIs(baseName, "js")) {
|
|
@@ -183826,120 +183831,91 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
183826
183831
|
const typeName = this.legacySafelist.get(cleanedTypingName);
|
|
183827
183832
|
if (typeName !== void 0) {
|
|
183828
183833
|
this.logger.info(`Excluded '${normalizedNames[i]}' because it matched ${cleanedTypingName} from the legacy safelist`);
|
|
183829
|
-
|
|
183830
|
-
exclude = true;
|
|
183834
|
+
addExcludedFile(i);
|
|
183831
183835
|
if (!typeAcqInclude.includes(typeName)) {
|
|
183832
183836
|
typeAcqInclude.push(typeName);
|
|
183833
183837
|
}
|
|
183838
|
+
continue;
|
|
183834
183839
|
}
|
|
183835
183840
|
}
|
|
183836
183841
|
}
|
|
183837
|
-
if (
|
|
183838
|
-
|
|
183839
|
-
|
|
183840
|
-
|
|
183841
|
-
filesToKeep.push(proj.rootFiles[i]);
|
|
183842
|
-
}
|
|
183842
|
+
if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
|
|
183843
|
+
addExcludedFile(i);
|
|
183844
|
+
} else {
|
|
183845
|
+
filesToKeep == null ? void 0 : filesToKeep.push(rootFiles[i]);
|
|
183843
183846
|
}
|
|
183844
183847
|
}
|
|
183845
183848
|
}
|
|
183846
|
-
|
|
183847
|
-
|
|
183849
|
+
return excludedFiles ? {
|
|
183850
|
+
rootFiles: filesToKeep,
|
|
183851
|
+
excludedFiles
|
|
183852
|
+
} : void 0;
|
|
183853
|
+
function addExcludedFile(index) {
|
|
183854
|
+
if (!excludedFiles) {
|
|
183855
|
+
Debug.assert(!filesToKeep);
|
|
183856
|
+
filesToKeep = rootFiles.slice(0, index);
|
|
183857
|
+
excludedFiles = [];
|
|
183858
|
+
}
|
|
183859
|
+
excludedFiles.push(normalizedNames[index]);
|
|
183860
|
+
}
|
|
183848
183861
|
}
|
|
183849
183862
|
openExternalProject(proj, print) {
|
|
183850
|
-
|
|
183851
|
-
|
|
183852
|
-
|
|
183853
|
-
|
|
183854
|
-
proj.typeAcquisition.enable = hasNoTypeScriptSource(proj.rootFiles.map((f) => f.fileName));
|
|
183855
|
-
}
|
|
183856
|
-
const excludedFiles = this.applySafeList(proj);
|
|
183857
|
-
let tsConfigFiles;
|
|
183858
|
-
const rootFiles = [];
|
|
183863
|
+
const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
|
|
183864
|
+
const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
|
|
183865
|
+
let configuredProjects;
|
|
183866
|
+
let rootFiles = [];
|
|
183859
183867
|
for (const file of proj.rootFiles) {
|
|
183860
183868
|
const normalized = toNormalizedPath(file.fileName);
|
|
183861
183869
|
if (getBaseConfigFileName(normalized)) {
|
|
183862
183870
|
if (this.serverMode === 0 /* Semantic */ && this.host.fileExists(normalized)) {
|
|
183863
|
-
|
|
183871
|
+
let project = this.findConfiguredProjectByProjectName(normalized);
|
|
183872
|
+
if (!project) {
|
|
183873
|
+
project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(normalized, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
183874
|
+
}
|
|
183875
|
+
if (!(existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.has(project))) {
|
|
183876
|
+
project.addExternalProjectReference();
|
|
183877
|
+
}
|
|
183878
|
+
(configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
|
|
183879
|
+
existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.delete(project);
|
|
183864
183880
|
}
|
|
183865
183881
|
} else {
|
|
183866
183882
|
rootFiles.push(file);
|
|
183867
183883
|
}
|
|
183868
183884
|
}
|
|
183869
|
-
if (
|
|
183870
|
-
|
|
183871
|
-
|
|
183872
|
-
|
|
183873
|
-
|
|
183874
|
-
|
|
183875
|
-
|
|
183876
|
-
|
|
183885
|
+
if (configuredProjects) {
|
|
183886
|
+
this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, configuredProjects);
|
|
183887
|
+
if (existingExternalProject)
|
|
183888
|
+
this.removeProject(existingExternalProject);
|
|
183889
|
+
} else {
|
|
183890
|
+
this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
|
|
183891
|
+
const typeAcquisition = proj.typeAcquisition || {};
|
|
183892
|
+
typeAcquisition.include = typeAcquisition.include || [];
|
|
183893
|
+
typeAcquisition.exclude = typeAcquisition.exclude || [];
|
|
183894
|
+
if (typeAcquisition.enable === void 0) {
|
|
183895
|
+
typeAcquisition.enable = hasNoTypeScriptSource(rootFiles.map((f) => f.fileName));
|
|
183896
|
+
}
|
|
183897
|
+
const excludeResult = this.applySafeListWorker(proj, rootFiles, typeAcquisition);
|
|
183898
|
+
const excludedFiles = (excludeResult == null ? void 0 : excludeResult.excludedFiles) ?? [];
|
|
183899
|
+
rootFiles = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles;
|
|
183900
|
+
if (existingExternalProject) {
|
|
183901
|
+
existingExternalProject.excludedFiles = excludedFiles;
|
|
183877
183902
|
const compilerOptions = convertCompilerOptions(proj.options);
|
|
183878
|
-
const watchOptionsAndErrors = convertWatchOptions(proj.options,
|
|
183879
|
-
const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions,
|
|
183903
|
+
const watchOptionsAndErrors = convertWatchOptions(proj.options, existingExternalProject.getCurrentDirectory());
|
|
183904
|
+
const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles, externalFilePropertyReader);
|
|
183880
183905
|
if (lastFileExceededProgramSize) {
|
|
183881
|
-
|
|
183906
|
+
existingExternalProject.disableLanguageService(lastFileExceededProgramSize);
|
|
183882
183907
|
} else {
|
|
183883
|
-
|
|
183908
|
+
existingExternalProject.enableLanguageService();
|
|
183884
183909
|
}
|
|
183885
|
-
|
|
183886
|
-
this.updateRootAndOptionsOfNonInferredProject(
|
|
183887
|
-
|
|
183888
|
-
if (print)
|
|
183889
|
-
this.printProjects();
|
|
183890
|
-
return;
|
|
183891
|
-
}
|
|
183892
|
-
this.closeExternalProject(
|
|
183893
|
-
proj.projectFileName,
|
|
183894
|
-
/*print*/
|
|
183895
|
-
false
|
|
183896
|
-
);
|
|
183897
|
-
} else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
|
|
183898
|
-
if (!tsConfigFiles) {
|
|
183899
|
-
this.closeExternalProject(
|
|
183900
|
-
proj.projectFileName,
|
|
183901
|
-
/*print*/
|
|
183902
|
-
false
|
|
183903
|
-
);
|
|
183910
|
+
existingExternalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
183911
|
+
this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
|
|
183912
|
+
existingExternalProject.updateGraph();
|
|
183904
183913
|
} else {
|
|
183905
|
-
const
|
|
183906
|
-
|
|
183907
|
-
let iOld = 0;
|
|
183908
|
-
while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {
|
|
183909
|
-
const newConfig = tsConfigFiles[iNew];
|
|
183910
|
-
const oldConfig = oldConfigFiles[iOld];
|
|
183911
|
-
if (oldConfig < newConfig) {
|
|
183912
|
-
this.closeConfiguredProjectReferencedFromExternalProject(oldConfig);
|
|
183913
|
-
iOld++;
|
|
183914
|
-
} else if (oldConfig > newConfig) {
|
|
183915
|
-
iNew++;
|
|
183916
|
-
} else {
|
|
183917
|
-
(exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);
|
|
183918
|
-
iOld++;
|
|
183919
|
-
iNew++;
|
|
183920
|
-
}
|
|
183921
|
-
}
|
|
183922
|
-
for (let i = iOld; i < oldConfigFiles.length; i++) {
|
|
183923
|
-
this.closeConfiguredProjectReferencedFromExternalProject(oldConfigFiles[i]);
|
|
183924
|
-
}
|
|
183925
|
-
}
|
|
183926
|
-
}
|
|
183927
|
-
if (tsConfigFiles) {
|
|
183928
|
-
this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles);
|
|
183929
|
-
for (const tsconfigFile of tsConfigFiles) {
|
|
183930
|
-
let project = this.findConfiguredProjectByProjectName(tsconfigFile);
|
|
183931
|
-
if (!project) {
|
|
183932
|
-
project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
183933
|
-
}
|
|
183934
|
-
if (project && !contains(exisingConfigFiles, tsconfigFile)) {
|
|
183935
|
-
project.addExternalProjectReference();
|
|
183936
|
-
}
|
|
183914
|
+
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles);
|
|
183915
|
+
project.updateGraph();
|
|
183937
183916
|
}
|
|
183938
|
-
} else {
|
|
183939
|
-
this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
|
|
183940
|
-
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
|
|
183941
|
-
project.updateGraph();
|
|
183942
183917
|
}
|
|
183918
|
+
this.closeConfiguredProjectReferencedFromExternalProject(existingConfiguredProjects);
|
|
183943
183919
|
if (print)
|
|
183944
183920
|
this.printProjects();
|
|
183945
183921
|
}
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3906,6 +3906,7 @@ declare namespace ts {
|
|
|
3906
3906
|
private static escapeFilenameForRegex;
|
|
3907
3907
|
resetSafeList(): void;
|
|
3908
3908
|
applySafeList(proj: protocol.ExternalProject): NormalizedPath[];
|
|
3909
|
+
private applySafeListWorker;
|
|
3909
3910
|
openExternalProject(proj: protocol.ExternalProject): void;
|
|
3910
3911
|
hasDeferredExtension(): boolean;
|
|
3911
3912
|
private enableRequestedPluginsAsync;
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20240214`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -35009,7 +35009,7 @@ ${lanes.join("\n")}
|
|
|
35009
35009
|
if (!jsDocDiagnostics) {
|
|
35010
35010
|
jsDocDiagnostics = [];
|
|
35011
35011
|
}
|
|
35012
|
-
jsDocDiagnostics
|
|
35012
|
+
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
35013
35013
|
}
|
|
35014
35014
|
currentToken = saveToken;
|
|
35015
35015
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
|
@@ -56965,6 +56965,8 @@ ${lanes.join("\n")}
|
|
|
56965
56965
|
result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]);
|
|
56966
56966
|
if (paramMapper) {
|
|
56967
56967
|
result.mapper = left.compositeKind !== 2097152 /* Intersection */ && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper;
|
|
56968
|
+
} else if (left.compositeKind !== 2097152 /* Intersection */ && left.mapper && left.compositeSignatures) {
|
|
56969
|
+
result.mapper = left.mapper;
|
|
56968
56970
|
}
|
|
56969
56971
|
return result;
|
|
56970
56972
|
}
|
|
@@ -68147,7 +68149,7 @@ ${lanes.join("\n")}
|
|
|
68147
68149
|
function hasMatchingArgument(expression, reference) {
|
|
68148
68150
|
if (expression.arguments) {
|
|
68149
68151
|
for (const argument of expression.arguments) {
|
|
68150
|
-
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference)) {
|
|
68152
|
+
if (isOrContainsMatchingReference(reference, argument) || optionalChainContainsReference(argument, reference) || getCandidateDiscriminantPropertyAccess(argument, reference)) {
|
|
68151
68153
|
return true;
|
|
68152
68154
|
}
|
|
68153
68155
|
}
|
|
@@ -68157,6 +68159,36 @@ ${lanes.join("\n")}
|
|
|
68157
68159
|
}
|
|
68158
68160
|
return false;
|
|
68159
68161
|
}
|
|
68162
|
+
function getCandidateDiscriminantPropertyAccess(expr, reference) {
|
|
68163
|
+
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
68164
|
+
if (isIdentifier(expr)) {
|
|
68165
|
+
const symbol = getResolvedSymbol(expr);
|
|
68166
|
+
const declaration = symbol.valueDeclaration;
|
|
68167
|
+
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
68168
|
+
return declaration;
|
|
68169
|
+
}
|
|
68170
|
+
}
|
|
68171
|
+
} else if (isAccessExpression(expr)) {
|
|
68172
|
+
if (isMatchingReference(reference, expr.expression)) {
|
|
68173
|
+
return expr;
|
|
68174
|
+
}
|
|
68175
|
+
} else if (isIdentifier(expr)) {
|
|
68176
|
+
const symbol = getResolvedSymbol(expr);
|
|
68177
|
+
if (isConstantVariable(symbol)) {
|
|
68178
|
+
const declaration = symbol.valueDeclaration;
|
|
68179
|
+
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
68180
|
+
return declaration.initializer;
|
|
68181
|
+
}
|
|
68182
|
+
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
68183
|
+
const parent2 = declaration.parent.parent;
|
|
68184
|
+
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
68185
|
+
return declaration;
|
|
68186
|
+
}
|
|
68187
|
+
}
|
|
68188
|
+
}
|
|
68189
|
+
}
|
|
68190
|
+
return void 0;
|
|
68191
|
+
}
|
|
68160
68192
|
function getFlowNodeId(flow) {
|
|
68161
68193
|
if (!flow.id || flow.id < 0) {
|
|
68162
68194
|
flow.id = nextFlowId;
|
|
@@ -69256,39 +69288,9 @@ ${lanes.join("\n")}
|
|
|
69256
69288
|
}
|
|
69257
69289
|
return result;
|
|
69258
69290
|
}
|
|
69259
|
-
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
69260
|
-
if (isBindingPattern(reference) || isFunctionExpressionOrArrowFunction(reference) || isObjectLiteralMethod(reference)) {
|
|
69261
|
-
if (isIdentifier(expr)) {
|
|
69262
|
-
const symbol = getResolvedSymbol(expr);
|
|
69263
|
-
const declaration = symbol.valueDeclaration;
|
|
69264
|
-
if (declaration && (isBindingElement(declaration) || isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
69265
|
-
return declaration;
|
|
69266
|
-
}
|
|
69267
|
-
}
|
|
69268
|
-
} else if (isAccessExpression(expr)) {
|
|
69269
|
-
if (isMatchingReference(reference, expr.expression)) {
|
|
69270
|
-
return expr;
|
|
69271
|
-
}
|
|
69272
|
-
} else if (isIdentifier(expr)) {
|
|
69273
|
-
const symbol = getResolvedSymbol(expr);
|
|
69274
|
-
if (isConstantVariable(symbol)) {
|
|
69275
|
-
const declaration = symbol.valueDeclaration;
|
|
69276
|
-
if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) {
|
|
69277
|
-
return declaration.initializer;
|
|
69278
|
-
}
|
|
69279
|
-
if (isBindingElement(declaration) && !declaration.initializer) {
|
|
69280
|
-
const parent2 = declaration.parent.parent;
|
|
69281
|
-
if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) {
|
|
69282
|
-
return declaration;
|
|
69283
|
-
}
|
|
69284
|
-
}
|
|
69285
|
-
}
|
|
69286
|
-
}
|
|
69287
|
-
return void 0;
|
|
69288
|
-
}
|
|
69289
69291
|
function getDiscriminantPropertyAccess(expr, computedType) {
|
|
69290
69292
|
if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) {
|
|
69291
|
-
const access = getCandidateDiscriminantPropertyAccess(expr);
|
|
69293
|
+
const access = getCandidateDiscriminantPropertyAccess(expr, reference);
|
|
69292
69294
|
if (access) {
|
|
69293
69295
|
const name = getAccessedPropertyName(access);
|
|
69294
69296
|
if (name) {
|
|
@@ -162319,15 +162321,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162319
162321
|
const basePath = compilerOptions.project || host.getCurrentDirectory();
|
|
162320
162322
|
const ignoreCase = !(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames());
|
|
162321
162323
|
const baseDirectories = getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptDirectory, ignoreCase);
|
|
162322
|
-
return
|
|
162323
|
-
|
|
162324
|
-
|
|
162325
|
-
|
|
162326
|
-
|
|
162327
|
-
|
|
162328
|
-
|
|
162329
|
-
|
|
162330
|
-
|
|
162324
|
+
return deduplicate(
|
|
162325
|
+
flatMap(baseDirectories, (baseDirectory) => arrayFrom(getCompletionEntriesForDirectoryFragment(
|
|
162326
|
+
fragment,
|
|
162327
|
+
baseDirectory,
|
|
162328
|
+
extensionOptions,
|
|
162329
|
+
host,
|
|
162330
|
+
/*moduleSpecifierIsRelative*/
|
|
162331
|
+
true,
|
|
162332
|
+
exclude
|
|
162333
|
+
).values())),
|
|
162334
|
+
(itemA, itemB) => itemA.name === itemB.name && itemA.kind === itemB.kind && itemA.extension === itemB.extension
|
|
162335
|
+
);
|
|
162331
162336
|
}
|
|
162332
162337
|
function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) {
|
|
162333
162338
|
var _a;
|
|
@@ -175438,7 +175443,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
175438
175443
|
}
|
|
175439
175444
|
break;
|
|
175440
175445
|
default:
|
|
175441
|
-
if (
|
|
175446
|
+
if (orderedRemoveItem(this.containingProjects, project)) {
|
|
175442
175447
|
project.onFileAddedOrRemoved(this.isSymlink());
|
|
175443
175448
|
}
|
|
175444
175449
|
break;
|
|
@@ -179147,7 +179152,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
179147
179152
|
);
|
|
179148
179153
|
project.addRoot(info);
|
|
179149
179154
|
if (info.containingProjects[0] !== project) {
|
|
179150
|
-
info.
|
|
179155
|
+
orderedRemoveItem(info.containingProjects, project);
|
|
179151
179156
|
info.containingProjects.unshift(project);
|
|
179152
179157
|
}
|
|
179153
179158
|
project.updateGraph();
|
|
@@ -179442,8 +179447,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
179442
179447
|
* otherwise just file name
|
|
179443
179448
|
*/
|
|
179444
179449
|
getConfigFileNameForFile(info) {
|
|
179445
|
-
if (
|
|
179446
|
-
Debug.assert(info.isScriptOpen());
|
|
179450
|
+
if (!isAncestorConfigFileInfo(info)) {
|
|
179447
179451
|
const result = this.configFileForOpenFiles.get(info.path);
|
|
179448
179452
|
if (result !== void 0)
|
|
179449
179453
|
return result || void 0;
|
|
@@ -180438,11 +180442,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
180438
180442
|
} = this.hostConfiguration.preferences;
|
|
180439
180443
|
this.hostConfiguration.preferences = { ...this.hostConfiguration.preferences, ...args.preferences };
|
|
180440
180444
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
180441
|
-
this.
|
|
180442
|
-
|
|
180443
|
-
project.
|
|
180444
|
-
|
|
180445
|
-
|
|
180445
|
+
this.externalProjectToConfiguredProjectMap.forEach(
|
|
180446
|
+
(projects) => projects.forEach((project) => {
|
|
180447
|
+
if (!project.isClosed() && project.hasExternalProjectRef() && project.pendingUpdateLevel === 2 /* Full */ && !this.pendingProjectUpdates.has(project.getProjectName())) {
|
|
180448
|
+
project.updateGraph();
|
|
180449
|
+
}
|
|
180450
|
+
})
|
|
180451
|
+
);
|
|
180446
180452
|
}
|
|
180447
180453
|
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
180448
180454
|
this.forEachProject((project) => {
|
|
@@ -181027,23 +181033,20 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181027
181033
|
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
|
|
181028
181034
|
}
|
|
181029
181035
|
}
|
|
181030
|
-
closeConfiguredProjectReferencedFromExternalProject(
|
|
181031
|
-
|
|
181032
|
-
|
|
181033
|
-
|
|
181034
|
-
|
|
181035
|
-
|
|
181036
|
-
return;
|
|
181036
|
+
closeConfiguredProjectReferencedFromExternalProject(configuredProjects) {
|
|
181037
|
+
configuredProjects == null ? void 0 : configuredProjects.forEach((configuredProject) => {
|
|
181038
|
+
if (!configuredProject.isClosed()) {
|
|
181039
|
+
configuredProject.deleteExternalProjectReference();
|
|
181040
|
+
if (!configuredProject.hasOpenRef())
|
|
181041
|
+
this.removeProject(configuredProject);
|
|
181037
181042
|
}
|
|
181038
|
-
}
|
|
181043
|
+
});
|
|
181039
181044
|
}
|
|
181040
181045
|
closeExternalProject(uncheckedFileName, print) {
|
|
181041
181046
|
const fileName = toNormalizedPath(uncheckedFileName);
|
|
181042
|
-
const
|
|
181043
|
-
if (
|
|
181044
|
-
|
|
181045
|
-
this.closeConfiguredProjectReferencedFromExternalProject(configFile);
|
|
181046
|
-
}
|
|
181047
|
+
const configuredProjects = this.externalProjectToConfiguredProjectMap.get(fileName);
|
|
181048
|
+
if (configuredProjects) {
|
|
181049
|
+
this.closeConfiguredProjectReferencedFromExternalProject(configuredProjects);
|
|
181047
181050
|
this.externalProjectToConfiguredProjectMap.delete(fileName);
|
|
181048
181051
|
} else {
|
|
181049
181052
|
const externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
|
|
@@ -181083,16 +181086,18 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181083
181086
|
this.safelist = defaultTypeSafeList;
|
|
181084
181087
|
}
|
|
181085
181088
|
applySafeList(proj) {
|
|
181086
|
-
const { rootFiles } = proj;
|
|
181087
181089
|
const typeAcquisition = proj.typeAcquisition;
|
|
181088
181090
|
Debug.assert(!!typeAcquisition, "proj.typeAcquisition should be set by now");
|
|
181091
|
+
const result = this.applySafeListWorker(proj, proj.rootFiles, typeAcquisition);
|
|
181092
|
+
return (result == null ? void 0 : result.excludedFiles) ?? [];
|
|
181093
|
+
}
|
|
181094
|
+
applySafeListWorker(proj, rootFiles, typeAcquisition) {
|
|
181089
181095
|
if (typeAcquisition.enable === false || typeAcquisition.disableFilenameBasedTypeAcquisition) {
|
|
181090
|
-
return
|
|
181096
|
+
return void 0;
|
|
181091
181097
|
}
|
|
181092
181098
|
const typeAcqInclude = typeAcquisition.include || (typeAcquisition.include = []);
|
|
181093
181099
|
const excludeRules = [];
|
|
181094
181100
|
const normalizedNames = rootFiles.map((f) => normalizeSlashes(f.fileName));
|
|
181095
|
-
const excludedFiles = [];
|
|
181096
181101
|
for (const name of Object.keys(this.safelist)) {
|
|
181097
181102
|
const rule2 = this.safelist[name];
|
|
181098
181103
|
for (const root of normalizedNames) {
|
|
@@ -181133,12 +181138,12 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181133
181138
|
}
|
|
181134
181139
|
}
|
|
181135
181140
|
const excludeRegexes = excludeRules.map((e) => new RegExp(e, "i"));
|
|
181136
|
-
|
|
181137
|
-
|
|
181141
|
+
let filesToKeep;
|
|
181142
|
+
let excludedFiles;
|
|
181143
|
+
for (let i = 0; i < rootFiles.length; i++) {
|
|
181138
181144
|
if (excludeRegexes.some((re) => re.test(normalizedNames[i]))) {
|
|
181139
|
-
|
|
181145
|
+
addExcludedFile(i);
|
|
181140
181146
|
} else {
|
|
181141
|
-
let exclude = false;
|
|
181142
181147
|
if (typeAcquisition.enable) {
|
|
181143
181148
|
const baseName = getBaseFileName(toFileNameLowerCase(normalizedNames[i]));
|
|
181144
181149
|
if (fileExtensionIs(baseName, "js")) {
|
|
@@ -181147,120 +181152,91 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181147
181152
|
const typeName = this.legacySafelist.get(cleanedTypingName);
|
|
181148
181153
|
if (typeName !== void 0) {
|
|
181149
181154
|
this.logger.info(`Excluded '${normalizedNames[i]}' because it matched ${cleanedTypingName} from the legacy safelist`);
|
|
181150
|
-
|
|
181151
|
-
exclude = true;
|
|
181155
|
+
addExcludedFile(i);
|
|
181152
181156
|
if (!typeAcqInclude.includes(typeName)) {
|
|
181153
181157
|
typeAcqInclude.push(typeName);
|
|
181154
181158
|
}
|
|
181159
|
+
continue;
|
|
181155
181160
|
}
|
|
181156
181161
|
}
|
|
181157
181162
|
}
|
|
181158
|
-
if (
|
|
181159
|
-
|
|
181160
|
-
|
|
181161
|
-
|
|
181162
|
-
filesToKeep.push(proj.rootFiles[i]);
|
|
181163
|
-
}
|
|
181163
|
+
if (/^.+[.-]min\.js$/.test(normalizedNames[i])) {
|
|
181164
|
+
addExcludedFile(i);
|
|
181165
|
+
} else {
|
|
181166
|
+
filesToKeep == null ? void 0 : filesToKeep.push(rootFiles[i]);
|
|
181164
181167
|
}
|
|
181165
181168
|
}
|
|
181166
181169
|
}
|
|
181167
|
-
|
|
181168
|
-
|
|
181170
|
+
return excludedFiles ? {
|
|
181171
|
+
rootFiles: filesToKeep,
|
|
181172
|
+
excludedFiles
|
|
181173
|
+
} : void 0;
|
|
181174
|
+
function addExcludedFile(index) {
|
|
181175
|
+
if (!excludedFiles) {
|
|
181176
|
+
Debug.assert(!filesToKeep);
|
|
181177
|
+
filesToKeep = rootFiles.slice(0, index);
|
|
181178
|
+
excludedFiles = [];
|
|
181179
|
+
}
|
|
181180
|
+
excludedFiles.push(normalizedNames[index]);
|
|
181181
|
+
}
|
|
181169
181182
|
}
|
|
181170
181183
|
openExternalProject(proj, print) {
|
|
181171
|
-
|
|
181172
|
-
|
|
181173
|
-
|
|
181174
|
-
|
|
181175
|
-
proj.typeAcquisition.enable = hasNoTypeScriptSource(proj.rootFiles.map((f) => f.fileName));
|
|
181176
|
-
}
|
|
181177
|
-
const excludedFiles = this.applySafeList(proj);
|
|
181178
|
-
let tsConfigFiles;
|
|
181179
|
-
const rootFiles = [];
|
|
181184
|
+
const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
|
|
181185
|
+
const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
|
|
181186
|
+
let configuredProjects;
|
|
181187
|
+
let rootFiles = [];
|
|
181180
181188
|
for (const file of proj.rootFiles) {
|
|
181181
181189
|
const normalized = toNormalizedPath(file.fileName);
|
|
181182
181190
|
if (getBaseConfigFileName(normalized)) {
|
|
181183
181191
|
if (this.serverMode === 0 /* Semantic */ && this.host.fileExists(normalized)) {
|
|
181184
|
-
|
|
181192
|
+
let project = this.findConfiguredProjectByProjectName(normalized);
|
|
181193
|
+
if (!project) {
|
|
181194
|
+
project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(normalized, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
181195
|
+
}
|
|
181196
|
+
if (!(existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.has(project))) {
|
|
181197
|
+
project.addExternalProjectReference();
|
|
181198
|
+
}
|
|
181199
|
+
(configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
|
|
181200
|
+
existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.delete(project);
|
|
181185
181201
|
}
|
|
181186
181202
|
} else {
|
|
181187
181203
|
rootFiles.push(file);
|
|
181188
181204
|
}
|
|
181189
181205
|
}
|
|
181190
|
-
if (
|
|
181191
|
-
|
|
181192
|
-
|
|
181193
|
-
|
|
181194
|
-
|
|
181195
|
-
|
|
181196
|
-
|
|
181197
|
-
|
|
181206
|
+
if (configuredProjects) {
|
|
181207
|
+
this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, configuredProjects);
|
|
181208
|
+
if (existingExternalProject)
|
|
181209
|
+
this.removeProject(existingExternalProject);
|
|
181210
|
+
} else {
|
|
181211
|
+
this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
|
|
181212
|
+
const typeAcquisition = proj.typeAcquisition || {};
|
|
181213
|
+
typeAcquisition.include = typeAcquisition.include || [];
|
|
181214
|
+
typeAcquisition.exclude = typeAcquisition.exclude || [];
|
|
181215
|
+
if (typeAcquisition.enable === void 0) {
|
|
181216
|
+
typeAcquisition.enable = hasNoTypeScriptSource(rootFiles.map((f) => f.fileName));
|
|
181217
|
+
}
|
|
181218
|
+
const excludeResult = this.applySafeListWorker(proj, rootFiles, typeAcquisition);
|
|
181219
|
+
const excludedFiles = (excludeResult == null ? void 0 : excludeResult.excludedFiles) ?? [];
|
|
181220
|
+
rootFiles = (excludeResult == null ? void 0 : excludeResult.rootFiles) ?? rootFiles;
|
|
181221
|
+
if (existingExternalProject) {
|
|
181222
|
+
existingExternalProject.excludedFiles = excludedFiles;
|
|
181198
181223
|
const compilerOptions = convertCompilerOptions(proj.options);
|
|
181199
|
-
const watchOptionsAndErrors = convertWatchOptions(proj.options,
|
|
181200
|
-
const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions,
|
|
181224
|
+
const watchOptionsAndErrors = convertWatchOptions(proj.options, existingExternalProject.getCurrentDirectory());
|
|
181225
|
+
const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(proj.projectFileName, compilerOptions, rootFiles, externalFilePropertyReader);
|
|
181201
181226
|
if (lastFileExceededProgramSize) {
|
|
181202
|
-
|
|
181227
|
+
existingExternalProject.disableLanguageService(lastFileExceededProgramSize);
|
|
181203
181228
|
} else {
|
|
181204
|
-
|
|
181229
|
+
existingExternalProject.enableLanguageService();
|
|
181205
181230
|
}
|
|
181206
|
-
|
|
181207
|
-
this.updateRootAndOptionsOfNonInferredProject(
|
|
181208
|
-
|
|
181209
|
-
if (print)
|
|
181210
|
-
this.printProjects();
|
|
181211
|
-
return;
|
|
181212
|
-
}
|
|
181213
|
-
this.closeExternalProject(
|
|
181214
|
-
proj.projectFileName,
|
|
181215
|
-
/*print*/
|
|
181216
|
-
false
|
|
181217
|
-
);
|
|
181218
|
-
} else if (this.externalProjectToConfiguredProjectMap.get(proj.projectFileName)) {
|
|
181219
|
-
if (!tsConfigFiles) {
|
|
181220
|
-
this.closeExternalProject(
|
|
181221
|
-
proj.projectFileName,
|
|
181222
|
-
/*print*/
|
|
181223
|
-
false
|
|
181224
|
-
);
|
|
181231
|
+
existingExternalProject.setProjectErrors(watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.errors);
|
|
181232
|
+
this.updateRootAndOptionsOfNonInferredProject(existingExternalProject, rootFiles, externalFilePropertyReader, compilerOptions, typeAcquisition, proj.options.compileOnSave, watchOptionsAndErrors == null ? void 0 : watchOptionsAndErrors.watchOptions);
|
|
181233
|
+
existingExternalProject.updateGraph();
|
|
181225
181234
|
} else {
|
|
181226
|
-
const
|
|
181227
|
-
|
|
181228
|
-
let iOld = 0;
|
|
181229
|
-
while (iNew < tsConfigFiles.length && iOld < oldConfigFiles.length) {
|
|
181230
|
-
const newConfig = tsConfigFiles[iNew];
|
|
181231
|
-
const oldConfig = oldConfigFiles[iOld];
|
|
181232
|
-
if (oldConfig < newConfig) {
|
|
181233
|
-
this.closeConfiguredProjectReferencedFromExternalProject(oldConfig);
|
|
181234
|
-
iOld++;
|
|
181235
|
-
} else if (oldConfig > newConfig) {
|
|
181236
|
-
iNew++;
|
|
181237
|
-
} else {
|
|
181238
|
-
(exisingConfigFiles || (exisingConfigFiles = [])).push(oldConfig);
|
|
181239
|
-
iOld++;
|
|
181240
|
-
iNew++;
|
|
181241
|
-
}
|
|
181242
|
-
}
|
|
181243
|
-
for (let i = iOld; i < oldConfigFiles.length; i++) {
|
|
181244
|
-
this.closeConfiguredProjectReferencedFromExternalProject(oldConfigFiles[i]);
|
|
181245
|
-
}
|
|
181246
|
-
}
|
|
181247
|
-
}
|
|
181248
|
-
if (tsConfigFiles) {
|
|
181249
|
-
this.externalProjectToConfiguredProjectMap.set(proj.projectFileName, tsConfigFiles);
|
|
181250
|
-
for (const tsconfigFile of tsConfigFiles) {
|
|
181251
|
-
let project = this.findConfiguredProjectByProjectName(tsconfigFile);
|
|
181252
|
-
if (!project) {
|
|
181253
|
-
project = this.getHostPreferences().lazyConfiguredProjectsFromExternalProject ? this.createConfiguredProjectWithDelayLoad(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`) : this.createLoadAndUpdateConfiguredProject(tsconfigFile, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
181254
|
-
}
|
|
181255
|
-
if (project && !contains(exisingConfigFiles, tsconfigFile)) {
|
|
181256
|
-
project.addExternalProjectReference();
|
|
181257
|
-
}
|
|
181235
|
+
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, typeAcquisition, excludedFiles);
|
|
181236
|
+
project.updateGraph();
|
|
181258
181237
|
}
|
|
181259
|
-
} else {
|
|
181260
|
-
this.externalProjectToConfiguredProjectMap.delete(proj.projectFileName);
|
|
181261
|
-
const project = this.createExternalProject(proj.projectFileName, rootFiles, proj.options, proj.typeAcquisition, excludedFiles);
|
|
181262
|
-
project.updateGraph();
|
|
181263
181238
|
}
|
|
181239
|
+
this.closeConfiguredProjectReferencedFromExternalProject(existingConfiguredProjects);
|
|
181264
181240
|
if (print)
|
|
181265
181241
|
this.printProjects();
|
|
181266
181242
|
}
|
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.20240214`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -24326,7 +24326,7 @@ var Parser;
|
|
|
24326
24326
|
if (!jsDocDiagnostics) {
|
|
24327
24327
|
jsDocDiagnostics = [];
|
|
24328
24328
|
}
|
|
24329
|
-
jsDocDiagnostics
|
|
24329
|
+
addRange(jsDocDiagnostics, parseDiagnostics, saveParseDiagnosticsLength);
|
|
24330
24330
|
}
|
|
24331
24331
|
currentToken = saveToken;
|
|
24332
24332
|
parseDiagnostics.length = saveParseDiagnosticsLength;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-dev.
|
|
5
|
+
"version": "5.4.0-dev.20240214",
|
|
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": "db3d54ffbc0a805fbdd5104c5a5137d7ca84420a"
|
|
117
117
|
}
|