lacspace-size

Bundle size in raw + gzip + brotli, with CI budgets.

● Live · v0.1.0npmSource
terminal
npx lacspace-size dist
What it does

Everything, 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.

Features

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.

How to use

Copy, paste, done

Real commands and snippets — from a one-liner to the typed library.

Analyze a build dir
terminal
npx lacspace-size dist

Raw/gzip/brotli table + by-extension totals.

Enforce budgets in CI
terminal
npx lacspace-size "dist/**/*.js" --max 500kb --budget "*.css:50kb"

Exits non-zero if any budget is exceeded.

Save a baseline
terminal
npx lacspace-size dist --save-baseline .size.json

Commit it on main.

Fail a PR regression
terminal
npx lacspace-size dist --baseline .size.json --max-increase 5%

Fails if the total grew >5%.

Markdown PR comment
terminal
npx lacspace-size dist -f md > size-report.md

Drop into a PR.

Good for

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

Start now

Run lacspace-size today

Free, open-source, no API keys. It's a CLI and a typed library.

terminal
npx lacspace-size dist