From 16e22726c84528d3ee066b41d5ee3b423e16d49b Mon Sep 17 00:00:00 2001 From: Aman Varshney Date: Tue, 12 Aug 2025 17:54:14 +0530 Subject: [PATCH] chore(web): test --- apps/web/src/app/llms-full.txt/route.ts | 1 + .../web/src/app/llms.mdx/[[...slug]]/route.ts | 4 ++-- apps/web/src/lib/get-llm-text.ts | 19 +++++++++++++++---- apps/web/wrangler.jsonc | 1 + 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/apps/web/src/app/llms-full.txt/route.ts b/apps/web/src/app/llms-full.txt/route.ts index ed54c01..1f85318 100644 --- a/apps/web/src/app/llms-full.txt/route.ts +++ b/apps/web/src/app/llms-full.txt/route.ts @@ -3,6 +3,7 @@ import { source } from "@/lib/source"; // cached forever export const revalidate = false; +export const dynamic = 'force-static'; export async function GET() { const scan = source.getPages().map(getLLMText); diff --git a/apps/web/src/app/llms.mdx/[[...slug]]/route.ts b/apps/web/src/app/llms.mdx/[[...slug]]/route.ts index 80ebdfb..a7f3d82 100644 --- a/apps/web/src/app/llms.mdx/[[...slug]]/route.ts +++ b/apps/web/src/app/llms.mdx/[[...slug]]/route.ts @@ -1,10 +1,10 @@ -import { notFound } from "next/navigation"; import { type NextRequest, NextResponse } from "next/server"; import { getLLMText } from "@/lib/get-llm-text"; import { source } from "@/lib/source"; +import { notFound } from "next/navigation"; export const revalidate = false; - +export const dynamic = "force-static"; export async function GET( _req: NextRequest, { params }: { params: Promise<{ slug?: string[] }> }, diff --git a/apps/web/src/lib/get-llm-text.ts b/apps/web/src/lib/get-llm-text.ts index 1a5e231..a46262b 100644 --- a/apps/web/src/lib/get-llm-text.ts +++ b/apps/web/src/lib/get-llm-text.ts @@ -1,9 +1,20 @@ -import type { InferPageType } from "fumadocs-core/source"; -import { remarkInclude } from "fumadocs-mdx/config"; import { remark } from "remark"; import remarkGfm from "remark-gfm"; import remarkMdx from "remark-mdx"; -import type { source } from "@/lib/source"; +import { remarkInclude } from "fumadocs-mdx/config"; +// Avoid importing `source` at runtime to keep bundle small +// import { source } from '@/lib/source'; +// import type { InferPageType } from 'fumadocs-core/source'; + +type LLMPage = { + url: string; + data: { + title: string; + description?: string; + content: string; + _file: { absolutePath: string; path: string }; + }; +}; const processor = remark() .use(remarkMdx) @@ -11,7 +22,7 @@ const processor = remark() .use(remarkInclude) .use(remarkGfm); -export async function getLLMText(page: InferPageType) { +export async function getLLMText(page: LLMPage) { const processed = await processor.process({ path: page.data._file.absolutePath, value: page.data.content, diff --git a/apps/web/wrangler.jsonc b/apps/web/wrangler.jsonc index 32a8e43..f9fc56c 100644 --- a/apps/web/wrangler.jsonc +++ b/apps/web/wrangler.jsonc @@ -4,6 +4,7 @@ "name": "better-t-stack", "compatibility_date": "2025-07-13", "compatibility_flags": ["nodejs_compat", "global_fetch_strictly_public"], + "minify": true, "keep_names": false, "assets": { "directory": ".open-next/assets",