bundle-import-auditor

📁 handxr/bundle-import-auditor 📅 10 days ago
2
总安装量
2
周安装量
#75689
全站排名
安装命令
npx skills add https://github.com/handxr/bundle-import-auditor --skill bundle-import-auditor

Agent 安装分布

opencode 2
gemini-cli 2
antigravity 2
claude-code 2
windsurf 2
github-copilot 2

Skill 文档

Bundle Import Auditor

Static analysis tool that scans JS/TS imports for patterns that bloat production bundles.

Running the Audit

# Single file
python3 scripts/bundle_import_auditor.py <file>

# Entire project
python3 scripts/bundle_import_auditor.py <directory>

# Include low-severity hints (deep imports, code-splitting opportunities)
python3 scripts/bundle_import_auditor.py <target> --strict

# Machine-readable JSON
python3 scripts/bundle_import_auditor.py <target> --json

No dependencies — uses only Python 3 standard library.

Detection Categories

Category Detects Severity
Heavy dependencies 20+ known packages with lighter alternatives (moment, lodash, jquery, axios, uuid…) Error (100KB+) / Warning
Tree-shaking blockers import * as X wildcards, barrel file re-exports Warning
Duplicate imports Same module imported multiple times in one file Warning
Code-splitting Route/page/modal components that could be lazy-loaded Info
Import hygiene Deep internal imports, heavy CSS frameworks Info
Lodash patterns Full lodash import vs per-function or lodash-es Error / Warning

Severity Levels

  • !! Error: Large impact (100KB+) or broken tree-shaking — fix immediately
  • !~ Warning: Moderate impact or suboptimal patterns — fix in hot paths
  • ~~ Info: Improvement opportunities (only shown with --strict)

Fix Priority

  1. Heavy dependencies — swap moment/lodash/jquery for modern alternatives (biggest wins)
  2. Lodash full imports — switch to per-function imports or lodash-es
  3. Wildcard imports — convert import * to named imports for tree-shaking
  4. Barrel files — import directly from source modules instead of index files
  5. Code-splitting — lazy-load route/page components

Detailed Rules

For complete detection rules, edge cases, and configuration tips, see references/bundle-rules.md.