{
  "version": 3,
  "sources": ["../../src/utils/analyze-outputs.ts"],
  "sourceRoot": "file://",
  "sourcesContent": ["/**\n * @file Utilities - analyzeOutputs\n * @module mkbuild/utils/analyzeOutputs\n */\n\nimport type { OutputMetadata } from '#src/types'\nimport { entries, join, template } from '@flex-development/tutils'\nimport pb from 'pretty-bytes'\nimport color from 'tinyrainbow'\n\n/**\n * Generates a build analysis for the given `outputs`.\n *\n * @param {string} outdir - Output directory name\n * @param {Record<string, Pick<OutputMetadata, 'bytes'>>} [outputs={}] - Build\n * output map from metafile\n * @return {{ analysis: string; bytes: number }} Build output analysis and size\n */\nconst analyzeOutputs = (\n  outdir: string,\n  outputs: Record<string, Pick<OutputMetadata, 'bytes'>> = {}\n): { analysis: string; bytes: number } => {\n  /**\n   * Indentation.\n   *\n   * @const {string} indent\n   */\n  const indent: string = ' '.repeat(2)\n\n  /**\n   * Output strings.\n   *\n   * @const {string[]} strings\n   */\n  const strings: string[] = []\n\n  /**\n   * Total output size.\n   *\n   * @const {number} size\n   */\n  const size: number = entries(outputs).reduce((acc, output) => {\n    const [outfile, metadata] = output\n    strings.push(color.gray(`${indent}└─ ${outfile} (${pb(metadata.bytes)})`))\n    return acc + metadata.bytes\n  }, 0)\n\n  return {\n    analysis: template(`${indent}{0} (total size: {1})\\n{2}`, {\n      0: color.bold(outdir),\n      1: color.cyan(pb(size)),\n      2: join(strings, '\\n')\n    }),\n    bytes: size\n  }\n}\n\nexport default analyzeOutputs\n"],
  "mappings": ";;AAMA,SAAS,SAAS,MAAM,gBAAgB;AACxC,OAAO,QAAQ;AACf,OAAO,WAAW;AAUlB,MAAM,iBAAiB,wBACrB,QACA,UAAyD,CAAC,MAClB;AAMxC,QAAM,SAAiB,IAAI,OAAO,CAAC,GAO7B,UAAoB,CAAC,GAOrB,OAAe,QAAQ,OAAO,EAAE,OAAO,CAAC,KAAK,WAAW;AAC5D,UAAM,CAAC,SAAS,QAAQ,IAAI;AAC5B,mBAAQ,KAAK,MAAM,KAAK,GAAG,MAAM,MAAM,OAAO,KAAK,GAAG,SAAS,KAAK,CAAC,GAAG,CAAC,GAClE,MAAM,SAAS;AAAA,EACxB,GAAG,CAAC;AAEJ,SAAO;AAAA,IACL,UAAU,SAAS,GAAG,MAAM;AAAA,MAA8B;AAAA,MACxD,GAAG,MAAM,KAAK,MAAM;AAAA,MACpB,GAAG,MAAM,KAAK,GAAG,IAAI,CAAC;AAAA,MACtB,GAAG,KAAK,SAAS;AAAA,CAAI;AAAA,IACvB,CAAC;AAAA,IACD,OAAO;AAAA,EACT;AACF,GArCuB;AAuCvB,IAAO,0BAAQ;",
  "names": []
}
