gm-plugkit 2.0.1467 → 2.0.1469
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 +2 -12
- package/package.json +1 -1
- package/plugkit-wasm-wrapper.js +27 -0
package/bootstrap.js
CHANGED
|
@@ -329,14 +329,6 @@ async function extractNpmPackageWithRetry(destPath, version) {
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
|
|
332
|
-
function platformKey() {
|
|
333
|
-
const p = os.platform();
|
|
334
|
-
const a = os.arch();
|
|
335
|
-
if (p === 'win32') return a === 'arm64' ? 'win32-arm64' : 'win32-x64';
|
|
336
|
-
if (p === 'darwin') return a === 'arm64' ? 'darwin-arm64' : 'darwin-x64';
|
|
337
|
-
return (a === 'arm64' || a === 'aarch64') ? 'linux-arm64' : 'linux-x64';
|
|
338
|
-
}
|
|
339
|
-
|
|
340
332
|
function healIfShaMatches(binPath, expectedSha, sentinelPath, partialPath, kind) {
|
|
341
333
|
if (!fs.existsSync(binPath)) return false;
|
|
342
334
|
if (partialPath) { try { if (fs.existsSync(partialPath)) fs.unlinkSync(partialPath); } catch (_) {} }
|
|
@@ -428,10 +420,8 @@ function pruneOldVersions(root, keepVersion) {
|
|
|
428
420
|
try {
|
|
429
421
|
const entries = fs.readdirSync(root);
|
|
430
422
|
for (const e of entries) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (!isPlugkit && !isRtk) continue;
|
|
434
|
-
if (isPlugkit && e === `v${keepVersion}`) continue;
|
|
423
|
+
if (!e.startsWith('v')) continue;
|
|
424
|
+
if (e === `v${keepVersion}`) continue;
|
|
435
425
|
const dir = path.join(root, e);
|
|
436
426
|
const lock = path.join(dir, '.lock');
|
|
437
427
|
if (fs.existsSync(lock) && !isLockStale(lock)) continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-plugkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1469",
|
|
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
|
@@ -3109,6 +3109,30 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
3109
3109
|
// file ahead of a verified binary download poisons installedVersionAtTools() and causes an infinite
|
|
3110
3110
|
// drift-respawn thrash. Auto-update is notify-only until a sha-verified force-download path exists.
|
|
3111
3111
|
}
|
|
3112
|
+
function checkUpdateViaNpm(installed) {
|
|
3113
|
+
const req = https.get({
|
|
3114
|
+
host: 'registry.npmjs.org',
|
|
3115
|
+
path: '/plugkit-wasm/latest',
|
|
3116
|
+
headers: { 'user-agent': 'plugkit-watcher', 'accept': 'application/json' },
|
|
3117
|
+
timeout: 5000,
|
|
3118
|
+
}, (res) => {
|
|
3119
|
+
if (res.statusCode !== 200) { res.resume(); return; }
|
|
3120
|
+
const chunks = [];
|
|
3121
|
+
res.on('data', c => chunks.push(c));
|
|
3122
|
+
res.on('end', () => {
|
|
3123
|
+
try {
|
|
3124
|
+
const meta = JSON.parse(Buffer.concat(chunks).toString('utf-8'));
|
|
3125
|
+
const latest = meta && meta.version;
|
|
3126
|
+
if (!latest) return;
|
|
3127
|
+
writeSharedUpdateCache(latest, 200);
|
|
3128
|
+
applyUpdateCheckResult(installed, latest, 200);
|
|
3129
|
+
} catch (_) {}
|
|
3130
|
+
});
|
|
3131
|
+
});
|
|
3132
|
+
req.on('timeout', () => { try { req.destroy(); } catch (_) {} });
|
|
3133
|
+
req.on('error', () => {});
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3112
3136
|
function checkForUpdate() {
|
|
3113
3137
|
const installed = resolveVersion(instance);
|
|
3114
3138
|
const cached = readSharedUpdateCache();
|
|
@@ -3126,6 +3150,7 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
3126
3150
|
res.resume();
|
|
3127
3151
|
writeSharedUpdateCache(null, res.statusCode);
|
|
3128
3152
|
applyUpdateCheckResult(installed, null, res.statusCode);
|
|
3153
|
+
checkUpdateViaNpm(installed);
|
|
3129
3154
|
return;
|
|
3130
3155
|
}
|
|
3131
3156
|
const chunks = [];
|
|
@@ -3178,12 +3203,14 @@ async function runSpoolWatcher(instance, spoolDir) {
|
|
|
3178
3203
|
try { req.destroy(); } catch (_) {}
|
|
3179
3204
|
writeSharedUpdateCache(null, -1);
|
|
3180
3205
|
logUpdateCheckError({ error: 'timeout' });
|
|
3206
|
+
checkUpdateViaNpm(installed);
|
|
3181
3207
|
});
|
|
3182
3208
|
req.on('error', (e) => {
|
|
3183
3209
|
if (_checkErrored) return;
|
|
3184
3210
|
_checkErrored = true;
|
|
3185
3211
|
writeSharedUpdateCache(null, -2);
|
|
3186
3212
|
logUpdateCheckError({ error: String(e && e.message || e) });
|
|
3213
|
+
checkUpdateViaNpm(installed);
|
|
3187
3214
|
});
|
|
3188
3215
|
}
|
|
3189
3216
|
setTimeout(checkForUpdate, 10_000);
|