@typescript-deploys/pr-build 4.9.0-pr-50007-10 → 4.9.0-pr-50247-10

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
@@ -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.9";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220810";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20220815";
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) {
@@ -3024,6 +3025,8 @@ var ts;
3024
3025
  typeof performance.mark === "function" &&
3025
3026
  typeof performance.measure === "function" &&
3026
3027
  typeof performance.now === "function" &&
3028
+ typeof performance.clearMarks === "function" &&
3029
+ typeof performance.clearMeasures === "function" &&
3027
3030
  typeof PerformanceObserver === "function";
3028
3031
  }
3029
3032
  function tryGetWebPerformanceHooks() {
@@ -3061,7 +3064,9 @@ var ts;
3061
3064
  if (end === "__performance.measure-fix__") {
3062
3065
  nodePerformance_1.clearMarks("__performance.measure-fix__");
3063
3066
  }
3064
- }
3067
+ },
3068
+ clearMarks: function (name) { return nodePerformance_1.clearMarks(name); },
3069
+ clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); },
3065
3070
  };
3066
3071
  }
3067
3072
  return {
@@ -3156,6 +3161,30 @@ var ts;
3156
3161
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3157
3162
  }
3158
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;
3159
3188
  function isEnabled() {
3160
3189
  return enabled;
3161
3190
  }
@@ -5081,12 +5110,9 @@ var ts;
5081
5110
  }
5082
5111
  ts.getPathFromPathComponents = getPathFromPathComponents;
5083
5112
  function normalizeSlashes(path) {
5084
- var index = path.indexOf("\\");
5085
- if (index === -1) {
5086
- return path;
5087
- }
5088
- backslashRegExp.lastIndex = index;
5089
- return path.replace(backslashRegExp, ts.directorySeparator);
5113
+ return path.indexOf("\\") !== -1
5114
+ ? path.replace(backslashRegExp, ts.directorySeparator)
5115
+ : path;
5090
5116
  }
5091
5117
  ts.normalizeSlashes = normalizeSlashes;
5092
5118
  function reducePathComponents(components) {
@@ -6709,6 +6735,7 @@ var ts;
6709
6735
  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."),
6710
6736
  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"),
6711
6737
  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"),
6738
+ 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}'"),
6712
6739
  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}'"),
6713
6740
  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."),
6714
6741
  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."),
@@ -15293,20 +15320,18 @@ var ts;
15293
15320
  return getStringFromExpandedCharCodes(expandedCharCodes);
15294
15321
  }
15295
15322
  ts.base64decode = base64decode;
15296
- function readJsonIgnoringErrors(path, host) {
15297
- return readJsonIgnoringErrorsFromText(path, host.readFile(path));
15298
- }
15299
- ts.readJsonIgnoringErrors = readJsonIgnoringErrors;
15300
- function readJsonIgnoringErrorsFromText(path, jsonText) {
15323
+ function readJsonOrUndefined(path, hostOrText) {
15324
+ var jsonText = ts.isString(hostOrText) || hostOrText === undefined ? hostOrText : hostOrText.readFile(path);
15301
15325
  if (!jsonText)
15302
- return {};
15326
+ return undefined;
15303
15327
  var result = ts.parseConfigFileTextToJson(path, jsonText);
15304
- if (result.error) {
15305
- return {};
15306
- }
15307
- return result.config;
15328
+ return !result.error ? result.config : undefined;
15329
+ }
15330
+ ts.readJsonOrUndefined = readJsonOrUndefined;
15331
+ function readJson(path, hostOrText) {
15332
+ return readJsonOrUndefined(path, hostOrText) || {};
15308
15333
  }
15309
- ts.readJsonIgnoringErrorsFromText = readJsonIgnoringErrorsFromText;
15334
+ ts.readJson = readJson;
15310
15335
  function directoryProbablyExists(directoryName, host) {
15311
15336
  return !host.directoryExists || host.directoryExists(directoryName);
15312
15337
  }
@@ -22345,10 +22370,12 @@ var ts;
22345
22370
  node.helpers = ts.map(bundleFileInfo.sources && bundleFileInfo.sources.helpers, function (name) { return ts.getAllUnscopedEmitHelpers().get(name); });
22346
22371
  return node;
22347
22372
  }
22348
- function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
22373
+ function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPathOrHost, declarationPathOrOptions, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
22349
22374
  var node = ts.parseNodeFactory.createInputFiles();
22350
22375
  if (!ts.isString(javascriptTextOrReadFileText)) {
22351
22376
  var cache_1 = new ts.Map();
22377
+ var host_1 = javascriptPathOrHost;
22378
+ var options_1 = declarationPathOrOptions;
22352
22379
  var textGetter_1 = function (path) {
22353
22380
  if (path === undefined)
22354
22381
  return undefined;
@@ -22364,10 +22391,18 @@ var ts;
22364
22391
  return result !== undefined ? result : "/* Input file " + path + " was missing */\r\n";
22365
22392
  };
22366
22393
  var buildInfo_1;
22367
- var getAndCacheBuildInfo_1 = function (getText) {
22368
- if (buildInfo_1 === undefined) {
22369
- var result = getText();
22370
- buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
22394
+ var getAndCacheBuildInfo = function () {
22395
+ var _a, _b, _c;
22396
+ if (buildInfo_1 === undefined && declarationMapTextOrBuildInfoPath) {
22397
+ if (host_1 === null || host_1 === void 0 ? void 0 : host_1.getBuildInfo) {
22398
+ buildInfo_1 = (_a = host_1.getBuildInfo(declarationMapTextOrBuildInfoPath, options_1)) !== null && _a !== void 0 ? _a : false;
22399
+ }
22400
+ else {
22401
+ var result = textGetter_1(declarationMapTextOrBuildInfoPath);
22402
+ if (result)
22403
+ (_b = host_1 === null || host_1 === void 0 ? void 0 : host_1.buildInfoCallbacks) === null || _b === void 0 ? void 0 : _b.onRead(result.length, options_1);
22404
+ buildInfo_1 = result !== undefined ? (_c = ts.getBuildInfo(declarationMapTextOrBuildInfoPath, result)) !== null && _c !== void 0 ? _c : false : false;
22405
+ }
22371
22406
  }
22372
22407
  return buildInfo_1 || undefined;
22373
22408
  };
@@ -22381,7 +22416,7 @@ var ts;
22381
22416
  javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
22382
22417
  declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
22383
22418
  declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
22384
- buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
22419
+ buildInfo: { get: getAndCacheBuildInfo },
22385
22420
  });
22386
22421
  }
22387
22422
  else {
@@ -22391,8 +22426,8 @@ var ts;
22391
22426
  node.declarationText = declarationTextOrJavascriptPath;
22392
22427
  node.declarationMapPath = declarationMapPath;
22393
22428
  node.declarationMapText = declarationMapTextOrBuildInfoPath;
22394
- node.javascriptPath = javascriptPath;
22395
- node.declarationPath = declarationPath;
22429
+ node.javascriptPath = javascriptPathOrHost;
22430
+ node.declarationPath = declarationPathOrOptions;
22396
22431
  node.buildInfoPath = buildInfoPath;
22397
22432
  node.buildInfo = buildInfo;
22398
22433
  node.oldFileOfCurrentEmit = oldFileOfCurrentEmit;
@@ -34116,8 +34151,8 @@ var ts;
34116
34151
  entries.push({ value: "" });
34117
34152
  }
34118
34153
  entries.push({ value: "/* " + category + " */" });
