Conversation
How to use the Graphite Merge QueueAdd the label auto-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
45e4691 to
bc38b7a
Compare
810d51c to
efc5c42
Compare
efc5c42 to
d143fc6
Compare
d143fc6 to
9db93c2
Compare
183be48 to
f551a2a
Compare
9db93c2 to
cc73dcc
Compare
000f043 to
00ae674
Compare
a38d005 to
c16f4d5
Compare
00ae674 to
5fb8073
Compare
ffb13dd to
3659cb9
Compare
cfccc29 to
d64cba8
Compare
f5c94ee to
2430298
Compare
df57cf4 to
5534094
Compare
The bun platform package (`@oven/bun-{os}-{arch}`) places the native
binary at `package/bin/bun`, not `package/bun`. Fixed the path in
`download_bun_package_manager` to look in the correct location.
Updated all 10 bun snap test outputs with working bun command results.
Bun outputs "Resolving dependencies" and "Resolved, downloaded and extracted [N]" intermittently depending on cache state. Filter these lines in the snap test output sanitizer for stable snapshots.
Fix 7 defects in bun package manager support:
P1 - Windows shims: use bun.native.exe on Windows instead of bun.native
P1 - Hash validation: skip hash check for platform-specific package
(hash from packageManager field belongs to main bun package)
P1 - Audit command: use `bun audit` with `--audit-level` instead of
`bun pm audit` with `--level`
P1 - Install flags: forward --ignore-scripts and --omit optional to bun
instead of warning them away
P2 - Update flags: forward --production, --omit optional, --no-save,
and --recursive to bun update
P2 - Pack flags: map --out to bun's --filename, forward --gzip-level
P3 - Why flags: forward --depth to bun why
Update corresponding RFC documents to reflect correct bun mappings.
Add 18 new unit tests covering all fixes.
- Remove unused `expected_hash` parameter from `download_bun_package_manager` (hash belongs to main bun package, not platform binary; documented at call site) - Remove misleading shamefully-hoist comment in install.rs - Filter additional unstable bun output: "Resolving..." prefix and "(vX.Y.Z available)" hints that appear intermittently
On musl Linux (Alpine), the glibc bun binary from `@oven/bun-linux-x64` cannot execute. Use `@oven/bun-linux-x64-musl` and `@oven/bun-linux-aarch64-musl` on musl targets via `cfg(target_env)`, matching the pattern used by the Node.js provider. This fixes bun snap test failures on Linux x64 musl CI.
Bun intermittently prints "Saved lockfile" depending on cache state. Filter this line in the snap test output sanitizer for stable snapshots.
- view.rs: use native `bun info` instead of npm fallback - dlx.rs: forward `--package` flag to `bun x` (before package spec) - install.rs: forward `--lockfile-only` to bun - outdated.rs: forward `--production` and `--omit optional` to bun - login/logout/owner/ping/search/token: remove unnecessary warning logs when falling back to npm (the fallback itself is correct)
There was a problem hiding this comment.
Pull request overview
Adds Bun as a 4th supported package manager across Vite+ (Rust core, NAPI/binding, TypeScript CLI), updating command mappings/RFCs and adding snapshot coverage to validate behavior.
Changes:
- Introduces
PackageManagerType::Bunwith detection (packageManager field + bun lock/config files) and Bun binary download/shim support. - Adds Bun support across CLI commands (install/add/remove/update/outdated/pm subcommands/etc.) plus TypeScript prompts/migration/template handling.
- Updates RFC documentation and adds global snap-tests for Bun flows.
Reviewed changes
Copilot reviewed 82 out of 82 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| rfcs/why-package-command.md | Documents vp why mappings and Bun behavior/limitations. |
| rfcs/update-package-command.md | Documents vp update mappings including Bun flags. |
| rfcs/pm-command-group.md | Documents vp pm subcommands and Bun delegation rules. |
| rfcs/pack-command.md | Clarifies vp pm pack behavior for Bun (bun pm pack). |
| rfcs/outdated-package-command.md | Documents vp outdated mappings including Bun support/limits. |
| rfcs/link-unlink-package-commands.md | Documents vp link/unlink mappings including Bun. |
| rfcs/install-command.md | Documents vp install mappings including Bun flags. |
| rfcs/exec-command.md | Updates vp exec RFC to reference Bun equivalences. |
| rfcs/dlx-command.md | Updates vp dlx RFC to include Bun (bun x) mapping. |
| rfcs/dedupe-package-command.md | Notes Bun lacks dedupe; documents fallback expectations. |
| rfcs/add-remove-package-commands.md | Documents add/remove mappings including Bun and limitations. |
| packages/tools/src/utils.ts | Stabilizes bun CLI output in snapshot normalization. |
| packages/cli/src/utils/prompts.ts | Adds Bun to interactive package manager selection. |
| packages/cli/src/types/package.ts | Extends PackageManager type with bun. |
| packages/cli/src/migration/migrator.ts | Treats Bun like npm for overrides; excludes Bun from catalog usage. |
| packages/cli/src/migration/bin.ts | Forces reinstall with --force for npm and bun. |
| packages/cli/src/create/templates/monorepo.ts | Treats Bun like npm workspace layout (workspaces field). |
| packages/cli/src/create/command.ts | Uses bun x as runner; fixes npx -- passthrough condition. |
| packages/cli/snap-tests-global/command-why-bun/steps.json | Adds Bun snap-test steps for vp why. |
| packages/cli/snap-tests-global/command-why-bun/snap.txt | Expected output snapshot for Bun vp why. |
| packages/cli/snap-tests-global/command-why-bun/package.json | Bun-based fixture project for vp why. |
| packages/cli/snap-tests-global/command-view-bun/steps.json | Adds Bun snap-test steps for vp pm view. |
| packages/cli/snap-tests-global/command-view-bun/snap.txt | Expected output snapshot for Bun vp pm view. |
| packages/cli/snap-tests-global/command-view-bun/package.json | Bun-based fixture project for vp pm view. |
| packages/cli/snap-tests-global/command-update-bun/steps.json | Adds Bun snap-test steps for vp update. |
| packages/cli/snap-tests-global/command-update-bun/snap.txt | Expected output snapshot for Bun vp update. |
| packages/cli/snap-tests-global/command-update-bun/package.json | Bun-based fixture project for vp update. |
| packages/cli/snap-tests-global/command-remove-bun/steps.json | Adds Bun snap-test steps for vp remove. |
| packages/cli/snap-tests-global/command-remove-bun/snap.txt | Expected output snapshot for Bun vp remove. |
| packages/cli/snap-tests-global/command-remove-bun/package.json | Bun-based fixture project for vp remove. |
| packages/cli/snap-tests-global/command-publish-bun/steps.json | Adds Bun snap-test steps for vp pm publish. |
| packages/cli/snap-tests-global/command-publish-bun/snap.txt | Expected output snapshot for Bun vp pm publish. |
| packages/cli/snap-tests-global/command-publish-bun/package.json | Bun-based fixture project for vp pm publish. |
| packages/cli/snap-tests-global/command-outdated-bun/steps.json | Adds Bun snap-test steps for vp outdated. |
| packages/cli/snap-tests-global/command-outdated-bun/snap.txt | Expected output snapshot for Bun vp outdated. |
| packages/cli/snap-tests-global/command-outdated-bun/package.json | Bun-based fixture project for vp outdated. |
| packages/cli/snap-tests-global/command-list-bun/steps.json | Adds Bun snap-test steps for vp pm list. |
| packages/cli/snap-tests-global/command-list-bun/snap.txt | Expected output snapshot for Bun vp pm list. |
| packages/cli/snap-tests-global/command-list-bun/package.json | Bun-based fixture project for vp pm list. |
| packages/cli/snap-tests-global/command-dlx-bun/steps.json | Adds Bun snap-test steps for vp dlx. |
| packages/cli/snap-tests-global/command-dlx-bun/snap.txt | Expected output snapshot for Bun vp dlx. |
| packages/cli/snap-tests-global/command-dlx-bun/package.json | Bun-based fixture project for vp dlx. |
| packages/cli/snap-tests-global/command-cache-bun/steps.json | Adds Bun snap-test steps for vp pm cache. |
| packages/cli/snap-tests-global/command-cache-bun/snap.txt | Expected output snapshot for Bun vp pm cache. |
| packages/cli/snap-tests-global/command-cache-bun/package.json | Bun-based fixture project for vp pm cache. |
| packages/cli/snap-tests-global/command-add-bun/steps.json | Adds Bun snap-test steps for vp add. |
| packages/cli/snap-tests-global/command-add-bun/snap.txt | Expected output snapshot for Bun vp add. |
| packages/cli/snap-tests-global/command-add-bun/package.json | Bun-based fixture project for vp add. |
| packages/cli/binding/src/package_manager.rs | Maps "bun" to PackageManagerType::Bun in NAPI binding. |
| crates/vite_install/src/shim.rs | Adds native binary shim generation for bun (and similar). |
| crates/vite_install/src/package_manager.rs | Adds Bun detection, platform package selection, and bun binary download flow. |
| crates/vite_install/src/commands/why.rs | Adds Bun why resolution with supported/unsupported flags behavior. |
| crates/vite_install/src/commands/whoami.rs | Adds Bun whoami mapping (bun pm whoami). |
| crates/vite_install/src/commands/view.rs | Uses bun info when PM is Bun; otherwise npm view. |
| crates/vite_install/src/commands/update.rs | Adds Bun update argument mapping. |
| crates/vite_install/src/commands/unlink.rs | Adds Bun unlink mapping with recursive warning. |
| crates/vite_install/src/commands/token.rs | Documents Bun fallback behavior (comment). |
| crates/vite_install/src/commands/search.rs | Documents Bun fallback behavior (comment). |
| crates/vite_install/src/commands/run.rs | Allows run to use bun binary for Bun PM. |
| crates/vite_install/src/commands/remove.rs | Adds Bun remove mapping and unsupported flag warnings. |
| crates/vite_install/src/commands/rebuild.rs | Disables rebuild for Bun with warning. |
| crates/vite_install/src/commands/publish.rs | Adds Bun publish mapping + unsupported flag warnings. |
| crates/vite_install/src/commands/prune.rs | Disables prune for Bun with warning. |
| crates/vite_install/src/commands/ping.rs | Documents Bun fallback behavior (comment). |
| crates/vite_install/src/commands/pack.rs | Adds Bun pack mapping to bun pm pack with option translations. |
| crates/vite_install/src/commands/owner.rs | Documents Bun fallback behavior (comment). |
| crates/vite_install/src/commands/outdated.rs | Adds Bun outdated mapping + unsupported option warnings. |
| crates/vite_install/src/commands/logout.rs | Uses npm logout when PM is Bun. |
| crates/vite_install/src/commands/login.rs | Uses npm login when PM is Bun. |
| crates/vite_install/src/commands/list.rs | Adds Bun list mapping to bun pm ls with warnings for unsupported flags. |
| crates/vite_install/src/commands/link.rs | Adds Bun link mapping (bun link). |
| crates/vite_install/src/commands/install.rs | Adds Bun install argument mapping + standardizes warnings via output::warn. |
| crates/vite_install/src/commands/fund.rs | Warns and falls back to npm fund for Bun. |
| crates/vite_install/src/commands/dlx.rs | Adds Bun dlx runner (bun x). |
| crates/vite_install/src/commands/dist_tag.rs | Warns and falls back to npm dist-tag for Bun. |
| crates/vite_install/src/commands/deprecate.rs | Warns and falls back to npm deprecate for Bun. |
| crates/vite_install/src/commands/dedupe.rs | Warns and falls back to bun install for Bun dedupe. |
| crates/vite_install/src/commands/config.rs | Warns and falls back to npm config for Bun. |
| crates/vite_install/src/commands/cache.rs | Adds Bun cache mapping via bun pm cache / rm. |
| crates/vite_install/src/commands/audit.rs | Adds Bun audit mapping + behavior for unsupported flags. |
| crates/vite_install/src/commands/add.rs | Adds Bun add mapping + unsupported flag warnings. |
| crates/vite_global_cli/src/shim/dispatch.rs | Includes bun in package-manager tool list for project-context resolution. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let to_bin = to_bin.as_ref(); | ||
| let relative_path = diff_paths(source_file, to_bin.parent().unwrap()).unwrap(); | ||
| let relative_file = relative_path.to_str().unwrap(); |
There was a problem hiding this comment.
write_native_shims uses multiple unwrap() calls (to_bin.parent(), diff_paths(...), to_str()). These can panic on edge cases (e.g., to_bin without parent, paths on different volumes, non-UTF8 paths) and would crash the install/shim flow. Please convert these to fallible handling and return a vite_error::Error with context instead of panicking.
| // Download the platform-specific package directly | ||
| let platform_tgz_url = get_npm_package_tgz_url(platform_package_name, version); | ||
| let target_dir_tmp = tempfile::tempdir_in(parent_dir)?.path().to_path_buf(); | ||
|
|
There was a problem hiding this comment.
tempfile::tempdir_in(parent_dir)?.path().to_path_buf() drops the TempDir immediately, so you lose RAII cleanup on early returns/errors and the “robust temporary directory creation” guarantee in the comment. Consider keeping the TempDir handle alive for the whole download/extract/rename flow (or using into_path() and explicitly cleaning up on failure).
- dlx: bun supports --package flag (before package spec) - install: bun supports --lockfile-only - outdated: bun supports --production and --omit optional - pm-command-group: view uses native `bun info` instead of npm fallback
Add `--package-manager` option to `vp create` for specifying the package manager without interactive prompts. Priority: workspace detection > CLI flag > interactive prompt/default. Fix bun catalog support in monorepo migration: - Enable `catalog:` protocol for bun (was incorrectly excluded) - Add `rewriteBunCatalog()` to write catalog entries to root package.json (bun stores catalogs in package.json, not pnpm-workspace.yaml) - Bun overrides use raw versions (catalog: not supported in overrides) Add `new-vite-monorepo-bun` snap test verifying: - Root package.json has catalog, workspaces, and overrides fields - Sub-packages use `catalog:` references for dependencies - No pnpm-workspace.yaml or .yarnrc.yml files created
Bun's overrides field supports catalog: references. Use them instead of raw version strings so all version management is centralized in the catalog definition.
Add bun-based React + Mantine project (why-reproductions-are-required/ bun-vite-template) to ecosystem-ci to verify bun package manager support works end-to-end with `vp migrate` and `vp run build`.
Add `@` prefix to the execution line in `native_cmd_shim` to prevent cmd.exe from echoing the full command path before running it. Without this, bun commands on Windows print the raw shim path in output.

