typescript 4.8.0-dev.20220809 → 4.9.0-dev.20220812

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/tsc.js CHANGED
@@ -68,8 +68,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
68
68
  };
69
69
  var ts;
70
70
  (function (ts) {
71
- ts.versionMajorMinor = "4.8";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220809";
71
+ ts.versionMajorMinor = "4.9";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220812";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -78,24 +78,25 @@ var ts;
78
78
  undefined;
79
79
  function tryGetNativeMap() {
80
80
  var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
81
- return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
81
+ var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
82
+ if (!constructor) {
83
+ throw new Error("No compatible Map implementation found.");
84
+ }
85
+ return constructor;
82
86
  }
83
87
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
84
88
  function tryGetNativeSet() {
85
89
  var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
86
- return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
90
+ var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
91
+ if (!constructor) {
92
+ throw new Error("No compatible Set implementation found.");
93
+ }
94
+ return constructor;
87
95
  }
88
96
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
89
97
  })(NativeCollections || (NativeCollections = {}));
90
- ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim");
91
- ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim");
92
- function getCollectionImplementation(name, nativeFactory, shimFactory) {
93
- var _a;
94
- var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator);
95
- if (constructor)
96
- return constructor;
97
- throw new Error("TypeScript requires an environment that provides a compatible native " + name + " implementation.");
98
- }
98
+ ts.Map = NativeCollections.tryGetNativeMap();
99
+ ts.Set = NativeCollections.tryGetNativeSet();
99
100
  })(ts || (ts = {}));
100
101
  var ts;
101
102
  (function (ts) {
@@ -759,15 +760,18 @@ var ts;
759
760
  function insertSorted(array, insert, compare, allowDuplicates) {
760
761
  if (array.length === 0) {
761
762
  array.push(insert);
762
- return;
763
+ return true;
763
764
  }
764
765
  var insertIndex = binarySearch(array, insert, identity, compare);
765
766
  if (insertIndex < 0) {
766
767
  array.splice(~insertIndex, 0, insert);
768
+ return true;
767
769
  }
768
- else if (allowDuplicates) {
770
+ if (allowDuplicates) {
769
771
  array.splice(insertIndex, 0, insert);
772
+ return true;
770
773
  }
774
+ return false;
771
775
  }
772
776
  ts.insertSorted = insertSorted;
773
777
  function sortAndDeduplicate(array, comparer, equalityComparer) {
@@ -3021,6 +3025,8 @@ var ts;
3021
3025
  typeof performance.mark === "function" &&
3022
3026
  typeof performance.measure === "function" &&
3023
3027
  typeof performance.now === "function" &&
3028
+ typeof performance.clearMarks === "function" &&
3029
+ typeof performance.clearMeasures === "function" &&
3024
3030
  typeof PerformanceObserver === "function";
3025
3031
  }
3026
3032
  function tryGetWebPerformanceHooks() {
@@ -3058,7 +3064,9 @@ var ts;
3058
3064
  if (end === "__performance.measure-fix__") {
3059
3065
  nodePerformance_1.clearMarks("__performance.measure-fix__");
3060
3066
  }
3061
- }
3067
+ },
3068
+ clearMarks: function (name) { return nodePerformance_1.clearMarks(name); },
3069
+ clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); },
3062
3070
  };
3063
3071
  }
3064
3072
  return {
@@ -3153,6 +3161,30 @@ var ts;
3153
3161
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3154
3162
  }
3155
3163
  performance.forEachMeasure = forEachMeasure;
3164
+ function forEachMark(cb) {
3165
+ marks.forEach(function (_time, markName) { return cb(markName); });
3166
+ }
3167
+ performance.forEachMark = forEachMark;
3168
+ function clearMeasures(name) {
3169
+ if (name !== undefined)
3170
+ durations.delete(name);
3171
+ else
3172
+ durations.clear();
3173
+ performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name);
3174
+ }
3175
+ performance.clearMeasures = clearMeasures;
3176
+ function clearMarks(name) {
3177
+ if (name !== undefined) {
3178
+ counts.delete(name);
3179
+ marks.delete(name);
3180
+ }
3181
+ else {
3182
+ counts.clear();
3183
+ marks.clear();
3184
+ }
3185
+ performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name);
3186
+ }
3187
+ performance.clearMarks = clearMarks;
3156
3188
  function isEnabled() {
3157
3189
  return enabled;
3158
3190
  }
@@ -5078,12 +5110,9 @@ var ts;
5078
5110
  }
5079
5111
  ts.getPathFromPathComponents = getPathFromPathComponents;
5080
5112
  function normalizeSlashes(path) {
5081
- var index = path.indexOf("\\");
5082
- if (index === -1) {
5083
- return path;
5084
- }
5085
- backslashRegExp.lastIndex = index;
5086
- return path.replace(backslashRegExp, ts.directorySeparator);
5113
+ return path.indexOf("\\") !== -1
5114
+ ? path.replace(backslashRegExp, ts.directorySeparator)
5115
+ : path;
5087
5116
  }
5088
5117
  ts.normalizeSlashes = normalizeSlashes;
5089
5118
  function reducePathComponents(components) {
@@ -6704,6 +6733,7 @@ var ts;
6704
6733
  Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."),
6705
6734
  Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
6706
6735
  Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
6736
+ Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"),
6707
6737
  The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
6708
6738
  The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
6709
6739
  The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -15279,20 +15309,16 @@ var ts;
15279
15309
  return getStringFromExpandedCharCodes(expandedCharCodes);
15280
15310
  }
15281
15311
  ts.base64decode = base64decode;
