summaryrefslogtreecommitdiff
path: root/src/node_options.cc
diff options
context:
space:
mode:
authorMyles Borins <mylesborins@google.com>2019-11-27 01:54:23 -0500
committerMyles Borins <mylesborins@google.com>2019-12-04 13:21:41 -0800
commitee953d813be1fb19930e0e64196c0aa33699b133 (patch)
tree2b11d0315bcbb33ee26ad333a798ff012da696fa /src/node_options.cc
parent12254ce242c30d403b523ad9adb60a0280080957 (diff)
downloadandroid-node-v8-ee953d813be1fb19930e0e64196c0aa33699b133.tar.gz
android-node-v8-ee953d813be1fb19930e0e64196c0aa33699b133.tar.bz2
android-node-v8-ee953d813be1fb19930e0e64196c0aa33699b133.zip
esm: make specifier flag clearly experimental
`--es-module-specifier-resolution` is the only flagged portion of the ESM implementation that does not have the word experimental in the flag name. This commit changes the flag to: `--experimental-specifier-resolution` `--es-module-specifier-resolution` remains as an alias for backwards compatibility but it is no longer documented. PR-URL: https://github.com/nodejs/node/pull/30678 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com>
Diffstat (limited to 'src/node_options.cc')
-rw-r--r--src/node_options.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/node_options.cc b/src/node_options.cc
index 498bedd1e5..abf26fb781 100644
--- a/src/node_options.cc
+++ b/src/node_options.cc
@@ -128,9 +128,23 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) {
}
if (!es_module_specifier_resolution.empty()) {
- if (es_module_specifier_resolution != "node" &&
- es_module_specifier_resolution != "explicit") {
- errors->push_back("invalid value for --es-module-specifier-resolution");
+ if (!experimental_specifier_resolution.empty()) {
+ errors->push_back(
+ "bad option: cannot use --es-module-specifier-resolution"
+ " and --experimental-specifier-resolution at the same time");
+ } else {
+ experimental_specifier_resolution = es_module_specifier_resolution;
+ if (experimental_specifier_resolution != "node" &&
+ experimental_specifier_resolution != "explicit") {
+ errors->push_back(
+ "invalid value for --es-module-specifier-resolution");
+ }
+ }
+ } else if (!experimental_specifier_resolution.empty()) {
+ if (experimental_specifier_resolution != "node" &&
+ experimental_specifier_resolution != "explicit") {
+ errors->push_back(
+ "invalid value for --experimental-specifier-resolution");
}
}
@@ -365,9 +379,13 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"set module type for string input",
&EnvironmentOptions::module_type,
kAllowedInEnvironment);
- AddOption("--es-module-specifier-resolution",
+ AddOption("--experimental-specifier-resolution",
"Select extension resolution algorithm for es modules; "
"either 'explicit' (default) or 'node'",
+ &EnvironmentOptions::experimental_specifier_resolution,
+ kAllowedInEnvironment);
+ AddOption("--es-module-specifier-resolution",
+ "",
&EnvironmentOptions::es_module_specifier_resolution,
kAllowedInEnvironment);
AddOption("--no-deprecation",