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 40eb3b7

Browse filesBrowse files
guybedfordMylesBorins
authored andcommitted
cli: add -C alias for --conditions flag
PR-URL: #38755 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jan Krems <jan.krems@gmail.com>
1 parent 6a4811d commit 40eb3b7
Copy full SHA for 40eb3b7

File tree

Expand file treeCollapse file tree

5 files changed

+14
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+14
-6
lines changed
Open diff view settings
Collapse file

‎doc/api/cli.md‎

Copy file name to clipboardExpand all lines: doc/api/cli.md
+10-3Lines changed: 10 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,27 @@ $ node --completion-bash > node_bash_completion
8080
$ source node_bash_completion
8181
```
8282

83-
### `--conditions=condition`
83+
### `-C=condition`, `--conditions=condition`
8484
<!-- YAML
8585
added: v14.9.0
8686
-->
8787

8888
> Stability: 1 - Experimental
8989
90-
Enable experimental support for custom conditional exports resolution
90+
Enable experimental support for custom [conditional exports][] resolution
9191
conditions.
9292

9393
Any number of custom string condition names are permitted.
9494

9595
The default Node.js conditions of `"node"`, `"default"`, `"import"`, and
9696
`"require"` will always apply as defined.
9797

98+
For example, to run a module with "development" resolutions:
99+
100+
```console
101+
$ node -C=development app.js
102+
```
103+
98104
### `--cpu-prof`
99105
<!-- YAML
100106
added: v12.0.0
@@ -1259,7 +1265,7 @@ node --require "./a.js" --require "./b.js"
12591265

12601266
Node.js options that are allowed are:
12611267
<!-- node-options-node start -->
1262-
* `--conditions`
1268+
* `--conditions`, `-C`
12631269
* `--diagnostic-dir`
12641270
* `--disable-proto`
12651271
* `--enable-fips`
@@ -1620,6 +1626,7 @@ $ node --max-old-space-size=1536 index.js
16201626
[`tls.DEFAULT_MIN_VERSION`]: tls.md#tls_tls_default_min_version
16211627
[`unhandledRejection`]: process.md#process_event_unhandledrejection
16221628
[`worker_threads.threadId`]: worker_threads.md#worker_threads_worker_threadid
1629+
[conditional exports]: packages.md#packages_conditional_exports
16231630
[context-aware]: addons.md#addons_context_aware_addons
16241631
[customizing ESM specifier resolution]: esm.md#esm_customizing_esm_specifier_resolution_algorithm
16251632
[debugger]: debugger.md
Collapse file

‎doc/node.1‎

Copy file name to clipboardExpand all lines: doc/node.1
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Aborting instead of exiting causes a core file to be generated for analysis.
7878
.It Fl -completion-bash
7979
Print source-able bash completion script for Node.js.
8080
.
81-
.It Fl -conditions Ar string
81+
.It Fl C , Fl -conditions Ar string
8282
Use custom conditional exports conditions.
8383
.Ar string
8484
.
Collapse file

‎src/node_options.cc‎

Copy file name to clipboardExpand all lines: src/node_options.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
272272
"additional user conditions for conditional exports and imports",
273273
&EnvironmentOptions::conditions,
274274
kAllowedInEnvironment);
275+
AddAlias("-C", "--conditions");
275276
AddOption("--diagnostic-dir",
276277
"set dir for all output files"
277278
" (default: current working directory)",
Collapse file

‎test/es-module/test-esm-custom-exports.mjs‎

Copy file name to clipboardExpand all lines: test/es-module/test-esm-custom-exports.mjs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Flags: --conditions=custom-condition --conditions another
1+
// Flags: --conditions=custom-condition -C another
22
import { mustCall } from '../common/index.mjs';
33
import { strictEqual } from 'assert';
44
import { requireFixture, importFixture } from '../fixtures/pkgexports.mjs';
Collapse file

‎test/parallel/test-process-env-allowed-flags.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-process-env-allowed-flags.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const assert = require('assert');
5151
// Assert all "canonical" flags begin with dash(es)
5252
{
5353
process.allowedNodeEnvironmentFlags.forEach((flag) => {
54-
assert(/^--?[a-z0-9._-]+$/.test(flag),
54+
assert(/^--?[a-zA-Z0-9._-]+$/.test(flag),
5555
`Unexpected format for flag ${flag}`);
5656
});
5757
}

0 commit comments

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