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.
@@ -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.20220116";
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
- ts.sysLog = ts.noop; // eslint-disable-line prefer-const
6804
+ function sysLog(s) {
6805
+ return curSysLog(s);
6806
+ }
6807
+ ts.sysLog = sysLog;
6804
6808
  /*@internal*/
6805
6809
  function setSysLog(logger) {
6806
- ts.sysLog = logger;
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
- ts.sysLog("sysLog:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size);
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
- ts.sysLog("sysLog:: invokingWatchers:: Elapsed:: " + (ts.timestamp() - start) + "ms:: " + cacheToUpdateChildWatches.size);
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
- ts.sysLog("sysLog:: Elapsed:: " + elapsed + "ms:: onTimerToUpdateChildWatches:: " + cacheToUpdateChildWatches.size + " " + timerToUpdateChildWatches);
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
- ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing watcher to " + (createWatcher === watchPresentFileSystemEntry ? "Present" : "Missing") + "FileSystemEntryWatcher");
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
- ts.sysLog("sysLog:: " + fileOrDirectory + ":: Defaulting to fsWatchFile");
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
- ts.sysLog("sysLog:: " + fileOrDirectory + ":: Changing to fsWatchFile");
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
- Found_0_errors_in_1_file: diag(6260, ts.DiagnosticCategory.Message, "Found_0_errors_in_1_file_6260", "Found {0} errors in 1 file."),
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 isRequireVariableDeclaration(node) && getLeftmostAccessExpression(node.initializer).arguments[0];
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 isRequireVariableDeclaration(node) {
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) && !!node.initializer && isRequireCall(getLeftmostAccessExpression(node.initializer), /*requireStringLiteralLikeArgument*/ true);
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 isRequireVariableDeclaration(decl); });
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 = alloc;
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
- ts.localizedDiagnosticMessages = messages;
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 ts.localizedDiagnosticMessages && ts.localizedDiagnosticMessages[message.key] || message.message;
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);
@@ -44486,7 +44512,7 @@ var ts;
44486
44512
  maybeBindExpressionFlowIfCall(node.expression);
44487
44513
  }
44488
44514
  function maybeBindExpressionFlowIfCall(node) {
44489
- // A top level or LHS of comma expression call expression with a dotted function name and at least one argument
44515
+ // A top level or comma expression call expression with a dotted function name and at least one argument
44490
44516
  // is potentially an assertion and is therefore included in the control flow.
44491
44517
  if (node.kind === 207 /* CallExpression */) {
44492
44518
  var call = node;
@@ -44654,22 +44680,27 @@ var ts;
44654
44680
  }
44655
44681
  return state;
44656
44682
  }
