diff --git a/.github/workflows/platforms.yml b/.github/workflows/platforms.yml
index 4bf3a2e9f..14ae0f916 100644
--- a/.github/workflows/platforms.yml
+++ b/.github/workflows/platforms.yml
@@ -94,12 +94,6 @@ jobs:
- name: Check examples (default features)
run: cargo +${{ env.MSRV_ALSA }} check --examples --workspace --verbose
- - name: Run tests (no default features)
- run: cargo +${{ env.MSRV_ALSA }} test --no-default-features --workspace --verbose
-
- - name: Check examples (no default features)
- run: cargo +${{ env.MSRV_ALSA }} check --examples --no-default-features --workspace --verbose
-
- name: Run tests (all features)
run: cargo +${{ steps.msrv.outputs.all-features }} test --all-features --workspace --verbose
@@ -151,17 +145,11 @@ jobs:
- name: Check examples (default features)
run: cross +${{ env.MSRV_ALSA }} check --examples --workspace --verbose --target ${{ env.TARGET }}
- - name: Run tests (no default features)
- run: cross +${{ env.MSRV_ALSA }} test --no-default-features --workspace --verbose --target ${{ env.TARGET }}
-
- - name: Check examples (no default features)
- run: cross +${{ env.MSRV_ALSA }} test --no-default-features --workspace --verbose --target ${{ env.TARGET }}
-
- name: Run tests (all features)
run: cross +${{ steps.msrv.outputs.all-features }} test --features=jack,pulseaudio --workspace --verbose --target ${{ env.TARGET }}
- name: Check examples (all features)
- run: cross +${{ steps.msrv.outputs.all-features }} test --features=jack,pulseaudio --workspace --verbose --target ${{ env.TARGET }}
+ run: cross +${{ steps.msrv.outputs.all-features }} check --examples --features=jack,pulseaudio --workspace --verbose --target ${{ env.TARGET }}
pipewire-bookworm:
name: pipewire-bookworm
@@ -241,12 +229,6 @@ jobs:
- name: Check examples (default features)
run: cargo +${{ env.MSRV_WINDOWS }} check --examples --workspace --verbose
- - name: Run tests (no default features)
- run: cargo +${{ env.MSRV_WINDOWS }} test --no-default-features --workspace --verbose
-
- - name: Check examples (no default features)
- run: cargo +${{ env.MSRV_WINDOWS }} check --examples --no-default-features --workspace --verbose
-
- name: Run tests (all features)
run: cargo +${{ steps.msrv.outputs.all-features }} test --workspace --all-features --verbose
@@ -293,12 +275,6 @@ jobs:
- name: Check examples (default features)
run: cargo +${{ env.MSRV_COREAUDIO }} check --examples --workspace --verbose
- - name: Run tests (no default features)
- run: cargo +${{ env.MSRV_COREAUDIO }} test --no-default-features --workspace --verbose
-
- - name: Check examples (no default features)
- run: cargo +${{ env.MSRV_COREAUDIO }} check --no-default-features --examples --workspace --verbose
-
- name: Run tests (all features)
run: cargo +${{ steps.msrv.outputs.all-features }} test --all-features --workspace --verbose
@@ -342,9 +318,6 @@ jobs:
- name: Check examples (default features)
run: cargo +${{ env.MSRV_AAUDIO }} check --examples --workspace --verbose --target ${{ env.TARGET }}
- - name: Check examples (no default features)
- run: cargo +${{ env.MSRV_AAUDIO }} check --examples --no-default-features --workspace --verbose --target ${{ env.TARGET }}
-
- name: Check examples (all features)
run: cargo +${{ steps.msrv.outputs.all-features }} check --examples --all-features --workspace --verbose --target ${{ env.TARGET }}
@@ -391,9 +364,6 @@ jobs:
- name: Check examples (default features)
run: cargo +${{ env.MSRV_COREAUDIO }} check --examples --workspace --verbose --target ${{ env.TARGET }}
- - name: Check examples (no default features)
- run: cargo +${{ env.MSRV_COREAUDIO }} check --examples --no-default-features --workspace --verbose --target ${{ env.TARGET }}
-
- name: Check examples (all features)
run: cargo +${{ env.MSRV_COREAUDIO }} check --examples --all-features --workspace --verbose --target ${{ env.TARGET }}
@@ -429,9 +399,6 @@ jobs:
- name: Check examples (default features)
run: cargo +nightly check --examples --workspace --verbose --target ${{ env.TARGET }} -Z build-std
- - name: Check examples (no default features)
- run: cargo +nightly check --examples --no-default-features --workspace --verbose --target ${{ env.TARGET }} -Z build-std
-
- name: Check examples (all features)
run: cargo +nightly check --examples --all-features --workspace --verbose --target ${{ env.TARGET }} -Z build-std
@@ -459,6 +426,9 @@ jobs:
with:
key: wasm-bindgen
+ - name: Check examples (default features)
+ run: cargo +${{ env.MSRV_WASM }} check --examples --workspace --verbose --target ${{ env.TARGET }}
+
- name: Check examples (wasm-bindgen feature)
run: cargo +${{ env.MSRV_WASM }} check --examples --features wasm-bindgen --workspace --verbose --target ${{ env.TARGET }}
@@ -496,9 +466,15 @@ jobs:
with:
key: wasm-audioworklet
+ - name: Check examples (default features)
+ run: cargo +nightly check --examples --workspace --verbose -Z build-std=std,panic_abort --target ${{ env.TARGET }}
+
- name: Check examples (audioworklet feature)
run: cargo +nightly check --examples --features audioworklet --workspace --verbose -Z build-std=std,panic_abort --target ${{ env.TARGET }}
+ - name: Check all features
+ run: cargo +nightly check --workspace --all-features --verbose -Z build-std=std,panic_abort --target ${{ env.TARGET }}
+
- name: Build audioworklet-beep example
working-directory: ./examples/audioworklet-beep
run: trunk build
@@ -527,8 +503,8 @@ jobs:
- name: Check examples (default features)
run: cargo +${{ env.MSRV_WASIP1 }} check --examples --workspace --target ${{ env.TARGET }} --verbose
- - name: Check examples (no default features)
- run: cargo +${{ env.MSRV_WASIP1 }} check --examples --no-default-features --workspace --verbose --target ${{ env.TARGET }}
+ - name: Check all features
+ run: cargo +${{ env.MSRV_WASIP1 }} check --workspace --all-features --verbose --target ${{ env.TARGET }}
# Windows crate version compatibility
windows-versions:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e8dfa7f05..834b4269b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Exclude `pipewire` from the `docs.rs` build; system dependency not available in its environment.
+- Fix `wasm-bindgen` causing compile errors on non-browser `wasm32` targets such as `wasm32-wasip1`.
## [0.18.0] - 2026-06-06
diff --git a/src/host/mod.rs b/src/host/mod.rs
index 61875ee47..ae14ca818 100644
--- a/src/host/mod.rs
+++ b/src/host/mod.rs
@@ -25,6 +25,8 @@ pub(crate) mod alsa;
pub(crate) mod asio;
#[cfg(all(
+ target_arch = "wasm32",
+ target_os = "unknown",
feature = "wasm-bindgen",
feature = "audioworklet",
target_feature = "atomics"
@@ -72,7 +74,11 @@ pub(crate) mod pulseaudio;
#[cfg(windows)]
pub(crate) mod wasapi;
-#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
+#[cfg(all(
+ target_arch = "wasm32",
+ target_os = "unknown",
+ feature = "wasm-bindgen"
+))]
pub(crate) mod webaudio;
#[cfg(feature = "custom")]
@@ -86,7 +92,11 @@ pub(crate) mod custom;
target_os = "netbsd",
target_vendor = "apple",
target_os = "android",
- all(target_arch = "wasm32", feature = "wasm-bindgen"),
+ all(
+ target_arch = "wasm32",
+ target_os = "unknown",
+ feature = "wasm-bindgen"
+ ),
)))]
pub(crate) mod null;
diff --git a/src/lib.rs b/src/lib.rs
index cf11e08eb..2adbecd6c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -164,11 +164,23 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
// Extern crate declarations with `#[macro_use]` must unfortunately be at crate root.
-#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
+#[cfg(all(
+ target_arch = "wasm32",
+ target_os = "unknown",
+ feature = "wasm-bindgen"
+))]
extern crate js_sys;
-#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
+#[cfg(all(
+ target_arch = "wasm32",
+ target_os = "unknown",
+ feature = "wasm-bindgen"
+))]
extern crate wasm_bindgen;
-#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
+#[cfg(all(
+ target_arch = "wasm32",
+ target_os = "unknown",
+ feature = "wasm-bindgen"
+))]
extern crate web_sys;
pub use device_description::{
@@ -180,7 +192,11 @@ pub use platform::{
SupportedInputConfigs, SupportedOutputConfigs, ALL_HOSTS,
};
pub use sample_format::{FromSample, Sample, SampleFormat, SizedSample, I24, U24};
-#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
+#[cfg(all(
+ target_arch = "wasm32",
+ target_os = "unknown",
+ feature = "wasm-bindgen"
+))]
use wasm_bindgen::prelude::*;
pub mod device_description;
@@ -375,14 +391,22 @@ pub enum BufferSize {
Fixed(FrameCount),
}
-#[cfg(all(target_arch = "wasm32", feature = "wasm-bindgen"))]
+#[cfg(all(
+ target_arch = "wasm32",
+ target_os = "unknown",
+ feature = "wasm-bindgen"
+))]
impl wasm_bindgen::describe::WasmDescribe for BufferSize {
fn describe() {