typescript 4.6.0-dev.20220116 → 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 +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 +94 -41
- package/lib/tsserver.js +200 -115
- package/lib/tsserverlibrary.d.ts +2 -0
- package/lib/tsserverlibrary.js +200 -115
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +186 -113
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +186 -113
- package/lib/typingsInstaller.js +103 -42
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.6";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220120";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
function tryGetNativeMap() {
|
|
@@ -4171,9 +4171,13 @@ var ts;
|
|
|
4171
4171
|
}
|
|
4172
4172
|
ts.getFileWatcherEventKind = getFileWatcherEventKind;
|
|
4173
4173
|
ts.ignoredPaths = ["/node_modules/.", "/.git", "/.#"];
|
|
4174
|
-
|
|
4174
|
+
var curSysLog = ts.noop;
|
|
4175
|
+
function sysLog(s) {
|
|
4176
|
+
return curSysLog(s);
|
|
4177
|
+
}
|
|
4178
|
+
ts.sysLog = sysLog;
|
|
4175
4179
|
function setSysLog(logger) {
|
|
4176
|
-
|
|
4180
|
+
curSysLog = logger;
|
|
4177
4181
|
}
|
|
4178
4182
|
ts.setSysLog = setSysLog;
|
|
4179
4183
|
function createDirectoryWatcherSupportingRecursive(_a) {
|
|
@@ -4293,7 +4297,7 @@ var ts;
|
|
|
4293
4297
|
}
|
|
4294
4298
|
function onTimerToUpdateChildWatches() {
|
|
4295
4299
|
timerToUpdateChildWatches = undefined;
|
|
4296
|
-
|
|
4300
|
+
sysLog("sysLog:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size);
|
|
4297
4301
|
var start = ts.timestamp();
|
|
4298
4302
|
var invokeMap = new ts.Map();
|
|
4299
4303
|
while (!timerToUpdateChildWatches && cacheToUpdateChildWatches.size) {
|
|
@@ -4304,7 +4308,7 @@ var ts;
|
|
|
4304
4308
|
var hasChanges = updateChildWatches(dirName, dirPath, options);
|
|
4305
4309
|
invokeCallbacks(dirPath, invokeMap, hasChanges ? undefined : fileNames);
|
|
4306
4310
|
}
|
|
4307
|
-
|
|
4311
|
+
sysLog("sysLog:: invokingWatchers:: Elapsed:: " + (ts.timestamp() - start) + "ms:: " + cacheToUpdateChildWatches.size);
|
|
4308
4312
|
callbackCache.forEach(function (callbacks, rootDirName) {
|
|
4309
4313
|
var existing = invokeMap.get(rootDirName);
|
|
4310
4314
|
if (existing) {
|
|
@@ -4320,7 +4324,7 @@ var ts;
|
|
|
4320
4324
|
}
|
|
4321
4325
|
});
|
|
4322
4326
|
var elapsed = ts.timestamp() - start;
|
|
4323
|
-
|
|
4327
|
+
sysLog("sysLog:: Elapsed:: " + elapsed + "ms:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size + " " + timerToUpdateChildWatches);
|
|
4324
4328
|
}
|
|
4325
4329
|
function removeChildWatches(parentWatcher) {
|
|
4326
4330
|
if (!parentWatcher)
|
|
@@ -4822,7 +4826,7 @@ var ts;
|
|
|
4822
4826
|
}
|
|
4823
4827
|
};
|
|
4824
4828
|
function invokeCallbackAndUpdateWatcher(createWatcher) {
|
|
4825
|
-
|
|
4829
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
|
|
4826
4830
|
callback("rename", "");
|
|
4827
4831
|
if (watcher) {
|
|
4828
4832
|
watcher.close();
|
|
@@ -4839,7 +4843,7 @@ var ts;
|
|
|
4839
4843
|
}
|
|
4840
4844
|
}
|
|
4841
4845
|
if (hitSystemWatcherLimit) {
|
|
4842
|
-
|
|
4846
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
|
|
4843
4847
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
4844
4848
|
}
|
|
4845
4849
|
try {
|
|
@@ -4851,7 +4855,7 @@ var ts;
|
|
|
4851
4855
|
}
|
|
4852
4856
|
catch (e) {
|
|
4853
4857
|
hitSystemWatcherLimit || (hitSystemWatcherLimit = e.code === "ENOSPC");
|
|
4854
|
-
|
|
4858
|
+
sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
|
|
4855
4859
|
return watchPresentFileSystemEntryWithFsWatchFile();
|
|
4856
4860
|
}
|
|
4857
4861
|
}
|
|
@@ -5419,6 +5423,7 @@ var ts;
|
|
|
5419
5423
|
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"),
|
|
5420
5424
|
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."),
|
|
5421
5425
|
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."),
|
|
5426
|
+
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
5422
5427
|
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."),
|
|
5423
5428
|
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."),
|
|
5424
5429
|
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.", undefined, true),
|
|
@@ -6299,7 +6304,7 @@ var ts;
|
|
|
6299
6304
|
Completeness: diag(6257, ts.DiagnosticCategory.Message, "Completeness_6257", "Completeness"),
|
|
6300
6305
|
_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"),
|
|
6301
6306
|
Found_1_error_in_1: diag(6259, ts.DiagnosticCategory.Message, "Found_1_error_in_1_6259", "Found 1 error in {1}"),
|
|
6302
|
-
|
|
6307
|
+
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}"),
|
|
6303
6308
|
Found_0_errors_in_1_files: diag(6261, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."),
|
|
6304
6309
|
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."),
|
|
6305
6310
|
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}'."),
|
|
@@ -12277,7 +12282,7 @@ var ts;
|
|
|
12277
12282
|
}
|
|
12278
12283
|
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
|
|
12279
12284
|
function getExternalModuleRequireArgument(node) {
|
|
12280
|
-
return
|
|
12285
|
+
return isVariableDeclarationInitializedToBareOrAccessedRequire(node) && getLeftmostAccessExpression(node.initializer).arguments[0];
|
|
12281
12286
|
}
|
|
12282
12287
|
ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument;
|
|
12283
12288
|
function isInternalModuleImportEqualsDeclaration(node) {
|
|
@@ -12331,17 +12336,26 @@ var ts;
|
|
|
12331
12336
|
return !requireStringLiteralLikeArgument || ts.isStringLiteralLike(arg);
|
|
12332
12337
|
}
|
|
12333
12338
|
ts.isRequireCall = isRequireCall;
|
|
12334
|
-
function
|
|
12339
|
+
function isVariableDeclarationInitializedToRequire(node) {
|
|
12340
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, false);
|
|
12341
|
+
}
|
|
12342
|
+
ts.isVariableDeclarationInitializedToRequire = isVariableDeclarationInitializedToRequire;
|
|
12343
|
+
function isVariableDeclarationInitializedToBareOrAccessedRequire(node) {
|
|
12344
|
+
return isVariableDeclarationInitializedWithRequireHelper(node, true);
|
|
12345
|
+
}
|
|
12346
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
12347
|
+
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
12335
12348
|
if (node.kind === 202) {
|
|
12336
12349
|
node = node.parent.parent;
|
|
12337
12350
|
}
|
|
12338
|
-
return ts.isVariableDeclaration(node) &&
|
|
12351
|
+
return ts.isVariableDeclaration(node) &&
|
|
12352
|
+
!!node.initializer &&
|
|
12353
|
+
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, true);
|
|
12339
12354
|
}
|
|
12340
|
-
ts.isRequireVariableDeclaration = isRequireVariableDeclaration;
|
|
12341
12355
|
function isRequireVariableStatement(node) {
|
|
12342
12356
|
return ts.isVariableStatement(node)
|
|
12343
12357
|
&& node.declarationList.declarations.length > 0
|
|
12344
|
-
&& ts.every(node.declarationList.declarations, function (decl) { return
|
|
12358
|
+
&& ts.every(node.declarationList.declarations, function (decl) { return isVariableDeclarationInitializedToRequire(decl); });
|
|
12345
12359
|
}
|
|
12346
12360
|
ts.isRequireVariableStatement = isRequireVariableStatement;
|
|
12347
12361
|
function isSingleOrDoubleQuote(charCode) {
|
|
@@ -15301,7 +15315,7 @@ var ts;
|
|
|
15301
15315
|
getSourceMapSourceConstructor: function () { return SourceMapSource; },
|
|
15302
15316
|
};
|
|
15303
15317
|
function setObjectAllocator(alloc) {
|
|
15304
|
-
ts.objectAllocator
|
|
15318
|
+
Object.assign(ts.objectAllocator, alloc);
|
|
15305
15319
|
}
|
|
15306
15320
|
ts.setObjectAllocator = setObjectAllocator;
|
|
15307
15321
|
function formatStringFromArgs(text, args, baseIndex) {
|
|
@@ -15309,12 +15323,19 @@ var ts;
|
|
|
15309
15323
|
return text.replace(/{(\d+)}/g, function (_match, index) { return "" + ts.Debug.checkDefined(args[+index + baseIndex]); });
|
|
15310
15324
|
}
|
|
15311
15325
|
ts.formatStringFromArgs = formatStringFromArgs;
|
|
15326
|
+
var localizedDiagnosticMessages;
|
|
15312
15327
|
function setLocalizedDiagnosticMessages(messages) {
|
|
15313
|
-
|
|
15328
|
+
localizedDiagnosticMessages = messages;
|
|
15314
15329
|
}
|
|
15315
15330
|
ts.setLocalizedDiagnosticMessages = setLocalizedDiagnosticMessages;
|
|
15331
|
+
function maybeSetLocalizedDiagnosticMessages(getMessages) {
|
|
15332
|
+
if (!localizedDiagnosticMessages && getMessages) {
|
|
15333
|
+
localizedDiagnosticMessages = getMessages();
|
|
15334
|
+
}
|
|
15335
|
+
}
|
|
15336
|
+
ts.maybeSetLocalizedDiagnosticMessages = maybeSetLocalizedDiagnosticMessages;
|
|
15316
15337
|
function getLocaleSpecificMessage(message) {
|
|
15317
|
-
return
|
|
15338
|
+
return localizedDiagnosticMessages && localizedDiagnosticMessages[message.key] || message.message;
|
|
15318
15339
|
}
|
|
15319
15340
|
ts.getLocaleSpecificMessage = getLocaleSpecificMessage;
|
|
15320
15341
|
function createDetachedDiagnostic(fileName, start, length, message) {
|
|
@@ -28164,7 +28185,7 @@ var ts;
|
|
|
28164
28185
|
var catchClause = token() === 83 ? parseCatchClause() : undefined;
|
|
28165
28186
|
var finallyBlock;
|
|
28166
28187
|
if (!catchClause || token() === 96) {
|
|
28167
|
-
parseExpected(96);
|
|
28188
|
+
parseExpected(96, ts.Diagnostics.catch_or_finally_expected);
|
|
28168
28189
|
finallyBlock = parseBlock(false);
|
|
28169
28190
|
}
|
|
28170
28191
|
return withJSDoc(finishNode(factory.createTryStatement(tryBlock, catchClause, finallyBlock), pos), hasJSDoc);
|
|
@@ -36576,22 +36597,27 @@ var ts;
|
|
|
36576
36597
|
}
|
|
36577
36598
|
return state;
|
|
36578
36599
|
}
|
|
36579
|
-
function onLeft(left, state,
|
|
36600
|
+
function onLeft(left, state, node) {
|
|
36580
36601
|
if (!state.skip) {
|
|
36581
|
-
|
|
36602
|
+
var maybeBound = maybeBind(left);
|
|
36603
|
+
if (node.operatorToken.kind === 27) {
|
|
36604
|
+
maybeBindExpressionFlowIfCall(left);
|
|
36605
|
+
}
|
|
36606
|
+
return maybeBound;
|
|
36582
36607
|
}
|
|
36583
36608
|
}
|
|
36584
|
-
function onOperator(operatorToken, state,
|
|
36609
|
+
function onOperator(operatorToken, state, _node) {
|
|
36585
36610
|
if (!state.skip) {
|
|
36586
|
-
if (operatorToken.kind === 27) {
|
|
36587
|
-
maybeBindExpressionFlowIfCall(node.left);
|
|
36588
|
-
}
|
|
36589
36611
|
bind(operatorToken);
|
|
36590
36612
|
}
|
|
36591
36613
|
}
|
|
36592
|
-
function onRight(right, state,
|
|
36614
|
+
function onRight(right, state, node) {
|
|
36593
36615
|
if (!state.skip) {
|
|
36594
|
-
|
|
36616
|
+
var maybeBound = maybeBind(right);
|
|
36617
|
+
if (node.operatorToken.kind === 27) {
|
|
36618
|
+
maybeBindExpressionFlowIfCall(right);
|
|
36619
|
+
}
|
|
36620
|
+
return maybeBound;
|
|
36595
36621
|
}
|
|
36596
36622
|
}
|
|
36597
36623
|
function onExit(node, state) {
|
|
@@ -37927,7 +37953,7 @@ var ts;
|
|
|
37927
37953
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
37928
37954
|
}
|
|
37929
37955
|
if (!ts.isBindingPattern(node.name)) {
|
|
37930
|
-
if (ts.isInJSFile(node) && ts.
|
|
37956
|
+
if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node)) {
|
|
37931
37957
|
declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
|
|
37932
37958
|
}
|
|
37933
37959
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -40205,7 +40231,7 @@ var ts;
|
|
|
40205
40231
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
40206
40232
|
|| node.kind === 295
|
|
40207
40233
|
|| node.kind === 294 && isAliasableOrJsExpression(node.initializer)
|
|
40208
|
-
|| ts.
|
|
40234
|
+
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
|
|
40209
40235
|
}
|
|
40210
40236
|
function isAliasableOrJsExpression(e) {
|
|
40211
40237
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -41901,6 +41927,7 @@ var ts;
|
|
|
41901
41927
|
getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function () { return host.getCommonSourceDirectory(); } : function () { return ""; },
|
|
41902
41928
|
getCurrentDirectory: function () { return host.getCurrentDirectory(); },
|
|
41903
41929
|
getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
|
|
41930
|
+
getPackageJsonInfoCache: function () { var _a; return (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host); },
|
|
41904
41931
|
useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
|
|
41905
41932
|
redirectTargetsMap: host.redirectTargetsMap,
|
|
41906
41933
|
getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
|
|
@@ -67508,7 +67535,7 @@ var ts;
|
|
|
67508
67535
|
return;
|
|
67509
67536
|
}
|
|
67510
67537
|
var symbol = getSymbolOfNode(node);
|
|
67511
|
-
if (symbol.flags & 2097152 && ts.
|
|
67538
|
+
if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
67512
67539
|
checkAliasSymbol(node);
|
|
67513
67540
|
return;
|
|
67514
67541
|
}
|
|
@@ -79784,10 +79811,16 @@ var ts;
|
|
|
79784
79811
|
var _a;
|
|
79785
79812
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
79786
79813
|
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
79787
|
-
var args = [tagName, objectProperties
|
|
79814
|
+
var args = [tagName, objectProperties];
|
|
79815
|
+
if (keyAttr) {
|
|
79816
|
+
args.push(transformJsxAttributeInitializer(keyAttr.initializer));
|
|
79817
|
+
}
|
|
79788
79818
|
if (compilerOptions.jsx === 5) {
|
|
79789
79819
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
79790
79820
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
79821
|
+
if (keyAttr === undefined) {
|
|
79822
|
+
args.push(factory.createVoidZero());
|
|
79823
|
+
}
|
|
79791
79824
|
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
79792
79825
|
var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
|
|
79793
79826
|
args.push(factory.createObjectLiteralExpression([
|
|
@@ -98634,11 +98667,12 @@ var ts;
|
|
|
98634
98667
|
};
|
|
98635
98668
|
}
|
|
98636
98669
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
98670
|
+
var _a;
|
|
98637
98671
|
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
|
|
98638
98672
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
98639
98673
|
return false;
|
|
98640
98674
|
}
|
|
98641
|
-
return ts.getImpliedNodeFormatForFile(importingSourceFileName,
|
|
98675
|
+
return ts.getImpliedNodeFormatForFile(importingSourceFileName, (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host), getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
|
|
98642
98676
|
}
|
|
98643
98677
|
function getModuleResolutionHost(host) {
|
|
98644
98678
|
var _a;
|
|
@@ -99111,11 +99145,13 @@ var ts;
|
|
|
99111
99145
|
var packageName = ts.getPackageNameFromTypesPackageName(nodeModulesDirectoryName);
|
|
99112
99146
|
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
|
|
99113
99147
|
function tryDirectoryWithPackageJson(packageRootIndex) {
|
|
99148
|
+
var _a, _b;
|
|
99114
99149
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
99115
99150
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
99116
99151
|
var moduleFileToTry = path;
|
|
99117
|
-
|
|
99118
|
-
|
|
99152
|
+
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
99153
|
+
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
99154
|
+
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
99119
99155
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
99120
99156
|
var conditions = ["node", importingSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
99121
99157
|
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string"
|
|
@@ -99382,22 +99418,31 @@ var ts;
|
|
|
99382
99418
|
ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
|
|
99383
99419
|
}
|
|
99384
99420
|
ts.getWatchErrorSummaryDiagnosticMessage = getWatchErrorSummaryDiagnosticMessage;
|
|
99421
|
+
function prettyPathForFileError(error, cwd) {
|
|
99422
|
+
var line = ts.formatColorAndReset(":" + error.line, ts.ForegroundColorEscapeSequences.Grey);
|
|
99423
|
+
if (ts.pathIsAbsolute(error.fileName) && ts.pathIsAbsolute(cwd)) {
|
|
99424
|
+
return ts.getRelativePathFromDirectory(cwd, error.fileName, false) + line;
|
|
99425
|
+
}
|
|
99426
|
+
return error.fileName + line;
|
|
99427
|
+
}
|
|
99385
99428
|
function getErrorSummaryText(errorCount, filesInError, newLine, host) {
|
|
99386
99429
|
if (errorCount === 0)
|
|
99387
99430
|
return "";
|
|
99388
99431
|
var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
|
|
99389
99432
|
var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
|
|
99390
99433
|
.filter(function (value, index, self) { return self.indexOf(value) === index; });
|
|
99434
|
+
var firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
|
|
99391
99435
|
var d = errorCount === 1 ?
|
|
99392
99436
|
ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
|
|
99393
99437
|
ts.Diagnostics.Found_1_error_in_1 :
|
|
99394
|
-
ts.Diagnostics.Found_1_error, errorCount,
|
|
99438
|
+
ts.Diagnostics.Found_1_error, errorCount, firstFileReference) :
|
|
99395
99439
|
ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
|
|
99396
99440
|
ts.Diagnostics.Found_0_errors :
|
|
99397
99441
|
distinctFileNamesWithLines.length === 1 ?
|
|
99398
|
-
ts.Diagnostics.
|
|
99399
|
-
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
|
|
99400
|
-
|
|
99442
|
+
ts.Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 :
|
|
99443
|
+
ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length);
|
|
99444
|
+
var suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "";
|
|
99445
|
+
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + suffix;
|
|
99401
99446
|
}
|
|
99402
99447
|
ts.getErrorSummaryText = getErrorSummaryText;
|
|
99403
99448
|
function createTabularErrorsDisplay(filesInError, host) {
|
|
@@ -99419,8 +99464,8 @@ var ts;
|
|
|
99419
99464
|
var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
|
|
99420
99465
|
" ".repeat(leftPaddingGoal - errorCountDigitsLength)
|
|
99421
99466
|
: "";
|
|
99422
|
-
var
|
|
99423
|
-
tabularData += "" + leftPadding + errorCount + " " +
|
|
99467
|
+
var fileRef = prettyPathForFileError(file, host.getCurrentDirectory());
|
|
99468
|
+
tabularData += "" + leftPadding + errorCount + " " + fileRef + "\n";
|
|
99424
99469
|
});
|
|
99425
99470
|
return tabularData;
|
|
99426
99471
|
}
|
|
@@ -99885,6 +99930,7 @@ var ts;
|
|
|
99885
99930
|
var sharedExtendedConfigFileWatchers;
|
|
99886
99931
|
var extendedConfigCache = host.extendedConfigCache;
|
|
99887
99932
|
var changesAffectResolution = false;
|
|
99933
|
+
var reportFileChangeDetectedOnCreateProgram = false;
|
|
99888
99934
|
var sourceFilesCache = new ts.Map();
|
|
99889
99935
|
var missingFilePathsRequestedForRelease;
|
|
99890
99936
|
var hasChangedCompilerOptions = false;
|
|
@@ -100038,14 +100084,21 @@ var ts;
|
|
|
100038
100084
|
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
|
|
100039
100085
|
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
100040
100086
|
if (hasChangedConfigFileParsingErrors) {
|
|
100087
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
100088
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
100089
|
+
}
|
|
100041
100090
|
builderProgram = createProgram(undefined, undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
100042
100091
|
hasChangedConfigFileParsingErrors = false;
|
|
100043
100092
|
}
|
|
100044
100093
|
}
|
|
100045
100094
|
else {
|
|
100095
|
+
if (reportFileChangeDetectedOnCreateProgram) {
|
|
100096
|
+
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
100097
|
+
}
|
|
100046
100098
|
createNewProgram(hasInvalidatedResolution);
|
|
100047
100099
|
}
|
|
100048
100100
|
changesAffectResolution = false;
|
|
100101
|
+
reportFileChangeDetectedOnCreateProgram = false;
|
|
100049
100102
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
100050
100103
|
host.afterProgramCreate(builderProgram);
|
|
100051
100104
|
}
|
|
@@ -100224,7 +100277,7 @@ var ts;
|
|
|
100224
100277
|
}
|
|
100225
100278
|
function updateProgramWithWatchStatus() {
|
|
100226
100279
|
timerToUpdateProgram = undefined;
|
|
100227
|
-
|
|
100280
|
+
reportFileChangeDetectedOnCreateProgram = true;
|
|
100228
100281
|
updateProgram();
|
|
100229
100282
|
}
|
|
100230
100283
|
function updateProgram() {
|