From c497e766f1a136c674d8be2467eb103c85fe1d44 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 18 Apr 2024 21:43:28 -0400 Subject: refactor: move redirect handling into deno_graph (#23444) --- cli/lsp/config.rs | 2 +- cli/lsp/jsr.rs | 2 +- cli/lsp/npm.rs | 2 +- cli/lsp/registries.rs | 11 +++++------ 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'cli/lsp') diff --git a/cli/lsp/config.rs b/cli/lsp/config.rs index 15bd93ced..ec736f365 100644 --- a/cli/lsp/config.rs +++ b/cli/lsp/config.rs @@ -1393,7 +1393,7 @@ impl ConfigData { if import_map_value.is_none() { if let Some(file_fetcher) = file_fetcher { let fetch_result = file_fetcher - .fetch(specifier, PermissionsContainer::allow_all()) + .fetch(specifier, &PermissionsContainer::allow_all()) .await; let value_result = fetch_result.and_then(|f| { serde_json::from_slice::(&f.source).map_err(|e| e.into()) diff --git a/cli/lsp/jsr.rs b/cli/lsp/jsr.rs index a9c35aad6..ca0dae958 100644 --- a/cli/lsp/jsr.rs +++ b/cli/lsp/jsr.rs @@ -51,7 +51,7 @@ impl PackageSearchApi for CliJsrSearchApi { search_url.query_pairs_mut().append_pair("query", query); let file = self .file_fetcher - .fetch(&search_url, PermissionsContainer::allow_all()) + .fetch(&search_url, &PermissionsContainer::allow_all()) .await? .into_text_decoded()?; let names = Arc::new(parse_jsr_search_response(&file.source)?); diff --git a/cli/lsp/npm.rs b/cli/lsp/npm.rs index 33cf48675..830aaed95 100644 --- a/cli/lsp/npm.rs +++ b/cli/lsp/npm.rs @@ -48,7 +48,7 @@ impl PackageSearchApi for CliNpmSearchApi { .append_pair("text", &format!("{} boost-exact:false", query)); let file = self .file_fetcher - .fetch(&search_url, PermissionsContainer::allow_all()) + .fetch(&search_url, &PermissionsContainer::allow_all()) .await? .into_text_decoded()?; let names = Arc::new(parse_npm_search_response(&file.source)?); diff --git a/cli/lsp/registries.rs b/cli/lsp/registries.rs index b0eeb9df0..a145322b5 100644 --- a/cli/lsp/registries.rs +++ b/cli/lsp/registries.rs @@ -512,10 +512,9 @@ impl ModuleRegistry { .file_fetcher .fetch_with_options(FetchOptions { specifier, - permissions: PermissionsContainer::allow_all(), + permissions: &PermissionsContainer::allow_all(), maybe_accept: Some("application/vnd.deno.reg.v2+json, application/vnd.deno.reg.v1+json;q=0.9, application/json;q=0.8"), maybe_cache_setting: None, - maybe_checksum: None, }) .await; // if there is an error fetching, we will cache an empty file, so that @@ -609,7 +608,7 @@ impl ModuleRegistry { .ok()?; let file = self .file_fetcher - .fetch(&endpoint, PermissionsContainer::allow_all()) + .fetch(&endpoint, &PermissionsContainer::allow_all()) .await .ok()? .into_text_decoded() @@ -975,7 +974,7 @@ impl ModuleRegistry { let specifier = Url::parse(url).ok()?; let file = self .file_fetcher - .fetch(&specifier, PermissionsContainer::allow_all()) + .fetch(&specifier, &PermissionsContainer::allow_all()) .await .ok()? .into_text_decoded() @@ -1034,7 +1033,7 @@ impl ModuleRegistry { let specifier = ModuleSpecifier::parse(url).ok()?; let file = self .file_fetcher - .fetch(&specifier, PermissionsContainer::allow_all()) + .fetch(&specifier, &PermissionsContainer::allow_all()) .await .map_err(|err| { error!( @@ -1072,7 +1071,7 @@ impl ModuleRegistry { .ok()?; let file = self .file_fetcher - .fetch(&specifier, PermissionsContainer::allow_all()) + .fetch(&specifier, &PermissionsContainer::allow_all()) .await .map_err(|err| { error!( -- cgit v1.2.3