@haybarn/node-bindings 1.5.3-rc2
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/LICENSE +7 -0
- package/README.md +23 -0
- package/haybarn.d.ts +1509 -0
- package/haybarn.js +47 -0
- package/package.json +24 -0
package/haybarn.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const getRuntimePlatformArch = () => `${process.platform}-${process.arch}`;
|
|
2
|
+
|
|
3
|
+
// detect-libc uses Node's own diagnostic report (glibcVersionRuntime) as
|
|
4
|
+
// its primary check, with subprocess fallbacks for unusual environments.
|
|
5
|
+
// Wrapped in try/catch so a detection failure falls back to glibc rather
|
|
6
|
+
// than breaking binding load entirely.
|
|
7
|
+
const isLinuxMusl = () => {
|
|
8
|
+
try {
|
|
9
|
+
const { familySync, MUSL } = require('detect-libc');
|
|
10
|
+
return familySync() === MUSL;
|
|
11
|
+
} catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @throw Error if there isn't any available native binding for the current platform/arch.
|
|
18
|
+
*/
|
|
19
|
+
const getNativeNodeBinding = (runtimePlatformArch) => {
|
|
20
|
+
switch(runtimePlatformArch) {
|
|
21
|
+
case `linux-x64`:
|
|
22
|
+
return isLinuxMusl()
|
|
23
|
+
? require('@haybarn/node-bindings-linux-x64-musl/haybarn.node')
|
|
24
|
+
: require('@haybarn/node-bindings-linux-x64/haybarn.node');
|
|
25
|
+
case 'linux-arm64':
|
|
26
|
+
return isLinuxMusl()
|
|
27
|
+
? require('@haybarn/node-bindings-linux-arm64-musl/haybarn.node')
|
|
28
|
+
: require('@haybarn/node-bindings-linux-arm64/haybarn.node');
|
|
29
|
+
case 'darwin-arm64':
|
|
30
|
+
return require('@haybarn/node-bindings-darwin-arm64/haybarn.node');
|
|
31
|
+
case 'darwin-x64':
|
|
32
|
+
return require('@haybarn/node-bindings-darwin-x64/haybarn.node');
|
|
33
|
+
case 'win32-arm64':
|
|
34
|
+
return require('@haybarn/node-bindings-win32-arm64/haybarn.node');
|
|
35
|
+
case 'win32-x64':
|
|
36
|
+
return require('@haybarn/node-bindings-win32-x64/haybarn.node');
|
|
37
|
+
default:
|
|
38
|
+
const [platform, arch] = runtimePlatformArch.split('-');
|
|
39
|
+
try {
|
|
40
|
+
return require(`@haybarn/node-bindings-${platform}-${arch}/haybarn.node`);
|
|
41
|
+
} catch (err) {
|
|
42
|
+
throw new Error(`Error loading haybarn native binding: unsupported arch '${arch}' for platform '${platform}'`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
module.exports = getNativeNodeBinding(getRuntimePlatformArch());
|
package/package.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@haybarn/node-bindings",
|
|
3
|
+
"version": "1.5.3-rc2",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "./haybarn.js",
|
|
6
|
+
"types": "./haybarn.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"detect-libc": "^2.1.2"
|
|
9
|
+
},
|
|
10
|
+
"optionalDependencies": {
|
|
11
|
+
"@haybarn/node-bindings-darwin-arm64": "1.5.3-rc2",
|
|
12
|
+
"@haybarn/node-bindings-darwin-x64": "1.5.3-rc2",
|
|
13
|
+
"@haybarn/node-bindings-linux-arm64-musl": "1.5.3-rc2",
|
|
14
|
+
"@haybarn/node-bindings-linux-x64": "1.5.3-rc2",
|
|
15
|
+
"@haybarn/node-bindings-linux-arm64": "1.5.3-rc2",
|
|
16
|
+
"@haybarn/node-bindings-linux-x64-musl": "1.5.3-rc2",
|
|
17
|
+
"@haybarn/node-bindings-win32-x64": "1.5.3-rc2"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/Query-farm-haybarn/haybarn-node-neo.git"
|
|
22
|
+
},
|
|
23
|
+
"description": "Low-level Node bindings to the DuckDB C API, linked against Haybarn (libhaybarn)."
|
|
24
|
+
}
|