GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: add config file support · nodejs/node@9fd217d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Makefile
  • doc
    • api
      • cli.md
    • node.1
    • node_config_json_schema.json
  • lib/internal
    • options.js
    • process
      • pre_execution.js
  • node.gyp
  • src
    • node.cc
    • node_config_file.cc
    • node_config_file.h
    • node_options.cc
    • node_options.h
  • test
    • fixtures
      • dotenv
        • node-options-no-tranform.env
      • rc
        • empty-object.json
        • empty.json
        • host-port.json
        • import-as-string.json
        • import.json
        • invalid-import.json
        • negative-numeric.json
        • no-op.json
        • not-node-options-flag.json
        • numeric.json
        • override-property.json
        • sneaky-flag.json
        • string.json
        • test.js
        • transform-types.json
        • unknown-flag.json
        • v8-flag.json
    • parallel
      • test-config-file.js
      • test-config-json-schema.js
  • tools/doc
    • generate-json-schema.mjs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Makefile‎

Copy file name to clipboardExpand all lines: Makefile
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ doc: $(NODE_EXE) doc-only ## Build Node.js, and then build the documentation wit
809809

810810
out/doc:
811811
mkdir -p $@
812+
cp doc/node_config_json_schema.json $@
812813

813814
# If it's a source tarball, doc/api already contains the generated docs.
814815
# Just copy everything under doc/api over.
Collapse file

‎doc/api/cli.md‎

Copy file name to clipboardExpand all lines: doc/api/cli.md
+63Lines changed: 63 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,69 @@ flows within the application. As such, it is presently recommended to be sure
919919
your application behaviour is unaffected by this change before using it in
920920
production.
921921

922+
### `--experimental-config-file`
923+
924+
<!-- YAML
925+
added: REPLACEME
926+
-->
927+
928+
> Stability: 1.0 - Early development
929+
930+
Use this flag to specify a configuration file that will be loaded and parsed
931+
before the application starts.
932+
Node.js will read the configuration file and apply the settings.
933+
The configuration file should be a JSON file
934+
with the following structure:
935+
936+
```json
937+
{
938+
"$schema": "https://nodejs.org/dist/REPLACEME/docs/node_config_json_schema.json",
939+
"experimental-transform-types": true,
940+
"import": [
941+
"amaro/transform"
942+
],
943+
"disable-warning": "ExperimentalWarning",
944+
"watch-path": "src",
945+
"watch-preserve-output": true
946+
}
947+
```
948+
949+
Only flags that are allowed in [`NODE_OPTIONS`][] are supported.
950+
No-op flags are not supported.
951+
Not all V8 flags are currently supported.
952+
953+
It is possible to use the [official JSON schema](../node_config_json_schema.json)
954+
to validate the configuration file, which may vary depending on the Node.js version.
955+
Each key in the configuration file corresponds to a flag that can be passed
956+
as a command-line argument. The value of the key is the value that would be
957+
passed to the flag.
958+
959+
For example, the configuration file above is equivalent to
960+
the following command-line arguments:
961+
962+
```bash
963+
node --experimental-transform-types --import amaro/transform --disable-warning=ExperimentalWarning --watch-path=src --watch-preserve-output
964+
```
965+
966+
The priority in configuration is as follows:
967+
968+
1. NODE\_OPTIONS and command-line options
969+
2. Configuration file
970+
3. Dotenv NODE\_OPTIONS
971+
972+
Values in the configuration file will not override the values in the environment
973+
variables and command-line options, but will override the values in the `NODE_OPTIONS`
974+
env file parsed by the `--env-file` flag.
975+
976+
If duplicate keys are present in the configuration file, only
977+
the first key will be used.
978+
979+
The configuration parser will throw an error if the configuration file contains
980+
unknown keys or keys that cannot used in `NODE_OPTIONS`.
981+
982+
Node.js will not sanitize or perform validation on the user-provided configuration,
983+
so **NEVER** use untrusted configuration files.
984+
922985
### `--experimental-eventsource`
923986

924987
<!-- YAML
Collapse file

‎doc/node.1‎

Copy file name to clipboardExpand all lines: doc/node.1
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ Interpret the entry point as a URL.
166166
.It Fl -experimental-addon-modules
167167
Enable experimental addon module support.
168168
.
169+
.It Fl -experimental-config-file
170+
Enable support for experimental config file
171+
.
169172
.It Fl -experimental-import-meta-resolve
170173
Enable experimental ES modules support for import.meta.resolve().
171174
.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.