fluxy-bot 0.2.24 → 0.2.25
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/bin/cli.js +15 -20
- package/package.json +1 -1
- package/supervisor/vite-dev.ts +28 -0
- package/vite.config.ts +11 -0
- package/vite.fluxy.config.ts +14 -0
package/bin/cli.js
CHANGED
|
@@ -219,6 +219,10 @@ function bootServer() {
|
|
|
219
219
|
let resolved = false;
|
|
220
220
|
let stderrBuf = '';
|
|
221
221
|
|
|
222
|
+
// Vite warmup tracking
|
|
223
|
+
let viteWarmResolve;
|
|
224
|
+
const viteWarm = new Promise((r) => { viteWarmResolve = r; });
|
|
225
|
+
|
|
222
226
|
const doResolve = () => {
|
|
223
227
|
if (resolved) return;
|
|
224
228
|
resolved = true;
|
|
@@ -227,6 +231,7 @@ function bootServer() {
|
|
|
227
231
|
child,
|
|
228
232
|
tunnelUrl: tunnelUrl || `http://localhost:${config.port}`,
|
|
229
233
|
relayUrl: relayUrl || config.relay?.url || null,
|
|
234
|
+
viteWarm,
|
|
230
235
|
});
|
|
231
236
|
};
|
|
232
237
|
|
|
@@ -239,6 +244,10 @@ function bootServer() {
|
|
|
239
244
|
const relayMatch = text.match(/__RELAY_URL__=(\S+)/);
|
|
240
245
|
if (relayMatch) relayUrl = relayMatch[1];
|
|
241
246
|
|
|
247
|
+
if (text.includes('__VITE_WARM__')) {
|
|
248
|
+
viteWarmResolve();
|
|
249
|
+
}
|
|
250
|
+
|
|
242
251
|
if (tunnelUrl && relayUrl) {
|
|
243
252
|
doResolve();
|
|
244
253
|
return;
|
|
@@ -308,18 +317,11 @@ async function init() {
|
|
|
308
317
|
console.error(` ${c.dim}${err.message}${c.reset}\n`);
|
|
309
318
|
process.exit(1);
|
|
310
319
|
}
|
|
311
|
-
const { child, tunnelUrl, relayUrl } = result;
|
|
320
|
+
const { child, tunnelUrl, relayUrl, viteWarm } = result;
|
|
312
321
|
stepper.advance();
|
|
313
322
|
|
|
314
|
-
//
|
|
315
|
-
|
|
316
|
-
const localUrl = `http://localhost:${config.port}`;
|
|
317
|
-
try {
|
|
318
|
-
await Promise.all([
|
|
319
|
-
fetch(localUrl + '/').then(r => r.text()),
|
|
320
|
-
fetch(localUrl + '/fluxy/onboard.html').then(r => r.text()),
|
|
321
|
-
]);
|
|
322
|
-
} catch {}
|
|
323
|
+
// Wait for Vite to finish pre-transforming all modules (with timeout)
|
|
324
|
+
await Promise.race([viteWarm, new Promise(r => setTimeout(r, 30_000))]);
|
|
323
325
|
stepper.advance();
|
|
324
326
|
|
|
325
327
|
stepper.finish();
|
|
@@ -358,18 +360,11 @@ async function start() {
|
|
|
358
360
|
console.error(` ${c.dim}${err.message}${c.reset}\n`);
|
|
359
361
|
process.exit(1);
|
|
360
362
|
}
|
|
361
|
-
const { child, tunnelUrl, relayUrl } = result;
|
|
363
|
+
const { child, tunnelUrl, relayUrl, viteWarm } = result;
|
|
362
364
|
stepper.advance();
|
|
363
365
|
|
|
364
|
-
//
|
|
365
|
-
|
|
366
|
-
const local = `http://localhost:${cfg.port}`;
|
|
367
|
-
try {
|
|
368
|
-
await Promise.all([
|
|
369
|
-
fetch(local + '/').then(r => r.text()),
|
|
370
|
-
fetch(local + '/fluxy/onboard.html').then(r => r.text()),
|
|
371
|
-
]);
|
|
372
|
-
} catch {}
|
|
366
|
+
// Wait for Vite to finish pre-transforming all modules (with timeout)
|
|
367
|
+
await Promise.race([viteWarm, new Promise(r => setTimeout(r, 30_000))]);
|
|
373
368
|
stepper.advance();
|
|
374
369
|
|
|
375
370
|
stepper.finish();
|
package/package.json
CHANGED
package/supervisor/vite-dev.ts
CHANGED
|
@@ -60,6 +60,34 @@ export async function startViteDevServers(supervisorPort: number): Promise<{ das
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
log.ok(`Vite HMR active — dashboard :${ports.dashboard}, fluxy :${ports.fluxy}`);
|
|
63
|
+
|
|
64
|
+
// Warm up: fetch entry pages so Vite pre-transforms all modules
|
|
65
|
+
// This runs in the background — the server is already listening
|
|
66
|
+
Promise.all([
|
|
67
|
+
fetch(`http://127.0.0.1:${ports.dashboard}/`).then(r => r.text()),
|
|
68
|
+
fetch(`http://127.0.0.1:${ports.fluxy}/fluxy/fluxy.html`).then(r => r.text()),
|
|
69
|
+
fetch(`http://127.0.0.1:${ports.fluxy}/fluxy/onboard.html`).then(r => r.text()),
|
|
70
|
+
]).then(async ([dashHtml, fluxyHtml, onboardHtml]) => {
|
|
71
|
+
// Parse script entries and fetch them to trigger full module graph transformation
|
|
72
|
+
const scriptRe = /src="([^"]+\.tsx)"/g;
|
|
73
|
+
const fetches: Promise<any>[] = [];
|
|
74
|
+
for (const [html, port, base] of [
|
|
75
|
+
[dashHtml, ports.dashboard, ''],
|
|
76
|
+
[fluxyHtml, ports.fluxy, '/fluxy'],
|
|
77
|
+
[onboardHtml, ports.fluxy, '/fluxy'],
|
|
78
|
+
] as [string, number, string][]) {
|
|
79
|
+
let m;
|
|
80
|
+
while ((m = scriptRe.exec(html)) !== null) {
|
|
81
|
+
const url = `http://127.0.0.1:${port}${base}${m[1].startsWith('/') ? '' : '/'}${m[1]}`;
|
|
82
|
+
fetches.push(fetch(url).then(r => r.text()).catch(() => {}));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
await Promise.all(fetches);
|
|
86
|
+
console.log('__VITE_WARM__');
|
|
87
|
+
}).catch(() => {
|
|
88
|
+
console.log('__VITE_WARM__');
|
|
89
|
+
});
|
|
90
|
+
|
|
63
91
|
return ports;
|
|
64
92
|
}
|
|
65
93
|
|
package/vite.config.ts
CHANGED
|
@@ -17,9 +17,20 @@ export default defineConfig({
|
|
|
17
17
|
proxy: {
|
|
18
18
|
'/api': 'http://localhost:3000',
|
|
19
19
|
},
|
|
20
|
+
warmup: {
|
|
21
|
+
clientFiles: ['./src/main.tsx'],
|
|
22
|
+
},
|
|
20
23
|
},
|
|
21
24
|
optimizeDeps: {
|
|
22
25
|
include: [
|
|
26
|
+
'react',
|
|
27
|
+
'react-dom/client',
|
|
28
|
+
'react/jsx-runtime',
|
|
29
|
+
'lucide-react',
|
|
30
|
+
'framer-motion',
|
|
31
|
+
'recharts',
|
|
32
|
+
'zustand',
|
|
33
|
+
'sonner',
|
|
23
34
|
'use-sync-external-store',
|
|
24
35
|
'use-sync-external-store/shim',
|
|
25
36
|
],
|
package/vite.fluxy.config.ts
CHANGED
|
@@ -19,8 +19,22 @@ export default defineConfig({
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
|
+
server: {
|
|
23
|
+
warmup: {
|
|
24
|
+
clientFiles: ['./fluxy-main.tsx', './onboard-main.tsx'],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
22
27
|
optimizeDeps: {
|
|
23
28
|
include: [
|
|
29
|
+
'react',
|
|
30
|
+
'react-dom/client',
|
|
31
|
+
'react/jsx-runtime',
|
|
32
|
+
'lucide-react',
|
|
33
|
+
'framer-motion',
|
|
34
|
+
'react-markdown',
|
|
35
|
+
'remark-gfm',
|
|
36
|
+
'react-syntax-highlighter',
|
|
37
|
+
'react-syntax-highlighter/dist/esm/styles/prism/one-dark',
|
|
24
38
|
'use-sync-external-store',
|
|
25
39
|
'use-sync-external-store/shim',
|
|
26
40
|
],
|