typescript 4.9.0-dev.20220811 → 4.9.0-dev.20220814

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-dev.20220811";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220814";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -3025,6 +3025,8 @@ var ts;
3025
3025
  typeof performance.mark === "function" &&
3026
3026
  typeof performance.measure === "function" &&
3027
3027
  typeof performance.now === "function" &&
3028
+ typeof performance.clearMarks === "function" &&
3029
+ typeof performance.clearMeasures === "function" &&
3028
3030
  typeof PerformanceObserver === "function";
3029
3031
  }
3030
3032
  function tryGetWebPerformanceHooks() {
@@ -3062,7 +3064,9 @@ var ts;
3062
3064
  if (end === "__performance.measure-fix__") {
3063
3065
  nodePerformance_1.clearMarks("__performance.measure-fix__");
3064
3066
  }
3065
- }
3067
+ },
3068
+ clearMarks: function (name) { return nodePerformance_1.clearMarks(name); },
3069
+ clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); },
3066
3070
  };
3067
3071
  }
3068
3072
  return {
@@ -3157,6 +3161,30 @@ var ts;
3157
3161
  durations.forEach(function (duration, measureName) { return cb(measureName, duration); });
3158
3162
  }
3159
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;
3160
3188
  function isEnabled() {
3161
3189
  return enabled;
3162
3190
  }
@@ -61486,25 +61514,7 @@ var ts;
61486
61514
  }
61487
61515
  function getTypeOfPropertyOfContextualType(type, name, nameType) {
61488
61516
  return mapType(type, function (t) {
61489
- if (t.flags & 2097152) {
61490
- var intersection = t;
61491
- var newTypes = ts.mapDefined(intersection.types, getTypeOfConcretePropertyOfContextualType);
61492
- if (newTypes.length > 0) {
61493
- return getIntersectionType(newTypes);
61494
- }
61495
- newTypes = ts.mapDefined(intersection.types, getTypeOfApplicableIndexInfoOfContextualType);
61496
- if (newTypes.length > 0) {
61497
- return getIntersectionType(newTypes);
61498
- }
61499
- return undefined;
61500
- }
61501
- var concretePropertyType = getTypeOfConcretePropertyOfContextualType(t);
61502
- if (concretePropertyType) {
61503
- return concretePropertyType;
61504
- }
61505
- return getTypeOfApplicableIndexInfoOfContextualType(t);
61506
- }, true);
61507
- function getTypeOfConcretePropertyOfContextualType(t) {
61517
+ var _a;
61508
61518
  if (isGenericMappedType(t) && !t.declaration.nameType) {
61509
61519
  var constraint = getConstraintTypeFromMappedType(t);
61510
61520
  var constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
@@ -61512,9 +61522,8 @@ var ts;
61512
61522
  if (isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
61513
61523
  return substituteIndexedMappedType(t, propertyNameType);
61514
61524
  }
61515
- return undefined;
61516
61525
  }
61517
- if (t.flags & 3670016) {
61526
+ else if (t.flags & 3670016) {
61518
61527
  var prop = getPropertyOfType(t, name);
61519
61528
  if (prop) {
61520
61529
  return isCircularMappedProperty(prop) ? undefined : getTypeOfSymbol(prop);
@@ -61525,16 +61534,10 @@ var ts;
61525
61534
  return restType;
61526
61535
  }
61527
61536
  }
61537
+ return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
61528
61538
  }
61529
61539
  return undefined;
61530
- }
61531
- function getTypeOfApplicableIndexInfoOfContextualType(t) {
61532
- var _a;
61533
- if (!(t.flags & 3670016)) {
61534
- return undefined;
61535
- }
61536
- return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(ts.unescapeLeadingUnderscores(name)))) === null || _a === void 0 ? void 0 : _a.type;
61537
- }
61540
+ }, true);
61538
61541
  }
61539
61542
  function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
61540
61543
  ts.Debug.assert(ts.isObjectLiteralMethod(node));
@@ -61847,17 +61850,13 @@ var ts;
61847
61850
  var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
61848
61851
  var hostClassType = getReturnTypeOfSignature(sig);
61849
61852
  var libraryManagedAttributeType = void 0;
