Skip to content

Conversation

joyeecheung
Copy link
Member

@joyeecheung joyeecheung commented Aug 20, 2025

This implements the execArgvExtension configuration field for SEA, which takes one of three string values to specify whether and how execution arguments can be extended for the SEA at run time:

  • "none": No extension is allowed. Only the arguments specified in execArgv will be used, and the NODE_OPTIONS environment variable will be ignored.
  • "env": (Default) The NODE_OPTIONS environment variable can extend the execution arguments. This is the default behavior to maintain backward compatibility.
  • "cli": The executable can be launched with --node-options="--flag1 --flag2", and those flags will be parsed as execution arguments for Node.js instead of being passed to the user script. This allows using arguments that are not supported by the NODE_OPTIONS environment variable.

Refs: #51688
Fixes: #55573
Fixes: nodejs/single-executable#100

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/single-executable
  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. single-executable Issues and PRs related to single-executable applications labels Aug 20, 2025
@joyeecheung joyeecheung force-pushed the sea-exec-argv-extension branch from 6c83973 to a84a237 Compare August 20, 2025 16:22
This implements the execArgvExtension configuration field for SEA,
which takes one of three string values to specify whether and how
execution arguments can be extended for the SEA at run time:

* `"none"`: No extension is allowed. Only the arguments specified
  in `execArgv` will be used,
  and the `NODE_OPTIONS` environment variable will be ignored.
* `"env"`: _(Default)_ The `NODE_OPTIONS` environment variable can
  extend the execution arguments.
  This is the default behavior to maintain backward compatibility.
* `"cli"`: The executable can be launched with
  `--node-options="--flag1 --flag2"`, and those flags
  will be parsed as execution arguments for Node.js instead of being
  passed to the user script. This allows using arguments that are
  not supported by the `NODE_OPTIONS` environment variable.
@joyeecheung joyeecheung force-pushed the sea-exec-argv-extension branch from a84a237 to 541dc75 Compare August 20, 2025 17:14
@nodejs-github-bot
Copy link
Collaborator

Copy link

codecov bot commented Aug 20, 2025

Codecov Report

❌ Patch coverage is 84.61538% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.88%. Comparing base (6c215fb) to head (541dc75).
⚠️ Report is 45 commits behind head on main.

Files with missing lines Patch % Lines
src/node_sea.cc 82.14% 6 Missing and 4 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #59560    +/-   ##
========================================
  Coverage   89.87%   89.88%            
========================================
  Files         664      667     +3     
  Lines      194946   195278   +332     
  Branches    38292    38340    +48     
========================================
+ Hits       175202   175519   +317     
- Misses      12193    12212    +19     
+ Partials     7551     7547     -4     
Files with missing lines Coverage Δ
src/node.cc 75.37% <100.00%> (+0.26%) ⬆️
src/node_sea.cc 86.50% <82.14%> (-0.18%) ⬇️

... and 33 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nodejs-github-bot
Copy link
Collaborator

This is the default behavior to maintain backward compatibility.
* `"cli"`: The executable can be launched with `--node-options="--flag1 --flag2"`, and those flags
will be parsed as execution arguments for Node.js instead of being passed to the user script.
This allows using arguments that are not supported by the `NODE_OPTIONS` environment variable.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: it might be good to define "cli" in here very briefly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Did you mean defining the word "cli" as "command line interface"? I feel that for the target audience of this part of the documentation, that would be a bit superfluous - it seems unlikely that someone who is packaging an an application as a CLI SEA does not know what "cli" means.

@joyeecheung joyeecheung added commit-queue Add this label to land a pull request using GitHub Actions. and removed review wanted PRs that need reviews. labels Aug 25, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 25, 2025
@nodejs-github-bot nodejs-github-bot merged commit 6722642 into nodejs:main Aug 25, 2025
60 of 62 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 6722642

targos pushed a commit that referenced this pull request Aug 26, 2025
This implements the execArgvExtension configuration field for SEA,
which takes one of three string values to specify whether and how
execution arguments can be extended for the SEA at run time:

* `"none"`: No extension is allowed. Only the arguments specified
  in `execArgv` will be used,
  and the `NODE_OPTIONS` environment variable will be ignored.
* `"env"`: _(Default)_ The `NODE_OPTIONS` environment variable can
  extend the execution arguments.
  This is the default behavior to maintain backward compatibility.
* `"cli"`: The executable can be launched with
  `--node-options="--flag1 --flag2"`, and those flags
  will be parsed as execution arguments for Node.js instead of being
  passed to the user script. This allows using arguments that are
  not supported by the `NODE_OPTIONS` environment variable.

PR-URL: #59560
Fixes: #55573
Fixes: nodejs/single-executable#100
Refs: #51688
Reviewed-By: Xuguang Mei <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
@joyeecheung joyeecheung added the semver-minor PRs that contain new features and should be released in the next minor version. label Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version. single-executable Issues and PRs related to single-executable applications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Freeze NODE_OPTIONS for SingeExecutableApplications Add ability to pass flags to Node instance
5 participants