15312
+ function readJsonOrUndefined(path, hostOrText) {
15313
+ var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path);
15314
+ if (!jsonText)
15315
+ return undefined;
15316
+ var result = ts.parseConfigFileTextToJson(path, jsonText);
15317
+ return !result.error ? result.config : undefined;
15318
+ }
15319
+ ts.readJsonOrUndefined = readJsonOrUndefined;
15282
15320
  function readJson(path, host) {
15283
- try {
15284
- var jsonText = host.readFile(path);
15285
- if (!jsonText)
15286
- return {};
15287
- var result = ts.parseConfigFileTextToJson(path, jsonText);
15288
- if (result.error) {
15289
- return {};
15290
- }
15291
- return result.config;
15292
- }
15293
- catch (e) {
15294
- return {};
15295
- }
15321
+ return readJsonOrUndefined(path, host) || {};
15296
15322
  }
15297
15323
  ts.readJson = readJson;
15298
15324
  function directoryProbablyExists(directoryName, host) {
@@ -22352,9 +22378,10 @@ var ts;
22352
22378
  };
22353
22379
  var buildInfo_1;
22354
22380
  var getAndCacheBuildInfo_1 = function (getText) {
22381
+ var _a;
22355
22382
  if (buildInfo_1 === undefined) {
22356
22383
  var result = getText();
22357
- buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
22384
+ buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false;
22358
22385
  }
22359
22386
  return buildInfo_1 || undefined;
22360
22387
  };
@@ -37498,6 +37525,9 @@ var ts;
37498
37525
  case 203:
37499
37526
  bindBindingElementFlow(node);
37500
37527
  break;
37528
+ case 164:
37529
+ bindParameterFlow(node);
37530
+ break;
37501
37531
  case 205:
37502
37532
  case 204:
37503
37533
  case 296:
@@ -38192,15 +38222,32 @@ var ts;
38192
38222
  }
38193
38223
  }
38194
38224
  function bindBindingElementFlow(node) {
38195
- if (ts.isBindingPattern(node.name)) {
38196
- bind(node.dotDotDotToken);
38197
- bind(node.propertyName);
38198
- bind(node.initializer);
38199
- bind(node.name);
38225
+ bind(node.dotDotDotToken);
38226
+ bind(node.propertyName);
38227
+ bindInitializer(node.initializer);
38228
+ bind(node.name);
38229
+ }
38230
+ function bindParameterFlow(node) {
38231
+ bindEach(node.modifiers);
38232
+ bind(node.dotDotDotToken);
38233
+ bind(node.questionToken);
38234
+ bind(node.type);
38235
+ bindInitializer(node.initializer);
38236
+ bind(node.name);
38237
+ }
38238
+ function bindInitializer(node) {
38239
+ if (!node) {
38240
+ return;
38200
38241
  }
38201
- else {
38202
- bindEachChild(node);
38242
+ var entryFlow = currentFlow;
38243
+ bind(node);
38244
+ if (entryFlow === unreachableFlow || entryFlow === currentFlow) {
38245
+ return;
38203
38246
  }
38247
+ var exitFlow = createBranchLabel();
38248
+ addAntecedent(exitFlow, entryFlow);
38249
+ addAntecedent(exitFlow, currentFlow);
38250
+ currentFlow = finishFlowLabel(exitFlow);
38204
38251
  }
38205
38252
  function bindJSDocTypeAlias(node) {
38206
38253
  bind(node.tagName);
@@ -40846,7 +40893,7 @@ var ts;
40846
40893
  if (unidirectional === void 0) { unidirectional = false; }
40847
40894
  source.forEach(function (sourceSymbol, id) {
40848
40895
  var targetSymbol = target.get(id);
40849
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
40896
+ target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol));
40850
40897
  });
40851
40898
  }
40852
40899
  function mergeModuleAugmentation(moduleName) {
@@ -46698,11 +46745,9 @@ var ts;
46698
46745
  return getReturnTypeOfSignature(getterSignature);
46699
46746
  }
46700
46747
  }
46701
- if (ts.isInJSFile(declaration)) {
46702
- var type_1 = getParameterTypeOfTypeTag(func, declaration);
46703
- if (type_1)
46704
- return type_1;
46705
- }
46748
+ var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration);
46749
+ if (parameterTypeOfTypeTag)
46750
+ return parameterTypeOfTypeTag;
46706
46751
  var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration);
46707
46752
  if (type) {
46708
46753
  return addOptionality(type, false, isOptional);
@@ -47207,8 +47252,8 @@ var ts;
47207
47252
  if (typeNode === undefined) {
47208
47253
  return useUnknownInCatchVariables ? unknownType : anyType;
47209
47254
  }
47210
- var type_2 = getTypeOfNode(typeNode);
47211
- return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType;
47255
+ var type_1 = getTypeOfNode(typeNode);
47256
+ return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType;
47212
47257
  }
47213
47258
  if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) {
47214
47259
  if (!declaration.statements.length) {
@@ -47405,11 +47450,11 @@ var ts;
47405
47450
  return errorType;
47406
47451
  }
47407
47452
  var exportEquals = getMergedSymbol(symbol.exports.get("export="));
47408
- var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
47453
+ var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule);
47409
47454
  if (!popTypeResolution()) {
47410
47455
  return reportCircularityError(symbol);
47411
47456
  }
47412
- return type_3;
47457
+ return type_2;
47413
47458
  }
47414
47459
  }
47415
47460
  var type = createObjectType(16, symbol);
@@ -49335,10 +49380,10 @@ var ts;
49335
49380
  var baseTypes = [];
49336
49381
  var different = false;
49337
49382
  for (var _i = 0, types_7 = types; _i < types_7.length; _i++) {
49338
- var type_4 = types_7[_i];
49339
- var baseType = getBaseConstraint(type_4);
49383
+ var type_3 = types_7[_i];
49384
+ var baseType = getBaseConstraint(type_3);
49340
49385
  if (baseType) {
49341
- if (baseType !== type_4) {
49386
+ if (baseType !== type_3) {
49342
49387
  different = true;
49343
49388
  }
49344
49389
  baseTypes.push(baseType);
@@ -50019,7 +50064,10 @@ var ts;
50019
50064
  continue;
50020
50065
  }
50021
50066
  }
50022
- result.push(getSignatureFromDeclaration(decl));
50067
+ result.push((!ts.isFunctionExpressionOrArrowFunction(decl) &&
50068
+ !ts.isObjectLiteralMethod(decl) &&
50069
+ getSignatureOfTypeTag(decl)) ||
50070
+ getSignatureFromDeclaration(decl));
50023
50071
  }
50024
50072
  return result;
50025
50073
  }
@@ -50050,7 +50098,7 @@ var ts;
50050
50098
  else {
50051
50099
  var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration);
50052
50100
  var jsdocPredicate = void 0;
50053
- if (!type && ts.isInJSFile(signature.declaration)) {
50101
+ if (!type) {
50054
50102
  var jsdocSignature = getSignatureOfTypeTag(signature.declaration);
50055
50103
  if (jsdocSignature && signature !== jsdocSignature) {
50056
50104
  jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
@@ -53643,14 +53691,13 @@ var ts;
53643
53691
  return false;
53644
53692
  }
53645
53693
  function isContextSensitiveFunctionLikeDeclaration(node) {
53646
- return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) &&
53647
- (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node));
53694
+ return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
53648
53695
  }
53649
53696
  function hasContextSensitiveReturnExpression(node) {
53650
53697
  return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 && isContextSensitive(node.body);
53651
53698
  }
53652
53699
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
53653
- return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
53700
+ return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
53654
53701
  isContextSensitiveFunctionLikeDeclaration(func);
53655
53702
  }
53656
53703
  function getTypeWithoutSignatures(type) {
@@ -61414,8 +61461,11 @@ var ts;
61414
61461
  case 1:
61415
61462
  case 6:
61416
61463
  case 3:
61417
- var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
61418
61464
  case 2:
61465
+ var valueDeclaration = void 0;
61466
+ if (kind !== 2) {
61467
+ valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
61468
+ }
61419
61469
  valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
61420
61470
  var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
61421
61471
  return annotated ? getTypeFromTypeNode(annotated) : undefined;
@@ -61824,9 +61874,14 @@ var ts;
61824
61874
  if (!isErrorType(intrinsicClassAttribs)) {
61825
61875
  var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
61826
61876
  var hostClassType = getReturnTypeOfSignature(sig);
61827
- apparentAttributesType = intersectTypes(typeParams
61828
- ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)))
61829
- : intrinsicClassAttribs, apparentAttributesType);
61877
+ var libraryManagedAttributeType = void 0;
61878
+ if (typeParams) {
61879
+ var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
61880
+ libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
61881
+ }
61882
+ else
61883
+ libraryManagedAttributeType = intrinsicClassAttribs;
61884
+ apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
61830
61885
  }
61831
61886
  var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
61832
61887
  if (!isErrorType(intrinsicAttribs)) {
@@ -65043,11 +65098,13 @@ var ts;
65043
65098
  return false;
65044
65099
  }
65045
65100
  var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
65046
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
65101
+ (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
65047
65102
  undefined;
65048
65103
  if (func) {
65049
65104
  if (ts.getJSDocClassTag(node))
65050
65105
  return true;
65106
+ if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent)))
65107
+ return false;
65051
65108
  var symbol = getSymbolOfNode(func);
65052
65109
  return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
65053
65110
  }
@@ -65279,8 +65336,8 @@ var ts;
65279
65336
  if (hasDefaultOnly && type && !isErrorType(type)) {
65280
65337
  var synthType = type;
65281
65338
  if (!synthType.defaultOnlyType) {
65282
- var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
65283
- synthType.defaultOnlyType = type_5;
65339
+ var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol);
65340
+ synthType.defaultOnlyType = type_4;
65284
65341
  }
65285
65342
  return synthType.defaultOnlyType;
65286
65343
  }
@@ -73404,6 +73461,12 @@ var ts;
73404
73461
  return resolveJSDocMemberName(name, false, getSymbolOfNode(container));
73405
73462
  }
73406
73463
  }
73464
+ if (result && isJSDoc_1) {
73465
+ var container = ts.getJSDocHost(name);
73466
+ if (container && ts.isEnumMember(container) && container === result.valueDeclaration) {
73467
+ return resolveEntityName(name, meaning, true, true, ts.getSourceFileOfNode(container)) || result;
73468
+ }
73469
+ }
73407
73470
  return result;
73408
73471
  }
73409
73472
  else if (ts.isPrivateIdentifier(name)) {
@@ -88487,6 +88550,12 @@ var ts;
88487
88550
  case 265:
88488
88551
  ts.Debug.assert(importVariableName !== undefined);
88489
88552
  statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName)));
88553
+ if (ts.hasSyntacticModifier(entry, 1)) {
88554
+ statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, undefined, [
88555
+ factory.createStringLiteral(ts.idText(importVariableName)),
88556
+ parameterName,
88557
+ ])));
88558
+ }
88490
88559
  break;
88491
88560
  case 272:
88492
88561
  ts.Debug.assert(importVariableName !== undefined);
@@ -90728,8 +90797,12 @@ var ts;
90728
90797
  }
90729
90798
  var previousNeedsDeclare = needsDeclare;
90730
90799
  switch (input.kind) {
90731
- case 259:
90732
- return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
90800
+ case 259: {
90801
+ needsDeclare = false;
90802
+ var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
90803
+ needsDeclare = previousNeedsDeclare;
90804
+ return clean;
90805
+ }
90733
90806
  case 258: {
90734
90807
  return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
90735
90808
  }
@@ -92038,8 +92111,8 @@ var ts;
92038
92111
  return JSON.stringify(buildInfo);
92039
92112
  }
92040
92113
  ts.getBuildInfoText = getBuildInfoText;
