@tinyport/core
v0.4.0
Published
The portable import-analysis engine behind TinyPort: parse imports, measure real bundle cost, detect unused/duplicate imports, and plan safe rewrites.
Maintainers
Readme
@tinyport/core
The portable import-analysis engine behind TinyPort.
It parses import statements, measures each imported package's real cost (disk
shipped or esbuild-bundled + gzipped), detects unused and duplicate
imports, and plans safe sort/group/remove rewrites.
Most people want one of the surfaces built on top of this, not the engine directly:
- CLI —
tinyport - VS Code — TinyPort
- MCP server —
@tinyport/mcp
Design
Core is deliberately portable: it imports no vscode, no esbuild, and no
Node built-ins beyond node:path / node:zlib. All I/O goes through ports
(FileSystemPort, CacheStore, BundlerPort), so the same analysis runs in
a CLI, an editor, or an MCP server. A frontend supplies the ports; core turns
a file into a deterministic Report.
The rewriter is text-preserving and refuses rather than guesses: side-effect imports and any foreign text between imports are ordering barriers, so nothing is ever reordered across code it does not understand, and no byte outside an import statement is dropped.
import { analyzeFile } from "@tinyport/core";
const report = await analyzeFile({ file, text, fs, cache });Full docs and source: tinyport.vantaso.org · github.com/MuhammadAli511/tinyport-engine.
MIT © 2026 Muhammad Ali
