Home / File/ registry.ts — ui Source File

registry.ts — ui Source File

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

File typescript ComponentRegistry ChartRegistry 3 imports 5 dependents 2 functions

Entity Profile

Dependency Diagram

graph LR
  36b31cf1_05ba_97d7_e250_f336253a3080["registry.ts"]
  f6686cba_ff20_80a3_2e9c_3352570707a4["http"]
  36b31cf1_05ba_97d7_e250_f336253a3080 --> f6686cba_ff20_80a3_2e9c_3352570707a4
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  36b31cf1_05ba_97d7_e250_f336253a3080 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  f9f5e551_eb59_1a6b_8bf2_b97e73eb13de["fs-extra"]
  36b31cf1_05ba_97d7_e250_f336253a3080 --> f9f5e551_eb59_1a6b_8bf2_b97e73eb13de
  9a2ee0f9_d989_1165_589f_f10c64d3de86["resolver.test.ts"]
  9a2ee0f9_d989_1165_589f_f10c64d3de86 --> 36b31cf1_05ba_97d7_e250_f336253a3080
  850315ae_10e7_b3da_fe0a_07bc60ae8665["init.test.ts"]
  850315ae_10e7_b3da_fe0a_07bc60ae8665 --> 36b31cf1_05ba_97d7_e250_f336253a3080
  53b3a078_76ff_e9b8_1c06_58b2c68c2132["registries.test.ts"]
  53b3a078_76ff_e9b8_1c06_58b2c68c2132 --> 36b31cf1_05ba_97d7_e250_f336253a3080
  5aae16d8_dc31_7b01_2a8a_3a28b78e877b["search.test.ts"]
  5aae16d8_dc31_7b01_2a8a_3a28b78e877b --> 36b31cf1_05ba_97d7_e250_f336253a3080
  1867f1db_8fe1_137d_8738_ad32a6243fdc["view.test.ts"]
  1867f1db_8fe1_137d_8738_ad32a6243fdc --> 36b31cf1_05ba_97d7_e250_f336253a3080
  style 36b31cf1_05ba_97d7_e250_f336253a3080 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { createServer } from "http"
import path from "path"
import fs from "fs-extra"

export async function createRegistryServer(
  items: Array<{ name: string; type: string } & Record<string, unknown>>,
  {
    port = 4444,
    path = "/r",
  }: {
    port?: number
    path?: string
  }
) {
  const server = createServer((request, response) => {
    const urlRaw = request.url?.split("?")[0]

    // Handle registries.json endpoint (don't strip .json for this one).
    if (urlRaw?.endsWith("/registries.json")) {
      response.writeHead(200, { "Content-Type": "application/json" })
      // Return empty registry array for tests - we want to test manual configuration.
      response.end(JSON.stringify([]))
      return
    }

    // For other endpoints, strip .json extension
    const urlWithoutQuery = urlRaw?.replace(/\.json$/, "")

    if (urlWithoutQuery?.includes("icons/index")) {
      response.writeHead(200, { "Content-Type": "application/json" })
      response.end(
        JSON.stringify({
          AlertCircle: {
            lucide: "AlertCircle",
            radix: "ExclamationTriangleIcon",
          },
          ArrowLeft: {
            lucide: "ArrowLeft",
            radix: "ArrowLeftIcon",
          },
        })
      )
      return
    }

    if (urlWithoutQuery?.includes("colors/neutral")) {
      response.writeHead(200, { "Content-Type": "application/json" })
      response.end(
        JSON.stringify({
          inlineColors: {
            light: {
              background: "white",
              foreground: "neutral-950",
            },
            dark: {
              background: "neutral-950",
              foreground: "neutral-50",
            },
          },
          cssVars: {
// ... (214 more lines)

Subdomains

Dependencies

  • fs-extra
  • http
  • path

Frequently Asked Questions

What does registry.ts do?
registry.ts is a source file in the ui codebase, written in typescript. It belongs to the ComponentRegistry domain, ChartRegistry subdomain.
What functions are defined in registry.ts?
registry.ts defines 2 function(s): configureRegistries, createRegistryServer.
What does registry.ts depend on?
registry.ts imports 3 module(s): fs-extra, http, path.
What files import registry.ts?
registry.ts is imported by 5 file(s): init.test.ts, registries.test.ts, resolver.test.ts, search.test.ts, view.test.ts.
Where is registry.ts in the architecture?
registry.ts is located at packages/tests/src/utils/registry.ts (domain: ComponentRegistry, subdomain: ChartRegistry, directory: packages/tests/src/utils).

Analyze Your Own Codebase

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

Try Supermodel Free