Skip to content

feat: passthrough fallback for vpr/vp i on low Node (#1909 #1916)#1921

Open
l246804 wants to merge 1 commit into
voidzero-dev:mainfrom
l246804:feat/low-node-passthrough
Open

feat: passthrough fallback for vpr/vp i on low Node (#1909 #1916)#1921
l246804 wants to merge 1 commit into
voidzero-dev:mainfrom
l246804:feat/low-node-passthrough

Conversation

@l246804

@l246804 l246804 commented Jun 23, 2026

Copy link
Copy Markdown

Summary

Closes #1909 (low-Node passthrough). Refs #1916.

Changes

Crate Change
vite_shared Add MIN_SUPPORTED_NODE = "20.19.0" constant + is_node_below_min() helper
vite_install Add PackageManagerBuilder::detect_only() — builds PM without writing devEngines
vite_pm_cli Extract dispatch_with_pm() + 12 *_with_pm handler variants for external PM injection
vite_global_cli Add passthrough module (is_eligible, should_passthrough, execute) + precheck in run_command_with_options

How it works

  1. In 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.
  2. If yes: print a one-line notice, resolve the PM via detect_only (no devEngines pin), and dispatch via dispatch_with_pm (PM commands) or run_command (Run commands).
  3. If no: original path unchanged.

Test plan

  • cargo test -p vite_shared --lib → 92 passed
  • cargo test -p vite_install --lib → 552 passed
  • cargo test -p vite_pm_cli --lib → 12 passed
  • cargo test -p vite_global_cli --bin vp passthrough → 6 passed
  • cargo clippy on all 4 crates → clean
  • Manual: .node-version=14.15.0 + vpr/vp i passthrough, no devEngines written
  • pnpm bootstrap-cli && pnpm test && git status (requires cmake)

@netlify

netlify Bot commented Jun 23, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 3a95df9
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a3ba8b1eb32f000084ebb2b

@liangmiQwQ liangmiQwQ self-requested a review June 23, 2026 13:46

@liangmiQwQ liangmiQwQ left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread crates/vite_global_cli/src/commands/passthrough.rs Outdated
@liangmiQwQ

Copy link
Copy Markdown
Collaborator

I tested locally, and I found it only works for vp run command but not for vpr command. We'd better handle passthrough fallback for shims as well.

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create an environment for this repo.

@liangmiQwQ

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/vite_install/src/package_manager.rs Outdated
Comment thread crates/vite_global_cli/src/commands/passthrough.rs Outdated
Comment thread crates/vite_global_cli/src/commands/passthrough.rs Outdated
Comment thread crates/vite_global_cli/src/cli.rs Outdated
l246804 pushed a commit to l246804/vite-plus that referenced this pull request Jun 24, 2026
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
@l246804 l246804 force-pushed the feat/low-node-passthrough branch from 5cfcafa to 3a95df9 Compare June 24, 2026 09:51
@l246804 l246804 requested a review from liangmiQwQ June 24, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: vite-plus@0.2.1 crashes on Node < 20.12 with "node:util has no export named styleText" before engine check

2 participants