typescript 4.9.0-dev.20220811 → 4.9.0-dev.20220812

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -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.20220812";
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
  }
@@ -61847,17 +61875,13 @@ var ts;
61847
61875
  var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol);
61848
61876
  var hostClassType = getReturnTypeOfSignature(sig);
61849
61877
  var libraryManagedAttributeType = void 0;
61850
- if (typeParams && typeParams.length === 1) {
61878
+ if (typeParams) {
61851
61879
  var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context));
61852
61880
  libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs));
61853
61881
  }
61854
- else if (typeParams)
61855
- libraryManagedAttributeType = undefined;
61856
61882
  else
61857
61883
  libraryManagedAttributeType = intrinsicClassAttribs;
61858
- if (libraryManagedAttributeType) {
61859
- apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
61860
- }
61884
+ apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType);
61861
61885
  }
61862
61886
  var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
61863
61887
  if (!isErrorType(intrinsicAttribs)) {
@@ -104613,6 +104637,7 @@ var ts;
104613
104637
  if (value) {
104614
104638
  return isParsedCommandLine(value) ? value : undefined;
104615
104639
  }
104640
+ ts.performance.mark("SolutionBuilder::beforeConfigFileParsing");
104616
104641
  var diagnostic;
104617
104642
  var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host;
104618
104643
  var parsed;
@@ -104627,6 +104652,8 @@ var ts;
104627
104652
  parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
104628
104653
  }
104629
104654
  configFileCache.set(configFilePath, parsed || diagnostic);
104655
+ ts.performance.mark("SolutionBuilder::afterConfigFileParsing");
104656
+ ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing");
104630
104657
  return parsed;
104631
104658
  }
104632
104659
  function resolveProjectName(state, name) {
@@ -104819,6 +104846,7 @@ var ts;
104819
104846
  if (updateOutputFileStampsPending) {
104820
104847
  updateOutputTimestamps(state, config, projectPath);
104821
104848
  }
104849
+ ts.performance.mark("SolutionBuilder::Timestamps only updates");
104822
104850
  return doneInvalidatedProject(state, projectPath);
104823
104851
  }
104824
104852
  };
@@ -104912,6 +104940,10 @@ var ts;
104912
104940
  };
104913
104941
  function done(cancellationToken, writeFile, customTransformers) {
104914
104942
  executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers);
104943
+ if (kind === InvalidatedProjectKind.Build)
104944
+ ts.performance.mark("SolutionBuilder::Projects built");
104945
+ else
104946
+ ts.performance.mark("SolutionBuilder::Bundles updated");
104915
104947
  return doneInvalidatedProject(state, projectPath);
104916
104948
  }
104917
104949
  function withProgramOrUndefined(action) {
@@ -105629,7 +105661,10 @@ var ts;
105629
105661
  if (prior !== undefined) {
105630
105662
  return prior;
105631
105663
  }
105664
+ ts.performance.mark("SolutionBuilder::beforeUpToDateCheck");
105632
105665
  var actual = getUpToDateStatusWorker(state, project, resolvedPath);
105666
+ ts.performance.mark("SolutionBuilder::afterUpToDateCheck");
105667
+ ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck");
105633
105668
  state.projectStatus.set(resolvedPath, actual);
105634
105669
  return actual;
105635
105670
  }
@@ -105756,6 +105791,13 @@ var ts;
105756
105791
  }
105757
105792
  }
105758
105793
  function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
105794
+ ts.performance.mark("SolutionBuilder::beforeBuild");
105795
+ var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences);
105796
+ ts.performance.mark("SolutionBuilder::afterBuild");
105797
+ ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
105798
+ return result;
105799
+ }
105800
+ function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) {
105759
105801
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
105760
105802
  if (!buildOrder)
105761
105803
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -105783,6 +105825,13 @@ var ts;
105783
105825
  : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped;
105784
105826
  }
