feat: wasm build (#4412)

* chore: enable wasm build

* chore: bump collab

* chore: fix build

* chore: flowy-document wasm

* chore: fix compile

* chore: fix compile

* chore: fix compile

* chore: fix compile

* chore: fix ci

* chore: fix ci

* chore: fix ci
This commit is contained in:
Nathan.fooo
2024-01-22 13:34:15 +08:00
committed by GitHub
parent c4acba8216
commit 90516b6adc
43 changed files with 555 additions and 316 deletions

View File

@ -12,7 +12,7 @@ chrono = { workspace = true, default-features = false, features = ["clock"] }
bytes = { version = "1.5" }
pin-project = "1.1.3"
futures-core = { version = "0.3" }
tokio = { workspace = true, features = ["time", "rt"] }
tokio = { workspace = true, features = ["sync", "time", "rt"] }
async-trait.workspace = true
md5 = "0.7.0"
anyhow.workspace = true
@ -32,3 +32,4 @@ brotli = { version = "3.4.0", optional = true }
[features]
compression = ["brotli"]
wasm_build = []

View File

@ -1,3 +1,19 @@
#[macro_export]
macro_rules! if_native {
($($item:item)*) => {$(
#[cfg(not(target_arch = "wasm32"))]
$item
)*}
}
#[macro_export]
macro_rules! if_wasm {
($($item:item)*) => {$(
#[cfg(target_arch = "wasm32")]
$item
)*}
}
pub fn move_vec_element<T, F>(
vec: &mut Vec<T>,
filter: F,