tinyport
v0.4.0
Published
Know what every import costs. Measure, sort, clean, and budget your imports from the command line.
Maintainers
Readme
tinyport
Know what every import costs, from the command line. TinyPort measures the real bytes a bundler ships for each import, then sorts, cleans, and budgets your import blocks.
Part of TinyPort: one engine, three surfaces (this CLI, a VS Code extension, and an MCP server for AI agents).
Install
No install needed:
npx tinyport report "src/**/*.ts"Or install it globally / as a dev dependency:
npm i -g tinyport
# or
npm i -D tinyportCommands
tinyport check [...patterns]
Fail CI when a file goes over its byte budget. Leads with a one-line summary,
then details only the files that matter (over-budget when a budget is set,
otherwise the heaviest, sorted heaviest-first). Exits 1 the moment one file
is over.
tinyport check "src/**/*.ts" --budget 10000089 of 142 files have imports · 47 packages · 3.2 MB total
Over budget
src/app.tsx 212 kB, over budget by 112 kB
framer-motion 114 kB (bundled)
moment 72 kB (bundled)
3 of 142 files over budget| Flag | Effect |
|---|---|
| --budget <bytes> | Per-file budget in bytes. |
| --bundle | Measure the real bundled + gzipped size via esbuild (slower). |
| --all | Detail every file with imports, not just the heaviest. |
| --json | Machine-readable output. |
tinyport fix [...patterns]
Sort and group imports. Prints a diff by default and writes nothing until you
pass --write.
tinyport fix "src/**/*.ts" # preview the diff
tinyport fix "src/**/*.ts" --write # apply| Flag | Effect |
|---|---|
| --write | Apply the changes (otherwise a diff is printed). |
| --remove-unused | Also remove imports flagged unused, before sorting. |
tinyport report [...patterns]
Rank the heaviest imported packages across the project.
tinyport report "src/**/*.ts" --top 20| Flag | Effect |
|---|---|
| --top <n> | How many packages to list (default 20). |
| --bundle | Measure the real bundled + gzipped size via esbuild (slower). |
| --json | Machine-readable output. |
Sizing
By default TinyPort reports shipped, an instant, offline, disk-based
estimate. Pass --bundle for bundled, the real minified + gzipped bytes a
bundler would ship for that specific import. Every figure is labelled so an
estimate is never mistaken for a measurement, and a whole-statement
import type counts as 0 bytes.
Full docs: tinyport.vantaso.org/docs.
MIT © 2026 Muhammad Ali
