feat(cli): replace vite-lib config with direct tsdown integration#381
feat(cli): replace vite-lib config with direct tsdown integration#381
Conversation
9089b4f to
eb49060
Compare
eb49060 to
27bc06c
Compare
There was a problem hiding this comment.
Pull request overview
This PR replaces the Rust-based Vite lib config generation with a Node.js implementation using the cac CLI library to simplify the architecture and enable direct interaction with the tsdown API.
Key Changes:
- Removed Rust code that generated temporary Vite lib config files
- Implemented lib command in Node.js using
cacfor CLI parsing and tsdown's build API - Updated path resolution to point to the new lib-bin.js instead of tsdown's CLI
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/src/lib-bin.ts | New Node.js implementation of the lib command with CLI parsing and tsdown integration |
| packages/cli/src/resolve-lib.ts | Updated binPath to point to lib-bin.js instead of tsdown's run.js |
| packages/cli/binding/src/cli.rs | Removed Rust code for generating temporary vite-lib.config.js files |
| packages/cli/package.json | Added cac dependency for CLI argument parsing |
| pnpm-workspace.yaml | Added cac to the catalog |
| pnpm-lock.yaml | Updated lockfile with cac dependency |
| packages/cli/snap-tests/command-lib/snap.txt | Updated test snapshots to reflect new CLI output without tsdown version/config messages |
| packages/cli/snap-tests/command-lib-monorepo/snap.txt | Updated test snapshots showing format change from cjs to mjs |
| packages/cli/snap-tests/command-helper/snap.txt | Updated help output snapshots for the new CLI interface |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
27bc06c to
7a5dbf8
Compare
|
cursor review |
7a5dbf8 to
71104a0
Compare
71104a0 to
6a9597b
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6a9597b to
6a4e3b6
Compare
6a4e3b6 to
6fe7515
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
packages/cli/src/resolve-lib.ts:23
- The documentation comment still refers to "Tsdown binary path" and "resolves the Tsdown binary path using Node.js module resolution" and "executes Tsdown for running lib", but the implementation has changed to use a custom
lib-bin.jsfile instead of Tsdown's binary. The comments should be updated to accurately reflect that this now resolves the custom lib command implementation rather than directly pointing to Tsdown.
* Tsdown tool resolver for the vite-plus CLI.
*
* This module exports a function that resolves the Tsdown binary path
* using Node.js module resolution. The resolved path is passed back
* to the Rust core, which then executes Tsdown for running lib.
*
* Used for: `vite-plus lib` command
*/
import { join } from 'node:path';
import { DEFAULT_ENVS } from './utils.js';
/**
* Resolves the Tsdown binary path and environment variables.
*
* @returns Promise containing:
* - binPath: Absolute path to the Tsdown CLI entry point
* - envs: Environment variables to set when executing Tsdown
*
* Tsdown is a tool that provides a library for building JavaScript/TypeScript libraries.
*/
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

TL;DR
Replaced the Rust-based Vite lib config generation with a Node.js implementation using the
cacCLI library.What changed?
lib-bin.tsfile that implements the lib command functionality in Node.jsresolve-lib.tsto point to the new Node.js implementationcacas a dependency for command-line argument parsingcacusageHow to test?
vite libcommand with various optionsWhy make this change?
This change simplifies the architecture by moving the lib command implementation from Rust to Node.js. Using
cacfor command-line parsing provides better flexibility and maintainability for the CLI interface. The Node.js implementation can directly interact with the tsdown API without needing to generate intermediate configuration files.Note
Moves
vite libto a Node-based implementation and removes the interim Vite config generation.src/lib-bin.tsusingcacto implementvite lib, resolvingvite.config.ts, forwarding flags, and callingbuildfrom@voidzero-dev/vite-plus-core/libwrite_vite_lib_configpath; simplifiescli.rsto calllibwithout generatingvite-lib.config.jsresolve-lib.tsto run bundledlib-bin.jsinstead of tsdown’srun.jsvite lib; example outputs now showindex.mjscacto workspace and lockfileWritten by Cursor Bugbot for commit 7a5dbf8. This will update automatically on new commits. Configure here.