92041
- function getBuildInfo(buildInfoText) {
92042
- return JSON.parse(buildInfoText);
92114
+ function getBuildInfo(buildInfoFile, buildInfoText) {
92115
+ return ts.readJsonOrUndefined(buildInfoFile, buildInfoText);
92043
92116
  }
92044
92117
  ts.getBuildInfo = getBuildInfo;
92045
92118
  ts.notImplementedResolver = {
@@ -92113,17 +92186,16 @@ var ts;
92113
92186
  var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
92114
92187
  var buildInfo;
92115
92188
  if (host.getBuildInfo) {
92116
- var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
92117
- if (!hostBuildInfo)
92118
- return buildInfoPath;
92119
- buildInfo = hostBuildInfo;
92189
+ buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
92120
92190
  }
92121
92191
  else {
92122
92192
  var buildInfoText = host.readFile(buildInfoPath);
92123
92193
  if (!buildInfoText)
92124
92194
  return buildInfoPath;
92125
- buildInfo = getBuildInfo(buildInfoText);
92195
+ buildInfo = getBuildInfo(buildInfoPath, buildInfoText);
92126
92196
  }
92197
+ if (!buildInfo)
92198
+ return buildInfoPath;
92127
92199
  if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
92128
92200
  return buildInfoPath;
92129
92201
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
@@ -96367,7 +96439,15 @@ var ts;
96367
96439
  return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath));
96368
96440
  }
96369
96441
  function getCachedFileSystemEntriesForBaseDir(path) {
96370
- return getCachedFileSystemEntries(ts.getDirectoryPath(path));
96442
+ var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path));
96443
+ if (!entries) {
96444
+ return entries;
96445
+ }
96446
+ if (!entries.sortedAndCanonicalizedFiles) {
96447
+ entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort();
96448
+ entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort();
96449
+ }
96450
+ return entries;
96371
96451
  }
96372
96452
  function getBaseNameOfFileName(fileName) {
96373
96453
  return ts.getBaseFileName(ts.normalizePath(fileName));
@@ -96402,21 +96482,9 @@ var ts;
96402
96482
  return undefined;
96403
96483
  }
96404
96484
  }
96405
- function fileNameEqual(name1, name2) {
96406
- return getCanonicalFileName(name1) === getCanonicalFileName(name2);
96407
- }
96408
96485
  function hasEntry(entries, name) {
96409
- return ts.some(entries, function (file) { return fileNameEqual(file, name); });
96410
- }
96411
- function updateFileSystemEntry(entries, baseName, isValid) {
96412
- if (hasEntry(entries, baseName)) {
96413
- if (!isValid) {
96414
- return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); });
96415
- }
96416
- }
96417
- else if (isValid) {
96418
- return entries.push(baseName);
96419
- }
96486
+ var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive);
96487
+ return index >= 0;
96420
96488
  }
96421
96489
  function writeFile(fileName, data, writeByteOrderMark) {
96422
96490
  var path = toPath(fileName);
@@ -96429,7 +96497,7 @@ var ts;
96429
96497
  function fileExists(fileName) {
96430
96498
  var path = toPath(fileName);
96431
96499
  var result = getCachedFileSystemEntriesForBaseDir(path);
96432
- return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) ||
96500
+ return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) ||
96433
96501
  host.fileExists(fileName);
96434
96502
  }
96435
96503
  function directoryExists(dirPath) {
@@ -96439,9 +96507,13 @@ var ts;
96439
96507
  function createDirectory(dirPath) {
96440
96508
  var path = toPath(dirPath);
96441
96509
  var result = getCachedFileSystemEntriesForBaseDir(path);
96442
- var baseFileName = getBaseNameOfFileName(dirPath);
96443
96510
  if (result) {
96444
- updateFileSystemEntry(result.directories, baseFileName, true);
96511
+ var baseName = getBaseNameOfFileName(dirPath);
96512
+ var canonicalizedBaseName = getCanonicalFileName(baseName);
96513
+ var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories;
96514
+ if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
96515
+ result.directories.push(baseName);
96516
+ }
96445
96517
  }
96446
96518
  host.createDirectory(dirPath);
96447
96519
  }
@@ -96505,7 +96577,7 @@ var ts;
96505
96577
  fileExists: host.fileExists(fileOrDirectoryPath),
96506
96578
  directoryExists: host.directoryExists(fileOrDirectoryPath)
96507
96579
  };
96508
- if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) {
96580
+ if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
96509
96581
  clearCache();
96510
96582
  }
96511
96583
  else {
@@ -96523,7 +96595,21 @@ var ts;
96523
96595
  }
96524
96596
  }
96525
96597
  function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) {
96526
- updateFileSystemEntry(parentResult.files, baseName, fileExists);
96598
+ var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles;
96599
+ var canonicalizedBaseName = getCanonicalFileName(baseName);
96600
+ if (fileExists) {
96601
+ if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) {
96602
+ parentResult.files.push(baseName);
96603
+ }
96604
+ }
96605
+ else {
96606
+ var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive);
96607
+ if (sortedIndex >= 0) {
96608
+ canonicalizedFiles.splice(sortedIndex, 1);
96609
+ var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; });
96610
+ parentResult.files.splice(unsortedIndex, 1);
96611
+ }
96612
+ }
96527
96613
  }
96528
96614
  function clearCache() {
96529
96615
  cachedReadDirectoryResult.clear();
@@ -103677,18 +103763,14 @@ var ts;
103677
103763
  var buildInfo;
103678
103764
  if (host.getBuildInfo) {
103679
103765
  buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
103680
- if (!buildInfo)
103681
- return undefined;
103682
103766
  }
103683
103767
  else {
103684
103768
  var content = host.readFile(buildInfoPath);
103685
103769
  if (!content)
103686
103770
  return undefined;
103687
- buildInfo = ts.getBuildInfo(content);
103771
+ buildInfo = ts.getBuildInfo(buildInfoPath, content);
103688
103772
  }
103689
- if (buildInfo.version !== ts.version)
103690
- return undefined;
103691
- if (!buildInfo.program)
103773
+ if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
103692
103774
  return undefined;
103693
103775
  return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host);
103694
103776
  }
@@ -103901,7 +103983,8 @@ var ts;
103901
103983
  }
103902
103984
  }
103903
103985
  var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
