<commit_before>import {sum, mean, stdev} from 'stats-lite'
import Table from 'cli-table'
import ms from 'pretty-ms'
import {bold, red} from 'chalk'

const FUNCTIONS = ['load', 'resolveId', 'transform', 'transformBundle']

export default class RollupTimer {
  constructor () {
    this._timings = {}
  }

  get timings () {
    return this._timings
  }

  time (plugins) {
    return plugins.map((plugin, i) => this._time(plugin, i))
  }

  report () {
    const ids = Object.keys(this._timings)
      .filter((id) => (this._timings[id].length > 0))
    const maxSum = Math.max(0, ...ids.map((id) => sum(this._timings[id])))
    const all = Array.prototype.concat.apply([], ids.map((id) => this._timings[id]))
    const table = new Table({
      head: ['Plugin', 'Calls', 'Sum', 'Mean', 'StdDev'],
      colAligns: ['left', 'right', 'right', 'right', 'right'],
      style: {
        head: ['cyan']
      }
    })
    for (const id of ids) {
      this._addToReport(table, id, this._timings[id], maxSum)<commit_msg>Add support for intro, outro, banner, and footer<commit_after>import {sum, mean, stdev} from 'stats-lite'
import Table from 'cli-table'
import ms from 'pretty-ms'
import {bold, red} from 'chalk'

const FUNCTIONS = [
  'load',
  'resolveId',
  'transform',
  'transformBundle',
  'intro',
  'outro',
  'banner',
  'footer'
]

export default class RollupTimer {
  constructor () {
    this._timings = {}
  }

  get timings () {
    return this._timings
  }

  time (plugins) {
    return plugins.map((plugin, i) => this._time(plugin, i))
  }

  report () {
    const ids = Object.keys(this._timings)
      .filter((id) => (this._timings[id].length > 0))
    const maxSum = Math.max(0, ...ids.map((id) => sum(this._timings[id])))
    const all = Array.prototype.concat.apply([], ids.map((id) => this._timings[id]))
    const table = new Table({
      head: ['Plugin', 'Calls', 'Sum', 'Mean', 'StdDev'],
      colAligns: ['left', 'right', 'right', 'right', 'right'],
      style: {
        head: ['cyan']
      }
    })
    for (const id of ids) {
      this._addToReport(table, id, this._timings[id], maxSum)
{'fraction_non_alphanumeric': 0.18357715903728172, 'fraction_numerical': 0.0018876828692779614, 'mean_word_length': 3.2063492063492065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2806185', 'n_tokens_mistral': 750, 'n_tokens_neox': 732, 'n_words': 184}