@aiready/visualizer 0.6.23 → 0.7.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.
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>AIReady Visualizer (Dev)</title>
7
- <script type="module" crossorigin src="/assets/index-BfuwI9KQ.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-C8KyAlJg.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-SEmv1C_v.css">
9
9
  </head>
10
10
  <body>
package/web/package.json CHANGED
@@ -12,9 +12,14 @@
12
12
  "dependencies": {
13
13
  "@aiready/components": "workspace:*",
14
14
  "@aiready/core": "workspace:*",
15
+ "class-variance-authority": "^0.7.1",
16
+ "clsx": "^2.1.1",
15
17
  "d3": "^7.9.0",
18
+ "framer-motion": "^12.35.0",
19
+ "lucide-react": "^0.577.0",
16
20
  "react": "^19.0.0",
17
- "react-dom": "^19.0.0"
21
+ "react-dom": "^19.0.0",
22
+ "tailwind-merge": "^3.0.0"
18
23
  },
19
24
  "devDependencies": {
20
25
  "@tailwindcss/postcss": "^4.1.18",
@@ -1,10 +1,12 @@
1
- import { defineConfig } from 'vite';
1
+ import { defineConfig, type UserConfig } from 'vite';
2
2
  import { resolve } from 'path';
3
3
  import react from '@vitejs/plugin-react';
4
- import { existsSync } from 'fs';
5
- import tailwindcss from '@tailwindcss/vite';
4
+ import { existsSync, readFileSync } from 'fs';
5
+ import { createRequire } from 'module';
6
6
 
7
- export default defineConfig(async ({ command }) => {
7
+ const require = createRequire(import.meta.url);
8
+
9
+ export default defineConfig(({ command }): UserConfig => {
8
10
  const isDev = command === 'serve';
9
11
 
10
12
  // Resolve path to @aiready/components for alias
@@ -13,61 +15,57 @@ export default defineConfig(async ({ command }) => {
13
15
  if (!existsSync(componentsPath)) {
14
16
  // Fallback: try installed package
15
17
  try {
16
- componentsPath = require.resolve('@aiready/components');
17
- componentsPath = resolve(componentsPath, '..');
18
+ // Use synchronous resolve
19
+ componentsPath = resolve(
20
+ require.resolve('@aiready/components'),
21
+ '../../src'
22
+ );
18
23
  } catch (e) {
19
24
  // Use build dist as last resort
20
25
  componentsPath = resolve(__dirname, '../../components/dist');
21
26
  }
22
27
  }
23
28
 
24
- const plugins: any[] = [react() /*, tailwindcss()*/];
25
- // Dev-time middleware: if the CLI sets AIREADY_REPORT_PATH when spawning Vite,
26
- // serve that file at /report-data.json so the client can fetch the report
27
- // directly from the consumer working directory without copying into node_modules.
29
+ const plugins: any[] = [react()];
30
+
31
+ // Dev-time middleware
28
32
  const reportProxyPlugin = {
29
33
  name: 'aiready-report-proxy',
30
34
  configureServer(server: any) {
31
35
  const reportPath = process.env.AIREADY_REPORT_PATH;
32
36
  const visualizerConfigStr = process.env.AIREADY_VISUALIZER_CONFIG;
33
37
  if (!reportPath) return;
34
- server.middlewares.use(async (req: any, res: any, next: any) => {
35
- try {
36
- const url = req.url || '';
37
- if (
38
- url === '/report-data.json' ||
39
- url.startsWith('/report-data.json?')
40
- ) {
41
- const { promises: fsp } = await import('fs');
38
+
39
+ server.middlewares.use((req: any, res: any, next: any) => {
40
+ const url = req.url || '';
41
+ if (url === '/report-data.json' || url.startsWith('/report-data.json?')) {
42
+ try {
42
43
  if (!existsSync(reportPath)) {
43
44
  res.statusCode = 404;
44
45
  res.setHeader('Content-Type', 'text/plain; charset=utf-8');
45
46
  res.end('Report not found');
46
47
  return;
47
48
  }
48
- const data = await fsp.readFile(reportPath, 'utf8');
49
+ const data = readFileSync(reportPath, 'utf8');
49
50
  const report = JSON.parse(data);
50
51
 
51
- // Inject visualizer config from env if available
52
52
  if (visualizerConfigStr) {
53
53
  try {
54
54
  const visualizerConfig = JSON.parse(visualizerConfigStr);
55
55
  report.visualizerConfig = visualizerConfig;
56
- } catch (e) {
57
- // Silently ignore parse errors
58
- }
56
+ } catch (e) {}
59
57
  }
60
58
 
61
59
  res.statusCode = 200;
62
60
  res.setHeader('Content-Type', 'application/json; charset=utf-8');
63
61
  res.end(JSON.stringify(report));
64
62
  return;
63
+ } catch (e) {
64
+ res.statusCode = 500;
65
+ res.setHeader('Content-Type', 'text/plain; charset=utf-8');
66
+ res.end('Error reading report');
67
+ return;
65
68
  }
66
- } catch (e) {
67
- res.statusCode = 500;
68
- res.setHeader('Content-Type', 'text/plain; charset=utf-8');
69
- res.end('Error reading report');
70
- return;
71
69
  }
72
70
  next();
73
71
  });
@@ -89,16 +87,14 @@ export default defineConfig(async ({ command }) => {
89
87
  },
90
88
  },
91
89
  server: {
92
- // Use default port (5173); don't hardcode to avoid conflicts
93
90
  open: false,
94
91
  },
95
92
  resolve: {
96
- alias: {
97
- // during dev resolve to source for HMR; during build use the built dist
98
- '@aiready/components': isDev
99
- ? componentsPath
100
- : resolve(__dirname, '../../components/dist/index.js'),
101
- },
93
+ alias: isDev
94
+ ? {
95
+ '@aiready/components': componentsPath,
96
+ }
97
+ : ({} as Record<string, string>),
102
98
  },
103
99
  };
104
100
  });