The @adaptive-bundle/vite-plugin ships a CLI for standalone analysis, scaffolding, and validation.
npx adaptive <command> [options]Run bundle analysis on your source files without a full Vite build.
npx adaptive analyze
npx adaptive analyze --src=src/featuresScans all .ts, .tsx, .js, .jsx files for adaptive boundaries and reports their structure. Size data requires a full Vite build for accurate numbers.
| Flag | Default | Description |
|---|---|---|
--src |
src |
Source directory to scan |
Scaffold an adaptive boundary for a heavy component. Creates a .Lite variant file and a .adaptive wrapper.
npx adaptive init src/components/MapView.tsxOutput:
Created:
src/components/MapViewLite.tsx
src/components/MapView.adaptive.tsx
Next: implement the lite variant in MapViewLite.tsx
The generated .adaptive.tsx file uses the two-variant pattern:
import { adaptive } from '@adaptive-bundle/react';
const MapView = adaptive({
high: () => import('./MapView'),
low: () => import('./MapViewLite'),
name: 'MapView',
});
export default MapView;What-if analysis: shows what would happen if you wrapped a component in an adaptive boundary.
npx adaptive simulate src/components/HeavyChart.tsxLists external dependencies (potential high-variant exclusives) and local imports. Helps you estimate impact before committing to an adaptive boundary.
Regenerate a report from cached build data. Requires a prior vite build with report: true and reportFormat: 'json'.
npx adaptive report
npx adaptive report --format=html --output=./reports| Flag | Default | Description |
|---|---|---|
--format |
console |
Output format: console, html, json |
--output |
./adaptive-reports |
Output directory for HTML/JSON files |
Check that all adaptive boundaries in your source are correctly configured (both variants present, import paths resolve).
npx adaptive validate
npx adaptive validate --src=src/featuresReports missing high/low variants, unresolved import paths, and other structural issues. Non-zero exit code on validation errors — suitable for CI.
| Flag | Description |
|---|---|
--help |
Show help message |
--src=<path> |
Override source directory (default: src) |
--format=<fmt> |
Report format: console, html, json |
--output=<path> |
Output directory for reports |