Skip to content

Commit e15c5da

Browse files
aduh95avivkeller
authored andcommittedJan 5, 2025
test: ensure cli.md is in alphabetical order
Co-authored-by: RedYetiDev <redyetidev@gmail.com> PR-URL: #56025 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent dd14b80 commit e15c5da

File tree

2 files changed

+144
-140
lines changed

2 files changed

+144
-140
lines changed
 

‎doc/api/cli.md

+129-140
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,18 @@ Affects the default output directory of:
549549
* [`--heap-prof-dir`][]
550550
* [`--redirect-warnings`][]
551551

552+
### `--disable-proto=mode`
553+
554+
<!-- YAML
555+
added:
556+
- v13.12.0
557+
- v12.17.0
558+
-->
559+
560+
Disable the `Object.prototype.__proto__` property. If `mode` is `delete`, the
561+
property is removed entirely. If `mode` is `throw`, accesses to the
562+
property throw an exception with the code `ERR_PROTO_ACCESS`.
563+
552564
### `--disable-warning=code-or-type`
553565

554566
> Stability: 1.1 - Active development
@@ -641,18 +653,6 @@ users can at least run WebAssembly (with less optimal performance)
641653
when the virtual memory address space available to their Node.js
642654
process is lower than what the V8 WebAssembly memory cage needs.
643655

644-
### `--disable-proto=mode`
645-
646-
<!-- YAML
647-
added:
648-
- v13.12.0
649-
- v12.17.0
650-
-->
651-
652-
Disable the `Object.prototype.__proto__` property. If `mode` is `delete`, the
653-
property is removed entirely. If `mode` is `throw`, accesses to the
654-
property throw an exception with the code `ERR_PROTO_ACCESS`.
655-
656656
### `--disallow-code-generation-from-strings`
657657

658658
<!-- YAML
@@ -663,23 +663,6 @@ Make built-in language features like `eval` and `new Function` that generate
663663
code from strings throw an exception instead. This does not affect the Node.js
664664
`node:vm` module.
665665

666-
### `--expose-gc`
667-
668-
<!-- YAML
669-
added: v22.3.0
670-
-->
671-
672-
> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to
673-
> change upstream.
674-
675-
This flag will expose the gc extension from V8.
676-
677-
```js
678-
if (globalThis.gc) {
679-
globalThis.gc();
680-
}
681-
```
682-
683666
### `--dns-result-order=order`
684667

685668
<!-- YAML
@@ -783,6 +766,15 @@ node --entry-url --experimental-strip-types 'file.ts?query#hash'
783766
node --entry-url 'data:text/javascript,console.log("Hello")'
784767
```
785768

769+
### `--env-file-if-exists=config`
770+
771+
<!-- YAML
772+
added: v22.9.0
773+
-->
774+
775+
Behavior is the same as [`--env-file`][], but an error is not thrown if the file
776+
does not exist.
777+
786778
### `--env-file=config`
787779

788780
> Stability: 1.1 - Active development
@@ -850,15 +842,6 @@ export USERNAME="nodejs" # will result in `nodejs` as the value.
850842
If you want to load environment variables from a file that may not exist, you
851843
can use the [`--env-file-if-exists`][] flag instead.
852844

853-
### `--env-file-if-exists=config`
854-
855-
<!-- YAML
856-
added: v22.9.0
857-
-->
858-
859-
Behavior is the same as [`--env-file`][], but an error is not thrown if the file
860-
does not exist.
861-
862845
### `-e`, `--eval "script"`
863846

864847
<!-- YAML
@@ -929,17 +912,6 @@ files with no extension will be treated as WebAssembly if they begin with the
929912
WebAssembly magic number (`\0asm`); otherwise they will be treated as ES module
930913
JavaScript.
931914

932-
### `--experimental-transform-types`
933-
934-
<!-- YAML
935-
added: v22.7.0
936-
-->
937-
938-
> Stability: 1.0 - Early development
939-
940-
Enables the transformation of TypeScript-only syntax into JavaScript code.
941-
Implies `--experimental-strip-types` and `--enable-source-maps`.
942-
943915
### `--experimental-eventsource`
944916

945917
<!-- YAML
@@ -1016,6 +988,16 @@ following permissions are restricted:
1016988
* WASI - manageable through [`--allow-wasi`][] flag
1017989
* Addons - manageable through [`--allow-addons`][] flag
1018990

991+
### `--experimental-print-required-tla`
992+
993+
<!-- YAML
994+
added: v22.0.0
995+
-->
996+
997+
If the ES module being `require()`'d contains top-level `await`, this flag
998+
allows Node.js to evaluate the module, try to locate the
999+
top-level awaits, and print their location to help users find them.
1000+
10191001
### `--experimental-require-module`
10201002

10211003
<!-- YAML
@@ -1108,6 +1090,17 @@ added: v22.3.0
11081090
11091091
Enable module mocking in the test runner.
11101092

1093+
### `--experimental-transform-types`
1094+
1095+
<!-- YAML
1096+
added: v22.7.0
1097+
-->
1098+
1099+
> Stability: 1.0 - Early development
1100+
1101+
Enables the transformation of TypeScript-only syntax into JavaScript code.
1102+
Implies `--experimental-strip-types` and `--enable-source-maps`.
1103+
11111104
### `--experimental-vm-modules`
11121105

11131106
<!-- YAML
@@ -1153,6 +1146,23 @@ added: v22.4.0
11531146

11541147
Enable experimental [`Web Storage`][] support.
11551148

1149+
### `--expose-gc`
1150+
1151+
<!-- YAML
1152+
added: v22.3.0
1153+
-->
1154+
1155+
> Stability: 1 - Experimental. This flag is inherited from V8 and is subject to
1156+
> change upstream.
1157+
1158+
This flag will expose the gc extension from V8.
1159+
1160+
```js
1161+
if (globalThis.gc) {
1162+
globalThis.gc();
1163+
}
1164+
```
1165+
11561166
### `--force-context-aware`
11571167

11581168
<!-- YAML
@@ -1427,40 +1437,6 @@ When enabled, the parser will accept the following:
14271437
All the above will expose your application to request smuggling
14281438
or poisoning attack. Avoid using this option.
14291439

1430-
### `--inspect[=[host:]port]`
1431-
1432-
<!-- YAML
1433-
added: v6.3.0
1434-
-->
1435-
1436-
Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is
1437-
specified, a random available port will be used.
1438-
1439-
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
1440-
and profile Node.js instances. The tools attach to Node.js instances via a
1441-
tcp port and communicate using the [Chrome DevTools Protocol][].
1442-
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
1443-
1444-
<!-- Anchor to make sure old links find a target -->
1445-
1446-
<a id="inspector_security"></a>
1447-
1448-
#### Warning: binding inspector to a public IP:port combination is insecure
1449-
1450-
Binding the inspector to a public IP (including `0.0.0.0`) with an open port is
1451-
insecure, as it allows external hosts to connect to the inspector and perform
1452-
a [remote code execution][] attack.
1453-
1454-
If specifying a host, make sure that either:
1455-
1456-
* The host is not accessible from public networks.
1457-
* A firewall disallows unwanted connections on the port.
1458-
1459-
**More specifically, `--inspect=0.0.0.0` is insecure if the port (`9229` by
1460-
default) is not firewall-protected.**
1461-
1462-
See the [debugging security implications][] section for more information.
1463-
14641440
### `--inspect-brk[=[host:]port]`
14651441

14661442
<!-- YAML
@@ -1507,6 +1483,40 @@ a random available port will be used.
15071483

15081484
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
15091485

1486+
### `--inspect[=[host:]port]`
1487+
1488+
<!-- YAML
1489+
added: v6.3.0
1490+
-->
1491+
1492+
Activate inspector on `host:port`. Default is `127.0.0.1:9229`. If port `0` is
1493+
specified, a random available port will be used.
1494+
1495+
V8 inspector integration allows tools such as Chrome DevTools and IDEs to debug
1496+
and profile Node.js instances. The tools attach to Node.js instances via a
1497+
tcp port and communicate using the [Chrome DevTools Protocol][].
1498+
See [V8 Inspector integration for Node.js][] for further explanation on Node.js debugger.
1499+
1500+
<!-- Anchor to make sure old links find a target -->
1501+
1502+
<a id="inspector_security"></a>
1503+
1504+
#### Warning: binding inspector to a public IP:port combination is insecure
1505+
1506+
Binding the inspector to a public IP (including `0.0.0.0`) with an open port is
1507+
insecure, as it allows external hosts to connect to the inspector and perform
1508+
a [remote code execution][] attack.
1509+
1510+
If specifying a host, make sure that either:
1511+
1512+
* The host is not accessible from public networks.
1513+
* A firewall disallows unwanted connections on the port.
1514+
1515+
**More specifically, `--inspect=0.0.0.0` is insecure if the port (`9229` by
1516+
default) is not firewall-protected.**
1517+
1518+
See the [debugging security implications][] section for more information.
1519+
15101520
### `-i`, `--interactive`
15111521

15121522
<!-- YAML
@@ -1590,14 +1600,6 @@ added: v0.8.0
15901600

15911601
Silence deprecation warnings.
15921602

1593-
### `--no-experimental-fetch`
1594-
1595-
<!-- YAML
1596-
added: v18.0.0
1597-
-->
1598-
1599-
Disable exposition of [Fetch API][] on the global scope.
1600-
16011603
### `--no-experimental-detect-module`
16021604

16031605
<!-- YAML
@@ -1613,6 +1615,14 @@ changes:
16131615

16141616
Disable using [syntax detection][] to determine module type.
16151617

1618+
### `--no-experimental-fetch`
1619+
1620+
<!-- YAML
1621+
added: v18.0.0
1622+
-->
1623+
1624+
Disable exposition of [Fetch API][] on the global scope.
1625+
16161626
### `--no-experimental-global-customevent`
16171627

16181628
<!-- YAML
@@ -1874,16 +1884,6 @@ changes:
18741884

18751885
Identical to `-e` but prints the result.
18761886

1877-
### `--experimental-print-required-tla`
1878-
1879-
<!-- YAML
1880-
added: v22.0.0
1881-
-->
1882-
1883-
If the ES module being `require()`'d contains top-level `await`, this flag
1884-
allows Node.js to evaluate the module, try to locate the
1885-
top-level awaits, and print their location to help users find them.
1886-
18871887
### `--prof`
18881888

18891889
<!-- YAML
@@ -1957,9 +1957,7 @@ contain the `environmentVariables` data.
19571957
### `--report-exclude-network`
19581958

19591959
<!-- YAML
1960-
added:
1961-
- v22.0.0
1962-
- v20.13.0
1960+
added: v22.0.0
19631961
-->
19641962

19651963
Exclude `header.networkInterfaces` from the diagnostic report. By default
@@ -2073,15 +2071,6 @@ Enables report to be generated when the process exits due to an uncaught
20732071
exception. Useful when inspecting the JavaScript stack in conjunction with
20742072
native stack and other runtime environment data.
20752073

2076-
### `--report-exclude-network`
2077-
2078-
<!-- YAML
2079-
added: v22.0.0
2080-
-->
2081-
2082-
Exclude `header.networkInterfaces` from the diagnostic report. By default
2083-
this is not set and the network interfaces are included.
2084-
20852074
### `-r`, `--require module`
20862075

20872076
<!-- YAML
@@ -2168,6 +2157,17 @@ The following environment variables are set when running a script with `--run`:
21682157
* `NODE_RUN_PACKAGE_JSON_PATH`: The path to the `package.json` that is being
21692158
processed.
21702159

2160+
### `--secure-heap-min=n`
2161+
2162+
<!-- YAML
2163+
added: v15.6.0
2164+
-->
2165+
2166+
When using `--secure-heap`, the `--secure-heap-min` flag specifies the
2167+
minimum allocation from the secure heap. The minimum value is `2`.
2168+
The maximum value is the lesser of `--secure-heap` or `2147483647`.
2169+
The value given must be a power of two.
2170+
21712171
### `--secure-heap=n`
21722172

21732173
<!-- YAML
@@ -2193,17 +2193,6 @@ The secure heap is not available on Windows.
21932193

21942194
See [`CRYPTO_secure_malloc_init`][] for more details.
21952195

2196-
### `--secure-heap-min=n`
2197-
2198-
<!-- YAML
2199-
added: v15.6.0
2200-
-->
2201-
2202-
When using `--secure-heap`, the `--secure-heap-min` flag specifies the
2203-
minimum allocation from the secure heap. The minimum value is `2`.
2204-
The maximum value is the lesser of `--secure-heap` or `2147483647`.
2205-
The value given must be a power of two.
2206-
22072196
### `--snapshot-blob=path`
22082197

22092198
<!-- YAML
@@ -2941,11 +2930,6 @@ and `NODE_DISABLE_COLORS` environment variables are ignored.
29412930

29422931
Any other value will result in colorized output being disabled.
29432932

2944-
### `NO_COLOR=<any>`
2945-
2946-
[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the
2947-
environment variable is arbitrary.
2948-
29492933
### `NODE_COMPILE_CACHE=dir`
29502934

29512935
<!-- YAML
@@ -3421,6 +3405,11 @@ and the line lengths of the source file (in the key `lineLengths`).
34213405
}
34223406
```
34233407

