-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix support for WebAssembly #18
Conversation
The crate previously assumed that `wasm-bindgen` can be used for every WebAssembly target. However there's essentially the following 4 targets: - WebAssembly on the web - Freestanding WebAssembly - WebAssembly with WASI - WebAssembly with Emscripten Only `WebAssembly on the web` supports `wasm-bindgen`. Unfortunately that's not a target on its own for historical reasons, so the only way to properly support that target is through a `wasm-web` feature. All other WebAssembly targets now fall back onto a new fallback implementation that always returns `None`. The crate now also should be able to build at all on unsupported targets because of that.
Hey there, thanks for the PR. To make sure I understand correctly, there are two intents with this?
Do you have strong opinions on the variable name? Other crates, such as Regarding the others, do you know if WASI or Emscripten support getting the locale information from the runtime? I found this PR for Emscripten that seems to provide it via |
I don't particularly care about the feature name, so
Yeah so it doesn't look like WASI can be supported yet, but as it turns out, Emscripten counts as a Unix, so the approach in the Unix code should work. However that means that Emscripten satisifes both WASM and Unix, so I'll push a fix that ensures Emscripten doesn't accidentally compile in two implementations. |
cf693b2
to
a088c12
Compare
This renames the `wasm-web` feature to `js` like in some more common crates in the ecosystem and ensures that Emscripten doesn't accidentally compile in two implementations, one for WASM, one for Unix.
This should be ready again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, sorry for the gap. I tested the cfg
blocks out locally to double check, but this is good to go now. Thanks for working on this!
This is now released as |
Thank you so much :) |
The crate previously assumed that
wasm-bindgen
can be used for every WebAssembly target. However there's essentially the following 4 targets:(And possibly more in the future)
Only
WebAssembly on the web
supportswasm-bindgen
. Unfortunately that's not a target on its own for historical reasons, so the only way to properly support that target is through awasm-web
feature. All other WebAssembly targets now fall back onto a new fallback implementation that always returnsNone
. The crate now also should be able to build at all on unsupported targets because of that.This is technically a breaking change that requires a new "major version" (0.3.0).