Skip to content

Commit

Permalink
fix: do not redefine wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
DimiDumo committed Jan 31, 2025
1 parent 6e90fa8 commit 62d9572
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ regex = "=1.10.6"
getrandom = { version = "0.2", features = ["js"] }
wasm-bindgen = "0.2"
serde-wasm-bindgen = "0.6.5"
console_error_panic_hook = "0.1.7"
1 change: 1 addition & 0 deletions packages/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,5 +216,6 @@ pub fn gen_circom_from_decomposed_regex(
Ok(())
}

// do not re-define
#[cfg(target_arch = "wasm32")]
pub use crate::wasm::*;
7 changes: 7 additions & 0 deletions packages/compiler/src/wasm.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
use crate::*;
use console_error_panic_hook;
use serde_wasm_bindgen::from_value;
use std::panic;
use wasm_bindgen::prelude::*;

use self::circom::gen_circom_string;

#[wasm_bindgen(start)]
pub fn init_panic_hook() {
panic::set_hook(Box::new(console_error_panic_hook::hook));
}

#[wasm_bindgen]
#[allow(non_snake_case)]
pub fn genFromDecomposed(decomposedRegexJson: &str, circomTemplateName: &str) -> String {
Expand Down

0 comments on commit 62d9572

Please sign in to comment.