61850
- if (typeParams && typeParams.length === 1) {
61853
+ if (typeParams) {
61851
61854
  var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
61852
61855
  libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
61853
61856
  }
61854
- else if (typeParams)
61855
- libraryManagedAttributeType = undefined;
61856
61857
  else
61857
61858
  libraryManagedAttributeType = intrinsicClassAttribs;
61858
- if (libraryManagedAttributeType) {
61859
- apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
61860
- }
61859
+ apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
61861
61860
  }
61862
61861
  var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
61863
61862
  if (!isErrorType(intrinsicAttribs)) {
@@ -104613,6 +104612,7 @@ var ts;
104613
104612
  if (value) {
104614
104613
  return isParsedCommandLine(value) ? value : undefined;
104615
104614
  }
104615
+ ts.performance.mark("SolutionBuilder::beforeConfigFileParsing");
104616
104616
  var diagnostic;
104617
104617
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
104618
104618
  var parsed;
@@ -104627,6 +104627,8 @@ var ts;
104627
104627
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
104628
104628
  }
104629
104629
  configFileCache.set(configFilePath, parsed || diagnostic);
104630
+ ts.performance.mark("SolutionBuilder::afterConfigFileParsing");
104631
+ ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing");
104630
104632
  return parsed;
104631
104633
  }
104632
104634
  function resolveProjectName(state, name) {
@@ -104819,6 +104821,7 @@ var ts;
104819
104821
  if (updateOutputFileStampsPending) {
104820
104822
  updateOutputTimestamps(state, config, projectPath);
104821
104823
  }
104824
+ ts.performance.mark("SolutionBuilder::Timestamps only updates");
104822
104825
  return doneInvalidatedProject(state, projectPath);
104823
104826
  }
104824
104827
  };
@@ -104912,6 +104915,10 @@ var ts;
104912
104915
  };
104913
104916
  function done(cancellationToken, writeFile, customTransformers) {
104914
104917
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
104918
+ if (kind === InvalidatedProjectKind.Build)
104919
+ ts.performance.mark("SolutionBuilder::Projects built");
104920
+ else
104921
+ ts.performance.mark("SolutionBuilder::Bundles updated");
104915
104922
  return doneInvalidatedProject(state, projectPath);
104916
104923
  }
104917
104924
  function withProgramOrUndefined(action) {
@@ -105629,7 +105636,10 @@ var ts;
105629
105636
  if (prior !== undefined) {
105630
105637
  return prior;
105631
105638
  }
105639
+ ts.performance.mark("SolutionBuilder::beforeUpToDateCheck");
105632
105640
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
105641
+ ts.performance.mark("SolutionBuilder::afterUpToDateCheck");
105642
+ ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck");
105633
105643
  state.projectStatus.set(resolvedPath, actual);
105634
105644
  return actual;
105635
105645
  }
@@ -105756,6 +105766,13 @@ var ts;
105756
105766
  }
105757
105767
  }
105758
105768
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
105769
+ ts.performance.mark("SolutionBuilder::beforeBuild");
105770
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
105771
+ ts.performance.mark("SolutionBuilder::afterBuild");
105772
+ ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
105773
+ return result;
105774
+ }
105775
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
105759
105776
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
105760
105777
  if (!buildOrder)
105761
105778
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -105783,6 +105800,13 @@ var ts;
105783
105800
  : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
105784
105801
  }
105785
105802
  function clean(state, project, onlyReferences) {
105803
+ ts.performance.mark("SolutionBuilder::beforeClean");
105804
+ var result = cleanWorker(state, project, onlyReferences);
105805
+ ts.performance.mark("SolutionBuilder::afterClean");
105806
+ ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean");
105807
+ return result;
105808
+ }
105809
+ function cleanWorker(state, project, onlyReferences) {
105786
105810
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
105787
105811
  if (!buildOrder)
105788
105812
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -105853,6 +105877,14 @@ var ts;
105853
105877
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
105854
105878
  }
105855
105879
  function buildNextInvalidatedProject(state, changeDetected) {
105880
+ ts.performance.mark("SolutionBuilder::beforeBuild");
105881
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
105882
+ ts.performance.mark("SolutionBuilder::afterBuild");
105883
+ ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
105884
+ if (buildOrder)
105885
+ reportErrorSummary(state, buildOrder);
105886
+ }
105887
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
105856
105888
  state.timerToBuildInvalidatedProject = undefined;
