Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions crates/float-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
Comment on lines +1 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify the hardcoded artifact paths in build.js
echo "=== Checking build.js for hardcoded artifact paths ==="
rg -n "rain_math_float" scripts/build.js

Repository: rainlanguage/rain.math.float

Length of output: 394


Build script incompatibility: artifact name mismatch.

The package name rain-math-float-wasm will produce a WASM artifact named rain_math_float_wasm.wasm, but the build script (scripts/build.js) hardcodes the artifact name as rain_math_float.wasm:

wasm-bindgen --target nodejs ./target/wasm32-unknown-unknown/release/rain_math_float.wasm ...
wasm-bindgen --target web ./target/wasm32-unknown-unknown/release/rain_math_float.wasm ...

This mismatch will cause the WASM build to fail.

Fix options:

  1. Add name = "rain_math_float" under [lib] to preserve the original artifact name:
 [lib]
 crate-type = ["cdylib"]
+name = "rain_math_float"
  1. Or update scripts/build.js to reference rain_math_float_wasm.wasm.

Option 1 is recommended.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/float-wasm/Cargo.toml` around lines 1 - 12, The crate's package name
rain-math-float-wasm produces an artifact rain_math_float_wasm.wasm but the
build script scripts/build.js expects rain_math_float.wasm; to fix, add a name
override under [lib] (e.g., name = "rain_math_float") in this Cargo.toml so the
generated WASM artifact matches the wasm-bindgen invocations, or alternatively
update the wasm-bindgen calls in scripts/build.js to reference
rain_math_float_wasm.wasm; modify the Cargo.toml [lib] block (or the
wasm-bindgen lines in scripts/build.js) accordingly to make the artifact name
consistent.

8 changes: 8 additions & 0 deletions crates/float-wasm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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::*;
2 changes: 1 addition & 1 deletion crates/float/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
Loading