impitreq 0.1.22 → 0.1.26

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/index.js CHANGED
@@ -1,23 +1,33 @@
1
1
  const path = require('path');
2
+ const fs = require('fs');
2
3
 
3
- function resolvePrebuildPath() {
4
+ function getLibPath() {
4
5
  const platform = process.platform;
5
6
  const arch = process.arch;
7
+
8
+ let folder = '';
9
+ let file = '';
6
10
 
7
- if (platform === 'win32' && arch === 'x64') return path.join(__dirname, 'prebuilds', 'win32-x64', 'impitreq.dll');
8
- if (platform === 'linux' && arch === 'x64') return path.join(__dirname, 'prebuilds', 'linux-x64', 'impitreq.so');
9
- throw new Error(`Unsupported platform: ${platform}-${arch}`);
10
- }
11
+ if (platform === 'win32' && arch === 'x64') {
12
+ folder = 'win32-x64';
13
+ file = 'impitreq.dll';
14
+ } else if (platform === 'linux' && arch === 'x64') {
15
+ folder = 'linux-x64';
16
+ file = 'impitreq.so';
17
+ } else if (platform === 'darwin' && arch === 'x64') {
18
+ folder = 'darwin-x64';
19
+ file = 'impitreq.dylib';
20
+ } else {
21
+ throw new Error(`Unsupported platform: ${platform}-${arch}`);
22
+ }
11
23
 
12
- function getLibPath() {
13
- const libPath = resolvePrebuildPath();
14
- if (!libPath) {
15
- throw new Error('Prebuilt library path not resolved');
24
+ const libPath = path.join(__dirname, 'prebuilds', folder, file);
25
+ if (!fs.existsSync(libPath)) {
26
+ throw new Error(`Library not found at: ${libPath}.`);
16
27
  }
17
28
  return libPath;
18
29
  }
19
30
 
20
31
  module.exports = {
21
- getLibPath,
22
- resolvePrebuildPath,
32
+ getLibPath
23
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impitreq",
3
- "version": "0.1.22",
3
+ "version": "0.1.26",
4
4
  "description": "Platform-aware distribution of the impitreq c-shared library",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -8,19 +8,6 @@
8
8
  "files": [
9
9
  "index.js",
10
10
  "index.d.ts",
11
- "prebuilds/"
12
- ],
13
- "repository": {
14
- "type": "git",
15
- "url": "https://github.com/wengooooo/impit-repository"
16
- },
17
- "homepage": "https://github.com/wengooooo/impit-repository#readme",
18
- "keywords": [
19
- "impitreq",
20
- "cgo",
21
- "prebuilds",
22
- "windows",
23
- "linux"
24
- ],
25
- "author": "wengooooo"
11
+ "prebuilds"
12
+ ]
26
13
  }
Binary file
Binary file