103904
- if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103986
+ var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
103987
+ if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103905
103988
  if (hasChangedConfigFileParsingErrors) {
103906
103989
  if (reportFileChangeDetectedOnCreateProgram) {
103907
103990
  reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
@@ -103920,6 +104003,11 @@ var ts;
103920
104003
  if (host.afterProgramCreate && program !== builderProgram) {
103921
104004
  host.afterProgramCreate(builderProgram);
103922
104005
  }
104006
+ compilerHost.readFile = originalReadFile;
104007
+ compilerHost.fileExists = originalFileExists;
104008
+ compilerHost.directoryExists = originalDirectoryExists;
104009
+ compilerHost.createDirectory = originalCreateDirectory;
104010
+ compilerHost.writeFile = originalWriteFile;
103923
104011
  return builderProgram;
103924
104012
  }
103925
104013
  function createNewProgram(hasInvalidatedResolution) {
@@ -104339,16 +104427,17 @@ var ts;
104339
104427
  UpToDateStatusType[UpToDateStatusType["UpToDateWithUpstreamTypes"] = 2] = "UpToDateWithUpstreamTypes";
104340
104428
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
104341
104429
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
104342
- UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
104343
- UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
104344
- UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
104345
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
104346
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
104347
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
104348
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
104349
- UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
104350
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
104351
- UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
104430
+ UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile";
104431
+ UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf";
104432
+ UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
104433
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
104434
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate";
104435
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked";
104436
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream";
104437
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate";
104438
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText";
104439
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly";
104440
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild";
104352
104441
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
104353
104442
  function resolveConfigFileProjectName(project) {
104354
104443
  if (ts.fileExtensionIs(project, ".json")) {
@@ -104548,6 +104637,7 @@ var ts;
104548
104637
  if (value) {
104549
104638
  return isParsedCommandLine(value) ? value : undefined;
104550
104639
  }
104640
+ ts.performance.mark("SolutionBuilder::beforeConfigFileParsing");
104551
104641
  var diagnostic;
104552
104642
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
104553
104643
  var parsed;
@@ -104562,6 +104652,8 @@ var ts;
104562
104652
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
104563
104653
  }
104564
104654
  configFileCache.set(configFilePath, parsed || diagnostic);
104655
+ ts.performance.mark("SolutionBuilder::afterConfigFileParsing");
104656
+ ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing");
104565
104657
  return parsed;
104566
104658
  }
104567
104659
  function resolveProjectName(state, name) {
@@ -104754,6 +104846,7 @@ var ts;
104754
104846
  if (updateOutputFileStampsPending) {
104755
104847
  updateOutputTimestamps(state, config, projectPath);
104756
104848
  }
104849
+ ts.performance.mark("SolutionBuilder::Timestamps only updates");
104757
104850
  return doneInvalidatedProject(state, projectPath);
104758
104851
  }
104759
104852
  };
@@ -104847,6 +104940,10 @@ var ts;
104847
104940
  };
104848
104941
  function done(cancellationToken, writeFile, customTransformers) {
104849
104942
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
104943
+ if (kind === InvalidatedProjectKind.Build)
104944
+ ts.performance.mark("SolutionBuilder::Projects built");
104945
+ else
104946
+ ts.performance.mark("SolutionBuilder::Bundles updated");
104850
104947
  return doneInvalidatedProject(state, projectPath);
104851
104948
  }
104852
104949
  function withProgramOrUndefined(action) {
@@ -105013,13 +105110,13 @@ var ts;
105013
105110
  var emitterDiagnostics = ts.createDiagnosticCollection();
105014
105111
  var emittedOutputs = new ts.Map();
105015
105112
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
105016
- var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
105113
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined;
105017
105114
  outputFiles.forEach(function (_a) {
105018
105115
  var _b, _c;
105019
105116
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
105020
105117
  emittedOutputs.set(toPath(state, name), name);
105021
105118
  if (buildInfo) {
105022
- if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
105119
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
105023
105120
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
105024
105121
  }
105025
105122
  setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
@@ -105302,8 +105399,7 @@ var ts;
105302
105399
  return existing.buildInfo || undefined;
105303
105400
  }
105304
105401
  var value = state.readFileWithCache(buildInfoPath);
105305
- var buildInfo = value ? ts.getBuildInfo(value) : undefined;
105306
- ts.Debug.assert(modifiedTime || !buildInfo);
105402
+ var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
105307
105403
  state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
105308
105404
  return buildInfo;
105309
105405
  }
@@ -105381,7 +105477,13 @@ var ts;
105381
105477
  missingOutputFileName: buildInfoPath
105382
105478
  };
105383
105479
  }
105384
- var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
105480
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime);
105481
+ if (!buildInfo) {
105482
+ return {
105483
+ type: ts.UpToDateStatusType.ErrorReadingFile,
105484
+ fileName: buildInfoPath
105485
+ };
105486
+ }
105385
105487
  if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
105386
105488
  return {
105387
105489
  type: ts.UpToDateStatusType.TsVersionOutputOfDate,
@@ -105559,7 +105661,10 @@ var ts;
105559
105661
  if (prior !== undefined) {
105560
105662
  return prior;
105561
105663
  }
105664
+ ts.performance.mark("SolutionBuilder::beforeUpToDateCheck");
105562
105665
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
105666
+ ts.performance.mark("SolutionBuilder::afterUpToDateCheck");
105667
+ ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck");
105563
105668
  state.projectStatus.set(resolvedPath, actual);
105564
105669
  return actual;
105565
105670
  }
@@ -105686,6 +105791,13 @@ var ts;
105686
105791
  }
105687
105792
  }
105688
105793
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
105794
+ ts.performance.mark("SolutionBuilder::beforeBuild");
105795
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
105796
+ ts.performance.mark("SolutionBuilder::afterBuild");
105797
+ ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
105798
+ return result;
105799
+ }
105800
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
105689
105801
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
105690
105802
  if (!buildOrder)
105691
105803
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -105713,6 +105825,13 @@ var ts;
105713
105825
  : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
105714
105826
  }
