feat(js): new glue hash function

This commit is contained in:
frelodev 2024-08-27 16:09:44 +02:00
parent fc9247c5a8
commit 4a701818f2
4 changed files with 12 additions and 2 deletions

2
dist/js/build.sh vendored
View file

@ -1 +1 @@
npx napi build --release --cargo-cwd ../.. npx napi build --cargo-cwd ../..

View file

@ -1,6 +1,6 @@
{ {
"name": "@codemp/codemp", "name": "@codemp/codemp",
"version": "0.0.5", "version": "0.0.9-debug",
"dependencies": { "dependencies": {
"@napi-rs/cli": "^2.18.0", "@napi-rs/cli": "^2.18.0",

8
src/ffi/js/ext.rs Normal file
View file

@ -0,0 +1,8 @@
use napi_derive::napi;
use crate::hash;
#[napi(js_name = "hash")]
pub fn js_hash(str : String) -> napi::Result<i64>{
Ok(hash(str))
}

View file

@ -3,6 +3,8 @@ pub mod workspace;
pub mod cursor; pub mod cursor;
pub mod buffer; pub mod buffer;
pub mod op_cache; pub mod op_cache;
pub mod ext;
impl From<crate::Error> for napi::Error { impl From<crate::Error> for napi::Error {
fn from(value: crate::Error) -> Self { fn from(value: crate::Error) -> Self {