@fairfox/polly 0.2.0 → 0.2.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/dist/vendor/verify/specs/Dockerfile +13 -0
- package/dist/vendor/verify/specs/README.md +37 -0
- package/dist/vendor/verify/specs/docker-compose.yml +9 -0
- package/dist/vendor/verify/specs/tla/MessageRouter.cfg +24 -0
- package/dist/vendor/verify/specs/tla/MessageRouter.tla +221 -0
- package/dist/vendor/verify/specs/tla/README.md +179 -0
- package/dist/vendor/verify/specs/verification.config.ts +61 -0
- package/dist/vendor/verify/src/cli.js +22 -4
- package/dist/vendor/verify/src/cli.js.map +5 -5
- package/dist/vendor/visualize/src/cli.js +379 -46
- package/dist/vendor/visualize/src/cli.js.map +11 -10
- package/package.json +1 -1
|
@@ -13,13 +13,327 @@ var __export = (target, all) => {
|
|
|
13
13
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
14
14
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
15
15
|
|
|
16
|
+
// vendor/analysis/src/extract/project-detector.ts
|
|
17
|
+
var exports_project_detector = {};
|
|
18
|
+
__export(exports_project_detector, {
|
|
19
|
+
detectProjectConfig: () => detectProjectConfig,
|
|
20
|
+
ProjectDetector: () => ProjectDetector
|
|
21
|
+
});
|
|
22
|
+
import * as fs3 from "node:fs";
|
|
23
|
+
import * as path3 from "node:path";
|
|
24
|
+
|
|
25
|
+
class ProjectDetector {
|
|
26
|
+
projectRoot;
|
|
27
|
+
constructor(projectRoot) {
|
|
28
|
+
this.projectRoot = projectRoot;
|
|
29
|
+
}
|
|
30
|
+
detect() {
|
|
31
|
+
const manifestPath = path3.join(this.projectRoot, "manifest.json");
|
|
32
|
+
if (fs3.existsSync(manifestPath)) {
|
|
33
|
+
return this.detectChromeExtension(manifestPath);
|
|
34
|
+
}
|
|
35
|
+
const pwaManifestPath = path3.join(this.projectRoot, "public", "manifest.json");
|
|
36
|
+
if (fs3.existsSync(pwaManifestPath)) {
|
|
37
|
+
return this.detectPWA(pwaManifestPath);
|
|
38
|
+
}
|
|
39
|
+
const packageJsonPath = path3.join(this.projectRoot, "package.json");
|
|
40
|
+
if (fs3.existsSync(packageJsonPath)) {
|
|
41
|
+
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
|
|
42
|
+
if (packageJson.dependencies?.electron || packageJson.devDependencies?.electron) {
|
|
43
|
+
return this.detectElectron(packageJson);
|
|
44
|
+
}
|
|
45
|
+
if (packageJson.dependencies?.ws || packageJson.dependencies?.["socket.io"] || packageJson.dependencies?.elysia || packageJson.dependencies?.express) {
|
|
46
|
+
return this.detectWebSocketApp(packageJson);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return this.detectGenericProject();
|
|
50
|
+
}
|
|
51
|
+
detectChromeExtension(manifestPath) {
|
|
52
|
+
const manifest = JSON.parse(fs3.readFileSync(manifestPath, "utf-8"));
|
|
53
|
+
const entryPoints = {};
|
|
54
|
+
const background = manifest.background;
|
|
55
|
+
if (background) {
|
|
56
|
+
const file = background.service_worker || background.scripts?.[0] || background.page;
|
|
57
|
+
if (file) {
|
|
58
|
+
entryPoints.background = this.findSourceFile(file);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const contentScripts = manifest.content_scripts;
|
|
62
|
+
if (contentScripts && contentScripts.length > 0) {
|
|
63
|
+
const firstScript = contentScripts[0].js?.[0];
|
|
64
|
+
if (firstScript) {
|
|
65
|
+
entryPoints.content = this.findSourceFile(firstScript);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const popup = manifest.action?.default_popup || manifest.browser_action?.default_popup;
|
|
69
|
+
if (popup) {
|
|
70
|
+
const jsFile = this.findAssociatedJS(path3.join(this.projectRoot, popup));
|
|
71
|
+
if (jsFile)
|
|
72
|
+
entryPoints.popup = jsFile;
|
|
73
|
+
}
|
|
74
|
+
const options = manifest.options_ui?.page || manifest.options_page;
|
|
75
|
+
if (options) {
|
|
76
|
+
const jsFile = this.findAssociatedJS(path3.join(this.projectRoot, options));
|
|
77
|
+
if (jsFile)
|
|
78
|
+
entryPoints.options = jsFile;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
type: "chrome-extension",
|
|
82
|
+
entryPoints,
|
|
83
|
+
metadata: {
|
|
84
|
+
name: manifest.name,
|
|
85
|
+
version: manifest.version,
|
|
86
|
+
description: manifest.description
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
detectPWA(manifestPath) {
|
|
91
|
+
const manifest = JSON.parse(fs3.readFileSync(manifestPath, "utf-8"));
|
|
92
|
+
const entryPoints = {};
|
|
93
|
+
const swCandidates = [
|
|
94
|
+
"src/service-worker.ts",
|
|
95
|
+
"src/sw.ts",
|
|
96
|
+
"public/service-worker.js",
|
|
97
|
+
"public/sw.js"
|
|
98
|
+
];
|
|
99
|
+
for (const candidate of swCandidates) {
|
|
100
|
+
const fullPath = path3.join(this.projectRoot, candidate);
|
|
101
|
+
if (fs3.existsSync(fullPath)) {
|
|
102
|
+
entryPoints.worker = fullPath;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const clientCandidates = [
|
|
107
|
+
"src/main.ts",
|
|
108
|
+
"src/index.ts",
|
|
109
|
+
"src/app.ts",
|
|
110
|
+
"src/main.tsx",
|
|
111
|
+
"src/index.tsx"
|
|
112
|
+
];
|
|
113
|
+
for (const candidate of clientCandidates) {
|
|
114
|
+
const fullPath = path3.join(this.projectRoot, candidate);
|
|
115
|
+
if (fs3.existsSync(fullPath)) {
|
|
116
|
+
entryPoints.client = fullPath;
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
type: "pwa",
|
|
122
|
+
entryPoints,
|
|
123
|
+
contextMapping: {
|
|
124
|
+
worker: "Service Worker",
|
|
125
|
+
client: "Client App"
|
|
126
|
+
},
|
|
127
|
+
metadata: {
|
|
128
|
+
name: manifest.name || manifest.short_name,
|
|
129
|
+
version: "1.0.0",
|
|
130
|
+
description: manifest.description
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
detectElectron(packageJson) {
|
|
135
|
+
const entryPoints = {};
|
|
136
|
+
const mainCandidates = [
|
|
137
|
+
packageJson.main,
|
|
138
|
+
"src/main/index.ts",
|
|
139
|
+
"src/electron/main.ts",
|
|
140
|
+
"electron/main.ts",
|
|
141
|
+
"main.ts"
|
|
142
|
+
].filter(Boolean);
|
|
143
|
+
for (const candidate of mainCandidates) {
|
|
144
|
+
const fullPath = path3.join(this.projectRoot, candidate);
|
|
145
|
+
if (fs3.existsSync(fullPath) || fs3.existsSync(fullPath.replace(/\.js$/, ".ts"))) {
|
|
146
|
+
entryPoints.main = fs3.existsSync(fullPath) ? fullPath : fullPath.replace(/\.js$/, ".ts");
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const rendererCandidates = [
|
|
151
|
+
"src/renderer/index.tsx",
|
|
152
|
+
"src/renderer/index.ts",
|
|
153
|
+
"src/index.tsx",
|
|
154
|
+
"src/index.ts"
|
|
155
|
+
];
|
|
156
|
+
for (const candidate of rendererCandidates) {
|
|
157
|
+
const fullPath = path3.join(this.projectRoot, candidate);
|
|
158
|
+
if (fs3.existsSync(fullPath)) {
|
|
159
|
+
entryPoints.renderer = fullPath;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
type: "electron",
|
|
165
|
+
entryPoints,
|
|
166
|
+
contextMapping: {
|
|
167
|
+
main: "Main Process",
|
|
168
|
+
renderer: "Renderer Process"
|
|
169
|
+
},
|
|
170
|
+
metadata: {
|
|
171
|
+
name: packageJson.name,
|
|
172
|
+
version: packageJson.version,
|
|
173
|
+
description: packageJson.description
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
detectWebSocketApp(packageJson) {
|
|
178
|
+
const entryPoints = {};
|
|
179
|
+
const serverCandidates = [
|
|
180
|
+
"src/server.ts",
|
|
181
|
+
"src/index.ts",
|
|
182
|
+
"src/main.ts",
|
|
183
|
+
"src/app.ts",
|
|
184
|
+
"server.ts",
|
|
185
|
+
"index.ts"
|
|
186
|
+
];
|
|
187
|
+
for (const candidate of serverCandidates) {
|
|
188
|
+
const fullPath = path3.join(this.projectRoot, candidate);
|
|
189
|
+
if (fs3.existsSync(fullPath)) {
|
|
190
|
+
entryPoints.server = fullPath;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const clientCandidates = [
|
|
195
|
+
"src/client/index.ts",
|
|
196
|
+
"src/client.ts",
|
|
197
|
+
"client/index.ts"
|
|
198
|
+
];
|
|
199
|
+
for (const candidate of clientCandidates) {
|
|
200
|
+
const fullPath = path3.join(this.projectRoot, candidate);
|
|
201
|
+
if (fs3.existsSync(fullPath)) {
|
|
202
|
+
entryPoints.client = fullPath;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
type: "websocket-app",
|
|
208
|
+
entryPoints,
|
|
209
|
+
contextMapping: {
|
|
210
|
+
server: "Server",
|
|
211
|
+
client: "Client"
|
|
212
|
+
},
|
|
213
|
+
metadata: {
|
|
214
|
+
name: packageJson.name,
|
|
215
|
+
version: packageJson.version,
|
|
216
|
+
description: packageJson.description
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
detectGenericProject() {
|
|
221
|
+
const entryPoints = {};
|
|
222
|
+
const tsConfigPath = path3.join(this.projectRoot, "tsconfig.json");
|
|
223
|
+
if (fs3.existsSync(tsConfigPath)) {
|
|
224
|
+
try {
|
|
225
|
+
const tsConfig = JSON.parse(fs3.readFileSync(tsConfigPath, "utf-8"));
|
|
226
|
+
if (tsConfig.files && Array.isArray(tsConfig.files)) {
|
|
227
|
+
tsConfig.files.forEach((file, idx) => {
|
|
228
|
+
const fullPath = path3.join(this.projectRoot, file);
|
|
229
|
+
if (fs3.existsSync(fullPath)) {
|
|
230
|
+
entryPoints[`module${idx + 1}`] = fullPath;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
} catch (error) {
|
|
235
|
+
console.warn(`Failed to parse tsconfig.json: ${error}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (Object.keys(entryPoints).length === 0) {
|
|
239
|
+
const commonEntries = [
|
|
240
|
+
"src/index.ts",
|
|
241
|
+
"src/main.ts",
|
|
242
|
+
"src/app.ts",
|
|
243
|
+
"index.ts",
|
|
244
|
+
"main.ts"
|
|
245
|
+
];
|
|
246
|
+
for (const candidate of commonEntries) {
|
|
247
|
+
const fullPath = path3.join(this.projectRoot, candidate);
|
|
248
|
+
if (fs3.existsSync(fullPath)) {
|
|
249
|
+
entryPoints.main = fullPath;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
const packageJsonPath = path3.join(this.projectRoot, "package.json");
|
|
255
|
+
let metadata = { name: "Unknown Project" };
|
|
256
|
+
if (fs3.existsSync(packageJsonPath)) {
|
|
257
|
+
try {
|
|
258
|
+
const packageJson = JSON.parse(fs3.readFileSync(packageJsonPath, "utf-8"));
|
|
259
|
+
metadata = {
|
|
260
|
+
name: packageJson.name,
|
|
261
|
+
version: packageJson.version,
|
|
262
|
+
description: packageJson.description
|
|
263
|
+
};
|
|
264
|
+
} catch (error) {
|
|
265
|
+
console.warn(`Failed to parse package.json: ${error}`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return {
|
|
269
|
+
type: "generic",
|
|
270
|
+
entryPoints,
|
|
271
|
+
metadata
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
findSourceFile(manifestPath) {
|
|
275
|
+
const candidates = [
|
|
276
|
+
path3.join(this.projectRoot, manifestPath),
|
|
277
|
+
path3.join(this.projectRoot, manifestPath.replace(/\.js$/, ".ts")),
|
|
278
|
+
path3.join(this.projectRoot, "src", manifestPath),
|
|
279
|
+
path3.join(this.projectRoot, "src", manifestPath.replace(/\.js$/, ".ts")),
|
|
280
|
+
path3.join(this.projectRoot, "src", manifestPath.replace(/\.js$/, ".tsx"))
|
|
281
|
+
];
|
|
282
|
+
for (const candidate of candidates) {
|
|
283
|
+
if (fs3.existsSync(candidate)) {
|
|
284
|
+
return candidate;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return path3.join(this.projectRoot, manifestPath);
|
|
288
|
+
}
|
|
289
|
+
findAssociatedJS(htmlPath) {
|
|
290
|
+
if (!fs3.existsSync(htmlPath)) {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
const html = fs3.readFileSync(htmlPath, "utf-8");
|
|
294
|
+
const scriptMatch = html.match(/<script[^>]+src=["']([^"']+)["']/i);
|
|
295
|
+
if (scriptMatch && scriptMatch[1]) {
|
|
296
|
+
const scriptPath = scriptMatch[1];
|
|
297
|
+
const fullPath = path3.resolve(path3.dirname(htmlPath), scriptPath);
|
|
298
|
+
if (fs3.existsSync(fullPath))
|
|
299
|
+
return fullPath;
|
|
300
|
+
if (fs3.existsSync(fullPath.replace(/\.js$/, ".ts"))) {
|
|
301
|
+
return fullPath.replace(/\.js$/, ".ts");
|
|
302
|
+
}
|
|
303
|
+
if (fs3.existsSync(fullPath.replace(/\.js$/, ".tsx"))) {
|
|
304
|
+
return fullPath.replace(/\.js$/, ".tsx");
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
const baseName = path3.basename(htmlPath, ".html");
|
|
308
|
+
const dir = path3.dirname(htmlPath);
|
|
309
|
+
const candidates = [
|
|
310
|
+
path3.join(dir, `${baseName}.ts`),
|
|
311
|
+
path3.join(dir, `${baseName}.tsx`),
|
|
312
|
+
path3.join(dir, `${baseName}.js`),
|
|
313
|
+
path3.join(dir, "index.ts"),
|
|
314
|
+
path3.join(dir, "index.tsx")
|
|
315
|
+
];
|
|
316
|
+
for (const candidate of candidates) {
|
|
317
|
+
if (fs3.existsSync(candidate)) {
|
|
318
|
+
return candidate;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return null;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function detectProjectConfig(projectRoot) {
|
|
325
|
+
const detector = new ProjectDetector(projectRoot);
|
|
326
|
+
return detector.detect();
|
|
327
|
+
}
|
|
328
|
+
var init_project_detector = () => {};
|
|
329
|
+
|
|
16
330
|
// vendor/visualize/src/cli.ts
|
|
17
|
-
import * as
|
|
18
|
-
import * as
|
|
331
|
+
import * as fs6 from "node:fs";
|
|
332
|
+
import * as path6 from "node:path";
|
|
19
333
|
|
|
20
334
|
// vendor/analysis/src/extract/architecture.ts
|
|
21
|
-
import * as
|
|
22
|
-
import * as
|
|
335
|
+
import * as fs4 from "node:fs";
|
|
336
|
+
import * as path4 from "node:path";
|
|
23
337
|
|
|
24
338
|
// vendor/analysis/src/extract/manifest.ts
|
|
25
339
|
import * as fs from "node:fs";
|
|
@@ -1168,9 +1482,31 @@ class ArchitectureAnalyzer {
|
|
|
1168
1482
|
this.options = options;
|
|
1169
1483
|
}
|
|
1170
1484
|
async analyze() {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1485
|
+
let manifest;
|
|
1486
|
+
let projectConfig;
|
|
1487
|
+
let entryPoints = {};
|
|
1488
|
+
let systemInfo;
|
|
1489
|
+
const manifestPath = path4.join(this.options.projectRoot, "manifest.json");
|
|
1490
|
+
const hasManifest = fs4.existsSync(manifestPath);
|
|
1491
|
+
if (hasManifest && !this.options.useProjectDetector) {
|
|
1492
|
+
const manifestParser = new ManifestParser(this.options.projectRoot);
|
|
1493
|
+
manifest = manifestParser.parse();
|
|
1494
|
+
entryPoints = manifestParser.getContextEntryPoints();
|
|
1495
|
+
systemInfo = {
|
|
1496
|
+
name: manifest.name,
|
|
1497
|
+
version: manifest.version,
|
|
1498
|
+
description: manifest.description
|
|
1499
|
+
};
|
|
1500
|
+
} else {
|
|
1501
|
+
const { detectProjectConfig: detectProjectConfig2 } = await Promise.resolve().then(() => (init_project_detector(), exports_project_detector));
|
|
1502
|
+
projectConfig = detectProjectConfig2(this.options.projectRoot);
|
|
1503
|
+
entryPoints = projectConfig.entryPoints;
|
|
1504
|
+
systemInfo = {
|
|
1505
|
+
name: projectConfig.metadata?.name || "Unknown Project",
|
|
1506
|
+
version: projectConfig.metadata?.version || "0.0.0",
|
|
1507
|
+
description: projectConfig.metadata?.description
|
|
1508
|
+
};
|
|
1509
|
+
}
|
|
1174
1510
|
const handlerExtractor = new HandlerExtractor(this.options.tsConfigPath);
|
|
1175
1511
|
const { handlers } = handlerExtractor.extractHandlers();
|
|
1176
1512
|
const contextAnalyzer = new ContextAnalyzer(this.options.tsConfigPath);
|
|
@@ -1191,12 +1527,9 @@ class ArchitectureAnalyzer {
|
|
|
1191
1527
|
const adrs = extractADRs(this.options.projectRoot);
|
|
1192
1528
|
const repository = this.extractRepositoryInfo();
|
|
1193
1529
|
return {
|
|
1194
|
-
system:
|
|
1195
|
-
name: manifest.name,
|
|
1196
|
-
version: manifest.version,
|
|
1197
|
-
description: manifest.description
|
|
1198
|
-
},
|
|
1530
|
+
system: systemInfo,
|
|
1199
1531
|
manifest,
|
|
1532
|
+
projectConfig,
|
|
1200
1533
|
contexts,
|
|
1201
1534
|
messageFlows,
|
|
1202
1535
|
integrations,
|
|
@@ -1219,12 +1552,12 @@ class ArchitectureAnalyzer {
|
|
|
1219
1552
|
}
|
|
1220
1553
|
}
|
|
1221
1554
|
extractRepositoryInfo() {
|
|
1222
|
-
const packageJsonPath =
|
|
1223
|
-
if (!
|
|
1555
|
+
const packageJsonPath = path4.join(this.options.projectRoot, "package.json");
|
|
1556
|
+
if (!fs4.existsSync(packageJsonPath)) {
|
|
1224
1557
|
return;
|
|
1225
1558
|
}
|
|
1226
1559
|
try {
|
|
1227
|
-
const content =
|
|
1560
|
+
const content = fs4.readFileSync(packageJsonPath, "utf-8");
|
|
1228
1561
|
const packageJson = JSON.parse(content);
|
|
1229
1562
|
if (packageJson.repository) {
|
|
1230
1563
|
if (typeof packageJson.repository === "string") {
|
|
@@ -1724,8 +2057,8 @@ function generateStructurizrDSL(analysis, options) {
|
|
|
1724
2057
|
}
|
|
1725
2058
|
|
|
1726
2059
|
// vendor/visualize/src/runner/export.ts
|
|
1727
|
-
import * as
|
|
1728
|
-
import * as
|
|
2060
|
+
import * as fs5 from "node:fs";
|
|
2061
|
+
import * as path5 from "node:path";
|
|
1729
2062
|
import { spawn } from "node:child_process";
|
|
1730
2063
|
|
|
1731
2064
|
class DiagramExporter {
|
|
@@ -1733,15 +2066,15 @@ class DiagramExporter {
|
|
|
1733
2066
|
static DEFAULT_TIMEOUT = 120000;
|
|
1734
2067
|
async export(options) {
|
|
1735
2068
|
const { dslPath, outputDir, timeout = DiagramExporter.DEFAULT_TIMEOUT } = options;
|
|
1736
|
-
if (!
|
|
2069
|
+
if (!fs5.existsSync(dslPath)) {
|
|
1737
2070
|
return {
|
|
1738
2071
|
success: false,
|
|
1739
2072
|
siteDir: "",
|
|
1740
2073
|
error: `DSL file not found: ${dslPath}`
|
|
1741
2074
|
};
|
|
1742
2075
|
}
|
|
1743
|
-
if (!
|
|
1744
|
-
|
|
2076
|
+
if (!fs5.existsSync(outputDir)) {
|
|
2077
|
+
fs5.mkdirSync(outputDir, { recursive: true });
|
|
1745
2078
|
}
|
|
1746
2079
|
const dockerAvailable = await this.isDockerAvailable();
|
|
1747
2080
|
if (!dockerAvailable) {
|
|
@@ -1774,8 +2107,8 @@ class DiagramExporter {
|
|
|
1774
2107
|
}
|
|
1775
2108
|
}
|
|
1776
2109
|
async exportStaticSite(dslPath, outputDir, timeout) {
|
|
1777
|
-
const dslDir =
|
|
1778
|
-
const dslFileName =
|
|
2110
|
+
const dslDir = path5.dirname(dslPath);
|
|
2111
|
+
const dslFileName = path5.basename(dslPath);
|
|
1779
2112
|
const workspaceMount = `${dslDir}:/usr/local/structurizr`;
|
|
1780
2113
|
const outputMount = `${outputDir}:/output`;
|
|
1781
2114
|
const args = [
|
|
@@ -1813,7 +2146,7 @@ class DiagramExporter {
|
|
|
1813
2146
|
}
|
|
1814
2147
|
}
|
|
1815
2148
|
async pullImage(onProgress) {
|
|
1816
|
-
return new Promise((
|
|
2149
|
+
return new Promise((resolve3, reject) => {
|
|
1817
2150
|
const proc = spawn("docker", ["pull", DiagramExporter.DOCKER_IMAGE]);
|
|
1818
2151
|
proc.stdout.on("data", (data) => {
|
|
1819
2152
|
onProgress?.(data.toString().trim());
|
|
@@ -1823,7 +2156,7 @@ class DiagramExporter {
|
|
|
1823
2156
|
});
|
|
1824
2157
|
proc.on("close", (code) => {
|
|
1825
2158
|
if (code === 0) {
|
|
1826
|
-
|
|
2159
|
+
resolve3();
|
|
1827
2160
|
} else {
|
|
1828
2161
|
reject(new Error(`Failed to pull image, exit code: ${code}`));
|
|
1829
2162
|
}
|
|
@@ -1837,7 +2170,7 @@ class DiagramExporter {
|
|
|
1837
2170
|
return this.runCommand("docker", args, timeout);
|
|
1838
2171
|
}
|
|
1839
2172
|
async runCommand(command, args, timeout) {
|
|
1840
|
-
return new Promise((
|
|
2173
|
+
return new Promise((resolve3, reject) => {
|
|
1841
2174
|
const proc = spawn(command, args);
|
|
1842
2175
|
let stdout = "";
|
|
1843
2176
|
let stderr = "";
|
|
@@ -1854,7 +2187,7 @@ class DiagramExporter {
|
|
|
1854
2187
|
proc.on("close", (code) => {
|
|
1855
2188
|
clearTimeout(timer);
|
|
1856
2189
|
if (code === 0) {
|
|
1857
|
-
|
|
2190
|
+
resolve3(stdout);
|
|
1858
2191
|
} else {
|
|
1859
2192
|
reject(new Error(`Command failed with exit code ${code}: ${stderr}`));
|
|
1860
2193
|
}
|
|
@@ -1963,12 +2296,12 @@ async function generateCommand() {
|
|
|
1963
2296
|
includeComponentDiagrams: true,
|
|
1964
2297
|
componentDiagramContexts: ["background"]
|
|
1965
2298
|
});
|
|
1966
|
-
const outputDir =
|
|
1967
|
-
if (!
|
|
1968
|
-
|
|
2299
|
+
const outputDir = path6.join(process.cwd(), "docs");
|
|
2300
|
+
if (!fs6.existsSync(outputDir)) {
|
|
2301
|
+
fs6.mkdirSync(outputDir, { recursive: true });
|
|
1969
2302
|
}
|
|
1970
|
-
const dslPath =
|
|
1971
|
-
|
|
2303
|
+
const dslPath = path6.join(outputDir, "architecture.dsl");
|
|
2304
|
+
fs6.writeFileSync(dslPath, dsl, "utf-8");
|
|
1972
2305
|
console.log(color(`✅ Architecture documentation generated!
|
|
1973
2306
|
`, COLORS.green));
|
|
1974
2307
|
console.log(` File: ${color(dslPath, COLORS.blue)}`);
|
|
@@ -2010,14 +2343,14 @@ async function exportCommand(args) {
|
|
|
2010
2343
|
\uD83D\uDCE4 Generating static site...
|
|
2011
2344
|
`, COLORS.blue));
|
|
2012
2345
|
try {
|
|
2013
|
-
const dslPath =
|
|
2014
|
-
if (!
|
|
2346
|
+
const dslPath = path6.join(process.cwd(), "docs", "architecture.dsl");
|
|
2347
|
+
if (!fs6.existsSync(dslPath)) {
|
|
2015
2348
|
console.error(color("❌ DSL file not found", COLORS.red));
|
|
2016
2349
|
console.error(" Expected: docs/architecture.dsl");
|
|
2017
2350
|
console.error(" Run 'bun visualize' first to generate the DSL");
|
|
2018
2351
|
process.exit(1);
|
|
2019
2352
|
}
|
|
2020
|
-
const outputDir =
|
|
2353
|
+
const outputDir = path6.join(process.cwd(), "docs", "site");
|
|
2021
2354
|
console.log(color(` DSL: ${dslPath}`, COLORS.gray));
|
|
2022
2355
|
console.log(color(` Output: ${outputDir}`, COLORS.gray));
|
|
2023
2356
|
console.log();
|
|
@@ -2061,9 +2394,9 @@ async function serveCommand(args) {
|
|
|
2061
2394
|
\uD83C\uDF10 Starting static site server...
|
|
2062
2395
|
`, COLORS.blue));
|
|
2063
2396
|
try {
|
|
2064
|
-
const siteDir =
|
|
2065
|
-
const indexPath =
|
|
2066
|
-
if (!
|
|
2397
|
+
const siteDir = path6.join(process.cwd(), "docs", "site");
|
|
2398
|
+
const indexPath = path6.join(siteDir, "index.html");
|
|
2399
|
+
if (!fs6.existsSync(indexPath)) {
|
|
2067
2400
|
console.error(color("❌ Static site not found", COLORS.red));
|
|
2068
2401
|
console.error(" Expected: docs/site/index.html");
|
|
2069
2402
|
console.error(" Run 'bun visualize --export' first to generate the site");
|
|
@@ -2082,8 +2415,8 @@ async function serveCommand(args) {
|
|
|
2082
2415
|
port,
|
|
2083
2416
|
fetch(req) {
|
|
2084
2417
|
const url = new URL(req.url);
|
|
2085
|
-
let filePath =
|
|
2086
|
-
if (
|
|
2418
|
+
let filePath = path6.join(siteDir, url.pathname === "/" ? "index.html" : url.pathname);
|
|
2419
|
+
if (fs6.existsSync(filePath) && fs6.statSync(filePath).isFile()) {
|
|
2087
2420
|
const file = BunGlobal.file(filePath);
|
|
2088
2421
|
return new Response(file);
|
|
2089
2422
|
}
|
|
@@ -2154,21 +2487,21 @@ ${color("Learn More:", COLORS.blue)}
|
|
|
2154
2487
|
}
|
|
2155
2488
|
function findTsConfig() {
|
|
2156
2489
|
const locations = [
|
|
2157
|
-
|
|
2158
|
-
|
|
2490
|
+
path6.join(process.cwd(), "tsconfig.json"),
|
|
2491
|
+
path6.join(process.cwd(), "..", "tsconfig.json")
|
|
2159
2492
|
];
|
|
2160
2493
|
for (const loc of locations) {
|
|
2161
|
-
if (
|
|
2494
|
+
if (fs6.existsSync(loc)) {
|
|
2162
2495
|
return loc;
|
|
2163
2496
|
}
|
|
2164
2497
|
}
|
|
2165
2498
|
return null;
|
|
2166
2499
|
}
|
|
2167
2500
|
function findProjectRoot() {
|
|
2168
|
-
const locations = [process.cwd(),
|
|
2501
|
+
const locations = [process.cwd(), path6.join(process.cwd(), "..")];
|
|
2169
2502
|
for (const loc of locations) {
|
|
2170
|
-
const manifestPath =
|
|
2171
|
-
if (
|
|
2503
|
+
const manifestPath = path6.join(loc, "manifest.json");
|
|
2504
|
+
if (fs6.existsSync(manifestPath)) {
|
|
2172
2505
|
return loc;
|
|
2173
2506
|
}
|
|
2174
2507
|
}
|
|
@@ -2186,4 +2519,4 @@ Stack trace:`, COLORS.gray));
|
|
|
2186
2519
|
process.exit(1);
|
|
2187
2520
|
});
|
|
2188
2521
|
|
|
2189
|
-
//# debugId=
|
|
2522
|
+
//# debugId=42A0D5368C5C715B64756E2164756E21
|