Repository navigation
perf(void): keep auth codegen and CLI output out of the plugin entry - #503
Conversation
Every `vp dev` and `vp build` imports the plugin entry before doing anything
else. It statically loaded Better Auth's schema helpers (with zod) for the
routing plugin's auth codegen and the CLI's terminal-link stack for the AI
setup prompt, although only auth apps and that prompt use them. Import both
where they are used.
This drops 151 modules from the entry's own import graph and about 25ms
from `import('void')`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
01f378d to
35c6fec
Compare
…LI output Every vp dev and vp build imports the plugin entry first. The test mocks auth/drizzle.ts, cli/output.ts, better-auth/db and terminal-link, imports the entry, and expects none of them to load. It fails on main, where the entry loads both modules statically. AGENTS.md points to the test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Thanks! Verified: on the built dist, void loads 238 → 77 modules after Vite + the Cloudflare plugin (median 70.8 → 37.7 ms), and nothing from better-auth, zod or terminal-link is reachable from I pushed 46fcb55 with a guard test, |
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Thanks! Claude actually added a test but I removed it as I felt it was superflous 😅 |
|
Let's respect Claude's behavior 🫡 |
Issue
Every
vp devandvp buildimports the plugin entry before anything else. It statically loaded:auth/drizzle.ts→better-auth/dband zod), used only by the routing plugin's auth codegen.cli/output.ts), used only byprintSuccessat the end of the interactive AI setup prompt.Fix
Both are now lazily-imported where they are used. Apps without auth, and dev sessions that never run the AI prompt, no longer load them.
Impact
@cloudflare/vite-pluginare loaded: 231 → 80 modules, ~54 → ~30ms.import('void')overall: ~510 → ~480ms (6 interleaved runs). Most of what remains is@cloudflare/vite-pluginimporting wrangler and miniflare.Small improvements, but every ms counts 😎
Verification
vp run --filter ./packages/void typecheckpackages/void/test/unit/plugin-routing.test.tspackages/void/test/integration/kitchen-sink-build.test.ts(an auth app, so it runs the lazily loaded codegen in a real build)