diff --git a/libp2p/CHANGELOG.md b/libp2p/CHANGELOG.md index dcf1ad7254d..d75bd7fd9fa 100644 --- a/libp2p/CHANGELOG.md +++ b/libp2p/CHANGELOG.md @@ -2,6 +2,9 @@ - Introduce `libp2p-webrtc-websys` behind `webrtc-websys` feature flag. See [PR 5819](https://github.com/libp2p/rust-libp2p/pull/5819). +- Make the `*-websys` variants (`libp2p-webrtc-websys`, `libp2p-websocket-websys`, `libp2p-webtransport-websys`) only available on wasm32 target architecture. + See [PR 5891](https://github.com/libp2p/rust-libp2p/pull/5891). + ## 0.55.0 - Raise MSRV to 1.83.0. diff --git a/libp2p/Cargo.toml b/libp2p/Cargo.toml index 4cfd2957a2a..870f0f2e131 100644 --- a/libp2p/Cargo.toml +++ b/libp2p/Cargo.toml @@ -99,7 +99,6 @@ futures-timer = "3.0.2" # Explicit dependency to be used in `wasm-bindgen` featu getrandom = { workspace = true } # Explicit dependency to be used in `wasm-bindgen` feature # TODO feature flag? rw-stream-sink = { workspace = true } - libp2p-allow-block-list = { workspace = true } libp2p-autonat = { workspace = true, optional = true } libp2p-connection-limits = { workspace = true } @@ -119,14 +118,16 @@ libp2p-relay = { workspace = true, optional = true } libp2p-rendezvous = { workspace = true, optional = true } libp2p-request-response = { workspace = true, optional = true } libp2p-swarm = { workspace = true } -libp2p-webrtc-websys = { workspace = true, optional = true } -libp2p-websocket-websys = { workspace = true, optional = true } -libp2p-webtransport-websys = { workspace = true, optional = true } libp2p-yamux = { workspace = true, optional = true } multiaddr = { workspace = true } pin-project = "1.0.0" thiserror = { workspace = true } +[target.'cfg(target_arch = "wasm32")'.dependencies] +libp2p-webrtc-websys = { workspace = true, optional = true } +libp2p-websocket-websys = { workspace = true, optional = true } +libp2p-webtransport-websys = { workspace = true, optional = true } + [target.'cfg(not(target_arch = "wasm32"))'.dependencies] libp2p-dns = { workspace = true, optional = true } libp2p-mdns = { workspace = true, optional = true } diff --git a/libp2p/src/lib.rs b/libp2p/src/lib.rs index 80b5880f6d5..51f4eedeb1a 100644 --- a/libp2p/src/lib.rs +++ b/libp2p/src/lib.rs @@ -123,17 +123,17 @@ pub use libp2p_uds as uds; #[cfg(not(target_arch = "wasm32"))] #[doc(inline)] pub use libp2p_upnp as upnp; -#[cfg(feature = "webrtc-websys")] +#[cfg(all(feature = "webrtc-websys", target_arch = "wasm32"))] #[doc(inline)] pub use libp2p_webrtc_websys as webrtc_websys; #[cfg(feature = "websocket")] #[cfg(not(target_arch = "wasm32"))] #[doc(inline)] pub use libp2p_websocket as websocket; -#[cfg(feature = "websocket-websys")] +#[cfg(all(feature = "websocket-websys", target_arch = "wasm32"))] #[doc(inline)] pub use libp2p_websocket_websys as websocket_websys; -#[cfg(feature = "webtransport-websys")] +#[cfg(all(feature = "webtransport-websys", target_arch = "wasm32"))] #[cfg_attr(docsrs, doc(cfg(feature = "webtransport-websys")))] #[doc(inline)] pub use libp2p_webtransport_websys as webtransport_websys;