Uh oh!
There was an error while loading. Please reload this page.
feat: expose package manager detection and download APIs - #308
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f9b8d8e to
fead428Compare2e9276a to
06cf754Comparee9e6dac to
57029f1Compare21916a3 to
1db7b58Compare57029f1 to
ebce813Compareebce813 to
8bf1272Compare1db7b58 to
f3cb301Compare8bf1272 to
d1a3ebbComparec315cb6 to
f409ec7Compared1a3ebb to
8a3eb33Comparef409ec7 to
dbd0974Compareb34995d to
74cd86eCompareaf40762 to
bc1410dCompare5859dd3 to
b0f8412Comparebc1410d to
d258eb1Comparea41588e to
d5a6269Compare59f106d to
4fd6e56Compared5a6269 to
37853c1Compare37853c1 to
e94dab5Compare4fd6e56 to
bb0f097Comparee94dab5 to
1dfda67Compare1dfda67 to
810a8d5CompareThere 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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.

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.