fix(cli): apply supported NODE_OPTIONS before command-line arguments - #73
Merged
Merged
Conversation
Ports oven-sh#40328 by @robobun. Keep the init regression hermetic with declared dependencies and a local registry.
steipete
force-pushed
the
claude/w67-node-options-preloads
branch
from
October 2, 2026 07:40
5ff3580 to
05b75d4
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.
Bun ignored
NODE_OPTIONS, so a child launched with an environment--requirepreload ran without its startup hook even though the equivalent command-line preload worked. This breaks process-manager fixtures and real tools that propagate startup configuration through the environment.Ports the open upstream oven-sh/bun#40328, with credit to @robobun. Parse Node's quoting and escaping rules, apply the Node flags Bun implements before ordinary command-line arguments, and keep injected tokens out of
process.execArgv. Update raw-argv consumers so environment options cannot shift subcommand arguments or compiled-app passthrough. The init regression uses declared dependencies and a local registry to remain hermetic.This is the upstream port's documented partial support: unsupported Node flags remain ignored, disallowed flags warn and are ignored, and
node_without_node_optionsstays true. Supported preload behavior follows Node 24, including environment-before-argv ordering and require-before-import ordering.The standalone Node 24.21.0 oracle verifies a quoted preload path, mixed environment/CLI preloads, and unmodified execArgv; unpatched Bun fails it. The AWS Linux release build passes 273 tests across the new environment suite, BUN_OPTIONS, preload, and process suites (5 skips, 3 existing todo, zero failures; 2.02 seconds). The identical quoted-path/order/execArgv oracle now matches Node 24. All 12 Rust targets pass, and the scoped P2 branch review is clean. Exact-head Linux/macOS CI gates landing.