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 — module: fix specifier resolution option value · nodejs/node@314483c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/modules
    • run_main.js
  • src
    • node_options.cc
    • node_options.h
  • test/es-module
    • test-esm-specifiers-both-flags.mjs
    • test-esm-specifiers.mjs
Expand file treeCollapse file tree
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)
You are visitor 01402520 — 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.