Repository navigation
refactor(env): select the project Node.js version in one place - #3498
Merged
Merged
Conversation
Contributor
CLI artifact sizes (
|
| Artifact | Format | Base | PR | Change |
|---|---|---|---|---|
packages/cli/dist |
Directory total | 2.38 MiB | 2.38 MiB | 0 B (0.00%) |
packages/core/dist |
Directory total | 4.11 MiB | 4.11 MiB | 0 B (0.00%) |
| Combined package dist | Directory total | 6.49 MiB | 6.49 MiB | 0 B (0.00%) |
vp (Linux x64) |
Binary | 8.51 MiB | 8.50 MiB | -8.00 KiB (-0.09%) |
vp (Linux x64) |
gzip -9 | 3.89 MiB | 3.89 MiB | -88 B (-0.00%) |
| NAPI (Linux x64) | Binary | 37.22 MiB | 37.22 MiB | 0 B (0.00%) |
| NAPI (Linux x64) | gzip -9 | 14.86 MiB | 14.86 MiB | 0 B (0.00%) |
vp (macOS ARM64) |
Binary | 5.57 MiB | 5.57 MiB | -16 B (-0.00%) |
vp (macOS ARM64) |
gzip -9 | 3.32 MiB | 3.32 MiB | -419 B (-0.01%) |
| NAPI (macOS ARM64) | Binary | 43.77 MiB | 43.77 MiB | 0 B (0.00%) |
| NAPI (macOS ARM64) | gzip -9 | 19.01 MiB | 19.01 MiB | 0 B (0.00%) |
vp (Windows x64) |
Binary | 6.59 MiB | 6.59 MiB | -1.50 KiB (-0.02%) |
vp (Windows x64) |
gzip -9 | 3.01 MiB | 3.01 MiB | -244 B (-0.01%) |
| NAPI (Windows x64) | Binary | 33.18 MiB | 33.18 MiB | 0 B (0.00%) |
| NAPI (Windows x64) | gzip -9 | 13.60 MiB | 13.60 MiB | +3 B (+0.00%) |
| Trampoline (Windows x64) | Binary | 13.50 KiB | 13.50 KiB | 0 B (0.00%) |
| Trampoline (Windows x64) | gzip -9 | 7.09 KiB | 7.09 KiB | 0 B (0.00%) |
| Installer (Windows x64) | Binary | 4.69 MiB | 4.69 MiB | 0 B (0.00%) |
| Installer (Windows x64) | gzip -9 | 2.25 MiB | 2.25 MiB | +37 B (+0.00%) |
fengmk2
force-pushed
the
refactor/select-project-node-version
branch
from
November 20, 2026 14:41
38f2cf7 to
e9a4edc
Compare
fengmk2
force-pushed
the
refactor/select-project-node-version
branch
from
November 20, 2026 15:29
ba1e380 to
dc0474f
Compare
fengmk2
marked this pull request as ready for review
November 20, 2026 15:29
cpojer
approved these changes
Nov 20, 2026
fengmk2
force-pushed
the
refactor/select-project-node-version
branch
from
November 20, 2026 16:14
dc0474f to
d9ee33f
Compare
download_runtime_for_project and the global CLI's resolve_project_version_source each had their own fallback chain over the lower-priority sources. Both now call select_project_node_version in vp_js_runtime, which validates the first source, falls back within the same directory, and returns the lower-priority constraints for the compatibility check. - The walk returns the package.json it already parsed, so the fallback reads it again only beside a .node-version. - A source that the walk already validated is not validated again, so an invalid engines.node or .nvmrc warns once in vp commands. - vp env current and the shims now also warn about an invalid engines.node below a valid .node-version or devEngines.runtime, as vp commands already did. - The fallback helpers and validated_version are now private. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vp env which now uses the shared selection, so it reports the invalid engines.node constraint below devEngines.runtime, as vp exec already did. The snapshot is the runner's recorded output from CI (Linux and macOS recorded the same text). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- select_project_node_version validates the devEngines.runtime entry with one call in both roles, so validated_version, dev_engines_runtime_fallback, dev_engines_runtime_constraint, and the separate warning helper are gone. - It takes VersionResolution apart by value, so the shim fast path no longer copies the source and project paths. - The walk no longer returns a manifest for .nvmrc, which nothing read. - check_version_compatibility takes the selection. Its source guards could no longer be false. - resolve_project_version_source returns ProjectNodeVersion, so the ProjectVersionSource copy and its String source are gone. VersionSource::as_str replaces the String allocations for comparisons and warning labels. - Unused vp_js_runtime exports are dropped, and the stale js_executor.rs comments are fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fengmk2
force-pushed
the
refactor/select-project-node-version
branch
from
November 21, 2026 03:18
d9ee33f to
39eaceb
Compare
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.
Stacked on #3489.
Before this PR, Node.js version selection had two fallback chains that had to agree:
vp_js_runtime::download_runtime_for_project, which runs beforevpcommandsresolve_project_version_sourceinvp_global_cli, whichvp env current,vp env which,vp env use, and the shims useensure_project_runtimecalls both for the same project. During review, #3489 had to fix two drifts between them: a wrong fallback directory and a missing warning. Both paths now callselect_project_node_versioninvp_js_runtime. It walks up to the first source, validates it, falls back within the same directory, and returns the lower-priority constraints for the compatibility check.Behavior changes:
vp env current,vp env which,vp env use, or a shim cache miss, with a valid.node-versionordevEngines.runtimeand an invalidengines.nodewarning: invalid version '…' in engines.node, ignoring, asvpcommands already printvpcommands with an invalidengines.nodeabove a valid.nvmrcOther changes:
package.jsonit already parsed. The fallback readspackage.jsonagain only beside a.node-version, andvpcommands no longer read an ancestor manifest a second time.select_project_node_versionvalidates adevEngines.runtimeentry with one call, both when the entry selects the version and when it is only a constraint. The separate fallback, constraint, andvalidated_versionhelpers are gone.resolve_project_version_sourcereturnsProjectNodeVersiondirectly, so the global CLI'sProjectVersionSourcecopy is gone.VersionSource::as_strreplaces theStringallocations in the shim cache check.is_valid_version,normalize_version, andread_package_jsonare no longer exported fromvp_js_runtime, because no other crate uses them.🤖 Generated with Claude Code