\nView detailed bundle breakdown
\n\n\n${printAssetTablesByGroup(
groups,
)}\n
\n `,
);
return parts.join('\n');
}
async function main() {
const args = parseArgs(process.argv);
console.error(
`[bundle-stats] Found ${args.sections.length} sections to process`,
);
args.sections.forEach((section, index) => {
console.error(
`[bundle-stats] Section ${index + 1}: ${section.name} (base: ${section.basePath}, head: ${section.headPath})`,
);
});
const sections = [];
for (const section of args.sections) {
console.error(`[bundle-stats] Processing section: ${section.name}`);
console.error(
`[bundle-stats] Loading base stats from: ${section.basePath}`,
);
const baseStats = await loadStats(section.basePath);
console.error(
`[bundle-stats] Loading head stats from: ${section.headPath}`,
);
const headStats = await loadStats(section.headPath);
const statsDiff = getStatsDiff(baseStats, headStats);
const chunkDiff = getChunkModuleDiff(baseStats, headStats);
console.error(
`[bundle-stats] Section ${section.name}: ${statsDiff.total.name} files, total size ${statsDiff.total.old.size} → ${statsDiff.total.new.size}`,
);
sections.push({
name: section.name,
statsDiff,
chunkDiff,
});
}
const identifier = ``;
const comment = [
'### Bundle Stats',
'',
sections
.map(section =>
renderSection(section.name, section.statsDiff, section.chunkDiff),
)
.join('\n\n---\n\n'),
'',
identifier,
'',
].join('\n');
process.stdout.write(comment);
}
main().catch(error => {
console.error(error);
process.exitCode = 1;
});