summaryrefslogtreecommitdiff
path: root/cli/flags.rs
diff options
context:
space:
mode:
authorBert Belder <bertbelder@gmail.com>2019-07-08 23:04:07 +0200
committerBert Belder <bertbelder@gmail.com>2019-07-08 23:04:07 +0200
commitf4c9b314056b002a01ac0bd5fc33f6503aba5ab2 (patch)
treefe766a63210f83aa4aa8e38cb982630e36fc3420 /cli/flags.rs
parent72d9045528ad69ec32d7de9707cea65fab9f405e (diff)
core: replace ModuleSpecifier::to_url() by as_url()
Diffstat (limited to 'cli/flags.rs')
-rw-r--r--cli/flags.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index b3fc11380..62cd8b7a4 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -6,6 +6,7 @@ use clap::ArgMatches;
use clap::Shell;
use clap::SubCommand;
use crate::deno_dir;
+use deno::ModuleSpecifier;
use log::Level;
use std;
use std::str;
@@ -629,14 +630,11 @@ pub enum DenoSubcommand {
}
fn get_default_bundle_filename(source_file: &str) -> String {
- use deno::ModuleSpecifier;
- let url = ModuleSpecifier::resolve_url_or_path(source_file)
- .unwrap()
- .to_url();
- let path_segments = url.path_segments().unwrap();
- let last = path_segments.last().unwrap();
- String::from(last.trim_end_matches(".ts").trim_end_matches(".js"))
- + ".bundle.js"
+ let specifier = ModuleSpecifier::resolve_url_or_path(source_file).unwrap();
+ let path_segments = specifier.as_url().path_segments().unwrap();
+ let file_name = path_segments.last().unwrap();
+ let file_stem = file_name.trim_end_matches(".ts").trim_end_matches(".js");
+ format!("{}.bundle.js", file_stem)
}
#[test]