tokmon 0.19.8 → 0.20.0
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/bootstrap-ink-R3PFUV5N.js +3499 -0
- package/dist/chunk-A6RQRHRO.js +1051 -0
- package/dist/{chunk-UAPL47GL.js → chunk-MB6LRSEZ.js} +810 -516
- package/dist/chunk-MVMPQJ5S.js +270 -0
- package/dist/chunk-RF4GGQGM.js +106 -0
- package/dist/cli.js +15 -2710
- package/dist/config-64VVUH42.js +45 -0
- package/dist/daemon-UB2PZDX6.js +213 -0
- package/dist/daemon-handle-ZHECQZ6Q.js +142 -0
- package/dist/glyphs-NKCSZLGO.js +17 -0
- package/dist/server-SP3FOHM2.js +9 -0
- package/dist/web/assets/{breakdown-C9UzD3X2.js → breakdown-DEws2QQ3.js} +3 -3
- package/dist/web/assets/{chart-C6EyXc8D.js → chart-CFynoGh5.js} +7 -7
- package/dist/web/assets/{index-CN07mDjO.css → index-CZOCHnad.css} +1 -1
- package/dist/web/assets/index-vqWRGYnh.js +105 -0
- package/dist/web/assets/{timeline-_qBfhBAY.js → timeline-a7y6nopU.js} +2 -2
- package/dist/web/index.html +2 -2
- package/package.json +3 -1
- package/dist/chunk-STCMWCFW.js +0 -564
- package/dist/server-VMB5ZLZC.js +0 -8
- package/dist/web/assets/index-mgYwFiX4.js +0 -80
- package/dist/web-DYAEMCAE.js +0 -110
package/dist/web-DYAEMCAE.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
startWebServer
|
|
4
|
-
} from "./chunk-STCMWCFW.js";
|
|
5
|
-
import {
|
|
6
|
-
flushDisk,
|
|
7
|
-
loadConfig
|
|
8
|
-
} from "./chunk-UAPL47GL.js";
|
|
9
|
-
|
|
10
|
-
// src/web/open.ts
|
|
11
|
-
import { spawn } from "child_process";
|
|
12
|
-
import { appendFileSync } from "fs";
|
|
13
|
-
function openBrowser(url) {
|
|
14
|
-
if (process.env.TOKMON_OPENLOG) {
|
|
15
|
-
try {
|
|
16
|
-
appendFileSync(process.env.TOKMON_OPENLOG, url + "\n");
|
|
17
|
-
} catch {
|
|
18
|
-
}
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
try {
|
|
22
|
-
if (process.platform === "darwin") {
|
|
23
|
-
spawn("open", [url], { stdio: "ignore", detached: true }).unref();
|
|
24
|
-
} else if (process.platform === "win32") {
|
|
25
|
-
spawn("cmd", ["/c", "start", "", url], { stdio: "ignore", detached: true }).unref();
|
|
26
|
-
} else {
|
|
27
|
-
spawn("xdg-open", [url], { stdio: "ignore", detached: true }).unref();
|
|
28
|
-
}
|
|
29
|
-
} catch {
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// src/web/index.ts
|
|
34
|
-
function parseServeArgs(args) {
|
|
35
|
-
let port;
|
|
36
|
-
let open = true;
|
|
37
|
-
let help = false;
|
|
38
|
-
for (let i = 0; i < args.length; i++) {
|
|
39
|
-
const a = args[i];
|
|
40
|
-
if ((a === "--port" || a === "-p") && args[i + 1]) {
|
|
41
|
-
port = Number(args[++i]);
|
|
42
|
-
} else if (a.startsWith("--port=")) {
|
|
43
|
-
port = Number(a.slice("--port=".length));
|
|
44
|
-
} else if (a === "--no-open") {
|
|
45
|
-
open = false;
|
|
46
|
-
} else if (a === "--help" || a === "-h") {
|
|
47
|
-
help = true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (port !== void 0 && (!Number.isFinite(port) || port < 1 || port > 65535)) port = void 0;
|
|
51
|
-
return { port, open, help };
|
|
52
|
-
}
|
|
53
|
-
var SERVE_HELP = `tokmon serve - Launch the tokmon web dashboard (local, loopback only)
|
|
54
|
-
|
|
55
|
-
Usage: tokmon serve [options]
|
|
56
|
-
|
|
57
|
-
Options:
|
|
58
|
-
-p, --port <n> Port to listen on (default: 4317, auto-falls back if taken)
|
|
59
|
-
--no-open Don't open the browser automatically
|
|
60
|
-
-h, --help Show this help
|
|
61
|
-
`;
|
|
62
|
-
async function startWeb(args) {
|
|
63
|
-
const { port, open, help } = parseServeArgs(args);
|
|
64
|
-
if (help) {
|
|
65
|
-
process.stdout.write(SERVE_HELP);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
const config = await loadConfig();
|
|
69
|
-
let controller;
|
|
70
|
-
try {
|
|
71
|
-
controller = await startWebServer({ config, port, log: true });
|
|
72
|
-
} catch (err) {
|
|
73
|
-
process.stderr.write(`tokmon: failed to start web server: ${err.message}
|
|
74
|
-
`);
|
|
75
|
-
process.exitCode = 1;
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
process.stdout.write(`
|
|
79
|
-
\u25C6 tokmon web \u2192 ${controller.url}
|
|
80
|
-
`);
|
|
81
|
-
process.stdout.write(` live dashboard \xB7 Ctrl-C to stop
|
|
82
|
-
|
|
83
|
-
`);
|
|
84
|
-
if (open) {
|
|
85
|
-
openBrowser(controller.url);
|
|
86
|
-
process.stdout.write(` opening browser\u2026
|
|
87
|
-
`);
|
|
88
|
-
}
|
|
89
|
-
let shuttingDown = false;
|
|
90
|
-
const shutdown = async () => {
|
|
91
|
-
if (shuttingDown) return;
|
|
92
|
-
shuttingDown = true;
|
|
93
|
-
process.stdout.write("\n stopping tokmon web\u2026\n");
|
|
94
|
-
await controller.stop();
|
|
95
|
-
await flushDisk();
|
|
96
|
-
process.exit(0);
|
|
97
|
-
};
|
|
98
|
-
process.on("SIGINT", () => {
|
|
99
|
-
void shutdown();
|
|
100
|
-
});
|
|
101
|
-
process.on("SIGTERM", () => {
|
|
102
|
-
void shutdown();
|
|
103
|
-
});
|
|
104
|
-
await new Promise(() => {
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
export {
|
|
108
|
-
startWeb,
|
|
109
|
-
startWebServer
|
|
110
|
-
};
|