From db6de3dcab1ada7e442a9c0b7a94a4855bd5d815 Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Fri, 21 May 2021 16:16:12 +0200 Subject: [PATCH 1/6] cli: add -m alias for --conditions flag --- doc/api/cli.md | 2 +- doc/node.1 | 2 +- src/node_options.cc | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/cli.md b/doc/api/cli.md index e8fb68a538b6a0..9b0ae4cfe58d62 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -80,7 +80,7 @@ $ node --completion-bash > node_bash_completion $ source node_bash_completion ``` -### `--conditions=condition` +### `-m`, `--conditions=condition` -* `--conditions` +* `--conditions`, `-C` * `--diagnostic-dir` * `--disable-proto` * `--enable-fips` diff --git a/doc/node.1 b/doc/node.1 index f7521ccffafa58..a65ec7451a88cc 100644 --- a/doc/node.1 +++ b/doc/node.1 @@ -78,7 +78,7 @@ Aborting instead of exiting causes a core file to be generated for analysis. .It Fl -completion-bash Print source-able bash completion script for Node.js. . -.It Fl m , Fl -conditions Ar string +.It Fl C , Fl -conditions Ar string Use custom conditional exports conditions. .Ar string . diff --git a/src/node_options.cc b/src/node_options.cc index e8ab3435a9c014..b8809df58f0552 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -292,7 +292,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { "additional user conditions for conditional exports and imports", &EnvironmentOptions::conditions, kAllowedInEnvironment); - AddAlias("-m", "--conditions"); + AddAlias("-C", "--conditions"); AddOption("--diagnostic-dir", "set dir for all output files" " (default: current working directory)", diff --git a/test/es-module/test-esm-custom-exports.mjs b/test/es-module/test-esm-custom-exports.mjs index 695b9ea62e0cc0..e6023387cf8afc 100644 --- a/test/es-module/test-esm-custom-exports.mjs +++ b/test/es-module/test-esm-custom-exports.mjs @@ -1,4 +1,4 @@ -// Flags: --conditions=custom-condition -m another +// Flags: --conditions=custom-condition -C another import { mustCall } from '../common/index.mjs'; import { strictEqual } from 'assert'; import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs'; From 9aef2d342577055d7a66253f0ee7833fa3a073cf Mon Sep 17 00:00:00 2001 From: Guy Bedford Date: Sat, 22 May 2021 13:47:07 +0200 Subject: [PATCH 6/6] extend allowed check --- test/parallel/test-process-env-allowed-flags.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-process-env-allowed-flags.js b/test/parallel/test-process-env-allowed-flags.js index 1d50e02d7abe0c..9337263d5cc979 100644 --- a/test/parallel/test-process-env-allowed-flags.js +++ b/test/parallel/test-process-env-allowed-flags.js @@ -51,7 +51,7 @@ const assert = require('assert'); // Assert all "canonical" flags begin with dash(es) { process.allowedNodeEnvironmentFlags.forEach((flag) => { - assert(/^--?[a-z0-9._-]+$/.test(flag), + assert(/^--?[a-zA-Z0-9._-]+$/.test(flag), `Unexpected format for flag ${flag}`); }); }