From e83158bcbe5f50130ff872ec408934f5759f94a4 Mon Sep 17 00:00:00 2001 From: Frederik Rothenberger Date: Mon, 2 Sep 2024 15:14:40 +0200 Subject: [PATCH 1/4] Mark `js-sys` as optional for identity_core In #1397 my intention was to make the `js-sys` dependency mutually exclusive with the feature `custom_time`. As it turns out, it's not that simple and mixing target specific dependencies with feature specific dependencies does not actually work. See [here](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#platform-specific-dependencies) and [here](https://doc.rust-lang.org/cargo/reference/features.html#mutually-exclusive-features). So this removes the broken feature reference in the dependency declaration and instead marks it as `optional`. Also, the feature `custom_time` takes precedence over `js-sys` so these do not actually conflict and one _could_ enable both. --- identity_core/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/identity_core/Cargo.toml b/identity_core/Cargo.toml index f8aa615b28..adf556d16f 100644 --- a/identity_core/Cargo.toml +++ b/identity_core/Cargo.toml @@ -21,8 +21,8 @@ time = { version = "0.3.23", default-features = false, features = ["std", "serde url = { version = "2.4", default-features = false, features = ["serde"] } zeroize = { version = "1.6", default-features = false } -[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi"), not(feature = "custom_time")))'.dependencies] -js-sys = { version = "0.3.55", default-features = false } +[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] +js-sys = { version = "0.3.55", default-features = false, optional = true } [dev-dependencies] proptest = { version = "1.0.0" } From ca568643be40af5b204cbc81050180d260f7bda2 Mon Sep 17 00:00:00 2001 From: Frederik Rothenberger Date: Tue, 3 Sep 2024 09:01:02 +0200 Subject: [PATCH 2/4] Make js-sys a default feature --- identity_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/identity_core/Cargo.toml b/identity_core/Cargo.toml index adf556d16f..57a4db5232 100644 --- a/identity_core/Cargo.toml +++ b/identity_core/Cargo.toml @@ -22,7 +22,7 @@ url = { version = "2.4", default-features = false, features = ["serde"] } zeroize = { version = "1.6", default-features = false } [target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] -js-sys = { version = "0.3.55", default-features = false, optional = true } +js-sys = { version = "0.3.55", default-features = true, optional = true } [dev-dependencies] proptest = { version = "1.0.0" } From d50959c754b79632e8f98206d2a806b39574357d Mon Sep 17 00:00:00 2001 From: Frederik Rothenberger Date: Tue, 3 Sep 2024 11:04:46 +0200 Subject: [PATCH 3/4] Fix defaults switch --- identity_core/Cargo.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/identity_core/Cargo.toml b/identity_core/Cargo.toml index 57a4db5232..90c624d3a0 100644 --- a/identity_core/Cargo.toml +++ b/identity_core/Cargo.toml @@ -22,7 +22,7 @@ url = { version = "2.4", default-features = false, features = ["serde"] } zeroize = { version = "1.6", default-features = false } [target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies] -js-sys = { version = "0.3.55", default-features = true, optional = true } +js-sys = { version = "0.3.55", default-features = false, optional = true } [dev-dependencies] proptest = { version = "1.0.0" } @@ -39,6 +39,7 @@ rustdoc-args = ["--cfg", "docsrs"] workspace = true [features] +default = ["js-sys"] # Enables a macro to provide a custom time (Timestamp::now_utc) implementation, see src/custom_time.rs custom_time = [] From 4fc3c06f7b40df602fc8d2ef9adc07bc05b9a344 Mon Sep 17 00:00:00 2001 From: Frederik Rothenberger Date: Wed, 4 Sep 2024 09:06:48 +0200 Subject: [PATCH 4/4] Don't expose `js-sys` feature Co-authored-by: Yasir --- identity_core/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/identity_core/Cargo.toml b/identity_core/Cargo.toml index 90c624d3a0..239383c2f6 100644 --- a/identity_core/Cargo.toml +++ b/identity_core/Cargo.toml @@ -39,7 +39,7 @@ rustdoc-args = ["--cfg", "docsrs"] workspace = true [features] -default = ["js-sys"] +default = ["dep:js-sys"] # Enables a macro to provide a custom time (Timestamp::now_utc) implementation, see src/custom_time.rs custom_time = []