wstp-node 0.4.4 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wstp-node",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
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",
@@ -30,6 +30,7 @@
30
30
  "src/addon.cc",
31
31
  "scripts/wstp_dir.js",
32
32
  "scripts/install.js",
33
+ "scripts/diagnose-windows.ps1",
33
34
  "build.sh",
34
35
  "binding.gyp",
35
36
  "index.d.ts",
@@ -0,0 +1,58 @@
1
+ # diagnose-windows.ps1
2
+ # Run this in PowerShell to find the WSTP DeveloperKit on your Windows machine.
3
+ # It searches for the two files that wstp-node needs:
4
+ # wstp.h (C header)
5
+ # wstp64i4s.lib (static import library)
6
+ #
7
+ # Usage:
8
+ # powershell -ExecutionPolicy Bypass -File diagnose-windows.ps1
9
+
10
+ Write-Host "`n=== Searching for WSTP DeveloperKit files ===`n" -ForegroundColor Cyan
11
+
12
+ $files = @("wstp.h", "wstp64i4s.lib")
13
+ $searchRoots = @(
14
+ "C:\Program Files\Wolfram Research",
15
+ "C:\Program Files (x86)\Wolfram Research",
16
+ "$env:LOCALAPPDATA\Programs\Wolfram Research"
17
+ )
18
+
19
+ $found = @{}
20
+
21
+ foreach ($root in $searchRoots) {
22
+ if (-not (Test-Path $root)) { continue }
23
+ Write-Host "Searching under: $root" -ForegroundColor Gray
24
+ foreach ($file in $files) {
25
+ $results = Get-ChildItem -Path $root -Filter $file -Recurse -ErrorAction SilentlyContinue
26
+ foreach ($r in $results) {
27
+ Write-Host " FOUND $file at: $($r.FullName)" -ForegroundColor Green
28
+ $found[$file] = $r.DirectoryName
29
+ }
30
+ }
31
+ }
32
+
33
+ Write-Host ""
34
+
35
+ if ($found.Count -eq 0) {
36
+ Write-Host "Neither wstp.h nor wstp64i4s.lib found." -ForegroundColor Red
37
+ Write-Host "Make sure Wolfram Engine or Mathematica is installed."
38
+ exit 1
39
+ }
40
+
41
+ # If both are in the same directory, suggest WSTP_DIR
42
+ $dirs = $found.Values | Sort-Object -Unique
43
+ if ($dirs.Count -eq 1) {
44
+ $dir = $dirs[0]
45
+ Write-Host "Both files are in:" -ForegroundColor Cyan
46
+ Write-Host " $dir" -ForegroundColor Yellow
47
+ Write-Host ""
48
+ Write-Host "Run this before npm install:" -ForegroundColor Cyan
49
+ Write-Host " `$env:WSTP_DIR = `"$dir`"" -ForegroundColor Yellow
50
+ Write-Host " npm install" -ForegroundColor Yellow
51
+ } else {
52
+ Write-Host "Files found in different directories — use the directory containing both:" -ForegroundColor Yellow
53
+ foreach ($kv in $found.GetEnumerator()) {
54
+ Write-Host " $($kv.Key) => $($kv.Value)"
55
+ }
56
+ Write-Host ""
57
+ Write-Host "Set WSTP_DIR to the folder containing both files, then run npm install."
58
+ }
@@ -62,7 +62,11 @@ function resolve () {
62
62
  if (!fs.existsSync(path.join(wstp, 'wstp.h')) &&
63
63
  !fs.existsSync(path.join(wstp, 'wstp64i4s.lib'))) {
64
64
  process.stderr.write(
65
- `wstp_dir: WSTP DeveloperKit not found at expected path:\n ${wstp}\n`
65
+ `wstp_dir: found version "${versions[0]}" but WSTP DeveloperKit missing.\n` +
66
+ ` Expected these files inside:\n` +
67
+ ` ${wstp}\n` +
68
+ ` wstp.h (C header)\n` +
69
+ ` wstp64i4s.lib (static import library)\n`
66
70
  );
67
71
  continue;
68
72
  }
@@ -71,10 +75,15 @@ function resolve () {
71
75
 
72
76
  throw new Error(
73
77
  `WSTP DeveloperKit not found.\n` +
74
- `Tried under "${base}" for: ${products.join(', ')}\n\n` +
75
- `Set WSTP_DIR to your CompilerAdditions folder, e.g.:\n` +
78
+ `Searched under "${base}" for: ${products.join(', ')}\n\n` +
79
+ `The build needs these two files:\n` +
80
+ ` wstp.h (C header)\n` +
81
+ ` wstp64i4s.lib (static import library)\n\n` +
82
+ `Run the diagnostic script to find them:\n` +
83
+ ` powershell -ExecutionPolicy Bypass -File scripts\\diagnose-windows.ps1\n\n` +
84
+ `Then set WSTP_DIR to the folder containing both files and retry:\n` +
76
85
  ` set WSTP_DIR=C:\\Program Files\\Wolfram Research\\Wolfram Engine\\14.2\\SystemFiles\\Links\\WSTP\\DeveloperKit\\Windows-x86-64\\CompilerAdditions\n` +
77
- `then run npm install again.`
86
+ ` npm install`
78
87
  );
79
88
  }
80
89