diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed700ecb..5d07b54b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,9 +91,12 @@ jobs: - name: Install run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - + - name: Default features - run: wasm-pack test --node -- --features "wasm-bindgen v1 v3 v4 v5" + run: wasm-pack test --node + + - name: Version features + run: wasm-pack test --node -- --features "js v1 v3 v4 v5" embedded: name: Build / Embedded diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fcd1f031..00000000 --- a/.travis.yml +++ /dev/null @@ -1,71 +0,0 @@ -branches: - except: - - /.*(.tmp)$/ - -language: rust - -matrix: - include: - - os: osx - rust: nightly - - rust: nightly - env: - - LABEL="cargo-web" - before_script: - - cargo install cargo-web - script: - - cargo test --features "serde std v1 v3 v4 v5" - - cargo bench --features "serde std v1 v3 v4 v5" - - cargo web build --features "v3 stdweb" - - cargo web build --features "v4 stdweb" - - cargo web build --features "v5 stdweb" - - cargo web build --features "v3 wasm-bindgen" - - cargo web build --features "v4 wasm-bindgen" - - cargo web build --features "v5 wasm-bindgen" - - rust: beta - env: - - LABEL="cargo-web" - before_script: - - cargo install cargo-web - script: - - cargo web build --features "v3 wasm-bindgen" - - cargo web build --features "v4 wasm-bindgen" - - cargo web build --features "v5 wasm-bindgen" - - rust: stable - env: - - LABEL="wasm" - before_script: - - rustup target add wasm32-unknown-unknown - script: - - cargo build --target wasm32-unknown-unknown --features "v3 wasm-bindgen" - - cargo build --target wasm32-unknown-unknown --features "v4 wasm-bindgen" - - cargo build --target wasm32-unknown-unknown --features "v5 wasm-bindgen" - - rust: stable - env: - - LABEL="no-std" - before_script: - - rustup target add thumbv6m-none-eabi - script: - - cargo build --no-default-features --target thumbv6m-none-eabi - -notifications: - email: - on_success: never - -os: linux - -script: -- cargo build --no-default-features -- cargo build --all-features -- cargo build -- cargo test --no-default-features -- cargo test --all-features -- cargo test -- cargo test --features "serde" -- cargo test --features "v1" -- cargo test --features "v3" -- cargo test --features "v4" -- cargo test --features "v5" -- cargo test --features "slog" - -sudo: false diff --git a/Cargo.toml b/Cargo.toml index db235df7..4c01df72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,12 +55,11 @@ repository = "uuid-rs/uuid" default = ["std"] guid = ["winapi"] std = [] -stdweb = ["getrandom", "getrandom/js"] v1 = ["atomic"] v3 = ["md-5"] v4 = ["getrandom"] v5 = ["sha-1"] -wasm-bindgen = ["getrandom", "getrandom/js"] +js = ["getrandom", "getrandom/js"] # Private [dependencies.getrandom] diff --git a/README.md b/README.md index d58281bb..754245a2 100644 --- a/README.md +++ b/README.md @@ -49,10 +49,8 @@ various pieces of functionality: You need to enable one of the following Cargo features together with the `v4` feature if you're targeting `wasm32-unknown-unknown` target: -* `stdweb` - enables support for `OsRng` on `wasm32-unknown-unknown` via - `stdweb` combined with `cargo-web` -* `wasm-bindgen` - `wasm-bindgen` enables support for `OsRng` on - `wasm32-unknown-unknown` via [`wasm-bindgen`] +* `js` - enables support for randomness on + `wasm32-unknown-unknown` via [`getrandom`] Alternatively, you can provide a custom `getrandom` implementation yourself via [`getrandom::register_custom_getrandom`](https://docs.rs/getrandom/0.2.2/getrandom/macro.register_custom_getrandom.html). diff --git a/src/lib.rs b/src/lib.rs index d98841ff..a8e1d651 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -68,11 +68,16 @@ //! //! ## WebAssembly //! -//! For WebAssembly, enable one of the following features depending -//! on your JavaScript interop toolchain of choice: +//! For WebAssembly, enable the `js` feature along with `v4` for a +//! source of randomness: //! -//! * `stdweb` - for [`stdweb`] combined with [`cargo-web`] -//! * `wasm-bindgen` - for [`wasm-bindgen`] +//! ```toml +//! [dependencies] +//! uuid = { version = "0.8", features = ["v4", "js"] } +//! ``` +//! +//! You don't need the `js` feature to use `uuid` in WebAssembly if you're +//! not enabling other features too. //! //! ## Embedded //! @@ -158,7 +163,6 @@ //! //! [`wasm-bindgen`]: https://crates.io/crates/wasm-bindgen //! [`cargo-web`]: https://crates.io/crates/cargo-web -//! [`stdweb`]: https://crates.io/crates/stdweb //! [`Uuid`]: struct.Uuid.html //! [`Uuid::new_v1`]: struct.Uuid.html#method.new_v1 //! [`Uuid::new_v3`]: struct.Uuid.html#method.new_v3