34119
- for (var _i = 0, options_1 = options; _i < options_1.length; _i++) {
34120
- var option = options_1[_i];
34154
+ for (var _i = 0, options_2 = options; _i < options_2.length; _i++) {
34155
+ var option = options_2[_i];
34121
34156
  var optionName = void 0;
34122
34157
  if (compilerOptionsMap.has(option.name)) {
34123
34158
  optionName = "\"" + option.name + "\": " + JSON.stringify(compilerOptionsMap.get(option.name)) + ((seenKnownKeys += 1) === compilerOptionsMap.size ? "" : ",");
@@ -34579,7 +34614,7 @@ var ts;
34579
34614
  function getDefaultCompilerOptions(configFileName) {
34580
34615
  var options = configFileName && ts.getBaseFileName(configFileName) === "jsconfig.json"
34581
34616
  ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true, noEmit: true }
34582
- : {};
34617
+ : { cacheResolutions: true };
34583
34618
  return options;
34584
34619
  }
34585
34620
  function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) {
@@ -35337,7 +35372,7 @@ var ts;
35337
35372
  var typeDirectivePath = _b[_a];
35338
35373
  var normalized = ts.normalizePath(typeDirectivePath);
35339
35374
  var packageJsonPath = ts.combinePaths(root, normalized, "package.json");
35340
- var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.readJsonIgnoringErrors(packageJsonPath, host).typings === null;
35375
+ var isNotNeededPackage = host.fileExists(packageJsonPath) && ts.readJson(packageJsonPath, host).typings === null;
35341
35376
  if (!isNotNeededPackage) {
35342
35377
  var baseFileName = ts.getBaseFileName(normalized);
35343
35378
  if (baseFileName.charCodeAt(0) !== 46) {
@@ -36365,9 +36400,9 @@ var ts;
36365
36400
  var _a;
36366
36401
  var fromCache = (_a = state.packageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.getPackageJsonScope(directory);
36367
36402
  if (fromCache) {
36368
- var host_1 = state.host, traceEnabled = state.traceEnabled;
36403
+ var host_2 = state.host, traceEnabled = state.traceEnabled;
36369
36404
  if (traceEnabled) {
36370
- trace(host_1, fromCache.info ?
36405
+ trace(host_2, fromCache.info ?
36371
36406
  ts.Diagnostics.Directory_0_resolves_to_1_scope_according_to_cache :
36372
36407
  ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_according_to_cache, directory, getPackageJsconLocationFromScope(fromCache));
36373
36408
  }
@@ -36415,7 +36450,7 @@ var ts;
36415
36450
  var directoryExists = ts.directoryProbablyExists(packageDirectory, host);
36416
36451
  if (directoryExists && host.fileExists(packageJsonPath)) {
36417
36452
  var packageJsonText = host.readFile(packageJsonPath);
36418
- var packageJsonContent = ts.readJsonIgnoringErrorsFromText(packageJsonPath, packageJsonText);
36453
+ var packageJsonContent = ts.readJson(packageJsonPath, packageJsonText);
36419
36454
  if (traceEnabled) {
36420
36455
  trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
36421
36456
  }
@@ -61648,8 +61683,11 @@ var ts;
61648
61683
  case 1:
61649
61684
  case 6:
61650
61685
  case 3:
61651
- var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
61652
61686
  case 2:
61687
+ var valueDeclaration = void 0;
61688
+ if (kind !== 2) {
61689
+ valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration;
61690
+ }
61653
61691
  valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration);
61654
61692
  var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration);
61655
61693
  return annotated ? getTypeFromTypeNode(annotated) : undefined;
@@ -61698,25 +61736,7 @@ var ts;
61698
61736
  }
61699
61737
  function getTypeOfPropertyOfContextualType(type, name, nameType) {
61700
61738
  return mapType(type, function (t) {
61701
- if (t.flags & 2097152) {
61702
- var intersection = t;
61703
- var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType);
61704
- if (newTypes.length > 0) {
61705
- return getIntersectionType(newTypes);
61706
- }
61707
- newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType);
61708
- if (newTypes.length > 0) {
61709
- return getIntersectionType(newTypes);
61710
- }
61711
- return undefined;
61712
- }
61713
- var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t);
61714
- if (concretePropertyType) {
61715
- return concretePropertyType;
61716
- }
61717
- return getTypeOfApplicableIndexInfoOfContextualType(t);
61718
- }, true);
61719
- function getTypeOfConcretePropertyOfContextualType(t) {
61739
+ var _a;
61720
61740
  if (isGenericMappedType(t) && !t.declaration.nameType) {
61721
61741
  var constraint = getConstraintTypeFromMappedType(t);
61722
61742
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
@@ -61724,9 +61744,8 @@ var ts;
61724
61744
  if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
61725
61745
  return substituteIndexedMappedType(t, propertyNameType);
61726
61746
  }
61727
- return undefined;
61728
61747
  }
61729
- if (t.flags & 3670016) {
61748
+ else if (t.flags & 3670016) {
61730
61749
  var prop = getPropertyOfType(t, name);
61731
61750
  if (prop) {
61732
61751
  return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop);
@@ -61737,16 +61756,10 @@ var ts;
61737
61756
  return restType;
61738
61757
  }
61739
61758
  }
61759
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
61740
61760
  }
61741
61761
  return undefined;
61742
- }
61743
- function getTypeOfApplicableIndexInfoOfContextualType(t) {
61744
- var _a;
61745
- if (!(t.flags & 3670016)) {
61746
- return undefined;
61747
- }
61748
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
61749
- }
61762
+ }, true);
61750
61763
  }
61751
61764
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
61752
61765
  ts.Debug.assert(ts.isObjectLiteralMethod(node));
@@ -62058,9 +62071,14 @@ var ts;
62058
62071
  if (!isErrorType(intrinsicClassAttribs)) {
62059
62072
  var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
62060
62073
  var hostClassType = getReturnTypeOfSignature(sig);
62061
- apparentAttributesType = intersectTypes(typeParams
62062
- ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)))
62063
- : intrinsicClassAttribs, apparentAttributesType);
62074
+ var libraryManagedAttributeType = void 0;
62075
+ if (typeParams) {
62076
+ var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
62077
+ libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
62078
+ }
62079
+ else
62080
+ libraryManagedAttributeType = intrinsicClassAttribs;
62081
+ apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
62064
62082
  }
62065
62083
  var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
62066
62084
  if (!isErrorType(intrinsicAttribs)) {
@@ -65277,11 +65295,13 @@ var ts;
65277
65295
  return false;
65278
65296
  }
65279
65297
  var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node :
65280
- ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
65298
+ (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer :
65281
65299
  undefined;
65282
65300
  if (func) {
65283
65301
  if (ts.getJSDocClassTag(node))
65284
65302
  return true;
65303
+ if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent)))
65304
+ return false;
65285
65305
  var symbol = getSymbolOfNode(func);
65286
65306
  return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size);
65287
65307
  }
@@ -73185,12 +73205,12 @@ var ts;
73185
73205
  var parent = node.parent;
73186
73206
  var paramTag = node.parent.parent;
73187
73207
  if (ts.isJSDocTypeExpression(node.parent) && ts.isJSDocParameterTag(paramTag)) {
73188
- var host_2 = ts.getHostSignatureFromJSDoc(paramTag);
73208
+ var host_3 = ts.getHostSignatureFromJSDoc(paramTag);
73189
73209
  var isCallbackTag = ts.isJSDocCallbackTag(paramTag.parent.parent);
73190
- if (host_2 || isCallbackTag) {
73210
+ if (host_3 || isCallbackTag) {
73191
73211
  var lastParamDeclaration = isCallbackTag
73192
73212
  ? ts.lastOrUndefined(paramTag.parent.parent.typeExpression.parameters)
73193
- : ts.lastOrUndefined(host_2.parameters);
73213
+ : ts.lastOrUndefined(host_3.parameters);
73194
73214
  var symbol = ts.getParameterSymbolFromJSDoc(paramTag);
73195
73215
  if (!lastParamDeclaration ||
73196
73216
  symbol && lastParamDeclaration.symbol === symbol && ts.isRestParameter(lastParamDeclaration)) {
@@ -75707,9 +75727,9 @@ var ts;
75707
75727
  }
75708
75728
  var parent = ts.walkUpParenthesizedTypes(node.parent);
75709
75729
  if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) {
75710
- var host_3 = ts.getJSDocHost(parent);
75711
- if (host_3) {
75712
- parent = ts.getSingleVariableOfVariableStatement(host_3) || host_3;
75730
+ var host_4 = ts.getJSDocHost(parent);
75731
+ if (host_4) {
75732
+ parent = ts.getSingleVariableOfVariableStatement(host_4) || host_4;
75713
75733
  }
75714
75734
  }
75715
75735
  switch (parent.kind) {
@@ -92078,6 +92098,7 @@ var ts;
92078
92098
  }
92079
92099
  }
92080
92100
  function emitBuildInfo(bundle, buildInfoPath) {
92101
+ var _a;
92081
92102
  if (!buildInfoPath || targetSourceFile || emitSkipped)
92082
92103
  return;
92083
92104
  var program = host.getProgramBuildInfo();
@@ -92087,7 +92108,9 @@ var ts;
92087
92108
  }
92088
92109
  var version = ts.version;
92089
92110
  var buildInfo = { bundle: bundle, program: program, version: version };
92090
- ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText(buildInfo), false, undefined, { buildInfo: buildInfo });
92111
+ var buildInfoText = getBuildInfoText(buildInfo);
92112
+ (_a = host.buildInfoCallbacks) === null || _a === void 0 ? void 0 : _a.onWrite(buildInfoText.length);
92113
+ ts.writeFile(host, emitterDiagnostics, buildInfoPath, buildInfoText, false, undefined, { buildInfo: buildInfo });
92091
92114
  }
92092
92115
  function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo) {
92093
92116
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -92289,8 +92312,8 @@ var ts;
92289
92312
  return JSON.stringify(buildInfo);
92290
92313
  }
92291
92314
  ts.getBuildInfoText = getBuildInfoText;
92292
- function getBuildInfo(buildInfoText) {
92293
- return JSON.parse(buildInfoText);
92315
+ function getBuildInfo(buildInfoFile, buildInfoText) {
92316
+ return ts.readJsonOrUndefined(buildInfoFile, buildInfoText);
92294
92317
  }
92295
92318
  ts.getBuildInfo = getBuildInfo;
92296
92319
  ts.notImplementedResolver = {
@@ -92360,20 +92383,20 @@ var ts;
92360
92383
  });
92361
92384
  }
92362
92385
  function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) {
92386
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "emitUsingBuildInfo", {}, true);
92387
+ ts.performance.mark("beforeEmit");
92388
+ var result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers);
92389
+ ts.performance.mark("afterEmit");
92390
+ ts.performance.measure("Emit", "beforeEmit", "afterEmit");
92391
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
92392
+ return result;
92393
+ }
92394
+ ts.emitUsingBuildInfo = emitUsingBuildInfo;
92395
+ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers) {
92363
92396
  var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath;
92364
- var buildInfo;
92365
- if (host.getBuildInfo) {
92366
- var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath);
92367
- if (!hostBuildInfo)
92368
- return buildInfoPath;
92369
- buildInfo = hostBuildInfo;
92370
- }
92371
- else {
92372
- var buildInfoText = host.readFile(buildInfoPath);
92373
- if (!buildInfoText)
92374
- return buildInfoPath;
92375
- buildInfo = getBuildInfo(buildInfoText);
92376
- }
92397
+ var buildInfo = host.getBuildInfo(buildInfoPath, config.options);
92398
+ if (!buildInfo)
92399
+ return buildInfoPath;
92377
92400
  if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts))
