lacspace-size
Bundle size in raw + gzip + brotli, with CI budgets.
npx lacspace-size distEverything, in one command
lacspace-size is a zero-dependency bundle/build-output analyzer. Point it at files, a directory, or globs and it compresses each file with Node's built-in zlib to report raw, gzip and brotli sizes, a per-file table (sorted largest-first with % of total) and a by-extension rollup. Its headline feature is CI gating: --max and repeatable --budget exit non-zero when a budget is breached, and --save-baseline/--baseline plus --max-increase fail a pull request that grows the bundle. Human output is colorized; --json and -f md feed dashboards and PR comments.
What's inside
Raw + gzip + brotli
Every file compressed independently via node:zlib, exactly as a CDN serves it.
Budgets that gate CI
Global --max and repeatable per-pattern --budget, non-zero exit on breach.
Baseline diff
Snapshot a run, then report added/removed/grew/shrank files and total delta/%.
Regression gate
--max-increase <size|%> fails a PR that grows the bundle.
Clean reporting
Sorted table + by-extension rollup, colorized, plus --json and Markdown.
Zero deps, offline
Nothing is uploaded; no key, no telemetry.
CLI + library
A typed dual ESM/CJS library sharing one engine.
Copy, paste, done
Real commands and snippets — from a one-liner to the typed library.
npx lacspace-size distRaw/gzip/brotli table + by-extension totals.
npx lacspace-size "dist/**/*.js" --max 500kb --budget "*.css:50kb"Exits non-zero if any budget is exceeded.
npx lacspace-size dist --save-baseline .size.jsonCommit it on main.
npx lacspace-size dist --baseline .size.json --max-increase 5%Fails if the total grew >5%.
npx lacspace-size dist -f md > size-report.mdDrop into a PR.
What people build with it
✓ Gate PRs on bundle size in CI
✓ Track dist size over time with a committed baseline
✓ Audit which files/extensions dominate a build
✓ Produce a Markdown size report for review
Run lacspace-size today
Free, open-source, no API keys. It's a CLI and a typed library.
npx lacspace-size dist