@acentera/node 0.0.26 → 0.0.28

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.
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const os_1 = __importDefault(require("os"));
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ function loadLibrary() {
10
+ const arch = os_1.default.arch();
11
+ const platform = os_1.default.platform();
12
+ let libName;
13
+ if (platform === 'darwin') {
14
+ if (arch === 'x64') {
15
+ libName = 'acentera.dylib.x86';
16
+ }
17
+ else {
18
+ libName = 'acentera.dylib.arm64';
19
+ }
20
+ }
21
+ else if (platform === 'linux') {
22
+ if (arch === 'x64') {
23
+ libName = 'acentera';
24
+ }
25
+ else {
26
+ libName = 'acentera.arm64';
27
+ }
28
+ }
29
+ else {
30
+ throw new Error('Unsupported platform');
31
+ }
32
+ libName += '.node';
33
+ const filePath = path_1.default.join(__dirname, libName);
34
+ if (fs_1.default.existsSync(filePath)) {
35
+ return require(filePath);
36
+ }
37
+ else {
38
+ return require(libName);
39
+ }
40
+ }
41
+ exports.default = loadLibrary();
package/index.js CHANGED
@@ -31,6 +31,10 @@ function loadLibrary() {
31
31
  if (fs.existsSync(filePath)) {
32
32
  return require(filePath);
33
33
  } else {
34
+ const filePathLevelUp = path.join(__dirname, '/../', libName);
35
+ if (fs.existsSync(filePathLevelUp)) {
36
+ return require(filePathLevelUp);
37
+ }
34
38
  return require(libName);
35
39
  }
36
40
  }
package/index.ts ADDED
@@ -0,0 +1,40 @@
1
+ import os from 'os';
2
+ import fs from 'fs';
3
+ import path from 'path';
4
+
5
+ function loadLibrary(): any {
6
+ const arch = os.arch();
7
+ const platform = os.platform();
8
+
9
+ let libName: string;
10
+ if (platform === 'darwin') {
11
+ if (arch === 'x64') {
12
+ libName = 'acentera.dylib.x86';
13
+ } else {
14
+ libName = 'acentera.dylib.arm64';
15
+ }
16
+ } else if (platform === 'linux') {
17
+ if (arch === 'x64') {
18
+ libName = 'acentera';
19
+ } else {
20
+ libName = 'acentera.arm64';
21
+ }
22
+ } else {
23
+ throw new Error('Unsupported platform');
24
+ }
25
+
26
+ libName += '.node';
27
+ const filePath = path.join(__dirname, libName);
28
+
29
+ if (fs.existsSync(filePath)) {
30
+ return require(filePath);
31
+ } else {
32
+ const filePathLevelUp = path.join(__dirname, '/../', libName);
33
+ if (fs.existsSync(filePathLevelUp)) {
34
+ return require(filePathLevelUp);
35
+ }
36
+ return require(libName);
37
+ }
38
+ }
39
+
40
+ export default loadLibrary();
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "@acentera/node",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "ACenterA library",
5
- "main": "acentera.node",
6
- "scripts": {},
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc"
9
+ },
7
10
  "files": [
8
11
  "dist/",
9
12
  "*.node",
10
13
  "index.js",
14
+ "index.ts",
11
15
  "users.yaml"
12
16
  ],
13
17
  "repository": {
@@ -24,6 +28,7 @@
24
28
  "singleQuote": true,
25
29
  "trailingComma": "all"
26
30
  },
27
- "devDependencies": {},
28
- "dependencies": {}
31
+ "devDependencies": {
32
+ "typescript": "^5.5.4"
33
+ }
29
34
  }