From 3af2547933661d51b7808a90e912c11c9e964b06 Mon Sep 17 00:00:00 2001 From: MOZGIII Date: Fri, 13 Sep 2024 17:48:30 -0300 Subject: [PATCH] Rename xwt-web-sys to xwt-web --- .github/scripts/build_env/ubuntu.sh | 2 +- Cargo.lock | 4 ++-- crates/{xwt-web-sys => xwt-web}/Cargo.toml | 2 +- crates/{xwt-web-sys => xwt-web}/src/error.rs | 0 crates/{xwt-web-sys => xwt-web}/src/lib.rs | 0 crates/{xwt-web-sys => xwt-web}/src/options.rs | 0 crates/{xwt-web-sys => xwt-web}/tests/test.rs | 10 +++++----- crates/xwt/build.rs | 2 +- examples/microapp/client-web/Cargo.toml | 2 +- examples/microapp/client-web/src/lib.rs | 8 ++++---- 10 files changed, 15 insertions(+), 15 deletions(-) rename crates/{xwt-web-sys => xwt-web}/Cargo.toml (98%) rename crates/{xwt-web-sys => xwt-web}/src/error.rs (100%) rename crates/{xwt-web-sys => xwt-web}/src/lib.rs (100%) rename crates/{xwt-web-sys => xwt-web}/src/options.rs (100%) rename crates/{xwt-web-sys => xwt-web}/tests/test.rs (91%) diff --git a/.github/scripts/build_env/ubuntu.sh b/.github/scripts/build_env/ubuntu.sh index 400f9d79..a5592dd2 100755 --- a/.github/scripts/build_env/ubuntu.sh +++ b/.github/scripts/build_env/ubuntu.sh @@ -6,7 +6,7 @@ SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) get_wasm_bindgen_version() { cargo metadata \ --format-version 1 \ - --manifest-path crates/xwt-web-sys/Cargo.toml \ + --manifest-path crates/xwt-web/Cargo.toml \ --filter-platform wasm32-unknown-unknown \ --quiet | jq -r \ diff --git a/Cargo.lock b/Cargo.lock index dc62d862..07c44670 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1971,7 +1971,7 @@ dependencies = [ "xwt-core", "xwt-example-client-shared", "xwt-test-assets", - "xwt-web-sys", + "xwt-web", ] [[package]] @@ -2049,7 +2049,7 @@ dependencies = [ ] [[package]] -name = "xwt-web-sys" +name = "xwt-web" version = "0.13.0" dependencies = [ "js-sys", diff --git a/crates/xwt-web-sys/Cargo.toml b/crates/xwt-web/Cargo.toml similarity index 98% rename from crates/xwt-web-sys/Cargo.toml rename to crates/xwt-web/Cargo.toml index b39c6cef..2dcd5cd0 100644 --- a/crates/xwt-web-sys/Cargo.toml +++ b/crates/xwt-web/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "xwt-web-sys" +name = "xwt-web" version = "0.13.0" edition = "2021" resolver = "2" diff --git a/crates/xwt-web-sys/src/error.rs b/crates/xwt-web/src/error.rs similarity index 100% rename from crates/xwt-web-sys/src/error.rs rename to crates/xwt-web/src/error.rs diff --git a/crates/xwt-web-sys/src/lib.rs b/crates/xwt-web/src/lib.rs similarity index 100% rename from crates/xwt-web-sys/src/lib.rs rename to crates/xwt-web/src/lib.rs diff --git a/crates/xwt-web-sys/src/options.rs b/crates/xwt-web/src/options.rs similarity index 100% rename from crates/xwt-web-sys/src/options.rs rename to crates/xwt-web/src/options.rs diff --git a/crates/xwt-web-sys/tests/test.rs b/crates/xwt-web/tests/test.rs similarity index 91% rename from crates/xwt-web-sys/tests/test.rs rename to crates/xwt-web/tests/test.rs index 4a03928d..38443a25 100644 --- a/crates/xwt-web-sys/tests/test.rs +++ b/crates/xwt-web/tests/test.rs @@ -1,12 +1,12 @@ #![cfg(target_family = "wasm")] use wasm_bindgen_test::*; -use xwt_web_sys::{CertificateHash, HashAlgorithm, WebTransportOptions}; +use xwt_web::{CertificateHash, HashAlgorithm, WebTransportOptions}; wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); -static_assertions::assert_impl_all!(xwt_web_sys::Endpoint: xwt_core::endpoint::Connect); -static_assertions::assert_impl_all!(xwt_web_sys::Session: xwt_core::base::Session); +static_assertions::assert_impl_all!(xwt_web::Endpoint: xwt_core::endpoint::Connect); +static_assertions::assert_impl_all!(xwt_web::Session: xwt_core::base::Session); fn setup() { static INIT: std::sync::Once = std::sync::Once::new(); @@ -15,7 +15,7 @@ fn setup() { }); } -fn test_endpoint() -> xwt_web_sys::Endpoint { +fn test_endpoint() -> xwt_web::Endpoint { let digest = xwt_cert_fingerprint::Sha256::compute_for_der(xwt_test_assets::CERT); console_log!("certificate sha256 digest: {digest}"); @@ -27,7 +27,7 @@ fn test_endpoint() -> xwt_web_sys::Endpoint { ..Default::default() }; - xwt_web_sys::Endpoint { + xwt_web::Endpoint { options: options.to_js(), } } diff --git a/crates/xwt/build.rs b/crates/xwt/build.rs index 7831eb93..07da097a 100644 --- a/crates/xwt/build.rs +++ b/crates/xwt/build.rs @@ -7,7 +7,7 @@ the current build target (native vs wasm). For better portability, \ the `xwt-core` crate should be used instead, and the drivers should \ be hand-picked for each of the targets instead of using a crate like this one. \ We will be removing the `xwt` crate soon, and you are free to import \ -`xwt-web-sys` and `xwt-wtransport` manually and put them under \ +`xwt-web` and `xwt-wtransport` manually and put them under \ a `cfg_if!` macro yourself if you prefer this mode of operation; they key \ difference there is you maintain explicit control over the your driver \ dependencies rather than us having to tie them together for you - and this how \ diff --git a/examples/microapp/client-web/Cargo.toml b/examples/microapp/client-web/Cargo.toml index 49415cbe..6a9826c2 100644 --- a/examples/microapp/client-web/Cargo.toml +++ b/examples/microapp/client-web/Cargo.toml @@ -11,7 +11,7 @@ xwt-example-client-shared = { path = "../client-shared", default-features = fals # Core xwt primitives and driver. xwt-cert-fingerprint = { path = "../../../crates/xwt-cert-fingerprint", default-features = false } xwt-core = { path = "../../../crates/xwt-core", default-features = false } -xwt-web-sys = { path = "../../../crates/xwt-web-sys", default-features = false } +xwt-web = { path = "../../../crates/xwt-web", default-features = false } # The dependency specific to this being an xwt example that is designed to # work with an xwt test server. diff --git a/examples/microapp/client-web/src/lib.rs b/examples/microapp/client-web/src/lib.rs index a8c3d40f..4bbabdf8 100644 --- a/examples/microapp/client-web/src/lib.rs +++ b/examples/microapp/client-web/src/lib.rs @@ -9,14 +9,14 @@ use xwt_core::prelude::*; pub async fn main() -> Result<(), JsValue> { let server_cert_hash = xwt_cert_fingerprint::Sha256::compute_for_der(xwt_test_assets::CERT); - let options = xwt_web_sys::WebTransportOptions { - server_certificate_hashes: vec![xwt_web_sys::CertificateHash { - algorithm: xwt_web_sys::HashAlgorithm::Sha256, + let options = xwt_web::WebTransportOptions { + server_certificate_hashes: vec![xwt_web::CertificateHash { + algorithm: xwt_web::HashAlgorithm::Sha256, value: server_cert_hash.into_inner().to_vec(), }], ..Default::default() }; - let endpoint = xwt_web_sys::Endpoint { + let endpoint = xwt_web::Endpoint { options: options.to_js(), };