@aiready/visualizer 0.1.19 → 0.1.21
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/package.json +3 -2
- package/web/vite.config.ts +36 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/visualizer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Interactive graph visualization for AIReady analysis results",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"react": "19.2.4",
|
|
49
49
|
"react-dom": "19.2.4",
|
|
50
50
|
"regenerator-runtime": "^0.14.1",
|
|
51
|
-
"
|
|
51
|
+
"d3": "^7",
|
|
52
|
+
"@aiready/core": "0.9.17"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
55
|
"@types/node": "^22.10.5",
|
package/web/vite.config.ts
CHANGED
|
@@ -21,6 +21,42 @@ export default defineConfig(async ({ command }) => {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const plugins: any[] = [react()];
|
|
24
|
+
// Dev-time middleware: if the CLI sets AIREADY_REPORT_PATH when spawning Vite,
|
|
25
|
+
// serve that file at /report-data.json so the client can fetch the report
|
|
26
|
+
// directly from the consumer working directory without copying into node_modules.
|
|
27
|
+
const reportProxyPlugin = {
|
|
28
|
+
name: 'aiready-report-proxy',
|
|
29
|
+
configureServer(server: any) {
|
|
30
|
+
const reportPath = process.env.AIREADY_REPORT_PATH;
|
|
31
|
+
if (!reportPath) return;
|
|
32
|
+
server.middlewares.use(async (req: any, res: any, next: any) => {
|
|
33
|
+
try {
|
|
34
|
+
const url = req.url || '';
|
|
35
|
+
if (url === '/report-data.json' || url.startsWith('/report-data.json?')) {
|
|
36
|
+
const { promises: fsp } = await import('fs');
|
|
37
|
+
if (!existsSync(reportPath)) {
|
|
38
|
+
res.statusCode = 404;
|
|
39
|
+
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
|
|
40
|
+
res.end('Report not found');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const data = await fsp.readFile(reportPath, 'utf8');
|
|
44
|
+
res.statusCode = 200;
|
|
45
|
+
res.setHeader('Content-Type', 'application/json; charset=utf-8');
|
|
46
|
+
res.end(data);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
} catch (e) {
|
|
50
|
+
res.statusCode = 500;
|
|
51
|
+
res.setHeader('Content-Type', 'text/plain; charset=utf-8');
|
|
52
|
+
res.end('Error reading report');
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
next();
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
plugins.push(reportProxyPlugin);
|
|
24
60
|
// Try to dynamically import Tailwind Vite plugin. If it's not installed,
|
|
25
61
|
// continue without it so consumers who don't use Tailwind won't error.
|
|
26
62
|
try {
|