Skip to content

Commit c54cadc

Browse files
authored
Merge pull request #828 from bushrat011899/wasm32v1-none
Add `wasm32v1-none` Support
2 parents 5fbd843 + 625d769 commit c54cadc

File tree

12 files changed

+102
-368
lines changed

12 files changed

+102
-368
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,19 @@ jobs:
250250

251251
- name: Powerset
252252
run: cargo hack check --each-feature -Z avoid-dev-deps
253+
254+
wasm32v1-none:
255+
name: Build / MVP Web
256+
runs-on: ubuntu-latest
257+
steps:
258+
- name: Checkout sources
259+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
260+
261+
- name: Install Rust toolchain
262+
run: rustup update nightly && rustup target add --toolchain nightly wasm32v1-none
263+
264+
- name: No features
265+
run: cargo +nightly build -Z avoid-dev-deps --target wasm32v1-none --no-default-features
266+
267+
- name: Version features
268+
run: cargo +nightly build -Z avoid-dev-deps --target wasm32v1-none --no-default-features --features "js v1 v3 v4 v5 v6 v7 v8 serde"

Cargo.toml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ status = "actively-developed"
5555

5656
[features]
5757
default = ["std"]
58-
std = []
58+
std = ["wasm-bindgen?/std", "js-sys?/std"]
5959
macro-diagnostics = ["dep:uuid-macro-internal"]
6060

6161
# NOTE: When adding new features, check the `ci.yml` workflow
@@ -126,21 +126,24 @@ optional = true
126126
version = "1"
127127
default-features = false
128128

129+
# NOTE: `getrandom` will throw a compiler error for the following target configuration when `wasm_js` is not enabled:
130+
# all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))
131+
129132
# Private
130133
# (Formally public)
131-
[target.'cfg(not(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown")))'.dependencies.getrandom]
134+
[target.'cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))'.dependencies.getrandom]
132135
version = "0.3"
133136
optional = true
134137

135-
[target.'cfg(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown"))'.dependencies.uuid-rng-internal-lib]
138+
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dependencies.uuid-rng-internal-lib]
136139
# Work-around lack of support for both `dep:x` and `x/` in MSRV
137140
package = "uuid-rng-internal"
138141
version = "1.16.0"
139142
path = "rng"
140143
optional = true
141144

142145
# Private
143-
[target.'cfg(not(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown")))'.dependencies.rand]
146+
[target.'cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))'.dependencies.rand]
144147
version = "0.9"
145148
optional = true
146149

@@ -169,12 +172,15 @@ optional = true
169172
version = "0.6"
170173

171174
# Private
172-
[target.'cfg(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown"))'.dependencies.wasm-bindgen]
175+
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dependencies.wasm-bindgen]
176+
default-features = false
177+
features = ["msrv"]
173178
version = "0.2"
174179
optional = true
175180

176181
# Private
177-
[target.'cfg(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown", target_feature = "atomics"))'.dependencies.js-sys]
182+
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"), target_feature = "atomics"))'.dependencies.js-sys]
183+
default-features = false
178184
version = "0.3"
179185
optional = true
180186

@@ -190,10 +196,10 @@ version = "1.0"
190196
[dev-dependencies.serde_test]
191197
version = "1.0.56"
192198

193-
[target.'cfg(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown"))'.dev-dependencies.wasm-bindgen]
199+
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dev-dependencies.wasm-bindgen]
194200
version = "0.2"
195201

196-
[target.'cfg(all(target_arch = "wasm32", target_vendor = "unknown", target_os = "unknown"))'.dev-dependencies.wasm-bindgen-test]
202+
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dev-dependencies.wasm-bindgen-test]
197203
version = "0.3"
198204

199205
[dev-dependencies.trybuild]

0 commit comments

Comments
 (0)