From bc59e323817e8f050b281ca43c59940e2ce901bb Mon Sep 17 00:00:00 2001 From: Hinton Date: Mon, 24 Jun 2024 16:56:52 +0200 Subject: [PATCH] Remove wasm-bindgen feature --- Cargo.lock | 1 + crates/bitwarden-core/Cargo.toml | 1 - crates/bitwarden-wasm/Cargo.toml | 8 ++++++++ crates/bitwarden-wasm/build.sh | 4 ++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 79d2733f7..55266a08b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -665,6 +665,7 @@ version = "0.1.0" dependencies = [ "argon2", "bitwarden-json", + "chrono", "console_error_panic_hook", "console_log", "js-sys", diff --git a/crates/bitwarden-core/Cargo.toml b/crates/bitwarden-core/Cargo.toml index dcd525e74..a34ca1fa8 100644 --- a/crates/bitwarden-core/Cargo.toml +++ b/crates/bitwarden-core/Cargo.toml @@ -28,7 +28,6 @@ uniffi = [ "dep:p256", ] # Uniffi bindings secrets = [] # Secrets manager API -wasm-bindgen = ["chrono/wasmbind"] [dependencies] async-trait = ">=0.1.80, <0.2" diff --git a/crates/bitwarden-wasm/Cargo.toml b/crates/bitwarden-wasm/Cargo.toml index a4ba8b6ae..c4be614d3 100644 --- a/crates/bitwarden-wasm/Cargo.toml +++ b/crates/bitwarden-wasm/Cargo.toml @@ -34,5 +34,13 @@ wasm-bindgen-futures = "0.4.41" [dev-dependencies] wasm-bindgen-test = "0.3.41" +[target.'cfg(target_arch = "wasm32")'.dependencies] +chrono = { version = ">=0.4.26, <0.5", features = [ + "clock", + "serde", + "std", + "wasmbind", +], default-features = false } + [lints] workspace = true diff --git a/crates/bitwarden-wasm/build.sh b/crates/bitwarden-wasm/build.sh index ae32c775d..d49b12de3 100755 --- a/crates/bitwarden-wasm/build.sh +++ b/crates/bitwarden-wasm/build.sh @@ -4,12 +4,12 @@ cd ../../ if [ "$1" != "-r" ]; then # Dev - cargo build -p bitwarden -p bitwarden-wasm --target wasm32-unknown-unknown --features wasm-bindgen + cargo build -p bitwarden-wasm --target wasm32-unknown-unknown wasm-bindgen --target bundler --out-dir languages/js/wasm ./target/wasm32-unknown-unknown/debug/bitwarden_wasm.wasm wasm-bindgen --target nodejs --out-dir languages/js/wasm/node ./target/wasm32-unknown-unknown/debug/bitwarden_wasm.wasm else # Release - cargo build -p bitwarden -p bitwarden-wasm --target wasm32-unknown-unknown --features wasm-bindgen --release + cargo build -p bitwarden-wasm --target wasm32-unknown-unknown --release wasm-bindgen --target bundler --out-dir languages/js/wasm ./target/wasm32-unknown-unknown/release/bitwarden_wasm.wasm wasm-bindgen --target nodejs --out-dir languages/js/wasm/node ./target/wasm32-unknown-unknown/release/bitwarden_wasm.wasm fi