summaryrefslogtreecommitdiff
path: root/cli/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/main.rs')
-rw-r--r--cli/main.rs78
1 files changed, 38 insertions, 40 deletions
diff --git a/cli/main.rs b/cli/main.rs
index c1873ebf1..cfce2254b 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -49,9 +49,9 @@ use crate::worker::Worker;
use deno::v8_set_flags;
use flags::DenoFlags;
use flags::DenoSubcommand;
+use futures::future;
use futures::lazy;
use futures::Future;
-use futures::future;
use log::{LevelFilter, Metadata, Record};
use std::env;
@@ -97,51 +97,48 @@ pub fn print_file_info(
worker: Worker,
url: &str,
) -> impl Future<Item = Worker, Error = ()> {
- worker::fetch_module_meta_data_and_maybe_compile_async(
- &worker.state,
- url,
- ".",
- ).and_then(move |out| {
- println!("{} {}", ansi::bold("local:".to_string()), &(out.filename));
-
- println!(
- "{} {}",
- ansi::bold("type:".to_string()),
- msg::enum_name_media_type(out.media_type)
- );
-
- if out.maybe_output_code_filename.is_some() {
- println!(
- "{} {}",
- ansi::bold("compiled:".to_string()),
- out.maybe_output_code_filename.as_ref().unwrap(),
- );
- }
+ state::fetch_module_meta_data_and_maybe_compile_async(&worker.state, url, ".")
+ .and_then(move |out| {
+ println!("{} {}", ansi::bold("local:".to_string()), &(out.filename));
- if out.maybe_source_map_filename.is_some() {
println!(
"{} {}",
- ansi::bold("map:".to_string()),
- out.maybe_source_map_filename.as_ref().unwrap()
+ ansi::bold("type:".to_string()),
+ msg::enum_name_media_type(out.media_type)
);
- }
- let modules = worker.modules.lock().unwrap();
- if let Some(deps) = worker.modules.deps(&out.module_name) {
- println!("{}{}", ansi::bold("deps:\n".to_string()), deps.name);
- if let Some(ref depsdeps) = deps.deps {
- for d in depsdeps {
- println!("{}", d);
+ if out.maybe_output_code_filename.is_some() {
+ println!(
+ "{} {}",
+ ansi::bold("compiled:".to_string()),
+ out.maybe_output_code_filename.as_ref().unwrap(),
+ );
+ }
+
+ if out.maybe_source_map_filename.is_some() {
+ println!(
+ "{} {}",
+ ansi::bold("map:".to_string()),
+ out.maybe_source_map_filename.as_ref().unwrap()
+ );
+ }
+
+ if let Some(deps) = worker.modules.lock().unwrap().deps(&out.module_name)
+ {
+ println!("{}{}", ansi::bold("deps:\n".to_string()), deps.name);
+ if let Some(ref depsdeps) = deps.deps {
+ for d in depsdeps {
+ println!("{}", d);
+ }
}
+ } else {
+ println!(
+ "{} cannot retrieve full dependency graph",
+ ansi::bold("deps:".to_string()),
+ );
}
- } else {
- println!(
- "{} cannot retrieve full dependency graph",
- ansi::bold("deps:".to_string()),
- );
- }
- Ok(worker)
- }).map_err(|err| println!("{}", err))
+ Ok(worker)
+ }).map_err(|err| println!("{}", err))
}
fn create_worker_and_state(
@@ -196,6 +193,7 @@ fn fetch_or_info_command(
worker
.execute_mod_async(&main_url, true)
+ .map_err(print_err_and_exit)
.and_then(move |()| {
if print_info {
future::Either::A(print_file_info(worker, &main_module))
@@ -207,7 +205,7 @@ fn fetch_or_info_command(
js_check(result);
Ok(())
})
- }).map_err(print_err_and_exit)
+ })
});
tokio_util::run(main_future);
}