How suleymancelikel/metro-bundle-visualizer works
metro-bundle-visualizer is a React Native CLI tool that captures Metro’s per-module JavaScript sizes and produces a self-contained interactive HTML treemap. The main workflow detects project settings, bundles through a temporary Metro configuration, captures module statistics in the serializer, generates the report, and optionally opens it. The graph also preserves the documented package breakdown, search/filter, tooltip, and file-detail capabilities. Relationships are limited to those shown in the CLI, serializer, report code, or README; UI asset wiring is supported by the report implementation.
Main entry points: cli.ts CLI workflow · report.ts HTML report generator · bundle.ts Bundle runner · serializer.ts Stats serializer
Components 12
Project discovery
- CLI workflow
src/cli.ts - Project detection
src/detect.ts
Bundle capture
- Metro bundler
- Bundle runner
src/bundle.ts - Stats serializer
src/serializer.ts - Module statistics
Report visualization
- HTML report generator
src/report.ts - Report template
src/ui/template.html - Report styles
src/ui/styles.css - Treemap interface
src/ui/treemap.js
Other components
- React Native developer
- Browser
Connections 13
- React Native developer → CLI workflow: runs
README.md - CLI workflow → Project detection: detects project
src/cli.ts - CLI workflow → Bundle runner: runs bundle
src/cli.ts - Bundle runner → Metro bundler: spawns bundler
src/bundle.ts - Metro bundler → Stats serializer: invokes serializer
README.md - Stats serializer → Module statistics: writes statistics
src/serializer.ts - CLI workflow → Module statistics: reads statistics
src/cli.ts - CLI workflow → HTML report generator: generates report
src/cli.ts - HTML report generator → Report template: loads template
src/report.ts - HTML report generator → Report styles: embeds styles
src/report.ts - HTML report generator → Treemap interface: embeds interface
src/report.ts - Treemap interface → Browser: renders treemap
README.md - CLI workflow → Browser: opens report
src/cli.ts