105715
105827
  function clean(state, project, onlyReferences) {
105828
+ ts.performance.mark("SolutionBuilder::beforeClean");
105829
+ var result = cleanWorker(state, project, onlyReferences);
105830
+ ts.performance.mark("SolutionBuilder::afterClean");
105831
+ ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean");
105832
+ return result;
105833
+ }
105834
+ function cleanWorker(state, project, onlyReferences) {
105716
105835
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
105717
105836
  if (!buildOrder)
105718
105837
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -105783,6 +105902,14 @@ var ts;
105783
105902
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
105784
105903
  }
105785
105904
  function buildNextInvalidatedProject(state, changeDetected) {
105905
+ ts.performance.mark("SolutionBuilder::beforeBuild");
105906
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
105907
+ ts.performance.mark("SolutionBuilder::afterBuild");
105908
+ ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
105909
+ if (buildOrder)
105910
+ reportErrorSummary(state, buildOrder);
105911
+ }
105912
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
105786
105913
  state.timerToBuildInvalidatedProject = undefined;
105787
105914
  if (state.reportFileChangeDetected) {
105788
105915
  state.reportFileChangeDetected = false;
@@ -105812,7 +105939,7 @@ var ts;
105812
105939
  }
105813
105940
  }
105814
105941
  disableCache(state);
105815
- reportErrorSummary(state, buildOrder);
105942
+ return buildOrder;
105816
105943
  }
105817
105944
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
105818
105945
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
@@ -105867,6 +105994,7 @@ var ts;
105867
105994
  function startWatching(state, buildOrder) {
105868
105995
  if (!state.watchAllProjectsPending)
105869
105996
  return;
105997
+ ts.performance.mark("SolutionBuilder::beforeWatcherCreation");
105870
105998
  state.watchAllProjectsPending = false;
105871
105999
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
105872
106000
  var resolved = _a[_i];
@@ -105880,6 +106008,8 @@ var ts;
105880
106008
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
105881
106009
  }
105882
106010
  }
106011
+ ts.performance.mark("SolutionBuilder::afterWatcherCreation");
106012
+ ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation");
105883
106013
  }
105884
106014
  function stopWatching(state) {
105885
106015
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -105989,6 +106119,8 @@ var ts;
105989
106119
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName));
105990
106120
  case ts.UpToDateStatusType.OutputMissing:
105991
106121
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName));
106122
+ case ts.UpToDateStatusType.ErrorReadingFile:
106123
+ return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName));
105992
106124
  case ts.UpToDateStatusType.OutOfDateBuildInfo:
105993
106125
  return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile));
105994
106126
  case ts.UpToDateStatusType.UpToDate:
@@ -106029,6 +106161,12 @@ var ts;
106029
106161
  })(ts || (ts = {}));
106030
106162
  var ts;
106031
106163
  (function (ts) {
106164
+ var StatisticType;
106165
+ (function (StatisticType) {
106166
+ StatisticType[StatisticType["time"] = 0] = "time";
106167
+ StatisticType[StatisticType["count"] = 1] = "count";
106168
+ StatisticType[StatisticType["memory"] = 2] = "memory";
106169
+ })(StatisticType = ts.StatisticType || (ts.StatisticType = {}));
106032
106170
  function countLines(program) {
106033
106171
  var counts = getCountsMap();
106034
106172
  ts.forEach(program.getSourceFiles(), function (file) {
@@ -106038,14 +106176,6 @@ var ts;
106038
106176
  });
106039
106177
  return counts;
106040
106178
  }
106041
- function countNodes(program) {
106042
- var counts = getCountsMap();
106043
- ts.forEach(program.getSourceFiles(), function (file) {
106044
- var key = getCountKey(program, file);
106045
- counts.set(key, counts.get(key) + file.nodeCount);
106046
- });
106047
- return counts;
106048
- }
106049
106179
  function getCountsMap() {
106050
106180
  var counts = new ts.Map();
106051
106181
  counts.set("Library", 0);
@@ -106589,15 +106719,26 @@ var ts;
106589
106719
  if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
106590
106720
  return;
106591
106721
  var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions));
106592
- updateSolutionBuilderHost(sys, cb, buildHost_1);
106722
+ var solutionPerformance_1 = enableSolutionPerformance(sys, buildOptions);
106723
+ updateSolutionBuilderHost(sys, cb, buildHost_1, solutionPerformance_1);
106724
+ var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange;
106725
+ buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) {
106726
+ onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount);
106727
+ if (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
106728
+ d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code) {
106729
+ reportSolutionBuilderTimes(builder_1, solutionPerformance_1);
106730
+ }
106731
+ };
106593
106732
  var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions);
106594
106733
  builder_1.build();
106595
106734
  return builder_1;
106596
106735
  }
106597
106736
  var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions));
106598
- updateSolutionBuilderHost(sys, cb, buildHost);
106737
+ var solutionPerformance = enableSolutionPerformance(sys, buildOptions);
106738
+ updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance);
106599
106739
  var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
106600
106740
  var exitStatus = buildOptions.clean ? builder.clean() : builder.build();
106741
+ reportSolutionBuilderTimes(builder, solutionPerformance);
106601
106742
  ts.dumpTracingLegend();
106602
106743
  return sys.exit(exitStatus);
106603
106744
  }
@@ -106622,7 +106763,7 @@ var ts;
106622
106763
  };
106623
106764
  var program = ts.createProgram(programOptions);
106624
106765
  var exitStatus = ts.emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, function (s) { return sys.write(s + sys.newLine); }, createReportErrorSummary(sys, options));
106625
- reportStatistics(sys, program);
106766
+ reportStatistics(sys, program, undefined);
106626
106767
  cb(program);
106627
106768
  return sys.exit(exitStatus);
106628
106769
  }
@@ -106640,36 +106781,36 @@ var ts;
106640
106781
  reportDiagnostic: reportDiagnostic,
106641
106782
  reportErrorSummary: createReportErrorSummary(sys, options),
106642
106783
  afterProgramEmitAndDiagnostics: function (builderProgram) {
106643
- reportStatistics(sys, builderProgram.getProgram());
106784
+ reportStatistics(sys, builderProgram.getProgram(), undefined);
106644
106785
  cb(builderProgram);
106645
106786
  }
106646
106787
  });
106647
106788
  return sys.exit(exitStatus);
106648
106789
  }
106649
- function updateSolutionBuilderHost(sys, cb, buildHost) {
106650
- updateCreateProgram(sys, buildHost);
106790
+ function updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance) {
106791
+ updateCreateProgram(sys, buildHost, true);
106651
106792
  buildHost.afterProgramEmitAndDiagnostics = function (program) {
106652
- reportStatistics(sys, program.getProgram());
106793
+ reportStatistics(sys, program.getProgram(), solutionPerformance);
106653
106794
  cb(program);
106654
106795
  };
106655
106796
  buildHost.afterEmitBundle = cb;
106656
106797
  }
106657
- function updateCreateProgram(sys, host) {
106798
+ function updateCreateProgram(sys, host, isBuildMode) {
106658
106799
  var compileUsingBuilder = host.createProgram;
106659
106800
  host.createProgram = function (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) {
106660
106801
  ts.Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram));
106661
106802
  if (options !== undefined) {
106662
- enableStatisticsAndTracing(sys, options, true);
106803
+ enableStatisticsAndTracing(sys, options, isBuildMode);
106663
106804
  }
106664
106805
  return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
106665
106806
  };
106666
106807
  }
106667
106808
  function updateWatchCompilationHost(sys, cb, watchCompilerHost) {
106668
- updateCreateProgram(sys, watchCompilerHost);
106809
+ updateCreateProgram(sys, watchCompilerHost, false);
106669
106810
  var emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate;
106670
106811
  watchCompilerHost.afterProgramCreate = function (builderProgram) {
106671
106812
  emitFilesUsingBuilder(builderProgram);
106672
- reportStatistics(sys, builderProgram.getProgram());
106813
+ reportStatistics(sys, builderProgram.getProgram(), undefined);
106673
106814
  cb(builderProgram);
106674
106815
  };
106675
106816
  }
@@ -106702,6 +106843,71 @@ var ts;
106702
106843
  updateWatchCompilationHost(system, cb, watchCompilerHost);
106703
106844
  return ts.createWatchProgram(watchCompilerHost);
106704
106845
  }
106846
+ function enableSolutionPerformance(system, options) {
106847
+ if (system === ts.sys && options.extendedDiagnostics) {
106848
+ ts.performance.enable();
106849
+ return createSolutionPerfomrance();
106850
+ }
106851
+ }
106852
+ function createSolutionPerfomrance() {
106853
+ var statistics;
106854
+ return {
106855
+ addAggregateStatistic: addAggregateStatistic,
106856
+ forEachAggregateStatistics: forEachAggreateStatistics,
106857
+ clear: clear,
106858
+ };
106859
+ function addAggregateStatistic(s) {
106860
+ var existing = statistics === null || statistics === void 0 ? void 0 : statistics.get(s.name);
106861
+ if (existing) {
106862
+ if (existing.type === StatisticType.memory)
106863
+ existing.value = Math.max(existing.value, s.value);
106864
+ else
106865
+ existing.value += s.value;
106866
+ }
106867
+ else {
106868
+ (statistics !== null && statistics !== void 0 ? statistics : (statistics = new ts.Map())).set(s.name, s);
106869
+ }
106870
+ }
106871
+ function forEachAggreateStatistics(cb) {
106872
+ statistics === null || statistics === void 0 ? void 0 : statistics.forEach(cb);
106873
+ }
106874
+ function clear() {
106875
+ statistics = undefined;
106876
+ }
106877
+ }
106878
+ function reportSolutionBuilderTimes(builder, solutionPerformance) {
106879
+ if (!solutionPerformance)
106880
+ return;
106881
+ if (!ts.performance.isEnabled()) {
106882
+ ts.sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
106883
+ return;
106884
+ }
106885
+ var statistics = [];
106886
+ statistics.push({ name: "Projects in scope", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count });
106887
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Projects built");
106888
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Timestamps only updates");
106889
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Bundles updated");
106890
+ solutionPerformance.forEachAggregateStatistics(function (s) {
106891
+ s.name = "Aggregate " + s.name;
106892
+ statistics.push(s);
106893
+ });
106894
+ ts.performance.forEachMeasure(function (name, duration) {
106895
+ if (isSolutionMarkOrMeasure(name))
106896
+ statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name) + " time", value: duration, type: StatisticType.time });
106897
+ });
106898
+ ts.performance.disable();
106899
+ ts.performance.enable();
106900
+ reportAllStatistics(ts.sys, statistics);
106901
+ function reportSolutionBuilderCountStatistic(name) {
106902
+ var value = ts.performance.getCount(name);
106903
+ if (value) {
106904
+ statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name), value: value, type: StatisticType.count });
106905
+ }
106906
+ }
106907
+ function getNameFromSolutionBuilderMarkOrMeasure(name) {
106908
+ return name.replace("SolutionBuilder::", "");
106909
+ }
106910
+ }
106705
106911
  function canReportDiagnostics(system, compilerOptions) {
106706
106912
  return system === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
106707
106913
  }
@@ -106716,7 +106922,10 @@ var ts;
106716
106922
  ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
106717
106923
  }
106718
106924
  }
