File size: 831 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { docs } from "@/.velite"
import { BASE_URL } from "@/lib/constants"

export const dynamic = "force-static"

export async function GET() {
  const baseUrl = `${BASE_URL}/llms-component`
  const components = new Set<{ id: string; path: string; fullPath: string }>()

  docs
    .filter(
      (doc) =>
        doc.slug.startsWith("docs/components/") &&
        !doc.slug.includes("concepts"),
    )
    .forEach((doc) => {
      const parts = doc.slug.split("/")
      const component = parts[2]
      components.add({
        id: component,
        path: `${baseUrl}/${component}.txt`,
        fullPath: `${baseUrl}/${component}-full.txt`,
      })
    })

  return Response.json(Array.from(components), {
    headers: {
      "Content-Type": "application/json",
      "Cache-Control": "public, max-age=3600",
    },
  })
}