add console panic hook
This commit is contained in:
parent
abd5218668
commit
a623308496
|
@ -10,9 +10,10 @@ crate-type = ["cdylib"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasm-bindgen = "0.2.92"
|
wasm-bindgen = "0.2.92"
|
||||||
shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang.git", default-features = false, features = ["serde", "shulkerbox"], rev = "af544ac79eea4498ef4563acfb7e8dd14ec5c84e" }
|
shulkerscript = { git = "https://github.com/moritz-hoelting/shulkerscript-lang.git", default-features = false, features = ["serde", "shulkerbox"], rev = "a0a27cda96e1922b019b216961c39f7ef7991d22" }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde-wasm-bindgen = "0.6.5"
|
serde-wasm-bindgen = "0.6.5"
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
zip = { version = "2.1.3", default-features = false, features = ["deflate"] }
|
zip = { version = "2.1.3", default-features = false, features = ["deflate"] }
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
|
console_error_panic_hook = "0.1.7"
|
||||||
|
|
|
@ -29,6 +29,8 @@ extern "C" {
|
||||||
/// Compiles the given directory into datapack files.
|
/// Compiles the given directory into datapack files.
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn compile(root_dir: JsValue) -> JsValue {
|
pub fn compile(root_dir: JsValue) -> JsValue {
|
||||||
|
console_error_panic_hook::set_once();
|
||||||
|
|
||||||
let root_dir = VFolder::from(serde_wasm_bindgen::from_value::<Directory>(root_dir).unwrap());
|
let root_dir = VFolder::from(serde_wasm_bindgen::from_value::<Directory>(root_dir).unwrap());
|
||||||
|
|
||||||
log("Compiling...");
|
log("Compiling...");
|
||||||
|
@ -43,6 +45,8 @@ pub fn compile(root_dir: JsValue) -> JsValue {
|
||||||
/// Returns a base64 encoded zip file containing the compiled datapack.
|
/// Returns a base64 encoded zip file containing the compiled datapack.
|
||||||
#[wasm_bindgen(js_name = compileZip)]
|
#[wasm_bindgen(js_name = compileZip)]
|
||||||
pub fn compile_zip(root_dir: JsValue) -> Option<String> {
|
pub fn compile_zip(root_dir: JsValue) -> Option<String> {
|
||||||
|
console_error_panic_hook::set_once();
|
||||||
|
|
||||||
let root_dir = VFolder::from(serde_wasm_bindgen::from_value::<Directory>(root_dir).unwrap());
|
let root_dir = VFolder::from(serde_wasm_bindgen::from_value::<Directory>(root_dir).unwrap());
|
||||||
|
|
||||||
let datapack = _compile(&root_dir).ok()?;
|
let datapack = _compile(&root_dir).ok()?;
|
||||||
|
|
Loading…
Reference in New Issue