@typescript-deploys/pr-build 4.7.0-pr-48784-4 → 4.7.0-pr-48784-10
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/protocol.d.ts +1 -0
- package/lib/tsc.js +119 -51
- package/lib/tsserver.js +229 -93
- package/lib/tsserverlibrary.d.ts +12 -0
- package/lib/tsserverlibrary.js +229 -93
- package/lib/typescript.d.ts +11 -0
- package/lib/typescript.js +222 -86
- package/lib/typescriptServices.d.ts +11 -0
- package/lib/typescriptServices.js +222 -86
- package/lib/typingsInstaller.js +120 -51
- package/package.json +1 -1
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-insiders.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220429";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -8282,7 +8282,7 @@ var ts;
|
|
|
8282
8282
|
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
|
|
8283
8283
|
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_or_nodenext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
8284
8284
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
8285
|
-
|
|
8285
|
+
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
|
|
8286
8286
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
8287
8287
|
Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal: diag(1328, ts.DiagnosticCategory.Error, "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328", "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."),
|
|
8288
8288
|
_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0: diag(1329, ts.DiagnosticCategory.Error, "_0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write__1329", "'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?"),
|
|
@@ -8669,7 +8669,6 @@ var ts;
|
|
|
8669
8669
|
A_rest_element_cannot_have_a_property_name: diag(2566, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_a_property_name_2566", "A rest element cannot have a property name."),
|
|
8670
8670
|
Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations: diag(2567, ts.DiagnosticCategory.Error, "Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations_2567", "Enum declarations can only merge with namespace or other enum declarations."),
|
|
8671
8671
|
Property_0_may_not_exist_on_type_1_Did_you_mean_2: diag(2568, ts.DiagnosticCategory.Error, "Property_0_may_not_exist_on_type_1_Did_you_mean_2_2568", "Property '{0}' may not exist on type '{1}'. Did you mean '{2}'?"),
|
|
8672
|
-
Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators: diag(2569, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterati_2569", "Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators."),
|
|
8673
8672
|
Could_not_find_name_0_Did_you_mean_1: diag(2570, ts.DiagnosticCategory.Error, "Could_not_find_name_0_Did_you_mean_1_2570", "Could not find name '{0}'. Did you mean '{1}'?"),
|
|
8674
8673
|
Object_is_of_type_unknown: diag(2571, ts.DiagnosticCategory.Error, "Object_is_of_type_unknown_2571", "Object is of type 'unknown'."),
|
|
8675
8674
|
A_rest_element_type_must_be_an_array_type: diag(2574, ts.DiagnosticCategory.Error, "A_rest_element_type_must_be_an_array_type_2574", "A rest element type must be an array type."),
|
|
@@ -9357,6 +9356,7 @@ var ts;
|
|
|
9357
9356
|
Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4: diag(6397, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_succes_6397", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was successfully resolved to '{3}' with Package ID '{4}'."),
|
|
9358
9357
|
Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
|
|
9359
9358
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_are_not_emitted_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes are not emitted"),
|
|
9359
|
+
Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs update to timestamps of output files that are older than input files"),
|
|
9360
9360
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
9361
9361
|
The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
9362
9362
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -82757,7 +82757,7 @@ var ts;
|
|
|
82757
82757
|
}
|
|
82758
82758
|
var yieldType = getIterationTypeOfIterable(use, 0 /* Yield */, inputType, /*errorNode*/ undefined);
|
|
82759
82759
|
if (yieldType) {
|
|
82760
|
-
return [ts.Diagnostics.
|
|
82760
|
+
return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
|
|
82761
82761
|
}
|
|
82762
82762
|
if (isES2015OrLaterIterable((_a = inputType.symbol) === null || _a === void 0 ? void 0 : _a.escapedName)) {
|
|
82763
82763
|
return [ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true];
|
|
@@ -86034,7 +86034,7 @@ var ts;
|
|
|
86034
86034
|
var symbol = getIntrinsicTagSymbol(name.parent);
|
|
86035
86035
|
return symbol === unknownSymbol ? undefined : symbol;
|
|
86036
86036
|
}
|
|
86037
|
-
var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/
|
|
86037
|
+
var result = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /* dontResolveAlias */ true, ts.getHostSignatureFromJSDoc(name));
|
|
86038
86038
|
if (!result && isJSDoc_1) {
|
|
86039
86039
|
var container = ts.findAncestor(name, ts.or(ts.isClassLike, ts.isInterfaceDeclaration));
|
|
86040
86040
|
if (container) {
|
|
@@ -87891,6 +87891,9 @@ var ts;
|
|
|
87891
87891
|
return ts.some(types, checkGrammarExpressionWithTypeArguments);
|
|
87892
87892
|
}
|
|
87893
87893
|
function checkGrammarExpressionWithTypeArguments(node) {
|
|
87894
|
+
if (ts.isExpressionWithTypeArguments(node) && ts.isImportKeyword(node.expression) && node.typeArguments) {
|
|
87895
|
+
return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
87896
|
+
}
|
|
87894
87897
|
return checkGrammarTypeArguments(node, node.typeArguments);
|
|
87895
87898
|
}
|
|
87896
87899
|
function checkGrammarClassDeclarationHeritageClauses(node) {
|
|
@@ -88832,7 +88835,7 @@ var ts;
|
|
|
88832
88835
|
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext);
|
|
88833
88836
|
}
|
|
88834
88837
|
if (node.typeArguments) {
|
|
88835
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88838
|
+
return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
88836
88839
|
}
|
|
88837
88840
|
var nodeArguments = node.arguments;
|
|
88838
88841
|
if (moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.NodeNext) {
|
|
@@ -108628,6 +108631,8 @@ var ts;
|
|
|
108628
108631
|
var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
|
|
108629
108632
|
errorFallbackNode = undefined;
|
|
108630
108633
|
var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* Const */));
|
|
108634
|
+
preserveJsDoc(statement, input);
|
|
108635
|
+
ts.removeAllComments(input);
|
|
108631
108636
|
return [statement, factory.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
|
|
108632
108637
|
}
|
|
108633
108638
|
}
|
|
@@ -120122,6 +120127,10 @@ var ts;
|
|
|
120122
120127
|
}
|
|
120123
120128
|
return ts.filterSemanticDiagnostics(diagnostics, state.compilerOptions);
|
|
120124
120129
|
}
|
|
120130
|
+
function isProgramBundleEmitBuildInfo(info) {
|
|
120131
|
+
return !!ts.outFile(info.options || {});
|
|
120132
|
+
}
|
|
120133
|
+
ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
|
|
120125
120134
|
/**
|
|
120126
120135
|
* Gets the program information to be emitted in buildInfo so that we can use it to create new program
|
|
120127
120136
|
*/
|
|
@@ -120133,7 +120142,18 @@ var ts;
|
|
|
120133
120142
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
|
|
120134
120143
|
state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
|
|
120135
120144
|
if (outFilePath) {
|
|
120145
|
+
var fileNames_1 = [];
|
|
120146
|
+
var fileInfos_1 = [];
|
|
120147
|
+
state.program.getRootFileNames().forEach(function (f) {
|
|
120148
|
+
var sourceFile = state.program.getSourceFile(f);
|
|
120149
|
+
if (!sourceFile)
|
|
120150
|
+
return;
|
|
120151
|
+
fileNames_1.push(relativeToBuildInfo(sourceFile.resolvedPath));
|
|
120152
|
+
fileInfos_1.push(sourceFile.version);
|
|
120153
|
+
});
|
|
120136
120154
|
var result_15 = {
|
|
120155
|
+
fileNames: fileNames_1,
|
|
120156
|
+
fileInfos: fileInfos_1,
|
|
120137
120157
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
|
|
120138
120158
|
outSignature: state.outSignature,
|
|
120139
120159
|
dtsChangeTime: state.dtsChangeTime,
|
|
@@ -120660,43 +120680,54 @@ var ts;
|
|
|
120660
120680
|
{ version: fileInfo.version, signature: fileInfo.signature === false ? undefined : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat };
|
|
120661
120681
|
}
|
|
120662
120682
|
ts.toBuilderStateFileInfo = toBuilderStateFileInfo;
|
|
120663
|
-
function createBuilderProgramUsingProgramBuildInfo(
|
|
120664
|
-
var _a, _b, _c, _d
|
|
120683
|
+
function createBuilderProgramUsingProgramBuildInfo(program, buildInfoPath, host) {
|
|
120684
|
+
var _a, _b, _c, _d;
|
|
120665
120685
|
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
120666
120686
|
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
120667
|
-
var
|
|
120668
|
-
var filePaths
|
|
120669
|
-
var filePathsSetList
|
|
120670
|
-
|
|
120671
|
-
|
|
120672
|
-
|
|
120673
|
-
|
|
120674
|
-
|
|
120675
|
-
|
|
120676
|
-
|
|
120677
|
-
|
|
120678
|
-
|
|
120679
|
-
|
|
120680
|
-
|
|
120681
|
-
|
|
120682
|
-
|
|
120683
|
-
|
|
120684
|
-
|
|
120685
|
-
|
|
120686
|
-
|
|
120687
|
-
|
|
120688
|
-
|
|
120689
|
-
|
|
120690
|
-
|
|
120691
|
-
|
|
120692
|
-
|
|
120693
|
-
|
|
120694
|
-
|
|
120695
|
-
|
|
120696
|
-
|
|
120697
|
-
|
|
120698
|
-
|
|
120699
|
-
|
|
120687
|
+
var state;
|
|
120688
|
+
var filePaths;
|
|
120689
|
+
var filePathsSetList;
|
|
120690
|
+
if (isProgramBundleEmitBuildInfo(program)) {
|
|
120691
|
+
state = {
|
|
120692
|
+
fileInfos: new ts.Map(),
|
|
120693
|
+
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
120694
|
+
dtsChangeTime: program.dtsChangeTime,
|
|
120695
|
+
outSignature: program.outSignature,
|
|
120696
|
+
};
|
|
120697
|
+
}
|
|
120698
|
+
else {
|
|
120699
|
+
filePaths = (_a = program.fileNames) === null || _a === void 0 ? void 0 : _a.map(toPath);
|
|
120700
|
+
filePathsSetList = (_b = program.fileIdsList) === null || _b === void 0 ? void 0 : _b.map(function (fileIds) { return new ts.Set(fileIds.map(toFilePath)); });
|
|
120701
|
+
var fileInfos_2 = new ts.Map();
|
|
120702
|
+
var emitSignatures_1 = ((_c = program.options) === null || _c === void 0 ? void 0 : _c.composite) && !ts.outFile(program.options) ? new ts.Map() : undefined;
|
|
120703
|
+
program.fileInfos.forEach(function (fileInfo, index) {
|
|
120704
|
+
var path = toFilePath(index + 1);
|
|
120705
|
+
var stateFileInfo = toBuilderStateFileInfo(fileInfo);
|
|
120706
|
+
fileInfos_2.set(path, stateFileInfo);
|
|
120707
|
+
if (emitSignatures_1 && stateFileInfo.signature)
|
|
120708
|
+
emitSignatures_1.set(path, stateFileInfo.signature);
|
|
120709
|
+
});
|
|
120710
|
+
(_d = program.emitSignatures) === null || _d === void 0 ? void 0 : _d.forEach(function (value) {
|
|
120711
|
+
if (ts.isNumber(value))
|
|
120712
|
+
emitSignatures_1.delete(toFilePath(value));
|
|
120713
|
+
else
|
|
120714
|
+
emitSignatures_1.set(toFilePath(value[0]), value[1]);
|
|
120715
|
+
});
|
|
120716
|
+
state = {
|
|
120717
|
+
fileInfos: fileInfos_2,
|
|
120718
|
+
compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
120719
|
+
referencedMap: toManyToManyPathMap(program.referencedMap),
|
|
120720
|
+
exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
|
|
120721
|
+
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toFilePath(ts.isNumber(value) ? value : value[0]); }, function (value) { return ts.isNumber(value) ? ts.emptyArray : value[1]; }),
|
|
120722
|
+
hasReusableDiagnostic: true,
|
|
120723
|
+
affectedFilesPendingEmit: ts.map(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }),
|
|
120724
|
+
affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
|
|
120725
|
+
affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
|
|
120726
|
+
changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
|
|
120727
|
+
dtsChangeTime: program.dtsChangeTime,
|
|
120728
|
+
emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
|
|
120729
|
+
};
|
|
120730
|
+
}
|
|
120700
120731
|
return {
|
|
120701
120732
|
getState: function () { return state; },
|
|
120702
120733
|
backupEmitState: ts.noop,
|
|
@@ -120746,6 +120777,18 @@ var ts;
|
|
|
120746
120777
|
}
|
|
120747
120778
|
}
|
|
120748
120779
|
ts.createBuilderProgramUsingProgramBuildInfo = createBuilderProgramUsingProgramBuildInfo;
|
|
120780
|
+
function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
|
|
120781
|
+
var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
|
|
120782
|
+
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
120783
|
+
var fileInfos = new ts.Map();
|
|
120784
|
+
program.fileInfos.forEach(function (fileInfo, index) {
|
|
120785
|
+
var path = ts.toPath(program.fileNames[index], buildInfoDirectory, getCanonicalFileName);
|
|
120786
|
+
var version = ts.isString(fileInfo) ? fileInfo : fileInfo.version; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
|
|
120787
|
+
fileInfos.set(path, version);
|
|
120788
|
+
});
|
|
120789
|
+
return fileInfos;
|
|
120790
|
+
}
|
|
120791
|
+
ts.getBuildInfoFileVersionMap = getBuildInfoFileVersionMap;
|
|
120749
120792
|
function createRedirectedBuilderProgram(getState, configFileParsingDiagnostics) {
|
|
120750
120793
|
return {
|
|
120751
120794
|
getState: ts.notImplemented,
|
|
@@ -123680,11 +123723,12 @@ var ts;
|
|
|
123680
123723
|
UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
|
|
123681
123724
|
UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
|
|
123682
123725
|
UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
|
|
123726
|
+
UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
|
|
123683
123727
|
/**
|
|
123684
123728
|
* Projects with no outputs (i.e. "solution" files)
|
|
123685
123729
|
*/
|
|
123686
|
-
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] =
|
|
123687
|
-
UpToDateStatusType[UpToDateStatusType["ForceBuild"] =
|
|
123730
|
+
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
|
|
123731
|
+
UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
|
|
123688
123732
|
})(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
|
|
123689
123733
|
function resolveConfigFileProjectName(project) {
|
|
123690
123734
|
if (ts.fileExtensionIs(project, ".json" /* Json */)) {
|
|
@@ -124511,7 +124555,7 @@ var ts;
|
|
|
124511
124555
|
}
|
|
124512
124556
|
continue;
|
|
124513
124557
|
}
|
|
124514
|
-
if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes) {
|
|
124558
|
+
if (status.type === ts.UpToDateStatusType.UpToDateWithUpstreamTypes || status.type === ts.UpToDateStatusType.UpToDateWithInputFileText) {
|
|
124515
124559
|
reportAndStoreErrors(state, projectPath, ts.getConfigFileParsingDiagnostics(config));
|
|
124516
124560
|
return createUpdateOutputFileStampsProject(state, project, projectPath, config, buildOrder);
|
|
124517
124561
|
}
|
|
@@ -124725,6 +124769,8 @@ var ts;
|
|
|
124725
124769
|
var oldestOutputFileName = "(none)";
|
|
124726
124770
|
var oldestOutputFileTime = maximumDate;
|
|
124727
124771
|
var buildInfoTime;
|
|
124772
|
+
var buildInfoProgram;
|
|
124773
|
+
var buildInfoVersionMap;
|
|
124728
124774
|
var newestDeclarationFileContentChangedTime;
|
|
124729
124775
|
if (buildInfoPath) {
|
|
124730
124776
|
var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
|
|
@@ -124757,6 +124803,7 @@ var ts;
|
|
|
124757
124803
|
buildInfoFile: buildInfoPath
|
|
124758
124804
|
};
|
|
124759
124805
|
}
|
|
124806
|
+
buildInfoProgram = buildInfo.program;
|
|
124760
124807
|
}
|
|
124761
124808
|
oldestOutputFileTime = buildInfoTime;
|
|
124762
124809
|
oldestOutputFileName = buildInfoPath;
|
|
@@ -124765,6 +124812,7 @@ var ts;
|
|
|
124765
124812
|
// Check input files
|
|
124766
124813
|
var newestInputFileName = undefined;
|
|
124767
124814
|
var newestInputFileTime = minimumDate;
|
|
124815
|
+
var pseudoInputUptodate = false;
|
|
124768
124816
|
// Get timestamps of input files
|
|
124769
124817
|
for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
|
|
124770
124818
|
var inputFile = _f[_e];
|
|
@@ -124777,11 +124825,25 @@ var ts;
|
|
|
124777
124825
|
}
|
|
124778
124826
|
// If an buildInfo is older than the newest input, we can stop checking
|
|
124779
124827
|
if (buildInfoTime && buildInfoTime < inputTime) {
|
|
124780
|
-
|
|
124781
|
-
|
|
124782
|
-
|
|
124783
|
-
|
|
124784
|
-
|
|
124828
|
+
var version_3 = void 0;
|
|
124829
|
+
var currentVersion = void 0;
|
|
124830
|
+
if (buildInfoProgram) {
|
|
124831
|
+
// Read files and see if they are same, read is anyways cached
|
|
124832
|
+
if (!buildInfoVersionMap)
|
|
124833
|
+
buildInfoVersionMap = ts.getBuildInfoFileVersionMap(buildInfoProgram, buildInfoPath, host);
|
|
124834
|
+
version_3 = buildInfoVersionMap.get(toPath(state, inputFile));
|
|
124835
|
+
var text = version_3 ? state.readFileWithCache(inputFile) : undefined;
|
|
124836
|
+
currentVersion = text && (host.createHash || ts.generateDjb2Hash)(text);
|
|
124837
|
+
if (version_3 && version_3 === currentVersion)
|
|
124838
|
+
pseudoInputUptodate = true;
|
|
124839
|
+
}
|
|
124840
|
+
if (!version_3 || version_3 !== currentVersion) {
|
|
124841
|
+
return {
|
|
124842
|
+
type: ts.UpToDateStatusType.OutOfDateWithSelf,
|
|
124843
|
+
outOfDateOutputFileName: buildInfoPath,
|
|
124844
|
+
newerInputFileName: inputFile
|
|
124845
|
+
};
|
|
124846
|
+
}
|
|
124785
124847
|
}
|
|
124786
124848
|
if (inputTime > newestInputFileTime) {
|
|
124787
124849
|
newestInputFileName = inputFile;
|
|
@@ -124886,7 +124948,11 @@ var ts;
|
|
|
124886
124948
|
}
|
|
124887
124949
|
// Up to date
|
|
124888
124950
|
return {
|
|
124889
|
-
type: pseudoUpToDate ?
|
|
124951
|
+
type: pseudoUpToDate ?
|
|
124952
|
+
ts.UpToDateStatusType.UpToDateWithUpstreamTypes :
|
|
124953
|
+
pseudoInputUptodate ?
|
|
124954
|
+
ts.UpToDateStatusType.UpToDateWithInputFileText :
|
|
124955
|
+
ts.UpToDateStatusType.UpToDate,
|
|
124890
124956
|
newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
|
|
124891
124957
|
newestInputFileTime: newestInputFileTime,
|
|
124892
124958
|
newestInputFileName: newestInputFileName,
|
|
@@ -125029,6 +125095,7 @@ var ts;
|
|
|
125029
125095
|
break;
|
|
125030
125096
|
}
|
|
125031
125097
|
// falls through
|
|
125098
|
+
case ts.UpToDateStatusType.UpToDateWithInputFileText:
|
|
125032
125099
|
case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
|
|
125033
125100
|
case ts.UpToDateStatusType.OutOfDateWithPrepend:
|
|
125034
125101
|
if (!(buildResult & BuildResultFlags.DeclarationOutputUnchanged)) {
|
|
@@ -125219,7 +125286,7 @@ var ts;
|
|
|
125219
125286
|
if (!state.watch || !state.lastCachedPackageJsonLookups)
|
|
125220
125287
|
return;
|
|
125221
125288
|
ts.mutateMap(getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath), new ts.Map(state.lastCachedPackageJsonLookups.get(resolvedPath)), {
|
|
125222
|
-
createNewValue: function (path, _input) { return watchFile(state, path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.
|
|
125289
|
+
createNewValue: function (path, _input) { return watchFile(state, path, function () { return invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.None); }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.PackageJson, resolved); },
|
|
125223
125290
|
onDeleteValue: ts.closeFileWatcher,
|
|
125224
125291
|
});
|
|
125225
125292
|
}
|
|
@@ -125370,6 +125437,8 @@ var ts;
|
|
|
125370
125437
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed, relName(state, configFileName), relName(state, status.newerProjectName));
|
|
125371
125438
|
case ts.UpToDateStatusType.UpToDateWithUpstreamTypes:
|
|
125372
125439
|
return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_with_d_ts_files_from_its_dependencies, relName(state, configFileName));
|
|
125440
|
+
case ts.UpToDateStatusType.UpToDateWithInputFileText:
|
|
125441
|
+
return reportStatus(state, ts.Diagnostics.Project_0_is_up_to_date_but_needs_update_to_timestamps_of_output_files_that_are_older_than_input_files, relName(state, configFileName));
|
|
125373
125442
|
case ts.UpToDateStatusType.UpstreamOutOfDate:
|
|
125374
125443
|
return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_its_dependency_1_is_out_of_date, relName(state, configFileName), relName(state, status.upstreamProjectName));
|
|
125375
125444
|
case ts.UpToDateStatusType.UpstreamBlocked:
|
|
@@ -125548,6 +125617,17 @@ var ts;
|
|
|
125548
125617
|
SymbolDisplayPartKind[SymbolDisplayPartKind["linkName"] = 23] = "linkName";
|
|
125549
125618
|
SymbolDisplayPartKind[SymbolDisplayPartKind["linkText"] = 24] = "linkText";
|
|
125550
125619
|
})(SymbolDisplayPartKind = ts.SymbolDisplayPartKind || (ts.SymbolDisplayPartKind = {}));
|
|
125620
|
+
// Do not change existing values, as they exist in telemetry.
|
|
125621
|
+
var CompletionInfoFlags;
|
|
125622
|
+
(function (CompletionInfoFlags) {
|
|
125623
|
+
CompletionInfoFlags[CompletionInfoFlags["None"] = 0] = "None";
|
|
125624
|
+
CompletionInfoFlags[CompletionInfoFlags["MayIncludeAutoImports"] = 1] = "MayIncludeAutoImports";
|
|
125625
|
+
CompletionInfoFlags[CompletionInfoFlags["IsImportStatementCompletion"] = 2] = "IsImportStatementCompletion";
|
|
125626
|
+
CompletionInfoFlags[CompletionInfoFlags["IsContinuation"] = 4] = "IsContinuation";
|
|
125627
|
+
CompletionInfoFlags[CompletionInfoFlags["ResolvedModuleSpecifiers"] = 8] = "ResolvedModuleSpecifiers";
|
|
125628
|
+
CompletionInfoFlags[CompletionInfoFlags["ResolvedModuleSpecifiersBeyondLimit"] = 16] = "ResolvedModuleSpecifiersBeyondLimit";
|
|
125629
|
+
CompletionInfoFlags[CompletionInfoFlags["MayIncludeMethodSnippets"] = 32] = "MayIncludeMethodSnippets";
|
|
125630
|
+
})(CompletionInfoFlags = ts.CompletionInfoFlags || (ts.CompletionInfoFlags = {}));
|
|
125551
125631
|
var OutliningSpanKind;
|
|
125552
125632
|
(function (OutliningSpanKind) {
|
|
125553
125633
|
/** Single or multi-line comments */
|
|
@@ -127560,6 +127640,14 @@ var ts;
|
|
|
127560
127640
|
return __assign(__assign({}, createModuleSpecifierResolutionHost(program, host)), { getCommonSourceDirectory: function () { return program.getCommonSourceDirectory(); } });
|
|
127561
127641
|
}
|
|
127562
127642
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127643
|
+
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127644
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node12 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127645
|
+
}
|
|
127646
|
+
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127647
|
+
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127648
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node12 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127649
|
+
}
|
|
127650
|
+
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127563
127651
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
127564
127652
|
return defaultImport || namedImports && namedImports.length ? makeImport(defaultImport, namedImports, moduleSpecifier, quotePreference) : undefined;
|
|
127565
127653
|
}
|
|
@@ -129163,8 +129251,8 @@ var ts;
|
|
|
129163
129251
|
if (from === to)
|
|
129164
129252
|
return false;
|
|
129165
129253
|
var cachedResult = moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {});
|
|
129166
|
-
if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.
|
|
129167
|
-
return cachedResult.
|
|
129254
|
+
if ((cachedResult === null || cachedResult === void 0 ? void 0 : cachedResult.isBlockedByPackageJsonDependencies) !== undefined) {
|
|
129255
|
+
return !cachedResult.isBlockedByPackageJsonDependencies;
|
|
129168
129256
|
}
|
|
129169
129257
|
var getCanonicalFileName = ts.hostGetCanonicalFileName(moduleSpecifierResolutionHost);
|
|
129170
129258
|
var globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) === null || _a === void 0 ? void 0 : _a.call(moduleSpecifierResolutionHost);
|
|
@@ -129178,7 +129266,7 @@ var ts;
|
|
|
129178
129266
|
});
|
|
129179
129267
|
if (packageJsonFilter) {
|
|
129180
129268
|
var isAutoImportable = hasImportablePath && packageJsonFilter.allowsImportingSourceFile(to, moduleSpecifierResolutionHost);
|
|
129181
|
-
moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.
|
|
129269
|
+
moduleSpecifierCache === null || moduleSpecifierCache === void 0 ? void 0 : moduleSpecifierCache.setBlockedByPackageJsonDependencies(from.path, to.path, preferences, {}, !isAutoImportable);
|
|
129182
129270
|
return isAutoImportable;
|
|
129183
129271
|
}
|
|
129184
129272
|
return hasImportablePath;
|
|
@@ -131457,15 +131545,26 @@ var ts;
|
|
|
131457
131545
|
var _a, _b, _c;
|
|
131458
131546
|
var start = ts.timestamp();
|
|
131459
131547
|
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
131460
|
-
|
|
131548
|
+
// Under `--moduleResolution nodenext`, we have to resolve module specifiers up front, because
|
|
131549
|
+
// package.json exports can mean we *can't* resolve a module specifier (that doesn't include a
|
|
131550
|
+
// relative path into node_modules), and we want to filter those completions out entirely.
|
|
131551
|
+
// Import statement completions always need specifier resolution because the module specifier is
|
|
131552
|
+
// part of their `insertText`, not the `codeActions` creating edits away from the cursor.
|
|
131553
|
+
var needsFullResolution = isForImportStatementCompletion || ts.moduleResolutionRespectsExports(ts.getEmitModuleResolutionKind(program.getCompilerOptions()));
|
|
131554
|
+
var skippedAny = false;
|
|
131461
131555
|
var ambientCount = 0;
|
|
131462
131556
|
var resolvedCount = 0;
|
|
131463
131557
|
var resolvedFromCacheCount = 0;
|
|
131464
131558
|
var cacheAttemptCount = 0;
|
|
131465
|
-
var result = cb({
|
|
131559
|
+
var result = cb({
|
|
131560
|
+
tryResolve: tryResolve,
|
|
131561
|
+
skippedAny: function () { return skippedAny; },
|
|
131562
|
+
resolvedAny: function () { return resolvedCount > 0; },
|
|
131563
|
+
resolvedBeyondLimit: function () { return resolvedCount > Completions.moduleSpecifierResolutionLimit; },
|
|
131564
|
+
});
|
|
131466
131565
|
var hitRateMessage = cacheAttemptCount ? " (" + (resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1) + "% hit rate)" : "";
|
|
131467
131566
|
(_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, logPrefix + ": resolved " + resolvedCount + " module specifiers, plus " + ambientCount + " ambient and " + resolvedFromCacheCount + " from cache" + hitRateMessage);
|
|
131468
|
-
(_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (
|
|
131567
|
+
(_b = host.log) === null || _b === void 0 ? void 0 : _b.call(host, logPrefix + ": response is " + (skippedAny ? "incomplete" : "complete"));
|
|
131469
131568
|
(_c = host.log) === null || _c === void 0 ? void 0 : _c.call(host, logPrefix + ": " + (ts.timestamp() - start));
|
|
131470
131569
|
return result;
|
|
131471
131570
|
function tryResolve(exportInfo, symbolName, isFromAmbientModule) {
|
|
@@ -131474,22 +131573,22 @@ var ts;
|
|
|
131474
131573
|
if (result_1) {
|
|
131475
131574
|
ambientCount++;
|
|
131476
131575
|
}
|
|
131477
|
-
return result_1;
|
|
131576
|
+
return result_1 || "failed";
|
|
131478
131577
|
}
|
|
131479
|
-
var shouldResolveModuleSpecifier =
|
|
131578
|
+
var shouldResolveModuleSpecifier = needsFullResolution || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
|
|
131480
131579
|
var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
|
|
131481
131580
|
var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
|
|
131482
131581
|
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, symbolName, position, isValidTypeOnlyUseSite, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
131483
131582
|
: undefined;
|
|
131484
131583
|
if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
|
|
131485
|
-
|
|
131584
|
+
skippedAny = true;
|
|
131486
131585
|
}
|
|
131487
131586
|
resolvedCount += (result === null || result === void 0 ? void 0 : result.computedWithoutCacheCount) || 0;
|
|
131488
|
-
resolvedFromCacheCount += exportInfo.length -
|
|
131587
|
+
resolvedFromCacheCount += exportInfo.length - ((result === null || result === void 0 ? void 0 : result.computedWithoutCacheCount) || 0);
|
|
131489
131588
|
if (shouldGetModuleSpecifierFromCache) {
|
|
131490
131589
|
cacheAttemptCount++;
|
|
131491
131590
|
}
|
|
131492
|
-
return result;
|
|
131591
|
+
return result || (needsFullResolution ? "failed" : "skipped");
|
|
131493
131592
|
}
|
|
131494
131593
|
}
|
|
131495
131594
|
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
|
|
@@ -131587,6 +131686,7 @@ var ts;
|
|
|
131587
131686
|
var newEntries = resolvingModuleSpecifiers("continuePreviousIncompleteResponse", host, program, file, location.getStart(), preferences,
|
|
131588
131687
|
/*isForImportStatementCompletion*/ false, ts.isValidTypeOnlyAliasUseSite(location), function (context) {
|
|
131589
131688
|
var entries = ts.mapDefined(previousResponse.entries, function (entry) {
|
|
131689
|
+
var _a;
|
|
131590
131690
|
if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) {
|
|
131591
131691
|
// Not an auto import or already resolved; keep as is
|
|
131592
131692
|
return entry;
|
|
@@ -131598,8 +131698,12 @@ var ts;
|
|
|
131598
131698
|
var origin = ts.Debug.checkDefined(getAutoImportSymbolFromCompletionEntryData(entry.name, entry.data, program, host)).origin;
|
|
131599
131699
|
var info = exportMap.get(file.path, entry.data.exportMapKey);
|
|
131600
131700
|
var result = info && context.tryResolve(info, entry.name, !ts.isExternalModuleNameRelative(ts.stripQuotes(origin.moduleSymbol.name)));
|
|
131601
|
-
if (
|
|
131701
|
+
if (result === "skipped")
|
|
131602
131702
|
return entry;
|
|
131703
|
+
if (!result || result === "failed") {
|
|
131704
|
+
(_a = host.log) === null || _a === void 0 ? void 0 : _a.call(host, "Unexpected failure resolving auto import for '" + entry.name + "' from '" + entry.source + "'");
|
|
131705
|
+
return undefined;
|
|
131706
|
+
}
|
|
131603
131707
|
var newOrigin = __assign(__assign({}, origin), { kind: 32 /* ResolvedExport */, moduleSpecifier: result.moduleSpecifier });
|
|
131604
131708
|
// Mutating for performance... feels sketchy but nobody else uses the cache,
|
|
131605
131709
|
// so why bother allocating a bunch of new objects?
|
|
@@ -131608,12 +131712,13 @@ var ts;
|
|
|
131608
131712
|
entry.sourceDisplay = [ts.textPart(newOrigin.moduleSpecifier)];
|
|
131609
131713
|
return entry;
|
|
131610
131714
|
});
|
|
131611
|
-
if (!context.
|
|
131715
|
+
if (!context.skippedAny()) {
|
|
131612
131716
|
previousResponse.isIncomplete = undefined;
|
|
131613
131717
|
}
|
|
131614
131718
|
return entries;
|
|
131615
131719
|
});
|
|
131616
131720
|
previousResponse.entries = newEntries;
|
|
131721
|
+
previousResponse.flags = (previousResponse.flags || 0) | 4 /* IsContinuation */;
|
|
131617
131722
|
return previousResponse;
|
|
131618
131723
|
}
|
|
131619
131724
|
function jsdocCompletionInfo(entries) {
|
|
@@ -131695,12 +131800,13 @@ var ts;
|
|
|
131695
131800
|
ts.insertSorted(entries, createCompletionEntryForLiteral(sourceFile, preferences, literal), compareCompletionEntries, /*allowDuplicates*/ true);
|
|
131696
131801
|
}
|
|
131697
131802
|
return {
|
|
131803
|
+
flags: completionData.flags,
|
|
131698
131804
|
isGlobalCompletion: isInSnippetScope,
|
|
131699
131805
|
isIncomplete: preferences.allowIncompleteCompletions && hasUnresolvedAutoImports ? true : undefined,
|
|
131700
131806
|
isMemberCompletion: isMemberCompletionKind(completionKind),
|
|
131701
131807
|
isNewIdentifierLocation: isNewIdentifierLocation,
|
|
131702
131808
|
optionalReplacementSpan: getOptionalReplacementSpan(location),
|
|
131703
|
-
entries: entries
|
|
131809
|
+
entries: entries,
|
|
131704
131810
|
};
|
|
131705
131811
|
}
|
|
131706
131812
|
function isUncheckedFile(sourceFile, compilerOptions) {
|
|
@@ -132757,6 +132863,7 @@ var ts;
|
|
|
132757
132863
|
var location = ts.getTouchingPropertyName(sourceFile, position);
|
|
132758
132864
|
var keywordFilters = 0 /* None */;
|
|
132759
132865
|
var isNewIdentifierLocation = false;
|
|
132866
|
+
var flags = 0 /* None */;
|
|
132760
132867
|
if (contextToken) {
|
|
132761
132868
|
var importStatementCompletion = getImportStatementCompletionInfo(contextToken);
|
|
132762
132869
|
isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation;
|
|
@@ -132776,6 +132883,7 @@ var ts;
|
|
|
132776
132883
|
// is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
|
|
132777
132884
|
// to opt in with the `includeCompletionsForImportStatements` user preference.
|
|
132778
132885
|
importCompletionNode = importStatementCompletion.replacementNode;
|
|
132886
|
+
flags |= 2 /* IsImportStatementCompletion */;
|
|
132779
132887
|
}
|
|
132780
132888
|
// Bail out if this is a known invalid completion location
|
|
132781
132889
|
if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
|
|
@@ -132968,6 +133076,7 @@ var ts;
|
|
|
132968
133076
|
isRightOfOpenTag: isRightOfOpenTag,
|
|
132969
133077
|
importCompletionNode: importCompletionNode,
|
|
132970
133078
|
hasUnresolvedAutoImports: hasUnresolvedAutoImports,
|
|
133079
|
+
flags: flags,
|
|
132971
133080
|
};
|
|
132972
133081
|
function isTagWithTypeExpression(tag) {
|
|
132973
133082
|
switch (tag.kind) {
|
|
@@ -133377,6 +133486,7 @@ var ts;
|
|
|
133377
133486
|
// Asking for completion details for an item that is not an auto-import
|
|
133378
133487
|
return;
|
|
133379
133488
|
}
|
|
133489
|
+
flags |= 1 /* MayIncludeAutoImports */;
|
|
133380
133490
|
// import { type | -> token text should be blank
|
|
133381
133491
|
var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken
|
|
133382
133492
|
&& importCompletionNode
|
|
@@ -133407,16 +133517,36 @@ var ts;
|
|
|
133407
133517
|
return true;
|
|
133408
133518
|
return charactersFuzzyMatchInString(symbolName, lowerCaseTokenText);
|
|
133409
133519
|
}, function (info, symbolName, isFromAmbientModule, exportMapKey) {
|
|
133520
|
+
var _a;
|
|
133410
133521
|
if (detailsEntryId && !ts.some(info, function (i) { return detailsEntryId.source === ts.stripQuotes(i.moduleSymbol.name); })) {
|
|
133411
133522
|
return;
|
|
133412
133523
|
}
|
|
133413
|
-
|
|
133414
|
-
|
|
133524
|
+
// Do a relatively cheap check to bail early if all re-exports are non-importable
|
|
133525
|
+
// due to file location or package.json dependency filtering. For non-node12+
|
|
133526
|
+
// module resolution modes, getting past this point guarantees that we'll be
|
|
133527
|
+
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133528
|
+
// even if we defer computing the module specifier.
|
|
133529
|
+
var firstImportableExportInfo = ts.find(info, isImportableExportInfo);
|
|
133530
|
+
if (!firstImportableExportInfo) {
|
|
133531
|
+
return;
|
|
133532
|
+
}
|
|
133533
|
+
// In node12+, module specifier resolution can fail due to modules being blocked
|
|
133534
|
+
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133535
|
+
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133536
|
+
// because we have to know now if it's going to fail so we can omit the completion
|
|
133537
|
+
// from the list.
|
|
133538
|
+
var result = context.tryResolve(info, symbolName, isFromAmbientModule) || {};
|
|
133539
|
+
if (result === "failed")
|
|
133415
133540
|
return;
|
|
133541
|
+
// If we skipped resolving module specifiers, our selection of which ExportInfo
|
|
133542
|
+
// to use here is arbitrary, since the info shown in the completion list derived from
|
|
133543
|
+
// it should be identical regardless of which one is used. During the subsequent
|
|
133544
|
+
// `CompletionEntryDetails` request, we'll get all the ExportInfos again and pick
|
|
133545
|
+
// the best one based on the module specifier it produces.
|
|
133546
|
+
var exportInfo = firstImportableExportInfo, moduleSpecifier;
|
|
133547
|
+
if (result !== "skipped") {
|
|
133548
|
+
(_a = result.exportInfo, exportInfo = _a === void 0 ? firstImportableExportInfo : _a, moduleSpecifier = result.moduleSpecifier);
|
|
133416
133549
|
}
|
|
133417
|
-
// If we don't need to resolve module specifiers, we can use any re-export that is importable at all
|
|
133418
|
-
// (We need to ensure that at least one is importable to show a completion.)
|
|
133419
|
-
var _a = context.tryResolve(info, symbolName, isFromAmbientModule) || {}, _b = _a.exportInfo, exportInfo = _b === void 0 ? defaultExportInfo : _b, moduleSpecifier = _a.moduleSpecifier;
|
|
133420
133550
|
var isDefaultExport = exportInfo.exportKind === 1 /* Default */;
|
|
133421
133551
|
var symbol = isDefaultExport && ts.getLocalSymbolForExportDefault(exportInfo.symbol) || exportInfo.symbol;
|
|
133422
133552
|
pushAutoImportSymbol(symbol, {
|
|
@@ -133431,7 +133561,9 @@ var ts;
|
|
|
133431
133561
|
isFromPackageJson: exportInfo.isFromPackageJson,
|
|
133432
133562
|
});
|
|
133433
133563
|
});
|
|
133434
|
-
hasUnresolvedAutoImports = context.
|
|
133564
|
+
hasUnresolvedAutoImports = context.skippedAny();
|
|
133565
|
+
flags |= context.resolvedAny() ? 8 /* ResolvedModuleSpecifiers */ : 0;
|
|
133566
|
+
flags |= context.resolvedBeyondLimit() ? 16 /* ResolvedModuleSpecifiersBeyondLimit */ : 0;
|
|
133435
133567
|
});
|
|
133436
133568
|
function isImportableExportInfo(info) {
|
|
133437
133569
|
var moduleFile = ts.tryCast(info.moduleSymbol.valueDeclaration, ts.isSourceFile);
|
|
@@ -133479,6 +133611,7 @@ var ts;
|
|
|
133479
133611
|
return;
|
|
133480
133612
|
}
|
|
133481
133613
|
var origin = __assign({ kind: 128 /* ObjectLiteralMethod */ }, entryProps);
|
|
133614
|
+
flags |= 32 /* MayIncludeMethodSnippets */;
|
|
133482
133615
|
symbolToOriginInfoMap[symbols.length] = origin;
|
|
133483
133616
|
symbols.push(member);
|
|
133484
133617
|
});
|
|
@@ -133675,7 +133808,7 @@ var ts;
|
|
|
133675
133808
|
// through type declaration or inference.
|
|
133676
133809
|
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
|
|
133677
133810
|
// type of parameter will flow in from the contextual type of the function
|
|
133678
|
-
var canGetType = ts.hasInitializer(rootDeclaration) || ts.
|
|
133811
|
+
var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* ForOfStatement */;
|
|
133679
133812
|
if (!canGetType && rootDeclaration.kind === 164 /* Parameter */) {
|
|
133680
133813
|
if (ts.isExpression(rootDeclaration.parent)) {
|
|
133681
133814
|
canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
|
|
@@ -134950,6 +135083,8 @@ var ts;
|
|
|
134950
135083
|
return highlightSpans(getAsyncAndAwaitOccurrences(node));
|
|
134951
135084
|
case 125 /* YieldKeyword */:
|
|
134952
135085
|
return highlightSpans(getYieldOccurrences(node));
|
|
135086
|
+
case 101 /* InKeyword */:
|
|
135087
|
+
return undefined;
|
|
134953
135088
|
default:
|
|
134954
135089
|
return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent))
|
|
134955
135090
|
? highlightSpans(getModifierOccurrences(node.kind, node.parent))
|
|
@@ -149718,7 +149853,7 @@ var ts;
|
|
|
149718
149853
|
ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code,
|
|
149719
149854
|
ts.Diagnostics.Type_0_is_not_an_array_type.code,
|
|
149720
149855
|
ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code,
|
|
149721
|
-
ts.Diagnostics.
|
|
149856
|
+
ts.Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher.code,
|
|
149722
149857
|
ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
|
|
149723
149858
|
ts.Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
|
|
149724
149859
|
ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
|
|
@@ -152672,6 +152807,7 @@ var ts;
|
|
|
152672
152807
|
var compilerOptions = program.getCompilerOptions();
|
|
152673
152808
|
var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host);
|
|
152674
152809
|
var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); });
|
|
152810
|
+
var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions));
|
|
152675
152811
|
var getModuleSpecifiers = fromCacheOnly
|
|
152676
152812
|
? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); }
|
|
152677
152813
|
: function (moduleSymbol, checker) { return ts.moduleSpecifiers.getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions, sourceFile, moduleSpecifierResolutionHost, preferences); };
|
|
@@ -152682,19 +152818,19 @@ var ts;
|
|
|
152682
152818
|
var importedSymbolHasValueMeaning = !!(exportInfo.targetFlags & 111551 /* Value */);
|
|
152683
152819
|
var addAsTypeOnly = getAddAsTypeOnly(isValidTypeOnlyUseSite, /*isForNewImportDeclaration*/ true, exportInfo.symbol, exportInfo.targetFlags, checker, compilerOptions);
|
|
152684
152820
|
computedWithoutCacheCount += computedWithoutCache ? 1 : 0;
|
|
152685
|
-
return moduleSpecifiers
|
|
152686
|
-
|
|
152687
|
-
|
|
152688
|
-
? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 }
|
|
152689
|
-
|
|
152690
|
-
|
|
152691
|
-
|
|
152692
|
-
|
|
152693
|
-
|
|
152694
|
-
|
|
152695
|
-
|
|
152696
|
-
|
|
152697
|
-
|
|
152821
|
+
return ts.mapDefined(moduleSpecifiers, function (moduleSpecifier) {
|
|
152822
|
+
return rejectNodeModulesRelativePaths && ts.pathContainsNodeModules(moduleSpecifier) ? undefined :
|
|
152823
|
+
// `position` should only be undefined at a missing jsx namespace, in which case we shouldn't be looking for pure types.
|
|
152824
|
+
!importedSymbolHasValueMeaning && isJs && position !== undefined ? { kind: 1 /* JsdocTypeImport */, moduleSpecifier: moduleSpecifier, position: position, exportInfo: exportInfo, isReExport: i > 0 } :
|
|
152825
|
+
{
|
|
152826
|
+
kind: 3 /* AddNew */,
|
|
152827
|
+
moduleSpecifier: moduleSpecifier,
|
|
152828
|
+
importKind: getImportKind(sourceFile, exportInfo.exportKind, compilerOptions),
|
|
152829
|
+
useRequire: useRequire,
|
|
152830
|
+
addAsTypeOnly: addAsTypeOnly,
|
|
152831
|
+
exportInfo: exportInfo,
|
|
152832
|
+
isReExport: i > 0,
|
|
152833
|
+
};
|
|
152698
152834
|
});
|
|
152699
152835
|
});
|
|
152700
152836
|
return { computedWithoutCacheCount: computedWithoutCacheCount, fixes: fixes };
|
|
@@ -174251,7 +174387,7 @@ var ts;
|
|
|
174251
174387
|
return cache.get(toFileName);
|
|
174252
174388
|
},
|
|
174253
174389
|
set: function (fromFileName, toFileName, preferences, options, modulePaths, moduleSpecifiers) {
|
|
174254
|
-
ensureCache(fromFileName, preferences, options).set(toFileName, createInfo(modulePaths, moduleSpecifiers, /*
|
|
174390
|
+
ensureCache(fromFileName, preferences, options).set(toFileName, createInfo(modulePaths, moduleSpecifiers, /*isBlockedByPackageJsonDependencies*/ false));
|
|
174255
174391
|
// If any module specifiers were generated based off paths in node_modules,
|
|
174256
174392
|
// a package.json file in that package was read and is an input to the cached.
|
|
174257
174393
|
// Instead of watching each individual package.json file, set up a wildcard
|
|
@@ -174277,17 +174413,17 @@ var ts;
|
|
|
174277
174413
|
info.modulePaths = modulePaths;
|
|
174278
174414
|
}
|
|
174279
174415
|
else {
|
|
174280
|
-
cache.set(toFileName, createInfo(modulePaths, /*moduleSpecifiers*/ undefined, /*
|
|
174416
|
+
cache.set(toFileName, createInfo(modulePaths, /*moduleSpecifiers*/ undefined, /*isBlockedByPackageJsonDependencies*/ undefined));
|
|
174281
174417
|
}
|
|
174282
174418
|
},
|
|
174283
|
-
|
|
174419
|
+
setBlockedByPackageJsonDependencies: function (fromFileName, toFileName, preferences, options, isBlockedByPackageJsonDependencies) {
|
|
174284
174420
|
var cache = ensureCache(fromFileName, preferences, options);
|
|
174285
174421
|
var info = cache.get(toFileName);
|
|
174286
174422
|
if (info) {
|
|
174287
|
-
info.
|
|
174423
|
+
info.isBlockedByPackageJsonDependencies = isBlockedByPackageJsonDependencies;
|
|
174288
174424
|
}
|
|
174289
174425
|
else {
|
|
174290
|
-
cache.set(toFileName, createInfo(/*modulePaths*/ undefined, /*moduleSpecifiers*/ undefined,
|
|
174426
|
+
cache.set(toFileName, createInfo(/*modulePaths*/ undefined, /*moduleSpecifiers*/ undefined, isBlockedByPackageJsonDependencies));
|
|
174291
174427
|
}
|
|
174292
174428
|
},
|
|
174293
174429
|
clear: function () {
|
|
@@ -174315,8 +174451,8 @@ var ts;
|
|
|
174315
174451
|
function key(fromFileName, preferences, options) {
|
|
174316
174452
|
return fromFileName + "," + preferences.importModuleSpecifierEnding + "," + preferences.importModuleSpecifierPreference + "," + options.overrideImportMode;
|
|
174317
174453
|
}
|
|
174318
|
-
function createInfo(modulePaths, moduleSpecifiers,
|
|
174319
|
-
return { modulePaths: modulePaths, moduleSpecifiers: moduleSpecifiers,
|
|
174454
|
+
function createInfo(modulePaths, moduleSpecifiers, isBlockedByPackageJsonDependencies) {
|
|
174455
|
+
return { modulePaths: modulePaths, moduleSpecifiers: moduleSpecifiers, isBlockedByPackageJsonDependencies: isBlockedByPackageJsonDependencies };
|
|
174320
174456
|
}
|
|
174321
174457
|
}
|
|
174322
174458
|
server.createModuleSpecifierCache = createModuleSpecifierCache;
|