@swisseph/node 1.0.3 → 1.0.5
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/binding/swisseph_binding.cc +1 -0
- package/binding.gyp +8 -3
- package/dist/index.js +1 -1
- package/package.json +9 -4
- package/prebuilds/darwin-arm64/swisseph.node +0 -0
- package/prebuilds/linux-x64/swisseph.node +0 -0
- package/prebuilds/win32-x64/swisseph.node +0 -0
- package/scripts/setup-libswe.js +41 -0
package/binding.gyp
CHANGED
|
@@ -16,8 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"include_dirs": [
|
|
18
18
|
"<!@(node -p \"require('node-addon-api').include\")",
|
|
19
|
-
"libswe"
|
|
20
|
-
"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1"
|
|
19
|
+
"libswe"
|
|
21
20
|
],
|
|
22
21
|
"dependencies": [
|
|
23
22
|
"<!(node -p \"require('node-addon-api').gyp\")"
|
|
@@ -29,10 +28,16 @@
|
|
|
29
28
|
["OS=='mac'", {
|
|
30
29
|
"xcode_settings": {
|
|
31
30
|
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
|
|
31
|
+
"GCC_ENABLE_CPP_RTTI": "YES",
|
|
32
32
|
"CLANG_CXX_LIBRARY": "libc++",
|
|
33
33
|
"CLANG_CXX_LANGUAGE_STANDARD": "c++14",
|
|
34
34
|
"MACOSX_DEPLOYMENT_TARGET": "10.15",
|
|
35
|
-
"OTHER_CPLUSPLUSFLAGS": [
|
|
35
|
+
"OTHER_CPLUSPLUSFLAGS": [
|
|
36
|
+
"-std=c++14",
|
|
37
|
+
"-stdlib=libc++",
|
|
38
|
+
"-isysroot",
|
|
39
|
+
"<!@(xcrun --show-sdk-path)"
|
|
40
|
+
]
|
|
36
41
|
},
|
|
37
42
|
"cflags_cc": ["-std=c++14", "-stdlib=libc++"]
|
|
38
43
|
}],
|
package/dist/index.js
CHANGED
|
@@ -54,7 +54,7 @@ exports.close = close;
|
|
|
54
54
|
const core_1 = require("@swisseph/core");
|
|
55
55
|
const path = __importStar(require("path"));
|
|
56
56
|
// Import the native addon
|
|
57
|
-
const binding = require('
|
|
57
|
+
const binding = require('node-gyp-build')(path.join(__dirname, '..'));
|
|
58
58
|
// Track if ephemeris path has been explicitly set
|
|
59
59
|
let ephemerisPathSet = false;
|
|
60
60
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swisseph/node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Swiss Ephemeris for Node.js - high precision astronomical calculations with native bindings",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"binding.gyp",
|
|
19
19
|
"ephemeris",
|
|
20
20
|
"libswe",
|
|
21
|
-
"
|
|
21
|
+
"scripts",
|
|
22
|
+
"README.md",
|
|
23
|
+
"prebuilds"
|
|
22
24
|
],
|
|
23
25
|
"keywords": [
|
|
24
26
|
"astronomy",
|
|
@@ -48,6 +50,7 @@
|
|
|
48
50
|
},
|
|
49
51
|
"dependencies": {
|
|
50
52
|
"node-addon-api": "^7.1.0",
|
|
53
|
+
"node-gyp-build": "^4.8.4",
|
|
51
54
|
"@swisseph/core": "1.0.4"
|
|
52
55
|
},
|
|
53
56
|
"devDependencies": {
|
|
@@ -55,6 +58,7 @@
|
|
|
55
58
|
"@types/node": "^20.10.6",
|
|
56
59
|
"jest": "^29.7.0",
|
|
57
60
|
"node-gyp": "^10.0.1",
|
|
61
|
+
"prebuildify": "^6.0.1",
|
|
58
62
|
"ts-jest": "^29.1.1",
|
|
59
63
|
"ts-node": "^10.9.2",
|
|
60
64
|
"typescript": "^5.3.3"
|
|
@@ -63,9 +67,10 @@
|
|
|
63
67
|
"node": ">=14.0.0"
|
|
64
68
|
},
|
|
65
69
|
"scripts": {
|
|
66
|
-
"
|
|
70
|
+
"preinstall": "node scripts/setup-libswe.js",
|
|
71
|
+
"install": "node-gyp-build",
|
|
67
72
|
"copy:libswe": "mkdir -p libswe && cp ../../native/libswe/* libswe/",
|
|
68
|
-
"prebuild": "
|
|
73
|
+
"prebuild": "node scripts/setup-libswe.js && prebuildify --napi --strip --name swisseph",
|
|
69
74
|
"build": "node-gyp rebuild && tsc",
|
|
70
75
|
"build:native": "node-gyp rebuild",
|
|
71
76
|
"build:js": "tsc",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const sourceDir = path.resolve(__dirname, '../../../native/libswe');
|
|
5
|
+
const targetDir = path.resolve(__dirname, '../libswe');
|
|
6
|
+
|
|
7
|
+
// Function to copy files recursively
|
|
8
|
+
function copyDir(src, dest) {
|
|
9
|
+
if (!fs.existsSync(dest)) {
|
|
10
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
14
|
+
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
const srcPath = path.join(src, entry.name);
|
|
17
|
+
const destPath = path.join(dest, entry.name);
|
|
18
|
+
|
|
19
|
+
if (entry.isDirectory()) {
|
|
20
|
+
copyDir(srcPath, destPath);
|
|
21
|
+
} else {
|
|
22
|
+
fs.copyFileSync(srcPath, destPath);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Main logic
|
|
28
|
+
if (fs.existsSync(sourceDir)) {
|
|
29
|
+
console.log('Development environment detected (native source found).');
|
|
30
|
+
console.log(`Copying libswe files from ${sourceDir} to ${targetDir}...`);
|
|
31
|
+
try {
|
|
32
|
+
copyDir(sourceDir, targetDir);
|
|
33
|
+
console.log('Copy complete.');
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.error('Error copying files:', err);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
console.log('Production environment detected (no native source).');
|
|
40
|
+
console.log('Assuming libswe files are already present in the package.');
|
|
41
|
+
}
|