44657
- function onLeft(left, state, _node) {
44683
+ function onLeft(left, state, node) {
44658
44684
  if (!state.skip) {
44659
- return maybeBind(left);
44685
+ var maybeBound = maybeBind(left);
44686
+ if (node.operatorToken.kind === 27 /* CommaToken */) {
44687
+ maybeBindExpressionFlowIfCall(left);
44688
+ }
44689
+ return maybeBound;
44660
44690
  }
44661
44691
  }
44662
- function onOperator(operatorToken, state, node) {
44692
+ function onOperator(operatorToken, state, _node) {
44663
44693
  if (!state.skip) {
44664
- if (operatorToken.kind === 27 /* CommaToken */) {
44665
- maybeBindExpressionFlowIfCall(node.left);
44666
- }
44667
44694
  bind(operatorToken);
44668
44695
  }
44669
44696
  }
44670
- function onRight(right, state, _node) {
44697
+ function onRight(right, state, node) {
44671
44698
  if (!state.skip) {
44672
- return maybeBind(right);
44699
+ var maybeBound = maybeBind(right);
44700
+ if (node.operatorToken.kind === 27 /* CommaToken */) {
44701
+ maybeBindExpressionFlowIfCall(right);
44702
+ }
44703
+ return maybeBound;
44673
44704
  }
44674
44705
  }
44675
44706
  function onExit(node, state) {
@@ -46232,7 +46263,7 @@ var ts;
46232
46263
  checkStrictModeEvalOrArguments(node, node.name);
46233
46264
  }
46234
46265
  if (!ts.isBindingPattern(node.name)) {
46235
- if (ts.isInJSFile(node) && ts.isRequireVariableDeclaration(node) && !ts.getJSDocTypeTag(node)) {
46266
+ if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) && !ts.getJSDocTypeTag(node)) {
46236
46267
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
46237
46268
  }
46238
46269
  else if (ts.isBlockOrCatchScoped(node)) {
@@ -49015,7 +49046,7 @@ var ts;
49015
49046
  && isAliasableOrJsExpression(node.parent.right)
49016
49047
  || node.kind === 295 /* ShorthandPropertyAssignment */
49017
49048
  || node.kind === 294 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer)
49018
- || ts.isRequireVariableDeclaration(node);
49049
+ || ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node);
49019
49050
  }
49020
49051
  function isAliasableOrJsExpression(e) {
49021
49052
  return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
@@ -50946,6 +50977,7 @@ var ts;
50946
50977
  getCommonSourceDirectory: !!host.getCommonSourceDirectory ? function () { return host.getCommonSourceDirectory(); } : function () { return ""; },
50947
50978
  getCurrentDirectory: function () { return host.getCurrentDirectory(); },
50948
50979
  getSymlinkCache: ts.maybeBind(host, host.getSymlinkCache),
50980
+ getPackageJsonInfoCache: function () { var _a; return (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host); },
50949
50981
  useCaseSensitiveFileNames: ts.maybeBind(host, host.useCaseSensitiveFileNames),
50950
50982
  redirectTargetsMap: host.redirectTargetsMap,
50951
50983
  getProjectReferenceRedirect: function (fileName) { return host.getProjectReferenceRedirect(fileName); },
@@ -80573,7 +80605,7 @@ var ts;
80573
80605
  }
80574
80606
  // For a commonjs `const x = require`, validate the alias and exit
80575
80607
  var symbol = getSymbolOfNode(node);
80576
- if (symbol.flags & 2097152 /* Alias */ && ts.isRequireVariableDeclaration(node)) {
80608
+ if (symbol.flags & 2097152 /* Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
80577
80609
  checkAliasSymbol(node);
80578
80610
  return;
80579
80611
  }
@@ -95518,10 +95550,19 @@ var ts;
95518
95550
  var _a;
95519
95551
  var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
95520
95552
  var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
95521
- var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
95553
+ var args = [tagName, objectProperties];
95554
+ // function jsx(type, config, maybeKey) {}
95555
+ // "maybeKey" is optional. It is acceptable to use "_jsx" without a third argument
95556
+ if (keyAttr) {
95557
+ args.push(transformJsxAttributeInitializer(keyAttr.initializer));
95558
+ }
95522
95559
  if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
95523
95560
  var originalFile = ts.getOriginalNode(currentSourceFile);
95524
95561
  if (originalFile && ts.isSourceFile(originalFile)) {
95562
+ // "maybeKey" has to be replaced with "void 0" to not break the jsxDEV signature
95563
+ if (keyAttr === undefined) {
95564
+ args.push(factory.createVoidZero());
95565
+ }
95525
95566
  // isStaticChildren development flag
95526
95567
  args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
95527
95568
  // __source development flag
@@ -119386,11 +119427,12 @@ var ts;
119386
119427
  };
119387
119428
  }
119388
119429
  function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
119430
+ var _a;
119389
119431
  if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node12
119390
119432
  && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
119391
119433
  return false;
119392
119434
  }
119393
- return ts.getImpliedNodeFormatForFile(importingSourceFileName, /*packageJsonInfoCache*/ undefined, getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
119435
+ return ts.getImpliedNodeFormatForFile(importingSourceFileName, (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host), getModuleResolutionHost(host), compilerOptions) !== ts.ModuleKind.CommonJS;
119394
119436
  }
119395
119437
  function getModuleResolutionHost(host) {
119396
119438
  var _a;
@@ -119950,11 +119992,13 @@ var ts;
119950
119992
  // For classic resolution, only allow importing from node_modules/@types, not other node_modules
119951
119993
  return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
119952
119994
  function tryDirectoryWithPackageJson(packageRootIndex) {
119995
+ var _a, _b;
119953
119996
  var packageRootPath = path.substring(0, packageRootIndex);
119954
119997
  var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
119955
119998
  var moduleFileToTry = path;
119956
- if (host.fileExists(packageJsonPath)) {
119957
- var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
119999
+ var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
120000
+ if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
120001
+ var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
119958
120002
  if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
119959
120003
  // `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
119960
120004
  // an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
@@ -120254,22 +120298,31 @@ var ts;
120254
120298
  ts.Diagnostics.Found_0_errors_Watching_for_file_changes;
120255
120299
  }
120256
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
+ }
120257
120308
  function getErrorSummaryText(errorCount, filesInError, newLine, host) {
120258
120309
  if (errorCount === 0)
120259
120310
  return "";
120260
120311
  var nonNilFiles = filesInError.filter(function (fileInError) { return fileInError !== undefined; });
120261
120312
  var distinctFileNamesWithLines = nonNilFiles.map(function (fileInError) { return fileInError.fileName + ":" + fileInError.line; })
120262
120313
  .filter(function (value, index, self) { return self.indexOf(value) === index; });
120314
+ var firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory());
120263
120315
  var d = errorCount === 1 ?
120264
120316
  ts.createCompilerDiagnostic(filesInError[0] !== undefined ?
120265
120317
  ts.Diagnostics.Found_1_error_in_1 :
120266
- ts.Diagnostics.Found_1_error, errorCount, distinctFileNamesWithLines[0]) :
120318
+ ts.Diagnostics.Found_1_error, errorCount, firstFileReference) :
120267
120319
  ts.createCompilerDiagnostic(distinctFileNamesWithLines.length === 0 ?
120268
120320
  ts.Diagnostics.Found_0_errors :
120269
120321
  distinctFileNamesWithLines.length === 1 ?
120270
- ts.Diagnostics.Found_0_errors_in_1_file :
120271
- ts.Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length);
120272
- return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine + (errorCount > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : "");
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;
120273
120326
  }
120274
120327
  ts.getErrorSummaryText = getErrorSummaryText;
120275
120328
  function createTabularErrorsDisplay(filesInError, host) {
@@ -120291,8 +120344,8 @@ var ts;
120291
120344
  var leftPadding = errorCountDigitsLength < leftPaddingGoal ?
120292
120345
  " ".repeat(leftPaddingGoal - errorCountDigitsLength)
120293
120346
  : "";
120294
- var relativePath = ts.getRelativePathFromDirectory(host.getCurrentDirectory(), file.fileName, /* ignoreCase */ false);
120295
- tabularData += "" + leftPadding + errorCount + " " + relativePath + ":" + file.line + "\n";
120347
+ var fileRef = prettyPathForFileError(file, host.getCurrentDirectory());
120348
+ tabularData += "" + leftPadding + errorCount + " " + fileRef + "\n";
120296
120349
  });