92378
92401
  return buildInfoPath;
92379
92402
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
@@ -92399,7 +92422,7 @@ var ts;
92399
92422
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
92400
92423
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
92401
92424
  var outputFiles = [];
92402
- var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); });
92425
+ var prependNodes = ts.createPrependNodes(config.projectReferences, getCommandLine, function (f) { return host.readFile(f); }, host);
92403
92426
  var sourceFilesForJsEmit = createSourceFilesFromBundleBuildInfo(buildInfo.bundle, buildInfoDirectory, host);
92404
92427
  var changedDtsText;
92405
92428
  var changedDtsData;
@@ -92440,7 +92463,8 @@ var ts;
92440
92463
  newBuildInfo.bundle.dts.sources = dts.sources;
92441
92464
  }
92442
92465
  newBuildInfo.bundle.sourceFiles = sourceFiles;
92443
- outputFiles.push({ name: name, text: getBuildInfoText(newBuildInfo), writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
92466
+ var newBuildInfoText = getBuildInfoText(newBuildInfo);
92467
+ outputFiles.push({ name: name, text: newBuildInfoText, writeByteOrderMark: writeByteOrderMark, buildInfo: newBuildInfo });
92444
92468
  return;
92445
92469
  case declarationFilePath:
92446
92470
  if (declarationText === text)
@@ -92466,11 +92490,11 @@ var ts;
92466
92490
  redirectTargetsMap: ts.createMultiMap(),
92467
92491
  getFileIncludeReasons: ts.notImplemented,
92468
92492
  createHash: ts.maybeBind(host, host.createHash),
92493
+ buildInfoCallbacks: host.buildInfoCallbacks,
92469
92494
  };
92470
92495
  emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options, customTransformers));
92471
92496
  return outputFiles;
92472
92497
  }
92473
- ts.emitUsingBuildInfo = emitUsingBuildInfo;
92474
92498
  function createPrinter(printerOptions, handlers) {
92475
92499
  if (printerOptions === void 0) { printerOptions = {}; }
92476
92500
  if (handlers === void 0) { handlers = {}; }
@@ -97107,15 +97131,12 @@ var ts;
97107
97131
  return createCompilerHostWorker(options, setParentNodes);
97108
97132
  }
97109
97133
  ts.createCompilerHost = createCompilerHost;
97110
- function createCompilerHostWorker(options, setParentNodes, system) {
97111
- if (system === void 0) { system = ts.sys; }
97112
- var existingDirectories = new ts.Map();
97113
- var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
97114
- function getSourceFile(fileName, languageVersionOrOptions, onError) {
97134
+ function createGetSourceFile(readFile, getCompilerOptions, setParentNodes) {
97135
+ return function (fileName, languageVersionOrOptions, onError) {
97115
97136
  var text;
97116
97137
  try {
97117
97138
  ts.performance.mark("beforeIORead");
97118
- text = compilerHost.readFile(fileName);
97139
+ text = readFile(fileName, getCompilerOptions().charset);
97119
97140
  ts.performance.mark("afterIORead");
97120
97141
  ts.performance.measure("I/O Read", "beforeIORead", "afterIORead");
97121
97142
  }
@@ -97126,21 +97147,14 @@ var ts;
97126
97147
  text = "";
97127
97148
  }
97128
97149
  return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions, setParentNodes) : undefined;
97129
- }
97130
- function directoryExists(directoryPath) {
97131
- if (existingDirectories.has(directoryPath)) {
97132
- return true;
97133
- }
97134
- if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
97135
- existingDirectories.set(directoryPath, true);
97136
- return true;
97137
- }
97138
- return false;
97139
- }
97140
- function writeFile(fileName, data, writeByteOrderMark, onError) {
97150
+ };
97151
+ }
97152
+ ts.createGetSourceFile = createGetSourceFile;
97153
+ function createWriteFile(writeFile, createDirectory, directoryExists) {
97154
+ return function (fileName, data, writeByteOrderMark, onError) {
97141
97155
  try {
97142
97156
  ts.performance.mark("beforeIOWrite");
97143
- ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, function (path, data, writeByteOrderMark) { return system.writeFile(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); });
97157
+ ts.writeFileEnsuringDirectories(fileName, data, writeByteOrderMark, writeFile, createDirectory, directoryExists);
97144
97158
  ts.performance.mark("afterIOWrite");
97145
97159
  ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
97146
97160
  }
@@ -97149,6 +97163,22 @@ var ts;
97149
97163
  onError(e.message);
97150
97164
  }
97151
97165
  }
97166
+ };
97167
+ }
97168
+ ts.createWriteFile = createWriteFile;
97169
+ function createCompilerHostWorker(options, setParentNodes, system) {
97170
+ if (system === void 0) { system = ts.sys; }
97171
+ var existingDirectories = new ts.Map();
97172
+ var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames);
97173
+ function directoryExists(directoryPath) {
97174
+ if (existingDirectories.has(directoryPath)) {
97175
+ return true;
97176
+ }
97177
+ if ((compilerHost.directoryExists || system.directoryExists)(directoryPath)) {
97178
+ existingDirectories.set(directoryPath, true);
97179
+ return true;
97180
+ }
97181
+ return false;
97152
97182
  }
97153
97183
  function getDefaultLibLocation() {
97154
97184
  return ts.getDirectoryPath(ts.normalizePath(system.getExecutingFilePath()));
@@ -97156,10 +97186,10 @@ var ts;
97156
97186
  var newLine = ts.getNewLineCharacter(options, function () { return system.newLine; });
97157
97187
  var realpath = system.realpath && (function (path) { return system.realpath(path); });
97158
97188
  var compilerHost = {
97159
- getSourceFile: getSourceFile,
97189
+ getSourceFile: createGetSourceFile(function (fileName) { return compilerHost.readFile(fileName); }, function () { return options; }, setParentNodes),
97160
97190
  getDefaultLibLocation: getDefaultLibLocation,
97161
97191
  getDefaultLibFileName: function (options) { return ts.combinePaths(getDefaultLibLocation(), ts.getDefaultLibFileName(options)); },
97162
- writeFile: writeFile,
97192
+ writeFile: createWriteFile(function (path, data, writeByteOrderMark) { return system.writeFile(path, data, writeByteOrderMark); }, function (path) { return (compilerHost.createDirectory || system.createDirectory)(path); }, function (path) { return directoryExists(path); }),
97163
97193
  getCurrentDirectory: ts.memoize(function () { return system.getCurrentDirectory(); }),
97164
97194
  useCaseSensitiveFileNames: function () { return system.useCaseSensitiveFileNames; },
97165
97195
  getCanonicalFileName: getCanonicalFileName,
@@ -98696,6 +98726,7 @@ var ts;
98696
98726
  redirectTargetsMap: redirectTargetsMap,
98697
98727
  getFileIncludeReasons: program.getFileIncludeReasons,
98698
98728
  createHash: ts.maybeBind(host, host.createHash),
98729
+ buildInfoCallbacks: host.buildInfoCallbacks,
98699
98730
  };
98700
98731
  }
98701
98732
  function writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
@@ -98722,7 +98753,7 @@ var ts;
98722
98753
  var path = toPath(fileName);
98723
98754
  var sourceFile = getSourceFileByPath(path);
98724
98755
  return sourceFile ? sourceFile.text : filesByName.has(path) ? undefined : host.readFile(path);
98725
- });
98756
+ }, host);
98726
98757
  }
98727
98758
  function isSourceFileFromExternalLibrary(file) {
98728
98759
  return !!sourceFilesFoundSearchingNodeModules.get(file.path);
@@ -99825,9 +99856,6 @@ var ts;
99825
99856
  createDiagnosticForOptionName(ts.Diagnostics.Composite_projects_may_not_disable_incremental_compilation, "declaration");
99826
99857
  }
99827
99858
  }
99828
- if (options.cacheResolutions && !ts.isIncrementalCompilation(options)) {
99829
- createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "cacheResolutions", "incremental", "composite");
99830
- }
99831
99859
  var outputFile = ts.outFile(options);
99832
99860
  if (options.tsBuildInfoFile) {
99833
99861
  if (!ts.isIncrementalCompilation(options)) {
@@ -100522,7 +100550,7 @@ var ts;
100522
100550
  };
100523
100551
  }
100524
100552
  ts.parseConfigHostFromCompilerHostLike = parseConfigHostFromCompilerHostLike;
100525
- function createPrependNodes(projectReferences, getCommandLine, readFile) {
100553
+ function createPrependNodes(projectReferences, getCommandLine, readFile, host) {
100526
100554
  if (!projectReferences)
100527
100555
  return ts.emptyArray;
100528
100556
  var nodes;
@@ -100534,7 +100562,7 @@ var ts;
100534
100562
  if (!out)
100535
100563
  continue;
100536
100564
  var _a = ts.getOutputPathsForBundle(resolvedRefOpts.options, true), jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
100537
- var node = ts.createInputFiles(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath);
100565
+ var node = ts.createInputFiles(readFile, jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath, host, resolvedRefOpts.options);
100538
100566
  (nodes || (nodes = [])).push(node);
100539
100567
  }
100540
100568
  }
