From e00e3abd84fa3754b7e9ee7c2d02b2faeeb7cb49 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:56:52 +0800 Subject: [PATCH] chore(deps): update rust crates (major) (#8739) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [oxc_resolver](https://redirect.github.com/oxc-project/oxc-resolver) | workspace.dependencies | major | `3` -> `4` | | [ureq](https://redirect.github.com/algesten/ureq) | workspace.dependencies | major | `2.12.1` -> `3.0.0` | --- ### Release Notes
oxc-project/oxc-resolver (oxc_resolver) ### [`v4.0.0`](https://redirect.github.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#400---2025-01-20) [Compare Source](https://redirect.github.com/oxc-project/oxc-resolver/compare/oxc_resolver-v3.0.3...oxc_resolver-v4.0.0) ##### Features - \[**breaking**] generic fs cache `type Resolver = ResolverGeneric>` ([#​358](https://redirect.github.com/oxc-project/oxc-resolver/issues/358)) - \[**breaking**] `PackageJson` and `TsConfig` traits ([#​360](https://redirect.github.com/oxc-project/oxc-resolver/issues/360)) ##### Performance - use papaya instead of dashmap ([#​356](https://redirect.github.com/oxc-project/oxc-resolver/issues/356))
algesten/ureq (ureq) ### [`v3.0.0`](https://redirect.github.com/algesten/ureq/blob/HEAD/CHANGELOG.md#300) [Compare Source](https://redirect.github.com/algesten/ureq/compare/2.12.1...3.0.0) - Replace RequestBuilder Deref with explicit wrappers ([#​944](https://redirect.github.com/algesten/ureq/issues/944)) - Remove dependency on `url` crate ([#​943](https://redirect.github.com/algesten/ureq/issues/943)) - Feature `Config::save_redirect_history` ([#​939](https://redirect.github.com/algesten/ureq/issues/939))
--- ### Configuration 📅 **Schedule**: Branch creation - "on monday" in timezone Asia/Shanghai, Automerge - "on monday" in timezone Asia/Shanghai. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc). --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Boshen Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- Cargo.lock | 148 ++++++++++++++++--- Cargo.toml | 6 +- tasks/common/Cargo.toml | 2 +- tasks/common/src/request.rs | 40 +++-- tasks/common/src/test_file.rs | 4 +- tasks/coverage/src/runtime/mod.rs | 8 +- tasks/coverage/src/runtime/test262_status.rs | 6 +- tasks/javascript_globals/src/main.rs | 2 +- tasks/rulegen/Cargo.toml | 1 - tasks/rulegen/src/main.rs | 6 +- 10 files changed, 165 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7819c4d95f613..381520a8f464d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -333,6 +333,35 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "cookie" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "cookie_store" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9" +dependencies = [ + "cookie", + "document-features", + "idna", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "time", + "url", +] + [[package]] name = "cow-utils" version = "0.1.3" @@ -550,6 +579,15 @@ dependencies = [ "syn", ] +[[package]] +name = "document-features" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6969eaabd2421f8a2775cfd2471a2b634372b4a25d41e3bd647b79912850a0" +dependencies = [ + "litrs", +] + [[package]] name = "dyn-clone" version = "1.0.17" @@ -864,6 +902,17 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "http" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f16ca2af56261c99fba8bac40a10251ce8188205a4c448fbb745a2e4daa76fea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "httparse" version = "1.9.5" @@ -1204,6 +1253,12 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" + [[package]] name = "lock_api" version = "0.4.12" @@ -1273,12 +1328,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.8.2" @@ -1355,12 +1404,11 @@ dependencies = [ [[package]] name = "nom" -version = "7.1.3" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" dependencies = [ "memchr", - "minimal-lexical", ] [[package]] @@ -1489,9 +1537,9 @@ dependencies = [ [[package]] name = "oxc-browserslist" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b585351ba1b93f0bf9683df23285cc0978ec35a6e3074794815756086770c14" +checksum = "ba2705c663f10d23e2c1600ef89834a979afc1756a88197061bdbb275c608cd1" dependencies = [ "js-sys", "nom", @@ -2008,16 +2056,17 @@ dependencies = [ [[package]] name = "oxc_resolver" -version = "3.0.3" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bed381b6ab4bbfebfc7a011ad43b110ace8d201d02a39c0e09855f16b8f3f741" +checksum = "d0f82c2be3d07b2ac002fb4a414d6fab602b352a8d99ed9b59f6868a968c73ba" dependencies = [ "cfg-if", - "dashmap 6.1.0", "indexmap", "json-strip-comments", "once_cell", + "papaya", "rustc-hash", + "seize", "serde", "serde_json", "simdutf8", @@ -2236,6 +2285,16 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "papaya" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc7c76487f7eaa00a0fc1d7f88dc6b295aec478d11b0fc79f857b62c2874124c" +dependencies = [ + "equivalent", + "seize", +] + [[package]] name = "parking_lot" version = "0.12.3" @@ -2553,7 +2612,6 @@ dependencies = [ "regex", "rustc-hash", "serde", - "ureq", ] [[package]] @@ -2605,6 +2663,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.10.1" @@ -2702,6 +2769,16 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "seize" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d84b0c858bdd30cb56f5597f8b3bf702ec23829e652cc636a1e5a7b9de46ae93" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "self_cell" version = "1.1.0" @@ -3067,11 +3144,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21" dependencies = [ "deranged", + "itoa", "js-sys", "num-conv", "powerfmt", "serde", "time-core", + "time-macros", ] [[package]] @@ -3080,6 +3159,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +[[package]] +name = "time-macros" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.7.6" @@ -3342,21 +3431,38 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "ureq" -version = "2.12.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d1a66277ed75f640d608235660df48c8e3c19f3b4edb6a263315626cc3c01d" +checksum = "e860613aec8c8643c53fb4a3ea3bed801ac09d982b75cb5a1c579e410ef043c2" dependencies = [ "base64", + "cc", + "cookie_store", "log", "once_cell", + "percent-encoding", "rustls", + "rustls-pemfile", "rustls-pki-types", "serde", "serde_json", - "url", + "ureq-proto", + "utf-8", "webpki-roots", ] +[[package]] +name = "ureq-proto" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "319fa2a136b0a13deb093ce09407b39918ecceb68abfc688d9bf9353cf840b94" +dependencies = [ + "base64", + "http", + "httparse", + "log", +] + [[package]] name = "url" version = "2.5.4" @@ -3369,6 +3475,12 @@ dependencies = [ "serde", ] +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + [[package]] name = "utf16_iter" version = "1.0.5" diff --git a/Cargo.toml b/Cargo.toml index 5ac78639e3da7..69278de0111a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -127,9 +127,9 @@ unicode-id-start = "1" # dashmap = "6" -oxc-browserslist = "1.1.0" +oxc-browserslist = "1.1.2" oxc_index = "2" -oxc_resolver = "3" +oxc_resolver = "4" oxc_sourcemap = "1" # @@ -198,7 +198,7 @@ tokio = "1.42.0" tower-lsp = "0.20.0" tracing-subscriber = "0.3.19" tsify = "0.4.5" -ureq = { version = "2.12.1", default-features = false } +ureq = { version = "3.0.0", default-features = false } url = "2.5.4" walkdir = "2.5.0" wasm-bindgen = "0.2.99" diff --git a/tasks/common/Cargo.toml b/tasks/common/Cargo.toml index 4a63712c577be..cb4ba1e9c8a6e 100644 --- a/tasks/common/Cargo.toml +++ b/tasks/common/Cargo.toml @@ -18,5 +18,5 @@ console = { workspace = true } project-root = { workspace = true } similar = { workspace = true } -ureq = { workspace = true, features = ["json", "tls"] } +ureq = { workspace = true, features = ["json", "rustls"] } url = { workspace = true } diff --git a/tasks/common/src/request.rs b/tasks/common/src/request.rs index 670502264f790..8659704c2bf69 100644 --- a/tasks/common/src/request.rs +++ b/tasks/common/src/request.rs @@ -1,28 +1,26 @@ +use std::time::Duration; + +use ureq::{Agent, Proxy}; + /// detect proxy from environment variable in following order: /// ALL_PROXY | all_proxy | HTTPS_PROXY | https_proxy | HTTP_PROXY | http_proxy -fn detect_proxy() -> Option { - macro_rules! try_env { - ($($env:literal),+) => { - $( - if let Ok(env) = std::env::var($env) { - if let Ok(proxy) = ureq::Proxy::new(env) { - return Some(proxy); - } - } - )+ - }; - } - - try_env!("HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"); +fn detect_proxy() -> Option { + for env in ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"] + { + if let Ok(env) = std::env::var(env) { + if let Ok(proxy) = Proxy::new(&env) { + return Some(proxy); + } + } + } None } /// build a agent with proxy automatically detected -pub fn agent() -> ureq::Agent { - let builder = ureq::AgentBuilder::new(); - if let Some(proxy) = detect_proxy() { - builder.proxy(proxy).build() - } else { - builder.build() - } +pub fn agent() -> Agent { + let config = Agent::config_builder() + .proxy(detect_proxy()) + .timeout_global(Some(Duration::from_secs(5))) + .build(); + Agent::new_with_config(config) } diff --git a/tasks/common/src/test_file.rs b/tasks/common/src/test_file.rs index ec6b1fc69cc2a..92fc71477cfc5 100644 --- a/tasks/common/src/test_file.rs +++ b/tasks/common/src/test_file.rs @@ -107,8 +107,8 @@ impl TestFile { } else { println!("[{filename}] - Downloading [{lib}] to [{}]", file.display()); match agent().get(lib).call() { - Ok(response) => { - let mut reader = response.into_reader(); + Ok(mut response) => { + let mut reader = response.body_mut().as_reader(); let _drop = std::fs::remove_file(&file); let mut writer = std::fs::File::create(&file).map_err(err_to_string)?; diff --git a/tasks/coverage/src/runtime/mod.rs b/tasks/coverage/src/runtime/mod.rs index 658b48544f586..7462c2376248e 100644 --- a/tasks/coverage/src/runtime/mod.rs +++ b/tasks/coverage/src/runtime/mod.rs @@ -1,7 +1,4 @@ -use std::{ - path::{Path, PathBuf}, - time::Duration, -}; +use std::path::{Path, PathBuf}; use serde_json::json; @@ -274,10 +271,9 @@ async fn request_run_code(json: impl serde::Serialize + Send + 'static) -> Resul tokio::spawn(async move { agent() .post("http://localhost:32055/run") - .timeout(Duration::from_secs(4)) .send_json(json) .map_err(|err| err.to_string()) - .and_then(|res| res.into_string().map_err(|err| err.to_string())) + .and_then(|mut res| res.body_mut().read_to_string().map_err(|err| err.to_string())) }) .await .map_err(|err| err.to_string())? diff --git a/tasks/coverage/src/runtime/test262_status.rs b/tasks/coverage/src/runtime/test262_status.rs index 77fdf1baa0b78..be9a464f22169 100644 --- a/tasks/coverage/src/runtime/test262_status.rs +++ b/tasks/coverage/src/runtime/test262_status.rs @@ -1,4 +1,4 @@ -use std::{fs, sync::OnceLock, time::Duration}; +use std::{fs, sync::OnceLock}; use oxc_tasks_common::agent; use regex::Regex; @@ -19,10 +19,10 @@ pub fn get_v8_test262_failure_paths() -> &'static Vec { } else { let res = agent() .get("http://raw.githubusercontent.com/v8/v8/main/test/test262/test262.status") - .timeout(Duration::from_secs(10)) .call() .unwrap() - .into_string() + .body_mut() + .read_to_string() .unwrap(); let mut tests = Regex::new(r"'(.+)': \[(FAIL|SKIP)\]") .unwrap() diff --git a/tasks/javascript_globals/src/main.rs b/tasks/javascript_globals/src/main.rs index 0086d7b4f5f9a..1e9548121861e 100644 --- a/tasks/javascript_globals/src/main.rs +++ b/tasks/javascript_globals/src/main.rs @@ -77,7 +77,7 @@ fn main() { .get("https://raw.githubusercontent.com/sindresorhus/globals/main/globals.json") .call() { - Ok(response) => response.into_json().unwrap(), + Ok(mut response) => response.body_mut().read_json().unwrap(), Err(e) => { panic!("Failed to fetch globals.json: {e}"); } diff --git a/tasks/rulegen/Cargo.toml b/tasks/rulegen/Cargo.toml index 571b7c4123491..8fd8b2cca596c 100644 --- a/tasks/rulegen/Cargo.toml +++ b/tasks/rulegen/Cargo.toml @@ -26,4 +26,3 @@ lazy_static = { workspace = true } regex = { workspace = true } rustc-hash = { workspace = true } serde = { workspace = true, features = ["derive"] } -ureq = { workspace = true } diff --git a/tasks/rulegen/src/main.rs b/tasks/rulegen/src/main.rs index c819ed24218ea..be31fcaf653b8 100644 --- a/tasks/rulegen/src/main.rs +++ b/tasks/rulegen/src/main.rs @@ -19,7 +19,6 @@ use oxc_parser::Parser; use oxc_span::{GetSpan, SourceType, Span}; use rustc_hash::FxHashMap; use serde::Serialize; -use ureq::Response; mod json; mod template; @@ -677,7 +676,10 @@ fn main() { println!("Reading test file from {rule_test_path}"); - let body = oxc_tasks_common::agent().get(&rule_test_path).call().map(Response::into_string); + let body = oxc_tasks_common::agent() + .get(&rule_test_path) + .call() + .map(|mut res| res.body_mut().read_to_string()); let context = match body { Ok(Ok(body)) => { let allocator = Allocator::default();