| 159 | } |
| 160 | |
| 161 | const createSelectedReport = (stats: ReadonlyArray<BundleStats>): string => { |
| 162 | const lines: Array<string> = [ |
| 163 | "| File Name | Current Size |", |
| 164 | "|:----------|:------------:|" |
| 165 | ] |
| 166 | |
| 167 | for (const current of stats) { |
| 168 | const filename = `\`${path.basename(current.path)}\`` |
| 169 | const currKb = `${(current.sizeInBytes / 1000).toFixed(2)} KB` |
| 170 | const line = `| ${filename} | ${currKb} |` |
| 171 | lines.push(line) |
| 172 | } |
| 173 | |
| 174 | return lines.join("\n") + "\n" |
| 175 | } |
| 176 | |
| 177 | const createVisualizationReport = (paths: ReadonlyArray<string>, outputDirectory: string): string => { |
| 178 | const lines: Array<string> = [ |