105857
105889
  if (state.reportFileChangeDetected) {
105858
105890
  state.reportFileChangeDetected = false;
@@ -105882,7 +105914,7 @@ var ts;
105882
105914
  }
105883
105915
  }
105884
105916
  disableCache(state);
105885
- reportErrorSummary(state, buildOrder);
105917
+ return buildOrder;
105886
105918
  }
105887
105919
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
105888
105920
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
@@ -105937,6 +105969,7 @@ var ts;
105937
105969
  function startWatching(state, buildOrder) {
105938
105970
  if (!state.watchAllProjectsPending)
105939
105971
  return;
105972
+ ts.performance.mark("SolutionBuilder::beforeWatcherCreation");
105940
105973
  state.watchAllProjectsPending = false;
105941
105974
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
105942
105975
  var resolved = _a[_i];
@@ -105950,6 +105983,8 @@ var ts;
105950
105983
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
105951
105984
  }
105952
105985
  }
105986
+ ts.performance.mark("SolutionBuilder::afterWatcherCreation");
105987
+ ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation");
105953
105988
  }
105954
105989
  function stopWatching(state) {
105955
105990
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -106101,6 +106136,12 @@ var ts;
106101
106136
  })(ts || (ts = {}));
106102
106137
  var ts;
106103
106138
  (function (ts) {
106139
+ var StatisticType;
106140
+ (function (StatisticType) {
106141
+ StatisticType[StatisticType["time"] = 0] = "time";
106142
+ StatisticType[StatisticType["count"] = 1] = "count";
106143
+ StatisticType[StatisticType["memory"] = 2] = "memory";
106144
+ })(StatisticType = ts.StatisticType || (ts.StatisticType = {}));
106104
106145
  function countLines(program) {
106105
106146
  var counts = getCountsMap();
106106
106147
  ts.forEach(program.getSourceFiles(), function (file) {
@@ -106110,14 +106151,6 @@ var ts;
106110
106151
  });
106111
106152
  return counts;
106112
106153
  }
106113
- function countNodes(program) {
106114
- var counts = getCountsMap();
106115
- ts.forEach(program.getSourceFiles(), function (file) {
106116
- var key = getCountKey(program, file);
106117
- counts.set(key, counts.get(key) + file.nodeCount);
106118
- });
106119
- return counts;
106120
- }
106121
106154
  function getCountsMap() {
106122
106155
  var counts = new ts.Map();
106123
106156
  counts.set("Library", 0);
@@ -106661,15 +106694,26 @@ var ts;
106661
106694
  if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
106662
106695
  return;
106663
106696
  var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions));
106664
- updateSolutionBuilderHost(sys, cb, buildHost_1);
106697
+ var solutionPerformance_1 = enableSolutionPerformance(sys, buildOptions);
106698
+ updateSolutionBuilderHost(sys, cb, buildHost_1, solutionPerformance_1);
106699
+ var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange;
106700
+ buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) {
106701
+ onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount);
106702
+ if (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
106703
+ d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code) {
106704
+ reportSolutionBuilderTimes(builder_1, solutionPerformance_1);
106705
+ }
106706
+ };
106665
106707
  var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions);
106666
106708
  builder_1.build();
106667
106709
  return builder_1;
106668
106710
  }
106669
106711
  var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions));
106670
- updateSolutionBuilderHost(sys, cb, buildHost);
106712
+ var solutionPerformance = enableSolutionPerformance(sys, buildOptions);
106713
+ updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance);
106671
106714
  var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
106672
106715
  var exitStatus = buildOptions.clean ? builder.clean() : builder.build();
106716
+ reportSolutionBuilderTimes(builder, solutionPerformance);
106673
106717
  ts.dumpTracingLegend();
106674
106718
  return sys.exit(exitStatus);
106675
106719
  }
@@ -106694,7 +106738,7 @@ var ts;
106694
106738
  };
106695
106739
  var program = ts.createProgram(programOptions);
106696
106740
  var exitStatus = ts.emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, function (s) { return sys.write(s + sys.newLine); }, createReportErrorSummary(sys, options));
