typescript 4.7.0-dev.20220316 → 4.7.0-dev.20220319
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 +44 -19
- package/lib/tsserver.js +171 -41
- package/lib/tsserverlibrary.js +171 -41
- package/lib/typescript.js +150 -39
- package/lib/typescriptServices.js +150 -39
- package/lib/typingsInstaller.js +50 -20
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220319";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5437,6 +5437,7 @@ var ts;
|
|
|
5437
5437
|
Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),
|
|
5438
5438
|
Decorator_function_return_type_0_is_not_assignable_to_type_1: diag(1270, ts.DiagnosticCategory.Error, "Decorator_function_return_type_0_is_not_assignable_to_type_1_1270", "Decorator function return type '{0}' is not assignable to type '{1}'."),
|
|
5439
5439
|
Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any: diag(1271, ts.DiagnosticCategory.Error, "Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271", "Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),
|
|
5440
|
+
A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."),
|
|
5440
5441
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5441
5442
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5442
5443
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
@@ -33318,7 +33319,10 @@ var ts;
|
|
|
33318
33319
|
}
|
|
33319
33320
|
ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
|
|
33320
33321
|
function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
|
|
33321
|
-
|
|
33322
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse", "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName });
|
|
33323
|
+
var result = parseJsonConfigFileContentWorker(undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
|
|
33324
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
33325
|
+
return result;
|
|
33322
33326
|
}
|
|
33323
33327
|
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
|
|
33324
33328
|
function setConfigFileInOptions(options, configFile) {
|
|
@@ -48751,7 +48755,15 @@ var ts;
|
|
|
48751
48755
|
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
|
|
48752
48756
|
});
|
|
48753
48757
|
var syntheticArgsSymbol = createSymbol(3, "args", 32768);
|
|
48754
|
-
|
|
48758
|
+
if (lastParamVariadicType) {
|
|
48759
|
+
syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
48760
|
+
}
|
|
48761
|
+
else {
|
|
48762
|
+
syntheticArgsSymbol.checkFlags |= 65536;
|
|
48763
|
+
syntheticArgsSymbol.deferralParent = neverType;
|
|
48764
|
+
syntheticArgsSymbol.deferralConstituents = [anyArrayType];
|
|
48765
|
+
syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
|
|
48766
|
+
}
|
|
48755
48767
|
if (lastParamVariadicType) {
|
|
48756
48768
|
parameters.pop();
|
|
48757
48769
|
}
|
|
@@ -64247,7 +64259,9 @@ var ts;
|
|
|
64247
64259
|
}
|
|
64248
64260
|
if (signatureHasRestParameter(signature)) {
|
|
64249
64261
|
var parameter = ts.last(signature.parameters);
|
|
64250
|
-
if (
|
|
64262
|
+
if (parameter.valueDeclaration
|
|
64263
|
+
? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
|
|
64264
|
+
: !!(ts.getCheckFlags(parameter) & 65536)) {
|
|
64251
64265
|
var contextualParameterType = getRestTypeAtPosition(context, len);
|
|
64252
64266
|
assignParameterType(parameter, contextualParameterType);
|
|
64253
64267
|
}
|
|
@@ -64266,8 +64280,8 @@ var ts;
|
|
|
64266
64280
|
var links = getSymbolLinks(parameter);
|
|
64267
64281
|
if (!links.type) {
|
|
64268
64282
|
var declaration = parameter.valueDeclaration;
|
|
64269
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
|
64270
|
-
if (declaration.name.kind !== 79) {
|
|
64283
|
+
links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, true) : getTypeOfSymbol(parameter));
|
|
64284
|
+
if (declaration && declaration.name.kind !== 79) {
|
|
64271
64285
|
if (links.type === unknownType) {
|
|
64272
64286
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
64273
64287
|
}
|
|
@@ -67527,26 +67541,37 @@ var ts;
|
|
|
67527
67541
|
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage);
|
|
67528
67542
|
}
|
|
67529
67543
|
function markTypeNodeAsReferenced(node) {
|
|
67530
|
-
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
|
|
67544
|
+
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node), false);
|
|
67531
67545
|
}
|
|
67532
|
-
function markEntityNameOrEntityExpressionAsReference(typeName) {
|
|
67546
|
+
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
67533
67547
|
if (!typeName)
|
|
67534
67548
|
return;
|
|
67535
67549
|
var rootName = ts.getFirstIdentifier(typeName);
|
|
67536
67550
|
var meaning = (typeName.kind === 79 ? 788968 : 1920) | 2097152;
|
|
67537
67551
|
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, undefined, undefined, true);
|
|
67538
|
-
if (rootSymbol
|
|
67539
|
-
|
|
67540
|
-
|
|
67541
|
-
|
|
67542
|
-
|
|
67543
|
-
|
|
67552
|
+
if (rootSymbol && rootSymbol.flags & 2097152) {
|
|
67553
|
+
if (symbolIsValue(rootSymbol)
|
|
67554
|
+
&& !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
|
|
67555
|
+
&& !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
67556
|
+
markAliasSymbolAsReferenced(rootSymbol);
|
|
67557
|
+
}
|
|
67558
|
+
else if (forDecoratorMetadata
|
|
67559
|
+
&& compilerOptions.isolatedModules
|
|
67560
|
+
&& ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015
|
|
67561
|
+
&& !symbolIsValue(rootSymbol)
|
|
67562
|
+
&& !ts.some(rootSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration)) {
|
|
67563
|
+
var diag = error(typeName, ts.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
67564
|
+
var aliasDeclaration = ts.find(rootSymbol.declarations || ts.emptyArray, isAliasSymbolDeclaration);
|
|
67565
|
+
if (aliasDeclaration) {
|
|
67566
|
+
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(aliasDeclaration, ts.Diagnostics._0_was_imported_here, ts.idText(rootName)));
|
|
67567
|
+
}
|
|
67568
|
+
}
|
|
67544
67569
|
}
|
|
67545
67570
|
}
|
|
67546
67571
|
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
67547
67572
|
var entityName = getEntityNameForDecoratorMetadata(node);
|
|
67548
67573
|
if (entityName && ts.isEntityName(entityName)) {
|
|
67549
|
-
markEntityNameOrEntityExpressionAsReference(entityName);
|
|
67574
|
+
markEntityNameOrEntityExpressionAsReference(entityName, true);
|
|
67550
67575
|
}
|
|
67551
67576
|
}
|
|
67552
67577
|
function getEntityNameForDecoratorMetadata(node) {
|
|
@@ -70657,7 +70682,7 @@ var ts;
|
|
|
70657
70682
|
if (checkGrammarModuleElementContext(node, ts.isInJSFile(node) ? ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_module : ts.Diagnostics.An_export_declaration_can_only_be_used_at_the_top_level_of_a_namespace_or_module)) {
|
|
70658
70683
|
return;
|
|
70659
70684
|
}
|
|
70660
|
-
if (!checkGrammarDecoratorsAndModifiers(node) && ts.
|
|
70685
|
+
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasSyntacticModifiers(node)) {
|
|
70661
70686
|
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
|
|
70662
70687
|
}
|
|
70663
70688
|
if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0) {
|
|
@@ -73546,9 +73571,9 @@ var ts;
|
|
|
73546
73571
|
}
|
|
73547
73572
|
var parent = ts.walkUpParenthesizedTypes(node.parent);
|
|
73548
73573
|
if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
|
|
73549
|
-
|
|
73550
|
-
if (
|
|
73551
|
-
parent =
|
|
73574
|
+
var host_2 = ts.getJSDocHost(parent);
|
|
73575
|
+
if (host_2) {
|
|
73576
|
+
parent = ts.getSingleVariableOfVariableStatement(host_2) || host_2;
|
|
73552
73577
|
}
|
|
73553
73578
|
}
|
|
73554
73579
|
switch (parent.kind) {
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220319";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8250,6 +8250,7 @@ var ts;
|
|
|
8250
8250
|
Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),
|
|
8251
8251
|
Decorator_function_return_type_0_is_not_assignable_to_type_1: diag(1270, ts.DiagnosticCategory.Error, "Decorator_function_return_type_0_is_not_assignable_to_type_1_1270", "Decorator function return type '{0}' is not assignable to type '{1}'."),
|
|
8252
8252
|
Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any: diag(1271, ts.DiagnosticCategory.Error, "Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271", "Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),
|
|
8253
|
+
A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."),
|
|
8253
8254
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
8254
8255
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
8255
8256
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
@@ -40895,7 +40896,10 @@ var ts;
|
|
|
40895
40896
|
* file to. e.g. outDir
|
|
40896
40897
|
*/
|
|
40897
40898
|
function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) {
|
|
40898
|
-
|
|
40899
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse" /* Parse */, "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName });
|
|
40900
|
+
var result = parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
|
|
40901
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
40902
|
+
return result;
|
|
40899
40903
|
}
|
|
40900
40904
|
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
|
|
40901
40905
|
/*@internal*/
|
|
@@ -58896,7 +58900,19 @@ var ts;
|
|
|
58896
58900
|
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
|
|
58897
58901
|
});
|
|
58898
58902
|
var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
|
|
58899
|
-
|
|
58903
|
+
if (lastParamVariadicType) {
|
|
58904
|
+
// Parameter has effective annotation, lock in type
|
|
58905
|
+
syntheticArgsSymbol.type = createArrayType(getTypeFromTypeNode(lastParamVariadicType.type));
|
|
58906
|
+
}
|
|
58907
|
+
else {
|
|
58908
|
+
// Parameter has no annotation
|
|
58909
|
+
// By using a `DeferredType` symbol, we allow the type of this rest arg to be overriden by contextual type assignment so long as its type hasn't been
|
|
58910
|
+
// cached by `getTypeOfSymbol` yet.
|
|
58911
|
+
syntheticArgsSymbol.checkFlags |= 65536 /* DeferredType */;
|
|
58912
|
+
syntheticArgsSymbol.deferralParent = neverType;
|
|
58913
|
+
syntheticArgsSymbol.deferralConstituents = [anyArrayType];
|
|
58914
|
+
syntheticArgsSymbol.deferralWriteConstituents = [anyArrayType];
|
|
58915
|
+
}
|
|
58900
58916
|
if (lastParamVariadicType) {
|
|
58901
58917
|
// Replace the last parameter with a rest parameter.
|
|
58902
58918
|
parameters.pop();
|
|
@@ -76783,7 +76799,11 @@ var ts;
|
|
|
76783
76799
|
if (signatureHasRestParameter(signature)) {
|
|
76784
76800
|
// parameter might be a transient symbol generated by use of `arguments` in the function body.
|
|
76785
76801
|
var parameter = ts.last(signature.parameters);
|
|
76786
|
-
if (
|
|
76802
|
+
if (parameter.valueDeclaration
|
|
76803
|
+
? !ts.getEffectiveTypeAnnotationNode(parameter.valueDeclaration)
|
|
76804
|
+
// a declarationless parameter may still have a `.type` already set by its construction logic
|
|
76805
|
+
// (which may pull a type from a jsdoc) - only allow fixing on `DeferredType` parameters with a fallback type
|
|
76806
|
+
: !!(ts.getCheckFlags(parameter) & 65536 /* DeferredType */)) {
|
|
76787
76807
|
var contextualParameterType = getRestTypeAtPosition(context, len);
|
|
76788
76808
|
assignParameterType(parameter, contextualParameterType);
|
|
76789
76809
|
}
|
|
@@ -76802,8 +76822,8 @@ var ts;
|
|
|
76802
76822
|
var links = getSymbolLinks(parameter);
|
|
76803
76823
|
if (!links.type) {
|
|
76804
76824
|
var declaration = parameter.valueDeclaration;
|
|
76805
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
|
|
76806
|
-
if (declaration.name.kind !== 79 /* Identifier */) {
|
|
76825
|
+
links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true) : getTypeOfSymbol(parameter));
|
|
76826
|
+
if (declaration && declaration.name.kind !== 79 /* Identifier */) {
|
|
76807
76827
|
// if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
|
|
76808
76828
|
if (links.type === unknownType) {
|
|
76809
76829
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
@@ -80616,20 +80636,31 @@ var ts;
|
|
|
80616
80636
|
* marked as referenced to prevent import elision.
|
|
80617
80637
|
*/
|
|
80618
80638
|
function markTypeNodeAsReferenced(node) {
|
|
80619
|
-
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
|
|
80639
|
+
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node), /*forDecoratorMetadata*/ false);
|
|
80620
80640
|
}
|
|
80621
|
-
function markEntityNameOrEntityExpressionAsReference(typeName) {
|
|
80641
|
+
function markEntityNameOrEntityExpressionAsReference(typeName, forDecoratorMetadata) {
|
|
80622
80642
|
if (!typeName)
|
|
80623
80643
|
return;
|
|
80624
80644
|
var rootName = ts.getFirstIdentifier(typeName);
|
|
80625
80645
|
var meaning = (typeName.kind === 79 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
|
|
80626
80646
|
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isReference*/ true);
|
|
80627
|
-
if (rootSymbol
|
|
80628
|
-
|
|
80629
|
-
|
|
80630
|
-
|
|
80631
|
-
|
|
80632
|
-
|
|
80647
|
+
if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) {
|
|
80648
|
+
if (symbolIsValue(rootSymbol)
|
|
80649
|
+
&& !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))
|
|
80650
|
+
&& !getTypeOnlyAliasDeclaration(rootSymbol)) {
|
|
80651
|
+
markAliasSymbolAsReferenced(rootSymbol);
|
|
80652
|
+
}
|
|
80653
|
+
else if (forDecoratorMetadata
|
|
80654
|
+
&& compilerOptions.isolatedModules
|
|
80655
|
+
&& ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.ES2015
|
|
80656
|
+
&& !symbolIsValue(rootSymbol)
|
|
80657
|
+
&& !ts.some(rootSymbol.declarations, ts.isTypeOnlyImportOrExportDeclaration)) {
|
|
80658
|
+
var diag = error(typeName, ts.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled);
|
|
80659
|
+
var aliasDeclaration = ts.find(rootSymbol.declarations || ts.emptyArray, isAliasSymbolDeclaration);
|
|
80660
|
+
if (aliasDeclaration) {
|
|
80661
|
+
ts.addRelatedInfo(diag, ts.createDiagnosticForNode(aliasDeclaration, ts.Diagnostics._0_was_imported_here, ts.idText(rootName)));
|
|
80662
|
+
}
|
|
80663
|
+
}
|
|
80633
80664
|
}
|
|
80634
80665
|
}
|
|
80635
80666
|
/**
|
|
@@ -80642,7 +80673,7 @@ var ts;
|
|
|
80642
80673
|
function markDecoratorMedataDataTypeNodeAsReferenced(node) {
|
|
80643
80674
|
var entityName = getEntityNameForDecoratorMetadata(node);
|
|
80644
80675
|
if (entityName && ts.isEntityName(entityName)) {
|
|
80645
|
-
markEntityNameOrEntityExpressionAsReference(entityName);
|
|
80676
|
+
markEntityNameOrEntityExpressionAsReference(entityName, /*forDecoratorMetadata*/ true);
|
|
80646
80677
|
}
|
|
80647
80678
|
}
|
|
80648
80679
|
function getEntityNameForDecoratorMetadata(node) {
|
|
@@ -84294,7 +84325,7 @@ var ts;
|
|
|
84294
84325
|
// If we hit an export in an illegal context, just bail out to avoid cascading errors.
|
|
84295
84326
|
return;
|
|
84296
84327
|
}
|
|
84297
|
-
if (!checkGrammarDecoratorsAndModifiers(node) && ts.
|
|
84328
|
+
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasSyntacticModifiers(node)) {
|
|
84298
84329
|
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers);
|
|
84299
84330
|
}
|
|
84300
84331
|
if (node.moduleSpecifier && node.exportClause && ts.isNamedExports(node.exportClause) && ts.length(node.exportClause.elements) && languageVersion === 0 /* ES3 */) {
|
|
@@ -87471,10 +87502,9 @@ var ts;
|
|
|
87471
87502
|
}
|
|
87472
87503
|
var parent = ts.walkUpParenthesizedTypes(node.parent);
|
|
87473
87504
|
if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
|
|
87474
|
-
|
|
87475
|
-
if (
|
|
87476
|
-
|
|
87477
|
-
parent = parent.parent.parent;
|
|
87505
|
+
var host_2 = ts.getJSDocHost(parent);
|
|
87506
|
+
if (host_2) {
|
|
87507
|
+
parent = ts.getSingleVariableOfVariableStatement(host_2) || host_2;
|
|
87478
87508
|
}
|
|
87479
87509
|
}
|
|
87480
87510
|
switch (parent.kind) {
|
|
@@ -130292,14 +130322,15 @@ var ts;
|
|
|
130292
130322
|
SortText["SuggestedClassMembers"] = "14";
|
|
130293
130323
|
SortText["GlobalsOrKeywords"] = "15";
|
|
130294
130324
|
SortText["AutoImportSuggestions"] = "16";
|
|
130295
|
-
SortText["
|
|
130296
|
-
SortText["
|
|
130297
|
-
SortText["
|
|
130298
|
-
SortText["
|
|
130299
|
-
SortText["
|
|
130300
|
-
SortText["
|
|
130301
|
-
SortText["
|
|
130302
|
-
SortText["
|
|
130325
|
+
SortText["ClassMemberSnippets"] = "17";
|
|
130326
|
+
SortText["JavascriptIdentifiers"] = "18";
|
|
130327
|
+
SortText["DeprecatedLocalDeclarationPriority"] = "19";
|
|
130328
|
+
SortText["DeprecatedLocationPriority"] = "20";
|
|
130329
|
+
SortText["DeprecatedOptionalMember"] = "21";
|
|
130330
|
+
SortText["DeprecatedMemberDeclaredBySpreadAssignment"] = "22";
|
|
130331
|
+
SortText["DeprecatedSuggestedClassMembers"] = "23";
|
|
130332
|
+
SortText["DeprecatedGlobalsOrKeywords"] = "24";
|
|
130333
|
+
SortText["DeprecatedAutoImportSuggestions"] = "25";
|
|
130303
130334
|
})(SortText = Completions.SortText || (Completions.SortText = {}));
|
|
130304
130335
|
var SortTextId;
|
|
130305
130336
|
(function (SortTextId) {
|
|
@@ -130311,10 +130342,10 @@ var ts;
|
|
|
130311
130342
|
SortTextId[SortTextId["GlobalsOrKeywords"] = 15] = "GlobalsOrKeywords";
|
|
130312
130343
|
SortTextId[SortTextId["AutoImportSuggestions"] = 16] = "AutoImportSuggestions";
|
|
130313
130344
|
// Don't use these directly.
|
|
130314
|
-
SortTextId[SortTextId["_JavaScriptIdentifiers"] =
|
|
130315
|
-
SortTextId[SortTextId["_DeprecatedStart"] =
|
|
130345
|
+
SortTextId[SortTextId["_JavaScriptIdentifiers"] = 18] = "_JavaScriptIdentifiers";
|
|
130346
|
+
SortTextId[SortTextId["_DeprecatedStart"] = 19] = "_DeprecatedStart";
|
|
130316
130347
|
SortTextId[SortTextId["_First"] = 10] = "_First";
|
|
130317
|
-
SortTextId[SortTextId["DeprecatedOffset"] =
|
|
130348
|
+
SortTextId[SortTextId["DeprecatedOffset"] = 9] = "DeprecatedOffset";
|
|
130318
130349
|
})(SortTextId || (SortTextId = {}));
|
|
130319
130350
|
/**
|
|
130320
130351
|
* Special values for `CompletionInfo['source']` used to disambiguate
|
|
@@ -130795,6 +130826,7 @@ var ts;
|
|
|
130795
130826
|
isClassLikeMemberCompletion(symbol, location)) {
|
|
130796
130827
|
var importAdder = void 0;
|
|
130797
130828
|
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
|
|
130829
|
+
sortText = SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852.
|
|
130798
130830
|
if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
|
|
130799
130831
|
hasAction = true;
|
|
130800
130832
|
source = CompletionSource.ClassMemberSnippet;
|
|
@@ -131158,7 +131190,7 @@ var ts;
|
|
|
131158
131190
|
}
|
|
131159
131191
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
131160
131192
|
var sortTextId = (_a = symbolToSortTextIdMap === null || symbolToSortTextIdMap === void 0 ? void 0 : symbolToSortTextIdMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : 11 /* LocationPriority */;
|
|
131161
|
-
var sortText = (isDeprecated(symbol, typeChecker) ?
|
|
131193
|
+
var sortText = (isDeprecated(symbol, typeChecker) ? 9 /* DeprecatedOffset */ + sortTextId : sortTextId).toString();
|
|
131162
131194
|
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag);
|
|
131163
131195
|
if (!entry) {
|
|
131164
131196
|
continue;
|
|
@@ -142398,7 +142430,7 @@ var ts;
|
|
|
142398
142430
|
if (!typeDisplayString) {
|
|
142399
142431
|
continue;
|
|
142400
142432
|
}
|
|
142401
|
-
addTypeHints(typeDisplayString, param.name.end);
|
|
142433
|
+
addTypeHints(typeDisplayString, param.questionToken ? param.questionToken.end : param.name.end);
|
|
142402
142434
|
}
|
|
142403
142435
|
}
|
|
142404
142436
|
function getParameterDeclarationTypeDisplayString(symbol) {
|
|
@@ -153577,6 +153609,74 @@ var ts;
|
|
|
153577
153609
|
})(ts || (ts = {}));
|
|
153578
153610
|
/* @internal */
|
|
153579
153611
|
var ts;
|
|
153612
|
+
(function (ts) {
|
|
153613
|
+
var codefix;
|
|
153614
|
+
(function (codefix) {
|
|
153615
|
+
var fixId = "fixUnreferenceableDecoratorMetadata";
|
|
153616
|
+
var errorCodes = [ts.Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code];
|
|
153617
|
+
codefix.registerCodeFix({
|
|
153618
|
+
errorCodes: errorCodes,
|
|
153619
|
+
getCodeActions: function (context) {
|
|
153620
|
+
var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
153621
|
+
if (!importDeclaration)
|
|
153622
|
+
return;
|
|
153623
|
+
var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 269 /* ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); });
|
|
153624
|
+
var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); });
|
|
153625
|
+
var actions;
|
|
153626
|
+
if (namespaceChanges.length) {
|
|
153627
|
+
actions = ts.append(actions, codefix.createCodeFixActionWithoutFixAll(fixId, namespaceChanges, ts.Diagnostics.Convert_named_imports_to_namespace_import));
|
|
153628
|
+
}
|
|
153629
|
+
if (typeOnlyChanges.length) {
|
|
153630
|
+
actions = ts.append(actions, codefix.createCodeFixActionWithoutFixAll(fixId, typeOnlyChanges, ts.Diagnostics.Convert_to_type_only_import));
|
|
153631
|
+
}
|
|
153632
|
+
return actions;
|
|
153633
|
+
},
|
|
153634
|
+
fixIds: [fixId],
|
|
153635
|
+
});
|
|
153636
|
+
function getImportDeclaration(sourceFile, program, start) {
|
|
153637
|
+
var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier);
|
|
153638
|
+
if (!identifier || identifier.parent.kind !== 177 /* TypeReference */)
|
|
153639
|
+
return;
|
|
153640
|
+
var checker = program.getTypeChecker();
|
|
153641
|
+
var symbol = checker.getSymbolAtLocation(identifier);
|
|
153642
|
+
return ts.find((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts.emptyArray, ts.or(ts.isImportClause, ts.isImportSpecifier, ts.isImportEqualsDeclaration));
|
|
153643
|
+
}
|
|
153644
|
+
// Converts the import declaration of the offending import to a type-only import,
|
|
153645
|
+
// only if it can be done without affecting other imported names. If the conversion
|
|
153646
|
+
// cannot be done cleanly, we could offer to *extract* the offending import to a
|
|
153647
|
+
// new type-only import declaration, but honestly I doubt anyone will ever use this
|
|
153648
|
+
// codefix at all, so it's probably not worth the lines of code.
|
|
153649
|
+
function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) {
|
|
153650
|
+
if (importDeclaration.kind === 264 /* ImportEqualsDeclaration */) {
|
|
153651
|
+
changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, importDeclaration.name);
|
|
153652
|
+
return;
|
|
153653
|
+
}
|
|
153654
|
+
var importClause = importDeclaration.kind === 266 /* ImportClause */ ? importDeclaration : importDeclaration.parent.parent;
|
|
153655
|
+
if (importClause.name && importClause.namedBindings) {
|
|
153656
|
+
// Cannot convert an import with a default import and named bindings to type-only
|
|
153657
|
+
// (it's a grammar error).
|
|
153658
|
+
return;
|
|
153659
|
+
}
|
|
153660
|
+
var checker = program.getTypeChecker();
|
|
153661
|
+
var importsValue = !!ts.forEachImportClauseDeclaration(importClause, function (decl) {
|
|
153662
|
+
if (ts.skipAlias(decl.symbol, checker).flags & 111551 /* Value */)
|
|
153663
|
+
return true;
|
|
153664
|
+
});
|
|
153665
|
+
if (importsValue) {
|
|
153666
|
+
// Assume that if someone wrote a non-type-only import that includes some values,
|
|
153667
|
+
// they intend to use those values in value positions, even if they haven't yet.
|
|
153668
|
+
// Don't convert it to type-only.
|
|
153669
|
+
return;
|
|
153670
|
+
}
|
|
153671
|
+
changes.insertModifierBefore(sourceFile, 151 /* TypeKeyword */, importClause);
|
|
153672
|
+
}
|
|
153673
|
+
function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) {
|
|
153674
|
+
ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent);
|
|
153675
|
+
}
|
|
153676
|
+
})(codefix = ts.codefix || (ts.codefix = {}));
|
|
153677
|
+
})(ts || (ts = {}));
|
|
153678
|
+
/* @internal */
|
|
153679
|
+
var ts;
|
|
153580
153680
|
(function (ts) {
|
|
153581
153681
|
var codefix;
|
|
153582
153682
|
(function (codefix) {
|
|
@@ -156144,6 +156244,7 @@ var ts;
|
|
|
156144
156244
|
return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_definite_assignment_assertion_to_property_0, info.prop.getText()], fixIdAddDefiniteAssignmentAssertions, ts.Diagnostics.Add_definite_assignment_assertions_to_all_uninitialized_properties);
|
|
156145
156245
|
}
|
|
156146
156246
|
function addDefiniteAssignmentAssertion(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) {
|
|
156247
|
+
ts.suppressLeadingAndTrailingTrivia(propertyDeclaration);
|
|
156147
156248
|
var property = ts.factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.decorators, propertyDeclaration.modifiers, propertyDeclaration.name, ts.factory.createToken(53 /* ExclamationToken */), propertyDeclaration.type, propertyDeclaration.initializer);
|
|
156148
156249
|
changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property);
|
|
156149
156250
|
}
|
|
@@ -156173,6 +156274,7 @@ var ts;
|
|
|
156173
156274
|
return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_initializer_to_property_0, info.prop.name.getText()], fixIdAddInitializer, ts.Diagnostics.Add_initializers_to_all_uninitialized_properties);
|
|
156174
156275
|
}
|
|
156175
156276
|
function addInitializer(changeTracker, propertyDeclarationSourceFile, propertyDeclaration, initializer) {
|
|
156277
|
+
ts.suppressLeadingAndTrailingTrivia(propertyDeclaration);
|
|
156176
156278
|
var property = ts.factory.updatePropertyDeclaration(propertyDeclaration, propertyDeclaration.decorators, propertyDeclaration.modifiers, propertyDeclaration.name, propertyDeclaration.questionToken, propertyDeclaration.type, initializer);
|
|
156177
156279
|
changeTracker.replaceNode(propertyDeclarationSourceFile, propertyDeclaration, property);
|
|
156178
156280
|
}
|
|
@@ -157096,20 +157198,22 @@ var ts;
|
|
|
157096
157198
|
if (importClause.namedBindings.kind === 267 /* NamespaceImport */) {
|
|
157097
157199
|
return { convertTo: 0 /* Named */, import: importClause.namedBindings };
|
|
157098
157200
|
}
|
|
157099
|
-
var
|
|
157100
|
-
var shouldUseDefault = ts.getAllowSyntheticDefaultImports(compilerOptions)
|
|
157101
|
-
&& isExportEqualsModule(importClause.parent.moduleSpecifier, context.program.getTypeChecker());
|
|
157201
|
+
var shouldUseDefault = getShouldUseDefault(context.program, importClause);
|
|
157102
157202
|
return shouldUseDefault
|
|
157103
157203
|
? { convertTo: 1 /* Default */, import: importClause.namedBindings }
|
|
157104
157204
|
: { convertTo: 2 /* Namespace */, import: importClause.namedBindings };
|
|
157105
157205
|
}
|
|
157206
|
+
function getShouldUseDefault(program, importClause) {
|
|
157207
|
+
return ts.getAllowSyntheticDefaultImports(program.getCompilerOptions())
|
|
157208
|
+
&& isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
|
|
157209
|
+
}
|
|
157106
157210
|
function doChange(sourceFile, program, changes, info) {
|
|
157107
157211
|
var checker = program.getTypeChecker();
|
|
157108
157212
|
if (info.convertTo === 0 /* Named */) {
|
|
157109
157213
|
doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions()));
|
|
157110
157214
|
}
|
|
157111
157215
|
else {
|
|
157112
|
-
doChangeNamedToNamespaceOrDefault(sourceFile,
|
|
157216
|
+
doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, info.import, info.convertTo === 1 /* Default */);
|
|
157113
157217
|
}
|
|
157114
157218
|
}
|
|
157115
157219
|
function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allowSyntheticDefaultImports) {
|
|
@@ -157159,7 +157263,9 @@ var ts;
|
|
|
157159
157263
|
function getLeftOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) {
|
|
157160
157264
|
return ts.isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left;
|
|
157161
157265
|
}
|
|
157162
|
-
function doChangeNamedToNamespaceOrDefault(sourceFile,
|
|
157266
|
+
function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConvert, shouldUseDefault) {
|
|
157267
|
+
if (shouldUseDefault === void 0) { shouldUseDefault = getShouldUseDefault(program, toConvert.parent); }
|
|
157268
|
+
var checker = program.getTypeChecker();
|
|
157163
157269
|
var importDecl = toConvert.parent.parent;
|
|
157164
157270
|
var moduleSpecifier = importDecl.moduleSpecifier;
|
|
157165
157271
|
var toConvertSymbols = new ts.Set();
|
|
@@ -157220,6 +157326,7 @@ var ts;
|
|
|
157220
157326
|
changes.insertNodeAfter(sourceFile, toConvert.parent.parent, updateImport(importDecl, /*defaultImportName*/ undefined, newNamedImports));
|
|
157221
157327
|
}
|
|
157222
157328
|
}
|
|
157329
|
+
refactor.doChangeNamedToNamespaceOrDefault = doChangeNamedToNamespaceOrDefault;
|
|
157223
157330
|
function isExportEqualsModule(moduleSpecifier, checker) {
|
|
157224
157331
|
var externalModule = checker.resolveExternalModuleName(moduleSpecifier);
|
|
157225
157332
|
if (!externalModule)
|
|
@@ -158620,7 +158727,9 @@ var ts;
|
|
|
158620
158727
|
var checker = context.program.getTypeChecker();
|
|
158621
158728
|
// Make a unique name for the extracted variable
|
|
158622
158729
|
var file = scope.getSourceFile();
|
|
158623
|
-
var localNameText = ts.
|
|
158730
|
+
var localNameText = ts.isPropertyAccessExpression(node) && !ts.isClassLike(scope) && !checker.resolveName(node.name.text, node, 111551 /* Value */, /*excludeGlobals*/ false) && !ts.isPrivateIdentifier(node.name) && !ts.isKeyword(node.name.originalKeywordKind)
|
|
158731
|
+
? node.name.text
|
|
158732
|
+
: ts.getUniqueName(ts.isClassLike(scope) ? "newProperty" : "newLocal", file);
|
|
158624
158733
|
var isJS = ts.isInJSFile(scope);
|
|
158625
158734
|
var variableType = isJS || !checker.isContextSensitive(node)
|
|
158626
158735
|
? undefined
|
|
@@ -162387,10 +162496,12 @@ var ts;
|
|
|
162387
162496
|
this.fileNameToEntry = new ts.Map();
|
|
162388
162497
|
// Initialize the list with the root file names
|
|
162389
162498
|
var rootFileNames = host.getScriptFileNames();
|
|
162499
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "initializeHostCache", { count: rootFileNames.length });
|
|
162390
162500
|
for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) {
|
|
162391
162501
|
var fileName = rootFileNames_1[_i];
|
|
162392
162502
|
this.createEntry(fileName, ts.toPath(fileName, this.currentDirectory, getCanonicalFileName));
|
|
162393
162503
|
}
|
|
162504
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
162394
162505
|
}
|
|
162395
162506
|
HostCache.prototype.createEntry = function (fileName, path) {
|
|
162396
162507
|
var entry;
|
|
@@ -167878,6 +167989,7 @@ var ts;
|
|
|
167878
167989
|
*/
|
|
167879
167990
|
Project.prototype.updateGraph = function () {
|
|
167880
167991
|
var _a;
|
|
167992
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "updateGraph", { name: this.projectName, kind: ProjectKind[this.projectKind] });
|
|
167881
167993
|
ts.perfLogger.logStartUpdateGraph();
|
|
167882
167994
|
this.resolutionCache.startRecordingFilesWithChangedResolutions();
|
|
167883
167995
|
var hasNewProgram = this.updateGraphWorker();
|
|
@@ -167921,6 +168033,7 @@ var ts;
|
|
|
167921
168033
|
this.getPackageJsonAutoImportProvider();
|
|
167922
168034
|
}
|
|
167923
168035
|
ts.perfLogger.logStopUpdateGraph();
|
|
168036
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
167924
168037
|
return !hasNewProgram;
|
|
167925
168038
|
};
|
|
167926
168039
|
/*@internal*/
|
|
@@ -167953,7 +168066,9 @@ var ts;
|
|
|
167953
168066
|
this.resolutionCache.startCachingPerDirectoryResolution();
|
|
167954
168067
|
this.program = this.languageService.getProgram(); // TODO: GH#18217
|
|
167955
168068
|
this.dirty = false;
|
|
168069
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "finishCachingPerDirectoryResolution");
|
|
167956
168070
|
this.resolutionCache.finishCachingPerDirectoryResolution();
|
|
168071
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
167957
168072
|
ts.Debug.assert(oldProgram === undefined || this.program !== undefined);
|
|
167958
168073
|
// bump up the version if
|
|
167959
168074
|
// - oldProgram is not set - this is a first time updateGraph is called
|
|
@@ -168501,13 +168616,16 @@ var ts;
|
|
|
168501
168616
|
}
|
|
168502
168617
|
var dependencySelection = this.includePackageJsonAutoImports();
|
|
168503
168618
|
if (dependencySelection) {
|
|
168619
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "getPackageJsonAutoImportProvider");
|
|
168504
168620
|
var start = ts.timestamp();
|
|
168505
168621
|
this.autoImportProviderHost = AutoImportProviderProject.create(dependencySelection, this, this.getModuleResolutionHostForAutoImportProvider(), this.documentRegistry);
|
|
168506
168622
|
if (this.autoImportProviderHost) {
|
|
168507
168623
|
server.updateProjectIfDirty(this.autoImportProviderHost);
|
|
168508
168624
|
this.sendPerformanceEvent("CreatePackageJsonAutoImportProvider", ts.timestamp() - start);
|
|
168625
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
168509
168626
|
return this.autoImportProviderHost.getCurrentProgram();
|
|
168510
168627
|
}
|
|
168628
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
168511
168629
|
}
|
|
168512
168630
|
};
|
|
168513
168631
|
/*@internal*/
|
|
@@ -168527,10 +168645,14 @@ var ts;
|
|
|
168527
168645
|
}());
|
|
168528
168646
|
server.Project = Project;
|
|
168529
168647
|
function getUnresolvedImports(program, cachedUnresolvedImportsPerFile) {
|
|
168648
|
+
var sourceFiles = program.getSourceFiles();
|
|
168649
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "getUnresolvedImports", { count: sourceFiles.length });
|
|
168530
168650
|
var ambientModules = program.getTypeChecker().getAmbientModules().map(function (mod) { return ts.stripQuotes(mod.getName()); });
|
|
168531
|
-
|
|
168651
|
+
var result = ts.sortAndDeduplicate(ts.flatMap(sourceFiles, function (sourceFile) {
|
|
168532
168652
|
return extractUnresolvedImportsFromSourceFile(sourceFile, ambientModules, cachedUnresolvedImportsPerFile);
|
|
168533
168653
|
}));
|
|
168654
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
168655
|
+
return result;
|
|
168534
168656
|
}
|
|
168535
168657
|
function extractUnresolvedImportsFromSourceFile(file, ambientModules, cachedUnresolvedImportsPerFile) {
|
|
168536
168658
|
return ts.getOrUpdate(cachedUnresolvedImportsPerFile, file.path, function () {
|
|
@@ -170604,6 +170726,7 @@ var ts;
|
|
|
170604
170726
|
};
|
|
170605
170727
|
/* @internal */
|
|
170606
170728
|
ProjectService.prototype.createConfiguredProject = function (configFileName) {
|
|
170729
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("session" /* Session */, "createConfiguredProject", { configFilePath: configFileName });
|
|
170607
170730
|
this.logger.info("Creating configuration project " + configFileName);
|
|
170608
170731
|
var canonicalConfigFilePath = server.asNormalizedPath(this.toCanonicalFileName(configFileName));
|
|
170609
170732
|
var configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
@@ -170652,6 +170775,7 @@ var ts;
|
|
|
170652
170775
|
/* @internal */
|
|
170653
170776
|
ProjectService.prototype.loadConfiguredProject = function (project, reason) {
|
|
170654
170777
|
var _this = this;
|
|
170778
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "loadConfiguredProject", { configFilePath: project.canonicalConfigFilePath });
|
|
170655
170779
|
this.sendProjectLoadingStartEvent(project, reason);
|
|
170656
170780
|
// Read updated contents from disk
|
|
170657
170781
|
var configFilename = server.asNormalizedPath(ts.normalizePath(project.getConfigFilePath()));
|
|
@@ -170687,6 +170811,7 @@ var ts;
|
|
|
170687
170811
|
project.enablePluginsWithOptions(compilerOptions, this.currentPluginConfigOverrides);
|
|
170688
170812
|
var filesToAdd = parsedCommandLine.fileNames.concat(project.getExternalFiles());
|
|
170689
170813
|
this.updateRootAndOptionsOfNonInferredProject(project, filesToAdd, fileNamePropertyReader, compilerOptions, parsedCommandLine.typeAcquisition, parsedCommandLine.compileOnSave, parsedCommandLine.watchOptions);
|
|
170814
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
170690
170815
|
};
|
|
170691
170816
|
/*@internal*/
|
|
170692
170817
|
ProjectService.prototype.ensureParsedConfigUptoDate = function (configFilename, canonicalConfigFilePath, configFileExistenceInfo, forProject) {
|
|
@@ -173735,7 +173860,6 @@ var ts;
|
|
|
173735
173860
|
this.host.write(msgText);
|
|
173736
173861
|
};
|
|
173737
173862
|
Session.prototype.event = function (body, eventName) {
|
|
173738
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("session" /* Session */, "event", { eventName: eventName });
|
|
173739
173863
|
this.send(toEvent(eventName, body));
|
|
173740
173864
|
};
|
|
173741
173865
|
// For backwards-compatibility only.
|
|
@@ -173784,16 +173908,22 @@ var ts;
|
|
|
173784
173908
|
this.send(res);
|
|
173785
173909
|
};
|
|
173786
173910
|
Session.prototype.semanticCheck = function (file, project) {
|
|
173911
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "semanticCheck", { file: file, configFilePath: project.canonicalConfigFilePath }); // undefined is fine if the cast fails
|
|
173787
173912
|
var diags = isDeclarationFileInJSOnlyNonConfiguredProject(project, file)
|
|
173788
173913
|
? server.emptyArray
|
|
173789
173914
|
: project.getLanguageService().getSemanticDiagnostics(file).filter(function (d) { return !!d.file; });
|
|
173790
173915
|
this.sendDiagnosticsEvent(file, project, diags, "semanticDiag");
|
|
173916
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
173791
173917
|
};
|
|
173792
173918
|
Session.prototype.syntacticCheck = function (file, project) {
|
|
173919
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "syntacticCheck", { file: file, configFilePath: project.canonicalConfigFilePath }); // undefined is fine if the cast fails
|
|
173793
173920
|
this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSyntacticDiagnostics(file), "syntaxDiag");
|
|
173921
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
173794
173922
|
};
|
|
173795
173923
|
Session.prototype.suggestionCheck = function (file, project) {
|
|
173924
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("session" /* Session */, "suggestionCheck", { file: file, configFilePath: project.canonicalConfigFilePath }); // undefined is fine if the cast fails
|
|
173796
173925
|
this.sendDiagnosticsEvent(file, project, project.getLanguageService().getSuggestionDiagnostics(file), "suggestionDiag");
|
|
173926
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
173797
173927
|
};
|
|
173798
173928
|
Session.prototype.sendDiagnosticsEvent = function (file, project, diagnostics, kind) {
|
|
173799
173929
|
try {
|