From 67f0e6a0541b46c298f93596d204b0d9d6f0c5b2 Mon Sep 17 00:00:00 2001 From: OneBigPotato <263071750@qq.com> Date: Fri, 23 Feb 2024 15:11:02 +0800 Subject: [PATCH 1/2] fix bug when trying to load this lib in a Worker Thread after load in main thread --- src/nodemurmurhash.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/nodemurmurhash.cc b/src/nodemurmurhash.cc index ff62f72..9c5d698 100644 --- a/src/nodemurmurhash.cc +++ b/src/nodemurmurhash.cc @@ -312,6 +312,23 @@ namespace MurmurHash { static_cast(ReadOnly | DontDelete) ).FromJust(); } + + + NODE_MODULE_INIT() { + Local bigEndian = Nan::New(); + InitWithOrder(bigEndian); + Nan::Set(exports, Nan::New("BE").ToLocalChecked(), bigEndian); + + Local littleEndian = Nan::New(); + InitWithOrder(littleEndian); + Nan::Set(exports, Nan::New("LE").ToLocalChecked(), littleEndian); + + Nan::Set(exports, Nan::New("platform").ToLocalChecked(), + IsBigEndian() ? bigEndian : littleEndian); + + InitWithOrder(exports); + } + } -NODE_MODULE(murmurhash, MurmurHash::Init) +//NODE_MODULE(murmurhash, MurmurHash::Init) From 3d21278a582c427e41185c92c4048c493fe93e30 Mon Sep 17 00:00:00 2001 From: OneBigPotato <263071750@qq.com> Date: Thu, 11 Apr 2024 13:46:28 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feature:=20=E5=8C=85=E5=90=8D=E5=92=8Cbinar?= =?UTF-8?q?y=E4=B8=8B=E8=BD=BD=E5=9C=B0=E5=9D=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 82c68d4..1243d25 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "murmurhash-native", + "name": "@northpool/murmurhash-native", "description": "MurmurHash (32,64,128)bit native bindings for nodejs", "keywords": [ "murmurhash", @@ -15,13 +15,19 @@ ], "version": "3.5.0", "license": "MIT", - "author": "RafaƂ Michalski ", + "author": "luz", "contributors": [], "homepage": "http://github.com/royaltm/node-murmurhash-native", "repository": { "type": "git", "url": "git+https://github.com/royaltm/node-murmurhash-native.git" }, + "binary": { + "module_name": "murmurhash", + "module_path": "./lib/{configuration}/", + "host": "https://gitee.com/lz_code/murmurhash-native-prebuilt/releases/download/v{version}/", + "package_name": "{platform}-{arch}.zip" + }, "scripts": { "install": "node-pre-gyp install --fallback-to-build", "test": "tap -C -Rclassic ./test/test*.js ./test/types/test*.js", @@ -32,12 +38,6 @@ "tsc": "tsc -p test/types", "typedoc": "typedoc --tsconfig test/types/tsconfig.json index.d.ts promisify.d.ts incremental.d.ts stream.d.ts" }, - "binary": { - "module_name": "murmurhash", - "module_path": "./lib/{configuration}/", - "host": "https://github.com/royaltm/node-murmurhash-native/releases/download/", - "remote_path": "v{version}" - }, "main": "index.js", "types": "index.d.ts", "typeScriptVersion": "2.0",