Skip to content

Import WASM viewer crate from rezolus-webview#800

Merged
thinkingfish merged 7 commits intomainfrom
claude/integrate-wasm-building-QjhNF
Apr 17, 2026
Merged

Import WASM viewer crate from rezolus-webview#800
thinkingfish merged 7 commits intomainfrom
claude/integrate-wasm-building-QjhNF

Conversation

@thinkingfish
Copy link
Copy Markdown
Member

@thinkingfish thinkingfish commented Apr 17, 2026

Summary

Imports the WASM viewer crate from iopsystems/rezolus-webview into crates/rezolus-webview/ so the module that powers site/viewer/ can be built from this repo, allowing the former repository to be archived.

  • crates/rezolus-webview/Cargo.toml is its own Cargo workspace root: the crate targets wasm32-unknown-unknown and has [profile.release] settings that differ from the main rezolus workspace.
  • crates/rezolus-webview/build.sh invokes wasm-pack build --target web --out-dir ../../site/viewer/pkg --out-name wasm_viewer, matching the ../pkg/wasm_viewer.js import path used by the frontend.
  • CLAUDE.md documents the new build command and the static site WASM architecture.

Only the Rust/WASM source is migrated. The frontend (site/ and src/viewer/assets/) has evolved independently in this repo and is not affected; any frontend differences in rezolus-webview are discarded.

Test plan

  • ./crates/rezolus-webview/build.sh produces wasm_viewer.js, wasm_viewer_bg.wasm, and the accompanying .d.ts files in site/viewer/pkg/.
  • Serve site/ and confirm the viewer loads a parquet file end-to-end.
  • cargo check --workspace in the rezolus root still passes (webview crate is excluded from the main workspace).

claude added 7 commits April 17, 2026 16:12
Adds crates/rezolus-webview/ so the WASM module powering site/viewer/
can be built from this repository, allowing iopsystems/rezolus-webview
to be archived. The crate lives in its own Cargo workspace because it
targets wasm32-unknown-unknown with release profile settings that
differ from the main rezolus workspace.

build.sh invokes wasm-pack with --out-name wasm_viewer so the output
matches the ../pkg/wasm_viewer.js import path used by the frontend.

Only the WASM source is migrated; the frontend lives under site/ and
src/viewer/assets/ in this repo and has evolved independently.
- Rename crates/rezolus-webview to crates/viewer; the rezolus context is
  implied.
- Promote the root Cargo.toml to an explicit Cargo workspace that
  includes rezolus, systeminfo, and viewer. xtask stays excluded so it
  keeps its own lockfile.
- Add [workspace.package] and [workspace.dependencies] so shared
  metadata and dep versions (including metriken-query from the git main
  branch) are declared once and inherited by members.
- viewer now inherits metriken-query from the workspace, keeping it in
  sync with the rest of the codebase.
- Add a custom [profile.wasm-release] (inherits from release, no debug
  info, opt-level = "s") and have build.sh invoke wasm-pack with
  --profile wasm-release so the browser bundle stays compact.
- Apply rustfmt to crates/viewer/src/lib.rs now that it's a workspace
  member and covered by `cargo fmt --all`.
- Add an empty `[workspace]` table to xtask/Cargo.toml. `exclude = ["xtask"]`
  in the root alone isn't enough: when `cargo xtask` invokes cargo against
  xtask's manifest, cargo walks up, finds the root `[workspace]`, and
  errors because xtask isn't a member. Declaring xtask as its own
  workspace root detaches it cleanly and keeps xtask/Cargo.lock separate.
- Root README: point readers at the browser-only static viewer under
  `site/viewer/` in the Viewer section and add a `build.sh` snippet under
  "Build from source".
- crates/viewer README: describe how the crate plugs into the static site
  and the main workspace, note the wasm-pack version requirement, and
  explain the `wasm-release` profile used by build.sh.
The viewer crate targets wasm32 and drags in arrow/parquet/zstd, so
building it under rezolus's LTO release profile on every matrix job was
pushing `build-ubuntu-24.04-release` past the runner's time/resource
limit (exit 143 / SIGTERM). viewer is built out-of-band via
crates/viewer/build.sh, so skip it in the main workspace build and
test steps.
Apple's system clang can't target wasm32, so build.sh relies on
Homebrew's LLVM. The previous hardcoded `/opt/homebrew/opt/llvm` check
silently missed Intel Macs (where Homebrew lives at `/usr/local`) and
any other non-default layout, causing `wasm-pack build` to fall back to
system clang and fail with

    unable to create target: 'No available targets are compatible with
    triple "wasm32-unknown-unknown"'

Query `brew --prefix llvm` so the script picks up the right path on any
Homebrew install.
@thinkingfish thinkingfish marked this pull request as ready for review April 17, 2026 20:16
@thinkingfish thinkingfish merged commit 4334452 into main Apr 17, 2026
39 checks passed
@thinkingfish thinkingfish deleted the claude/integrate-wasm-building-QjhNF branch April 17, 2026 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants