Home / File/ rehype.ts — ui Source File

rehype.ts — ui Source File

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

File typescript DocumentationAtlas SearchAPI 11 imports 10 functions

Entity Profile

Dependency Diagram

graph LR
  e2427336_4794_0f1c_982a_f2089ffcec85["rehype.ts"]
  eac8f98f_e40a_7fe8_f505_372c83d20c7a["fs"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> eac8f98f_e40a_7fe8_f505_372c83d20c7a
  d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5["path"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> d05ec4ea_7a68_3a36_bfa4_9ba7f8409ee5
  7c0ef5ae_77fa_2db5_3105_1433ebd1e241["__index__"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> 7c0ef5ae_77fa_2db5_3105_1433ebd1e241
  75cb203e_d65f_cec0_d549_2a7a4cba2250["utils"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> 75cb203e_d65f_cec0_d549_2a7a4cba2250
  4f6f7e78_23ff_4f5f_c723_474454f64c85["ts-morph"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> 4f6f7e78_23ff_4f5f_c723_474454f64c85
  937f5d4b_c2a7_bcb9_05d8_41dc51498899["unist-builder"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> 937f5d4b_c2a7_bcb9_05d8_41dc51498899
  fcbb6195_57aa_1339_fa5f_694d53020f20["unist-util-visit"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> fcbb6195_57aa_1339_fa5f_694d53020f20
  3760d05c_9abb_8921_1a30_9996e59e5714["__index__"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> 3760d05c_9abb_8921_1a30_9996e59e5714
  b5745d66_2f51_7fb8_758d_e409c7f36c09["_legacy-styles"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> b5745d66_2f51_7fb8_758d_e409c7f36c09
  c544a3e1_3972_d827_a6cc_0c6a194dbe9e["bases"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> c544a3e1_3972_d827_a6cc_0c6a194dbe9e
  bfb9bc1d_9320_eaa1_c2b8_c6e4e825bbf7["__index__"]
  e2427336_4794_0f1c_982a_f2089ffcec85 --> bfb9bc1d_9320_eaa1_c2b8_c6e4e825bbf7
  style e2427336_4794_0f1c_982a_f2089ffcec85 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs, { promises as fsPromises } from "fs"
import path from "path"
import { ExamplesIndex } from "@/examples/__index__"
import {
  createStyleMap,
  transformIcons,
  transformMenu,
  transformRender,
  transformStyle,
} from "shadcn/utils"
import { Project, ScriptKind } from "ts-morph"
import { u } from "unist-builder"
import { visit } from "unist-util-visit"

import { Index as StylesIndex } from "@/registry/__index__"
import { getActiveStyle } from "@/registry/_legacy-styles"
import { BASES } from "@/registry/bases"
import { Index as BasesIndex } from "@/registry/bases/__index__"

function getBaseForStyle(styleName: string) {
  for (const base of BASES) {
    if (styleName.startsWith(`${base.name}-`)) {
      return base.name
    }
  }
  return null
}

function getDemoFilePath(name: string, styleName: string) {
  const base = getBaseForStyle(styleName)
  if (!base) return null

  const demo = ExamplesIndex[base]?.[name]
  if (!demo) return null

  return path.join(process.cwd(), demo.filePath)
}

function getIndexForStyle(styleName: string) {
  const base = getBaseForStyle(styleName)
  if (base) {
    return { index: BasesIndex, key: base }
  }
  return { index: StylesIndex, key: styleName }
}

function getStyleFromStyleName(styleName: string) {
  const parts = styleName.split("-")
  return parts.length > 1 ? parts.slice(1).join("-") : styleName
}

function buildDisplayConfig(styleName: string) {
  return {
    $schema: "https://ui.shadcn.com/schema.json",
    style: styleName,
    rsc: true,
    tsx: true,
    tailwind: {
      config: "",
      css: "",
// ... (263 more lines)

Subdomains

Dependencies

  • __index__
  • __index__
  • __index__
  • _legacy-styles
  • bases
  • fs
  • path
  • ts-morph
  • unist-builder
  • unist-util-visit
  • utils

Frequently Asked Questions

What does rehype.ts do?
rehype.ts is a source file in the ui codebase, written in typescript. It belongs to the DocumentationAtlas domain, SearchAPI subdomain.
What functions are defined in rehype.ts?
rehype.ts defines 10 function(s): buildDisplayConfig, formatCode, getBaseForStyle, getDemoFilePath, getIndexForStyle, getNodeAttributeByName, getStyleFromStyleName, getStyleMap, isTruthyMdxAttribute, rehypeComponent.
What does rehype.ts depend on?
rehype.ts imports 11 module(s): __index__, __index__, __index__, _legacy-styles, bases, fs, path, ts-morph, and 3 more.
Where is rehype.ts in the architecture?
rehype.ts is located at apps/v4/lib/rehype.ts (domain: DocumentationAtlas, subdomain: SearchAPI, directory: apps/v4/lib).

Analyze Your Own Codebase

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

Try Supermodel Free