semantic-atlas 2.0.0 → 2.1.1
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/.agents/skills/semantic-atlas/SKILL.md +133 -73
- package/.agents/skills/semantic-atlas/agents/openai.yaml +2 -2
- package/.agents/skills/semantic-atlas-maintenance/SKILL.md +35 -12
- package/.agents/skills/semantic-atlas-maintenance/agents/openai.yaml +1 -1
- package/.agents/skills/semantic-atlas-maintenance/references/reconciliation.md +11 -5
- package/README.md +52 -15
- package/README.zh-CN.md +204 -0
- package/dist/application/map-application.d.ts +11 -0
- package/dist/application/map-application.d.ts.map +1 -1
- package/dist/application/map-application.js +21 -1
- package/dist/application/map-application.js.map +1 -1
- package/dist/cli/run-cli.d.ts +2 -0
- package/dist/cli/run-cli.d.ts.map +1 -1
- package/dist/cli/run-cli.js +47 -2
- package/dist/cli/run-cli.js.map +1 -1
- package/dist/contracts/cli.d.ts +8 -0
- package/dist/contracts/cli.d.ts.map +1 -1
- package/dist/map/business-graph.d.ts +1 -0
- package/dist/map/business-graph.d.ts.map +1 -1
- package/dist/map/business-graph.js +10 -0
- package/dist/map/business-graph.js.map +1 -1
- package/dist/rendering/html.d.ts +3 -0
- package/dist/rendering/html.d.ts.map +1 -0
- package/dist/rendering/html.js +12 -0
- package/dist/rendering/html.js.map +1 -0
- package/dist/rendering/map-camera.d.ts +25 -0
- package/dist/rendering/map-camera.d.ts.map +1 -0
- package/dist/rendering/map-camera.js +47 -0
- package/dist/rendering/map-camera.js.map +1 -0
- package/dist/rendering/map-projector.d.ts +8 -1
- package/dist/rendering/map-projector.d.ts.map +1 -1
- package/dist/rendering/map-projector.js +106 -169
- package/dist/rendering/map-projector.js.map +1 -1
- package/dist/rendering/viewer-browser.d.ts +2 -0
- package/dist/rendering/viewer-browser.d.ts.map +1 -0
- package/dist/rendering/viewer-browser.js +279 -0
- package/dist/rendering/viewer-browser.js.map +1 -0
- package/dist/rendering/viewer-page.d.ts +29 -0
- package/dist/rendering/viewer-page.d.ts.map +1 -0
- package/dist/rendering/viewer-page.js +438 -0
- package/dist/rendering/viewer-page.js.map +1 -0
- package/dist/web/local-web-application.d.ts +9 -0
- package/dist/web/local-web-application.d.ts.map +1 -0
- package/dist/web/local-web-application.js +29 -0
- package/dist/web/local-web-application.js.map +1 -0
- package/dist/web/local-web-server.d.ts +12 -0
- package/dist/web/local-web-server.d.ts.map +1 -0
- package/dist/web/local-web-server.js +71 -0
- package/dist/web/local-web-server.js.map +1 -0
- package/dist/web/web-command-service.d.ts +16 -0
- package/dist/web/web-command-service.d.ts.map +1 -0
- package/dist/web/web-command-service.js +50 -0
- package/dist/web/web-command-service.js.map +1 -0
- package/docs/architecture.md +72 -32
- package/docs/evaluation.md +24 -12
- package/docs/index.md +3 -2
- package/docs/map-format.md +6 -4
- package/docs/observations.md +25 -15
- package/docs/product-contract.md +71 -50
- package/package.json +3 -2
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
import { escapeHtml } from "./html.js";
|
|
2
|
+
import { renderViewerBrowserScript } from "./viewer-browser.js";
|
|
3
|
+
export function renderViewerPage(projects, mode) {
|
|
4
|
+
const displayedProjects = disambiguateProjectNames(projects);
|
|
5
|
+
const model = JSON.stringify({
|
|
6
|
+
projects: displayedProjects.map(({ id, name, views }) => ({
|
|
7
|
+
id,
|
|
8
|
+
name,
|
|
9
|
+
views: views.map(({ id: viewId, name: viewName, nodeCount, relationCount, nodes }) => ({
|
|
10
|
+
id: viewId,
|
|
11
|
+
name: viewName,
|
|
12
|
+
nodeCount,
|
|
13
|
+
relationCount,
|
|
14
|
+
nodes,
|
|
15
|
+
})),
|
|
16
|
+
})),
|
|
17
|
+
}).replaceAll("<", "\\u003c");
|
|
18
|
+
return `<!doctype html>
|
|
19
|
+
<html lang="en">
|
|
20
|
+
<head>
|
|
21
|
+
<meta charset="utf-8">
|
|
22
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
23
|
+
<title>Semantic Atlas business map</title>
|
|
24
|
+
<style>${viewerStyles()}</style>
|
|
25
|
+
</head>
|
|
26
|
+
<body data-viewer-mode="${mode}">
|
|
27
|
+
<main class="viewer-shell">
|
|
28
|
+
<header class="viewer-toolbar">
|
|
29
|
+
<div class="brand" aria-label="Semantic Atlas">
|
|
30
|
+
<span class="brand__mark">SA</span>
|
|
31
|
+
<span class="brand__name">Semantic Atlas</span>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="viewer-toolbar__selectors">
|
|
34
|
+
<label class="field">
|
|
35
|
+
<span>Project</span>
|
|
36
|
+
<select id="project-select" aria-label="Project">
|
|
37
|
+
${displayedProjects.map(({ id, name }) => `<option value="${escapeHtml(id)}">${escapeHtml(name)}</option>`).join("")}
|
|
38
|
+
</select>
|
|
39
|
+
</label>
|
|
40
|
+
<label class="field">
|
|
41
|
+
<span>Business</span>
|
|
42
|
+
<select id="domain-select" aria-label="Business domain"></select>
|
|
43
|
+
</label>
|
|
44
|
+
</div>
|
|
45
|
+
<div class="viewer-toolbar__meta">
|
|
46
|
+
<span id="map-statistics" class="statistics" aria-live="polite"></span>
|
|
47
|
+
<details class="legend">
|
|
48
|
+
<summary>Legend</summary>
|
|
49
|
+
<div class="legend__panel">
|
|
50
|
+
<span class="legend__line legend__line--containment"></span>
|
|
51
|
+
<span>Containment relationships</span>
|
|
52
|
+
<span class="legend__line legend__line--relation"></span>
|
|
53
|
+
<span>Directed business relationships</span>
|
|
54
|
+
</div>
|
|
55
|
+
</details>
|
|
56
|
+
<div class="camera-controls" aria-label="Map controls">
|
|
57
|
+
<button type="button" data-action="zoom-out" aria-label="Zoom out">-</button>
|
|
58
|
+
<button type="button" data-action="fit" aria-label="Fit map to window">Fit</button>
|
|
59
|
+
<button type="button" data-action="zoom-in" aria-label="Zoom in">+</button>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</header>
|
|
63
|
+
<section id="map-viewport" class="map-viewport" aria-label="Interactive business map">
|
|
64
|
+
${displayedProjects.flatMap((project) => project.views.map((view) => `
|
|
65
|
+
<div class="project-view" data-project-view data-project-id="${escapeHtml(project.id)}" data-map-view="${escapeHtml(view.id)}" hidden>
|
|
66
|
+
${view.svg}
|
|
67
|
+
</div>`)).join("")}
|
|
68
|
+
</section>
|
|
69
|
+
<aside id="node-details" class="node-details" aria-labelledby="node-details-title" hidden>
|
|
70
|
+
<header class="node-details__header">
|
|
71
|
+
<div>
|
|
72
|
+
<p class="node-details__eyebrow">Concept details</p>
|
|
73
|
+
<p id="node-details-kind" class="node-details__kind"></p>
|
|
74
|
+
</div>
|
|
75
|
+
<button type="button" class="node-details__close" data-action="close-details" aria-label="Close concept details">×</button>
|
|
76
|
+
</header>
|
|
77
|
+
<h2 id="node-details-title" class="node-details__title"></h2>
|
|
78
|
+
<p id="node-details-summary" class="node-details__summary"></p>
|
|
79
|
+
<section id="node-details-anchors" class="node-details__anchors" aria-labelledby="node-details-anchors-title" hidden>
|
|
80
|
+
<h3 id="node-details-anchors-title">Navigation anchors</h3>
|
|
81
|
+
<div id="node-details-anchor-list" class="node-details__anchor-list"></div>
|
|
82
|
+
</section>
|
|
83
|
+
</aside>
|
|
84
|
+
</main>
|
|
85
|
+
<script id="viewer-model" type="application/json">${model}</script>
|
|
86
|
+
<script>${renderViewerBrowserScript()}</script>
|
|
87
|
+
</body>
|
|
88
|
+
</html>
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
function disambiguateProjectNames(projects) {
|
|
92
|
+
const nameCounts = new Map();
|
|
93
|
+
for (const project of projects) {
|
|
94
|
+
nameCounts.set(project.name, (nameCounts.get(project.name) ?? 0) + 1);
|
|
95
|
+
}
|
|
96
|
+
const occurrences = new Map();
|
|
97
|
+
return projects.map((project) => {
|
|
98
|
+
if ((nameCounts.get(project.name) ?? 0) < 2)
|
|
99
|
+
return project;
|
|
100
|
+
const occurrence = (occurrences.get(project.name) ?? 0) + 1;
|
|
101
|
+
occurrences.set(project.name, occurrence);
|
|
102
|
+
return { ...project, name: `${project.name} (${occurrence})` };
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function viewerStyles() {
|
|
106
|
+
return `
|
|
107
|
+
:root {
|
|
108
|
+
color-scheme: light;
|
|
109
|
+
--paper: #eee9dd;
|
|
110
|
+
--surface: rgba(255, 253, 247, 0.94);
|
|
111
|
+
--surface-strong: #fffdf7;
|
|
112
|
+
--ink: #1d2a2b;
|
|
113
|
+
--muted: #667373;
|
|
114
|
+
--line: #c5c8bd;
|
|
115
|
+
--containment: #385967;
|
|
116
|
+
--relation: #b4532f;
|
|
117
|
+
--accent: #d9a441;
|
|
118
|
+
--toolbar-height: 68px;
|
|
119
|
+
}
|
|
120
|
+
* { box-sizing: border-box; }
|
|
121
|
+
html, body { width: 100%; min-height: 100%; margin: 0; }
|
|
122
|
+
body {
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
color: var(--ink);
|
|
125
|
+
background:
|
|
126
|
+
radial-gradient(circle at 8% 0%, rgba(217, 164, 65, 0.18), transparent 28rem),
|
|
127
|
+
linear-gradient(145deg, #f8f5ed 0%, var(--paper) 62%, #e8ede7 100%);
|
|
128
|
+
font-family: "Avenir Next", Avenir, "Trebuchet MS", sans-serif;
|
|
129
|
+
}
|
|
130
|
+
button, select { font: inherit; }
|
|
131
|
+
.viewer-shell {
|
|
132
|
+
display: grid;
|
|
133
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
134
|
+
grid-template-columns: minmax(0, 1fr);
|
|
135
|
+
height: 100vh;
|
|
136
|
+
min-height: 420px;
|
|
137
|
+
}
|
|
138
|
+
.viewer-toolbar {
|
|
139
|
+
z-index: 3;
|
|
140
|
+
display: grid;
|
|
141
|
+
grid-template-columns: auto minmax(300px, 1fr) auto;
|
|
142
|
+
align-items: center;
|
|
143
|
+
gap: 22px;
|
|
144
|
+
min-height: var(--toolbar-height);
|
|
145
|
+
padding: 10px 16px;
|
|
146
|
+
border-bottom: 1px solid rgba(56, 89, 103, 0.22);
|
|
147
|
+
background: var(--surface);
|
|
148
|
+
box-shadow: 0 10px 30px rgba(29, 42, 43, 0.08);
|
|
149
|
+
backdrop-filter: blur(16px);
|
|
150
|
+
}
|
|
151
|
+
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
|
|
152
|
+
.brand__mark {
|
|
153
|
+
display: grid;
|
|
154
|
+
place-items: center;
|
|
155
|
+
width: 34px;
|
|
156
|
+
height: 34px;
|
|
157
|
+
border: 1px solid var(--ink);
|
|
158
|
+
background: var(--ink);
|
|
159
|
+
color: #fffdf7;
|
|
160
|
+
font-family: Georgia, "Times New Roman", serif;
|
|
161
|
+
font-size: 12px;
|
|
162
|
+
font-weight: 700;
|
|
163
|
+
letter-spacing: 0.06em;
|
|
164
|
+
}
|
|
165
|
+
.brand__name {
|
|
166
|
+
font-family: Georgia, "Times New Roman", serif;
|
|
167
|
+
font-size: 19px;
|
|
168
|
+
font-weight: 650;
|
|
169
|
+
letter-spacing: -0.01em;
|
|
170
|
+
}
|
|
171
|
+
.viewer-toolbar__selectors, .viewer-toolbar__meta, .camera-controls {
|
|
172
|
+
display: flex;
|
|
173
|
+
align-items: center;
|
|
174
|
+
}
|
|
175
|
+
.viewer-toolbar__selectors { gap: 10px; min-width: 0; }
|
|
176
|
+
.viewer-toolbar__meta { justify-content: flex-end; gap: 12px; white-space: nowrap; }
|
|
177
|
+
.field { display: flex; align-items: center; gap: 7px; min-width: 0; }
|
|
178
|
+
.field > span {
|
|
179
|
+
color: var(--muted);
|
|
180
|
+
font-size: 10px;
|
|
181
|
+
font-weight: 850;
|
|
182
|
+
letter-spacing: 0.10em;
|
|
183
|
+
text-transform: uppercase;
|
|
184
|
+
}
|
|
185
|
+
select {
|
|
186
|
+
min-width: 160px;
|
|
187
|
+
max-width: 260px;
|
|
188
|
+
height: 36px;
|
|
189
|
+
padding: 0 34px 0 11px;
|
|
190
|
+
border: 1px solid rgba(56, 89, 103, 0.28);
|
|
191
|
+
border-radius: 7px;
|
|
192
|
+
color: var(--ink);
|
|
193
|
+
background: var(--surface-strong);
|
|
194
|
+
font-size: 13px;
|
|
195
|
+
font-weight: 650;
|
|
196
|
+
}
|
|
197
|
+
select:disabled { color: var(--muted); opacity: 0.72; }
|
|
198
|
+
.statistics { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
199
|
+
.legend { position: relative; }
|
|
200
|
+
.legend summary {
|
|
201
|
+
cursor: pointer;
|
|
202
|
+
color: var(--muted);
|
|
203
|
+
font-size: 12px;
|
|
204
|
+
font-weight: 700;
|
|
205
|
+
list-style: none;
|
|
206
|
+
}
|
|
207
|
+
.legend summary::-webkit-details-marker { display: none; }
|
|
208
|
+
.legend__panel {
|
|
209
|
+
position: absolute;
|
|
210
|
+
top: calc(100% + 16px);
|
|
211
|
+
right: 0;
|
|
212
|
+
display: grid;
|
|
213
|
+
grid-template-columns: 48px max-content;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: 12px 10px;
|
|
216
|
+
padding: 16px;
|
|
217
|
+
border: 1px solid rgba(56, 89, 103, 0.24);
|
|
218
|
+
border-radius: 10px;
|
|
219
|
+
background: var(--surface-strong);
|
|
220
|
+
box-shadow: 0 18px 44px rgba(29, 42, 43, 0.16);
|
|
221
|
+
color: var(--muted);
|
|
222
|
+
font-size: 12px;
|
|
223
|
+
}
|
|
224
|
+
.legend__line { display: block; height: 0; border-top: 2px solid; }
|
|
225
|
+
.legend__line--containment { border-color: var(--containment); border-top-style: dashed; }
|
|
226
|
+
.legend__line--relation { position: relative; border-color: var(--relation); }
|
|
227
|
+
.legend__line--relation::after {
|
|
228
|
+
position: absolute;
|
|
229
|
+
top: -5px;
|
|
230
|
+
right: -1px;
|
|
231
|
+
width: 7px;
|
|
232
|
+
height: 7px;
|
|
233
|
+
content: "";
|
|
234
|
+
border-top: 2px solid var(--relation);
|
|
235
|
+
border-right: 2px solid var(--relation);
|
|
236
|
+
transform: rotate(45deg);
|
|
237
|
+
}
|
|
238
|
+
.camera-controls { overflow: hidden; border: 1px solid rgba(56, 89, 103, 0.28); border-radius: 7px; }
|
|
239
|
+
.camera-controls button {
|
|
240
|
+
height: 34px;
|
|
241
|
+
min-width: 34px;
|
|
242
|
+
padding: 0 10px;
|
|
243
|
+
border: 0;
|
|
244
|
+
border-right: 1px solid rgba(56, 89, 103, 0.20);
|
|
245
|
+
color: var(--ink);
|
|
246
|
+
background: var(--surface-strong);
|
|
247
|
+
font-size: 13px;
|
|
248
|
+
font-weight: 800;
|
|
249
|
+
cursor: pointer;
|
|
250
|
+
}
|
|
251
|
+
.camera-controls button:last-child { border-right: 0; }
|
|
252
|
+
.camera-controls button:hover { background: #f4ead2; }
|
|
253
|
+
.camera-controls button:focus-visible, select:focus-visible, summary:focus-visible {
|
|
254
|
+
outline: 3px solid rgba(217, 164, 65, 0.42);
|
|
255
|
+
outline-offset: 2px;
|
|
256
|
+
}
|
|
257
|
+
.map-viewport {
|
|
258
|
+
grid-row: 2;
|
|
259
|
+
grid-column: 1;
|
|
260
|
+
position: relative;
|
|
261
|
+
min-height: 0;
|
|
262
|
+
overflow: hidden;
|
|
263
|
+
cursor: grab;
|
|
264
|
+
touch-action: none;
|
|
265
|
+
user-select: none;
|
|
266
|
+
-webkit-user-select: none;
|
|
267
|
+
}
|
|
268
|
+
.map-viewport[data-dragging="true"] { cursor: grabbing; }
|
|
269
|
+
.project-view { position: absolute; inset: 0; }
|
|
270
|
+
.project-view[hidden] { display: none; }
|
|
271
|
+
.map-svg { display: block; width: 100%; height: 100%; }
|
|
272
|
+
.grid-line { stroke: #d9ddd3; stroke-width: 1; }
|
|
273
|
+
.edge__path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
|
|
274
|
+
.edge--containment .edge__path { stroke: var(--containment); stroke-width: 2.2; stroke-dasharray: 9 7; }
|
|
275
|
+
.edge--directed-relation .edge__path { stroke: var(--relation); stroke-width: 2.4; }
|
|
276
|
+
.edge__label-surface { fill: var(--surface-strong); stroke-width: 1; }
|
|
277
|
+
.edge--containment .edge__label-surface { stroke: var(--containment); }
|
|
278
|
+
.edge--directed-relation .edge__label-surface { stroke: var(--relation); }
|
|
279
|
+
.edge__label { fill: var(--ink); font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
|
|
280
|
+
.node-card { cursor: pointer; }
|
|
281
|
+
.node-card:focus { outline: none; }
|
|
282
|
+
.node-card__surface {
|
|
283
|
+
fill: var(--surface-strong);
|
|
284
|
+
stroke: var(--line);
|
|
285
|
+
stroke-width: 1.5;
|
|
286
|
+
transition: fill 140ms ease, stroke 140ms ease, stroke-width 140ms ease;
|
|
287
|
+
}
|
|
288
|
+
.node-card:hover .node-card__surface,
|
|
289
|
+
.node-card:focus .node-card__surface,
|
|
290
|
+
.node-card[aria-expanded="true"] .node-card__surface {
|
|
291
|
+
fill: #fffaf0;
|
|
292
|
+
stroke: var(--accent);
|
|
293
|
+
stroke-width: 3;
|
|
294
|
+
}
|
|
295
|
+
.node-card__kind-rule { fill: var(--accent); }
|
|
296
|
+
.node-card--boundary .node-card__surface { fill: #f1f3ed; stroke-dasharray: 6 5; }
|
|
297
|
+
.node-card--boundary .node-card__kind-rule { fill: var(--containment); }
|
|
298
|
+
.node-card__kind { fill: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: 0.12em; }
|
|
299
|
+
.node-card__title { fill: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 18px; font-weight: 650; }
|
|
300
|
+
.node-card__summary { fill: #405052; font-size: 13px; }
|
|
301
|
+
.node-details {
|
|
302
|
+
z-index: 2;
|
|
303
|
+
grid-row: 2;
|
|
304
|
+
grid-column: 1;
|
|
305
|
+
align-self: stretch;
|
|
306
|
+
justify-self: end;
|
|
307
|
+
width: min(390px, calc(100% - 28px));
|
|
308
|
+
margin: 14px;
|
|
309
|
+
padding: 22px;
|
|
310
|
+
overflow: auto;
|
|
311
|
+
border: 1px solid rgba(56, 89, 103, 0.28);
|
|
312
|
+
border-left: 7px solid var(--accent);
|
|
313
|
+
border-radius: 14px;
|
|
314
|
+
background:
|
|
315
|
+
linear-gradient(135deg, rgba(217, 164, 65, 0.09), transparent 38%),
|
|
316
|
+
var(--surface-strong);
|
|
317
|
+
box-shadow: 0 24px 64px rgba(29, 42, 43, 0.20);
|
|
318
|
+
animation: details-arrive 180ms ease-out;
|
|
319
|
+
}
|
|
320
|
+
.node-details[hidden] { display: none; }
|
|
321
|
+
.node-details__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
|
322
|
+
.node-details__eyebrow {
|
|
323
|
+
margin: 0 0 7px;
|
|
324
|
+
color: var(--relation);
|
|
325
|
+
font-size: 10px;
|
|
326
|
+
font-weight: 850;
|
|
327
|
+
letter-spacing: 0.13em;
|
|
328
|
+
text-transform: uppercase;
|
|
329
|
+
}
|
|
330
|
+
.node-details__kind {
|
|
331
|
+
margin: 0;
|
|
332
|
+
color: var(--muted);
|
|
333
|
+
font-size: 11px;
|
|
334
|
+
font-weight: 800;
|
|
335
|
+
letter-spacing: 0.10em;
|
|
336
|
+
text-transform: uppercase;
|
|
337
|
+
}
|
|
338
|
+
.node-details__close {
|
|
339
|
+
display: grid;
|
|
340
|
+
place-items: center;
|
|
341
|
+
width: 34px;
|
|
342
|
+
height: 34px;
|
|
343
|
+
padding: 0;
|
|
344
|
+
border: 1px solid rgba(56, 89, 103, 0.24);
|
|
345
|
+
border-radius: 50%;
|
|
346
|
+
color: var(--ink);
|
|
347
|
+
background: #fffdf7;
|
|
348
|
+
font-size: 21px;
|
|
349
|
+
line-height: 1;
|
|
350
|
+
cursor: pointer;
|
|
351
|
+
}
|
|
352
|
+
.node-details__close:hover { background: #f4ead2; }
|
|
353
|
+
.node-details__close:focus-visible {
|
|
354
|
+
outline: 3px solid rgba(217, 164, 65, 0.42);
|
|
355
|
+
outline-offset: 2px;
|
|
356
|
+
}
|
|
357
|
+
.node-details__title {
|
|
358
|
+
margin: 18px 0 10px;
|
|
359
|
+
font-family: Georgia, "Times New Roman", serif;
|
|
360
|
+
font-size: 28px;
|
|
361
|
+
font-weight: 650;
|
|
362
|
+
line-height: 1.08;
|
|
363
|
+
letter-spacing: -0.02em;
|
|
364
|
+
}
|
|
365
|
+
.node-details__summary { margin: 0; color: #405052; font-size: 14px; line-height: 1.6; }
|
|
366
|
+
.node-details__anchors { margin-top: 24px; padding-top: 18px; border-top: 1px solid rgba(56, 89, 103, 0.20); }
|
|
367
|
+
.node-details__anchors[hidden] { display: none; }
|
|
368
|
+
.node-details__anchors h3 {
|
|
369
|
+
margin: 0 0 12px;
|
|
370
|
+
color: var(--relation);
|
|
371
|
+
font-size: 11px;
|
|
372
|
+
letter-spacing: 0.10em;
|
|
373
|
+
text-transform: uppercase;
|
|
374
|
+
}
|
|
375
|
+
.node-details__anchor-list { display: grid; gap: 10px; }
|
|
376
|
+
.node-details__anchor {
|
|
377
|
+
padding: 12px;
|
|
378
|
+
border: 1px solid rgba(56, 89, 103, 0.18);
|
|
379
|
+
border-radius: 9px;
|
|
380
|
+
background: rgba(238, 233, 221, 0.44);
|
|
381
|
+
}
|
|
382
|
+
.node-details__anchor-kind {
|
|
383
|
+
display: block;
|
|
384
|
+
margin-bottom: 6px;
|
|
385
|
+
color: var(--muted);
|
|
386
|
+
font-size: 9px;
|
|
387
|
+
font-weight: 850;
|
|
388
|
+
letter-spacing: 0.12em;
|
|
389
|
+
text-transform: uppercase;
|
|
390
|
+
}
|
|
391
|
+
.node-details__anchor code {
|
|
392
|
+
display: block;
|
|
393
|
+
overflow-wrap: anywhere;
|
|
394
|
+
color: var(--ink);
|
|
395
|
+
font-family: "SFMono-Regular", Consolas, monospace;
|
|
396
|
+
font-size: 11px;
|
|
397
|
+
line-height: 1.45;
|
|
398
|
+
}
|
|
399
|
+
.node-details__anchor p { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
|
|
400
|
+
@keyframes details-arrive {
|
|
401
|
+
from { opacity: 0; transform: translateX(12px); }
|
|
402
|
+
to { opacity: 1; transform: translateX(0); }
|
|
403
|
+
}
|
|
404
|
+
@media (max-width: 940px) {
|
|
405
|
+
:root { --toolbar-height: auto; }
|
|
406
|
+
.viewer-toolbar { grid-template-columns: auto 1fr; gap: 8px 16px; }
|
|
407
|
+
.viewer-toolbar__selectors { justify-content: flex-end; }
|
|
408
|
+
.viewer-toolbar__meta { grid-column: 1 / -1; justify-content: space-between; }
|
|
409
|
+
}
|
|
410
|
+
@media (max-width: 620px) {
|
|
411
|
+
.viewer-toolbar { display: flex; flex-wrap: wrap; padding: 9px 10px; }
|
|
412
|
+
.brand__name { font-size: 17px; }
|
|
413
|
+
.viewer-toolbar__selectors { order: 3; width: 100%; }
|
|
414
|
+
.viewer-toolbar__meta { margin-left: auto; }
|
|
415
|
+
.statistics, .legend { display: none; }
|
|
416
|
+
.field { flex: 1; }
|
|
417
|
+
.field > span { display: none; }
|
|
418
|
+
select { width: 100%; min-width: 0; max-width: none; }
|
|
419
|
+
.node-details {
|
|
420
|
+
align-self: end;
|
|
421
|
+
justify-self: stretch;
|
|
422
|
+
width: auto;
|
|
423
|
+
max-height: 58%;
|
|
424
|
+
margin: 8px;
|
|
425
|
+
padding: 18px;
|
|
426
|
+
border-left-width: 1px;
|
|
427
|
+
border-top: 6px solid var(--accent);
|
|
428
|
+
animation-name: details-rise;
|
|
429
|
+
}
|
|
430
|
+
.node-details__title { font-size: 24px; }
|
|
431
|
+
@keyframes details-rise {
|
|
432
|
+
from { opacity: 0; transform: translateY(12px); }
|
|
433
|
+
to { opacity: 1; transform: translateY(0); }
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
`;
|
|
437
|
+
}
|
|
438
|
+
//# sourceMappingURL=viewer-page.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewer-page.js","sourceRoot":"","sources":["../../src/rendering/viewer-page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAkChE,MAAM,UAAU,gBAAgB,CAC9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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0UN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MapApplication } from "../application/map-application.js";
|
|
2
|
+
export declare class LocalWebApplication {
|
|
3
|
+
private readonly mapApplication;
|
|
4
|
+
private readonly repositoryPaths;
|
|
5
|
+
constructor(mapApplication: MapApplication, repositoryPaths: readonly string[]);
|
|
6
|
+
get repositoryCount(): number;
|
|
7
|
+
render(): Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=local-web-application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-web-application.d.ts","sourceRoot":"","sources":["../../src/web/local-web-application.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGnE,qBAAa,mBAAmB;IAI5B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAHjC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAoB;gBAGjC,cAAc,EAAE,cAAc,EAC/C,eAAe,EAAE,SAAS,MAAM,EAAE;IAUpC,IAAW,eAAe,IAAI,MAAM,CAEnC;IAEY,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC;CAWvC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { MapApplication } from "../application/map-application.js";
|
|
3
|
+
import { renderViewerPage } from "../rendering/viewer-page.js";
|
|
4
|
+
export class LocalWebApplication {
|
|
5
|
+
mapApplication;
|
|
6
|
+
repositoryPaths;
|
|
7
|
+
constructor(mapApplication, repositoryPaths) {
|
|
8
|
+
this.mapApplication = mapApplication;
|
|
9
|
+
this.repositoryPaths = Object.freeze([
|
|
10
|
+
...new Set(repositoryPaths.map((repositoryPath) => path.resolve(repositoryPath))),
|
|
11
|
+
]);
|
|
12
|
+
if (this.repositoryPaths.length === 0) {
|
|
13
|
+
throw new Error("At least one repository is required for the Web viewer");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
get repositoryCount() {
|
|
17
|
+
return this.repositoryPaths.length;
|
|
18
|
+
}
|
|
19
|
+
async render() {
|
|
20
|
+
const results = await Promise.all(this.repositoryPaths.map((repositoryPath) => this.mapApplication.viewerProject(repositoryPath)));
|
|
21
|
+
const failure = results.find((result) => !result.ok);
|
|
22
|
+
if (failure && !failure.ok) {
|
|
23
|
+
throw new Error(failure.error.message);
|
|
24
|
+
}
|
|
25
|
+
const projects = results.flatMap((result) => result.ok ? [result.viewerProject] : []);
|
|
26
|
+
return renderViewerPage(projects, "web");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=local-web-application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-web-application.js","sourceRoot":"","sources":["../../src/web/local-web-application.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,MAAM,OAAO,mBAAmB;IAIX;IAHF,eAAe,CAAoB;IAEpD,YACmB,cAA8B,EAC/C,eAAkC;QADjB,mBAAc,GAAd,cAAc,CAAgB;QAG/C,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;YACnC,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC;SAClF,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC;IAED,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,cAAc,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC,CAChG,CAAC;QACF,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrD,IAAI,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtF,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LocalWebApplication } from "./local-web-application.js";
|
|
2
|
+
export interface LocalWebServerOptions {
|
|
3
|
+
readonly application: LocalWebApplication;
|
|
4
|
+
readonly port: number;
|
|
5
|
+
}
|
|
6
|
+
export interface LocalWebServer {
|
|
7
|
+
readonly url: string;
|
|
8
|
+
readonly repositoryCount: number;
|
|
9
|
+
close(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare function startLocalWebServer(options: LocalWebServerOptions): Promise<LocalWebServer>;
|
|
12
|
+
//# sourceMappingURL=local-web-server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-web-server.d.ts","sourceRoot":"","sources":["../../src/web/local-web-server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAItE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createServer } from "node:http";
|
|
2
|
+
const LOOPBACK_HOST = "127.0.0.1";
|
|
3
|
+
export async function startLocalWebServer(options) {
|
|
4
|
+
await options.application.render();
|
|
5
|
+
const server = createServer((request, response) => {
|
|
6
|
+
void routeRequest(options.application, request.method ?? "GET", request.url ?? "/", response);
|
|
7
|
+
});
|
|
8
|
+
await new Promise((resolve, reject) => {
|
|
9
|
+
server.once("error", reject);
|
|
10
|
+
server.listen(options.port, LOOPBACK_HOST, () => {
|
|
11
|
+
server.off("error", reject);
|
|
12
|
+
resolve();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
const address = server.address();
|
|
16
|
+
if (!address || typeof address === "string") {
|
|
17
|
+
await closeServer(server);
|
|
18
|
+
throw new Error("Could not resolve the local Web server address");
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
url: `http://${LOOPBACK_HOST}:${address.port}`,
|
|
22
|
+
repositoryCount: options.application.repositoryCount,
|
|
23
|
+
close: async () => {
|
|
24
|
+
server.closeIdleConnections();
|
|
25
|
+
await closeServer(server);
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
async function routeRequest(application, method, requestUrl, response) {
|
|
30
|
+
if (method !== "GET" && method !== "HEAD") {
|
|
31
|
+
response.writeHead(405, {
|
|
32
|
+
Allow: "GET, HEAD",
|
|
33
|
+
"Content-Type": "text/plain; charset=utf-8",
|
|
34
|
+
});
|
|
35
|
+
response.end("Method not allowed\n");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const pathname = new URL(requestUrl, `http://${LOOPBACK_HOST}`).pathname;
|
|
39
|
+
if (pathname === "/health") {
|
|
40
|
+
sendResponse(response, method, 200, "application/json; charset=utf-8", '{"ok":true}\n');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (pathname !== "/") {
|
|
44
|
+
sendResponse(response, method, 404, "text/plain; charset=utf-8", "Not found\n");
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const html = await application.render();
|
|
49
|
+
response.setHeader("Content-Security-Policy", "default-src 'none'; style-src 'unsafe-inline'; script-src 'unsafe-inline'; base-uri 'none'; form-action 'none'");
|
|
50
|
+
response.setHeader("X-Content-Type-Options", "nosniff");
|
|
51
|
+
sendResponse(response, method, 200, "text/html; charset=utf-8", html);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
sendResponse(response, method, 500, "text/plain; charset=utf-8", "The business map could not be loaded.\n");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function sendResponse(response, method, status, contentType, body) {
|
|
58
|
+
response.writeHead(status, {
|
|
59
|
+
"Content-Type": contentType,
|
|
60
|
+
"Content-Length": Buffer.byteLength(body),
|
|
61
|
+
});
|
|
62
|
+
response.end(method === "HEAD" ? undefined : body);
|
|
63
|
+
}
|
|
64
|
+
async function closeServer(server) {
|
|
65
|
+
if (!server.listening)
|
|
66
|
+
return;
|
|
67
|
+
await new Promise((resolve, reject) => {
|
|
68
|
+
server.close((error) => error ? reject(error) : resolve());
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=local-web-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-web-server.js","sourceRoot":"","sources":["../../src/web/local-web-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,WAAW,CAAC;AAG9D,MAAM,aAAa,GAAG,WAAW,CAAC;AAalC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAA8B;IAE9B,MAAM,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;QAChD,KAAK,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,EAAE,QAAQ,CAAC,CAAC;IAChG,CAAC,CAAC,CAAC;IAEH,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE;YAC9C,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC5B,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IACjC,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IAED,OAAO;QACL,GAAG,EAAE,UAAU,aAAa,IAAI,OAAO,CAAC,IAAI,EAAE;QAC9C,eAAe,EAAE,OAAO,CAA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P,YAAY,CACV,QAAQ,EACR,MAAM,EACN,GAAG,EACH,2BAA2B,EAC3B,yCAAyC,CAC1C,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CACnB,QAAwB,EACxB,MAAc,EACd,MAAc,EACd,WAAmB,EACnB,IAAY;IAEZ,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE;QACzB,cAAc,EAAE,WAAW;QAC3B,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC;KAC1C,CAAC,CAAC;IACH,QAAQ,CAAC,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,MAAuC;IAChE,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO;IAC9B,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC1C,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MapApplication } from "../application/map-application.js";
|
|
2
|
+
export interface StartWebOptions {
|
|
3
|
+
readonly repositoryPaths: readonly string[];
|
|
4
|
+
readonly port: number;
|
|
5
|
+
readonly openBrowser: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface WebSessionData {
|
|
8
|
+
readonly url: string;
|
|
9
|
+
readonly repositoryCount: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class WebCommandService {
|
|
12
|
+
private readonly mapApplication;
|
|
13
|
+
constructor(mapApplication: MapApplication);
|
|
14
|
+
start(options: StartWebOptions): Promise<WebSessionData>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=web-command-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-command-service.d.ts","sourceRoot":"","sources":["../../src/web/web-command-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAInE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,qBAAa,iBAAiB;IACT,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAErD,KAAK,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;CAUtE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { MapApplication } from "../application/map-application.js";
|
|
3
|
+
import { LocalWebApplication } from "./local-web-application.js";
|
|
4
|
+
import { startLocalWebServer } from "./local-web-server.js";
|
|
5
|
+
export class WebCommandService {
|
|
6
|
+
mapApplication;
|
|
7
|
+
constructor(mapApplication) {
|
|
8
|
+
this.mapApplication = mapApplication;
|
|
9
|
+
}
|
|
10
|
+
async start(options) {
|
|
11
|
+
const application = new LocalWebApplication(this.mapApplication, options.repositoryPaths);
|
|
12
|
+
const server = await startLocalWebServer({ application, port: options.port });
|
|
13
|
+
installShutdownHandlers(server);
|
|
14
|
+
if (options.openBrowser)
|
|
15
|
+
openDefaultBrowser(server.url);
|
|
16
|
+
return {
|
|
17
|
+
url: server.url,
|
|
18
|
+
repositoryCount: server.repositoryCount,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function installShutdownHandlers(server) {
|
|
23
|
+
let closing = false;
|
|
24
|
+
const close = () => {
|
|
25
|
+
if (closing)
|
|
26
|
+
return;
|
|
27
|
+
closing = true;
|
|
28
|
+
void server.close().finally(() => {
|
|
29
|
+
process.exitCode = 0;
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
process.once("SIGINT", close);
|
|
33
|
+
process.once("SIGTERM", close);
|
|
34
|
+
}
|
|
35
|
+
function openDefaultBrowser(url) {
|
|
36
|
+
const command = process.platform === "darwin"
|
|
37
|
+
? { executable: "open", arguments: [url] }
|
|
38
|
+
: process.platform === "win32"
|
|
39
|
+
? { executable: "cmd", arguments: ["/c", "start", "", url] }
|
|
40
|
+
: { executable: "xdg-open", arguments: [url] };
|
|
41
|
+
const child = spawn(command.executable, command.arguments, {
|
|
42
|
+
detached: true,
|
|
43
|
+
stdio: "ignore",
|
|
44
|
+
});
|
|
45
|
+
child.once("error", () => {
|
|
46
|
+
// The printed loopback URL remains usable when the desktop opener is unavailable.
|
|
47
|
+
});
|
|
48
|
+
child.unref();
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=web-command-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-command-service.js","sourceRoot":"","sources":["../../src/web/web-command-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAuB,MAAM,uBAAuB,CAAC;AAajF,MAAM,OAAO,iBAAiB;IACQ;IAApC,YAAoC,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAE/D,KAAK,CAAC,KAAK,CAAC,OAAwB;QACzC,MAAM,WAAW,GAAG,IAAI,mBAAmB,CAAC,IAAI,CAAC,cAAc,EAAE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