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 d344cc3
Show file tree
Hide file tree
Showing 3 changed files with 4 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::*;
2 changes: 2 additions & 0 deletions packages/compiler/src/wasm.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::*;
use console_error_panic_hook;
use serde_wasm_bindgen::from_value;
use wasm_bindgen::prelude::*;

Expand All @@ -7,6 +8,7 @@ use self::circom::gen_circom_string;
#[wasm_bindgen]
#[allow(non_snake_case)]
pub fn genFromDecomposed(decomposedRegexJson: &str, circomTemplateName: &str) -> String {
console_error_panic_hook::set_once();
let mut decomposed_regex_config: DecomposedRegexConfig =
serde_json::from_str(decomposedRegexJson).expect("failed to parse decomposed_regex json");
let regex_and_dfa = get_regex_and_dfa(&mut decomposed_regex_config)
Expand Down

0 comments on commit d344cc3

Please sign in to comment.