diff --git a/.eslintignore b/.eslintignore index b3f1511..c2b6b30 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ !.eslintrc.json !.mocharc.json -!.prettierrc.json \ No newline at end of file +!.prettierrc.json +!.release-please-manifest.json \ No newline at end of file diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b832e7e..d42dbf8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { ".": "2.0.0-beta.0" -} \ No newline at end of file +} diff --git a/lib/index.js b/lib/index.js index de38de8..b573d9b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,8 +1,17 @@ 'use strict'; -const zstd = require('bindings')('zstd'); const { promisify } = require('util'); const { isUint8Array } = require('util/types'); +function load() { + try { + return require('../build/Release/zstd.node'); + } catch { + return require('../build/Debug/zstd.node'); + } +} + +const zstd = load(); + const _compress = promisify(zstd.compress); const _decompress = promisify(zstd.decompress); // Error objects created via napi don't have JS stacks; wrap them so .stack is present diff --git a/package-lock.json b/package-lock.json index 55d1c31..28a2fd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "bindings": "^1.5.0", "node-addon-api": "^4.3.0", "prebuild-install": "^7.1.2" }, @@ -1086,14 +1085,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, "node_modules/bl": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.1.tgz", @@ -2285,11 +2276,6 @@ "node": ">=16.0.0" } }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "node_modules/fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", @@ -6578,14 +6564,6 @@ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", "dev": true }, - "bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "requires": { - "file-uri-to-path": "1.0.0" - } - }, "bl": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/bl/-/bl-3.0.1.tgz", @@ -7463,11 +7441,6 @@ "flat-cache": "^4.0.0" } }, - "file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" - }, "fill-range": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", diff --git a/package.json b/package.json index 92dfb38..e6b2312 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "addon/*" ], "dependencies": { - "bindings": "^1.5.0", "node-addon-api": "^4.3.0", "prebuild-install": "^7.1.2" },