120297
120350
  return tabularData;
120298
120351
  }
@@ -120793,6 +120846,7 @@ var ts;
120793
120846
  var sharedExtendedConfigFileWatchers; // Map of file watchers for extended files, shared between different referenced projects
120794
120847
  var extendedConfigCache = host.extendedConfigCache; // Cache for extended config evaluation
120795
120848
  var changesAffectResolution = false; // Flag for indicating non-config changes affect module resolution
120849
+ var reportFileChangeDetectedOnCreateProgram = false; // True if synchronizeProgram should report "File change detected..." when a new program is created
120796
120850
  var sourceFilesCache = new ts.Map(); // Cache that stores the source file and version info
120797
120851
  var missingFilePathsRequestedForRelease; // These paths are held temporarily so that we can remove the entry from source file cache if the file is not tracked by missing files
120798
120852
  var hasChangedCompilerOptions = false; // True if the compiler options have changed between compilations
@@ -120955,14 +121009,21 @@ var ts;
120955
121009
  var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
120956
121010
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
120957
121011
  if (hasChangedConfigFileParsingErrors) {
121012
+ if (reportFileChangeDetectedOnCreateProgram) {
121013
+ reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
121014
+ }
120958
121015
  builderProgram = createProgram(/*rootNames*/ undefined, /*options*/ undefined, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
120959
121016
  hasChangedConfigFileParsingErrors = false;
120960
121017
  }
120961
121018
  }
120962
121019
  else {
121020
+ if (reportFileChangeDetectedOnCreateProgram) {
121021
+ reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
121022
+ }
120963
121023
  createNewProgram(hasInvalidatedResolution);
120964
121024
  }
120965
121025
  changesAffectResolution = false; // reset for next sync
121026
+ reportFileChangeDetectedOnCreateProgram = false;
120966
121027
  if (host.afterProgramCreate && program !== builderProgram) {
120967
121028
  host.afterProgramCreate(builderProgram);
120968
121029
  }
@@ -121164,7 +121225,7 @@ var ts;
121164
121225
  }
121165
121226
  function updateProgramWithWatchStatus() {
121166
121227
  timerToUpdateProgram = undefined;
121167
- reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
121228
+ reportFileChangeDetectedOnCreateProgram = true;
121168
121229
  updateProgram();
121169
121230
  }
121170
121231
  function updateProgram() {
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.20220116",
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": [