forked from 1b-agent/opencadstudio-upstream
build(web): restore the wasm build — gate native-only deps off wasm
The web build had bit-rotted: native-only features added since it last compiled pulled crates that don't build for wasm32-unknown-unknown. - printpdf (PDF export / printing) → native-only target; the web build gets stub export_pdf / print_wires. It pulls a wasm-incompatible memchr 1.0.2 via lopdf → nom_locate, and the web has no filesystem. - getrandom 0.3 (via ahash via acadrust) → enable its wasm_js feature and add the matching --cfg getrandom_backend rustflag in .cargo/config.toml. - ocs_plugin_api "host" feature (out-of-process plugin runtime: interprocess, libloading, memmap2, rkyv) → native-only target; the web gets the dependency-free manifest/ribbon contract. The host code was already wasm-gated; only the Cargo wiring pulled it in unconditionally. `trunk build --release` succeeds again. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
8b1e37e0da
commit
44fa9df278
5 files changed
+75
-3
No files matched your search
+14
-2
@@ -24,7 +24,9 @@ solid3d = ["dep:truck-meshalgo", "dep:truck-shapeops", "dep:lzma-sys"]
|
||||
[dependencies]
|
||||
# Stable, dependency-free add-on contract (manifest + ribbon/CadModule types).
|
||||
# Plugin authors target this crate's semver, not OpenCADStudio internals.
|
||||
ocs_plugin_api = { path = "crates/ocs_plugin_api", features = ["host"] }
|
||||
# The `host` feature (out-of-process plugin runtime: interprocess, libloading,
|
||||
# memmap2, rkyv) is native-only — see the per-target sections below; the web
|
||||
# build gets the dependency-free manifest/ribbon contract.
|
||||
# vtkio (pulled in transitively via truck-meshalgo) depends on xz2 → lzma-sys,
|
||||
# which by default links the system liblzma dynamically. On macOS that bakes a
|
||||
# Homebrew dylib path (/opt/homebrew/.../liblzma.5.dylib) into the binary, so
|
||||
@@ -44,7 +46,6 @@ clap = { version = "4", features = ["derive"] }
|
||||
# Opt-in logging via --log / RUST_LOG (surfaces wgpu / iced / winit diagnostics).
|
||||
env_logger = "0.11"
|
||||
acadrust = "0.3.4"
|
||||
printpdf = "0.9.1"
|
||||
flate2 = "1"
|
||||
image = { version = "0.25", default-features = false, features = ["png", "jpeg", "bmp", "tiff"] }
|
||||
inventory = "0.3"
|
||||
@@ -80,14 +81,25 @@ windows-sys = { version = "0.61", features = ["Win32_UI_Shell", "Win32_UI_Window
|
||||
acadrust = { git = "https://github.com/HakanSeven12/acadrust", branch = "main" }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
# Native enables the plugin host runtime (out-of-process plugins).
|
||||
ocs_plugin_api = { path = "crates/ocs_plugin_api", features = ["host"] }
|
||||
rayon = "1"
|
||||
open = "5"
|
||||
# PDF export / printing. Native-only: printpdf pulls a wasm-incompatible
|
||||
# `memchr` (1.0.2) via lopdf → nom_locate, and the web build has no filesystem.
|
||||
printpdf = "0.9.1"
|
||||
ureq = { version = "3", default-features = false, features = ["rustls"] }
|
||||
# Parse the GitHub Releases API response for the plugin marketplace.
|
||||
serde_json = "1"
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
# Web gets the dependency-free manifest/ribbon contract only (no plugin host).
|
||||
ocs_plugin_api = { path = "crates/ocs_plugin_api" }
|
||||
console_error_panic_hook = "0.1"
|
||||
# ahash (via acadrust) pulls getrandom 0.3, which needs the `wasm_js` backend
|
||||
# enabled to support wasm32-unknown-unknown (plus the matching rustflag in
|
||||
# .cargo/config.toml).
|
||||
getrandom = { version = "0.3", features = ["wasm_js"] }
|
||||
wasm-bindgen = "0.2"
|
||||
# fetch() returns a JS Promise; bridge it to a Rust future for the per-script
|
||||
# web font loader (#141).
|
||||
|
||||
Reference in new issue
Block a user