Compare commits
No commits in common. "8406d37991ad788bf9d39d7166c9cdbe7c7bb87f" and "068864ea87fbd2ee4b74f548cee45f05cc199226" have entirely different histories.
8406d37991
...
068864ea87
@ -52,7 +52,6 @@ path = "src/lib.rs"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
futures = { version = "0.3.28", optional = true }
|
futures = { version = "0.3.28", optional = true }
|
||||||
gloo-utils = "0.2.0"
|
|
||||||
nom = "7.1.1"
|
nom = "7.1.1"
|
||||||
opentelemetry = { version = "0.20.0", optional = true, default-features = false, features = ["trace", "rt-tokio"] }
|
opentelemetry = { version = "0.20.0", optional = true, default-features = false, features = ["trace", "rt-tokio"] }
|
||||||
opentelemetry-otlp = { version = "0.13.0", optional = true }
|
opentelemetry-otlp = { version = "0.13.0", optional = true }
|
||||||
|
3
Makefile
3
Makefile
@ -7,7 +7,6 @@ MAKEFLAGS += --no-builtin-rules
|
|||||||
TESTJOBS := 4
|
TESTJOBS := 4
|
||||||
OS:=$(shell uname -s)
|
OS:=$(shell uname -s)
|
||||||
RELEASEFLAGS :=
|
RELEASEFLAGS :=
|
||||||
WASMTARGET := bundler # or web
|
|
||||||
|
|
||||||
ifeq ($(OS),Linux)
|
ifeq ($(OS),Linux)
|
||||||
TESTJOBS:=$(shell nproc)
|
TESTJOBS:=$(shell nproc)
|
||||||
@ -33,7 +32,7 @@ release:
|
|||||||
.PHONY: wasm
|
.PHONY: wasm
|
||||||
wasm:
|
wasm:
|
||||||
> cargo build --target=wasm32-unknown-unknown --profile wasm --bin wasm --features wasm
|
> cargo build --target=wasm32-unknown-unknown --profile wasm --bin wasm --features wasm
|
||||||
> wasm-bindgen --target $(WASMTARGET) --out-dir target/wasm32-unknown-unknown/js target/wasm32-unknown-unknown/wasm/wasm.wasm
|
> wasm-bindgen --target web --out-dir target/wasm32-unknown-unknown/js target/wasm32-unknown-unknown/wasm/wasm.wasm
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
use gloo_utils::format::JsValueSerdeExt;
|
|
||||||
use wasm_bindgen::JsValue;
|
|
||||||
|
|
||||||
use crate::parser::parse_with_settings;
|
use crate::parser::parse_with_settings;
|
||||||
use crate::settings::GlobalSettings;
|
use crate::settings::GlobalSettings;
|
||||||
use crate::wasm::ParseResult;
|
use crate::wasm::ParseResult;
|
||||||
@ -11,15 +8,17 @@ pub fn parse_org(org_contents: &str) -> wasm_bindgen::JsValue {
|
|||||||
let rust_parsed = match parse_with_settings(org_contents, &GlobalSettings::default()) {
|
let rust_parsed = match parse_with_settings(org_contents, &GlobalSettings::default()) {
|
||||||
Ok(document) => document,
|
Ok(document) => document,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return JsValue::from_serde(&ParseResult::Error(format!("{:?}", err))).unwrap();
|
return serde_wasm_bindgen::to_value(&ParseResult::Error(format!("{:?}", err)))
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let to_wasm_context = ToWasmContext::new(org_contents);
|
let to_wasm_context = ToWasmContext::new(org_contents);
|
||||||
let wasm_document = match rust_parsed.to_wasm(to_wasm_context) {
|
let wasm_document = match rust_parsed.to_wasm(to_wasm_context) {
|
||||||
Ok(document) => document,
|
Ok(document) => document,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
return JsValue::from_serde(&ParseResult::Error(format!("{:?}", err))).unwrap();
|
return serde_wasm_bindgen::to_value(&ParseResult::Error(format!("{:?}", err)))
|
||||||
|
.unwrap();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
JsValue::from_serde(&ParseResult::Success(wasm_document)).unwrap()
|
serde_wasm_bindgen::to_value(&ParseResult::Success(wasm_document)).unwrap()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user