Skip to content

Commit bdc8f94

Browse files
committed
Move web wasm crate into Rust bindings
1 parent 39fad5d commit bdc8f94

16 files changed

Lines changed: 55 additions & 2402 deletions

File tree

β€Ž.github/workflows/rust-lint.ymlβ€Ž

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
pull_request:
88
paths:
99
- "rust/crates/core/**"
10+
- "rust/crates/contacts/**"
11+
- "rust/bindings/wasm/ente-wasm/**"
1012
- "rust/photos/**"
1113
- "rust/Cargo.lock"
1214
- "rust/Cargo.toml"
13-
- "web/packages/wasm/Cargo.*"
14-
- "web/packages/wasm/src/**"
1515
- ".github/workflows/rust-lint.yml"
1616

1717
permissions:
@@ -40,8 +40,7 @@ jobs:
4040
~/.cargo/git
4141
rust/target
4242
rust/photos/target
43-
web/packages/wasm/target
44-
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock', 'rust/photos/Cargo.lock', 'web/packages/wasm/Cargo.lock') }}
43+
key: ${{ runner.os }}-cargo-${{ hashFiles('rust/Cargo.lock', 'rust/photos/Cargo.lock') }}
4544

4645
- name: Check formatting (core)
4746
working-directory: rust
@@ -76,17 +75,17 @@ jobs:
7675
run: cargo test
7776

7877
- name: Check formatting (wasm)
79-
working-directory: web/packages/wasm
80-
run: cargo fmt --check
78+
working-directory: rust
79+
run: cargo fmt --check -p ente-wasm
8180

8281
- name: Run clippy (wasm)
83-
working-directory: web/packages/wasm
84-
run: cargo clippy --all-targets --all-features
82+
working-directory: rust
83+
run: cargo clippy -p ente-wasm --all-targets --all-features
8584

8685
- name: Build (wasm)
87-
working-directory: web/packages/wasm
88-
run: cargo build
86+
working-directory: rust
87+
run: cargo build -p ente-wasm
8988

9089
- name: Test (wasm)
91-
working-directory: web/packages/wasm
92-
run: cargo test
90+
working-directory: rust
91+
run: cargo test -p ente-wasm

β€Ž.github/workflows/web-lint.ymlβ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ on:
55
pull_request:
66
paths:
77
- "web/**"
8+
- "rust/bindings/wasm/ente-wasm/**"
9+
- "rust/crates/contacts/**"
810
- "rust/crates/core/**"
11+
- "rust/Cargo.lock"
12+
- "rust/Cargo.toml"
913
- ".github/workflows/web-lint.yml"
1014

1115
permissions:

β€Žrust/Cargo.lockβ€Ž

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žrust/Cargo.tomlβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ members = [
99
"bindings/uniffi/ensu/inference",
1010
"bindings/uniffi/ensu/sync",
1111
"bindings/uniffi/ensu/transcription",
12+
"bindings/wasm/ente-wasm",
1213
"crates/accounts",
1314
"crates/contacts",
1415
"crates/core",

β€Žrust/README.mdβ€Ž

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
β”‚ β”‚ β”‚
1515
β–Ό β–Ό β–Ό
1616
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
17-
β”‚ mobile/packages/rust/ β”‚ β”‚ web/packages/wasm/ β”‚ β”‚ rust/apps/cli/ β”‚
18-
β”‚ (ente_rust crate) β”‚ β”‚ (ente-wasm crate) β”‚ β”‚ β”‚
17+
β”‚ mobile/packages/rust/ β”‚ β”‚ rust/bindings/wasm/ β”‚ β”‚ rust/apps/cli/ β”‚
18+
β”‚ (ente_rust crate) β”‚ β”‚ ente-wasm/ β”‚ β”‚ β”‚
1919
β”‚ β”‚ β”‚ β”‚ β”‚ CLI binary, depends β”‚
2020
β”‚ Shared #[frb] wrappers β”‚ β”‚ #[wasm_bindgen] wrappers β”‚ β”‚ on ente-core β”‚
2121
β”‚ for all mobile apps β”‚ β”‚ for all web apps β”‚ β”‚ β”‚
@@ -43,6 +43,7 @@
4343
- `rust/crates/core/` (`ente-core`) - shared, pure Rust code used by clients (crypto + auth, plus small HTTP/URL helpers).
4444
- `rust/photos/` (`ente_photos`) - shared Photos Rust logic (motion photo, ML, image processing, vector DB).
4545
- `rust/apps/cli/` (`ente-rs`) - Rust CLI.
46+
- `rust/bindings/wasm/ente-wasm/` (`ente-wasm`) - wasm-bindgen bindings for web.
4647
- `rust/e2e/` (`ente-e2e`) - live Museum-backed Rust end-to-end tests.
4748
- `rust/crates/ensu/` - LLM chat stack (see `rust/crates/ensu/README.md`).
4849

@@ -93,10 +94,12 @@ rust/bindings/uniffi/ # UniFFI bindings for core crypto/aut
9394
β”œβ”€β”€ core/
9495
└── ensu/
9596
96-
web/packages/wasm/ # WASM bindings (lives in web workspace)
97+
rust/bindings/wasm/ente-wasm/ # WASM bindings Rust crate
9798
β”œβ”€β”€ src/
9899
β”‚ └── lib.rs # #[wasm_bindgen] wrappers around ente-core
99-
β”œβ”€β”€ Cargo.toml # crate name: ente-wasm
100+
└── Cargo.toml # crate name: ente-wasm
101+
102+
web/packages/wasm/ # JS package surface for ente-wasm
100103
β”œβ”€β”€ package.json # includes wasm-pack as devDependency
101104
└── pkg/ # generated output (gitignored)
102105
@@ -187,11 +190,11 @@ rust/e2e/scripts/run.sh # starts Dock
187190
cargo test --manifest-path rust/Cargo.toml -p ente-e2e -- --ignored --nocapture
188191
```
189192

190-
**ente-wasm (web/packages/wasm/):**
193+
**ente-wasm (Rust source in rust/bindings/wasm/ente-wasm/, JS package in web/packages/wasm/):**
191194

192195
```sh
193196
yarn install # installs wasm-pack
194-
yarn build # runs wasm-pack build --target bundler
197+
yarn build # runs wasm-pack against the Rust crate
195198
```
196199

197200
Or from web/ root:
@@ -207,7 +210,7 @@ yarn build:wasm # builds the WASM package
207210
> ```sh
208211
> cargo install cargo-watch
209212
> cd web/
210-
> cargo watch -w ../rust/crates/core -w packages/wasm/src -s "yarn build:wasm"
213+
> cargo watch -w ../rust/crates/core -w ../rust/bindings/wasm/ente-wasm/src -s "yarn build:wasm"
211214
> ```
212215
213216
**ente_rust (mobile/packages/rust/):**
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ edition = "2024"
77
crate-type = ["cdylib"]
88

99
[dependencies]
10-
ente-contacts = { path = "../../../rust/crates/contacts" }
11-
ente-core = { path = "../../../rust/crates/core", features = ["srp"] }
10+
ente-contacts = { path = "../../../crates/contacts" }
11+
ente-core = { path = "../../../crates/core", features = ["srp"] }
1212
md-5 = "0.11"
1313
js-sys = "0.3"
1414
serde = { version = "1", features = ["derive"] }
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
Β (0)