106697
- reportStatistics(sys, program);
106741
+ reportStatistics(sys, program, undefined);
106698
106742
  cb(program);
106699
106743
  return sys.exit(exitStatus);
106700
106744
  }
@@ -106712,36 +106756,36 @@ var ts;
106712
106756
  reportDiagnostic: reportDiagnostic,
106713
106757
  reportErrorSummary: createReportErrorSummary(sys, options),
106714
106758
  afterProgramEmitAndDiagnostics: function (builderProgram) {
106715
- reportStatistics(sys, builderProgram.getProgram());
106759
+ reportStatistics(sys, builderProgram.getProgram(), undefined);
106716
106760
  cb(builderProgram);
106717
106761
  }
106718
106762
  });
106719
106763
  return sys.exit(exitStatus);
106720
106764
  }
106721
- function updateSolutionBuilderHost(sys, cb, buildHost) {
106722
- updateCreateProgram(sys, buildHost);
106765
+ function updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance) {
106766
+ updateCreateProgram(sys, buildHost, true);
106723
106767
  buildHost.afterProgramEmitAndDiagnostics = function (program) {
106724
- reportStatistics(sys, program.getProgram());
106768
+ reportStatistics(sys, program.getProgram(), solutionPerformance);
106725
106769
  cb(program);
106726
106770
  };
106727
106771
  buildHost.afterEmitBundle = cb;
106728
106772
  }
106729
- function updateCreateProgram(sys, host) {
106773
+ function updateCreateProgram(sys, host, isBuildMode) {
106730
106774
  var compileUsingBuilder = host.createProgram;
106731
106775
  host.createProgram = function (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) {
106732
106776
  ts.Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram));
106733
106777
  if (options !== undefined) {
106734
- enableStatisticsAndTracing(sys, options, true);
106778
+ enableStatisticsAndTracing(sys, options, isBuildMode);
106735
106779
  }
106736
106780
  return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
106737
106781
  };
106738
106782
  }
106739
106783
  function updateWatchCompilationHost(sys, cb, watchCompilerHost) {
106740
- updateCreateProgram(sys, watchCompilerHost);
106784
+ updateCreateProgram(sys, watchCompilerHost, false);
106741
106785
  var emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate;
106742
106786
  watchCompilerHost.afterProgramCreate = function (builderProgram) {
106743
106787
  emitFilesUsingBuilder(builderProgram);
106744
- reportStatistics(sys, builderProgram.getProgram());
106788
+ reportStatistics(sys, builderProgram.getProgram(), undefined);
106745
106789
  cb(builderProgram);
106746
106790
  };
106747
106791
  }
@@ -106774,6 +106818,71 @@ var ts;
106774
106818
  updateWatchCompilationHost(system, cb, watchCompilerHost);
106775
106819
  return ts.createWatchProgram(watchCompilerHost);
106776
106820
  }
106821
+ function enableSolutionPerformance(system, options) {
106822
+ if (system === ts.sys && options.extendedDiagnostics) {
106823
+ ts.performance.enable();
106824
+ return createSolutionPerfomrance();
106825
+ }
106826
+ }
106827
+ function createSolutionPerfomrance() {
106828
+ var statistics;
106829
+ return {
106830
+ addAggregateStatistic: addAggregateStatistic,
106831
+ forEachAggregateStatistics: forEachAggreateStatistics,
106832
+ clear: clear,
106833
+ };
106834
+ function addAggregateStatistic(s) {
106835
+ var existing = statistics === null || statistics === void 0 ? void 0 : statistics.get(s.name);
106836
+ if (existing) {
106837
+ if (existing.type === StatisticType.memory)
106838
+ existing.value = Math.max(existing.value, s.value);
106839
+ else
106840
+ existing.value += s.value;
106841
+ }
106842
+ else {
106843
+ (statistics !== null && statistics !== void 0 ? statistics : (statistics = new ts.Map())).set(s.name, s);
106844
+ }
106845
+ }
106846
+ function forEachAggreateStatistics(cb) {
106847
+ statistics === null || statistics === void 0 ? void 0 : statistics.forEach(cb);
106848
+ }
106849
+ function clear() {
106850
+ statistics = undefined;
106851
+ }
106852
+ }
106853
+ function reportSolutionBuilderTimes(builder, solutionPerformance) {
106854
+ if (!solutionPerformance)
106855
+ return;
106856
+ if (!ts.performance.isEnabled()) {
106857
+ 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");
106858
+ return;
106859
+ }
106860
+ var statistics = [];
106861
+ statistics.push({ name: "Projects in scope", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count });
106862
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Projects built");
106863
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Timestamps only updates");
106864
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Bundles updated");
106865
+ solutionPerformance.forEachAggregateStatistics(function (s) {
106866
+ s.name = "Aggregate " + s.name;
106867
+ statistics.push(s);
106868
+ });
106869
+ ts.performance.forEachMeasure(function (name, duration) {
106870
+ if (isSolutionMarkOrMeasure(name))
106871
+ statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name) + " time", value: duration, type: StatisticType.time });
106872
+ });
106873
+ ts.performance.disable();
106874
+ ts.performance.enable();
106875
+ reportAllStatistics(ts.sys, statistics);
106876
+ function reportSolutionBuilderCountStatistic(name) {
106877
+ var value = ts.performance.getCount(name);
106878
+ if (value) {
106879
+ statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name), value: value, type: StatisticType.count });
106880
+ }
106881
+ }
106882
+ function getNameFromSolutionBuilderMarkOrMeasure(name) {
106883
+ return name.replace("SolutionBuilder::", "");
106884
+ }
106885
+ }
106777
106886
  function canReportDiagnostics(system, compilerOptions) {
106778
106887
  return system === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
106779
106888
  }
@@ -106788,7 +106897,10 @@ var ts;
106788
106897
  ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
106789
106898
  }
106790
106899
  }
106791
- function reportStatistics(sys, program) {
106900
+ function isSolutionMarkOrMeasure(name) {
106901
+ return ts.startsWith(name, "SolutionBuilder::");
106902
+ }
106903
+ function reportStatistics(sys, program, solutionPerformance) {
106792
106904
  var compilerOptions = program.getCompilerOptions();
106793
106905
  if (canTrace(sys, compilerOptions)) {
106794
106906
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing();
@@ -106799,27 +106911,21 @@ var ts;
106799
106911
  var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
106800
106912
  reportCountStatistic("Files", program.getSourceFiles().length);
106801
106913
  var lineCounts = countLines(program);
106802
- var nodeCounts = countNodes(program);
106803
106914
  if (compilerOptions.extendedDiagnostics) {
106804
106915
  for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
106805
106916
  var key = _a[_i];
106806
106917
  reportCountStatistic("Lines of " + key, lineCounts.get(key));
106807
106918
  }
106808
- for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) {
106809
- var key = _c[_b];
106810
- reportCountStatistic("Nodes of " + key, nodeCounts.get(key));
106811
- }
106812
106919
  }
106813
106920
  else {
106814
106921
  reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0));
106815
- reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0));
106816
106922
  }
106817
106923
  reportCountStatistic("Identifiers", program.getIdentifierCount());
106818
106924
  reportCountStatistic("Symbols", program.getSymbolCount());
106819
106925
  reportCountStatistic("Types", program.getTypeCount());
106820
106926
  reportCountStatistic("Instantiations", program.getInstantiationCount());
106821
106927
  if (memoryUsed >= 0) {
106822
- reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
106928
+ reportStatisticalValue({ name: "Memory used", value: memoryUsed, type: StatisticType.memory }, true);
106823
106929
  }
106824
106930
  var isPerformanceEnabled = ts.performance.isEnabled();
106825
106931
  var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0;
@@ -106833,53 +106939,83 @@ var ts;
106833
106939
  reportCountStatistic("Subtype cache size", caches.subtype);
106834
106940
  reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
106835
106941
  if (isPerformanceEnabled) {
106836
- ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + " time", duration); });
106942
+ ts.performance.forEachMeasure(function (name, duration) {
106943
+ if (!isSolutionMarkOrMeasure(name))
106944
+ reportTimeStatistic(name + " time", duration, true);
106945
+ });
106837
106946
  }
106838
106947
  }
