| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -809,7 +809,7 @@ doc: $(NODE_EXE) doc-only ## Build Node.js, and then build the documentation wit | |||
| 809 | 809 | ||
| 810 | 810 | out/doc: | |
| 811 | 811 | mkdir -p $@ | |
| 812 | - cp doc/node_config_json_schema.json $@ | ||
| 812 | + cp doc/node-config-schema.json $@ | ||
| 813 | 813 | ||
| 814 | 814 | # If it's a source tarball, doc/api already contains the generated docs. | |
| 815 | 815 | # Just copy everything under doc/api over. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -919,29 +919,30 @@ flows within the application. As such, it is presently recommended to be sure | |||
| 919 | 919 | your application behaviour is unaffected by this change before using it in | |
| 920 | 920 | production. | |
| 921 | 921 | ||
| 922 | - ### `--experimental-config-file` | ||
| 922 | + ### `--experimental-config-file=config` | ||
| 923 | 923 | ||
| 924 | 924 | <!-- YAML | |
| 925 | 925 | added: REPLACEME | |
| 926 | 926 | --> | |
| 927 | 927 | ||
| 928 | 928 | > Stability: 1.0 - Early development | |
| 929 | 929 | ||
| 930 | - Use this flag to specify a configuration file that will be loaded and parsed | ||
| 931 | - before the application starts. | ||
| 930 | + If present, Node.js will look for a | ||
| 931 | + configuration file at the specified path. | ||
| 932 | 932 | Node.js will read the configuration file and apply the settings. | |
| 933 | 933 | The configuration file should be a JSON file | |
| 934 | 934 | with the following structure: | |
| 935 | 935 | ||
| 936 | + > \[!NOTE] | ||
| 937 | + > Replace `vX.Y.Z` in the `$schema` with the version of Node.js you are using. | ||
| 938 | + | ||
| 936 | 939 | ```json | |
| 937 | 940 | { | |
| 938 | - "$schema": "https://nodejs.org/dist/REPLACEME/docs/node_config_json_schema.json", | ||
| 941 | + "$schema": "https://nodejs.org/dist/vX.Y.Z/docs/node-config-schema.json", | ||
| 939 | 942 | "nodeOptions": { | |
| 940 | - "experimental-transform-types": true, | ||
| 941 | 943 | "import": [ | |
| 942 | - "amaro/transform" | ||
| 944 | + "amaro/strip" | ||
| 943 | 945 | ], | |
| 944 | - "disable-warning": "ExperimentalWarning", | ||
| 945 | 946 | "watch-path": "src", | |
| 946 | 947 | "watch-preserve-output": true | |
| 947 | 948 | } | |
@@ -952,7 +953,7 @@ In the `nodeOptions` field, only flags that are allowed in [`NODE_OPTIONS`][] ar | |||
| 952 | 953 | No-op flags are not supported. | |
| 953 | 954 | Not all V8 flags are currently supported. | |
| 954 | 955 | ||
| 955 | - It is possible to use the [official JSON schema](../node_config_json_schema.json) | ||
| 956 | + It is possible to use the [official JSON schema](../node-config-schema.json) | ||
| 956 | 957 | to validate the configuration file, which may vary depending on the Node.js version. | |
| 957 | 958 | Each key in the configuration file corresponds to a flag that can be passed | |
| 958 | 959 | as a command-line argument. The value of the key is the value that would be | |
@@ -962,7 +963,7 @@ For example, the configuration file above is equivalent to | |||
| 962 | 963 | the following command-line arguments: | |
| 963 | 964 | ||
| 964 | 965 | ```bash | |
| 965 | - node --experimental-transform-types --import amaro/transform --disable-warning=ExperimentalWarning --watch-path=src --watch-preserve-output | ||
| 966 | + node --import amaro/strip --watch-path=src --watch-preserve-output | ||
| 966 | 967 | ``` | |
| 967 | 968 | ||
| 968 | 969 | The priority in configuration is as follows: | |
@@ -984,6 +985,18 @@ unknown keys or keys that cannot used in `NODE_OPTIONS`. | |||
| 984 | 985 | Node.js will not sanitize or perform validation on the user-provided configuration, | |
| 985 | 986 | so **NEVER** use untrusted configuration files. | |
| 986 | 987 | ||
| 988 | + ### `--experimental-default-config-file` | ||
| 989 | + | ||
| 990 | + <!-- YAML | ||
| 991 | + added: REPLACEME | ||
| 992 | + --> | ||
| 993 | + | ||
| 994 | + > Stability: 1.0 - Early development | ||
| 995 | + | ||
| 996 | + If the `--experimental-default-config-file` flag is present, Node.js will look for a | ||
| 997 | + `node.config.json` file in the current working directory and load it as a | ||
| 998 | + as configuration file. | ||
| 999 | + | ||
| 987 | 1000 | ### `--experimental-eventsource` | |
| 988 | 1001 | ||
| 989 | 1002 | <!-- YAML | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -167,7 +167,10 @@ Interpret the entry point as a URL. | |||
| 167 | 167 | Enable experimental addon module support. | |
| 168 | 168 | . | |
| 169 | 169 | .It Fl -experimental-config-file | |
| 170 | - Enable support for experimental config file | ||
| 170 | + Specifies the configuration file to load. | ||
| 171 | + . | ||
| 172 | + .It Fl -experimental-default-config-file | ||
| 173 | + Enable support for automatically loading node.config.json. | ||
| 171 | 174 | . | |
| 172 | 175 | .It Fl -experimental-import-meta-resolve | |
| 173 | 176 | Enable experimental ES modules support for import.meta.resolve(). | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -315,7 +315,8 @@ function setupSQLite() { | |||
| 315 | 315 | } | |
| 316 | 316 | ||
| 317 | 317 | function initializeConfigFileSupport() { | |
| 318 | - if (getOptionValue('--experimental-config-file')) { | ||
| 318 | + if (getOptionValue('--experimental-default-config-file') || | ||
| 319 | + getOptionValue('--experimental-config-file')) { | ||
| 319 | 320 | emitExperimentalWarning('--experimental-config-file'); | |
| 320 | 321 | } | |
| 321 | 322 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,22 +8,32 @@ namespace node { | |||
| 8 | 8 | ||
| 9 | 9 | std::optional<std::string_view> ConfigReader::GetDataFromArgs( | |
| 10 | 10 | const std::vector<std::string>& args) { | |
| 11 | - constexpr std::string_view flag = "--experimental-config-file"; | ||
| 11 | + constexpr std::string_view flag_path = "--experimental-config-file"; | ||
| 12 | + constexpr std::string_view default_file = | ||
| 13 | + "--experimental-default-config-file"; | ||
| 14 | + | ||
| 15 | + bool has_default_config_file = false; | ||
| 12 | 16 | ||
| 13 | 17 | for (auto it = args.begin(); it != args.end(); ++it) { | |
| 14 | - if (*it == flag) { | ||
| 18 | + if (*it == flag_path) { | ||
| 15 | 19 | // Case: "--experimental-config-file foo" | |
| 16 | 20 | if (auto next = std::next(it); next != args.end()) { | |
| 17 | 21 | return *next; | |
| 18 | 22 | } | |
| 19 | - } else if (it->starts_with(flag)) { | ||
| 23 | + } else if (it->starts_with(flag_path)) { | ||
| 20 | 24 | // Case: "--experimental-config-file=foo" | |
| 21 | - if (it->size() > flag.size() && (*it)[flag.size()] == '=') { | ||
| 22 | - return it->substr(flag.size() + 1); | ||
| 25 | + if (it->size() > flag_path.size() && (*it)[flag_path.size()] == '=') { | ||
| 26 | + return it->substr(flag_path.size() + 1); | ||
| 23 | 27 | } | |
| 28 | + } else if (*it == default_file || it->starts_with(default_file)) { | ||
| 29 | + has_default_config_file = true; | ||
| 24 | 30 | } | |
| 25 | 31 | } | |
| 26 | 32 | ||
| 33 | + if (has_default_config_file) { | ||
| 34 | + return "node.config.json"; | ||
| 35 | + } | ||
| 36 | + | ||
| 27 | 37 | return std::nullopt; | |
| 28 | 38 | } | |
| 29 | 39 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -685,7 +685,10 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |||
| 685 | 685 | Implies("--env-file-if-exists", "[has_env_file_string]"); | |
| 686 | 686 | AddOption("--experimental-config-file", | |
| 687 | 687 | "set config file from supplied file", | |
| 688 | - &EnvironmentOptions::experimental_config_file); | ||
| 688 | + &EnvironmentOptions::experimental_config_file_path); | ||
| 689 | + AddOption("--experimental-default-config-file", | ||
| 690 | + "set config file from default config file", | ||
| 691 | + &EnvironmentOptions::experimental_default_config_file); | ||
| 689 | 692 | AddOption("--test", | |
| 690 | 693 | "launch test runner on startup", | |
| 691 | 694 | &EnvironmentOptions::test_runner); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -258,7 +258,8 @@ class EnvironmentOptions : public Options { | |||
| 258 | 258 | ||
| 259 | 259 | bool report_exclude_env = false; | |
| 260 | 260 | bool report_exclude_network = false; | |
| 261 | - std::string experimental_config_file; | ||
| 261 | + std::string experimental_config_file_path; | ||
| 262 | + bool experimental_default_config_file = false; | ||
| 262 | 263 | ||
| 263 | 264 | inline DebugOptions* get_debug_options() { return &debug_options_; } | |
| 264 | 265 | inline const DebugOptions& debug_options() const { return debug_options_; } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + { | ||
| 2 | + "nodeOptions": { | ||
| 3 | + "max-http-header-size": 10 | ||
| 4 | + } | ||
| 5 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + { | ||
| 2 | + "nodeOptions": { | ||
| 3 | + "max-http-header-size": 20 | ||
| 4 | + } | ||
| 5 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments