From 93cf3bd5341d5985201ea0905280082d5a3310f9 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Fri, 8 May 2020 03:39:00 +0900 Subject: feat: format deno bundle output (#5139) --- cli/compilers/ts.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cli/compilers/ts.rs') diff --git a/cli/compilers/ts.rs b/cli/compilers/ts.rs index 77297713e..db4313927 100644 --- a/cli/compilers/ts.rs +++ b/cli/compilers/ts.rs @@ -7,6 +7,7 @@ use crate::diagnostics::DiagnosticItem; use crate::disk_cache::DiskCache; use crate::file_fetcher::SourceFile; use crate::file_fetcher::SourceFileFetcher; +use crate::fmt; use crate::fs as deno_fs; use crate::global_state::GlobalState; use crate::msg; @@ -343,17 +344,19 @@ impl TsCompiler { return Err(ErrBox::from(bundle_response.diagnostics)); } + let output_string = fmt::format_text(&bundle_response.bundle_output)?; + if let Some(out_file_) = out_file.as_ref() { eprintln!("Emitting bundle to {:?}", out_file_); - let output_bytes = bundle_response.bundle_output.as_bytes(); + let output_bytes = output_string.as_bytes(); let output_len = output_bytes.len(); deno_fs::write_file(out_file_, output_bytes, 0o666)?; // TODO(bartlomieju): add "humanFileSize" method eprintln!("{} bytes emmited.", output_len); } else { - println!("{}", bundle_response.bundle_output); + println!("{}", output_string); } Ok(()) -- cgit v1.2.3