@aztec-labs/kvdb 7.0.0-nightly.20260926.b
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.
- package/dest/index.d.ts +3 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +1 -0
- package/dest/platform.d.ts +8 -0
- package/dest/platform.d.ts.map +1 -0
- package/dest/platform.js +64 -0
- package/package.json +38 -0
package/dest/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
package/dest/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { findNapiBinary } from "./platform.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type Platform = "x86_64-linux" | "x86_64-darwin" | "aarch64-linux" | "aarch64-darwin";
|
|
2
|
+
/**
|
|
3
|
+
* Locate the kvdb NAPI addon (nodejs_module.node) for the current platform.
|
|
4
|
+
* @param customPath Optional explicit path to the addon (overrides detection).
|
|
5
|
+
* @returns Absolute path to the addon, or null if not found.
|
|
6
|
+
*/
|
|
7
|
+
export declare function findNapiBinary(customPath?: string): string | null;
|
|
8
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,QAAQ,GAChB,cAAc,GACd,eAAe,GACf,eAAe,GACf,gBAAgB,CAAC;AA6CrB;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAwBjE"}
|
package/dest/platform.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
const PLATFORM_TO_PACKAGE = {
|
|
6
|
+
"x86_64-linux": "@aztec-foundation/kvdb-linux-x64",
|
|
7
|
+
"x86_64-darwin": "@aztec-foundation/kvdb-darwin-x64",
|
|
8
|
+
"aarch64-linux": "@aztec-foundation/kvdb-linux-arm64",
|
|
9
|
+
"aarch64-darwin": "@aztec-foundation/kvdb-darwin-arm64",
|
|
10
|
+
};
|
|
11
|
+
const NAPI_BINARY = "nodejs_module.node";
|
|
12
|
+
function currentDir() {
|
|
13
|
+
return path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
}
|
|
15
|
+
function detectPlatform() {
|
|
16
|
+
if (process.arch === "x64" && process.platform === "linux")
|
|
17
|
+
return "x86_64-linux";
|
|
18
|
+
if (process.arch === "x64" && process.platform === "darwin")
|
|
19
|
+
return "x86_64-darwin";
|
|
20
|
+
if (process.arch === "arm64" && process.platform === "linux")
|
|
21
|
+
return "aarch64-linux";
|
|
22
|
+
if (process.arch === "arm64" && process.platform === "darwin")
|
|
23
|
+
return "aarch64-darwin";
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
function findArchPackageDir(platform) {
|
|
27
|
+
const packageName = PLATFORM_TO_PACKAGE[platform];
|
|
28
|
+
try {
|
|
29
|
+
const require = createRequire(import.meta.url);
|
|
30
|
+
return path.dirname(require.resolve(packageName + "/package.json"));
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
const siblingPackageDir = path.join(currentDir(), "..", "packages", packageName.split("/").pop());
|
|
34
|
+
return fs.existsSync(path.join(siblingPackageDir, "package.json"))
|
|
35
|
+
? siblingPackageDir
|
|
36
|
+
: null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Locate the kvdb NAPI addon (nodejs_module.node) for the current platform.
|
|
41
|
+
* @param customPath Optional explicit path to the addon (overrides detection).
|
|
42
|
+
* @returns Absolute path to the addon, or null if not found.
|
|
43
|
+
*/
|
|
44
|
+
export function findNapiBinary(customPath) {
|
|
45
|
+
if (customPath) {
|
|
46
|
+
return fs.existsSync(customPath) ? path.resolve(customPath) : null;
|
|
47
|
+
}
|
|
48
|
+
const envPath = process.env.AZTEC_KVDB_NAPI_PATH;
|
|
49
|
+
if (envPath) {
|
|
50
|
+
return fs.existsSync(envPath) ? path.resolve(envPath) : null;
|
|
51
|
+
}
|
|
52
|
+
const platform = detectPlatform();
|
|
53
|
+
if (!platform) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const archDir = findArchPackageDir(platform);
|
|
57
|
+
if (archDir) {
|
|
58
|
+
const candidate = path.join(archDir, NAPI_BINARY);
|
|
59
|
+
if (fs.existsSync(candidate)) {
|
|
60
|
+
return candidate;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aztec-labs/kvdb",
|
|
3
|
+
"version": "7.0.0-nightly.20260926.b",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dest/index.d.ts",
|
|
8
|
+
"default": "./dest/index.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dest/",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"clean": "rm -rf dest .tsbuildinfo",
|
|
17
|
+
"build": "tsc -p tsconfig.json",
|
|
18
|
+
"prepare_arch_packages": "./scripts/prepare_arch_packages.sh"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"tslib": "^2.4.0"
|
|
22
|
+
},
|
|
23
|
+
"optionalDependencies": {
|
|
24
|
+
"@aztec-labs/kvdb-darwin-arm64": "7.0.0-nightly.20260926.b",
|
|
25
|
+
"@aztec-labs/kvdb-darwin-x64": "7.0.0-nightly.20260926.b",
|
|
26
|
+
"@aztec-labs/kvdb-linux-arm64": "7.0.0-nightly.20260926.b",
|
|
27
|
+
"@aztec-labs/kvdb-linux-x64": "7.0.0-nightly.20260926.b"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^22.15.17",
|
|
31
|
+
"typescript": "^5.3.3"
|
|
32
|
+
},
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/AztecProtocol/aztec-packages.git",
|
|
36
|
+
"directory": "native-packages/kvdb/ts"
|
|
37
|
+
}
|
|
38
|
+
}
|