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
|
@@ -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);
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220120";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -6799,11 +6799,15 @@ var ts;
|
|
|
6799
6799
|
ts.getFileWatcherEventKind = getFileWatcherEventKind;
|
|
6800
6800
|
/*@internal*/
|
|
6801
6801
|
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
|
|
6802
|
+
var curSysLog = ts.noop; // eslint-disable-line prefer-const
|
|
6802
6803
|
/*@internal*/
|
|
6803
|
-
|
|
6804
|
+
function sysLog(s) {
|
|
6805
|
+
return curSysLog(s);
|
|
6806
|
+
}
|
|
6807
|
+
ts.sysLog = sysLog;
|
|
6804
6808
|
/*@internal*/
|
|
6805
6809
|
function setSysLog(logger) {
|
|
6806
|
-
|
|
6810
|
+
curSysLog = logger;
|
|
6807
6811
|
}
|
|
6808
6812
|
ts.setSysLog = setSysLog;
|
|
6809
6813
|
/**
|
|
@@ -6938,7 +6942,7 @@ var ts;
|
|
|
6938
6942
|
}
|
|
6939
6943
|
function onTimerToUpdateChildWatches() {
|
|
6940
6944
|
timerToUpdateChildWatches = undefined;
|
|
6941
|
-
|
|
6945
|
+
sysLog("sysLog:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size);
|
|
6942
6946
|
var start = ts.timestamp();
|
|
6943
6947
|
var invokeMap = new ts.Map();
|
|
6944
6948
|
while (!timerToUpdateChildWatches && cacheToUpdateChildWatches.size) {
|
|
@@ -6951,7 +6955,7 @@ var ts;
|
|
|
6951
6955
|
var hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
6952
6956
|
invokeCallbacks(dirPath, invokeMap, hasChanges ? undefined : fileNames);
|
|
6953
6957
|
}
|
|
6954
|
-
|
|
6958
|
+
sysLog("sysLog:: invokingWatchers:: Elapsed:: " + (ts.timestamp() - start) + "ms:: " + cacheToUpdateChildWatches.size);
|
|
6955
6959
|
callbackCache.forEach(function (callbacks, rootDirName) {
|
|
6956
6960
|
var existing = invokeMap.get(rootDirName);
|
|
6957
6961
|
if (existing) {
|
|
@@ -6967,7 +6971,7 @@ var ts;
|
|
|
6967
6971
|
}
|
|
6968
6972
|
});
|
|
6969
6973
|
var elapsed = ts.timestamp() - start;
|
|
6970
|
-
|
|
6974
|
+
sysLog("sysLog:: Elapsed:: " + elapsed + "ms:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size + " " + timerToUpdateChildWatches);
|
|
6971
6975
|
}
|
|
6972
6976
|
function removeChildWatches(parentWatcher) {
|
|
6973
6977
|
if (!parentWatcher)
|
|
@@ -7554,7 +7558,7 @@ var ts;
|
|
|
7554
7558
|
* @param createWatcher
|
|
7555
7559
|
*/
|
|
7556
7560
|
function invokeCallbackAndUpdateWatcher(createWatcher) {
|
|
7557
|
-
|
|
7561
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
|
|
7558
7562
|
// Call the callback for current directory
|
|
7559
7563
|
callback("rename", "");
|
|
7560
7564
|
// If watcher is not closed, update it
|
|
@@ -7579,7 +7583,7 @@ var ts;
|
|
|
7579
7583
|
}
|
|
7580
7584
|
}
|
|
7581
7585
|
if (hitSystemWatcherLimit) {
|
|
7582
|
-
|
|
7586
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
|
|
7583
7587
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
7584
7588
|
}
|
|
7585
7589
|
try {
|
|
@@ -7595,7 +7599,7 @@ var ts;
|
|
|
7595
7599
|
// 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
|
|
7596
7600
|
// so instead of throwing error, use fs.watchFile
|
|
7597
7601
|
hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
|
|
7598
|
-
|
|
7602
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
|
|
7599
7603
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
7600
7604
|
}
|
|
7601
7605
|
}
|
|
@@ -8194,6 +8198,7 @@ var ts;
|
|
|
8194
8198
|
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"),
|
|
8195
8199
|
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."),
|
|
8196
8200
|
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."),
|
|
8201
|
+
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
8197
8202
|
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."),
|
|
8198
8203
|
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."),
|
|
8199
8204
|
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),
|
|
@@ -9074,7 +9079,7 @@ var ts;
|
|
|
9074
9079
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
9075
9080
|
_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"),
|
|
9076
9081
|
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
9077
|
-
|
|
9082
|
+
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}"),
|
|
9078
9083
|
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
9079
9084
|
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."),
|
|
9080
9085
|
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}'."),
|
|
@@ -15847,7 +15852,7 @@ var ts;
|
|
|
15847
15852
|
}
|
|
15848
15853
|
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
|
|
15849
15854
|
function getExternalModuleRequireArgument(node) {
|
|
15850
|
-
return
|
|
15855
|
+
return isVariableDeclarationInitializedToBareOrAccessedRequire(node) && getLeftmostAccessExpression(node.initializer).arguments[0];
|
|
15851
15856
|
}
|
|
15852
15857
|
ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument;
|
|
15853
15858
|
function isInternalModuleImportEqualsDeclaration(node) {
|
|
@@ -15905,17 +15910,29 @@ var ts;
|
|
|
15905
15910
|
* Returns true if the node is a VariableDeclaration initialized to a require call (see `isRequireCall`).
|
|
15906
15911
|
* This function does not test if the node is in a JavaScript file or not.
|
|
15907
15912
|
*/
|
|
15908
|
-
function
|
|
15913
|
+
function isVariableDeclarationInitializedToRequire(node) {
|
|
15914
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, /*allowAccessedRequire*/ false);
|
|
15915
|
+
}
|
|
15916
|
+
ts.isVariableDeclarationInitializedToRequire = isVariableDeclarationInitializedToRequire;
|
|
15917
|
+
/**
|
|
15918
|
+
* Like {@link isVariableDeclarationInitializedToRequire} but allows things like `require("...").foo.bar` or `require("...")["baz"]`.
|
|
15919
|
+
*/
|
|
15920
|
+
function isVariableDeclarationInitializedToBareOrAccessedRequire(node) {
|
|
15921
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, /*allowAccessedRequire*/ true);
|
|
15922
|
+
}
|
|
15923
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
15924
|
+
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
15909
15925
|
if (node.kind === 202 /* BindingElement */) {
|
|
15910
15926
|
node = node.parent.parent;
|
|
15911
15927
|
}
|
|
15912
|
-
return ts.isVariableDeclaration(node) &&
|
|
15928
|
+
return ts.isVariableDeclaration(node) &&
|
|
15929
|
+
!!node.initializer &&
|
|
15930
|
+
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, /*requireStringLiteralLikeArgument*/ true);
|
|
15913
15931
|
}
|
|
15914
|
-
ts.isRequireVariableDeclaration = isRequireVariableDeclaration;
|
|
15915
15932
|
function isRequireVariableStatement(node) {
|
|
15916
15933
|
return ts.isVariableStatement(node)
|
|
15917
15934
|
&& node.declarationList.declarations.length > 0
|
|
15918
|
-
&& ts.every(node.declarationList.declarations, function (decl) { return
|
|
15935
|
+
&& ts.every(node.declarationList.declarations, function (decl) { return isVariableDeclarationInitializedToRequire(decl); });
|
|
15919
15936
|
}
|
|
15920
15937
|
ts.isRequireVariableStatement = isRequireVariableStatement;
|
|
15921
15938
|
function isSingleOrDoubleQuote(charCode) {
|
|
@@ -19402,7 +19419,7 @@ var ts;
|
|
|
19402
19419
|
getSourceMapSourceConstructor: function () { return SourceMapSource; },
|
|
19403
19420
|
};
|
|
19404
19421
|
function setObjectAllocator(alloc) {
|
|
19405
|
-
ts.objectAllocator
|
|
19422
|
+
Object.assign(ts.objectAllocator, alloc);
|
|
19406
19423
|
}
|
|
19407
19424
|
ts.setObjectAllocator = setObjectAllocator;
|
|
19408
19425
|
function formatStringFromArgs(text, args, baseIndex) {
|
|
@@ -19410,13 +19427,22 @@ var ts;
|
|
|
19410
19427
|
return text.replace(/{(\d+)}/g, function (_match, index) { return "" + ts.Debug.checkDefined(args[+index + baseIndex]); });
|
|
19411
19428
|
}
|
|
19412
19429
|
ts.formatStringFromArgs = formatStringFromArgs;
|
|
19430
|
+
var localizedDiagnosticMessages;
|
|
19413
19431
|
/* @internal */
|
|
19414
19432
|
function setLocalizedDiagnosticMessages(messages) {
|
|
19415
|
-
|
|
19433
|
+
localizedDiagnosticMessages = messages;
|
|
19416
19434
|
}
|
|
19417
19435
|
ts.setLocalizedDiagnosticMessages = setLocalizedDiagnosticMessages;
|
|
19436
|
+
/* @internal */
|
|
19437
|
+
// If the localized messages json is unset, and if given function use it to set the json
|
|
19438
|
+
function maybeSetLocalizedDiagnosticMessages(getMessages) {
|
|
19439
|
+
if (!localizedDiagnosticMessages && getMessages) {
|
|
19440
|
+
localizedDiagnosticMessages = getMessages();
|
|
19441
|
+
}
|
|
19442
|
+
}
|
|
19443
|
+
ts.maybeSetLocalizedDiagnosticMessages = maybeSetLocalizedDiagnosticMessages;
|
|
19418
19444
|
function getLocaleSpecificMessage(message) {
|
|
19419
|
-
return
|
|
19445
|
+
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
|
|
19420
19446
|
}
|
|
19421
19447
|
ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
|
|
19422
19448
|
function createDetachedDiagnostic(fileName, start, length, message) {
|
|
@@ -35025,7 +35051,7 @@ var ts;
|
|
|
35025
35051
|
// one out no matter what.
|
|
35026
35052
|
var finallyBlock;
|
|
35027
35053
|
if (!catchClause || token() === 96 /* FinallyKeyword */) {
|
|
35028
|
-
parseExpected(96 /* FinallyKeyword
|
|
35054
|
+
parseExpected(96 /* FinallyKeyword */, ts.Diagnostics.catch_or_finally_expected);
|
|
35029
35055
|
finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
|
|
35030
35056
|
}
|
|
35031
35057
|
return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc);
|
|
@@ -46237,7 +46263,7 @@ var ts;
|
|
|
46237
46263
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
46238
46264
|
}
|
|
46239
46265
|
if (!ts.isBindingPattern(node.name)) {
|
|
46240
|
-
if (ts.isInJSFile(node) && ts.
|
|
46266
|
+
if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node)) {
|
|
46241
46267
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
46242
46268
|
}
|
|
46243
46269
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -49020,7 +49046,7 @@ var ts;
|
|
|
49020
49046
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
49021
49047
|
|| node.kind === 295 /* ShorthandPropertyAssignment */
|
|
49022
49048
|
|| node.kind === 294 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
|
|
49023
|
-
|| ts.
|
|
49049
|
+
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
49024
49050
|
}
|
|
49025
49051
|
function isAliasableOrJsExpression(e) {
|
|
49026
49052
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -80579,7 +80605,7 @@ var ts;
|
|
|
80579
80605
|
}
|
|
80580
80606
|
// For a commonjs `const x = require`, validate the alias and exit
|
|
80581
80607
|
var symbol = getSymbolOfNode(node);
|
|
80582
|
-
if (symbol.flags & 2097152 /* Alias */ && ts.
|
|
80608
|
+
if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
80583
80609
|
checkAliasSymbol(node);
|
|
80584
80610
|
return;
|
|
80585
80611
|
}
|
|
@@ -120272,22 +120298,31 @@ var ts;
|
|
|
120272
120298
|
ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
120273
120299
|
}
|
|
120274
120300
|
ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
|
|
120301
|
+
function prettyPathForFileError(error, cwd) {
|
|
120302
|
+
var line = ts.formatColorAndReset(":" + error.line, ts.ForegroundColorEscapeSequences.Grey);
|
|
120303
|
+
if (ts.pathIsAbsolute(error.fileName) && ts.pathIsAbsolute(cwd)) {
|
|
120304
|
+
return ts.getRelativePathFromDirectory(cwd, error.fileName, /* ignoreCase */ false) + line;
|
|
120305
|
+
}
|
|
120306
|
+
return error.fileName + line;
|
|
120307
|
+
}
|
|
120275
120308
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
120276
120309
|
if (errorCount === 0)
|
|
120277
120310
|
return "";
|
|
120278
120311
|
var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
|
|
120279
120312
|
var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
|
|
120280
120313
|
.filter(function (value, index, self) { return self.indexOf(value) === index; });
|
|
120314
|
+
var firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
120281
120315
|
var d = errorCount === 1 ?
|
|
120282
120316
|
ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
|
|
120283
120317
|
ts.Diagnostics.Found_1_error_in_1 :
|
|
120284
|
-
ts.Diagnostics.Found_1_error, errorCount,
|
|
120318
|
+
ts.Diagnostics.Found_1_error, errorCount, firstFileReference) :
|
|
120285
120319
|
ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
|
|
120286
120320
|
ts.Diagnostics.Found_0_errors :
|
|
120287
120321
|
distinctFileNamesWithLines.length === 1 ?
|
|
120288
|
-
ts.Diagnostics.
|
|
120289
|
-
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
|
|
120290
|
-
|
|
120322
|
+
ts.Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 :
|
|
120323
|
+
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length);
|
|
120324
|
+
var suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
120325
|
+
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + suffix;
|
|
120291
120326
|
}
|
|
120292
120327
|
ts.getErrorSummaryText = getErrorSummaryText;
|
|
120293
120328
|
function createTabularErrorsDisplay(filesInError, host) {
|
|
@@ -120309,8 +120344,8 @@ var ts;
|
|
|
120309
120344
|
var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
|
|
120310
120345
|
" ".repeat(leftPaddingGoal - errorCountDigitsLength)
|
|
120311
120346
|
: "";
|
|
120312
|
-
var
|
|
120313
|
-
tabularData += "" + leftPadding + errorCount + " " +
|
|
120347
|
+
var fileRef = prettyPathForFileError(file, host.getCurrentDirectory());
|
|
120348
|
+
tabularData += "" + leftPadding + errorCount + " " + fileRef + "\n";
|
|
120314
120349
|
});
|
|
120315
120350
|
return tabularData;
|
|
120316
120351
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.6.0-dev.
|
|
5
|
+
"version": "4.6.0-dev.20220120",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|