From 4a701818f284f8f04244b1370633f751ff7e2956 Mon Sep 17 00:00:00 2001 From: frelodev Date: Tue, 27 Aug 2024 16:09:44 +0200 Subject: [PATCH] feat(js): new glue hash function --- dist/js/build.sh | 2 +- dist/js/package.json | 2 +- src/ffi/js/ext.rs | 8 ++++++++ src/ffi/js/mod.rs | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/ffi/js/ext.rs diff --git a/dist/js/build.sh b/dist/js/build.sh index cbec9f9..ed9c465 100644 --- a/dist/js/build.sh +++ b/dist/js/build.sh @@ -1 +1 @@ -npx napi build --release --cargo-cwd ../.. \ No newline at end of file +npx napi build --cargo-cwd ../.. \ No newline at end of file diff --git a/dist/js/package.json b/dist/js/package.json index 6bec29c..2e9bf68 100644 --- a/dist/js/package.json +++ b/dist/js/package.json @@ -1,6 +1,6 @@ { "name": "@codemp/codemp", - "version": "0.0.5", + "version": "0.0.9-debug", "dependencies": { "@napi-rs/cli": "^2.18.0", diff --git a/src/ffi/js/ext.rs b/src/ffi/js/ext.rs new file mode 100644 index 0000000..cd905c4 --- /dev/null +++ b/src/ffi/js/ext.rs @@ -0,0 +1,8 @@ +use napi_derive::napi; +use crate::hash; + + +#[napi(js_name = "hash")] +pub fn js_hash(str : String) -> napi::Result{ + Ok(hash(str)) +} diff --git a/src/ffi/js/mod.rs b/src/ffi/js/mod.rs index e64036e..713b60f 100644 --- a/src/ffi/js/mod.rs +++ b/src/ffi/js/mod.rs @@ -3,6 +3,8 @@ pub mod workspace; pub mod cursor; pub mod buffer; pub mod op_cache; +pub mod ext; + impl From for napi::Error { fn from(value: crate::Error) -> Self {