summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-05-19 18:39:27 -0400
committerGitHub <noreply@github.com>2023-05-19 22:39:27 +0000
commitcc406c8360b4ba559d7f13e14d2a32e1ab761b0d (patch)
treea2cfae5c7f082261aa504b2f00fe6f53f4626dfe /cli/args/flags.rs
parent7f5290b6946fececec5ec3acd85e67cd16960b8e (diff)
feat(vendor): support for npm specifiers (#19186)
We never properly added support for this. This fixes vendoring when it has npm or node specifiers. Vendoring occurs by adding a `"nodeModulesDir": true` property to deno.json then it uses a local node_modules directory. This can be opted out by setting `"nodeModulesDir": false` or running with `--node-modules-dir=false`. Closes #18090 Closes #17210 Closes #17619 Closes #16778
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r--cli/args/flags.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 63ec2b947..c4d8a3f87 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -1343,7 +1343,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
.arg(lock_arg())
.arg(config_arg())
.arg(import_map_arg())
- .arg(local_npm_arg())
+ .arg(node_modules_dir_arg())
.arg(
Arg::new("json")
.long("json")
@@ -1862,6 +1862,7 @@ Remote modules and multiple modules may also be specified:
.arg(config_arg())
.arg(import_map_arg())
.arg(lock_arg())
+ .arg(node_modules_dir_arg())
.arg(reload_arg())
.arg(ca_file_arg())
}
@@ -1875,7 +1876,7 @@ fn compile_args_without_check_args(app: Command) -> Command {
.arg(import_map_arg())
.arg(no_remote_arg())
.arg(no_npm_arg())
- .arg(local_npm_arg())
+ .arg(node_modules_dir_arg())
.arg(config_arg())
.arg(no_config_arg())
.arg(reload_arg())
@@ -2424,7 +2425,7 @@ fn no_npm_arg() -> Arg {
.help("Do not resolve npm modules")
}
-fn local_npm_arg() -> Arg {
+fn node_modules_dir_arg() -> Arg {
Arg::new("node-modules-dir")
.long("node-modules-dir")
.num_args(0..=1)
@@ -2719,7 +2720,7 @@ fn info_parse(flags: &mut Flags, matches: &mut ArgMatches) {
import_map_arg_parse(flags, matches);
location_arg_parse(flags, matches);
ca_file_arg_parse(flags, matches);
- local_npm_args_parse(flags, matches);
+ node_modules_dir_arg_parse(flags, matches);
lock_arg_parse(flags, matches);
no_lock_arg_parse(flags, matches);
no_remote_arg_parse(flags, matches);
@@ -2975,6 +2976,7 @@ fn vendor_parse(flags: &mut Flags, matches: &mut ArgMatches) {
config_args_parse(flags, matches);
import_map_arg_parse(flags, matches);
lock_arg_parse(flags, matches);
+ node_modules_dir_arg_parse(flags, matches);
reload_arg_parse(flags, matches);
flags.subcommand = DenoSubcommand::Vendor(VendorFlags {
@@ -3000,7 +3002,7 @@ fn compile_args_without_check_parse(
import_map_arg_parse(flags, matches);
no_remote_arg_parse(flags, matches);
no_npm_arg_parse(flags, matches);
- local_npm_args_parse(flags, matches);
+ node_modules_dir_arg_parse(flags, matches);
config_args_parse(flags, matches);
reload_arg_parse(flags, matches);
lock_args_parse(flags, matches);
@@ -3254,7 +3256,7 @@ fn no_npm_arg_parse(flags: &mut Flags, matches: &mut ArgMatches) {
}
}
-fn local_npm_args_parse(flags: &mut Flags, matches: &mut ArgMatches) {
+fn node_modules_dir_arg_parse(flags: &mut Flags, matches: &mut ArgMatches) {
flags.node_modules_dir = matches.remove_one::<bool>("node-modules-dir");
}