Skip to content

Commit

Permalink
Use PathBuf for DenoSubcommand::Bundle's out_file
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn committed Feb 10, 2020
1 parent e8f639c commit eb5ce24
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions cli/compilers/ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ fn req(
request_type: msg::CompilerRequestType,
root_names: Vec<String>,
compiler_config: CompilerConfig,
out_file: Option<String>,
out_file: Option<PathBuf>,
target: &str,
bundle: bool,
) -> Buf {
Expand Down Expand Up @@ -271,7 +271,7 @@ impl TsCompiler {
&self,
global_state: GlobalState,
module_name: String,
out_file: Option<String>,
out_file: Option<PathBuf>,
) -> Result<(), ErrBox> {
debug!(
"Invoking the compiler to bundle. module_name: {}",
Expand Down Expand Up @@ -743,7 +743,7 @@ mod tests {
.bundle_async(
state.clone(),
module_name,
Some(String::from("$deno$/bundle.js")),
Some(PathBuf::from("$deno$/bundle.js")),
)
.await;
assert!(result.is_ok());
Expand Down
8 changes: 4 additions & 4 deletions cli/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use clap::ArgMatches;
use clap::SubCommand;
use log::Level;
use std::collections::HashSet;
use std::path::Path;
use std::path::{Path, PathBuf};

/// Creates vector of strings, Vec<String>
macro_rules! svec {
Expand Down Expand Up @@ -35,7 +35,7 @@ const TEST_RUNNER_URL: &str = std_url!("testing/runner.ts");
pub enum DenoSubcommand {
Bundle {
source_file: String,
out_file: Option<String>,
out_file: Option<PathBuf>,
},
Completions {
buf: Box<[u8]>,
Expand Down Expand Up @@ -347,7 +347,7 @@ fn bundle_parse(flags: &mut DenoFlags, matches: &clap::ArgMatches) {

let out_file = if let Some(out_file) = matches.value_of("out_file") {
flags.allow_write = true;
Some(out_file.to_string())
Some(PathBuf::from(out_file))
} else {
None
};
Expand Down Expand Up @@ -1677,7 +1677,7 @@ mod tests {
DenoFlags {
subcommand: DenoSubcommand::Bundle {
source_file: "source.ts".to_string(),
out_file: Some("bundle.js".to_string()),
out_file: Some(PathBuf::from("bundle.js")),
},
allow_write: true,
..DenoFlags::default()
Expand Down
3 changes: 2 additions & 1 deletion cli/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ use log::Level;
use log::Metadata;
use log::Record;
use std::env;
use std::path::PathBuf;

static LOGGER: Logger = Logger;

Expand Down Expand Up @@ -331,7 +332,7 @@ async fn eval_command(flags: DenoFlags, code: String) {
async fn bundle_command(
flags: DenoFlags,
source_file: String,
out_file: Option<String>,
out_file: Option<PathBuf>,
) {
debug!(">>>>> bundle_async START");
let source_file_specifier =
Expand Down

0 comments on commit eb5ce24

Please sign in to comment.