105785
105827
  function clean(state, project, onlyReferences) {
105828
+ ts.performance.mark("SolutionBuilder::beforeClean");
105829
+ var result = cleanWorker(state, project, onlyReferences);
105830
+ ts.performance.mark("SolutionBuilder::afterClean");
105831
+ ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean");
105832
+ return result;
105833
+ }
105834
+ function cleanWorker(state, project, onlyReferences) {
105786
105835
  var buildOrder = getBuildOrderFor(state, project, onlyReferences);
105787
105836
  if (!buildOrder)
105788
105837
  return ts.ExitStatus.InvalidProject_OutputsSkipped;
@@ -105853,6 +105902,14 @@ var ts;
105853
105902
  state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected);
105854
105903
  }
105855
105904
  function buildNextInvalidatedProject(state, changeDetected) {
105905
+ ts.performance.mark("SolutionBuilder::beforeBuild");
105906
+ var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected);
105907
+ ts.performance.mark("SolutionBuilder::afterBuild");
105908
+ ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild");
105909
+ if (buildOrder)
105910
+ reportErrorSummary(state, buildOrder);
105911
+ }
105912
+ function buildNextInvalidatedProjectWorker(state, changeDetected) {
105856
105913
  state.timerToBuildInvalidatedProject = undefined;
105857
105914
  if (state.reportFileChangeDetected) {
105858
105915
  state.reportFileChangeDetected = false;
@@ -105882,7 +105939,7 @@ var ts;
105882
105939
  }
105883
105940
  }
105884
105941
  disableCache(state);
105885
- reportErrorSummary(state, buildOrder);
105942
+ return buildOrder;
105886
105943
  }
105887
105944
  function watchConfigFile(state, resolved, resolvedPath, parsed) {
105888
105945
  if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath))
@@ -105937,6 +105994,7 @@ var ts;
105937
105994
  function startWatching(state, buildOrder) {
105938
105995
  if (!state.watchAllProjectsPending)
105939
105996
  return;
105997
+ ts.performance.mark("SolutionBuilder::beforeWatcherCreation");
105940
105998
  state.watchAllProjectsPending = false;
105941
105999
  for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) {
105942
106000
  var resolved = _a[_i];
@@ -105950,6 +106008,8 @@ var ts;
105950
106008
  watchPackageJsonFiles(state, resolved, resolvedPath, cfg);
105951
106009
  }
105952
106010
  }
106011
+ ts.performance.mark("SolutionBuilder::afterWatcherCreation");
106012
+ ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation");
105953
106013
  }
105954
106014
  function stopWatching(state) {
105955
106015
  ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher);
@@ -106101,6 +106161,12 @@ var ts;
106101
106161
  })(ts || (ts = {}));
106102
106162
  var ts;
106103
106163
  (function (ts) {
106164
+ var StatisticType;
106165
+ (function (StatisticType) {
106166
+ StatisticType[StatisticType["time"] = 0] = "time";
106167
+ StatisticType[StatisticType["count"] = 1] = "count";
106168
+ StatisticType[StatisticType["memory"] = 2] = "memory";
106169
+ })(StatisticType = ts.StatisticType || (ts.StatisticType = {}));
106104
106170
  function countLines(program) {
106105
106171
  var counts = getCountsMap();
106106
106172
  ts.forEach(program.getSourceFiles(), function (file) {
@@ -106110,14 +106176,6 @@ var ts;
106110
106176
  });
106111
106177
  return counts;
106112
106178
  }
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
106179
  function getCountsMap() {
106122
106180
  var counts = new ts.Map();
106123
106181
  counts.set("Library", 0);
@@ -106661,15 +106719,26 @@ var ts;
106661
106719
  if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic))
106662
106720
  return;
106663
106721
  var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions));
106664
- updateSolutionBuilderHost(sys, cb, buildHost_1);
106722
+ var solutionPerformance_1 = enableSolutionPerformance(sys, buildOptions);
106723
+ updateSolutionBuilderHost(sys, cb, buildHost_1, solutionPerformance_1);
106724
+ var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange;
106725
+ buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) {
106726
+ onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount);
106727
+ if (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
106728
+ d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code) {
106729
+ reportSolutionBuilderTimes(builder_1, solutionPerformance_1);
106730
+ }
106731
+ };
106665
106732
  var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions);
106666
106733
  builder_1.build();
106667
106734
  return builder_1;
106668
106735
  }
106669
106736
  var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions));
