@acentera/node 0.0.26 → 0.0.27
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/dist/index.d.ts +2 -0
- package/dist/index.js +41 -0
- package/index.ts +36 -0
- package/package.json +10 -5
package/dist/index.d.ts
ADDED
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.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
return require(libName);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default loadLibrary();
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acentera/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.27",
|
|
4
4
|
"description": "ACenterA library",
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
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
|
-
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"typescript": "^5.5.4"
|
|
33
|
+
}
|
|
29
34
|
}
|