feat: expose package manager detection and download APIs#308
Merged
Conversation
Member
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f9b8d8e to
fead428
Compare
2e9276a to
06cf754
Compare
e9e6dac to
57029f1
Compare
21916a3 to
1db7b58
Compare
57029f1 to
ebce813
Compare
ebce813 to
8bf1272
Compare
1db7b58 to
f3cb301
Compare
8bf1272 to
d1a3ebb
Compare
c315cb6 to
f409ec7
Compare
d1a3ebb to
8a3eb33
Compare
f409ec7 to
dbd0974
Compare
b34995d to
74cd86e
Compare
af40762 to
bc1410d
Compare
5859dd3 to
b0f8412
Compare
bc1410d to
d258eb1
Compare
a41588e to
d5a6269
Compare
59f106d to
4fd6e56
Compare
d5a6269 to
37853c1
Compare
37853c1 to
e94dab5
Compare
4fd6e56 to
bb0f097
Compare
e94dab5 to
1dfda67
Compare
branchseer
approved these changes
Nov 21, 2025
1dfda67 to
810a8d5
Compare
Member
Author
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR exposes package manager detection and download functionality through the CLI binding API, enabling external tools to leverage Vite's package manager capabilities without reimplementing the logic.
Key Changes:
- Added
detectWorkspaceanddownloadPackageManagerfunctions to the public API - Refactored
download_package_managerin the Rust crate to return package metadata (install_dir, package_name, version) - Created comprehensive test suites with fixtures for pnpm and npm monorepos
Reviewed Changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cli/binding/src/package_manager.rs | New module implementing the NAPI bindings for workspace detection and package manager download |
| packages/cli/binding/src/lib.rs | Exports the new public functions |
| packages/cli/binding/index.js | Exports the new functions to JavaScript |
| packages/cli/binding/index.d.ts | TypeScript type definitions for the new API |
| crates/vite_install/src/package_manager.rs | Refactored download_package_manager to return tuple with metadata and made functions public |
| crates/vite_install/src/lib.rs | Exports newly public functions |
| packages/cli/binding/tests/detect-workspace.spec.ts | Test suite for workspace detection |
| packages/cli/binding/tests/download-package-manager.spec.ts | Test suite for package manager download |
| packages/cli/binding/tests/fixtures/* | Test fixtures for pnpm-monorepo, npm-monorepo, and npm-project |
| packages/cli/binding/Cargo.toml | Added vite_workspace dependency |
| Cargo.lock | Updated with new dependency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
fengmk2
commented
Nov 21, 2025
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.

TL;DR
Expose package manager detection and download functionality through the CLI binding API.
What changed?
detectWorkspace: Detects the workspace root, package manager type, version, and whether it's a monorepodownloadPackageManager: Downloads a specified package manager versionvite_installto make it more modular and reusableHow to test?
Run the new tests:
Try using the new API in a project:
Why make this change?
This change enables external tools and plugins to leverage Vite's package manager detection and download capabilities. By exposing these functions through the CLI binding API, other tools can reliably determine the project structure and ensure the correct package manager is available without reimplementing this logic.