feat(migration): skip rewriting imports for packages in peerDependencies#367
feat(migration): skip rewriting imports for packages in peerDependencies#367
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ddeb301 to
5bb32a4
Compare
5bb32a4 to
9f1d497
Compare
There was a problem hiding this comment.
Pull request overview
This PR adds intelligent peer dependency handling to the Vite migration tool, preventing accidental bundling of vite-plus into libraries that depend on Vite as a peer dependency (like Vite plugins).
Key Changes:
- Split monolithic AST-grep rules into separate VITE, VITEST, and TSDOWN rule sets for selective application
- Implemented package.json peerDependencies detection with per-file resolution
- Added caching mechanism to optimize package.json reads in monorepos
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/vite_migration/src/import_rewriter.rs |
Core implementation: split AST rules, added SkipPackages logic, implemented nearest package.json resolution, added comprehensive unit tests |
packages/global/src/utils/workspace.ts |
Added node_modules exclusion to workspace package discovery |
packages/global/snap-tests/migration-skip-vite-peer-dependency/* |
Snap test for single-package scenario with vite in peerDependencies |
packages/global/snap-tests/migration-monorepo-skip-vite-peer-dependency/* |
Snap test for monorepo scenario with different peerDependencies per package |
ecosystem-ci/repo.json |
Added vite-plugin-react to ecosystem CI |
ecosystem-ci/.gitignore |
Added vite-plugin-react to gitignore |
.github/workflows/e2e-test.yml |
Added vite-plugin-react E2E test configuration and pull_request trigger |
CLAUDE.md |
Added build and snap-test instructions documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9f1d497 to
41f5174
Compare
41f5174 to
8435a43
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8435a43 to
f663046
Compare
f663046 to
33874b2
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
33874b2 to
6e9016f
Compare
6e9016f to
6ed5f3a
Compare
6ed5f3a to
fdfd022
Compare
fdfd022 to
63f9d5a
Compare
4a5de30 to
60194e3
Compare
Merge activity |
63f9d5a to
927dd23
Compare
…ndencies When a project has vite in peerDependencies (like a Vite plugin), the import rewriter now skips rewriting vite imports to avoid accidentally bundling vite-plus into the library. - Split AST-grep rules into separate VITE, VITEST, and TSDOWN rule sets - Added get_skip_packages_from_root() to check root package.json for peerDependencies - Apply rules conditionally based on which packages are in peerDependencies - Added comprehensive unit tests for peerDependencies scenarios - Added snap test: migration-skip-vite-peer-dependency - Updated CLAUDE.md with build and snap-test instructions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Find the nearest package.json for each source file instead of only checking the root. This allows monorepos to have different packages with different peerDependencies - a vite plugin package can have vite in peerDependencies (imports preserved) while an app package without peerDependencies will have imports rewritten. - Add find_nearest_package_json() to walk up directories - Cache package.json lookups for performance - Add monorepo unit tests and snap-test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
65ceee6 to
6e4eef6
Compare
927dd23 to
9a4de13
Compare

When a project has vite in peerDependencies (like a Vite plugin), the
import rewriter now skips rewriting vite imports to avoid accidentally
bundling vite-plus into the library.
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com