rust-kgdb 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +35 -1
  2. package/package.json +6 -6
package/index.js CHANGED
@@ -1,4 +1,38 @@
1
- const { GraphDb, getVersion } = require('./rust-kgdb-napi.node')
1
+ // Platform-specific native module loading for NAPI-RS
2
+ const os = require('os')
3
+ const path = require('path')
4
+
5
+ function loadNativeBinding() {
6
+ const platform = os.platform()
7
+ const arch = os.arch()
8
+
9
+ // Map Node.js arch/platform to NAPI-RS naming convention
10
+ let nativeBinding
11
+
12
+ if (platform === 'darwin') {
13
+ if (arch === 'x64') {
14
+ nativeBinding = require('./rust-kgdb-napi.darwin-x64.node')
15
+ } else if (arch === 'arm64') {
16
+ nativeBinding = require('./rust-kgdb-napi.darwin-arm64.node')
17
+ }
18
+ } else if (platform === 'linux') {
19
+ if (arch === 'x64') {
20
+ nativeBinding = require('./rust-kgdb-napi.linux-x64-gnu.node')
21
+ } else if (arch === 'arm64') {
22
+ nativeBinding = require('./rust-kgdb-napi.linux-arm64-gnu.node')
23
+ }
24
+ } else if (platform === 'win32' && arch === 'x64') {
25
+ nativeBinding = require('./rust-kgdb-napi.win32-x64-msvc.node')
26
+ }
27
+
28
+ if (!nativeBinding) {
29
+ throw new Error(`Unsupported platform: ${platform}-${arch}. Please contact support.`)
30
+ }
31
+
32
+ return nativeBinding
33
+ }
34
+
35
+ const { GraphDb, getVersion } = loadNativeBinding()
2
36
 
3
37
  module.exports = {
4
38
  GraphDB: GraphDb, // Export as GraphDB for consistency
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rust-kgdb",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "High-performance RDF/SPARQL database with 100% W3C compliance, WCOJ execution, and distributed cluster support",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -56,10 +56,10 @@
56
56
  "*.node"
57
57
  ],
58
58
  "optionalDependencies": {
59
- "rust-kgdb-win32-x64-msvc": "0.2.0",
60
- "rust-kgdb-darwin-x64": "0.2.0",
61
- "rust-kgdb-linux-x64-gnu": "0.2.0",
62
- "rust-kgdb-darwin-arm64": "0.2.0",
63
- "rust-kgdb-linux-arm64-gnu": "0.2.0"
59
+ "rust-kgdb-win32-x64-msvc": "0.2.1",
60
+ "rust-kgdb-darwin-x64": "0.2.1",
61
+ "rust-kgdb-linux-x64-gnu": "0.2.1",
62
+ "rust-kgdb-darwin-arm64": "0.2.1",
63
+ "rust-kgdb-linux-arm64-gnu": "0.2.1"
64
64
  }
65
65
  }