mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 19:08:15 +00:00
feat: stabilize --node-conditions flag (#29628)
Stabilizes `--conditions` flag added in https://github.com/denoland/deno/pull/29586. Closes https://github.com/denoland/deno/issues/23757
This commit is contained in:
parent
7554b28a04
commit
9913311860
3 changed files with 12 additions and 11 deletions
|
@ -4636,9 +4636,11 @@ fn lock_args() -> [Arg; 3] {
|
|||
}
|
||||
|
||||
fn node_conditions_arg() -> Arg {
|
||||
Arg::new("unstable-conditions")
|
||||
.long("unstable-conditions")
|
||||
.help("Use this argument to specify custom conditions for npm package exports. You can also use DENO_CONDITIONS env var.")
|
||||
Arg::new("conditions")
|
||||
.long("conditions")
|
||||
.help("Use this argument to specify custom conditions for npm package exports. You can also use DENO_CONDITIONS env var.
|
||||
|
||||
Docs: https://docs.deno.com/go/conditional-exports")
|
||||
.use_value_delimiter(true)
|
||||
.action(ArgAction::Append)
|
||||
}
|
||||
|
@ -6330,8 +6332,7 @@ fn lock_args_parse(flags: &mut Flags, matches: &mut ArgMatches) {
|
|||
}
|
||||
|
||||
fn node_conditions_args_parse(flags: &mut Flags, matches: &mut ArgMatches) {
|
||||
if let Some(conditions) = matches.remove_many::<String>("unstable-conditions")
|
||||
{
|
||||
if let Some(conditions) = matches.remove_many::<String>("conditions") {
|
||||
flags.node_conditions = conditions.collect();
|
||||
}
|
||||
}
|
||||
|
@ -12615,7 +12616,7 @@ Usage: deno repl [OPTIONS] [-- [ARGS]...]\n"
|
|||
let flags = flags_from_vec(svec![
|
||||
"deno",
|
||||
"run",
|
||||
"--unstable-conditions",
|
||||
"--conditions",
|
||||
"development",
|
||||
"main.ts"
|
||||
])
|
||||
|
@ -12636,7 +12637,7 @@ Usage: deno repl [OPTIONS] [-- [ARGS]...]\n"
|
|||
let flags = flags_from_vec(svec![
|
||||
"deno",
|
||||
"run",
|
||||
"--unstable-conditions",
|
||||
"--conditions",
|
||||
"development,production",
|
||||
"main.ts"
|
||||
])
|
||||
|
@ -12657,9 +12658,9 @@ Usage: deno repl [OPTIONS] [-- [ARGS]...]\n"
|
|||
let flags = flags_from_vec(svec![
|
||||
"deno",
|
||||
"run",
|
||||
"--unstable-conditions",
|
||||
"--conditions",
|
||||
"development",
|
||||
"--unstable-conditions",
|
||||
"--conditions",
|
||||
"production",
|
||||
"main.ts"
|
||||
])
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"output": "no_condition.out"
|
||||
},
|
||||
{
|
||||
"args": "run --unstable-conditions react-server -A main.js",
|
||||
"args": "run --conditions react-server -A main.js",
|
||||
"output": "condition.out",
|
||||
"exitCode": 1
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"args": "run --unstable-conditions some-condition main.cjs",
|
||||
"args": "run --conditions some-condition main.cjs",
|
||||
"output": "good\n"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue