cli: add --expose-gc flag available to NODE_OPTIONS

This commits allows users to send `--expose-gc` via `NODE_OPTIONS`
environment variable.

Using `node --expose-gc` is possible but via `NODE_OPTIONS` won't
work.

```sh
NODE_OPTIONS='--expose-gc' node
node: --expose-gc is not allowed in NODE_OPTIONS
```

Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/53078
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
Juan José authored and Michaël Zasso committed 2024-09-21 12:38:46 +02:00
1 parent 272484b8b2
commit 3f78d4eb28
3 files changed
+22

No files matched your search

+20
View File
@@ -687,6 +687,23 @@ Make built-in language features like `eval` and `new Function` that generate
code from strings throw an exception instead. This does not affect the Node.js
`node:vm` module.
### `--expose-gc`
<!-- YAML
added: REPLACEME
-->
> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to
> change upstream.
This flag will expose the gc extension from V8.
```js
if (globalThis.gc) {
globalThis.gc();
}
```
### `--dns-result-order=order`
<!-- YAML
@@ -2819,6 +2836,7 @@ V8 options that are allowed are:
* `--abort-on-uncaught-exception`
* `--disallow-code-generation-from-strings`
* `--enable-etw-stack-walking`
* `--expose-gc`
* `--huge-max-old-generation-size`
* `--interpreted-frames-native-stack`
* `--jitless`
@@ -3148,6 +3166,8 @@ documented here:
### `--enable-etw-stack-walking`
### `--expose-gc`
### `--harmony-shadow-realm`
### `--huge-max-old-generation-size`
+1
View File
@@ -506,6 +506,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
AddOption("--experimental-report", "", NoOp{}, kAllowedInEnvvar);
AddOption(
"--experimental-wasi-unstable-preview1", "", NoOp{}, kAllowedInEnvvar);
AddOption("--expose-gc", "expose gc extension", V8Option{}, kAllowedInEnvvar);
AddOption("--expose-internals", "", &EnvironmentOptions::expose_internals);
AddOption("--frozen-intrinsics",
"experimental frozen intrinsics support",
+1
View File
@@ -69,6 +69,7 @@ if (common.hasCrypto) {
// V8 options
expect('--abort_on-uncaught_exception', 'B\n');
expect('--disallow-code-generation-from-strings', 'B\n');
expect('--expose-gc', 'B\n');
expect('--huge-max-old-generation-size', 'B\n');
expect('--jitless', 'B\n');
expect('--max-old-space-size=0', 'B\n');