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/tsserver.js
CHANGED
|
@@ -2303,7 +2303,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2303
2303
|
|
|
2304
2304
|
// src/compiler/corePublic.ts
|
|
2305
2305
|
var versionMajorMinor = "5.1";
|
|
2306
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2306
|
+
var version = `${versionMajorMinor}.0-dev.20230428`;
|
|
2307
2307
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2308
2308
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2309
2309
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6951,10 +6951,10 @@ var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
|
|
|
6951
6951
|
LanguageVariant4[LanguageVariant4["JSX"] = 1] = "JSX";
|
|
6952
6952
|
return LanguageVariant4;
|
|
6953
6953
|
})(LanguageVariant || {});
|
|
6954
|
-
var WatchDirectoryFlags = /* @__PURE__ */ ((
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
return
|
|
6954
|
+
var WatchDirectoryFlags = /* @__PURE__ */ ((WatchDirectoryFlags3) => {
|
|
6955
|
+
WatchDirectoryFlags3[WatchDirectoryFlags3["None"] = 0] = "None";
|
|
6956
|
+
WatchDirectoryFlags3[WatchDirectoryFlags3["Recursive"] = 1] = "Recursive";
|
|
6957
|
+
return WatchDirectoryFlags3;
|
|
6958
6958
|
})(WatchDirectoryFlags || {});
|
|
6959
6959
|
var CharacterCodes = /* @__PURE__ */ ((CharacterCodes2) => {
|
|
6960
6960
|
CharacterCodes2[CharacterCodes2["nullCharacter"] = 0] = "nullCharacter";
|
|
@@ -17584,6 +17584,7 @@ function canHaveJSDoc(node) {
|
|
|
17584
17584
|
case 171 /* PropertyDeclaration */:
|
|
17585
17585
|
case 170 /* PropertySignature */:
|
|
17586
17586
|
case 252 /* ReturnStatement */:
|
|
17587
|
+
case 239 /* SemicolonClassElement */:
|
|
17587
17588
|
case 177 /* SetAccessor */:
|
|
17588
17589
|
case 303 /* ShorthandPropertyAssignment */:
|
|
17589
17590
|
case 304 /* SpreadAssignment */:
|
|
@@ -35486,11 +35487,11 @@ var Parser;
|
|
|
35486
35487
|
}
|
|
35487
35488
|
function parseClassElement() {
|
|
35488
35489
|
const pos = getNodePos();
|
|
35490
|
+
const hasJSDoc = hasPrecedingJSDocComment();
|
|
35489
35491
|
if (token() === 27 /* SemicolonToken */) {
|
|
35490
35492
|
nextToken();
|
|
35491
|
-
return finishNode(factory2.createSemicolonClassElement(), pos);
|
|
35493
|
+
return withJSDoc(finishNode(factory2.createSemicolonClassElement(), pos), hasJSDoc);
|
|
35492
35494
|
}
|
|
35493
|
-
const hasJSDoc = hasPrecedingJSDocComment();
|
|
35494
35495
|
const modifiers = parseModifiers(
|
|
35495
35496
|
/*allowDecorators*/
|
|
35496
35497
|
true,
|
|
@@ -48291,13 +48292,14 @@ function createTypeChecker(host) {
|
|
|
48291
48292
|
return diagnostic;
|
|
48292
48293
|
}
|
|
48293
48294
|
function isDeprecatedSymbol(symbol) {
|
|
48294
|
-
|
|
48295
|
-
|
|
48296
|
-
|
|
48297
|
-
return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */));
|
|
48298
|
-
}
|
|
48295
|
+
const parentSymbol = getParentOfSymbol(symbol);
|
|
48296
|
+
if (parentSymbol && length(symbol.declarations) > 1) {
|
|
48297
|
+
return parentSymbol.flags & 64 /* Interface */ ? some(symbol.declarations, isDeprecatedDeclaration2) : every(symbol.declarations, isDeprecatedDeclaration2);
|
|
48299
48298
|
}
|
|
48300
|
-
return !!(
|
|
48299
|
+
return !!symbol.valueDeclaration && isDeprecatedDeclaration2(symbol.valueDeclaration) || length(symbol.declarations) && every(symbol.declarations, isDeprecatedDeclaration2);
|
|
48300
|
+
}
|
|
48301
|
+
function isDeprecatedDeclaration2(declaration) {
|
|
48302
|
+
return !!(getCombinedNodeFlags(declaration) & 268435456 /* Deprecated */);
|
|
48301
48303
|
}
|
|
48302
48304
|
function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
|
|
48303
48305
|
const diagnostic = createDiagnosticForNode(location, Diagnostics._0_is_deprecated, deprecatedEntity);
|
|
@@ -59190,16 +59192,16 @@ function createTypeChecker(host) {
|
|
|
59190
59192
|
if (declaration.kind === 175 /* Constructor */) {
|
|
59191
59193
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
59192
59194
|
}
|
|
59195
|
+
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
59193
59196
|
if (isJSDocSignature(declaration)) {
|
|
59194
59197
|
const root = getJSDocRoot(declaration);
|
|
59195
|
-
if (root && isConstructorDeclaration(root.parent)) {
|
|
59198
|
+
if (root && isConstructorDeclaration(root.parent) && !typeNode) {
|
|
59196
59199
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
59197
59200
|
}
|
|
59198
59201
|
}
|
|
59199
59202
|
if (isJSDocConstructSignature(declaration)) {
|
|
59200
59203
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
59201
59204
|
}
|
|
59202
|
-
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
59203
59205
|
if (typeNode) {
|
|
59204
59206
|
return getTypeFromTypeNode(typeNode);
|
|
59205
59207
|
}
|
|
@@ -70457,7 +70459,7 @@ function createTypeChecker(host) {
|
|
|
70457
70459
|
markAliasReferenced(symbol, node);
|
|
70458
70460
|
}
|
|
70459
70461
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
70460
|
-
const targetSymbol =
|
|
70462
|
+
const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node);
|
|
70461
70463
|
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
70462
70464
|
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
70463
70465
|
}
|
|
@@ -71626,6 +71628,7 @@ function createTypeChecker(host) {
|
|
|
71626
71628
|
);
|
|
71627
71629
|
}
|
|
71628
71630
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
71631
|
+
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
71629
71632
|
return discriminateTypeByDiscriminableItems(
|
|
71630
71633
|
contextualType,
|
|
71631
71634
|
concatenate(
|
|
@@ -71636,7 +71639,14 @@ function createTypeChecker(host) {
|
|
|
71636
71639
|
map(
|
|
71637
71640
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
71638
71641
|
var _a;
|
|
71639
|
-
|
|
71642
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
71643
|
+
return false;
|
|
71644
|
+
}
|
|
71645
|
+
const element = node.parent.parent;
|
|
71646
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
71647
|
+
return false;
|
|
71648
|
+
}
|
|
71649
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
71640
71650
|
}),
|
|
71641
71651
|
(s) => [() => undefinedType, s.escapedName]
|
|
71642
71652
|
)
|
|
@@ -73453,8 +73463,9 @@ function createTypeChecker(host) {
|
|
|
73453
73463
|
addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText);
|
|
73454
73464
|
}
|
|
73455
73465
|
} else {
|
|
73456
|
-
|
|
73457
|
-
|
|
73466
|
+
const targetPropSymbol = resolveAliasWithDeprecationCheck(prop, right);
|
|
73467
|
+
if (isDeprecatedSymbol(targetPropSymbol) && isUncalledFunctionReference(node, targetPropSymbol) && targetPropSymbol.declarations) {
|
|
73468
|
+
addDeprecatedSuggestion(right, targetPropSymbol.declarations, right.escapedText);
|
|
73458
73469
|
}
|
|
73459
73470
|
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
|
|
73460
73471
|
markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
|
|
@@ -83730,19 +83741,17 @@ function createTypeChecker(host) {
|
|
|
83730
83741
|
}
|
|
83731
83742
|
}
|
|
83732
83743
|
if (isImportSpecifier(node)) {
|
|
83733
|
-
const targetSymbol =
|
|
83734
|
-
if (
|
|
83744
|
+
const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
|
|
83745
|
+
if (isDeprecatedSymbol(targetSymbol) && targetSymbol.declarations) {
|
|
83735
83746
|
addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
|
|
83736
83747
|
}
|
|
83737
83748
|
}
|
|
83738
83749
|
}
|
|
83739
83750
|
}
|
|
83740
|
-
function
|
|
83741
|
-
|
|
83742
|
-
}
|
|
83743
|
-
function checkDeprecatedAliasedSymbol(symbol, location) {
|
|
83744
|
-
if (!(symbol.flags & 2097152 /* Alias */))
|
|
83751
|
+
function resolveAliasWithDeprecationCheck(symbol, location) {
|
|
83752
|
+
if (!(symbol.flags & 2097152 /* Alias */) || isDeprecatedSymbol(symbol) || !getDeclarationOfAliasSymbol(symbol)) {
|
|
83745
83753
|
return symbol;
|
|
83754
|
+
}
|
|
83746
83755
|
const targetSymbol = resolveAlias(symbol);
|
|
83747
83756
|
if (targetSymbol === unknownSymbol)
|
|
83748
83757
|
return targetSymbol;
|
|
@@ -83752,7 +83761,7 @@ function createTypeChecker(host) {
|
|
|
83752
83761
|
if (target === targetSymbol)
|
|
83753
83762
|
break;
|
|
83754
83763
|
if (target.declarations && length(target.declarations)) {
|
|
83755
|
-
if (
|
|
83764
|
+
if (isDeprecatedSymbol(target)) {
|
|
83756
83765
|
addDeprecatedSuggestion(location, target.declarations, target.escapedName);
|
|
83757
83766
|
break;
|
|
83758
83767
|
} else {
|
|
@@ -106225,12 +106234,56 @@ function transformModule(context) {
|
|
|
106225
106234
|
return visitExportDeclaration(node);
|
|
106226
106235
|
case 276 /* ExportAssignment */:
|
|
106227
106236
|
return visitExportAssignment(node);
|
|
106237
|
+
case 261 /* FunctionDeclaration */:
|
|
106238
|
+
return visitFunctionDeclaration(node);
|
|
106239
|
+
case 262 /* ClassDeclaration */:
|
|
106240
|
+
return visitClassDeclaration(node);
|
|
106241
|
+
default:
|
|
106242
|
+
return topLevelNestedVisitor(node);
|
|
106243
|
+
}
|
|
106244
|
+
}
|
|
106245
|
+
function topLevelNestedVisitor(node) {
|
|
106246
|
+
switch (node.kind) {
|
|
106228
106247
|
case 242 /* VariableStatement */:
|
|
106229
106248
|
return visitVariableStatement(node);
|
|
106230
106249
|
case 261 /* FunctionDeclaration */:
|
|
106231
106250
|
return visitFunctionDeclaration(node);
|
|
106232
106251
|
case 262 /* ClassDeclaration */:
|
|
106233
106252
|
return visitClassDeclaration(node);
|
|
106253
|
+
case 247 /* ForStatement */:
|
|
106254
|
+
return visitForStatement(
|
|
106255
|
+
node,
|
|
106256
|
+
/*isTopLevel*/
|
|
106257
|
+
true
|
|
106258
|
+
);
|
|
106259
|
+
case 248 /* ForInStatement */:
|
|
106260
|
+
return visitForInStatement(node);
|
|
106261
|
+
case 249 /* ForOfStatement */:
|
|
106262
|
+
return visitForOfStatement(node);
|
|
106263
|
+
case 245 /* DoStatement */:
|
|
106264
|
+
return visitDoStatement(node);
|
|
106265
|
+
case 246 /* WhileStatement */:
|
|
106266
|
+
return visitWhileStatement(node);
|
|
106267
|
+
case 255 /* LabeledStatement */:
|
|
106268
|
+
return visitLabeledStatement(node);
|
|
106269
|
+
case 253 /* WithStatement */:
|
|
106270
|
+
return visitWithStatement(node);
|
|
106271
|
+
case 244 /* IfStatement */:
|
|
106272
|
+
return visitIfStatement(node);
|
|
106273
|
+
case 254 /* SwitchStatement */:
|
|
106274
|
+
return visitSwitchStatement(node);
|
|
106275
|
+
case 268 /* CaseBlock */:
|
|
106276
|
+
return visitCaseBlock(node);
|
|
106277
|
+
case 295 /* CaseClause */:
|
|
106278
|
+
return visitCaseClause(node);
|
|
106279
|
+
case 296 /* DefaultClause */:
|
|
106280
|
+
return visitDefaultClause(node);
|
|
106281
|
+
case 257 /* TryStatement */:
|
|
106282
|
+
return visitTryStatement(node);
|
|
106283
|
+
case 298 /* CatchClause */:
|
|
106284
|
+
return visitCatchClause(node);
|
|
106285
|
+
case 240 /* Block */:
|
|
106286
|
+
return visitBlock(node);
|
|
106234
106287
|
default:
|
|
106235
106288
|
return visitor(node);
|
|
106236
106289
|
}
|
|
@@ -106241,7 +106294,11 @@ function transformModule(context) {
|
|
|
106241
106294
|
}
|
|
106242
106295
|
switch (node.kind) {
|
|
106243
106296
|
case 247 /* ForStatement */:
|
|
106244
|
-
return visitForStatement(
|
|
106297
|
+
return visitForStatement(
|
|
106298
|
+
node,
|
|
106299
|
+
/*isTopLevel*/
|
|
106300
|
+
false
|
|
106301
|
+
);
|
|
106245
106302
|
case 243 /* ExpressionStatement */:
|
|
106246
106303
|
return visitExpressionStatement(node);
|
|
106247
106304
|
case 216 /* ParenthesizedExpression */:
|
|
@@ -106326,15 +106383,177 @@ function transformModule(context) {
|
|
|
106326
106383
|
}
|
|
106327
106384
|
return visitEachChild(node, visitor, context);
|
|
106328
106385
|
}
|
|
106329
|
-
function visitForStatement(node) {
|
|
106386
|
+
function visitForStatement(node, isTopLevel) {
|
|
106387
|
+
if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
106388
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
106389
|
+
/*statements*/
|
|
106390
|
+
void 0,
|
|
106391
|
+
node.initializer,
|
|
106392
|
+
/*isForInOrOfInitializer*/
|
|
106393
|
+
false
|
|
106394
|
+
);
|
|
106395
|
+
if (exportStatements) {
|
|
106396
|
+
const statements = [];
|
|
106397
|
+
const varDeclList = visitNode(node.initializer, discardedValueVisitor, isVariableDeclarationList);
|
|
106398
|
+
const varStatement = factory2.createVariableStatement(
|
|
106399
|
+
/*modifiers*/
|
|
106400
|
+
void 0,
|
|
106401
|
+
varDeclList
|
|
106402
|
+
);
|
|
106403
|
+
statements.push(varStatement);
|
|
106404
|
+
addRange(statements, exportStatements);
|
|
106405
|
+
const condition = visitNode(node.condition, visitor, isExpression);
|
|
106406
|
+
const incrementor = visitNode(node.incrementor, discardedValueVisitor, isExpression);
|
|
106407
|
+
const body = visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context);
|
|
106408
|
+
statements.push(factory2.updateForStatement(
|
|
106409
|
+
node,
|
|
106410
|
+
/*initializer*/
|
|
106411
|
+
void 0,
|
|
106412
|
+
condition,
|
|
106413
|
+
incrementor,
|
|
106414
|
+
body
|
|
106415
|
+
));
|
|
106416
|
+
return statements;
|
|
106417
|
+
}
|
|
106418
|
+
}
|
|
106330
106419
|
return factory2.updateForStatement(
|
|
106331
106420
|
node,
|
|
106332
106421
|
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
106333
106422
|
visitNode(node.condition, visitor, isExpression),
|
|
106334
106423
|
visitNode(node.incrementor, discardedValueVisitor, isExpression),
|
|
106335
|
-
visitIterationBody(node.statement, visitor, context)
|
|
106424
|
+
visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context)
|
|
106336
106425
|
);
|
|
106337
106426
|
}
|
|
106427
|
+
function visitForInStatement(node) {
|
|
106428
|
+
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
106429
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
106430
|
+
/*statements*/
|
|
106431
|
+
void 0,
|
|
106432
|
+
node.initializer,
|
|
106433
|
+
/*isForInOrOfInitializer*/
|
|
106434
|
+
true
|
|
106435
|
+
);
|
|
106436
|
+
if (some(exportStatements)) {
|
|
106437
|
+
const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
|
|
106438
|
+
const expression = visitNode(node.expression, visitor, isExpression);
|
|
106439
|
+
const body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
|
|
106440
|
+
const mergedBody = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
|
|
106441
|
+
[...exportStatements, body],
|
|
106442
|
+
/*multiLine*/
|
|
106443
|
+
true
|
|
106444
|
+
);
|
|
106445
|
+
return factory2.updateForInStatement(node, initializer, expression, mergedBody);
|
|
106446
|
+
}
|
|
106447
|
+
}
|
|
106448
|
+
return factory2.updateForInStatement(
|
|
106449
|
+
node,
|
|
106450
|
+
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
106451
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106452
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
106453
|
+
);
|
|
106454
|
+
}
|
|
106455
|
+
function visitForOfStatement(node) {
|
|
106456
|
+
if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) {
|
|
106457
|
+
const exportStatements = appendExportsOfVariableDeclarationList(
|
|
106458
|
+
/*statements*/
|
|
106459
|
+
void 0,
|
|
106460
|
+
node.initializer,
|
|
106461
|
+
/*isForInOrOfInitializer*/
|
|
106462
|
+
true
|
|
106463
|
+
);
|
|
106464
|
+
const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer);
|
|
106465
|
+
const expression = visitNode(node.expression, visitor, isExpression);
|
|
106466
|
+
let body = visitIterationBody(node.statement, topLevelNestedVisitor, context);
|
|
106467
|
+
if (some(exportStatements)) {
|
|
106468
|
+
body = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock(
|
|
106469
|
+
[...exportStatements, body],
|
|
106470
|
+
/*multiLine*/
|
|
106471
|
+
true
|
|
106472
|
+
);
|
|
106473
|
+
}
|
|
106474
|
+
return factory2.updateForOfStatement(node, node.awaitModifier, initializer, expression, body);
|
|
106475
|
+
}
|
|
106476
|
+
return factory2.updateForOfStatement(
|
|
106477
|
+
node,
|
|
106478
|
+
node.awaitModifier,
|
|
106479
|
+
visitNode(node.initializer, discardedValueVisitor, isForInitializer),
|
|
106480
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106481
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
106482
|
+
);
|
|
106483
|
+
}
|
|
106484
|
+
function visitDoStatement(node) {
|
|
106485
|
+
return factory2.updateDoStatement(
|
|
106486
|
+
node,
|
|
106487
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context),
|
|
106488
|
+
visitNode(node.expression, visitor, isExpression)
|
|
106489
|
+
);
|
|
106490
|
+
}
|
|
106491
|
+
function visitWhileStatement(node) {
|
|
106492
|
+
return factory2.updateWhileStatement(
|
|
106493
|
+
node,
|
|
106494
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106495
|
+
visitIterationBody(node.statement, topLevelNestedVisitor, context)
|
|
106496
|
+
);
|
|
106497
|
+
}
|
|
106498
|
+
function visitLabeledStatement(node) {
|
|
106499
|
+
return factory2.updateLabeledStatement(
|
|
106500
|
+
node,
|
|
106501
|
+
node.label,
|
|
106502
|
+
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
106503
|
+
);
|
|
106504
|
+
}
|
|
106505
|
+
function visitWithStatement(node) {
|
|
106506
|
+
return factory2.updateWithStatement(
|
|
106507
|
+
node,
|
|
106508
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106509
|
+
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
106510
|
+
);
|
|
106511
|
+
}
|
|
106512
|
+
function visitIfStatement(node) {
|
|
106513
|
+
return factory2.updateIfStatement(
|
|
106514
|
+
node,
|
|
106515
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106516
|
+
Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
|
|
106517
|
+
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
|
|
106518
|
+
);
|
|
106519
|
+
}
|
|
106520
|
+
function visitSwitchStatement(node) {
|
|
106521
|
+
return factory2.updateSwitchStatement(
|
|
106522
|
+
node,
|
|
106523
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106524
|
+
Debug.checkDefined(visitNode(node.caseBlock, topLevelNestedVisitor, isCaseBlock))
|
|
106525
|
+
);
|
|
106526
|
+
}
|
|
106527
|
+
function visitCaseBlock(node) {
|
|
106528
|
+
return factory2.updateCaseBlock(
|
|
106529
|
+
node,
|
|
106530
|
+
visitNodes2(node.clauses, topLevelNestedVisitor, isCaseOrDefaultClause)
|
|
106531
|
+
);
|
|
106532
|
+
}
|
|
106533
|
+
function visitCaseClause(node) {
|
|
106534
|
+
return factory2.updateCaseClause(
|
|
106535
|
+
node,
|
|
106536
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106537
|
+
visitNodes2(node.statements, topLevelNestedVisitor, isStatement)
|
|
106538
|
+
);
|
|
106539
|
+
}
|
|
106540
|
+
function visitDefaultClause(node) {
|
|
106541
|
+
return visitEachChild(node, topLevelNestedVisitor, context);
|
|
106542
|
+
}
|
|
106543
|
+
function visitTryStatement(node) {
|
|
106544
|
+
return visitEachChild(node, topLevelNestedVisitor, context);
|
|
106545
|
+
}
|
|
106546
|
+
function visitCatchClause(node) {
|
|
106547
|
+
return factory2.updateCatchClause(
|
|
106548
|
+
node,
|
|
106549
|
+
node.variableDeclaration,
|
|
106550
|
+
Debug.checkDefined(visitNode(node.block, topLevelNestedVisitor, isBlock))
|
|
106551
|
+
);
|
|
106552
|
+
}
|
|
106553
|
+
function visitBlock(node) {
|
|
106554
|
+
node = visitEachChild(node, topLevelNestedVisitor, context);
|
|
106555
|
+
return node;
|
|
106556
|
+
}
|
|
106338
106557
|
function visitExpressionStatement(node) {
|
|
106339
106558
|
return factory2.updateExpressionStatement(
|
|
106340
106559
|
node,
|
|
@@ -107127,25 +107346,33 @@ function transformModule(context) {
|
|
|
107127
107346
|
return appendExportsOfDeclaration(statements, decl);
|
|
107128
107347
|
}
|
|
107129
107348
|
function appendExportsOfVariableStatement(statements, node) {
|
|
107349
|
+
return appendExportsOfVariableDeclarationList(
|
|
107350
|
+
statements,
|
|
107351
|
+
node.declarationList,
|
|
107352
|
+
/*isForInOrOfInitializer*/
|
|
107353
|
+
false
|
|
107354
|
+
);
|
|
107355
|
+
}
|
|
107356
|
+
function appendExportsOfVariableDeclarationList(statements, node, isForInOrOfInitializer) {
|
|
107130
107357
|
if (currentModuleInfo.exportEquals) {
|
|
107131
107358
|
return statements;
|
|
107132
107359
|
}
|
|
107133
|
-
for (const decl of node.
|
|
107134
|
-
statements = appendExportsOfBindingElement(statements, decl);
|
|
107360
|
+
for (const decl of node.declarations) {
|
|
107361
|
+
statements = appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer);
|
|
107135
107362
|
}
|
|
107136
107363
|
return statements;
|
|
107137
107364
|
}
|
|
107138
|
-
function appendExportsOfBindingElement(statements, decl) {
|
|
107365
|
+
function appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer) {
|
|
107139
107366
|
if (currentModuleInfo.exportEquals) {
|
|
107140
107367
|
return statements;
|
|
107141
107368
|
}
|
|
107142
107369
|
if (isBindingPattern(decl.name)) {
|
|
107143
107370
|
for (const element of decl.name.elements) {
|
|
107144
107371
|
if (!isOmittedExpression(element)) {
|
|
107145
|
-
statements = appendExportsOfBindingElement(statements, element);
|
|
107372
|
+
statements = appendExportsOfBindingElement(statements, element, isForInOrOfInitializer);
|
|
107146
107373
|
}
|
|
107147
107374
|
}
|
|
107148
|
-
} else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer)) {
|
|
107375
|
+
} else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer || isForInOrOfInitializer)) {
|
|
107149
107376
|
statements = appendExportsOfDeclaration(statements, decl);
|
|
107150
107377
|
}
|
|
107151
107378
|
return statements;
|
|
@@ -117327,7 +117554,7 @@ var WatchLogLevel = /* @__PURE__ */ ((WatchLogLevel2) => {
|
|
|
117327
117554
|
WatchLogLevel2[WatchLogLevel2["Verbose"] = 2] = "Verbose";
|
|
117328
117555
|
return WatchLogLevel2;
|
|
117329
117556
|
})(WatchLogLevel || {});
|
|
117330
|
-
function getWatchFactory(host, watchLogLevel, log,
|
|
117557
|
+
function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo2) {
|
|
117331
117558
|
setSysLog(watchLogLevel === 2 /* Verbose */ ? log : noop);
|
|
117332
117559
|
const plainInvokeFactory = {
|
|
117333
117560
|
watchFile: (file, callback, pollingInterval, options) => host.watchFile(file, callback, pollingInterval, options),
|
|
@@ -117365,23 +117592,23 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo3) {
|
|
|
117365
117592
|
return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
|
|
117366
117593
|
}
|
|
117367
117594
|
function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
|
|
117368
|
-
log(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117595
|
+
log(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
117369
117596
|
return {
|
|
117370
|
-
close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117597
|
+
close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
|
|
117371
117598
|
};
|
|
117372
117599
|
}
|
|
117373
117600
|
function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
117374
|
-
log(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117601
|
+
log(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
117375
117602
|
const watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
117376
117603
|
return {
|
|
117377
117604
|
close: () => {
|
|
117378
|
-
log(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117605
|
+
log(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
117379
117606
|
watcher.close();
|
|
117380
117607
|
}
|
|
117381
117608
|
};
|
|
117382
117609
|
}
|
|
117383
117610
|
function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
117384
|
-
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117611
|
+
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
117385
117612
|
log(watchInfo);
|
|
117386
117613
|
const start2 = timestamp();
|
|
117387
117614
|
const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
@@ -117389,7 +117616,7 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo3) {
|
|
|
117389
117616
|
log(`Elapsed:: ${elapsed}ms ${watchInfo}`);
|
|
117390
117617
|
return {
|
|
117391
117618
|
close: () => {
|
|
117392
|
-
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117619
|
+
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
117393
117620
|
log(watchInfo2);
|
|
117394
117621
|
const start3 = timestamp();
|
|
117395
117622
|
watcher.close();
|
|
@@ -117404,7 +117631,7 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo3) {
|
|
|
117404
117631
|
void 0,
|
|
117405
117632
|
file,
|
|
117406
117633
|
(...args) => {
|
|
117407
|
-
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117634
|
+
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
117408
117635
|
log(triggerredInfo);
|
|
117409
117636
|
const start2 = timestamp();
|
|
117410
117637
|
cb.call(
|
|
@@ -117421,8 +117648,8 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo3) {
|
|
|
117421
117648
|
detailInfo2
|
|
117422
117649
|
);
|
|
117423
117650
|
}
|
|
117424
|
-
function getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117425
|
-
return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${
|
|
117651
|
+
function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo3) {
|
|
117652
|
+
return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${getDetailWatchInfo3 ? getDetailWatchInfo3(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : `${detailInfo1} ${detailInfo2}`}`;
|
|
117426
117653
|
}
|
|
117427
117654
|
}
|
|
117428
117655
|
function getFallbackOptions(options) {
|
|
@@ -124554,7 +124781,9 @@ var WatchType = {
|
|
|
124554
124781
|
MissingSourceMapFile: "Missing source map file",
|
|
124555
124782
|
NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root",
|
|
124556
124783
|
MissingGeneratedFile: "Missing generated file",
|
|
124557
|
-
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation"
|
|
124784
|
+
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation",
|
|
124785
|
+
TypingInstallerLocationFile: "File location for typing installer",
|
|
124786
|
+
TypingInstallerLocationDirectory: "Directory location for typing installer"
|
|
124558
124787
|
};
|
|
124559
124788
|
function createWatchFactory(host, options) {
|
|
124560
124789
|
const watchLogLevel = host.trace ? options.extendedDiagnostics ? 2 /* Verbose */ : options.diagnostics ? 1 /* TriggerOnly */ : 0 /* None */ : 0 /* None */;
|
|
@@ -127834,6 +128063,7 @@ var EventTypesRegistry = "event::typesRegistry";
|
|
|
127834
128063
|
var EventBeginInstallTypes = "event::beginInstallTypes";
|
|
127835
128064
|
var EventEndInstallTypes = "event::endInstallTypes";
|
|
127836
128065
|
var EventInitializationFailed = "event::initializationFailed";
|
|
128066
|
+
var ActionWatchTypingLocations = "action::watchTypingLocations";
|
|
127837
128067
|
var Arguments;
|
|
127838
128068
|
((Arguments2) => {
|
|
127839
128069
|
Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation";
|
|
@@ -171595,6 +171825,7 @@ __export(ts_server_exports3, {
|
|
|
171595
171825
|
ActionInvalidate: () => ActionInvalidate,
|
|
171596
171826
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
171597
171827
|
ActionSet: () => ActionSet,
|
|
171828
|
+
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
171598
171829
|
Arguments: () => Arguments,
|
|
171599
171830
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
171600
171831
|
CharRangeSection: () => CharRangeSection,
|
|
@@ -171728,19 +171959,6 @@ function getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remainin
|
|
|
171728
171959
|
}
|
|
171729
171960
|
return { command, remaining: remaining - toSlice };
|
|
171730
171961
|
}
|
|
171731
|
-
function endsWith2(str, suffix, caseSensitive) {
|
|
171732
|
-
const expectedPos = str.length - suffix.length;
|
|
171733
|
-
return expectedPos >= 0 && (str.indexOf(suffix, expectedPos) === expectedPos || !caseSensitive && compareStringsCaseInsensitive(str.substr(expectedPos), suffix) === 0 /* EqualTo */);
|
|
171734
|
-
}
|
|
171735
|
-
function isPackageOrBowerJson(fileName, caseSensitive) {
|
|
171736
|
-
return endsWith2(fileName, "/package.json", caseSensitive) || endsWith2(fileName, "/bower.json", caseSensitive);
|
|
171737
|
-
}
|
|
171738
|
-
function sameFiles(a, b, caseSensitive) {
|
|
171739
|
-
return a === b || !caseSensitive && compareStringsCaseInsensitive(a, b) === 0 /* EqualTo */;
|
|
171740
|
-
}
|
|
171741
|
-
function getDetailWatchInfo(projectName, watchers) {
|
|
171742
|
-
return `Project: ${projectName} watcher already invoked: ${watchers == null ? void 0 : watchers.isInvoked}`;
|
|
171743
|
-
}
|
|
171744
171962
|
var TypingsInstaller = class {
|
|
171745
171963
|
constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation, throttleLimit, log = nullLog) {
|
|
171746
171964
|
this.installTypingHost = installTypingHost;
|
|
@@ -171758,13 +171976,10 @@ var TypingsInstaller = class {
|
|
|
171758
171976
|
this.installRunCount = 1;
|
|
171759
171977
|
this.inFlightRequestCount = 0;
|
|
171760
171978
|
this.latestDistTag = "latest";
|
|
171761
|
-
this.toCanonicalFileName = createGetCanonicalFileName(installTypingHost.useCaseSensitiveFileNames);
|
|
171762
|
-
this.globalCachePackageJsonPath = combinePaths(globalCachePath, "package.json");
|
|
171763
171979
|
const isLoggingEnabled = this.log.isEnabled();
|
|
171764
171980
|
if (isLoggingEnabled) {
|
|
171765
171981
|
this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}', types map path ${typesMapLocation}`);
|
|
171766
171982
|
}
|
|
171767
|
-
this.watchFactory = getWatchFactory(this.installTypingHost, isLoggingEnabled ? 2 /* Verbose */ : 0 /* None */, (s) => this.log.writeLine(s), getDetailWatchInfo);
|
|
171768
171983
|
this.processCacheLocation(this.globalCachePath);
|
|
171769
171984
|
}
|
|
171770
171985
|
closeProject(req) {
|
|
@@ -171781,8 +171996,8 @@ var TypingsInstaller = class {
|
|
|
171781
171996
|
}
|
|
171782
171997
|
return;
|
|
171783
171998
|
}
|
|
171784
|
-
clearMap(watchers, closeFileWatcher);
|
|
171785
171999
|
this.projectWatchers.delete(projectName);
|
|
172000
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: [] });
|
|
171786
172001
|
if (this.log.isEnabled()) {
|
|
171787
172002
|
this.log.writeLine(`Closing file watchers for project '${projectName}' - done.`);
|
|
171788
172003
|
}
|
|
@@ -171815,7 +172030,7 @@ var TypingsInstaller = class {
|
|
|
171815
172030
|
if (this.log.isEnabled()) {
|
|
171816
172031
|
this.log.writeLine(`Finished typings discovery: ${JSON.stringify(discoverTypingsResult)}`);
|
|
171817
172032
|
}
|
|
171818
|
-
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch
|
|
172033
|
+
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch);
|
|
171819
172034
|
if (discoverTypingsResult.newTypingNames.length) {
|
|
171820
172035
|
this.installTypings(req, req.cachePath || this.globalCachePath, discoverTypingsResult.cachedTypingPaths, discoverTypingsResult.newTypingNames);
|
|
171821
172036
|
} else {
|
|
@@ -172016,75 +172231,19 @@ var TypingsInstaller = class {
|
|
|
172016
172231
|
host.createDirectory(directory);
|
|
172017
172232
|
}
|
|
172018
172233
|
}
|
|
172019
|
-
watchFiles(projectName, files
|
|
172234
|
+
watchFiles(projectName, files) {
|
|
172020
172235
|
if (!files.length) {
|
|
172021
172236
|
this.closeWatchers(projectName);
|
|
172022
172237
|
return;
|
|
172023
172238
|
}
|
|
172024
|
-
|
|
172025
|
-
const
|
|
172026
|
-
if (!
|
|
172027
|
-
|
|
172028
|
-
this.
|
|
172239
|
+
const existing = this.projectWatchers.get(projectName);
|
|
172240
|
+
const newSet = new Set(files);
|
|
172241
|
+
if (!existing || forEachKey(newSet, (s) => !existing.has(s)) || forEachKey(existing, (s) => !newSet.has(s))) {
|
|
172242
|
+
this.projectWatchers.set(projectName, newSet);
|
|
172243
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files });
|
|
172029
172244
|
} else {
|
|
172030
|
-
|
|
172245
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: void 0 });
|
|
172031
172246
|
}
|
|
172032
|
-
watchers.isInvoked = false;
|
|
172033
|
-
const isLoggingEnabled = this.log.isEnabled();
|
|
172034
|
-
const createProjectWatcher = (path, projectWatcherType) => {
|
|
172035
|
-
const canonicalPath = this.toCanonicalFileName(path);
|
|
172036
|
-
toRemove.delete(canonicalPath);
|
|
172037
|
-
if (watchers.has(canonicalPath)) {
|
|
172038
|
-
return;
|
|
172039
|
-
}
|
|
172040
|
-
if (isLoggingEnabled) {
|
|
172041
|
-
this.log.writeLine(`${projectWatcherType}:: Added:: WatchInfo: ${path}`);
|
|
172042
|
-
}
|
|
172043
|
-
const watcher = projectWatcherType === "FileWatcher" /* FileWatcher */ ? this.watchFactory.watchFile(path, () => {
|
|
172044
|
-
if (!watchers.isInvoked) {
|
|
172045
|
-
watchers.isInvoked = true;
|
|
172046
|
-
this.sendResponse({ projectName, kind: ActionInvalidate });
|
|
172047
|
-
}
|
|
172048
|
-
}, 2e3 /* High */, options, projectName, watchers) : this.watchFactory.watchDirectory(path, (f) => {
|
|
172049
|
-
if (watchers.isInvoked || !fileExtensionIs(f, ".json" /* Json */)) {
|
|
172050
|
-
return;
|
|
172051
|
-
}
|
|
172052
|
-
if (isPackageOrBowerJson(f, this.installTypingHost.useCaseSensitiveFileNames) && !sameFiles(f, this.globalCachePackageJsonPath, this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
172053
|
-
watchers.isInvoked = true;
|
|
172054
|
-
this.sendResponse({ projectName, kind: ActionInvalidate });
|
|
172055
|
-
}
|
|
172056
|
-
}, 1 /* Recursive */, options, projectName, watchers);
|
|
172057
|
-
watchers.set(canonicalPath, isLoggingEnabled ? {
|
|
172058
|
-
close: () => {
|
|
172059
|
-
this.log.writeLine(`${projectWatcherType}:: Closed:: WatchInfo: ${path}`);
|
|
172060
|
-
watcher.close();
|
|
172061
|
-
}
|
|
172062
|
-
} : watcher);
|
|
172063
|
-
};
|
|
172064
|
-
for (const file of files) {
|
|
172065
|
-
if (file.endsWith("/package.json") || file.endsWith("/bower.json")) {
|
|
172066
|
-
createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
|
|
172067
|
-
continue;
|
|
172068
|
-
}
|
|
172069
|
-
if (containsPath(projectRootPath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
172070
|
-
const subDirectory = file.indexOf(directorySeparator, projectRootPath.length + 1);
|
|
172071
|
-
if (subDirectory !== -1) {
|
|
172072
|
-
createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
|
|
172073
|
-
} else {
|
|
172074
|
-
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
172075
|
-
}
|
|
172076
|
-
continue;
|
|
172077
|
-
}
|
|
172078
|
-
if (containsPath(this.globalCachePath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
172079
|
-
createProjectWatcher(this.globalCachePath, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
172080
|
-
continue;
|
|
172081
|
-
}
|
|
172082
|
-
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
172083
|
-
}
|
|
172084
|
-
toRemove.forEach((watch, path) => {
|
|
172085
|
-
watch.close();
|
|
172086
|
-
watchers.delete(path);
|
|
172087
|
-
});
|
|
172088
172247
|
}
|
|
172089
172248
|
createSetTypings(request, typings) {
|
|
172090
172249
|
return {
|
|
@@ -172141,7 +172300,6 @@ function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports
|
|
|
172141
172300
|
true
|
|
172142
172301
|
).concat(project.getExcludedFiles()),
|
|
172143
172302
|
compilerOptions: project.getCompilationSettings(),
|
|
172144
|
-
watchOptions: project.projectService.getWatchOptions(project),
|
|
172145
172303
|
typeAcquisition,
|
|
172146
172304
|
unresolvedImports,
|
|
172147
172305
|
projectRootPath: project.getCurrentDirectory(),
|
|
@@ -173759,6 +173917,8 @@ var Project3 = class {
|
|
|
173759
173917
|
return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
|
|
173760
173918
|
}
|
|
173761
173919
|
close() {
|
|
173920
|
+
this.projectService.typingsCache.onProjectClosed(this);
|
|
173921
|
+
this.closeWatchingTypingLocations();
|
|
173762
173922
|
if (this.program) {
|
|
173763
173923
|
for (const f of this.program.getSourceFiles()) {
|
|
173764
173924
|
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
@@ -174049,6 +174209,89 @@ var Project3 = class {
|
|
|
174049
174209
|
}
|
|
174050
174210
|
}
|
|
174051
174211
|
/** @internal */
|
|
174212
|
+
closeWatchingTypingLocations() {
|
|
174213
|
+
if (this.typingWatchers)
|
|
174214
|
+
clearMap(this.typingWatchers, closeFileWatcher);
|
|
174215
|
+
this.typingWatchers = void 0;
|
|
174216
|
+
}
|
|
174217
|
+
/** @internal */
|
|
174218
|
+
onTypingInstallerWatchInvoke() {
|
|
174219
|
+
this.typingWatchers.isInvoked = true;
|
|
174220
|
+
this.projectService.updateTypingsForProject({ projectName: this.getProjectName(), kind: ActionInvalidate });
|
|
174221
|
+
}
|
|
174222
|
+
/** @internal */
|
|
174223
|
+
watchTypingLocations(files) {
|
|
174224
|
+
if (!files) {
|
|
174225
|
+
this.typingWatchers.isInvoked = false;
|
|
174226
|
+
return;
|
|
174227
|
+
}
|
|
174228
|
+
if (!files.length) {
|
|
174229
|
+
this.closeWatchingTypingLocations();
|
|
174230
|
+
return;
|
|
174231
|
+
}
|
|
174232
|
+
const toRemove = new Map(this.typingWatchers);
|
|
174233
|
+
if (!this.typingWatchers)
|
|
174234
|
+
this.typingWatchers = /* @__PURE__ */ new Map();
|
|
174235
|
+
this.typingWatchers.isInvoked = false;
|
|
174236
|
+
const createProjectWatcher = (path, typingsWatcherType) => {
|
|
174237
|
+
const canonicalPath = this.toPath(path);
|
|
174238
|
+
toRemove.delete(canonicalPath);
|
|
174239
|
+
if (!this.typingWatchers.has(canonicalPath)) {
|
|
174240
|
+
this.typingWatchers.set(
|
|
174241
|
+
canonicalPath,
|
|
174242
|
+
typingsWatcherType === "FileWatcher" /* FileWatcher */ ? this.projectService.watchFactory.watchFile(
|
|
174243
|
+
path,
|
|
174244
|
+
() => !this.typingWatchers.isInvoked ? this.onTypingInstallerWatchInvoke() : this.writeLog(`TypingWatchers already invoked`),
|
|
174245
|
+
2e3 /* High */,
|
|
174246
|
+
this.projectService.getWatchOptions(this),
|
|
174247
|
+
WatchType.TypingInstallerLocationFile,
|
|
174248
|
+
this
|
|
174249
|
+
) : this.projectService.watchFactory.watchDirectory(
|
|
174250
|
+
path,
|
|
174251
|
+
(f) => {
|
|
174252
|
+
if (this.typingWatchers.isInvoked)
|
|
174253
|
+
return this.writeLog(`TypingWatchers already invoked`);
|
|
174254
|
+
if (!fileExtensionIs(f, ".json" /* Json */))
|
|
174255
|
+
return this.writeLog(`Ignoring files that are not *.json`);
|
|
174256
|
+
if (comparePaths(f, combinePaths(this.projectService.typingsInstaller.globalTypingsCacheLocation, "package.json"), !this.useCaseSensitiveFileNames()))
|
|
174257
|
+
return this.writeLog(`Ignoring package.json change at global typings location`);
|
|
174258
|
+
this.onTypingInstallerWatchInvoke();
|
|
174259
|
+
},
|
|
174260
|
+
1 /* Recursive */,
|
|
174261
|
+
this.projectService.getWatchOptions(this),
|
|
174262
|
+
WatchType.TypingInstallerLocationDirectory,
|
|
174263
|
+
this
|
|
174264
|
+
)
|
|
174265
|
+
);
|
|
174266
|
+
}
|
|
174267
|
+
};
|
|
174268
|
+
for (const file of files) {
|
|
174269
|
+
const basename = getBaseFileName(file);
|
|
174270
|
+
if (basename === "package.json" || basename === "bower.json") {
|
|
174271
|
+
createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
|
|
174272
|
+
continue;
|
|
174273
|
+
}
|
|
174274
|
+
if (containsPath(this.currentDirectory, file, this.currentDirectory, !this.useCaseSensitiveFileNames())) {
|
|
174275
|
+
const subDirectory = file.indexOf(directorySeparator, this.currentDirectory.length + 1);
|
|
174276
|
+
if (subDirectory !== -1) {
|
|
174277
|
+
createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
|
|
174278
|
+
} else {
|
|
174279
|
+
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
174280
|
+
}
|
|
174281
|
+
continue;
|
|
174282
|
+
}
|
|
174283
|
+
if (containsPath(this.projectService.typingsInstaller.globalTypingsCacheLocation, file, this.currentDirectory, !this.useCaseSensitiveFileNames())) {
|
|
174284
|
+
createProjectWatcher(this.projectService.typingsInstaller.globalTypingsCacheLocation, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
174285
|
+
continue;
|
|
174286
|
+
}
|
|
174287
|
+
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
174288
|
+
}
|
|
174289
|
+
toRemove.forEach((watch, path) => {
|
|
174290
|
+
watch.close();
|
|
174291
|
+
this.typingWatchers.delete(path);
|
|
174292
|
+
});
|
|
174293
|
+
}
|
|
174294
|
+
/** @internal */
|
|
174052
174295
|
getCurrentProgram() {
|
|
174053
174296
|
return this.program;
|
|
174054
174297
|
}
|
|
@@ -175613,7 +175856,7 @@ function forEachReferencedProject(project, cb) {
|
|
|
175613
175856
|
(potentialProjectRef) => callbackRefProject(project, cb, potentialProjectRef)
|
|
175614
175857
|
);
|
|
175615
175858
|
}
|
|
175616
|
-
function
|
|
175859
|
+
function getDetailWatchInfo(watchType, project) {
|
|
175617
175860
|
return `${isString(project) ? `Config: ${project} ` : project ? `Project: ${project.getProjectName()} ` : ""}WatchType: ${watchType}`;
|
|
175618
175861
|
}
|
|
175619
175862
|
function isScriptInfoWatchedFromNodeModules(info) {
|
|
@@ -175759,7 +176002,7 @@ var _ProjectService = class {
|
|
|
175759
176002
|
this.watchFactory = this.serverMode !== 0 /* Semantic */ ? {
|
|
175760
176003
|
watchFile: returnNoopFileWatcher,
|
|
175761
176004
|
watchDirectory: returnNoopFileWatcher
|
|
175762
|
-
} : getWatchFactory(this.host, watchLogLevel, log,
|
|
176005
|
+
} : getWatchFactory(this.host, watchLogLevel, log, getDetailWatchInfo);
|
|
175763
176006
|
}
|
|
175764
176007
|
toPath(fileName) {
|
|
175765
176008
|
return toPath(fileName, this.currentDirectory, this.toCanonicalFileName);
|
|
@@ -175845,6 +176088,11 @@ var _ProjectService = class {
|
|
|
175845
176088
|
}
|
|
175846
176089
|
}
|
|
175847
176090
|
/** @internal */
|
|
176091
|
+
watchTypingLocations(response) {
|
|
176092
|
+
var _a;
|
|
176093
|
+
(_a = this.findProject(response.projectName)) == null ? void 0 : _a.watchTypingLocations(response.files);
|
|
176094
|
+
}
|
|
176095
|
+
/** @internal */
|
|
175848
176096
|
delayEnsureProjectForOpenFiles() {
|
|
175849
176097
|
if (!this.openFiles.size)
|
|
175850
176098
|
return;
|
|
@@ -181515,7 +181763,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
|
|
|
181515
181763
|
getApplicableRefactors(args) {
|
|
181516
181764
|
const { file, project } = this.getFileAndProject(args);
|
|
181517
181765
|
const scriptInfo = project.getScriptInfoForNormalizedPath(file);
|
|
181518
|
-
return project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind);
|
|
181766
|
+
return project.getLanguageService().getApplicableRefactors(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file), args.triggerReason, args.kind, args.includeInteractiveActions);
|
|
181519
181767
|
}
|
|
181520
181768
|
getEditsForRefactor(args, simplifiedResult) {
|
|
181521
181769
|
const { file, project } = this.getFileAndProject(args);
|
|
@@ -182804,6 +183052,7 @@ __export(ts_server_exports4, {
|
|
|
182804
183052
|
ActionInvalidate: () => ActionInvalidate,
|
|
182805
183053
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
182806
183054
|
ActionSet: () => ActionSet,
|
|
183055
|
+
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
182807
183056
|
Arguments: () => Arguments,
|
|
182808
183057
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
182809
183058
|
CharRangeSection: () => CharRangeSection,
|
|
@@ -183415,6 +183664,9 @@ function startNodeSession(options, logger, cancellationToken) {
|
|
|
183415
183664
|
this.event(response, "setTypings");
|
|
183416
183665
|
break;
|
|
183417
183666
|
}
|
|
183667
|
+
case ActionWatchTypingLocations:
|
|
183668
|
+
this.projectService.watchTypingLocations(response);
|
|
183669
|
+
break;
|
|
183418
183670
|
default:
|
|
183419
183671
|
assertType(response);
|
|
183420
183672
|
}
|