typescript 4.6.0-dev.20220119 → 4.6.0-dev.20220120
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 +1 -1
- package/lib/tsc.js +58 -28
- package/lib/tsserver.js +77 -41
- package/lib/tsserverlibrary.js +77 -41
- package/lib/typescript.js +77 -41
- package/lib/typescriptServices.js +77 -41
- package/lib/typingsInstaller.js +63 -28
- package/package.json +1 -1
package/lib/typescript.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.20220120";
|
|
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),
|
|
@@ -9279,7 +9284,7 @@ var ts;
|
|
|
9279
9284
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9280
9285
|
_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
9286
|
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
9282
|
-
|
|
9287
|
+
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
9288
|
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
9289
|
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
9290
|
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 +16057,7 @@ var ts;
|
|
|
16052
16057
|
}
|
|
16053
16058
|
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
|
|
16054
16059
|
function getExternalModuleRequireArgument(node) {
|
|
16055
|
-
return
|
|
16060
|
+
return isVariableDeclarationInitializedToBareOrAccessedRequire(node) && getLeftmostAccessExpression(node.initializer).arguments[0];
|
|
16056
16061
|
}
|
|
16057
16062
|
ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument;
|
|
16058
16063
|
function isInternalModuleImportEqualsDeclaration(node) {
|
|
@@ -16110,17 +16115,29 @@ var ts;
|
|
|
16110
16115
|
* Returns true if the node is a VariableDeclaration initialized to a require call (see `isRequireCall`).
|
|
16111
16116
|
* This function does not test if the node is in a JavaScript file or not.
|
|
16112
16117
|
*/
|
|
16113
|
-
function
|
|
16118
|
+
function isVariableDeclarationInitializedToRequire(node) {
|
|
16119
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, /*allowAccessedRequire*/ false);
|
|
16120
|
+
}
|
|
16121
|
+
ts.isVariableDeclarationInitializedToRequire = isVariableDeclarationInitializedToRequire;
|
|
16122
|
+
/**
|
|
16123
|
+
* Like {@link isVariableDeclarationInitializedToRequire} but allows things like `require("...").foo.bar` or `require("...")["baz"]`.
|
|
16124
|
+
*/
|
|
16125
|
+
function isVariableDeclarationInitializedToBareOrAccessedRequire(node) {
|
|
16126
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, /*allowAccessedRequire*/ true);
|
|
16127
|
+
}
|
|
16128
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
16129
|
+
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
16114
16130
|
if (node.kind === 202 /* BindingElement */) {
|
|
16115
16131
|
node = node.parent.parent;
|
|
16116
16132
|
}
|
|
16117
|
-
return ts.isVariableDeclaration(node) &&
|
|
16133
|
+
return ts.isVariableDeclaration(node) &&
|
|
16134
|
+
!!node.initializer &&
|
|
16135
|
+
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
|
|
16118
16136
|
}
|
|
16119
|
-
ts.isRequireVariableDeclaration = isRequireVariableDeclaration;
|
|
16120
16137
|
function isRequireVariableStatement(node) {
|
|
16121
16138
|
return ts.isVariableStatement(node)
|
|
16122
16139
|
&& node.declarationList.declarations.length > 0
|
|
16123
|
-
&& ts.every(node.declarationList.declarations, function (decl) { return
|
|
16140
|
+
&& ts.every(node.declarationList.declarations, function (decl) { return isVariableDeclarationInitializedToRequire(decl); });
|
|
16124
16141
|
}
|
|
16125
16142
|
ts.isRequireVariableStatement = isRequireVariableStatement;
|
|
16126
16143
|
function isSingleOrDoubleQuote(charCode) {
|
|
@@ -19607,7 +19624,7 @@ var ts;
|
|
|
19607
19624
|
getSourceMapSourceConstructor: function () { return SourceMapSource; },
|
|
19608
19625
|
};
|
|
19609
19626
|
function setObjectAllocator(alloc) {
|
|
19610
|
-
ts.objectAllocator
|
|
19627
|
+
Object.assign(ts.objectAllocator, alloc);
|
|
19611
19628
|
}
|
|
19612
19629
|
ts.setObjectAllocator = setObjectAllocator;
|
|
19613
19630
|
function formatStringFromArgs(text, args, baseIndex) {
|
|
@@ -19615,13 +19632,22 @@ var ts;
|
|
|
19615
19632
|
return text.replace(/{(\d+)}/g, function (_match, index) { return "" + ts.Debug.checkDefined(args[+index + baseIndex]); });
|
|
19616
19633
|
}
|
|
19617
19634
|
ts.formatStringFromArgs = formatStringFromArgs;
|
|
19635
|
+
var localizedDiagnosticMessages;
|
|
19618
19636
|
/* @internal */
|
|
19619
19637
|
function setLocalizedDiagnosticMessages(messages) {
|
|
19620
|
-
|
|
19638
|
+
localizedDiagnosticMessages = messages;
|
|
19621
19639
|
}
|
|
19622
19640
|
ts.setLocalizedDiagnosticMessages = setLocalizedDiagnosticMessages;
|
|
19641
|
+
/* @internal */
|
|
19642
|
+
// If the localized messages json is unset, and if given function use it to set the json
|
|
19643
|
+
function maybeSetLocalizedDiagnosticMessages(getMessages) {
|
|
19644
|
+
if (!localizedDiagnosticMessages && getMessages) {
|
|
19645
|
+
localizedDiagnosticMessages = getMessages();
|
|
19646
|
+
}
|
|
19647
|
+
}
|
|
19648
|
+
ts.maybeSetLocalizedDiagnosticMessages = maybeSetLocalizedDiagnosticMessages;
|
|
19623
19649
|
function getLocaleSpecificMessage(message) {
|
|
19624
|
-
return
|
|
19650
|
+
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
|
|
19625
19651
|
}
|
|
19626
19652
|
ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
|
|
19627
19653
|
function createDetachedDiagnostic(fileName, start, length, message) {
|
|
@@ -35230,7 +35256,7 @@ var ts;
|
|
|
35230
35256
|
// one out no matter what.
|
|
35231
35257
|
var finallyBlock;
|
|
35232
35258
|
if (!catchClause || token() === 96 /* FinallyKeyword */) {
|
|
35233
|
-
parseExpected(96 /* FinallyKeyword
|
|
35259
|
+
parseExpected(96 /* FinallyKeyword */, ts.Diagnostics.catch_or_finally_expected);
|
|
35234
35260
|
finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
|
|
35235
35261
|
}
|
|
35236
35262
|
return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc);
|
|
@@ -46442,7 +46468,7 @@ var ts;
|
|
|
46442
46468
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
46443
46469
|
}
|
|
46444
46470
|
if (!ts.isBindingPattern(node.name)) {
|
|
46445
|
-
if (ts.isInJSFile(node) && ts.
|
|
46471
|
+
if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node)) {
|
|
46446
46472
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
46447
46473
|
}
|
|
46448
46474
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -49225,7 +49251,7 @@ var ts;
|
|
|
49225
49251
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
49226
49252
|
|| node.kind === 295 /* ShorthandPropertyAssignment */
|
|
49227
49253
|
|| node.kind === 294 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
|
|
49228
|
-
|| ts.
|
|
49254
|
+
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
49229
49255
|
}
|
|
49230
49256
|
function isAliasableOrJsExpression(e) {
|
|
49231
49257
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -80784,7 +80810,7 @@ var ts;
|
|
|
80784
80810
|
}
|
|
80785
80811
|
// For a commonjs `const x = require`, validate the alias and exit
|
|
80786
80812
|
var symbol = getSymbolOfNode(node);
|
|
80787
|
-
if (symbol.flags & 2097152 /* Alias */ && ts.
|
|
80813
|
+
if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
80788
80814
|
checkAliasSymbol(node);
|
|
80789
80815
|
return;
|
|
80790
80816
|
}
|
|
@@ -120477,22 +120503,31 @@ var ts;
|
|
|
120477
120503
|
ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
120478
120504
|
}
|
|
120479
120505
|
ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
|
|
120506
|
+
function prettyPathForFileError(error, cwd) {
|
|
120507
|
+
var line = ts.formatColorAndReset(":" + error.line, ts.ForegroundColorEscapeSequences.Grey);
|
|
120508
|
+
if (ts.pathIsAbsolute(error.fileName) && ts.pathIsAbsolute(cwd)) {
|
|
120509
|
+
return ts.getRelativePathFromDirectory(cwd, error.fileName, /* ignoreCase */ false) + line;
|
|
120510
|
+
}
|
|
120511
|
+
return error.fileName + line;
|
|
120512
|
+
}
|
|
120480
120513
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
120481
120514
|
if (errorCount === 0)
|
|
120482
120515
|
return "";
|
|
120483
120516
|
var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
|
|
120484
120517
|
var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
|
|
120485
120518
|
.filter(function (value, index, self) { return self.indexOf(value) === index; });
|
|
120519
|
+
var firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
120486
120520
|
var d = errorCount === 1 ?
|
|
120487
120521
|
ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
|
|
120488
120522
|
ts.Diagnostics.Found_1_error_in_1 :
|
|
120489
|
-
ts.Diagnostics.Found_1_error, errorCount,
|
|
120523
|
+
ts.Diagnostics.Found_1_error, errorCount, firstFileReference) :
|
|
120490
120524
|
ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
|
|
120491
120525
|
ts.Diagnostics.Found_0_errors :
|
|
120492
120526
|
distinctFileNamesWithLines.length === 1 ?
|
|
120493
|
-
ts.Diagnostics.
|
|
120494
|
-
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
|
|
120495
|
-
|
|
120527
|
+
ts.Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 :
|
|
120528
|
+
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length);
|
|
120529
|
+
var suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
120530
|
+
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + suffix;
|
|
120496
120531
|
}
|
|
120497
120532
|
ts.getErrorSummaryText = getErrorSummaryText;
|
|
120498
120533
|
function createTabularErrorsDisplay(filesInError, host) {
|
|
@@ -120514,8 +120549,8 @@ var ts;
|
|
|
120514
120549
|
var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
|
|
120515
120550
|
" ".repeat(leftPaddingGoal - errorCountDigitsLength)
|
|
120516
120551
|
: "";
|
|
120517
|
-
var
|
|
120518
|
-
tabularData += "" + leftPadding + errorCount + " " +
|
|
120552
|
+
var fileRef = prettyPathForFileError(file, host.getCurrentDirectory());
|
|
120553
|
+
tabularData += "" + leftPadding + errorCount + " " + fileRef + "\n";
|
|
120519
120554
|
});
|
|
120520
120555
|
return tabularData;
|
|
120521
120556
|
}
|
|
@@ -125245,7 +125280,7 @@ var ts;
|
|
|
125245
125280
|
isWhiteSpaceOnlyJsxText(child);
|
|
125246
125281
|
if (lookInPreviousChild) {
|
|
125247
125282
|
// actual start of the node is past the position - previous token should be at the end of previous child
|
|
125248
|
-
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile);
|
|
125283
|
+
var candidate_1 = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ i, sourceFile, n.kind);
|
|
125249
125284
|
return candidate_1 && findRightmostToken(candidate_1, sourceFile);
|
|
125250
125285
|
}
|
|
125251
125286
|
else {
|
|
@@ -125259,7 +125294,7 @@ var ts;
|
|
|
125259
125294
|
// the only known case is when position is at the end of the file.
|
|
125260
125295
|
// Try to find the rightmost token in the file without filtering.
|
|
125261
125296
|
// Namely we are skipping the check: 'position < node.end'
|
|
125262
|
-
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile);
|
|
125297
|
+
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile, n.kind);
|
|
125263
125298
|
return candidate && findRightmostToken(candidate, sourceFile);
|
|
125264
125299
|
}
|
|
125265
125300
|
}
|
|
@@ -125275,17 +125310,19 @@ var ts;
|
|
|
125275
125310
|
if (children.length === 0) {
|
|
125276
125311
|
return n;
|
|
125277
125312
|
}
|
|
125278
|
-
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile);
|
|
125313
|
+
var candidate = findRightmostChildNodeWithTokens(children, /*exclusiveStartPosition*/ children.length, sourceFile, n.kind);
|
|
125279
125314
|
return candidate && findRightmostToken(candidate, sourceFile);
|
|
125280
125315
|
}
|
|
125281
125316
|
/**
|
|
125282
125317
|
* Finds the rightmost child to the left of `children[exclusiveStartPosition]` which is a non-all-whitespace token or has constituent tokens.
|
|
125283
125318
|
*/
|
|
125284
|
-
function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile) {
|
|
125319
|
+
function findRightmostChildNodeWithTokens(children, exclusiveStartPosition, sourceFile, parentKind) {
|
|
125285
125320
|
for (var i = exclusiveStartPosition - 1; i >= 0; i--) {
|
|
125286
125321
|
var child = children[i];
|
|
125287
125322
|
if (isWhiteSpaceOnlyJsxText(child)) {
|
|
125288
|
-
|
|
125323
|
+
if (i === 0 && (parentKind === 11 /* JsxText */ || parentKind === 278 /* JsxSelfClosingElement */)) {
|
|
125324
|
+
ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`");
|
|
125325
|
+
}
|
|
125289
125326
|
}
|
|
125290
125327
|
else if (nodeHasTokens(children[i], sourceFile)) {
|
|
125291
125328
|
return children[i];
|
|
@@ -133832,7 +133869,7 @@ var ts;
|
|
|
133832
133869
|
ts.Debug.assert(parent.name === node);
|
|
133833
133870
|
return true;
|
|
133834
133871
|
case 202 /* BindingElement */:
|
|
133835
|
-
return ts.isInJSFile(node) && ts.
|
|
133872
|
+
return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent);
|
|
133836
133873
|
default:
|
|
133837
133874
|
return false;
|
|
133838
133875
|
}
|
|
@@ -135232,7 +135269,7 @@ var ts;
|
|
|
135232
135269
|
// Use the parent symbol if the location is commonjs require syntax on javascript files only.
|
|
135233
135270
|
if (ts.isInJSFile(referenceLocation)
|
|
135234
135271
|
&& referenceLocation.parent.kind === 202 /* BindingElement */
|
|
135235
|
-
&& ts.
|
|
135272
|
+
&& ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent)) {
|
|
135236
135273
|
referenceSymbol = referenceLocation.parent.symbol;
|
|
135237
135274
|
// The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In
|
|
135238
135275
|
// this case, just skip it, since the bound identifiers are not an alias of the import.
|
|
@@ -136943,7 +136980,7 @@ var ts;
|
|
|
136943
136980
|
return declaration.parent.kind === 268 /* NamedImports */;
|
|
136944
136981
|
case 202 /* BindingElement */:
|
|
136945
136982
|
case 253 /* VariableDeclaration */:
|
|
136946
|
-
return ts.isInJSFile(declaration) && ts.
|
|
136983
|
+
return ts.isInJSFile(declaration) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(declaration);
|
|
136947
136984
|
default:
|
|
136948
136985
|
return false;
|
|
136949
136986
|
}
|
|
@@ -150034,7 +150071,7 @@ var ts;
|
|
|
150034
150071
|
var importKind = getImportKind(importingFile, exportKind, compilerOptions);
|
|
150035
150072
|
return ts.mapDefined(importingFile.imports, function (moduleSpecifier) {
|
|
150036
150073
|
var i = ts.importFromModuleSpecifier(moduleSpecifier);
|
|
150037
|
-
if (ts.
|
|
150074
|
+
if (ts.isVariableDeclarationInitializedToRequire(i.parent)) {
|
|
150038
150075
|
return checker.resolveExternalModuleName(moduleSpecifier) === moduleSymbol ? { declaration: i.parent, importKind: importKind, symbol: symbol, targetFlags: targetFlags } : undefined;
|
|
150039
150076
|
}
|
|
150040
150077
|
if (i.kind === 265 /* ImportDeclaration */ || i.kind === 264 /* ImportEqualsDeclaration */) {
|
|
@@ -161219,6 +161256,7 @@ var ts;
|
|
|
161219
161256
|
], false);
|
|
161220
161257
|
function createLanguageService(host, documentRegistry, syntaxOnlyOrLanguageServiceMode) {
|
|
161221
161258
|
var _a;
|
|
161259
|
+
var _b;
|
|
161222
161260
|
if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); }
|
|
161223
161261
|
var languageServiceMode;
|
|
161224
161262
|
if (syntaxOnlyOrLanguageServiceMode === undefined) {
|
|
@@ -161239,10 +161277,8 @@ var ts;
|
|
|
161239
161277
|
? new CancellationTokenObject(host.getCancellationToken())
|
|
161240
161278
|
: NoopCancellationToken;
|
|
161241
161279
|
var currentDirectory = host.getCurrentDirectory();
|
|
161242
|
-
//
|
|
161243
|
-
|
|
161244
|
-
ts.setLocalizedDiagnosticMessages(host.getLocalizedDiagnosticMessages());
|
|
161245
|
-
}
|
|
161280
|
+
// Checks if the localized messages json is set, and if not, query the host for it
|
|
161281
|
+
ts.maybeSetLocalizedDiagnosticMessages((_b = host.getLocalizedDiagnosticMessages) === null || _b === void 0 ? void 0 : _b.bind(host));
|
|
161246
161282
|
function log(message) {
|
|
161247
161283
|
if (host.log) {
|
|
161248
161284
|
host.log(message);
|