106670
- updateSolutionBuilderHost(sys, cb, buildHost);
106737
+ var solutionPerformance = enableSolutionPerformance(sys, buildOptions);
106738
+ updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance);
106671
106739
  var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions);
106672
106740
  var exitStatus = buildOptions.clean ? builder.clean() : builder.build();
106741
+ reportSolutionBuilderTimes(builder, solutionPerformance);
106673
106742
  ts.dumpTracingLegend();
106674
106743
  return sys.exit(exitStatus);
106675
106744
  }
@@ -106694,7 +106763,7 @@ var ts;
106694
106763
  };
106695
106764
  var program = ts.createProgram(programOptions);
106696
106765
  var exitStatus = ts.emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, function (s) { return sys.write(s + sys.newLine); }, createReportErrorSummary(sys, options));
106697
- reportStatistics(sys, program);
106766
+ reportStatistics(sys, program, undefined);
106698
106767
  cb(program);
106699
106768
  return sys.exit(exitStatus);
106700
106769
  }
@@ -106712,36 +106781,36 @@ var ts;
106712
106781
  reportDiagnostic: reportDiagnostic,
106713
106782
  reportErrorSummary: createReportErrorSummary(sys, options),
106714
106783
  afterProgramEmitAndDiagnostics: function (builderProgram) {
106715
- reportStatistics(sys, builderProgram.getProgram());
106784
+ reportStatistics(sys, builderProgram.getProgram(), undefined);
106716
106785
  cb(builderProgram);
106717
106786
  }
106718
106787
  });
106719
106788
  return sys.exit(exitStatus);
106720
106789
  }
106721
- function updateSolutionBuilderHost(sys, cb, buildHost) {
106722
- updateCreateProgram(sys, buildHost);
106790
+ function updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance) {
106791
+ updateCreateProgram(sys, buildHost, true);
106723
106792
  buildHost.afterProgramEmitAndDiagnostics = function (program) {
106724
- reportStatistics(sys, program.getProgram());
106793
+ reportStatistics(sys, program.getProgram(), solutionPerformance);
106725
106794
  cb(program);
106726
106795
  };
106727
106796
  buildHost.afterEmitBundle = cb;
106728
106797
  }
106729
- function updateCreateProgram(sys, host) {
106798
+ function updateCreateProgram(sys, host, isBuildMode) {
106730
106799
  var compileUsingBuilder = host.createProgram;
106731
106800
  host.createProgram = function (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) {
106732
106801
  ts.Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram));
106733
106802
  if (options !== undefined) {
106734
- enableStatisticsAndTracing(sys, options, true);
106803
+ enableStatisticsAndTracing(sys, options, isBuildMode);
106735
106804
  }
106736
106805
  return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences);
106737
106806
  };
106738
106807
  }
106739
106808
  function updateWatchCompilationHost(sys, cb, watchCompilerHost) {
106740
- updateCreateProgram(sys, watchCompilerHost);
106809
+ updateCreateProgram(sys, watchCompilerHost, false);
106741
106810
  var emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate;
106742
106811
  watchCompilerHost.afterProgramCreate = function (builderProgram) {
106743
106812
  emitFilesUsingBuilder(builderProgram);
106744
- reportStatistics(sys, builderProgram.getProgram());
106813
+ reportStatistics(sys, builderProgram.getProgram(), undefined);
106745
106814
  cb(builderProgram);
106746
106815
  };
106747
106816
  }
@@ -106774,6 +106843,71 @@ var ts;
106774
106843
  updateWatchCompilationHost(system, cb, watchCompilerHost);
106775
106844
  return ts.createWatchProgram(watchCompilerHost);
106776
106845
  }
