mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
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:
@ -4,6 +4,8 @@ version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[dependencies]
|
||||
flowy-derive.workspace = true
|
||||
@ -28,18 +30,18 @@ url = { version = "2.2", optional = true }
|
||||
collab-database = { version = "0.1.0", optional = true }
|
||||
collab-document = { version = "0.1.0", optional = true }
|
||||
collab-plugins = { version = "0.1.0", optional = true }
|
||||
tokio-postgres = { version = "0.7.8", optional = true }
|
||||
client-api = { version = "0.1.0", optional = true }
|
||||
|
||||
[features]
|
||||
default = ["impl_from_appflowy_cloud", "impl_from_collab", "impl_from_reqwest", "impl_from_serde"]
|
||||
impl_from_dispatch_error = ["lib-dispatch"]
|
||||
impl_from_serde = []
|
||||
impl_from_reqwest = ["reqwest"]
|
||||
impl_from_sqlite = ["flowy-sqlite", "r2d2"]
|
||||
impl_from_collab = ["collab-database", "collab-document", "impl_from_reqwest", "collab-plugins"]
|
||||
impl_from_postgres = ["tokio-postgres"]
|
||||
impl_from_collab_document = ["collab-document", "impl_from_reqwest", "collab-plugins"]
|
||||
impl_from_collab_database= ["collab-database"]
|
||||
impl_from_url = ["url"]
|
||||
wasm_build = ["lib-dispatch/wasm_build"]
|
||||
|
||||
impl_from_sqlite = ["flowy-sqlite", "r2d2"]
|
||||
impl_from_appflowy_cloud = ["client-api"]
|
||||
dart = ["flowy-codegen/dart"]
|
||||
ts = ["flowy-codegen/ts"]
|
||||
|
@ -1,25 +1,36 @@
|
||||
#[cfg(feature = "impl_from_collab_database")]
|
||||
use collab_database::error::DatabaseError;
|
||||
|
||||
#[cfg(feature = "impl_from_collab_document")]
|
||||
use collab_document::error::DocumentError;
|
||||
|
||||
#[cfg(feature = "impl_from_collab_document")]
|
||||
use collab_plugins::local_storage::kv::PersistenceError;
|
||||
|
||||
use crate::{ErrorCode, FlowyError};
|
||||
|
||||
#[cfg(feature = "impl_from_collab_document")]
|
||||
impl From<PersistenceError> for FlowyError {
|
||||
fn from(err: PersistenceError) -> Self {
|
||||
match err {
|
||||
PersistenceError::UnexpectedEmptyUpdates => FlowyError::new(ErrorCode::RecordNotFound, err),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
PersistenceError::RocksdbCorruption(_) => FlowyError::new(ErrorCode::RocksdbCorruption, err),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
PersistenceError::RocksdbIOError(_) => FlowyError::new(ErrorCode::RocksdbIOError, err),
|
||||
_ => FlowyError::new(ErrorCode::RocksdbInternal, err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "impl_from_collab_database")]
|
||||
impl From<DatabaseError> for FlowyError {
|
||||
fn from(error: DatabaseError) -> Self {
|
||||
FlowyError::internal().with_context(error)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "impl_from_collab_document")]
|
||||
impl From<DocumentError> for FlowyError {
|
||||
fn from(error: DocumentError) -> Self {
|
||||
FlowyError::internal().with_context(error)
|
||||
|
@ -13,12 +13,9 @@ pub mod reqwest;
|
||||
#[cfg(feature = "impl_from_sqlite")]
|
||||
pub mod database;
|
||||
|
||||
#[cfg(feature = "impl_from_collab")]
|
||||
#[cfg(feature = "impl_from_collab_document")]
|
||||
pub mod collab;
|
||||
|
||||
#[cfg(feature = "impl_from_postgres")]
|
||||
mod postgres;
|
||||
|
||||
#[cfg(feature = "impl_from_appflowy_cloud")]
|
||||
mod cloud;
|
||||
#[cfg(feature = "impl_from_url")]
|
||||
|
@ -1,7 +0,0 @@
|
||||
use crate::FlowyError;
|
||||
|
||||
impl std::convert::From<tokio_postgres::Error> for FlowyError {
|
||||
fn from(error: tokio_postgres::Error) -> Self {
|
||||
FlowyError::internal().with_context(error)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user