@swisseph/node 1.0.4 → 1.0.6

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/README.md CHANGED
@@ -6,14 +6,21 @@ High precision astronomical calculations for Node.js using native bindings to th
6
6
 
7
7
  ```bash
8
8
  npm install @swisseph/node
9
+ # or
10
+ pnpm add @swisseph/node
11
+ # or
12
+ bun add @swisseph/node
9
13
  ```
10
14
 
11
15
  **Requirements:**
12
- - Node.js 14.0.0 or higher
13
- - C++ build tools for native compilation
16
+ - Node.js 14.0.0 or higher (or Bun)
17
+
18
+ **Prebuilt binaries are included** for common platforms (macOS, Linux, Windows). No C++ compiler needed for most users.
14
19
 
15
20
  <details>
16
- <summary>Installing build tools</summary>
21
+ <summary>Building from source (optional)</summary>
22
+
23
+ If prebuilt binaries aren't available for your platform, the package will automatically build from source. You'll need C++ build tools:
17
24
 
18
25
  **macOS:**
19
26
  ```bash
@@ -253,16 +260,21 @@ Complete documentation is available in the [GitHub repository](https://github.co
253
260
 
254
261
  ## Troubleshooting
255
262
 
263
+ **"Module did not self-register" or platform errors**
264
+ - The package includes prebuilt binaries for common platforms
265
+ - If your platform isn't supported, the package will try to build from source
266
+ - Install C++ build tools if needed (see "Building from source" above)
267
+ - Try rebuilding: `npm rebuild @swisseph/node`
268
+
256
269
  **Build fails with "node-gyp rebuild failed"**
257
- - Install C++ build tools (see installation section above)
270
+ - Install C++ build tools (see "Building from source" section above)
271
+ - On macOS: ensure Xcode Command Line Tools are installed
272
+ - On Windows: ensure Visual Studio Build Tools are installed
258
273
 
259
274
  **"Cannot find ephemeris files"**
260
275
  - Files are bundled with the package. Check `node_modules/@swisseph/node/ephemeris/` exists
261
276
  - If using custom files, verify path in `setEphemerisPath()`
262
277
 
263
- **"Module did not self-register"**
264
- - Rebuild for your Node.js version: `npm rebuild @swisseph/node`
265
-
266
278
  ## License
267
279
 
268
280
  AGPL-3.0 (same as Swiss Ephemeris)
@@ -1,3 +1,4 @@
1
+ #include <cstdint>
1
2
  #include <napi.h>
2
3
  #include "swephexp.h"
3
4
  #include <cstring>
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": ["-std=c++14", "-stdlib=libc++"]
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('../build/Release/swisseph.node');
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.4",
3
+ "version": "1.0.6",
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",
@@ -19,7 +19,8 @@
19
19
  "ephemeris",
20
20
  "libswe",
21
21
  "scripts",
22
- "README.md"
22
+ "README.md",
23
+ "prebuilds"
23
24
  ],
24
25
  "keywords": [
25
26
  "astronomy",
@@ -49,6 +50,7 @@
49
50
  },
50
51
  "dependencies": {
51
52
  "node-addon-api": "^7.1.0",
53
+ "node-gyp-build": "^4.8.4",
52
54
  "@swisseph/core": "1.0.4"
53
55
  },
54
56
  "devDependencies": {
@@ -56,6 +58,7 @@
56
58
  "@types/node": "^20.10.6",
57
59
  "jest": "^29.7.0",
58
60
  "node-gyp": "^10.0.1",
61
+ "prebuildify": "^6.0.1",
59
62
  "ts-jest": "^29.1.1",
60
63
  "ts-node": "^10.9.2",
61
64
  "typescript": "^5.3.3"
@@ -64,9 +67,10 @@
64
67
  "node": ">=14.0.0"
65
68
  },
66
69
  "scripts": {
67
- "install": "node scripts/setup-libswe.js && node-gyp rebuild",
70
+ "preinstall": "node scripts/setup-libswe.js",
71
+ "install": "node-gyp-build",
68
72
  "copy:libswe": "mkdir -p libswe && cp ../../native/libswe/* libswe/",
69
- "prebuild": "npm run copy:libswe",
73
+ "prebuild": "node scripts/setup-libswe.js && prebuildify --napi --strip --name swisseph",
70
74
  "build": "node-gyp rebuild && tsc",
71
75
  "build:native": "node-gyp rebuild",
72
76
  "build:js": "tsc",