gm-plugkit 2.0.1229 → 2.0.1230
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/bootstrap.js +23 -2
- package/package.json +1 -1
package/bootstrap.js
CHANGED
|
@@ -7,6 +7,28 @@ const os = require('os');
|
|
|
7
7
|
const crypto = require('crypto');
|
|
8
8
|
const { spawn, spawnSync } = require('child_process');
|
|
9
9
|
|
|
10
|
+
// Resolve a bare command name to its actual .exe on Windows. cmd.exe + .cmd
|
|
11
|
+
// shim chains re-enter conhost (visible window flash) even with
|
|
12
|
+
// windowsHide:true on the parent. Spawning the real .exe directly lets
|
|
13
|
+
// CREATE_NO_WINDOW propagate. See [[windows-spawn-cmd-shim-flash]].
|
|
14
|
+
function resolveWindowsExe(cmd) {
|
|
15
|
+
if (process.platform !== 'win32') return cmd;
|
|
16
|
+
try {
|
|
17
|
+
const r = spawnSync('where', [cmd], {
|
|
18
|
+
encoding: 'utf-8',
|
|
19
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
20
|
+
windowsHide: true,
|
|
21
|
+
timeout: 800,
|
|
22
|
+
});
|
|
23
|
+
if (r.status !== 0) return cmd;
|
|
24
|
+
const lines = (r.stdout || '').split(/\r?\n/).map(l => l.trim()).filter(Boolean);
|
|
25
|
+
const exe = lines.find(l => /\.exe$/i.test(l));
|
|
26
|
+
return exe || lines[0] || cmd;
|
|
27
|
+
} catch {
|
|
28
|
+
return cmd;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
10
32
|
const NPM_PACKAGE = 'plugkit-wasm';
|
|
11
33
|
const ATTEMPT_TIMEOUT_MS = 10 * 60 * 1000;
|
|
12
34
|
const MAX_ATTEMPTS = 3;
|
|
@@ -180,7 +202,7 @@ async function extractNpmPackageWasm(destPath, version) {
|
|
|
180
202
|
|
|
181
203
|
fs.writeFileSync(path.join(tempDir, 'package.json'), JSON.stringify({ name: 'plugkit-extract', version: '0.0.0', private: true }));
|
|
182
204
|
|
|
183
|
-
const cmd =
|
|
205
|
+
const cmd = resolveWindowsExe('npm');
|
|
184
206
|
const args = ['install', '--no-audit', '--no-fund', '--no-save', NPM_PACKAGE + '@' + version];
|
|
185
207
|
|
|
186
208
|
const result = spawnSync(cmd, args, {
|
|
@@ -189,7 +211,6 @@ async function extractNpmPackageWasm(destPath, version) {
|
|
|
189
211
|
timeout: ATTEMPT_TIMEOUT_MS,
|
|
190
212
|
encoding: 'utf8',
|
|
191
213
|
windowsHide: true,
|
|
192
|
-
shell: process.platform === 'win32',
|
|
193
214
|
});
|
|
194
215
|
|
|
195
216
|
if (result.error) throw result.error;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1230",
|
|
4
4
|
"description": "Bootstrap and daemon-spawn tool for gm plugkit binary. Downloads the correct platform binary, verifies SHA256, and starts the spool watcher daemon. Includes plugkit-wasm-wrapper for WASM-based spool watching.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|