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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220122";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -6810,11 +6810,15 @@ var ts;
|
|
|
6810
6810
|
ts.getFileWatcherEventKind = getFileWatcherEventKind;
|
|
6811
6811
|
/*@internal*/
|
|
6812
6812
|
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
|
|
6813
|
+
var curSysLog = ts.noop; // eslint-disable-line prefer-const
|
|
6813
6814
|
/*@internal*/
|
|
6814
|
-
|
|
6815
|
+
function sysLog(s) {
|
|
6816
|
+
return curSysLog(s);
|
|
6817
|
+
}
|
|
6818
|
+
ts.sysLog = sysLog;
|
|
6815
6819
|
/*@internal*/
|
|
6816
6820
|
function setSysLog(logger) {
|
|
6817
|
-
|
|
6821
|
+
curSysLog = logger;
|
|
6818
6822
|
}
|
|
6819
6823
|
ts.setSysLog = setSysLog;
|
|
6820
6824
|
/**
|
|
@@ -6949,7 +6953,7 @@ var ts;
|
|
|
6949
6953
|
}
|
|
6950
6954
|
function onTimerToUpdateChildWatches() {
|
|
6951
6955
|
timerToUpdateChildWatches = undefined;
|
|
6952
|
-
|
|
6956
|
+
sysLog("sysLog:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size);
|
|
6953
6957
|
var start = ts.timestamp();
|
|
6954
6958
|
var invokeMap = new ts.Map();
|
|
6955
6959
|
while (!timerToUpdateChildWatches && cacheToUpdateChildWatches.size) {
|
|
@@ -6962,7 +6966,7 @@ var ts;
|
|
|
6962
6966
|
var hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
6963
6967
|
invokeCallbacks(dirPath, invokeMap, hasChanges ? undefined : fileNames);
|
|
6964
6968
|
}
|
|
6965
|
-
|
|
6969
|
+
sysLog("sysLog:: invokingWatchers:: Elapsed:: " + (ts.timestamp() - start) + "ms:: " + cacheToUpdateChildWatches.size);
|
|
6966
6970
|
callbackCache.forEach(function (callbacks, rootDirName) {
|
|
6967
6971
|
var existing = invokeMap.get(rootDirName);
|
|
6968
6972
|
if (existing) {
|
|
@@ -6978,7 +6982,7 @@ var ts;
|
|
|
6978
6982
|
}
|
|
6979
6983
|
});
|
|
6980
6984
|
var elapsed = ts.timestamp() - start;
|
|
6981
|
-
|
|
6985
|
+
sysLog("sysLog:: Elapsed:: " + elapsed + "ms:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size + " " + timerToUpdateChildWatches);
|
|
6982
6986
|
}
|
|
6983
6987
|
function removeChildWatches(parentWatcher) {
|
|
6984
6988
|
if (!parentWatcher)
|
|
@@ -7565,7 +7569,7 @@ var ts;
|
|
|
7565
7569
|
* @param createWatcher
|
|
7566
7570
|
*/
|
|
7567
7571
|
function invokeCallbackAndUpdateWatcher(createWatcher) {
|
|
7568
|
-
|
|
7572
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
|
|
7569
7573
|
// Call the callback for current directory
|
|
7570
7574
|
callback("rename", "");
|
|
7571
7575
|
// If watcher is not closed, update it
|
|
@@ -7590,7 +7594,7 @@ var ts;
|
|
|
7590
7594
|
}
|
|
7591
7595
|
}
|
|
7592
7596
|
if (hitSystemWatcherLimit) {
|
|
7593
|
-
|
|
7597
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
|
|
7594
7598
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
7595
7599
|
}
|
|
7596
7600
|
try {
|
|
@@ -7606,7 +7610,7 @@ var ts;
|
|
|
7606
7610
|
// 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
|
|
7607
7611
|
// so instead of throwing error, use fs.watchFile
|
|
7608
7612
|
hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
|
|
7609
|
-
|
|
7613
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
|
|
7610
7614
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
7611
7615
|
}
|
|
7612
7616
|
}
|
|
@@ -8205,6 +8209,7 @@ var ts;
|
|
|
8205
8209
|
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"),
|
|
8206
8210
|
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."),
|
|
8207
8211
|
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."),
|
|
8212
|
+
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
8208
8213
|
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."),
|
|
8209
8214
|
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."),
|
|
8210
8215
|
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),
|
|
@@ -8692,6 +8697,7 @@ var ts;
|
|
|
8692
8697
|
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."),
|
|
8693
8698
|
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}'?"),
|
|
8694
8699
|
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."),
|
|
8700
|
+
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."),
|
|
8695
8701
|
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}'."),
|
|
8696
8702
|
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}'."),
|
|
8697
8703
|
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}'."),
|
|
@@ -9085,7 +9091,7 @@ var ts;
|
|
|
9085
9091
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9086
9092
|
_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"),
|
|
9087
9093
|
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
9088
|
-
|
|
9094
|
+
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}"),
|
|
9089
9095
|
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
9090
9096
|
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."),
|
|
9091
9097
|
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}'."),
|
|
@@ -15858,7 +15864,7 @@ var ts;
|
|
|
15858
15864
|
}
|
|
15859
15865
|
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
|
|
15860
15866
|
function getExternalModuleRequireArgument(node) {
|
|
15861
|
-
return
|
|
15867
|
+
return isVariableDeclarationInitializedToBareOrAccessedRequire(node) && getLeftmostAccessExpression(node.initializer).arguments[0];
|
|
15862
15868
|
}
|
|
15863
15869
|
ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument;
|
|
15864
15870
|
function isInternalModuleImportEqualsDeclaration(node) {
|
|
@@ -15916,17 +15922,29 @@ var ts;
|
|
|
15916
15922
|
* Returns true if the node is a VariableDeclaration initialized to a require call (see `isRequireCall`).
|
|
15917
15923
|
* This function does not test if the node is in a JavaScript file or not.
|
|
15918
15924
|
*/
|
|
15919
|
-
function
|
|
15925
|
+
function isVariableDeclarationInitializedToRequire(node) {
|
|
15926
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, /*allowAccessedRequire*/ false);
|
|
15927
|
+
}
|
|
15928
|
+
ts.isVariableDeclarationInitializedToRequire = isVariableDeclarationInitializedToRequire;
|
|
15929
|
+
/**
|
|
15930
|
+
* Like {@link isVariableDeclarationInitializedToRequire} but allows things like `require("...").foo.bar` or `require("...")["baz"]`.
|
|
15931
|
+
*/
|
|
15932
|
+
function isVariableDeclarationInitializedToBareOrAccessedRequire(node) {
|
|
15933
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, /*allowAccessedRequire*/ true);
|
|
15934
|
+
}
|
|
15935
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
15936
|
+
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
15920
15937
|
if (node.kind === 202 /* BindingElement */) {
|
|
15921
15938
|
node = node.parent.parent;
|
|
15922
15939
|
}
|
|
15923
|
-
return ts.isVariableDeclaration(node) &&
|
|
15940
|
+
return ts.isVariableDeclaration(node) &&
|
|
15941
|
+
!!node.initializer &&
|
|
15942
|
+
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
|
|
15924
15943
|
}
|
|
15925
|
-
ts.isRequireVariableDeclaration = isRequireVariableDeclaration;
|
|
15926
15944
|
function isRequireVariableStatement(node) {
|
|
15927
15945
|
return ts.isVariableStatement(node)
|
|
15928
15946
|
&& node.declarationList.declarations.length > 0
|
|
15929
|
-
&& ts.every(node.declarationList.declarations, function (decl) { return
|
|
15947
|
+
&& ts.every(node.declarationList.declarations, function (decl) { return isVariableDeclarationInitializedToRequire(decl); });
|
|
15930
15948
|
}
|
|
15931
15949
|
ts.isRequireVariableStatement = isRequireVariableStatement;
|
|
15932
15950
|
function isSingleOrDoubleQuote(charCode) {
|
|
@@ -19413,7 +19431,7 @@ var ts;
|
|
|
19413
19431
|
getSourceMapSourceConstructor: function () { return SourceMapSource; },
|
|
19414
19432
|
};
|
|
19415
19433
|
function setObjectAllocator(alloc) {
|
|
19416
|
-
ts.objectAllocator
|
|
19434
|
+
Object.assign(ts.objectAllocator, alloc);
|
|
19417
19435
|
}
|
|
19418
19436
|
ts.setObjectAllocator = setObjectAllocator;
|
|
19419
19437
|
function formatStringFromArgs(text, args, baseIndex) {
|
|
@@ -19421,13 +19439,22 @@ var ts;
|
|
|
19421
19439
|
return text.replace(/{(\d+)}/g, function (_match, index) { return "" + ts.Debug.checkDefined(args[+index + baseIndex]); });
|
|
19422
19440
|
}
|
|
19423
19441
|
ts.formatStringFromArgs = formatStringFromArgs;
|
|
19442
|
+
var localizedDiagnosticMessages;
|
|
19424
19443
|
/* @internal */
|
|
19425
19444
|
function setLocalizedDiagnosticMessages(messages) {
|
|
19426
|
-
|
|
19445
|
+
localizedDiagnosticMessages = messages;
|
|
19427
19446
|
}
|
|
19428
19447
|
ts.setLocalizedDiagnosticMessages = setLocalizedDiagnosticMessages;
|
|
19448
|
+
/* @internal */
|
|
19449
|
+
// If the localized messages json is unset, and if given function use it to set the json
|
|
19450
|
+
function maybeSetLocalizedDiagnosticMessages(getMessages) {
|
|
19451
|
+
if (!localizedDiagnosticMessages && getMessages) {
|
|
19452
|
+
localizedDiagnosticMessages = getMessages();
|
|
19453
|
+
}
|
|
19454
|
+
}
|
|
19455
|
+
ts.maybeSetLocalizedDiagnosticMessages = maybeSetLocalizedDiagnosticMessages;
|
|
19429
19456
|
function getLocaleSpecificMessage(message) {
|
|
19430
|
-
return
|
|
19457
|
+
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
|
|
19431
19458
|
}
|
|
19432
19459
|
ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
|
|
19433
19460
|
function createDetachedDiagnostic(fileName, start, length, message) {
|
|
@@ -35036,7 +35063,7 @@ var ts;
|
|
|
35036
35063
|
// one out no matter what.
|
|
35037
35064
|
var finallyBlock;
|
|
35038
35065
|
if (!catchClause || token() === 96 /* FinallyKeyword */) {
|
|
35039
|
-
parseExpected(96 /* FinallyKeyword
|
|
35066
|
+
parseExpected(96 /* FinallyKeyword */, ts.Diagnostics.catch_or_finally_expected);
|
|
35040
35067
|
finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
|
|
35041
35068
|
}
|
|
35042
35069
|
return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc);
|
|
@@ -36080,7 +36107,7 @@ var ts;
|
|
|
36080
36107
|
var pos = getNodePos();
|
|
36081
36108
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
36082
36109
|
parseExpected(58 /* ColonToken */);
|
|
36083
|
-
var value =
|
|
36110
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
36084
36111
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
36085
36112
|
}
|
|
36086
36113
|
function parseAssertClause() {
|
|
@@ -44497,7 +44524,7 @@ var ts;
|
|
|
44497
44524
|
maybeBindExpressionFlowIfCall(node.expression);
|
|
44498
44525
|
}
|
|
44499
44526
|
function maybeBindExpressionFlowIfCall(node) {
|
|
44500
|
-
// A top level or
|
|
44527
|
+
// A top level or comma expression call expression with a dotted function name and at least one argument
|
|
44501
44528
|
// is potentially an assertion and is therefore included in the control flow.
|
|
44502
44529
|
if (node.kind === 207 /* CallExpression */) {
|
|
44503
44530
|
var call = node;
|
|
@@ -44665,22 +44692,27 @@ var ts;
|
|
|
44665
44692
|
}
|
|
44666
44693
|
return state;
|
|
44667
44694
|
}
|
|
44668
|
-
function onLeft(left, state,
|
|
44695
|
+
function onLeft(left, state, node) {
|
|
44669
44696
|
if (!state.skip) {
|
|
44670
|
-
|
|
44697
|
+
var maybeBound = maybeBind(left);
|
|
44698
|
+
if (node.operatorToken.kind === 27 /* CommaToken */) {
|
|
44699
|
+
maybeBindExpressionFlowIfCall(left);
|
|
44700
|
+
}
|
|
44701
|
+
return maybeBound;
|
|
44671
44702
|
}
|
|
44672
44703
|
}
|
|
44673
|
-
function onOperator(operatorToken, state,
|
|
44704
|
+
function onOperator(operatorToken, state, _node) {
|
|
44674
44705
|
if (!state.skip) {
|
|
44675
|
-
if (operatorToken.kind === 27 /* CommaToken */) {
|
|
44676
|
-
maybeBindExpressionFlowIfCall(node.left);
|
|
44677
|
-
}
|
|
44678
44706
|
bind(operatorToken);
|
|
44679
44707
|
}
|
|
44680
44708
|
}
|
|
44681
|
-
function onRight(right, state,
|
|
44709
|
+
function onRight(right, state, node) {
|
|
44682
44710
|
if (!state.skip) {
|
|
44683
|
-
|
|
44711
|
+
var maybeBound = maybeBind(right);
|
|
44712
|
+
if (node.operatorToken.kind === 27 /* CommaToken */) {
|
|
44713
|
+
maybeBindExpressionFlowIfCall(right);
|
|
44714
|
+
}
|
|
44715
|
+
return maybeBound;
|
|
44684
44716
|
}
|
|
44685
44717
|
}
|
|
44686
44718
|
function onExit(node, state) {
|
|
@@ -45423,6 +45455,8 @@ var ts;
|
|
|
45423
45455
|
return;
|
|
45424
45456
|
}
|
|
45425
45457
|
ts.setParent(node, parent);
|
|
45458
|
+
if (ts.tracing)
|
|
45459
|
+
node.tracingPath = file.path;
|
|
45426
45460
|
var saveInStrictMode = inStrictMode;
|
|
45427
45461
|
// Even though in the AST the jsdoc @typedef node belongs to the current node,
|
|
45428
45462
|
// its symbol might be in the same scope with the current node's symbol. Consider:
|
|
@@ -46243,7 +46277,7 @@ var ts;
|
|
|
46243
46277
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
46244
46278
|
}
|
|
46245
46279
|
if (!ts.isBindingPattern(node.name)) {
|
|
46246
|
-
if (ts.isInJSFile(node) && ts.
|
|
46280
|
+
if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node)) {
|
|
46247
46281
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
46248
46282
|
}
|
|
46249
46283
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -46754,6 +46788,9 @@ var ts;
|
|
|
46754
46788
|
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
|
|
46755
46789
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
46756
46790
|
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
46791
|
+
// Masks
|
|
46792
|
+
TypeFacts[TypeFacts["OrFactsMask"] = 8288] = "OrFactsMask";
|
|
46793
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 16768927] = "AndFactsMask";
|
|
46757
46794
|
})(TypeFacts || (TypeFacts = {}));
|
|
46758
46795
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
46759
46796
|
string: 1 /* TypeofEQString */,
|
|
@@ -49026,7 +49063,7 @@ var ts;
|
|
|
49026
49063
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
49027
49064
|
|| node.kind === 295 /* ShorthandPropertyAssignment */
|
|
49028
49065
|
|| node.kind === 294 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
|
|
49029
|
-
|| ts.
|
|
49066
|
+
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
49030
49067
|
}
|
|
49031
49068
|
function isAliasableOrJsExpression(e) {
|
|
49032
49069
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -49814,8 +49851,14 @@ var ts;
|
|
|
49814
49851
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49815
49852
|
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49816
49853
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49817
|
-
var sourceFile = resolvedModule
|
|
49854
|
+
var sourceFile = resolvedModule
|
|
49855
|
+
&& (!resolutionDiagnostic || resolutionDiagnostic === ts.Diagnostics.Module_0_was_resolved_to_1_but_jsx_is_not_set)
|
|
49856
|
+
&& host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49818
49857
|
if (sourceFile) {
|
|
49858
|
+
// If there's a resolutionDiagnostic we need to report it even if a sourceFile is found.
|
|
49859
|
+
if (resolutionDiagnostic) {
|
|
49860
|
+
error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName);
|
|
49861
|
+
}
|
|
49819
49862
|
if (sourceFile.symbol) {
|
|
49820
49863
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
49821
49864
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
@@ -50957,6 +51000,7 @@ var ts;
|
|
|
50957
51000
|
getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function () { return host.getCommonSourceDirectory(); } : function () { return ""; },
|
|
50958
51001
|
getCurrentDirectory: function () { return host.getCurrentDirectory(); },
|
|
50959
51002
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
|
|
51003
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host); },
|
|
50960
51004
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
50961
51005
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
50962
51006
|
getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
|
|
@@ -67888,10 +67932,23 @@ var ts;
|
|
|
67888
67932
|
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
67889
67933
|
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
67890
67934
|
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
67891
|
-
return
|
|
67935
|
+
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
67892
67936
|
}
|
|
67893
67937
|
return 16777215 /* All */;
|
|
67894
67938
|
}
|
|
67939
|
+
function getIntersectionTypeFacts(type, ignoreObjects) {
|
|
67940
|
+
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
67941
|
+
// and others are computed as `or`.
|
|
67942
|
+
var oredFacts = 0 /* None */;
|
|
67943
|
+
var andedFacts = 16777215 /* All */;
|
|
67944
|
+
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
67945
|
+
var t = _a[_i];
|
|
67946
|
+
var f = getTypeFacts(t, ignoreObjects);
|
|
67947
|
+
oredFacts |= f;
|
|
67948
|
+
andedFacts &= f;
|
|
67949
|
+
}
|
|
67950
|
+
return oredFacts & 8288 /* OrFactsMask */ | andedFacts & 16768927 /* AndFactsMask */;
|
|
67951
|
+
}
|
|
67895
67952
|
function getTypeWithFacts(type, include) {
|
|
67896
67953
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
67897
67954
|
}
|
|
@@ -77903,7 +77960,7 @@ var ts;
|
|
|
77903
77960
|
}
|
|
77904
77961
|
}
|
|
77905
77962
|
function checkExpression(node, checkMode, forceTuple) {
|
|
77906
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end });
|
|
77963
|
+
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 });
|
|
77907
77964
|
var saveCurrentNode = currentNode;
|
|
77908
77965
|
currentNode = node;
|
|
77909
77966
|
instantiationCount = 0;
|
|
@@ -80584,7 +80641,7 @@ var ts;
|
|
|
80584
80641
|
}
|
|
80585
80642
|
// For a commonjs `const x = require`, validate the alias and exit
|
|
80586
80643
|
var symbol = getSymbolOfNode(node);
|
|
80587
|
-
if (symbol.flags & 2097152 /* Alias */ && ts.
|
|
80644
|
+
if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
80588
80645
|
checkAliasSymbol(node);
|
|
80589
80646
|
return;
|
|
80590
80647
|
}
|
|
@@ -80662,7 +80719,7 @@ var ts;
|
|
|
80662
80719
|
return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags);
|
|
80663
80720
|
}
|
|
80664
80721
|
function checkVariableDeclaration(node) {
|
|
80665
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end });
|
|
80722
|
+
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 });
|
|
80666
80723
|
checkGrammarVariableDeclaration(node);
|
|
80667
80724
|
checkVariableLikeDeclaration(node);
|
|
80668
80725
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -83052,6 +83109,17 @@ var ts;
|
|
|
83052
83109
|
return false;
|
|
83053
83110
|
}
|
|
83054
83111
|
}
|
|
83112
|
+
if (!ts.isImportEqualsDeclaration(node) && node.assertClause) {
|
|
83113
|
+
var hasError = false;
|
|
83114
|
+
for (var _i = 0, _a = node.assertClause.elements; _i < _a.length; _i++) {
|
|
83115
|
+
var clause = _a[_i];
|
|
83116
|
+
if (!ts.isStringLiteral(clause.value)) {
|
|
83117
|
+
hasError = true;
|
|
83118
|
+
error(clause.value, ts.Diagnostics.Import_assertion_values_must_be_string_literal_expressions);
|
|
83119
|
+
}
|
|
83120
|
+
}
|
|
83121
|
+
return !hasError;
|
|
83122
|
+
}
|
|
83055
83123
|
return true;
|
|
83056
83124
|
}
|
|
83057
83125
|
function checkAliasSymbol(node) {
|
|
@@ -83745,7 +83813,7 @@ var ts;
|
|
|
83745
83813
|
}
|
|
83746
83814
|
}
|
|
83747
83815
|
function checkDeferredNode(node) {
|
|
83748
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("check" /* Check */, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end });
|
|
83816
|
+
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 });
|
|
83749
83817
|
var saveCurrentNode = currentNode;
|
|
83750
83818
|
currentNode = node;
|
|
83751
83819
|
instantiationCount = 0;
|
|
@@ -87679,7 +87747,7 @@ var ts;
|
|
|
87679
87747
|
return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine);
|
|
87680
87748
|
case 293 /* AssertEntry */:
|
|
87681
87749
|
ts.Debug.type(node);
|
|
87682
|
-
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.
|
|
87750
|
+
return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode));
|
|
87683
87751
|
case 266 /* ImportClause */:
|
|
87684
87752
|
ts.Debug.type(node);
|
|
87685
87753
|
return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings));
|
|
@@ -95529,10 +95597,19 @@ var ts;
|
|
|
95529
95597
|
var _a;
|
|
95530
95598
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95531
95599
|
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
95532
|
-
var args = [tagName, objectProperties
|
|
95600
|
+
var args = [tagName, objectProperties];
|
|
95601
|
+
// function jsx(type, config, maybeKey) {}
|
|
95602
|
+
// "maybeKey" is optional. It is acceptable to use "_jsx" without a third argument
|
|
95603
|
+
if (keyAttr) {
|
|
95604
|
+
args.push(transformJsxAttributeInitializer(keyAttr.initializer));
|
|
95605
|
+
}
|
|
95533
95606
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
95534
95607
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
95535
95608
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
95609
|
+
// "maybeKey" has to be replaced with "void 0" to not break the jsxDEV signature
|
|
95610
|
+
if (keyAttr === undefined) {
|
|
95611
|
+
args.push(factory.createVoidZero());
|
|
95612
|
+
}
|
|
95536
95613
|
// isStaticChildren development flag
|
|
95537
95614
|
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
95538
95615
|
// __source development flag
|
|
@@ -119397,11 +119474,12 @@ var ts;
|
|
|
119397
119474
|
};
|
|
119398
119475
|
}
|
|
119399
119476
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
119477
|
+
var _a;
|
|
119400
119478
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
|
|
119401
119479
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
119402
119480
|
return false;
|
|
119403
119481
|
}
|
|
119404
|
-
return ts.getImpliedNodeFormatForFile(importingSourceFileName,
|
|
119482
|
+
return ts.getImpliedNodeFormatForFile(importingSourceFileName, (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host), getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
|
|
119405
119483
|
}
|
|
119406
119484
|
function getModuleResolutionHost(host) {
|
|
119407
119485
|
var _a;
|
|
@@ -119961,11 +120039,13 @@ var ts;
|
|
|
119961
120039
|
// For classic resolution, only allow importing from node_modules/@types, not other node_modules
|
|
119962
120040
|
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
|
|
119963
120041
|
function tryDirectoryWithPackageJson(packageRootIndex) {
|
|
120042
|
+
var _a, _b;
|
|
119964
120043
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
119965
120044
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
119966
120045
|
var moduleFileToTry = path;
|
|
119967
|
-
|
|
119968
|
-
|
|
120046
|
+
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
120047
|
+
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
120048
|
+
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
119969
120049
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
119970
120050
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
119971
120051
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
@@ -120265,22 +120345,31 @@ var ts;
|
|
|
120265
120345
|
ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
120266
120346
|
}
|
|
120267
120347
|
ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
|
|
120348
|
+
function prettyPathForFileError(error, cwd) {
|
|
120349
|
+
var line = ts.formatColorAndReset(":" + error.line, ts.ForegroundColorEscapeSequences.Grey);
|
|
120350
|
+
if (ts.pathIsAbsolute(error.fileName) && ts.pathIsAbsolute(cwd)) {
|
|
120351
|
+
return ts.getRelativePathFromDirectory(cwd, error.fileName, /* ignoreCase */ false) + line;
|
|
120352
|
+
}
|
|
120353
|
+
return error.fileName + line;
|
|
120354
|
+
}
|
|
120268
120355
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
120269
120356
|
if (errorCount === 0)
|
|
120270
120357
|
return "";
|
|
120271
120358
|
var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
|
|
120272
120359
|
var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
|
|
120273
120360
|
.filter(function (value, index, self) { return self.indexOf(value) === index; });
|
|
120361
|
+
var firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
120274
120362
|
var d = errorCount === 1 ?
|
|
120275
120363
|
ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
|
|
120276
120364
|
ts.Diagnostics.Found_1_error_in_1 :
|
|
120277
|
-
ts.Diagnostics.Found_1_error, errorCount,
|
|
120365
|
+
ts.Diagnostics.Found_1_error, errorCount, firstFileReference) :
|
|
120278
120366
|
ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
|
|
120279
120367
|
ts.Diagnostics.Found_0_errors :
|
|
120280
120368
|
distinctFileNamesWithLines.length === 1 ?
|
|
120281
|
-
ts.Diagnostics.
|
|
120282
|
-
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
|
|
120283
|
-
|
|
120369
|
+
ts.Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 :
|
|
120370
|
+
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length);
|
|
120371
|
+
var suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
120372
|
+
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + suffix;
|
|
120284
120373
|
}
|
|
120285
120374
|
ts.getErrorSummaryText = getErrorSummaryText;
|
|
120286
120375
|
function createTabularErrorsDisplay(filesInError, host) {
|
|
@@ -120302,8 +120391,8 @@ var ts;
|
|
|
120302
120391
|
var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
|
|
120303
120392
|
" ".repeat(leftPaddingGoal - errorCountDigitsLength)
|
|
120304
120393
|
: "";
|
|
120305
|
-
var
|
|
120306
|
-
tabularData += "" + leftPadding + errorCount + " " +
|
|
120394
|
+
var fileRef = prettyPathForFileError(file, host.getCurrentDirectory());
|
|
120395
|
+
tabularData += "" + leftPadding + errorCount + " " + fileRef + "\n";
|
|
120307
120396
|
});
|
|
120308
120397
|
return tabularData;
|
|
120309
120398
|
}
|
|
@@ -120804,6 +120893,7 @@ var ts;
|
|
|
120804
120893
|
var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects
|
|
120805
120894
|
var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
|
|
120806
120895
|
var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
|
|
120896
|
+
var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
|
|
120807
120897
|
var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info
|
|
120808
120898
|
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
|
|
120809
120899
|
var hasChangedCompilerOptions = false; // True if the compiler options have changed between compilations
|
|
@@ -120966,14 +121056,21 @@ var ts;
|
|
|
120966
121056
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
|
|
120967
121057
|
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
120968
121058
|
if (hasChangedConfigFileParsingErrors) {
|
|
121059
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
121060
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
121061
|
+
}
|
|
120969
121062
|
builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
120970
121063
|
hasChangedConfigFileParsingErrors = false;
|
|
120971
121064
|
}
|
|
120972
121065
|
}
|
|
120973
121066
|
else {
|
|
121067
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
121068
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
121069
|
+
}
|
|
120974
121070
|
createNewProgram(hasInvalidatedResolution);
|
|
120975
121071
|
}
|
|
120976
121072
|
changesAffectResolution = false; // reset for next sync
|
|
121073
|
+
reportFileChangeDetectedOnCreateProgram = false;
|
|
120977
121074
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
120978
121075
|
host.afterProgramCreate(builderProgram);
|
|
120979
121076
|
}
|
|
@@ -121175,7 +121272,7 @@ var ts;
|
|
|
121175
121272
|
}
|
|
121176
121273
|
function updateProgramWithWatchStatus() {
|
|
121177
121274
|
timerToUpdateProgram = undefined;
|
|
121178
|
-
|
|
121275
|
+
reportFileChangeDetectedOnCreateProgram = true;
|
|
121179
121276
|
updateProgram();
|
|
121180
121277
|
}
|
|
121181
121278
|
function updateProgram() {
|
|
@@ -123282,6 +123379,7 @@ var ts;
|
|
|
123282
123379
|
ScriptElementKind["externalModuleName"] = "external module name";
|
|
123283
123380
|
/**
|
|
123284
123381
|
* <JsxTagName attribute1 attribute2={0} />
|
|
123382
|
+
* @deprecated
|
|
123285
123383
|
*/
|
|
123286
123384
|
ScriptElementKind["jsxAttribute"] = "JSX attribute";
|
|
123287
123385
|
/** String literal */
|
|
@@ -124607,7 +124705,7 @@ var ts;
|
|
|
124607
124705
|
isWhiteSpaceOnlyJsxText(child);
|
|
124608
124706
|
if (lookInPreviousChild) {
|
|
124609
124707
|
// actual start of the node is past the position - previous token should be at the end of previous child
|
|
124610
|
-
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
|
|
124708
|
+
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile, n.kind);
|
|
124611
124709
|
return candidate_1 && findRightmostToken(candidate_1, sourceFile);
|
|
124612
124710
|
}
|
|
124613
124711
|
else {
|
|
@@ -124621,7 +124719,7 @@ var ts;
|
|
|
124621
124719
|
// the only known case is when position is at the end of the file.
|
|
124622
124720
|
// Try to find the rightmost token in the file without filtering.
|
|
124623
124721
|
// Namely we are skipping the check: 'position < node.end'
|
|
124624
|
-
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile);
|
|
124722
|
+
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile, n.kind);
|
|
124625
124723
|
return candidate && findRightmostToken(candidate, sourceFile);
|
|
124626
124724
|
}
|
|
124627
124725
|
}
|
|
@@ -124637,17 +124735,19 @@ var ts;
|
|
|
124637
124735
|
if (children.length === 0) {
|
|
124638
124736
|
return n;
|
|
124639
124737
|
}
|
|
124640
|
-
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile);
|
|
124738
|
+
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile, n.kind);
|
|
124641
124739
|
return candidate && findRightmostToken(candidate, sourceFile);
|
|
124642
124740
|
}
|
|
124643
124741
|
/**
|
|
124644
124742
|
* Finds the rightmost child to the left of `children[exclusiveStartPosition]` which is a non-all-whitespace token or has constituent tokens.
|
|
124645
124743
|
*/
|
|
124646
|
-
function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile) {
|
|
124744
|
+
function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile, parentKind) {
|
|
124647
124745
|
for (var i = exclusiveStartPosition - 1; i >= 0; i--) {
|
|
124648
124746
|
var child = children[i];
|
|
124649
124747
|
if (isWhiteSpaceOnlyJsxText(child)) {
|
|
124650
|
-
|
|
124748
|
+
if (i === 0 && (parentKind === 11 /* JsxText */ || parentKind === 278 /* JsxSelfClosingElement */)) {
|
|
124749
|
+
ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`");
|
|
124750
|
+
}
|
|
124651
124751
|
}
|
|
124652
124752
|
else if (nodeHasTokens(children[i], sourceFile)) {
|
|
124653
124753
|
return children[i];
|
|
@@ -125173,6 +125273,7 @@ var ts;
|
|
|
125173
125273
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
125174
125274
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache,
|
|
125175
125275
|
getModuleSpecifierCache: ts.maybeBind(host, host.getModuleSpecifierCache),
|
|
125276
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = program.getModuleResolutionCache()) === null || _a === void 0 ? void 0 : _a.getPackageJsonInfoCache(); },
|
|
125176
125277
|
getGlobalTypingsCacheLocation: ts.maybeBind(host, host.getGlobalTypingsCacheLocation),
|
|
125177
125278
|
redirectTargetsMap: program.redirectTargetsMap,
|
|
125178
125279
|
getProjectReferenceRedirect: function (fileName) { return program.getProjectReferenceRedirect(fileName); },
|
|
@@ -128917,6 +129018,7 @@ var ts;
|
|
|
128917
129018
|
function resolvingModuleSpecifiers(logPrefix, host, program, sourceFile, preferences, isForImportStatementCompletion, cb) {
|
|
128918
129019
|
var _a, _b, _c;
|
|
128919
129020
|
var start = ts.timestamp();
|
|
129021
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
128920
129022
|
var resolutionLimitExceeded = false;
|
|
128921
129023
|
var ambientCount = 0;
|
|
128922
129024
|
var resolvedCount = 0;
|
|
@@ -128939,7 +129041,7 @@ var ts;
|
|
|
128939
129041
|
var shouldResolveModuleSpecifier = isForImportStatementCompletion || preferences.allowIncompleteCompletions && resolvedCount < Completions.moduleSpecifierResolutionLimit;
|
|
128940
129042
|
var shouldGetModuleSpecifierFromCache = !shouldResolveModuleSpecifier && preferences.allowIncompleteCompletions && cacheAttemptCount < Completions.moduleSpecifierResolutionCacheAttemptLimit;
|
|
128941
129043
|
var result = (shouldResolveModuleSpecifier || shouldGetModuleSpecifierFromCache)
|
|
128942
|
-
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, shouldGetModuleSpecifierFromCache)
|
|
129044
|
+
? ts.codefix.getModuleSpecifierForBestExportInfo(exportInfo, sourceFile, program, host, preferences, packageJsonImportFilter, shouldGetModuleSpecifierFromCache)
|
|
128943
129045
|
: undefined;
|
|
128944
129046
|
if (!shouldResolveModuleSpecifier && !shouldGetModuleSpecifierFromCache || shouldGetModuleSpecifierFromCache && !result) {
|
|
128945
129047
|
resolutionLimitExceeded = true;
|
|
@@ -130337,9 +130439,7 @@ var ts;
|
|
|
130337
130439
|
// GH#39946. Pulling on the type of a node inside of a function with a contextual `this` parameter can result in a circularity
|
|
130338
130440
|
// if the `node` is part of the exprssion of a `yield` or `return`. This circularity doesn't exist at compile time because
|
|
130339
130441
|
// we will check (and cache) the type of `this` *before* checking the type of the node.
|
|
130340
|
-
|
|
130341
|
-
if (!ts.isSourceFile(container) && container.parent)
|
|
130342
|
-
typeChecker.getTypeAtLocation(container);
|
|
130442
|
+
typeChecker.tryGetThisTypeAt(node, /*includeGlobalThis*/ false);
|
|
130343
130443
|
var type = typeChecker.getTypeAtLocation(node).getNonOptionalType();
|
|
130344
130444
|
var insertQuestionDot = false;
|
|
130345
130445
|
if (type.isNullableType()) {
|
|
@@ -133194,7 +133294,7 @@ var ts;
|
|
|
133194
133294
|
ts.Debug.assert(parent.name === node);
|
|
133195
133295
|
return true;
|
|
133196
133296
|
case 202 /* BindingElement */:
|
|
133197
|
-
return ts.isInJSFile(node) && ts.
|
|
133297
|
+
return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent);
|
|
133198
133298
|
default:
|
|
133199
133299
|
return false;
|
|
133200
133300
|
}
|
|
@@ -133675,7 +133775,7 @@ var ts;
|
|
|
133675
133775
|
function getTextSpan(node, sourceFile, endNode) {
|
|
133676
133776
|
var start = node.getStart(sourceFile);
|
|
133677
133777
|
var end = (endNode || node).getEnd();
|
|
133678
|
-
if (ts.isStringLiteralLike(node)) {
|
|
133778
|
+
if (ts.isStringLiteralLike(node) && (end - start) > 2) {
|
|
133679
133779
|
ts.Debug.assert(endNode === undefined);
|
|
133680
133780
|
start += 1;
|
|
133681
133781
|
end -= 1;
|
|
@@ -134594,7 +134694,7 @@ var ts;
|
|
|
134594
134694
|
// Use the parent symbol if the location is commonjs require syntax on javascript files only.
|
|
134595
134695
|
if (ts.isInJSFile(referenceLocation)
|
|
134596
134696
|
&& referenceLocation.parent.kind === 202 /* BindingElement */
|
|
134597
|
-
&& ts.
|
|
134697
|
+
&& ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent)) {
|
|
134598
134698
|
referenceSymbol = referenceLocation.parent.symbol;
|
|
134599
134699
|
// The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In
|
|
134600
134700
|
// this case, just skip it, since the bound identifiers are not an alias of the import.
|
|
@@ -136195,7 +136295,7 @@ var ts;
|
|
|
136195
136295
|
return file && { reference: libReferenceDirective, fileName: file.fileName, file: file, unverified: false };
|
|
136196
136296
|
}
|
|
136197
136297
|
if ((_a = sourceFile.resolvedModules) === null || _a === void 0 ? void 0 : _a.size()) {
|
|
136198
|
-
var node = ts.
|
|
136298
|
+
var node = ts.getTouchingToken(sourceFile, position);
|
|
136199
136299
|
if (ts.isModuleSpecifierLike(node) && ts.isExternalModuleNameRelative(node.text) && sourceFile.resolvedModules.has(node.text, ts.getModeForUsageLocation(sourceFile, node))) {
|
|
136200
136300
|
var verifiedFileName = (_b = sourceFile.resolvedModules.get(node.text, ts.getModeForUsageLocation(sourceFile, node))) === null || _b === void 0 ? void 0 : _b.resolvedFileName;
|
|
136201
136301
|
var fileName = verifiedFileName || ts.resolvePath(ts.getDirectoryPath(sourceFile.fileName), node.text);
|
|
@@ -136305,7 +136405,7 @@ var ts;
|
|
|
136305
136405
|
return declaration.parent.kind === 268 /* NamedImports */;
|
|
136306
136406
|
case 202 /* BindingElement */:
|
|
136307
136407
|
case 253 /* VariableDeclaration */:
|
|
136308
|
-
return ts.isInJSFile(declaration) && ts.
|
|
136408
|
+
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
136309
136409
|
default:
|
|
136310
136410
|
return false;
|
|
136311
136411
|
}
|
|
@@ -136995,7 +137095,7 @@ var ts;
|
|
|
136995
137095
|
textSpan: ts.createTextSpanFromNode(declaration),
|
|
136996
137096
|
// TODO(jfreeman): What should be the containerName when the container has a computed name?
|
|
136997
137097
|
containerName: containerName ? containerName.text : "",
|
|
136998
|
-
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
137098
|
+
containerKind: containerName ? ts.getNodeKind(container) : "" /* unknown */,
|
|
136999
137099
|
};
|
|
137000
137100
|
}
|
|
137001
137101
|
})(NavigateTo = ts.NavigateTo || (ts.NavigateTo = {}));
|
|
@@ -141209,18 +141309,7 @@ var ts;
|
|
|
141209
141309
|
}
|
|
141210
141310
|
return unionPropertyKind;
|
|
141211
141311
|
}
|
|
141212
|
-
|
|
141213
|
-
switch (location.parent && location.parent.kind) {
|
|
141214
|
-
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
|
|
141215
|
-
case 279 /* JsxOpeningElement */:
|
|
141216
|
-
case 277 /* JsxElement */:
|
|
141217
|
-
case 278 /* JsxSelfClosingElement */:
|
|
141218
|
-
return location.kind === 79 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
|
|
141219
|
-
case 284 /* JsxAttribute */:
|
|
141220
|
-
return "JSX attribute" /* jsxAttribute */;
|
|
141221
|
-
default:
|
|
141222
|
-
return "property" /* memberVariableElement */;
|
|
141223
|
-
}
|
|
141312
|
+
return "property" /* memberVariableElement */;
|
|
141224
141313
|
}
|
|
141225
141314
|
return "" /* unknown */;
|
|
141226
141315
|
}
|
|
@@ -149212,7 +149301,8 @@ var ts;
|
|
|
149212
149301
|
codefix.getImportCompletionAction = getImportCompletionAction;
|
|
149213
149302
|
function getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, symbolName, program, position, isValidTypeOnlyUseSite, useRequire, host, preferences) {
|
|
149214
149303
|
ts.Debug.assert(exportInfos.some(function (info) { return info.moduleSymbol === moduleSymbol || info.symbol.parent === moduleSymbol; }), "Some exportInfo should match the specified moduleSymbol");
|
|
149215
|
-
|
|
149304
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(sourceFile, preferences, host);
|
|
149305
|
+
return getBestFix(getImportFixes(exportInfos, symbolName, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences), sourceFile, program, packageJsonImportFilter);
|
|
149216
149306
|
}
|
|
149217
149307
|
function codeFixActionToCodeAction(_a) {
|
|
149218
149308
|
var description = _a.description, changes = _a.changes, commands = _a.commands;
|
|
@@ -149267,12 +149357,12 @@ var ts;
|
|
|
149267
149357
|
return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host));
|
|
149268
149358
|
}
|
|
149269
149359
|
}
|
|
149270
|
-
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, fromCacheOnly) {
|
|
149360
|
+
function getModuleSpecifierForBestExportInfo(exportInfo, importingFile, program, host, preferences, packageJsonImportFilter, fromCacheOnly) {
|
|
149271
149361
|
var _a = getNewImportFixes(program, importingFile,
|
|
149272
149362
|
/*position*/ undefined,
|
|
149273
149363
|
/*isValidTypeOnlyUseSite*/ false,
|
|
149274
149364
|
/*useRequire*/ false, exportInfo, host, preferences, fromCacheOnly), fixes = _a.fixes, computedWithoutCacheCount = _a.computedWithoutCacheCount;
|
|
149275
|
-
var result = getBestFix(fixes, importingFile, program,
|
|
149365
|
+
var result = getBestFix(fixes, importingFile, program, packageJsonImportFilter || ts.createPackageJsonImportFilter(importingFile, preferences, host));
|
|
149276
149366
|
return result && __assign(__assign({}, result), { computedWithoutCacheCount: computedWithoutCacheCount });
|
|
149277
149367
|
}
|
|
149278
149368
|
codefix.getModuleSpecifierForBestExportInfo = getModuleSpecifierForBestExportInfo;
|
|
@@ -149406,7 +149496,7 @@ var ts;
|
|
|
149406
149496
|
var importKind = getImportKind(importingFile, exportKind, compilerOptions);
|
|
149407
149497
|
return ts.mapDefined(importingFile.imports, function (moduleSpecifier) {
|
|
149408
149498
|
var i = ts.importFromModuleSpecifier(moduleSpecifier);
|
|
149409
|
-
if (ts.
|
|
149499
|
+
if (ts.isVariableDeclarationInitializedToRequire(i.parent)) {
|
|
149410
149500
|
return checker.resolveExternalModuleName(moduleSpecifier) === moduleSymbol ? { declaration: i.parent, importKind: importKind, symbol: symbol, targetFlags: targetFlags } : undefined;
|
|
149411
149501
|
}
|
|
149412
149502
|
if (i.kind === 265 /* ImportDeclaration */ || i.kind === 264 /* ImportEqualsDeclaration */) {
|
|
@@ -149492,23 +149582,22 @@ var ts;
|
|
|
149492
149582
|
var info = errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code
|
|
149493
149583
|
? getFixesInfoForUMDImport(context, symbolToken)
|
|
149494
149584
|
: ts.isIdentifier(symbolToken) ? getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider) : undefined;
|
|
149495
|
-
|
|
149585
|
+
var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host);
|
|
149586
|
+
return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter) });
|
|
149496
149587
|
}
|
|
149497
|
-
function sortFixes(fixes, sourceFile, program,
|
|
149498
|
-
|
|
149499
|
-
return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, allowsImportingSpecifier); });
|
|
149588
|
+
function sortFixes(fixes, sourceFile, program, packageJsonImportFilter) {
|
|
149589
|
+
return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier); });
|
|
149500
149590
|
}
|
|
149501
|
-
function getBestFix(fixes, sourceFile, program,
|
|
149591
|
+
function getBestFix(fixes, sourceFile, program, packageJsonImportFilter) {
|
|
149502
149592
|
if (!ts.some(fixes))
|
|
149503
149593
|
return;
|
|
149504
149594
|
// These will always be placed first if available, and are better than other kinds
|
|
149505
149595
|
if (fixes[0].kind === 0 /* UseNamespace */ || fixes[0].kind === 2 /* AddToExisting */) {
|
|
149506
149596
|
return fixes[0];
|
|
149507
149597
|
}
|
|
149508
|
-
var allowsImportingSpecifier = ts.createPackageJsonImportFilter(sourceFile, preferences, host).allowsImportingSpecifier;
|
|
149509
149598
|
return fixes.reduce(function (best, fix) {
|
|
149510
149599
|
// Takes true branch of conditional if `fix` is better than `best`
|
|
149511
|
-
return compareModuleSpecifiers(fix, best, sourceFile, program, allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
|
|
149600
|
+
return compareModuleSpecifiers(fix, best, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier) === -1 /* LessThan */ ? fix : best;
|
|
149512
149601
|
});
|
|
149513
149602
|
}
|
|
149514
149603
|
/** @returns `Comparison.LessThan` if `a` is better than `b`. */
|
|
@@ -150132,7 +150221,7 @@ var ts;
|
|
|
150132
150221
|
var errorCodes = [ts.Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
150133
150222
|
codefix.registerCodeFix({
|
|
150134
150223
|
errorCodes: errorCodes,
|
|
150135
|
-
getCodeActions: function (context) {
|
|
150224
|
+
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
150136
150225
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
150137
150226
|
var diagnostic;
|
|
150138
150227
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
@@ -150147,7 +150236,8 @@ var ts;
|
|
|
150147
150236
|
});
|
|
150148
150237
|
function doChange(changes, sourceFile, pos, checker) {
|
|
150149
150238
|
var token = ts.getTokenAtPosition(sourceFile, pos);
|
|
150150
|
-
ts.
|
|
150239
|
+
if (!ts.isThis(token))
|
|
150240
|
+
return undefined;
|
|
150151
150241
|
var fn = ts.getThisContainer(token, /*includeArrowFunctions*/ false);
|
|
150152
150242
|
if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
|
|
150153
150243
|
return undefined;
|
|
@@ -151957,6 +152047,9 @@ var ts;
|
|
|
151957
152047
|
codefix.registerCodeFix({
|
|
151958
152048
|
errorCodes: errorCodes,
|
|
151959
152049
|
getCodeActions: function (context) {
|
|
152050
|
+
var syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
152051
|
+
if (syntacticDiagnostics.length)
|
|
152052
|
+
return;
|
|
151960
152053
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, context.span.start, context.span.length, context.errorCode); });
|
|
151961
152054
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unreachable_code, fixId, ts.Diagnostics.Remove_all_unreachable_code)];
|
|
151962
152055
|
},
|
|
@@ -152360,7 +152453,7 @@ var ts;
|
|
|
152360
152453
|
});
|
|
152361
152454
|
var name = declaration && ts.getNameOfDeclaration(declaration);
|
|
152362
152455
|
return !name || changes.length === 0 ? undefined
|
|
152363
|
-
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token),
|
|
152456
|
+
: [codefix.createCodeFixAction(fixId, changes, [getDiagnostic(errorCode, token), ts.getTextOfNode(name)], fixId, ts.Diagnostics.Infer_all_types_from_usage)];
|
|
152364
152457
|
},
|
|
152365
152458
|
fixIds: [fixId],
|
|
152366
152459
|
getAllCodeActions: function (context) {
|
|
@@ -152438,7 +152531,7 @@ var ts;
|
|
|
152438
152531
|
case ts.Diagnostics.Variable_0_implicitly_has_an_1_type.code: {
|
|
152439
152532
|
var symbol = program.getTypeChecker().getSymbolAtLocation(token);
|
|
152440
152533
|
if (symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && markSeen(symbol.valueDeclaration)) {
|
|
152441
|
-
annotateVariableDeclaration(changes, importAdder,
|
|
152534
|
+
annotateVariableDeclaration(changes, importAdder, ts.getSourceFileOfNode(symbol.valueDeclaration), symbol.valueDeclaration, program, host, cancellationToken);
|
|
152442
152535
|
importAdder.writeFixes(changes);
|
|
152443
152536
|
return symbol.valueDeclaration;
|
|
152444
152537
|
}
|
|
@@ -160592,6 +160685,7 @@ var ts;
|
|
|
160592
160685
|
], false);
|
|
160593
160686
|
function createLanguageService(host, documentRegistry, syntaxOnlyOrLanguageServiceMode) {
|
|
160594
160687
|
var _a;
|
|
160688
|
+
var _b;
|
|
160595
160689
|
if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); }
|
|
160596
160690
|
var languageServiceMode;
|
|
160597
160691
|
if (syntaxOnlyOrLanguageServiceMode === undefined) {
|
|
@@ -160612,10 +160706,8 @@ var ts;
|
|
|
160612
160706
|
? new CancellationTokenObject(host.getCancellationToken())
|
|
160613
160707
|
: NoopCancellationToken;
|
|
160614
160708
|
var currentDirectory = host.getCurrentDirectory();
|
|
160615
|
-
//
|
|
160616
|
-
|
|
160617
|
-
ts.setLocalizedDiagnosticMessages(host.getLocalizedDiagnosticMessages());
|
|
160618
|
-
}
|
|
160709
|
+
// Checks if the localized messages json is set, and if not, query the host for it
|
|
160710
|
+
ts.maybeSetLocalizedDiagnosticMessages((_b = host.getLocalizedDiagnosticMessages) === null || _b === void 0 ? void 0 : _b.bind(host));
|
|
160619
160711
|
function log(message) {
|
|
160620
160712
|
if (host.log) {
|
|
160621
160713
|
host.log(message);
|
|
@@ -160717,6 +160809,7 @@ var ts;
|
|
|
160717
160809
|
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
|
|
160718
160810
|
trace: parseConfigHost.trace,
|
|
160719
160811
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
160812
|
+
getModuleResolutionCache: ts.maybeBind(host, host.getModuleResolutionCache),
|
|
160720
160813
|
resolveTypeReferenceDirectives: ts.maybeBind(host, host.resolveTypeReferenceDirectives),
|
|
160721
160814
|
useSourceOfProjectReferenceRedirect: ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect),
|
|
160722
160815
|
getParsedCommandLine: getParsedCommandLine,
|
|
@@ -165347,6 +165440,9 @@ var ts;
|
|
|
165347
165440
|
Project.prototype.resolveModuleNames = function (moduleNames, containingFile, reusedNames, redirectedReference, _options, containingSourceFile) {
|
|
165348
165441
|
return this.resolutionCache.resolveModuleNames(moduleNames, containingFile, reusedNames, redirectedReference, containingSourceFile);
|
|
165349
165442
|
};
|
|
165443
|
+
Project.prototype.getModuleResolutionCache = function () {
|
|
165444
|
+
return this.resolutionCache.getModuleResolutionCache();
|
|
165445
|
+
};
|
|
165350
165446
|
Project.prototype.getResolvedModuleWithFailedLookupLocationsFromCache = function (moduleName, containingFile, resolutionMode) {
|
|
165351
165447
|
return this.resolutionCache.getResolvedModuleWithFailedLookupLocationsFromCache(moduleName, containingFile, resolutionMode);
|
|
165352
165448
|
};
|
|
@@ -166609,6 +166705,7 @@ var ts;
|
|
|
166609
166705
|
if (!program) {
|
|
166610
166706
|
return ts.emptyArray;
|
|
166611
166707
|
}
|
|
166708
|
+
var start = ts.timestamp();
|
|
166612
166709
|
var dependencyNames;
|
|
166613
166710
|
var rootNames;
|
|
166614
166711
|
var rootFileName = ts.combinePaths(hostProject.currentDirectory, ts.inferredTypesContainingFile);
|
|
@@ -166618,14 +166715,14 @@ var ts;
|
|
|
166618
166715
|
(_a = packageJson.dependencies) === null || _a === void 0 ? void 0 : _a.forEach(function (_, dependenyName) { return addDependency(dependenyName); });
|
|
166619
166716
|
(_b = packageJson.peerDependencies) === null || _b === void 0 ? void 0 : _b.forEach(function (_, dependencyName) { return addDependency(dependencyName); });
|
|
166620
166717
|
}
|
|
166718
|
+
var dependenciesAdded = 0;
|
|
166621
166719
|
if (dependencyNames) {
|
|
166622
|
-
var dependenciesAdded = 0;
|
|
166623
166720
|
var symlinkCache = hostProject.getSymlinkCache();
|
|
166624
166721
|
for (var _c = 0, _d = ts.arrayFrom(dependencyNames.keys()); _c < _d.length; _c++) {
|
|
166625
166722
|
var name = _d[_c];
|
|
166626
166723
|
// Avoid creating a large project that would significantly slow down time to editor interactivity
|
|
166627
166724
|
if (dependencySelection === 2 /* Auto */ && dependenciesAdded > this.maxDependencies) {
|
|
166628
|
-
hostProject.log("
|
|
166725
|
+
hostProject.log("AutoImportProviderProject: attempted to add more than " + this.maxDependencies + " dependencies. Aborting.");
|
|
166629
166726
|
return ts.emptyArray;
|
|
166630
166727
|
}
|
|
166631
166728
|
// 1. Try to load from the implementation package. For many dependencies, the
|
|
@@ -166659,6 +166756,9 @@ var ts;
|
|
|
166659
166756
|
}
|
|
166660
166757
|
}
|
|
166661
166758
|
}
|
|
166759
|
+
if (rootNames === null || rootNames === void 0 ? void 0 : rootNames.length) {
|
|
166760
|
+
hostProject.log("AutoImportProviderProject: found " + rootNames.length + " root files in " + dependenciesAdded + " dependencies in " + (ts.timestamp() - start) + " ms");
|
|
166761
|
+
}
|
|
166662
166762
|
return rootNames || ts.emptyArray;
|
|
166663
166763
|
function addDependency(dependency) {
|
|
166664
166764
|
if (!ts.startsWith(dependency, "@types/")) {
|
|
@@ -166759,6 +166859,11 @@ var ts;
|
|
|
166759
166859
|
return this.hostProject.getSymlinkCache();
|
|
166760
166860
|
};
|
|
166761
166861
|
/*@internal*/
|
|
166862
|
+
AutoImportProviderProject.prototype.getModuleResolutionCache = function () {
|
|
166863
|
+
var _a;
|
|
166864
|
+
return (_a = this.hostProject.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getModuleResolutionCache();
|
|
166865
|
+
};
|
|
166866
|
+
/*@internal*/
|
|
166762
166867
|
AutoImportProviderProject.maxDependencies = 10;
|
|
166763
166868
|
/*@internal*/
|
|
166764
166869
|
AutoImportProviderProject.compilerOptionsOverrides = {
|