@@ -101212,10 +101240,10 @@ var ts;
101212
101240
  if (!state.cleanedDiagnosticsOfLibFiles) {
101213
101241
  state.cleanedDiagnosticsOfLibFiles = true;
101214
101242
  var program_1 = ts.Debug.checkDefined(state.program);
101215
- var options_2 = program_1.getCompilerOptions();
101243
+ var options_3 = program_1.getCompilerOptions();
101216
101244
  ts.forEach(program_1.getSourceFiles(), function (f) {
101217
101245
  return program_1.isSourceFileDefaultLibrary(f) &&
101218
- !ts.skipTypeChecking(f, options_2, program_1) &&
101246
+ !ts.skipTypeChecking(f, options_3, program_1) &&
101219
101247
  removeSemanticDiagnosticsOf(state, f.resolvedPath);
101220
101248
  });
101221
101249
  }
@@ -104588,25 +104616,10 @@ var ts;
104588
104616
  var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames();
104589
104617
  var hostGetNewLine = ts.memoize(function () { return host.getNewLine(); });
104590
104618
  return {
104591
- getSourceFile: function (fileName, languageVersionOrOptions, onError) {
104592
- var text;
104593
- try {
104594
- ts.performance.mark("beforeIORead");
104595
- text = host.readFile(fileName, getCompilerOptions().charset);
104596
- ts.performance.mark("afterIORead");
104597
- ts.performance.measure("I/O Read", "beforeIORead", "afterIORead");
104598
- }
104599
- catch (e) {
104600
- if (onError) {
104601
- onError(e.message);
104602
- }
104603
- text = "";
104604
- }
104605
- return text !== undefined ? ts.createSourceFile(fileName, text, languageVersionOrOptions) : undefined;
104606
- },
104619
+ getSourceFile: ts.createGetSourceFile(function (fileName, encoding) { return host.readFile(fileName, encoding); }, getCompilerOptions, undefined),
104607
104620
  getDefaultLibLocation: ts.maybeBind(host, host.getDefaultLibLocation),
104608
104621
  getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); },
104609
- writeFile: writeFile,
104622
+ writeFile: ts.createWriteFile(function (path, data, writeByteOrderMark) { return host.writeFile(path, data, writeByteOrderMark); }, function (path) { return host.createDirectory(path); }, function (path) { return host.directoryExists(path); }),
104610
104623
  getCurrentDirectory: ts.memoize(function () { return host.getCurrentDirectory(); }),
104611
104624
  useCaseSensitiveFileNames: function () { return useCaseSensitiveFileNames; },
104612
104625
  getCanonicalFileName: ts.createGetCanonicalFileName(useCaseSensitiveFileNames),
@@ -104622,20 +104635,8 @@ var ts;
104622
104635
  readDirectory: ts.maybeBind(host, host.readDirectory),
104623
104636
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
104624
104637
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
104638
+ buildInfoCallbacks: host.buildInfoCallbacks,
104625
104639
  };
104626
- function writeFile(fileName, text, writeByteOrderMark, onError) {
104627
- try {
104628
- ts.performance.mark("beforeIOWrite");
104629
- ts.writeFileEnsuringDirectories(fileName, text, writeByteOrderMark, function (path, data, writeByteOrderMark) { return host.writeFile(path, data, writeByteOrderMark); }, function (path) { return host.createDirectory(path); }, function (path) { return host.directoryExists(path); });
104630
- ts.performance.mark("afterIOWrite");
104631
- ts.performance.measure("I/O Write", "beforeIOWrite", "afterIOWrite");
104632
- }
104633
- catch (e) {
104634
- if (onError) {
104635
- onError(e.message);
104636
- }
104637
- }
104638
- }
104639
104640
  }
104640
104641
  ts.createCompilerHostFromProgramHost = createCompilerHostFromProgramHost;
104641
104642
  function setGetSourceFileAsHashVersioned(compilerHost, host) {
@@ -104732,24 +104733,22 @@ var ts;
104732
104733
  var ts;
104733
104734
  (function (ts) {
104734
104735
  function readBuildInfoForProgram(compilerOptions, host) {
104736
+ var _a;
104735
104737
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(compilerOptions);
104736
104738
  if (!buildInfoPath)
104737
104739
  return undefined;
104738
104740
  var buildInfo;
104739
104741
  if (host.getBuildInfo) {
104740
- buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath);
104741
- if (!buildInfo)
104742
- return undefined;
104742
+ buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions);
104743
104743
  }
104744
104744
  else {
104745
104745
  var content = host.readFile(buildInfoPath);
104746
104746
  if (!content)
104747
104747
  return undefined;
104748
- buildInfo = ts.getBuildInfo(content);
104748
+ (_a = host.buildInfoCallbacks) === null || _a === void 0 ? void 0 : _a.onRead(content.length, compilerOptions);
104749
+ buildInfo = ts.getBuildInfo(buildInfoPath, content);
104749
104750
  }
104750
- if (buildInfo.version !== ts.version)
104751
- return undefined;
104752
- if (!buildInfo.program)
104751
+ if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program)
104753
104752
  return undefined;
104754
104753
  return { buildInfo: buildInfo, buildInfoPath: buildInfoPath };
104755
104754
  }
@@ -104988,7 +104987,7 @@ var ts;
104988
104987
  }
104989
104988
  reportFileChangeDetectedOnCreateProgram = false;
104990
104989
  if (host.afterProgramCreate && program !== builderProgram) {
104991
- host.afterProgramCreate(builderProgram);
104990
+ host.afterProgramCreate(builderProgram, compilerHost);
104992
104991
  }
104993
104992
  compilerHost.readFile = originalReadFile;
104994
104993
  compilerHost.fileExists = originalFileExists;
@@ -105405,16 +105404,17 @@ var ts;
105405
105404
  UpToDateStatusType[UpToDateStatusType["UpToDateWithUpstreamTypes"] = 2] = "UpToDateWithUpstreamTypes";
105406
105405
  UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend";
105407
105406
  UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing";
105408
- UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf";
105409
- UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream";
105410
- UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo";
105411
- UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate";
105412
- UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked";
105413
- UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream";
105414
- UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate";
105415
- UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText";
105416
- UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly";
105417
- UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild";
105407
+ UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile";
105408
+ UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf";
105409
+ UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream";
105410
+ UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo";
105411
+ UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate";
105412
+ UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked";
105413
+ UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream";
105414
+ UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate";
105415
+ UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText";
105416
+ UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly";
105417
+ UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild";
105418
105418
  })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
105419
105419
  function resolveConfigFileProjectName(project) {
105420
105420
  if (ts.fileExtensionIs(project, ".json")) {
@@ -105542,7 +105542,7 @@ var ts;
105542
105542
  };
105543
105543
  compilerHost.getTypeReferenceDirectiveResolutionCache = function () { return typeReferenceDirectiveResolutionCache; };
105544
105544
  }
105545
- compilerHost.getBuildInfo = function (fileName, configFilePath) { return getBuildInfo(state, fileName, toResolvedConfigFilePath(state, configFilePath), undefined); };
105545
+ compilerHost.getBuildInfo = function (fileName, options) { return getBuildInfo(state, fileName, options, toResolvedConfigFilePath(state, options.configFilePath), undefined); };
105546
105546
  var _a = ts.createWatchFactory(hostWithWatch, options), watchFile = _a.watchFile, watchDirectory = _a.watchDirectory, writeLog = _a.writeLog;
105547
105547
  var state = {
105548
105548
  host: host,
@@ -105616,6 +105616,7 @@ var ts;
105616
105616
  if (value) {
105617
105617
  return isParsedCommandLine(value) ? value : undefined;
105618
105618
  }
105619
+ ts.performance.mark("SolutionBuilder::beforeConfigFileParsing");
105619
105620
  var diagnostic;
105620
105621
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
105621
105622
  var parsed;
@@ -105630,6 +105631,8 @@ var ts;
105630
105631
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
105631
105632
  }
105632
105633
  configFileCache.set(configFilePath, parsed || diagnostic);
105634
+ ts.performance.mark("SolutionBuilder::afterConfigFileParsing");
105635
+ ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing");
105633
105636
  return parsed;
105634
105637
  }
105635
105638
  function resolveProjectName(state, name) {
@@ -105822,6 +105825,7 @@ var ts;
105822
105825
  if (updateOutputFileStampsPending) {
105823
105826
  updateOutputTimestamps(state, config, projectPath);
105824
105827
  }
105828
+ ts.performance.mark("SolutionBuilder::Timestamps only updates");
105825
105829
  return doneInvalidatedProject(state, projectPath);
105826
105830
  }
105827
105831
  };
@@ -105915,6 +105919,10 @@ var ts;
105915
105919
  };
105916
105920
  function done(cancellationToken, writeFile, customTransformers) {
105917
105921
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
105922
+ if (kind === InvalidatedProjectKind.Build)
105923
+ ts.performance.mark("SolutionBuilder::Projects built");
105924
+ else
105925
+ ts.performance.mark("SolutionBuilder::Bundles updated");
105918
105926
  return doneInvalidatedProject(state, projectPath);
105919
105927
  }
105920
105928
  function withProgramOrUndefined(action) {
@@ -105973,7 +105981,7 @@ var ts;
105973
105981
  }
105974
105982
  function emit(writeFileCallback, cancellationToken, customTransformers) {
105975
105983
  var _a;
105976
- var _b, _c, _d;
105984
+ var _b, _c, _d, _e, _f;
105977
105985
  ts.Debug.assertIsDefined(program);
105978
105986
  ts.Debug.assert(step === BuildStep.Emit);
105979
105987
  var saved = program.saveEmitState();
@@ -105983,6 +105991,7 @@ var ts;
105983
105991
  var emitResult = ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, undefined, function (name, text, writeByteOrderMark, _onError, _sourceFiles, data) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark, buildInfo: data === null || data === void 0 ? void 0 : data.buildInfo }); }, cancellationToken, false, customTransformers || ((_c = (_b = state.host).getCustomTransformers) === null || _c === void 0 ? void 0 : _c.call(_b, project))).emitResult;