106846
+ function enableSolutionPerformance(system, options) {
106847
+ if (system === ts.sys && options.extendedDiagnostics) {
106848
+ ts.performance.enable();
106849
+ return createSolutionPerfomrance();
106850
+ }
106851
+ }
106852
+ function createSolutionPerfomrance() {
106853
+ var statistics;
106854
+ return {
106855
+ addAggregateStatistic: addAggregateStatistic,
106856
+ forEachAggregateStatistics: forEachAggreateStatistics,
106857
+ clear: clear,
106858
+ };
106859
+ function addAggregateStatistic(s) {
106860
+ var existing = statistics === null || statistics === void 0 ? void 0 : statistics.get(s.name);
106861
+ if (existing) {
106862
+ if (existing.type === StatisticType.memory)
106863
+ existing.value = Math.max(existing.value, s.value);
106864
+ else
106865
+ existing.value += s.value;
106866
+ }
106867
+ else {
106868
+ (statistics !== null && statistics !== void 0 ? statistics : (statistics = new ts.Map())).set(s.name, s);
106869
+ }
106870
+ }
106871
+ function forEachAggreateStatistics(cb) {
106872
+ statistics === null || statistics === void 0 ? void 0 : statistics.forEach(cb);
106873
+ }
106874
+ function clear() {
106875
+ statistics = undefined;
106876
+ }
106877
+ }
106878
+ function reportSolutionBuilderTimes(builder, solutionPerformance) {
106879
+ if (!solutionPerformance)
106880
+ return;
106881
+ if (!ts.performance.isEnabled()) {
106882
+ ts.sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
106883
+ return;
106884
+ }
106885
+ var statistics = [];
106886
+ statistics.push({ name: "Projects in scope", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count });
106887
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Projects built");
106888
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Timestamps only updates");
106889
+ reportSolutionBuilderCountStatistic("SolutionBuilder::Bundles updated");
106890
+ solutionPerformance.forEachAggregateStatistics(function (s) {
106891
+ s.name = "Aggregate " + s.name;
106892
+ statistics.push(s);
106893
+ });
106894
+ ts.performance.forEachMeasure(function (name, duration) {
106895
+ if (isSolutionMarkOrMeasure(name))
106896
+ statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name) + " time", value: duration, type: StatisticType.time });
106897
+ });
106898
+ ts.performance.disable();
106899
+ ts.performance.enable();
106900
+ reportAllStatistics(ts.sys, statistics);
106901
+ function reportSolutionBuilderCountStatistic(name) {
106902
+ var value = ts.performance.getCount(name);
106903
+ if (value) {
106904
+ statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name), value: value, type: StatisticType.count });
106905
+ }
106906
+ }
106907
+ function getNameFromSolutionBuilderMarkOrMeasure(name) {
106908
+ return name.replace("SolutionBuilder::", "");
106909
+ }
106910
+ }
106777
106911
  function canReportDiagnostics(system, compilerOptions) {
106778
106912
  return system === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
106779
106913
  }
@@ -106788,7 +106922,10 @@ var ts;
106788
106922
  ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath);
106789
106923
  }
106790
106924
  }
106791
- function reportStatistics(sys, program) {
106925
+ function isSolutionMarkOrMeasure(name) {
106926
+ return ts.startsWith(name, "SolutionBuilder::");
106927
+ }
106928
+ function reportStatistics(sys, program, solutionPerformance) {
106792
106929
  var compilerOptions = program.getCompilerOptions();
106793
106930
  if (canTrace(sys, compilerOptions)) {
106794
106931
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing();
@@ -106799,27 +106936,21 @@ var ts;
106799
106936
  var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
106800
106937
  reportCountStatistic("Files", program.getSourceFiles().length);
106801
106938
  var lineCounts = countLines(program);
106802
- var nodeCounts = countNodes(program);
106803
106939
  if (compilerOptions.extendedDiagnostics) {
106804
106940
  for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) {
106805
106941
  var key = _a[_i];
106806
106942
  reportCountStatistic("Lines of " + key, lineCounts.get(key));
106807
106943
  }
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
106944
  }
106813
106945
  else {
106814
106946
  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
106947
  }
106817
106948
  reportCountStatistic("Identifiers", program.getIdentifierCount());
106818
106949
  reportCountStatistic("Symbols", program.getSymbolCount());
106819
106950
  reportCountStatistic("Types", program.getTypeCount());
106820
106951
  reportCountStatistic("Instantiations", program.getInstantiationCount());
106821
106952
  if (memoryUsed >= 0) {
106822
- reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K");
106953
+ reportStatisticalValue({ name: "Memory used", value: memoryUsed, type: StatisticType.memory }, true);
106823
106954
  }
106824
106955
  var isPerformanceEnabled = ts.performance.isEnabled();
106825
106956
  var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0;
@@ -106833,53 +106964,83 @@ var ts;
106833
106964
  reportCountStatistic("Subtype cache size", caches.subtype);
106834
106965
  reportCountStatistic("Strict subtype cache size", caches.strictSubtype);
106835
106966
  if (isPerformanceEnabled) {
106836
- ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + " time", duration); });
106967
+ ts.performance.forEachMeasure(function (name, duration) {
106968
+ if (!isSolutionMarkOrMeasure(name))
106969
+ reportTimeStatistic(name + " time", duration, true);
106970
+ });
106837
106971
  }
