typescript 4.6.0-dev.20220118 → 4.6.0-dev.20220122
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/lib.dom.d.ts +144 -58
- package/lib/lib.dom.iterable.d.ts +7 -0
- package/lib/lib.es2015.iterable.d.ts +2 -1
- package/lib/lib.es2020.intl.d.ts +4 -0
- package/lib/lib.es5.d.ts +0 -2
- package/lib/lib.webworker.d.ts +80 -17
- package/lib/lib.webworker.iterable.d.ts +7 -0
- package/lib/protocol.d.ts +1 -0
- package/lib/tsc.js +131 -48
- package/lib/tsserver.js +202 -97
- package/lib/tsserverlibrary.d.ts +5 -3
- package/lib/tsserverlibrary.js +202 -97
- package/lib/typescript.d.ts +4 -3
- package/lib/typescript.js +188 -95
- package/lib/typescriptServices.d.ts +4 -3
- package/lib/typescriptServices.js +188 -95
- package/lib/typingsInstaller.js +146 -49
- package/package.json +2 -2
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220122";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -7004,11 +7004,15 @@ var ts;
|
|
|
7004
7004
|
ts.getFileWatcherEventKind = getFileWatcherEventKind;
|
|
7005
7005
|
/*@internal*/
|
|
7006
7006
|
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
|
|
7007
|
+
var curSysLog = ts.noop; // eslint-disable-line prefer-const
|
|
7007
7008
|
/*@internal*/
|
|
7008
|
-
|
|
7009
|
+
function sysLog(s) {
|
|
7010
|
+
return curSysLog(s);
|
|
7011
|
+
}
|
|
7012
|
+
ts.sysLog = sysLog;
|
|
7009
7013
|
/*@internal*/
|
|
7010
7014
|
function setSysLog(logger) {
|
|
7011
|
-
|
|
7015
|
+
curSysLog = logger;
|
|
7012
7016
|
}
|
|
7013
7017
|
ts.setSysLog = setSysLog;
|
|
7014
7018
|
/**
|
|
@@ -7143,7 +7147,7 @@ var ts;
|
|
|
7143
7147
|
}
|
|
7144
7148
|
function onTimerToUpdateChildWatches() {
|
|
7145
7149
|
timerToUpdateChildWatches = undefined;
|
|
7146
|
-
|
|
7150
|
+
sysLog("sysLog:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size);
|
|
7147
7151
|
var start = ts.timestamp();
|
|
7148
7152
|
var invokeMap = new ts.Map();
|
|
7149
7153
|
while (!timerToUpdateChildWatches && cacheToUpdateChildWatches.size) {
|
|
@@ -7156,7 +7160,7 @@ var ts;
|
|
|
7156
7160
|
var hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
7157
7161
|
invokeCallbacks(dirPath, invokeMap, hasChanges ? undefined : fileNames);
|
|
7158
7162
|
}
|
|
7159
|
-
|
|
7163
|
+
sysLog("sysLog:: invokingWatchers:: Elapsed:: " + (ts.timestamp() - start) + "ms:: " + cacheToUpdateChildWatches.size);
|
|
7160
7164
|
callbackCache.forEach(function (callbacks, rootDirName) {
|
|
7161
7165
|
var existing = invokeMap.get(rootDirName);
|
|
7162
7166
|
if (existing) {
|
|
@@ -7172,7 +7176,7 @@ var ts;
|
|
|
7172
7176
|
}
|
|
7173
7177
|
});
|
|
7174
7178
|
var elapsed = ts.timestamp() - start;
|
|
7175
|
-
|
|
7179
|
+
sysLog("sysLog:: Elapsed:: " + elapsed + "ms:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size + " " + timerToUpdateChildWatches);
|
|
7176
7180
|
}
|
|
7177
7181
|
function removeChildWatches(parentWatcher) {
|
|
7178
7182
|
if (!parentWatcher)
|
|
@@ -7759,7 +7763,7 @@ var ts;
|
|
|
7759
7763
|
* @param createWatcher
|
|
7760
7764
|
*/
|
|
7761
7765
|
function invokeCallbackAndUpdateWatcher(createWatcher) {
|
|
7762
|
-
|
|
7766
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
|
|
7763
7767
|
// Call the callback for current directory
|
|
7764
7768
|
callback("rename", "");
|
|
7765
7769
|
// If watcher is not closed, update it
|
|
@@ -7784,7 +7788,7 @@ var ts;
|
|
|
7784
7788
|
}
|
|
7785
7789
|
}
|
|
7786
7790
|
if (hitSystemWatcherLimit) {
|
|
7787
|
-
|
|
7791
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
|
|
7788
7792
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
7789
7793
|
}
|
|
7790
7794
|
try {
|
|
@@ -7800,7 +7804,7 @@ var ts;
|
|
|
7800
7804
|
// Eg. on linux the number of watches are limited and one could easily exhaust watches and the exception ENOSPC is thrown when creating watcher at that point
|
|
7801
7805
|
// so instead of throwing error, use fs.watchFile
|
|
7802
7806
|
hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
|
|
7803
|
-
|
|
7807
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
|
|
7804
7808
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
7805
7809
|
}
|
|
7806
7810
|
}
|
|
@@ -8399,6 +8403,7 @@ var ts;
|
|
|
8399
8403
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
8400
8404
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
8401
8405
|
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
|
|
8406
|
+
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
8402
8407
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8403
8408
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8404
8409
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -8886,6 +8891,7 @@ var ts;
|
|
|
8886
8891
|
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
|
|
8887
8892
|
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
|
|
8888
8893
|
Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
|
|
8894
|
+
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
8889
8895
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
8890
8896
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
8891
8897
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -9279,7 +9285,7 @@ var ts;
|
|
|
9279
9285
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9280
9286
|
_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, ts.DiagnosticCategory.Error, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"),
|
|
9281
9287
|
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
9282
|
-
|
|
9288
|
+
Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, ts.DiagnosticCategory.Message, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"),
|
|
9283
9289
|
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
9284
9290
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, ts.DiagnosticCategory.Message, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
9285
9291
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, ts.DiagnosticCategory.Message, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
@@ -16052,7 +16058,7 @@ var ts;
|
|
|
16052
16058
|
}
|
|
16053
16059
|
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
|
|
16054
16060
|
function getExternalModuleRequireArgument(node) {
|
|
16055
|
-
return
|
|
16061
|
+
return isVariableDeclarationInitializedToBareOrAccessedRequire(node) && getLeftmostAccessExpression(node.initializer).arguments[0];
|
|
16056
16062
|
}
|
|
16057
16063
|
ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument;
|
|
16058
16064
|
function isInternalModuleImportEqualsDeclaration(node) {
|
|
@@ -16110,17 +16116,29 @@ var ts;
|
|
|
16110
16116
|
* Returns true if the node is a VariableDeclaration initialized to a require call (see `isRequireCall`).
|
|
16111
16117
|
* This function does not test if the node is in a JavaScript file or not.
|
|
16112
16118
|
*/
|
|
16113
|
-
function
|
|
16119
|
+
function isVariableDeclarationInitializedToRequire(node) {
|
|
16120
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, /*allowAccessedRequire*/ false);
|
|
16121
|
+
}
|
|
16122
|
+
ts.isVariableDeclarationInitializedToRequire = isVariableDeclarationInitializedToRequire;
|
|
16123
|
+
/**
|
|
16124
|
+
* Like {@link isVariableDeclarationInitializedToRequire} but allows things like `require("...").foo.bar` or `require("...")["baz"]`.
|
|
16125
|
+
*/
|
|
16126
|
+
function isVariableDeclarationInitializedToBareOrAccessedRequire(node) {
|
|
16127
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, /*allowAccessedRequire*/ true);
|
|
16128
|
+
}
|
|
16129
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
16130
|
+
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
16114
16131
|
if (node.kind === 202 /* BindingElement */) {
|
|
16115
16132
|
node = node.parent.parent;
|
|
16116
16133
|
}
|
|
16117
|
-
return ts.isVariableDeclaration(node) &&
|
|
16134
|
+
return ts.isVariableDeclaration(node) &&
|
|
16135
|
+
!!node.initializer &&
|
|
16136
|
+
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
|
|
16118
16137
|
}
|
|
16119
|
-
ts.isRequireVariableDeclaration = isRequireVariableDeclaration;
|
|
16120
16138
|
function isRequireVariableStatement(node) {
|
|
16121
16139
|
return ts.isVariableStatement(node)
|
|
16122
16140
|
&& node.declarationList.declarations.length > 0
|
|
16123
|
-
&& ts.every(node.declarationList.declarations, function (decl) { return
|
|
16141
|
+
&& ts.every(node.declarationList.declarations, function (decl) { return isVariableDeclarationInitializedToRequire(decl); });
|
|
16124
16142
|
}
|
|
16125
16143
|
ts.isRequireVariableStatement = isRequireVariableStatement;
|
|
16126
16144
|
function isSingleOrDoubleQuote(charCode) {
|
|
@@ -19607,7 +19625,7 @@ var ts;
|
|
|
19607
19625
|
getSourceMapSourceConstructor: function () { return SourceMapSource; },
|
|
19608
19626
|
};
|
|
19609
19627
|
function setObjectAllocator(alloc) {
|
|
19610
|
-
ts.objectAllocator
|
|
19628
|
+
Object.assign(ts.objectAllocator, alloc);
|
|
19611
19629
|
}
|
|
19612
19630
|
ts.setObjectAllocator = setObjectAllocator;
|
|
19613
19631
|
function formatStringFromArgs(text, args, baseIndex) {
|
|
@@ -19615,13 +19633,22 @@ var ts;
|
|
|
19615
19633
|
return text.replace(/{(\d+)}/g, function (_match, index) { return "" + ts.Debug.checkDefined(args[+index + baseIndex]); });
|
|
19616
19634
|
}
|
|
19617
19635
|
ts.formatStringFromArgs = formatStringFromArgs;
|
|
19636
|
+
var localizedDiagnosticMessages;
|
|
19618
19637
|
/* @internal */
|
|
19619
19638
|
function setLocalizedDiagnosticMessages(messages) {
|
|
19620
|
-
|
|
19639
|
+
localizedDiagnosticMessages = messages;
|
|
19621
19640
|
}
|
|
19622
19641
|
ts.setLocalizedDiagnosticMessages = setLocalizedDiagnosticMessages;
|
|
19642
|
+
/* @internal */
|
|
19643
|
+
// If the localized messages json is unset, and if given function use it to set the json
|
|
19644
|
+
function maybeSetLocalizedDiagnosticMessages(getMessages) {
|
|
19645
|
+
if (!localizedDiagnosticMessages && getMessages) {
|
|
19646
|
+
localizedDiagnosticMessages = getMessages();
|
|
19647
|
+
}
|
|
19648
|
+
}
|
|
19649
|
+
ts.maybeSetLocalizedDiagnosticMessages = maybeSetLocalizedDiagnosticMessages;
|
|
19623
19650
|
function getLocaleSpecificMessage(message) {
|
|
19624
|
-
return
|
|
19651
|
+
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
|
|
19625
19652
|
}
|
|
19626
19653
|
ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
|
|
19627
19654
|
function createDetachedDiagnostic(fileName, start, length, message) {
|
|
@@ -35230,7 +35257,7 @@ var ts;
|
|
|
35230
35257
|
// one out no matter what.
|
|
35231
35258
|
var finallyBlock;
|
|
35232
35259
|
if (!catchClause || token() === 96 /* FinallyKeyword */) {
|
|
35233
|
-
parseExpected(96 /* FinallyKeyword
|
|
35260
|
+
parseExpected(96 /* FinallyKeyword */, ts.Diagnostics.catch_or_finally_expected);
|
|
35234
35261
|
finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
|
|
35235
35262
|
}
|
|
35236
35263
|
return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc);
|
|
@@ -36274,7 +36301,7 @@ var ts;
|
|
|
36274
36301
|
var pos = getNodePos();
|
|
36275
36302
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
36276
36303
|
parseExpected(58 /* ColonToken */);
|
|
36277
|
-
var value =
|
|
36304
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
36278
36305
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
36279
36306
|
}
|
|
36280
36307
|
function parseAssertClause() {
|
|
@@ -44691,7 +44718,7 @@ var ts;
|
|
|
44691
44718
|
maybeBindExpressionFlowIfCall(node.expression);
|
|
44692
44719
|
}
|
|
44693
44720
|
function maybeBindExpressionFlowIfCall(node) {
|
|
44694
|
-
// A top level or
|
|
44721
|
+
// A top level or comma expression call expression with a dotted function name and at least one argument
|
|
44695
44722
|
// is potentially an assertion and is therefore included in the control flow.
|
|
44696
44723
|
if (node.kind === 207 /* CallExpression */) {
|
|
44697
44724
|
var call = node;
|
|
@@ -44859,22 +44886,27 @@ var ts;
|
|
|
44859
44886
|
}
|
|
44860
44887
|
return state;
|
|
44861
44888
|
}
|
|
44862
|
-
function onLeft(left, state,
|
|
44889
|
+
function onLeft(left, state, node) {
|
|
44863
44890
|
if (!state.skip) {
|
|
44864
|
-
|
|
44891
|
+
var maybeBound = maybeBind(left);
|
|
44892
|
+
if (node.operatorToken.kind === 27 /* CommaToken */) {
|
|
44893
|
+
maybeBindExpressionFlowIfCall(left);
|
|
44894
|
+
}
|
|
44895
|
+
return maybeBound;
|
|
44865
44896
|
}
|
|
44866
44897
|
}
|
|
44867
|
-
function onOperator(operatorToken, state,
|
|
44898
|
+
function onOperator(operatorToken, state, _node) {
|
|
44868
44899
|
if (!state.skip) {
|
|
44869
|
-
if (operatorToken.kind === 27 /* CommaToken */) {
|
|
44870
|
-
maybeBindExpressionFlowIfCall(node.left);
|
|
44871
|
-
}
|
|
44872
44900
|
bind(operatorToken);
|
|
44873
44901
|
}
|
|
44874
44902
|
}
|
|
44875
|
-
function onRight(right, state,
|
|
44903
|
+
function onRight(right, state, node) {
|
|
44876
44904
|
if (!state.skip) {
|
|
44877
|
-
|
|
44905
|
+
var maybeBound = maybeBind(right);
|
|
44906
|
+
if (node.operatorToken.kind === 27 /* CommaToken */) {
|
|
44907
|
+
maybeBindExpressionFlowIfCall(right);
|
|
44908
|
+
}
|
|
44909
|
+
return maybeBound;
|
|
44878
44910
|
}
|
|
44879
44911
|
}
|
|
44880
44912
|
function onExit(node, state) {
|
|
@@ -45617,6 +45649,8 @@ var ts;
|
|
|
45617
45649
|
return;
|
|
45618
45650
|
}
|
|
45619
45651
|
ts.setParent(node, parent);
|
|
45652
|
+
if (ts.tracing)
|
|
45653
|
+
node.tracingPath = file.path;
|
|
45620
45654
|
var saveInStrictMode = inStrictMode;
|
|
45621
45655
|
// Even though in the AST the jsdoc @typedef node belongs to the current node,
|
|
45622
45656
|
// its symbol might be in the same scope with the current node's symbol. Consider:
|
|
@@ -46437,7 +46471,7 @@ var ts;
|
|
|
46437
46471
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
46438
46472
|
}
|
|
46439
46473
|
if (!ts.isBindingPattern(node.name)) {
|
|
46440
|
-
if (ts.isInJSFile(node) && ts.
|
|
46474
|
+
if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node)) {
|
|
46441
46475
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
46442
46476
|
}
|
|
46443
46477
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -46948,6 +46982,9 @@ var ts;
|
|
|
46948
46982
|
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
|
|
46949
46983
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
46950
46984
|
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
46985
|
+
// Masks
|
|
46986
|
+
TypeFacts[TypeFacts["OrFactsMask"] = 8288] = "OrFactsMask";
|
|
46987
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 16768927] = "AndFactsMask";
|
|
46951
46988
|
})(TypeFacts || (TypeFacts = {}));
|
|
46952
46989
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
46953
46990
|
string: 1 /* TypeofEQString */,
|
|
@@ -49220,7 +49257,7 @@ var ts;
|
|
|
49220
49257
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
49221
49258
|
|| node.kind === 295 /* ShorthandPropertyAssignment */
|
|
49222
49259
|
|| node.kind === 294 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
|
|
49223
|
-
|| ts.
|
|
49260
|
+
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
49224
49261
|
}
|
|
49225
49262
|
function isAliasableOrJsExpression(e) {
|
|
49226
49263
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -50008,8 +50045,14 @@ var ts;
|
|
|
50008
50045
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
50009
50046
|
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
50010
50047
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
50011
|
-
var sourceFile = resolvedModule
|
|
50048
|
+
var sourceFile = resolvedModule
|
|
50049
|
+
&& (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
|
|
50050
|
+
&& host.getSourceFile(resolvedModule.resolvedFileName);
|
|
50012
50051
|
if (sourceFile) {
|
|
50052
|
+
// If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
|
|
50053
|
+
if (resolutionDiagnostic) {
|
|
50054
|
+
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
50055
|
+
}
|
|
50013
50056
|
if (sourceFile.symbol) {
|
|
50014
50057
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50015
50058
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
@@ -51151,6 +51194,7 @@ var ts;
|
|
|
51151
51194
|
getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function () { return host.getCommonSourceDirectory(); } : function () { return ""; },
|
|
51152
51195
|
getCurrentDirectory: function () { return host.getCurrentDirectory(); },
|
|
51153
51196
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
|
|
51197
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host); },
|
|
51154
51198
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
51155
51199
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
51156
51200
|
getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
|
|
@@ -68082,10 +68126,23 @@ var ts;
|
|
|
68082
68126
|
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
68083
68127
|
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
68084
68128
|
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
68085
|
-
return
|
|
68129
|
+
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
68086
68130
|
}
|
|
68087
68131
|
return 16777215 /* All */;
|
|
68088
68132
|
}
|
|
68133
|
+
function getIntersectionTypeFacts(type, ignoreObjects) {
|
|
68134
|
+
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
68135
|
+
// and others are computed as `or`.
|
|
68136
|
+
var oredFacts = 0 /* None */;
|
|
68137
|
+
var andedFacts = 16777215 /* All */;
|
|
68138
|
+
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
68139
|
+
var t = _a[_i];
|
|
68140
|
+
var f = getTypeFacts(t, ignoreObjects);
|
|
68141
|
+
oredFacts |= f;
|
|
68142
|
+
andedFacts &= f;
|
|
68143
|
+
}
|
|
68144
|
+
return oredFacts & 8288 /* OrFactsMask */ | andedFacts & 16768927 /* AndFactsMask */;
|
|
68145
|
+
}
|
|
68089
68146
|
function getTypeWithFacts(type, include) {
|
|
68090
68147
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
68091
68148
|
}
|
|
@@ -78097,7 +78154,7 @@ var ts;
|
|
|
78097
78154
|
}
|
|
78098
78155
|
}
|
|
78099
78156
|
function checkExpression(node, checkMode, forceTuple) {
|
|
78100
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
|
|
78157
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
78101
78158
|
var saveCurrentNode = currentNode;
|
|
78102
78159
|
currentNode = node;
|
|
78103
78160
|
instantiationCount = 0;
|
|
@@ -80778,7 +80835,7 @@ var ts;
|
|
|
80778
80835
|
}
|
|
80779
80836
|
// For a commonjs `const x = require`, validate the alias and exit
|
|
80780
80837
|
var symbol = getSymbolOfNode(node);
|
|
80781
|
-
if (symbol.flags & 2097152 /* Alias */ && ts.
|
|
80838
|
+
if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
80782
80839
|
checkAliasSymbol(node);
|
|
80783
80840
|
return;
|
|
80784
80841
|
}
|
|
@@ -80856,7 +80913,7 @@ var ts;
|
|
|
80856
80913
|
return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80857
80914
|
}
|
|
80858
80915
|
function checkVariableDeclaration(node) {
|
|
80859
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
|
|
80916
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
80860
80917
|
checkGrammarVariableDeclaration(node);
|
|
80861
80918
|
checkVariableLikeDeclaration(node);
|
|
80862
80919
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -83246,6 +83303,17 @@ var ts;
|
|
|
83246
83303
|
return false;
|
|
83247
83304
|
}
|
|
83248
83305
|
}
|
|
83306
|
+
if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
|
|
83307
|
+
var hasError = false;
|
|
83308
|
+
for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
|
|
83309
|
+
var clause = _a[_i];
|
|
83310
|
+
if (!ts.isStringLiteral(clause.value)) {
|
|
83311
|
+
hasError = true;
|
|
83312
|
+
error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83313
|
+
}
|
|
83314
|
+
}
|
|
83315
|
+
return !hasError;
|
|
83316
|
+
}
|
|
83249
83317
|
return true;
|
|
83250
83318
|
}
|
|
83251
83319
|
function checkAliasSymbol(node) {
|
|
@@ -83939,7 +84007,7 @@ var ts;
|
|
|
83939
84007
|
}
|
|
83940
84008
|
}
|
|
83941
84009
|
function checkDeferredNode(node) {
|
|
83942
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
|
|
84010
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath });
|
|
83943
84011
|
var saveCurrentNode = currentNode;
|
|
83944
84012
|
currentNode = node;
|
|
83945
84013
|
instantiationCount = 0;
|
|
@@ -87873,7 +87941,7 @@ var ts;
|
|
|
87873
87941
|
return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
|
|
87874
87942
|
case 293 /* AssertEntry */:
|
|
87875
87943
|
ts.Debug.type(node);
|
|
87876
|
-
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.
|
|
87944
|
+
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
|
|
87877
87945
|
case 266 /* ImportClause */:
|
|
87878
87946
|
ts.Debug.type(node);
|
|
87879
87947
|
return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
|
|
@@ -95723,10 +95791,19 @@ var ts;
|
|
|
95723
95791
|
var _a;
|
|
95724
95792
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95725
95793
|
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
95726
|
-
var args = [tagName, objectProperties
|
|
95794
|
+
var args = [tagName, objectProperties];
|
|
95795
|
+
// function jsx(type, config, maybeKey) {}
|
|
95796
|
+
// "maybeKey" is optional. It is acceptable to use "_jsx" without a third argument
|
|
95797
|
+
if (keyAttr) {
|
|
95798
|
+
args.push(transformJsxAttributeInitializer(keyAttr.initializer));
|
|
95799
|
+
}
|
|
95727
95800
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
95728
95801
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
95729
95802
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
95803
|
+
// "maybeKey" has to be replaced with "void 0" to not break the jsxDEV signature
|
|
95804
|
+
if (keyAttr === undefined) {
|
|
95805
|
+
args.push(factory.createVoidZero());
|
|
95806
|
+
}
|
|
95730
95807
|
// isStaticChildren development flag
|
|
95731
95808
|
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
95732
95809
|
// __source development flag
|
|
@@ -119591,11 +119668,12 @@ var ts;
|
|
|
119591
119668
|
};
|
|
119592
119669
|
}
|
|
119593
119670
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
119671
|
+
var _a;
|
|
119594
119672
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
|
|
119595
119673
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
119596
119674
|
return false;
|
|
119597
119675
|
}
|
|
119598
|
-
return ts.getImpliedNodeFormatForFile(importingSourceFileName,
|
|
119676
|
+
return ts.getImpliedNodeFormatForFile(importingSourceFileName, (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host), getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
|
|
119599
119677
|
}
|
|
119600
119678
|
function getModuleResolutionHost(host) {
|
|
119601
119679
|
var _a;
|
|
@@ -120155,11 +120233,13 @@ var ts;
|
|
|
120155
120233
|
// For classic resolution, only allow importing from node_modules/@types, not other node_modules
|
|
120156
120234
|
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
|
|
120157
120235
|
function tryDirectoryWithPackageJson(packageRootIndex) {
|
|
120236
|
+
var _a, _b;
|
|
120158
120237
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
120159
120238
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
120160
120239
|
var moduleFileToTry = path;
|
|
120161
|
-
|
|
120162
|
-
|
|
120240
|
+
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
120241
|
+
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
120242
|
+
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
120163
120243
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
120164
120244
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
120165
120245
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
@@ -120459,22 +120539,31 @@ var ts;
|
|
|
120459
120539
|
ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
120460
120540
|
}
|
|
120461
120541
|
ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
|
|
120542
|
+
function prettyPathForFileError(error, cwd) {
|
|
120543
|
+
var line = ts.formatColorAndReset(":" + error.line, ts.ForegroundColorEscapeSequences.Grey);
|
|
120544
|
+
if (ts.pathIsAbsolute(error.fileName) && ts.pathIsAbsolute(cwd)) {
|
|
120545
|
+
return ts.getRelativePathFromDirectory(cwd, error.fileName, /* ignoreCase */ false) + line;
|
|
120546
|
+
}
|
|
120547
|
+
return error.fileName + line;
|
|
120548
|
+
}
|
|
120462
120549
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
120463
120550
|
if (errorCount === 0)
|
|
120464
120551
|
return "";
|
|
120465
120552
|
var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
|
|
120466
120553
|
var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
|
|
120467
120554
|
.filter(function (value, index, self) { return self.indexOf(value) === index; });
|
|
120555
|
+
var firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
120468
120556
|
var d = errorCount === 1 ?
|
|
120469
120557
|
ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
|
|
120470
120558
|
ts.Diagnostics.Found_1_error_in_1 :
|
|
120471
|
-
ts.Diagnostics.Found_1_error, errorCount,
|
|
120559
|
+
ts.Diagnostics.Found_1_error, errorCount, firstFileReference) :
|
|
120472
120560
|
ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
|
|
120473
120561
|
ts.Diagnostics.Found_0_errors :
|
|
120474
120562
|
distinctFileNamesWithLines.length === 1 ?
|
|
120475
|
-
ts.Diagnostics.
|
|
120476
|
-
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
|
|
120477
|
-
|
|
120563
|
+
ts.Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 :
|
|
120564
|
+
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length);
|
|
120565
|
+
var suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
120566
|
+
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + suffix;
|
|
120478
120567
|
}
|
|
120479
120568
|
ts.getErrorSummaryText = getErrorSummaryText;
|
|
120480
120569
|
function createTabularErrorsDisplay(filesInError, host) {
|
|
@@ -120496,8 +120585,8 @@ var ts;
|
|
|
120496
120585
|
var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
|
|
120497
120586
|
" ".repeat(leftPaddingGoal - errorCountDigitsLength)
|
|
120498
120587
|
: "";
|
|
120499
|
-
var
|
|
120500
|
-
tabularData += "" + leftPadding + errorCount + " " +
|
|
120588
|
+
var fileRef = prettyPathForFileError(file, host.getCurrentDirectory());
|
|
120589
|
+
tabularData += "" + leftPadding + errorCount + " " + fileRef + "\n";
|
|
120501
120590
|
});
|
|
120502
120591
|
return tabularData;
|
|
120503
120592
|
}
|
|
@@ -120998,6 +121087,7 @@ var ts;
|
|
|
120998
121087
|
var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects
|
|
120999
121088
|
var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
|
|
121000
121089
|
var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
|
|
121090
|
+
var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
|
|
121001
121091
|
var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info
|
|
121002
121092
|
var missingFilePathsRequestedForRelease; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
|
|
121003
121093
|
var hasChangedCompilerOptions = false; // True if the compiler options have changed between compilations
|
|
@@ -121160,14 +121250,21 @@ var ts;
|
|
|
121160
121250
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
|
|
121161
121251
|
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
121162
121252
|
if (hasChangedConfigFileParsingErrors) {
|
|
121253
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
121254
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
121255
|
+
}
|
|
121163
121256
|
builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
121164
121257
|
hasChangedConfigFileParsingErrors = false;
|
|
121165
121258
|
}
|
|
121166
121259
|
}
|
|
121167
121260
|
else {
|
|
121261
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
121262
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
121263
|
+
}
|
|
121168
121264
|
createNewProgram(hasInvalidatedResolution);
|
|
121169
121265
|
}
|
|
121170
121266
|
changesAffectResolution = false; // reset for next sync
|
|
121267
|
+
reportFileChangeDetectedOnCreateProgram = false;
|
|
121171
121268
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
121172
121269
|
host.afterProgramCreate(builderProgram);
|
|
121173
121270
|
}
|
|
@@ -121369,7 +121466,7 @@ var ts;
|
|
|
121369
121466
|
}
|
|
121370
121467
|
function updateProgramWithWatchStatus() {
|
|
121371
121468
|
timerToUpdateProgram = undefined;
|
|
121372
|
-
|
|
121469
|
+
reportFileChangeDetectedOnCreateProgram = true;
|
|
121373
121470
|
updateProgram();
|
|
121374
121471
|
}
|
|
121375
121472
|
function updateProgram() {
|
|
@@ -123893,6 +123990,7 @@ var ts;
|
|
|
123893
123990
|
ScriptElementKind["externalModuleName"] = "external module name";
|
|
123894
123991
|
/**
|
|
123895
123992
|
* <JsxTagName attribute1 attribute2={0} />
|
|
123993
|
+
* @deprecated
|
|
123896
123994
|
*/
|
|
123897
123995
|
ScriptElementKind["jsxAttribute"] = "JSX attribute";
|
|
123898
123996
|
/** String literal */
|
|
@@ -125218,7 +125316,7 @@ var ts;
|
|
|
125218
125316
|
isWhiteSpaceOnlyJsxText(child);
|
|
125219
125317
|
if (lookInPreviousChild) {
|
|
125220
125318
|
// actual start of the node is past the position - previous token should be at the end of previous child
|
|
125221
|
-
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
|
|
125319
|
+
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile, n.kind);
|
|
125222
125320
|
return candidate_1 && findRightmostToken(candidate_1, sourceFile);
|
|
125223
125321
|
}
|
|
125224
125322
|
else {
|
|
@@ -125232,7 +125330,7 @@ var ts;
|
|
|
125232
125330
|
// the only known case is when position is at the end of the file.
|
|
125233
125331
|
// Try to find the rightmost token in the file without filtering.
|
|
125234
125332
|
// Namely we are skipping the check: 'position < node.end'
|
|
125235
|
-
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile);
|
|
125333
|
+
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile, n.kind);
|
|
125236
125334
|
return candidate && findRightmostToken(candidate, sourceFile);
|
|
125237
125335
|
}
|
|
125238
125336
|
}
|
|
@@ -125248,17 +125346,19 @@ var ts;
|
|
|
125248
125346
|
if (children.length === 0) {
|
|
125249
125347
|
return n;
|
|
125250
125348
|
}
|
|
125251
|
-
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile);
|
|
125349
|
+
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile, n.kind);
|
|
125252
125350
|
return candidate && findRightmostToken(candidate, sourceFile);
|
|
125253
125351
|
}
|
|
125254
125352
|
/**
|
|
125255
125353
|
* Finds the rightmost child to the left of `children[exclusiveStartPosition]` which is a non-all-whitespace token or has constituent tokens.
|
|
125256
125354
|
*/
|
|
125257
|
-
function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile) {
|
|
125355
|
+
function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile, parentKind) {
|
|
125258
125356
|
for (var i = exclusiveStartPosition - 1; i >= 0; i--) {
|
|
125259
125357
|
var child = children[i];
|
|
125260
125358
|
if (isWhiteSpaceOnlyJsxText(child)) {
|
|
125261
|
-
|
|
125359
|
+
if (i === 0 && (parentKind === 11 /* JsxText */ || parentKind === 278 /* JsxSelfClosingElement */)) {
|
|
125360
|
+
ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`");
|
|
125361
|
+
}
|
|
125262
125362
|
}
|
|
125263
125363
|
else if (nodeHasTokens(children[i], sourceFile)) {
|
|
125264
125364
|
return children[i];
|
|
@@ -125784,6 +125884,7 @@ var ts;
|
|
|
125784
125884
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
125785
125885
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache,
|
|
125786
125886
|
getModuleSpecifierCache: ts.maybeBind(host, host.getModuleSpecifierCache),
|
|
125887
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache(); },
|
|
125787
125888
|
getGlobalTypingsCacheLocation: ts.maybeBind(host, host.getGlobalTypingsCacheLocation),
|
|
125788
125889
|
redirectTargetsMap: program.redirectTargetsMap,
|
|
125789
125890
|
getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
|
|
@@ -129528,6 +129629,7 @@ var ts;
|
|
|
129528
129629
|
function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
|
|
129529
129630
|
var _a, _b, _c;
|
|
129530
129631
|
var start = ts.timestamp();
|
|
129632
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
129531
129633
|
var resolutionLimitExceeded = false;
|
|
129532
129634
|
var ambientCount = 0;
|
|
129533
129635
|
var resolvedCount = 0;
|
|
@@ -129550,7 +129652,7 @@ var ts;
|
|
|
129550
129652
|
var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
|
|
129551
129653
|
var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
|
|
129552
129654
|
var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
|
|
129553
|
-
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, shouldGetModuleSpecifierFromCache)
|
|
129655
|
+
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
129554
129656
|
: undefined;
|
|
129555
129657
|
if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
|
|
129556
129658
|
resolutionLimitExceeded = true;
|
|
@@ -130948,9 +131050,7 @@ var ts;
|
|
|
130948
131050
|
// GH#39946. Pulling on the type of a node inside of a function with a contextual `this` parameter can result in a circularity
|
|
130949
131051
|
// if the `node` is part of the exprssion of a `yield` or `return`. This circularity doesn't exist at compile time because
|
|
130950
131052
|
// we will check (and cache) the type of `this` *before* checking the type of the node.
|
|
130951
|
-
|
|
130952
|
-
if (!ts.isSourceFile(container) && container.parent)
|
|
130953
|
-
typeChecker.getTypeAtLocation(container);
|
|
131053
|
+
typeChecker.tryGetThisTypeAt(node, /*includeGlobalThis*/ false);
|
|
130954
131054
|
var type = typeChecker.getTypeAtLocation(node).getNonOptionalType();
|
|
130955
131055
|
var insertQuestionDot = false;
|
|
130956
131056
|
if (type.isNullableType()) {
|
|
@@ -133805,7 +133905,7 @@ var ts;
|
|
|
133805
133905
|
ts.Debug.assert(parent.name === node);
|
|
133806
133906
|
return true;
|
|
133807
133907
|
case 202 /* BindingElement */:
|
|
133808
|
-
return ts.isInJSFile(node) && ts.
|
|
133908
|
+
return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent);
|
|
133809
133909
|
default:
|
|
133810
133910
|
return false;
|
|
133811
133911
|
}
|
|
@@ -134286,7 +134386,7 @@ var ts;
|
|
|
134286
134386
|
function getTextSpan(node, sourceFile, endNode) {
|
|
134287
134387
|
var start = node.getStart(sourceFile);
|
|
134288
134388
|
var end = (endNode || node).getEnd();
|
|
134289
|
-
if (ts.isStringLiteralLike(node)) {
|
|
134389
|
+
if (ts.isStringLiteralLike(node) && (end - start) > 2) {
|
|
134290
134390
|
ts.Debug.assert(endNode === undefined);
|
|
134291
134391
|
start += 1;
|
|
134292
134392
|
end -= 1;
|
|
@@ -135205,7 +135305,7 @@ var ts;
|
|
|
135205
135305
|
// Use the parent symbol if the location is commonjs require syntax on javascript files only.
|
|
135206
135306
|
if (ts.isInJSFile(referenceLocation)
|
|
135207
135307
|
&& referenceLocation.parent.kind === 202 /* BindingElement */
|
|
135208
|
-
&& ts.
|
|
135308
|
+
&& ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent)) {
|
|
135209
135309
|
referenceSymbol = referenceLocation.parent.symbol;
|
|
135210
135310
|
// The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In
|
|
135211
135311
|
// this case, just skip it, since the bound identifiers are not an alias of the import.
|
|
@@ -136806,7 +136906,7 @@ var ts;
|
|
|
136806
136906
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
136807
136907
|
}
|
|
136808
136908
|
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
|
|
136809
|
-
var node = ts.
|
|
136909
|
+
var node = ts.getTouchingToken(sourceFile, position);
|
|
136810
136910
|
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
|
|
136811
136911
|
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
136812
136912
|
var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
|
|
@@ -136916,7 +137016,7 @@ var ts;
|
|
|
136916
137016
|
return declaration.parent.kind === 268 /* NamedImports */;
|
|
136917
137017
|
case 202 /* BindingElement */:
|
|
136918
137018
|
case 253 /* VariableDeclaration */:
|
|
136919
|
-
return ts.isInJSFile(declaration) && ts.
|
|
137019
|
+
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
136920
137020
|
default:
|
|
136921
137021
|
return false;
|
|
136922
137022
|
}
|
|
@@ -137606,7 +137706,7 @@ var ts;
|
|
|
137606
137706
|
textSpan: ts.createTextSpanFromNode(declaration),
|
|
137607
137707
|
// TODO(jfreeman): What should be the containerName when the container has a computed name?
|
|
137608
137708
|
containerName: containerName ? containerName.text : "",
|
|
137609
|
-
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137709
|
+
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137610
137710
|
};
|
|
137611
137711
|
}
|
|
137612
137712
|
})(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
|
|
@@ -141820,18 +141920,7 @@ var ts;
|
|
|
141820
141920
|
}
|
|
141821
141921
|
return unionPropertyKind;
|
|
141822
141922
|
}
|
|
141823
|
-
|
|
141824
|
-
switch (location.parent && location.parent.kind) {
|
|
141825
|
-
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
|
|
141826
|
-
case 279 /* JsxOpeningElement */:
|
|
141827
|
-
case 277 /* JsxElement */:
|
|
141828
|
-
case 278 /* JsxSelfClosingElement */:
|
|
141829
|
-
return location.kind === 79 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
|
|
141830
|
-
case 284 /* JsxAttribute */:
|
|
141831
|
-
return "JSX attribute" /* jsxAttribute */;
|
|
141832
|
-
default:
|
|
141833
|
-
return "property" /* memberVariableElement */;
|
|
141834
|
-
}
|
|
141923
|
+
return "property" /* memberVariableElement */;
|
|
141835
141924
|
}
|
|
141836
141925
|
return "" /* unknown */;
|
|
141837
141926
|
}
|
|
@@ -149823,7 +149912,8 @@ var ts;
|
|
|
149823
149912
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
149824
149913
|
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
149825
149914
|
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
|
|
149826
|
-
|
|
149915
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
149916
|
+
return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter);
|
|
149827
149917
|
}
|
|
149828
149918
|
function codeFixActionToCodeAction(_a) {
|
|
149829
149919
|
var description = _a.description, changes = _a.changes, commands = _a.commands;
|
|
@@ -149878,12 +149968,12 @@ var ts;
|
|
|
149878
149968
|
return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host));
|
|
149879
149969
|
}
|
|
149880
149970
|
}
|
|
149881
|
-
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, fromCacheOnly) {
|
|
149971
|
+
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
|
|
149882
149972
|
var _a = getNewImportFixes(program, importingFile,
|
|
149883
149973
|
/*position*/ undefined,
|
|
149884
149974
|
/*isValidTypeOnlyUseSite*/ false,
|
|
149885
149975
|
/*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
|
|
149886
|
-
var result = getBestFix(fixes, importingFile, program,
|
|
149976
|
+
var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host));
|
|
149887
149977
|
return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
|
|
149888
149978
|
}
|
|
149889
149979
|
codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
|
|
@@ -150017,7 +150107,7 @@ var ts;
|
|
|
150017
150107
|
var importKind = getImportKind(importingFile, exportKind, compilerOptions);
|
|
150018
150108
|
return ts.mapDefined(importingFile.imports, function (moduleSpecifier) {
|
|
150019
150109
|
var i = ts.importFromModuleSpecifier(moduleSpecifier);
|
|
150020
|
-
if (ts.
|
|
150110
|
+
if (ts.isVariableDeclarationInitializedToRequire(i.parent)) {
|
|
150021
150111
|
return checker.resolveExternalModuleName(moduleSpecifier) === moduleSymbol ? { declaration: i.parent, importKind: importKind, symbol: symbol, targetFlags: targetFlags } : undefined;
|
|
150022
150112
|
}
|
|
150023
150113
|
if (i.kind === 265 /* ImportDeclaration */ || i.kind === 264 /* ImportEqualsDeclaration */) {
|
|
@@ -150103,23 +150193,22 @@ var ts;
|
|
|
150103
150193
|
var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
|
|
150104
150194
|
? getFixesInfoForUMDImport(context, symbolToken)
|
|
150105
150195
|
: ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
|
|
150106
|
-
|
|
150196
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
|
|
150197
|
+
return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
|
|
150107
150198
|
}
|
|
150108
|
-
function sortFixes(fixes, sourceFile, program,
|
|
150109
|
-
|
|
150110
|
-
return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, allowsImportingSpecifier); });
|
|
150199
|
+
function sortFixes(fixes, sourceFile, program, packageJsonImportFilter) {
|
|
150200
|
+
return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier); });
|
|
150111
150201
|
}
|
|
150112
|
-
function getBestFix(fixes, sourceFile, program,
|
|
150202
|
+
function getBestFix(fixes, sourceFile, program, packageJsonImportFilter) {
|
|
150113
150203
|
if (!ts.some(fixes))
|
|
150114
150204
|
return;
|
|
150115
150205
|
// These will always be placed first if available, and are better than other kinds
|
|
150116
150206
|
if (fixes[0].kind === 0 /* UseNamespace */ || fixes[0].kind === 2 /* AddToExisting */) {
|
|
150117
150207
|
return fixes[0];
|
|
150118
150208
|
}
|
|
150119
|
-
var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
|
|
150120
150209
|
return fixes.reduce(function (best, fix) {
|
|
150121
150210
|
// Takes true branch of conditional if `fix` is better than `best`
|
|
150122
|
-
return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
|
|
150211
|
+
return compareModuleSpecifiers(fix, best, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
|
|
150123
150212
|
});
|
|
150124
150213
|
}
|
|
150125
150214
|
/** @returns `Comparison.LessThan` if `a` is better than `b`. */
|
|
@@ -150743,7 +150832,7 @@ var ts;
|
|
|
150743
150832
|
var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
150744
150833
|
codefix.registerCodeFix({
|
|
150745
150834
|
errorCodes: errorCodes,
|
|
150746
|
-
getCodeActions: function (context) {
|
|
150835
|
+
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
150747
150836
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
150748
150837
|
var diagnostic;
|
|
150749
150838
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
@@ -150758,7 +150847,8 @@ var ts;
|
|
|
150758
150847
|
});
|
|
150759
150848
|
function doChange(changes, sourceFile, pos, checker) {
|
|
150760
150849
|
var token = ts.getTokenAtPosition(sourceFile, pos);
|
|
150761
|
-
ts.
|
|
150850
|
+
if (!ts.isThis(token))
|
|
150851
|
+
return undefined;
|
|
150762
150852
|
var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
|
|
150763
150853
|
if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
|
|
150764
150854
|
return undefined;
|
|
@@ -152568,6 +152658,9 @@ var ts;
|
|
|
152568
152658
|
codefix.registerCodeFix({
|
|
152569
152659
|
errorCodes: errorCodes,
|
|
152570
152660
|
getCodeActions: function (context) {
|
|
152661
|
+
var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
152662
|
+
if (syntacticDiagnostics.length)
|
|
152663
|
+
return;
|
|
152571
152664
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
|
|
152572
152665
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
|
|
152573
152666
|
},
|
|
@@ -152971,7 +153064,7 @@ var ts;
|
|
|
152971
153064
|
});
|
|
152972
153065
|
var name = declaration && ts.getNameOfDeclaration(declaration);
|
|
152973
153066
|
return !name || changes.length === 0 ? undefined
|
|
152974
|
-
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token),
|
|
153067
|
+
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getTextOfNode(name)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
|
|
152975
153068
|
},
|
|
152976
153069
|
fixIds: [fixId],
|
|
152977
153070
|
getAllCodeActions: function (context) {
|
|
@@ -153049,7 +153142,7 @@ var ts;
|
|
|
153049
153142
|
case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
|
153050
153143
|
var symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
|
153051
153144
|
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
|
|
153052
|
-
annotateVariableDeclaration(changes, importAdder,
|
|
153145
|
+
annotateVariableDeclaration(changes, importAdder, ts.getSourceFileOfNode(symbol.valueDeclaration), symbol.valueDeclaration, program, host, cancellationToken);
|
|
153053
153146
|
importAdder.writeFixes(changes);
|
|
153054
153147
|
return symbol.valueDeclaration;
|
|
153055
153148
|
}
|
|
@@ -161203,6 +161296,7 @@ var ts;
|
|
|
161203
161296
|
], false);
|
|
161204
161297
|
function createLanguageService(host, documentRegistry, syntaxOnlyOrLanguageServiceMode) {
|
|
161205
161298
|
var _a;
|
|
161299
|
+
var _b;
|
|
161206
161300
|
if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); }
|
|
161207
161301
|
var languageServiceMode;
|
|
161208
161302
|
if (syntaxOnlyOrLanguageServiceMode === undefined) {
|
|
@@ -161223,10 +161317,8 @@ var ts;
|
|
|
161223
161317
|
? new CancellationTokenObject(host.getCancellationToken())
|
|
161224
161318
|
: NoopCancellationToken;
|
|
161225
161319
|
var currentDirectory = host.getCurrentDirectory();
|
|
161226
|
-
//
|
|
161227
|
-
|
|
161228
|
-
ts.setLocalizedDiagnosticMessages(host.getLocalizedDiagnosticMessages());
|
|
161229
|
-
}
|
|
161320
|
+
// Checks if the localized messages json is set, and if not, query the host for it
|
|
161321
|
+
ts.maybeSetLocalizedDiagnosticMessages((_b = host.getLocalizedDiagnosticMessages) === null || _b === void 0 ? void 0 : _b.bind(host));
|
|
161230
161322
|
function log(message) {
|
|
161231
161323
|
if (host.log) {
|
|
161232
161324
|
host.log(message);
|
|
@@ -161328,6 +161420,7 @@ var ts;
|
|
|
161328
161420
|
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
|
|
161329
161421
|
trace: parseConfigHost.trace,
|
|
161330
161422
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
161423
|
+
getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
|
|
161331
161424
|
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
161332
161425
|
useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
161333
161426
|
getParsedCommandLine: getParsedCommandLine,
|
|
@@ -165541,6 +165634,9 @@ var ts;
|
|
|
165541
165634
|
Project.prototype.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
165542
165635
|
return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile);
|
|
165543
165636
|
};
|
|
165637
|
+
Project.prototype.getModuleResolutionCache = function () {
|
|
165638
|
+
return this.resolutionCache.getModuleResolutionCache();
|
|
165639
|
+
};
|
|
165544
165640
|
Project.prototype.getResolvedModuleWithFailedLookupLocationsFromCache = function (moduleName, containingFile, resolutionMode) {
|
|
165545
165641
|
return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode);
|
|
165546
165642
|
};
|
|
@@ -166803,6 +166899,7 @@ var ts;
|
|
|
166803
166899
|
if (!program) {
|
|
166804
166900
|
return ts.emptyArray;
|
|
166805
166901
|
}
|
|
166902
|
+
var start = ts.timestamp();
|
|
166806
166903
|
var dependencyNames;
|
|
166807
166904
|
var rootNames;
|
|
166808
166905
|
var rootFileName = ts.combinePaths(hostProject.currentDirectory, ts.inferredTypesContainingFile);
|
|
@@ -166812,14 +166909,14 @@ var ts;
|
|
|
166812
166909
|
(_a = packageJson.dependencies) === null || _a === void 0 ? void 0 : _a.forEach(function (_, dependenyName) { return addDependency(dependenyName); });
|
|
166813
166910
|
(_b = packageJson.peerDependencies) === null || _b === void 0 ? void 0 : _b.forEach(function (_, dependencyName) { return addDependency(dependencyName); });
|
|
166814
166911
|
}
|
|
166912
|
+
var dependenciesAdded = 0;
|
|
166815
166913
|
if (dependencyNames) {
|
|
166816
|
-
var dependenciesAdded = 0;
|
|
166817
166914
|
var symlinkCache = hostProject.getSymlinkCache();
|
|
166818
166915
|
for (var _c = 0, _d = ts.arrayFrom(dependencyNames.keys()); _c < _d.length; _c++) {
|
|
166819
166916
|
var name = _d[_c];
|
|
166820
166917
|
// Avoid creating a large project that would significantly slow down time to editor interactivity
|
|
166821
166918
|
if (dependencySelection === 2 /* Auto */ && dependenciesAdded > this.maxDependencies) {
|
|
166822
|
-
hostProject.log("
|
|
166919
|
+
hostProject.log("AutoImportProviderProject: attempted to add more than " + this.maxDependencies + " dependencies. Aborting.");
|
|
166823
166920
|
return ts.emptyArray;
|
|
166824
166921
|
}
|
|
166825
166922
|
// 1. Try to load from the implementation package. For many dependencies, the
|
|
@@ -166853,6 +166950,9 @@ var ts;
|
|
|
166853
166950
|
}
|
|
166854
166951
|
}
|
|
166855
166952
|
}
|
|
166953
|
+
if (rootNames === null || rootNames === void 0 ? void 0 : rootNames.length) {
|
|
166954
|
+
hostProject.log("AutoImportProviderProject: found " + rootNames.length + " root files in " + dependenciesAdded + " dependencies in " + (ts.timestamp() - start) + " ms");
|
|
166955
|
+
}
|
|
166856
166956
|
return rootNames || ts.emptyArray;
|
|
166857
166957
|
function addDependency(dependency) {
|
|
166858
166958
|
if (!ts.startsWith(dependency, "@types/")) {
|
|
@@ -166953,6 +167053,11 @@ var ts;
|
|
|
166953
167053
|
return this.hostProject.getSymlinkCache();
|
|
166954
167054
|
};
|
|
166955
167055
|
/*@internal*/
|
|
167056
|
+
AutoImportProviderProject.prototype.getModuleResolutionCache = function () {
|
|
167057
|
+
var _a;
|
|
167058
|
+
return (_a = this.hostProject.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getModuleResolutionCache();
|
|
167059
|
+
};
|
|
167060
|
+
/*@internal*/
|
|
166956
167061
|
AutoImportProviderProject.maxDependencies = 10;
|
|
166957
167062
|
/*@internal*/
|
|
166958
167063
|
AutoImportProviderProject.compilerOptionsOverrides = {
|