Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 314483c

Browse filesBrowse files
himself65ruyadorno
authored andcommitted
module: fix specifier resolution option value
Fixes: #35095 PR-URL: #35098 Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 379c5ce commit 314483c
Copy full SHA for 314483c

File tree

Expand file treeCollapse file tree

5 files changed

+13
-38
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+13
-38
lines changed
Open diff view settings
Collapse file

‎lib/internal/modules/run_main.js‎

Copy file name to clipboardExpand all lines: lib/internal/modules/run_main.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function shouldUseESMLoader(mainPath) {
2525
if (userLoader)
2626
return true;
2727
const esModuleSpecifierResolution =
28-
getOptionValue('--es-module-specifier-resolution');
28+
getOptionValue('--experimental-specifier-resolution');
2929
if (esModuleSpecifierResolution === 'node')
3030
return true;
3131
// Determine the module format of the main
Collapse file

‎src/node_options.cc‎

Copy file name to clipboardExpand all lines: src/node_options.cc
+3-18Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,7 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) {
9292
}
9393
}
9494

95-
if (!es_module_specifier_resolution.empty()) {
96-
if (!experimental_specifier_resolution.empty()) {
97-
errors->push_back(
98-
"bad option: cannot use --es-module-specifier-resolution"
99-
" and --experimental-specifier-resolution at the same time");
100-
} else {
101-
experimental_specifier_resolution = es_module_specifier_resolution;
102-
if (experimental_specifier_resolution != "node" &&
103-
experimental_specifier_resolution != "explicit") {
104-
errors->push_back(
105-
"invalid value for --es-module-specifier-resolution");
106-
}
107-
}
108-
} else if (!experimental_specifier_resolution.empty()) {
95+
if (!experimental_specifier_resolution.empty()) {
10996
if (experimental_specifier_resolution != "node" &&
11097
experimental_specifier_resolution != "explicit") {
11198
errors->push_back(
@@ -366,10 +353,8 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
366353
"either 'explicit' (default) or 'node'",
367354
&EnvironmentOptions::experimental_specifier_resolution,
368355
kAllowedInEnvironment);
369-
AddOption("--es-module-specifier-resolution",
370-
"",
371-
&EnvironmentOptions::es_module_specifier_resolution,
372-
kAllowedInEnvironment);
356+
AddAlias("--es-module-specifier-resolution",
357+
"--experimental-specifier-resolution");
373358
AddOption("--no-deprecation",
374359
"silence deprecation warnings",
375360
&EnvironmentOptions::no_deprecation,
Collapse file

‎src/node_options.h‎

Copy file name to clipboardExpand all lines: src/node_options.h
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ class EnvironmentOptions : public Options {
105105
bool experimental_json_modules = false;
106106
bool experimental_modules = false;
107107
std::string experimental_specifier_resolution;
108-
std::string es_module_specifier_resolution;
109108
bool experimental_wasm_modules = false;
110109
bool experimental_import_meta_resolve = false;
111110
std::string module_type;
Collapse file

‎test/es-module/test-esm-specifiers-both-flags.mjs‎

Copy file name to clipboardExpand all lines: test/es-module/test-esm-specifiers-both-flags.mjs
-14Lines changed: 0 additions & 14 deletions
This file was deleted.
Collapse file

‎test/es-module/test-esm-specifiers.mjs‎

Copy file name to clipboardExpand all lines: test/es-module/test-esm-specifiers.mjs
+9-4Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@ main().catch(mustNotCall);
4949
'../../fixtures/es-module-specifiers',
5050
item,
5151
);
52-
spawn(process.execPath,
53-
['--es-module-specifier-resolution=node', modulePath],
54-
{ stdio: 'inherit' }).on('exit', (code) => {
55-
assert.strictEqual(code, 0);
52+
[
53+
'--experimental-specifier-resolution',
54+
'--es-module-specifier-resolution'
55+
].forEach((option) => {
56+
spawn(process.execPath,
57+
[`${option}=node`, modulePath],
58+
{ stdio: 'inherit' }).on('exit', (code) => {
59+
assert.strictEqual(code, 0);
60+
});
5661
});
5762
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.