105984
105992
  if (declDiagnostics) {
105985
105993
  program.restoreEmitState(saved);
105994
+ (_d = state.compilerHost.buildInfoCallbacks) === null || _d === void 0 ? void 0 : _d.revertLastWrite();
105986
105995
  (_a = buildErrors(state, projectPath, program, config, declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file"), buildResult = _a.buildResult, step = _a.step);
105987
105996
  return {
105988
105997
  emitSkipped: true,
@@ -105990,7 +105999,8 @@ var ts;
105990
105999
  };
105991
106000
  }
105992
106001
  var host = state.host, compilerHost = state.compilerHost;
105993
- var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
106002
+ (_e = compilerHost.buildInfoCallbacks) === null || _e === void 0 ? void 0 : _e.clearLastWrite();
106003
+ var resultFlags = ((_f = program.hasChangedEmitSignature) === null || _f === void 0 ? void 0 : _f.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
105994
106004
  var emitterDiagnostics = ts.createDiagnosticCollection();
105995
106005
  var emittedOutputs = new ts.Map();
105996
106006
  var options = program.getCompilerOptions();
@@ -106056,7 +106066,7 @@ var ts;
106056
106066
  return emitDiagnostics;
106057
106067
  }
106058
106068
  function emitBundle(writeFileCallback, customTransformers) {
106059
- var _a, _b;
106069
+ var _a, _b, _c, _d;
106060
106070
  ts.Debug.assert(kind === InvalidatedProjectKind.UpdateBundle);
106061
106071
  if (state.options.dry) {
106062
106072
  reportStatus(state, ts.Diagnostics.A_non_dry_build_would_update_output_of_project_0, project);
@@ -106068,10 +106078,11 @@ var ts;
106068
106078
  reportStatus(state, ts.Diagnostics.Updating_output_of_project_0, project);
106069
106079
  var compilerHost = state.compilerHost;
106070
106080
  state.projectCompilerOptions = config.options;
106081
+ (_b = (_a = state.host).beforeEmitBundle) === null || _b === void 0 ? void 0 : _b.call(_a, config, compilerHost);
106071
106082
  var outputFiles = ts.emitUsingBuildInfo(config, compilerHost, function (ref) {
106072
106083
  var refName = resolveProjectName(state, ref.path);
106073
106084
  return parseConfigFile(state, refName, toResolvedConfigFilePath(state, refName));
106074
- }, customTransformers || ((_b = (_a = state.host).getCustomTransformers) === null || _b === void 0 ? void 0 : _b.call(_a, project)));
106085
+ }, customTransformers || ((_d = (_c = state.host).getCustomTransformers) === null || _d === void 0 ? void 0 : _d.call(_c, project)));
106075
106086
  if (ts.isString(outputFiles)) {
106076
106087
  reportStatus(state, ts.Diagnostics.Cannot_update_output_of_project_0_because_there_was_error_reading_file_1, project, relName(state, outputFiles));
106077
106088
  step = BuildStep.BuildInvalidatedProjectOfBundle;
@@ -106081,13 +106092,13 @@ var ts;
106081
106092
  var emitterDiagnostics = ts.createDiagnosticCollection();
106082
106093
  var emittedOutputs = new ts.Map();
106083
106094
  var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
106084
- var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo;
106095
+ var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined;
106085
106096
  outputFiles.forEach(function (_a) {
106086
106097
  var _b, _c;
106087
106098
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
106088
106099
  emittedOutputs.set(toPath(state, name), name);
106089
106100
  if (buildInfo) {
106090
- if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
106101
+ 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)) {
106091
106102
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
106092
106103
  }
106093
106104
  setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
@@ -106263,12 +106274,12 @@ var ts;
106263
106274
  if (state.write)
106264
106275
  ts.listFiles(program, state.write);
106265
106276
  if (state.host.afterProgramEmitAndDiagnostics) {
106266
- state.host.afterProgramEmitAndDiagnostics(program);
106277
+ state.host.afterProgramEmitAndDiagnostics(program, state.compilerHost);
106267
106278
  }
106268
106279
  program.releaseProgram();
106269
106280
  }
106270
106281
  else if (state.host.afterEmitBundle) {
106271
- state.host.afterEmitBundle(config);
106282
+ state.host.afterEmitBundle(config, state.compilerHost);
106272
106283
  }
106273
106284
  state.projectCompilerOptions = state.baseCompilerOptions;
106274
106285
  }
@@ -106363,15 +106374,17 @@ var ts;
106363
106374
  var existing = state.buildInfoCache.get(resolvedConfigPath);
106364
106375
  return (existing === null || existing === void 0 ? void 0 : existing.path) === path ? existing : undefined;
106365
106376
  }
106366
- function getBuildInfo(state, buildInfoPath, resolvedConfigPath, modifiedTime) {
106377
+ function getBuildInfo(state, buildInfoPath, options, resolvedConfigPath, modifiedTime) {
106378
+ var _a;
106367
106379
  var path = toPath(state, buildInfoPath);
106368
106380
  var existing = state.buildInfoCache.get(resolvedConfigPath);
106369
106381
  if (existing !== undefined && existing.path === path) {
106370
106382
  return existing.buildInfo || undefined;
106371
106383
  }
106372
106384
  var value = state.readFileWithCache(buildInfoPath);
106373
- var buildInfo = value ? ts.getBuildInfo(value) : undefined;
106374
- ts.Debug.assert(modifiedTime || !buildInfo);
106385
+ if (value)
106386
+ (_a = (modifiedTime ? state.host : state.compilerHost).buildInfoCallbacks) === null || _a === void 0 ? void 0 : _a.onRead(value.length, options);
106387
+ var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined;
106375
106388
  state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime });
106376
106389
  return buildInfo;
106377
106390
  }
@@ -106449,7 +106462,13 @@ var ts;
106449
106462
  missingOutputFileName: buildInfoPath
106450
106463
  };
106451
106464
  }
106452
- var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime));
106465
+ var buildInfo = getBuildInfo(state, buildInfoPath, project.options, resolvedPath, buildInfoTime);
106466
+ if (!buildInfo) {
106467
+ return {
106468
+ type: ts.UpToDateStatusType.ErrorReadingFile,
106469
+ fileName: buildInfoPath
106470
+ };
106471
+ }
106453
106472
  if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) {
106454
106473
  return {
106455
106474
  type: ts.UpToDateStatusType.TsVersionOutputOfDate,
@@ -106627,7 +106646,10 @@ var ts;
106627
106646
  if (prior !== undefined) {
106628
106647
  return prior;
106629
106648
  }
106649
+ ts.performance.mark("SolutionBuilder::beforeUpToDateCheck");
106630
106650
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
106651
+ ts.performance.mark("SolutionBuilder::afterUpToDateCheck");
106652
+ ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck");
106631
106653
  state.projectStatus.set(resolvedPath, actual);
106632
106654
  return actual;
106633
106655
  }
@@ -106754,6 +106776,13 @@ var ts;
106754
106776
  }
106755
106777
  }
106756
106778
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
106779
+ ts.performance.mark("SolutionBuilder::beforeBuild");
106780
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
106781
+ ts.performance.mark("SolutionBuilder::afterBuild");
106782
+ ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
106783
+ return result;
106784
+ }
106785
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
106757
106786
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
106758
106787
  if (!buildOrder)
106759
106788
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -106781,6 +106810,13 @@ var ts;
106781
106810
  : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
106782
106811
  }
106783
106812
  function clean(state, project, onlyReferences) {
106813
+ ts.performance.mark("SolutionBuilder::beforeClean");
106814
+ var result = cleanWorker(state, project, onlyReferences);
106815
+ ts.performance.mark("SolutionBuilder::afterClean");
106816
+ ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean");
106817
+ return result;
106818
+ }
106819
+ function cleanWorker(state, project, onlyReferences) {
106784
106820
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
106785
106821
  if (!buildOrder)
106786
106822
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -106851,6 +106887,14 @@ var ts;
106851
106887
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
106852
106888
  }
106853
106889
  function buildNextInvalidatedProject(state, changeDetected) {
106890
+ ts.performance.mark("SolutionBuilder::beforeBuild");
106891
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
106892
+ ts.performance.mark("SolutionBuilder::afterBuild");
106893
+ ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
106894
+ if (buildOrder)
106895
+ reportErrorSummary(state, buildOrder);
106896
+ }
106897
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
106854
106898
  state.timerToBuildInvalidatedProject = undefined;
106855
106899
  if (state.reportFileChangeDetected) {
106856
106900
  state.reportFileChangeDetected = false;
@@ -106880,7 +106924,7 @@ var ts;
106880
106924
  }
106881
106925
  }
106882
106926
  disableCache(state);
106883
- reportErrorSummary(state, buildOrder);
106927
+ return buildOrder;
106884
106928
  }
106885
106929
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
106886
106930
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
@@ -106935,6 +106979,7 @@ var ts;
106935
106979
  function startWatching(state, buildOrder) {
106936
106980
  if (!state.watchAllProjectsPending)
106937
106981
  return;
106982
+ ts.performance.mark("SolutionBuilder::beforeWatcherCreation");
106938
106983
  state.watchAllProjectsPending = false;
106939
106984
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
106940
106985
  var resolved = _a[_i];
@@ -106948,6 +106993,8 @@ var ts;
106948
106993
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
106949
106994
  }
106950
106995
  }
106996
+ ts.performance.mark("SolutionBuilder::afterWatcherCreation");
106997
+ ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation");
106951
106998
  }
106952
106999
  function stopWatching(state) {
106953
107000
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -107057,6 +107104,8 @@ var ts;
107057
107104
  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));
107058
107105
  case ts.UpToDateStatusType.OutputMissing:
107059
107106
  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));
107107
+ case ts.UpToDateStatusType.ErrorReadingFile:
107108
+ 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));
107060
107109
  case ts.UpToDateStatusType.OutOfDateBuildInfo:
107061
107110
  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));
107062
107111
  case ts.UpToDateStatusType.UpToDate:
@@ -107097,6 +107146,13 @@ var ts;
107097
107146
  })(ts || (ts = {}));
107098
107147
  var ts;
107099
107148
  (function (ts) {
107149
+ var StatisticType;
107150
+ (function (StatisticType) {
107151
+ StatisticType[StatisticType["time"] = 0] = "time";
107152
+ StatisticType[StatisticType["count"] = 1] = "count";
107153
+ StatisticType[StatisticType["memory"] = 2] = "memory";
107154
+ StatisticType[StatisticType["size"] = 3] = "size";
107155
+ })(StatisticType = ts.StatisticType || (ts.StatisticType = {}));
107100
107156
  function countLines(program) {
107101
107157
  var counts = getCountsMap();
107102
107158
  ts.forEach(program.getSourceFiles(), function (file) {
@@ -107106,14 +107162,6 @@ var ts;
107106
107162
  });
107107
107163
  return counts;
107108
107164
  }
107109
- function countNodes(program) {
107110
- var counts = getCountsMap();
107111
- ts.forEach(program.getSourceFiles(), function (file) {
107112
- var key = getCountKey(program, file);
107113
- counts.set(key, counts.get(key) + file.nodeCount);
107114
- });
107115
- return counts;
107116
- }
107117
107165
  function getCountsMap() {
107118
107166
  var counts = new ts.Map();
107119
107167
  counts.set("Library", 0);
@@ -107657,15 +107705,29 @@ var ts;
107657
107705
  if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
107658
107706
  return;
107659
107707
  var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions));
107660
- updateSolutionBuilderHost(sys, cb, buildHost_1);
107708
+ var solutionPerformance_1 = enableSolutionPerformance(sys, buildOptions, buildHost_1);
107709
+ updateSolutionBuilderHost(sys, cb, buildHost_1, solutionPerformance_1);
107710
+ var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange;
107711
+ var reportBuildStatistics_1 = false;
107712
+ buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) {
107713
+ onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount);
107714
+ if (reportBuildStatistics_1 && (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
107715
+ d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code)) {
107716
+ reportSolutionBuilderTimes(builder_1, solutionPerformance_1);
107717
+ }
107718
+ };
107661
107719
  var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions);
107662
107720
  builder_1.build();
107721
+ reportSolutionBuilderTimes(builder_1, solutionPerformance_1);
107722
+ reportBuildStatistics_1 = true;
107663
107723
  return builder_1;
107664
107724
  }
107665
107725
  var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions));
107666
- updateSolutionBuilderHost(sys, cb, buildHost);
107726
+ var solutionPerformance = enableSolutionPerformance(sys, buildOptions, buildHost);
107727
+ updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance);
107667
107728
  var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
107668
107729
  var exitStatus = buildOptions.clean ? builder.clean() : builder.build();
107730
+ reportSolutionBuilderTimes(builder, solutionPerformance);
107669
107731
  ts.dumpTracingLegend();
107670
107732
  return sys.exit(exitStatus);
107671
107733
  }
@@ -107680,7 +107742,7 @@ var ts;
107680
107742
  var currentDirectory = host.getCurrentDirectory();
107681
107743
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
107682
107744
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, currentDirectory, getCanonicalFileName); });
107683
- enableStatisticsAndTracing(sys, options, false);
107745
+ enableStatisticsAndTracing(sys, options, host, false);
107684
107746
  var programOptions = {
107685
107747
  rootNames: fileNames,
107686
107748
  options: options,
@@ -107690,14 +107752,14 @@ var ts;
107690
107752
  };
107691
107753
  var program = ts.createProgram(programOptions);
107692
107754
  var exitStatus = ts.emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, function (s) { return sys.write(s + sys.newLine); }, createReportErrorSummary(sys, options));
107693
- reportStatistics(sys, program);
107755
+ reportStatistics(sys, program, host, undefined);
107694
107756
  cb(program);
107695
107757
  return sys.exit(exitStatus);
107696
107758
  }
107697
107759
  function performIncrementalCompilation(sys, cb, reportDiagnostic, config) {
107698
107760
  var options = config.options, fileNames = config.fileNames, projectReferences = config.projectReferences;
107699
- enableStatisticsAndTracing(sys, options, false);
107700
107761
  var host = ts.createIncrementalCompilerHost(options, sys);
107762
+ enableStatisticsAndTracing(sys, options, host, false);
107701
107763
  var exitStatus = ts.performIncrementalCompilation({
107702
107764
  host: host,
107703
107765
  system: sys,
@@ -107708,36 +107770,43 @@ var ts;
107708
107770
  reportDiagnostic: reportDiagnostic,
107709
107771
  reportErrorSummary: createReportErrorSummary(sys, options),
107710
107772
  afterProgramEmitAndDiagnostics: function (builderProgram) {
107711
- reportStatistics(sys, builderProgram.getProgram());
107773
+ reportStatistics(sys, builderProgram.getProgram(), host, undefined);
107712
107774
  cb(builderProgram);
107713
107775
  }
107714
107776
  });
107715
107777
  return sys.exit(exitStatus);
107716
107778
  }
107717
- function updateSolutionBuilderHost(sys, cb, buildHost) {
107718
- updateCreateProgram(sys, buildHost);
107719
- buildHost.afterProgramEmitAndDiagnostics = function (program) {
107720
- reportStatistics(sys, program.getProgram());
107779
+ function updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance) {
107780
+ updateCreateProgram(sys, buildHost, true);
107781
+ buildHost.afterProgramEmitAndDiagnostics = function (program, host) {
107782
+ reportStatistics(sys, program.getProgram(), host, solutionPerformance);
107721
107783
  cb(program);
107722
107784
  };
107723
- buildHost.afterEmitBundle = cb;
107785
+ buildHost.beforeEmitBundle = function (config, host) { return enableStatisticsAndTracing(sys, config.options, host, true); };
107786
+ buildHost.afterEmitBundle = function (config, host) {
107787
+ reportStatistics(sys, config, host, solutionPerformance);
107788
+ cb(config);
107789
+ };
107724
107790
  }
107725
- function updateCreateProgram(sys, host) {
107791
+ function updateCreateProgram(sys, host, isBuildMode) {
107726
107792
  var compileUsingBuilder = host.createProgram;
107727
107793
  host.createProgram = function (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) {
107728
107794
  ts.Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram));
107729
107795
  if (options !== undefined) {
107730
- enableStatisticsAndTracing(sys, options, true);
107796
+ enableStatisticsAndTracing(sys, options, host, isBuildMode);
107731
107797
  }
107732
107798
  return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
107733
107799
  };
107734
107800
  }
107735
- function updateWatchCompilationHost(sys, cb, watchCompilerHost) {
107736
- updateCreateProgram(sys, watchCompilerHost);
107801
+ function updateWatchCompilationHost(system, cb, watchCompilerHost, options) {
107802
+ updateCreateProgram(system, watchCompilerHost, false);
107803
+ if (system === ts.sys && options.extendedDiagnostics) {
107804
+ createBuildInfoCallbacks(watchCompilerHost, options);
107805
+ }
107737
107806
  var emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate;
107738
- watchCompilerHost.afterProgramCreate = function (builderProgram) {
107739
- emitFilesUsingBuilder(builderProgram);
107740
- reportStatistics(sys, builderProgram.getProgram());
107807
+ watchCompilerHost.afterProgramCreate = function (builderProgram, host) {
107808
+ emitFilesUsingBuilder(builderProgram, host);
107809
+ reportStatistics(system, builderProgram.getProgram(), host, undefined);
107741
107810
  cb(builderProgram);
107742
107811
  };
107743
107812
  }
@@ -107753,7 +107822,7 @@ var ts;
107753
107822
  reportDiagnostic: reportDiagnostic,
107754
107823
  reportWatchStatus: createWatchStatusReporter(system, configParseResult.options)
107755
107824
  });
107756
- updateWatchCompilationHost(system, cb, watchCompilerHost);
107825
+ updateWatchCompilationHost(system, cb, watchCompilerHost, configParseResult.options);
107757
107826
  watchCompilerHost.configFileParsingResult = configParseResult;
107758
107827
  watchCompilerHost.extendedConfigCache = extendedConfigCache;
107759
107828
  return ts.createWatchProgram(watchCompilerHost);
@@ -107767,25 +107836,219 @@ var ts;
107767
107836
  reportDiagnostic: reportDiagnostic,
107768
107837
  reportWatchStatus: createWatchStatusReporter(system, options)
107769
107838
  });
107770
- updateWatchCompilationHost(system, cb, watchCompilerHost);
107839
+ updateWatchCompilationHost(system, cb, watchCompilerHost, options);
107771
107840
  return ts.createWatchProgram(watchCompilerHost);
107772
107841
  }
107842
+ function enableSolutionPerformance(system, options, buildHost) {
107843
+ if (system === ts.sys && options.extendedDiagnostics) {
107844
+ ts.performance.enable();
107845
+ return createSolutionPerfomrance(buildHost);
107846
+ }
107847
+ }
107848
+ function createSolutionPerfomrance(buildHost) {
107849
+ var statistics;
107850
+ var buildInfoCallbacks = createBuildInfoCallbacks(buildHost, undefined);
107851
+ return {
107852
+ addAggregateStatistic: addAggregateStatistic,
107853
+ hasStatistics: hasStatistics,
107854
+ forEachAggregateStatistics: forEachAggregateStatistics,
107855
+ clear: clear,
107856
+ buildInfoCallbacks: buildInfoCallbacks,
107857
+ };
107858
+ function addAggregateStatistic(s) {
107859
+ var existing = statistics === null || statistics === void 0 ? void 0 : statistics.get(s.name);
107860
+ if (existing) {
107861
+ if (existing.type === StatisticType.memory)
107862
+ existing.value = Math.max(existing.value, s.value);
107863
+ else
107864
+ existing.value += s.value;
107865
+ }
107866
+ else {
107867
+ (statistics !== null && statistics !== void 0 ? statistics : (statistics = new ts.Map())).set(s.name, s);
107868
+ }
107869
+ }
107870
+ function hasStatistics(name) {
107871
+ return !!(statistics === null || statistics === void 0 ? void 0 : statistics.has(name));
107872
+ }
107873
+ function forEachAggregateStatistics(cb) {
107874
+ statistics === null || statistics === void 0 ? void 0 : statistics.forEach(cb);
107875
+ }
107876
+ function clear() {
107877
+ statistics = undefined;
107878
+ buildInfoCallbacks.clear();
107879
+ }
107880
+ }
107881
+ function reportSolutionBuilderTimes(builder, solutionPerformance) {
107882
+ if (!solutionPerformance)
107883
+ return;
107884
+ if (!ts.performance.isEnabled()) {
107885
+ 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");
107886
+ return;
107887
+ }
107888
+ var statistics = [];
107889
+ statistics.push({ name: "Projects in scope", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count });
107890
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Projects built");
107891
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Timestamps only updates");
107892
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Bundles updated");
107893
+ reportBuildInfoReadOrWriteStatistic(solutionPerformance.buildInfoCallbacks.getRead(), "read");
107894
+ reportBuildInfoReadOrWriteStatistic(solutionPerformance.buildInfoCallbacks.getWrite(), "write");
107895
+ solutionPerformance.forEachAggregateStatistics(function (s) {
107896
+ s.name = "Aggregate " + s.name;
107897
+ statistics.push(s);
107898
+ });
107899
+ ts.performance.forEachMeasure(function (name, duration) {
107900
+ if (isSolutionMarkOrMeasure(name))
107901
+ statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name) + " time", value: duration, type: StatisticType.time });
107902
+ });
107903
+ ts.performance.disable();
107904
+ ts.performance.enable();
107905
+ solutionPerformance.clear();
107906
+ reportAllStatistics(ts.sys, statistics);
107907
+ function reportSolutionBuilderCountStatistic(name) {
107908
+ var value = ts.performance.getCount(name);
107909
+ if (value) {
107910
+ statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name), value: value, type: StatisticType.count });
107911
+ }
107912
+ }
107913
+ function getNameFromSolutionBuilderMarkOrMeasure(name) {
107914
+ return name.replace("SolutionBuilder::", "");
107915
+ }
107916
+ function reportBuildInfoReadOrWriteStatistic(s, type) {
107917
+ if (s.count) {
107918
+ var countStatisticName = "BuildInfo " + type;
107919
+ if (s.count !== 1)
107920
+ statistics.push({ name: countStatisticName, value: s.count, type: StatisticType.count });
107921
+ statistics.push({ name: "BuildInfo " + type + " size", value: s.size, type: StatisticType.size });
107922
+ if (solutionPerformance.hasStatistics(countStatisticName)) {
107923
+ solutionPerformance.addAggregateStatistic({ name: countStatisticName, value: s.count, type: StatisticType.count });
107924
+ solutionPerformance.addAggregateStatistic({ name: "BuildInfo " + type + " size", value: s.size, type: StatisticType.size });
107925
+ }
107926
+ }
107927
+ }
107928
+ }
107773
107929
  function canReportDiagnostics(system, compilerOptions) {
107774
107930
  return system === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
107775
107931
  }
107776
107932
  function canTrace(system, compilerOptions) {
107777
107933
  return system === ts.sys && compilerOptions.generateTrace;
107778
107934
  }
