Description
When running vp migrate, tsdown is removed as a dependency and replaced with vite-plus equivalents.
However, two patterns are currently left unrewritten, causing broken imports and TypeScript errors after migration.
relates: #1501
Cases to handle
1. import "tsdown/client" in .ts files
// before
import "tsdown/client";
// after
import "vite-plus/pack/client";
Real-world example: https://github.com/Tarrowren/css-class-intellisense/c91dd77dc1fb5acf/lezer/less/test/test-less.ts#L1
2. types array in tsconfig.json
// before
{ "compilerOptions": { "types": ["tsdown/client"] } }
{ "compilerOptions": { "types": ["vite/client"] } }
// after
{ "compilerOptions": { "types": ["vite-plus/pack/client"] } }
{ "compilerOptions": { "types": ["vite-plus/client"] } }
Real-world example: https://github.com/ascorbic/cirrus/blob/98aec98dc56de58f8d6010565cef6cfc5c62311e/packages/pds/tsconfig.json#L5
Suggested solution
Case 1 — import in .ts files
Add a new ast-grep rule to REWRITE_TSDOWN_RULES (import_rewriter.rs)
to match import "tsdown/client" and rewrite it to import "vite-plus/pack/client",
alongside the existing tsdown rule.
Case 2 — tsconfig.json types array
Add a new function to packages/cli/src/utils/tsconfig.ts using the existing
jsonc-parser dependency to rewrite entries in compilerOptions.types:
"tsdown/client" → "vite-plus/pack/client"
"vite/client" → "vite-plus/client"
Call this function from migrator.ts alongside cleanupDeprecatedTsconfigOptions().
Alternative
- Document as manual steps instead of automating. (Even though I don't want to)
Additional context
No response
Validations
Description
When running
vp migrate,tsdownis removed as a dependency and replaced withvite-plusequivalents.However, two patterns are currently left unrewritten, causing broken imports and TypeScript errors after migration.
relates: #1501
Cases to handle
1.
import "tsdown/client"in.tsfilesReal-world example: https://github.com/Tarrowren/css-class-intellisense/c91dd77dc1fb5acf/lezer/less/test/test-less.ts#L1
2.
typesarray intsconfig.jsonReal-world example: https://github.com/ascorbic/cirrus/blob/98aec98dc56de58f8d6010565cef6cfc5c62311e/packages/pds/tsconfig.json#L5
Suggested solution
Case 1 — import in .ts files
Add a new ast-grep rule to
REWRITE_TSDOWN_RULES(import_rewriter.rs)to match
import "tsdown/client"and rewrite it toimport "vite-plus/pack/client",alongside the existing
tsdownrule.Case 2 — tsconfig.json types array
Add a new function to
packages/cli/src/utils/tsconfig.tsusing the existingjsonc-parserdependency to rewrite entries incompilerOptions.types:"tsdown/client"→"vite-plus/pack/client""vite/client"→"vite-plus/client"Call this function from
migrator.tsalongsidecleanupDeprecatedTsconfigOptions().Alternative
Additional context
No response
Validations