fix: do not redefine wasm

This commit is contained in:
Dimitri
2025-01-31 13:32:45 +07:00
parent 6e90fa8d56
commit 62d9572a84
3 changed files with 9 additions and 0 deletions

View File

@@ -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"

View File

@@ -216,5 +216,6 @@ pub fn gen_circom_from_decomposed_regex(
Ok(())
}
// do not re-define
#[cfg(target_arch = "wasm32")]
pub use crate::wasm::*;

View File

@@ -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 {