Repository navigation
Make the library compilable for wasm32-unknown-unknown - #20
Merged
Merged
Conversation
The binary (main.rs) is native-only and stays that way — it opens a real redb file, binds a #[tokio::main] multi-thread runtime, and (via oauth.rs) a local TCP listener for the interactive OAuth callback server, none of which has a wasm32 equivalent inside a browser sandbox. This scopes to the library (config, http, ontology, store), matching how atomic_lib itself ships a separate wasm/ crate around the same core. - oauth.rs is #[cfg(not(target_arch = "wasm32"))]; its axum/rand/tokio dependencies move to a target.'cfg(not(target_arch = "wasm32"))' section — nothing else in the library needs them. - atomic_lib gets its own "wasm" feature alongside db-redb on wasm32 (that fork's db-redb doc comment already claims wasm support via an in-memory backend). - getrandom 0.3 with the wasm_js feature is a direct wasm32-only dependency, plus a new .cargo/config.toml cfg flag it needs in addition to the feature: ulid (via atomic_lib) pulls in rand 0.9 -> getrandom 0.3, a different major version than uuid's via syncables. - http.rs's Fetch impl and store.rs's Storage impl go ?Send on wasm32, matching the relaxation syncables-rs's PR #27 makes to the Fetch/ Storage trait definitions themselves (a reqwest-over-fetch() or Storelike-backed future generally isn't Send on that target). Bumps the syncables git rev to the commit with its own wasm32 fixes. Adds two wasm32 build/clippy checks to CI. Closes #19. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017z9GAjT5LWWqBZFf5o9mNQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #19, which waited on
syncables-rs#25 landing first (done:localthought/syncables-rsPRs #26 and #27).The binary (
main.rs) is native-only and stays that way — it opens a realredbfile, binds a#[tokio::main]multi-thread runtime, and (viaoauth.rs) a local TCP listener for the interactive OAuth callback server, none of which has a wasm32 equivalent inside a browser sandbox. This scopes to the library (config,http,ontology,store), matching howatomic_libitself ships a separatewasm/crate around the same core rather than trying to run its server binary in a browser.oauth.rsis#[cfg(not(target_arch = "wasm32"))]; itsaxum/rand/tokiodependencies move to atarget.'cfg(not(target_arch = "wasm32"))'.dependenciessection — nothing else in the library needs them.atomic_libgets its ownwasmfeature alongsidedb-redbon wasm32 (that fork'sdb-redbdoc comment already claims wasm support via an in-memory backend).getrandom0.3 with thewasm_jsfeature is a direct wasm32-only dependency, plus a new.cargo/config.tomlcfg flag it needs in addition to the feature:ulid(viaatomic_lib) pulls inrand0.9 →getrandom0.3, a different major version thanuuid's viasyncables.http.rs'sFetchimpl andstore.rs'sStorageimpl go?Sendon wasm32, matching the relaxationsyncables-rsPR #27 makes to theFetch/Storagetrait definitions themselves (areqwest-over-fetch()orStorelike-backed future generally isn'tSendon that target).Bumps the
syncablesgitrevto the commit with its own wasm32 fixes. Adds two wasm32 build/clippy checks to CI. Documents all of it in README ("WASM compatibility") and CLAUDE.md.Test plan
cargo build --target wasm32-unknown-unknown --libcargo clippy --target wasm32-unknown-unknown --lib -- -D warningscargo build,cargo test(39 passed),cargo clippy --all-targets -- -D warnings,cargo fmt -- --check(native, unaffected)🤖 Generated with Claude Code
https://claude.ai/code/session_017z9GAjT5LWWqBZFf5o9mNQ
Generated by Claude Code