Thanks for your interest in contributing! Here's how to get started.
git clone https://github.com/Phoenixrr2113/phantom.git
cd phantom
npm install
npm run build
npm testsrc/
├── plugin.ts # Main unplugin entry (Vite/Webpack/Rspack)
├── analyzer.ts # Module parser (OXC + eslint-scope)
├── classify/ # Segment classification (taint, purity, lazy detection)
├── extract/ # Code generation (stubs, chunk modules, lazy transforms)
├── runtime/ # Browser runtime ($p lazy loader)
├── types.ts # Shared TypeScript types
└── cli.ts # CLI entry point
test/
├── *.unit.ts # Unit and integration tests (vitest)
├── fixtures/ # Test fixture components
integration-test/ # Vite integration test
integration-test-webpack/ # Webpack integration test
integration-test-rsbuild/ # Rsbuild integration test
benchmarks/ # shadcn-admin benchmark suite
# Full suite (253 tests)
npm test
# Single file
npx vitest run test/extract.unit.ts
# Watch mode
npx vitest test/extract.unit.ts# Route-level JS comparison
npm run build
node benchmarks/compare-routes.mjs
# Lighthouse A/B comparison (requires Chrome)
node benchmarks/lighthouse-compare.mjs --runs=3- Fork and branch — Create a feature branch from
main - Test — All 253+ tests must pass (
npm test) - Build —
npm run buildmust succeed - Scope — Keep PRs focused on a single change
- Describe — Explain what changed and why in the PR description
- Bug fixes with a regression test
- Performance improvements with benchmark evidence
- New bundler integrations (Farm, Turbopack, etc.)
- Documentation improvements
- Classification accuracy improvements (with test cases)
- TypeScript strict mode
- No external runtime dependencies (zero-dep for end users)
- Comments explain why, not what
Please include:
- Phantom version (
npm ls phantom-build) - Bundler and version (Vite/Webpack/Rsbuild)
- Minimal reproduction (ideally a repo or code snippet)
- Expected vs actual behavior
By contributing, you agree that your contributions will be licensed under the MIT License.