Summary
Add bun as the 4th supported package manager alongside pnpm, npm, and yarn. Bun is added only as a package manager and runtime support is not planned.
Closes #557
Changes
Rust Core
Bunvariant toPackageManagerTypeenumpackageManagerfield,bun.lock,bun.lockb,bunfig.toml@oven/bun-{os}-{arch}npm packages (including musl variants)PackageManagerType::Bunarms to all 30 command files with correct flag mappingsCommand Mappings
bun installwith--frozen-lockfile,--production,--ignore-scripts,--lockfile-only,--omit optional,--filterbun addwith--dev,--peer,--optional,--exact,--globalbun remove,bun update(with--latest,--interactive,--recursive,--production)bun outdated(with--filter,--recursive,--production,--omit optional)bun why(with--depth),bun x(with--package),bun audit(with--audit-level)bun pm pack(with--filename,--gzip-level),bun pm ls,bun pm cache,bun pm whoamibun infofor package view,bun publishfor publishingGlobal CLI & NAPI
"bun"toPACKAGE_MANAGER_TOOLSin shim dispatch"bun" => PackageManagerType::Bunin NAPI bindingTypeScript
buntoPackageManagertype and selection prompt--package-managerflag tovp createfor easier testingpackage.jsonworkspaces, not pnpm-workspace.yaml)package.jsonwithcatalog:references in both dependencies and overridesoverrideswithcatalog:references (not raw versions)bun xinstead ofbunxfor DLX commands (better cross-platform compatibility)Snap Tests & Output Sanitizer
new-vite-monorepo-bun) verifying catalog supportResolving dependencies,Resolved, downloaded and extracted,Resolving...,Saved lockfile,(vX.Y.Z available)RFCs
Ecosystem CI
bun-vite-template(React + Mantine) test caseTest plan
cargo test -p vite_install— 455 tests pass (18 new bun tests)cargo test -p vite_global_cli— 311 tests passpnpm -F vite-plus snap-test-global bun— all 10 bun snap tests passpnpm -F vite-plus snap-test-global new-vite-monorepo-bun— catalog test passespnpm -F vite-plus snap-test-global new-vite-monorepo— existing pnpm test unaffectedbun-vite-template🤖 Generated with Claude Code