feat: passthrough fallback for vpr/vp i on low Node (#1909 #1916)#1921
feat: passthrough fallback for vpr/vp i on low Node (#1909 #1916)#1921l246804 wants to merge 1 commit into
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
There was a problem hiding this comment.
Thanks!
plans/2026-06-23-low-node-passthrough.md and specs/2026-06-23-low-node-passthrough-design.md seem left by mistake?
Could you please also clean up outdated comments and dead code like Wired in Task X?
|
I tested locally, and I found it only works for |
|
To use Codex here, create an environment for this repo. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5d290e8af8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The vpr shim goes through shim::dispatch → commands::vpr::execute_vpr → delegate::execute, which bypasses run_command_with_options where the passthrough precheck lives. This meant vpr on low-Node projects still crashed with the styleText ESM error. Add the same passthrough precheck logic to execute_vpr: resolve the project's Node version, check should_passthrough, and if eligible call passthrough::execute before delegating to the JS CLI. Fixes the issue reported in PR voidzero-dev#1921 review where vpr didn't work with passthrough. Verified: RUSTC_BOOTSTRAP=1 cargo test -p vite_global_cli --bin vp passthrough -> 6 passed.
Closes voidzero-dev#1909 Closes voidzero-dev#1916 When the project's resolved Node version is below the supported minimum (20.19.0), eligible commands (vp run/vpr + package-manager family) bypass the Vite+ JS CLI and run the project's package manager directly. - Add shared passthrough module (vite_shared) with version comparison - Add passthrough command routing (vite_global_cli) with PATH handling - Add dispatch_with_pm for externally-provided PackageManager - Add detect_only on PackageManagerBuilder (no devEngines pin) - Defer is_low_node check in vpx until actually needed - Use vite_shared path utilities for safe non-UTF-8 PATH handling
5cfcafa to
3a95df9
Compare
Summary
vpr/vp runand the package-manager family bypass the Vite+ JS CLI and run the project's own package manager directly.styleTextcrash on Node < 20.12 — never loads Vite+ JS) and the low-Node case of bug: vp i pins npm@11 into devEngines on low Node, breaking manual npm with "Cannot find module node:path" #1916 (no longer pins/downloads an incompatible npm, no longer writesdevEngines).devEngines"fail leaves side effects" general fix (deferred pin) is split into a follow-up PR.Closes #1909 (low-Node passthrough). Refs #1916.
Changes
vite_sharedMIN_SUPPORTED_NODE = "20.19.0"constant +is_node_below_min()helpervite_installPackageManagerBuilder::detect_only()— builds PM without writing devEnginesvite_pm_clidispatch_with_pm()+ 12*_with_pmhandler variants for external PM injectionvite_global_cliis_eligible,should_passthrough,execute) + precheck inrun_command_with_optionsHow it works
run_command_with_options, before the command match, check if the command is eligible (Run / PackageManager) and the project's resolved Node < 20.19.0.detect_only(no devEngines pin), and dispatch viadispatch_with_pm(PM commands) orrun_command(Run commands).Test plan
cargo test -p vite_shared --lib→ 92 passedcargo test -p vite_install --lib→ 552 passedcargo test -p vite_pm_cli --lib→ 12 passedcargo test -p vite_global_cli --bin vp passthrough→ 6 passedcargo clippyon all 4 crates → clean.node-version=14.15.0+vpr/vp ipassthrough, nodevEngineswrittenpnpm bootstrap-cli && pnpm test && git status(requires cmake)