git.delta.rocks / jrsonnet / refs/commits / 4ea8dc2d6da9

difftreelog

feat(bindings) implement WASM

Лач2020-06-28parent: #85533fe.patch.diff
in: master

3 files changed

modifiedREADME.mddiffbeforeafterboth
--- a/README.md
+++ b/README.md
@@ -20,8 +20,7 @@
 ## Bindings
 
 C bindings (libjsonnet.so) are WIP
-
-Something is implemented, but mostly unusable for now
+JS bindings are WIP too, but also available in WASM form
 
 See them in `./bindings/jsonnet/`
 
modifiedbindings/Makefilediffbeforeafterboth
--- a/bindings/Makefile
+++ b/bindings/Makefile
@@ -10,3 +10,8 @@
 	ldd ./c/libjsonnet_test_file
 	valgrind --leak-check=full ./c/libjsonnet_test_file test.jsonnet
 
+../target/wasm32-wasi/release/jsonnet.wasm:
+	cd jsonnet && cargo wasi build --release -p jsonnet && cd ..
+
+test-js: ../target/wasm32-wasi/release/jsonnet.wasm
+	node --experimental-wasi-unstable-preview1 --experimental-wasm-bigint js/index
modifiedbindings/jsonnet/src/lib.rsdiffbeforeafterboth
16 rc::Rc,16 rc::Rc,
17};17};
18
19#[no_mangle]
20pub extern "C" fn _start() {}
1821
19#[no_mangle]22#[no_mangle]
20pub extern "C" fn jsonnet_version() -> &'static [u8; 8] {23pub extern "C" fn jsonnet_version() -> &'static [u8; 8] {