typescript 5.5.0-dev.20240509 → 5.5.0-dev.20240511
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 +466 -261
- package/lib/typescript.d.ts +39 -38
- package/lib/typescript.js +987 -743
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -68,7 +68,6 @@ __export(typescript_exports, {
|
|
|
68
68
|
EmitHint: () => EmitHint,
|
|
69
69
|
EmitOnly: () => EmitOnly,
|
|
70
70
|
EndOfLineState: () => EndOfLineState,
|
|
71
|
-
EnumKind: () => EnumKind,
|
|
72
71
|
ExitStatus: () => ExitStatus,
|
|
73
72
|
ExportKind: () => ExportKind,
|
|
74
73
|
Extension: () => Extension,
|
|
@@ -95,7 +94,7 @@ __export(typescript_exports, {
|
|
|
95
94
|
IndexKind: () => IndexKind,
|
|
96
95
|
InferenceFlags: () => InferenceFlags,
|
|
97
96
|
InferencePriority: () => InferencePriority,
|
|
98
|
-
InlayHintKind: () =>
|
|
97
|
+
InlayHintKind: () => InlayHintKind2,
|
|
99
98
|
InlayHints: () => ts_InlayHints_exports,
|
|
100
99
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
101
100
|
InternalSymbolName: () => InternalSymbolName,
|
|
@@ -2369,7 +2368,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2369
2368
|
|
|
2370
2369
|
// src/compiler/corePublic.ts
|
|
2371
2370
|
var versionMajorMinor = "5.5";
|
|
2372
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2371
|
+
var version = `${versionMajorMinor}.0-dev.20240511`;
|
|
2373
2372
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2374
2373
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2375
2374
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6492,11 +6491,6 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags3) => {
|
|
|
6492
6491
|
SymbolFlags3[SymbolFlags3["LateBindingContainer"] = 6256] = "LateBindingContainer";
|
|
6493
6492
|
return SymbolFlags3;
|
|
6494
6493
|
})(SymbolFlags || {});
|
|
6495
|
-
var EnumKind = /* @__PURE__ */ ((EnumKind2) => {
|
|
6496
|
-
EnumKind2[EnumKind2["Numeric"] = 0] = "Numeric";
|
|
6497
|
-
EnumKind2[EnumKind2["Literal"] = 1] = "Literal";
|
|
6498
|
-
return EnumKind2;
|
|
6499
|
-
})(EnumKind || {});
|
|
6500
6494
|
var CheckFlags = /* @__PURE__ */ ((CheckFlags2) => {
|
|
6501
6495
|
CheckFlags2[CheckFlags2["None"] = 0] = "None";
|
|
6502
6496
|
CheckFlags2[CheckFlags2["Instantiated"] = 1] = "Instantiated";
|
|
@@ -15978,7 +15972,7 @@ function canHaveLocals(node) {
|
|
|
15978
15972
|
}
|
|
15979
15973
|
}
|
|
15980
15974
|
function isDeclarationKind(kind) {
|
|
15981
|
-
return kind === 219 /* ArrowFunction */ || kind === 208 /* BindingElement */ || kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 175 /* ClassStaticBlockDeclaration */ || kind === 176 /* Constructor */ || kind === 266 /* EnumDeclaration */ || kind === 306 /* EnumMember */ || kind === 281 /* ExportSpecifier */ || kind === 262 /* FunctionDeclaration */ || kind === 218 /* FunctionExpression */ || kind === 177 /* GetAccessor */ || kind === 273 /* ImportClause */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 276 /* ImportSpecifier */ || kind === 264 /* InterfaceDeclaration */ || kind === 291 /* JsxAttribute */ || kind === 174 /* MethodDeclaration */ || kind === 173 /* MethodSignature */ || kind === 267 /* ModuleDeclaration */ || kind === 270 /* NamespaceExportDeclaration */ || kind === 274 /* NamespaceImport */ || kind === 280 /* NamespaceExport */ || kind === 169 /* Parameter */ || kind === 303 /* PropertyAssignment */ || kind === 172 /* PropertyDeclaration */ || kind === 171 /* PropertySignature */ || kind === 178 /* SetAccessor */ || kind === 304 /* ShorthandPropertyAssignment */ || kind === 265 /* TypeAliasDeclaration */ || kind === 168 /* TypeParameter */ || kind === 260 /* VariableDeclaration */ || kind === 346 /* JSDocTypedefTag */ || kind === 338 /* JSDocCallbackTag */ || kind === 348 /* JSDocPropertyTag */;
|
|
15975
|
+
return kind === 219 /* ArrowFunction */ || kind === 208 /* BindingElement */ || kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 175 /* ClassStaticBlockDeclaration */ || kind === 176 /* Constructor */ || kind === 266 /* EnumDeclaration */ || kind === 306 /* EnumMember */ || kind === 281 /* ExportSpecifier */ || kind === 262 /* FunctionDeclaration */ || kind === 218 /* FunctionExpression */ || kind === 177 /* GetAccessor */ || kind === 273 /* ImportClause */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 276 /* ImportSpecifier */ || kind === 264 /* InterfaceDeclaration */ || kind === 291 /* JsxAttribute */ || kind === 174 /* MethodDeclaration */ || kind === 173 /* MethodSignature */ || kind === 267 /* ModuleDeclaration */ || kind === 270 /* NamespaceExportDeclaration */ || kind === 274 /* NamespaceImport */ || kind === 280 /* NamespaceExport */ || kind === 169 /* Parameter */ || kind === 303 /* PropertyAssignment */ || kind === 172 /* PropertyDeclaration */ || kind === 171 /* PropertySignature */ || kind === 178 /* SetAccessor */ || kind === 304 /* ShorthandPropertyAssignment */ || kind === 265 /* TypeAliasDeclaration */ || kind === 168 /* TypeParameter */ || kind === 260 /* VariableDeclaration */ || kind === 346 /* JSDocTypedefTag */ || kind === 338 /* JSDocCallbackTag */ || kind === 348 /* JSDocPropertyTag */ || kind === 202 /* NamedTupleMember */;
|
|
15982
15976
|
}
|
|
15983
15977
|
function isDeclarationStatementKind(kind) {
|
|
15984
15978
|
return kind === 262 /* FunctionDeclaration */ || kind === 282 /* MissingDeclaration */ || kind === 263 /* ClassDeclaration */ || kind === 264 /* InterfaceDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 266 /* EnumDeclaration */ || kind === 267 /* ModuleDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 278 /* ExportDeclaration */ || kind === 277 /* ExportAssignment */ || kind === 270 /* NamespaceExportDeclaration */;
|
|
@@ -23156,13 +23150,15 @@ function createNameResolver({
|
|
|
23156
23150
|
let useResult = true;
|
|
23157
23151
|
if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
|
|
23158
23152
|
if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
|
|
23159
|
-
useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation
|
|
23153
|
+
useResult = result.flags & 262144 /* TypeParameter */ ? !!(lastLocation.flags & 16 /* Synthesized */) || // Synthetic fake scopes are added for signatures so type parameters are accessible from them
|
|
23154
|
+
lastLocation === location.type || lastLocation.kind === 169 /* Parameter */ || lastLocation.kind === 341 /* JSDocParameterTag */ || lastLocation.kind === 342 /* JSDocReturnTag */ || lastLocation.kind === 168 /* TypeParameter */ : false;
|
|
23160
23155
|
}
|
|
23161
23156
|
if (meaning & result.flags & 3 /* Variable */) {
|
|
23162
23157
|
if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
|
|
23163
23158
|
useResult = false;
|
|
23164
23159
|
} else if (result.flags & 1 /* FunctionScopedVariable */) {
|
|
23165
|
-
useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation
|
|
23160
|
+
useResult = lastLocation.kind === 169 /* Parameter */ || !!(lastLocation.flags & 16 /* Synthesized */) || // Synthetic fake scopes are added for signatures so parameters are accessible from them
|
|
23161
|
+
lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
|
|
23166
23162
|
}
|
|
23167
23163
|
}
|
|
23168
23164
|
} else if (location.kind === 194 /* ConditionalType */) {
|
|
@@ -51210,7 +51206,6 @@ function createTypeChecker(host) {
|
|
|
51210
51206
|
if (meaning) {
|
|
51211
51207
|
const symbol = getMergedSymbol(symbols.get(name));
|
|
51212
51208
|
if (symbol) {
|
|
51213
|
-
Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
|
|
51214
51209
|
if (symbol.flags & meaning) {
|
|
51215
51210
|
return symbol;
|
|
51216
51211
|
}
|
|
@@ -52462,37 +52457,6 @@ function createTypeChecker(host) {
|
|
|
52462
52457
|
}
|
|
52463
52458
|
return void 0;
|
|
52464
52459
|
}
|
|
52465
|
-
function markExportAsReferenced(node) {
|
|
52466
|
-
if (!canCollectSymbolAliasAccessabilityData) {
|
|
52467
|
-
return;
|
|
52468
|
-
}
|
|
52469
|
-
const symbol = getSymbolOfDeclaration(node);
|
|
52470
|
-
const target = resolveAlias(symbol);
|
|
52471
|
-
if (target) {
|
|
52472
|
-
const markAlias = target === unknownSymbol || getSymbolFlags(
|
|
52473
|
-
symbol,
|
|
52474
|
-
/*excludeTypeOnlyMeanings*/
|
|
52475
|
-
true
|
|
52476
|
-
) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
|
|
52477
|
-
if (markAlias) {
|
|
52478
|
-
markAliasSymbolAsReferenced(symbol);
|
|
52479
|
-
}
|
|
52480
|
-
}
|
|
52481
|
-
}
|
|
52482
|
-
function markAliasSymbolAsReferenced(symbol) {
|
|
52483
|
-
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
52484
|
-
const links = getSymbolLinks(symbol);
|
|
52485
|
-
if (!links.referenced) {
|
|
52486
|
-
links.referenced = true;
|
|
52487
|
-
const node = getDeclarationOfAliasSymbol(symbol);
|
|
52488
|
-
if (!node) return Debug.fail();
|
|
52489
|
-
if (isInternalModuleImportEqualsDeclaration(node)) {
|
|
52490
|
-
if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
|
|
52491
|
-
checkExpressionCached(node.moduleReference);
|
|
52492
|
-
}
|
|
52493
|
-
}
|
|
52494
|
-
}
|
|
52495
|
-
}
|
|
52496
52460
|
function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
|
|
52497
52461
|
if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
|
|
52498
52462
|
entityName = entityName.parent;
|
|
@@ -52645,7 +52609,6 @@ function createTypeChecker(host) {
|
|
|
52645
52609
|
} else {
|
|
52646
52610
|
Debug.assertNever(name, "Unknown entity name kind.");
|
|
52647
52611
|
}
|
|
52648
|
-
Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
|
|
52649
52612
|
if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 277 /* ExportAssignment */)) {
|
|
52650
52613
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
52651
52614
|
getAliasDeclarationFromName(name),
|
|
@@ -54066,7 +54029,6 @@ function createTypeChecker(host) {
|
|
|
54066
54029
|
return symbolToExpression(symbol, context, meaning);
|
|
54067
54030
|
}
|
|
54068
54031
|
function withContext2(enclosingDeclaration, flags, tracker, cb) {
|
|
54069
|
-
Debug.assert(enclosingDeclaration === void 0 || (enclosingDeclaration.flags & 16 /* Synthesized */) === 0);
|
|
54070
54032
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
54071
54033
|
const context = {
|
|
54072
54034
|
enclosingDeclaration,
|
|
@@ -54080,7 +54042,18 @@ function createTypeChecker(host) {
|
|
|
54080
54042
|
inferTypeParameters: void 0,
|
|
54081
54043
|
approximateLength: 0,
|
|
54082
54044
|
trackedSymbols: void 0,
|
|
54083
|
-
bundled: !!compilerOptions.outFile && !!enclosingDeclaration && isExternalOrCommonJsModule(getSourceFileOfNode(enclosingDeclaration))
|
|
54045
|
+
bundled: !!compilerOptions.outFile && !!enclosingDeclaration && isExternalOrCommonJsModule(getSourceFileOfNode(enclosingDeclaration)),
|
|
54046
|
+
truncating: false,
|
|
54047
|
+
usedSymbolNames: void 0,
|
|
54048
|
+
remappedSymbolNames: void 0,
|
|
54049
|
+
remappedSymbolReferences: void 0,
|
|
54050
|
+
reverseMappedStack: void 0,
|
|
54051
|
+
mustCreateTypeParameterSymbolList: true,
|
|
54052
|
+
typeParameterSymbolList: void 0,
|
|
54053
|
+
mustCreateTypeParametersNamesLookups: true,
|
|
54054
|
+
typeParameterNames: void 0,
|
|
54055
|
+
typeParameterNamesByText: void 0,
|
|
54056
|
+
typeParameterNamesByTextNextNameCount: void 0
|
|
54084
54057
|
};
|
|
54085
54058
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
54086
54059
|
const resultingNode = cb(context);
|
|
@@ -55075,22 +55048,22 @@ function createTypeChecker(host) {
|
|
|
55075
55048
|
}
|
|
55076
55049
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
55077
55050
|
var _a;
|
|
55078
|
-
const flags = context.flags;
|
|
55079
|
-
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
55080
|
-
context.approximateLength += 3;
|
|
55081
55051
|
let typeParameters;
|
|
55082
55052
|
let typeArguments;
|
|
55083
|
-
if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
|
|
55084
|
-
typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
|
|
55085
|
-
} else {
|
|
55086
|
-
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
|
|
55087
|
-
}
|
|
55088
55053
|
const expandedParams = getExpandedParameters(
|
|
55089
55054
|
signature,
|
|
55090
55055
|
/*skipUnionExpanding*/
|
|
55091
55056
|
true
|
|
55092
55057
|
)[0];
|
|
55093
|
-
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters);
|
|
55058
|
+
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters);
|
|
55059
|
+
context.approximateLength += 3;
|
|
55060
|
+
if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
|
|
55061
|
+
typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
|
|
55062
|
+
} else {
|
|
55063
|
+
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
|
|
55064
|
+
}
|
|
55065
|
+
const flags = context.flags;
|
|
55066
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
55094
55067
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */));
|
|
55095
55068
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
55096
55069
|
if (thisParameter) {
|
|
@@ -55188,15 +55161,14 @@ function createTypeChecker(host) {
|
|
|
55188
55161
|
return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).typeParameters : isConditionalTypeNode(node) ? getInferTypeParameters(node) : [getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))];
|
|
55189
55162
|
}
|
|
55190
55163
|
function getParametersInScope(node) {
|
|
55191
|
-
return isFunctionLike(node) || isJSDocSignature(node) ?
|
|
55192
|
-
|
|
55193
|
-
|
|
55194
|
-
|
|
55195
|
-
|
|
55196
|
-
|
|
55197
|
-
|
|
55198
|
-
|
|
55199
|
-
if (context.enclosingDeclaration && declaration && declaration !== context.enclosingDeclaration && !isInJSFile(declaration) && (some(expandedParams) || some(typeParameters))) {
|
|
55164
|
+
return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).parameters : void 0;
|
|
55165
|
+
}
|
|
55166
|
+
function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters) {
|
|
55167
|
+
const cleanupContext = cloneNodeBuilderContext(context);
|
|
55168
|
+
let cleanupParams;
|
|
55169
|
+
let cleanupTypeParams;
|
|
55170
|
+
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
55171
|
+
if (context.enclosingDeclaration && declaration) {
|
|
55200
55172
|
let pushFakeScope2 = function(kind, addAll) {
|
|
55201
55173
|
Debug.assert(context.enclosingDeclaration);
|
|
55202
55174
|
let existingFakeScope;
|
|
@@ -55208,39 +55180,45 @@ function createTypeChecker(host) {
|
|
|
55208
55180
|
Debug.assertOptionalNode(existingFakeScope, isBlock);
|
|
55209
55181
|
const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
|
|
55210
55182
|
let newLocals;
|
|
55183
|
+
let oldLocals;
|
|
55211
55184
|
addAll((name, symbol) => {
|
|
55212
|
-
if (
|
|
55213
|
-
|
|
55214
|
-
|
|
55185
|
+
if (existingFakeScope) {
|
|
55186
|
+
const oldSymbol = locals.get(name);
|
|
55187
|
+
if (!oldSymbol) {
|
|
55188
|
+
newLocals = append(newLocals, name);
|
|
55189
|
+
} else {
|
|
55190
|
+
oldLocals = append(oldLocals, { name, oldSymbol });
|
|
55191
|
+
}
|
|
55215
55192
|
}
|
|
55193
|
+
locals.set(name, symbol);
|
|
55216
55194
|
});
|
|
55217
|
-
if (!
|
|
55218
|
-
|
|
55219
|
-
function undo() {
|
|
55220
|
-
forEach(newLocals, (s) => locals.delete(s));
|
|
55221
|
-
oldCleanup == null ? void 0 : oldCleanup();
|
|
55222
|
-
}
|
|
55223
|
-
if (existingFakeScope) {
|
|
55224
|
-
cleanup = undo;
|
|
55225
|
-
} else {
|
|
55226
|
-
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
55195
|
+
if (!existingFakeScope) {
|
|
55196
|
+
const fakeScope = factory.createBlock(emptyArray);
|
|
55227
55197
|
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind;
|
|
55228
55198
|
fakeScope.locals = locals;
|
|
55229
|
-
|
|
55230
|
-
setParent(fakeScope, saveEnclosingDeclaration);
|
|
55199
|
+
setParent(fakeScope, context.enclosingDeclaration);
|
|
55231
55200
|
context.enclosingDeclaration = fakeScope;
|
|
55232
|
-
|
|
55233
|
-
|
|
55234
|
-
|
|
55201
|
+
} else {
|
|
55202
|
+
return function undo() {
|
|
55203
|
+
forEach(newLocals, (s) => locals.delete(s));
|
|
55204
|
+
forEach(oldLocals, (s) => locals.set(s.name, s.oldSymbol));
|
|
55235
55205
|
};
|
|
55236
55206
|
}
|
|
55237
55207
|
};
|
|
55238
55208
|
var pushFakeScope = pushFakeScope2;
|
|
55239
|
-
pushFakeScope2(
|
|
55209
|
+
cleanupParams = !some(expandedParams) ? void 0 : pushFakeScope2(
|
|
55240
55210
|
"params",
|
|
55241
55211
|
(add) => {
|
|
55242
|
-
|
|
55243
|
-
|
|
55212
|
+
if (!expandedParams) return;
|
|
55213
|
+
for (let pIndex = 0; pIndex < expandedParams.length; pIndex++) {
|
|
55214
|
+
const param = expandedParams[pIndex];
|
|
55215
|
+
const originalParam = originalParameters == null ? void 0 : originalParameters[pIndex];
|
|
55216
|
+
if (originalParameters && originalParam !== param) {
|
|
55217
|
+
add(param.escapedName, unknownSymbol);
|
|
55218
|
+
if (originalParam) {
|
|
55219
|
+
add(originalParam.escapedName, unknownSymbol);
|
|
55220
|
+
}
|
|
55221
|
+
} else if (!forEach(param.declarations, (d) => {
|
|
55244
55222
|
if (isParameter(d) && isBindingPattern(d.name)) {
|
|
55245
55223
|
bindPattern(d.name);
|
|
55246
55224
|
return true;
|
|
@@ -55271,8 +55249,8 @@ function createTypeChecker(host) {
|
|
|
55271
55249
|
}
|
|
55272
55250
|
}
|
|
55273
55251
|
);
|
|
55274
|
-
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
55275
|
-
pushFakeScope2(
|
|
55252
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && some(typeParameters)) {
|
|
55253
|
+
cleanupTypeParams = pushFakeScope2(
|
|
55276
55254
|
"typeParams",
|
|
55277
55255
|
(add) => {
|
|
55278
55256
|
for (const typeParam of typeParameters ?? emptyArray) {
|
|
@@ -55282,8 +55260,13 @@ function createTypeChecker(host) {
|
|
|
55282
55260
|
}
|
|
55283
55261
|
);
|
|
55284
55262
|
}
|
|
55285
|
-
return cleanup;
|
|
55286
55263
|
}
|
|
55264
|
+
return () => {
|
|
55265
|
+
cleanupParams == null ? void 0 : cleanupParams();
|
|
55266
|
+
cleanupTypeParams == null ? void 0 : cleanupTypeParams();
|
|
55267
|
+
cleanupContext();
|
|
55268
|
+
context.enclosingDeclaration = oldEnclosingDecl;
|
|
55269
|
+
};
|
|
55287
55270
|
}
|
|
55288
55271
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
55289
55272
|
if (signature.thisParameter) {
|
|
@@ -55501,7 +55484,11 @@ function createTypeChecker(host) {
|
|
|
55501
55484
|
if ((_a = context.typeParameterSymbolList) == null ? void 0 : _a.has(symbolId)) {
|
|
55502
55485
|
return void 0;
|
|
55503
55486
|
}
|
|
55504
|
-
|
|
55487
|
+
if (context.mustCreateTypeParameterSymbolList) {
|
|
55488
|
+
context.mustCreateTypeParameterSymbolList = false;
|
|
55489
|
+
context.typeParameterSymbolList = new Set(context.typeParameterSymbolList);
|
|
55490
|
+
}
|
|
55491
|
+
context.typeParameterSymbolList.add(symbolId);
|
|
55505
55492
|
let typeParameterNodes;
|
|
55506
55493
|
if (context.flags & 512 /* WriteTypeParametersInQualifiedName */ && index < chain.length - 1) {
|
|
55507
55494
|
const parentSymbol = symbol;
|
|
@@ -55762,9 +55749,15 @@ function createTypeChecker(host) {
|
|
|
55762
55749
|
result = factory.createIdentifier(text);
|
|
55763
55750
|
setIdentifierTypeArguments(result, typeArguments);
|
|
55764
55751
|
}
|
|
55765
|
-
|
|
55766
|
-
|
|
55767
|
-
|
|
55752
|
+
if (context.mustCreateTypeParametersNamesLookups) {
|
|
55753
|
+
context.mustCreateTypeParametersNamesLookups = false;
|
|
55754
|
+
context.typeParameterNames = new Map(context.typeParameterNames);
|
|
55755
|
+
context.typeParameterNamesByTextNextNameCount = new Map(context.typeParameterNamesByTextNextNameCount);
|
|
55756
|
+
context.typeParameterNamesByText = new Set(context.typeParameterNamesByText);
|
|
55757
|
+
}
|
|
55758
|
+
context.typeParameterNamesByTextNextNameCount.set(rawtext, i);
|
|
55759
|
+
context.typeParameterNames.set(getTypeId(type), result);
|
|
55760
|
+
context.typeParameterNamesByText.add(text);
|
|
55768
55761
|
}
|
|
55769
55762
|
return result;
|
|
55770
55763
|
}
|
|
@@ -55886,21 +55879,22 @@ function createTypeChecker(host) {
|
|
|
55886
55879
|
}
|
|
55887
55880
|
}
|
|
55888
55881
|
function cloneNodeBuilderContext(context) {
|
|
55889
|
-
const
|
|
55890
|
-
|
|
55891
|
-
|
|
55892
|
-
|
|
55893
|
-
|
|
55894
|
-
|
|
55895
|
-
|
|
55896
|
-
|
|
55897
|
-
|
|
55898
|
-
|
|
55899
|
-
|
|
55900
|
-
|
|
55901
|
-
|
|
55902
|
-
|
|
55903
|
-
|
|
55882
|
+
const oldMustCreateTypeParameterSymbolList = context.mustCreateTypeParameterSymbolList;
|
|
55883
|
+
const oldMustCreateTypeParametersNamesLookups = context.mustCreateTypeParametersNamesLookups;
|
|
55884
|
+
context.mustCreateTypeParameterSymbolList = true;
|
|
55885
|
+
context.mustCreateTypeParametersNamesLookups = true;
|
|
55886
|
+
const oldTypeParameterNames = context.typeParameterNames;
|
|
55887
|
+
const oldTypeParameterNamesByText = context.typeParameterNamesByText;
|
|
55888
|
+
const oldTypeParameterNamesByTextNextNameCount = context.typeParameterNamesByTextNextNameCount;
|
|
55889
|
+
const oldTypeParameterSymbolList = context.typeParameterSymbolList;
|
|
55890
|
+
return () => {
|
|
55891
|
+
context.typeParameterNames = oldTypeParameterNames;
|
|
55892
|
+
context.typeParameterNamesByText = oldTypeParameterNamesByText;
|
|
55893
|
+
context.typeParameterNamesByTextNextNameCount = oldTypeParameterNamesByTextNextNameCount;
|
|
55894
|
+
context.typeParameterSymbolList = oldTypeParameterSymbolList;
|
|
55895
|
+
context.mustCreateTypeParameterSymbolList = oldMustCreateTypeParameterSymbolList;
|
|
55896
|
+
context.mustCreateTypeParametersNamesLookups = oldMustCreateTypeParametersNamesLookups;
|
|
55897
|
+
};
|
|
55904
55898
|
}
|
|
55905
55899
|
function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
|
|
55906
55900
|
return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
|
|
@@ -56033,13 +56027,34 @@ function createTypeChecker(host) {
|
|
|
56033
56027
|
/*dontResolveAlias*/
|
|
56034
56028
|
true
|
|
56035
56029
|
);
|
|
56030
|
+
if (context.enclosingDeclaration && (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration || !findAncestor(node, (n) => n === context.enclosingDeclaration)) && !(sym && sym.flags & 262144 /* TypeParameter */)) {
|
|
56031
|
+
sym = getExportSymbolOfValueSymbolIfExported(sym);
|
|
56032
|
+
const symAtLocation = resolveEntityName(
|
|
56033
|
+
leftmost,
|
|
56034
|
+
meaning,
|
|
56035
|
+
/*ignoreErrors*/
|
|
56036
|
+
true,
|
|
56037
|
+
/*dontResolveAlias*/
|
|
56038
|
+
true,
|
|
56039
|
+
context.enclosingDeclaration
|
|
56040
|
+
);
|
|
56041
|
+
if (
|
|
56042
|
+
// Check for unusable parameters symbols
|
|
56043
|
+
symAtLocation === unknownSymbol || // If the symbol is not found, but was not found in the original scope either we probably have an error, don't reuse the node
|
|
56044
|
+
symAtLocation === void 0 && sym !== void 0 || // If the symbol is found both in declaration scope and in current scope then it shoudl point to the same reference
|
|
56045
|
+
symAtLocation && sym && !getSymbolIfSameReference(getExportSymbolOfValueSymbolIfExported(symAtLocation), sym)
|
|
56046
|
+
) {
|
|
56047
|
+
introducesError = true;
|
|
56048
|
+
return { introducesError, node, sym };
|
|
56049
|
+
}
|
|
56050
|
+
}
|
|
56036
56051
|
if (sym) {
|
|
56037
56052
|
if (sym.flags & 1 /* FunctionScopedVariable */ && sym.valueDeclaration) {
|
|
56038
|
-
if (isPartOfParameterDeclaration(sym.valueDeclaration)) {
|
|
56053
|
+
if (isPartOfParameterDeclaration(sym.valueDeclaration) || isJSDocParameterTag(sym.valueDeclaration)) {
|
|
56039
56054
|
return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
|
|
56040
56055
|
}
|
|
56041
56056
|
}
|
|
56042
|
-
if (!(sym.flags & 262144 /* TypeParameter */) && // Type parameters are visible in the
|
|
56057
|
+
if (!(sym.flags & 262144 /* TypeParameter */) && // Type parameters are visible in the current context if they are are resolvable
|
|
56043
56058
|
!isDeclarationName(node) && isSymbolAccessible(
|
|
56044
56059
|
sym,
|
|
56045
56060
|
context.enclosingDeclaration,
|
|
@@ -56090,14 +56105,7 @@ function createTypeChecker(host) {
|
|
|
56090
56105
|
return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
|
|
56091
56106
|
}
|
|
56092
56107
|
function onEnterNewScope(node) {
|
|
56093
|
-
|
|
56094
|
-
context = cloneNodeBuilderContext(context);
|
|
56095
|
-
const cleanup = enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
56096
|
-
return onExitNewScope;
|
|
56097
|
-
function onExitNewScope() {
|
|
56098
|
-
cleanup == null ? void 0 : cleanup();
|
|
56099
|
-
context = oldContex;
|
|
56100
|
-
}
|
|
56108
|
+
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
56101
56109
|
}
|
|
56102
56110
|
function visitExistingNodeTreeSymbolsWorker(node) {
|
|
56103
56111
|
if (isJSDocAllType(node) || node.kind === 319 /* JSDocNamepathType */) {
|
|
@@ -56547,17 +56555,9 @@ function createTypeChecker(host) {
|
|
|
56547
56555
|
visitedSymbols.add(getSymbolId(visitedSym));
|
|
56548
56556
|
const skipMembershipCheck = !isPrivate;
|
|
56549
56557
|
if (skipMembershipCheck || !!length(symbol.declarations) && some(symbol.declarations, (d) => !!findAncestor(d, (n) => n === enclosingDeclaration))) {
|
|
56550
|
-
const
|
|
56551
|
-
context = cloneNodeBuilderContext(context);
|
|
56558
|
+
const scopeCleanup = cloneNodeBuilderContext(context);
|
|
56552
56559
|
serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
|
|
56553
|
-
|
|
56554
|
-
oldcontext.reportedDiagnostic = context.reportedDiagnostic;
|
|
56555
|
-
}
|
|
56556
|
-
if (context.trackedSymbols) {
|
|
56557
|
-
if (!oldContext.trackedSymbols) oldContext.trackedSymbols = context.trackedSymbols;
|
|
56558
|
-
else Debug.assert(context.trackedSymbols === oldContext.trackedSymbols);
|
|
56559
|
-
}
|
|
56560
|
-
context = oldContext;
|
|
56560
|
+
scopeCleanup();
|
|
56561
56561
|
}
|
|
56562
56562
|
}
|
|
56563
56563
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias, escapedSymbolName = symbol.escapedName) {
|
|
@@ -58124,8 +58124,6 @@ function createTypeChecker(host) {
|
|
|
58124
58124
|
switch (propertyName) {
|
|
58125
58125
|
case 0 /* Type */:
|
|
58126
58126
|
return !!getSymbolLinks(target).type;
|
|
58127
|
-
case 5 /* EnumTagType */:
|
|
58128
|
-
return !!getNodeLinks(target).resolvedEnumType;
|
|
58129
58127
|
case 2 /* DeclaredType */:
|
|
58130
58128
|
return !!getSymbolLinks(target).declaredType;
|
|
58131
58129
|
case 1 /* ResolvedBaseConstructorType */:
|
|
@@ -58134,13 +58132,13 @@ function createTypeChecker(host) {
|
|
|
58134
58132
|
return !!target.resolvedReturnType;
|
|
58135
58133
|
case 4 /* ImmediateBaseConstraint */:
|
|
58136
58134
|
return !!target.immediateBaseConstraint;
|
|
58137
|
-
case
|
|
58135
|
+
case 5 /* ResolvedTypeArguments */:
|
|
58138
58136
|
return !!target.resolvedTypeArguments;
|
|
58139
|
-
case
|
|
58137
|
+
case 6 /* ResolvedBaseTypes */:
|
|
58140
58138
|
return !!target.baseTypesResolved;
|
|
58141
|
-
case
|
|
58139
|
+
case 7 /* WriteType */:
|
|
58142
58140
|
return !!getSymbolLinks(target).writeType;
|
|
58143
|
-
case
|
|
58141
|
+
case 8 /* ParameterInitializerContainsUndefined */:
|
|
58144
58142
|
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
58145
58143
|
}
|
|
58146
58144
|
return Debug.assertNever(propertyName);
|
|
@@ -59159,7 +59157,7 @@ function createTypeChecker(host) {
|
|
|
59159
59157
|
function getWriteTypeOfAccessors(symbol) {
|
|
59160
59158
|
const links = getSymbolLinks(symbol);
|
|
59161
59159
|
if (!links.writeType) {
|
|
59162
|
-
if (!pushTypeResolution(symbol,
|
|
59160
|
+
if (!pushTypeResolution(symbol, 7 /* WriteType */)) {
|
|
59163
59161
|
return errorType;
|
|
59164
59162
|
}
|
|
59165
59163
|
const setter = getDeclarationOfKind(symbol, 178 /* SetAccessor */) ?? tryCast(getDeclarationOfKind(symbol, 172 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration);
|
|
@@ -59569,7 +59567,7 @@ function createTypeChecker(host) {
|
|
|
59569
59567
|
}
|
|
59570
59568
|
function getBaseTypes(type) {
|
|
59571
59569
|
if (!type.baseTypesResolved) {
|
|
59572
|
-
if (pushTypeResolution(type,
|
|
59570
|
+
if (pushTypeResolution(type, 6 /* ResolvedBaseTypes */)) {
|
|
59573
59571
|
if (type.objectFlags & 8 /* Tuple */) {
|
|
59574
59572
|
type.resolvedBaseTypes = [getTupleBaseType(type)];
|
|
59575
59573
|
} else if (type.symbol.flags & (32 /* Class */ | 64 /* Interface */)) {
|
|
@@ -62464,7 +62462,7 @@ function createTypeChecker(host) {
|
|
|
62464
62462
|
function getTypeArguments(type) {
|
|
62465
62463
|
var _a, _b;
|
|
62466
62464
|
if (!type.resolvedTypeArguments) {
|
|
62467
|
-
if (!pushTypeResolution(type,
|
|
62465
|
+
if (!pushTypeResolution(type, 5 /* ResolvedTypeArguments */)) {
|
|
62468
62466
|
return ((_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
|
|
62469
62467
|
}
|
|
62470
62468
|
const node = type.node;
|
|
@@ -73663,7 +73661,7 @@ function createTypeChecker(host) {
|
|
|
73663
73661
|
function parameterInitializerContainsUndefined(declaration) {
|
|
73664
73662
|
const links = getNodeLinks(declaration);
|
|
73665
73663
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
73666
|
-
if (!pushTypeResolution(declaration,
|
|
73664
|
+
if (!pushTypeResolution(declaration, 8 /* ParameterInitializerContainsUndefined */)) {
|
|
73667
73665
|
reportCircularityError(declaration.symbol);
|
|
73668
73666
|
return true;
|
|
73669
73667
|
}
|
|
@@ -73717,6 +73715,248 @@ function createTypeChecker(host) {
|
|
|
73717
73715
|
return false;
|
|
73718
73716
|
});
|
|
73719
73717
|
}
|
|
73718
|
+
function markLinkedReferences(location, hint, propSymbol, parentType) {
|
|
73719
|
+
if (!canCollectSymbolAliasAccessabilityData) {
|
|
73720
|
+
return;
|
|
73721
|
+
}
|
|
73722
|
+
if (location.flags & 33554432 /* Ambient */) {
|
|
73723
|
+
return;
|
|
73724
|
+
}
|
|
73725
|
+
switch (hint) {
|
|
73726
|
+
case 1 /* Identifier */:
|
|
73727
|
+
return markIdentifierAliasReferenced(location);
|
|
73728
|
+
case 2 /* Property */:
|
|
73729
|
+
return markPropertyAliasReferenced(location, propSymbol, parentType);
|
|
73730
|
+
case 3 /* ExportAssignment */:
|
|
73731
|
+
return markExportAssignmentAliasReferenced(location);
|
|
73732
|
+
case 4 /* Jsx */:
|
|
73733
|
+
return markJsxAliasReferenced(location);
|
|
73734
|
+
case 5 /* AsyncFunction */:
|
|
73735
|
+
return markAsyncFunctionAliasReferenced(location);
|
|
73736
|
+
case 6 /* ExportImportEquals */:
|
|
73737
|
+
return markImportEqualsAliasReferenced(location);
|
|
73738
|
+
case 7 /* ExportSpecifier */:
|
|
73739
|
+
return markExportSpecifierAliasReferenced(location);
|
|
73740
|
+
case 8 /* Decorator */:
|
|
73741
|
+
return markDecoratorAliasReferenced(location);
|
|
73742
|
+
case 0 /* Unspecified */: {
|
|
73743
|
+
if (isIdentifier(location) && (isExpressionNode(location) || isShorthandPropertyAssignment(location.parent) || isImportEqualsDeclaration(location.parent) && location.parent.moduleReference === location) && shouldMarkIdentifierAliasReferenced(location)) {
|
|
73744
|
+
if (isPropertyAccessOrQualifiedName(location.parent)) {
|
|
73745
|
+
const left = isPropertyAccessExpression(location.parent) ? location.parent.expression : location.parent.left;
|
|
73746
|
+
if (left !== location) return;
|
|
73747
|
+
}
|
|
73748
|
+
markIdentifierAliasReferenced(location);
|
|
73749
|
+
return;
|
|
73750
|
+
}
|
|
73751
|
+
if (isPropertyAccessOrQualifiedName(location)) {
|
|
73752
|
+
let topProp = location;
|
|
73753
|
+
while (isPropertyAccessOrQualifiedName(topProp)) {
|
|
73754
|
+
if (isPartOfTypeNode(topProp)) return;
|
|
73755
|
+
topProp = topProp.parent;
|
|
73756
|
+
}
|
|
73757
|
+
return markPropertyAliasReferenced(location);
|
|
73758
|
+
}
|
|
73759
|
+
if (isExportAssignment(location)) {
|
|
73760
|
+
return markExportAssignmentAliasReferenced(location);
|
|
73761
|
+
}
|
|
73762
|
+
if (isJsxOpeningLikeElement(location) || isJsxOpeningFragment(location)) {
|
|
73763
|
+
return markJsxAliasReferenced(location);
|
|
73764
|
+
}
|
|
73765
|
+
if (isFunctionLikeDeclaration(location) || isMethodSignature(location)) {
|
|
73766
|
+
return markAsyncFunctionAliasReferenced(location);
|
|
73767
|
+
}
|
|
73768
|
+
if (isImportEqualsDeclaration(location)) {
|
|
73769
|
+
if (isInternalModuleImportEqualsDeclaration(location) || checkExternalImportOrExportDeclaration(location)) {
|
|
73770
|
+
return markImportEqualsAliasReferenced(location);
|
|
73771
|
+
}
|
|
73772
|
+
return;
|
|
73773
|
+
}
|
|
73774
|
+
if (isExportSpecifier(location)) {
|
|
73775
|
+
return markExportSpecifierAliasReferenced(location);
|
|
73776
|
+
}
|
|
73777
|
+
if (!compilerOptions.emitDecoratorMetadata) {
|
|
73778
|
+
return;
|
|
73779
|
+
}
|
|
73780
|
+
if (!canHaveDecorators(location) || !hasDecorators(location) || !location.modifiers || !nodeCanBeDecorated(legacyDecorators, location, location.parent, location.parent.parent)) {
|
|
73781
|
+
return;
|
|
73782
|
+
}
|
|
73783
|
+
return markDecoratorAliasReferenced(location);
|
|
73784
|
+
}
|
|
73785
|
+
default:
|
|
73786
|
+
Debug.assertNever(hint, `Unhandled reference hint: ${hint}`);
|
|
73787
|
+
}
|
|
73788
|
+
}
|
|
73789
|
+
function markIdentifierAliasReferenced(location) {
|
|
73790
|
+
const symbol = getResolvedSymbol(location);
|
|
73791
|
+
if (symbol && symbol !== argumentsSymbol && symbol !== unknownSymbol && !isThisInTypeQuery(location)) {
|
|
73792
|
+
markAliasReferenced(symbol, location);
|
|
73793
|
+
}
|
|
73794
|
+
}
|
|
73795
|
+
function markPropertyAliasReferenced(location, propSymbol, parentType) {
|
|
73796
|
+
const left = isPropertyAccessExpression(location) ? location.expression : location.left;
|
|
73797
|
+
if (isThisIdentifier(left) || !isIdentifier(left)) {
|
|
73798
|
+
return;
|
|
73799
|
+
}
|
|
73800
|
+
const parentSymbol = getResolvedSymbol(left);
|
|
73801
|
+
if (!parentSymbol || parentSymbol === unknownSymbol) {
|
|
73802
|
+
return;
|
|
73803
|
+
}
|
|
73804
|
+
if (getIsolatedModules(compilerOptions) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location)) {
|
|
73805
|
+
markAliasReferenced(parentSymbol, location);
|
|
73806
|
+
return;
|
|
73807
|
+
}
|
|
73808
|
+
const leftType = parentType || checkExpressionCached(left);
|
|
73809
|
+
if (isTypeAny(leftType) || leftType === silentNeverType) {
|
|
73810
|
+
markAliasReferenced(parentSymbol, location);
|
|
73811
|
+
return;
|
|
73812
|
+
}
|
|
73813
|
+
let prop = propSymbol;
|
|
73814
|
+
if (!prop && !parentType) {
|
|
73815
|
+
const right = isPropertyAccessExpression(location) ? location.name : location.right;
|
|
73816
|
+
const lexicallyScopedSymbol = isPrivateIdentifier(right) && lookupSymbolForPrivateIdentifierDeclaration(right.escapedText, right);
|
|
73817
|
+
const assignmentKind = getAssignmentTargetKind(location);
|
|
73818
|
+
const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(location) ? getWidenedType(leftType) : leftType);
|
|
73819
|
+
prop = isPrivateIdentifier(right) ? lexicallyScopedSymbol && getPrivateIdentifierPropertyOfType(apparentType, lexicallyScopedSymbol) || void 0 : getPropertyOfType(apparentType, right.escapedText);
|
|
73820
|
+
}
|
|
73821
|
+
if (!(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && location.parent.kind === 306 /* EnumMember */))) {
|
|
73822
|
+
markAliasReferenced(parentSymbol, location);
|
|
73823
|
+
}
|
|
73824
|
+
return;
|
|
73825
|
+
}
|
|
73826
|
+
function markExportAssignmentAliasReferenced(location) {
|
|
73827
|
+
if (isIdentifier(location.expression)) {
|
|
73828
|
+
const id = location.expression;
|
|
73829
|
+
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
73830
|
+
id,
|
|
73831
|
+
-1 /* All */,
|
|
73832
|
+
/*ignoreErrors*/
|
|
73833
|
+
true,
|
|
73834
|
+
/*dontResolveAlias*/
|
|
73835
|
+
true,
|
|
73836
|
+
location
|
|
73837
|
+
));
|
|
73838
|
+
if (sym) {
|
|
73839
|
+
markAliasReferenced(sym, id);
|
|
73840
|
+
}
|
|
73841
|
+
}
|
|
73842
|
+
}
|
|
73843
|
+
function markJsxAliasReferenced(node) {
|
|
73844
|
+
if (!getJsxNamespaceContainerForImplicitImport(node)) {
|
|
73845
|
+
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
|
|
73846
|
+
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
73847
|
+
const jsxFactoryLocation = isJsxOpeningLikeElement(node) ? node.tagName : node;
|
|
73848
|
+
let jsxFactorySym;
|
|
73849
|
+
if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
|
|
73850
|
+
jsxFactorySym = resolveName(
|
|
73851
|
+
jsxFactoryLocation,
|
|
73852
|
+
jsxFactoryNamespace,
|
|
73853
|
+
111551 /* Value */,
|
|
73854
|
+
jsxFactoryRefErr,
|
|
73855
|
+
/*isUse*/
|
|
73856
|
+
true
|
|
73857
|
+
);
|
|
73858
|
+
}
|
|
73859
|
+
if (jsxFactorySym) {
|
|
73860
|
+
jsxFactorySym.isReferenced = -1 /* All */;
|
|
73861
|
+
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
73862
|
+
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
73863
|
+
}
|
|
73864
|
+
}
|
|
73865
|
+
if (isJsxOpeningFragment(node)) {
|
|
73866
|
+
const file = getSourceFileOfNode(node);
|
|
73867
|
+
const localJsxNamespace = getLocalJsxNamespace(file);
|
|
73868
|
+
if (localJsxNamespace) {
|
|
73869
|
+
resolveName(
|
|
73870
|
+
jsxFactoryLocation,
|
|
73871
|
+
localJsxNamespace,
|
|
73872
|
+
111551 /* Value */,
|
|
73873
|
+
jsxFactoryRefErr,
|
|
73874
|
+
/*isUse*/
|
|
73875
|
+
true
|
|
73876
|
+
);
|
|
73877
|
+
}
|
|
73878
|
+
}
|
|
73879
|
+
}
|
|
73880
|
+
return;
|
|
73881
|
+
}
|
|
73882
|
+
function markAsyncFunctionAliasReferenced(location) {
|
|
73883
|
+
if (languageVersion < 2 /* ES2015 */) {
|
|
73884
|
+
if (getFunctionFlags(location) & 2 /* Async */) {
|
|
73885
|
+
const returnTypeNode = getEffectiveReturnTypeNode(location);
|
|
73886
|
+
markTypeNodeAsReferenced(returnTypeNode);
|
|
73887
|
+
}
|
|
73888
|
+
}
|
|
73889
|
+
}
|
|
73890
|
+
function markImportEqualsAliasReferenced(location) {
|
|
73891
|
+
if (hasSyntacticModifier(location, 32 /* Export */)) {
|
|
73892
|
+
markExportAsReferenced(location);
|
|
73893
|
+
}
|
|
73894
|
+
}
|
|
73895
|
+
function markExportSpecifierAliasReferenced(location) {
|
|
73896
|
+
if (!location.parent.parent.moduleSpecifier && !location.isTypeOnly && !location.parent.parent.isTypeOnly) {
|
|
73897
|
+
const exportedName = location.propertyName || location.name;
|
|
73898
|
+
const symbol = resolveName(
|
|
73899
|
+
exportedName,
|
|
73900
|
+
exportedName.escapedText,
|
|
73901
|
+
111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */,
|
|
73902
|
+
/*nameNotFoundMessage*/
|
|
73903
|
+
void 0,
|
|
73904
|
+
/*isUse*/
|
|
73905
|
+
true
|
|
73906
|
+
);
|
|
73907
|
+
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
73908
|
+
} else {
|
|
73909
|
+
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
|
|
73910
|
+
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
|
|
73911
|
+
markExportAsReferenced(location);
|
|
73912
|
+
markIdentifierAliasReferenced(location.propertyName || location.name);
|
|
73913
|
+
}
|
|
73914
|
+
}
|
|
73915
|
+
return;
|
|
73916
|
+
}
|
|
73917
|
+
}
|
|
73918
|
+
function markDecoratorAliasReferenced(node) {
|
|
73919
|
+
if (compilerOptions.emitDecoratorMetadata) {
|
|
73920
|
+
const firstDecorator = find(node.modifiers, isDecorator);
|
|
73921
|
+
if (!firstDecorator) {
|
|
73922
|
+
return;
|
|
73923
|
+
}
|
|
73924
|
+
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
|
|
73925
|
+
switch (node.kind) {
|
|
73926
|
+
case 263 /* ClassDeclaration */:
|
|
73927
|
+
const constructor = getFirstConstructorWithBody(node);
|
|
73928
|
+
if (constructor) {
|
|
73929
|
+
for (const parameter of constructor.parameters) {
|
|
73930
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
73931
|
+
}
|
|
73932
|
+
}
|
|
73933
|
+
break;
|
|
73934
|
+
case 177 /* GetAccessor */:
|
|
73935
|
+
case 178 /* SetAccessor */:
|
|
73936
|
+
const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
|
|
73937
|
+
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
|
|
73938
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
|
|
73939
|
+
break;
|
|
73940
|
+
case 174 /* MethodDeclaration */:
|
|
73941
|
+
for (const parameter of node.parameters) {
|
|
73942
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
73943
|
+
}
|
|
73944
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
|
|
73945
|
+
break;
|
|
73946
|
+
case 172 /* PropertyDeclaration */:
|
|
73947
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
|
|
73948
|
+
break;
|
|
73949
|
+
case 169 /* Parameter */:
|
|
73950
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
|
|
73951
|
+
const containingSignature = node.parent;
|
|
73952
|
+
for (const parameter of containingSignature.parameters) {
|
|
73953
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
73954
|
+
}
|
|
73955
|
+
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
|
|
73956
|
+
break;
|
|
73957
|
+
}
|
|
73958
|
+
}
|
|
73959
|
+
}
|
|
73720
73960
|
function markAliasReferenced(symbol, location) {
|
|
73721
73961
|
if (!canCollectSymbolAliasAccessabilityData) {
|
|
73722
73962
|
return;
|
|
@@ -73738,6 +73978,77 @@ function createTypeChecker(host) {
|
|
|
73738
73978
|
}
|
|
73739
73979
|
}
|
|
73740
73980
|
}
|
|
73981
|
+
function markAliasSymbolAsReferenced(symbol) {
|
|
73982
|
+
Debug.assert(canCollectSymbolAliasAccessabilityData);
|
|
73983
|
+
const links = getSymbolLinks(symbol);
|
|
73984
|
+
if (!links.referenced) {
|
|
73985
|
+
links.referenced = true;
|
|
73986
|
+
const node = getDeclarationOfAliasSymbol(symbol);
|
|
73987
|
+
if (!node) return Debug.fail();
|
|
73988
|
+
if (isInternalModuleImportEqualsDeclaration(node)) {
|
|
73989
|
+
if (getSymbolFlags(resolveSymbol(symbol)) & 111551 /* Value */) {
|
|
73990
|
+
const left = getFirstIdentifier(node.moduleReference);
|
|
73991
|
+
markIdentifierAliasReferenced(left);
|
|
73992
|
+
}
|
|
73993
|
+
}
|
|
73994
|
+
}
|
|
73995
|
+
}
|
|
73996
|
+
function markExportAsReferenced(node) {
|
|
73997
|
+
const symbol = getSymbolOfDeclaration(node);
|
|
73998
|
+
const target = resolveAlias(symbol);
|
|
73999
|
+
if (target) {
|
|
74000
|
+
const markAlias = target === unknownSymbol || getSymbolFlags(
|
|
74001
|
+
symbol,
|
|
74002
|
+
/*excludeTypeOnlyMeanings*/
|
|
74003
|
+
true
|
|
74004
|
+
) & 111551 /* Value */ && !isConstEnumOrConstEnumOnlyModule(target);
|
|
74005
|
+
if (markAlias) {
|
|
74006
|
+
markAliasSymbolAsReferenced(symbol);
|
|
74007
|
+
}
|
|
74008
|
+
}
|
|
74009
|
+
}
|
|
74010
|
+
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
74011
|
+
if (!typeName) return;
|
|
74012
|
+
const rootName = getFirstIdentifier(typeName);
|
|
74013
|
+
const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
|
|
74014
|
+
const rootSymbol = resolveName(
|
|
74015
|
+
rootName,
|
|
74016
|
+
rootName.escapedText,
|
|
74017
|
+
meaning,
|
|
74018
|
+
/*nameNotFoundMessage*/
|
|
74019
|
+
void 0,
|
|
74020
|
+
/*isUse*/
|
|
74021
|
+
true
|
|
74022
|
+
);
|
|
74023
|
+
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
74024
|
+
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
74025
|
+
markAliasSymbolAsReferenced(rootSymbol);
|
|
74026
|
+
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
74027
|
+
const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
74028
|
+
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
74029
|
+
if (aliasDeclaration) {
|
|
74030
|
+
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
74031
|
+
}
|
|
74032
|
+
}
|
|
74033
|
+
}
|
|
74034
|
+
}
|
|
74035
|
+
function markTypeNodeAsReferenced(node) {
|
|
74036
|
+
markEntityNameOrEntityExpressionAsReference(
|
|
74037
|
+
node && getEntityNameFromTypeNode(node),
|
|
74038
|
+
/*forDecoratorMetadata*/
|
|
74039
|
+
false
|
|
74040
|
+
);
|
|
74041
|
+
}
|
|
74042
|
+
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
74043
|
+
const entityName = getEntityNameForDecoratorMetadata(node);
|
|
74044
|
+
if (entityName && isEntityName(entityName)) {
|
|
74045
|
+
markEntityNameOrEntityExpressionAsReference(
|
|
74046
|
+
entityName,
|
|
74047
|
+
/*forDecoratorMetadata*/
|
|
74048
|
+
true
|
|
74049
|
+
);
|
|
74050
|
+
}
|
|
74051
|
+
}
|
|
73741
74052
|
function getNarrowedTypeOfSymbol(symbol, location, checkMode) {
|
|
73742
74053
|
var _a;
|
|
73743
74054
|
const type = getTypeOfSymbol(symbol, checkMode);
|
|
@@ -73833,7 +74144,7 @@ function createTypeChecker(host) {
|
|
|
73833
74144
|
return getTypeOfSymbol(symbol);
|
|
73834
74145
|
}
|
|
73835
74146
|
if (shouldMarkIdentifierAliasReferenced(node)) {
|
|
73836
|
-
|
|
74147
|
+
markLinkedReferences(node, 1 /* Identifier */);
|
|
73837
74148
|
}
|
|
73838
74149
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
73839
74150
|
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
@@ -76376,42 +76687,7 @@ function createTypeChecker(host) {
|
|
|
76376
76687
|
checkGrammarJsxElement(node);
|
|
76377
76688
|
}
|
|
76378
76689
|
checkJsxPreconditions(node);
|
|
76379
|
-
|
|
76380
|
-
const jsxFactoryRefErr = diagnostics && compilerOptions.jsx === 2 /* React */ ? Diagnostics.Cannot_find_name_0 : void 0;
|
|
76381
|
-
const jsxFactoryNamespace = getJsxNamespace(node);
|
|
76382
|
-
const jsxFactoryLocation = isNodeOpeningLikeElement ? node.tagName : node;
|
|
76383
|
-
let jsxFactorySym;
|
|
76384
|
-
if (!(isJsxOpeningFragment(node) && jsxFactoryNamespace === "null")) {
|
|
76385
|
-
jsxFactorySym = resolveName(
|
|
76386
|
-
jsxFactoryLocation,
|
|
76387
|
-
jsxFactoryNamespace,
|
|
76388
|
-
111551 /* Value */,
|
|
76389
|
-
jsxFactoryRefErr,
|
|
76390
|
-
/*isUse*/
|
|
76391
|
-
true
|
|
76392
|
-
);
|
|
76393
|
-
}
|
|
76394
|
-
if (jsxFactorySym) {
|
|
76395
|
-
jsxFactorySym.isReferenced = -1 /* All */;
|
|
76396
|
-
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
76397
|
-
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
76398
|
-
}
|
|
76399
|
-
}
|
|
76400
|
-
if (isJsxOpeningFragment(node)) {
|
|
76401
|
-
const file = getSourceFileOfNode(node);
|
|
76402
|
-
const localJsxNamespace = getLocalJsxNamespace(file);
|
|
76403
|
-
if (localJsxNamespace) {
|
|
76404
|
-
resolveName(
|
|
76405
|
-
jsxFactoryLocation,
|
|
76406
|
-
localJsxNamespace,
|
|
76407
|
-
111551 /* Value */,
|
|
76408
|
-
jsxFactoryRefErr,
|
|
76409
|
-
/*isUse*/
|
|
76410
|
-
true
|
|
76411
|
-
);
|
|
76412
|
-
}
|
|
76413
|
-
}
|
|
76414
|
-
}
|
|
76690
|
+
markLinkedReferences(node, 4 /* Jsx */);
|
|
76415
76691
|
if (isNodeOpeningLikeElement) {
|
|
76416
76692
|
const jsxOpeningLikeNode = node;
|
|
76417
76693
|
const sig = getResolvedSignature(jsxOpeningLikeNode);
|
|
@@ -76842,7 +77118,13 @@ function createTypeChecker(host) {
|
|
|
76842
77118
|
} else {
|
|
76843
77119
|
if (isAnyLike) {
|
|
76844
77120
|
if (isIdentifier(left) && parentSymbol) {
|
|
76845
|
-
|
|
77121
|
+
markLinkedReferences(
|
|
77122
|
+
node,
|
|
77123
|
+
2 /* Property */,
|
|
77124
|
+
/*propSymbol*/
|
|
77125
|
+
void 0,
|
|
77126
|
+
leftType
|
|
77127
|
+
);
|
|
76846
77128
|
}
|
|
76847
77129
|
return isErrorType(apparentType) ? errorType : apparentType;
|
|
76848
77130
|
}
|
|
@@ -76855,9 +77137,7 @@ function createTypeChecker(host) {
|
|
|
76855
77137
|
node.kind === 166 /* QualifiedName */
|
|
76856
77138
|
);
|
|
76857
77139
|
}
|
|
76858
|
-
|
|
76859
|
-
markAliasReferenced(parentSymbol, node);
|
|
76860
|
-
}
|
|
77140
|
+
markLinkedReferences(node, 2 /* Property */, prop, leftType);
|
|
76861
77141
|
let propType;
|
|
76862
77142
|
if (!prop) {
|
|
76863
77143
|
const indexInfo = !isPrivateIdentifier(right) && (assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) || isThisTypeParameter(leftType)) ? getApplicableIndexInfoForName(apparentType, right.escapedText) : void 0;
|
|
@@ -83790,7 +84070,7 @@ function createTypeChecker(host) {
|
|
|
83790
84070
|
return;
|
|
83791
84071
|
}
|
|
83792
84072
|
} else {
|
|
83793
|
-
|
|
84073
|
+
markLinkedReferences(node, 5 /* AsyncFunction */);
|
|
83794
84074
|
if (isErrorType(returnType)) {
|
|
83795
84075
|
return;
|
|
83796
84076
|
}
|
|
@@ -83974,48 +84254,6 @@ function createTypeChecker(host) {
|
|
|
83974
84254
|
voidType
|
|
83975
84255
|
);
|
|
83976
84256
|
}
|
|
83977
|
-
function markTypeNodeAsReferenced(node) {
|
|
83978
|
-
markEntityNameOrEntityExpressionAsReference(
|
|
83979
|
-
node && getEntityNameFromTypeNode(node),
|
|
83980
|
-
/*forDecoratorMetadata*/
|
|
83981
|
-
false
|
|
83982
|
-
);
|
|
83983
|
-
}
|
|
83984
|
-
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
83985
|
-
if (!typeName) return;
|
|
83986
|
-
const rootName = getFirstIdentifier(typeName);
|
|
83987
|
-
const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
|
|
83988
|
-
const rootSymbol = resolveName(
|
|
83989
|
-
rootName,
|
|
83990
|
-
rootName.escapedText,
|
|
83991
|
-
meaning,
|
|
83992
|
-
/*nameNotFoundMessage*/
|
|
83993
|
-
void 0,
|
|
83994
|
-
/*isUse*/
|
|
83995
|
-
true
|
|
83996
|
-
);
|
|
83997
|
-
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
83998
|
-
if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
83999
|
-
markAliasSymbolAsReferenced(rootSymbol);
|
|
84000
|
-
} else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) {
|
|
84001
|
-
const diag2 = error2(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
84002
|
-
const aliasDeclaration = find(rootSymbol.declarations || emptyArray, isAliasSymbolDeclaration2);
|
|
84003
|
-
if (aliasDeclaration) {
|
|
84004
|
-
addRelatedInfo(diag2, createDiagnosticForNode(aliasDeclaration, Diagnostics._0_was_imported_here, idText(rootName)));
|
|
84005
|
-
}
|
|
84006
|
-
}
|
|
84007
|
-
}
|
|
84008
|
-
}
|
|
84009
|
-
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
84010
|
-
const entityName = getEntityNameForDecoratorMetadata(node);
|
|
84011
|
-
if (entityName && isEntityName(entityName)) {
|
|
84012
|
-
markEntityNameOrEntityExpressionAsReference(
|
|
84013
|
-
entityName,
|
|
84014
|
-
/*forDecoratorMetadata*/
|
|
84015
|
-
true
|
|
84016
|
-
);
|
|
84017
|
-
}
|
|
84018
|
-
}
|
|
84019
84257
|
function getEntityNameForDecoratorMetadata(node) {
|
|
84020
84258
|
if (node) {
|
|
84021
84259
|
switch (node.kind) {
|
|
@@ -84095,42 +84333,7 @@ function createTypeChecker(host) {
|
|
|
84095
84333
|
}
|
|
84096
84334
|
}
|
|
84097
84335
|
}
|
|
84098
|
-
|
|
84099
|
-
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
|
|
84100
|
-
switch (node.kind) {
|
|
84101
|
-
case 263 /* ClassDeclaration */:
|
|
84102
|
-
const constructor = getFirstConstructorWithBody(node);
|
|
84103
|
-
if (constructor) {
|
|
84104
|
-
for (const parameter of constructor.parameters) {
|
|
84105
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
84106
|
-
}
|
|
84107
|
-
}
|
|
84108
|
-
break;
|
|
84109
|
-
case 177 /* GetAccessor */:
|
|
84110
|
-
case 178 /* SetAccessor */:
|
|
84111
|
-
const otherKind = node.kind === 177 /* GetAccessor */ ? 178 /* SetAccessor */ : 177 /* GetAccessor */;
|
|
84112
|
-
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind);
|
|
84113
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
|
|
84114
|
-
break;
|
|
84115
|
-
case 174 /* MethodDeclaration */:
|
|
84116
|
-
for (const parameter of node.parameters) {
|
|
84117
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
84118
|
-
}
|
|
84119
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node));
|
|
84120
|
-
break;
|
|
84121
|
-
case 172 /* PropertyDeclaration */:
|
|
84122
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node));
|
|
84123
|
-
break;
|
|
84124
|
-
case 169 /* Parameter */:
|
|
84125
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
|
|
84126
|
-
const containingSignature = node.parent;
|
|
84127
|
-
for (const parameter of containingSignature.parameters) {
|
|
84128
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
|
84129
|
-
}
|
|
84130
|
-
markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(containingSignature));
|
|
84131
|
-
break;
|
|
84132
|
-
}
|
|
84133
|
-
}
|
|
84336
|
+
markLinkedReferences(node, 8 /* Decorator */);
|
|
84134
84337
|
for (const modifier of node.modifiers) {
|
|
84135
84338
|
if (isDecorator(modifier)) {
|
|
84136
84339
|
checkDecorator(modifier);
|
|
@@ -87471,9 +87674,7 @@ function createTypeChecker(host) {
|
|
|
87471
87674
|
checkGrammarModifiers(node);
|
|
87472
87675
|
if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
|
|
87473
87676
|
checkImportBinding(node);
|
|
87474
|
-
|
|
87475
|
-
markExportAsReferenced(node);
|
|
87476
|
-
}
|
|
87677
|
+
markLinkedReferences(node, 6 /* ExportImportEquals */);
|
|
87477
87678
|
if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
|
|
87478
87679
|
const target = resolveAlias(getSymbolOfDeclaration(node));
|
|
87479
87680
|
if (target !== unknownSymbol) {
|
|
@@ -87571,13 +87772,7 @@ function createTypeChecker(host) {
|
|
|
87571
87772
|
if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
|
|
87572
87773
|
error2(exportedName, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, idText(exportedName));
|
|
87573
87774
|
} else {
|
|
87574
|
-
|
|
87575
|
-
markExportAsReferenced(node);
|
|
87576
|
-
}
|
|
87577
|
-
const target = symbol && (symbol.flags & 2097152 /* Alias */ ? resolveAlias(symbol) : symbol);
|
|
87578
|
-
if (!target || getSymbolFlags(target) & 111551 /* Value */) {
|
|
87579
|
-
checkExpressionCached(node.propertyName || node.name);
|
|
87580
|
-
}
|
|
87775
|
+
markLinkedReferences(node, 7 /* ExportSpecifier */);
|
|
87581
87776
|
}
|
|
87582
87777
|
} else {
|
|
87583
87778
|
if (getESModuleInterop(compilerOptions) && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) < 4 /* System */ && idText(node.propertyName || node.name) === "default") {
|
|
@@ -87619,8 +87814,8 @@ function createTypeChecker(host) {
|
|
|
87619
87814
|
node
|
|
87620
87815
|
));
|
|
87621
87816
|
if (sym) {
|
|
87817
|
+
markLinkedReferences(node, 3 /* ExportAssignment */);
|
|
87622
87818
|
const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(sym, 111551 /* Value */);
|
|
87623
|
-
markAliasReferenced(sym, id);
|
|
87624
87819
|
if (getSymbolFlags(sym) & 111551 /* Value */) {
|
|
87625
87820
|
checkExpressionCached(id);
|
|
87626
87821
|
if (!isIllegalExportDefaultInCJS && !(node.flags & 33554432 /* Ambient */) && compilerOptions.verbatimModuleSyntax && typeOnlyDeclaration) {
|
|
@@ -134426,12 +134621,12 @@ var CompletionTriggerKind = /* @__PURE__ */ ((CompletionTriggerKind2) => {
|
|
|
134426
134621
|
CompletionTriggerKind2[CompletionTriggerKind2["TriggerForIncompleteCompletions"] = 3] = "TriggerForIncompleteCompletions";
|
|
134427
134622
|
return CompletionTriggerKind2;
|
|
134428
134623
|
})(CompletionTriggerKind || {});
|
|
134429
|
-
var
|
|
134430
|
-
|
|
134431
|
-
|
|
134432
|
-
|
|
134433
|
-
return
|
|
134434
|
-
})(
|
|
134624
|
+
var InlayHintKind2 = /* @__PURE__ */ ((InlayHintKind3) => {
|
|
134625
|
+
InlayHintKind3["Type"] = "Type";
|
|
134626
|
+
InlayHintKind3["Parameter"] = "Parameter";
|
|
134627
|
+
InlayHintKind3["Enum"] = "Enum";
|
|
134628
|
+
return InlayHintKind3;
|
|
134629
|
+
})(InlayHintKind2 || {});
|
|
134435
134630
|
var HighlightSpanKind = /* @__PURE__ */ ((HighlightSpanKind2) => {
|
|
134436
134631
|
HighlightSpanKind2["none"] = "none";
|
|
134437
134632
|
HighlightSpanKind2["definition"] = "definition";
|
|
@@ -159995,7 +160190,7 @@ function createSignatureDeclarationFromSignature(kind, context, quotePreference,
|
|
|
159995
160190
|
}
|
|
159996
160191
|
let typeParameters = isJs ? void 0 : signatureDeclaration.typeParameters;
|
|
159997
160192
|
let parameters = signatureDeclaration.parameters;
|
|
159998
|
-
let type = isJs ? void 0 : signatureDeclaration.type;
|
|
160193
|
+
let type = isJs ? void 0 : getSynthesizedDeepClone(signatureDeclaration.type);
|
|
159999
160194
|
if (importAdder) {
|
|
160000
160195
|
if (typeParameters) {
|
|
160001
160196
|
const newTypeParameters = sameMap(typeParameters, (typeParameterDecl) => {
|
|
@@ -168820,7 +169015,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
168820
169015
|
}
|
|
168821
169016
|
if (searchOtherFilesOnly && every(symbol.declarations, (d) => d.getSourceFile().fileName === sourceFile.fileName)) return void 0;
|
|
168822
169017
|
const calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
|
|
168823
|
-
if (calledDeclaration && !(isJsxOpeningLikeElement(node.parent) &&
|
|
169018
|
+
if (calledDeclaration && !(isJsxOpeningLikeElement(node.parent) && isJsxConstructorLike(calledDeclaration))) {
|
|
168824
169019
|
const sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
|
|
168825
169020
|
if (typeChecker.getRootSymbols(symbol).some((s) => symbolMatchesSignature(s, calledDeclaration))) {
|
|
168826
169021
|
return [sigInfo];
|
|
@@ -169241,10 +169436,11 @@ function tryGetSignatureDeclaration(typeChecker, node) {
|
|
|
169241
169436
|
const signature = callLike && typeChecker.getResolvedSignature(callLike);
|
|
169242
169437
|
return tryCast(signature && signature.declaration, (d) => isFunctionLike(d) && !isFunctionTypeNode(d));
|
|
169243
169438
|
}
|
|
169244
|
-
function
|
|
169439
|
+
function isJsxConstructorLike(node) {
|
|
169245
169440
|
switch (node.kind) {
|
|
169246
169441
|
case 176 /* Constructor */:
|
|
169247
169442
|
case 185 /* ConstructorType */:
|
|
169443
|
+
case 179 /* CallSignature */:
|
|
169248
169444
|
case 180 /* ConstructSignature */:
|
|
169249
169445
|
return true;
|
|
169250
169446
|
default:
|
|
@@ -177154,7 +177350,6 @@ __export(ts_exports2, {
|
|
|
177154
177350
|
EmitHint: () => EmitHint,
|
|
177155
177351
|
EmitOnly: () => EmitOnly,
|
|
177156
177352
|
EndOfLineState: () => EndOfLineState,
|
|
177157
|
-
EnumKind: () => EnumKind,
|
|
177158
177353
|
ExitStatus: () => ExitStatus,
|
|
177159
177354
|
ExportKind: () => ExportKind,
|
|
177160
177355
|
Extension: () => Extension,
|
|
@@ -177181,7 +177376,7 @@ __export(ts_exports2, {
|
|
|
177181
177376
|
IndexKind: () => IndexKind,
|
|
177182
177377
|
InferenceFlags: () => InferenceFlags,
|
|
177183
177378
|
InferencePriority: () => InferencePriority,
|
|
177184
|
-
InlayHintKind: () =>
|
|
177379
|
+
InlayHintKind: () => InlayHintKind2,
|
|
177185
177380
|
InlayHints: () => ts_InlayHints_exports,
|
|
177186
177381
|
InternalEmitFlags: () => InternalEmitFlags,
|
|
177187
177382
|
InternalSymbolName: () => InternalSymbolName,
|
|
@@ -179575,6 +179770,7 @@ __export(ts_server_exports3, {
|
|
|
179575
179770
|
CommandNames: () => CommandNames,
|
|
179576
179771
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
179577
179772
|
ConfiguredProject: () => ConfiguredProject2,
|
|
179773
|
+
ConfiguredProjectLoadKind: () => ConfiguredProjectLoadKind,
|
|
179578
179774
|
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
179579
179775
|
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
179580
179776
|
Errors: () => Errors,
|
|
@@ -179582,7 +179778,7 @@ __export(ts_server_exports3, {
|
|
|
179582
179778
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
179583
179779
|
EventInitializationFailed: () => EventInitializationFailed,
|
|
179584
179780
|
EventTypesRegistry: () => EventTypesRegistry,
|
|
179585
|
-
ExternalProject: () =>
|
|
179781
|
+
ExternalProject: () => ExternalProject,
|
|
179586
179782
|
GcTimer: () => GcTimer,
|
|
179587
179783
|
InferredProject: () => InferredProject2,
|
|
179588
179784
|
LargeFileReferencedEvent: () => LargeFileReferencedEvent,
|
|
@@ -179598,7 +179794,6 @@ __export(ts_server_exports3, {
|
|
|
179598
179794
|
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
|
|
179599
179795
|
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
|
|
179600
179796
|
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
|
|
179601
|
-
ProjectReferenceProjectLoadKind: () => ProjectReferenceProjectLoadKind,
|
|
179602
179797
|
ProjectService: () => ProjectService3,
|
|
179603
179798
|
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
|
|
179604
179799
|
ScriptInfo: () => ScriptInfo,
|
|
@@ -179650,7 +179845,6 @@ __export(ts_server_exports3, {
|
|
|
179650
179845
|
nowString: () => nowString,
|
|
179651
179846
|
nullCancellationToken: () => nullCancellationToken,
|
|
179652
179847
|
nullTypingsInstaller: () => nullTypingsInstaller,
|
|
179653
|
-
projectContainsInfoDirectly: () => projectContainsInfoDirectly,
|
|
179654
179848
|
protocol: () => ts_server_protocol_exports,
|
|
179655
179849
|
removeSorted: () => removeSorted,
|
|
179656
179850
|
stringifyIndented: () => stringifyIndented,
|
|
@@ -180828,11 +181022,8 @@ var ScriptInfo = class {
|
|
|
180828
181022
|
case 0:
|
|
180829
181023
|
return Errors.ThrowNoProject();
|
|
180830
181024
|
case 1:
|
|
180831
|
-
return
|
|
180832
|
-
!isProjectDeferredClose(this.containingProjects[0]) ? this.containingProjects[0] : void 0
|
|
180833
|
-
);
|
|
181025
|
+
return isProjectDeferredClose(this.containingProjects[0]) || isBackgroundProject(this.containingProjects[0]) ? Errors.ThrowNoProject() : this.containingProjects[0];
|
|
180834
181026
|
default:
|
|
180835
|
-
let firstExternalProject;
|
|
180836
181027
|
let firstConfiguredProject;
|
|
180837
181028
|
let firstInferredProject;
|
|
180838
181029
|
let firstNonSourceOfProjectReferenceRedirect;
|
|
@@ -180849,15 +181040,13 @@ var ScriptInfo = class {
|
|
|
180849
181040
|
if (!firstNonSourceOfProjectReferenceRedirect) firstNonSourceOfProjectReferenceRedirect = project;
|
|
180850
181041
|
}
|
|
180851
181042
|
if (!firstConfiguredProject) firstConfiguredProject = project;
|
|
180852
|
-
} else if (
|
|
180853
|
-
|
|
181043
|
+
} else if (isExternalProject(project)) {
|
|
181044
|
+
return project;
|
|
180854
181045
|
} else if (!firstInferredProject && isInferredProject(project)) {
|
|
180855
181046
|
firstInferredProject = project;
|
|
180856
181047
|
}
|
|
180857
181048
|
}
|
|
180858
|
-
return
|
|
180859
|
-
defaultConfiguredProject || firstNonSourceOfProjectReferenceRedirect || firstConfiguredProject || firstExternalProject || firstInferredProject
|
|
180860
|
-
);
|
|
181049
|
+
return (defaultConfiguredProject || firstNonSourceOfProjectReferenceRedirect || firstConfiguredProject || firstInferredProject) ?? Errors.ThrowNoProject();
|
|
180861
181050
|
}
|
|
180862
181051
|
}
|
|
180863
181052
|
registerFileUpdate() {
|
|
@@ -180947,12 +181136,6 @@ var ScriptInfo = class {
|
|
|
180947
181136
|
}
|
|
180948
181137
|
}
|
|
180949
181138
|
};
|
|
180950
|
-
function ensurePrimaryProjectKind(project) {
|
|
180951
|
-
if (!project || isBackgroundProject(project)) {
|
|
180952
|
-
return Errors.ThrowNoProject();
|
|
180953
|
-
}
|
|
180954
|
-
return project;
|
|
180955
|
-
}
|
|
180956
181139
|
function failIfInvalidPosition(position) {
|
|
180957
181140
|
Debug.assert(typeof position === "number", `Expected position ${position} to be a number.`);
|
|
180958
181141
|
Debug.assert(position >= 0, `Expected position to be non-negative.`);
|
|
@@ -182703,7 +182886,7 @@ var Project3 = class _Project {
|
|
|
182703
182886
|
isDefaultProjectForOpenFiles() {
|
|
182704
182887
|
return !!forEachEntry(
|
|
182705
182888
|
this.projectService.openFiles,
|
|
182706
|
-
(
|
|
182889
|
+
(_projectRootPath, path) => this.projectService.tryGetDefaultProjectForFile(this.projectService.getScriptInfoForPath(path)) === this
|
|
182707
182890
|
);
|
|
182708
182891
|
}
|
|
182709
182892
|
/** @internal */
|
|
@@ -182842,7 +183025,7 @@ var InferredProject2 = class extends Project3 {
|
|
|
182842
183025
|
super.addRoot(info);
|
|
182843
183026
|
}
|
|
182844
183027
|
removeRoot(info) {
|
|
182845
|
-
this.projectService.
|
|
183028
|
+
this.projectService.stopWatchingConfigFilesForScriptInfo(info);
|
|
182846
183029
|
super.removeRoot(info);
|
|
182847
183030
|
if (!this.isOrphan() && this._isJsInferredProject && info.isJavaScript()) {
|
|
182848
183031
|
if (every(this.getRootScriptInfos(), (rootInfo) => !rootInfo.isJavaScript())) {
|
|
@@ -182861,7 +183044,7 @@ var InferredProject2 = class extends Project3 {
|
|
|
182861
183044
|
return !this.projectRootPath && !this.projectService.useSingleInferredProject || this.getRootScriptInfos().length === 1;
|
|
182862
183045
|
}
|
|
182863
183046
|
close() {
|
|
182864
|
-
forEach(this.getRootScriptInfos(), (info) => this.projectService.
|
|
183047
|
+
forEach(this.getRootScriptInfos(), (info) => this.projectService.stopWatchingConfigFilesForScriptInfo(info));
|
|
182865
183048
|
super.close();
|
|
182866
183049
|
}
|
|
182867
183050
|
getTypeAcquisition() {
|
|
@@ -183193,8 +183376,6 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
183193
183376
|
this.openFileWatchTriggered = /* @__PURE__ */ new Map();
|
|
183194
183377
|
/** @internal */
|
|
183195
183378
|
this.canConfigFileJsonReportNoInputFiles = false;
|
|
183196
|
-
/** Ref count to the project when opened from external project */
|
|
183197
|
-
this.externalProjectRefCount = 0;
|
|
183198
183379
|
/** @internal */
|
|
183199
183380
|
this.isInitialLoadPending = returnTrue;
|
|
183200
183381
|
/** @internal */
|
|
@@ -183256,13 +183437,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
183256
183437
|
case 2 /* Full */:
|
|
183257
183438
|
this.openFileWatchTriggered.clear();
|
|
183258
183439
|
const reason = Debug.checkDefined(this.pendingUpdateReason);
|
|
183259
|
-
this.
|
|
183260
|
-
this.projectService.reloadConfiguredProject(
|
|
183261
|
-
this,
|
|
183262
|
-
reason,
|
|
183263
|
-
/*clearSemanticCache*/
|
|
183264
|
-
false
|
|
183265
|
-
);
|
|
183440
|
+
this.projectService.reloadConfiguredProject(this, reason);
|
|
183266
183441
|
result = true;
|
|
183267
183442
|
break;
|
|
183268
183443
|
default:
|
|
@@ -183366,69 +183541,13 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
183366
183541
|
super.markAsDirty();
|
|
183367
183542
|
}
|
|
183368
183543
|
/** @internal */
|
|
183369
|
-
addExternalProjectReference() {
|
|
183370
|
-
this.externalProjectRefCount++;
|
|
183371
|
-
}
|
|
183372
|
-
/** @internal */
|
|
183373
|
-
deleteExternalProjectReference() {
|
|
183374
|
-
this.externalProjectRefCount--;
|
|
183375
|
-
}
|
|
183376
|
-
/** @internal */
|
|
183377
183544
|
isSolution() {
|
|
183378
183545
|
return this.getRootFilesMap().size === 0 && !this.canConfigFileJsonReportNoInputFiles;
|
|
183379
183546
|
}
|
|
183380
|
-
/**
|
|
183381
|
-
* Find the configured project from the project references in project which contains the info directly
|
|
183382
|
-
*
|
|
183383
|
-
* @internal
|
|
183384
|
-
*/
|
|
183385
|
-
getDefaultChildProjectFromProjectWithReferences(info) {
|
|
183386
|
-
return forEachResolvedProjectReferenceProject(
|
|
183387
|
-
this,
|
|
183388
|
-
info.path,
|
|
183389
|
-
(child) => projectContainsInfoDirectly(child, info) ? child : void 0,
|
|
183390
|
-
0 /* Find */
|
|
183391
|
-
);
|
|
183392
|
-
}
|
|
183393
|
-
/**
|
|
183394
|
-
* Returns true if the project is needed by any of the open script info/external project
|
|
183395
|
-
*
|
|
183396
|
-
* @internal
|
|
183397
|
-
*/
|
|
183398
|
-
hasOpenRef() {
|
|
183399
|
-
var _a, _b;
|
|
183400
|
-
if (!!this.externalProjectRefCount) {
|
|
183401
|
-
return true;
|
|
183402
|
-
}
|
|
183403
|
-
if (this.isClosed()) {
|
|
183404
|
-
return false;
|
|
183405
|
-
}
|
|
183406
|
-
const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(this.canonicalConfigFilePath);
|
|
183407
|
-
if (this.deferredClose) return !!((_a = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.size);
|
|
183408
|
-
if (this.projectService.hasPendingProjectUpdate(this)) {
|
|
183409
|
-
return !!((_b = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _b.size);
|
|
183410
|
-
}
|
|
183411
|
-
return !!configFileExistenceInfo.openFilesImpactedByConfigFile && forEachEntry(
|
|
183412
|
-
configFileExistenceInfo.openFilesImpactedByConfigFile,
|
|
183413
|
-
(_value, infoPath) => {
|
|
183414
|
-
const info = this.projectService.getScriptInfoForPath(infoPath);
|
|
183415
|
-
return this.containsScriptInfo(info) || !!forEachResolvedProjectReferenceProject(
|
|
183416
|
-
this,
|
|
183417
|
-
info.path,
|
|
183418
|
-
(child) => child.containsScriptInfo(info),
|
|
183419
|
-
0 /* Find */
|
|
183420
|
-
);
|
|
183421
|
-
}
|
|
183422
|
-
) || false;
|
|
183423
|
-
}
|
|
183424
183547
|
/** @internal */
|
|
183425
183548
|
isOrphan() {
|
|
183426
183549
|
return !!this.deferredClose;
|
|
183427
183550
|
}
|
|
183428
|
-
/** @internal */
|
|
183429
|
-
hasExternalProjectRef() {
|
|
183430
|
-
return !!this.externalProjectRefCount;
|
|
183431
|
-
}
|
|
183432
183551
|
getEffectiveTypeRoots() {
|
|
183433
183552
|
return getEffectiveTypeRoots(this.getCompilationSettings(), this) || [];
|
|
183434
183553
|
}
|
|
@@ -183437,7 +183556,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
183437
183556
|
updateErrorForNoInputFiles(fileNames, this.getConfigFilePath(), this.getCompilerOptions().configFile.configFileSpecs, this.projectErrors, this.canConfigFileJsonReportNoInputFiles);
|
|
183438
183557
|
}
|
|
183439
183558
|
};
|
|
183440
|
-
var
|
|
183559
|
+
var ExternalProject = class extends Project3 {
|
|
183441
183560
|
/** @internal */
|
|
183442
183561
|
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
|
|
183443
183562
|
super(
|
|
@@ -183645,59 +183764,115 @@ function findProjectByName(projectName, projects) {
|
|
|
183645
183764
|
}
|
|
183646
183765
|
}
|
|
183647
183766
|
var noopConfigFileWatcher = { close: noop };
|
|
183767
|
+
function getConfigFileNameFromCache(info, cache) {
|
|
183768
|
+
if (!cache || isAncestorConfigFileInfo(info)) return void 0;
|
|
183769
|
+
return cache.get(info.path);
|
|
183770
|
+
}
|
|
183648
183771
|
function isOpenScriptInfo(infoOrFileNameOrConfig) {
|
|
183649
183772
|
return !!infoOrFileNameOrConfig.containingProjects;
|
|
183650
183773
|
}
|
|
183651
183774
|
function isAncestorConfigFileInfo(infoOrFileNameOrConfig) {
|
|
183652
183775
|
return !!infoOrFileNameOrConfig.configFileInfo;
|
|
183653
183776
|
}
|
|
183654
|
-
var
|
|
183655
|
-
|
|
183656
|
-
|
|
183657
|
-
|
|
183658
|
-
|
|
183659
|
-
|
|
183777
|
+
var ConfiguredProjectLoadKind = /* @__PURE__ */ ((ConfiguredProjectLoadKind2) => {
|
|
183778
|
+
ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Find"] = 0] = "Find";
|
|
183779
|
+
ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Create"] = 1] = "Create";
|
|
183780
|
+
ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 2] = "Reload";
|
|
183781
|
+
return ConfiguredProjectLoadKind2;
|
|
183782
|
+
})(ConfiguredProjectLoadKind || {});
|
|
183783
|
+
function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, delayReloadedConfiguredProjects) {
|
|
183784
|
+
while (true) {
|
|
183785
|
+
if (!project.isInitialLoadPending() && (!project.getCompilerOptions().composite || project.getCompilerOptions().disableSolutionSearching)) return;
|
|
183786
|
+
const configFileName = project.projectService.getConfigFileNameForFile({
|
|
183787
|
+
fileName: project.getConfigFilePath(),
|
|
183788
|
+
path: info.path,
|
|
183789
|
+
configFileInfo: true
|
|
183790
|
+
}, kind === 0 /* Find */);
|
|
183791
|
+
if (!configFileName) return;
|
|
183792
|
+
const ancestor = project.projectService.findCreateOrReloadConfiguredProject(
|
|
183793
|
+
configFileName,
|
|
183794
|
+
kind,
|
|
183795
|
+
reason,
|
|
183796
|
+
allowDeferredClosed,
|
|
183797
|
+
/*triggerFile*/
|
|
183798
|
+
void 0,
|
|
183799
|
+
reloadedProjects,
|
|
183800
|
+
/*delayLoad*/
|
|
183801
|
+
true,
|
|
183802
|
+
delayReloadedConfiguredProjects
|
|
183803
|
+
);
|
|
183804
|
+
if (!ancestor) return;
|
|
183805
|
+
if (ancestor.project.isInitialLoadPending() && project.getCompilerOptions().composite) {
|
|
183806
|
+
ancestor.project.setPotentialProjectReference(project.canonicalConfigFilePath);
|
|
183807
|
+
}
|
|
183808
|
+
const result = cb(ancestor.project);
|
|
183809
|
+
if (result) return result;
|
|
183810
|
+
project = ancestor.project;
|
|
183811
|
+
}
|
|
183812
|
+
}
|
|
183813
|
+
function forEachResolvedProjectReferenceProject(project, fileName, cb, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects) {
|
|
183660
183814
|
var _a;
|
|
183661
183815
|
const resolvedRefs = (_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences();
|
|
183662
183816
|
if (!resolvedRefs) return void 0;
|
|
183663
|
-
let seenResolvedRefs;
|
|
183664
183817
|
const possibleDefaultRef = fileName ? project.getResolvedProjectReferenceToRedirect(fileName) : void 0;
|
|
183665
183818
|
if (possibleDefaultRef) {
|
|
183666
183819
|
const configFileName = toNormalizedPath(possibleDefaultRef.sourceFile.fileName);
|
|
183667
|
-
const child = project.projectService.findConfiguredProjectByProjectName(
|
|
183820
|
+
const child = project.projectService.findConfiguredProjectByProjectName(
|
|
183821
|
+
configFileName,
|
|
183822
|
+
allowDeferredClosed
|
|
183823
|
+
);
|
|
183668
183824
|
if (child) {
|
|
183669
|
-
const result =
|
|
183825
|
+
const result = callbackWithProjectFoundUsingFind(child);
|
|
183670
183826
|
if (result) return result;
|
|
183671
|
-
} else if (
|
|
183672
|
-
seenResolvedRefs = /* @__PURE__ */ new Map();
|
|
183827
|
+
} else if (kind !== 0 /* Find */) {
|
|
183673
183828
|
const result = forEachResolvedProjectReferenceProjectWorker(
|
|
183674
183829
|
resolvedRefs,
|
|
183675
183830
|
project.getCompilerOptions(),
|
|
183676
183831
|
(ref, loadKind) => possibleDefaultRef === ref ? callback(ref, loadKind) : void 0,
|
|
183677
|
-
|
|
183678
|
-
project.projectService
|
|
183679
|
-
seenResolvedRefs
|
|
183832
|
+
kind,
|
|
183833
|
+
project.projectService
|
|
183680
183834
|
);
|
|
183681
183835
|
if (result) return result;
|
|
183682
|
-
seenResolvedRefs.clear();
|
|
183683
183836
|
}
|
|
183684
183837
|
}
|
|
183685
183838
|
return forEachResolvedProjectReferenceProjectWorker(
|
|
183686
183839
|
resolvedRefs,
|
|
183687
183840
|
project.getCompilerOptions(),
|
|
183688
183841
|
(ref, loadKind) => possibleDefaultRef !== ref ? callback(ref, loadKind) : void 0,
|
|
183689
|
-
|
|
183690
|
-
project.projectService
|
|
183691
|
-
seenResolvedRefs
|
|
183842
|
+
kind,
|
|
183843
|
+
project.projectService
|
|
183692
183844
|
);
|
|
183693
183845
|
function callback(ref, loadKind) {
|
|
183694
|
-
const
|
|
183695
|
-
|
|
183696
|
-
|
|
183846
|
+
const result = project.projectService.findCreateOrReloadConfiguredProject(
|
|
183847
|
+
toNormalizedPath(ref.sourceFile.fileName),
|
|
183848
|
+
loadKind,
|
|
183849
|
+
reason,
|
|
183850
|
+
allowDeferredClosed,
|
|
183851
|
+
triggerFile,
|
|
183852
|
+
reloadedProjects
|
|
183853
|
+
);
|
|
183854
|
+
return result && (loadKind === kind ? cb(result.project, result.sentConfigFileDiag) : callbackWithProjectFoundUsingFind(result.project));
|
|
183855
|
+
}
|
|
183856
|
+
function callbackWithProjectFoundUsingFind(child) {
|
|
183857
|
+
let sentConfigFileDiag = false;
|
|
183858
|
+
switch (kind) {
|
|
183859
|
+
case 1 /* Create */:
|
|
183860
|
+
sentConfigFileDiag = updateConfiguredProject(child, triggerFile);
|
|
183861
|
+
break;
|
|
183862
|
+
case 2 /* Reload */:
|
|
183863
|
+
sentConfigFileDiag = child.projectService.reloadConfiguredProjectClearingSemanticCache(child, reason, reloadedProjects);
|
|
183864
|
+
break;
|
|
183865
|
+
case 0 /* Find */:
|
|
183866
|
+
break;
|
|
183867
|
+
default:
|
|
183868
|
+
Debug.assertNever(kind);
|
|
183869
|
+
}
|
|
183870
|
+
const result = cb(child, sentConfigFileDiag);
|
|
183871
|
+
if (result) return result;
|
|
183697
183872
|
}
|
|
183698
183873
|
}
|
|
183699
|
-
function forEachResolvedProjectReferenceProjectWorker(resolvedProjectReferences, parentOptions, cb,
|
|
183700
|
-
const loadKind = parentOptions.disableReferencedProjectLoad ? 0 /* Find */ :
|
|
183874
|
+
function forEachResolvedProjectReferenceProjectWorker(resolvedProjectReferences, parentOptions, cb, kind, projectService, seenResolvedRefs) {
|
|
183875
|
+
const loadKind = parentOptions.disableReferencedProjectLoad ? 0 /* Find */ : kind;
|
|
183701
183876
|
return forEach(resolvedProjectReferences, (ref) => {
|
|
183702
183877
|
if (!ref) return void 0;
|
|
183703
183878
|
const configFileName = toNormalizedPath(ref.sourceFile.fileName);
|
|
@@ -183738,9 +183913,6 @@ function getDetailWatchInfo(watchType, project) {
|
|
|
183738
183913
|
function isScriptInfoWatchedFromNodeModules(info) {
|
|
183739
183914
|
return !info.isScriptOpen() && info.mTime !== void 0;
|
|
183740
183915
|
}
|
|
183741
|
-
function projectContainsInfoDirectly(project, info) {
|
|
183742
|
-
return project.containsScriptInfo(info) && !project.isSourceOfProjectReferenceRedirect(info.path);
|
|
183743
|
-
}
|
|
183744
183916
|
function updateProjectIfDirty(project) {
|
|
183745
183917
|
project.invalidateResolutionsOfFailedLookupLocations();
|
|
183746
183918
|
return project.dirty && !project.updateGraph();
|
|
@@ -183758,6 +183930,25 @@ function updateWithTriggerFile(project, triggerFile, isReload) {
|
|
|
183758
183930
|
project.triggerFileForConfigFileDiag = void 0;
|
|
183759
183931
|
return sent;
|
|
183760
183932
|
}
|
|
183933
|
+
function updateConfiguredProject(project, triggerFile) {
|
|
183934
|
+
if (triggerFile) {
|
|
183935
|
+
if (updateWithTriggerFile(
|
|
183936
|
+
project,
|
|
183937
|
+
triggerFile,
|
|
183938
|
+
/*isReload*/
|
|
183939
|
+
false
|
|
183940
|
+
)) return true;
|
|
183941
|
+
} else {
|
|
183942
|
+
updateProjectIfDirty(project);
|
|
183943
|
+
}
|
|
183944
|
+
return false;
|
|
183945
|
+
}
|
|
183946
|
+
function fileOpenReason(info) {
|
|
183947
|
+
return `Creating possible configured project for ${info.fileName} to open`;
|
|
183948
|
+
}
|
|
183949
|
+
function reloadReason(reason) {
|
|
183950
|
+
return `User requested reload projects: ${reason}`;
|
|
183951
|
+
}
|
|
183761
183952
|
function setProjectOptionsUsed(project) {
|
|
183762
183953
|
if (isConfiguredProject(project)) {
|
|
183763
183954
|
project.projectOptions = true;
|
|
@@ -183897,8 +184088,10 @@ var _ProjectService = class _ProjectService {
|
|
|
183897
184088
|
* Open files: with value being project root path, and key being Path of the file that is open
|
|
183898
184089
|
*/
|
|
183899
184090
|
this.openFiles = /* @__PURE__ */ new Map();
|
|
183900
|
-
/**
|
|
184091
|
+
/** Config files looked up and cached config files for open script info */
|
|
183901
184092
|
this.configFileForOpenFiles = /* @__PURE__ */ new Map();
|
|
184093
|
+
/** Set of open script infos that are root of inferred project */
|
|
184094
|
+
this.rootOfInferredProjects = /* @__PURE__ */ new Set();
|
|
183902
184095
|
/**
|
|
183903
184096
|
* Map of open files that are opened without complete path but have projectRoot as current directory
|
|
183904
184097
|
*/
|
|
@@ -184252,9 +184445,28 @@ var _ProjectService = class _ProjectService {
|
|
|
184252
184445
|
const scriptInfo = isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo;
|
|
184253
184446
|
return scriptInfo && !scriptInfo.isOrphan() ? scriptInfo.getDefaultProject() : void 0;
|
|
184254
184447
|
}
|
|
184448
|
+
/**
|
|
184449
|
+
* If there is default project calculation pending for this file,
|
|
184450
|
+
* then it completes that calculation so that correct default project is used for the project
|
|
184451
|
+
*/
|
|
184452
|
+
tryGetDefaultProjectForEnsuringConfiguredProjectForFile(fileNameOrScriptInfo) {
|
|
184453
|
+
var _a;
|
|
184454
|
+
const scriptInfo = isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo;
|
|
184455
|
+
if (!scriptInfo) return void 0;
|
|
184456
|
+
if ((_a = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a.delete(scriptInfo.path)) {
|
|
184457
|
+
this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
184458
|
+
scriptInfo,
|
|
184459
|
+
1 /* Create */
|
|
184460
|
+
);
|
|
184461
|
+
if (scriptInfo.isOrphan()) {
|
|
184462
|
+
this.assignOrphanScriptInfoToInferredProject(scriptInfo, this.openFiles.get(scriptInfo.path));
|
|
184463
|
+
}
|
|
184464
|
+
}
|
|
184465
|
+
return this.tryGetDefaultProjectForFile(scriptInfo);
|
|
184466
|
+
}
|
|
184255
184467
|
/** @internal */
|
|
184256
184468
|
ensureDefaultProjectForFile(fileNameOrScriptInfo) {
|
|
184257
|
-
return this.
|
|
184469
|
+
return this.tryGetDefaultProjectForEnsuringConfiguredProjectForFile(fileNameOrScriptInfo) || this.doEnsureDefaultProjectForFile(fileNameOrScriptInfo);
|
|
184258
184470
|
}
|
|
184259
184471
|
doEnsureDefaultProjectForFile(fileNameOrScriptInfo) {
|
|
184260
184472
|
this.ensureProjectStructuresUptoDate();
|
|
@@ -184475,7 +184687,7 @@ var _ProjectService = class _ProjectService {
|
|
|
184475
184687
|
return scheduledAnyProjectUpdate;
|
|
184476
184688
|
}
|
|
184477
184689
|
/** @internal */
|
|
184478
|
-
onConfigFileChanged(canonicalConfigFilePath, eventKind) {
|
|
184690
|
+
onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind) {
|
|
184479
184691
|
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184480
184692
|
const project = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
|
|
184481
184693
|
const wasDefferedClose = project == null ? void 0 : project.deferredClose;
|
|
@@ -184489,44 +184701,35 @@ var _ProjectService = class _ProjectService {
|
|
|
184489
184701
|
project.markAsDirty();
|
|
184490
184702
|
}
|
|
184491
184703
|
}
|
|
184492
|
-
this.delayUpdateProjectsFromParsedConfigOnConfigFileChange(
|
|
184493
|
-
|
|
184494
|
-
configFileExistenceInfo,
|
|
184495
|
-
!wasDefferedClose && eventKind !== 2 /* Deleted */ ? identity : (
|
|
184496
|
-
// Reload open files if they are root of inferred project
|
|
184497
|
-
returnTrue
|
|
184498
|
-
),
|
|
184499
|
-
// Reload all the open files impacted by config file
|
|
184704
|
+
this.delayUpdateProjectsFromParsedConfigOnConfigFileChange(
|
|
184705
|
+
canonicalConfigFilePath,
|
|
184500
184706
|
"Change in config file detected"
|
|
184501
184707
|
);
|
|
184502
|
-
|
|
184503
|
-
|
|
184504
|
-
|
|
184505
|
-
|
|
184506
|
-
|
|
184507
|
-
* If there is no existing project it just opens the configured project for the config file
|
|
184508
|
-
* shouldReloadProjectFor provides a way to filter out files to reload configured project for
|
|
184509
|
-
*/
|
|
184510
|
-
delayReloadConfiguredProjectsForFile(configFileExistenceInfo, shouldReloadProjectFor, reason) {
|
|
184511
|
-
var _a;
|
|
184512
|
-
const updatedProjects = /* @__PURE__ */ new Set();
|
|
184513
|
-
(_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.forEach((infoIsRootOfInferredProject, path) => {
|
|
184708
|
+
const updatedProjects = new Set(project ? [project] : void 0);
|
|
184709
|
+
this.openFiles.forEach((_projectRootPath, path) => {
|
|
184710
|
+
var _a, _b;
|
|
184711
|
+
const configFileForOpenFile = this.configFileForOpenFiles.get(path);
|
|
184712
|
+
if (!((_a = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.has(path))) return;
|
|
184514
184713
|
this.configFileForOpenFiles.delete(path);
|
|
184515
|
-
if (!shouldReloadProjectFor(infoIsRootOfInferredProject)) {
|
|
184516
|
-
return;
|
|
184517
|
-
}
|
|
184518
184714
|
const info = this.getScriptInfoForPath(path);
|
|
184519
|
-
|
|
184520
|
-
|
|
184521
|
-
|
|
184522
|
-
|
|
184523
|
-
|
|
184524
|
-
|
|
184525
|
-
|
|
184526
|
-
|
|
184527
|
-
}
|
|
184715
|
+
const newConfigFileNameForInfo = this.getConfigFileNameForFile(
|
|
184716
|
+
info,
|
|
184717
|
+
/*findFromCacheOnly*/
|
|
184718
|
+
false
|
|
184719
|
+
);
|
|
184720
|
+
if (!newConfigFileNameForInfo) return;
|
|
184721
|
+
const projectForInfo = this.findConfiguredProjectByProjectName(newConfigFileNameForInfo) ?? this.createConfiguredProject(
|
|
184722
|
+
newConfigFileNameForInfo,
|
|
184723
|
+
`Change in config file ${configFileName} detected, ${fileOpenReason(info)}`
|
|
184724
|
+
);
|
|
184725
|
+
if (!((_b = this.pendingOpenFileProjectUpdates) == null ? void 0 : _b.has(path))) {
|
|
184726
|
+
(this.pendingOpenFileProjectUpdates ?? (this.pendingOpenFileProjectUpdates = /* @__PURE__ */ new Map())).set(path, configFileForOpenFile);
|
|
184727
|
+
}
|
|
184728
|
+
if (tryAddToSet(updatedProjects, projectForInfo) && projectForInfo.isInitialLoadPending()) {
|
|
184729
|
+
this.delayUpdateProjectGraph(projectForInfo);
|
|
184528
184730
|
}
|
|
184529
184731
|
});
|
|
184732
|
+
this.delayEnsureProjectForOpenFiles();
|
|
184530
184733
|
}
|
|
184531
184734
|
removeProject(project) {
|
|
184532
184735
|
this.logger.info("`remove Project::");
|
|
@@ -184627,9 +184830,10 @@ var _ProjectService = class _ProjectService {
|
|
|
184627
184830
|
* @param info The file that has been closed or newly configured
|
|
184628
184831
|
*/
|
|
184629
184832
|
closeOpenFile(info, skipAssignOrphanScriptInfosToInferredProject) {
|
|
184833
|
+
var _a;
|
|
184630
184834
|
const fileExists = info.isDynamic ? false : this.host.fileExists(info.fileName);
|
|
184631
184835
|
info.close(fileExists);
|
|
184632
|
-
this.
|
|
184836
|
+
this.stopWatchingConfigFilesForScriptInfo(info);
|
|
184633
184837
|
const canonicalFileName = this.toCanonicalFileName(info.fileName);
|
|
184634
184838
|
if (this.openFilesWithNonRootedDiskPath.get(canonicalFileName) === info) {
|
|
184635
184839
|
this.openFilesWithNonRootedDiskPath.delete(canonicalFileName);
|
|
@@ -184665,6 +184869,8 @@ var _ProjectService = class _ProjectService {
|
|
|
184665
184869
|
}
|
|
184666
184870
|
this.openFiles.delete(info.path);
|
|
184667
184871
|
this.configFileForOpenFiles.delete(info.path);
|
|
184872
|
+
(_a = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a.delete(info.path);
|
|
184873
|
+
Debug.assert(!this.rootOfInferredProjects.has(info));
|
|
184668
184874
|
if (!skipAssignOrphanScriptInfosToInferredProject && ensureProjectsForOpenFiles) {
|
|
184669
184875
|
this.assignOrphanScriptInfosToInferredProject();
|
|
184670
184876
|
}
|
|
@@ -184691,21 +184897,15 @@ var _ProjectService = class _ProjectService {
|
|
|
184691
184897
|
info.closeSourceMapFileWatcher();
|
|
184692
184898
|
}
|
|
184693
184899
|
configFileExists(configFileName, canonicalConfigFilePath, info) {
|
|
184694
|
-
|
|
184695
|
-
let configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184696
|
-
if (configFileExistenceInfo) {
|
|
184697
|
-
if (isOpenScriptInfo(info) && !((_a = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.has(info.path))) {
|
|
184698
|
-
(configFileExistenceInfo.openFilesImpactedByConfigFile || (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Map())).set(info.path, false);
|
|
184699
|
-
}
|
|
184700
|
-
return configFileExistenceInfo.exists;
|
|
184701
|
-
}
|
|
184702
|
-
const exists = this.host.fileExists(configFileName);
|
|
184900
|
+
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184703
184901
|
let openFilesImpactedByConfigFile;
|
|
184704
|
-
if (
|
|
184705
|
-
(openFilesImpactedByConfigFile
|
|
184902
|
+
if (this.openFiles.has(info.path) && !isAncestorConfigFileInfo(info)) {
|
|
184903
|
+
if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
|
|
184904
|
+
else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
|
|
184706
184905
|
}
|
|
184707
|
-
configFileExistenceInfo
|
|
184708
|
-
this.
|
|
184906
|
+
if (configFileExistenceInfo) return configFileExistenceInfo.exists;
|
|
184907
|
+
const exists = this.host.fileExists(configFileName);
|
|
184908
|
+
this.configFileExistenceInfoCache.set(canonicalConfigFilePath, { exists, openFilesImpactedByConfigFile });
|
|
184709
184909
|
return exists;
|
|
184710
184910
|
}
|
|
184711
184911
|
/** @internal */
|
|
@@ -184715,7 +184915,7 @@ var _ProjectService = class _ProjectService {
|
|
|
184715
184915
|
if (!configFileExistenceInfo.watcher || configFileExistenceInfo.watcher === noopConfigFileWatcher) {
|
|
184716
184916
|
configFileExistenceInfo.watcher = this.watchFactory.watchFile(
|
|
184717
184917
|
configFileName,
|
|
184718
|
-
(_fileName, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind),
|
|
184918
|
+
(_fileName, eventKind) => this.onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind),
|
|
184719
184919
|
2e3 /* High */,
|
|
184720
184920
|
this.getWatchOptionsFromProjectWatchOptions((_b = (_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) == null ? void 0 : _b.watchOptions, getDirectoryPath(configFileName)),
|
|
184721
184921
|
WatchType.ConfigFile,
|
|
@@ -184725,12 +184925,6 @@ var _ProjectService = class _ProjectService {
|
|
|
184725
184925
|
const projects = configFileExistenceInfo.config.projects;
|
|
184726
184926
|
projects.set(forProject.canonicalConfigFilePath, projects.get(forProject.canonicalConfigFilePath) || false);
|
|
184727
184927
|
}
|
|
184728
|
-
/**
|
|
184729
|
-
* Returns true if the configFileExistenceInfo is needed/impacted by open files that are root of inferred project
|
|
184730
|
-
*/
|
|
184731
|
-
configFileExistenceImpactsRootOfInferredProject(configFileExistenceInfo) {
|
|
184732
|
-
return configFileExistenceInfo.openFilesImpactedByConfigFile && forEachEntry(configFileExistenceInfo.openFilesImpactedByConfigFile, identity);
|
|
184733
|
-
}
|
|
184734
184928
|
/** @internal */
|
|
184735
184929
|
releaseParsedConfig(canonicalConfigFilePath, forProject) {
|
|
184736
184930
|
var _a, _b, _c;
|
|
@@ -184741,7 +184935,7 @@ var _ProjectService = class _ProjectService {
|
|
|
184741
184935
|
clearSharedExtendedConfigFileWatcher(canonicalConfigFilePath, this.sharedExtendedConfigFileWatchers);
|
|
184742
184936
|
Debug.checkDefined(configFileExistenceInfo.watcher);
|
|
184743
184937
|
if ((_c = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _c.size) {
|
|
184744
|
-
if (
|
|
184938
|
+
if (configFileExistenceInfo.inferredProjectRoots) {
|
|
184745
184939
|
if (!canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath)))) {
|
|
184746
184940
|
configFileExistenceInfo.watcher.close();
|
|
184747
184941
|
configFileExistenceInfo.watcher = noopConfigFileWatcher;
|
|
@@ -184756,36 +184950,35 @@ var _ProjectService = class _ProjectService {
|
|
|
184756
184950
|
}
|
|
184757
184951
|
}
|
|
184758
184952
|
/**
|
|
184759
|
-
*
|
|
184760
|
-
*
|
|
184761
|
-
*
|
|
184953
|
+
* This is called on file close or when its removed from inferred project as root,
|
|
184954
|
+
* so that we handle the watches and inferred project root data
|
|
184762
184955
|
* @internal
|
|
184763
184956
|
*/
|
|
184764
|
-
|
|
184765
|
-
if (
|
|
184766
|
-
|
|
184767
|
-
|
|
184768
|
-
|
|
184769
|
-
}
|
|
184770
|
-
/**
|
|
184771
|
-
* This is called on file close, so that we stop watching the config file for this script info
|
|
184772
|
-
*/
|
|
184773
|
-
stopWatchingConfigFilesForClosedScriptInfo(info) {
|
|
184774
|
-
Debug.assert(!info.isScriptOpen());
|
|
184957
|
+
stopWatchingConfigFilesForScriptInfo(info) {
|
|
184958
|
+
if (this.serverMode !== 0 /* Semantic */) return;
|
|
184959
|
+
const isRootOfInferredProject = this.rootOfInferredProjects.delete(info);
|
|
184960
|
+
const isOpen = info.isScriptOpen();
|
|
184961
|
+
if (isOpen && !isRootOfInferredProject) return;
|
|
184775
184962
|
this.forEachConfigFileLocation(info, (canonicalConfigFilePath) => {
|
|
184776
184963
|
var _a, _b, _c;
|
|
184777
184964
|
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184778
|
-
if (configFileExistenceInfo)
|
|
184779
|
-
|
|
184780
|
-
(
|
|
184781
|
-
|
|
184782
|
-
|
|
184783
|
-
|
|
184784
|
-
|
|
184785
|
-
|
|
184786
|
-
|
|
184965
|
+
if (!configFileExistenceInfo) return;
|
|
184966
|
+
if (isOpen) {
|
|
184967
|
+
if (!((_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.has(info.path))) return;
|
|
184968
|
+
} else {
|
|
184969
|
+
if (!((_b = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _b.delete(info.path))) return;
|
|
184970
|
+
}
|
|
184971
|
+
if (isRootOfInferredProject) {
|
|
184972
|
+
configFileExistenceInfo.inferredProjectRoots--;
|
|
184973
|
+
if (configFileExistenceInfo.watcher && !configFileExistenceInfo.config && !configFileExistenceInfo.inferredProjectRoots) {
|
|
184974
|
+
configFileExistenceInfo.watcher.close();
|
|
184975
|
+
configFileExistenceInfo.watcher = void 0;
|
|
184787
184976
|
}
|
|
184788
184977
|
}
|
|
184978
|
+
if (!((_c = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _c.size) && !configFileExistenceInfo.config) {
|
|
184979
|
+
Debug.assert(!configFileExistenceInfo.watcher);
|
|
184980
|
+
this.configFileExistenceInfoCache.delete(canonicalConfigFilePath);
|
|
184981
|
+
}
|
|
184789
184982
|
});
|
|
184790
184983
|
}
|
|
184791
184984
|
/**
|
|
@@ -184794,39 +184987,27 @@ var _ProjectService = class _ProjectService {
|
|
|
184794
184987
|
* @internal
|
|
184795
184988
|
*/
|
|
184796
184989
|
startWatchingConfigFilesForInferredProjectRoot(info) {
|
|
184990
|
+
if (this.serverMode !== 0 /* Semantic */) return;
|
|
184797
184991
|
Debug.assert(info.isScriptOpen());
|
|
184992
|
+
this.rootOfInferredProjects.add(info);
|
|
184798
184993
|
this.forEachConfigFileLocation(info, (canonicalConfigFilePath, configFileName) => {
|
|
184799
184994
|
let configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184800
184995
|
if (!configFileExistenceInfo) {
|
|
184801
|
-
configFileExistenceInfo = { exists: this.host.fileExists(configFileName) };
|
|
184996
|
+
configFileExistenceInfo = { exists: this.host.fileExists(configFileName), inferredProjectRoots: 1 };
|
|
184802
184997
|
this.configFileExistenceInfoCache.set(canonicalConfigFilePath, configFileExistenceInfo);
|
|
184998
|
+
} else {
|
|
184999
|
+
configFileExistenceInfo.inferredProjectRoots = (configFileExistenceInfo.inferredProjectRoots ?? 0) + 1;
|
|
184803
185000
|
}
|
|
184804
|
-
(configFileExistenceInfo.openFilesImpactedByConfigFile
|
|
185001
|
+
(configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
|
|
184805
185002
|
configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath))) ? this.watchFactory.watchFile(
|
|
184806
185003
|
configFileName,
|
|
184807
|
-
(_filename, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind),
|
|
185004
|
+
(_filename, eventKind) => this.onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind),
|
|
184808
185005
|
2e3 /* High */,
|
|
184809
185006
|
this.hostConfiguration.watchOptions,
|
|
184810
185007
|
WatchType.ConfigFileForInferredRoot
|
|
184811
185008
|
) : noopConfigFileWatcher);
|
|
184812
185009
|
});
|
|
184813
185010
|
}
|
|
184814
|
-
/**
|
|
184815
|
-
* This is called by inferred project whenever root script info is removed from it
|
|
184816
|
-
*
|
|
184817
|
-
* @internal
|
|
184818
|
-
*/
|
|
184819
|
-
stopWatchingConfigFilesForInferredProjectRoot(info) {
|
|
184820
|
-
this.forEachConfigFileLocation(info, (canonicalConfigFilePath) => {
|
|
184821
|
-
var _a;
|
|
184822
|
-
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184823
|
-
if ((_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.has(info.path)) {
|
|
184824
|
-
Debug.assert(info.isScriptOpen());
|
|
184825
|
-
configFileExistenceInfo.openFilesImpactedByConfigFile.set(info.path, false);
|
|
184826
|
-
this.closeConfigFileWatcherOnReleaseOfOpenFile(configFileExistenceInfo);
|
|
184827
|
-
}
|
|
184828
|
-
});
|
|
184829
|
-
}
|
|
184830
185011
|
/**
|
|
184831
185012
|
* This function tries to search for a tsconfig.json for the given file.
|
|
184832
185013
|
* This is different from the method the compiler uses because
|
|
@@ -184869,10 +185050,25 @@ var _ProjectService = class _ProjectService {
|
|
|
184869
185050
|
}
|
|
184870
185051
|
/** @internal */
|
|
184871
185052
|
findDefaultConfiguredProject(info) {
|
|
184872
|
-
|
|
184873
|
-
|
|
184874
|
-
|
|
184875
|
-
|
|
185053
|
+
var _a;
|
|
185054
|
+
return info.isScriptOpen() ? (_a = this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
|
|
185055
|
+
info,
|
|
185056
|
+
0 /* Find */
|
|
185057
|
+
)) == null ? void 0 : _a.defaultProject : void 0;
|
|
185058
|
+
}
|
|
185059
|
+
/** Get cached configFileName for scriptInfo or ancestor of open script info */
|
|
185060
|
+
getConfigFileNameForFileFromCache(info, lookInPendingFilesForValue) {
|
|
185061
|
+
if (lookInPendingFilesForValue) {
|
|
185062
|
+
const result = getConfigFileNameFromCache(info, this.pendingOpenFileProjectUpdates);
|
|
185063
|
+
if (result !== void 0) return result;
|
|
185064
|
+
}
|
|
185065
|
+
return getConfigFileNameFromCache(info, this.configFileForOpenFiles);
|
|
185066
|
+
}
|
|
185067
|
+
/** Caches the configFilename for script info or ancestor of open script info */
|
|
185068
|
+
setConfigFileNameForFileInCache(info, configFileName) {
|
|
185069
|
+
if (!this.openFiles.has(info.path)) return;
|
|
185070
|
+
if (isAncestorConfigFileInfo(info)) return;
|
|
185071
|
+
this.configFileForOpenFiles.set(info.path, configFileName || false);
|
|
184876
185072
|
}
|
|
184877
185073
|
/**
|
|
184878
185074
|
* This function tries to search for a tsconfig.json for the given file.
|
|
@@ -184883,17 +185079,16 @@ var _ProjectService = class _ProjectService {
|
|
|
184883
185079
|
* the newly opened file.
|
|
184884
185080
|
* If script info is passed in, it is asserted to be open script info
|
|
184885
185081
|
* otherwise just file name
|
|
185082
|
+
* when findFromCacheOnly is true only looked up in cache instead of hitting disk to figure things out
|
|
185083
|
+
* @internal
|
|
184886
185084
|
*/
|
|
184887
|
-
getConfigFileNameForFile(info) {
|
|
184888
|
-
|
|
184889
|
-
|
|
184890
|
-
|
|
184891
|
-
}
|
|
185085
|
+
getConfigFileNameForFile(info, findFromCacheOnly) {
|
|
185086
|
+
const fromCache = this.getConfigFileNameForFileFromCache(info, findFromCacheOnly);
|
|
185087
|
+
if (fromCache !== void 0) return fromCache || void 0;
|
|
185088
|
+
if (findFromCacheOnly) return void 0;
|
|
184892
185089
|
const configFileName = this.forEachConfigFileLocation(info, (canonicalConfigFilePath, configFileName2) => this.configFileExists(configFileName2, canonicalConfigFilePath, info));
|
|
184893
185090
|
this.logger.info(`getConfigFileNameForFile:: File: ${info.fileName} ProjectRootPath: ${this.openFiles.get(info.path)}:: Result: ${configFileName}`);
|
|
184894
|
-
|
|
184895
|
-
this.configFileForOpenFiles.set(info.path, configFileName || false);
|
|
184896
|
-
}
|
|
185091
|
+
this.setConfigFileNameForFileInCache(info, configFileName);
|
|
184897
185092
|
return configFileName;
|
|
184898
185093
|
}
|
|
184899
185094
|
printProjects() {
|
|
@@ -184913,10 +185108,10 @@ var _ProjectService = class _ProjectService {
|
|
|
184913
185108
|
this.logger.endGroup();
|
|
184914
185109
|
}
|
|
184915
185110
|
/** @internal */
|
|
184916
|
-
findConfiguredProjectByProjectName(configFileName) {
|
|
185111
|
+
findConfiguredProjectByProjectName(configFileName, allowDeferredClosed) {
|
|
184917
185112
|
const canonicalConfigFilePath = asNormalizedPath(this.toCanonicalFileName(configFileName));
|
|
184918
185113
|
const result = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
|
|
184919
|
-
return !(result == null ? void 0 : result.deferredClose) ? result : void 0;
|
|
185114
|
+
return allowDeferredClosed ? result : !(result == null ? void 0 : result.deferredClose) ? result : void 0;
|
|
184920
185115
|
}
|
|
184921
185116
|
getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath) {
|
|
184922
185117
|
return this.configuredProjects.get(canonicalConfigFilePath);
|
|
@@ -184950,7 +185145,7 @@ var _ProjectService = class _ProjectService {
|
|
|
184950
185145
|
createExternalProject(projectFileName, files, options, typeAcquisition, excludedFiles) {
|
|
184951
185146
|
const compilerOptions = convertCompilerOptions(options);
|
|
184952
185147
|
const watchOptionsAndErrors = convertWatchOptions(options, getDirectoryPath(normalizeSlashes(projectFileName)));
|
|
184953
|
-
const project = new
|
|
185148
|
+
const project = new ExternalProject(
|
|
184954
185149
|
projectFileName,
|
|
184955
185150
|
this,
|
|
184956
185151
|
this.documentRegistry,
|
|
@@ -184996,7 +185191,7 @@ var _ProjectService = class _ProjectService {
|
|
|
184996
185191
|
exclude: projectOptions && projectOptions.configHasExcludeProperty,
|
|
184997
185192
|
compileOnSave: project.compileOnSaveEnabled,
|
|
184998
185193
|
configFileName: configFileName(),
|
|
184999
|
-
projectType: project instanceof
|
|
185194
|
+
projectType: project instanceof ExternalProject ? "external" : "configured",
|
|
185000
185195
|
languageServiceEnabled: project.languageServiceEnabled,
|
|
185001
185196
|
version
|
|
185002
185197
|
};
|
|
@@ -185052,18 +185247,6 @@ var _ProjectService = class _ProjectService {
|
|
|
185052
185247
|
this.createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, project);
|
|
185053
185248
|
return project;
|
|
185054
185249
|
}
|
|
185055
|
-
/** @internal */
|
|
185056
|
-
createLoadAndUpdateConfiguredProject(configFileName, reason, triggerFile) {
|
|
185057
|
-
const project = this.createConfiguredProject(configFileName, reason);
|
|
185058
|
-
if (triggerFile) updateWithTriggerFile(
|
|
185059
|
-
project,
|
|
185060
|
-
triggerFile,
|
|
185061
|
-
/*isReload*/
|
|
185062
|
-
false
|
|
185063
|
-
);
|
|
185064
|
-
else project.updateGraph();
|
|
185065
|
-
return project;
|
|
185066
|
-
}
|
|
185067
185250
|
/**
|
|
185068
185251
|
* Read the config file of the project, and update the project root file names.
|
|
185069
185252
|
*
|
|
@@ -185337,14 +185520,23 @@ var _ProjectService = class _ProjectService {
|
|
|
185337
185520
|
setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
|
|
185338
185521
|
this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
|
|
185339
185522
|
}
|
|
185523
|
+
/** @internal */
|
|
185524
|
+
reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects) {
|
|
185525
|
+
if (!tryAddToSet(reloadedProjects, project)) return false;
|
|
185526
|
+
this.clearSemanticCache(project);
|
|
185527
|
+
this.reloadConfiguredProject(project, reloadReason(reason));
|
|
185528
|
+
return true;
|
|
185529
|
+
}
|
|
185340
185530
|
/**
|
|
185341
185531
|
* Read the config file of the project again by clearing the cache and update the project graph
|
|
185342
185532
|
*
|
|
185343
185533
|
* @internal
|
|
185344
185534
|
*/
|
|
185345
|
-
reloadConfiguredProject(project, reason
|
|
185535
|
+
reloadConfiguredProject(project, reason) {
|
|
185536
|
+
project.isInitialLoadPending = returnFalse;
|
|
185537
|
+
project.pendingUpdateReason = void 0;
|
|
185538
|
+
project.pendingUpdateLevel = 0 /* Update */;
|
|
185346
185539
|
const host = project.getCachedDirectoryStructureHost();
|
|
185347
|
-
if (clearSemanticCache) this.clearSemanticCache(project);
|
|
185348
185540
|
host.clearCache();
|
|
185349
185541
|
this.loadConfiguredProject(project, reason);
|
|
185350
185542
|
updateWithTriggerFile(
|
|
@@ -185356,6 +185548,7 @@ var _ProjectService = class _ProjectService {
|
|
|
185356
185548
|
}
|
|
185357
185549
|
/** @internal */
|
|
185358
185550
|
clearSemanticCache(project) {
|
|
185551
|
+
project.originalConfiguredProjects = void 0;
|
|
185359
185552
|
project.resolutionCache.clear();
|
|
185360
185553
|
project.getLanguageService(
|
|
185361
185554
|
/*ensureSynchronized*/
|
|
@@ -185900,7 +186093,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
185900
186093
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
185901
186094
|
this.externalProjectToConfiguredProjectMap.forEach(
|
|
185902
186095
|
(projects) => projects.forEach((project) => {
|
|
185903
|
-
if (!project.deferredClose && !project.isClosed() && project.
|
|
186096
|
+
if (!project.deferredClose && !project.isClosed() && project.pendingUpdateLevel === 2 /* Full */ && !this.hasPendingProjectUpdate(project)) {
|
|
185904
186097
|
project.updateGraph();
|
|
185905
186098
|
}
|
|
185906
186099
|
})
|
|
@@ -185960,76 +186153,57 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
185960
186153
|
this.pendingProjectUpdates.delete(projectName);
|
|
185961
186154
|
});
|
|
185962
186155
|
this.throttledOperations.cancel(ensureProjectForOpenFileSchedule);
|
|
186156
|
+
this.pendingOpenFileProjectUpdates = void 0;
|
|
185963
186157
|
this.pendingEnsureProjectForOpenFiles = false;
|
|
185964
186158
|
this.configFileExistenceInfoCache.forEach((info) => {
|
|
185965
186159
|
if (info.config) info.config.updateLevel = 2 /* Full */;
|
|
185966
186160
|
});
|
|
185967
|
-
this.
|
|
186161
|
+
this.configFileForOpenFiles.clear();
|
|
185968
186162
|
this.externalProjects.forEach((project) => {
|
|
185969
186163
|
this.clearSemanticCache(project);
|
|
185970
186164
|
project.updateGraph();
|
|
185971
186165
|
});
|
|
185972
|
-
|
|
185973
|
-
|
|
185974
|
-
this.
|
|
185975
|
-
|
|
185976
|
-
|
|
185977
|
-
|
|
185978
|
-
|
|
185979
|
-
|
|
185980
|
-
|
|
185981
|
-
|
|
185982
|
-
|
|
185983
|
-
|
|
185984
|
-
|
|
185985
|
-
|
|
185986
|
-
if (tryAddToSet(updatedProjects, child)) {
|
|
185987
|
-
this.reloadConfiguredProject(
|
|
185988
|
-
child,
|
|
185989
|
-
reason,
|
|
185990
|
-
/*clearSemanticCache*/
|
|
185991
|
-
true
|
|
185992
|
-
);
|
|
185993
|
-
}
|
|
185994
|
-
};
|
|
185995
|
-
(_a = this.openFiles) == null ? void 0 : _a.forEach((_projectRoot, path) => {
|
|
185996
|
-
this.configFileForOpenFiles.delete(path);
|
|
185997
|
-
const info = this.getScriptInfoForPath(path);
|
|
185998
|
-
Debug.assert(info.isScriptOpen());
|
|
185999
|
-
const configFileName = this.getConfigFileNameForFile(info);
|
|
186000
|
-
if (configFileName) {
|
|
186001
|
-
const project = this.findConfiguredProjectByProjectName(configFileName) || this.createConfiguredProject(configFileName, reason);
|
|
186002
|
-
if (tryAddToSet(updatedProjects, project)) {
|
|
186003
|
-
this.reloadConfiguredProject(
|
|
186166
|
+
const reloadedConfiguredProjects = /* @__PURE__ */ new Set();
|
|
186167
|
+
const delayReloadedConfiguredProjects = /* @__PURE__ */ new Set();
|
|
186168
|
+
this.externalProjectToConfiguredProjectMap.forEach((projects, externalProjectName) => {
|
|
186169
|
+
const reason = `Reloading configured project in external project: ${externalProjectName}`;
|
|
186170
|
+
projects.forEach((project) => {
|
|
186171
|
+
if (this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) {
|
|
186172
|
+
if (!project.isInitialLoadPending()) {
|
|
186173
|
+
this.clearSemanticCache(project);
|
|
186174
|
+
project.pendingUpdateLevel = 2 /* Full */;
|
|
186175
|
+
project.pendingUpdateReason = reloadReason(reason);
|
|
186176
|
+
}
|
|
186177
|
+
delayReloadedConfiguredProjects.add(project);
|
|
186178
|
+
} else {
|
|
186179
|
+
this.reloadConfiguredProjectClearingSemanticCache(
|
|
186004
186180
|
project,
|
|
186005
186181
|
reason,
|
|
186006
|
-
|
|
186007
|
-
true
|
|
186182
|
+
reloadedConfiguredProjects
|
|
186008
186183
|
);
|
|
186009
|
-
if (!projectContainsInfoDirectly(project, info)) {
|
|
186010
|
-
const referencedProject = forEachResolvedProjectReferenceProject(
|
|
186011
|
-
project,
|
|
186012
|
-
info.path,
|
|
186013
|
-
(child) => {
|
|
186014
|
-
reloadChildProject(child);
|
|
186015
|
-
return projectContainsInfoDirectly(child, info);
|
|
186016
|
-
},
|
|
186017
|
-
1 /* FindCreate */,
|
|
186018
|
-
reason
|
|
186019
|
-
);
|
|
186020
|
-
if (referencedProject) {
|
|
186021
|
-
forEachResolvedProjectReferenceProject(
|
|
186022
|
-
project,
|
|
186023
|
-
/*fileName*/
|
|
186024
|
-
void 0,
|
|
186025
|
-
reloadChildProject,
|
|
186026
|
-
0 /* Find */
|
|
186027
|
-
);
|
|
186028
|
-
}
|
|
186029
|
-
}
|
|
186030
186184
|
}
|
|
186031
|
-
}
|
|
186185
|
+
});
|
|
186186
|
+
});
|
|
186187
|
+
this.openFiles.forEach((_projectRootPath, path) => {
|
|
186188
|
+
const info = this.getScriptInfoForPath(path);
|
|
186189
|
+
if (find(info.containingProjects, isExternalProject)) return;
|
|
186190
|
+
this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
186191
|
+
info,
|
|
186192
|
+
2 /* Reload */,
|
|
186193
|
+
reloadedConfiguredProjects,
|
|
186194
|
+
delayReloadedConfiguredProjects
|
|
186195
|
+
);
|
|
186032
186196
|
});
|
|
186197
|
+
delayReloadedConfiguredProjects.forEach((p) => reloadedConfiguredProjects.add(p));
|
|
186198
|
+
this.inferredProjects.forEach((project) => this.clearSemanticCache(project));
|
|
186199
|
+
this.ensureProjectForOpenFiles();
|
|
186200
|
+
this.cleanupProjectsAndScriptInfos(
|
|
186201
|
+
reloadedConfiguredProjects,
|
|
186202
|
+
new Set(this.openFiles.keys()),
|
|
186203
|
+
new Set(this.externalProjectToConfiguredProjectMap.keys())
|
|
186204
|
+
);
|
|
186205
|
+
this.logger.info("After reloading projects..");
|
|
186206
|
+
this.printProjects();
|
|
186033
186207
|
}
|
|
186034
186208
|
/**
|
|
186035
186209
|
* Remove the root of inferred project if script info is part of another project
|
|
@@ -186057,6 +186231,14 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186057
186231
|
ensureProjectForOpenFiles() {
|
|
186058
186232
|
this.logger.info("Before ensureProjectForOpenFiles:");
|
|
186059
186233
|
this.printProjects();
|
|
186234
|
+
const pendingOpenFileProjectUpdates = this.pendingOpenFileProjectUpdates;
|
|
186235
|
+
this.pendingOpenFileProjectUpdates = void 0;
|
|
186236
|
+
pendingOpenFileProjectUpdates == null ? void 0 : pendingOpenFileProjectUpdates.forEach(
|
|
186237
|
+
(_config, path) => this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
186238
|
+
this.getScriptInfoForPath(path),
|
|
186239
|
+
1 /* Create */
|
|
186240
|
+
)
|
|
186241
|
+
);
|
|
186060
186242
|
this.openFiles.forEach((projectRootPath, path) => {
|
|
186061
186243
|
const info = this.getScriptInfoForPath(path);
|
|
186062
186244
|
if (info.isOrphan()) {
|
|
@@ -186094,7 +186276,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186094
186276
|
const scriptInfo = this.getScriptInfo(fileName);
|
|
186095
186277
|
if (!scriptInfo && !this.host.fileExists(fileName)) return void 0;
|
|
186096
186278
|
const originalFileInfo = { fileName: toNormalizedPath(fileName), path: this.toPath(fileName) };
|
|
186097
|
-
const configFileName = this.getConfigFileNameForFile(
|
|
186279
|
+
const configFileName = this.getConfigFileNameForFile(
|
|
186280
|
+
originalFileInfo,
|
|
186281
|
+
/*findFromCacheOnly*/
|
|
186282
|
+
false
|
|
186283
|
+
);
|
|
186098
186284
|
if (!configFileName) return void 0;
|
|
186099
186285
|
let configuredProject = this.findConfiguredProjectByProjectName(configFileName);
|
|
186100
186286
|
if (!configuredProject) {
|
|
@@ -186109,17 +186295,14 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186109
186295
|
updateProjectIfDirty(configuredProject);
|
|
186110
186296
|
const projectContainsOriginalInfo = (project2) => {
|
|
186111
186297
|
const info = this.getScriptInfo(fileName);
|
|
186112
|
-
return info &&
|
|
186298
|
+
return info && project2.containsScriptInfo(info) && !project2.isSourceOfProjectReferenceRedirect(info.path);
|
|
186113
186299
|
};
|
|
186114
186300
|
if (configuredProject.isSolution() || !projectContainsOriginalInfo(configuredProject)) {
|
|
186115
186301
|
configuredProject = forEachResolvedProjectReferenceProject(
|
|
186116
186302
|
configuredProject,
|
|
186117
186303
|
fileName,
|
|
186118
|
-
(child) =>
|
|
186119
|
-
|
|
186120
|
-
return projectContainsOriginalInfo(child) ? child : void 0;
|
|
186121
|
-
},
|
|
186122
|
-
1 /* FindCreate */,
|
|
186304
|
+
(child) => projectContainsOriginalInfo(child) ? child : void 0,
|
|
186305
|
+
1 /* Create */,
|
|
186123
186306
|
`Creating project referenced in solution ${configuredProject.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`
|
|
186124
186307
|
);
|
|
186125
186308
|
if (!configuredProject) return void 0;
|
|
@@ -186168,107 +186351,148 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186168
186351
|
assignProjectToOpenedScriptInfo(info) {
|
|
186169
186352
|
let configFileName;
|
|
186170
186353
|
let configFileErrors;
|
|
186171
|
-
|
|
186354
|
+
const project = this.findExternalProjectContainingOpenScriptInfo(info);
|
|
186172
186355
|
let retainProjects;
|
|
186173
|
-
let projectForConfigFileDiag;
|
|
186174
186356
|
let sentConfigDiag;
|
|
186175
186357
|
if (!project && this.serverMode === 0 /* Semantic */) {
|
|
186176
|
-
|
|
186177
|
-
|
|
186178
|
-
|
|
186179
|
-
|
|
186180
|
-
|
|
186181
|
-
|
|
186182
|
-
|
|
186183
|
-
|
|
186184
|
-
|
|
186185
|
-
|
|
186186
|
-
false
|
|
186187
|
-
)) {
|
|
186188
|
-
(sentConfigDiag ?? (sentConfigDiag = /* @__PURE__ */ new Set())).add(project);
|
|
186189
|
-
}
|
|
186190
|
-
projectForConfigFileDiag = project.containsScriptInfo(info) ? project : void 0;
|
|
186191
|
-
retainProjects = project;
|
|
186192
|
-
if (!projectContainsInfoDirectly(project, info)) {
|
|
186193
|
-
forEachResolvedProjectReferenceProject(
|
|
186194
|
-
project,
|
|
186195
|
-
info.path,
|
|
186196
|
-
(child) => {
|
|
186197
|
-
if (updateWithTriggerFile(
|
|
186198
|
-
child,
|
|
186199
|
-
info.fileName,
|
|
186200
|
-
/*isReload*/
|
|
186201
|
-
false
|
|
186202
|
-
)) {
|
|
186203
|
-
(sentConfigDiag ?? (sentConfigDiag = /* @__PURE__ */ new Set())).add(child);
|
|
186204
|
-
}
|
|
186205
|
-
if (!isArray(retainProjects)) {
|
|
186206
|
-
retainProjects = [project, child];
|
|
186207
|
-
} else {
|
|
186208
|
-
retainProjects.push(child);
|
|
186209
|
-
}
|
|
186210
|
-
if (projectContainsInfoDirectly(child, info)) {
|
|
186211
|
-
projectForConfigFileDiag = child;
|
|
186212
|
-
return child;
|
|
186213
|
-
}
|
|
186214
|
-
if (!projectForConfigFileDiag && child.containsScriptInfo(info)) {
|
|
186215
|
-
projectForConfigFileDiag = child;
|
|
186216
|
-
}
|
|
186217
|
-
},
|
|
186218
|
-
1 /* FindCreate */,
|
|
186219
|
-
`Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`
|
|
186220
|
-
);
|
|
186221
|
-
}
|
|
186222
|
-
if (projectForConfigFileDiag) {
|
|
186223
|
-
configFileName = projectForConfigFileDiag.getConfigFilePath();
|
|
186224
|
-
configFileErrors = projectForConfigFileDiag.getAllProjectErrors();
|
|
186225
|
-
} else {
|
|
186226
|
-
configFileName = void 0;
|
|
186358
|
+
const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
186359
|
+
info,
|
|
186360
|
+
1 /* Create */
|
|
186361
|
+
);
|
|
186362
|
+
if (result) {
|
|
186363
|
+
retainProjects = result.seenProjects;
|
|
186364
|
+
sentConfigDiag = result.sentConfigDiag;
|
|
186365
|
+
if (result.defaultProject) {
|
|
186366
|
+
configFileName = result.defaultProject.getConfigFilePath();
|
|
186367
|
+
configFileErrors = result.defaultProject.getAllProjectErrors();
|
|
186227
186368
|
}
|
|
186228
|
-
this.createAncestorProjects(info, project);
|
|
186229
186369
|
}
|
|
186230
186370
|
}
|
|
186231
186371
|
info.containingProjects.forEach(updateProjectIfDirty);
|
|
186232
186372
|
if (info.isOrphan()) {
|
|
186233
|
-
|
|
186234
|
-
|
|
186235
|
-
|
|
186236
|
-
project2,
|
|
186237
|
-
info.fileName,
|
|
186238
|
-
/*force*/
|
|
186239
|
-
true
|
|
186240
|
-
);
|
|
186241
|
-
});
|
|
186242
|
-
} else if (retainProjects && !(sentConfigDiag == null ? void 0 : sentConfigDiag.has(retainProjects))) {
|
|
186243
|
-
this.sendConfigFileDiagEvent(
|
|
186244
|
-
retainProjects,
|
|
186373
|
+
retainProjects == null ? void 0 : retainProjects.forEach((project2) => {
|
|
186374
|
+
if (!sentConfigDiag.has(project2)) this.sendConfigFileDiagEvent(
|
|
186375
|
+
project2,
|
|
186245
186376
|
info.fileName,
|
|
186246
186377
|
/*force*/
|
|
186247
186378
|
true
|
|
186248
186379
|
);
|
|
186249
|
-
}
|
|
186380
|
+
});
|
|
186250
186381
|
Debug.assert(this.openFiles.has(info.path));
|
|
186251
186382
|
this.assignOrphanScriptInfoToInferredProject(info, this.openFiles.get(info.path));
|
|
186252
186383
|
}
|
|
186253
186384
|
Debug.assert(!info.isOrphan());
|
|
186254
186385
|
return { configFileName, configFileErrors, retainProjects };
|
|
186255
186386
|
}
|
|
186256
|
-
|
|
186257
|
-
|
|
186258
|
-
|
|
186259
|
-
|
|
186260
|
-
|
|
186261
|
-
|
|
186262
|
-
|
|
186263
|
-
|
|
186264
|
-
|
|
186265
|
-
|
|
186266
|
-
|
|
186267
|
-
|
|
186268
|
-
|
|
186269
|
-
|
|
186270
|
-
|
|
186387
|
+
/**
|
|
186388
|
+
* Depending on kind
|
|
186389
|
+
* - Find the configuedProject and return it - if allowDeferredClosed is set it will find the deferredClosed project as well
|
|
186390
|
+
* - Create - if the project doesnt exist, it creates one as well. If not delayLoad, the project is updated (with triggerFile if passed)
|
|
186391
|
+
* - Reload - if the project doesnt exist, it creates one. If not delayLoad, the project is reloaded clearing semantic cache
|
|
186392
|
+
* @internal
|
|
186393
|
+
*/
|
|
186394
|
+
findCreateOrReloadConfiguredProject(configFileName, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects, delayLoad, delayReloadedConfiguredProjects) {
|
|
186395
|
+
let project = this.findConfiguredProjectByProjectName(configFileName, allowDeferredClosed);
|
|
186396
|
+
let sentConfigFileDiag = false;
|
|
186397
|
+
switch (kind) {
|
|
186398
|
+
case 0 /* Find */:
|
|
186399
|
+
if (!project) return;
|
|
186400
|
+
break;
|
|
186401
|
+
case 1 /* Create */:
|
|
186402
|
+
project ?? (project = this.createConfiguredProject(configFileName, reason));
|
|
186403
|
+
sentConfigFileDiag = !delayLoad && updateConfiguredProject(project, triggerFile);
|
|
186404
|
+
break;
|
|
186405
|
+
case 2 /* Reload */:
|
|
186406
|
+
project ?? (project = this.createConfiguredProject(configFileName, reloadReason(reason)));
|
|
186407
|
+
sentConfigFileDiag = !delayReloadedConfiguredProjects && this.reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects);
|
|
186408
|
+
if (delayReloadedConfiguredProjects && !delayReloadedConfiguredProjects.has(project) && !reloadedProjects.has(project)) {
|
|
186409
|
+
project.pendingUpdateLevel = 2 /* Full */;
|
|
186410
|
+
project.pendingUpdateReason = reloadReason(reason);
|
|
186411
|
+
delayReloadedConfiguredProjects.add(project);
|
|
186412
|
+
}
|
|
186413
|
+
break;
|
|
186414
|
+
default:
|
|
186415
|
+
Debug.assertNever(kind);
|
|
186416
|
+
}
|
|
186417
|
+
return { project, sentConfigFileDiag };
|
|
186418
|
+
}
|
|
186419
|
+
/**
|
|
186420
|
+
* Finds the default configured project for given info
|
|
186421
|
+
* For any tsconfig found, it looks into that project, if not then all its references,
|
|
186422
|
+
* The search happens for all tsconfigs till projectRootPath
|
|
186423
|
+
*/
|
|
186424
|
+
tryFindDefaultConfiguredProjectForOpenScriptInfo(info, kind, allowDeferredClosed, reloadedProjects) {
|
|
186425
|
+
const configFileName = this.getConfigFileNameForFile(info, kind === 0 /* Find */);
|
|
186426
|
+
if (!configFileName) return;
|
|
186427
|
+
const result = this.findCreateOrReloadConfiguredProject(
|
|
186428
|
+
configFileName,
|
|
186429
|
+
kind,
|
|
186430
|
+
fileOpenReason(info),
|
|
186431
|
+
allowDeferredClosed,
|
|
186432
|
+
info.fileName,
|
|
186433
|
+
reloadedProjects
|
|
186434
|
+
);
|
|
186435
|
+
if (!result) return;
|
|
186436
|
+
const seenProjects = /* @__PURE__ */ new Set();
|
|
186437
|
+
const sentConfigDiag = new Set(result.sentConfigFileDiag ? [result.project] : void 0);
|
|
186438
|
+
let defaultProject;
|
|
186439
|
+
let possiblyDefault;
|
|
186440
|
+
tryFindDefaultConfiguredProject(result.project);
|
|
186441
|
+
return {
|
|
186442
|
+
defaultProject: defaultProject ?? possiblyDefault,
|
|
186443
|
+
sentConfigDiag,
|
|
186444
|
+
seenProjects
|
|
186445
|
+
};
|
|
186446
|
+
function tryFindDefaultConfiguredProject(project) {
|
|
186447
|
+
return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project);
|
|
186448
|
+
}
|
|
186449
|
+
function isDefaultProject(project) {
|
|
186450
|
+
if (!tryAddToSet(seenProjects, project)) return;
|
|
186451
|
+
const projectWithInfo = project.containsScriptInfo(info);
|
|
186452
|
+
if (projectWithInfo && !project.isSourceOfProjectReferenceRedirect(info.path)) return defaultProject = project;
|
|
186453
|
+
possiblyDefault ?? (possiblyDefault = projectWithInfo ? project : void 0);
|
|
186454
|
+
}
|
|
186455
|
+
function tryFindDefaultConfiguredProjectFromReferences(project) {
|
|
186456
|
+
return forEachResolvedProjectReferenceProject(
|
|
186457
|
+
project,
|
|
186458
|
+
info.path,
|
|
186459
|
+
(child, sentConfigFileDiag) => {
|
|
186460
|
+
if (sentConfigFileDiag) sentConfigDiag.add(child);
|
|
186461
|
+
return isDefaultProject(child);
|
|
186462
|
+
},
|
|
186463
|
+
kind,
|
|
186464
|
+
`Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`,
|
|
186465
|
+
allowDeferredClosed,
|
|
186466
|
+
info.fileName,
|
|
186467
|
+
reloadedProjects
|
|
186468
|
+
);
|
|
186469
|
+
}
|
|
186470
|
+
}
|
|
186471
|
+
tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(info, kind, reloadedProjects, delayReloadedConfiguredProjects) {
|
|
186472
|
+
const allowDeferredClosed = kind === 0 /* Find */;
|
|
186473
|
+
const result = this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
|
|
186474
|
+
info,
|
|
186475
|
+
kind,
|
|
186476
|
+
allowDeferredClosed,
|
|
186477
|
+
reloadedProjects
|
|
186478
|
+
);
|
|
186479
|
+
if (!result) return;
|
|
186480
|
+
const { defaultProject, seenProjects } = result;
|
|
186481
|
+
if (defaultProject) {
|
|
186482
|
+
forEachAncestorProject(
|
|
186483
|
+
info,
|
|
186484
|
+
defaultProject,
|
|
186485
|
+
(ancestor) => {
|
|
186486
|
+
seenProjects.add(ancestor);
|
|
186487
|
+
},
|
|
186488
|
+
kind,
|
|
186489
|
+
`Creating project possibly referencing default composite project ${defaultProject.getProjectName()} of open file ${info.fileName}`,
|
|
186490
|
+
allowDeferredClosed,
|
|
186491
|
+
reloadedProjects,
|
|
186492
|
+
delayReloadedConfiguredProjects
|
|
186493
|
+
);
|
|
186271
186494
|
}
|
|
186495
|
+
return result;
|
|
186272
186496
|
}
|
|
186273
186497
|
/** @internal */
|
|
186274
186498
|
loadAncestorProjectTree(forProjects) {
|
|
@@ -186295,13 +186519,27 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186295
186519
|
const referencedProject = forEachResolvedProjectReference(child.references, (ref) => forProjects.has(ref.sourceFile.path) ? ref : void 0);
|
|
186296
186520
|
if (!referencedProject) continue;
|
|
186297
186521
|
const configFileName = toNormalizedPath(child.sourceFile.fileName);
|
|
186298
|
-
const childProject =
|
|
186522
|
+
const childProject = this.findConfiguredProjectByProjectName(configFileName) ?? this.createConfiguredProject(
|
|
186523
|
+
configFileName,
|
|
186524
|
+
`Creating project referenced by : ${project.projectName} as it references project ${referencedProject.sourceFile.fileName}`
|
|
186525
|
+
);
|
|
186299
186526
|
updateProjectIfDirty(childProject);
|
|
186300
186527
|
this.ensureProjectChildren(childProject, forProjects, seenProjects);
|
|
186301
186528
|
}
|
|
186302
186529
|
}
|
|
186303
|
-
|
|
186304
|
-
this.
|
|
186530
|
+
cleanupConfiguredProjects(toRetainConfiguredProjects, externalProjectsRetainingConfiguredProjects, openFilesWithRetainedConfiguredProject) {
|
|
186531
|
+
this.getOrphanConfiguredProjects(
|
|
186532
|
+
toRetainConfiguredProjects,
|
|
186533
|
+
openFilesWithRetainedConfiguredProject,
|
|
186534
|
+
externalProjectsRetainingConfiguredProjects
|
|
186535
|
+
).forEach((project) => this.removeProject(project));
|
|
186536
|
+
}
|
|
186537
|
+
cleanupProjectsAndScriptInfos(toRetainConfiguredProjects, openFilesWithRetainedConfiguredProject, externalProjectsRetainingConfiguredProjects) {
|
|
186538
|
+
this.cleanupConfiguredProjects(
|
|
186539
|
+
toRetainConfiguredProjects,
|
|
186540
|
+
externalProjectsRetainingConfiguredProjects,
|
|
186541
|
+
openFilesWithRetainedConfiguredProject
|
|
186542
|
+
);
|
|
186305
186543
|
for (const inferredProject of this.inferredProjects.slice()) {
|
|
186306
186544
|
if (inferredProject.isOrphan()) {
|
|
186307
186545
|
this.removeProject(inferredProject);
|
|
@@ -186312,17 +186550,18 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186312
186550
|
openClientFileWithNormalizedPath(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
|
|
186313
186551
|
const info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
|
|
186314
186552
|
const { retainProjects, ...result } = this.assignProjectToOpenedScriptInfo(info);
|
|
186315
|
-
this.
|
|
186553
|
+
this.cleanupProjectsAndScriptInfos(
|
|
186554
|
+
retainProjects,
|
|
186555
|
+
/* @__PURE__ */ new Set([info.path]),
|
|
186556
|
+
/*externalProjectsRetainingConfiguredProjects*/
|
|
186557
|
+
void 0
|
|
186558
|
+
);
|
|
186316
186559
|
this.telemetryOnOpenFile(info);
|
|
186317
186560
|
this.printProjects();
|
|
186318
186561
|
return result;
|
|
186319
186562
|
}
|
|
186320
|
-
removeOrphanConfiguredProjects(toRetainConfiguredProjects) {
|
|
186321
|
-
const orphanConfiguredProjects = this.getOrphanConfiguredProjects(toRetainConfiguredProjects);
|
|
186322
|
-
orphanConfiguredProjects.forEach((project) => this.removeProject(project));
|
|
186323
|
-
}
|
|
186324
186563
|
/** @internal */
|
|
186325
|
-
getOrphanConfiguredProjects(toRetainConfiguredProjects) {
|
|
186564
|
+
getOrphanConfiguredProjects(toRetainConfiguredProjects, openFilesWithRetainedConfiguredProject, externalProjectsRetainingConfiguredProjects) {
|
|
186326
186565
|
const toRemoveConfiguredProjects = new Set(this.configuredProjects.values());
|
|
186327
186566
|
const markOriginalProjectsAsUsed = (project) => {
|
|
186328
186567
|
if (project.originalConfiguredProjects && (isConfiguredProject(project) || !project.isOrphan())) {
|
|
@@ -186334,32 +186573,45 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186334
186573
|
);
|
|
186335
186574
|
}
|
|
186336
186575
|
};
|
|
186337
|
-
|
|
186338
|
-
if (isArray(toRetainConfiguredProjects)) {
|
|
186339
|
-
toRetainConfiguredProjects.forEach(retainConfiguredProject);
|
|
186340
|
-
} else {
|
|
186341
|
-
retainConfiguredProject(toRetainConfiguredProjects);
|
|
186342
|
-
}
|
|
186343
|
-
}
|
|
186576
|
+
toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach(retainConfiguredProject);
|
|
186344
186577
|
this.inferredProjects.forEach(markOriginalProjectsAsUsed);
|
|
186345
186578
|
this.externalProjects.forEach(markOriginalProjectsAsUsed);
|
|
186579
|
+
this.externalProjectToConfiguredProjectMap.forEach((projects, externalProjectName) => {
|
|
186580
|
+
if (!(externalProjectsRetainingConfiguredProjects == null ? void 0 : externalProjectsRetainingConfiguredProjects.has(externalProjectName))) {
|
|
186581
|
+
projects.forEach(retainConfiguredProject);
|
|
186582
|
+
}
|
|
186583
|
+
});
|
|
186584
|
+
this.openFiles.forEach((_projectRootPath, path) => {
|
|
186585
|
+
if (openFilesWithRetainedConfiguredProject == null ? void 0 : openFilesWithRetainedConfiguredProject.has(path)) return;
|
|
186586
|
+
const info = this.getScriptInfoForPath(path);
|
|
186587
|
+
if (find(info.containingProjects, isExternalProject)) return;
|
|
186588
|
+
const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
186589
|
+
info,
|
|
186590
|
+
0 /* Find */
|
|
186591
|
+
);
|
|
186592
|
+
if (result == null ? void 0 : result.defaultProject) {
|
|
186593
|
+
result == null ? void 0 : result.seenProjects.forEach(retainConfiguredProject);
|
|
186594
|
+
}
|
|
186595
|
+
});
|
|
186346
186596
|
this.configuredProjects.forEach((project) => {
|
|
186347
|
-
if (
|
|
186348
|
-
|
|
186349
|
-
|
|
186350
|
-
|
|
186351
|
-
retainConfiguredProject(project);
|
|
186597
|
+
if (toRemoveConfiguredProjects.has(project)) {
|
|
186598
|
+
if (isPendingUpdate(project) || forEachReferencedProject(project, isRetained)) {
|
|
186599
|
+
retainConfiguredProject(project);
|
|
186600
|
+
}
|
|
186352
186601
|
}
|
|
186353
186602
|
});
|
|
186354
186603
|
return toRemoveConfiguredProjects;
|
|
186355
186604
|
function isRetained(project) {
|
|
186356
|
-
return !toRemoveConfiguredProjects.has(project) || project
|
|
186605
|
+
return !toRemoveConfiguredProjects.has(project) || isPendingUpdate(project);
|
|
186606
|
+
}
|
|
186607
|
+
function isPendingUpdate(project) {
|
|
186608
|
+
var _a, _b;
|
|
186609
|
+
return (project.deferredClose || project.projectService.hasPendingProjectUpdate(project)) && !!((_b = (_a = project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath)) == null ? void 0 : _a.openFilesImpactedByConfigFile) == null ? void 0 : _b.size);
|
|
186357
186610
|
}
|
|
186358
186611
|
function retainConfiguredProject(project) {
|
|
186359
|
-
if (toRemoveConfiguredProjects.delete(project))
|
|
186360
|
-
|
|
186361
|
-
|
|
186362
|
-
}
|
|
186612
|
+
if (!toRemoveConfiguredProjects.delete(project)) return;
|
|
186613
|
+
markOriginalProjectsAsUsed(project);
|
|
186614
|
+
forEachReferencedProject(project, retainConfiguredProject);
|
|
186363
186615
|
}
|
|
186364
186616
|
}
|
|
186365
186617
|
removeOrphanScriptInfos() {
|
|
@@ -186474,14 +186726,20 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186474
186726
|
}
|
|
186475
186727
|
}
|
|
186476
186728
|
let retainProjects;
|
|
186477
|
-
|
|
186478
|
-
|
|
186479
|
-
|
|
186729
|
+
openScriptInfos == null ? void 0 : openScriptInfos.forEach((info) => {
|
|
186730
|
+
var _a;
|
|
186731
|
+
return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach((p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Set())).add(p));
|
|
186732
|
+
});
|
|
186480
186733
|
if (assignOrphanScriptInfosToInferredProject) {
|
|
186481
186734
|
this.assignOrphanScriptInfosToInferredProject();
|
|
186482
186735
|
}
|
|
186483
186736
|
if (openScriptInfos) {
|
|
186484
|
-
this.
|
|
186737
|
+
this.cleanupProjectsAndScriptInfos(
|
|
186738
|
+
retainProjects,
|
|
186739
|
+
new Set(openScriptInfos.map((info) => info.path)),
|
|
186740
|
+
/*externalProjectsRetainingConfiguredProjects*/
|
|
186741
|
+
void 0
|
|
186742
|
+
);
|
|
186485
186743
|
openScriptInfos.forEach((info) => this.telemetryOnOpenFile(info));
|
|
186486
186744
|
this.printProjects();
|
|
186487
186745
|
} else if (length(closedFiles)) {
|
|
@@ -186494,20 +186752,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186494
186752
|
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
|
|
186495
186753
|
}
|
|
186496
186754
|
}
|
|
186497
|
-
closeConfiguredProjectReferencedFromExternalProject(configuredProjects) {
|
|
186498
|
-
configuredProjects == null ? void 0 : configuredProjects.forEach((configuredProject) => {
|
|
186499
|
-
if (!configuredProject.isClosed()) {
|
|
186500
|
-
configuredProject.deleteExternalProjectReference();
|
|
186501
|
-
if (!configuredProject.hasOpenRef()) this.removeProject(configuredProject);
|
|
186502
|
-
}
|
|
186503
|
-
});
|
|
186504
|
-
}
|
|
186505
186755
|
// eslint-disable-line @typescript-eslint/unified-signatures
|
|
186506
|
-
closeExternalProject(uncheckedFileName,
|
|
186756
|
+
closeExternalProject(uncheckedFileName, cleanupAfter) {
|
|
186507
186757
|
const fileName = toNormalizedPath(uncheckedFileName);
|
|
186508
|
-
const
|
|
186509
|
-
if (
|
|
186510
|
-
this.closeConfiguredProjectReferencedFromExternalProject(configuredProjects);
|
|
186758
|
+
const projects = this.externalProjectToConfiguredProjectMap.get(fileName);
|
|
186759
|
+
if (projects) {
|
|
186511
186760
|
this.externalProjectToConfiguredProjectMap.delete(fileName);
|
|
186512
186761
|
} else {
|
|
186513
186762
|
const externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
|
|
@@ -186515,28 +186764,28 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186515
186764
|
this.removeProject(externalProject);
|
|
186516
186765
|
}
|
|
186517
186766
|
}
|
|
186518
|
-
if (
|
|
186767
|
+
if (cleanupAfter) {
|
|
186768
|
+
this.cleanupConfiguredProjects();
|
|
186769
|
+
this.printProjects();
|
|
186770
|
+
}
|
|
186519
186771
|
}
|
|
186520
186772
|
openExternalProjects(projects) {
|
|
186521
|
-
const projectsToClose =
|
|
186522
|
-
|
|
186523
|
-
projectsToClose.set(externalProjectName, true);
|
|
186524
|
-
});
|
|
186773
|
+
const projectsToClose = new Set(this.externalProjects.map((p) => p.getProjectName()));
|
|
186774
|
+
this.externalProjectToConfiguredProjectMap.forEach((_, externalProjectName) => projectsToClose.add(externalProjectName));
|
|
186525
186775
|
for (const externalProject of projects) {
|
|
186526
186776
|
this.openExternalProject(
|
|
186527
186777
|
externalProject,
|
|
186528
|
-
/*
|
|
186778
|
+
/*cleanupAfter*/
|
|
186529
186779
|
false
|
|
186530
186780
|
);
|
|
186531
186781
|
projectsToClose.delete(externalProject.projectFileName);
|
|
186532
186782
|
}
|
|
186533
|
-
|
|
186534
|
-
|
|
186535
|
-
|
|
186536
|
-
|
|
186537
|
-
|
|
186538
|
-
|
|
186539
|
-
});
|
|
186783
|
+
projectsToClose.forEach((externalProjectName) => this.closeExternalProject(
|
|
186784
|
+
externalProjectName,
|
|
186785
|
+
/*cleanupAfter*/
|
|
186786
|
+
false
|
|
186787
|
+
));
|
|
186788
|
+
this.cleanupConfiguredProjects();
|
|
186540
186789
|
this.printProjects();
|
|
186541
186790
|
}
|
|
186542
186791
|
static escapeFilenameForRegex(filename) {
|
|
@@ -186641,9 +186890,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186641
186890
|
}
|
|
186642
186891
|
}
|
|
186643
186892
|
// eslint-disable-line @typescript-eslint/unified-signatures
|
|
186644
|
-
openExternalProject(proj,
|
|
186893
|
+
openExternalProject(proj, cleanupAfter) {
|
|
186645
186894
|
const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
|
|
186646
|
-
const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
|
|
186647
186895
|
let configuredProjects;
|
|
186648
186896
|
let rootFiles = [];
|
|
186649
186897
|
for (const file of proj.rootFiles) {
|
|
@@ -186652,18 +186900,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186652
186900
|
if (this.serverMode === 0 /* Semantic */ && this.host.fileExists(normalized)) {
|
|
186653
186901
|
let project = this.findConfiguredProjectByProjectName(normalized);
|
|
186654
186902
|
if (!project) {
|
|
186655
|
-
project = this.
|
|
186656
|
-
|
|
186657
|
-
`Creating configured project in external project: ${proj.projectFileName}`,
|
|
186658
|
-
/*triggerFile*/
|
|
186659
|
-
void 0
|
|
186660
|
-
);
|
|
186661
|
-
}
|
|
186662
|
-
if (!(existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.has(project))) {
|
|
186663
|
-
project.addExternalProjectReference();
|
|
186903
|
+
project = this.createConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
186904
|
+
if (!this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) project.updateGraph();
|
|
186664
186905
|
}
|
|
186665
186906
|
(configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
|
|
186666
|
-
|
|
186907
|
+
Debug.assert(!project.isClosed());
|
|
186667
186908
|
}
|
|
186668
186909
|
} else {
|
|
186669
186910
|
rootFiles.push(file);
|
|
@@ -186701,8 +186942,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186701
186942
|
project.updateGraph();
|
|
186702
186943
|
}
|
|
186703
186944
|
}
|
|
186704
|
-
|
|
186705
|
-
|
|
186945
|
+
if (cleanupAfter) {
|
|
186946
|
+
this.cleanupConfiguredProjects(
|
|
186947
|
+
configuredProjects,
|
|
186948
|
+
new Set(proj.projectFileName)
|
|
186949
|
+
);
|
|
186950
|
+
this.printProjects();
|
|
186951
|
+
}
|
|
186706
186952
|
}
|
|
186707
186953
|
hasDeferredExtension() {
|
|
186708
186954
|
for (const extension of this.hostConfiguration.extraFileExtensions) {
|
|
@@ -187616,7 +187862,7 @@ var Session3 = class _Session {
|
|
|
187616
187862
|
["openExternalProject" /* OpenExternalProject */]: (request) => {
|
|
187617
187863
|
this.projectService.openExternalProject(
|
|
187618
187864
|
request.arguments,
|
|
187619
|
-
/*
|
|
187865
|
+
/*cleanupAfter*/
|
|
187620
187866
|
true
|
|
187621
187867
|
);
|
|
187622
187868
|
return this.requiredResponse(
|
|
@@ -187634,7 +187880,7 @@ var Session3 = class _Session {
|
|
|
187634
187880
|
["closeExternalProject" /* CloseExternalProject */]: (request) => {
|
|
187635
187881
|
this.projectService.closeExternalProject(
|
|
187636
187882
|
request.arguments.projectFileName,
|
|
187637
|
-
/*
|
|
187883
|
+
/*cleanupAfter*/
|
|
187638
187884
|
true
|
|
187639
187885
|
);
|
|
187640
187886
|
return this.requiredResponse(
|
|
@@ -191359,6 +191605,7 @@ __export(ts_server_exports4, {
|
|
|
191359
191605
|
CommandNames: () => CommandNames,
|
|
191360
191606
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
191361
191607
|
ConfiguredProject: () => ConfiguredProject2,
|
|
191608
|
+
ConfiguredProjectLoadKind: () => ConfiguredProjectLoadKind,
|
|
191362
191609
|
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
191363
191610
|
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
191364
191611
|
Errors: () => Errors,
|
|
@@ -191366,7 +191613,7 @@ __export(ts_server_exports4, {
|
|
|
191366
191613
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
191367
191614
|
EventInitializationFailed: () => EventInitializationFailed,
|
|
191368
191615
|
EventTypesRegistry: () => EventTypesRegistry,
|
|
191369
|
-
ExternalProject: () =>
|
|
191616
|
+
ExternalProject: () => ExternalProject,
|
|
191370
191617
|
GcTimer: () => GcTimer,
|
|
191371
191618
|
InferredProject: () => InferredProject2,
|
|
191372
191619
|
LargeFileReferencedEvent: () => LargeFileReferencedEvent,
|
|
@@ -191382,7 +191629,6 @@ __export(ts_server_exports4, {
|
|
|
191382
191629
|
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
|
|
191383
191630
|
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
|
|
191384
191631
|
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
|
|
191385
|
-
ProjectReferenceProjectLoadKind: () => ProjectReferenceProjectLoadKind,
|
|
191386
191632
|
ProjectService: () => ProjectService3,
|
|
191387
191633
|
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
|
|
191388
191634
|
ScriptInfo: () => ScriptInfo,
|
|
@@ -191434,7 +191680,6 @@ __export(ts_server_exports4, {
|
|
|
191434
191680
|
nowString: () => nowString,
|
|
191435
191681
|
nullCancellationToken: () => nullCancellationToken,
|
|
191436
191682
|
nullTypingsInstaller: () => nullTypingsInstaller,
|
|
191437
|
-
projectContainsInfoDirectly: () => projectContainsInfoDirectly,
|
|
191438
191683
|
protocol: () => ts_server_protocol_exports,
|
|
191439
191684
|
removeSorted: () => removeSorted,
|
|
191440
191685
|
stringifyIndented: () => stringifyIndented,
|
|
@@ -191496,7 +191741,6 @@ if (typeof console !== "undefined") {
|
|
|
191496
191741
|
EmitHint,
|
|
191497
191742
|
EmitOnly,
|
|
191498
191743
|
EndOfLineState,
|
|
191499
|
-
EnumKind,
|
|
191500
191744
|
ExitStatus,
|
|
191501
191745
|
ExportKind,
|
|
191502
191746
|
Extension,
|