106839
106948
  else if (isPerformanceEnabled) {
106840
- reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"));
106841
- reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"));
106842
- reportTimeStatistic("Parse time", programTime);
106843
- reportTimeStatistic("Bind time", bindTime);
106844
- reportTimeStatistic("Check time", checkTime);
106845
- reportTimeStatistic("Emit time", emitTime);
106949
+ reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"), true);
106950
+ reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"), true);
106951
+ reportTimeStatistic("Parse time", programTime, true);
106952
+ reportTimeStatistic("Bind time", bindTime, true);
106953
+ reportTimeStatistic("Check time", checkTime, true);
106954
+ reportTimeStatistic("Emit time", emitTime, true);
106846
106955
  }
106847
106956
  if (isPerformanceEnabled) {
106848
- reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
106957
+ reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime, false);
106849
106958
  }
106850
- reportStatistics();
106959
+ reportAllStatistics(sys, statistics);
106851
106960
  if (!isPerformanceEnabled) {
106852
106961
  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");
106853
106962
  }
106854
106963
  else {
106855
- ts.performance.disable();
106856
- }
106857
- }
106858
- function reportStatistics() {
106859
- var nameSize = 0;
106860
- var valueSize = 0;
106861
- for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
106862
- var _a = statistics_1[_i], name = _a.name, value = _a.value;
106863
- if (name.length > nameSize) {
106864
- nameSize = name.length;
106964
+ if (solutionPerformance) {
106965
+ ts.performance.forEachMeasure(function (name) {
106966
+ if (!isSolutionMarkOrMeasure(name))
106967
+ ts.performance.clearMeasures(name);
106968
+ });
106969
+ ts.performance.forEachMark(function (name) {
106970
+ if (!isSolutionMarkOrMeasure(name))
106971
+ ts.performance.clearMarks(name);
106972
+ });
106865
106973
  }
106866
- if (value.length > valueSize) {
106867
- valueSize = value.length;
106974
+ else {
106975
+ ts.performance.disable();
106868
106976
  }
106869
106977
  }
106870
- for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) {
106871
- var _c = statistics_2[_b], name = _c.name, value = _c.value;
106872
- sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine);
106873
- }
106874
106978
  }
106875
- function reportStatisticalValue(name, value) {
106876
- statistics.push({ name: name, value: value });
106979
+ function reportStatisticalValue(s, aggregate) {
106980
+ statistics.push(s);
106981
+ if (aggregate)
106982
+ solutionPerformance === null || solutionPerformance === void 0 ? void 0 : solutionPerformance.addAggregateStatistic(s);
106877
106983
  }
106878
106984
  function reportCountStatistic(name, count) {
106879
- reportStatisticalValue(name, "" + count);
106985
+ reportStatisticalValue({ name: name, value: count, type: StatisticType.count }, true);
106986
+ }
106987
+ function reportTimeStatistic(name, time, aggregate) {
106988
+ reportStatisticalValue({ name: name, value: time, type: StatisticType.time }, aggregate);
106989
+ }
106990
+ }
106991
+ function reportAllStatistics(sys, statistics) {
106992
+ var nameSize = 0;
106993
+ var valueSize = 0;
106994
+ for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
106995
+ var s = statistics_1[_i];
106996
+ if (s.name.length > nameSize) {
106997
+ nameSize = s.name.length;
106998
+ }
106999
+ var value = statisticValue(s);
107000
+ if (value.length > valueSize) {
107001
+ valueSize = value.length;
107002
+ }
107003
+ }
107004
+ for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) {
107005
+ var s = statistics_2[_a];
107006
+ sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine);
106880
107007
  }
106881
- function reportTimeStatistic(name, time) {
106882
- reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
107008
+ }
107009
+ function statisticValue(s) {
107010
+ switch (s.type) {
107011
+ case StatisticType.count:
107012
+ return "" + s.value;
107013
+ case StatisticType.time:
107014
+ return (s.value / 1000).toFixed(2) + "s";
107015
+ case StatisticType.memory:
107016
+ return Math.round(s.value / 1000) + "K";
107017
+ default:
107018
+ ts.Debug.assertNever(s.type);
106883
107019
  }
106884
107020
  }
106885
107021
  function writeConfigFile(sys, reportDiagnostic, options, fileNames) {