106719
- function reportStatistics(sys, program) {
106925
+ function isSolutionMarkOrMeasure(name) {
106926
+ return ts.startsWith(name, "SolutionBuilder::");
106927
+ }
106928
+ function reportStatistics(sys, program, solutionPerformance) {
106720
106929
  var compilerOptions = program.getCompilerOptions();
106721
106930
  if (canTrace(sys, compilerOptions)) {
106722
106931
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing();
@@ -106727,27 +106936,21 @@ var ts;
106727
106936
  var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
106728
106937
  reportCountStatistic("Files", program.getSourceFiles().length);
106729
106938
  var lineCounts = countLines(program);
106730
- var nodeCounts = countNodes(program);
106731
106939
  if (compilerOptions.extendedDiagnostics) {
106732
106940
  for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
106733
106941
  var key = _a[_i];
106734
106942
  reportCountStatistic("Lines of " + key, lineCounts.get(key));
106735
106943
  }
106736
- for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
106737
- var key = _c[_b];
106738
- reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
106739
- }
106740
106944
  }
106741
106945
  else {
106742
106946
  reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
106743
- reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
106744
106947
  }
106745
106948
  reportCountStatistic("Identifiers", program.getIdentifierCount());
106746
106949
  reportCountStatistic("Symbols", program.getSymbolCount());
106747
106950
  reportCountStatistic("Types", program.getTypeCount());
106748
106951
  reportCountStatistic("Instantiations", program.getInstantiationCount());
106749
106952
  if (memoryUsed >= 0) {
106750
- reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
106953
+ reportStatisticalValue({ name: "Memory used", value: memoryUsed, type: StatisticType.memory }, true);
106751
106954
  }
106752
106955
  var isPerformanceEnabled = ts.performance.isEnabled();
106753
106956
  var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0;
@@ -106761,53 +106964,83 @@ var ts;
106761
106964
  reportCountStatistic("Subtype cache size", caches.subtype);
106762
106965
  reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
106763
106966
  if (isPerformanceEnabled) {
106764
- ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + " time", duration); });
106967
+ ts.performance.forEachMeasure(function (name, duration) {
106968
+ if (!isSolutionMarkOrMeasure(name))
106969
+ reportTimeStatistic(name + " time", duration, true);
106970
+ });
106765
106971
  }
106766
106972
  }
106767
106973
  else if (isPerformanceEnabled) {
106768
- reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"));
106769
- reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"));
106770
- reportTimeStatistic("Parse time", programTime);
106771
- reportTimeStatistic("Bind time", bindTime);
106772
- reportTimeStatistic("Check time", checkTime);
106773
- reportTimeStatistic("Emit time", emitTime);
106974
+ reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"), true);
106975
+ reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"), true);
106976
+ reportTimeStatistic("Parse time", programTime, true);
106977
+ reportTimeStatistic("Bind time", bindTime, true);
106978
+ reportTimeStatistic("Check time", checkTime, true);
106979
+ reportTimeStatistic("Emit time", emitTime, true);
106774
106980
  }
106775
106981
  if (isPerformanceEnabled) {
106776
- reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
106982
+ reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime, false);
106777
106983
  }
106778
- reportStatistics();
106984
+ reportAllStatistics(sys, statistics);
106779
106985
  if (!isPerformanceEnabled) {
106780
106986
  sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
106781
106987
  }
106782
106988
  else {
106783
- ts.performance.disable();
106784
- }
106785
- }
106786
- function reportStatistics() {
106787
- var nameSize = 0;
106788
- var valueSize = 0;
106789
- for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
106790
- var _a = statistics_1[_i], name = _a.name, value = _a.value;
106791
- if (name.length > nameSize) {
106792
- nameSize = name.length;
106989
+ if (solutionPerformance) {
106990
+ ts.performance.forEachMeasure(function (name) {
106991
+ if (!isSolutionMarkOrMeasure(name))
106992
+ ts.performance.clearMeasures(name);
106993
+ });
106994
+ ts.performance.forEachMark(function (name) {
106995
+ if (!isSolutionMarkOrMeasure(name))
106996
+ ts.performance.clearMarks(name);
106997
+ });
106793
106998
  }
106794
- if (value.length > valueSize) {
106795
- valueSize = value.length;
106999
+ else {
107000
+ ts.performance.disable();
106796
107001
  }
106797
107002
  }
106798
- for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {
106799
- var _c = statistics_2[_b], name = _c.name, value = _c.value;
106800
- sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine);
106801
- }
106802
107003
  }
106803
- function reportStatisticalValue(name, value) {
106804
- statistics.push({ name: name, value: value });
107004
+ function reportStatisticalValue(s, aggregate) {
107005
+ statistics.push(s);
107006
+ if (aggregate)
107007
+ solutionPerformance === null || solutionPerformance === void 0 ? void 0 : solutionPerformance.addAggregateStatistic(s);
106805
107008
  }
106806
107009
  function reportCountStatistic(name, count) {
106807
- reportStatisticalValue(name, "" + count);
107010
+ reportStatisticalValue({ name: name, value: count, type: StatisticType.count }, true);
106808
107011
  }
106809
- function reportTimeStatistic(name, time) {
106810
- reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
107012
+ function reportTimeStatistic(name, time, aggregate) {
107013
+ reportStatisticalValue({ name: name, value: time, type: StatisticType.time }, aggregate);
107014
+ }
107015
+ }
107016
+ function reportAllStatistics(sys, statistics) {
107017
+ var nameSize = 0;
107018
+ var valueSize = 0;
107019
+ for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
107020
+ var s = statistics_1[_i];
107021
+ if (s.name.length > nameSize) {
107022
+ nameSize = s.name.length;
107023
+ }
107024
+ var value = statisticValue(s);
107025
+ if (value.length > valueSize) {
107026
+ valueSize = value.length;
107027
+ }
107028
+ }
107029
+ for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) {
107030
+ var s = statistics_2[_a];
107031
+ sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine);
107032
+ }
107033
+ }
107034
+ function statisticValue(s) {
107035
+ switch (s.type) {
107036
+ case StatisticType.count:
107037
+ return "" + s.value;
107038
+ case StatisticType.time:
107039
+ return (s.value / 1000).toFixed(2) + "s";
107040
+ case StatisticType.memory:
107041
+ return Math.round(s.value / 1000) + "K";
107042
+ default:
107043
+ ts.Debug.assertNever(s.type);
106811
107044
  }
106812
107045
  }
106813
107046
  function writeConfigFile(sys, reportDiagnostic, options, fileNames) {