@duckdb/node-bindings 1.1.3-alpha.10 → 1.1.3-alpha.12

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/duckdb.js +24 -1
  2. package/package.json +6 -6
package/duckdb.js CHANGED
@@ -1 +1,24 @@
1
- module.exports = require(`@duckdb/node-bindings-${process.platform}-${process.arch}/duckdb.node`);
1
+ const getRuntimePlatformArch = () => `${process.platform}-${process.arch}`;
2
+
3
+ /**
4
+ * @throw Error if there isn't any available native binding for the current platform/arch.
5
+ */
6
+ const getNativeNodeBinding = (runtimePlatformArch) => {
7
+ switch(runtimePlatformArch) {
8
+ case `linux-x64`:
9
+ return require('@duckdb/node-bindings-linux-x64/duckdb.node');
10
+ case 'linux-arm64':
11
+ return require('@duckdb/node-bindings-linux-arm64/duckdb.node');
12
+ case 'darwin-arm64':
13
+ return require('@duckdb/node-bindings-darwin-arm64/duckdb.node');
14
+ case 'darwin-x64':
15
+ return require('@duckdb/node-bindings-darwin-x64/duckdb.node');
16
+ case 'win32-x64':
17
+ return require('@duckdb/node-bindings-win32-x64/duckdb.node');
18
+ default:
19
+ const [platform, arch] = runtimePlatformArch.split('-')
20
+ throw new Error(`Error loading duckdb native binding: unsupported arch '${arch}' for platform '${platform}'`);
21
+ }
22
+ }
23
+
24
+ module.exports = getNativeNodeBinding(getRuntimePlatformArch());
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@duckdb/node-bindings",
3
- "version": "1.1.3-alpha.10",
3
+ "version": "1.1.3-alpha.12",
4
4
  "main": "./duckdb.js",
5
5
  "types": "./duckdb.d.ts",
6
6
  "optionalDependencies": {
7
- "@duckdb/node-bindings-darwin-arm64": "1.1.3-alpha.10",
8
- "@duckdb/node-bindings-linux-arm64": "1.1.3-alpha.10",
9
- "@duckdb/node-bindings-darwin-x64": "1.1.3-alpha.10",
10
- "@duckdb/node-bindings-linux-x64": "1.1.3-alpha.10",
11
- "@duckdb/node-bindings-win32-x64": "1.1.3-alpha.10"
7
+ "@duckdb/node-bindings-linux-arm64": "1.1.3-alpha.12",
8
+ "@duckdb/node-bindings-darwin-arm64": "1.1.3-alpha.12",
9
+ "@duckdb/node-bindings-darwin-x64": "1.1.3-alpha.12",
10
+ "@duckdb/node-bindings-win32-x64": "1.1.3-alpha.12",
11
+ "@duckdb/node-bindings-linux-x64": "1.1.3-alpha.12"
12
12
  },
13
13
  "repository": {
14
14
  "type": "git",