Archify Diagram Viewer 0.1.0
VS Code extension that previews Archify diagrams from their JSON sources (live, as you type) and opens rendered Archify HTML in a viewer tab. Bundles the Archify 3.0.1 renderer and runs it on VS Code's Node runtime. Adds validation diagnostics, JSON schema help, source-link navigation, export saving, render-to-file and open-in-browser commands. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { checkForUpdate } from './check-update.mjs';
|
||||
|
||||
// The parent can be busy in synchronous renderer work. Enforce its original
|
||||
// deadline here, in a separate event loop, so cache work cannot continue late.
|
||||
if (!/^\d{1,30}$/.test(process.argv[2] || '')) process.exit(1);
|
||||
const deadlineAt = BigInt(process.argv[2]);
|
||||
const remainingMs = Number(deadlineAt - process.hrtime.bigint()) / 1_000_000;
|
||||
if (remainingMs <= 0) process.exit(1);
|
||||
const deadlineTimer = setTimeout(() => process.kill(process.pid, 'SIGKILL'), remainingMs);
|
||||
deadlineTimer.unref();
|
||||
|
||||
const result = await checkForUpdate({
|
||||
...(process.env.ARCHIFY_UPDATE_RELEASE_PATH
|
||||
? { releasePath: process.env.ARCHIFY_UPDATE_RELEASE_PATH } : {}),
|
||||
...(process.env.ARCHIFY_UPDATE_CACHE_DIRECTORY
|
||||
? { cacheDirectory: process.env.ARCHIFY_UPDATE_CACHE_DIRECTORY } : {}),
|
||||
// Leave time to record a failed fetch, so a slow network backs off instead
|
||||
// of being killed before its result reaches the cache.
|
||||
timeoutMs: Math.max(1, Math.floor(remainingMs - 150)),
|
||||
});
|
||||
process.stdout.write(`${JSON.stringify(result)}\n`);
|
||||
Reference in New Issue
Block a user