bejamas 0.0.0-canary.0cf9645
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -0
- package/dist/generate-mdx-Bq9erbjr.js +654 -0
- package/dist/generate-mdx-Bq9erbjr.js.map +1 -0
- package/dist/index.js +783 -0
- package/dist/index.js.map +1 -0
- package/dist/spinner-9iMQF079.js +46 -0
- package/dist/spinner-9iMQF079.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-mdx-Bq9erbjr.js","names":["RESERVED_COMPONENTS: Set<string>","meta: Record<string, any>","usageLines: string[]","examplesLines: string[]","primaryExampleLines: string[]","descriptionBodyLines: string[]","current: any","nameNode: any","defaultValue: string | undefined","require","createRequire","match: RegExpExecArray | null","found: string[]","pathPosix","m: RegExpExecArray | null","external: string[]","internal: string[]","exampleSections: string[]","exampleRelPaths: string[]","examples: Array<{\n importName: string;\n importPath: string;\n title: string;\n source: string;\n }>","importPath","blocks: Array<{ title: string; body: string[] }>","current: { title: string; body: string[] }"],"sources":["../src/docs/generate-mdx/utils.ts","../src/docs/generate-mdx/mdx-builder.ts","../src/docs/generate-mdx/index.ts"],"sourcesContent":["import { existsSync, readFileSync } from \"fs\";\nimport { readdir } from \"fs/promises\";\nimport path, { dirname, extname, join, posix as pathPosix } from \"path\";\nimport { createRequire } from \"module\";\nimport { Project, SyntaxKind, SourceFile } from \"ts-morph\";\n\nexport const RESERVED_COMPONENTS: Set<string> = new Set([\n \"Fragment\",\n \"CodePackageManagers\",\n \"DocsTabs\",\n \"DocsTabItem\",\n \"DocsCodePackageManagers\",\n \"Tabs\",\n \"TabItem\",\n]);\n\nexport function slugify(input: string): string {\n return input\n .replace(/\\.(astro|md|mdx|tsx|ts|jsx|js)$/i, \"\")\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/\\s+/g, \"-\")\n .replace(/_+/g, \"-\")\n .toLowerCase();\n}\n\nexport function extractFrontmatter(source: string): string {\n const match = source.match(/^---\\n([\\s\\S]*?)\\n---/);\n return (match && match[1]) || \"\";\n}\n\nexport function toIdentifier(name: string): string {\n const base = name\n .replace(/\\.[^.]+$/, \"\")\n .replace(/[^a-zA-Z0-9]+/g, \" \")\n .trim()\n .replace(/\\b\\w/g, (c) => c.toUpperCase())\n .replace(/\\s+/g, \"\");\n return /^[A-Za-z_]/.test(base) ? base : `Ex${base}`;\n}\n\nexport function parseJsDocMetadata(\n frontmatterCode: string,\n): Record<string, any> {\n const jsDocMatch = frontmatterCode.match(/\\/\\*\\*([\\s\\S]*?)\\*\\//);\n if (!jsDocMatch) return {};\n const content = jsDocMatch[1];\n const lines = content.split(\"\\n\").map((l) => l.replace(/^\\s*\\*\\s?/, \"\"));\n const meta: Record<string, any> = {};\n let inUsage = false;\n let inExamples = false;\n let inPrimaryExample = false;\n let captureDescriptionBody = false;\n const usageLines: string[] = [];\n const examplesLines: string[] = [];\n const primaryExampleLines: string[] = [];\n const descriptionBodyLines: string[] = [];\n for (const rawLine of lines) {\n const line = rawLine;\n if (inUsage) {\n if (line.trim().startsWith(\"@\")) {\n inUsage = false;\n } else {\n usageLines.push(line);\n continue;\n }\n }\n if (inPrimaryExample) {\n if (line.trim().startsWith(\"@\")) {\n inPrimaryExample = false;\n } else {\n primaryExampleLines.push(line);\n continue;\n }\n }\n if (inExamples) {\n if (line.trim().startsWith(\"@\")) {\n inExamples = false;\n } else {\n examplesLines.push(line);\n continue;\n }\n }\n if (captureDescriptionBody) {\n if (line.trim().startsWith(\"@\")) {\n captureDescriptionBody = false;\n } else {\n descriptionBodyLines.push(line);\n continue;\n }\n }\n if (line.trim().startsWith(\"@component\"))\n meta.name = line.replace(\"@component\", \"\").trim();\n else if (line.trim().startsWith(\"@title\"))\n meta.title = line.replace(\"@title\", \"\").trim();\n else if (line.trim().startsWith(\"@description\")) {\n meta.description = line.replace(\"@description\", \"\").trim();\n captureDescriptionBody = true;\n continue;\n } else if (line.trim().startsWith(\"@figmaUrl\"))\n meta.figmaUrl = line.replace(\"@figmaUrl\", \"\").trim();\n // Backward compatibility: support @figma but map to figmaUrl\n else if (line.trim().startsWith(\"@figma\"))\n meta.figmaUrl = line.replace(\"@figma\", \"\").trim();\n else if (line.trim().startsWith(\"@usage\")) {\n inUsage = true;\n continue;\n } else if (line.trim().startsWith(\"@examples\")) {\n inExamples = true;\n continue;\n } else if (line.trim().startsWith(\"@preview\")) {\n inPrimaryExample = true;\n continue;\n } else if (line.trim().startsWith(\"@example\")) {\n // backward compatibility with older docs\n inPrimaryExample = true;\n continue;\n }\n }\n if (usageLines.length) meta.usageMDX = usageLines.join(\"\\n\").trim();\n if (examplesLines.length) meta.examplesMDX = examplesLines.join(\"\\n\").trim();\n if (primaryExampleLines.length)\n meta.primaryExampleMDX = primaryExampleLines.join(\"\\n\").trim();\n if (descriptionBodyLines.length)\n meta.descriptionBodyMDX = descriptionBodyLines.join(\"\\n\").trim();\n return meta;\n}\n\nexport function extractPropsFromAstroProps(sourceFile: SourceFile): Array<{\n name?: string;\n isRest?: boolean;\n hasDefault?: boolean;\n defaultValue?: string;\n alias?: string;\n}> {\n // Helper: unwrap expressions like `(Astro.props as Props)`, `Astro.props as Props`,\n // `<Props>Astro.props`, `(Astro.props)!`, and parenthesized variants until we reach\n // the underlying PropertyAccessExpression.\n function unwrapAstroProps(node: any): any | null {\n let current: any = node;\n // Unwrap layers that can wrap the property access\n // AsExpression, TypeAssertion, SatisfiesExpression, NonNullExpression, ParenthesizedExpression\n // Keep drilling down via getExpression()\n // Guard against cycles by limiting iterations\n for (let i = 0; i < 10; i += 1) {\n const kind = current.getKind();\n if (kind === SyntaxKind.PropertyAccessExpression) {\n const expr = current.getExpression();\n if (\n expr &&\n expr.getText() === \"Astro\" &&\n current.getName() === \"props\"\n ) {\n return current;\n }\n return null;\n }\n if (\n kind === SyntaxKind.AsExpression ||\n kind === SyntaxKind.TypeAssertion ||\n // @ts-ignore - SatisfiesExpression may not exist in older TS versions\n kind === (SyntaxKind as any).SatisfiesExpression ||\n kind === SyntaxKind.NonNullExpression ||\n kind === SyntaxKind.ParenthesizedExpression\n ) {\n const next = current.getExpression && current.getExpression();\n if (!next) return null;\n current = next;\n continue;\n }\n return null;\n }\n return null;\n }\n\n const declarations = sourceFile.getDescendantsOfKind(\n SyntaxKind.VariableDeclaration,\n );\n const target = declarations.find((decl) => {\n const init = decl.getInitializer();\n if (!init) return false;\n return !!unwrapAstroProps(init);\n });\n if (!target) return [];\n const nameNode: any = target.getNameNode();\n if (!nameNode || nameNode.getKind() !== SyntaxKind.ObjectBindingPattern)\n return [];\n const obj = nameNode.asKindOrThrow(SyntaxKind.ObjectBindingPattern);\n return obj.getElements().map((el: any) => {\n const isRest = !!el.getDotDotDotToken();\n if (isRest) return { isRest: true, hasDefault: false, alias: el.getName() };\n const propertyNameNode = el.getPropertyNameNode();\n const name = el.getName();\n const propName = propertyNameNode ? propertyNameNode.getText() : name;\n const initializer = el.getInitializer();\n let defaultValue: string | undefined;\n if (initializer) defaultValue = initializer.getText();\n return { name: propName, hasDefault: initializer != null, defaultValue };\n });\n}\n\nexport function extractPropsFromDeclaredProps(sourceFile: SourceFile): Array<{\n name: string;\n type: string;\n optional: boolean;\n}> {\n function normalizeTypeText(text: string | undefined): string {\n if (!text) return \"\";\n return text.replace(/\\s+/g, \" \").replace(/;\\s*$/, \"\").trim();\n }\n // Prefer interface Props\n const iface = sourceFile.getInterface(\"Props\");\n if (iface) {\n const properties = iface.getProperties();\n return properties.map((prop) => {\n const name = prop.getName();\n const typeNode = prop.getTypeNode();\n const rawType = typeNode ? typeNode.getText() : prop.getType().getText();\n const typeText = normalizeTypeText(rawType);\n const optional = prop.hasQuestionToken();\n return { name, type: typeText, optional };\n });\n }\n\n // Fallback: type Props = { ... }\n const typeAlias = sourceFile.getTypeAlias(\"Props\");\n if (typeAlias) {\n const typeNode = typeAlias.getTypeNode();\n if (typeNode && typeNode.getKind() === SyntaxKind.TypeLiteral) {\n const literal = typeNode.asKindOrThrow(SyntaxKind.TypeLiteral);\n const properties = literal.getProperties();\n return properties.map((prop) => {\n const name = prop.getName();\n const tn = prop.getTypeNode();\n const rawType = tn ? tn.getText() : prop.getType().getText();\n const typeText = normalizeTypeText(rawType);\n const optional = prop.hasQuestionToken();\n return { name, type: typeText, optional };\n });\n }\n }\n\n return [];\n}\n\nexport function resolveUiRoot(cwd: string): string {\n const require = createRequire(import.meta.url);\n\n const envRoot = process.env.BEJAMAS_UI_ROOT;\n if (envRoot && existsSync(path.join(envRoot, \"package.json\"))) {\n return envRoot;\n }\n\n try {\n const pkgPath = require.resolve(\"@bejamas/ui/package.json\", {\n paths: [cwd],\n });\n return path.dirname(pkgPath);\n } catch {}\n\n let current = cwd;\n for (let i = 0; i < 6; i += 1) {\n const candidate = path.join(current, \"packages\", \"ui\", \"package.json\");\n if (existsSync(candidate)) return path.dirname(candidate);\n const parent = path.dirname(current);\n if (parent === current) break;\n current = parent;\n }\n\n try {\n const anyEntry = require.resolve(\"@bejamas/ui/*\", { paths: [cwd] });\n return path.resolve(anyEntry, \"..\", \"..\");\n } catch {}\n\n throw new Error(\"Unable to locate @bejamas/ui in the workspace\");\n}\n\nexport function resolveOutDir(cwd: string): string {\n const envOut = process.env.BEJAMAS_DOCS_OUT_DIR;\n if (envOut && envOut.length) {\n return path.isAbsolute(envOut) ? envOut : path.resolve(cwd, envOut);\n }\n return path.resolve(cwd, \"../../apps/web/src/content/docs/components\");\n}\n\nexport function detectHasImportTopLevel(\n block: string,\n pascalName: string,\n): boolean {\n if (!block) return false;\n let inFence = false;\n const importLineRegex = new RegExp(\n `^\\\\s*import\\\\s+.*\\\\bfrom\\\\s+['\"][^'\"]+\\\\b${pascalName}\\\\.astro['\"]`,\n );\n for (const line of block.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"```\")) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && importLineRegex.test(line)) return true;\n }\n return false;\n}\n\nexport function hasImportOfTopLevel(\n block: string,\n componentName: string,\n): boolean {\n if (!block) return false;\n let inFence = false;\n const importRegex = new RegExp(\n `^\\\\s*import\\\\s+[^;]*\\\\b${componentName}\\\\b[^;]*from\\\\s+['\"][^'\"]*(?:/|^)${componentName}\\\\.astro['\"]`,\n );\n const lucideIconRegex = /Icon$/.test(componentName)\n ? new RegExp(\n `^\\\\s*import\\\\s+\\\\{[^}]*\\\\b${componentName}\\\\b[^}]*\\\\}\\\\s+from\\\\s+['\"]@lucide/astro['\"]`,\n )\n : null;\n for (const line of block.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"```\")) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && importRegex.test(line)) return true;\n if (!inFence && lucideIconRegex && lucideIconRegex.test(line)) return true;\n }\n return false;\n}\n\nexport function normalizeBlockMDX(block: string): string {\n if (!block) return \"\";\n return block.replace(\n /from\\s+['\"]@\\/ui\\/components\\//g,\n \"from '@bejamas/ui/components/\",\n );\n}\n\nexport function replaceDocsComponentTags(block: string): string {\n if (!block) return \"\";\n let inFence = false;\n const lines = block.split(\"\\n\");\n const out: string[] = [];\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"```\")) {\n inFence = !inFence;\n out.push(line);\n continue;\n }\n if (inFence) {\n out.push(line);\n continue;\n }\n const replaced = line\n .replace(/<Tabs(\\b|\\s)/g, \"<DocsTabs$1\")\n .replace(/<\\/Tabs>/g, \"</DocsTabs>\")\n .replace(/<TabItem(\\b|\\s)/g, \"<DocsTabItem$1\")\n .replace(/<\\/TabItem>/g, \"</DocsTabItem>\");\n out.push(replaced);\n }\n return out.join(\"\\n\");\n}\n\nexport function normalizeUsageMDX(\n usageMDX: string,\n pascalName: string,\n): { text: string; hasImport: boolean } {\n const normalized = normalizeBlockMDX(usageMDX);\n const hasImport = detectHasImportTopLevel(normalized, pascalName);\n return { text: normalized.trim(), hasImport };\n}\n\nexport function extractComponentTagsFromMDX(block: string): string[] {\n if (!block) return [];\n let inFence = false;\n const found = new Set<string>();\n const tagRegex = /<([A-Z][A-Za-z0-9_]*)\\b/g;\n for (const line of block.split(\"\\n\")) {\n const trimmed = line.trim();\n if (trimmed.startsWith(\"```\")) {\n inFence = !inFence;\n continue;\n }\n if (inFence) continue;\n let match: RegExpExecArray | null;\n while ((match = tagRegex.exec(line)) !== null) {\n const name = match[1];\n found.add(name);\n }\n }\n return Array.from(found);\n}\n\nexport async function discoverExamples(\n componentFilePath: string,\n componentsDir: string,\n): Promise<string[]> {\n const fileBase = path.basename(\n componentFilePath,\n path.extname(componentFilePath),\n );\n const kebabBase = slugify(fileBase);\n const candidates = [\n join(dirname(componentFilePath), `${fileBase}.examples`),\n join(dirname(componentFilePath), `${kebabBase}.examples`),\n ];\n const found: string[] = [];\n for (const dir of candidates) {\n try {\n const items = await readdir(dir, { withFileTypes: true });\n for (const it of items) {\n if (it.isFile() && extname(it.name).toLowerCase() === \".astro\") {\n const abs = join(dir, it.name);\n const relFromComponents = path\n .relative(componentsDir, abs)\n .split(path.sep)\n .join(pathPosix.sep);\n found.push(relFromComponents);\n }\n }\n } catch {}\n }\n return found;\n}\n\nexport function createSourceFileFromFrontmatter(\n frontmatterCode: string,\n): SourceFile {\n const project = new Project({ useInMemoryFileSystem: true });\n return project.createSourceFile(\"Component.ts\", frontmatterCode, {\n overwrite: true,\n });\n}\n","export function buildMdx(params: {\n importName: string;\n importPath: string;\n title: string;\n description: string;\n descriptionBodyMDX?: string;\n figmaUrl?: string;\n usageMDX: string;\n hasImport: boolean;\n propsList: string;\n propsTable?: Array<{\n name: string;\n type?: string;\n required?: boolean;\n defaultValue?: string | null;\n description?: string | null;\n }>;\n examples: Array<{\n importName: string;\n importPath: string;\n title: string;\n source: string;\n }>;\n examplesBlocks: Array<{ title: string; body: string }>;\n autoImports: string[];\n lucideIcons: string[];\n primaryExampleMDX: string;\n componentSource: string;\n commandName: string;\n}): string {\n const {\n importName,\n importPath,\n title,\n description,\n descriptionBodyMDX,\n usageMDX,\n hasImport,\n propsList,\n propsTable,\n examples,\n examplesBlocks,\n autoImports,\n lucideIcons,\n primaryExampleMDX,\n componentSource,\n commandName,\n figmaUrl,\n } = params;\n\n const sortedLucide = (lucideIcons ?? []).slice().sort();\n const lucideTopLine = sortedLucide.length\n ? `import { ${sortedLucide.join(\", \")} } from '@lucide/astro';`\n : null;\n const externalTopImports = [\n `import { Tabs as DocsTabs, TabItem as DocsTabItem } from '@astrojs/starlight/components';`,\n lucideTopLine,\n ]\n .filter((v) => v != null)\n .slice()\n .sort((a, b) => String(a).localeCompare(String(b)));\n const sortedUiAuto = (autoImports ?? []).slice().sort();\n const uiAutoLines = sortedUiAuto.map(\n (name) => `import ${name} from '@bejamas/ui/components/${name}.astro';`,\n );\n const exampleLines = (examples ?? [])\n .map((ex) => `import ${ex.importName} from '${ex.importPath}';`)\n .sort((a, b) => a.localeCompare(b));\n const internalTopImports = [\n !hasImport ? `import ${importName} from '${importPath}';` : null,\n ...uiAutoLines,\n ...exampleLines,\n ]\n .filter((v) => v != null)\n .slice()\n .sort((a, b) => String(a).localeCompare(String(b)));\n const importLines = [\n ...externalTopImports,\n externalTopImports.length && internalTopImports.length ? \"\" : null,\n ...internalTopImports,\n ].filter((v) => v !== null && v !== undefined);\n\n // Helper: build per-snippet imports so code fences are minimal and copy-pasteable\n const extractTags = (snippet: string): Set<string> => {\n const found = new Set<string>();\n const tagRegex = /<([A-Z][A-Za-z0-9_]*)\\b/g;\n let m: RegExpExecArray | null;\n while ((m = tagRegex.exec(snippet)) !== null) {\n found.add(m[1]);\n }\n return found;\n };\n\n const buildSnippetImportLines = (snippet: string): string[] => {\n if (!snippet || !snippet.length) return [];\n const used = extractTags(snippet);\n const usedIcons = sortedLucide.filter((n) => used.has(n));\n const usedUi = (autoImports ?? [])\n .filter((n) => used.has(n))\n .slice()\n .sort();\n const includeMain = !hasImport && used.has(importName);\n\n const external: string[] = [];\n if (usedIcons.length) {\n external.push(`import { ${usedIcons.join(\", \")} } from '@lucide/astro';`);\n }\n const internal: string[] = [];\n if (includeMain)\n internal.push(`import ${importName} from '${importPath}';`);\n internal.push(\n ...usedUi.map(\n (name) => `import ${name} from '@bejamas/ui/components/${name}.astro';`,\n ),\n );\n\n const externalSorted = external.slice().sort((a, b) => a.localeCompare(b));\n const internalSorted = internal.slice().sort((a, b) => a.localeCompare(b));\n return [\n ...externalSorted,\n externalSorted.length && internalSorted.length ? \"\" : null,\n ...internalSorted,\n ].filter((v) => v !== null && v !== undefined) as string[];\n };\n\n const wrapTextNodes = (snippet: string): string => {\n if (!snippet) return snippet;\n return snippet.replace(/>([^<]+)</g, (match, inner) => {\n const trimmed = inner.trim();\n if (!trimmed.length) return match;\n if (/^\\{[\\s\\S]*\\}$/.test(trimmed)) return match;\n return `>{${JSON.stringify(inner)}}<`;\n });\n };\n\n const toMdxPreview = (snippet: string): string => {\n if (!snippet) return snippet;\n // Convert HTML comments to MDX comment blocks for preview sections\n const withoutComments = snippet.replace(/<!--([\\s\\S]*?)-->/g, \"{/*$1*/}\");\n return wrapTextNodes(withoutComments);\n };\n\n // Split an example body into leading markdown description (paragraphs)\n // and the Astro/HTML snippet that should be rendered in Preview/Source tabs\n const splitDescriptionAndSnippet = (\n body: string,\n ): { descriptionMD: string; snippet: string } => {\n if (!body || !body.trim().length) return { descriptionMD: \"\", snippet: \"\" };\n const lines = body.split(\"\\n\");\n let snippetStartIdx = -1;\n for (let i = 0; i < lines.length; i++) {\n const ln = lines[i];\n // Skip empty lines before first meaningful content\n if (!ln.trim().length) continue;\n // Heuristic: consider this line the start of the snippet if it looks like Astro/HTML/JSX\n // e.g. starts with '<' or '{'\n if (/^\\s*[<{]/.test(ln)) {\n snippetStartIdx = i;\n break;\n }\n // Otherwise it's part of markdown description; keep looking until we hit markup\n }\n if (snippetStartIdx <= 0) {\n // No clear description or snippet starts at the very beginning → treat all as snippet\n return { descriptionMD: \"\", snippet: body.trim() };\n }\n const descriptionMD = lines.slice(0, snippetStartIdx).join(\"\\n\").trim();\n const snippet = lines.slice(snippetStartIdx).join(\"\\n\").trim();\n return { descriptionMD, snippet };\n };\n\n const primaryExampleSection =\n primaryExampleMDX && primaryExampleMDX.length\n ? `<DocsTabs>\n <DocsTabItem label=\"Preview\">\n <div class=\"not-content sl-bejamas-component-preview flex justify-center px-10 py-12 border border-border rounded-md min-h-[450px] items-center [&_input]:max-w-xs\">\n${toMdxPreview(primaryExampleMDX)}\n </div>\n </DocsTabItem>\n <DocsTabItem label=\"Source\">\n\n\\`\\`\\`astro\n${(() => {\n const lines = buildSnippetImportLines(primaryExampleMDX);\n return lines.length ? `---\\n${lines.join(\"\\n\")}\\n---\\n\\n` : \"\";\n})()}${primaryExampleMDX}\n\\`\\`\\`\n </DocsTabItem>\n</DocsTabs>`\n : null;\n\n const exampleSections: string[] = [];\n if (examplesBlocks && examplesBlocks.length) {\n for (const blk of examplesBlocks) {\n const { descriptionMD, snippet } = splitDescriptionAndSnippet(blk.body);\n const previewBody = toMdxPreview(snippet);\n\n // If there's no snippet, render only header + description\n if (!snippet || !snippet.length) {\n exampleSections.push(\n `### ${blk.title}\n\n${descriptionMD}`.trim(),\n );\n continue;\n }\n\n exampleSections.push(\n `### ${blk.title}\n\n${descriptionMD ? `${descriptionMD}\\n\\n` : \"\"}<DocsTabs>\n <DocsTabItem label=\"Preview\">\n <div class=\"not-content sl-bejamas-component-preview flex justify-center px-10 py-12 border border-border rounded-md min-h-[450px] items-center [&_input]:max-w-xs\">\n${previewBody}\n </div>\n </DocsTabItem>\n <DocsTabItem label=\"Source\">\n\n\\`\\`\\`astro\n${(() => {\n const lines = buildSnippetImportLines(snippet);\n return lines.length ? `---\\n${lines.join(\"\\n\")}\\n---\\n\\n` : \"\";\n})()}${snippet}\n\\`\\`\\`\n </DocsTabItem>\n</DocsTabs>`,\n );\n }\n }\n if (examples && examples.length) {\n for (const ex of examples) {\n exampleSections.push(\n `### ${ex.title}\n\n<DocsTabs>\n <DocsTabItem label=\"Preview\">\n <div class=\"not-content\">\n <${ex.importName} />\n </div>\n </DocsTabItem>\n <DocsTabItem label=\"Source\">\n\n\\`\\`\\`astro\n${ex.source}\n\\`\\`\\`\n </DocsTabItem>\n</DocsTabs>`,\n );\n }\n }\n\n const formatDefault = (val: unknown): string => {\n if (val == null) return \"\";\n let raw = String(val).trim();\n if (!raw.length) return \"\";\n // Normalize curly quotes to ASCII\n raw = raw\n .replace(/[\\u201C\\u201D\\u201E\\u201F]/g, '\"')\n .replace(/[\\u2018\\u2019]/g, \"'\");\n const isSingleQuoted = /^'[^']*'$/.test(raw);\n const isDoubleQuoted = /^\"[^\"]*\"$/.test(raw);\n const isBacktickSimple = /^`[^`]*`$/.test(raw) && raw.indexOf(\"${\") === -1;\n\n let content = raw;\n if (isSingleQuoted || isDoubleQuoted || isBacktickSimple) {\n const inner = raw.slice(1, -1);\n // Re-quote with standard double quotes\n content = `\"${inner}\"`;\n }\n // Escape table pipes\n content = content.replace(/\\|/g, \"\\\\|\");\n // Choose a backtick fence that doesn't appear in content\n const hasTick = content.includes(\"`\");\n const hasDoubleTick = content.includes(\"``\");\n const fence = !hasTick ? \"`\" : !hasDoubleTick ? \"``\" : \"```\";\n return `${fence}${content}${fence}`;\n };\n\n const installationSection = `## Installation\n<DocsTabs syncKey=\"installation\">\n <DocsTabItem label=\"CLI\">\n\n<DocsTabs syncKey=\"pkg\">\n <DocsTabItem label=\"bun\">\n\n\\`\\`\\`bash\n bunx bejamas add ${commandName}\n\\`\\`\\`\n\n </DocsTabItem>\n <DocsTabItem label=\"npm\">\n\n\\`\\`\\`bash\n npx bejamas add ${commandName}\n\\`\\`\\`\n\n </DocsTabItem>\n <DocsTabItem label=\"pnpm\">\n\n\\`\\`\\`bash\n pnpm dlx bejamas add ${commandName}\n\\`\\`\\`\n\n </DocsTabItem>\n <DocsTabItem label=\"yarn\">\n\n\\`\\`\\`bash\n yarn dlx bejamas add ${commandName}\n\\`\\`\\`\n\n </DocsTabItem>\n</DocsTabs>\n</DocsTabItem>\n<DocsTabItem label=\"Manual\">\n\n\\`\\`\\`astro\n${componentSource}\n\\`\\`\\`\n </DocsTabItem>\n</DocsTabs>`;\n\n const serializeFrontmatter = (\n label: string,\n value?: string,\n ): string | null => {\n if (!value || !value.length) return null;\n return `${label}: ${JSON.stringify(value)}`;\n };\n\n const lines = [\n \"---\",\n serializeFrontmatter(\"title\", title),\n serializeFrontmatter(\"description\", description),\n serializeFrontmatter(\"figmaUrl\", figmaUrl),\n \"---\",\n \"\",\n ...importLines,\n importLines.length ? \"\" : null,\n descriptionBodyMDX && descriptionBodyMDX.length ? descriptionBodyMDX : null,\n descriptionBodyMDX && descriptionBodyMDX.length ? \"\" : null,\n primaryExampleSection,\n primaryExampleSection ? \"\" : null,\n installationSection,\n \"\",\n usageMDX && usageMDX.length ? `## Usage\\n\\n${usageMDX}` : null,\n \"\",\n propsTable && propsTable.length\n ? `## Props\\n\\n| Prop | Type | Default |\\n|---|---|---|\\n${propsTable\n .map(\n (p) =>\n `| <code>${p.name}</code> | \\`${(p.type || \"\").replace(/\\|/g, \"\\\\|\")}\\` | ${formatDefault(p.defaultValue)} |`,\n )\n .join(\"\\n\")}`\n : propsList\n ? `## Props\\n\\n${propsList}`\n : null,\n (propsTable && propsTable.length) || propsList ? \"\" : null,\n exampleSections.length\n ? `## Examples\\n\\n` + exampleSections.join(\"\\n\\n\")\n : null,\n ].filter((v) => v !== null && v !== undefined);\n\n return lines.join(\"\\n\").trim() + \"\\n\";\n}\n","import { mkdirSync } from \"fs\";\nimport { readdir, writeFile } from \"fs/promises\";\nimport { join, extname, dirname, relative } from \"path\";\nimport {\n RESERVED_COMPONENTS,\n slugify,\n extractFrontmatter,\n toIdentifier,\n parseJsDocMetadata,\n extractPropsFromAstroProps,\n extractPropsFromDeclaredProps,\n resolveUiRoot,\n resolveOutDir,\n normalizeUsageMDX,\n normalizeBlockMDX,\n detectHasImportTopLevel,\n discoverExamples,\n extractComponentTagsFromMDX,\n createSourceFileFromFrontmatter,\n} from \"./utils\";\nimport { buildMdx } from \"./mdx-builder\";\nimport { logger } from \"@/src/utils/logger\";\nimport { spinner } from \"@/src/utils/spinner\";\n\nasync function main() {\n const DEBUG =\n process.env.BEJAMAS_DEBUG === \"1\" || process.env.BEJAMAS_DEBUG === \"true\";\n const cwd =\n process.env.BEJAMAS_DOCS_CWD && process.env.BEJAMAS_DOCS_CWD.length\n ? (process.env.BEJAMAS_DOCS_CWD as string)\n : process.cwd();\n const uiRoot = resolveUiRoot(cwd);\n const componentsDir = join(uiRoot, \"src\", \"components\");\n const outDir = resolveOutDir(cwd);\n mkdirSync(outDir, { recursive: true });\n\n if (DEBUG) {\n logger.info(`[docs-generator] cwd: ${cwd}`);\n logger.info(`[docs-generator] uiRoot: ${uiRoot}`);\n logger.info(`[docs-generator] componentsDir: ${componentsDir}`);\n logger.info(`[docs-generator] outDir: ${outDir}`);\n }\n\n const entriesDir = await readdir(componentsDir, { withFileTypes: true });\n const files = entriesDir.filter(\n (e) => e.isFile() && extname(e.name).toLowerCase() === \".astro\",\n );\n if (DEBUG) {\n logger.info(`[docs-generator] components found: ${files.length}`);\n if (files.length)\n logger.info(\n `[docs-generator] first few: ${files\n .slice(0, 5)\n .map((f) => f.name)\n .join(\", \")}`,\n );\n }\n\n let generatedCount = 0;\n const total = files.length;\n const spin = spinner(`Generating docs (0/${total})`).start();\n for (const f of files) {\n const filePath = join(componentsDir, f.name);\n const astroFile = await (\n await import(\"fs/promises\")\n ).readFile(filePath, \"utf-8\");\n const frontmatterCode = extractFrontmatter(astroFile);\n const sourceFile = createSourceFileFromFrontmatter(frontmatterCode);\n const meta = parseJsDocMetadata(frontmatterCode);\n const declaredProps = extractPropsFromDeclaredProps(sourceFile);\n const destructuredProps = extractPropsFromAstroProps(sourceFile);\n\n // Build props table preferring declared types; merge defaults from destructuring\n const defaultsMap = new Map<string, string | null>();\n for (const p of destructuredProps) {\n if (p.name && p.hasDefault) {\n defaultsMap.set(p.name, p.defaultValue || null);\n }\n }\n\n const propsTable = (declaredProps.length ? declaredProps : []).map((p) => ({\n name: p.name,\n type: p.type,\n required: !p.optional,\n defaultValue: defaultsMap.has(p.name) ? defaultsMap.get(p.name)! : null,\n }));\n\n const slug = `${slugify(f.name)}`;\n const pascal = f.name.replace(/\\.(astro)$/i, \"\");\n const title = meta.title || meta.name || pascal;\n const description = meta.description || \"\";\n const descriptionBodyMDX = (meta as any).descriptionBodyMDX || \"\";\n const figmaUrl = (meta as any).figmaUrl || \"\";\n // Do not display props if there is no declared Props\n const propsList = \"\";\n\n const importName = pascal;\n const importPath = `@bejamas/ui/components/${pascal}.astro`;\n const { text: usageMDX, hasImport: hasImportUsage } = normalizeUsageMDX(\n meta.usageMDX || \"\",\n pascal,\n );\n const primaryExampleMDX = normalizeBlockMDX(\n meta.primaryExampleMDX || \"\",\n ).trim();\n const examplesMDX = normalizeBlockMDX(meta.examplesMDX || \"\").trim();\n const hasImportExamples = detectHasImportTopLevel(examplesMDX, pascal);\n const hasImportPrimary = detectHasImportTopLevel(primaryExampleMDX, pascal);\n const hasImport = hasImportUsage || hasImportExamples || hasImportPrimary;\n\n let exampleRelPaths: string[] = [];\n let examples: Array<{\n importName: string;\n importPath: string;\n title: string;\n source: string;\n }> = [];\n const examplesBlocksRaw = examplesMDX;\n const examplesBlocks = parseExamplesBlocks(examplesBlocksRaw);\n if (examplesBlocks.length === 0) {\n exampleRelPaths = await discoverExamples(filePath, componentsDir);\n examples = (exampleRelPaths || []).map((rel) => {\n const posixRel = rel\n .split(require(\"path\").sep)\n .join(require(\"path\").posix.sep);\n const importPath = `@bejamas/ui/components/${posixRel}`;\n const abs = join(componentsDir, rel);\n const source = require(\"fs\").readFileSync(abs, \"utf-8\");\n const base = toIdentifier(\n require(\"path\").basename(rel, require(\"path\").extname(rel)),\n );\n const importName = `${pascal}${base}`;\n const title = base;\n return { importName, importPath, title, source };\n });\n }\n\n const usedInUsage = extractComponentTagsFromMDX(usageMDX).filter(\n (n) => n !== pascal,\n );\n const usedInExamples = extractComponentTagsFromMDX(examplesMDX).filter(\n (n) => n !== pascal,\n );\n const usedInPrimary = extractComponentTagsFromMDX(primaryExampleMDX).filter(\n (n) => n !== pascal,\n );\n const autoSet = new Set<string>([\n ...usedInUsage,\n ...usedInExamples,\n ...usedInPrimary,\n ]);\n const autoImports = Array.from(autoSet)\n .filter((name) => !RESERVED_COMPONENTS.has(name))\n .filter((name) => true);\n\n const lucideIcons = autoImports.filter((n) => /Icon$/.test(n));\n const uiAutoImports = autoImports.filter((n) => !/Icon$/.test(n));\n\n const mdx = buildMdx({\n importName,\n importPath,\n title,\n description,\n usageMDX,\n hasImport,\n propsList,\n propsTable,\n examples,\n examplesBlocks: parseExamplesBlocks(examplesBlocksRaw),\n autoImports: uiAutoImports,\n lucideIcons,\n primaryExampleMDX,\n componentSource: astroFile.trim(),\n commandName: slug,\n figmaUrl,\n descriptionBodyMDX,\n });\n const outFile = join(outDir, `${slug}.mdx`);\n mkdirSync(dirname(outFile), { recursive: true });\n await writeFile(outFile, mdx, \"utf-8\");\n generatedCount += 1;\n spin.text = `Generating docs (${generatedCount}/${total}) - ${title}`;\n if (DEBUG) logger.info(`Generated ${outFile}`);\n }\n spin.succeed(\n `Created ${generatedCount} file${generatedCount === 1 ? \"\" : \"s\"}:`,\n );\n // log all files with relative paths, sorted alphabetically\n const relPaths = files\n .map((f) => {\n const slug = `${slugify(f.name)}`;\n const outFile = join(outDir, `${slug}.mdx`);\n return relative(cwd, outFile);\n })\n .sort((a, b) => a.localeCompare(b));\n relPaths.forEach((p) => {\n logger.log(` - ${p}`);\n });\n logger.break();\n}\n\nexport function parseExamplesBlocks(\n examplesMDX: string,\n): Array<{ title: string; body: string }> {\n if (!examplesMDX) return [];\n const lines = examplesMDX.split(\"\\n\");\n const blocks: Array<{ title: string; body: string[] }> = [];\n let current: { title: string; body: string[] } = { title: \"\", body: [] };\n for (const line of lines) {\n const heading = line.match(/^###\\s+(.+)$/);\n if (heading) {\n if (current.title || current.body.length) blocks.push(current);\n current = { title: heading[1].trim(), body: [] };\n continue;\n }\n current.body.push(line);\n }\n if (current.title || current.body.length) blocks.push(current);\n return blocks.map((b, idx) => ({\n title: b.title || `Example ${idx + 1}`,\n body: b.body.join(\"\\n\").trim(),\n }));\n}\n\nexport async function runDocsGenerator(): Promise<void> {\n await main();\n}\n\nif (\n process.env.BEJAMAS_SKIP_AUTO_RUN !== \"1\" &&\n process.env.BEJAMAS_SKIP_AUTO_RUN !== \"true\"\n) {\n runDocsGenerator().catch((err) => {\n logger.error(String(err));\n process.exit(1);\n });\n}\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAaA,sBAAmC,IAAI,IAAI;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,SAAgB,QAAQ,OAAuB;AAC7C,QAAO,MACJ,QAAQ,oCAAoC,GAAG,CAC/C,QAAQ,sBAAsB,QAAQ,CACtC,QAAQ,QAAQ,IAAI,CACpB,QAAQ,OAAO,IAAI,CACnB,aAAa;;AAGlB,SAAgB,mBAAmB,QAAwB;CACzD,MAAM,QAAQ,OAAO,MAAM,wBAAwB;AACnD,QAAQ,SAAS,MAAM,MAAO;;AAGhC,SAAgB,aAAa,MAAsB;CACjD,MAAM,OAAO,KACV,QAAQ,YAAY,GAAG,CACvB,QAAQ,kBAAkB,IAAI,CAC9B,MAAM,CACN,QAAQ,UAAU,MAAM,EAAE,aAAa,CAAC,CACxC,QAAQ,QAAQ,GAAG;AACtB,QAAO,aAAa,KAAK,KAAK,GAAG,OAAO,KAAK;;AAG/C,SAAgB,mBACd,iBACqB;CACrB,MAAM,aAAa,gBAAgB,MAAM,uBAAuB;AAChE,KAAI,CAAC,WAAY,QAAO,EAAE;CAE1B,MAAM,QADU,WAAW,GACL,MAAM,KAAK,CAAC,KAAK,MAAM,EAAE,QAAQ,aAAa,GAAG,CAAC;CACxE,MAAMC,OAA4B,EAAE;CACpC,IAAI,UAAU;CACd,IAAI,aAAa;CACjB,IAAI,mBAAmB;CACvB,IAAI,yBAAyB;CA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