feat(migration): add tsdown to vite lib migration support#362
Merged
Conversation
This was referenced Dec 23, 2025
Member
Author
cc93454 to
4da046c
Compare
0beb490 to
30704fc
Compare
25bac5c to
f96eab7
Compare
30704fc to
7927e5e
Compare
f96eab7 to
f02d318
Compare
e2e5399 to
5d538f9
Compare
c2be0e2 to
9d34b0d
Compare
5d538f9 to
ac6a9e0
Compare
11fdb5c to
15d194b
Compare
9d34b0d to
ea8c676
Compare
15d194b to
b01886a
Compare
ea8c676 to
a4b708d
Compare
43287ba to
73b0808
Compare
aac6031 to
e3a2603
Compare
73b0808 to
f0e76cc
Compare
Member
|
cursor review |
Brooooooklyn
approved these changes
Dec 24, 2025
- Add import rewriting: `import { defineConfig } from 'tsdown'` → `import { defineConfig } from '@voidzero-dev/vite-plus/lib'`
- Add declare module rewriting for tsdown
- Add script rewriting: `tsdown` → `vite lib`
- Add unit tests for tsdown import and declare module rewriting
- Add snap test fixture for migration-from-tsdown
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
f0e76cc to
97f9757
Compare
e3a2603 to
29897cd
Compare
Add functionality to automatically import tsdown.config.ts and add `lib: libConfig` to the vite defineConfig when migrating. - Add merge_tsdown_config function in Rust - Reuse generate_merge_rule for adding lib config (consistent with lint/fmt) - Add NAPI binding for mergeTsdownConfig - Update migrator to call mergeTsdownConfigFile instead of notifyTsdownConfig - Create vite.config.ts if it doesn't exist before merging tsdown config - Support vite.config.ts files without any import statements - Use ast-grep for consistent import addition (add_lib_config_import) - Always show documentation link for manual tsdown config merging - Add idempotency checks to prevent duplicates when running migration multiple times - Add unit tests with complete content comparison for tsdown config merging Note: ast-grep patterns match the call expression without the trailing semicolon. A code formatter (e.g., `vite fmt`) can add semicolons back. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
97f9757 to
c2da86a
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds automated migration support from tsdown (a TypeScript library bundler) to Vite+. The migration handles import rewriting, config file merging, package dependency updates, and CLI script replacements.
- Import and declare module statements are rewritten from
tsdown→@voidzero-dev/vite-plus/lib - Config files are merged into
vite.config.ts: JSON configs are merged inline; TS/JS configs are imported - Package scripts are updated:
tsdown→vite lib
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/global/src/migration/migrator.ts |
Adds mergeTsdownConfigFile function to orchestrate tsdown config migration, called from all migration entry points |
packages/global/src/migration/detector.ts |
Enables detection of tsdown.config.* files across all supported extensions |
packages/global/src/migration/__tests__/__snapshots__/migrator.spec.ts.snap |
Updates snapshots to reflect removal of tsdown package from dependencies |
packages/global/snap-tests/migration-from-tsdown/* |
Adds snap test fixture for TS/JS config migration (imports config file) |
packages/global/snap-tests/migration-from-tsdown-json-config/* |
Adds snap test fixture for JSON config migration (merges inline and deletes file) |
packages/global/rules/vite-tools.yml |
Adds bash command rewriting rule: tsdown → vite lib |
crates/vite_migration/src/vite_config.rs |
Implements merge_tsdown_config function with extension mapping (.ts→.js, etc.) and comprehensive unit tests |
crates/vite_migration/src/import_rewriter.rs |
Adds import and declare module rewriting rules for tsdown package with unit tests |
crates/vite_migration/src/lib.rs |
Exports merge_tsdown_config function |
packages/global/binding/src/migration.rs |
Creates NAPI binding for merge_tsdown_config Rust function |
packages/global/binding/src/lib.rs |
Exports merge_tsdown_config binding |
packages/global/binding/index.js |
Exports mergeTsdownConfig JavaScript function |
packages/global/binding/index.d.ts |
Adds TypeScript type definitions for mergeTsdownConfig |
package.json |
Adds test:unit npm script |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

import { defineConfig } from 'tsdown'→import { defineConfig } from '@voidzero-dev/vite-plus/lib'tsdown→vite lib🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
Note
Introduces automated migration from
tsdownto Vite+.tsdownto@voidzero-dev/vite-plus/libwith unit testsmerge_tsdown_config(Rust core, NAPI binding, and JS export) importstsdown.config.*intovite.config.*and injectslib: tsdownConfig(idempotent)tsdown.config.*; merges JSON config content intoliband deletes the file, or adds an import for TS/JS; removestsdownand replaces scripts via rules (tsdown→vite lib)vite-tools.yml) and adds snap tests formigration-from-tsdown*; minor scripts: addstest:unitWritten by Cursor Bugbot for commit f0e76cc. This will update automatically on new commits. Configure here.