106838
106972
  }
106839
106973
  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);
106974
+ reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"), true);
106975
+ reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"), true);
106976
+ reportTimeStatistic("Parse time", programTime, true);
106977
+ reportTimeStatistic("Bind time", bindTime, true);
106978
+ reportTimeStatistic("Check time", checkTime, true);
106979
+ reportTimeStatistic("Emit time", emitTime, true);
106846
106980
  }
106847
106981
  if (isPerformanceEnabled) {
106848
- reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
106982
+ reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime, false);
106849
106983
  }
106850
- reportStatistics();
106984
+ reportAllStatistics(sys, statistics);
106851
106985
  if (!isPerformanceEnabled) {
106852
106986
  sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
106853
106987
  }
106854
106988
  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;
106989
+ if (solutionPerformance) {
106990
+ ts.performance.forEachMeasure(function (name) {
106991
+ if (!isSolutionMarkOrMeasure(name))
106992
+ ts.performance.clearMeasures(name);
106993
+ });
106994
+ ts.performance.forEachMark(function (name) {
106995
+ if (!isSolutionMarkOrMeasure(name))
106996
+ ts.performance.clearMarks(name);
106997
+ });
106865
106998
  }
106866
- if (value.length > valueSize) {
106867
- valueSize = value.length;
106999
+ else {
107000
+ ts.performance.disable();
106868
107001
  }
106869
107002
  }
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
107003
  }
106875
- function reportStatisticalValue(name, value) {
106876
- statistics.push({ name: name, value: value });
107004
+ function reportStatisticalValue(s, aggregate) {
107005
+ statistics.push(s);
107006
+ if (aggregate)
107007
+ solutionPerformance === null || solutionPerformance === void 0 ? void 0 : solutionPerformance.addAggregateStatistic(s);
106877
107008
  }
106878
107009
  function reportCountStatistic(name, count) {
106879
- reportStatisticalValue(name, "" + count);
107010
+ reportStatisticalValue({ name: name, value: count, type: StatisticType.count }, true);
106880
107011
  }
106881
- function reportTimeStatistic(name, time) {
106882
- reportStatisticalValue(name, (time / 1000).toFixed(2) + "s");
107012
+ function reportTimeStatistic(name, time, aggregate) {
107013
+ reportStatisticalValue({ name: name, value: time, type: StatisticType.time }, aggregate);
107014
+ }
107015
+ }
107016
+ function reportAllStatistics(sys, statistics) {
107017
+ var nameSize = 0;
107018
+ var valueSize = 0;
107019
+ for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) {
107020
+ var s = statistics_1[_i];
107021
+ if (s.name.length > nameSize) {
107022
+ nameSize = s.name.length;
107023
+ }
107024
+ var value = statisticValue(s);
107025
+ if (value.length > valueSize) {
107026
+ valueSize = value.length;
107027
+ }
107028
+ }
107029
+ for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) {
107030
+ var s = statistics_2[_a];
107031
+ sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine);
107032
+ }
107033
+ }
107034
+ function statisticValue(s) {
107035
+ switch (s.type) {
107036
+ case StatisticType.count:
107037
+ return "" + s.value;
107038
+ case StatisticType.time:
107039
+ return (s.value / 1000).toFixed(2) + "s";
107040
+ case StatisticType.memory:
107041
+ return Math.round(s.value / 1000) + "K";
107042
+ default:
107043
+ ts.Debug.assertNever(s.type);
106883
107044
  }
106884
107045
  }
106885
107046
  function writeConfigFile(sys, reportDiagnostic, options, fileNames) {