@based/db 0.0.3 → 0.0.5

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/basedDbNative.cjs +26 -0
  2. package/package.json +4 -3
@@ -0,0 +1,26 @@
1
+ const os = require('os')
2
+ const path = require('path')
3
+ const process = require('process')
4
+
5
+ const platform = os.platform()
6
+ const arch = os.arch()
7
+ const nodeVersion = process.version
8
+
9
+ const baseDir = path.join(__dirname, 'dist/lib')
10
+ let platformDir
11
+
12
+ switch (platform) {
13
+ case 'darwin':
14
+ platformDir = arch === 'arm64' ? 'darwin_aarch64' : 'darwin_x86_64'
15
+ break
16
+ case 'linux':
17
+ platformDir = arch === 'arm64' ? 'linux_aarch64' : 'linux_x86_64'
18
+ break
19
+ default:
20
+ throw new Error(`Unsupported platform: ${platform}`)
21
+ }
22
+
23
+ const libPath = path.join(baseDir, platformDir, `libnode-${nodeVersion}.node`)
24
+ const addon = require(libPath)
25
+
26
+ module.exports = addon
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@based/db",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/src/index.js",
@@ -27,10 +27,11 @@
27
27
  "dist/lib",
28
28
  "!*.map",
29
29
  "README.md",
30
- "package.json"
30
+ "package.json",
31
+ "basedDbNative.cjs"
31
32
  ],
32
33
  "dependencies": {
33
- "@based/schema": "5.0.0-alpha.0",
34
+ "@based/schema": "5.0.0-alpha.1",
34
35
  "@saulx/hash": "^3.0.0",
35
36
  "@saulx/utils": "^4.3.2",
36
37
  "picocolors": "^1.1.0"