Repository navigation
refactor(docs): build llms.txt only while prerendering - #42
Conversation
Rename the route to llms.txt.get.prerender.ts. Nitro adds a route with the .prerender suffix to the prerender build only, so the Worker bundle has no llms.txt handler and the route imports server/pages.ts directly.
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
tinyaml
tinyini
tinyjson5
tinylinkify
tinyswap
commit: |
There was a problem hiding this comment.
✅ No new issues found. No P0 or P1 findings.
Approach: Sound — Nitro’s .prerender suffix keeps the handler out of the Worker bundle while preserving /llms.txt as a public asset.
Reviewed changes — I traced the route from Nuxt’s prerender configuration through to the generated Worker.
- Sitemap route:
pnpm docs:generateprerendered 98 routes and producedllms.txtwithout bundling its handler. Local Wrangler returned200for bothGETandHEAD, and theGETbody matched the generated file byte for byte. The route is intentionally unavailable innuxi dev. - Other content routes: Search, the page API, and the Markdown middleware still use the existing
loadPages()guard./search.jsonand/index.mdboth returned200in the local Worker.
gpt-6.2-sol(high) | 𝕏
Latest result Pull request merged. Final answersSession Pull request merged. |

The Worker bundle shipped a
/llms.txthandler that only answered 404. Every page andllms.txtare prerendered, andload-pages.tsreturns nothing outside dev and prerender. Now that route is built only while prerendering. The site comes out the same.ViteHub documents this pattern since vite-hub/vitehub#5173 ("Content only at build" in the Content configure docs). This PR renames
server/routes/llms.txt.get.tstollms.txt.get.prerender.ts. The route importsserver/pages.tsdirectly, without theloadPages()guard. In the installed Nitro (3.0.261103-rc, the version locked since #40),parseScanPathreads.prerenderas an env suffix.initNitroRoutingthen keeps the route only when the preset isnitro-prerender.load-pages.tsstays./search.json,/api/pages/**and the.mdmiddleware must also work innuxi dev, so they keep theimport.meta.dev || import.meta.prerenderguard, which is the same guard the ViteHub docs show. Middleware can't take an env suffix in Nitro. Content, Comark and Shiki were already out of the Worker bundle. This PR only removes thellms.txtroute code.No ViteHub pin change: the site stays on
@vite-hub/content^0.3.1from #40.Verified, Node 24.21.0, Linux, clean builds (
dist,.nuxt, the Nuxt cache and.generatedremoved before each):pnpm docs:generateonmainand on this branch: 98 routes each, the same 122 public files.llms.txt,search.json, every.mdcopy and_headersare byte-identical. The HTML and_payload.jsonfiles differ only in the build ID,prerenderedAtand island UIDs._routes/llms.txt.mjsand its router entry are gone, anddocs/dist/servergoes from 972,941 to 971,696 bytes. On both builds, a grep of the server.mjsfiles finds no page text ("Smaller, faster drop-ins", "## Sitemap", thellms.txtintro), nodefineContent, nocomark-contentand noshiki.wrangler@4.158.0 dev -c docs/dist/server/wrangler.json:/,/tinyaml/guide/getting-started/,/tinylinkify/compatibility/,/search.json,/llms.txt,/index.mdand/tinyaml/guide/api.mdanswer 200 with the right content types. The servedllms.txtis byte-identical to themainbuild.Accept: text/markdownon/answers Markdown,/nope/answers 404, andHost: tinyaml.onmax.megets a 301 tohttps://tiny.onmax.me/guide/.pnpm docs:devstill fails with "Unrecognized import attributes specified" in workerd, the same way as onmain(noted in #40)./llms.txtnow answers 404 in dev instead of 500, as expected for a.prerenderroute.Not checked: a deploy. Merging deploys through Workers Builds.
Prepared with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code