feat(prerender): log server startup#1094
Conversation
commit: |
|
/bigbonk review |
There was a problem hiding this comment.
Clean, minimal change. The purpose option threads correctly through all three startup paths (app-only, pages-only, hybrid/shared), the logProdServerStarted helper is a nice consolidation of the two duplicated console.log lines, and the test coverage is solid.
One minor observation on the tests below, but nothing blocking.
| messages.push(message); | ||
| }); | ||
|
|
||
| const { startProdServer } = await import("../packages/vinext/src/server/prod-server.js"); |
There was a problem hiding this comment.
Nit: all three tests await import(...) the same module. Since Vitest (and Node) cache dynamic imports by specifier, the second and third tests will get the same module object as the first. This works today because startProdServer is a stateless function, but if it ever acquired module-level mutable state (e.g., a cached config), the tests could leak between each other.
Consider adding vi.resetModules() in the afterEach (or a beforeEach) to make each test get a fresh module instance. Not urgent — just future-proofing.
| return (response as ResponseWithVinextStreamingMetadata).__vinextStreamedHtmlResponse === true; | ||
| } | ||
|
|
||
| function logProdServerStarted(host: string, port: number, purpose: ProdServerOptions["purpose"]) { |
There was a problem hiding this comment.
Nice consolidation — this eliminates the duplicated log strings that previously lived in both startAppRouterServer and startPagesRouterServer.
|
Review submitted. Here's a summary: Approved -- this is a clean, well-scoped change. The One minor observation: the test file uses |
Summary
vinext start.purpose: "prerender"option through app-only, pages-only, and hybrid/shared prerender server startup paths.Part of #563.
Validation
vp test run tests/prod-server-logs.test.tsvp test run tests/prerender.test.ts -t "runPrerender — output"vp check tests/prod-server-logs.test.ts packages/vinext/src/server/prod-server.ts packages/vinext/src/build/prerender.ts packages/vinext/src/build/run-prerender.ts