@yorz/cli 0.1.4 → 0.1.6
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/dist/cli/index.js +133 -53
- package/dist/gui/assets/{abnfDiagram-VRR7QNED-BlILeZZA.js → abnfDiagram-VRR7QNED-Dk823f-p.js} +1 -1
- package/dist/gui/assets/{arc-C-xJpbjF.js → arc-CsAcQvy9.js} +1 -1
- package/dist/gui/assets/{architectureDiagram-ZJ3FMSHR-QdzNii0b.js → architectureDiagram-ZJ3FMSHR-9d29EB_v.js} +1 -1
- package/dist/gui/assets/{blockDiagram-677ZJIJ3-BQTAKTET.js → blockDiagram-677ZJIJ3-C_BdniYG.js} +1 -1
- package/dist/gui/assets/{c4Diagram-LMCZKHZV-YRh3fqeb.js → c4Diagram-LMCZKHZV-COHS5O60.js} +1 -1
- package/dist/gui/assets/channel-Cdj31qNd.js +1 -0
- package/dist/gui/assets/{chunk-2Q5K7J3B-Bgu-eeCS.js → chunk-2Q5K7J3B-CdpNMJAI.js} +1 -1
- package/dist/gui/assets/{chunk-32BRIVSS-DTLd8wsP.js → chunk-32BRIVSS-C-5zZ7Xl.js} +1 -1
- package/dist/gui/assets/{chunk-5VM5RSS4-Cct8HJoz.js → chunk-5VM5RSS4-DNMuZJaP.js} +1 -1
- package/dist/gui/assets/{chunk-EX3LRPZG-DBgaA_1N.js → chunk-EX3LRPZG-BGPzkMUB.js} +1 -1
- package/dist/gui/assets/{chunk-JWPE2WC7-DELoF8bV.js → chunk-JWPE2WC7-DKHh8QvM.js} +1 -1
- package/dist/gui/assets/{chunk-MOJQB5TN-Du6uREYs.js → chunk-MOJQB5TN-DjfrUCo1.js} +1 -1
- package/dist/gui/assets/{chunk-RYQCIY6F-CxO6cQdM.js → chunk-RYQCIY6F-CAOzG_fF.js} +1 -1
- package/dist/gui/assets/{chunk-V7JOEXUC-BiILBcGA.js → chunk-V7JOEXUC-CiYl0Zr6.js} +1 -1
- package/dist/gui/assets/{chunk-VR4S4FIN-BfY2RvG4.js → chunk-VR4S4FIN-C9R15N13.js} +1 -1
- package/dist/gui/assets/{chunk-XXDRQBXY-DmsZw6tB.js → chunk-XXDRQBXY-D08V--b4.js} +1 -1
- package/dist/gui/assets/classDiagram-OUVF2IWQ-BiCCYKL9.js +1 -0
- package/dist/gui/assets/classDiagram-v2-EOCWNBFH-BiCCYKL9.js +1 -0
- package/dist/gui/assets/{cose-bilkent-JH36ORCC-gX-8DSxS.js → cose-bilkent-JH36ORCC-h3WvWy31.js} +1 -1
- package/dist/gui/assets/{cynefin-VYW2F7L2-vOfRo7cL.js → cynefin-VYW2F7L2-BJJROAhw.js} +1 -1
- package/dist/gui/assets/{cynefinDiagram-TSTJHNR4-Dv66a7Rh.js → cynefinDiagram-TSTJHNR4-Cowr6YON.js} +1 -1
- package/dist/gui/assets/{dagre-VKFMJZFB-Rk64dDvT.js → dagre-VKFMJZFB-CHQSayFl.js} +1 -1
- package/dist/gui/assets/{diagram-FQU43EPY-CyW3IjmQ.js → diagram-FQU43EPY-Dkjm-gpD.js} +1 -1
- package/dist/gui/assets/{diagram-G47NLZAW-Caav47lW.js → diagram-G47NLZAW-CWzLjtMq.js} +1 -1
- package/dist/gui/assets/{diagram-NH7WQ7WH-_X3ihqNf.js → diagram-NH7WQ7WH-CJEfCmpn.js} +1 -1
- package/dist/gui/assets/{diagram-OA4YK3LP-CjbverOE.js → diagram-OA4YK3LP-DKXL4ZCg.js} +1 -1
- package/dist/gui/assets/{diagram-WEI45ONY-B93ZeTtT.js → diagram-WEI45ONY-CLvc8CSB.js} +1 -1
- package/dist/gui/assets/{ebnfDiagram-CCIWWBDH-CdDt4bWx.js → ebnfDiagram-CCIWWBDH-D6NViEZ2.js} +1 -1
- package/dist/gui/assets/{erDiagram-Q63AITRT-Bypq-rvj.js → erDiagram-Q63AITRT-B2mRc5jq.js} +1 -1
- package/dist/gui/assets/{flowDiagram-23GEKE2U-b-l8_7KP.js → flowDiagram-23GEKE2U-Bu2CgXeG.js} +1 -1
- package/dist/gui/assets/{ganttDiagram-NO4QXBWP-BeZFHLhX.js → ganttDiagram-NO4QXBWP-CLqVFiRj.js} +1 -1
- package/dist/gui/assets/{gitGraphDiagram-IHSO6WYX-C0siPGLA.js → gitGraphDiagram-IHSO6WYX-BCeVlEhg.js} +1 -1
- package/dist/gui/assets/index-BCf1jTQa.css +1 -0
- package/dist/gui/assets/index-BYq7_4Z-.js +663 -0
- package/dist/gui/assets/{infoDiagram-FWYZ7A6U-Bk8DNKgG.js → infoDiagram-FWYZ7A6U-CaGDhrD8.js} +1 -1
- package/dist/gui/assets/{ishikawaDiagram-FXEZZL3T-DyS4wmJu.js → ishikawaDiagram-FXEZZL3T-D-IBVo_N.js} +1 -1
- package/dist/gui/assets/{journeyDiagram-5HDEW3XC-4jUY7Bzi.js → journeyDiagram-5HDEW3XC-lxFR0Z8q.js} +1 -1
- package/dist/gui/assets/{kanban-definition-HUTT4EX6-BRiI4KbM.js → kanban-definition-HUTT4EX6-C1Quf86J.js} +1 -1
- package/dist/gui/assets/{linear-C5JkbjyJ.js → linear-BmiZLs2L.js} +1 -1
- package/dist/gui/assets/{mermaid.core-ImB_5gdE.js → mermaid.core-Qqp0pI8e.js} +4 -4
- package/dist/gui/assets/{mindmap-definition-LN4V7U3C-9_Awmd2W.js → mindmap-definition-LN4V7U3C-CiuAQSSr.js} +1 -1
- package/dist/gui/assets/{pegDiagram-2B236MQR-DF_vIYzp.js → pegDiagram-2B236MQR-BWjeZxVp.js} +1 -1
- package/dist/gui/assets/{pieDiagram-ENE6RG2P-3TPwXSjQ.js → pieDiagram-ENE6RG2P-C2aubU3s.js} +1 -1
- package/dist/gui/assets/{quadrantDiagram-ABIIQ3AL-jzJ30mNi.js → quadrantDiagram-ABIIQ3AL-l-nU_0aa.js} +1 -1
- package/dist/gui/assets/{railroadDiagram-RFXS5EU6-B-29q3CI.js → railroadDiagram-RFXS5EU6-CLs3ePNd.js} +1 -1
- package/dist/gui/assets/{requirementDiagram-TGXJPOKE-BanWpS6g.js → requirementDiagram-TGXJPOKE-noC5_aOI.js} +1 -1
- package/dist/gui/assets/{sankeyDiagram-HTMAVEWB-B_sxc9IV.js → sankeyDiagram-HTMAVEWB-CrVWROCY.js} +1 -1
- package/dist/gui/assets/{sequenceDiagram-DBY2YBRQ-BNVav9DA.js → sequenceDiagram-DBY2YBRQ-rrdT6eIu.js} +1 -1
- package/dist/gui/assets/{sizeCapture-X5ZJPWSS-DbaiKjno.js → sizeCapture-X5ZJPWSS-DvpoOhEJ.js} +1 -1
- package/dist/gui/assets/{stateDiagram-2N3HPSRC-jU5WBm6c.js → stateDiagram-2N3HPSRC-B2ui4ZZN.js} +1 -1
- package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-B_Wcpq2b.js +1 -0
- package/dist/gui/assets/{swimlanes-5IMT3BWC-Dcmb64x2.js → swimlanes-5IMT3BWC-DRhf5jKL.js} +2 -2
- package/dist/gui/assets/swimlanesDiagram-G3AALYLV-C2fsQgny.js +8 -0
- package/dist/gui/assets/{timeline-definition-FHXFAJF6-COm9ow7j.js → timeline-definition-FHXFAJF6-rm68zqM2.js} +1 -1
- package/dist/gui/assets/{vennDiagram-L72KCM5P-DliDuTVY.js → vennDiagram-L72KCM5P-BKVMfPvL.js} +1 -1
- package/dist/gui/assets/{wardleyDiagram-EHGQE667-C2O_2cpw.js → wardleyDiagram-EHGQE667-eXN3NRZ7.js} +1 -1
- package/dist/gui/assets/{xychartDiagram-FW5EYKEG-Ldmt9hoc.js → xychartDiagram-FW5EYKEG-3VtYytF2.js} +1 -1
- package/dist/gui/index.html +2 -2
- package/package.json +13 -1
- package/dist/_commonjsHelpers-DyI1JsEH.js +0 -34
- package/dist/abnfDiagram-VRR7QNED-UQS77aUi.js +0 -119
- package/dist/api-DrYc_Ds_.js +0 -129852
- package/dist/arc-B1cAL3U1.js +0 -132
- package/dist/architectureDiagram-ZJ3FMSHR-CfWOhs-q.js +0 -8816
- package/dist/blockDiagram-677ZJIJ3-CLOAAFZa.js +0 -3796
- package/dist/c4Diagram-LMCZKHZV-BGdELGkb.js +0 -2483
- package/dist/certs-BeimSwB3.js +0 -14071
- package/dist/certs-C4t5lAmJ.js +0 -14071
- package/dist/certs-CLLngjpY.js +0 -14071
- package/dist/certs-D3fTB-0_.js +0 -14071
- package/dist/channel-_gQD3mZ8.js +0 -8
- package/dist/chunk-2Q5K7J3B-DIJkMPWD.js +0 -20
- package/dist/chunk-32BRIVSS-CIQb7-9I.js +0 -117
- package/dist/chunk-5VM5RSS4-DmlAsh6o.js +0 -20
- package/dist/chunk-EX3LRPZG-BEXyn5R-.js +0 -1989
- package/dist/chunk-JWPE2WC7-XiIefccF.js +0 -17
- package/dist/chunk-MOJQB5TN-CC5OBDWw.js +0 -861
- package/dist/chunk-RYQCIY6F-DQacsGpB.js +0 -475
- package/dist/chunk-V7JOEXUC-TLRsIUvf.js +0 -2027
- package/dist/chunk-VR4S4FIN-9AfN7RDF.js +0 -25
- package/dist/chunk-XXDRQBXY-DhWucSRr.js +0 -14
- package/dist/classDiagram-OUVF2IWQ-CN55rRkB.js +0 -20
- package/dist/classDiagram-v2-EOCWNBFH-CN55rRkB.js +0 -20
- package/dist/cose-bilkent-JH36ORCC-8uGYe6_d.js +0 -4944
- package/dist/cynefin-VYW2F7L2-BwTeE-TI.js +0 -32061
- package/dist/cynefinDiagram-TSTJHNR4-DM7ixE-v.js +0 -454
- package/dist/cytoscape.esm-BTopYfIb.js +0 -30347
- package/dist/dagre-VKFMJZFB-blEDoYen.js +0 -522
- package/dist/defaultLocale-wHUL1xE2.js +0 -207
- package/dist/diagram-FQU43EPY-MEZlmmdi.js +0 -633
- package/dist/diagram-G47NLZAW-DZOZvHqp.js +0 -857
- package/dist/diagram-NH7WQ7WH-ChpmPbZz.js +0 -213
- package/dist/diagram-OA4YK3LP-oy4yvrnL.js +0 -489
- package/dist/diagram-WEI45ONY-B3nx1cYt.js +0 -305
- package/dist/ebnfDiagram-CCIWWBDH-BASj7BoO.js +0 -139
- package/dist/erDiagram-Q63AITRT-lujHq-S9.js +0 -1239
- package/dist/flowDiagram-23GEKE2U-BdsAVPgU.js +0 -2349
- package/dist/ganttDiagram-NO4QXBWP-DUUP4lsu.js +0 -3733
- package/dist/gitGraphDiagram-IHSO6WYX-BdIPAtb0.js +0 -1374
- package/dist/graph-CE8jV7cI.js +0 -2043
- package/dist/gui/assets/channel-DGoXAS0B.js +0 -1
- package/dist/gui/assets/classDiagram-OUVF2IWQ-B4zeZ0PC.js +0 -1
- package/dist/gui/assets/classDiagram-v2-EOCWNBFH-B4zeZ0PC.js +0 -1
- package/dist/gui/assets/index-Bp9JnkhK.css +0 -1
- package/dist/gui/assets/index-DKVgyltQ.js +0 -21
- package/dist/gui/assets/stateDiagram-v2-6OUMAXLB-GXq_r-DG.js +0 -1
- package/dist/gui/assets/swimlanesDiagram-G3AALYLV-DDE-INgq.js +0 -8
- package/dist/index--GoVvfUP.js +0 -5447
- package/dist/index-3-WDiDAh.js +0 -5466
- package/dist/index-CHBXZAxg.js +0 -5460
- package/dist/index-DeCq8xn7.js +0 -5460
- package/dist/infoDiagram-FWYZ7A6U-D9wo93kg.js +0 -32
- package/dist/init-DDGa2CQM.js +0 -17
- package/dist/ishikawaDiagram-FXEZZL3T-DZh3_kt2.js +0 -968
- package/dist/journeyDiagram-5HDEW3XC-C8RWHIn0.js +0 -1256
- package/dist/kanban-definition-HUTT4EX6-B7qQtB5a.js +0 -1053
- package/dist/katex-WjDlQEfU.js +0 -14500
- package/dist/layout-DQAYh_L7.js +0 -2360
- package/dist/linear-C_kZRZXS.js +0 -341
- package/dist/map-BElV7BMC.js +0 -299
- package/dist/mermaid.core-Dy_tFRs7.js +0 -26495
- package/dist/mindmap-definition-LN4V7U3C-BzHCd5Ab.js +0 -1181
- package/dist/ordinal-C2kkg180.js +0 -77
- package/dist/pegDiagram-2B236MQR-B046bQWM.js +0 -127
- package/dist/pieDiagram-ENE6RG2P-B5_W2CZy.js +0 -316
- package/dist/quadrantDiagram-ABIIQ3AL-Bbpt496h.js +0 -1342
- package/dist/railroadDiagram-RFXS5EU6-10XIH3X0.js +0 -93
- package/dist/requirementDiagram-TGXJPOKE-Dt1QyccY.js +0 -1205
- package/dist/sankeyDiagram-HTMAVEWB-CnqRAq7M.js +0 -1274
- package/dist/sequenceDiagram-DBY2YBRQ-DtJLSXoz.js +0 -4515
- package/dist/sizeCapture-X5ZJPWSS-DUl5ZEo3.js +0 -63
- package/dist/stateDiagram-2N3HPSRC-b-qzcVNj.js +0 -449
- package/dist/stateDiagram-v2-6OUMAXLB-KjDlRfc7.js +0 -20
- package/dist/swimlanes-5IMT3BWC-CAjGnQLa.js +0 -8553
- package/dist/swimlanesDiagram-G3AALYLV-DiOi9bzU.js +0 -16
- package/dist/timeline-definition-FHXFAJF6-Bme2FWbh.js +0 -1597
- package/dist/vennDiagram-L72KCM5P-BUQgnZDB.js +0 -2516
- package/dist/wardleyDiagram-EHGQE667-DHR2Avlu.js +0 -976
- package/dist/xychartDiagram-FW5EYKEG-V4K5eBMS.js +0 -2000
package/dist/cli/index.js
CHANGED
|
@@ -10,13 +10,14 @@ import { Hono } from "hono";
|
|
|
10
10
|
import { randomUUID, createHash } from "node:crypto";
|
|
11
11
|
import { promisify } from "node:util";
|
|
12
12
|
import { streamSSE } from "hono/streaming";
|
|
13
|
+
import { fileURLToPath } from "node:url";
|
|
13
14
|
import trash from "trash";
|
|
14
15
|
import matter from "gray-matter";
|
|
15
16
|
import chokidar from "chokidar";
|
|
16
17
|
import { EventEmitter } from "node:events";
|
|
17
18
|
import { createInterface } from "node:readline/promises";
|
|
18
19
|
import MarkdownIt from "markdown-it";
|
|
19
|
-
const version = "0.1.
|
|
20
|
+
const version = "0.1.6";
|
|
20
21
|
const pkg = {
|
|
21
22
|
version
|
|
22
23
|
};
|
|
@@ -2229,9 +2230,14 @@ function createStaticRoutes(guiRoot) {
|
|
|
2229
2230
|
return app;
|
|
2230
2231
|
}
|
|
2231
2232
|
function defaultGuiRoot() {
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2233
|
+
try {
|
|
2234
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
2235
|
+
return resolve(here, "..", "gui");
|
|
2236
|
+
} catch {
|
|
2237
|
+
const entry = process.argv[1];
|
|
2238
|
+
if (entry) return resolve(dirname(entry), "..", "gui");
|
|
2239
|
+
return resolve(process.cwd(), "dist", "gui");
|
|
2240
|
+
}
|
|
2235
2241
|
}
|
|
2236
2242
|
function resolveStaticFile(root, urlPath) {
|
|
2237
2243
|
const safe = normalize(urlPath).replace(/^\/+/, "");
|
|
@@ -4352,8 +4358,7 @@ async function runServe(opts) {
|
|
|
4352
4358
|
cwd: opts.cwd ?? process.cwd(),
|
|
4353
4359
|
noRegisterCwd: opts.noRegisterCwd
|
|
4354
4360
|
});
|
|
4355
|
-
await
|
|
4356
|
-
version: 1,
|
|
4361
|
+
await upsertProcess({
|
|
4357
4362
|
pid: process.pid,
|
|
4358
4363
|
port: handle.port,
|
|
4359
4364
|
url: handle.url,
|
|
@@ -4375,8 +4380,9 @@ async function runServe(opts) {
|
|
|
4375
4380
|
}
|
|
4376
4381
|
function startBackgroundServe(opts) {
|
|
4377
4382
|
return withStartLock(async () => {
|
|
4378
|
-
const
|
|
4379
|
-
if (
|
|
4383
|
+
const live = await readLiveProcesses();
|
|
4384
|
+
if (live.length > 0) {
|
|
4385
|
+
const existing = live[0];
|
|
4380
4386
|
console.log(`YorZ Service is already running in background (pid=${existing.pid}).`);
|
|
4381
4387
|
console.log(`Open ${existing.url}`);
|
|
4382
4388
|
console.log(`Stop with: yorz serve stop`);
|
|
@@ -4418,47 +4424,72 @@ function backgroundArgs(opts) {
|
|
|
4418
4424
|
return args;
|
|
4419
4425
|
}
|
|
4420
4426
|
async function runStopServe() {
|
|
4421
|
-
const
|
|
4422
|
-
if (
|
|
4427
|
+
const all = await readAllProcesses();
|
|
4428
|
+
if (all.length === 0) {
|
|
4423
4429
|
return {
|
|
4424
4430
|
stopped: false,
|
|
4431
|
+
stoppedPids: [],
|
|
4432
|
+
urls: [],
|
|
4425
4433
|
message: "YorZ Service is not running."
|
|
4426
4434
|
};
|
|
4427
4435
|
}
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
stopped: false,
|
|
4432
|
-
pid: runtime.pid,
|
|
4433
|
-
url: runtime.url,
|
|
4434
|
-
message: `YorZ Service was not running; removed stale runtime for pid=${runtime.pid}.`
|
|
4435
|
-
};
|
|
4436
|
-
}
|
|
4437
|
-
try {
|
|
4438
|
-
process.kill(runtime.pid, "SIGTERM");
|
|
4439
|
-
} catch (err) {
|
|
4436
|
+
const alive = all.filter((p) => isProcessAlive(p.pid));
|
|
4437
|
+
const dead = all.filter((p) => !isProcessAlive(p.pid));
|
|
4438
|
+
if (alive.length === 0) {
|
|
4440
4439
|
await removeRuntime();
|
|
4440
|
+
const deadPidList = dead.map((p) => `pid=${p.pid}`).join(", ");
|
|
4441
4441
|
return {
|
|
4442
4442
|
stopped: false,
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
message: `
|
|
4443
|
+
stoppedPids: [],
|
|
4444
|
+
urls: [],
|
|
4445
|
+
message: `YorZ Service was not running; removed stale runtime for ${deadPidList}.`
|
|
4446
4446
|
};
|
|
4447
4447
|
}
|
|
4448
|
-
|
|
4449
|
-
|
|
4448
|
+
const stoppedPids = [];
|
|
4449
|
+
const stoppedUrls = [];
|
|
4450
|
+
const failedPids = [];
|
|
4451
|
+
for (const proc of alive) {
|
|
4450
4452
|
try {
|
|
4451
|
-
process.kill(
|
|
4453
|
+
process.kill(proc.pid, "SIGTERM");
|
|
4452
4454
|
} catch {
|
|
4455
|
+
failedPids.push(proc.pid);
|
|
4456
|
+
continue;
|
|
4457
|
+
}
|
|
4458
|
+
let stopped = await waitForProcessExit(proc.pid, 2e3);
|
|
4459
|
+
if (!stopped) {
|
|
4460
|
+
try {
|
|
4461
|
+
process.kill(proc.pid, "SIGKILL");
|
|
4462
|
+
} catch {
|
|
4463
|
+
}
|
|
4464
|
+
stopped = await waitForProcessExit(proc.pid, 2e3);
|
|
4453
4465
|
}
|
|
4454
|
-
|
|
4466
|
+
if (stopped) {
|
|
4467
|
+
stoppedPids.push(proc.pid);
|
|
4468
|
+
stoppedUrls.push(proc.url);
|
|
4469
|
+
} else {
|
|
4470
|
+
failedPids.push(proc.pid);
|
|
4471
|
+
}
|
|
4472
|
+
}
|
|
4473
|
+
if (failedPids.length === 0) {
|
|
4474
|
+
await removeRuntime();
|
|
4475
|
+
} else {
|
|
4476
|
+
await writeAllProcesses(all.filter((p) => failedPids.includes(p.pid)));
|
|
4477
|
+
}
|
|
4478
|
+
const pidList = stoppedPids.map((p) => `pid=${p}`).join(", ");
|
|
4479
|
+
if (failedPids.length > 0) {
|
|
4480
|
+
const failedList = failedPids.map((p) => `pid=${p}`).join(", ");
|
|
4481
|
+
return {
|
|
4482
|
+
stopped: stoppedPids.length > 0,
|
|
4483
|
+
stoppedPids,
|
|
4484
|
+
urls: stoppedUrls,
|
|
4485
|
+
message: `Stopped ${stoppedPids.length} process(es): ${pidList}. Still running: ${failedList}.`
|
|
4486
|
+
};
|
|
4455
4487
|
}
|
|
4456
|
-
if (stopped) await removeRuntime();
|
|
4457
4488
|
return {
|
|
4458
|
-
stopped,
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
message:
|
|
4489
|
+
stopped: true,
|
|
4490
|
+
stoppedPids,
|
|
4491
|
+
urls: stoppedUrls,
|
|
4492
|
+
message: `Stopped ${stoppedPids.length} YorZ Service process(es): ${pidList}.`
|
|
4462
4493
|
};
|
|
4463
4494
|
}
|
|
4464
4495
|
function runtimePath() {
|
|
@@ -4489,8 +4520,8 @@ async function withStartLock(fn) {
|
|
|
4489
4520
|
async function waitForLiveRuntime(timeoutMs) {
|
|
4490
4521
|
const until = Date.now() + timeoutMs;
|
|
4491
4522
|
while (Date.now() < until) {
|
|
4492
|
-
const
|
|
4493
|
-
if (
|
|
4523
|
+
const live = await readLiveProcesses();
|
|
4524
|
+
if (live.length > 0) return live[0];
|
|
4494
4525
|
await sleep(100);
|
|
4495
4526
|
}
|
|
4496
4527
|
return null;
|
|
@@ -4498,42 +4529,91 @@ async function waitForLiveRuntime(timeoutMs) {
|
|
|
4498
4529
|
async function waitForRuntime(pid, timeoutMs) {
|
|
4499
4530
|
const until = Date.now() + timeoutMs;
|
|
4500
4531
|
while (Date.now() < until) {
|
|
4501
|
-
const
|
|
4502
|
-
|
|
4532
|
+
const live = await readLiveProcesses();
|
|
4533
|
+
const match = live.find((p) => pid === void 0 || p.pid === pid);
|
|
4534
|
+
if (match) return match;
|
|
4503
4535
|
await sleep(100);
|
|
4504
4536
|
}
|
|
4505
4537
|
return null;
|
|
4506
4538
|
}
|
|
4507
|
-
async function
|
|
4508
|
-
const
|
|
4509
|
-
if (
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4539
|
+
async function readLiveProcesses() {
|
|
4540
|
+
const all = await readAllProcesses();
|
|
4541
|
+
if (all.length === 0) return [];
|
|
4542
|
+
const alive = all.filter((p) => isProcessAlive(p.pid));
|
|
4543
|
+
const dead = all.filter((p) => !isProcessAlive(p.pid));
|
|
4544
|
+
if (dead.length > 0) {
|
|
4545
|
+
if (alive.length === 0) {
|
|
4546
|
+
await removeRuntime();
|
|
4547
|
+
} else {
|
|
4548
|
+
await writeAllProcesses(alive);
|
|
4549
|
+
}
|
|
4550
|
+
}
|
|
4551
|
+
return alive;
|
|
4513
4552
|
}
|
|
4514
|
-
async function
|
|
4553
|
+
async function readAllProcesses() {
|
|
4515
4554
|
const path = runtimePath();
|
|
4516
|
-
if (!existsSync(path)) return
|
|
4555
|
+
if (!existsSync(path)) return [];
|
|
4517
4556
|
try {
|
|
4518
4557
|
const raw = await readFile(path, "utf8");
|
|
4519
4558
|
const parsed = JSON.parse(raw);
|
|
4520
|
-
if (parsed.version
|
|
4521
|
-
return
|
|
4559
|
+
if (parsed.version === 2 && Array.isArray(parsed.processes)) {
|
|
4560
|
+
return parsed.processes.filter(isValidEntry).map(toProcessEntry);
|
|
4561
|
+
}
|
|
4562
|
+
if (parsed.version === 1) {
|
|
4563
|
+
const entry = tryV1Entry(parsed);
|
|
4564
|
+
if (entry) return [entry];
|
|
4522
4565
|
}
|
|
4523
|
-
return
|
|
4566
|
+
return [];
|
|
4524
4567
|
} catch {
|
|
4568
|
+
return [];
|
|
4569
|
+
}
|
|
4570
|
+
}
|
|
4571
|
+
function isValidEntry(obj) {
|
|
4572
|
+
if (typeof obj !== "object" || obj === null) return false;
|
|
4573
|
+
const o = obj;
|
|
4574
|
+
return typeof o.pid === "number" && typeof o.port === "number" && typeof o.url === "string" && typeof o.startedAt === "string";
|
|
4575
|
+
}
|
|
4576
|
+
function toProcessEntry(obj) {
|
|
4577
|
+
return {
|
|
4578
|
+
pid: obj.pid,
|
|
4579
|
+
port: obj.port,
|
|
4580
|
+
url: obj.url,
|
|
4581
|
+
startedAt: obj.startedAt
|
|
4582
|
+
};
|
|
4583
|
+
}
|
|
4584
|
+
function tryV1Entry(parsed) {
|
|
4585
|
+
if (typeof parsed.pid !== "number" || typeof parsed.port !== "number" || typeof parsed.url !== "string" || typeof parsed.startedAt !== "string") {
|
|
4525
4586
|
return null;
|
|
4526
4587
|
}
|
|
4588
|
+
return {
|
|
4589
|
+
pid: parsed.pid,
|
|
4590
|
+
port: parsed.port,
|
|
4591
|
+
url: parsed.url,
|
|
4592
|
+
startedAt: parsed.startedAt
|
|
4593
|
+
};
|
|
4594
|
+
}
|
|
4595
|
+
async function upsertProcess(entry) {
|
|
4596
|
+
const all = await readAllProcesses();
|
|
4597
|
+
const idx = all.findIndex((p) => p.pid === entry.pid);
|
|
4598
|
+
if (idx >= 0) all[idx] = entry;
|
|
4599
|
+
else all.push(entry);
|
|
4600
|
+
await writeAllProcesses(all);
|
|
4527
4601
|
}
|
|
4528
|
-
async function
|
|
4602
|
+
async function writeAllProcesses(processes) {
|
|
4529
4603
|
const path = runtimePath();
|
|
4530
4604
|
await mkdir(resolveGlobalConfigDir(), { recursive: true });
|
|
4531
|
-
await writeFile(path, `${JSON.stringify(
|
|
4605
|
+
await writeFile(path, `${JSON.stringify({ version: 2, processes }, null, 2)}
|
|
4532
4606
|
`, "utf8");
|
|
4533
4607
|
}
|
|
4534
4608
|
async function removeRuntimeForPid(pid) {
|
|
4535
|
-
const
|
|
4536
|
-
|
|
4609
|
+
const all = await readAllProcesses();
|
|
4610
|
+
const remaining = all.filter((p) => p.pid !== pid);
|
|
4611
|
+
if (remaining.length === all.length) return;
|
|
4612
|
+
if (remaining.length === 0) {
|
|
4613
|
+
await removeRuntime();
|
|
4614
|
+
} else {
|
|
4615
|
+
await writeAllProcesses(remaining);
|
|
4616
|
+
}
|
|
4537
4617
|
}
|
|
4538
4618
|
async function removeRuntime() {
|
|
4539
4619
|
await rm(runtimePath(), { force: true });
|
package/dist/gui/assets/{abnfDiagram-VRR7QNED-BlILeZZA.js → abnfDiagram-VRR7QNED-Dk823f-p.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-
|
|
1
|
+
import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-DjfrUCo1.js";import{p as f}from"./chunk-JWPE2WC7-DKHh8QvM.js";import{_ as n,l as o}from"./mermaid.core-Qqp0pI8e.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-BJJROAhw.js";import"./index-BYq7_4Z-.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},B={parser:R,db:a,renderer:u,styles:p};export{B as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-
|
|
1
|
+
import{Y as ln,$ as an,a0 as F,a1 as q,a2 as j,a3 as un,a4 as y,a5 as tn,a6 as J,a7 as _,a8 as rn,a9 as o,aa as on,ab as sn,ac as fn}from"./mermaid.core-Qqp0pI8e.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,I,D,v,A,z,a){var O=I-l,i=D-h,n=z-v,d=a-A,u=d*O-n*i;if(!(u*u<y))return u=(n*(h-A)-d*(l-v))/u,[l+u*O,h+u*i]}function U(l,h,I,D,v,A,z){var a=l-I,O=h-D,i=(z?A:-A)/J(a*a+O*O),n=i*O,d=-i*a,u=l+n,s=h+d,f=I+n,c=D+d,B=(u+f)/2,t=(s+c)/2,m=f-u,g=c-s,R=m*m+g*g,T=v-A,P=u*c-f*s,S=(g<0?-1:1)*J(on(0,T*T*R-P*P)),Y=(P*g-m*S)/R,$=(-P*m-g*S)/R,w=(P*g+m*S)/R,p=(-P*m+g*S)/R,x=Y-B,e=$-t,r=w-B,C=p-t;return x*x+e*e>r*r+C*C&&(Y=w,$=p),{cx:Y,cy:$,x01:-n,y01:-d,x11:Y*(v/T-1),y11:$*(v/T-1)}}function hn(){var l=cn,h=yn,I=j(0),D=null,v=gn,A=dn,z=mn,a=null,O=ln(i);function i(){var n,d,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-un,c=A.apply(this,arguments)-un,B=rn(c-f),t=c>f;if(a||(a=n=O()),s<u&&(d=s,s=u,u=d),!(s>y))a.moveTo(0,0);else if(B>tn-y)a.moveTo(s*F(f),s*q(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*F(c),u*q(c)),a.arc(0,0,u,c,f,t));else{var m=f,g=c,R=f,T=c,P=B,S=B,Y=z.apply(this,arguments)/2,$=Y>y&&(D?+D.apply(this,arguments):J(u*u+s*s)),w=_(rn(s-u)/2,+I.apply(this,arguments)),p=w,x=w,e,r;if($>y){var C=sn($/u*q(Y)),K=sn($/s*q(Y));(P-=C*2)>y?(C*=t?1:-1,R+=C,T-=C):(P=0,R=T=(f+c)/2),(S-=K*2)>y?(K*=t?1:-1,m+=K,g-=K):(S=0,m=g=(f+c)/2)}var G=s*F(m),H=s*q(m),L=u*F(T),M=u*q(T);if(w>y){var N=s*F(g),Q=s*q(g),V=u*F(R),W=u*q(R),E;if(B<an)if(E=pn(G,H,V,W,N,Q,L,M)){var X=G-E[0],Z=H-E[1],b=N-E[0],k=Q-E[1],nn=1/q(fn((X*b+Z*k)/(J(X*X+Z*Z)*J(b*b+k*k)))/2),en=J(E[0]*E[0]+E[1]*E[1]);p=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else p=x=0}S>y?x>y?(e=U(V,W,G,H,s,x,t),r=U(N,Q,L,M,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(G,H),a.arc(0,0,s,m,g,!t)):a.moveTo(G,H),!(u>y)||!(P>y)?a.lineTo(L,M):p>y?(e=U(L,M,N,Q,u,-p,t),r=U(G,H,V,W,u,-p,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),p<w?a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,p,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,p,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,R,t)}if(a.closePath(),n)return a=null,n+""||null}return i.centroid=function(){var n=(+l.apply(this,arguments)+ +h.apply(this,arguments))/2,d=(+v.apply(this,arguments)+ +A.apply(this,arguments))/2-an/2;return[F(d)*n,q(d)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:j(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:j(+n),i):h},i.cornerRadius=function(n){return arguments.length?(I=typeof n=="function"?n:j(+n),i):I},i.padRadius=function(n){return arguments.length?(D=n==null?null:typeof n=="function"?n:j(+n),i):D},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:j(+n),i):v},i.endAngle=function(n){return arguments.length?(A=typeof n=="function"?n:j(+n),i):A},i.padAngle=function(n){return arguments.length?(z=typeof n=="function"?n:j(+n),i):z},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as d};
|