@@ -15,14 +15,6 @@ use vite_str::Str;
1515
1616use crate :: { Error , provider:: ArchiveFormat } ;
1717
18- #[ cfg( not( target_os = "windows" ) ) ]
19- fn ensure_tls_provider ( ) {
20- static INIT : std:: sync:: OnceLock < ( ) > = std:: sync:: OnceLock :: new ( ) ;
21- INIT . get_or_init ( || {
22- let _ = rustls:: crypto:: ring:: default_provider ( ) . install_default ( ) ;
23- } ) ;
24- }
25-
2618/// Response from a cached fetch operation
2719pub struct CachedFetchResponse {
2820 /// Response body (None if 304 Not Modified)
@@ -45,7 +37,7 @@ pub async fn download_file(
4537 target_path : & AbsolutePath ,
4638 message : & str ,
4739) -> Result < ( ) , Error > {
48- ensure_tls_provider ( ) ;
40+ vite_shared :: ensure_tls_provider ( ) ;
4941
5042 tracing:: debug!( "Downloading {url} to {target_path:?}" ) ;
5143
@@ -124,7 +116,7 @@ pub async fn download_file(
124116/// Download text content from a URL with retry logic
125117#[ expect( clippy:: disallowed_types, reason = "HTTP response body is a String" ) ]
126118pub async fn download_text ( url : & str ) -> Result < String , Error > {
127- ensure_tls_provider ( ) ;
119+ vite_shared :: ensure_tls_provider ( ) ;
128120
129121 tracing:: debug!( "Downloading text from {url}" ) ;
130122
@@ -149,7 +141,7 @@ pub async fn fetch_with_cache_headers(
149141 url : & str ,
150142 if_none_match : Option < & str > ,
151143) -> Result < CachedFetchResponse , Error > {
152- ensure_tls_provider ( ) ;
144+ vite_shared :: ensure_tls_provider ( ) ;
153145
154146 tracing:: debug!( "Fetching with cache headers from {url}" ) ;
155147
0 commit comments