(size, filename, type, raw)
| 7 | const chalk = safeChalk() |
| 8 | |
| 9 | function formatSize(size, filename, type, raw) { |
| 10 | const pretty = raw ? `${size}B` : prettyBytes(size) |
| 11 | const color = size < 5000 ? 'green' : size > 40000 ? 'red' : 'yellow' |
| 12 | const MAGIC_INDENTATION = type === 'br' ? 13 : 10 |
| 13 | const prefix = ' '.repeat(MAGIC_INDENTATION - pretty.length) |
| 14 | return `${prefix}${chalk[color](pretty)}: ${chalk.white(path.basename(filename))}.${type}` |
| 15 | } |
| 16 | |
| 17 | function pretty(size, raw) { |
| 18 | return raw ? `${size}kb` : prettyBytes(size) |