typescript 5.1.0-dev.20230426 → 5.1.0-dev.20230428
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 +261 -32
- package/lib/tsserver.js +383 -131
- package/lib/tsserverlibrary.d.ts +10 -9
- package/lib/tsserverlibrary.js +381 -132
- package/lib/typescript.d.ts +9 -6
- package/lib/typescript.js +264 -33
- package/lib/typingsInstaller.js +23 -196
- package/package.json +2 -2
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230428`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4737,10 +4737,10 @@ ${lanes.join("\n")}
|
|
|
4737
4737
|
LanguageVariant4[LanguageVariant4["JSX"] = 1] = "JSX";
|
|
4738
4738
|
return LanguageVariant4;
|
|
4739
4739
|
})(LanguageVariant || {});
|
|
4740
|
-
WatchDirectoryFlags = /* @__PURE__ */ ((
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
return
|
|
4740
|
+
WatchDirectoryFlags = /* @__PURE__ */ ((WatchDirectoryFlags3) => {
|
|
4741
|
+
WatchDirectoryFlags3[WatchDirectoryFlags3["None"] = 0] = "None";
|
|
4742
|
+
WatchDirectoryFlags3[WatchDirectoryFlags3["Recursive"] = 1] = "Recursive";
|
|
4743
|
+
return WatchDirectoryFlags3;
|
|
4744
4744
|
})(WatchDirectoryFlags || {});
|
|
4745
4745
|
CharacterCodes = /* @__PURE__ */ ((CharacterCodes2) => {
|
|
4746
4746
|
CharacterCodes2[CharacterCodes2["nullCharacter"] = 0] = "nullCharacter";
|
|
@@ -15388,6 +15388,7 @@ ${lanes.join("\n")}
|
|
|
15388
15388
|
case 171 /* PropertyDeclaration */:
|
|
15389
15389
|
case 170 /* PropertySignature */:
|
|
15390
15390
|
case 252 /* ReturnStatement */:
|
|
15391
|
+
case 239 /* SemicolonClassElement */:
|
|
15391
15392
|
case 177 /* SetAccessor */:
|
|
15392
15393
|
case 303 /* ShorthandPropertyAssignment */:
|
|
15393
15394
|
case 304 /* SpreadAssignment */:
|
|
@@ -33583,11 +33584,11 @@ ${lanes.join("\n")}
|
|
|
33583
33584
|
}
|
|
33584
33585
|
function parseClassElement() {
|
|
33585
33586
|
const pos = getNodePos();
|
|
33587
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
33586
33588
|
if (token() === 27 /* SemicolonToken */) {
|
|
33587
33589
|
nextToken();
|
|
33588
|
-
return finishNode(factory2.createSemicolonClassElement(), pos);
|
|
33590
|
+
return withJSDoc(finishNode(factory2.createSemicolonClassElement(), pos), hasJSDoc);
|
|
33589
33591
|
}
|
|
33590
|
-
const hasJSDoc = hasPrecedingJSDocComment();
|
|
33591
33592
|
const modifiers = parseModifiers(
|
|
33592
33593
|
/*allowDecorators*/
|
|
33593
33594
|
true,
|
|
@@ -46083,13 +46084,14 @@ ${lanes.join("\n")}
|
|
|
46083
46084
|
return diagnostic;
|
|
46084
46085
|
}
|
|
46085
46086
|
function isDeprecatedSymbol(symbol) {
|
|
46086
|
-
|
|
46087
|
-
|
|
46088
|
-
|
|
46089
|
-
return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
|
|
46090
|
-
}
|
|
46087
|
+
const parentSymbol = getParentOfSymbol(symbol);
|
|
46088
|
+
if (parentSymbol && length(symbol.declarations) > 1) {
|
|
46089
|
+
return parentSymbol.flags & 64 /* Interface */ ? some(symbol.declarations, isDeprecatedDeclaration2) : every(symbol.declarations, isDeprecatedDeclaration2);
|
|
46091
46090
|
}
|
|
46092
|
-
return !!(
|
|
46091
|
+
return !!symbol.valueDeclaration && isDeprecatedDeclaration2(symbol.valueDeclaration) || length(symbol.declarations) && every(symbol.declarations, isDeprecatedDeclaration2);
|
|
46092
|
+
}
|
|
46093
|
+
function isDeprecatedDeclaration2(declaration) {
|
|
46094
|
+
return !!(getCombinedNodeFlags(declaration) & 268435456 /* Deprecated */);
|
|
46093
46095
|
}
|
|
46094
46096
|
function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
|
|
46095
46097
|
const diagnostic = createDiagnosticForNode(location, Diagnostics._0_is_deprecated, deprecatedEntity);
|
|
@@ -56982,16 +56984,16 @@ ${lanes.join("\n")}
|
|
|
56982
56984
|
if (declaration.kind === 175 /* Constructor */) {
|
|
56983
56985
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
56984
56986
|
}
|
|
56987
|
+
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
56985
56988
|
if (isJSDocSignature(declaration)) {
|
|
56986
56989
|
const root = getJSDocRoot(declaration);
|
|
56987
|
-
if (root && isConstructorDeclaration(root.parent)) {
|
|
56990
|
+
if (root && isConstructorDeclaration(root.parent) && !typeNode) {
|
|
56988
56991
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
56989
56992
|
}
|
|
56990
56993
|
}
|
|
56991
56994
|
if (isJSDocConstructSignature(declaration)) {
|
|
56992
56995
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
56993
56996
|
}
|
|
56994
|
-
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
56995
56997
|
if (typeNode) {
|
|
56996
56998
|
return getTypeFromTypeNode(typeNode);
|
|
56997
56999
|
}
|
|
@@ -68249,7 +68251,7 @@ ${lanes.join("\n")}
|
|
|
68249
68251
|
markAliasReferenced(symbol, node);
|
|
68250
68252
|
}
|
|
68251
68253
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
68252
|
-
const targetSymbol =
|
|
68254
|
+
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
68253
68255
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
68254
68256
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
68255
68257
|
}
|
|
@@ -69418,6 +69420,7 @@ ${lanes.join("\n")}
|
|
|
69418
69420
|
);
|
|
69419
69421
|
}
|
|
69420
69422
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
69423
|
+
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
69421
69424
|
return discriminateTypeByDiscriminableItems(
|
|
69422
69425
|
contextualType,
|
|
69423
69426
|
concatenate(
|
|
@@ -69428,7 +69431,14 @@ ${lanes.join("\n")}
|
|
|
69428
69431
|
map(
|
|
69429
69432
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
69430
69433
|
var _a;
|
|
69431
|
-
|
|
69434
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
69435
|
+
return false;
|
|
69436
|
+
}
|
|
69437
|
+
const element = node.parent.parent;
|
|
69438
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
69439
|
+
return false;
|
|
69440
|
+
}
|
|
69441
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
69432
69442
|
}),
|
|
69433
69443
|
(s) => [() => undefinedType, s.escapedName]
|
|
69434
69444
|
)
|
|
@@ -71245,8 +71255,9 @@ ${lanes.join("\n")}
|
|
|
71245
71255
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
71246
71256
|
}
|
|
71247
71257
|
} else {
|
|
71248
|
-
|
|
71249
|
-
|
|
71258
|
+
const targetPropSymbol = resolveAliasWithDeprecationCheck(prop, right);
|
|
71259
|
+
if (isDeprecatedSymbol(targetPropSymbol) && isUncalledFunctionReference(node, targetPropSymbol) && targetPropSymbol.declarations) {
|
|
71260
|
+
addDeprecatedSuggestion(right, targetPropSymbol.declarations, right.escapedText);
|
|
71250
71261
|
}
|
|
71251
71262
|
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
|
|
71252
71263
|
markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
|
|
@@ -81522,19 +81533,17 @@ ${lanes.join("\n")}
|
|
|
81522
81533
|
}
|
|
81523
81534
|
}
|
|
81524
81535
|
if (isImportSpecifier(node)) {
|
|
81525
|
-
const targetSymbol =
|
|
81526
|
-
if (
|
|
81536
|
+
const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
|
|
81537
|
+
if (isDeprecatedSymbol(targetSymbol) && targetSymbol.declarations) {
|
|
81527
81538
|
addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
|
|
81528
81539
|
}
|
|
81529
81540
|
}
|
|
81530
81541
|
}
|
|
81531
81542
|
}
|
|
81532
|
-
function
|
|
81533
|
-
|
|
81534
|
-
}
|
|
81535
|
-
function checkDeprecatedAliasedSymbol(symbol, location) {
|
|
81536
|
-
if (!(symbol.flags & 2097152 /* Alias */))
|
|
81543
|
+
function resolveAliasWithDeprecationCheck(symbol, location) {
|
|
81544
|
+
if (!(symbol.flags & 2097152 /* Alias */) || isDeprecatedSymbol(symbol) || !getDeclarationOfAliasSymbol(symbol)) {
|
|
81537
81545
|
return symbol;
|
|
81546
|
+
}
|
|
81538
81547
|
const targetSymbol = resolveAlias(symbol);
|
|
81539
81548
|
if (targetSymbol === unknownSymbol)
|
|
81540
81549
|
return targetSymbol;
|
|
@@ -81544,7 +81553,7 @@ ${lanes.join("\n")}
|
|
|
81544
81553
|
if (target === targetSymbol)
|
|
81545
81554
|
break;
|
|
81546
81555
|
if (target.declarations && length(target.declarations)) {
|
|
81547
|
-
if (
|
|
81556
|
+
if (isDeprecatedSymbol(target)) {
|
|
81548
81557
|
addDeprecatedSuggestion(location, target.declarations, target.escapedName);
|
|
81549
81558
|
break;
|
|
81550
81559
|
} else {
|
|
@@ -104283,12 +104292,56 @@ ${lanes.join("\n")}
|
|
|
104283
104292
|
return visitExportDeclaration(node);
|
|
104284
104293
|
case 276 /* ExportAssignment */:
|
|
104285
104294
|
return visitExportAssignment(node);
|
|
104295
|
+
case 261 /* FunctionDeclaration */:
|
|
104296
|
+
return visitFunctionDeclaration(node);
|
|
104297
|
+
case 262 /* ClassDeclaration */:
|
|
104298
|
+
return visitClassDeclaration(node);
|
|
104299
|
+
default:
|
|
104300
|
+
return topLevelNestedVisitor(node);
|
|
104301
|
+
}
|
|
104302
|
+
}
|
|
104303
|
+
function topLevelNestedVisitor(node) {
|
|
104304
|
+
switch (node.kind) {
|
|
104286
104305
|
case 242 /* VariableStatement */:
|
|
104287
104306
|
return visitVariableStatement(node);
|
|
104288
104307
|
case 261 /* FunctionDeclaration */:
|
|
104289
104308
|
return visitFunctionDeclaration(node);
|
|
104290
104309
|
case 262 /* ClassDeclaration */:
|
|
104291
104310
|
return visitClassDeclaration(node);
|
|
104311
|
+
case 247 /* ForStatement */:
|
|
104312
|
+
return visitForStatement(
|
|
104313
|
+
node,
|
|
104314
|
+
/*isTopLevel*/
|
|
104315
|
+
true
|
|
104316
|
+
);
|
|
104317
|
+
case 248 /* ForInStatement */:
|
|
104318
|
+
return visitForInStatement(node);
|
|
104319
|
+
case 249 /* ForOfStatement */:
|
|
104320
|
+
return visitForOfStatement(node);
|
|
104321
|
+
case 245 /* DoStatement */:
|
|
104322
|
+
return visitDoStatement(node);
|
|
104323
|
+
case 246 /* WhileStatement */:
|
|
104324
|
+
return visitWhileStatement(node);
|
|
104325
|
+
case 255 /* LabeledStatement */:
|
|
104326
|
+
return visitLabeledStatement(node);
|
|
104327
|
+
case 253 /* WithStatement */:
|
|
104328
|
+
return visitWithStatement(node);
|
|
104329
|
+
case 244 /* IfStatement */:
|
|
104330
|
+
return visitIfStatement(node);
|
|
104331
|
+
case 254 /* SwitchStatement */:
|
|
104332
|
+
return visitSwitchStatement(node);
|
|
104333
|
+
case 268 /* CaseBlock */:
|
|
104334
|
+
return visitCaseBlock(node);
|
|
104335
|
+
case 295 /* CaseClause */:
|
|
104336
|
+
return visitCaseClause(node);
|
|
104337
|
+
case 296 /* DefaultClause */:
|
|
104338
|
+
return visitDefaultClause(node);
|
|
104339
|
+
case 257 /* TryStatement */:
|
|
104340
|
+
return visitTryStatement(node);
|
|
104341
|
+
case 298 /* CatchClause */:
|
|
104342
|
+
return visitCatchClause(node);
|
|
104343
|
+
case 240 /* Block */:
|
|
104344
|
+
return visitBlock(node);
|
|
104292
104345
|
default:
|
|
104293
104346
|
return visitor(node);
|
|
104294
104347
|
}
|
|
@@ -104299,7 +104352,11 @@ ${lanes.join("\n")}
|
|
|
104299
104352
|
}
|
|
104300
104353
|
switch (node.kind) {
|
|
104301
104354
|
case 247 /* ForStatement */:
|
|
104302
|
-
return visitForStatement(
|
|
104355
|
+
return visitForStatement(
|
|
104356
|
+
node,
|
|
104357
|
+
/*isTopLevel*/
|
|
104358
|
+
false
|
|
104359
|
+
);
|
|
104303
104360
|
case 243 /* ExpressionStatement */:
|
|
104304
104361
|
return visitExpressionStatement(node);
|
|
104305
104362
|
case 216 /* ParenthesizedExpression */:
|
|
@@ -104384,15 +104441,177 @@ ${lanes.join("\n")}
|
|
|
104384
104441
|
}
|
|
104385
104442
|
return visitEachChild(node, visitor, context);
|
|
104386
104443
|
}
|
|
104387
|
-
function visitForStatement(node) {
|
|
104444
|
+
function visitForStatement(node, isTopLevel) {
|
|
104445
|
+
if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
104446
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
104447
|
+
/*statements*/
|
|
104448
|
+
void 0,
|
|
104449
|
+
node.initializer,
|
|
104450
|
+
/*isForInOrOfInitializer*/
|
|
104451
|
+
false
|
|
104452
|
+
);
|
|
104453
|
+
if (exportStatements) {
|
|
104454
|
+
const statements = [];
|
|
104455
|
+
const varDeclList = visitNode(node.initializer, discardedValueVisitor, isVariableDeclarationList);
|
|
104456
|
+
const varStatement = factory2.createVariableStatement(
|
|
104457
|
+
/*modifiers*/
|
|
104458
|
+
void 0,
|
|
104459
|
+
varDeclList
|
|
104460
|
+
);
|
|
104461
|
+
statements.push(varStatement);
|
|
104462
|
+
addRange(statements, exportStatements);
|
|
104463
|
+
const condition = visitNode(node.condition, visitor, isExpression);
|
|
104464
|
+
const incrementor = visitNode(node.incrementor, discardedValueVisitor, isExpression);
|
|
104465
|
+
const body = visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context);
|
|
104466
|
+
statements.push(factory2.updateForStatement(
|
|
104467
|
+
node,
|
|
104468
|
+
/*initializer*/
|
|
104469
|
+
void 0,
|
|
104470
|
+
condition,
|
|
104471
|
+
incrementor,
|
|
104472
|
+
body
|
|
104473
|
+
));
|
|
104474
|
+
return statements;
|
|
104475
|
+
}
|
|
104476
|
+
}
|
|
104388
104477
|
return factory2.updateForStatement(
|
|
104389
104478
|
node,
|
|
104390
104479
|
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
104391
104480
|
visitNode(node.condition, visitor, isExpression),
|
|
104392
104481
|
visitNode(node.incrementor, discardedValueVisitor, isExpression),
|
|
104393
|
-
visitIterationBody(node.statement, visitor, context)
|
|
104482
|
+
visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context)
|
|
104483
|
+
);
|
|
104484
|
+
}
|
|
104485
|
+
function visitForInStatement(node) {
|
|
104486
|
+
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
104487
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
104488
|
+
/*statements*/
|
|
104489
|
+
void 0,
|
|
104490
|
+
node.initializer,
|
|
104491
|
+
/*isForInOrOfInitializer*/
|
|
104492
|
+
true
|
|
104493
|
+
);
|
|
104494
|
+
if (some(exportStatements)) {
|
|
104495
|
+
const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
|
|
104496
|
+
const expression = visitNode(node.expression, visitor, isExpression);
|
|
104497
|
+
const body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
|
|
104498
|
+
const mergedBody = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
|
|
104499
|
+
[...exportStatements, body],
|
|
104500
|
+
/*multiLine*/
|
|
104501
|
+
true
|
|
104502
|
+
);
|
|
104503
|
+
return factory2.updateForInStatement(node, initializer, expression, mergedBody);
|
|
104504
|
+
}
|
|
104505
|
+
}
|
|
104506
|
+
return factory2.updateForInStatement(
|
|
104507
|
+
node,
|
|
104508
|
+
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
104509
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104510
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
104511
|
+
);
|
|
104512
|
+
}
|
|
104513
|
+
function visitForOfStatement(node) {
|
|
104514
|
+
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
104515
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
104516
|
+
/*statements*/
|
|
104517
|
+
void 0,
|
|
104518
|
+
node.initializer,
|
|
104519
|
+
/*isForInOrOfInitializer*/
|
|
104520
|
+
true
|
|
104521
|
+
);
|
|
104522
|
+
const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
|
|
104523
|
+
const expression = visitNode(node.expression, visitor, isExpression);
|
|
104524
|
+
let body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
|
|
104525
|
+
if (some(exportStatements)) {
|
|
104526
|
+
body = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
|
|
104527
|
+
[...exportStatements, body],
|
|
104528
|
+
/*multiLine*/
|
|
104529
|
+
true
|
|
104530
|
+
);
|
|
104531
|
+
}
|
|
104532
|
+
return factory2.updateForOfStatement(node, node.awaitModifier, initializer, expression, body);
|
|
104533
|
+
}
|
|
104534
|
+
return factory2.updateForOfStatement(
|
|
104535
|
+
node,
|
|
104536
|
+
node.awaitModifier,
|
|
104537
|
+
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
104538
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104539
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
104540
|
+
);
|
|
104541
|
+
}
|
|
104542
|
+
function visitDoStatement(node) {
|
|
104543
|
+
return factory2.updateDoStatement(
|
|
104544
|
+
node,
|
|
104545
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context),
|
|
104546
|
+
visitNode(node.expression, visitor, isExpression)
|
|
104547
|
+
);
|
|
104548
|
+
}
|
|
104549
|
+
function visitWhileStatement(node) {
|
|
104550
|
+
return factory2.updateWhileStatement(
|
|
104551
|
+
node,
|
|
104552
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104553
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
104554
|
+
);
|
|
104555
|
+
}
|
|
104556
|
+
function visitLabeledStatement(node) {
|
|
104557
|
+
return factory2.updateLabeledStatement(
|
|
104558
|
+
node,
|
|
104559
|
+
node.label,
|
|
104560
|
+
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
104561
|
+
);
|
|
104562
|
+
}
|
|
104563
|
+
function visitWithStatement(node) {
|
|
104564
|
+
return factory2.updateWithStatement(
|
|
104565
|
+
node,
|
|
104566
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104567
|
+
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
104568
|
+
);
|
|
104569
|
+
}
|
|
104570
|
+
function visitIfStatement(node) {
|
|
104571
|
+
return factory2.updateIfStatement(
|
|
104572
|
+
node,
|
|
104573
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104574
|
+
Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
|
|
104575
|
+
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
|
|
104576
|
+
);
|
|
104577
|
+
}
|
|
104578
|
+
function visitSwitchStatement(node) {
|
|
104579
|
+
return factory2.updateSwitchStatement(
|
|
104580
|
+
node,
|
|
104581
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104582
|
+
Debug.checkDefined(visitNode(node.caseBlock, topLevelNestedVisitor, isCaseBlock))
|
|
104583
|
+
);
|
|
104584
|
+
}
|
|
104585
|
+
function visitCaseBlock(node) {
|
|
104586
|
+
return factory2.updateCaseBlock(
|
|
104587
|
+
node,
|
|
104588
|
+
visitNodes2(node.clauses, topLevelNestedVisitor, isCaseOrDefaultClause)
|
|
104589
|
+
);
|
|
104590
|
+
}
|
|
104591
|
+
function visitCaseClause(node) {
|
|
104592
|
+
return factory2.updateCaseClause(
|
|
104593
|
+
node,
|
|
104594
|
+
visitNode(node.expression, visitor, isExpression),
|
|
104595
|
+
visitNodes2(node.statements, topLevelNestedVisitor, isStatement)
|
|
104596
|
+
);
|
|
104597
|
+
}
|
|
104598
|
+
function visitDefaultClause(node) {
|
|
104599
|
+
return visitEachChild(node, topLevelNestedVisitor, context);
|
|
104600
|
+
}
|
|
104601
|
+
function visitTryStatement(node) {
|
|
104602
|
+
return visitEachChild(node, topLevelNestedVisitor, context);
|
|
104603
|
+
}
|
|
104604
|
+
function visitCatchClause(node) {
|
|
104605
|
+
return factory2.updateCatchClause(
|
|
104606
|
+
node,
|
|
104607
|
+
node.variableDeclaration,
|
|
104608
|
+
Debug.checkDefined(visitNode(node.block, topLevelNestedVisitor, isBlock))
|
|
104394
104609
|
);
|
|
104395
104610
|
}
|
|
104611
|
+
function visitBlock(node) {
|
|
104612
|
+
node = visitEachChild(node, topLevelNestedVisitor, context);
|
|
104613
|
+
return node;
|
|
104614
|
+
}
|
|
104396
104615
|
function visitExpressionStatement(node) {
|
|
104397
104616
|
return factory2.updateExpressionStatement(
|
|
104398
104617
|
node,
|
|
@@ -105185,25 +105404,33 @@ ${lanes.join("\n")}
|
|
|
105185
105404
|
return appendExportsOfDeclaration(statements, decl);
|
|
105186
105405
|
}
|
|
105187
105406
|
function appendExportsOfVariableStatement(statements, node) {
|
|
105407
|
+
return appendExportsOfVariableDeclarationList(
|
|
105408
|
+
statements,
|
|
105409
|
+
node.declarationList,
|
|
105410
|
+
/*isForInOrOfInitializer*/
|
|
105411
|
+
false
|
|
105412
|
+
);
|
|
105413
|
+
}
|
|
105414
|
+
function appendExportsOfVariableDeclarationList(statements, node, isForInOrOfInitializer) {
|
|
105188
105415
|
if (currentModuleInfo.exportEquals) {
|
|
105189
105416
|
return statements;
|
|
105190
105417
|
}
|
|
105191
|
-
for (const decl of node.
|
|
105192
|
-
statements = appendExportsOfBindingElement(statements, decl);
|
|
105418
|
+
for (const decl of node.declarations) {
|
|
105419
|
+
statements = appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer);
|
|
105193
105420
|
}
|
|
105194
105421
|
return statements;
|
|
105195
105422
|
}
|
|
105196
|
-
function appendExportsOfBindingElement(statements, decl) {
|
|
105423
|
+
function appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer) {
|
|
105197
105424
|
if (currentModuleInfo.exportEquals) {
|
|
105198
105425
|
return statements;
|
|
105199
105426
|
}
|
|
105200
105427
|
if (isBindingPattern(decl.name)) {
|
|
105201
105428
|
for (const element of decl.name.elements) {
|
|
105202
105429
|
if (!isOmittedExpression(element)) {
|
|
105203
|
-
statements = appendExportsOfBindingElement(statements, element);
|
|
105430
|
+
statements = appendExportsOfBindingElement(statements, element, isForInOrOfInitializer);
|
|
105204
105431
|
}
|
|
105205
105432
|
}
|
|
105206
|
-
} else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer)) {
|
|
105433
|
+
} else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer || isForInOrOfInitializer)) {
|
|
105207
105434
|
statements = appendExportsOfDeclaration(statements, decl);
|
|
105208
105435
|
}
|
|
105209
105436
|
return statements;
|
|
@@ -115429,7 +115656,7 @@ ${lanes.join("\n")}
|
|
|
115429
115656
|
}
|
|
115430
115657
|
return program.isEmittedFile(file);
|
|
115431
115658
|
}
|
|
115432
|
-
function getWatchFactory(host, watchLogLevel, log,
|
|
115659
|
+
function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo2) {
|
|
115433
115660
|
setSysLog(watchLogLevel === 2 /* Verbose */ ? log : noop);
|
|
115434
115661
|
const plainInvokeFactory = {
|
|
115435
115662
|
watchFile: (file, callback, pollingInterval, options) => host.watchFile(file, callback, pollingInterval, options),
|
|
@@ -115467,23 +115694,23 @@ ${lanes.join("\n")}
|
|
|
115467
115694
|
return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
|
|
115468
115695
|
}
|
|
115469
115696
|
function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
|
|
115470
|
-
log(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
115697
|
+
log(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
115471
115698
|
return {
|
|
115472
|
-
close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
115699
|
+
close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
|
|
115473
115700
|
};
|
|
115474
115701
|
}
|
|
115475
115702
|
function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
115476
|
-
log(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
115703
|
+
log(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
115477
115704
|
const watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
115478
115705
|
return {
|
|
115479
115706
|
close: () => {
|
|
115480
|
-
log(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
115707
|
+
log(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
115481
115708
|
watcher.close();
|
|
115482
115709
|
}
|
|
115483
115710
|
};
|
|
115484
115711
|
}
|
|
115485
115712
|
function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
115486
|
-
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
115713
|
+
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
115487
115714
|
log(watchInfo);
|
|
115488
115715
|
const start = timestamp();
|
|
115489
115716
|
const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
@@ -115491,7 +115718,7 @@ ${lanes.join("\n")}
|
|
|
115491
115718
|
log(`Elapsed:: ${elapsed}ms ${watchInfo}`);
|
|
115492
115719
|
return {
|
|
115493
115720
|
close: () => {
|
|
115494
|
-
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
115721
|
+
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
115495
115722
|
log(watchInfo2);
|
|
115496
115723
|
const start2 = timestamp();
|
|
115497
115724
|
watcher.close();
|
|
@@ -115506,7 +115733,7 @@ ${lanes.join("\n")}
|
|
|
115506
115733
|
void 0,
|
|
115507
115734
|
file,
|
|
115508
115735
|
(...args) => {
|
|
115509
|
-
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
115736
|
+
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
115510
115737
|
log(triggerredInfo);
|
|
115511
115738
|
const start = timestamp();
|
|
115512
115739
|
cb.call(
|
|
@@ -115523,8 +115750,8 @@ ${lanes.join("\n")}
|
|
|
115523
115750
|
detailInfo2
|
|
115524
115751
|
);
|
|
115525
115752
|
}
|
|
115526
|
-
function getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
115527
|
-
return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${
|
|
115753
|
+
function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo3) {
|
|
115754
|
+
return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${getDetailWatchInfo3 ? getDetailWatchInfo3(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : `${detailInfo1} ${detailInfo2}`}`;
|
|
115528
115755
|
}
|
|
115529
115756
|
}
|
|
115530
115757
|
function getFallbackOptions(options) {
|
|
@@ -122901,7 +123128,9 @@ ${lanes.join("\n")}
|
|
|
122901
123128
|
MissingSourceMapFile: "Missing source map file",
|
|
122902
123129
|
NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root",
|
|
122903
123130
|
MissingGeneratedFile: "Missing generated file",
|
|
122904
|
-
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation"
|
|
123131
|
+
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation",
|
|
123132
|
+
TypingInstallerLocationFile: "File location for typing installer",
|
|
123133
|
+
TypingInstallerLocationDirectory: "Directory location for typing installer"
|
|
122905
123134
|
};
|
|
122906
123135
|
}
|
|
122907
123136
|
});
|
|
@@ -126118,7 +126347,7 @@ ${lanes.join("\n")}
|
|
|
126118
126347
|
const d = /* @__PURE__ */ new Date();
|
|
126119
126348
|
return `${padLeft(d.getHours().toString(), 2, "0")}:${padLeft(d.getMinutes().toString(), 2, "0")}:${padLeft(d.getSeconds().toString(), 2, "0")}.${padLeft(d.getMilliseconds().toString(), 3, "0")}`;
|
|
126120
126349
|
}
|
|
126121
|
-
var ActionSet, ActionInvalidate, ActionPackageInstalled, EventTypesRegistry, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, Arguments;
|
|
126350
|
+
var ActionSet, ActionInvalidate, ActionPackageInstalled, EventTypesRegistry, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, ActionWatchTypingLocations, Arguments;
|
|
126122
126351
|
var init_shared = __esm({
|
|
126123
126352
|
"src/jsTyping/shared.ts"() {
|
|
126124
126353
|
"use strict";
|
|
@@ -126130,6 +126359,7 @@ ${lanes.join("\n")}
|
|
|
126130
126359
|
EventBeginInstallTypes = "event::beginInstallTypes";
|
|
126131
126360
|
EventEndInstallTypes = "event::endInstallTypes";
|
|
126132
126361
|
EventInitializationFailed = "event::initializationFailed";
|
|
126362
|
+
ActionWatchTypingLocations = "action::watchTypingLocations";
|
|
126133
126363
|
((Arguments2) => {
|
|
126134
126364
|
Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation";
|
|
126135
126365
|
Arguments2.LogFile = "--logFile";
|
|
@@ -168972,19 +169202,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
168972
169202
|
}
|
|
168973
169203
|
return { command, remaining: remaining - toSlice };
|
|
168974
169204
|
}
|
|
168975
|
-
function endsWith2(str, suffix, caseSensitive) {
|
|
168976
|
-
const expectedPos = str.length - suffix.length;
|
|
168977
|
-
return expectedPos >= 0 && (str.indexOf(suffix, expectedPos) === expectedPos || !caseSensitive && compareStringsCaseInsensitive(str.substr(expectedPos), suffix) === 0 /* EqualTo */);
|
|
168978
|
-
}
|
|
168979
|
-
function isPackageOrBowerJson(fileName, caseSensitive) {
|
|
168980
|
-
return endsWith2(fileName, "/package.json", caseSensitive) || endsWith2(fileName, "/bower.json", caseSensitive);
|
|
168981
|
-
}
|
|
168982
|
-
function sameFiles(a, b, caseSensitive) {
|
|
168983
|
-
return a === b || !caseSensitive && compareStringsCaseInsensitive(a, b) === 0 /* EqualTo */;
|
|
168984
|
-
}
|
|
168985
|
-
function getDetailWatchInfo(projectName, watchers) {
|
|
168986
|
-
return `Project: ${projectName} watcher already invoked: ${watchers == null ? void 0 : watchers.isInvoked}`;
|
|
168987
|
-
}
|
|
168988
169205
|
function typingsName(packageName) {
|
|
168989
169206
|
return `@types/${packageName}@ts${versionMajorMinor}`;
|
|
168990
169207
|
}
|
|
@@ -169015,13 +169232,10 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169015
169232
|
this.installRunCount = 1;
|
|
169016
169233
|
this.inFlightRequestCount = 0;
|
|
169017
169234
|
this.latestDistTag = "latest";
|
|
169018
|
-
this.toCanonicalFileName = createGetCanonicalFileName(installTypingHost.useCaseSensitiveFileNames);
|
|
169019
|
-
this.globalCachePackageJsonPath = combinePaths(globalCachePath, "package.json");
|
|
169020
169235
|
const isLoggingEnabled = this.log.isEnabled();
|
|
169021
169236
|
if (isLoggingEnabled) {
|
|
169022
169237
|
this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}', types map path ${typesMapLocation}`);
|
|
169023
169238
|
}
|
|
169024
|
-
this.watchFactory = getWatchFactory(this.installTypingHost, isLoggingEnabled ? 2 /* Verbose */ : 0 /* None */, (s) => this.log.writeLine(s), getDetailWatchInfo);
|
|
169025
169239
|
this.processCacheLocation(this.globalCachePath);
|
|
169026
169240
|
}
|
|
169027
169241
|
closeProject(req) {
|
|
@@ -169038,8 +169252,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169038
169252
|
}
|
|
169039
169253
|
return;
|
|
169040
169254
|
}
|
|
169041
|
-
clearMap(watchers, closeFileWatcher);
|
|
169042
169255
|
this.projectWatchers.delete(projectName);
|
|
169256
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: [] });
|
|
169043
169257
|
if (this.log.isEnabled()) {
|
|
169044
169258
|
this.log.writeLine(`Closing file watchers for project '${projectName}' - done.`);
|
|
169045
169259
|
}
|
|
@@ -169072,7 +169286,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169072
169286
|
if (this.log.isEnabled()) {
|
|
169073
169287
|
this.log.writeLine(`Finished typings discovery: ${JSON.stringify(discoverTypingsResult)}`);
|
|
169074
169288
|
}
|
|
169075
|
-
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch
|
|
169289
|
+
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch);
|
|
169076
169290
|
if (discoverTypingsResult.newTypingNames.length) {
|
|
169077
169291
|
this.installTypings(req, req.cachePath || this.globalCachePath, discoverTypingsResult.cachedTypingPaths, discoverTypingsResult.newTypingNames);
|
|
169078
169292
|
} else {
|
|
@@ -169273,75 +169487,19 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169273
169487
|
host.createDirectory(directory);
|
|
169274
169488
|
}
|
|
169275
169489
|
}
|
|
169276
|
-
watchFiles(projectName, files
|
|
169490
|
+
watchFiles(projectName, files) {
|
|
169277
169491
|
if (!files.length) {
|
|
169278
169492
|
this.closeWatchers(projectName);
|
|
169279
169493
|
return;
|
|
169280
169494
|
}
|
|
169281
|
-
|
|
169282
|
-
const
|
|
169283
|
-
if (!
|
|
169284
|
-
|
|
169285
|
-
this.
|
|
169495
|
+
const existing = this.projectWatchers.get(projectName);
|
|
169496
|
+
const newSet = new Set(files);
|
|
169497
|
+
if (!existing || forEachKey(newSet, (s) => !existing.has(s)) || forEachKey(existing, (s) => !newSet.has(s))) {
|
|
169498
|
+
this.projectWatchers.set(projectName, newSet);
|
|
169499
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files });
|
|
169286
169500
|
} else {
|
|
169287
|
-
|
|
169501
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: void 0 });
|
|
169288
169502
|
}
|
|
169289
|
-
watchers.isInvoked = false;
|
|
169290
|
-
const isLoggingEnabled = this.log.isEnabled();
|
|
169291
|
-
const createProjectWatcher = (path, projectWatcherType) => {
|
|
169292
|
-
const canonicalPath = this.toCanonicalFileName(path);
|
|
169293
|
-
toRemove.delete(canonicalPath);
|
|
169294
|
-
if (watchers.has(canonicalPath)) {
|
|
169295
|
-
return;
|
|
169296
|
-
}
|
|
169297
|
-
if (isLoggingEnabled) {
|
|
169298
|
-
this.log.writeLine(`${projectWatcherType}:: Added:: WatchInfo: ${path}`);
|
|
169299
|
-
}
|
|
169300
|
-
const watcher = projectWatcherType === "FileWatcher" /* FileWatcher */ ? this.watchFactory.watchFile(path, () => {
|
|
169301
|
-
if (!watchers.isInvoked) {
|
|
169302
|
-
watchers.isInvoked = true;
|
|
169303
|
-
this.sendResponse({ projectName, kind: ActionInvalidate });
|
|
169304
|
-
}
|
|
169305
|
-
}, 2e3 /* High */, options, projectName, watchers) : this.watchFactory.watchDirectory(path, (f) => {
|
|
169306
|
-
if (watchers.isInvoked || !fileExtensionIs(f, ".json" /* Json */)) {
|
|
169307
|
-
return;
|
|
169308
|
-
}
|
|
169309
|
-
if (isPackageOrBowerJson(f, this.installTypingHost.useCaseSensitiveFileNames) && !sameFiles(f, this.globalCachePackageJsonPath, this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
169310
|
-
watchers.isInvoked = true;
|
|
169311
|
-
this.sendResponse({ projectName, kind: ActionInvalidate });
|
|
169312
|
-
}
|
|
169313
|
-
}, 1 /* Recursive */, options, projectName, watchers);
|
|
169314
|
-
watchers.set(canonicalPath, isLoggingEnabled ? {
|
|
169315
|
-
close: () => {
|
|
169316
|
-
this.log.writeLine(`${projectWatcherType}:: Closed:: WatchInfo: ${path}`);
|
|
169317
|
-
watcher.close();
|
|
169318
|
-
}
|
|
169319
|
-
} : watcher);
|
|
169320
|
-
};
|
|
169321
|
-
for (const file of files) {
|
|
169322
|
-
if (file.endsWith("/package.json") || file.endsWith("/bower.json")) {
|
|
169323
|
-
createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
|
|
169324
|
-
continue;
|
|
169325
|
-
}
|
|
169326
|
-
if (containsPath(projectRootPath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
169327
|
-
const subDirectory = file.indexOf(directorySeparator, projectRootPath.length + 1);
|
|
169328
|
-
if (subDirectory !== -1) {
|
|
169329
|
-
createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
|
|
169330
|
-
} else {
|
|
169331
|
-
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
169332
|
-
}
|
|
169333
|
-
continue;
|
|
169334
|
-
}
|
|
169335
|
-
if (containsPath(this.globalCachePath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
169336
|
-
createProjectWatcher(this.globalCachePath, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
169337
|
-
continue;
|
|
169338
|
-
}
|
|
169339
|
-
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
169340
|
-
}
|
|
169341
|
-
toRemove.forEach((watch, path) => {
|
|
169342
|
-
watch.close();
|
|
169343
|
-
watchers.delete(path);
|
|
169344
|
-
});
|
|
169345
169503
|
}
|
|
169346
169504
|
createSetTypings(request, typings) {
|
|
169347
169505
|
return {
|
|
@@ -169414,7 +169572,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169414
169572
|
true
|
|
169415
169573
|
).concat(project.getExcludedFiles()),
|
|
169416
169574
|
compilerOptions: project.getCompilationSettings(),
|
|
169417
|
-
watchOptions: project.projectService.getWatchOptions(project),
|
|
169418
169575
|
typeAcquisition,
|
|
169419
169576
|
unresolvedImports,
|
|
169420
169577
|
projectRootPath: project.getCurrentDirectory(),
|
|
@@ -171126,6 +171283,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171126
171283
|
return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
|
|
171127
171284
|
}
|
|
171128
171285
|
close() {
|
|
171286
|
+
this.projectService.typingsCache.onProjectClosed(this);
|
|
171287
|
+
this.closeWatchingTypingLocations();
|
|
171129
171288
|
if (this.program) {
|
|
171130
171289
|
for (const f of this.program.getSourceFiles()) {
|
|
171131
171290
|
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
@@ -171416,6 +171575,89 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
171416
171575
|
}
|
|
171417
171576
|
}
|
|
171418
171577
|
/** @internal */
|
|
171578
|
+
closeWatchingTypingLocations() {
|
|
171579
|
+
if (this.typingWatchers)
|
|
171580
|
+
clearMap(this.typingWatchers, closeFileWatcher);
|
|
171581
|
+
this.typingWatchers = void 0;
|
|
171582
|
+
}
|
|
171583
|
+
/** @internal */
|
|
171584
|
+
onTypingInstallerWatchInvoke() {
|
|
171585
|
+
this.typingWatchers.isInvoked = true;
|
|
171586
|
+
this.projectService.updateTypingsForProject({ projectName: this.getProjectName(), kind: ActionInvalidate });
|
|
171587
|
+
}
|
|
171588
|
+
/** @internal */
|
|
171589
|
+
watchTypingLocations(files) {
|
|
171590
|
+
if (!files) {
|
|
171591
|
+
this.typingWatchers.isInvoked = false;
|
|
171592
|
+
return;
|
|
171593
|
+
}
|
|
171594
|
+
if (!files.length) {
|
|
171595
|
+
this.closeWatchingTypingLocations();
|
|
171596
|
+
return;
|
|
171597
|
+
}
|
|
171598
|
+
const toRemove = new Map(this.typingWatchers);
|
|
171599
|
+
if (!this.typingWatchers)
|
|
171600
|
+
this.typingWatchers = /* @__PURE__ */ new Map();
|
|
171601
|
+
this.typingWatchers.isInvoked = false;
|
|
171602
|
+
const createProjectWatcher = (path, typingsWatcherType) => {
|
|
171603
|
+
const canonicalPath = this.toPath(path);
|
|
171604
|
+
toRemove.delete(canonicalPath);
|
|
171605
|
+
if (!this.typingWatchers.has(canonicalPath)) {
|
|
171606
|
+
this.typingWatchers.set(
|
|
171607
|
+
canonicalPath,
|
|
171608
|
+
typingsWatcherType === "FileWatcher" /* FileWatcher */ ? this.projectService.watchFactory.watchFile(
|
|
171609
|
+
path,
|
|
171610
|
+
() => !this.typingWatchers.isInvoked ? this.onTypingInstallerWatchInvoke() : this.writeLog(`TypingWatchers already invoked`),
|
|
171611
|
+
2e3 /* High */,
|
|
171612
|
+
this.projectService.getWatchOptions(this),
|
|
171613
|
+
WatchType.TypingInstallerLocationFile,
|
|
171614
|
+
this
|
|
171615
|
+
) : this.projectService.watchFactory.watchDirectory(
|
|
171616
|
+
path,
|
|
171617
|
+
(f) => {
|
|
171618
|
+
if (this.typingWatchers.isInvoked)
|
|
171619
|
+
return this.writeLog(`TypingWatchers already invoked`);
|
|
171620
|
+
if (!fileExtensionIs(f, ".json" /* Json */))
|
|
171621
|
+
return this.writeLog(`Ignoring files that are not *.json`);
|
|
171622
|
+
if (comparePaths(f, combinePaths(this.projectService.typingsInstaller.globalTypingsCacheLocation, "package.json"), !this.useCaseSensitiveFileNames()))
|
|
171623
|
+
return this.writeLog(`Ignoring package.json change at global typings location`);
|
|
171624
|
+
this.onTypingInstallerWatchInvoke();
|
|
171625
|
+
},
|
|
171626
|
+
1 /* Recursive */,
|
|
171627
|
+
this.projectService.getWatchOptions(this),
|
|
171628
|
+
WatchType.TypingInstallerLocationDirectory,
|
|
171629
|
+
this
|
|
171630
|
+
)
|
|
171631
|
+
);
|
|
171632
|
+
}
|
|
171633
|
+
};
|
|
171634
|
+
for (const file of files) {
|
|
171635
|
+
const basename = getBaseFileName(file);
|
|
171636
|
+
if (basename === "package.json" || basename === "bower.json") {
|
|
171637
|
+
createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
|
|
171638
|
+
continue;
|
|
171639
|
+
}
|
|
171640
|
+
if (containsPath(this.currentDirectory, file, this.currentDirectory, !this.useCaseSensitiveFileNames())) {
|
|
171641
|
+
const subDirectory = file.indexOf(directorySeparator, this.currentDirectory.length + 1);
|
|
171642
|
+
if (subDirectory !== -1) {
|
|
171643
|
+
createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
|
|
171644
|
+
} else {
|
|
171645
|
+
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
171646
|
+
}
|
|
171647
|
+
continue;
|
|
171648
|
+
}
|
|
171649
|
+
if (containsPath(this.projectService.typingsInstaller.globalTypingsCacheLocation, file, this.currentDirectory, !this.useCaseSensitiveFileNames())) {
|
|
171650
|
+
createProjectWatcher(this.projectService.typingsInstaller.globalTypingsCacheLocation, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
171651
|
+
continue;
|
|
171652
|
+
}
|
|
171653
|
+
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
171654
|
+
}
|
|
171655
|
+
toRemove.forEach((watch, path) => {
|
|
171656
|
+
watch.close();
|
|
171657
|
+
this.typingWatchers.delete(path);
|
|
171658
|
+
});
|
|
171659
|
+
}
|
|
171660
|
+
/** @internal */
|
|
171419
171661
|
getCurrentProgram() {
|
|
171420
171662
|
return this.program;
|
|
171421
171663
|
}
|
|
@@ -172865,7 +173107,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172865
173107
|
(potentialProjectRef) => callbackRefProject(project, cb, potentialProjectRef)
|
|
172866
173108
|
);
|
|
172867
173109
|
}
|
|
172868
|
-
function
|
|
173110
|
+
function getDetailWatchInfo(watchType, project) {
|
|
172869
173111
|
return `${isString(project) ? `Config: ${project} ` : project ? `Project: ${project.getProjectName()} ` : ""}WatchType: ${watchType}`;
|
|
172870
173112
|
}
|
|
172871
173113
|
function isScriptInfoWatchedFromNodeModules(info) {
|
|
@@ -173130,7 +173372,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173130
173372
|
this.watchFactory = this.serverMode !== 0 /* Semantic */ ? {
|
|
173131
173373
|
watchFile: returnNoopFileWatcher,
|
|
173132
173374
|
watchDirectory: returnNoopFileWatcher
|
|
173133
|
-
} : getWatchFactory(this.host, watchLogLevel, log,
|
|
173375
|
+
} : getWatchFactory(this.host, watchLogLevel, log, getDetailWatchInfo);
|
|
173134
173376
|
}
|
|
173135
173377
|
toPath(fileName) {
|
|
173136
173378
|
return toPath(fileName, this.currentDirectory, this.toCanonicalFileName);
|
|
@@ -173216,6 +173458,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173216
173458
|
}
|
|
173217
173459
|
}
|
|
173218
173460
|
/** @internal */
|
|
173461
|
+
watchTypingLocations(response) {
|
|
173462
|
+
var _a;
|
|
173463
|
+
(_a = this.findProject(response.projectName)) == null ? void 0 : _a.watchTypingLocations(response.files);
|
|
173464
|
+
}
|
|
173465
|
+
/** @internal */
|
|
173219
173466
|
delayEnsureProjectForOpenFiles() {
|
|
173220
173467
|
if (!this.openFiles.size)
|
|
173221
173468
|
return;
|
|
@@ -178955,7 +179202,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
178955
179202
|
getApplicableRefactors(args) {
|
|
178956
179203
|
const { file, project } = this.getFileAndProject(args);
|
|
178957
179204
|
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
|
178958
|
-
return project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind);
|
|
179205
|
+
return project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind, args.includeInteractiveActions);
|
|
178959
179206
|
}
|
|
178960
179207
|
getEditsForRefactor(args, simplifiedResult) {
|
|
178961
179208
|
const { file, project } = this.getFileAndProject(args);
|
|
@@ -180179,6 +180426,7 @@ ${e.message}`;
|
|
|
180179
180426
|
ActionInvalidate: () => ActionInvalidate,
|
|
180180
180427
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
180181
180428
|
ActionSet: () => ActionSet,
|
|
180429
|
+
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
180182
180430
|
Arguments: () => Arguments,
|
|
180183
180431
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
180184
180432
|
CharRangeSection: () => CharRangeSection,
|
|
@@ -182568,6 +182816,7 @@ ${e.message}`;
|
|
|
182568
182816
|
ActionInvalidate: () => ActionInvalidate,
|
|
182569
182817
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
182570
182818
|
ActionSet: () => ActionSet,
|
|
182819
|
+
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
182571
182820
|
Arguments: () => Arguments,
|
|
182572
182821
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
182573
182822
|
CharRangeSection: () => CharRangeSection,
|