107779
- function enableStatisticsAndTracing(system, compilerOptions, isBuildMode) {
107935
+ function enableStatisticsAndTracing(system, compilerOptions, host, isBuildMode) {
107780
107936
  if (canReportDiagnostics(system, compilerOptions)) {
107781
107937
  ts.performance.enable(system);
107782
107938
  }
107783
107939
  if (canTrace(system, compilerOptions)) {
107784
107940
  ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
107785
107941
  }
107942
+ if (system === ts.sys && host) {
107943
+ if (compilerOptions.extendedDiagnostics && ts.isIncrementalCompilation(compilerOptions)) {
107944
+ createBuildInfoCallbacks(host, compilerOptions);
107945
+ }
107946
+ else {
107947
+ createNoOpBuildInfoCallbacks(host);
107948
+ }
107949
+ }
107950
+ }
107951
+ var zeroCount = { count: 0, size: 0 };
107952
+ function createNoOpBuildInfoCallbacks(host) {
107953
+ var oldCallbacks = host.buildInfoCallbacks;
107954
+ oldCallbacks === null || oldCallbacks === void 0 ? void 0 : oldCallbacks.clearLastRead();
107955
+ return host.buildInfoCallbacks = {
107956
+ onRead: ts.noop,
107957
+ onWrite: ts.noop,
107958
+ getRead: function () { return zeroCount; },
107959
+ getWrite: function () { return zeroCount; },
107960
+ getLastRead: ts.returnUndefined,
107961
+ onTransferLastRead: ts.noop,
107962
+ clearLastRead: ts.noop,
107963
+ revertLastWrite: ts.noop,
107964
+ clearLastWrite: ts.noop,
107965
+ close: function (host) { return host.buildInfoCallbacks = oldCallbacks; },
107966
+ clear: ts.noop,
107967
+ };
107968
+ }
107969
+ function createBuildInfoCallbacks(host, options) {
107970
+ var read = initializedCountAndSize();
107971
+ var write = initializedCountAndSize();
107972
+ var lastRead;
107973
+ var lastWrite;
107974
+ var oldCallbacks = host.buildInfoCallbacks;
107975
+ if (oldCallbacks) {
107976
+ var oldLastRead = oldCallbacks.getLastRead();
107977
+ if (oldLastRead && oldLastRead.compilerOptions === options) {
107978
+ onReadOrWrite(read, oldLastRead.size);
107979
+ oldCallbacks.onTransferLastRead();
107980
+ }
107981
+ else {
107982
+ oldCallbacks.clearLastRead();
107983
+ }
107984
+ }
107985
+ return host.buildInfoCallbacks = {
107986
+ onRead: onRead,
107987
+ onWrite: onWrite,
107988
+ getRead: function () { return read; },
107989
+ getWrite: function () { return write; },
107990
+ getLastRead: function () { return lastRead; },
107991
+ onTransferLastRead: onTransferLastRead,
107992
+ clearLastRead: function () { return lastRead = undefined; },
107993
+ revertLastWrite: revertLastWrite,
107994
+ clearLastWrite: function () { return lastWrite = undefined; },
107995
+ close: function (host) { return host.buildInfoCallbacks = oldCallbacks; },
107996
+ clear: clear,
107997
+ };
107998
+ function clear() {
107999
+ ts.Debug.assert(!oldCallbacks);
108000
+ clearReadOrWrite(read);
108001
+ clearReadOrWrite(write);
108002
+ lastRead = undefined;
108003
+ lastWrite = undefined;
108004
+ }
108005
+ function clearReadOrWrite(countAndSize) {
108006
+ countAndSize.count = 0;
108007
+ countAndSize.size = 0;
108008
+ }
108009
+ function onTransferLastRead() {
108010
+ revertReadOrWrite(read, lastRead.size);
108011
+ lastRead = undefined;
108012
+ }
108013
+ function revertLastWrite() {
108014
+ if (lastWrite) {
108015
+ revertReadOrWrite(write, lastWrite);
108016
+ lastWrite = undefined;
108017
+ }
108018
+ }
108019
+ function revertReadOrWrite(countAndSize, size) {
108020
+ countAndSize.count--;
108021
+ countAndSize.size -= size;
108022
+ }
108023
+ function onRead(size, compilerOptions) {
108024
+ onReadOrWrite(read, size);
108025
+ if (compilerOptions)
108026
+ lastRead = { size: size, compilerOptions: compilerOptions };
108027
+ else
108028
+ lastRead = undefined;
108029
+ }
108030
+ function onWrite(size) {
108031
+ onReadOrWrite(write, size);
108032
+ lastWrite = size;
108033
+ }
108034
+ function onReadOrWrite(countAndSize, size) {
108035
+ countAndSize.count++;
108036
+ countAndSize.size += size;
108037
+ }
108038
+ }
108039
+ function initializedCountAndSize() {
108040
+ return { count: 0, size: 0 };
108041
+ }
108042
+ function isSolutionMarkOrMeasure(name) {
108043
+ return ts.startsWith(name, "SolutionBuilder::");
108044
+ }
108045
+ function isProgram(programOrConfig) {
108046
+ return !programOrConfig.options;
107786
108047
  }
107787
- function reportStatistics(sys, program) {
107788
- var compilerOptions = program.getCompilerOptions();
108048
+ function reportStatistics(sys, programOrConfig, host, solutionPerformance) {
108049
+ var program = isProgram(programOrConfig) ? programOrConfig : undefined;
108050
+ var config = isProgram(programOrConfig) ? undefined : programOrConfig;
108051
+ var compilerOptions = program ? program.getCompilerOptions() : config.options;
107789
108052
  if (canTrace(sys, compilerOptions)) {
107790
108053
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing();
107791
108054
  }
@@ -107793,29 +108056,25 @@ var ts;
107793
108056
  if (canReportDiagnostics(sys, compilerOptions)) {
107794
108057
  statistics = [];
107795
108058
  var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
107796
- reportCountStatistic("Files", program.getSourceFiles().length);
107797
- var lineCounts = countLines(program);
107798
- var nodeCounts = countNodes(program);
107799
- if (compilerOptions.extendedDiagnostics) {
107800
- for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
107801
- var key = _a[_i];
107802
- reportCountStatistic("Lines of " + key, lineCounts.get(key));
108059
+ if (program) {
108060
+ reportCountStatistic("Files", program.getSourceFiles().length);
108061
+ var lineCounts = countLines(program);
108062
+ if (compilerOptions.extendedDiagnostics) {
108063
+ for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
108064
+ var key = _a[_i];
108065
+ reportCountStatistic("Lines of " + key, lineCounts.get(key));
108066
+ }
107803
108067
  }
107804
- for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
107805
- var key = _c[_b];
107806
- reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
108068
+ else {
108069
+ reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
107807
108070
  }
108071
+ reportCountStatistic("Identifiers", program.getIdentifierCount());
108072
+ reportCountStatistic("Symbols", program.getSymbolCount());
108073
+ reportCountStatistic("Types", program.getTypeCount());
108074
+ reportCountStatistic("Instantiations", program.getInstantiationCount());
107808
108075
  }
107809
- else {
107810
- reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
107811
- reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
107812
- }
107813
- reportCountStatistic("Identifiers", program.getIdentifierCount());
107814
- reportCountStatistic("Symbols", program.getSymbolCount());
107815
- reportCountStatistic("Types", program.getTypeCount());
107816
- reportCountStatistic("Instantiations", program.getInstantiationCount());
107817
108076
  if (memoryUsed >= 0) {
107818
- reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
108077
+ reportStatisticalValue({ name: "Memory used", value: memoryUsed, type: StatisticType.memory }, true);
107819
108078
  }
107820
108079
  var isPerformanceEnabled = ts.performance.isEnabled();
107821
108080
  var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0;
@@ -107823,59 +108082,108 @@ var ts;
107823
108082
  var checkTime = isPerformanceEnabled ? ts.performance.getDuration("Check") : 0;
107824
108083
  var emitTime = isPerformanceEnabled ? ts.performance.getDuration("Emit") : 0;
107825
108084
  if (compilerOptions.extendedDiagnostics) {
107826
- var caches = program.getRelationCacheSizes();
107827
- reportCountStatistic("Assignability cache size", caches.assignable);
107828
- reportCountStatistic("Identity cache size", caches.identity);
107829
- reportCountStatistic("Subtype cache size", caches.subtype);
107830
- reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
108085
+ if (program) {
108086
+ var caches = program.getRelationCacheSizes();
108087
+ reportCountStatistic("Assignability cache size", caches.assignable);
108088
+ reportCountStatistic("Identity cache size", caches.identity);
108089
+ reportCountStatistic("Subtype cache size", caches.subtype);
108090
+ reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
108091
+ }
108092
+ if (host === null || host === void 0 ? void 0 : host.buildInfoCallbacks) {
108093
+ reportBuildInfoReadOrWriteStatistic(host.buildInfoCallbacks.getRead(), "read");
108094
+ reportBuildInfoReadOrWriteStatistic(host.buildInfoCallbacks.getWrite(), "write");
108095
+ host.buildInfoCallbacks.close(host);
108096
+ }
107831
108097
  if (isPerformanceEnabled) {
107832
- ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + " time", duration); });
108098
+ ts.performance.forEachMeasure(function (name, duration) {
108099
+ if (!isSolutionMarkOrMeasure(name))
108100
+ reportTimeStatistic(name + " time", duration, true);
108101
+ });
107833
108102
  }
107834
108103
  }
107835
108104
  else if (isPerformanceEnabled) {
107836
- reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"));
107837
- reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"));
107838
- reportTimeStatistic("Parse time", programTime);
107839
- reportTimeStatistic("Bind time", bindTime);
107840
- reportTimeStatistic("Check time", checkTime);
107841
- reportTimeStatistic("Emit time", emitTime);
108105
+ reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"), true);
108106
+ reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"), true);
108107
+ reportTimeStatistic("Parse time", programTime, true);
108108
+ reportTimeStatistic("Bind time", bindTime, true);
108109
+ reportTimeStatistic("Check time", checkTime, true);
108110
+ reportTimeStatistic("Emit time", emitTime, true);
107842
108111
  }
107843
108112
  if (isPerformanceEnabled) {
107844
- reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
108113
+ reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime, false);
107845
108114
  }
107846
- reportStatistics();
108115
+ reportAllStatistics(sys, statistics);
107847
108116
  if (!isPerformanceEnabled) {
107848
108117
  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");
107849
108118
  }
107850
108119
  else {
107851
- ts.performance.disable();
108120
+ if (solutionPerformance) {
108121
+ ts.performance.forEachMeasure(function (name) {
108122
+ if (!isSolutionMarkOrMeasure(name))
108123
+ ts.performance.clearMeasures(name);
108124
+ });
108125
+ ts.performance.forEachMark(function (name) {
108126
+ if (!isSolutionMarkOrMeasure(name))
108127
+ ts.performance.clearMarks(name);
108128
+ });
108129
+ }
108130
+ else {
108131
+ ts.performance.disable();
108132
+ }
107852
108133
  }
107853
108134
  }
107854
- function reportStatistics() {
107855
- var nameSize = 0;
107856
- var valueSize = 0;
107857
- for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
107858
- var _a = statistics_1[_i], name = _a.name, value = _a.value;
107859
- if (name.length > nameSize) {
107860
- nameSize = name.length;
108135
+ function reportStatisticalValue(s, aggregate) {
108136
+ statistics.push(s);
108137
+ if (aggregate)
108138
+ solutionPerformance === null || solutionPerformance === void 0 ? void 0 : solutionPerformance.addAggregateStatistic(s);
108139
+ }
108140
+ function reportCountStatistic(name, count) {
108141
+ reportStatisticalValue({ name: name, value: count, type: StatisticType.count }, true);
108142
+ }
108143
+ function reportTimeStatistic(name, time, aggregate) {
108144
+ reportStatisticalValue({ name: name, value: time, type: StatisticType.time }, aggregate);
108145
+ }
108146
+ function reportBuildInfoReadOrWriteStatistic(s, type) {
108147
+ if (s.count) {
108148
+ if (s.count === 1) {
108149
+ solutionPerformance === null || solutionPerformance === void 0 ? void 0 : solutionPerformance.addAggregateStatistic({ name: "BuildInfo " + type, value: s.count, type: StatisticType.count });
107861
108150
  }
107862
- if (value.length > valueSize) {
107863
- valueSize = value.length;
108151
+ else {
108152
+ reportCountStatistic("BuildInfo " + type, s.count);
107864
108153
  }
107865
- }
107866
- for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {
107867
- var _c = statistics_2[_b], name = _c.name, value = _c.value;
107868
- sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine);
108154
+ reportStatisticalValue({ name: "BuildInfo " + type + " size", value: s.size, type: StatisticType.size }, true);
107869
108155
  }
107870
108156
  }
107871
- function reportStatisticalValue(name, value) {
107872
- statistics.push({ name: name, value: value });
108157
+ }
108158
+ function reportAllStatistics(sys, statistics) {
108159
+ var nameSize = 0;
108160
+ var valueSize = 0;
108161
+ for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
108162
+ var s = statistics_1[_i];
108163
+ if (s.name.length > nameSize) {
108164
+ nameSize = s.name.length;
108165
+ }
108166
+ var value = statisticValue(s);
108167
+ if (value.length > valueSize) {
108168
+ valueSize = value.length;
108169
+ }
107873
108170
  }
107874
- function reportCountStatistic(name, count) {
107875
- reportStatisticalValue(name, "" + count);
108171
+ for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) {
108172
+ var s = statistics_2[_a];
108173
+ sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine);
107876
108174
  }
107877
- function reportTimeStatistic(name, time) {
107878
- reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
108175
+ }
108176
+ function statisticValue(s) {
108177
+ switch (s.type) {
108178
+ case StatisticType.count:
108179
+ return "" + s.value;
108180
+ case StatisticType.time:
108181
+ return (s.value / 1000).toFixed(2) + "s";
108182
+ case StatisticType.memory:
108183
+ case StatisticType.size:
108184
+ return Math.round(s.value / 1000) + "K";
108185
+ default:
108186
+ ts.Debug.assertNever(s.type);
107879
108187
  }
107880
108188
  }
107881
108189
  function writeConfigFile(sys, reportDiagnostic, options, fileNames) {