mirror of
https://github.com/denoland/deno.git
synced 2025-10-01 22:51:14 +00:00
fix(deno install): support file:
scheme URLs (#10562)
This commit is contained in:
parent
44cd0b1ef6
commit
7a751b8135
2 changed files with 54 additions and 39 deletions
|
@ -11,7 +11,6 @@ use crate::module_graph;
|
|||
use crate::program_state::ProgramState;
|
||||
use crate::tokio_util;
|
||||
use crate::tools::coverage::CoverageCollector;
|
||||
use crate::tools::installer::is_remote_url;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::futures::future;
|
||||
use deno_core::futures::stream;
|
||||
|
@ -226,6 +225,11 @@ pub(crate) fn is_supported(p: &Path) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_remote_url(module_url: &str) -> bool {
|
||||
let lower = module_url.to_lowercase();
|
||||
lower.starts_with("http://") || lower.starts_with("https://")
|
||||
}
|
||||
|
||||
pub fn collect_test_module_specifiers<P>(
|
||||
include: Vec<String>,
|
||||
root_path: &Path,
|
||||
|
@ -642,4 +646,14 @@ mod tests {
|
|||
.collect();
|
||||
assert_eq!(matched_urls, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_remote_url() {
|
||||
assert!(is_remote_url("https://deno.land/std/http/file_server.ts"));
|
||||
assert!(is_remote_url("http://deno.land/std/http/file_server.ts"));
|
||||
assert!(is_remote_url("HTTP://deno.land/std/http/file_server.ts"));
|
||||
assert!(is_remote_url("HTTp://deno.land/std/http/file_server.ts"));
|
||||
assert!(!is_remote_url("file:///dev/deno_std/http/file_server.ts"));
|
||||
assert!(!is_remote_url("./dev/deno_std/http/file_server.ts"));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue