function bundleStats(bundle, outDir) {
	let total = 0;
	const assets = bundle.output
		.filter(asset => !/\.map$/.test(asset.fileName))
		.sort((a, b) => {
			const scoreB = scoreAsset(b);
			const scoreA = scoreAsset(a);

			if (scoreA === scoreB) {
				const contentA = a.type === 'asset' ? a.source : a.code;
				const contentB = b.type === 'asset' ? b.source : b.code;
				return contentB.length - contentA.length;
			}

			return scoreB - scoreA;
		});

	let nonCssAsset = false;
	const assetsText = assets.reduce((str, output) => {
		// TODO: group output and bring back asset sizes
		if (!nonCssAsset && output.type === 'asset' && !/\.(css|html)/.test(output.fileName)) {
			str += '\n';
			nonCssAsset = true;
		}

		const content = output.type === 'asset' ? output.source : output.code;
		const size = content.length;
		total += content.length;
		let sizeText = prettyBytes(size);
		if (size > 50e3) sizeText = kl.lightRed(sizeText);
		else if (size > 10e3) sizeText = kl.lightYellow(sizeText);
		else if (size > 5e3) sizeText = kl.lightBlue(sizeText);
		else sizeText = kl.lightGreen(sizeText);

		let { fileName } = output;
		fileName = fileName.endsWith('.js')
			? kl.cyan(fileName)
			: fileName.endsWith('.css')
			? kl.magenta(fileName)
			: fileName;
		return `${str}\n  ${kl.dim(outDir + path.sep)}${fileName} ${sizeText}`;
	}, '');

	const totalText = prettyBytes(total);

	return { assets, total, totalText, assetsText };
}
@param {import('rollup').RollupOutput} bundle
@param {string} outDir