From 03c55b497035001cba77b0ddd8b22f0f9c25190d Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 24 Feb 2022 18:58:00 +0530 Subject: fix(compile): Support import maps (#13756) --- cli/main.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'cli/main.rs') 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 { 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()); -- cgit v1.2.3