| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2832,11 +2832,15 @@ V8 options that are allowed are: | |||
| 2832 | 2832 | ||
| 2833 | 2833 | <!-- node-options-v8 end --> | |
| 2834 | 2834 | ||
| 2835 | + <!-- node-options-others start --> | ||
| 2836 | + | ||
| 2835 | 2837 | `--perf-basic-prof-only-functions`, `--perf-basic-prof`, | |
| 2836 | 2838 | `--perf-prof-unwinding-info`, and `--perf-prof` are only available on Linux. | |
| 2837 | 2839 | ||
| 2838 | 2840 | `--enable-etw-stack-walking` is only available on Windows. | |
| 2839 | 2841 | ||
| 2842 | + <!-- node-options-others end --> | ||
| 2843 | + | ||
| 2840 | 2844 | ### `NODE_PATH=path[:…]` | |
| 2841 | 2845 | ||
| 2842 | 2846 | <!-- YAML | |
@@ -3136,6 +3140,32 @@ options are of interest only to V8 developers. Despite this, there is a small | |||
| 3136 | 3140 | set of V8 options that are widely applicable to Node.js, and they are | |
| 3137 | 3141 | documented here: | |
| 3138 | 3142 | ||
| 3143 | + <!-- v8-options start --> | ||
| 3144 | + | ||
| 3145 | + ### `--abort-on-uncaught-exception` | ||
| 3146 | + | ||
| 3147 | + ### `--disallow-code-generation-from-strings` | ||
| 3148 | + | ||
| 3149 | + ### `--enable-etw-stack-walking` | ||
| 3150 | + | ||
| 3151 | + ### `--harmony-shadow-realm` | ||
| 3152 | + | ||
| 3153 | + ### `--huge-max-old-generation-size` | ||
| 3154 | + | ||
| 3155 | + ### `--jitless` | ||
| 3156 | + | ||
| 3157 | + ### `--interpreted-frames-native-stack` | ||
| 3158 | + | ||
| 3159 | + ### `--prof` | ||
| 3160 | + | ||
| 3161 | + ### `--perf-basic-prof` | ||
| 3162 | + | ||
| 3163 | + ### `--perf-basic-prof-only-functions` | ||
| 3164 | + | ||
| 3165 | + ### `--perf-prof` | ||
| 3166 | + | ||
| 3167 | + ### `--perf-prof-unwinding-info` | ||
| 3168 | + | ||
| 3139 | 3169 | ### `--max-old-space-size=SIZE` (in megabytes) | |
| 3140 | 3170 | ||
| 3141 | 3171 | Sets the max memory size of V8's old memory section. As memory | |
@@ -3174,6 +3204,19 @@ for MiB in 16 32 64 128; do | |||
| 3174 | 3204 | done | |
| 3175 | 3205 | ``` | |
| 3176 | 3206 | ||
| 3207 | + ### `--security-revert` | ||
| 3208 | + | ||
| 3209 | + ### `--stack-trace-limit=limit` | ||
| 3210 | + | ||
| 3211 | + The maximum number of stack frames to collect in an error's stack trace. | ||
| 3212 | + Setting it to 0 disables stack trace collection. The default value is 10. | ||
| 3213 | + | ||
| 3214 | + ```bash | ||
| 3215 | + node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 | ||
| 3216 | + ``` | ||
| 3217 | + | ||
| 3218 | + <!-- v8-options end --> | ||
| 3219 | + | ||
| 3177 | 3220 | [#42511]: https://github.com/nodejs/node/issues/42511 | |
| 3178 | 3221 | [Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/ | |
| 3179 | 3222 | [CommonJS]: modules.md | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,6 +8,12 @@ rules. The core developers may remove these flags in any version of Node.js. | |||
| 8 | 8 | ||
| 9 | 9 | ### Flags | |
| 10 | 10 | ||
| 11 | + #### `--debug-arraybuffer-allocations` | ||
| 12 | + | ||
| 13 | + #### `--expose-internals` | ||
| 14 | + | ||
| 15 | + Allows to require the `internal/*` modules. | ||
| 16 | + | ||
| 11 | 17 | #### `--inspect-brk-node[=[host:]port]` | |
| 12 | 18 | ||
| 13 | 19 | <!-- YAML | |
@@ -17,3 +23,11 @@ added: v7.6.0 | |||
| 17 | 23 | Activate inspector on `host:port` and break at start of the first internal | |
| 18 | 24 | JavaScript script executed when the inspector is available. | |
| 19 | 25 | Default `host:port` is `127.0.0.1:9229`. | |
| 26 | + | ||
| 27 | + #### `--node-snapshot` | ||
| 28 | + | ||
| 29 | + #### `--test-udp-no-try-send` | ||
| 30 | + | ||
| 31 | + #### `--trace-promises` | ||
| 32 | + | ||
| 33 | + #### `--verify-base-objects` | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -165,9 +165,6 @@ Interpret as either ES modules or CommonJS modules input via --eval or STDIN, wh | |||
| 165 | 165 | .js or extensionless files with no sibling or parent package.json; | |
| 166 | 166 | .js or extensionless files whose nearest parent package.json lacks a "type" field, unless under node_modules. | |
| 167 | 167 | . | |
| 168 | - .It Fl -experimental-global-webcrypto | ||
| 169 | - Expose the Web Crypto API on the global scope. | ||
| 170 | - . | ||
| 171 | 168 | .It Fl -experimental-import-meta-resolve | |
| 172 | 169 | Enable experimental ES modules support for import.meta.resolve(). | |
| 173 | 170 | . | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -420,7 +420,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |||
| 420 | 420 | "experimental WebSocket API", | |
| 421 | 421 | &EnvironmentOptions::experimental_websocket, | |
| 422 | 422 | kAllowedInEnvvar, | |
| 423 | - true); | ||
| 423 | + false); | ||
| 424 | 424 | AddOption("--experimental-global-customevent", | |
| 425 | 425 | "expose experimental CustomEvent on the global scope", | |
| 426 | 426 | &EnvironmentOptions::experimental_global_customevent, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,129 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + if (process.config.variables.node_without_node_options) | ||
| 4 | + common.skip('missing NODE_OPTIONS support'); | ||
| 5 | + | ||
| 6 | + // Test options specified by env variable. | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const fs = require('fs'); | ||
| 10 | + const path = require('path'); | ||
| 11 | + | ||
| 12 | + const rootDir = path.resolve(__dirname, '..', '..'); | ||
| 13 | + const cliMd = path.join(rootDir, 'doc', 'api', 'cli.md'); | ||
| 14 | + const cliText = fs.readFileSync(cliMd, { encoding: 'utf8' }); | ||
| 15 | + | ||
| 16 | + const internalApiMd = path.join(rootDir, 'doc', 'contributing', 'internal-api.md'); | ||
| 17 | + const internalApiText = fs.readFileSync(internalApiMd, { encoding: 'utf8' }); | ||
| 18 | + | ||
| 19 | + const nodeOptionsCC = fs.readFileSync(path.resolve(rootDir, 'src', 'node_options.cc'), 'utf8'); | ||
| 20 | + const addOptionRE = /AddOption[\s\n\r]*\([\s\n\r]*"([^"]+)"(.*?)\);/gs; | ||
| 21 | + | ||
| 22 | + const nodeOptionsText = cliText.match(/<!-- node-options-node start -->(.*)<!-- node-options-others end -->/s)[1]; | ||
| 23 | + const v8OptionsText = cliText.match(/<!-- v8-options start -->(.*)<!-- v8-options end -->/s)[1]; | ||
| 24 | + | ||
| 25 | + const manPage = path.join(rootDir, 'doc', 'node.1'); | ||
| 26 | + const manPageText = fs.readFileSync(manPage, { encoding: 'utf8' }); | ||
| 27 | + | ||
| 28 | + // Documented in /doc/api/deprecations.md | ||
| 29 | + const deprecated = [ | ||
| 30 | + '--debug', | ||
| 31 | + '--debug-brk', | ||
| 32 | + ]; | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + const manPagesOptions = new Set(); | ||
| 36 | + | ||
| 37 | + for (const [, envVar] of manPageText.matchAll(/\.It Fl (-[a-zA-Z0-9._-]+)/g)) { | ||
| 38 | + manPagesOptions.add(envVar); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + for (const [, envVar, config] of nodeOptionsCC.matchAll(addOptionRE)) { | ||
| 42 | + let hasTrueAsDefaultValue = false; | ||
| 43 | + let isInNodeOption = false; | ||
| 44 | + let isV8Option = false; | ||
| 45 | + let isNoOp = false; | ||
| 46 | + | ||
| 47 | + if (config.includes('NoOp{}')) { | ||
| 48 | + isNoOp = true; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + if (config.includes('kAllowedInEnvvar')) { | ||
| 52 | + isInNodeOption = true; | ||
| 53 | + } | ||
| 54 | + if (config.includes('kDisallowedInEnvvar')) { | ||
| 55 | + isInNodeOption = false; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + if (config.includes('V8Option{}')) { | ||
| 59 | + isV8Option = true; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + if (/^\s*true\s*$/.test(config.split(',').pop())) { | ||
| 63 | + hasTrueAsDefaultValue = true; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + if ( | ||
| 67 | + envVar.startsWith('[') || | ||
| 68 | + deprecated.includes(envVar) || | ||
| 69 | + isNoOp | ||
| 70 | + ) { | ||
| 71 | + // assert(!manPagesOptions.has(envVar.slice(1)), `Option ${envVar} should not be documented`) | ||
| 72 | + manPagesOptions.delete(envVar.slice(1)); | ||
| 73 | + continue; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + // Internal API options are documented in /doc/contributing/internal-api.md | ||
| 77 | + if (new RegExp(`####.*\`${envVar}[[=\\s\\b\`]`).test(internalApiText) === true) { | ||
| 78 | + manPagesOptions.delete(envVar.slice(1)); | ||
| 79 | + continue; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + // CLI options | ||
| 83 | + if (!isV8Option && !hasTrueAsDefaultValue) { | ||
| 84 | + if (new RegExp(`###.*\`${envVar}[[=\\s\\b\`]`).test(cliText) === false) { | ||
| 85 | + assert(false, `Should have option ${envVar} documented`); | ||
| 86 | + } else { | ||
| 87 | + manPagesOptions.delete(envVar.slice(1)); | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + if (!hasTrueAsDefaultValue && new RegExp(`###.*\`--no${envVar.slice(1)}[[=\\s\\b\`]`).test(cliText) === true) { | ||
| 92 | + assert(false, `Should not have option --no${envVar.slice(1)} documented`); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + if (!isV8Option && hasTrueAsDefaultValue) { | ||
| 96 | + if (new RegExp(`###.*\`--no${envVar.slice(1)}[[=\\s\\b\`]`).test(cliText) === false) { | ||
| 97 | + assert(false, `Should have option --no${envVar.slice(1)} documented`); | ||
| 98 | + } else { | ||
| 99 | + manPagesOptions.delete(`-no${envVar.slice(1)}`); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + // NODE_OPTIONS | ||
| 104 | + if (isInNodeOption && !hasTrueAsDefaultValue && new RegExp(`\`${envVar}\``).test(nodeOptionsText) === false) { | ||
| 105 | + assert(false, `Should have option ${envVar} in NODE_OPTIONS documented`); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + if (isInNodeOption && hasTrueAsDefaultValue && new RegExp(`\`--no${envVar.slice(1)}`).test(cliText) === false) { | ||
| 109 | + assert(false, `Should have option --no${envVar.slice(1)} in NODE_OPTIONS documented`); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + if (!hasTrueAsDefaultValue && new RegExp(`\`--no${envVar.slice(1)}`).test(cliText) === true) { | ||
| 113 | + assert(false, `Should not have option --no${envVar.slice(1)} in NODE_OPTIONS documented`); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + // V8 options | ||
| 117 | + if (isV8Option) { | ||
| 118 | + if (new RegExp(`###.*\`${envVar}[[=\\s\\b\`]`).test(v8OptionsText) === false) { | ||
| 119 | + assert(false, `Should have option ${envVar} in V8 options documented`); | ||
| 120 | + } else { | ||
| 121 | + manPagesOptions.delete(envVar.slice(1)); | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + // add alias handling | ||
| 127 | + manPagesOptions.delete('-trace-events-enabled'); | ||
| 128 | + | ||
| 129 | + assert.strictEqual(manPagesOptions.size, 0, `Man page options not documented: ${[...manPagesOptions]}`); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments