()
| 6 | export const revalidate = false; |
| 7 | |
| 8 | export async function GET() { |
| 9 | const pages = source.getPages(); |
| 10 | |
| 11 | // Read meta.json to get the page order |
| 12 | const metaPath = join(process.cwd(), "content", "meta.json"); |
| 13 | const meta = JSON.parse(await fs.readFile(metaPath, "utf-8")); |
| 14 | |
| 15 | // Create a map of page URLs to their order in meta.json |
| 16 | const pageOrder = new Map<string, number>(); |
| 17 | meta.pages.forEach((page: string, index: number) => { |
| 18 | pageOrder.set(page, index); |
| 19 | }); |
| 20 | |
| 21 | // Sort pages according to meta.json order |
| 22 | const sortedPages = pages.sort((a, b) => { |
| 23 | const aOrder = pageOrder.get(a.url) ?? Number.MAX_SAFE_INTEGER; |
| 24 | const bOrder = pageOrder.get(b.url) ?? Number.MAX_SAFE_INTEGER; |
| 25 | return aOrder - bOrder; |
| 26 | }); |
| 27 | |
| 28 | // Generate content |
| 29 | let txt = `# Zod |
| 30 | |
| 31 | Zod is a TypeScript-first schema validation library with static type inference. This documentation provides comprehensive coverage of Zod 4's features, API, and usage patterns. |
| 32 | |
| 33 | `; |
| 34 | |
| 35 | // Process each page |
| 36 | for (const page of sortedPages) { |
| 37 | txt += await getLLMText(page); |
| 38 | txt += "\n\n"; |
| 39 | } |
| 40 | |
| 41 | return new Response(txt, { |
| 42 | headers: { "Content-Type": "text/plain; charset=utf-8" }, |
| 43 | }); |
| 44 | } |
nothing calls this directly
no test coverage detected