connorskees / grass

A Sass compiler written purely in Rust
https://docs.rs/grass/
MIT License
499 stars 38 forks source link

WASM build failing #58

Closed CanadaHonk closed 2 years ago

CanadaHonk commented 2 years ago

Hey, nice project. When trying to compile for WASM with cargo build --features wasm-exports --release, I get these errors. Couldn't find it reported anywhere but sorry if already known.

   Compiling grass v0.11.0 (/home/goose/grass)
error[E0061]: this function takes 2 arguments but 1 argument was supplied
   --> src/lib.rs:368:5
    |
368 |     from_string(Options::default()).map_err(|e| e.to_string())
    |     ^^^^^^^^^^^ ------------------ supplied 1 argument
    |     |
    |     expected 2 arguments
    |
note: function defined here
   --> src/lib.rs:361:8
    |
361 | pub fn from_string(input: String, options: &Options) -> Result<String> {
    |        ^^^^^^^^^^^ -------------  -----------------

error[E0308]: mismatched types
   --> src/lib.rs:368:5
    |
367 | pub fn from_string_js(p: String) -> std::result::Result<String, JsValue> {
    |                                     ------------------------------------ expected `Result<String, wasm_bindgen::JsValue>` because of return type
368 |     from_string(Options::default()).map_err(|e| e.to_string())
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `wasm_bindgen::JsValue`, found struct `String`
    |
    = note: expected enum `Result<_, wasm_bindgen::JsValue>`
               found enum `Result<_, String>`
connorskees commented 2 years ago

Thank you for this report. This should be resolved in the most recent release, 0.11.2. The WASM build has been somewhat neglected -- I should probably add some level of check in CI to prevent the build from becoming broken again.