From f9f9d96e098b51a71800ee46cb3af9fe7e921e08 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Rios Date: Tue, 17 Mar 2026 16:55:31 -0300 Subject: [PATCH] fix: move cdylib to separate float-wasm crate --- crates/float-wasm/Cargo.toml | 12 ++++++++++++ crates/float-wasm/src/lib.rs | 8 ++++++++ crates/float/Cargo.toml | 2 +- scripts/build.js | 4 ++-- 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 crates/float-wasm/Cargo.toml create mode 100644 crates/float-wasm/src/lib.rs diff --git a/crates/float-wasm/Cargo.toml b/crates/float-wasm/Cargo.toml new file mode 100644 index 00000000..0cd5decc --- /dev/null +++ b/crates/float-wasm/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "rain-math-float-wasm" +version = "0.1.0" +edition = "2021" +license = "LicenseRef-DCL-1.0" +homepage = "https://github.com/rainlanguage/rain.math.float" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +rain-math-float = { path = "../float" } diff --git a/crates/float-wasm/src/lib.rs b/crates/float-wasm/src/lib.rs new file mode 100644 index 00000000..0b627002 --- /dev/null +++ b/crates/float-wasm/src/lib.rs @@ -0,0 +1,8 @@ +//! WASM cdylib wrapper for `rain-math-float`. +//! +//! This crate exists solely to produce the cdylib artifact for WASM targets. +//! The core library (`rain-math-float`) is rlib-only to avoid output filename +//! collisions that cause duplicate dependency compilation in downstream +//! consumers. + +pub use rain_math_float::*; diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index 8294076b..02c178ae 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -6,7 +6,7 @@ license = "LicenseRef-DCL-1.0" homepage = "https://github.com/rainlanguage/rain.math.float" [lib] -crate-type = ["rlib", "cdylib"] +crate-type = ["rlib"] [dependencies] alloy = { version = "1.0.9", features = ["sol-types", "json-rpc"] } diff --git a/scripts/build.js b/scripts/build.js index e5024cc7..318f1bb0 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -10,10 +10,10 @@ execSync("npm run build-wasm"); // generate node/web bindgens execSync( - `wasm-bindgen --target nodejs ./target/wasm32-unknown-unknown/release/rain_math_float.wasm --out-dir ./temp/node --out-name float` + `wasm-bindgen --target nodejs ./target/wasm32-unknown-unknown/release/rain_math_float_wasm.wasm --out-dir ./temp/node --out-name float` ); execSync( - `wasm-bindgen --target web ./target/wasm32-unknown-unknown/release/rain_math_float.wasm --out-dir ./temp/web --out-name float` + `wasm-bindgen --target web ./target/wasm32-unknown-unknown/release/rain_math_float_wasm.wasm --out-dir ./temp/web --out-name float` ); // encode wasm as base64 into a json for cjs and esm that can be natively imported