Skip to content

Commit 84f1b7e

Browse files
Frederik Rothenbergeritsyaasir
Frederik Rothenberger
andauthored
Mark js-sys as optional for identity_core (#1405)
* 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. * Make js-sys a default feature * Fix defaults switch * Don't expose `js-sys` feature Co-authored-by: Yasir <yasirshariffa@gmail.com> --------- Co-authored-by: Yasir <yasirshariffa@gmail.com>
1 parent b355b47 commit 84f1b7e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

identity_core/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ time = { version = "0.3.23", default-features = false, features = ["std", "serde
2121
url = { version = "2.4", default-features = false, features = ["serde"] }
2222
zeroize = { version = "1.6", default-features = false }
2323

24-
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi"), not(feature = "custom_time")))'.dependencies]
25-
js-sys = { version = "0.3.55", default-features = false }
24+
[target.'cfg(all(target_arch = "wasm32", not(target_os = "wasi")))'.dependencies]
25+
js-sys = { version = "0.3.55", default-features = false, optional = true }
2626

2727
[dev-dependencies]
2828
proptest = { version = "1.0.0" }
@@ -39,6 +39,7 @@ rustdoc-args = ["--cfg", "docsrs"]
3939
workspace = true
4040

4141
[features]
42+
default = ["dep:js-sys"]
4243
# Enables a macro to provide a custom time (Timestamp::now_utc) implementation, see src/custom_time.rs
4344
custom_time = []
4445

0 commit comments

Comments
 (0)