summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-07-16 10:53:07 +0200
committerGitHub <noreply@github.com>2020-07-16 10:53:07 +0200
commit98e0ed54db5bbd8befcb5afbb1d63f2b80677f51 (patch)
tree7f8ab9b27a75840ed08ea6d4c33576f1886b3c6d /cli
parentb0f2bd4a2d1a75d7c8e4643a4b5b9478c1935668 (diff)
fix: ModuleSpecifier removes relative path parts (#6762)
Diffstat (limited to 'cli')
-rw-r--r--cli/fs.rs2
-rw-r--r--cli/main.rs11
2 files changed, 3 insertions, 10 deletions
diff --git a/cli/fs.rs b/cli/fs.rs
index 83dec4913..2aedf1e34 100644
--- a/cli/fs.rs
+++ b/cli/fs.rs
@@ -46,6 +46,8 @@ pub fn write_file_2<T: AsRef<[u8]>>(
file.write_all(data.as_ref())
}
+/// IMPORTANT: This method is duplicated in core/module_specifier.rs
+///
/// Normalize all itermediate components of the path (ie. remove "./" and "../" components).
/// Similar to `fs::canonicalize()` but doesn't resolve symlinks.
///
diff --git a/cli/main.rs b/cli/main.rs
index 088d65ecd..cf25ed324 100644
--- a/cli/main.rs
+++ b/cli/main.rs
@@ -440,16 +440,7 @@ async fn bundle_command(
source_file: String,
out_file: Option<PathBuf>,
) -> Result<(), ErrBox> {
- let mut module_specifier =
- ModuleSpecifier::resolve_url_or_path(&source_file)?;
- let url = module_specifier.as_url();
-
- // TODO(bartlomieju): fix this hack in ModuleSpecifier
- if url.scheme() == "file" {
- let a = deno_fs::normalize_path(&url.to_file_path().unwrap());
- let u = Url::from_file_path(a).unwrap();
- module_specifier = ModuleSpecifier::from(u)
- }
+ let module_specifier = ModuleSpecifier::resolve_url_or_path(&source_file)?;
debug!(">>>>> bundle START");
let global_state = GlobalState::new(flags)?;