wstp-node 0.4.1 → 0.4.3
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/package.json +6 -5
- package/scripts/install.js +33 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wstp-node",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Native Node.js addon for Wolfram/Mathematica WSTP — kernel sessions with evaluation queue, streaming Print/messages, Dialog subsessions, and side-channel WstpReader",
|
|
5
5
|
"main": "build/Release/wstp.node",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"files": [
|
|
30
30
|
"src/addon.cc",
|
|
31
31
|
"scripts/wstp_dir.js",
|
|
32
|
+
"scripts/install.js",
|
|
32
33
|
"build.sh",
|
|
33
34
|
"binding.gyp",
|
|
34
35
|
"index.d.ts",
|
|
@@ -38,10 +39,10 @@
|
|
|
38
39
|
"test_interrupt_dialog.js"
|
|
39
40
|
],
|
|
40
41
|
"scripts": {
|
|
41
|
-
"install": "
|
|
42
|
-
"build": "
|
|
43
|
-
"build:debug": "
|
|
44
|
-
"clean": "
|
|
42
|
+
"install": "node scripts/install.js",
|
|
43
|
+
"build": "node scripts/install.js",
|
|
44
|
+
"build:debug": "node scripts/install.js debug",
|
|
45
|
+
"clean": "node scripts/install.js clean",
|
|
45
46
|
"test": "node test.js",
|
|
46
47
|
"demo": "node examples/demo.js"
|
|
47
48
|
},
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/install.js
|
|
3
|
+
* Cross-platform build entry point invoked by `npm install` / `npm run build`.
|
|
4
|
+
*
|
|
5
|
+
* macOS / Linux → bash build.sh (direct clang++ path, faster)
|
|
6
|
+
* Windows → node-gyp rebuild (MSVC via binding.gyp)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
const { execSync } = require('child_process');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
|
|
14
|
+
const root = path.resolve(__dirname, '..');
|
|
15
|
+
const opts = { cwd: root, stdio: 'inherit' };
|
|
16
|
+
|
|
17
|
+
if (process.platform === 'win32') {
|
|
18
|
+
// On Windows: use node-gyp via the local devDependency.
|
|
19
|
+
// --msvs_version 2022 avoids gyp failing to auto-detect VS via PowerShell
|
|
20
|
+
// (common when execution policy is Restricted or VS was just installed).
|
|
21
|
+
// Falls back gracefully if an older VS is the only one present.
|
|
22
|
+
const mode = process.argv[2] === 'debug' ? '--debug' : '--release';
|
|
23
|
+
try {
|
|
24
|
+
execSync(`npx node-gyp rebuild ${mode} --msvs_version 2022`, opts);
|
|
25
|
+
} catch (_e) {
|
|
26
|
+
// Retry without version pin in case they have VS 2019 etc.
|
|
27
|
+
execSync(`npx node-gyp rebuild ${mode}`, opts);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
// macOS / Linux: use the hand-crafted bash script (faster, no gyp overhead).
|
|
31
|
+
const arg = process.argv[2] || ''; // '' | 'debug' | 'clean'
|
|
32
|
+
execSync(`bash build.sh ${arg}`, opts);
|
|
33
|
+
}
|