Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 43 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DATEX Web
# DATEX

> Check out our specification at [datex.unyt.org](https://datex.unyt.org).

Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unyt/datex",
"version": "0.0.12",
"version": "0.0.13",
"license": "MIT",
"exports": {
".": "./src/mod.ts",
Expand Down
6 changes: 3 additions & 3 deletions rs-lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "datex-web"
version = "0.0.12"
version = "0.0.13"
authors = [
"Benedikt Strehle <benedikt@unyt.org>",
"Jonas Strehle <jonas@unyt.org>",
Expand All @@ -20,14 +20,14 @@ panic = "abort"

[dependencies]
log = { version = "0.4", features = ["std", "serde"] }
datex-core = { version = "0.0.9", default-features = false, features = [
datex-core = { version = "0.0.10", default-features = false, features = [
"target_wasm",
"compiler",
"decompiler",
"syntax_highlighting_legacy",
"lsp_wasm",
] }
datex-crypto-facade = { version = "0.0.1" }
datex-crypto-facade = { version = "0.0.2" }

# datex_macros = { git = "https://github.com/unyt-org/datex", branch = "refactor/update-loop", version = "0.1.3", package = "datex_macros" }

Expand Down
3 changes: 1 addition & 2 deletions rs-lib/src/js_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ pub fn dif_js_value_to_value_container(

pub fn value_container_to_dif_js_value(
value_container: &ValueContainer,
memory: &RefCell<Memory>,
) -> JsValue {
let dif_value_container =
DIFValueContainer::from_value_container(&value_container, memory);
DIFValueContainer::from_value_container(&value_container);
to_js_value(&dif_value_container)
.expect("Failed to serialize DIFValueContainer to JsValue")
}
Expand Down
59 changes: 1 addition & 58 deletions rs-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use runtime::JSRuntime;
pub mod network;

pub mod js_utils;
pub mod pointer;
pub mod utils;

#[cfg(feature = "lsp")]
Expand Down Expand Up @@ -79,60 +78,4 @@ pub async fn create_runtime(
});

JSRuntime::run(config).await
}

/// Executes a Datex script and returns the result as a string.
#[wasm_bindgen]
pub fn execute(datex_script: &str, decompile_options: JsValue) -> String {
let result = compile_script(datex_script, CompileOptions::default());
if let Ok((dxb, _)) = result {
let input = ExecutionInput::new(
&dxb,
ExecutionOptions {
verbose: true,
..ExecutionOptions::default()
},
None,
);
let result = execute_dxb_sync(input).unwrap_or_else(|err| {
panic!("Failed to execute script: {err:?}");
});
let result = result.unwrap();
let (result_dxb, _) =
compile_template("?", &[Some(result)], CompileOptions::default())
.unwrap();

decompile_body(
&result_dxb,
from_value(decompile_options).unwrap_or_default(),
)
.unwrap_or_else(|err| {
panic!("Failed to decompile result: {err:?}");
})
} else {
panic!("Failed to compile script: {:?}", result.err());
}
}

/// Executes a Datex script and returns true when execution was successful.
/// Does not return the result of the script, but only indicates success or failure.
#[wasm_bindgen]
pub fn execute_internal(datex_script: &str) -> bool {
let result = compile_script(datex_script, CompileOptions::default());
if let Ok((dxb, _)) = result {
let input = ExecutionInput::new(
&dxb,
ExecutionOptions {
verbose: true,
..ExecutionOptions::default()
},
None,
);
let result = execute_dxb_sync(input).unwrap_or_else(|err| {
panic!("Failed to execute script: {err:?}");
});
result.is_some()
} else {
panic!("Failed to compile script: {:?}", result.err());
}
}
}
1 change: 0 additions & 1 deletion rs-lib/src/network/com_hub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ impl JSComHub {
&JsValue::UNDEFINED,
&value_container_to_dif_js_value(
&setup_data,
runtime.memory(),
),
)
.map_err(|e| {
Expand Down
22 changes: 0 additions & 22 deletions rs-lib/src/pointer.rs

This file was deleted.

Loading