gm-plugkit 2.0.1283 → 2.0.1285
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 +4 -1
- package/package.json +1 -1
- package/plugkit-wasm-wrapper.js +30 -3
- package/plugkit.sha256 +1 -1
- package/plugkit.version +1 -1
package/bootstrap.js
CHANGED
|
@@ -207,7 +207,10 @@ async function extractNpmPackageWasm(destPath, version) {
|
|
|
207
207
|
const args = ['install', '--no-audit', '--no-fund', '--no-save', NPM_PACKAGE + '@' + version];
|
|
208
208
|
const isCmdShim = process.platform === 'win32' && /\.(cmd|bat)$/i.test(cmd);
|
|
209
209
|
|
|
210
|
-
const
|
|
210
|
+
const spawnCmd = isCmdShim ? `"${cmd}"` : cmd;
|
|
211
|
+
const spawnArgs = isCmdShim ? args.map(a => /[\s"]/.test(a) ? `"${a.replace(/"/g, '\\"')}"` : a) : args;
|
|
212
|
+
|
|
213
|
+
const result = spawnSync(spawnCmd, spawnArgs, {
|
|
211
214
|
cwd: tempDir,
|
|
212
215
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
213
216
|
timeout: ATTEMPT_TIMEOUT_MS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1285",
|
|
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": {
|
package/plugkit-wasm-wrapper.js
CHANGED
|
@@ -638,10 +638,15 @@ function sleepSync(ms) {
|
|
|
638
638
|
}
|
|
639
639
|
|
|
640
640
|
function runPlaywriter(pw, args, timeoutMs) {
|
|
641
|
-
|
|
641
|
+
const allArgs = [...pw.baseArgs, ...args];
|
|
642
|
+
const useShell = !!pw.shell;
|
|
643
|
+
const spawnCmd = useShell && /\s/.test(pw.cmd) ? `"${pw.cmd}"` : pw.cmd;
|
|
644
|
+
const spawnArgs = useShell ? allArgs.map(a => /[\s"]/.test(String(a)) ? `"${String(a).replace(/"/g, '\\"')}"` : a) : allArgs;
|
|
645
|
+
return spawnSync(spawnCmd, spawnArgs, {
|
|
642
646
|
encoding: 'utf-8',
|
|
643
647
|
timeout: timeoutMs,
|
|
644
|
-
shell:
|
|
648
|
+
shell: useShell,
|
|
649
|
+
windowsHide: true,
|
|
645
650
|
env: process.env,
|
|
646
651
|
});
|
|
647
652
|
}
|
|
@@ -736,6 +741,27 @@ function isColdRunProfile(profileDir) {
|
|
|
736
741
|
}
|
|
737
742
|
}
|
|
738
743
|
|
|
744
|
+
function resolveManagedBrowserKey(pw) {
|
|
745
|
+
if (process.env.PLAYWRITER_BROWSER_KEY) {
|
|
746
|
+
const k = process.env.PLAYWRITER_BROWSER_KEY;
|
|
747
|
+
if (/^profile:/.test(k)) {
|
|
748
|
+
throw new Error(`PLAYWRITER_BROWSER_KEY=${k} points at a user OS browser profile; refusing — managed sessions must use install:Chromium:*`);
|
|
749
|
+
}
|
|
750
|
+
return k;
|
|
751
|
+
}
|
|
752
|
+
let text = '';
|
|
753
|
+
try {
|
|
754
|
+
const r = runPlaywriter(pw, ['browser', 'list'], 8000);
|
|
755
|
+
text = (r && (r.stdout || r.stderr)) || '';
|
|
756
|
+
} catch (e) {
|
|
757
|
+
throw new Error(`playwriter browser list failed: ${e.message}`);
|
|
758
|
+
}
|
|
759
|
+
const lines = text.split(/\r?\n/);
|
|
760
|
+
const installChromium = lines.map(l => (l.match(/\b(install:Chromium:[A-Za-z0-9_-]+)\b/) || [])[1]).find(Boolean);
|
|
761
|
+
if (installChromium) return installChromium;
|
|
762
|
+
throw new Error(`no managed Chromium install detected; playwriter browser list returned: ${scrubBrowserRunnerText(text).trim()}`);
|
|
763
|
+
}
|
|
764
|
+
|
|
739
765
|
function waitForExtensionReady(pw, profileDir, opts) {
|
|
740
766
|
const cold = (opts && typeof opts.cold === 'boolean') ? opts.cold : isColdRunProfile(profileDir);
|
|
741
767
|
const timeoutMs = (opts && opts.timeoutMs) || (cold ? 180000 : 30000);
|
|
@@ -745,10 +771,11 @@ function waitForExtensionReady(pw, profileDir, opts) {
|
|
|
745
771
|
let attempt = 0;
|
|
746
772
|
let lastErr = '';
|
|
747
773
|
let lastProgressAt = start;
|
|
774
|
+
const browserKey = resolveManagedBrowserKey(pw);
|
|
748
775
|
while (Date.now() < deadline) {
|
|
749
776
|
const remaining = deadline - Date.now();
|
|
750
777
|
const innerTimeout = Math.max(28000, Math.min(remaining, 30000));
|
|
751
|
-
const r = runPlaywriter(pw, ['session', 'new'], innerTimeout);
|
|
778
|
+
const r = runPlaywriter(pw, ['session', 'new', '--browser', browserKey], innerTimeout);
|
|
752
779
|
if (r && r.status === 0) return r;
|
|
753
780
|
lastErr = scrubBrowserRunnerText((r && (r.stderr || r.stdout)) || '');
|
|
754
781
|
const now = Date.now();
|
package/plugkit.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"plugkit.wasm":"
|
|
1
|
+
{"plugkit.wasm":"627006998cb293c98a69e06affaeace13a996e69c08cb63b44362b7a630ffc5e"}
|
package/plugkit.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.476
|