summaryrefslogtreecommitdiff
path: root/cli/args/flags.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r--cli/args/flags.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 0b1ba8c50..9650b9612 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -83,6 +83,7 @@ pub struct CompileFlags {
pub output: Option<PathBuf>,
pub args: Vec<String>,
pub target: Option<String>,
+ pub include: Vec<String>,
}
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -909,6 +910,20 @@ fn compile_subcommand<'a>() -> Command<'a> {
.trailing_var_arg(true)
.arg(script_arg().required(true))
.arg(
+ Arg::new("include")
+ .long("include")
+ .help("UNSTABLE: Additional module to include in the module graph")
+ .long_help(
+ "Includes an additional module in the compiled executable's module \
+ graph. Use this flag if a dynamically imported module or a web worker main \
+ module fails to load in the executable. This flag can be passed multiple \
+ times, to include multiple additional modules.",
+ )
+ .takes_value(true)
+ .multiple_occurrences(true)
+ .value_hint(ValueHint::FilePath),
+ )
+ .arg(
Arg::new("output")
.long("output")
.short('o')
@@ -2486,12 +2501,17 @@ fn compile_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
let source_file = script[0].to_string();
let output = matches.value_of("output").map(PathBuf::from);
let target = matches.value_of("target").map(String::from);
+ let include = match matches.values_of("include") {
+ Some(f) => f.map(String::from).collect(),
+ None => vec![],
+ };
flags.subcommand = DenoSubcommand::Compile(CompileFlags {
source_file,
output,
args,
target,
+ include,
});
}
@@ -6242,6 +6262,7 @@ mod tests {
output: None,
args: vec![],
target: None,
+ include: vec![]
}),
type_check_mode: TypeCheckMode::Local,
..Flags::default()
@@ -6261,6 +6282,7 @@ mod tests {
output: Some(PathBuf::from("colors")),
args: svec!["foo", "bar"],
target: None,
+ include: vec![]
}),
import_map_path: Some("import_map.json".to_string()),
no_remote: true,