3408+
### `NO_COLOR=<any>`
3409+
3410+
[`NO_COLOR`][] is an alias for `NODE_DISABLE_COLORS`. The value of the
3411+
environment variable is arbitrary.
3412+
34243413
### `OPENSSL_CONF=file`
34253414

34263415
<!-- YAML
@@ -3542,19 +3531,9 @@ documented here:
35423531

35433532
### `--huge-max-old-generation-size`
35443533

3545-
### `--jitless`
3546-
35473534
### `--interpreted-frames-native-stack`
35483535

3549-
### `--prof`
3550-
3551-
### `--perf-basic-prof`
3552-
3553-
### `--perf-basic-prof-only-functions`
3554-
3555-
### `--perf-prof`
3556-
3557-
### `--perf-prof-unwinding-info`
3536+
### `--jitless`
35583537

35593538
<!-- Anchor to make sure old links find a target -->
35603539

@@ -3606,6 +3585,16 @@ for MiB in 16 32 64 128; do
36063585
done
36073586
```
36083587

3588+
### `--perf-basic-prof`
3589+
3590+
### `--perf-basic-prof-only-functions`
3591+
3592+
### `--perf-prof`
3593+
3594+
### `--perf-prof-unwinding-info`
3595+
3596+
### `--prof`
3597+
36093598
### `--security-revert`
36103599

36113600
### `--stack-trace-limit=limit`

‎test/parallel/test-cli-node-options-docs.js

+15
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,21 @@ for (const [, envVar, config] of nodeOptionsCC.matchAll(addOptionRE)) {
123123
}
124124
}
125125

126+
{
127+
const sections = /^## (.+)$/mg;
128+
const cliOptionPattern = /^### (?:`-\w.*`, )?`([^`]+)`/mg;
129+
let match;
130+
let previousIndex = 0;
131+
do {
132+
const sectionTitle = match?.[1];
133+
match = sections.exec(cliText);
134+
const filteredCLIText = cliText.slice(previousIndex, match?.index);
135+
const options = Array.from(filteredCLIText.matchAll(cliOptionPattern), (match) => match[1]);
136+
assert.deepStrictEqual(options, options.toSorted(), `doc/api/cli.md ${sectionTitle} subsections are not in alphabetical order`);
137+
previousIndex = match?.index;
138+
} while (match);
139+
}
140+
126141
// add alias handling
127142
manPagesOptions.delete('-trace-events-enabled');
128143

0 commit comments

Comments
 (0)
Please sign in to comment.