wstp-node 0.4.1 → 0.4.2
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 +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wstp-node",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
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,26 @@
|
|
|
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
|
+
// npx picks up the node-gyp installed in node_modules/.bin.
|
|
20
|
+
const mode = process.argv[2] === 'debug' ? '--debug' : '--release';
|
|
21
|
+
execSync(`npx node-gyp rebuild ${mode}`, opts);
|
|
22
|
+
} else {
|
|
23
|
+
// macOS / Linux: use the hand-crafted bash script (faster, no gyp overhead).
|
|
24
|
+
const arg = process.argv[2] || ''; // '' | 'debug' | 'clean'
|
|
25
|
+
execSync(`bash build.sh ${arg}`, opts);
|
|
26
|
+
}
|