# Source of muon-link-web

muon-link-web is muon-link's browser binding: an Iroh endpoint that reaches a Muon printer through a relay. The
Muon3D Slicer's relay Worker loads it from this folder (`vendor/muon-link-web/01d80c0/`) to reach printers through
Muon Cloud. It is free software under the Apache License 2.0 (`LICENSE`, `NOTICE`); the third-party crates
compiled into it are listed with their licences in `THIRD-PARTY-NOTICES.md`.

- **Source:** https://github.com/Muon-3D/muon-link, crate `crates/muon-link-web`, at commit `01d80c0083aa16baad81648f40af3380904e7fe1`.
- **Built from source** by the Muon3D Slicer's `scripts/build-muon-link-web.mjs`, with the recipe of muon-link's CI
  (`.github/workflows/ci.yml`, job `browser`) and wasm-bindgen's web target:

```sh
rustup target add wasm32-unknown-unknown  # toolchain 1.97.1 (rust-toolchain.toml)
CC_wasm32_unknown_unknown="zig cc -target wasm32-freestanding, --target=* dropped"  AR_wasm32_unknown_unknown="zig ar"  # ziglang 0.16.0
CARGO_ENCODED_RUSTFLAGS="--remap-path-prefix=$CARGO_HOME=/cargo --remap-path-prefix=<muon-link checkout>=/muon-link --remap-path-prefix=$(rustc --print sysroot)=/rustc"  # separated by 0x1f, the longest folder last
cargo build --release --target wasm32-unknown-unknown -p muon-link-web --locked
wasm-bindgen --target web --out-dir pkg --out-name muon_link_web target/wasm32-unknown-unknown/release/muon_link_web.wasm
```

- **Toolchain:** rustc 1.97.1 (8bab26f4f 2026-07-14) (LLVM 22.1.6, host x86_64-pc-windows-msvc); cargo 1.97.1 (c980f4866 2026-06-30);
  wasm-bindgen 0.2.127 (the wasm-bindgen crate in Cargo.lock is 0.2.127); zig 0.16.0 (ziglang, -target wasm32-freestanding).

| File | Bytes | SHA-256 |
|---|---|---|
| `muon_link_web.js` | 56646 | `c39a2704a1796f16a2fb7318aac576a735a6c59e53d90da658a8982ca511152c` |
| `muon_link_web_bg.wasm` | 2865559 | `ab53e223c9b8d8fd819c00c5933eab5b3d9bf635146ba3aa5bed997ab568fbe5` |

The release profile keeps the source paths of panic locations (muon-link's Cargo.toml, `[profile.release]`). So
that the wasm names no folder of the machine that built it, the build passes rustc `--remap-path-prefix` in
`CARGO_ENCODED_RUSTFLAGS` (muon-link's CI sets no RUSTFLAGS for this job): cargo's home (`CARGO_HOME`, where the
crates are unpacked) becomes `/cargo`, the muon-link checkout `/muon-link` and the toolchain's sysroot `/rustc`.
The builder fails if either file still names one of the build's folders; ring's C code, compiled by zig, embeds no
path. Built in other folders, with another CARGO_HOME or target folder, the files are the same bytes. Rust on
Windows writes `\` in these paths where Linux and macOS write `/`, so a build on those differs in those bytes.

Compared on 2026-10-09 with the copy Muon Cloud's console served then:

- `muon_link_web.js`: 56646 bytes, sha256 `c39a2704a1796f16a2fb7318aac576a735a6c59e53d90da658a8982ca511152c`: byte-identical to this build.
- `muon_link_web_bg.wasm`: 2875811 bytes, sha256 `d3309effe3863c3bc673f72cb69b05ff4e3874b36d81599d30b36a4660bfbe0f`: not byte-identical to this build.
- The glue's exports are the same.
- That copy was built without `--remap-path-prefix`: its wasm names its builder's cargo registry folder in
  740 places where this build's names `/cargo`, so this build's wasm is not the bytes that copy serves.
