/** * Prints the release size of one entrypoint as JSON. * Run in its own process: inside `bun test`, Bun.build reuses the test * runtime's module resolution (CommonJS `main` entries), which inflates results. * bun run scripts/size.ts packages/toaster/index.ts */ import { brotliCompressSync, gzipSync } from "node:zlib"; import { buildRelease } from "./release"; const entry = process.argv[2]; if (!entry) throw new Error("usage: bun run scripts/size.ts "); const code = await buildRelease(entry); console.log(JSON.stringify({ entry, min: code.length, gz: gzipSync(code).byteLength, br: brotliCompressSync(code).byteLength }));