Skip to content

chore: disable some unused default features#117

Merged
JayWhite2357 merged 3 commits intospaceandtimefdn:mainfrom
jvff:prepare-to-support-wasm-without-js
Aug 28, 2024
Merged

chore: disable some unused default features#117
JayWhite2357 merged 3 commits intospaceandtimefdn:mainfrom
jvff:prepare-to-support-wasm-without-js

Conversation

@jvff
Copy link
Copy Markdown
Contributor

@jvff jvff commented Aug 23, 2024

Rationale for this change

To build this crate for wasm32-unknown-unknown to run on runtimes with a limited custom API available (e.g., Linera contracts), wasm-bindgen should not be a dependency. That's because wasm-bindgen generates bindings for the Javascript APIs available in browsers (and similar runtimes). For more bare-bones runtimes, these APIs aren't available.

What changes are included in this PR?

Disabling the default features of chrono, rand and rand-core.

Unfortunately, this doesn't complete the work to support wasm32-unknown-unknown without JS, because a fix is also needed in merlin (zkcrypto/merlin#8).

Are these changes tested?

Tested with cargo test.

jvff added 3 commits August 23, 2024 21:51
Follow the same formatting as the other lines.
They aren't needed and prevent building for `wasm32-unknown-unknown`
without the browser Javascript APIs, because one of the default features
is `wasmbind`.
They aren't needed and prevent building for `wasm32-unknown-unknown`
without the browser Javascript APIs, because one of the default features
is `getrandom`. That feature enables the `getrandom` dependency, which
can't be built for Wasm unless the Javascript APIs are enabled.
@iajoiner iajoiner requested a review from JayWhite2357 August 27, 2024 18:21
@JayWhite2357
Copy link
Copy Markdown
Contributor

Thanks @jvff! Looks good.

Extra note: We will likely be removing merlin from the dependencies in the near future, so wasm32-unknown-unknown may work once that gets in.

@JayWhite2357 JayWhite2357 merged commit 986b922 into spaceandtimefdn:main Aug 28, 2024
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 0.16.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

JayWhite2357 pushed a commit that referenced this pull request Mar 7, 2025
# Rationale for this change

To build this crate for `wasm32-unknown-unknown` to run on runtimes with
a limited custom API available (e.g., Linera contracts), `wasm-bindgen`
should not be a dependency. That's because `wasm-bindgen` generates
bindings for the Javascript APIs available in browsers (and similar
runtimes). For more bare-bones runtimes, these APIs aren't available.

# What changes are included in this PR?

Disabling the `default` features of `chrono`, `rand` and `rand-core`.

Unfortunately, this doesn't complete the work to support
`wasm32-unknown-unknown` without JS, because a fix is also needed in
`merlin` (zkcrypto/merlin#8).

# Are these changes tested?

Tested with `cargo test`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants