Home / File/ route.ts — ui Source File

route.ts — ui Source File

Architecture documentation for route.ts, a typescript file in the ui codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  f84ce2ab_6aa7_a8b9_321d_61eb23391030["route.ts"]
  f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb["navigation"]
  f84ce2ab_6aa7_a8b9_321d_61eb23391030 --> f5b0b1d9_de2f_9c31_0bcd_4adbd07581cb
  e6d8fc0a_e169_2eda_cf08_affb3ed577e3["server"]
  f84ce2ab_6aa7_a8b9_321d_61eb23391030 --> e6d8fc0a_e169_2eda_cf08_affb3ed577e3
  5cc1af3b_359d_cc42_e90e_fe93c8554205["llm"]
  f84ce2ab_6aa7_a8b9_321d_61eb23391030 --> 5cc1af3b_359d_cc42_e90e_fe93c8554205
  b5f7acc2_8550_f8f0_0425_a71c6d434acd["source"]
  f84ce2ab_6aa7_a8b9_321d_61eb23391030 --> b5f7acc2_8550_f8f0_0425_a71c6d434acd
  b5745d66_2f51_7fb8_758d_e409c7f36c09["_legacy-styles"]
  f84ce2ab_6aa7_a8b9_321d_61eb23391030 --> b5745d66_2f51_7fb8_758d_e409c7f36c09
  style f84ce2ab_6aa7_a8b9_321d_61eb23391030 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { notFound } from "next/navigation"
import { NextResponse, type NextRequest } from "next/server"

import { processMdxForLLMs } from "@/lib/llm"
import { source } from "@/lib/source"
import { getActiveStyle, type Style } from "@/registry/_legacy-styles"

export const revalidate = false

function getStyleFromSlug(slug: string[] | undefined, fallbackStyle: string) {
  // Detect base from URL: /docs/components/base/... or /docs/components/radix/...
  if (slug && slug[0] === "components" && slug[1]) {
    if (slug[1] === "base") {
      return "base-nova"
    }
    if (slug[1] === "radix") {
      return "new-york-v4"
    }
  }
  return fallbackStyle
}

export async function GET(
  _req: NextRequest,
  { params }: { params: Promise<{ slug?: string[] }> }
) {
  const [{ slug }, activeStyle] = await Promise.all([params, getActiveStyle()])

  const page = source.getPage(slug)

  if (!page) {
    notFound()
  }

  const effectiveStyle = getStyleFromSlug(slug, activeStyle.name)

  const processedContent = processMdxForLLMs(
    await page.data.getText("raw"),
    effectiveStyle as Style["name"]
  )

  return new NextResponse(processedContent, {
    headers: {
      "Content-Type": "text/markdown; charset=utf-8",
    },
  })
}

export function generateStaticParams() {
  return source.generateParams()
}

Subdomains

Dependencies

  • _legacy-styles
  • llm
  • navigation
  • server
  • source

Frequently Asked Questions

What does route.ts do?
route.ts is a source file in the ui codebase, written in typescript. It belongs to the DocumentationAtlas domain, Changelog subdomain.
What functions are defined in route.ts?
route.ts defines 3 function(s): GET, generateStaticParams, getStyleFromSlug.
What does route.ts depend on?
route.ts imports 5 module(s): _legacy-styles, llm, navigation, server, source.
Where is route.ts in the architecture?
route.ts is located at apps/v4/app/(app)/llm/[[...slug]]/route.ts (domain: DocumentationAtlas, subdomain: Changelog, directory: apps/v4/app/(app)/llm/[[...slug]]).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free