summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2022-02-24 18:58:00 +0530
committerGitHub <noreply@github.com>2022-02-24 18:58:00 +0530
commit03c55b497035001cba77b0ddd8b22f0f9c25190d (patch)
treee4fded4e37329d5e56a79e1a3f49e5030c611ccf /cli/main.rs
parent3e8180c793f1dd7437a497ffdb0cf7e919a9a5c3 (diff)
fix(compile): Support import maps (#13756)
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/cli/main.rs b/cli/main.rs
index 091c33b13..16f7d6b9b 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -396,19 +396,21 @@ async fn compile_command(
) -> Result<i32, AnyError> {
let debug = flags.log_level == Some(log::Level::Debug);
- let run_flags =
- tools::standalone::compile_to_runtime_flags(&flags, compile_flags.args)?;
+ let run_flags = tools::standalone::compile_to_runtime_flags(
+ &flags,
+ compile_flags.args.clone(),
+ )?;
let module_specifier = resolve_url_or_path(&compile_flags.source_file)?;
let ps = ProcState::build(Arc::new(flags)).await?;
let deno_dir = &ps.dir;
- let output = compile_flags.output.and_then(|output| {
- if fs_util::path_has_trailing_slash(&output) {
+ let output = compile_flags.output.as_ref().and_then(|output| {
+ if fs_util::path_has_trailing_slash(output) {
let infer_file_name = infer_name_from_url(&module_specifier).map(PathBuf::from)?;
Some(output.join(infer_file_name))
} else {
- Some(output)
+ Some(output.to_path_buf())
}
}).or_else(|| {
infer_name_from_url(&module_specifier).map(PathBuf::from)
@@ -423,6 +425,8 @@ async fn compile_command(
generic_error("There should only be one reference to ModuleGraph")
})?;
+ graph.valid().unwrap();
+
let eszip = eszip::EszipV2::from_graph(graph, Default::default())?;
info!(
@@ -441,7 +445,9 @@ async fn compile_command(
eszip,
module_specifier.clone(),
run_flags,
- )?;
+ ps,
+ )
+ .await?;
info!("{} {}", colors::green("Emit"), output.display());