ardo 3.3.0 → 3.4.0

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.
Files changed (65) hide show
  1. package/dist/{DocPage-B0Fr09xS.js → DocPage-Dy7OrCP2.js} +21 -19
  2. package/dist/DocPage-Dy7OrCP2.js.map +1 -0
  3. package/dist/assets/src/ui/{DocPage.css.ts.vanilla-BzG5Z7uL.css → DocPage.css.ts.vanilla-CWL92vUE.css} +8 -19
  4. package/dist/assets/src/ui/ErrorBoundary.css.ts.vanilla-C4usIU4z.css +112 -0
  5. package/dist/assets/src/ui/{Footer.css.ts.vanilla-YkYGSrJ5.css → Footer.css.ts.vanilla-DGTyff5Y.css} +39 -17
  6. package/dist/assets/src/ui/{Header.css.ts.vanilla-DoHPoq3b.css → Header.css.ts.vanilla-DEcLj8r0.css} +27 -45
  7. package/dist/assets/src/ui/{Layout.css.ts.vanilla-C7TVummJ.css → Layout.css.ts.vanilla-ClOa1YZm.css} +0 -3
  8. package/dist/assets/src/ui/{Sidebar.css.ts.vanilla-PyKaHp0J.css → Sidebar.css.ts.vanilla-IxNEQEBv.css} +57 -31
  9. package/dist/assets/src/ui/{Toc.css.ts.vanilla-Py3sLE1P.css → Toc.css.ts.vanilla-CQbpEdTg.css} +5 -5
  10. package/dist/assets/src/ui/components/{CodeBlock.css.ts.vanilla-DL4KE8dp.css → CodeBlock.css.ts.vanilla-BxDJ2gKc.css} +14 -12
  11. package/dist/assets/src/ui/components/{CopyButton.css.ts.vanilla-DSjVT6G0.css → CopyButton.css.ts.vanilla-CO2awD6S.css} +4 -5
  12. package/dist/assets/src/ui/components/HeaderSearch.css.ts.vanilla-KAo_Mlc-.css +68 -0
  13. package/dist/assets/src/ui/components/{Search.css.ts.vanilla-CX2EM6hW.css → Search.css.ts.vanilla-NQZH1eLo.css} +17 -6
  14. package/dist/assets/src/ui/theme/{dark.css.ts.vanilla-C40AfyaZ.css → dark.css.ts.vanilla-CQef5pk2.css} +11 -7
  15. package/dist/assets/src/ui/theme/{light.css.ts.vanilla-D0oxKOX2.css → light.css.ts.vanilla-D8gxaS1c.css} +11 -7
  16. package/dist/{brand-icons-DLJKqTun.js → brand-icons-Di8w0Nu9.js} +1 -1
  17. package/dist/{brand-icons-DLJKqTun.js.map → brand-icons-Di8w0Nu9.js.map} +1 -1
  18. package/dist/config/index.d.ts +1 -1
  19. package/dist/{contract.css-ZxmDpwAM.d.ts → contract.css-qPyk_asd.d.ts} +5 -1
  20. package/dist/contract.css-qPyk_asd.d.ts.map +1 -0
  21. package/dist/{generator-DX0PP1xf.js → generator-CYSyo4Vz.js} +7 -6
  22. package/dist/generator-CYSyo4Vz.js.map +1 -0
  23. package/dist/icons/index.js +1 -1
  24. package/dist/{index-CWfXolzQ.d.ts → index-BcekgOfA.d.ts} +68 -7
  25. package/dist/index-BcekgOfA.d.ts.map +1 -0
  26. package/dist/{index-BNKprp9_.d.ts → index-CuMTHUxX.d.ts} +8 -2
  27. package/dist/index-CuMTHUxX.d.ts.map +1 -0
  28. package/dist/index.d.ts +3 -3
  29. package/dist/index.js +3 -3
  30. package/dist/mdx/provider.js +1 -1
  31. package/dist/runtime/index.d.ts +1 -1
  32. package/dist/runtime/index.js +1 -1
  33. package/dist/{sidebar-utils-1Skqle1Q.js → sidebar-utils-C06DJsx4.js} +15 -4
  34. package/dist/sidebar-utils-C06DJsx4.js.map +1 -0
  35. package/dist/theme/index.d.ts +16 -4
  36. package/dist/theme/index.d.ts.map +1 -1
  37. package/dist/theme/index.js +46 -23
  38. package/dist/theme/index.js.map +1 -1
  39. package/dist/typedoc/components/index.d.ts +1 -1
  40. package/dist/typedoc/index.d.ts +1 -1
  41. package/dist/typedoc/index.d.ts.map +1 -1
  42. package/dist/typedoc/index.js +1 -1
  43. package/dist/{types-Do3OQY8G.d.ts → types-B75OhnGa.d.ts} +13 -2
  44. package/dist/types-B75OhnGa.d.ts.map +1 -0
  45. package/dist/{types-DvGYhH63.d.ts → types-Ck2Vm7NB.d.ts} +2 -2
  46. package/dist/{types-DvGYhH63.d.ts.map → types-Ck2Vm7NB.d.ts.map} +1 -1
  47. package/dist/ui/index.d.ts +2 -2
  48. package/dist/ui/index.js +3 -3
  49. package/dist/ui/styles.css +342 -306
  50. package/dist/ui/styles.js +11 -11
  51. package/dist/{ui-BzUIfYJm.js → ui-AGPGBunC.js} +584 -276
  52. package/dist/ui-AGPGBunC.js.map +1 -0
  53. package/dist/vite/index.d.ts +1 -1
  54. package/dist/vite/index.d.ts.map +1 -1
  55. package/dist/vite/index.js +165 -24
  56. package/dist/vite/index.js.map +1 -1
  57. package/package.json +13 -13
  58. package/dist/DocPage-B0Fr09xS.js.map +0 -1
  59. package/dist/contract.css-ZxmDpwAM.d.ts.map +0 -1
  60. package/dist/generator-DX0PP1xf.js.map +0 -1
  61. package/dist/index-BNKprp9_.d.ts.map +0 -1
  62. package/dist/index-CWfXolzQ.d.ts.map +0 -1
  63. package/dist/sidebar-utils-1Skqle1Q.js.map +0 -1
  64. package/dist/types-Do3OQY8G.d.ts.map +0 -1
  65. package/dist/ui-BzUIfYJm.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isRecord","isRecord","getHeadingText","slugify","ensureHProperties","isRecord","isRecord","formatTitle","readDirectoryEntries","readDirectoryIndexMetadata","formatTitle","readFrontmatter","isRecord","fs","fs","name","isIdentifierName","fs","formatTitle","generateSidebar","generateSidebar"],"sources":["../../src/markdown/links.ts","../../src/markdown/shiki-theme.ts","../../src/ui/components/code-block-classes.ts","../../src/markdown/shiki-html.ts","../../src/markdown/shiki-meta.ts","../../src/markdown/shiki-rehype.ts","../../src/markdown/shiki-transformer.ts","../../src/markdown/shiki.ts","../../src/markdown/toc.ts","../../src/markdown/pipeline.ts","../../src/runtime/loader.ts","../../src/runtime/sidebar.ts","../../src/vite/codeblock-scan.ts","../../src/vite/codeblock-transform.ts","../../src/vite/codeblock-plugin.ts","../../src/vite/git-utils.ts","../../src/vite/flatten-plugin.ts","../../src/vite/icons.ts","../../src/vite/markdown-meta.ts","../../../../node_modules/.pnpm/estree-util-value-to-estree@3.5.0/node_modules/estree-util-value-to-estree/dist/estree-util-value-to-estree.js","../../../../node_modules/.pnpm/estree-util-is-identifier-name@3.0.0/node_modules/estree-util-is-identifier-name/lib/index.js","../../../../node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.js","../../../../node_modules/.pnpm/estree-util-scope@1.0.0/node_modules/estree-util-scope/lib/index.js","../../../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/walker.js","../../../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/sync.js","../../../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/index.js","../../../../node_modules/.pnpm/unist-util-mdx-define@1.1.2/node_modules/unist-util-mdx-define/dist/unist-util-mdx-define.js","../../src/markdown/remark-mdx-toc.ts","../../src/vite/recma-wrap-export.ts","../../src/vite/mdx-plugin.ts","../../src/vite/project-meta.ts","../../src/vite/routes-core.ts","../../src/vite/routes-plugin.ts","../../src/vite/search-index.ts","../../src/vite/sidebar-index.ts","../../src/vite/typedoc-plugin.ts","../../src/vite/plugin.ts"],"sourcesContent":["import type { Element, Root } from \"hast\"\n\nimport { visit } from \"unist-util-visit\"\n\nexport type RehypeLinkOptions = {\n basePath: string\n}\n\n/**\n * Rehype plugin that rewrites internal links to include the basePath.\n * This is needed for static sites deployed to subpaths (e.g., GitHub Pages).\n */\nexport function rehypeLinks(options: RehypeLinkOptions) {\n const { basePath } = options\n\n // Normalize basePath: ensure it starts with / and doesn't end with /\n const normalizedBase = basePath === \"/\" ? \"\" : basePath.replace(/\\/$/, \"\")\n\n return (tree: Root) => {\n if (!normalizedBase) {\n // No basePath to add\n return\n }\n\n visit(tree, \"element\", (node: Element) => {\n if (node.tagName !== \"a\") {\n return\n }\n\n const href = node.properties.href\n\n // Only rewrite internal links that start with /\n // Don't rewrite: external URLs, anchors, relative paths, or already prefixed paths\n if (\n typeof href === \"string\" &&\n href.startsWith(\"/\") &&\n !href.startsWith(\"//\") &&\n !href.startsWith(normalizedBase)\n ) {\n node.properties.href = normalizedBase + href\n }\n })\n }\n}\n","import type { BundledTheme, Highlighter } from \"shiki\"\n\nimport type { MarkdownConfig } from \"../config/types\"\n\n/** Default Ardo themes used when no config is provided */\nexport const DEFAULT_THEMES = {\n light: \"github-light-default\" as BundledTheme,\n dark: \"github-dark-default\" as BundledTheme,\n}\n\nexport function resolveThemeConfig(\n theme: MarkdownConfig[\"theme\"] | undefined\n): MarkdownConfig[\"theme\"] {\n return theme ?? DEFAULT_THEMES\n}\n\nexport function getBundledThemes(themeConfig: MarkdownConfig[\"theme\"]): BundledTheme[] {\n if (themeConfig == null) return [DEFAULT_THEMES.light, DEFAULT_THEMES.dark]\n return typeof themeConfig === \"string\" ? [themeConfig] : [themeConfig.light, themeConfig.dark]\n}\n\nexport function highlightWithTheme(params: {\n code: string\n highlighter: Highlighter\n language: string\n themeConfig: MarkdownConfig[\"theme\"]\n}): string {\n const { code, highlighter, language, themeConfig } = params\n\n const resolved = themeConfig ?? DEFAULT_THEMES\n\n if (typeof resolved === \"string\") {\n return highlighter.codeToHtml(code, { lang: language, theme: resolved })\n }\n\n return highlighter.codeToHtml(code, {\n defaultColor: false,\n lang: language,\n themes: { dark: resolved.dark, light: resolved.light },\n })\n}\n","export const shikiContainerClassName = \"ardo-shiki\"\n","type CodeBlockOptions = {\n highlightLines: number[]\n lang: string\n lineNumbers: boolean\n title?: string\n}\n\nexport function buildCodeBlockHtml(shikiHtml: string, options: CodeBlockOptions): string {\n const titleHtml = renderTitle(options.title)\n const codeHtml = renderCodeLines({\n highlightLines: options.highlightLines,\n lineNumbers: options.lineNumbers,\n shikiHtml,\n })\n const copyButton = renderCopyButton(shikiHtml)\n\n return `${titleHtml}<div data-lang=\"${options.lang}\">${codeHtml}${copyButton}</div>`\n}\n\nfunction renderTitle(title: string | undefined): string {\n if (title == null || title.length === 0) {\n return \"\"\n }\n\n return `<div data-title>${escapeHtml(title)}</div>`\n}\n\nfunction renderCodeLines(params: {\n highlightLines: number[]\n lineNumbers: boolean\n shikiHtml: string\n}): string {\n const { highlightLines, lineNumbers, shikiHtml } = params\n if (!lineNumbers && highlightLines.length === 0) {\n return shikiHtml\n }\n\n return shikiHtml\n .split(\"\\n\")\n .map((lineHtml, index) =>\n renderSingleCodeLine({\n highlightLines,\n lineHtml,\n lineNumber: index + 1,\n lineNumbers,\n })\n )\n .join(\"\\n\")\n}\n\nfunction renderSingleCodeLine(params: {\n highlightLines: number[]\n lineHtml: string\n lineNumber: number\n lineNumbers: boolean\n}): string {\n const { highlightLines, lineHtml, lineNumber, lineNumbers } = params\n const isHighlighted = highlightLines.includes(lineNumber)\n const className = isHighlighted ? \"line highlighted\" : \"line\"\n const lineNumberAttribute = lineNumbers ? ` data-ln=\"${lineNumber}\"` : \"\"\n\n return `<span class=\"${className}\"${lineNumberAttribute}>${lineHtml}</span>`\n}\n\nfunction renderCopyButton(shikiHtml: string): string {\n const code = encodeURIComponent(extractCodeFromHtml(shikiHtml))\n return `<button data-code=\"${code}\">\n <span>Copy</span>\n <span style=\"display:none\">Copied!</span>\n </button>`\n}\n\nfunction extractCodeFromHtml(html: string): string {\n return decodeCommonEntities(stripTags(html))\n}\n\nfunction stripTags(html: string): string {\n let result = \"\"\n let inTag = false\n\n for (const char of html) {\n if (char === \"<\") {\n inTag = true\n continue\n }\n\n if (inTag && char === \">\") {\n inTag = false\n continue\n }\n\n if (!inTag) {\n result += char\n }\n }\n\n return result\n}\n\nfunction decodeCommonEntities(text: string): string {\n return text\n .replaceAll(\"&lt;\", \"<\")\n .replaceAll(\"&gt;\", \">\")\n .replaceAll(\"&amp;\", \"&\")\n .replaceAll(\"&quot;\", '\"')\n .replaceAll(\"&#39;\", \"'\")\n}\n\nfunction escapeHtml(text: string): string {\n return text\n .replaceAll(\"&\", \"&amp;\")\n .replaceAll(\"<\", \"&lt;\")\n .replaceAll(\">\", \"&gt;\")\n .replaceAll('\"', \"&quot;\")\n .replaceAll(\"'\", \"&#39;\")\n}\n","export function parseHighlightLines(meta: string): number[] {\n const match = /\\{([\\d,-]+)\\}/u.exec(meta)\n if (match?.[1] == null) {\n return []\n }\n\n const lines: number[] = []\n for (const range of match[1].split(\",\")) {\n appendRangeLines(lines, range)\n }\n\n return lines\n}\n\nfunction appendRangeLines(lines: number[], range: string): void {\n if (range.includes(\"-\")) {\n appendRangeSet(lines, range)\n return\n }\n\n const lineNumber = Number(range)\n if (Number.isFinite(lineNumber)) {\n lines.push(lineNumber)\n }\n}\n\nfunction appendRangeSet(lines: number[], range: string): void {\n const [start, end] = range.split(\"-\").map(Number)\n if (!Number.isFinite(start) || !Number.isFinite(end)) {\n return\n }\n\n for (let line = start; line <= end; line++) {\n lines.push(line)\n }\n}\n\nexport function parseTitle(meta: string): string | undefined {\n const match = /title=\"([^\"]+)\"/u.exec(meta)\n return match?.[1]\n}\n\nexport function parseLabel(meta: string): string | undefined {\n const start = meta.indexOf(\"[\")\n if (start === -1) {\n return undefined\n }\n\n const end = meta.indexOf(\"]\", start + 1)\n if (end === -1) {\n return undefined\n }\n\n const label = meta.slice(start + 1, end).trim()\n return label.length > 0 ? label : undefined\n}\n","import type { Element, Root, Text } from \"hast\"\nimport type { Highlighter } from \"shiki\"\n\nimport { visit } from \"unist-util-visit\"\n\nimport type { MarkdownConfig } from \"../config/types\"\n\nimport { shikiContainerClassName } from \"../ui/components/code-block-classes\"\nimport { buildCodeBlockHtml } from \"./shiki-html\"\nimport { parseHighlightLines, parseTitle } from \"./shiki-meta\"\nimport { highlightWithTheme, resolveThemeConfig } from \"./shiki-theme\"\n\ntype RehypeShikiOptions = {\n config: MarkdownConfig\n highlighter: Highlighter\n}\n\ntype TransformCodeNodeContext = {\n config: MarkdownConfig\n highlighter: Highlighter\n index: number | undefined\n node: Element\n parent: unknown\n themeConfig: MarkdownConfig[\"theme\"]\n}\n\nexport function rehypeShikiFromHighlighter(options: RehypeShikiOptions) {\n const themeConfig = resolveThemeConfig(options.config.theme)\n\n return function (tree: Root): void {\n visit(tree, \"element\", (node: Element, index, parent) => {\n transformCodeNode({\n config: options.config,\n highlighter: options.highlighter,\n index,\n node,\n parent,\n themeConfig,\n })\n })\n }\n}\n\nfunction transformCodeNode(context: TransformCodeNodeContext): void {\n const codeNode = getCodeNode(context.node)\n if (codeNode == null) {\n return\n }\n\n const codeContent = getTextContent(codeNode)\n if (codeContent.trim().length === 0) {\n return\n }\n\n const metaString = getMetaString(codeNode)\n const language = getLanguage(codeNode)\n const innerHtml = tryRenderHighlightedHtml({\n codeContent,\n context,\n language,\n metaString,\n })\n if (innerHtml == null) {\n return\n }\n\n replaceNodeWithShikiContainer(context.parent, context.index, innerHtml)\n}\n\nfunction tryRenderHighlightedHtml(params: {\n codeContent: string\n context: TransformCodeNodeContext\n language: string\n metaString: string\n}): null | string {\n const { codeContent, context, language, metaString } = params\n try {\n const html = highlightWithTheme({\n code: codeContent,\n highlighter: context.highlighter,\n language,\n themeConfig: context.themeConfig,\n })\n\n return buildCodeBlockHtml(html, {\n highlightLines: parseHighlightLines(metaString),\n lang: language,\n lineNumbers: (context.config.lineNumbers ?? false) || metaString.includes(\"showLineNumbers\"),\n title: parseTitle(metaString),\n })\n } catch {\n return null\n }\n}\n\nfunction getCodeNode(node: Element): Element | null {\n if (node.tagName !== \"pre\") {\n return null\n }\n\n const firstChild = node.children.at(0)\n if (!isElementNode(firstChild) || firstChild.tagName !== \"code\") {\n return null\n }\n\n return firstChild\n}\n\nfunction isElementNode(node: unknown): node is Element {\n return isRecord(node) && node.type === \"element\"\n}\n\nfunction getMetaString(codeNode: Element): string {\n const properties = toRecord(codeNode.properties)\n return typeof properties.metastring === \"string\" ? properties.metastring : \"\"\n}\n\nfunction getLanguage(codeNode: Element): string {\n const properties = toRecord(codeNode.properties)\n const classNames = toClassNameList(properties.className)\n const languageClass = classNames.find((className) => className.startsWith(\"language-\"))\n\n return languageClass == null ? \"text\" : languageClass.replace(\"language-\", \"\")\n}\n\nfunction toClassNameList(className: unknown): string[] {\n if (Array.isArray(className)) {\n return className.filter((entry): entry is string => typeof entry === \"string\")\n }\n\n if (typeof className === \"string\") {\n return [className]\n }\n\n return []\n}\n\nfunction getTextContent(node: Element | Text): string {\n if (node.type === \"text\") {\n return node.value\n }\n\n const parts: string[] = []\n for (const child of node.children) {\n if (child.type === \"text\" || child.type === \"element\") {\n parts.push(getTextContent(child))\n }\n }\n\n return parts.join(\"\")\n}\n\nfunction replaceNodeWithShikiContainer(\n parent: unknown,\n index: number | undefined,\n innerHtml: string\n): void {\n if (index == null || !hasChildrenArray(parent)) {\n return\n }\n\n parent.children[index] = {\n type: \"element\",\n tagName: \"div\",\n properties: {\n className: [shikiContainerClassName],\n },\n children: [\n {\n type: \"raw\",\n value: innerHtml,\n },\n ],\n }\n}\n\nfunction hasChildrenArray(value: unknown): value is { children: unknown[] } {\n return isRecord(value) && Array.isArray(value.children)\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> {\n return isRecord(value) ? value : {}\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n","import type { Root } from \"hast\"\nimport type { ShikiTransformer } from \"shiki\"\n\nimport { visit } from \"unist-util-visit\"\n\nimport { parseHighlightLines, parseLabel, parseTitle } from \"./shiki-meta\"\n\n/**\n * Remark plugin that extracts code fence meta info and stores it as HAST\n * data attributes before MDX compilation can corrupt it.\n */\nexport function remarkCodeMeta() {\n return function (tree: Root): void {\n visit(tree, \"code\", (node: { data?: Record<string, unknown>; meta?: null | string }) => {\n const meta = node.meta\n if (meta == null || meta.length === 0) {\n return\n }\n\n const data = ensureNodeData(node)\n const hProperties = ensureRecord(data.hProperties)\n\n // Preserve meta as metastring property on the <code> HAST element.\n // @shikijs/rehype reads head.properties.metastring and passes it\n // to Shiki as meta.__raw, which ardoLineTransformer reads.\n hProperties.metastring = meta\n data.hProperties = hProperties\n\n // Strip meta from the MDAST node to prevent MDX from\n // misinterpreting {expressions} like {2,4-5} as JSX.\n node.meta = null\n })\n }\n}\n\nfunction ensureNodeData(node: { data?: Record<string, unknown> }): Record<string, unknown> {\n node.data ??= {}\n return node.data\n}\n\nfunction ensureRecord(value: unknown): Record<string, unknown> {\n return isRecord(value) ? value : {}\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n\ntype ArdoLineTransformerOptions = {\n globalLineNumbers?: boolean\n}\n\ntype LineTransformerState = {\n highlightLines: number[]\n metaRaw: string\n showLineNumbers: boolean\n}\n\ntype TransformerNode = {\n properties?: Record<string, unknown>\n}\n\n/**\n * Shiki transformer that adds line highlighting, line numbers, and title\n * attributes to code blocks in the MDX pipeline.\n */\nexport function ardoLineTransformer(options: ArdoLineTransformerOptions = {}): ShikiTransformer {\n const state: LineTransformerState = {\n highlightLines: [],\n metaRaw: \"\",\n showLineNumbers: false,\n }\n\n return {\n name: \"ardo:lines\",\n preprocess(_code, shikiOptions) {\n const metaRaw = getMetaRaw(shikiOptions.meta)\n state.metaRaw = metaRaw\n state.highlightLines = parseHighlightLines(metaRaw)\n state.showLineNumbers =\n (options.globalLineNumbers ?? false) || metaRaw.includes(\"showLineNumbers\")\n },\n pre(node) {\n const properties = ensureNodeProperties(node)\n applyTitleProperty(properties, state.metaRaw)\n applyLabelProperty(properties, state.metaRaw)\n },\n line(node, line) {\n const properties = ensureNodeProperties(node)\n applyHighlightedLineClass(properties, state.highlightLines, line)\n\n if (state.showLineNumbers) {\n properties[\"data-ln\"] = String(line)\n }\n },\n }\n}\n\nfunction getMetaRaw(meta: unknown): string {\n if (!isRecord(meta)) {\n return \"\"\n }\n\n const raw = meta.__raw\n return typeof raw === \"string\" ? raw : \"\"\n}\n\nfunction ensureNodeProperties(node: TransformerNode): Record<string, unknown> {\n node.properties ??= {}\n return node.properties\n}\n\nfunction applyTitleProperty(properties: Record<string, unknown>, metaRaw: string): void {\n const title = parseTitle(metaRaw)\n if (title != null && title.length > 0) {\n properties[\"data-title\"] = title\n }\n}\n\nfunction applyLabelProperty(properties: Record<string, unknown>, metaRaw: string): void {\n const label = parseLabel(metaRaw)\n if (label != null && label.length > 0) {\n properties[\"data-label\"] = label\n }\n}\n\nfunction applyHighlightedLineClass(\n properties: Record<string, unknown>,\n highlightLines: number[],\n line: number\n): void {\n if (!highlightLines.includes(line)) {\n return\n }\n\n const currentClass = typeof properties.class === \"string\" ? properties.class : \"\"\n properties.class = currentClass.length > 0 ? `${currentClass} highlighted` : \"highlighted\"\n}\n","import { createHighlighter, type Highlighter } from \"shiki\"\n\nimport type { MarkdownConfig } from \"../config/types\"\n\nimport { getBundledThemes, highlightWithTheme, resolveThemeConfig } from \"./shiki-theme\"\n\nexport { rehypeShikiFromHighlighter } from \"./shiki-rehype\"\nexport { ardoLineTransformer, remarkCodeMeta } from \"./shiki-transformer\"\n\nexport type ShikiHighlighter = Highlighter\n\nlet cachedHighlighterPromise: Promise<ShikiHighlighter> | undefined\n\n/**\n * Highlights code using Shiki with Ardo's default themes.\n * Creates and caches a highlighter instance for reuse.\n */\nexport async function highlightCode(\n code: string,\n language: string,\n options?: { theme?: MarkdownConfig[\"theme\"] }\n): Promise<string> {\n const themeConfig = resolveThemeConfig(options?.theme)\n const highlighter = await getCachedHighlighter(themeConfig)\n\n return highlightWithTheme({\n code,\n highlighter,\n language,\n themeConfig,\n })\n}\n\nasync function getCachedHighlighter(\n themeConfig: MarkdownConfig[\"theme\"]\n): Promise<ShikiHighlighter> {\n cachedHighlighterPromise ??= createShikiHighlighter({\n anchor: false,\n lineNumbers: false,\n theme: themeConfig,\n toc: { level: [2, 3] },\n })\n\n return cachedHighlighterPromise\n}\n\nexport async function createShikiHighlighter(config: MarkdownConfig): Promise<ShikiHighlighter> {\n const themeConfig = resolveThemeConfig(config.theme)\n\n return createHighlighter({\n themes: getBundledThemes(themeConfig),\n langs: [\n // Web fundamentals\n \"javascript\",\n \"typescript\",\n \"jsx\",\n \"tsx\",\n \"html\",\n \"css\",\n \"scss\",\n\n // Data & config formats\n \"json\",\n \"jsonc\",\n \"yaml\",\n \"toml\",\n \"xml\",\n \"graphql\",\n\n // Markdown & docs\n \"markdown\",\n \"mdx\",\n\n // Shell & DevOps\n \"bash\",\n \"shell\",\n \"dockerfile\",\n\n // General purpose\n \"python\",\n \"rust\",\n \"go\",\n \"sql\",\n \"diff\",\n ],\n })\n}\n","import type { Heading, Root } from \"mdast\"\n\nimport { visit } from \"unist-util-visit\"\n\nimport type { TOCItem } from \"../config/types\"\n\nexport type TocExtraction = {\n toc: TOCItem[]\n}\n\ntype TocOptions = {\n tocExtraction: TocExtraction\n levels: [number, number]\n}\n\nexport function remarkExtractToc(options: TocOptions) {\n const { tocExtraction, levels } = options\n const [minLevel, maxLevel] = levels\n\n return function (tree: Root) {\n const headings: Array<{ text: string; level: number; id: string }> = []\n let headingIndex = 0\n\n visit(tree, \"heading\", (node: Heading) => {\n if (node.depth < minLevel || node.depth > maxLevel) {\n return\n }\n\n const text = getHeadingText(node)\n const slug = slugify(text)\n const id = slug === \"\" ? `heading-${headingIndex}` : slug\n headingIndex++\n\n headings.push({\n text,\n level: node.depth,\n id,\n })\n\n // Add id to the heading node for anchor links\n const hProperties = ensureHProperties(node)\n hProperties.id = id\n })\n\n tocExtraction.toc = buildTocTree(headings)\n }\n}\n\nfunction getHeadingText(node: Heading): string {\n const textParts: string[] = []\n\n function extractText(child: unknown) {\n if (!isRecord(child)) return\n\n if (child.type === \"text\") {\n textParts.push(typeof child.value === \"string\" ? child.value : \"\")\n } else if (child.type === \"inlineCode\") {\n textParts.push(typeof child.value === \"string\" ? child.value : \"\")\n } else if (Array.isArray(child.children)) {\n child.children.forEach((nestedChild) => {\n extractText(nestedChild)\n })\n }\n }\n\n node.children.forEach((child) => {\n extractText(child)\n })\n return textParts.join(\"\")\n}\n\nfunction slugify(text: string): string {\n let slug = text\n .toLowerCase()\n .trim()\n .replaceAll(/[^\\s\\w-]/g, \"\")\n .replaceAll(/[\\s_]/g, \"-\")\n\n while (slug.includes(\"--\")) {\n slug = slug.replaceAll(\"--\", \"-\")\n }\n\n if (slug.startsWith(\"-\")) {\n slug = slug.slice(1)\n }\n\n if (slug.endsWith(\"-\")) {\n slug = slug.slice(0, -1)\n }\n\n return slug\n}\n\nfunction popStackUntilParent(stack: Array<{ item: TOCItem; level: number }>, level: number): void {\n while (stack.length > 0) {\n const last = stack.at(-1)\n if (last === undefined || last.level < level) break\n stack.pop()\n }\n}\n\nfunction insertIntoTree(\n result: TOCItem[],\n stack: Array<{ item: TOCItem; level: number }>,\n item: TOCItem\n): void {\n const parent = stack.at(-1)?.item\n if (parent === undefined) {\n result.push(item)\n } else {\n parent.children ??= []\n parent.children.push(item)\n }\n}\n\nfunction buildTocTree(headings: Array<{ text: string; level: number; id: string }>): TOCItem[] {\n const result: TOCItem[] = []\n const stack: Array<{ item: TOCItem; level: number }> = []\n\n for (const heading of headings) {\n const item: TOCItem = { id: heading.id, text: heading.text, level: heading.level }\n popStackUntilParent(stack, heading.level)\n insertIntoTree(result, stack, item)\n stack.push({ item, level: heading.level })\n }\n\n return result\n}\n\ntype HeadingDataWithHProperties = {\n hProperties?: Record<string, unknown>\n} & Heading[\"data\"]\n\nfunction ensureHProperties(node: Heading): Record<string, unknown> {\n const data: HeadingDataWithHProperties = node.data ?? {}\n node.data = data\n\n if (!isRecord(data.hProperties)) {\n data.hProperties = {}\n }\n\n return data.hProperties\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n\nexport function flattenToc(toc: TOCItem[]): TOCItem[] {\n const result: TOCItem[] = []\n\n function flatten(items: TOCItem[]) {\n for (const item of items) {\n result.push(item)\n if (item.children !== undefined) {\n flatten(item.children)\n }\n }\n }\n\n flatten(toc)\n return result\n}\n","import matter from \"gray-matter\"\nimport rehypeStringify from \"rehype-stringify\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkParse from \"remark-parse\"\nimport remarkRehype from \"remark-rehype\"\nimport { unified } from \"unified\"\n\nimport type { MarkdownConfig, PageFrontmatter, TOCItem } from \"../config/types\"\n\nimport { rehypeLinks } from \"./links\"\nimport { createShikiHighlighter, rehypeShikiFromHighlighter, type ShikiHighlighter } from \"./shiki\"\nimport { remarkExtractToc, type TocExtraction } from \"./toc\"\n\nexport type TransformResult = {\n html: string\n frontmatter: PageFrontmatter\n toc: TOCItem[]\n}\n\nexport type TransformOptions = {\n basePath?: string\n highlighter?: ShikiHighlighter\n}\n\nexport async function transformMarkdown(\n content: string,\n config: MarkdownConfig,\n options: TransformOptions = {}\n): Promise<TransformResult> {\n const { data, content: markdownContent } = matter(content)\n const frontmatterData: unknown = data\n const { basePath = \"/\", highlighter: providedHighlighter } = options\n\n const tocExtraction: TocExtraction = { toc: [] }\n const highlighter = providedHighlighter ?? (await createShikiHighlighter(config))\n\n const processor = unified()\n .use(remarkParse)\n .use(remarkFrontmatter, [\"yaml\"])\n .use(remarkGfm)\n .use(remarkExtractToc, { tocExtraction, levels: config.toc?.level ?? [2, 3] })\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeShikiFromHighlighter, { highlighter, config })\n .use(rehypeLinks, { basePath })\n .use(rehypeStringify, { allowDangerousHtml: true })\n\n if (config.remarkPlugins) {\n processor.use(config.remarkPlugins)\n }\n\n if (config.rehypePlugins) {\n processor.use(config.rehypePlugins)\n }\n\n const result = await processor.process(markdownContent)\n\n return {\n html: String(result),\n frontmatter: readPageFrontmatter(frontmatterData),\n toc: tocExtraction.toc,\n }\n}\n\nexport async function transformMarkdownToReact(\n content: string,\n config: MarkdownConfig\n): Promise<TransformResult> {\n return transformMarkdown(content, config)\n}\n\nfunction readPageFrontmatter(data: unknown): PageFrontmatter {\n return isRecord(data) ? data : {}\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n","import fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport type { PageData, PageFrontmatter, ResolvedConfig, TOCItem } from \"../config/types\"\n\nimport { transformMarkdown } from \"../markdown/pipeline\"\n\nexport type LoadDocOptions = {\n slug: string\n contentDir: string\n config: ResolvedConfig\n}\n\nexport type LoadDocResult = {\n content: string\n frontmatter: PageFrontmatter\n toc: TOCItem[]\n filePath: string\n relativePath: string\n lastUpdated?: number\n}\n\nasync function findFile(\n contentDir: string,\n slug: string\n): Promise<{ filePath: string; fileContent: string } | null> {\n const possiblePaths = [\n path.join(contentDir, `${slug}.md`),\n path.join(contentDir, slug, \"index.md\"),\n ]\n\n for (const tryPath of possiblePaths) {\n try {\n const fileContent = await fs.readFile(tryPath, \"utf8\")\n return { filePath: tryPath, fileContent }\n } catch {\n continue\n }\n }\n return null\n}\n\nasync function getLastUpdated(filePath: string): Promise<number | undefined> {\n try {\n const stat = await fs.stat(filePath)\n return stat.mtimeMs\n } catch {\n return undefined\n }\n}\n\nexport async function loadDoc(options: LoadDocOptions): Promise<LoadDocResult | null> {\n const { slug, contentDir, config } = options\n const found = await findFile(contentDir, slug)\n if (found === null) return null\n\n const result = await transformMarkdown(found.fileContent, config.markdown)\n return {\n content: result.html,\n frontmatter: result.frontmatter,\n toc: result.toc,\n filePath: found.filePath,\n relativePath: path.relative(contentDir, found.filePath),\n lastUpdated: await getLastUpdated(found.filePath),\n }\n}\n\nexport async function loadAllDocs(contentDir: string, config: ResolvedConfig): Promise<PageData[]> {\n const docs: PageData[] = []\n\n async function scanDir(dir: string) {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n await scanDir(fullPath)\n } else if (entry.name.endsWith(\".md\")) {\n const fileContent = await fs.readFile(fullPath, \"utf8\")\n const result = await transformMarkdown(fileContent, config.markdown)\n const relativePath = path.relative(contentDir, fullPath)\n\n let lastUpdated: number | undefined\n try {\n const stat = await fs.stat(fullPath)\n lastUpdated = stat.mtimeMs\n } catch {\n // Ignore stat errors\n }\n\n docs.push({\n title: result.frontmatter.title ?? formatTitle(entry.name.replace(/\\.md$/, \"\")),\n description: result.frontmatter.description,\n frontmatter: result.frontmatter,\n content: result.html,\n toc: result.toc,\n filePath: fullPath,\n relativePath,\n lastUpdated,\n })\n }\n }\n }\n\n await scanDir(contentDir)\n return docs\n}\n\nfunction formatTitle(name: string): string {\n return name.replaceAll(/[_-]/g, \" \").replaceAll(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nexport function getSlugFromPath(relativePath: string): string {\n return relativePath\n .replace(/\\.md$/, \"\")\n .replace(/\\/index$/, \"\")\n .replaceAll(\"\\\\\", \"/\")\n}\n\nexport function getPageDataForRoute(docs: PageData[], slug: string): PageData | undefined {\n return docs.find((doc) => {\n const docSlug = getSlugFromPath(doc.relativePath)\n return docSlug === slug || docSlug === `${slug}/index`\n })\n}\n","import type { Dirent } from \"node:fs\"\n\nimport matter from \"gray-matter\"\nimport fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport type { ResolvedConfig, SidebarItem } from \"../config/types\"\n\nexport type SidebarGenerationOptions = {\n basePath: string\n config: ResolvedConfig\n contentDir: string\n}\n\ntype SidebarItemWithOrder = {\n order?: number\n} & SidebarItem\n\ntype SidebarFrontmatter = {\n order?: number\n sidebar?: boolean\n title?: string\n}\n\nexport async function generateSidebar(options: SidebarGenerationOptions): Promise<SidebarItem[]> {\n const { contentDir } = options\n return scanDirectoryForSidebar(contentDir, contentDir)\n}\n\nasync function scanDirectoryForSidebar(dir: string, rootDir: string): Promise<SidebarItem[]> {\n const entries = await readDirectoryEntries(dir)\n const items: SidebarItemWithOrder[] = []\n\n for (const entry of entries) {\n const sidebarItem = await createSidebarItemFromEntry({\n dir,\n entry,\n rootDir,\n })\n\n if (sidebarItem != null) {\n items.push(sidebarItem)\n }\n }\n\n sortSidebarItems(items)\n return items.map(({ order: _order, ...item }) => item)\n}\n\nasync function readDirectoryEntries(dir: string): Promise<Dirent[]> {\n try {\n return await fs.readdir(dir, { withFileTypes: true })\n } catch {\n return []\n }\n}\n\nasync function createSidebarItemFromEntry(params: {\n dir: string\n entry: Dirent\n rootDir: string\n}): Promise<null | SidebarItemWithOrder> {\n const { dir, entry, rootDir } = params\n if (isIgnoredEntry(entry.name)) {\n return null\n }\n\n const fullPath = path.join(dir, entry.name)\n const relativePath = path.relative(rootDir, fullPath)\n\n if (entry.isDirectory()) {\n return createDirectorySidebarItem(fullPath, relativePath, rootDir)\n }\n\n if (isMarkdownPage(entry.name)) {\n return createMarkdownSidebarItem(fullPath, relativePath, entry.name)\n }\n\n return null\n}\n\nfunction isIgnoredEntry(entryName: string): boolean {\n return entryName.startsWith(\".\") || entryName.startsWith(\"_\")\n}\n\nfunction isMarkdownPage(entryName: string): boolean {\n return entryName.endsWith(\".md\") && entryName !== \"index.md\"\n}\n\nasync function createDirectorySidebarItem(\n fullPath: string,\n relativePath: string,\n rootDir: string\n): Promise<null | SidebarItemWithOrder> {\n const children = await scanDirectoryForSidebar(fullPath, rootDir)\n if (children.length === 0) {\n return null\n }\n\n const metadata = await readDirectoryIndexMetadata(fullPath, relativePath)\n const title = metadata.title ?? formatTitle(path.basename(fullPath))\n\n return {\n collapsed: false,\n items: children,\n link: metadata.link,\n order: metadata.order,\n text: title,\n }\n}\n\nasync function readDirectoryIndexMetadata(\n fullPath: string,\n relativePath: string\n): Promise<{ link?: string; order?: number; title?: string }> {\n const indexPath = path.join(fullPath, \"index.md\")\n const frontmatter = await readFrontmatter(indexPath)\n\n return {\n link: frontmatter == null ? undefined : normalizePath(relativePath),\n order: frontmatter?.order,\n title: frontmatter?.title,\n }\n}\n\nasync function createMarkdownSidebarItem(\n fullPath: string,\n relativePath: string,\n fileName: string\n): Promise<null | SidebarItemWithOrder> {\n const frontmatter = await readFrontmatter(fullPath)\n if (frontmatter?.sidebar === false) {\n return null\n }\n\n const fallbackTitle = formatTitle(fileName.replace(/\\.md$/u, \"\"))\n const title = frontmatter?.title ?? fallbackTitle\n\n return {\n link: normalizePath(relativePath.replace(/\\.md$/u, \"\")),\n order: frontmatter?.order,\n text: title,\n }\n}\n\nasync function readFrontmatter(filePath: string): Promise<null | SidebarFrontmatter> {\n try {\n const fileContent = await fs.readFile(filePath, \"utf8\")\n const parsed = matter(fileContent)\n return toSidebarFrontmatter(parsed.data)\n } catch {\n return null\n }\n}\n\nfunction toSidebarFrontmatter(data: unknown): SidebarFrontmatter {\n if (!isRecord(data)) {\n return {}\n }\n\n return {\n order: typeof data.order === \"number\" ? data.order : undefined,\n sidebar: typeof data.sidebar === \"boolean\" ? data.sidebar : undefined,\n title: typeof data.title === \"string\" ? data.title : undefined,\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n\nfunction sortSidebarItems(items: SidebarItemWithOrder[]): void {\n items.sort((left, right) => {\n if (left.order != null && right.order != null) {\n return left.order - right.order\n }\n\n if (left.order != null) {\n return -1\n }\n\n if (right.order != null) {\n return 1\n }\n\n return left.text.localeCompare(right.text)\n })\n}\n\nfunction formatTitle(name: string): string {\n return name\n .replace(/^\\d+-/u, \"\")\n .replaceAll(/[_-]/gu, \" \")\n .replaceAll(/\\b\\w/gu, (char) => char.toUpperCase())\n}\n\nfunction normalizePath(p: string): string {\n return `/${p.replaceAll(\"\\\\\", \"/\").replace(/^\\/+/u, \"\")}`\n}\n","export type ScannedCodeBlock = {\n children: null | string\n end: number\n fullMatch: string\n props: string\n start: number\n}\n\nconst OPENING_TAG = \"<ArdoCodeBlock\"\nconst CLOSING_TAG = \"</ArdoCodeBlock>\"\n\n/**\n * Strips leading/trailing blank lines and removes common leading whitespace.\n * Same logic as the runtime outdent in CodeBlock.tsx.\n */\nexport function outdent(text: string): string {\n const trimmedLines = trimBlankLines(text.split(\"\\n\"))\n if (trimmedLines.length === 0) {\n return \"\"\n }\n\n const commonIndent = getCommonIndent(trimmedLines)\n if (commonIndent === 0) {\n return trimmedLines.join(\"\\n\")\n }\n\n return trimmedLines.map((line) => stripIndent(line, commonIndent)).join(\"\\n\")\n}\n\nfunction trimBlankLines(lines: string[]): string[] {\n const result = [...lines]\n\n while (result.length > 0 && result[0].trim().length === 0) {\n result.shift()\n }\n\n while (result.length > 0 && result.at(-1)?.trim().length === 0) {\n result.pop()\n }\n\n return result\n}\n\nfunction getCommonIndent(lines: string[]): number {\n let minIndent = Number.POSITIVE_INFINITY\n\n for (const line of lines) {\n if (line.trim().length === 0) {\n continue\n }\n\n const indent = getLeadingWhitespaceLength(line)\n if (indent < minIndent) {\n minIndent = indent\n }\n }\n\n return Number.isFinite(minIndent) ? minIndent : 0\n}\n\nfunction stripIndent(line: string, commonIndent: number): string {\n const availableIndent = getLeadingWhitespaceLength(line)\n const removeCount = Math.min(commonIndent, availableIndent)\n return line.slice(removeCount)\n}\n\nfunction getLeadingWhitespaceLength(line: string): number {\n let index = 0\n while (index < line.length) {\n const char = line[index]\n if (char !== \" \" && char !== \"\\t\") {\n break\n }\n index++\n }\n return index\n}\n\n/**\n * Finds all `<ArdoCodeBlock ... />` and `<ArdoCodeBlock ...>...</ArdoCodeBlock>` tags\n * by scanning for balanced quotes and braces.\n */\nexport function scanArdoCodeBlocks(source: string): ScannedCodeBlock[] {\n const blocks: ScannedCodeBlock[] = []\n let cursor = 0\n\n while (cursor < source.length) {\n const scanResult = scanNextCodeBlock(source, cursor)\n if (scanResult == null) {\n break\n }\n\n const { block, nextCursor } = scanResult\n if (block != null) {\n blocks.push(block)\n }\n\n cursor = nextCursor\n }\n\n return blocks\n}\n\nfunction scanNextCodeBlock(\n source: string,\n cursor: number\n): { block: null | ScannedCodeBlock; nextCursor: number } | null {\n const start = source.indexOf(OPENING_TAG, cursor)\n if (start === -1) {\n return null\n }\n\n const opening = scanOpeningTag(source, start)\n if (opening == null) {\n return { block: null, nextCursor: start + OPENING_TAG.length }\n }\n\n const block = createScannedBlock(source, start, opening)\n if (block == null) {\n return null\n }\n\n return { block, nextCursor: block.end }\n}\n\ntype OpeningTag = {\n end: number\n isSelfClosing: boolean\n props: string\n}\n\nfunction scanOpeningTag(source: string, start: number): null | OpeningTag {\n const afterTag = start + OPENING_TAG.length\n if (!isWhitespaceChar(source[afterTag])) {\n return null\n }\n\n let index = afterTag\n let braceDepth = 0\n let quote: null | QuoteChar = null\n\n while (index < source.length) {\n const step = advanceOpeningTagScan(source, {\n braceDepth,\n index,\n quote,\n })\n if (step.tagEndIndex != null) {\n return finalizeOpeningTag(source, afterTag, step.tagEndIndex)\n }\n\n index = step.nextIndex\n braceDepth = step.nextBraceDepth\n quote = step.nextQuote\n }\n\n return null\n}\n\nfunction finalizeOpeningTag(source: string, afterTag: number, endBracketIndex: number): OpeningTag {\n const isSelfClosing = source[endBracketIndex - 1] === \"/\"\n const propsEnd = isSelfClosing ? endBracketIndex - 1 : endBracketIndex\n const props = source.slice(afterTag, propsEnd).trim()\n\n return {\n end: endBracketIndex + 1,\n isSelfClosing,\n props,\n }\n}\n\ntype QuoteChar = '\"' | \"'\" | \"`\"\n\ntype OpeningTagScanStep = {\n nextBraceDepth: number\n nextIndex: number\n nextQuote: null | QuoteChar\n tagEndIndex: null | number\n}\n\ntype ScanCursorState = {\n braceDepth: number\n index: number\n quote: null | QuoteChar\n}\n\nfunction advanceOpeningTagScan(source: string, state: ScanCursorState): OpeningTagScanStep {\n const { braceDepth, index, quote } = state\n if (quote != null) {\n return scanQuotedStep(source, {\n braceDepth,\n index,\n quote,\n })\n }\n\n return scanUnquotedStep(source, index, braceDepth)\n}\n\nfunction scanQuotedStep(source: string, state: ScanCursorState): OpeningTagScanStep {\n const { braceDepth, index, quote } = state\n if (source[index] === \"\\\\\") {\n return {\n nextBraceDepth: braceDepth,\n nextIndex: Math.min(source.length, index + 2),\n nextQuote: quote,\n tagEndIndex: null,\n }\n }\n\n const closesQuote = source[index] === quote\n return {\n nextBraceDepth: braceDepth,\n nextIndex: index + 1,\n nextQuote: closesQuote ? null : quote,\n tagEndIndex: null,\n }\n}\n\nfunction scanUnquotedStep(source: string, index: number, braceDepth: number): OpeningTagScanStep {\n const char = source[index]\n if (isQuote(char)) {\n return makeScanStep(index + 1, braceDepth, char)\n }\n\n if (char === \"{\") {\n return makeScanStep(index + 1, braceDepth + 1, null)\n }\n\n if (char === \"}\") {\n return makeScanStep(index + 1, Math.max(0, braceDepth - 1), null)\n }\n\n if (braceDepth === 0 && char === \">\") {\n return {\n nextBraceDepth: braceDepth,\n nextIndex: index + 1,\n nextQuote: null,\n tagEndIndex: index,\n }\n }\n\n return makeScanStep(index + 1, braceDepth, null)\n}\n\nfunction makeScanStep(\n nextIndex: number,\n nextBraceDepth: number,\n nextQuote: null | QuoteChar\n): OpeningTagScanStep {\n return {\n nextBraceDepth,\n nextIndex,\n nextQuote,\n tagEndIndex: null,\n }\n}\n\nfunction createScannedBlock(\n source: string,\n start: number,\n opening: OpeningTag\n): null | ScannedCodeBlock {\n if (opening.isSelfClosing) {\n return {\n children: null,\n end: opening.end,\n fullMatch: source.slice(start, opening.end),\n props: opening.props,\n start,\n }\n }\n\n const closeStart = source.indexOf(CLOSING_TAG, opening.end)\n if (closeStart === -1) {\n return null\n }\n\n const end = closeStart + CLOSING_TAG.length\n return {\n children: source.slice(opening.end, closeStart),\n end,\n fullMatch: source.slice(start, end),\n props: opening.props,\n start,\n }\n}\n\nfunction isQuote(char: string): char is QuoteChar {\n return char === \"'\" || char === '\"' || char === \"`\"\n}\n\nfunction isWhitespaceChar(char: string | undefined): boolean {\n return char === \" \" || char === \"\\n\" || char === \"\\r\" || char === \"\\t\"\n}\n","import type { MarkdownConfig } from \"../config/types\"\n\nimport { highlightCode } from \"../markdown/shiki\"\nimport { outdent, scanArdoCodeBlocks, type ScannedCodeBlock } from \"./codeblock-scan\"\n\nexport async function transformArdoCodeBlocks(\n source: string,\n markdownConfig?: MarkdownConfig\n): Promise<string> {\n let result = source\n let offset = 0\n const blocks = scanArdoCodeBlocks(source)\n\n for (const block of blocks) {\n const replacement = await createReplacement(block, markdownConfig)\n if (replacement == null) {\n continue\n }\n\n const adjustedStart = block.start + offset\n const adjustedEnd = block.end + offset\n result = result.slice(0, adjustedStart) + replacement + result.slice(adjustedEnd)\n offset += replacement.length - block.fullMatch.length\n }\n\n return result\n}\n\nasync function createReplacement(\n block: ScannedCodeBlock,\n markdownConfig?: MarkdownConfig\n): Promise<null | string> {\n if (block.props.includes(\"__html\")) {\n return null\n }\n\n if (block.children == null) {\n return createSelfClosingReplacement(block, markdownConfig)\n }\n\n return createChildrenReplacement(block, markdownConfig)\n}\n\nasync function createSelfClosingReplacement(\n block: ScannedCodeBlock,\n markdownConfig?: MarkdownConfig\n): Promise<null | string> {\n const codeValue = extractCodeValue(block.props)\n const language = extractPropValue(block.props, \"language\")\n if (codeValue == null || language == null) {\n return null\n }\n\n const html = await safeHighlightCode(codeValue, language, markdownConfig)\n if (html == null) {\n return null\n }\n\n const escapedHtml = JSON.stringify(html)\n const newProps = `__html={${escapedHtml}} ${block.props}`\n return block.fullMatch.replace(block.props, newProps)\n}\n\nasync function createChildrenReplacement(\n block: ScannedCodeBlock,\n markdownConfig?: MarkdownConfig\n): Promise<null | string> {\n const language = extractPropValue(block.props, \"language\")\n if (language == null || block.children == null) {\n return null\n }\n\n const rawChildren = unwrapTemplateChildren(block.children)\n const codeContent = outdent(rawChildren)\n const html = await safeHighlightCode(codeContent, language, markdownConfig)\n if (html == null) {\n return null\n }\n\n const escapedHtml = JSON.stringify(html)\n const escapedCode = JSON.stringify(codeContent)\n return `<ArdoCodeBlock __html={${escapedHtml}} code={${escapedCode}} ${block.props} />`\n}\n\nfunction unwrapTemplateChildren(rawChildren: string): string {\n const trimmed = rawChildren.trim()\n if (!trimmed.startsWith(\"{`\") || !trimmed.endsWith(\"`}\")) {\n return rawChildren\n }\n\n return trimmed.slice(2, -2)\n}\n\nfunction extractCodeValue(props: string): null | string {\n const code = extractPropValue(props, \"code\")\n if (code == null) {\n return null\n }\n\n return decodeEscapedString(code)\n}\n\nfunction decodeEscapedString(value: string): string {\n return value.replaceAll(\"\\\\n\", \"\\n\").replaceAll('\\\\\"', '\"').replaceAll(\"\\\\\\\\\", \"\\\\\")\n}\n\nfunction extractPropValue(props: string, propName: string): null | string {\n const patterns = getPropPatterns(propName)\n\n for (const pattern of patterns) {\n const match = pattern.exec(props)\n if (match?.[1] != null) {\n return match[1]\n }\n }\n\n return null\n}\n\nfunction getPropPatterns(propName: string): RegExp[] {\n return [\n new RegExp(`\\\\b${propName}=\"((?:[^\"\\\\\\\\]|\\\\\\\\.)*)\"`, \"su\"),\n new RegExp(`\\\\b${propName}=\\\\{\\\\s*\"((?:[^\"\\\\\\\\]|\\\\\\\\.)*)\"\\\\s*\\\\}`, \"su\"),\n new RegExp(`\\\\b${propName}=\\\\{\\\\s*'((?:[^'\\\\\\\\]|\\\\\\\\.)*)'\\\\s*\\\\}`, \"su\"),\n ]\n}\n\nasync function safeHighlightCode(\n codeContent: string,\n language: string,\n markdownConfig?: MarkdownConfig\n): Promise<null | string> {\n try {\n return await highlightCode(codeContent, language, {\n theme: markdownConfig?.theme,\n })\n } catch {\n return null\n }\n}\n","import type { Plugin } from \"vite\"\n\nimport type { MarkdownConfig } from \"../config/types\"\n\nimport { transformArdoCodeBlocks } from \"./codeblock-transform\"\n\n/**\n * Vite plugin that pre-highlights ArdoCodeBlock components at build time.\n *\n * Runs before the JSX parser, so children can contain arbitrary code\n * (including `<`, `{`, etc.) without causing syntax errors.\n */\nexport function ardoCodeBlockPlugin(markdownConfig?: MarkdownConfig): Plugin {\n return {\n enforce: \"pre\",\n name: \"ardo:codeblock-highlight\",\n\n async transform(code, id) {\n if (!shouldProcessFile(code, id)) {\n return\n }\n\n const transformed = await transformArdoCodeBlocks(code, markdownConfig)\n if (transformed === code) {\n return\n }\n\n return {\n code: transformed,\n map: null,\n }\n },\n }\n}\n\nfunction shouldProcessFile(code: string, id: string): boolean {\n if (!/\\.[jt]sx$/u.test(id)) {\n return false\n }\n\n if (id.includes(\"node_modules\")) {\n return false\n }\n\n return code.includes(\"ArdoCodeBlock\")\n}\n","import { execSync } from \"node:child_process\"\nimport fs from \"node:fs\"\nimport path from \"node:path\"\n\n/**\n * Finds the package root by looking for package.json in parent directories.\n * Returns the path relative to cwd, or undefined if not found.\n */\nexport function findPackageRoot(cwd: string): string | undefined {\n let currentDir = path.resolve(cwd)\n const filesystemRoot = path.parse(currentDir).root\n\n while (currentDir !== filesystemRoot) {\n const parentDir = path.dirname(currentDir)\n const packageJsonPath = path.join(parentDir, \"package.json\")\n if (fs.existsSync(packageJsonPath)) {\n const relativePath = path.relative(cwd, parentDir)\n return relativePath === \"\" ? \".\" : relativePath\n }\n\n currentDir = parentDir\n }\n\n return undefined\n}\n\n/**\n * Detects the GitHub repository name from git remote URL.\n * Returns the repo name (e.g., \"ardo\" from \"github.com/sebastian-software/ardo\")\n * or undefined if not a GitHub repo.\n */\nexport function detectGitHubRepoName(cwd: string): string | undefined {\n const remoteUrl = runGitCommand(cwd, \"git remote get-url origin\")\n if (remoteUrl == null) {\n return undefined\n }\n\n return parseGitHubRepoName(remoteUrl)\n}\n\n/**\n * Detects the current short git commit hash.\n */\nexport function detectGitHash(cwd: string): string | undefined {\n return runGitCommand(cwd, \"git rev-parse --short HEAD\")\n}\n\n/**\n * Detects the GitHub Pages basename from the git remote URL.\n * Returns \"/\" in dev mode or when no GitHub repo is detected.\n */\nexport function detectGitHubBasename(cwd?: string): string {\n if (process.env.NODE_ENV !== \"production\") {\n return \"/\"\n }\n\n const repoName = detectGitHubRepoName(cwd ?? process.cwd())\n return repoName != null ? `/${repoName}/` : \"/\"\n}\n\n/**\n * Recursively copies files from src to dest, overwriting existing files.\n */\nexport function copyRecursive(src: string, dest: string): void {\n const stat = fs.statSync(src)\n if (!stat.isDirectory()) {\n fs.copyFileSync(src, dest)\n return\n }\n\n if (!fs.existsSync(dest)) {\n fs.mkdirSync(dest, { recursive: true })\n }\n\n for (const item of fs.readdirSync(src)) {\n copyRecursive(path.join(src, item), path.join(dest, item))\n }\n}\n\nfunction runGitCommand(cwd: string, command: string): string | undefined {\n try {\n const commandResult = execSync(command, {\n cwd,\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim()\n\n return commandResult === \"\" ? undefined : commandResult\n } catch {\n return undefined\n }\n}\n\nfunction parseGitHubRepoName(remoteUrl: string): string | undefined {\n const normalizedUrl = remoteUrl.trim()\n if (!normalizedUrl.includes(\"github.com\")) {\n return undefined\n }\n\n const withoutGitSuffix = normalizedUrl.endsWith(\".git\")\n ? normalizedUrl.slice(0, -4)\n : normalizedUrl\n const slashSeparatedUrl = withoutGitSuffix.replace(\":\", \"/\")\n const urlSegments = slashSeparatedUrl.split(\"/\")\n const repoName = urlSegments.at(-1)\n const ownerName = urlSegments.at(-2)\n\n if (repoName == null || repoName === \"\" || ownerName == null || ownerName === \"\") {\n return undefined\n }\n\n return repoName\n}\n","import type { Plugin } from \"vite\"\n\nimport fs from \"node:fs\"\nimport path from \"node:path\"\n\nimport { copyRecursive } from \"./git-utils\"\n\nlet flattenExecuted = false\n\nexport function createFlattenPlugin(): Plugin {\n let detectedBase: string | undefined\n\n return {\n name: \"ardo:flatten-github-pages\",\n enforce: \"post\",\n configResolved(config) {\n detectedBase = config.base === \"/\" ? undefined : config.base\n },\n closeBundle() {\n if (flattenExecuted || detectedBase == null) {\n return\n }\n\n const baseName = trimSlashes(detectedBase)\n if (baseName === \"\") {\n return\n }\n\n const buildDir = path.join(process.cwd(), \"build\", \"client\")\n const nestedDir = path.join(buildDir, baseName)\n if (!fs.existsSync(nestedDir)) {\n return\n }\n\n console.log(`[ardo] Flattening build/client/${baseName}/ to build/client/ for GitHub Pages`)\n copyRecursive(nestedDir, buildDir)\n fs.rmSync(nestedDir, { recursive: true, force: true })\n console.log(\"[ardo] Build output flattened successfully.\")\n flattenExecuted = true\n },\n }\n}\n\nfunction trimSlashes(value: string): string {\n let trimmed = value\n\n while (trimmed.startsWith(\"/\")) {\n trimmed = trimmed.slice(1)\n }\n\n while (trimmed.endsWith(\"/\")) {\n trimmed = trimmed.slice(0, -1)\n }\n\n return trimmed\n}\n","import type { ServerResponse } from \"node:http\"\nimport type { Plugin, ResolvedConfig as ViteResolvedConfig } from \"vite\"\n\nimport { Resvg } from \"@resvg/resvg-js\"\nimport { existsSync } from \"node:fs\"\nimport { readFile } from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport { ARDO_FAVICON_SVG } from \"../ui/favicon\"\n\nconst ICON_FILES = new Set([\"favicon.ico\", \"icon.svg\", \"apple-touch-icon.png\"])\n\nexport type ArdoIconOptions =\n | {\n /**\n * Source SVG file path, resolved from the Vite root.\n * Inline SVG strings are also accepted.\n */\n source?: string\n }\n | false\n\nexport type GeneratedIconAsset = {\n fileName: string\n contentType: string\n source: string | Uint8Array\n}\n\nexport function createIconsPlugin(options: ArdoIconOptions | undefined): Plugin[] {\n if (options === false) {\n return []\n }\n\n let config: ViteResolvedConfig\n let assetsPromise: Promise<GeneratedIconAsset[]> | undefined\n\n const getAssets = async () => {\n assetsPromise ??= createIconAssets(config.root, options)\n return assetsPromise\n }\n\n const plugin: Plugin = {\n name: \"ardo:icons\",\n configResolved(resolvedConfig) {\n config = resolvedConfig\n },\n configureServer(server) {\n server.middlewares.use((request, response, next) => {\n void serveIconRequest({ config, getAssets, response, url: request.url })\n .then((served) => {\n if (!served) {\n next()\n }\n })\n .catch((error: unknown) => {\n if (error instanceof Error) {\n next(error)\n } else {\n next(new Error(String(error)))\n }\n })\n })\n },\n async generateBundle() {\n if (config.build.ssr !== false) {\n return\n }\n\n const assets = await getAssets()\n for (const asset of assets) {\n if (hasPublicAsset(config, asset.fileName)) {\n continue\n }\n\n this.emitFile({\n type: \"asset\",\n fileName: asset.fileName,\n source: asset.source,\n })\n }\n },\n }\n\n return [plugin]\n}\n\nasync function serveIconRequest(input: {\n config: ViteResolvedConfig\n getAssets: () => Promise<GeneratedIconAsset[]>\n response: ServerResponse\n url: string | undefined\n}): Promise<boolean> {\n const { config, getAssets, response, url } = input\n const fileName = getIconRequestFileName(url)\n if (fileName == null || hasPublicAsset(config, fileName)) {\n return false\n }\n\n const assets = await getAssets()\n const asset = assets.find((candidate) => candidate.fileName === fileName)\n if (asset == null) {\n return false\n }\n\n response.statusCode = 200\n response.setHeader(\"Content-Type\", asset.contentType)\n response.setHeader(\"Cache-Control\", \"no-cache\")\n response.end(asset.source)\n return true\n}\n\nexport async function createIconAssets(\n root: string,\n options: Exclude<ArdoIconOptions, false> | undefined\n): Promise<GeneratedIconAsset[]> {\n const svg = await resolveIconSvg(root, options?.source)\n const faviconPng = renderPng(svg, 32)\n const appleTouchIcon = renderPng(svg, 180)\n\n return [\n {\n fileName: \"favicon.ico\",\n contentType: \"image/x-icon\",\n source: createIco(faviconPng, 32),\n },\n {\n fileName: \"icon.svg\",\n contentType: \"image/svg+xml\",\n source: svg,\n },\n {\n fileName: \"apple-touch-icon.png\",\n contentType: \"image/png\",\n source: appleTouchIcon,\n },\n ]\n}\n\nasync function resolveIconSvg(root: string, source: string | undefined): Promise<string> {\n if (source == null) {\n return ARDO_FAVICON_SVG\n }\n\n const trimmedSource = source.trim()\n if (trimmedSource.startsWith(\"<svg\")) {\n return trimmedSource\n }\n\n return readFile(path.resolve(root, source), \"utf8\")\n}\n\nfunction renderPng(svg: string, size: number): Uint8Array {\n return new Resvg(svg, {\n fitTo: {\n mode: \"width\",\n value: size,\n },\n })\n .render()\n .asPng()\n}\n\nfunction createIco(png: Uint8Array, size: number): Uint8Array {\n const headerLength = 6\n const directoryLength = 16\n const imageOffset = headerLength + directoryLength\n const ico = new Uint8Array(imageOffset + png.length)\n const view = new DataView(ico.buffer)\n\n writeIcoHeader(view)\n writeIcoDirectory({ ico, imageOffset, pngLength: png.length, size, view })\n ico.set(png, imageOffset)\n\n return ico\n}\n\nfunction writeIcoHeader(view: DataView): void {\n view.setUint16(0, 0, true)\n view.setUint16(2, 1, true)\n view.setUint16(4, 1, true)\n}\n\nfunction writeIcoDirectory(input: {\n ico: Uint8Array\n imageOffset: number\n pngLength: number\n size: number\n view: DataView\n}): void {\n const { ico, imageOffset, pngLength, size, view } = input\n ico[6] = size >= 256 ? 0 : size\n ico[7] = size >= 256 ? 0 : size\n ico[8] = 0\n ico[9] = 0\n view.setUint16(10, 1, true)\n view.setUint16(12, 32, true)\n view.setUint32(14, pngLength, true)\n view.setUint32(18, imageOffset, true)\n}\n\nfunction getIconRequestFileName(url: string | undefined): string | undefined {\n if (url == null) {\n return undefined\n }\n\n const [pathname] = url.split(\"?\", 1)\n const fileName = pathname.startsWith(\"/\") ? pathname.slice(1) : pathname\n return ICON_FILES.has(fileName) ? fileName : undefined\n}\n\nfunction hasPublicAsset(config: ViteResolvedConfig, fileName: string): boolean {\n return existsSync(path.join(config.publicDir, fileName))\n}\n","import type { ResolvedConfig } from \"../config/types\"\n\ntype MarkdownMetaState = {\n resolvedConfig?: ResolvedConfig\n routesDir: string\n}\n\nexport function transformMarkdownMeta(\n code: string,\n id: string,\n state: MarkdownMetaState\n): { code: string; map: null } | undefined {\n if (!shouldInjectMeta(code, id, state)) {\n return undefined\n }\n\n const pageTitle = extractFrontmatterValue(code, \"title\")\n if (pageTitle == null || pageTitle === \"\") {\n return undefined\n }\n\n const siteTitle = state.resolvedConfig?.title ?? \"Ardo\"\n const titleSeparator = state.resolvedConfig?.titleSeparator ?? \" | \"\n const description = extractFrontmatterValue(code, \"description\")\n const entries = buildMetaEntries({\n pageTitle,\n siteTitle,\n titleSeparator,\n description,\n })\n return { code: `${code}\\nexport const meta = () => [${entries.join(\", \")}];\\n`, map: null }\n}\n\nfunction shouldInjectMeta(code: string, id: string, state: MarkdownMetaState): boolean {\n return isMarkdownFile(id) && id.startsWith(state.routesDir) && !hasMetaExport(code)\n}\n\nfunction buildMetaEntries(input: {\n pageTitle: string\n siteTitle: string\n titleSeparator: string\n description?: string\n}): string[] {\n const fullTitle = `${input.pageTitle}${input.titleSeparator}${input.siteTitle}`\n const entries = [`{ title: ${JSON.stringify(fullTitle)} }`]\n if (input.description != null && input.description !== \"\") {\n entries.push(`{ name: \"description\", content: ${JSON.stringify(input.description)} }`)\n }\n\n return entries\n}\n\nfunction isMarkdownFile(id: string): boolean {\n return id.endsWith(\".md\") || id.endsWith(\".mdx\")\n}\n\nfunction hasMetaExport(code: string): boolean {\n return code.includes(\"export const meta\") || code.includes(\"export function meta\")\n}\n\nfunction extractFrontmatterValue(code: string, key: string): string | undefined {\n const frontmatterStart = code.indexOf(\"export const frontmatter\")\n if (frontmatterStart === -1) {\n return undefined\n }\n\n const valuePrefix = `${key}: \"`\n const valueStart = code.indexOf(valuePrefix, frontmatterStart)\n if (valueStart === -1) {\n return undefined\n }\n\n const startIndex = valueStart + valuePrefix.length\n const endIndex = code.indexOf('\"', startIndex)\n if (endIndex === -1) {\n return undefined\n }\n\n return code.slice(startIndex, endIndex)\n}\n","/**\n * Create an ESTree identifier node for a given name.\n *\n * @param name\n * The name of the identifier.\n * @returns\n * The identifier node.\n */\nfunction identifier(name) {\n return { type: 'Identifier', name };\n}\n/**\n * Create an ESTree literal node for a given value.\n *\n * @param value\n * The value for which to create a literal.\n * @returns\n * The literal node.\n */\nfunction literal(value) {\n return { type: 'Literal', value };\n}\n/**\n * Create an ESTree call expression on an object member.\n *\n * @param object\n * The object to call the method on.\n * @param name\n * The name of the method to call.\n * @param args\n * Arguments to pass to the function call\n * @returns\n * The call expression node.\n */\nfunction methodCall(object, name, args) {\n return {\n type: 'CallExpression',\n optional: false,\n callee: {\n type: 'MemberExpression',\n computed: false,\n optional: false,\n object,\n property: identifier(name)\n },\n arguments: args\n };\n}\n/**\n * Turn a number or bigint into an ESTree expression. This handles positive and negative numbers and\n * bigints as well as special numbers.\n *\n * @param number\n * The value to turn into an ESTree expression.\n * @returns\n * An expression that represents the given value.\n */\nfunction processNumber(number) {\n if (number < 0 || Object.is(number, -0)) {\n return {\n type: 'UnaryExpression',\n operator: '-',\n prefix: true,\n argument: processNumber(-number)\n };\n }\n if (typeof number === 'bigint') {\n return { type: 'Literal', bigint: String(number) };\n }\n if (number === Number.POSITIVE_INFINITY || Number.isNaN(number)) {\n return identifier(String(number));\n }\n return literal(number);\n}\n/**\n * Process an array of numbers. This is a shortcut for iterables whose constructor takes an array of\n * numbers as input.\n *\n * @param numbers\n * The numbers to add to the array expression.\n * @returns\n * An ESTree array expression whose elements match the input numbers.\n */\nfunction processNumberArray(numbers) {\n return { type: 'ArrayExpression', elements: Array.from(numbers, processNumber) };\n}\n/**\n * Check whether a value can be constructed from its string representation.\n *\n * @param value\n * The value to check\n * @returns\n * Whether or not the value can be constructed from its string representation.\n */\nfunction isStringReconstructable(value) {\n return value instanceof URL || value instanceof URLSearchParams;\n}\n/**\n * Check whether a value can be constructed from its `valueOf()` result.\n *\n * @param value\n * The value to check\n * @returns\n * Whether or not the value can be constructed from its `valueOf()` result.\n */\nfunction isValueReconstructable(value) {\n return (value instanceof Boolean ||\n value instanceof Date ||\n value instanceof Number ||\n value instanceof String);\n}\nconst wellKnownSymbols = new Map();\nfor (const name of Reflect.ownKeys(Symbol)) {\n const value = Symbol[name];\n if (typeof value === 'symbol') {\n wellKnownSymbols.set(value, name);\n }\n}\n/**\n * Check whether a value is a Temporal value.\n *\n * @param value\n * The value to check\n * @returns\n * Whether or not the value is a Temporal value.\n */\nfunction isTemporal(value) {\n return (typeof Temporal !== 'undefined' &&\n (value instanceof Temporal.Duration ||\n value instanceof Temporal.Instant ||\n value instanceof Temporal.PlainDate ||\n value instanceof Temporal.PlainDateTime ||\n value instanceof Temporal.PlainYearMonth ||\n value instanceof Temporal.PlainMonthDay ||\n value instanceof Temporal.PlainTime ||\n value instanceof Temporal.ZonedDateTime));\n}\n/**\n * Check whether a value is a typed array.\n *\n * @param value\n * The value to check\n * @returns\n * Whether or not the value is a typed array.\n */\nfunction isTypedArray(value) {\n return (value instanceof BigInt64Array ||\n value instanceof BigUint64Array ||\n (typeof Float16Array !== 'undefined' && value instanceof Float16Array) ||\n value instanceof Float32Array ||\n value instanceof Float64Array ||\n value instanceof Int8Array ||\n value instanceof Int16Array ||\n value instanceof Int32Array ||\n value instanceof Uint8Array ||\n value instanceof Uint8ClampedArray ||\n value instanceof Uint16Array ||\n value instanceof Uint32Array);\n}\n/**\n * Compare two value contexts for sorting them based on reference count.\n *\n * @param a\n * The first context to compare.\n * @param b\n * The second context to compare.\n * @returns\n * The count of context a minus the count of context b.\n */\nfunction compareContexts(a, b) {\n const aReferencedByB = a.referencedBy.has(b.value);\n const bReferencedByA = b.referencedBy.has(a.value);\n if (aReferencedByB) {\n if (bReferencedByA) {\n return a.count - b.count;\n }\n return -1;\n }\n if (bReferencedByA) {\n return 1;\n }\n return a.count - b.count;\n}\n/**\n * Replace the assigned right hand expression with the new expression.\n *\n * If there is no assignment expression, the original expression is returned. Otherwise the\n * assignment is modified and returned.\n *\n * @param expression\n * The expression to use for the assignment.\n * @param assignment\n * The existing assignmentexpression\n * @returns\n * The new expression.\n */\nfunction replaceAssignment(expression, assignment) {\n if (!assignment || assignment.type !== 'AssignmentExpression') {\n return expression;\n }\n let node = assignment;\n while (node.right.type === 'AssignmentExpression') {\n node = node.right;\n }\n node.right = expression;\n return assignment;\n}\n/**\n * Create an ESTree epxression to represent a symbol. Global and well-known symbols are supported.\n *\n * @param symbol\n * The symbol to represent.\n * @returns\n * An ESTree expression to represent the symbol.\n */\nfunction symbolToEstree(symbol) {\n const name = wellKnownSymbols.get(symbol);\n if (name) {\n return {\n type: 'MemberExpression',\n computed: false,\n optional: false,\n object: identifier('Symbol'),\n property: identifier(name)\n };\n }\n if (symbol.description && symbol === Symbol.for(symbol.description)) {\n return methodCall(identifier('Symbol'), 'for', [literal(symbol.description)]);\n }\n throw new TypeError(`Only global symbols are supported, got: ${String(symbol)}`, {\n cause: symbol\n });\n}\n/**\n * Create an ESTree property from a key and a value expression.\n *\n * @param key\n * The property key value\n * @param value\n * The property value as an ESTree expression.\n * @returns\n * The ESTree properry node.\n */\nfunction property(key, value) {\n const isString = typeof key === 'string';\n return {\n type: 'Property',\n method: false,\n shorthand: false,\n computed: key === '__proto__' || !isString,\n kind: 'init',\n key: isString ? literal(key) : symbolToEstree(key),\n value\n };\n}\n/**\n * Convert a value to an ESTree node.\n *\n * @param value\n * The value to convert.\n * @param options\n * Additional options to configure the output.\n * @returns\n * The ESTree node.\n */\nexport function valueToEstree(value, options = {}) {\n const stack = [];\n const collectedContexts = new Map();\n const namedContexts = [];\n const customTrees = new Map();\n /**\n * Analyze a value and collect all reference contexts.\n *\n * @param val\n * The value to analyze.\n */\n function analyze(val) {\n if (typeof val !== 'object' && typeof val !== 'function') {\n return;\n }\n if (val == null) {\n return;\n }\n const context = collectedContexts.get(val);\n if (context) {\n if (options.preserveReferences) {\n context.count += 1;\n }\n for (const ancestor of stack) {\n context.referencedBy.add(ancestor);\n }\n if (stack.includes(val)) {\n if (!options.preserveReferences) {\n throw new Error(`Found circular reference: ${val}`, { cause: val });\n }\n const parent = stack.at(-1);\n const parentContext = collectedContexts.get(parent);\n parentContext.recursive = true;\n context.recursive = true;\n }\n return;\n }\n collectedContexts.set(val, {\n count: 1,\n recursive: false,\n referencedBy: new Set(stack),\n value: val\n });\n const estree = options?.replacer?.(val);\n if (estree) {\n customTrees.set(val, estree);\n return;\n }\n if (typeof val === 'function') {\n throw new TypeError(`Unsupported value: ${val}`, { cause: val });\n }\n if (isTypedArray(val)) {\n return;\n }\n if (isStringReconstructable(val)) {\n return;\n }\n if (isValueReconstructable(val)) {\n return;\n }\n if (value instanceof RegExp) {\n return;\n }\n if (isTemporal(value)) {\n return;\n }\n stack.push(val);\n if (val instanceof Map) {\n for (const pair of val) {\n analyze(pair[0]);\n analyze(pair[1]);\n }\n }\n else if (Array.isArray(val) || val instanceof Set) {\n for (const entry of val) {\n analyze(entry);\n }\n }\n else {\n const proto = Object.getPrototypeOf(val);\n if (proto != null && proto !== Object.prototype && !options.instanceAsObject) {\n throw new TypeError(`Unsupported value: ${val}`, { cause: val });\n }\n for (const key of Reflect.ownKeys(val)) {\n analyze(val[key]);\n }\n }\n stack.pop();\n }\n /**\n * Recursively generate the ESTree expression needed to reconstruct the value.\n *\n * @param val\n * The value to process.\n * @param isDeclaration\n * Whether or not this is for a variable declaration.\n * @returns\n * The ESTree expression to reconstruct the value.\n */\n function generate(val, isDeclaration) {\n if (val === undefined) {\n return identifier(String(val));\n }\n if (val == null || typeof val === 'string' || typeof val === 'boolean') {\n return literal(val);\n }\n if (typeof val === 'bigint' || typeof val === 'number') {\n return processNumber(val);\n }\n if (typeof val === 'symbol') {\n return symbolToEstree(val);\n }\n const context = collectedContexts.get(val);\n if (!isDeclaration && context?.name) {\n return identifier(context.name);\n }\n const tree = customTrees.get(val);\n if (tree) {\n return tree;\n }\n if (isValueReconstructable(val)) {\n return {\n type: 'NewExpression',\n callee: identifier(val.constructor.name),\n arguments: [generate(val.valueOf())]\n };\n }\n if (val instanceof RegExp) {\n return {\n type: 'Literal',\n regex: { pattern: val.source, flags: val.flags }\n };\n }\n if (typeof Buffer !== 'undefined' && Buffer.isBuffer(val)) {\n return methodCall(identifier('Buffer'), 'from', [processNumberArray(val)]);\n }\n if (isTypedArray(val)) {\n return {\n type: 'NewExpression',\n callee: identifier(val.constructor.name),\n arguments: [processNumberArray(val)]\n };\n }\n if (isStringReconstructable(val)) {\n return {\n type: 'NewExpression',\n callee: identifier(val.constructor.name),\n arguments: [literal(String(val))]\n };\n }\n if (isTemporal(val)) {\n return methodCall({\n type: 'MemberExpression',\n computed: false,\n optional: false,\n object: identifier('Temporal'),\n property: identifier(val.constructor.name)\n }, 'from', [literal(String(val))]);\n }\n if (Array.isArray(val)) {\n const elements = Array.from({ length: val.length });\n let trimmable;\n for (let index = 0; index < val.length; index += 1) {\n if (!(index in val)) {\n elements[index] = null;\n trimmable = undefined;\n continue;\n }\n const child = val[index];\n const childContext = collectedContexts.get(child);\n if (context &&\n childContext &&\n namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) {\n elements[index] = null;\n trimmable ||= index;\n childContext.assignment = {\n type: 'AssignmentExpression',\n operator: '=',\n left: {\n type: 'MemberExpression',\n computed: true,\n optional: false,\n object: identifier(context.name),\n property: literal(index)\n },\n right: childContext.assignment || identifier(childContext.name)\n };\n }\n else {\n elements[index] = generate(child);\n trimmable = undefined;\n }\n }\n if (trimmable != null) {\n elements.splice(trimmable);\n }\n return {\n type: 'ArrayExpression',\n elements\n };\n }\n if (val instanceof Set) {\n const elements = [];\n let finalizer;\n for (const child of val) {\n if (finalizer) {\n finalizer = methodCall(finalizer, 'add', [generate(child)]);\n }\n else {\n const childContext = collectedContexts.get(child);\n if (context &&\n childContext &&\n namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) {\n finalizer = methodCall(identifier(context.name), 'add', [generate(child)]);\n }\n else {\n elements.push(generate(child));\n }\n }\n }\n if (context && finalizer) {\n context.assignment = replaceAssignment(finalizer, context.assignment);\n }\n return {\n type: 'NewExpression',\n callee: identifier('Set'),\n arguments: elements.length ? [{ type: 'ArrayExpression', elements }] : []\n };\n }\n if (val instanceof Map) {\n const elements = [];\n let finalizer;\n for (const [key, item] of val) {\n if (finalizer) {\n finalizer = methodCall(finalizer, 'set', [generate(key), generate(item)]);\n }\n else {\n const keyContext = collectedContexts.get(key);\n const itemContext = collectedContexts.get(item);\n if (context &&\n ((keyContext && namedContexts.indexOf(keyContext) >= namedContexts.indexOf(context)) ||\n (itemContext && namedContexts.indexOf(itemContext) >= namedContexts.indexOf(context)))) {\n finalizer = methodCall(identifier(context.name), 'set', [\n generate(key),\n generate(item)\n ]);\n }\n else {\n elements.push({\n type: 'ArrayExpression',\n elements: [generate(key), generate(item)]\n });\n }\n }\n }\n if (context && finalizer) {\n context.assignment = replaceAssignment(finalizer, context.assignment);\n }\n return {\n type: 'NewExpression',\n callee: identifier('Map'),\n arguments: elements.length ? [{ type: 'ArrayExpression', elements }] : []\n };\n }\n const properties = [];\n if (Object.getPrototypeOf(val) == null) {\n properties.push({\n type: 'Property',\n method: false,\n shorthand: false,\n computed: false,\n kind: 'init',\n key: identifier('__proto__'),\n value: literal(null)\n });\n }\n const object = val;\n const propertyDescriptors = [];\n for (const key of Reflect.ownKeys(val)) {\n // TODO [>=4] Throw an error for getters.\n const child = object[key];\n const { configurable, enumerable, writable } = Object.getOwnPropertyDescriptor(val, key);\n const childContext = collectedContexts.get(child);\n if (!configurable || !enumerable || !writable) {\n const propertyDescriptor = [property('value', generate(child))];\n if (configurable) {\n propertyDescriptor.push(property('configurable', literal(true)));\n }\n if (enumerable) {\n propertyDescriptor.push(property('enumerable', literal(true)));\n }\n if (writable) {\n propertyDescriptor.push(property('writable', literal(true)));\n }\n propertyDescriptors.push([\n key,\n { type: 'ObjectExpression', properties: propertyDescriptor }\n ]);\n }\n else if (context &&\n childContext &&\n namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) {\n if (key === '__proto__') {\n propertyDescriptors.push([\n key,\n {\n type: 'ObjectExpression',\n properties: [\n property('value', generate(child)),\n property('configurable', literal(true)),\n property('enumerable', literal(true)),\n property('writable', literal(true))\n ]\n }\n ]);\n }\n else {\n childContext.assignment = {\n type: 'AssignmentExpression',\n operator: '=',\n left: {\n type: 'MemberExpression',\n computed: true,\n optional: false,\n object: identifier(context.name),\n property: generate(key)\n },\n right: childContext.assignment || generate(child)\n };\n }\n }\n else {\n properties.push(property(key, generate(child)));\n }\n }\n const objectExpression = {\n type: 'ObjectExpression',\n properties\n };\n if (propertyDescriptors.length) {\n let name;\n let args;\n if (propertyDescriptors.length === 1) {\n const [[key, expression]] = propertyDescriptors;\n name = 'defineProperty';\n args = [typeof key === 'string' ? literal(key) : symbolToEstree(key), expression];\n }\n else {\n name = 'defineProperties';\n args = [\n {\n type: 'ObjectExpression',\n properties: propertyDescriptors.map(([key, expression]) => property(key, expression))\n }\n ];\n }\n if (!context) {\n return methodCall(identifier('Object'), name, [objectExpression, ...args]);\n }\n context.assignment = replaceAssignment(methodCall(identifier('Object'), name, [identifier(context.name), ...args]), context.assignment);\n }\n return objectExpression;\n }\n analyze(value);\n for (const [val, context] of collectedContexts) {\n if (context.recursive || context.count > 1) {\n // Assign reused or recursive references to a variable.\n context.name = `$${namedContexts.length}`;\n namedContexts.push(context);\n }\n else {\n // Otherwise don’t treat it as a reference.\n collectedContexts.delete(val);\n }\n }\n if (!namedContexts.length) {\n return generate(value);\n }\n const params = namedContexts.sort(compareContexts).map((context) => ({\n type: 'AssignmentPattern',\n left: identifier(context.name),\n right: generate(context.value, true)\n }));\n const rootContext = collectedContexts.get(value);\n const finalizers = [];\n for (const context of collectedContexts.values()) {\n if (context !== rootContext && context.assignment) {\n finalizers.push(context.assignment);\n }\n }\n finalizers.push(rootContext ? rootContext.assignment || identifier(rootContext.name) : generate(value));\n return {\n type: 'CallExpression',\n optional: false,\n arguments: [],\n callee: {\n type: 'ArrowFunctionExpression',\n expression: false,\n params,\n body: {\n type: 'SequenceExpression',\n expressions: finalizers\n }\n }\n };\n}\n//# sourceMappingURL=estree-util-value-to-estree.js.map","/**\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [jsx=false]\n * Support JSX identifiers (default: `false`).\n */\n\nconst startRe = /[$_\\p{ID_Start}]/u\nconst contRe = /[$_\\u{200C}\\u{200D}\\p{ID_Continue}]/u\nconst contReJsx = /[-$_\\u{200C}\\u{200D}\\p{ID_Continue}]/u\nconst nameRe = /^[$_\\p{ID_Start}][$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u\nconst nameReJsx = /^[$_\\p{ID_Start}][-$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Checks if the given code point can start an identifier.\n *\n * @param {number | undefined} code\n * Code point to check.\n * @returns {boolean}\n * Whether `code` can start an identifier.\n */\n// Note: `undefined` is supported so you can pass the result from `''.codePointAt`.\nexport function start(code) {\n return code ? startRe.test(String.fromCodePoint(code)) : false\n}\n\n/**\n * Checks if the given code point can continue an identifier.\n *\n * @param {number | undefined} code\n * Code point to check.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {boolean}\n * Whether `code` can continue an identifier.\n */\n// Note: `undefined` is supported so you can pass the result from `''.codePointAt`.\nexport function cont(code, options) {\n const settings = options || emptyOptions\n const re = settings.jsx ? contReJsx : contRe\n return code ? re.test(String.fromCodePoint(code)) : false\n}\n\n/**\n * Checks if the given value is a valid identifier name.\n *\n * @param {string} name\n * Identifier to check.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {boolean}\n * Whether `name` can be an identifier.\n */\nexport function name(name, options) {\n const settings = options || emptyOptions\n const re = settings.jsx ? nameReJsx : nameRe\n return re.test(name)\n}\n","export function deprecate(fn) {\n return fn\n}\n\nexport function equal() {}\n\nexport function ok() {}\n\nexport function unreachable() {}\n","/**\n * @import {Node, Pattern} from 'estree'\n * @import {Scope, Visitors} from './types.js'\n */\n\nimport {ok as assert} from 'devlop'\n\n/**\n * Create state to track what’s defined.\n *\n * @returns {Visitors}\n * State.\n */\nexport function createVisitors() {\n /** @type {[topLevel: Scope, ...rest: Array<Scope>]} */\n const scopes = [{block: false, defined: []}]\n\n return {enter, exit, scopes}\n\n /**\n * @param {Node} node\n * Node.\n * @returns {undefined}\n * Nothing.\n */\n function enter(node) {\n // On arrow functions, create scope, add parameters.\n if (node.type === 'ArrowFunctionExpression') {\n scopes.push({block: false, defined: []})\n\n for (const parameter of node.params) {\n definePattern(parameter, false)\n }\n }\n // On block statements, create scope.\n // Not sure why `periscopic` only does `Block`/`For`/`ForIn`/`ForOf`.\n // I added `DoWhile`/`While` here just to be sure.\n else if (\n node.type === 'BlockStatement' ||\n node.type === 'DoWhileStatement' ||\n node.type === 'ForInStatement' ||\n node.type === 'ForOfStatement' ||\n node.type === 'ForStatement' ||\n node.type === 'WhileStatement'\n ) {\n scopes.push({block: true, defined: []})\n }\n\n // On catch clauses, create scope, add param.\n else if (node.type === 'CatchClause') {\n scopes.push({block: true, defined: []})\n if (node.param) definePattern(node.param, true)\n }\n\n // Add identifier of class declaration.\n else if (node.type === 'ClassDeclaration') {\n defineIdentifier(node.id.name, false)\n }\n\n // On function declarations, add name, create scope, add parameters.\n else if (node.type === 'FunctionDeclaration') {\n defineIdentifier(node.id.name, false)\n scopes.push({block: false, defined: []})\n\n for (const parameter of node.params) {\n definePattern(parameter, false)\n }\n }\n\n // On function expressions, add name, create scope, add parameters.\n else if (node.type === 'FunctionExpression') {\n if (node.id) defineIdentifier(node.id.name, false)\n scopes.push({block: false, defined: []})\n\n for (const parameter of node.params) {\n definePattern(parameter, false)\n }\n }\n\n // Add specifiers of import declarations.\n else if (node.type === 'ImportDeclaration') {\n for (const specifier of node.specifiers) {\n defineIdentifier(specifier.local.name, false)\n }\n }\n\n // Add patterns of variable declarations.\n else if (node.type === 'VariableDeclaration') {\n for (const declaration of node.declarations) {\n definePattern(declaration.id, node.kind !== 'var')\n }\n }\n }\n\n /**\n * @param {Node} node\n * Node.\n * @returns {undefined}\n * Nothing.\n */\n function exit(node) {\n if (\n node.type === 'ArrowFunctionExpression' ||\n node.type === 'FunctionDeclaration' ||\n node.type === 'FunctionExpression'\n ) {\n const scope = scopes.pop()\n assert(scope, 'expected scope')\n assert(!scope.block, 'expected non-block')\n } else if (\n node.type === 'BlockStatement' ||\n node.type === 'CatchClause' ||\n node.type === 'DoWhileStatement' ||\n node.type === 'ForInStatement' ||\n node.type === 'ForOfStatement' ||\n node.type === 'ForStatement' ||\n node.type === 'WhileStatement'\n ) {\n const scope = scopes.pop()\n assert(scope, 'expected scope')\n assert(scope.block, 'expected block')\n }\n }\n\n /**\n * Define an identifier in a scope.\n *\n * @param {string} id\n * @param {boolean} block\n * @returns {undefined}\n */\n function defineIdentifier(id, block) {\n let index = scopes.length\n /** @type {Scope | undefined} */\n let scope\n\n while (index--) {\n scope = scopes[index]\n\n if (block || !scope.block) {\n break\n }\n }\n\n assert(scope)\n scope.defined.push(id)\n }\n\n /**\n * Define a pattern in a scope.\n *\n * @param {Pattern} pattern\n * @param {boolean} block\n */\n function definePattern(pattern, block) {\n // `[, x]`\n if (pattern.type === 'ArrayPattern') {\n for (const element of pattern.elements) {\n if (element) {\n definePattern(element, block)\n }\n }\n }\n\n // `{x=y}`\n else if (pattern.type === 'AssignmentPattern') {\n definePattern(pattern.left, block)\n }\n\n // `x`\n else if (pattern.type === 'Identifier') {\n defineIdentifier(pattern.name, block)\n }\n\n // `{x}`\n else if (pattern.type === 'ObjectPattern') {\n for (const property of pattern.properties) {\n // `{key}`, `{key = value}`, `{key: value}`\n if (property.type === 'Property') {\n definePattern(property.value, block)\n }\n // `{...x}`\n else {\n assert(property.type === 'RestElement')\n definePattern(property, block)\n }\n }\n }\n\n // `...x`\n else {\n assert(pattern.type === 'RestElement')\n definePattern(pattern.argument, block)\n }\n }\n}\n","/**\n * @typedef { import('estree').Node} Node\n * @typedef {{\n * skip: () => void;\n * remove: () => void;\n * replace: (node: Node) => void;\n * }} WalkerContext\n */\n\nexport class WalkerBase {\n\tconstructor() {\n\t\t/** @type {boolean} */\n\t\tthis.should_skip = false;\n\n\t\t/** @type {boolean} */\n\t\tthis.should_remove = false;\n\n\t\t/** @type {Node | null} */\n\t\tthis.replacement = null;\n\n\t\t/** @type {WalkerContext} */\n\t\tthis.context = {\n\t\t\tskip: () => (this.should_skip = true),\n\t\t\tremove: () => (this.should_remove = true),\n\t\t\treplace: (node) => (this.replacement = node)\n\t\t};\n\t}\n\n\t/**\n\t * @template {Node} Parent\n\t * @param {Parent | null | undefined} parent\n\t * @param {keyof Parent | null | undefined} prop\n\t * @param {number | null | undefined} index\n\t * @param {Node} node\n\t */\n\treplace(parent, prop, index, node) {\n\t\tif (parent && prop) {\n\t\t\tif (index != null) {\n\t\t\t\t/** @type {Array<Node>} */ (parent[prop])[index] = node;\n\t\t\t} else {\n\t\t\t\t/** @type {Node} */ (parent[prop]) = node;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @template {Node} Parent\n\t * @param {Parent | null | undefined} parent\n\t * @param {keyof Parent | null | undefined} prop\n\t * @param {number | null | undefined} index\n\t */\n\tremove(parent, prop, index) {\n\t\tif (parent && prop) {\n\t\t\tif (index !== null && index !== undefined) {\n\t\t\t\t/** @type {Array<Node>} */ (parent[prop]).splice(index, 1);\n\t\t\t} else {\n\t\t\t\tdelete parent[prop];\n\t\t\t}\n\t\t}\n\t}\n}\n","import { WalkerBase } from './walker.js';\n\n/**\n * @typedef { import('estree').Node} Node\n * @typedef { import('./walker.js').WalkerContext} WalkerContext\n * @typedef {(\n * this: WalkerContext,\n * node: Node,\n * parent: Node | null,\n * key: string | number | symbol | null | undefined,\n * index: number | null | undefined\n * ) => void} SyncHandler\n */\n\nexport class SyncWalker extends WalkerBase {\n\t/**\n\t *\n\t * @param {SyncHandler} [enter]\n\t * @param {SyncHandler} [leave]\n\t */\n\tconstructor(enter, leave) {\n\t\tsuper();\n\n\t\t/** @type {boolean} */\n\t\tthis.should_skip = false;\n\n\t\t/** @type {boolean} */\n\t\tthis.should_remove = false;\n\n\t\t/** @type {Node | null} */\n\t\tthis.replacement = null;\n\n\t\t/** @type {WalkerContext} */\n\t\tthis.context = {\n\t\t\tskip: () => (this.should_skip = true),\n\t\t\tremove: () => (this.should_remove = true),\n\t\t\treplace: (node) => (this.replacement = node)\n\t\t};\n\n\t\t/** @type {SyncHandler | undefined} */\n\t\tthis.enter = enter;\n\n\t\t/** @type {SyncHandler | undefined} */\n\t\tthis.leave = leave;\n\t}\n\n\t/**\n\t * @template {Node} Parent\n\t * @param {Node} node\n\t * @param {Parent | null} parent\n\t * @param {keyof Parent} [prop]\n\t * @param {number | null} [index]\n\t * @returns {Node | null}\n\t */\n\tvisit(node, parent, prop, index) {\n\t\tif (node) {\n\t\t\tif (this.enter) {\n\t\t\t\tconst _should_skip = this.should_skip;\n\t\t\t\tconst _should_remove = this.should_remove;\n\t\t\t\tconst _replacement = this.replacement;\n\t\t\t\tthis.should_skip = false;\n\t\t\t\tthis.should_remove = false;\n\t\t\t\tthis.replacement = null;\n\n\t\t\t\tthis.enter.call(this.context, node, parent, prop, index);\n\n\t\t\t\tif (this.replacement) {\n\t\t\t\t\tnode = this.replacement;\n\t\t\t\t\tthis.replace(parent, prop, index, node);\n\t\t\t\t}\n\n\t\t\t\tif (this.should_remove) {\n\t\t\t\t\tthis.remove(parent, prop, index);\n\t\t\t\t}\n\n\t\t\t\tconst skipped = this.should_skip;\n\t\t\t\tconst removed = this.should_remove;\n\n\t\t\t\tthis.should_skip = _should_skip;\n\t\t\t\tthis.should_remove = _should_remove;\n\t\t\t\tthis.replacement = _replacement;\n\n\t\t\t\tif (skipped) return node;\n\t\t\t\tif (removed) return null;\n\t\t\t}\n\n\t\t\t/** @type {keyof Node} */\n\t\t\tlet key;\n\n\t\t\tfor (key in node) {\n\t\t\t\t/** @type {unknown} */\n\t\t\t\tconst value = node[key];\n\n\t\t\t\tif (value && typeof value === 'object') {\n\t\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t\tconst nodes = /** @type {Array<unknown>} */ (value);\n\t\t\t\t\t\tfor (let i = 0; i < nodes.length; i += 1) {\n\t\t\t\t\t\t\tconst item = nodes[i];\n\t\t\t\t\t\t\tif (isNode(item)) {\n\t\t\t\t\t\t\t\tif (!this.visit(item, node, key, i)) {\n\t\t\t\t\t\t\t\t\t// removed\n\t\t\t\t\t\t\t\t\ti--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (isNode(value)) {\n\t\t\t\t\t\tthis.visit(value, node, key, null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.leave) {\n\t\t\t\tconst _replacement = this.replacement;\n\t\t\t\tconst _should_remove = this.should_remove;\n\t\t\t\tthis.replacement = null;\n\t\t\t\tthis.should_remove = false;\n\n\t\t\t\tthis.leave.call(this.context, node, parent, prop, index);\n\n\t\t\t\tif (this.replacement) {\n\t\t\t\t\tnode = this.replacement;\n\t\t\t\t\tthis.replace(parent, prop, index, node);\n\t\t\t\t}\n\n\t\t\t\tif (this.should_remove) {\n\t\t\t\t\tthis.remove(parent, prop, index);\n\t\t\t\t}\n\n\t\t\t\tconst removed = this.should_remove;\n\n\t\t\t\tthis.replacement = _replacement;\n\t\t\t\tthis.should_remove = _should_remove;\n\n\t\t\t\tif (removed) return null;\n\t\t\t}\n\t\t}\n\n\t\treturn node;\n\t}\n}\n\n/**\n * Ducktype a node.\n *\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction isNode(value) {\n\treturn (\n\t\tvalue !== null && typeof value === 'object' && 'type' in value && typeof value.type === 'string'\n\t);\n}\n","import { SyncWalker } from './sync.js';\nimport { AsyncWalker } from './async.js';\n\n/**\n * @typedef {import('estree').Node} Node\n * @typedef {import('./sync.js').SyncHandler} SyncHandler\n * @typedef {import('./async.js').AsyncHandler} AsyncHandler\n */\n\n/**\n * @param {Node} ast\n * @param {{\n * enter?: SyncHandler\n * leave?: SyncHandler\n * }} walker\n * @returns {Node | null}\n */\nexport function walk(ast, { enter, leave }) {\n\tconst instance = new SyncWalker(enter, leave);\n\treturn instance.visit(ast, null);\n}\n\n/**\n * @param {Node} ast\n * @param {{\n * enter?: AsyncHandler\n * leave?: AsyncHandler\n * }} walker\n * @returns {Promise<Node | null>}\n */\nexport async function asyncWalk(ast, { enter, leave }) {\n\tconst instance = new AsyncWalker(enter, leave);\n\treturn await instance.visit(ast, null);\n}\n","import { name as isIdentifierName } from 'estree-util-is-identifier-name';\nimport { createVisitors } from 'estree-util-scope';\nimport { walk } from 'estree-walker';\n/**\n * @param program\n * The ESTree program to scan.\n * @param file\n * The {@link VFile} to emit warnings to.\n * @param variables\n * The variables that should be injected.\n * @param options\n * {@link define}.options\n * @returns\n * The position in the body where the export may be injected.\n */\nfunction scan(program, file, variables, options) {\n const visitors = createVisitors();\n const [scope] = visitors.scopes;\n const identifiers = new Map();\n let injectIndex = 0;\n walk(program, {\n enter(node, parent) {\n visitors.enter(node);\n switch (node.type) {\n case 'Identifier':\n if (scope.defined.includes(node.name) && !identifiers.has(node.name)) {\n identifiers.set(node.name, node);\n }\n break;\n case 'ArrowFunctionExpression':\n case 'ClassDeclaration':\n case 'ClassExpression':\n case 'FunctionExpression':\n case 'FunctionDeclaration':\n this.skip();\n break;\n // Don’t insert before directives.\n case 'ExpressionStatement':\n if (parent === program &&\n node.expression.type === 'Literal' &&\n typeof node.expression.value === 'string') {\n injectIndex = program.body.indexOf(node) + 1;\n }\n break;\n default:\n }\n },\n leave: visitors.exit\n });\n for (const name of scope.defined) {\n if (variables.has(name)) {\n if (options?.conflict !== 'skip') {\n const identifier = identifiers.get(name);\n const message = file.message(`Variable name conflict: ${name}`, {\n place: identifier?.loc,\n ruleId: 'conflict',\n source: 'unist-util-mdx-define'\n });\n message.url = 'https://github.com/remcohaszing/unist-util-mdx-define';\n if (options?.conflict !== 'warn') {\n message.fatal = true;\n throw message;\n }\n }\n variables.delete(name);\n }\n }\n return injectIndex;\n}\n/**\n * Generate an export named declaration.\n *\n * @param variables\n * The variables for which to generate an declaration.\n * @param options\n * {@link define} options\n * @param returnStatement\n * The return statement of the program to inject into.\n * @returns\n * The export named declaration.\n */\nfunction generate(variables, options, returnStatement) {\n if (options?.export === 'namespace') {\n const statements = [];\n for (const [name, right] of variables) {\n const isIdentifier = isIdentifierName(name);\n statements.push({\n type: 'ExpressionStatement',\n expression: {\n type: 'AssignmentExpression',\n left: {\n type: 'MemberExpression',\n computed: !isIdentifier,\n object: { type: 'Identifier', name: 'MDXContent' },\n optional: false,\n property: isIdentifier ? { type: 'Identifier', name } : { type: 'Literal', value: name }\n },\n operator: '=',\n right\n }\n });\n }\n return statements;\n }\n const declarations = [];\n for (const [name, init] of variables) {\n declarations.push({\n type: 'VariableDeclaration',\n kind: 'const',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: { type: 'Identifier', name },\n init\n }\n ]\n });\n }\n if (options?.export === false) {\n return declarations;\n }\n if (!returnStatement) {\n return declarations.map((declaration) => ({\n type: 'ExportNamedDeclaration',\n declaration,\n specifiers: []\n }));\n }\n if (returnStatement.argument?.type === 'ObjectExpression') {\n returnStatement.argument.properties.splice(-1, 0, ...Array.from(variables.keys(), (name) => ({\n type: 'Property',\n computed: false,\n kind: 'init',\n method: false,\n shorthand: true,\n key: { type: 'Identifier', name },\n value: { type: 'Identifier', name }\n })));\n }\n return declarations;\n}\n/**\n * Define variables in an MDX related AST.\n *\n * @param ast\n * The AST in which to define an export\n * @param file\n * The {@link VFile} to emit warnings to.\n * @param variables\n * A mapping of variables to define. They keys are the names. The values are the ESTree expression\n * to represent them.\n * @param options\n * Additional options to configure behaviour.\n */\nexport function define(ast, file, variables, options) {\n const map = new Map(Object.entries(variables));\n if (options?.export !== 'namespace') {\n for (const name of map.keys()) {\n if (name === '_createMdxContent' ||\n name === '_Fragment' ||\n name === '_jsx' ||\n name === '_jsxs' ||\n name === '_missingMdxReference' ||\n name === 'MDXContent') {\n const message = file.message(`MDX internal name conflict: ${name}`, {\n ruleId: 'internal',\n source: 'unist-util-mdx-define'\n });\n message.url = 'https://github.com/remcohaszing/unist-util-mdx-define';\n message.fatal = true;\n throw message;\n }\n if (!isIdentifierName(name)) {\n const message = file.message(`Invalid identifier name: ${name}`, {\n ruleId: 'invalid-identifier',\n source: 'unist-util-mdx-define'\n });\n message.url = 'https://github.com/remcohaszing/unist-util-mdx-define';\n message.fatal = true;\n throw message;\n }\n }\n }\n if (ast.type === 'root') {\n for (const child of ast.children) {\n if (child.type !== 'mdxjsEsm') {\n continue;\n }\n const program = child.data?.estree;\n /* c8 ignore start */\n if (!program) {\n continue;\n }\n /* c8 ignore stop */\n scan(program, file, map, options);\n }\n if (map.size) {\n ast.children.unshift({\n type: 'mdxjsEsm',\n value: '',\n data: {\n estree: {\n type: 'Program',\n sourceType: 'module',\n body: generate(map, options)\n }\n }\n });\n }\n }\n else {\n const returnStatement = ast.body.find((node) => node.type === 'ReturnStatement');\n const injectIndex = scan(ast, file, map, options);\n if (map.size) {\n ast.body.splice(injectIndex, 0, ...generate(map, options, returnStatement));\n }\n }\n}\n//# sourceMappingURL=unist-util-mdx-define.js.map","/**\n * Remark plugin that extracts headings from MDX and exports them as `toc`.\n *\n * Adds `export const toc = [...]` to the MDX module, similar to how\n * `remark-mdx-frontmatter` exports frontmatter.\n */\nimport type { Heading, Root } from \"mdast\"\n\nimport { valueToEstree } from \"estree-util-value-to-estree\"\nimport { define } from \"unist-util-mdx-define\"\nimport { visit } from \"unist-util-visit\"\n\nimport type { TOCItem } from \"../config/types\"\n\ntype RemarkMdxTocOptions = {\n /** Export name (default: \"toc\") */\n name?: string\n /** Heading levels to include (default: [2, 3]) */\n levels?: [number, number]\n}\n\nexport function remarkMdxToc(options: RemarkMdxTocOptions = {}) {\n const { name = \"toc\", levels = [2, 3] } = options\n const [minLevel, maxLevel] = levels\n\n return function (tree: Root, file: Parameters<typeof define>[1]) {\n const items: TOCItem[] = []\n let headingIndex = 0\n\n visit(tree, \"heading\", (node: Heading) => {\n if (node.depth < minLevel || node.depth > maxLevel) return\n\n const text = getHeadingText(node)\n const slug = slugify(text)\n const id = slug === \"\" ? `heading-${String(headingIndex)}` : slug\n headingIndex++\n\n items.push({ id, text, level: node.depth })\n\n // Add id to the heading node for anchor links\n const hProperties = ensureHProperties(node)\n hProperties.id = id\n })\n\n // Use the same approach as remark-mdx-frontmatter: valueToEstree + define\n define(tree, file, { [name]: valueToEstree(items) })\n }\n}\n\nfunction getHeadingText(node: Heading): string {\n const parts: string[] = []\n\n function extract(child: unknown) {\n if (!isRecord(child)) return\n\n if (child.type === \"text\" || child.type === \"inlineCode\") {\n parts.push(typeof child.value === \"string\" ? child.value : \"\")\n } else if (Array.isArray(child.children)) {\n for (const nested of child.children) extract(nested)\n }\n }\n\n for (const child of node.children) extract(child)\n return parts.join(\"\")\n}\n\nfunction slugify(text: string): string {\n let slug = text\n .toLowerCase()\n .trim()\n .replaceAll(/[^\\s\\w-]/g, \"\")\n .replaceAll(/[\\s_]/g, \"-\")\n\n while (slug.includes(\"--\")) {\n slug = slug.replaceAll(\"--\", \"-\")\n }\n\n return slug.replaceAll(/^-|-$/g, \"\")\n}\n\ntype HeadingDataWithHProperties = {\n hProperties?: Record<string, unknown>\n} & Heading[\"data\"]\n\nfunction ensureHProperties(node: Heading): Record<string, unknown> {\n const data: HeadingDataWithHProperties = node.data ?? {}\n node.data = data\n\n if (!isRecord(data.hProperties)) {\n data.hProperties = {}\n }\n\n return data.hProperties\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n","/**\n * Recma plugin that wraps the MDX default export with ArdoPageDataProvider\n * to inject frontmatter + toc into the React context for TOC and content.\n */\n\ntype EstreeProgram = {\n type: string\n body: EstreeNode[]\n}\n\ntype EstreeNode = {\n type: string\n declaration?: EstreeNode\n id?: { type?: string; name: string }\n [key: string]: unknown\n}\n\nfunction findDefaultExport(body: EstreeNode[]): { index: number; name: string } {\n for (const [i, node] of body.entries()) {\n if (\n node.type === \"ExportDefaultDeclaration\" &&\n node.declaration?.type === \"FunctionDeclaration\" &&\n node.declaration.id?.name !== undefined &&\n node.declaration.id.name !== \"\"\n ) {\n return { index: i, name: node.declaration.id.name }\n }\n }\n return { index: -1, name: \"\" }\n}\n\nfunction createImport(imported: string, local: string, source: string): EstreeNode {\n return {\n type: \"ImportDeclaration\",\n specifiers: [\n {\n type: \"ImportSpecifier\",\n imported: { type: \"Identifier\", name: imported },\n local: { type: \"Identifier\", name: local },\n },\n ],\n source: { type: \"Literal\", value: source },\n }\n}\n\nfunction createShorthandProp(name: string): EstreeNode {\n return {\n type: \"Property\",\n key: { type: \"Identifier\", name },\n value: { type: \"Identifier\", name },\n kind: \"init\",\n shorthand: true,\n computed: false,\n method: false,\n }\n}\n\nfunction createWrapperFunction(fnName: string): EstreeNode {\n return {\n type: \"FunctionDeclaration\",\n id: { type: \"Identifier\", name: \"_ArdoWrapped\" },\n params: [{ type: \"Identifier\", name: \"props\" }],\n body: {\n type: \"BlockStatement\",\n body: [\n {\n type: \"ReturnStatement\",\n argument: {\n type: \"CallExpression\",\n callee: { type: \"Identifier\", name: \"_ardoJsx\" },\n arguments: [\n { type: \"Identifier\", name: \"_ArdoPageDP\" },\n {\n type: \"ObjectExpression\",\n properties: [\n createShorthandProp(\"frontmatter\"),\n createShorthandProp(\"toc\"),\n {\n type: \"Property\",\n key: { type: \"Identifier\", name: \"children\" },\n value: {\n type: \"CallExpression\",\n callee: { type: \"Identifier\", name: \"_ardoJsx\" },\n arguments: [\n { type: \"Identifier\", name: fnName },\n { type: \"Identifier\", name: \"props\" },\n ],\n optional: false,\n },\n kind: \"init\",\n shorthand: false,\n computed: false,\n method: false,\n },\n ],\n },\n ],\n optional: false,\n },\n },\n ],\n },\n generator: false,\n async: false,\n }\n}\n\n// eslint-disable-next-line @cspell/spellchecker\nexport function recmaWrapExport() {\n return (tree: EstreeProgram) => {\n const { index, name } = findDefaultExport(tree.body)\n if (index === -1) return\n\n // Remove `export default` — keep just the function declaration\n const decl = tree.body[index].declaration\n if (decl == null) return\n tree.body[index] = decl\n\n // Add imports, wrapper, and new default export\n tree.body.unshift(\n createImport(\"ArdoPageDataProvider\", \"_ArdoPageDP\", \"ardo/runtime\"),\n createImport(\"jsx\", \"_ardoJsx\", \"react/jsx-runtime\")\n )\n tree.body.push(createWrapperFunction(name), {\n type: \"ExportDefaultDeclaration\",\n declaration: { type: \"Identifier\", name: \"_ArdoWrapped\" },\n })\n }\n}\n","import type { Plugin } from \"vite\"\n\nimport mdx from \"@mdx-js/rollup\"\nimport { reactRouter } from \"@react-router/dev/vite\"\nimport rehypeShiki from \"@shikijs/rehype\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkMdxFrontmatter from \"remark-mdx-frontmatter\"\n\nimport type { ArdoConfig } from \"../config/types\"\n\nimport { defaultMarkdownConfig } from \"../config/index\"\nimport { remarkMdxToc } from \"../markdown/remark-mdx-toc\"\nimport { ardoLineTransformer, remarkCodeMeta } from \"../markdown/shiki\"\nimport { recmaWrapExport } from \"./recma-wrap-export\"\n\nexport function createMdxPlugin(markdownConfig: ArdoConfig[\"markdown\"]): Plugin {\n const themeConfig = markdownConfig?.theme ?? defaultMarkdownConfig.theme\n const lineNumbers = markdownConfig?.lineNumbers ?? false\n const shikiOptions = isShikiThemeObject(themeConfig)\n ? {\n themes: { light: themeConfig.light, dark: themeConfig.dark },\n defaultColor: false as const,\n transformers: [ardoLineTransformer({ globalLineNumbers: lineNumbers })],\n }\n : {\n theme: themeConfig,\n transformers: [ardoLineTransformer({ globalLineNumbers: lineNumbers })],\n }\n\n return mdx({\n include: /\\.(md|mdx)$/,\n remarkPlugins: [\n remarkFrontmatter,\n [remarkMdxFrontmatter, { name: \"frontmatter\" }],\n remarkGfm,\n remarkCodeMeta,\n [remarkMdxToc, { levels: markdownConfig?.toc?.level ?? [2, 3] }],\n ],\n rehypePlugins: [[rehypeShiki, shikiOptions]],\n recmaPlugins: [recmaWrapExport],\n providerImportSource: \"ardo/mdx-provider\",\n }) as Plugin\n}\n\nexport function getReactRouterPlugins(): Plugin[] {\n const routerPlugin = reactRouter()\n return Array.isArray(routerPlugin) ? routerPlugin : [routerPlugin]\n}\n\nfunction isShikiThemeObject(themeConfig: unknown): themeConfig is { dark: string; light: string } {\n return (\n typeof themeConfig === \"object\" &&\n themeConfig != null &&\n \"light\" in themeConfig &&\n \"dark\" in themeConfig\n )\n}\n","import fs from \"node:fs\"\nimport path from \"node:path\"\n\nimport type { ProjectMeta } from \"../config/types\"\n\ntype PackageJsonShape = {\n author?: { name?: string } | string\n homepage?: string\n license?: string\n name?: string\n repository?: { url?: string } | string\n version?: string\n}\n\n/**\n * Reads project metadata from package.json.\n */\nexport function readProjectMeta(root: string): ProjectMeta {\n const packageJsonPath = path.join(root, \"package.json\")\n\n try {\n const rawPackageJson = fs.readFileSync(packageJsonPath, \"utf8\")\n const parsedPackageJson: unknown = JSON.parse(rawPackageJson)\n if (!isPackageJsonShape(parsedPackageJson)) {\n return {}\n }\n\n const repository = extractRepository(parsedPackageJson.repository)\n const author = extractAuthor(parsedPackageJson.author)\n\n return {\n name: parsedPackageJson.name,\n homepage: parsedPackageJson.homepage,\n repository,\n version: parsedPackageJson.version,\n author,\n license: parsedPackageJson.license,\n }\n } catch {\n return {}\n }\n}\n\nfunction extractRepository(repository: PackageJsonShape[\"repository\"]): string | undefined {\n if (typeof repository === \"string\") {\n return normalizeRepository(repository)\n }\n\n if (repository == null || typeof repository.url !== \"string\") {\n return undefined\n }\n\n return normalizeRepository(repository.url)\n}\n\nfunction extractAuthor(author: PackageJsonShape[\"author\"]): string | undefined {\n if (typeof author === \"string\") {\n return author\n }\n\n if (author == null || typeof author.name !== \"string\") {\n return undefined\n }\n\n return author.name\n}\n\nfunction normalizeRepository(repository: string): string {\n return repository\n .replace(/^git\\+/, \"\")\n .replace(/^git:\\/\\//, \"https://\")\n .replace(/\\.git$/, \"\")\n}\n\nfunction isPackageJsonShape(value: unknown): value is PackageJsonShape {\n return typeof value === \"object\" && value != null\n}\n","import fsSync from \"node:fs\"\nimport fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nexport type RouteInfo = {\n /** File path relative to app directory (e.g., \"routes/guide/getting-started.mdx\") */\n file: string\n /** True if this is an index route */\n isIndex?: boolean\n /** URL path (e.g., \"/guide/getting-started\") */\n path: string\n}\n\nexport function scanRoutesSync(params: { dir: string; rootDir: string }): RouteInfo[] {\n const { dir, rootDir } = params\n const routes: RouteInfo[] = []\n const entries = readDirectoryEntries(dir)\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n routes.push(...scanRoutesSync({ dir: fullPath, rootDir }))\n continue\n }\n\n const route = createRouteInfo({ entryName: entry.name, fullPath, rootDir })\n if (route != null) {\n routes.push(route)\n }\n }\n\n return routes\n}\n\nfunction readDirectoryEntries(dir: string): fsSync.Dirent[] {\n try {\n return fsSync.readdirSync(dir, { withFileTypes: true })\n } catch {\n return []\n }\n}\n\nfunction createRouteInfo(params: {\n entryName: string\n fullPath: string\n rootDir: string\n}): null | RouteInfo {\n const { entryName, fullPath, rootDir } = params\n if (!isRouteFile(entryName) || isIgnoredRouteFile(entryName)) {\n return null\n }\n\n const extension = getRouteExtension(entryName)\n if (extension == null) {\n return null\n }\n\n const relativePath = path.relative(rootDir, fullPath)\n const baseName = entryName.replace(extension, \"\")\n const urlPath = toRoutePath({\n baseName,\n extension,\n relativePath,\n })\n\n return {\n file: `routes/${relativePath.replaceAll(\"\\\\\", \"/\")}`,\n isIndex: isIndexRoute(baseName),\n path: urlPath,\n }\n}\n\nfunction isRouteFile(entryName: string): boolean {\n return entryName.endsWith(\".md\") || entryName.endsWith(\".mdx\") || entryName.endsWith(\".tsx\")\n}\n\nfunction isIgnoredRouteFile(entryName: string): boolean {\n return entryName === \"root.tsx\" || entryName.startsWith(\"_\")\n}\n\nfunction getRouteExtension(entryName: string): \".md\" | \".mdx\" | \".tsx\" | null {\n if (entryName.endsWith(\".mdx\")) {\n return \".mdx\"\n }\n\n if (entryName.endsWith(\".md\")) {\n return \".md\"\n }\n\n if (entryName.endsWith(\".tsx\")) {\n return \".tsx\"\n }\n\n return null\n}\n\nfunction toRoutePath(params: {\n baseName: string\n extension: \".md\" | \".mdx\" | \".tsx\"\n relativePath: string\n}): string {\n const { baseName, extension, relativePath } = params\n\n if (isIndexRoute(baseName)) {\n const parentDir = path.dirname(relativePath)\n const normalizedParent = parentDir === \".\" ? \"\" : parentDir.replaceAll(\"\\\\\", \"/\")\n return applyDynamicSegments(`/${normalizedParent}`)\n }\n\n const withoutExtension = relativePath.replace(extension, \"\")\n return applyDynamicSegments(`/${withoutExtension.replaceAll(\"\\\\\", \"/\")}`)\n}\n\nfunction isIndexRoute(baseName: string): boolean {\n return baseName === \"index\" || baseName === \"home\"\n}\n\nfunction applyDynamicSegments(urlPath: string): string {\n return urlPath.replaceAll(/\\$(\\w+)/gu, \":$1\")\n}\n\nexport function generateRoutesFile(routes: RouteInfo[]): string {\n const sortedRoutes = sortRoutes(routes)\n const entries = sortedRoutes.map((routeInfo) => renderRouteEntry(routeInfo))\n\n return `// AUTO-GENERATED by Ardo - Do not edit manually\n\nimport { type RouteConfig, route, index } from \"@react-router/dev/routes\"\n\nexport default [\n${entries.join(\"\\n\")}\n] satisfies RouteConfig\n`\n}\n\nfunction sortRoutes(routes: RouteInfo[]): RouteInfo[] {\n return [...routes].sort((left, right) => {\n if (left.path === \"/\" && right.path !== \"/\") {\n return -1\n }\n\n if (right.path === \"/\" && left.path !== \"/\") {\n return 1\n }\n\n if (left.isIndex && !right.isIndex) {\n return -1\n }\n\n if (right.isIndex && !left.isIndex) {\n return 1\n }\n\n return left.path.localeCompare(right.path)\n })\n}\n\nfunction renderRouteEntry(routeInfo: RouteInfo): string {\n if (routeInfo.path === \"/\") {\n return ` index(\"${routeInfo.file}\"),`\n }\n\n const routePath = routeInfo.path.slice(1)\n return ` route(\"${routePath}\", \"${routeInfo.file}\"),`\n}\n\nexport function writeRoutesFileSync(params: {\n appDir: string\n routesDir: string\n routesFilePath: string\n}): void {\n const { appDir, routesDir, routesFilePath } = params\n const routes = scanRoutesSync({ dir: routesDir, rootDir: routesDir })\n if (routes.length === 0) {\n return\n }\n\n const content = generateRoutesFile(routes)\n const hasChanges = hasRoutesContentChangedSync(routesFilePath, content)\n if (!hasChanges) {\n return\n }\n\n fsSync.mkdirSync(appDir, { recursive: true })\n fsSync.writeFileSync(routesFilePath, content, \"utf8\")\n console.log(`[ardo] Generated routes.ts with ${routes.length} routes`)\n}\n\nfunction hasRoutesContentChangedSync(routesFilePath: string, nextContent: string): boolean {\n try {\n const existing = fsSync.readFileSync(routesFilePath, \"utf8\")\n return existing !== nextContent\n } catch {\n return true\n }\n}\n\nexport async function writeRoutesFile(params: {\n appDir: string\n routesDir: string\n routesFilePath: string\n}): Promise<void> {\n const { appDir, routesDir, routesFilePath } = params\n const routes = scanRoutesSync({ dir: routesDir, rootDir: routesDir })\n if (routes.length === 0) {\n return\n }\n\n const content = generateRoutesFile(routes)\n const hasChanges = await hasRoutesContentChanged(routesFilePath, content)\n if (!hasChanges) {\n return\n }\n\n await fs.mkdir(appDir, { recursive: true })\n await fs.writeFile(routesFilePath, content, \"utf8\")\n}\n\nasync function hasRoutesContentChanged(\n routesFilePath: string,\n nextContent: string\n): Promise<boolean> {\n try {\n const existing = await fs.readFile(routesFilePath, \"utf8\")\n return existing !== nextContent\n } catch {\n return true\n }\n}\n","import type { Plugin } from \"vite\"\n\nimport path from \"node:path\"\n\nimport { writeRoutesFile, writeRoutesFileSync } from \"./routes-core\"\n\nexport type ArdoRoutesPluginOptions = {\n /** Directory where routes are located (default: \"./app/routes\") */\n routesDir?: string\n}\n\ntype ResolvedRoutePaths = {\n appDir: string\n routesDir: string\n routesFilePath: string\n}\n\n/**\n * Vite plugin that generates routes.ts for React Router Framework Mode.\n */\nexport function ardoRoutesPlugin(options: ArdoRoutesPluginOptions = {}): Plugin {\n let paths = createDefaultPaths(process.cwd(), options)\n\n return {\n name: \"ardo:routes\",\n enforce: \"pre\",\n\n config(userConfig) {\n const root = userConfig.root ?? process.cwd()\n paths = createDefaultPaths(root, options)\n\n try {\n writeRoutesFileSync(paths)\n } catch (error) {\n console.warn(\"[ardo] Could not generate routes.ts in config phase:\", error)\n }\n },\n\n configResolved(resolvedConfig) {\n paths = createDefaultPaths(resolvedConfig.root, options)\n },\n\n async buildStart() {\n await writeRoutesFile(paths)\n },\n\n configureServer(server) {\n server.watcher.add(paths.routesDir)\n\n const handleChange = (changedPath: string) => {\n if (shouldHandleRouteChange(changedPath, paths.routesDir)) {\n void writeRoutesFile(paths)\n }\n }\n\n server.watcher.on(\"add\", handleChange)\n server.watcher.on(\"unlink\", handleChange)\n },\n }\n}\n\nfunction createDefaultPaths(root: string, options: ArdoRoutesPluginOptions): ResolvedRoutePaths {\n const appDir = path.join(root, \"app\")\n const routesDir = options.routesDir ?? path.join(appDir, \"routes\")\n const routesFilePath = path.join(appDir, \"routes.ts\")\n return { appDir, routesDir, routesFilePath }\n}\n\nfunction shouldHandleRouteChange(changedPath: string, routesDir: string): boolean {\n if (!changedPath.startsWith(routesDir)) {\n return false\n }\n\n return changedPath.endsWith(\".md\") || changedPath.endsWith(\".mdx\") || changedPath.endsWith(\".tsx\")\n}\n","import type { Dirent } from \"node:fs\"\n\nimport matter from \"gray-matter\"\nimport fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nexport type SearchDoc = {\n id: string\n title: string\n content: string\n path: string\n section?: string\n}\n\ntype SearchScanContext = {\n docs: SearchDoc[]\n routesDir: string\n}\n\ntype SearchDocBuildContext = {\n routesDir: string\n section?: string\n}\n\ntype SearchEntryContext = {\n dir: string\n section?: string\n scanContext: SearchScanContext\n}\n\nexport async function generateSearchIndex(routesDir: string): Promise<SearchDoc[]> {\n const context: SearchScanContext = { docs: [], routesDir }\n await scanDirectoryForSearch(routesDir, undefined, context)\n return context.docs\n}\n\nasync function scanDirectoryForSearch(\n dir: string,\n section: string | undefined,\n context: SearchScanContext\n): Promise<void> {\n let entries: Dirent[]\n\n try {\n entries = await fs.readdir(dir, { withFileTypes: true })\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n console.warn(\"[ardo] Failed to scan for search index:\", errorMessage)\n return\n }\n\n for (const entry of entries) {\n await processSearchEntry(entry, { dir, section, scanContext: context })\n }\n}\n\nasync function processSearchEntry(entry: Dirent, context: SearchEntryContext): Promise<void> {\n const fullPath = path.join(context.dir, entry.name)\n if (entry.isDirectory()) {\n const nestedSection = createNestedSection(context.section, entry.name)\n await scanDirectoryForSearch(fullPath, nestedSection, context.scanContext)\n return\n }\n\n if (entry.name.endsWith(\".mdx\") || entry.name.endsWith(\".md\")) {\n const doc = await createSearchDocFromFile(entry.name, fullPath, {\n routesDir: context.scanContext.routesDir,\n section: context.section,\n })\n if (doc != null) {\n context.scanContext.docs.push(doc)\n }\n }\n}\n\nasync function createSearchDocFromFile(\n fileName: string,\n filePath: string,\n context: SearchDocBuildContext\n): Promise<null | SearchDoc> {\n const fileContent = await fs.readFile(filePath, \"utf8\")\n const parsed = matter(fileContent)\n const extension = fileName.endsWith(\".mdx\") ? \".mdx\" : \".md\"\n const title =\n typeof parsed.data.title === \"string\"\n ? parsed.data.title\n : formatTitle(fileName.replace(extension, \"\"))\n\n const relativePath = path.relative(context.routesDir, filePath)\n const routePath = buildRoutePath(relativePath, fileName, extension)\n const content = sanitizeSearchContent(parsed.content)\n\n return {\n id: relativePath,\n title,\n content,\n path: routePath,\n section: context.section,\n }\n}\n\nfunction sanitizeSearchContent(content: string): string {\n const withoutCodeFences = removeCodeFences(content)\n const withoutImportLines = removeImportLines(withoutCodeFences)\n const normalizedText = replacePunctuationWithSpaces(withoutImportLines)\n const collapsedWhitespace = collapseWhitespace(normalizedText)\n return collapsedWhitespace.slice(0, 2000)\n}\n\nfunction removeCodeFences(content: string): string {\n const lines = content.split(\"\\n\")\n const keptLines: string[] = []\n let isInsideFence = false\n\n for (const line of lines) {\n if (line.trimStart().startsWith(\"```\")) {\n isInsideFence = !isInsideFence\n continue\n }\n\n if (!isInsideFence) {\n keptLines.push(line)\n }\n }\n\n return keptLines.join(\"\\n\")\n}\n\nfunction removeImportLines(content: string): string {\n const lines = content.split(\"\\n\")\n const keptLines: string[] = []\n\n for (const line of lines) {\n if (!line.trimStart().startsWith(\"import \")) {\n keptLines.push(line)\n }\n }\n\n return keptLines.join(\"\\n\")\n}\n\nfunction replacePunctuationWithSpaces(content: string): string {\n let normalized = content\n for (const token of [\"`\", \"#\", \"*\", \"_\", \"~\", \"[\", \"]\", \"(\", \")\", \"<\", \">\", \"|\", \"!\"]) {\n normalized = normalized.replaceAll(token, \" \")\n }\n\n return normalized\n}\n\nfunction collapseWhitespace(content: string): string {\n let result = \"\"\n let previousWasSpace = false\n\n for (const character of content) {\n const isSpace =\n character === \" \" || character === \"\\n\" || character === \"\\t\" || character === \"\\r\"\n if (isSpace) {\n if (!previousWasSpace) {\n result += \" \"\n }\n previousWasSpace = true\n continue\n }\n\n result += character\n previousWasSpace = false\n }\n\n return result.trim()\n}\n\nfunction buildRoutePath(relativePath: string, fileName: string, extension: string): string {\n if (fileName === \"index.mdx\" || fileName === \"index.md\") {\n const directoryPath = path.dirname(relativePath).replaceAll(\"\\\\\", \"/\")\n return directoryPath === \".\" ? \"/\" : `/${directoryPath}`\n }\n\n return `/${relativePath.replace(extension, \"\").replaceAll(\"\\\\\", \"/\")}`\n}\n\nfunction createNestedSection(section: string | undefined, directoryName: string): string {\n const currentTitle = formatTitle(directoryName)\n return section != null ? `${section} > ${currentTitle}` : currentTitle\n}\n\nfunction formatTitle(name: string): string {\n return name.replaceAll(/[_-]/g, \" \").replaceAll(/\\b\\w/g, (char) => char.toUpperCase())\n}\n","import type { Dirent } from \"node:fs\"\n\nimport matter from \"gray-matter\"\nimport fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport type { SidebarConfig, SidebarItem } from \"../config/types\"\n\ntype SidebarNode = {\n text: string\n link?: string\n items?: SidebarNode[]\n collapsed?: boolean\n order?: number\n sectionId: string\n}\n\ntype SidebarFrontmatter = {\n collapsed?: boolean\n order?: number\n sidebar?: boolean\n title?: string\n}\n\nexport async function generateSidebar(\n routesDir: string,\n options: SidebarConfig = {}\n): Promise<SidebarItem[]> {\n try {\n const nodes = await scanSidebarDirectory(routesDir, routesDir)\n sortNodesBySectionOrder(nodes, options.sectionOrder)\n return nodes.map((node) => stripOrderFromNode(node))\n } catch {\n return []\n }\n}\n\nasync function scanSidebarDirectory(dir: string, rootDir: string): Promise<SidebarNode[]> {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n const nodes: SidebarNode[] = []\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n const relativePath = path.relative(rootDir, fullPath)\n\n if (entry.isDirectory()) {\n const directoryNode = await createDirectoryNode(entry, fullPath, rootDir)\n if (directoryNode != null) {\n nodes.push(directoryNode)\n }\n continue\n }\n\n const fileNode = await createMarkdownNode(entry, fullPath, relativePath)\n if (fileNode != null) {\n nodes.push(fileNode)\n }\n }\n\n sortNodes(nodes)\n return nodes\n}\n\nasync function createDirectoryNode(\n entry: Dirent,\n fullPath: string,\n rootDir: string\n): Promise<null | SidebarNode> {\n const relativePath = path.relative(rootDir, fullPath)\n const children = await scanSidebarDirectory(fullPath, rootDir)\n if (children.length === 0) {\n return null\n }\n\n const metadata = await readDirectoryIndexMetadata(fullPath)\n const link = metadata == null ? undefined : `/${relativePath.replaceAll(\"\\\\\", \"/\")}`\n\n return {\n text: metadata?.title ?? formatTitle(entry.name),\n link,\n items: children,\n collapsed: metadata?.collapsed,\n order: metadata?.order,\n sectionId: entry.name,\n }\n}\n\nasync function createMarkdownNode(\n entry: Dirent,\n fullPath: string,\n relativePath: string\n): Promise<null | SidebarNode> {\n if (!isSidebarMarkdownFile(entry.name)) {\n return null\n }\n\n const extension = entry.name.endsWith(\".mdx\") ? \".mdx\" : \".md\"\n const fileContent = await fs.readFile(fullPath, \"utf8\")\n const frontmatter = readFrontmatter(fileContent)\n if (frontmatter.sidebar === false) {\n return null\n }\n\n const title = frontmatter.title ?? formatTitle(entry.name.replace(extension, \"\"))\n const link = `/${relativePath.replace(extension, \"\").replaceAll(\"\\\\\", \"/\")}`\n\n return {\n text: title,\n link,\n order: frontmatter.order,\n sectionId: entry.name.replace(extension, \"\"),\n }\n}\n\nasync function readDirectoryIndexMetadata(fullPath: string): Promise<null | SidebarFrontmatter> {\n for (const indexFileName of [\"index.mdx\", \"index.md\"]) {\n const metadata = await readFrontmatterFile(path.join(fullPath, indexFileName))\n if (metadata != null) {\n return metadata\n }\n }\n\n return null\n}\n\nasync function readFrontmatterFile(filePath: string): Promise<null | SidebarFrontmatter> {\n try {\n const fileContent = await fs.readFile(filePath, \"utf8\")\n return readFrontmatter(fileContent)\n } catch {\n return null\n }\n}\n\nfunction readFrontmatter(fileContent: string): SidebarFrontmatter {\n const parsed = matter(fileContent)\n const title = typeof parsed.data.title === \"string\" ? parsed.data.title : undefined\n const order = typeof parsed.data.order === \"number\" ? parsed.data.order : undefined\n const collapsed = typeof parsed.data.collapsed === \"boolean\" ? parsed.data.collapsed : undefined\n const sidebar = typeof parsed.data.sidebar === \"boolean\" ? parsed.data.sidebar : undefined\n return { title, order, collapsed, sidebar }\n}\n\nfunction sortNodes(nodes: SidebarNode[]): void {\n nodes.sort((leftNode, rightNode) => {\n if (leftNode.order != null && rightNode.order != null) {\n return leftNode.order - rightNode.order\n }\n\n if (leftNode.order != null) {\n return -1\n }\n\n if (rightNode.order != null) {\n return 1\n }\n\n return leftNode.text.localeCompare(rightNode.text)\n })\n}\n\nfunction sortNodesBySectionOrder(nodes: SidebarNode[], sectionOrder: string[] | undefined): void {\n if (sectionOrder == null || sectionOrder.length === 0) {\n return\n }\n\n const sectionOrderMap = new Map<string, number>()\n for (const [index, section] of sectionOrder.entries()) {\n const normalizedSection = normalizeSectionId(section)\n if (normalizedSection !== \"\" && !sectionOrderMap.has(normalizedSection)) {\n sectionOrderMap.set(normalizedSection, index)\n }\n }\n\n if (sectionOrderMap.size === 0) {\n return\n }\n\n nodes.sort((leftNode, rightNode) => {\n const leftIndex = sectionOrderMap.get(leftNode.sectionId)\n const rightIndex = sectionOrderMap.get(rightNode.sectionId)\n\n if (leftIndex != null && rightIndex != null) {\n return leftIndex - rightIndex\n }\n\n if (leftIndex != null) {\n return -1\n }\n\n if (rightIndex != null) {\n return 1\n }\n\n return 0\n })\n}\n\nfunction isSidebarMarkdownFile(fileName: string): boolean {\n const isMarkdownFile = fileName.endsWith(\".mdx\") || fileName.endsWith(\".md\")\n const isIndexFile = fileName === \"index.mdx\" || fileName === \"index.md\"\n return isMarkdownFile && !isIndexFile\n}\n\nfunction formatTitle(name: string): string {\n return name.replaceAll(/[_-]/g, \" \").replaceAll(/\\b\\w/g, (char) => char.toUpperCase())\n}\n\nfunction stripOrderFromNode(node: SidebarNode): SidebarItem {\n return {\n text: node.text,\n link: node.link,\n collapsed: node.collapsed,\n items: node.items?.map((item) => stripOrderFromNode(item)),\n }\n}\n\nfunction normalizeSectionId(section: string): string {\n const normalizedSection = section.replaceAll(\"\\\\\", \"/\")\n let startIndex = 0\n let endIndex = normalizedSection.length\n\n while (startIndex < endIndex && normalizedSection[startIndex] === \"/\") {\n startIndex += 1\n }\n\n while (endIndex > startIndex && normalizedSection[endIndex - 1] === \"/\") {\n endIndex -= 1\n }\n\n return normalizedSection.slice(startIndex, endIndex)\n}\n","import type { Plugin } from \"vite\"\n\nimport type { TypeDocConfig } from \"../typedoc/types\"\n\nimport { generateApiDocs } from \"../typedoc/generator\"\nimport { findPackageRoot } from \"./git-utils\"\n\nlet typedocGenerated = false\n\nexport function resolveTypedocConfig(\n typedoc: true | TypeDocConfig | undefined\n): TypeDocConfig | undefined {\n if (typedoc == null) {\n return undefined\n }\n\n const packageRoot = findPackageRoot(process.cwd())\n const defaultEntryPoint = packageRoot != null ? `${packageRoot}/src/index.ts` : \"./src/index.ts\"\n const defaultTsconfig = packageRoot != null ? `${packageRoot}/tsconfig.json` : \"./tsconfig.json\"\n const defaults: TypeDocConfig = {\n enabled: true,\n entryPoints: [defaultEntryPoint],\n tsconfig: defaultTsconfig,\n out: \"api-reference\",\n excludePrivate: true,\n excludeInternal: true,\n }\n\n return typedoc === true ? defaults : { ...defaults, ...typedoc }\n}\n\nexport function createTypeDocPlugin(typedocConfig: TypeDocConfig, routesDir: string): Plugin {\n return {\n name: \"ardo:typedoc\",\n async buildStart() {\n if (!typedocConfig.enabled || typedocGenerated) {\n return\n }\n\n typedocGenerated = true\n console.log(\"[ardo] Generating API documentation with TypeDoc...\")\n const startTime = Date.now()\n\n try {\n const docs = await generateApiDocs(typedocConfig, routesDir)\n const duration = Date.now() - startTime\n console.log(`[ardo] Generated ${docs.length} API documentation pages in ${duration}ms`)\n } catch (error) {\n console.warn(\"[ardo] TypeDoc generation failed. API documentation will not be available.\")\n console.warn(\"[ardo] Check your typedoc.entryPoints configuration.\")\n if (error instanceof Error) {\n console.warn(`[ardo] Error: ${error.message}`)\n }\n }\n },\n }\n}\n","import type { Plugin, UserConfig } from \"vite\"\n\nimport { vanillaExtractPlugin } from \"@vanilla-extract/vite-plugin\"\nimport path from \"node:path\"\n\nimport type { ArdoConfig, ProjectMeta, ResolvedConfig } from \"../config/types\"\n\nimport { resolveConfig } from \"../config/index\"\nimport { ardoCodeBlockPlugin } from \"./codeblock-plugin\"\nimport { createFlattenPlugin } from \"./flatten-plugin\"\nimport { detectGitHash, detectGitHubBasename, detectGitHubRepoName } from \"./git-utils\"\nimport { type ArdoIconOptions, createIconsPlugin } from \"./icons\"\nimport { transformMarkdownMeta } from \"./markdown-meta\"\nimport { createMdxPlugin, getReactRouterPlugins } from \"./mdx-plugin\"\nimport { readProjectMeta } from \"./project-meta\"\nimport { ardoRoutesPlugin, type ArdoRoutesPluginOptions } from \"./routes-plugin\"\nimport { generateSearchIndex } from \"./search-index\"\nimport { generateSidebar } from \"./sidebar-index\"\nimport { createTypeDocPlugin, resolveTypedocConfig } from \"./typedoc-plugin\"\n\nconst VIRTUAL_MODULE_ID = \"virtual:ardo/config\"\nconst VIRTUAL_SIDEBAR_ID = \"virtual:ardo/sidebar\"\nconst VIRTUAL_SEARCH_ID = \"virtual:ardo/search-index\"\nconst RESOLVED_IDS: Record<string, string> = {\n [VIRTUAL_MODULE_ID]: `\\0${VIRTUAL_MODULE_ID}`,\n [VIRTUAL_SIDEBAR_ID]: `\\0${VIRTUAL_SIDEBAR_ID}`,\n [VIRTUAL_SEARCH_ID]: `\\0${VIRTUAL_SEARCH_ID}`,\n}\n\ntype PluginState = {\n resolvedConfig?: ResolvedConfig\n routesDir: string\n}\n\ntype MainPluginOptions = {\n githubPages: boolean\n pressConfig: PressConfigOptions\n routesDirOption: string | undefined\n}\n\ntype PressConfigOptions = Omit<\n ArdoPluginOptions,\n \"githubPages\" | \"icons\" | \"routes\" | \"routesDir\" | \"typedoc\"\n>\n\nexport type ArdoPluginOptions = {\n /** Options for the routes generator plugin */\n routes?: ArdoRoutesPluginOptions | false\n /**\n * Generate the lean favicon set recommended for modern websites:\n * /favicon.ico, /icon.svg, and /apple-touch-icon.png.\n *\n * @default true\n */\n icons?: ArdoIconOptions\n /**\n * Auto-detect GitHub repository and set base path for GitHub Pages.\n * @default true\n */\n githubPages?: boolean\n /**\n * Directory where routes are located.\n * @default \"./app/routes\"\n */\n routesDir?: string\n} & Partial<ArdoConfig>\n\nexport { detectGitHubBasename }\n\nexport function ardoPlugin(options: ArdoPluginOptions = {}): Plugin[] {\n const {\n icons = {},\n routes,\n typedoc,\n githubPages = true,\n routesDir: routesDirOption,\n ...pressConfig\n } = options\n const state: PluginState = { routesDir: resolveRoutesDir(process.cwd(), routesDirOption) }\n\n const mainPluginOptions: MainPluginOptions = { githubPages, pressConfig, routesDirOption }\n const plugins: Plugin[] = [createMainPlugin(state, mainPluginOptions)]\n plugins.push(...createIconsPlugin(icons))\n addRoutesPlugin(plugins, routes, routesDirOption)\n addTypeDocPlugin(plugins, typedoc, state)\n\n plugins.push(ardoCodeBlockPlugin(pressConfig.markdown))\n plugins.push(createMdxPlugin(pressConfig.markdown))\n plugins.push(...vanillaExtractPlugin({ identifiers: \"short\" }))\n plugins.push(...getReactRouterPlugins())\n\n if (githubPages) {\n plugins.push(createFlattenPlugin())\n }\n\n return plugins\n}\n\nfunction addRoutesPlugin(\n plugins: Plugin[],\n routes: ArdoPluginOptions[\"routes\"],\n routesDirOption: string | undefined\n): void {\n if (routes === false) {\n return\n }\n\n const routePluginOptions = routes ?? {}\n plugins.push(ardoRoutesPlugin({ routesDir: routesDirOption, ...routePluginOptions }))\n}\n\nfunction addTypeDocPlugin(\n plugins: Plugin[],\n typedoc: ArdoPluginOptions[\"typedoc\"],\n state: PluginState\n): void {\n const typedocConfig = resolveTypedocConfig(typedoc)\n if (typedocConfig != null) {\n plugins.unshift(createTypeDocPlugin(typedocConfig, state.routesDir))\n }\n}\n\nfunction createMainPlugin(state: PluginState, options: MainPluginOptions): Plugin {\n return {\n name: \"ardo\",\n enforce: \"pre\",\n config(userConfig, env): UserConfig {\n return createMainConfig(state, {\n userConfig,\n command: env.command,\n githubPages: options.githubPages,\n routesDirOption: options.routesDirOption,\n })\n },\n configResolved(config) {\n state.routesDir = resolveRoutesDir(config.root, options.routesDirOption)\n state.resolvedConfig = resolveArdoConfig(config.root, state.routesDir, options.pressConfig)\n },\n resolveId(id) {\n return resolveVirtualModuleId(id)\n },\n async load(id) {\n return loadVirtualModule(id, state)\n },\n transform(code, id) {\n return transformMarkdownMeta(code, id, state)\n },\n }\n}\n\nfunction createMainConfig(\n state: PluginState,\n input: {\n command: string\n githubPages: boolean\n routesDirOption: string | undefined\n userConfig: UserConfig\n }\n): UserConfig {\n const { command, githubPages, routesDirOption, userConfig } = input\n const root = userConfig.root ?? process.cwd()\n state.routesDir = resolveRoutesDir(root, routesDirOption)\n\n const config: UserConfig = {\n define: { __BUILD_TIME__: JSON.stringify(new Date().toISOString()) },\n optimizeDeps: { exclude: [\"ardo/ui/styles.css\"] },\n ssr: { noExternal: [\"ardo\"] },\n }\n\n if (githubPages && command === \"build\" && userConfig.base == null) {\n const repoName = detectGitHubRepoName(root)\n if (repoName != null) {\n config.base = `/${repoName}/`\n console.log(`[ardo] GitHub Pages detected, using base: ${config.base}`)\n }\n }\n\n return config\n}\n\nfunction resolveArdoConfig(\n root: string,\n routesDir: string,\n pressConfig: PressConfigOptions\n): ResolvedConfig {\n const detectedProject = readProjectMeta(root)\n const project: ProjectMeta = { ...detectedProject, ...pressConfig.project }\n const configWithDefaults: ArdoConfig = {\n title: pressConfig.title ?? \"Ardo\",\n description: pressConfig.description ?? \"Documentation powered by Ardo\",\n }\n\n return resolveConfig(\n {\n ...configWithDefaults,\n ...pressConfig,\n project,\n srcDir: routesDir,\n },\n root\n )\n}\n\nfunction resolveVirtualModuleId(id: string): string | undefined {\n return RESOLVED_IDS[id]\n}\n\nasync function loadVirtualModule(id: string, state: PluginState): Promise<string | undefined> {\n if (state.resolvedConfig == null) {\n return undefined\n }\n\n if (id === RESOLVED_IDS[VIRTUAL_MODULE_ID]) {\n const clientConfig = {\n title: state.resolvedConfig.title,\n description: state.resolvedConfig.description,\n base: state.resolvedConfig.base,\n lang: state.resolvedConfig.lang,\n project: state.resolvedConfig.project,\n buildTime: new Date().toISOString(),\n buildHash: detectGitHash(state.resolvedConfig.root),\n }\n return `export default ${JSON.stringify(clientConfig)}`\n }\n\n if (id === RESOLVED_IDS[VIRTUAL_SIDEBAR_ID]) {\n const sidebar = await generateSidebar(state.routesDir, state.resolvedConfig.sidebar)\n return `export default ${JSON.stringify(sidebar)}`\n }\n\n if (id === RESOLVED_IDS[VIRTUAL_SEARCH_ID]) {\n const searchIndex = await generateSearchIndex(state.routesDir)\n return `export default ${JSON.stringify(searchIndex)}`\n }\n\n return undefined\n}\n\nfunction resolveRoutesDir(root: string, routesDirOption: string | undefined): string {\n return routesDirOption ?? path.join(root, \"app\", \"routes\")\n}\n"],"x_google_ignoreList":[19,20,21,22,23,24,25,26],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAgB,YAAY,SAA4B;CACtD,MAAM,EAAE,aAAa;CAGrB,MAAM,iBAAiB,aAAa,MAAM,KAAK,SAAS,QAAQ,OAAO,GAAG;CAE1E,QAAQ,SAAe;EACrB,IAAI,CAAC,gBAEH;EAGF,MAAM,MAAM,YAAY,SAAkB;GACxC,IAAI,KAAK,YAAY,KACnB;GAGF,MAAM,OAAO,KAAK,WAAW;GAI7B,IACE,OAAO,SAAS,YAChB,KAAK,WAAW,IAAI,IACpB,CAAC,KAAK,WAAW,KAAK,IACtB,CAAC,KAAK,WAAW,eAAe,EAEhC,KAAK,WAAW,OAAO,iBAAiB;IAE1C;;;;;;ACpCN,MAAa,iBAAiB;CAC5B,OAAO;CACP,MAAM;CACP;AAED,SAAgB,mBACd,OACyB;CACzB,OAAO,SAAS;;AAGlB,SAAgB,iBAAiB,aAAsD;CACrF,IAAI,eAAe,MAAM,OAAO,CAAC,eAAe,OAAO,eAAe,KAAK;CAC3E,OAAO,OAAO,gBAAgB,WAAW,CAAC,YAAY,GAAG,CAAC,YAAY,OAAO,YAAY,KAAK;;AAGhG,SAAgB,mBAAm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G;EACH;EACA,QAAQ;EACT,EACD,KACD;;AAGH,SAAS,uBAAuB,IAAgC;CAC9D,OAAO,aAAa;;AAGtB,eAAe,kBAAkB,IAAY,OAAiD;CAC5F,IAAI,MAAM,kBAAkB,MAC1B;CAGF,IAAI,OAAO,aAAa,oBAAoB;EAC1C,MAAM,eAAe;GACnB,OAAO,MAAM,eAAe;GAC5B,aAAa,MAAM,eAAe;GAClC,MAAM,MAAM,eAAe;GAC3B,MAAM,MAAM,eAAe;GAC3B,SAAS,MAAM,eAAe;GAC9B,4BAAW,IAAI,MAAM,EAAC,aAAa;GACnC,WAAW,cAAc,MAAM,eAAe,KAAK;GACpD;EACD,OAAO,kBAAkB,KAAK,UAAU,aAAa;;CAGvD,IAAI,OAAO,aAAa,qBAAqB;EAC3C,MAAM,UAAU,MAAMC,kBAAgB,MAAM,WAAW,MAAM,eAAe,QAAQ;EACpF,OAAO,kBAAkB,KAAK,UAAU,QAAQ;;CAGlD,IAAI,OAAO,aAAa,oBAAoB;EAC1C,MAAM,cAAc,MAAM,oBAAoB,MAAM,UAAU;EAC9D,OAAO,kBAAkB,KAAK,UAAU,YAAY;;;AAMxD,SAAS,iBAAiB,MAAc,iBAA6C;CACnF,OAAO,mBAAmB,KAAK,KAAK,MAAM,OAAO,SAAS"}
1
+ {"version":3,"file":"index.js","names":["isRecord","isRecord","getHeadingText","slugify","ensureHProperties","isRecord","isRecord","formatTitle","readDirectoryEntries","readDirectoryIndexMetadata","formatTitle","readFrontmatter","isRecord","fs","fs","name","isIdentifierName","getHeadingText","isRecord","fs","formatTitle","generateSidebar","generateSidebar"],"sources":["../../src/markdown/links.ts","../../src/markdown/shiki-theme.ts","../../src/ui/components/code-block-classes.ts","../../src/markdown/shiki-html.ts","../../src/markdown/shiki-meta.ts","../../src/markdown/shiki-rehype.ts","../../src/markdown/shiki-transformer.ts","../../src/markdown/shiki.ts","../../src/markdown/toc.ts","../../src/markdown/pipeline.ts","../../src/runtime/loader.ts","../../src/runtime/sidebar.ts","../../src/vite/codeblock-scan.ts","../../src/vite/codeblock-transform.ts","../../src/vite/codeblock-plugin.ts","../../src/vite/git-utils.ts","../../src/vite/flatten-plugin.ts","../../src/vite/icons.ts","../../src/vite/markdown-meta.ts","../../src/markdown/remark-callouts.ts","../../../../node_modules/.pnpm/estree-util-value-to-estree@3.5.0/node_modules/estree-util-value-to-estree/dist/estree-util-value-to-estree.js","../../../../node_modules/.pnpm/estree-util-is-identifier-name@3.0.0/node_modules/estree-util-is-identifier-name/lib/index.js","../../../../node_modules/.pnpm/devlop@1.1.0/node_modules/devlop/lib/default.js","../../../../node_modules/.pnpm/estree-util-scope@1.0.0/node_modules/estree-util-scope/lib/index.js","../../../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/walker.js","../../../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/sync.js","../../../../node_modules/.pnpm/estree-walker@3.0.3/node_modules/estree-walker/src/index.js","../../../../node_modules/.pnpm/unist-util-mdx-define@1.1.2/node_modules/unist-util-mdx-define/dist/unist-util-mdx-define.js","../../src/markdown/remark-mdx-handle.ts","../../src/markdown/remark-mdx-toc.ts","../../src/markdown/remark-strip-frontmatter-h1.ts","../../src/vite/recma-wrap-export.ts","../../src/vite/mdx-plugin.ts","../../src/vite/project-meta.ts","../../src/vite/routes-core.ts","../../src/vite/routes-plugin.ts","../../src/vite/search-index.ts","../../src/vite/sidebar-index.ts","../../src/vite/typedoc-plugin.ts","../../src/vite/plugin.ts"],"sourcesContent":["import type { Element, Root } from \"hast\"\n\nimport { visit } from \"unist-util-visit\"\n\nexport type RehypeLinkOptions = {\n basePath: string\n}\n\n/**\n * Rehype plugin that rewrites internal links to include the basePath.\n * This is needed for static sites deployed to subpaths (e.g., GitHub Pages).\n */\nexport function rehypeLinks(options: RehypeLinkOptions) {\n const { basePath } = options\n\n // Normalize basePath: ensure it starts with / and doesn't end with /\n const normalizedBase = basePath === \"/\" ? \"\" : basePath.replace(/\\/$/, \"\")\n\n return (tree: Root) => {\n if (!normalizedBase) {\n // No basePath to add\n return\n }\n\n visit(tree, \"element\", (node: Element) => {\n if (node.tagName !== \"a\") {\n return\n }\n\n const href = node.properties.href\n\n // Only rewrite internal links that start with /\n // Don't rewrite: external URLs, anchors, relative paths, or already prefixed paths\n if (\n typeof href === \"string\" &&\n href.startsWith(\"/\") &&\n !href.startsWith(\"//\") &&\n !href.startsWith(normalizedBase)\n ) {\n node.properties.href = normalizedBase + href\n }\n })\n }\n}\n","import type { BundledTheme, Highlighter } from \"shiki\"\n\nimport type { MarkdownConfig } from \"../config/types\"\n\n/** Default Ardo themes used when no config is provided */\nexport const DEFAULT_THEMES = {\n light: \"github-light-default\" as BundledTheme,\n dark: \"github-dark-default\" as BundledTheme,\n}\n\nexport function resolveThemeConfig(\n theme: MarkdownConfig[\"theme\"] | undefined\n): MarkdownConfig[\"theme\"] {\n return theme ?? DEFAULT_THEMES\n}\n\nexport function getBundledThemes(themeConfig: MarkdownConfig[\"theme\"]): BundledTheme[] {\n if (themeConfig == null) return [DEFAULT_THEMES.light, DEFAULT_THEMES.dark]\n return typeof themeConfig === \"string\" ? [themeConfig] : [themeConfig.light, themeConfig.dark]\n}\n\nexport function highlightWithTheme(params: {\n code: string\n highlighter: Highlighter\n language: string\n themeConfig: MarkdownConfig[\"theme\"]\n}): string {\n const { code, highlighter, language, themeConfig } = params\n\n const resolved = themeConfig ?? DEFAULT_THEMES\n\n if (typeof resolved === \"string\") {\n return highlighter.codeToHtml(code, { lang: language, theme: resolved })\n }\n\n return highlighter.codeToHtml(code, {\n defaultColor: false,\n lang: language,\n themes: { dark: resolved.dark, light: resolved.light },\n })\n}\n","export const shikiContainerClassName = \"ardo-shiki\"\n","type CodeBlockOptions = {\n highlightLines: number[]\n lang: string\n lineNumbers: boolean\n title?: string\n}\n\nexport function buildCodeBlockHtml(shikiHtml: string, options: CodeBlockOptions): string {\n const titleHtml = renderTitle(options.title)\n const codeHtml = renderCodeLines({\n highlightLines: options.highlightLines,\n lineNumbers: options.lineNumbers,\n shikiHtml,\n })\n const copyButton = renderCopyButton(shikiHtml)\n\n return `${titleHtml}<div data-lang=\"${options.lang}\">${codeHtml}${copyButton}</div>`\n}\n\nfunction renderTitle(title: string | undefined): string {\n if (title == null || title.length === 0) {\n return \"\"\n }\n\n return `<div data-title>${escapeHtml(title)}</div>`\n}\n\nfunction renderCodeLines(params: {\n highlightLines: number[]\n lineNumbers: boolean\n shikiHtml: string\n}): string {\n const { highlightLines, lineNumbers, shikiHtml } = params\n if (!lineNumbers && highlightLines.length === 0) {\n return shikiHtml\n }\n\n return shikiHtml\n .split(\"\\n\")\n .map((lineHtml, index) =>\n renderSingleCodeLine({\n highlightLines,\n lineHtml,\n lineNumber: index + 1,\n lineNumbers,\n })\n )\n .join(\"\\n\")\n}\n\nfunction renderSingleCodeLine(params: {\n highlightLines: number[]\n lineHtml: string\n lineNumber: number\n lineNumbers: boolean\n}): string {\n const { highlightLines, lineHtml, lineNumber, lineNumbers } = params\n const isHighlighted = highlightLines.includes(lineNumber)\n const className = isHighlighted ? \"line highlighted\" : \"line\"\n const lineNumberAttribute = lineNumbers ? ` data-ln=\"${lineNumber}\"` : \"\"\n\n return `<span class=\"${className}\"${lineNumberAttribute}>${lineHtml}</span>`\n}\n\nfunction renderCopyButton(shikiHtml: string): string {\n const code = encodeURIComponent(extractCodeFromHtml(shikiHtml))\n return `<button data-code=\"${code}\">\n <span>Copy</span>\n <span style=\"display:none\">Copied!</span>\n </button>`\n}\n\nfunction extractCodeFromHtml(html: string): string {\n return decodeCommonEntities(stripTags(html))\n}\n\nfunction stripTags(html: string): string {\n let result = \"\"\n let inTag = false\n\n for (const char of html) {\n if (char === \"<\") {\n inTag = true\n continue\n }\n\n if (inTag && char === \">\") {\n inTag = false\n continue\n }\n\n if (!inTag) {\n result += char\n }\n }\n\n return result\n}\n\nfunction decodeCommonEntities(text: string): string {\n return text\n .replaceAll(\"&lt;\", \"<\")\n .replaceAll(\"&gt;\", \">\")\n .replaceAll(\"&amp;\", \"&\")\n .replaceAll(\"&quot;\", '\"')\n .replaceAll(\"&#39;\", \"'\")\n}\n\nfunction escapeHtml(text: string): string {\n return text\n .replaceAll(\"&\", \"&amp;\")\n .replaceAll(\"<\", \"&lt;\")\n .replaceAll(\">\", \"&gt;\")\n .replaceAll('\"', \"&quot;\")\n .replaceAll(\"'\", \"&#39;\")\n}\n","export function parseHighlightLines(meta: string): number[] {\n const match = /\\{([\\d,-]+)\\}/u.exec(meta)\n if (match?.[1] == null) {\n return []\n }\n\n const lines: number[] = []\n for (const range of match[1].split(\",\")) {\n appendRangeLines(lines, range)\n }\n\n return lines\n}\n\nfunction appendRangeLines(lines: number[], range: string): void {\n if (range.includes(\"-\")) {\n appendRangeSet(lines, range)\n return\n }\n\n const lineNumber = Number(range)\n if (Number.isFinite(lineNumber)) {\n lines.push(lineNumber)\n }\n}\n\nfunction appendRangeSet(lines: number[], range: string): void {\n const [start, end] = range.split(\"-\").map(Number)\n if (!Number.isFinite(start) || !Number.isFinite(end)) {\n return\n }\n\n for (let line = start; line <= end; line++) {\n lines.push(line)\n }\n}\n\nexport function parseTitle(meta: string): string | undefined {\n const match = /title=\"([^\"]+)\"/u.exec(meta)\n return match?.[1]\n}\n\nexport function parseLabel(meta: string): string | undefined {\n const start = meta.indexOf(\"[\")\n if (start === -1) {\n return undefined\n }\n\n const end = meta.indexOf(\"]\", start + 1)\n if (end === -1) {\n return undefined\n }\n\n const label = meta.slice(start + 1, end).trim()\n return label.length > 0 ? label : undefined\n}\n","import type { Element, Root, Text } from \"hast\"\nimport type { Highlighter } from \"shiki\"\n\nimport { visit } from \"unist-util-visit\"\n\nimport type { MarkdownConfig } from \"../config/types\"\n\nimport { shikiContainerClassName } from \"../ui/components/code-block-classes\"\nimport { buildCodeBlockHtml } from \"./shiki-html\"\nimport { parseHighlightLines, parseTitle } from \"./shiki-meta\"\nimport { highlightWithTheme, resolveThemeConfig } from \"./shiki-theme\"\n\ntype RehypeShikiOptions = {\n config: MarkdownConfig\n highlighter: Highlighter\n}\n\ntype TransformCodeNodeContext = {\n config: MarkdownConfig\n highlighter: Highlighter\n index: number | undefined\n node: Element\n parent: unknown\n themeConfig: MarkdownConfig[\"theme\"]\n}\n\nexport function rehypeShikiFromHighlighter(options: RehypeShikiOptions) {\n const themeConfig = resolveThemeConfig(options.config.theme)\n\n return function (tree: Root): void {\n visit(tree, \"element\", (node: Element, index, parent) => {\n transformCodeNode({\n config: options.config,\n highlighter: options.highlighter,\n index,\n node,\n parent,\n themeConfig,\n })\n })\n }\n}\n\nfunction transformCodeNode(context: TransformCodeNodeContext): void {\n const codeNode = getCodeNode(context.node)\n if (codeNode == null) {\n return\n }\n\n const codeContent = getTextContent(codeNode)\n if (codeContent.trim().length === 0) {\n return\n }\n\n const metaString = getMetaString(codeNode)\n const language = getLanguage(codeNode)\n const innerHtml = tryRenderHighlightedHtml({\n codeContent,\n context,\n language,\n metaString,\n })\n if (innerHtml == null) {\n return\n }\n\n replaceNodeWithShikiContainer(context.parent, context.index, innerHtml)\n}\n\nfunction tryRenderHighlightedHtml(params: {\n codeContent: string\n context: TransformCodeNodeContext\n language: string\n metaString: string\n}): null | string {\n const { codeContent, context, language, metaString } = params\n try {\n const html = highlightWithTheme({\n code: codeContent,\n highlighter: context.highlighter,\n language,\n themeConfig: context.themeConfig,\n })\n\n return buildCodeBlockHtml(html, {\n highlightLines: parseHighlightLines(metaString),\n lang: language,\n lineNumbers: (context.config.lineNumbers ?? false) || metaString.includes(\"showLineNumbers\"),\n title: parseTitle(metaString),\n })\n } catch {\n return null\n }\n}\n\nfunction getCodeNode(node: Element): Element | null {\n if (node.tagName !== \"pre\") {\n return null\n }\n\n const firstChild = node.children.at(0)\n if (!isElementNode(firstChild) || firstChild.tagName !== \"code\") {\n return null\n }\n\n return firstChild\n}\n\nfunction isElementNode(node: unknown): node is Element {\n return isRecord(node) && node.type === \"element\"\n}\n\nfunction getMetaString(codeNode: Element): string {\n const properties = toRecord(codeNode.properties)\n return typeof properties.metastring === \"string\" ? properties.metastring : \"\"\n}\n\nfunction getLanguage(codeNode: Element): string {\n const properties = toRecord(codeNode.properties)\n const classNames = toClassNameList(properties.className)\n const languageClass = classNames.find((className) => className.startsWith(\"language-\"))\n\n return languageClass == null ? \"text\" : languageClass.replace(\"language-\", \"\")\n}\n\nfunction toClassNameList(className: unknown): string[] {\n if (Array.isArray(className)) {\n return className.filter((entry): entry is string => typeof entry === \"string\")\n }\n\n if (typeof className === \"string\") {\n return [className]\n }\n\n return []\n}\n\nfunction getTextContent(node: Element | Text): string {\n if (node.type === \"text\") {\n return node.value\n }\n\n const parts: string[] = []\n for (const child of node.children) {\n if (child.type === \"text\" || child.type === \"element\") {\n parts.push(getTextContent(child))\n }\n }\n\n return parts.join(\"\")\n}\n\nfunction replaceNodeWithShikiContainer(\n parent: unknown,\n index: number | undefined,\n innerHtml: string\n): void {\n if (index == null || !hasChildrenArray(parent)) {\n return\n }\n\n parent.children[index] = {\n type: \"element\",\n tagName: \"div\",\n properties: {\n className: [shikiContainerClassName],\n },\n children: [\n {\n type: \"raw\",\n value: innerHtml,\n },\n ],\n }\n}\n\nfunction hasChildrenArray(value: unknown): value is { children: unknown[] } {\n return isRecord(value) && Array.isArray(value.children)\n}\n\nfunction toRecord(value: unknown): Record<string, unknown> {\n return isRecord(value) ? value : {}\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n","import type { Root } from \"hast\"\nimport type { ShikiTransformer } from \"shiki\"\n\nimport { visit } from \"unist-util-visit\"\n\nimport { parseHighlightLines, parseLabel, parseTitle } from \"./shiki-meta\"\n\n/**\n * Remark plugin that extracts code fence meta info and stores it as HAST\n * data attributes before MDX compilation can corrupt it.\n */\nexport function remarkCodeMeta() {\n return function (tree: Root): void {\n visit(tree, \"code\", (node: { data?: Record<string, unknown>; meta?: null | string }) => {\n const meta = node.meta\n if (meta == null || meta.length === 0) {\n return\n }\n\n const data = ensureNodeData(node)\n const hProperties = ensureRecord(data.hProperties)\n\n // Preserve meta as metastring property on the <code> HAST element.\n // @shikijs/rehype reads head.properties.metastring and passes it\n // to Shiki as meta.__raw, which ardoLineTransformer reads.\n hProperties.metastring = meta\n data.hProperties = hProperties\n\n // Strip meta from the MDAST node to prevent MDX from\n // misinterpreting {expressions} like {2,4-5} as JSX.\n node.meta = null\n })\n }\n}\n\nfunction ensureNodeData(node: { data?: Record<string, unknown> }): Record<string, unknown> {\n node.data ??= {}\n return node.data\n}\n\nfunction ensureRecord(value: unknown): Record<string, unknown> {\n return isRecord(value) ? value : {}\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n\ntype ArdoLineTransformerOptions = {\n globalLineNumbers?: boolean\n}\n\ntype LineTransformerState = {\n highlightLines: number[]\n metaRaw: string\n showLineNumbers: boolean\n}\n\ntype TransformerNode = {\n properties?: Record<string, unknown>\n}\n\n/**\n * Shiki transformer that adds line highlighting, line numbers, and title\n * attributes to code blocks in the MDX pipeline.\n */\nexport function ardoLineTransformer(options: ArdoLineTransformerOptions = {}): ShikiTransformer {\n const state: LineTransformerState = {\n highlightLines: [],\n metaRaw: \"\",\n showLineNumbers: false,\n }\n\n return {\n name: \"ardo:lines\",\n preprocess(_code, shikiOptions) {\n const metaRaw = getMetaRaw(shikiOptions.meta)\n state.metaRaw = metaRaw\n state.highlightLines = parseHighlightLines(metaRaw)\n state.showLineNumbers =\n (options.globalLineNumbers ?? false) || metaRaw.includes(\"showLineNumbers\")\n },\n pre(node) {\n const properties = ensureNodeProperties(node)\n applyTitleProperty(properties, state.metaRaw)\n applyLabelProperty(properties, state.metaRaw)\n },\n line(node, line) {\n const properties = ensureNodeProperties(node)\n applyHighlightedLineClass(properties, state.highlightLines, line)\n\n if (state.showLineNumbers) {\n properties[\"data-ln\"] = String(line)\n }\n },\n }\n}\n\nfunction getMetaRaw(meta: unknown): string {\n if (!isRecord(meta)) {\n return \"\"\n }\n\n const raw = meta.__raw\n return typeof raw === \"string\" ? raw : \"\"\n}\n\nfunction ensureNodeProperties(node: TransformerNode): Record<string, unknown> {\n node.properties ??= {}\n return node.properties\n}\n\nfunction applyTitleProperty(properties: Record<string, unknown>, metaRaw: string): void {\n const title = parseTitle(metaRaw)\n if (title != null && title.length > 0) {\n properties[\"data-title\"] = title\n }\n}\n\nfunction applyLabelProperty(properties: Record<string, unknown>, metaRaw: string): void {\n const label = parseLabel(metaRaw)\n if (label != null && label.length > 0) {\n properties[\"data-label\"] = label\n }\n}\n\nfunction applyHighlightedLineClass(\n properties: Record<string, unknown>,\n highlightLines: number[],\n line: number\n): void {\n if (!highlightLines.includes(line)) {\n return\n }\n\n const currentClass = typeof properties.class === \"string\" ? properties.class : \"\"\n properties.class = currentClass.length > 0 ? `${currentClass} highlighted` : \"highlighted\"\n}\n","import { createHighlighter, type Highlighter } from \"shiki\"\n\nimport type { MarkdownConfig } from \"../config/types\"\n\nimport { getBundledThemes, highlightWithTheme, resolveThemeConfig } from \"./shiki-theme\"\n\nexport { rehypeShikiFromHighlighter } from \"./shiki-rehype\"\nexport { ardoLineTransformer, remarkCodeMeta } from \"./shiki-transformer\"\n\nexport type ShikiHighlighter = Highlighter\n\nlet cachedHighlighterPromise: Promise<ShikiHighlighter> | undefined\n\n/**\n * Highlights code using Shiki with Ardo's default themes.\n * Creates and caches a highlighter instance for reuse.\n */\nexport async function highlightCode(\n code: string,\n language: string,\n options?: { theme?: MarkdownConfig[\"theme\"] }\n): Promise<string> {\n const themeConfig = resolveThemeConfig(options?.theme)\n const highlighter = await getCachedHighlighter(themeConfig)\n\n return highlightWithTheme({\n code,\n highlighter,\n language,\n themeConfig,\n })\n}\n\nasync function getCachedHighlighter(\n themeConfig: MarkdownConfig[\"theme\"]\n): Promise<ShikiHighlighter> {\n cachedHighlighterPromise ??= createShikiHighlighter({\n anchor: false,\n lineNumbers: false,\n theme: themeConfig,\n toc: { level: [2, 3] },\n })\n\n return cachedHighlighterPromise\n}\n\nexport async function createShikiHighlighter(config: MarkdownConfig): Promise<ShikiHighlighter> {\n const themeConfig = resolveThemeConfig(config.theme)\n\n return createHighlighter({\n themes: getBundledThemes(themeConfig),\n langs: [\n // Web fundamentals\n \"javascript\",\n \"typescript\",\n \"jsx\",\n \"tsx\",\n \"html\",\n \"css\",\n \"scss\",\n\n // Data & config formats\n \"json\",\n \"jsonc\",\n \"yaml\",\n \"toml\",\n \"xml\",\n \"graphql\",\n\n // Markdown & docs\n \"markdown\",\n \"mdx\",\n\n // Shell & DevOps\n \"bash\",\n \"shell\",\n \"dockerfile\",\n\n // General purpose\n \"python\",\n \"rust\",\n \"go\",\n \"sql\",\n \"diff\",\n ],\n })\n}\n","import type { Heading, Root } from \"mdast\"\n\nimport { visit } from \"unist-util-visit\"\n\nimport type { TOCItem } from \"../config/types\"\n\nexport type TocExtraction = {\n toc: TOCItem[]\n}\n\ntype TocOptions = {\n tocExtraction: TocExtraction\n levels: [number, number]\n}\n\nexport function remarkExtractToc(options: TocOptions) {\n const { tocExtraction, levels } = options\n const [minLevel, maxLevel] = levels\n\n return function (tree: Root) {\n const headings: Array<{ text: string; level: number; id: string }> = []\n let headingIndex = 0\n\n visit(tree, \"heading\", (node: Heading) => {\n if (node.depth < minLevel || node.depth > maxLevel) {\n return\n }\n\n const text = getHeadingText(node)\n const slug = slugify(text)\n const id = slug === \"\" ? `heading-${headingIndex}` : slug\n headingIndex++\n\n headings.push({\n text,\n level: node.depth,\n id,\n })\n\n // Add id to the heading node for anchor links\n const hProperties = ensureHProperties(node)\n hProperties.id = id\n })\n\n tocExtraction.toc = buildTocTree(headings)\n }\n}\n\nfunction getHeadingText(node: Heading): string {\n const textParts: string[] = []\n\n function extractText(child: unknown) {\n if (!isRecord(child)) return\n\n if (child.type === \"text\") {\n textParts.push(typeof child.value === \"string\" ? child.value : \"\")\n } else if (child.type === \"inlineCode\") {\n textParts.push(typeof child.value === \"string\" ? child.value : \"\")\n } else if (Array.isArray(child.children)) {\n child.children.forEach((nestedChild) => {\n extractText(nestedChild)\n })\n }\n }\n\n node.children.forEach((child) => {\n extractText(child)\n })\n return textParts.join(\"\")\n}\n\nfunction slugify(text: string): string {\n let slug = text\n .toLowerCase()\n .trim()\n .replaceAll(/[^\\s\\w-]/g, \"\")\n .replaceAll(/[\\s_]/g, \"-\")\n\n while (slug.includes(\"--\")) {\n slug = slug.replaceAll(\"--\", \"-\")\n }\n\n if (slug.startsWith(\"-\")) {\n slug = slug.slice(1)\n }\n\n if (slug.endsWith(\"-\")) {\n slug = slug.slice(0, -1)\n }\n\n return slug\n}\n\nfunction popStackUntilParent(stack: Array<{ item: TOCItem; level: number }>, level: number): void {\n while (stack.length > 0) {\n const last = stack.at(-1)\n if (last === undefined || last.level < level) break\n stack.pop()\n }\n}\n\nfunction insertIntoTree(\n result: TOCItem[],\n stack: Array<{ item: TOCItem; level: number }>,\n item: TOCItem\n): void {\n const parent = stack.at(-1)?.item\n if (parent === undefined) {\n result.push(item)\n } else {\n parent.children ??= []\n parent.children.push(item)\n }\n}\n\nfunction buildTocTree(headings: Array<{ text: string; level: number; id: string }>): TOCItem[] {\n const result: TOCItem[] = []\n const stack: Array<{ item: TOCItem; level: number }> = []\n\n for (const heading of headings) {\n const item: TOCItem = { id: heading.id, text: heading.text, level: heading.level }\n popStackUntilParent(stack, heading.level)\n insertIntoTree(result, stack, item)\n stack.push({ item, level: heading.level })\n }\n\n return result\n}\n\ntype HeadingDataWithHProperties = {\n hProperties?: Record<string, unknown>\n} & Heading[\"data\"]\n\nfunction ensureHProperties(node: Heading): Record<string, unknown> {\n const data: HeadingDataWithHProperties = node.data ?? {}\n node.data = data\n\n if (!isRecord(data.hProperties)) {\n data.hProperties = {}\n }\n\n return data.hProperties\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n\nexport function flattenToc(toc: TOCItem[]): TOCItem[] {\n const result: TOCItem[] = []\n\n function flatten(items: TOCItem[]) {\n for (const item of items) {\n result.push(item)\n if (item.children !== undefined) {\n flatten(item.children)\n }\n }\n }\n\n flatten(toc)\n return result\n}\n","import matter from \"gray-matter\"\nimport rehypeStringify from \"rehype-stringify\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkParse from \"remark-parse\"\nimport remarkRehype from \"remark-rehype\"\nimport { unified } from \"unified\"\n\nimport type { MarkdownConfig, PageFrontmatter, TOCItem } from \"../config/types\"\n\nimport { rehypeLinks } from \"./links\"\nimport { createShikiHighlighter, rehypeShikiFromHighlighter, type ShikiHighlighter } from \"./shiki\"\nimport { remarkExtractToc, type TocExtraction } from \"./toc\"\n\nexport type TransformResult = {\n html: string\n frontmatter: PageFrontmatter\n toc: TOCItem[]\n}\n\nexport type TransformOptions = {\n basePath?: string\n highlighter?: ShikiHighlighter\n}\n\nexport async function transformMarkdown(\n content: string,\n config: MarkdownConfig,\n options: TransformOptions = {}\n): Promise<TransformResult> {\n const { data, content: markdownContent } = matter(content)\n const frontmatterData: unknown = data\n const { basePath = \"/\", highlighter: providedHighlighter } = options\n\n const tocExtraction: TocExtraction = { toc: [] }\n const highlighter = providedHighlighter ?? (await createShikiHighlighter(config))\n\n const processor = unified()\n .use(remarkParse)\n .use(remarkFrontmatter, [\"yaml\"])\n .use(remarkGfm)\n .use(remarkExtractToc, { tocExtraction, levels: config.toc?.level ?? [2, 3] })\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeShikiFromHighlighter, { highlighter, config })\n .use(rehypeLinks, { basePath })\n .use(rehypeStringify, { allowDangerousHtml: true })\n\n if (config.remarkPlugins) {\n processor.use(config.remarkPlugins)\n }\n\n if (config.rehypePlugins) {\n processor.use(config.rehypePlugins)\n }\n\n const result = await processor.process(markdownContent)\n\n return {\n html: String(result),\n frontmatter: readPageFrontmatter(frontmatterData),\n toc: tocExtraction.toc,\n }\n}\n\nexport async function transformMarkdownToReact(\n content: string,\n config: MarkdownConfig\n): Promise<TransformResult> {\n return transformMarkdown(content, config)\n}\n\nfunction readPageFrontmatter(data: unknown): PageFrontmatter {\n return isRecord(data) ? data : {}\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n","import fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport type { PageData, PageFrontmatter, ResolvedConfig, TOCItem } from \"../config/types\"\n\nimport { transformMarkdown } from \"../markdown/pipeline\"\n\nexport type LoadDocOptions = {\n slug: string\n contentDir: string\n config: ResolvedConfig\n}\n\nexport type LoadDocResult = {\n content: string\n frontmatter: PageFrontmatter\n toc: TOCItem[]\n filePath: string\n relativePath: string\n lastUpdated?: number\n}\n\nasync function findFile(\n contentDir: string,\n slug: string\n): Promise<{ filePath: string; fileContent: string } | null> {\n const possiblePaths = [\n path.join(contentDir, `${slug}.md`),\n path.join(contentDir, slug, \"index.md\"),\n ]\n\n for (const tryPath of possiblePaths) {\n try {\n const fileContent = await fs.readFile(tryPath, \"utf8\")\n return { filePath: tryPath, fileContent }\n } catch {\n continue\n }\n }\n return null\n}\n\nasync function getLastUpdated(filePath: string): Promise<number | undefined> {\n try {\n const stat = await fs.stat(filePath)\n return stat.mtimeMs\n } catch {\n return undefined\n }\n}\n\nexport async function loadDoc(options: LoadDocOptions): Promise<LoadDocResult | null> {\n const { slug, contentDir, config } = options\n const found = await findFile(contentDir, slug)\n if (found === null) return null\n\n const result = await transformMarkdown(found.fileContent, config.markdown)\n return {\n content: result.html,\n frontmatter: result.frontmatter,\n toc: result.toc,\n filePath: found.filePath,\n relativePath: path.relative(contentDir, found.filePath),\n lastUpdated: await getLastUpdated(found.filePath),\n }\n}\n\nexport async function loadAllDocs(contentDir: string, config: ResolvedConfig): Promise<PageData[]> {\n const docs: PageData[] = []\n\n async function scanDir(dir: string) {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n await scanDir(fullPath)\n } else if (entry.name.endsWith(\".md\")) {\n const fileContent = await fs.readFile(fullPath, \"utf8\")\n const result = await transformMarkdown(fileContent, config.markdown)\n const relativePath = path.relative(contentDir, fullPath)\n\n let lastUpdated: number | undefined\n try {\n const stat = await fs.stat(fullPath)\n lastUpdated = stat.mtimeMs\n } catch {\n // Ignore stat errors\n }\n\n docs.push({\n title: result.frontmatter.title ?? formatTitle(entry.name.replace(/\\.md$/, \"\")),\n description: result.frontmatter.description,\n frontmatter: result.frontmatter,\n content: result.html,\n toc: result.toc,\n filePath: fullPath,\n relativePath,\n lastUpdated,\n })\n }\n }\n }\n\n await scanDir(contentDir)\n return docs\n}\n\nfunction formatTitle(name: string): string {\n return name.replaceAll(/[_-]/g, \" \").replaceAll(/\\b\\w/g, (c) => c.toUpperCase())\n}\n\nexport function getSlugFromPath(relativePath: string): string {\n return relativePath\n .replace(/\\.md$/, \"\")\n .replace(/\\/index$/, \"\")\n .replaceAll(\"\\\\\", \"/\")\n}\n\nexport function getPageDataForRoute(docs: PageData[], slug: string): PageData | undefined {\n return docs.find((doc) => {\n const docSlug = getSlugFromPath(doc.relativePath)\n return docSlug === slug || docSlug === `${slug}/index`\n })\n}\n","import type { Dirent } from \"node:fs\"\n\nimport matter from \"gray-matter\"\nimport fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport type { ResolvedConfig, SidebarItem } from \"../config/types\"\n\nexport type SidebarGenerationOptions = {\n basePath: string\n config: ResolvedConfig\n contentDir: string\n}\n\ntype SidebarItemWithOrder = {\n order?: number\n} & SidebarItem\n\ntype SidebarFrontmatter = {\n order?: number\n sidebar?: boolean\n title?: string\n}\n\nexport async function generateSidebar(options: SidebarGenerationOptions): Promise<SidebarItem[]> {\n const { contentDir } = options\n return scanDirectoryForSidebar(contentDir, contentDir)\n}\n\nasync function scanDirectoryForSidebar(dir: string, rootDir: string): Promise<SidebarItem[]> {\n const entries = await readDirectoryEntries(dir)\n const items: SidebarItemWithOrder[] = []\n\n for (const entry of entries) {\n const sidebarItem = await createSidebarItemFromEntry({\n dir,\n entry,\n rootDir,\n })\n\n if (sidebarItem != null) {\n items.push(sidebarItem)\n }\n }\n\n sortSidebarItems(items)\n return items.map(({ order: _order, ...item }) => item)\n}\n\nasync function readDirectoryEntries(dir: string): Promise<Dirent[]> {\n try {\n return await fs.readdir(dir, { withFileTypes: true })\n } catch {\n return []\n }\n}\n\nasync function createSidebarItemFromEntry(params: {\n dir: string\n entry: Dirent\n rootDir: string\n}): Promise<null | SidebarItemWithOrder> {\n const { dir, entry, rootDir } = params\n if (isIgnoredEntry(entry.name)) {\n return null\n }\n\n const fullPath = path.join(dir, entry.name)\n const relativePath = path.relative(rootDir, fullPath)\n\n if (entry.isDirectory()) {\n return createDirectorySidebarItem(fullPath, relativePath, rootDir)\n }\n\n if (isMarkdownPage(entry.name)) {\n return createMarkdownSidebarItem(fullPath, relativePath, entry.name)\n }\n\n return null\n}\n\nfunction isIgnoredEntry(entryName: string): boolean {\n return entryName.startsWith(\".\") || entryName.startsWith(\"_\")\n}\n\nfunction isMarkdownPage(entryName: string): boolean {\n return entryName.endsWith(\".md\") && entryName !== \"index.md\"\n}\n\nasync function createDirectorySidebarItem(\n fullPath: string,\n relativePath: string,\n rootDir: string\n): Promise<null | SidebarItemWithOrder> {\n const children = await scanDirectoryForSidebar(fullPath, rootDir)\n if (children.length === 0) {\n return null\n }\n\n const metadata = await readDirectoryIndexMetadata(fullPath, relativePath)\n const title = metadata.title ?? formatTitle(path.basename(fullPath))\n\n return {\n collapsed: false,\n items: children,\n link: metadata.link,\n order: metadata.order,\n text: title,\n }\n}\n\nasync function readDirectoryIndexMetadata(\n fullPath: string,\n relativePath: string\n): Promise<{ link?: string; order?: number; title?: string }> {\n const indexPath = path.join(fullPath, \"index.md\")\n const frontmatter = await readFrontmatter(indexPath)\n\n return {\n link: frontmatter == null ? undefined : normalizePath(relativePath),\n order: frontmatter?.order,\n title: frontmatter?.title,\n }\n}\n\nasync function createMarkdownSidebarItem(\n fullPath: string,\n relativePath: string,\n fileName: string\n): Promise<null | SidebarItemWithOrder> {\n const frontmatter = await readFrontmatter(fullPath)\n if (frontmatter?.sidebar === false) {\n return null\n }\n\n const fallbackTitle = formatTitle(fileName.replace(/\\.md$/u, \"\"))\n const title = frontmatter?.title ?? fallbackTitle\n\n return {\n link: normalizePath(relativePath.replace(/\\.md$/u, \"\")),\n order: frontmatter?.order,\n text: title,\n }\n}\n\nasync function readFrontmatter(filePath: string): Promise<null | SidebarFrontmatter> {\n try {\n const fileContent = await fs.readFile(filePath, \"utf8\")\n const parsed = matter(fileContent)\n return toSidebarFrontmatter(parsed.data)\n } catch {\n return null\n }\n}\n\nfunction toSidebarFrontmatter(data: unknown): SidebarFrontmatter {\n if (!isRecord(data)) {\n return {}\n }\n\n return {\n order: typeof data.order === \"number\" ? data.order : undefined,\n sidebar: typeof data.sidebar === \"boolean\" ? data.sidebar : undefined,\n title: typeof data.title === \"string\" ? data.title : undefined,\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n\nfunction sortSidebarItems(items: SidebarItemWithOrder[]): void {\n items.sort((left, right) => {\n if (left.order != null && right.order != null) {\n return left.order - right.order\n }\n\n if (left.order != null) {\n return -1\n }\n\n if (right.order != null) {\n return 1\n }\n\n return left.text.localeCompare(right.text)\n })\n}\n\nfunction formatTitle(name: string): string {\n return name\n .replace(/^\\d+-/u, \"\")\n .replaceAll(/[_-]/gu, \" \")\n .replaceAll(/\\b\\w/gu, (char) => char.toUpperCase())\n}\n\nfunction normalizePath(p: string): string {\n return `/${p.replaceAll(\"\\\\\", \"/\").replace(/^\\/+/u, \"\")}`\n}\n","export type ScannedCodeBlock = {\n children: null | string\n end: number\n fullMatch: string\n props: string\n start: number\n}\n\nconst OPENING_TAG = \"<ArdoCodeBlock\"\nconst CLOSING_TAG = \"</ArdoCodeBlock>\"\n\n/**\n * Strips leading/trailing blank lines and removes common leading whitespace.\n * Same logic as the runtime outdent in CodeBlock.tsx.\n */\nexport function outdent(text: string): string {\n const trimmedLines = trimBlankLines(text.split(\"\\n\"))\n if (trimmedLines.length === 0) {\n return \"\"\n }\n\n const commonIndent = getCommonIndent(trimmedLines)\n if (commonIndent === 0) {\n return trimmedLines.join(\"\\n\")\n }\n\n return trimmedLines.map((line) => stripIndent(line, commonIndent)).join(\"\\n\")\n}\n\nfunction trimBlankLines(lines: string[]): string[] {\n const result = [...lines]\n\n while (result.length > 0 && result[0].trim().length === 0) {\n result.shift()\n }\n\n while (result.length > 0 && result.at(-1)?.trim().length === 0) {\n result.pop()\n }\n\n return result\n}\n\nfunction getCommonIndent(lines: string[]): number {\n let minIndent = Number.POSITIVE_INFINITY\n\n for (const line of lines) {\n if (line.trim().length === 0) {\n continue\n }\n\n const indent = getLeadingWhitespaceLength(line)\n if (indent < minIndent) {\n minIndent = indent\n }\n }\n\n return Number.isFinite(minIndent) ? minIndent : 0\n}\n\nfunction stripIndent(line: string, commonIndent: number): string {\n const availableIndent = getLeadingWhitespaceLength(line)\n const removeCount = Math.min(commonIndent, availableIndent)\n return line.slice(removeCount)\n}\n\nfunction getLeadingWhitespaceLength(line: string): number {\n let index = 0\n while (index < line.length) {\n const char = line[index]\n if (char !== \" \" && char !== \"\\t\") {\n break\n }\n index++\n }\n return index\n}\n\n/**\n * Finds all `<ArdoCodeBlock ... />` and `<ArdoCodeBlock ...>...</ArdoCodeBlock>` tags\n * by scanning for balanced quotes and braces.\n */\nexport function scanArdoCodeBlocks(source: string): ScannedCodeBlock[] {\n const blocks: ScannedCodeBlock[] = []\n let cursor = 0\n\n while (cursor < source.length) {\n const scanResult = scanNextCodeBlock(source, cursor)\n if (scanResult == null) {\n break\n }\n\n const { block, nextCursor } = scanResult\n if (block != null) {\n blocks.push(block)\n }\n\n cursor = nextCursor\n }\n\n return blocks\n}\n\nfunction scanNextCodeBlock(\n source: string,\n cursor: number\n): { block: null | ScannedCodeBlock; nextCursor: number } | null {\n const start = source.indexOf(OPENING_TAG, cursor)\n if (start === -1) {\n return null\n }\n\n const opening = scanOpeningTag(source, start)\n if (opening == null) {\n return { block: null, nextCursor: start + OPENING_TAG.length }\n }\n\n const block = createScannedBlock(source, start, opening)\n if (block == null) {\n return null\n }\n\n return { block, nextCursor: block.end }\n}\n\ntype OpeningTag = {\n end: number\n isSelfClosing: boolean\n props: string\n}\n\nfunction scanOpeningTag(source: string, start: number): null | OpeningTag {\n const afterTag = start + OPENING_TAG.length\n if (!isWhitespaceChar(source[afterTag])) {\n return null\n }\n\n let index = afterTag\n let braceDepth = 0\n let quote: null | QuoteChar = null\n\n while (index < source.length) {\n const step = advanceOpeningTagScan(source, {\n braceDepth,\n index,\n quote,\n })\n if (step.tagEndIndex != null) {\n return finalizeOpeningTag(source, afterTag, step.tagEndIndex)\n }\n\n index = step.nextIndex\n braceDepth = step.nextBraceDepth\n quote = step.nextQuote\n }\n\n return null\n}\n\nfunction finalizeOpeningTag(source: string, afterTag: number, endBracketIndex: number): OpeningTag {\n const isSelfClosing = source[endBracketIndex - 1] === \"/\"\n const propsEnd = isSelfClosing ? endBracketIndex - 1 : endBracketIndex\n const props = source.slice(afterTag, propsEnd).trim()\n\n return {\n end: endBracketIndex + 1,\n isSelfClosing,\n props,\n }\n}\n\ntype QuoteChar = '\"' | \"'\" | \"`\"\n\ntype OpeningTagScanStep = {\n nextBraceDepth: number\n nextIndex: number\n nextQuote: null | QuoteChar\n tagEndIndex: null | number\n}\n\ntype ScanCursorState = {\n braceDepth: number\n index: number\n quote: null | QuoteChar\n}\n\nfunction advanceOpeningTagScan(source: string, state: ScanCursorState): OpeningTagScanStep {\n const { braceDepth, index, quote } = state\n if (quote != null) {\n return scanQuotedStep(source, {\n braceDepth,\n index,\n quote,\n })\n }\n\n return scanUnquotedStep(source, index, braceDepth)\n}\n\nfunction scanQuotedStep(source: string, state: ScanCursorState): OpeningTagScanStep {\n const { braceDepth, index, quote } = state\n if (source[index] === \"\\\\\") {\n return {\n nextBraceDepth: braceDepth,\n nextIndex: Math.min(source.length, index + 2),\n nextQuote: quote,\n tagEndIndex: null,\n }\n }\n\n const closesQuote = source[index] === quote\n return {\n nextBraceDepth: braceDepth,\n nextIndex: index + 1,\n nextQuote: closesQuote ? null : quote,\n tagEndIndex: null,\n }\n}\n\nfunction scanUnquotedStep(source: string, index: number, braceDepth: number): OpeningTagScanStep {\n const char = source[index]\n if (isQuote(char)) {\n return makeScanStep(index + 1, braceDepth, char)\n }\n\n if (char === \"{\") {\n return makeScanStep(index + 1, braceDepth + 1, null)\n }\n\n if (char === \"}\") {\n return makeScanStep(index + 1, Math.max(0, braceDepth - 1), null)\n }\n\n if (braceDepth === 0 && char === \">\") {\n return {\n nextBraceDepth: braceDepth,\n nextIndex: index + 1,\n nextQuote: null,\n tagEndIndex: index,\n }\n }\n\n return makeScanStep(index + 1, braceDepth, null)\n}\n\nfunction makeScanStep(\n nextIndex: number,\n nextBraceDepth: number,\n nextQuote: null | QuoteChar\n): OpeningTagScanStep {\n return {\n nextBraceDepth,\n nextIndex,\n nextQuote,\n tagEndIndex: null,\n }\n}\n\nfunction createScannedBlock(\n source: string,\n start: number,\n opening: OpeningTag\n): null | ScannedCodeBlock {\n if (opening.isSelfClosing) {\n return {\n children: null,\n end: opening.end,\n fullMatch: source.slice(start, opening.end),\n props: opening.props,\n start,\n }\n }\n\n const closeStart = source.indexOf(CLOSING_TAG, opening.end)\n if (closeStart === -1) {\n return null\n }\n\n const end = closeStart + CLOSING_TAG.length\n return {\n children: source.slice(opening.end, closeStart),\n end,\n fullMatch: source.slice(start, end),\n props: opening.props,\n start,\n }\n}\n\nfunction isQuote(char: string): char is QuoteChar {\n return char === \"'\" || char === '\"' || char === \"`\"\n}\n\nfunction isWhitespaceChar(char: string | undefined): boolean {\n return char === \" \" || char === \"\\n\" || char === \"\\r\" || char === \"\\t\"\n}\n","import type { MarkdownConfig } from \"../config/types\"\n\nimport { highlightCode } from \"../markdown/shiki\"\nimport { outdent, scanArdoCodeBlocks, type ScannedCodeBlock } from \"./codeblock-scan\"\n\nexport async function transformArdoCodeBlocks(\n source: string,\n markdownConfig?: MarkdownConfig\n): Promise<string> {\n let result = source\n let offset = 0\n const blocks = scanArdoCodeBlocks(source)\n\n for (const block of blocks) {\n const replacement = await createReplacement(block, markdownConfig)\n if (replacement == null) {\n continue\n }\n\n const adjustedStart = block.start + offset\n const adjustedEnd = block.end + offset\n result = result.slice(0, adjustedStart) + replacement + result.slice(adjustedEnd)\n offset += replacement.length - block.fullMatch.length\n }\n\n return result\n}\n\nasync function createReplacement(\n block: ScannedCodeBlock,\n markdownConfig?: MarkdownConfig\n): Promise<null | string> {\n if (block.props.includes(\"__html\")) {\n return null\n }\n\n if (block.children == null) {\n return createSelfClosingReplacement(block, markdownConfig)\n }\n\n return createChildrenReplacement(block, markdownConfig)\n}\n\nasync function createSelfClosingReplacement(\n block: ScannedCodeBlock,\n markdownConfig?: MarkdownConfig\n): Promise<null | string> {\n const codeValue = extractCodeValue(block.props)\n const language = extractPropValue(block.props, \"language\")\n if (codeValue == null || language == null) {\n return null\n }\n\n const html = await safeHighlightCode(codeValue, language, markdownConfig)\n if (html == null) {\n return null\n }\n\n const escapedHtml = JSON.stringify(html)\n const newProps = `__html={${escapedHtml}} ${block.props}`\n return block.fullMatch.replace(block.props, newProps)\n}\n\nasync function createChildrenReplacement(\n block: ScannedCodeBlock,\n markdownConfig?: MarkdownConfig\n): Promise<null | string> {\n const language = extractPropValue(block.props, \"language\")\n if (language == null || block.children == null) {\n return null\n }\n\n const rawChildren = unwrapTemplateChildren(block.children)\n const codeContent = outdent(rawChildren)\n const html = await safeHighlightCode(codeContent, language, markdownConfig)\n if (html == null) {\n return null\n }\n\n const escapedHtml = JSON.stringify(html)\n const escapedCode = JSON.stringify(codeContent)\n return `<ArdoCodeBlock __html={${escapedHtml}} code={${escapedCode}} ${block.props} />`\n}\n\nfunction unwrapTemplateChildren(rawChildren: string): string {\n const trimmed = rawChildren.trim()\n if (!trimmed.startsWith(\"{`\") || !trimmed.endsWith(\"`}\")) {\n return rawChildren\n }\n\n return trimmed.slice(2, -2)\n}\n\nfunction extractCodeValue(props: string): null | string {\n const code = extractPropValue(props, \"code\")\n if (code == null) {\n return null\n }\n\n return decodeEscapedString(code)\n}\n\nfunction decodeEscapedString(value: string): string {\n return value.replaceAll(\"\\\\n\", \"\\n\").replaceAll('\\\\\"', '\"').replaceAll(\"\\\\\\\\\", \"\\\\\")\n}\n\nfunction extractPropValue(props: string, propName: string): null | string {\n const patterns = getPropPatterns(propName)\n\n for (const pattern of patterns) {\n const match = pattern.exec(props)\n if (match?.[1] != null) {\n return match[1]\n }\n }\n\n return null\n}\n\nfunction getPropPatterns(propName: string): RegExp[] {\n return [\n new RegExp(`\\\\b${propName}=\"((?:[^\"\\\\\\\\]|\\\\\\\\.)*)\"`, \"su\"),\n new RegExp(`\\\\b${propName}=\\\\{\\\\s*\"((?:[^\"\\\\\\\\]|\\\\\\\\.)*)\"\\\\s*\\\\}`, \"su\"),\n new RegExp(`\\\\b${propName}=\\\\{\\\\s*'((?:[^'\\\\\\\\]|\\\\\\\\.)*)'\\\\s*\\\\}`, \"su\"),\n ]\n}\n\nasync function safeHighlightCode(\n codeContent: string,\n language: string,\n markdownConfig?: MarkdownConfig\n): Promise<null | string> {\n try {\n return await highlightCode(codeContent, language, {\n theme: markdownConfig?.theme,\n })\n } catch {\n return null\n }\n}\n","import type { Plugin } from \"vite\"\n\nimport type { MarkdownConfig } from \"../config/types\"\n\nimport { transformArdoCodeBlocks } from \"./codeblock-transform\"\n\n/**\n * Vite plugin that pre-highlights ArdoCodeBlock components at build time.\n *\n * Runs before the JSX parser, so children can contain arbitrary code\n * (including `<`, `{`, etc.) without causing syntax errors.\n */\nexport function ardoCodeBlockPlugin(markdownConfig?: MarkdownConfig): Plugin {\n return {\n enforce: \"pre\",\n name: \"ardo:codeblock-highlight\",\n\n async transform(code, id) {\n if (!shouldProcessFile(code, id)) {\n return\n }\n\n const transformed = await transformArdoCodeBlocks(code, markdownConfig)\n if (transformed === code) {\n return\n }\n\n return {\n code: transformed,\n map: null,\n }\n },\n }\n}\n\nfunction shouldProcessFile(code: string, id: string): boolean {\n if (!/\\.[jt]sx$/u.test(id)) {\n return false\n }\n\n if (id.includes(\"node_modules\")) {\n return false\n }\n\n return code.includes(\"ArdoCodeBlock\")\n}\n","import { execSync } from \"node:child_process\"\nimport fs from \"node:fs\"\nimport path from \"node:path\"\n\n/**\n * Finds the package root by looking for package.json in parent directories.\n * Returns the path relative to cwd, or undefined if not found.\n */\nexport function findPackageRoot(cwd: string): string | undefined {\n let currentDir = path.resolve(cwd)\n const filesystemRoot = path.parse(currentDir).root\n\n while (currentDir !== filesystemRoot) {\n const parentDir = path.dirname(currentDir)\n const packageJsonPath = path.join(parentDir, \"package.json\")\n if (fs.existsSync(packageJsonPath)) {\n const relativePath = path.relative(cwd, parentDir)\n return relativePath === \"\" ? \".\" : relativePath\n }\n\n currentDir = parentDir\n }\n\n return undefined\n}\n\n/**\n * Detects the GitHub repository name from git remote URL.\n * Returns the repo name (e.g., \"ardo\" from \"github.com/sebastian-software/ardo\")\n * or undefined if not a GitHub repo.\n */\nexport function detectGitHubRepoName(cwd: string): string | undefined {\n const remoteUrl = runGitCommand(cwd, \"git remote get-url origin\")\n if (remoteUrl == null) {\n return undefined\n }\n\n return parseGitHubRepoName(remoteUrl)\n}\n\n/**\n * Detects the current short git commit hash.\n */\nexport function detectGitHash(cwd: string): string | undefined {\n return runGitCommand(cwd, \"git rev-parse --short HEAD\")\n}\n\n/**\n * Detects the GitHub Pages basename from the git remote URL.\n * Returns \"/\" in dev mode or when no GitHub repo is detected.\n */\nexport function detectGitHubBasename(cwd?: string): string {\n if (process.env.NODE_ENV !== \"production\") {\n return \"/\"\n }\n\n const repoName = detectGitHubRepoName(cwd ?? process.cwd())\n return repoName != null ? `/${repoName}/` : \"/\"\n}\n\n/**\n * Recursively copies files from src to dest, overwriting existing files.\n */\nexport function copyRecursive(src: string, dest: string): void {\n const stat = fs.statSync(src)\n if (!stat.isDirectory()) {\n fs.copyFileSync(src, dest)\n return\n }\n\n if (!fs.existsSync(dest)) {\n fs.mkdirSync(dest, { recursive: true })\n }\n\n for (const item of fs.readdirSync(src)) {\n copyRecursive(path.join(src, item), path.join(dest, item))\n }\n}\n\nfunction runGitCommand(cwd: string, command: string): string | undefined {\n try {\n const commandResult = execSync(command, {\n cwd,\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n }).trim()\n\n return commandResult === \"\" ? undefined : commandResult\n } catch {\n return undefined\n }\n}\n\nfunction parseGitHubRepoName(remoteUrl: string): string | undefined {\n const normalizedUrl = remoteUrl.trim()\n if (!normalizedUrl.includes(\"github.com\")) {\n return undefined\n }\n\n const withoutGitSuffix = normalizedUrl.endsWith(\".git\")\n ? normalizedUrl.slice(0, -4)\n : normalizedUrl\n const slashSeparatedUrl = withoutGitSuffix.replace(\":\", \"/\")\n const urlSegments = slashSeparatedUrl.split(\"/\")\n const repoName = urlSegments.at(-1)\n const ownerName = urlSegments.at(-2)\n\n if (repoName == null || repoName === \"\" || ownerName == null || ownerName === \"\") {\n return undefined\n }\n\n return repoName\n}\n","import type { Plugin } from \"vite\"\n\nimport fs from \"node:fs\"\nimport path from \"node:path\"\n\nimport { copyRecursive } from \"./git-utils\"\n\nlet flattenExecuted = false\n\nexport function createFlattenPlugin(): Plugin {\n let detectedBase: string | undefined\n\n return {\n name: \"ardo:flatten-github-pages\",\n enforce: \"post\",\n configResolved(config) {\n detectedBase = config.base === \"/\" ? undefined : config.base\n },\n closeBundle() {\n if (flattenExecuted || detectedBase == null) {\n return\n }\n\n const baseName = trimSlashes(detectedBase)\n if (baseName === \"\") {\n return\n }\n\n const buildDir = path.join(process.cwd(), \"build\", \"client\")\n const nestedDir = path.join(buildDir, baseName)\n if (!fs.existsSync(nestedDir)) {\n return\n }\n\n console.log(`[ardo] Flattening build/client/${baseName}/ to build/client/ for GitHub Pages`)\n copyRecursive(nestedDir, buildDir)\n fs.rmSync(nestedDir, { recursive: true, force: true })\n console.log(\"[ardo] Build output flattened successfully.\")\n flattenExecuted = true\n },\n }\n}\n\nfunction trimSlashes(value: string): string {\n let trimmed = value\n\n while (trimmed.startsWith(\"/\")) {\n trimmed = trimmed.slice(1)\n }\n\n while (trimmed.endsWith(\"/\")) {\n trimmed = trimmed.slice(0, -1)\n }\n\n return trimmed\n}\n","import type { ServerResponse } from \"node:http\"\nimport type { Plugin, ResolvedConfig as ViteResolvedConfig } from \"vite\"\n\nimport { Resvg } from \"@resvg/resvg-js\"\nimport { existsSync } from \"node:fs\"\nimport { readFile } from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport { ARDO_FAVICON_SVG } from \"../ui/favicon\"\n\nconst ICON_FILES = new Set([\"favicon.ico\", \"icon.svg\", \"apple-touch-icon.png\"])\n\nexport type ArdoIconOptions =\n | {\n /**\n * Source SVG file path, resolved from the Vite root.\n * Inline SVG strings are also accepted.\n */\n source?: string\n }\n | false\n\nexport type GeneratedIconAsset = {\n fileName: string\n contentType: string\n source: string | Uint8Array\n}\n\nexport function createIconsPlugin(options: ArdoIconOptions | undefined): Plugin[] {\n if (options === false) {\n return []\n }\n\n let config: ViteResolvedConfig\n let assetsPromise: Promise<GeneratedIconAsset[]> | undefined\n\n const getAssets = async () => {\n assetsPromise ??= createIconAssets(config.root, options)\n return assetsPromise\n }\n\n const plugin: Plugin = {\n name: \"ardo:icons\",\n configResolved(resolvedConfig) {\n config = resolvedConfig\n },\n configureServer(server) {\n server.middlewares.use((request, response, next) => {\n void serveIconRequest({ config, getAssets, response, url: request.url })\n .then((served) => {\n if (!served) {\n next()\n }\n })\n .catch((error: unknown) => {\n if (error instanceof Error) {\n next(error)\n } else {\n next(new Error(String(error)))\n }\n })\n })\n },\n async generateBundle() {\n if (config.build.ssr !== false) {\n return\n }\n\n const assets = await getAssets()\n for (const asset of assets) {\n if (hasPublicAsset(config, asset.fileName)) {\n continue\n }\n\n this.emitFile({\n type: \"asset\",\n fileName: asset.fileName,\n source: asset.source,\n })\n }\n },\n }\n\n return [plugin]\n}\n\nasync function serveIconRequest(input: {\n config: ViteResolvedConfig\n getAssets: () => Promise<GeneratedIconAsset[]>\n response: ServerResponse\n url: string | undefined\n}): Promise<boolean> {\n const { config, getAssets, response, url } = input\n const fileName = getIconRequestFileName(url)\n if (fileName == null || hasPublicAsset(config, fileName)) {\n return false\n }\n\n const assets = await getAssets()\n const asset = assets.find((candidate) => candidate.fileName === fileName)\n if (asset == null) {\n return false\n }\n\n response.statusCode = 200\n response.setHeader(\"Content-Type\", asset.contentType)\n response.setHeader(\"Cache-Control\", \"no-cache\")\n response.end(asset.source)\n return true\n}\n\nexport async function createIconAssets(\n root: string,\n options: Exclude<ArdoIconOptions, false> | undefined\n): Promise<GeneratedIconAsset[]> {\n const svg = await resolveIconSvg(root, options?.source)\n const faviconPng = renderPng(svg, 32)\n const appleTouchIcon = renderPng(svg, 180)\n\n return [\n {\n fileName: \"favicon.ico\",\n contentType: \"image/x-icon\",\n source: createIco(faviconPng, 32),\n },\n {\n fileName: \"icon.svg\",\n contentType: \"image/svg+xml\",\n source: svg,\n },\n {\n fileName: \"apple-touch-icon.png\",\n contentType: \"image/png\",\n source: appleTouchIcon,\n },\n ]\n}\n\nasync function resolveIconSvg(root: string, source: string | undefined): Promise<string> {\n if (source == null) {\n return ARDO_FAVICON_SVG\n }\n\n const trimmedSource = source.trim()\n if (trimmedSource.startsWith(\"<svg\")) {\n return trimmedSource\n }\n\n return readFile(path.resolve(root, source), \"utf8\")\n}\n\nfunction renderPng(svg: string, size: number): Uint8Array {\n return new Resvg(svg, {\n fitTo: {\n mode: \"width\",\n value: size,\n },\n })\n .render()\n .asPng()\n}\n\nfunction createIco(png: Uint8Array, size: number): Uint8Array {\n const headerLength = 6\n const directoryLength = 16\n const imageOffset = headerLength + directoryLength\n const ico = new Uint8Array(imageOffset + png.length)\n const view = new DataView(ico.buffer)\n\n writeIcoHeader(view)\n writeIcoDirectory({ ico, imageOffset, pngLength: png.length, size, view })\n ico.set(png, imageOffset)\n\n return ico\n}\n\nfunction writeIcoHeader(view: DataView): void {\n view.setUint16(0, 0, true)\n view.setUint16(2, 1, true)\n view.setUint16(4, 1, true)\n}\n\nfunction writeIcoDirectory(input: {\n ico: Uint8Array\n imageOffset: number\n pngLength: number\n size: number\n view: DataView\n}): void {\n const { ico, imageOffset, pngLength, size, view } = input\n ico[6] = size >= 256 ? 0 : size\n ico[7] = size >= 256 ? 0 : size\n ico[8] = 0\n ico[9] = 0\n view.setUint16(10, 1, true)\n view.setUint16(12, 32, true)\n view.setUint32(14, pngLength, true)\n view.setUint32(18, imageOffset, true)\n}\n\nfunction getIconRequestFileName(url: string | undefined): string | undefined {\n if (url == null) {\n return undefined\n }\n\n const [pathname] = url.split(\"?\", 1)\n const fileName = pathname.startsWith(\"/\") ? pathname.slice(1) : pathname\n return ICON_FILES.has(fileName) ? fileName : undefined\n}\n\nfunction hasPublicAsset(config: ViteResolvedConfig, fileName: string): boolean {\n return existsSync(path.join(config.publicDir, fileName))\n}\n","import type { ResolvedConfig } from \"../config/types\"\n\ntype MarkdownMetaState = {\n resolvedConfig?: ResolvedConfig\n routesDir: string\n}\n\nexport function transformMarkdownMeta(\n code: string,\n id: string,\n state: MarkdownMetaState\n): { code: string; map: null } | undefined {\n if (!shouldInjectMeta(code, id, state)) {\n return undefined\n }\n\n const pageTitle = extractFrontmatterValue(code, \"title\")\n if (pageTitle == null || pageTitle === \"\") {\n return undefined\n }\n\n const siteTitle = state.resolvedConfig?.title ?? \"Ardo\"\n const titleSeparator = state.resolvedConfig?.titleSeparator ?? \" | \"\n const description = extractFrontmatterValue(code, \"description\")\n const entries = buildMetaEntries({\n pageTitle,\n siteTitle,\n titleSeparator,\n description,\n })\n return { code: `${code}\\nexport const meta = () => [${entries.join(\", \")}];\\n`, map: null }\n}\n\nfunction shouldInjectMeta(code: string, id: string, state: MarkdownMetaState): boolean {\n return isMarkdownFile(id) && id.startsWith(state.routesDir) && !hasMetaExport(code)\n}\n\nfunction buildMetaEntries(input: {\n pageTitle: string\n siteTitle: string\n titleSeparator: string\n description?: string\n}): string[] {\n const fullTitle = `${input.pageTitle}${input.titleSeparator}${input.siteTitle}`\n const entries = [`{ title: ${JSON.stringify(fullTitle)} }`]\n if (input.description != null && input.description !== \"\") {\n entries.push(`{ name: \"description\", content: ${JSON.stringify(input.description)} }`)\n }\n\n return entries\n}\n\nfunction isMarkdownFile(id: string): boolean {\n return id.endsWith(\".md\") || id.endsWith(\".mdx\")\n}\n\nfunction hasMetaExport(code: string): boolean {\n return code.includes(\"export const meta\") || code.includes(\"export function meta\")\n}\n\nfunction extractFrontmatterValue(code: string, key: string): string | undefined {\n const frontmatterStart = code.indexOf(\"export const frontmatter\")\n if (frontmatterStart === -1) {\n return undefined\n }\n\n const valuePrefix = `${key}: \"`\n const valueStart = code.indexOf(valuePrefix, frontmatterStart)\n if (valueStart === -1) {\n return undefined\n }\n\n const startIndex = valueStart + valuePrefix.length\n const endIndex = code.indexOf('\"', startIndex)\n if (endIndex === -1) {\n return undefined\n }\n\n return code.slice(startIndex, endIndex)\n}\n","/**\n * Remark plugin that turns GitHub-flavored alert blockquotes into Ardo\n * callout components.\n *\n * Input (GFM alert syntax):\n *\n * > [!NOTE]\n * > Useful information that users should know.\n *\n * Output (after this plugin, MDX equivalent):\n *\n * <Note>\n * Useful information that users should know.\n * </Note>\n *\n * Supported types and their mapping:\n *\n * - `[!NOTE]` → `Note`\n * - `[!TIP]` → `Tip`\n * - `[!IMPORTANT]` → `Info`\n * - `[!WARNING]` → `Warning`\n * - `[!CAUTION]` → `Danger`\n */\nimport type { Blockquote, PhrasingContent, Root, RootContent } from \"mdast\"\n\nimport { visit } from \"unist-util-visit\"\n\ntype MdxJsxFlowElement = {\n type: \"mdxJsxFlowElement\"\n name: string\n attributes: never[]\n children: RootContent[]\n}\n\nconst TYPE_MAP: Record<string, string> = {\n NOTE: \"Note\",\n TIP: \"Tip\",\n IMPORTANT: \"Info\",\n WARNING: \"Warning\",\n CAUTION: \"Danger\",\n}\n\nconst ALERT_REGEX = /^\\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\][ \\t]*\\r?\\n?/i\n\nexport function remarkCallouts() {\n return function (tree: Root) {\n visit(tree, \"blockquote\", (node: Blockquote, index, parent) => {\n if (parent == null || index == null) return\n\n const componentName = extractCalloutType(node)\n if (componentName == null) return\n\n const replacement: MdxJsxFlowElement = {\n type: \"mdxJsxFlowElement\",\n name: componentName,\n attributes: [],\n children: node.children,\n }\n\n // Replace the blockquote node with the JSX element.\n // mdxJsxFlowElement is not part of the base mdast Root[\"children\"]\n // union, but @mdx-js/mdx adds it via the mdxjs preset.\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion\n parent.children[index] = replacement as unknown as RootContent\n })\n }\n}\n\nfunction extractCalloutType(node: Blockquote): string | undefined {\n // Runtime guards for empty arrays — TS types treat indexed access as\n // non-undefined here, but a blockquote can legitimately have no children\n // or an empty paragraph during streaming parsers.\n const firstChild = node.children[0] as Blockquote[\"children\"][number] | undefined\n if (firstChild?.type !== \"paragraph\") return undefined\n\n const firstParaChild = firstChild.children[0] as (typeof firstChild.children)[number] | undefined\n if (firstParaChild?.type !== \"text\") return undefined\n\n const match = ALERT_REGEX.exec(firstParaChild.value)\n if (match === null) return undefined\n\n const calloutName = TYPE_MAP[match[1].toUpperCase()]\n\n // Strip the `[!TYPE]` marker (and its trailing whitespace/newline) from\n // the first text node.\n firstParaChild.value = firstParaChild.value.slice(match[0].length)\n\n // If the marker consumed the entire first text node, drop the empty text\n // node and any leading break that immediately followed it.\n if (firstParaChild.value === \"\") {\n firstChild.children.shift()\n stripLeadingBreak(firstChild.children)\n }\n\n // If the first paragraph is now empty, drop it.\n if (firstChild.children.length === 0) {\n node.children.shift()\n }\n\n return calloutName\n}\n\nfunction stripLeadingBreak(children: PhrasingContent[]) {\n if (children[0]?.type === \"break\") {\n children.shift()\n }\n}\n","/**\n * Create an ESTree identifier node for a given name.\n *\n * @param name\n * The name of the identifier.\n * @returns\n * The identifier node.\n */\nfunction identifier(name) {\n return { type: 'Identifier', name };\n}\n/**\n * Create an ESTree literal node for a given value.\n *\n * @param value\n * The value for which to create a literal.\n * @returns\n * The literal node.\n */\nfunction literal(value) {\n return { type: 'Literal', value };\n}\n/**\n * Create an ESTree call expression on an object member.\n *\n * @param object\n * The object to call the method on.\n * @param name\n * The name of the method to call.\n * @param args\n * Arguments to pass to the function call\n * @returns\n * The call expression node.\n */\nfunction methodCall(object, name, args) {\n return {\n type: 'CallExpression',\n optional: false,\n callee: {\n type: 'MemberExpression',\n computed: false,\n optional: false,\n object,\n property: identifier(name)\n },\n arguments: args\n };\n}\n/**\n * Turn a number or bigint into an ESTree expression. This handles positive and negative numbers and\n * bigints as well as special numbers.\n *\n * @param number\n * The value to turn into an ESTree expression.\n * @returns\n * An expression that represents the given value.\n */\nfunction processNumber(number) {\n if (number < 0 || Object.is(number, -0)) {\n return {\n type: 'UnaryExpression',\n operator: '-',\n prefix: true,\n argument: processNumber(-number)\n };\n }\n if (typeof number === 'bigint') {\n return { type: 'Literal', bigint: String(number) };\n }\n if (number === Number.POSITIVE_INFINITY || Number.isNaN(number)) {\n return identifier(String(number));\n }\n return literal(number);\n}\n/**\n * Process an array of numbers. This is a shortcut for iterables whose constructor takes an array of\n * numbers as input.\n *\n * @param numbers\n * The numbers to add to the array expression.\n * @returns\n * An ESTree array expression whose elements match the input numbers.\n */\nfunction processNumberArray(numbers) {\n return { type: 'ArrayExpression', elements: Array.from(numbers, processNumber) };\n}\n/**\n * Check whether a value can be constructed from its string representation.\n *\n * @param value\n * The value to check\n * @returns\n * Whether or not the value can be constructed from its string representation.\n */\nfunction isStringReconstructable(value) {\n return value instanceof URL || value instanceof URLSearchParams;\n}\n/**\n * Check whether a value can be constructed from its `valueOf()` result.\n *\n * @param value\n * The value to check\n * @returns\n * Whether or not the value can be constructed from its `valueOf()` result.\n */\nfunction isValueReconstructable(value) {\n return (value instanceof Boolean ||\n value instanceof Date ||\n value instanceof Number ||\n value instanceof String);\n}\nconst wellKnownSymbols = new Map();\nfor (const name of Reflect.ownKeys(Symbol)) {\n const value = Symbol[name];\n if (typeof value === 'symbol') {\n wellKnownSymbols.set(value, name);\n }\n}\n/**\n * Check whether a value is a Temporal value.\n *\n * @param value\n * The value to check\n * @returns\n * Whether or not the value is a Temporal value.\n */\nfunction isTemporal(value) {\n return (typeof Temporal !== 'undefined' &&\n (value instanceof Temporal.Duration ||\n value instanceof Temporal.Instant ||\n value instanceof Temporal.PlainDate ||\n value instanceof Temporal.PlainDateTime ||\n value instanceof Temporal.PlainYearMonth ||\n value instanceof Temporal.PlainMonthDay ||\n value instanceof Temporal.PlainTime ||\n value instanceof Temporal.ZonedDateTime));\n}\n/**\n * Check whether a value is a typed array.\n *\n * @param value\n * The value to check\n * @returns\n * Whether or not the value is a typed array.\n */\nfunction isTypedArray(value) {\n return (value instanceof BigInt64Array ||\n value instanceof BigUint64Array ||\n (typeof Float16Array !== 'undefined' && value instanceof Float16Array) ||\n value instanceof Float32Array ||\n value instanceof Float64Array ||\n value instanceof Int8Array ||\n value instanceof Int16Array ||\n value instanceof Int32Array ||\n value instanceof Uint8Array ||\n value instanceof Uint8ClampedArray ||\n value instanceof Uint16Array ||\n value instanceof Uint32Array);\n}\n/**\n * Compare two value contexts for sorting them based on reference count.\n *\n * @param a\n * The first context to compare.\n * @param b\n * The second context to compare.\n * @returns\n * The count of context a minus the count of context b.\n */\nfunction compareContexts(a, b) {\n const aReferencedByB = a.referencedBy.has(b.value);\n const bReferencedByA = b.referencedBy.has(a.value);\n if (aReferencedByB) {\n if (bReferencedByA) {\n return a.count - b.count;\n }\n return -1;\n }\n if (bReferencedByA) {\n return 1;\n }\n return a.count - b.count;\n}\n/**\n * Replace the assigned right hand expression with the new expression.\n *\n * If there is no assignment expression, the original expression is returned. Otherwise the\n * assignment is modified and returned.\n *\n * @param expression\n * The expression to use for the assignment.\n * @param assignment\n * The existing assignmentexpression\n * @returns\n * The new expression.\n */\nfunction replaceAssignment(expression, assignment) {\n if (!assignment || assignment.type !== 'AssignmentExpression') {\n return expression;\n }\n let node = assignment;\n while (node.right.type === 'AssignmentExpression') {\n node = node.right;\n }\n node.right = expression;\n return assignment;\n}\n/**\n * Create an ESTree epxression to represent a symbol. Global and well-known symbols are supported.\n *\n * @param symbol\n * The symbol to represent.\n * @returns\n * An ESTree expression to represent the symbol.\n */\nfunction symbolToEstree(symbol) {\n const name = wellKnownSymbols.get(symbol);\n if (name) {\n return {\n type: 'MemberExpression',\n computed: false,\n optional: false,\n object: identifier('Symbol'),\n property: identifier(name)\n };\n }\n if (symbol.description && symbol === Symbol.for(symbol.description)) {\n return methodCall(identifier('Symbol'), 'for', [literal(symbol.description)]);\n }\n throw new TypeError(`Only global symbols are supported, got: ${String(symbol)}`, {\n cause: symbol\n });\n}\n/**\n * Create an ESTree property from a key and a value expression.\n *\n * @param key\n * The property key value\n * @param value\n * The property value as an ESTree expression.\n * @returns\n * The ESTree properry node.\n */\nfunction property(key, value) {\n const isString = typeof key === 'string';\n return {\n type: 'Property',\n method: false,\n shorthand: false,\n computed: key === '__proto__' || !isString,\n kind: 'init',\n key: isString ? literal(key) : symbolToEstree(key),\n value\n };\n}\n/**\n * Convert a value to an ESTree node.\n *\n * @param value\n * The value to convert.\n * @param options\n * Additional options to configure the output.\n * @returns\n * The ESTree node.\n */\nexport function valueToEstree(value, options = {}) {\n const stack = [];\n const collectedContexts = new Map();\n const namedContexts = [];\n const customTrees = new Map();\n /**\n * Analyze a value and collect all reference contexts.\n *\n * @param val\n * The value to analyze.\n */\n function analyze(val) {\n if (typeof val !== 'object' && typeof val !== 'function') {\n return;\n }\n if (val == null) {\n return;\n }\n const context = collectedContexts.get(val);\n if (context) {\n if (options.preserveReferences) {\n context.count += 1;\n }\n for (const ancestor of stack) {\n context.referencedBy.add(ancestor);\n }\n if (stack.includes(val)) {\n if (!options.preserveReferences) {\n throw new Error(`Found circular reference: ${val}`, { cause: val });\n }\n const parent = stack.at(-1);\n const parentContext = collectedContexts.get(parent);\n parentContext.recursive = true;\n context.recursive = true;\n }\n return;\n }\n collectedContexts.set(val, {\n count: 1,\n recursive: false,\n referencedBy: new Set(stack),\n value: val\n });\n const estree = options?.replacer?.(val);\n if (estree) {\n customTrees.set(val, estree);\n return;\n }\n if (typeof val === 'function') {\n throw new TypeError(`Unsupported value: ${val}`, { cause: val });\n }\n if (isTypedArray(val)) {\n return;\n }\n if (isStringReconstructable(val)) {\n return;\n }\n if (isValueReconstructable(val)) {\n return;\n }\n if (value instanceof RegExp) {\n return;\n }\n if (isTemporal(value)) {\n return;\n }\n stack.push(val);\n if (val instanceof Map) {\n for (const pair of val) {\n analyze(pair[0]);\n analyze(pair[1]);\n }\n }\n else if (Array.isArray(val) || val instanceof Set) {\n for (const entry of val) {\n analyze(entry);\n }\n }\n else {\n const proto = Object.getPrototypeOf(val);\n if (proto != null && proto !== Object.prototype && !options.instanceAsObject) {\n throw new TypeError(`Unsupported value: ${val}`, { cause: val });\n }\n for (const key of Reflect.ownKeys(val)) {\n analyze(val[key]);\n }\n }\n stack.pop();\n }\n /**\n * Recursively generate the ESTree expression needed to reconstruct the value.\n *\n * @param val\n * The value to process.\n * @param isDeclaration\n * Whether or not this is for a variable declaration.\n * @returns\n * The ESTree expression to reconstruct the value.\n */\n function generate(val, isDeclaration) {\n if (val === undefined) {\n return identifier(String(val));\n }\n if (val == null || typeof val === 'string' || typeof val === 'boolean') {\n return literal(val);\n }\n if (typeof val === 'bigint' || typeof val === 'number') {\n return processNumber(val);\n }\n if (typeof val === 'symbol') {\n return symbolToEstree(val);\n }\n const context = collectedContexts.get(val);\n if (!isDeclaration && context?.name) {\n return identifier(context.name);\n }\n const tree = customTrees.get(val);\n if (tree) {\n return tree;\n }\n if (isValueReconstructable(val)) {\n return {\n type: 'NewExpression',\n callee: identifier(val.constructor.name),\n arguments: [generate(val.valueOf())]\n };\n }\n if (val instanceof RegExp) {\n return {\n type: 'Literal',\n regex: { pattern: val.source, flags: val.flags }\n };\n }\n if (typeof Buffer !== 'undefined' && Buffer.isBuffer(val)) {\n return methodCall(identifier('Buffer'), 'from', [processNumberArray(val)]);\n }\n if (isTypedArray(val)) {\n return {\n type: 'NewExpression',\n callee: identifier(val.constructor.name),\n arguments: [processNumberArray(val)]\n };\n }\n if (isStringReconstructable(val)) {\n return {\n type: 'NewExpression',\n callee: identifier(val.constructor.name),\n arguments: [literal(String(val))]\n };\n }\n if (isTemporal(val)) {\n return methodCall({\n type: 'MemberExpression',\n computed: false,\n optional: false,\n object: identifier('Temporal'),\n property: identifier(val.constructor.name)\n }, 'from', [literal(String(val))]);\n }\n if (Array.isArray(val)) {\n const elements = Array.from({ length: val.length });\n let trimmable;\n for (let index = 0; index < val.length; index += 1) {\n if (!(index in val)) {\n elements[index] = null;\n trimmable = undefined;\n continue;\n }\n const child = val[index];\n const childContext = collectedContexts.get(child);\n if (context &&\n childContext &&\n namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) {\n elements[index] = null;\n trimmable ||= index;\n childContext.assignment = {\n type: 'AssignmentExpression',\n operator: '=',\n left: {\n type: 'MemberExpression',\n computed: true,\n optional: false,\n object: identifier(context.name),\n property: literal(index)\n },\n right: childContext.assignment || identifier(childContext.name)\n };\n }\n else {\n elements[index] = generate(child);\n trimmable = undefined;\n }\n }\n if (trimmable != null) {\n elements.splice(trimmable);\n }\n return {\n type: 'ArrayExpression',\n elements\n };\n }\n if (val instanceof Set) {\n const elements = [];\n let finalizer;\n for (const child of val) {\n if (finalizer) {\n finalizer = methodCall(finalizer, 'add', [generate(child)]);\n }\n else {\n const childContext = collectedContexts.get(child);\n if (context &&\n childContext &&\n namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) {\n finalizer = methodCall(identifier(context.name), 'add', [generate(child)]);\n }\n else {\n elements.push(generate(child));\n }\n }\n }\n if (context && finalizer) {\n context.assignment = replaceAssignment(finalizer, context.assignment);\n }\n return {\n type: 'NewExpression',\n callee: identifier('Set'),\n arguments: elements.length ? [{ type: 'ArrayExpression', elements }] : []\n };\n }\n if (val instanceof Map) {\n const elements = [];\n let finalizer;\n for (const [key, item] of val) {\n if (finalizer) {\n finalizer = methodCall(finalizer, 'set', [generate(key), generate(item)]);\n }\n else {\n const keyContext = collectedContexts.get(key);\n const itemContext = collectedContexts.get(item);\n if (context &&\n ((keyContext && namedContexts.indexOf(keyContext) >= namedContexts.indexOf(context)) ||\n (itemContext && namedContexts.indexOf(itemContext) >= namedContexts.indexOf(context)))) {\n finalizer = methodCall(identifier(context.name), 'set', [\n generate(key),\n generate(item)\n ]);\n }\n else {\n elements.push({\n type: 'ArrayExpression',\n elements: [generate(key), generate(item)]\n });\n }\n }\n }\n if (context && finalizer) {\n context.assignment = replaceAssignment(finalizer, context.assignment);\n }\n return {\n type: 'NewExpression',\n callee: identifier('Map'),\n arguments: elements.length ? [{ type: 'ArrayExpression', elements }] : []\n };\n }\n const properties = [];\n if (Object.getPrototypeOf(val) == null) {\n properties.push({\n type: 'Property',\n method: false,\n shorthand: false,\n computed: false,\n kind: 'init',\n key: identifier('__proto__'),\n value: literal(null)\n });\n }\n const object = val;\n const propertyDescriptors = [];\n for (const key of Reflect.ownKeys(val)) {\n // TODO [>=4] Throw an error for getters.\n const child = object[key];\n const { configurable, enumerable, writable } = Object.getOwnPropertyDescriptor(val, key);\n const childContext = collectedContexts.get(child);\n if (!configurable || !enumerable || !writable) {\n const propertyDescriptor = [property('value', generate(child))];\n if (configurable) {\n propertyDescriptor.push(property('configurable', literal(true)));\n }\n if (enumerable) {\n propertyDescriptor.push(property('enumerable', literal(true)));\n }\n if (writable) {\n propertyDescriptor.push(property('writable', literal(true)));\n }\n propertyDescriptors.push([\n key,\n { type: 'ObjectExpression', properties: propertyDescriptor }\n ]);\n }\n else if (context &&\n childContext &&\n namedContexts.indexOf(childContext) >= namedContexts.indexOf(context)) {\n if (key === '__proto__') {\n propertyDescriptors.push([\n key,\n {\n type: 'ObjectExpression',\n properties: [\n property('value', generate(child)),\n property('configurable', literal(true)),\n property('enumerable', literal(true)),\n property('writable', literal(true))\n ]\n }\n ]);\n }\n else {\n childContext.assignment = {\n type: 'AssignmentExpression',\n operator: '=',\n left: {\n type: 'MemberExpression',\n computed: true,\n optional: false,\n object: identifier(context.name),\n property: generate(key)\n },\n right: childContext.assignment || generate(child)\n };\n }\n }\n else {\n properties.push(property(key, generate(child)));\n }\n }\n const objectExpression = {\n type: 'ObjectExpression',\n properties\n };\n if (propertyDescriptors.length) {\n let name;\n let args;\n if (propertyDescriptors.length === 1) {\n const [[key, expression]] = propertyDescriptors;\n name = 'defineProperty';\n args = [typeof key === 'string' ? literal(key) : symbolToEstree(key), expression];\n }\n else {\n name = 'defineProperties';\n args = [\n {\n type: 'ObjectExpression',\n properties: propertyDescriptors.map(([key, expression]) => property(key, expression))\n }\n ];\n }\n if (!context) {\n return methodCall(identifier('Object'), name, [objectExpression, ...args]);\n }\n context.assignment = replaceAssignment(methodCall(identifier('Object'), name, [identifier(context.name), ...args]), context.assignment);\n }\n return objectExpression;\n }\n analyze(value);\n for (const [val, context] of collectedContexts) {\n if (context.recursive || context.count > 1) {\n // Assign reused or recursive references to a variable.\n context.name = `$${namedContexts.length}`;\n namedContexts.push(context);\n }\n else {\n // Otherwise don’t treat it as a reference.\n collectedContexts.delete(val);\n }\n }\n if (!namedContexts.length) {\n return generate(value);\n }\n const params = namedContexts.sort(compareContexts).map((context) => ({\n type: 'AssignmentPattern',\n left: identifier(context.name),\n right: generate(context.value, true)\n }));\n const rootContext = collectedContexts.get(value);\n const finalizers = [];\n for (const context of collectedContexts.values()) {\n if (context !== rootContext && context.assignment) {\n finalizers.push(context.assignment);\n }\n }\n finalizers.push(rootContext ? rootContext.assignment || identifier(rootContext.name) : generate(value));\n return {\n type: 'CallExpression',\n optional: false,\n arguments: [],\n callee: {\n type: 'ArrowFunctionExpression',\n expression: false,\n params,\n body: {\n type: 'SequenceExpression',\n expressions: finalizers\n }\n }\n };\n}\n//# sourceMappingURL=estree-util-value-to-estree.js.map","/**\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [jsx=false]\n * Support JSX identifiers (default: `false`).\n */\n\nconst startRe = /[$_\\p{ID_Start}]/u\nconst contRe = /[$_\\u{200C}\\u{200D}\\p{ID_Continue}]/u\nconst contReJsx = /[-$_\\u{200C}\\u{200D}\\p{ID_Continue}]/u\nconst nameRe = /^[$_\\p{ID_Start}][$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u\nconst nameReJsx = /^[$_\\p{ID_Start}][-$_\\u{200C}\\u{200D}\\p{ID_Continue}]*$/u\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Checks if the given code point can start an identifier.\n *\n * @param {number | undefined} code\n * Code point to check.\n * @returns {boolean}\n * Whether `code` can start an identifier.\n */\n// Note: `undefined` is supported so you can pass the result from `''.codePointAt`.\nexport function start(code) {\n return code ? startRe.test(String.fromCodePoint(code)) : false\n}\n\n/**\n * Checks if the given code point can continue an identifier.\n *\n * @param {number | undefined} code\n * Code point to check.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {boolean}\n * Whether `code` can continue an identifier.\n */\n// Note: `undefined` is supported so you can pass the result from `''.codePointAt`.\nexport function cont(code, options) {\n const settings = options || emptyOptions\n const re = settings.jsx ? contReJsx : contRe\n return code ? re.test(String.fromCodePoint(code)) : false\n}\n\n/**\n * Checks if the given value is a valid identifier name.\n *\n * @param {string} name\n * Identifier to check.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {boolean}\n * Whether `name` can be an identifier.\n */\nexport function name(name, options) {\n const settings = options || emptyOptions\n const re = settings.jsx ? nameReJsx : nameRe\n return re.test(name)\n}\n","export function deprecate(fn) {\n return fn\n}\n\nexport function equal() {}\n\nexport function ok() {}\n\nexport function unreachable() {}\n","/**\n * @import {Node, Pattern} from 'estree'\n * @import {Scope, Visitors} from './types.js'\n */\n\nimport {ok as assert} from 'devlop'\n\n/**\n * Create state to track what’s defined.\n *\n * @returns {Visitors}\n * State.\n */\nexport function createVisitors() {\n /** @type {[topLevel: Scope, ...rest: Array<Scope>]} */\n const scopes = [{block: false, defined: []}]\n\n return {enter, exit, scopes}\n\n /**\n * @param {Node} node\n * Node.\n * @returns {undefined}\n * Nothing.\n */\n function enter(node) {\n // On arrow functions, create scope, add parameters.\n if (node.type === 'ArrowFunctionExpression') {\n scopes.push({block: false, defined: []})\n\n for (const parameter of node.params) {\n definePattern(parameter, false)\n }\n }\n // On block statements, create scope.\n // Not sure why `periscopic` only does `Block`/`For`/`ForIn`/`ForOf`.\n // I added `DoWhile`/`While` here just to be sure.\n else if (\n node.type === 'BlockStatement' ||\n node.type === 'DoWhileStatement' ||\n node.type === 'ForInStatement' ||\n node.type === 'ForOfStatement' ||\n node.type === 'ForStatement' ||\n node.type === 'WhileStatement'\n ) {\n scopes.push({block: true, defined: []})\n }\n\n // On catch clauses, create scope, add param.\n else if (node.type === 'CatchClause') {\n scopes.push({block: true, defined: []})\n if (node.param) definePattern(node.param, true)\n }\n\n // Add identifier of class declaration.\n else if (node.type === 'ClassDeclaration') {\n defineIdentifier(node.id.name, false)\n }\n\n // On function declarations, add name, create scope, add parameters.\n else if (node.type === 'FunctionDeclaration') {\n defineIdentifier(node.id.name, false)\n scopes.push({block: false, defined: []})\n\n for (const parameter of node.params) {\n definePattern(parameter, false)\n }\n }\n\n // On function expressions, add name, create scope, add parameters.\n else if (node.type === 'FunctionExpression') {\n if (node.id) defineIdentifier(node.id.name, false)\n scopes.push({block: false, defined: []})\n\n for (const parameter of node.params) {\n definePattern(parameter, false)\n }\n }\n\n // Add specifiers of import declarations.\n else if (node.type === 'ImportDeclaration') {\n for (const specifier of node.specifiers) {\n defineIdentifier(specifier.local.name, false)\n }\n }\n\n // Add patterns of variable declarations.\n else if (node.type === 'VariableDeclaration') {\n for (const declaration of node.declarations) {\n definePattern(declaration.id, node.kind !== 'var')\n }\n }\n }\n\n /**\n * @param {Node} node\n * Node.\n * @returns {undefined}\n * Nothing.\n */\n function exit(node) {\n if (\n node.type === 'ArrowFunctionExpression' ||\n node.type === 'FunctionDeclaration' ||\n node.type === 'FunctionExpression'\n ) {\n const scope = scopes.pop()\n assert(scope, 'expected scope')\n assert(!scope.block, 'expected non-block')\n } else if (\n node.type === 'BlockStatement' ||\n node.type === 'CatchClause' ||\n node.type === 'DoWhileStatement' ||\n node.type === 'ForInStatement' ||\n node.type === 'ForOfStatement' ||\n node.type === 'ForStatement' ||\n node.type === 'WhileStatement'\n ) {\n const scope = scopes.pop()\n assert(scope, 'expected scope')\n assert(scope.block, 'expected block')\n }\n }\n\n /**\n * Define an identifier in a scope.\n *\n * @param {string} id\n * @param {boolean} block\n * @returns {undefined}\n */\n function defineIdentifier(id, block) {\n let index = scopes.length\n /** @type {Scope | undefined} */\n let scope\n\n while (index--) {\n scope = scopes[index]\n\n if (block || !scope.block) {\n break\n }\n }\n\n assert(scope)\n scope.defined.push(id)\n }\n\n /**\n * Define a pattern in a scope.\n *\n * @param {Pattern} pattern\n * @param {boolean} block\n */\n function definePattern(pattern, block) {\n // `[, x]`\n if (pattern.type === 'ArrayPattern') {\n for (const element of pattern.elements) {\n if (element) {\n definePattern(element, block)\n }\n }\n }\n\n // `{x=y}`\n else if (pattern.type === 'AssignmentPattern') {\n definePattern(pattern.left, block)\n }\n\n // `x`\n else if (pattern.type === 'Identifier') {\n defineIdentifier(pattern.name, block)\n }\n\n // `{x}`\n else if (pattern.type === 'ObjectPattern') {\n for (const property of pattern.properties) {\n // `{key}`, `{key = value}`, `{key: value}`\n if (property.type === 'Property') {\n definePattern(property.value, block)\n }\n // `{...x}`\n else {\n assert(property.type === 'RestElement')\n definePattern(property, block)\n }\n }\n }\n\n // `...x`\n else {\n assert(pattern.type === 'RestElement')\n definePattern(pattern.argument, block)\n }\n }\n}\n","/**\n * @typedef { import('estree').Node} Node\n * @typedef {{\n * skip: () => void;\n * remove: () => void;\n * replace: (node: Node) => void;\n * }} WalkerContext\n */\n\nexport class WalkerBase {\n\tconstructor() {\n\t\t/** @type {boolean} */\n\t\tthis.should_skip = false;\n\n\t\t/** @type {boolean} */\n\t\tthis.should_remove = false;\n\n\t\t/** @type {Node | null} */\n\t\tthis.replacement = null;\n\n\t\t/** @type {WalkerContext} */\n\t\tthis.context = {\n\t\t\tskip: () => (this.should_skip = true),\n\t\t\tremove: () => (this.should_remove = true),\n\t\t\treplace: (node) => (this.replacement = node)\n\t\t};\n\t}\n\n\t/**\n\t * @template {Node} Parent\n\t * @param {Parent | null | undefined} parent\n\t * @param {keyof Parent | null | undefined} prop\n\t * @param {number | null | undefined} index\n\t * @param {Node} node\n\t */\n\treplace(parent, prop, index, node) {\n\t\tif (parent && prop) {\n\t\t\tif (index != null) {\n\t\t\t\t/** @type {Array<Node>} */ (parent[prop])[index] = node;\n\t\t\t} else {\n\t\t\t\t/** @type {Node} */ (parent[prop]) = node;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @template {Node} Parent\n\t * @param {Parent | null | undefined} parent\n\t * @param {keyof Parent | null | undefined} prop\n\t * @param {number | null | undefined} index\n\t */\n\tremove(parent, prop, index) {\n\t\tif (parent && prop) {\n\t\t\tif (index !== null && index !== undefined) {\n\t\t\t\t/** @type {Array<Node>} */ (parent[prop]).splice(index, 1);\n\t\t\t} else {\n\t\t\t\tdelete parent[prop];\n\t\t\t}\n\t\t}\n\t}\n}\n","import { WalkerBase } from './walker.js';\n\n/**\n * @typedef { import('estree').Node} Node\n * @typedef { import('./walker.js').WalkerContext} WalkerContext\n * @typedef {(\n * this: WalkerContext,\n * node: Node,\n * parent: Node | null,\n * key: string | number | symbol | null | undefined,\n * index: number | null | undefined\n * ) => void} SyncHandler\n */\n\nexport class SyncWalker extends WalkerBase {\n\t/**\n\t *\n\t * @param {SyncHandler} [enter]\n\t * @param {SyncHandler} [leave]\n\t */\n\tconstructor(enter, leave) {\n\t\tsuper();\n\n\t\t/** @type {boolean} */\n\t\tthis.should_skip = false;\n\n\t\t/** @type {boolean} */\n\t\tthis.should_remove = false;\n\n\t\t/** @type {Node | null} */\n\t\tthis.replacement = null;\n\n\t\t/** @type {WalkerContext} */\n\t\tthis.context = {\n\t\t\tskip: () => (this.should_skip = true),\n\t\t\tremove: () => (this.should_remove = true),\n\t\t\treplace: (node) => (this.replacement = node)\n\t\t};\n\n\t\t/** @type {SyncHandler | undefined} */\n\t\tthis.enter = enter;\n\n\t\t/** @type {SyncHandler | undefined} */\n\t\tthis.leave = leave;\n\t}\n\n\t/**\n\t * @template {Node} Parent\n\t * @param {Node} node\n\t * @param {Parent | null} parent\n\t * @param {keyof Parent} [prop]\n\t * @param {number | null} [index]\n\t * @returns {Node | null}\n\t */\n\tvisit(node, parent, prop, index) {\n\t\tif (node) {\n\t\t\tif (this.enter) {\n\t\t\t\tconst _should_skip = this.should_skip;\n\t\t\t\tconst _should_remove = this.should_remove;\n\t\t\t\tconst _replacement = this.replacement;\n\t\t\t\tthis.should_skip = false;\n\t\t\t\tthis.should_remove = false;\n\t\t\t\tthis.replacement = null;\n\n\t\t\t\tthis.enter.call(this.context, node, parent, prop, index);\n\n\t\t\t\tif (this.replacement) {\n\t\t\t\t\tnode = this.replacement;\n\t\t\t\t\tthis.replace(parent, prop, index, node);\n\t\t\t\t}\n\n\t\t\t\tif (this.should_remove) {\n\t\t\t\t\tthis.remove(parent, prop, index);\n\t\t\t\t}\n\n\t\t\t\tconst skipped = this.should_skip;\n\t\t\t\tconst removed = this.should_remove;\n\n\t\t\t\tthis.should_skip = _should_skip;\n\t\t\t\tthis.should_remove = _should_remove;\n\t\t\t\tthis.replacement = _replacement;\n\n\t\t\t\tif (skipped) return node;\n\t\t\t\tif (removed) return null;\n\t\t\t}\n\n\t\t\t/** @type {keyof Node} */\n\t\t\tlet key;\n\n\t\t\tfor (key in node) {\n\t\t\t\t/** @type {unknown} */\n\t\t\t\tconst value = node[key];\n\n\t\t\t\tif (value && typeof value === 'object') {\n\t\t\t\t\tif (Array.isArray(value)) {\n\t\t\t\t\t\tconst nodes = /** @type {Array<unknown>} */ (value);\n\t\t\t\t\t\tfor (let i = 0; i < nodes.length; i += 1) {\n\t\t\t\t\t\t\tconst item = nodes[i];\n\t\t\t\t\t\t\tif (isNode(item)) {\n\t\t\t\t\t\t\t\tif (!this.visit(item, node, key, i)) {\n\t\t\t\t\t\t\t\t\t// removed\n\t\t\t\t\t\t\t\t\ti--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (isNode(value)) {\n\t\t\t\t\t\tthis.visit(value, node, key, null);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.leave) {\n\t\t\t\tconst _replacement = this.replacement;\n\t\t\t\tconst _should_remove = this.should_remove;\n\t\t\t\tthis.replacement = null;\n\t\t\t\tthis.should_remove = false;\n\n\t\t\t\tthis.leave.call(this.context, node, parent, prop, index);\n\n\t\t\t\tif (this.replacement) {\n\t\t\t\t\tnode = this.replacement;\n\t\t\t\t\tthis.replace(parent, prop, index, node);\n\t\t\t\t}\n\n\t\t\t\tif (this.should_remove) {\n\t\t\t\t\tthis.remove(parent, prop, index);\n\t\t\t\t}\n\n\t\t\t\tconst removed = this.should_remove;\n\n\t\t\t\tthis.replacement = _replacement;\n\t\t\t\tthis.should_remove = _should_remove;\n\n\t\t\t\tif (removed) return null;\n\t\t\t}\n\t\t}\n\n\t\treturn node;\n\t}\n}\n\n/**\n * Ducktype a node.\n *\n * @param {unknown} value\n * @returns {value is Node}\n */\nfunction isNode(value) {\n\treturn (\n\t\tvalue !== null && typeof value === 'object' && 'type' in value && typeof value.type === 'string'\n\t);\n}\n","import { SyncWalker } from './sync.js';\nimport { AsyncWalker } from './async.js';\n\n/**\n * @typedef {import('estree').Node} Node\n * @typedef {import('./sync.js').SyncHandler} SyncHandler\n * @typedef {import('./async.js').AsyncHandler} AsyncHandler\n */\n\n/**\n * @param {Node} ast\n * @param {{\n * enter?: SyncHandler\n * leave?: SyncHandler\n * }} walker\n * @returns {Node | null}\n */\nexport function walk(ast, { enter, leave }) {\n\tconst instance = new SyncWalker(enter, leave);\n\treturn instance.visit(ast, null);\n}\n\n/**\n * @param {Node} ast\n * @param {{\n * enter?: AsyncHandler\n * leave?: AsyncHandler\n * }} walker\n * @returns {Promise<Node | null>}\n */\nexport async function asyncWalk(ast, { enter, leave }) {\n\tconst instance = new AsyncWalker(enter, leave);\n\treturn await instance.visit(ast, null);\n}\n","import { name as isIdentifierName } from 'estree-util-is-identifier-name';\nimport { createVisitors } from 'estree-util-scope';\nimport { walk } from 'estree-walker';\n/**\n * @param program\n * The ESTree program to scan.\n * @param file\n * The {@link VFile} to emit warnings to.\n * @param variables\n * The variables that should be injected.\n * @param options\n * {@link define}.options\n * @returns\n * The position in the body where the export may be injected.\n */\nfunction scan(program, file, variables, options) {\n const visitors = createVisitors();\n const [scope] = visitors.scopes;\n const identifiers = new Map();\n let injectIndex = 0;\n walk(program, {\n enter(node, parent) {\n visitors.enter(node);\n switch (node.type) {\n case 'Identifier':\n if (scope.defined.includes(node.name) && !identifiers.has(node.name)) {\n identifiers.set(node.name, node);\n }\n break;\n case 'ArrowFunctionExpression':\n case 'ClassDeclaration':\n case 'ClassExpression':\n case 'FunctionExpression':\n case 'FunctionDeclaration':\n this.skip();\n break;\n // Don’t insert before directives.\n case 'ExpressionStatement':\n if (parent === program &&\n node.expression.type === 'Literal' &&\n typeof node.expression.value === 'string') {\n injectIndex = program.body.indexOf(node) + 1;\n }\n break;\n default:\n }\n },\n leave: visitors.exit\n });\n for (const name of scope.defined) {\n if (variables.has(name)) {\n if (options?.conflict !== 'skip') {\n const identifier = identifiers.get(name);\n const message = file.message(`Variable name conflict: ${name}`, {\n place: identifier?.loc,\n ruleId: 'conflict',\n source: 'unist-util-mdx-define'\n });\n message.url = 'https://github.com/remcohaszing/unist-util-mdx-define';\n if (options?.conflict !== 'warn') {\n message.fatal = true;\n throw message;\n }\n }\n variables.delete(name);\n }\n }\n return injectIndex;\n}\n/**\n * Generate an export named declaration.\n *\n * @param variables\n * The variables for which to generate an declaration.\n * @param options\n * {@link define} options\n * @param returnStatement\n * The return statement of the program to inject into.\n * @returns\n * The export named declaration.\n */\nfunction generate(variables, options, returnStatement) {\n if (options?.export === 'namespace') {\n const statements = [];\n for (const [name, right] of variables) {\n const isIdentifier = isIdentifierName(name);\n statements.push({\n type: 'ExpressionStatement',\n expression: {\n type: 'AssignmentExpression',\n left: {\n type: 'MemberExpression',\n computed: !isIdentifier,\n object: { type: 'Identifier', name: 'MDXContent' },\n optional: false,\n property: isIdentifier ? { type: 'Identifier', name } : { type: 'Literal', value: name }\n },\n operator: '=',\n right\n }\n });\n }\n return statements;\n }\n const declarations = [];\n for (const [name, init] of variables) {\n declarations.push({\n type: 'VariableDeclaration',\n kind: 'const',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: { type: 'Identifier', name },\n init\n }\n ]\n });\n }\n if (options?.export === false) {\n return declarations;\n }\n if (!returnStatement) {\n return declarations.map((declaration) => ({\n type: 'ExportNamedDeclaration',\n declaration,\n specifiers: []\n }));\n }\n if (returnStatement.argument?.type === 'ObjectExpression') {\n returnStatement.argument.properties.splice(-1, 0, ...Array.from(variables.keys(), (name) => ({\n type: 'Property',\n computed: false,\n kind: 'init',\n method: false,\n shorthand: true,\n key: { type: 'Identifier', name },\n value: { type: 'Identifier', name }\n })));\n }\n return declarations;\n}\n/**\n * Define variables in an MDX related AST.\n *\n * @param ast\n * The AST in which to define an export\n * @param file\n * The {@link VFile} to emit warnings to.\n * @param variables\n * A mapping of variables to define. They keys are the names. The values are the ESTree expression\n * to represent them.\n * @param options\n * Additional options to configure behaviour.\n */\nexport function define(ast, file, variables, options) {\n const map = new Map(Object.entries(variables));\n if (options?.export !== 'namespace') {\n for (const name of map.keys()) {\n if (name === '_createMdxContent' ||\n name === '_Fragment' ||\n name === '_jsx' ||\n name === '_jsxs' ||\n name === '_missingMdxReference' ||\n name === 'MDXContent') {\n const message = file.message(`MDX internal name conflict: ${name}`, {\n ruleId: 'internal',\n source: 'unist-util-mdx-define'\n });\n message.url = 'https://github.com/remcohaszing/unist-util-mdx-define';\n message.fatal = true;\n throw message;\n }\n if (!isIdentifierName(name)) {\n const message = file.message(`Invalid identifier name: ${name}`, {\n ruleId: 'invalid-identifier',\n source: 'unist-util-mdx-define'\n });\n message.url = 'https://github.com/remcohaszing/unist-util-mdx-define';\n message.fatal = true;\n throw message;\n }\n }\n }\n if (ast.type === 'root') {\n for (const child of ast.children) {\n if (child.type !== 'mdxjsEsm') {\n continue;\n }\n const program = child.data?.estree;\n /* c8 ignore start */\n if (!program) {\n continue;\n }\n /* c8 ignore stop */\n scan(program, file, map, options);\n }\n if (map.size) {\n ast.children.unshift({\n type: 'mdxjsEsm',\n value: '',\n data: {\n estree: {\n type: 'Program',\n sourceType: 'module',\n body: generate(map, options)\n }\n }\n });\n }\n }\n else {\n const returnStatement = ast.body.find((node) => node.type === 'ReturnStatement');\n const injectIndex = scan(ast, file, map, options);\n if (map.size) {\n ast.body.splice(injectIndex, 0, ...generate(map, options, returnStatement));\n }\n }\n}\n//# sourceMappingURL=unist-util-mdx-define.js.map","/**\n * Remark plugin that mirrors recognised frontmatter fields onto the\n * React Router `handle` export, so the layout decision becomes part of\n * the route module the same way it would in a hand-written `.tsx` route.\n *\n * Currently supported field: `layout`.\n *\n * Input:\n *\n * ---\n * title: Welcome\n * layout: bare\n * ---\n *\n * Effective output (added to the MDX module):\n *\n * export const handle = { layout: \"bare\" }\n *\n * The recognised layout values are `\"bare\"` (chrome-less marketing/home\n * page) and `\"default\"` (no-op, equivalent to omitting the field).\n */\nimport type { Root, Yaml } from \"mdast\"\n\nimport { valueToEstree } from \"estree-util-value-to-estree\"\nimport { define } from \"unist-util-mdx-define\"\n\ntype RouteHandle = {\n layout?: \"bare\" | \"default\"\n}\n\nexport function remarkMdxHandle() {\n return function (tree: Root, file: Parameters<typeof define>[1]) {\n const yamlNode = tree.children.find((node): node is Yaml => node.type === \"yaml\")\n if (yamlNode === undefined) return\n\n const layout = extractLayoutValue(yamlNode.value)\n if (layout === undefined) return\n\n const handle: RouteHandle = { layout }\n define(tree, file, { handle: valueToEstree(handle) })\n }\n}\n\nfunction extractLayoutValue(yaml: string): RouteHandle[\"layout\"] | undefined {\n const match = /^layout:[ \\t]+(\\S.*)$/m.exec(yaml)\n if (match === null) return undefined\n const raw = match[1].trim().replaceAll(/^[\"']|[\"']$/g, \"\")\n if (raw === \"bare\" || raw === \"default\") return raw\n return undefined\n}\n","/**\n * Remark plugin that extracts headings from MDX and exports them as `toc`.\n *\n * Adds `export const toc = [...]` to the MDX module, similar to how\n * `remark-mdx-frontmatter` exports frontmatter.\n */\nimport type { Heading, Root } from \"mdast\"\n\nimport { valueToEstree } from \"estree-util-value-to-estree\"\nimport { define } from \"unist-util-mdx-define\"\nimport { visit } from \"unist-util-visit\"\n\nimport type { TOCItem } from \"../config/types\"\n\ntype RemarkMdxTocOptions = {\n /** Export name (default: \"toc\") */\n name?: string\n /** Heading levels to include (default: [2, 3]) */\n levels?: [number, number]\n}\n\nexport function remarkMdxToc(options: RemarkMdxTocOptions = {}) {\n const { name = \"toc\", levels = [2, 3] } = options\n const [minLevel, maxLevel] = levels\n\n return function (tree: Root, file: Parameters<typeof define>[1]) {\n const items: TOCItem[] = []\n let headingIndex = 0\n\n visit(tree, \"heading\", (node: Heading) => {\n if (node.depth < minLevel || node.depth > maxLevel) return\n\n const text = getHeadingText(node)\n const slug = slugify(text)\n const id = slug === \"\" ? `heading-${String(headingIndex)}` : slug\n headingIndex++\n\n items.push({ id, text, level: node.depth })\n\n // Add id to the heading node for anchor links\n const hProperties = ensureHProperties(node)\n hProperties.id = id\n })\n\n // Use the same approach as remark-mdx-frontmatter: valueToEstree + define\n define(tree, file, { [name]: valueToEstree(items) })\n }\n}\n\nfunction getHeadingText(node: Heading): string {\n const parts: string[] = []\n\n function extract(child: unknown) {\n if (!isRecord(child)) return\n\n if (child.type === \"text\" || child.type === \"inlineCode\") {\n parts.push(typeof child.value === \"string\" ? child.value : \"\")\n } else if (Array.isArray(child.children)) {\n for (const nested of child.children) extract(nested)\n }\n }\n\n for (const child of node.children) extract(child)\n return parts.join(\"\")\n}\n\nfunction slugify(text: string): string {\n let slug = text\n .toLowerCase()\n .trim()\n .replaceAll(/[^\\s\\w-]/g, \"\")\n .replaceAll(/[\\s_]/g, \"-\")\n\n while (slug.includes(\"--\")) {\n slug = slug.replaceAll(\"--\", \"-\")\n }\n\n return slug.replaceAll(/^-|-$/g, \"\")\n}\n\ntype HeadingDataWithHProperties = {\n hProperties?: Record<string, unknown>\n} & Heading[\"data\"]\n\nfunction ensureHProperties(node: Heading): Record<string, unknown> {\n const data: HeadingDataWithHProperties = node.data ?? {}\n node.data = data\n\n if (!isRecord(data.hProperties)) {\n data.hProperties = {}\n }\n\n return data.hProperties\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n","/**\n * Remark plugin that removes the first top-level `# Heading` from the document\n * when its text matches the `title` field in the YAML frontmatter.\n *\n * Ardo renders `frontmatter.title` as the page H1 above the content body\n * (see `ContentHeader` in `Content.tsx`). When an MDX file also begins with\n * `# Title`, the page shows two H1s. This plugin removes the redundant body\n * heading, but only when titles match — so a deliberately different in-content\n * H1 is preserved.\n */\nimport type { Heading, Root, Yaml } from \"mdast\"\n\nexport function remarkStripFrontmatterH1() {\n return function (tree: Root) {\n const yamlNode = tree.children.find((node): node is Yaml => node.type === \"yaml\")\n if (yamlNode === undefined) return\n\n const title = extractYamlTitle(yamlNode.value)\n if (title === \"\") return\n\n const firstH1Index = tree.children.findIndex(\n (node) => node.type === \"heading\" && node.depth === 1\n )\n if (firstH1Index === -1) return\n\n const h1Node = tree.children[firstH1Index]\n if (h1Node.type !== \"heading\") return\n if (getHeadingText(h1Node).trim() === title) {\n tree.children.splice(firstH1Index, 1)\n }\n }\n}\n\nfunction extractYamlTitle(yaml: string): string {\n // `\\S` after the whitespace prevents `[ \\t]+` and `.+` from being able to\n // exchange leading whitespace, which keeps the regex linear.\n const match = /^title:[ \\t]+(\\S.*)$/m.exec(yaml)\n if (match === null) return \"\"\n return match[1].trim().replaceAll(/^[\"']|[\"']$/g, \"\")\n}\n\nfunction getHeadingText(node: Heading): string {\n const parts: string[] = []\n\n function extract(child: unknown) {\n if (!isRecord(child)) return\n if (child.type === \"text\" || child.type === \"inlineCode\") {\n parts.push(typeof child.value === \"string\" ? child.value : \"\")\n } else if (Array.isArray(child.children)) {\n for (const nested of child.children) extract(nested)\n }\n }\n\n for (const child of node.children) extract(child)\n return parts.join(\"\")\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value != null && typeof value === \"object\"\n}\n","/**\n * Recma plugin that wraps the MDX default export with ArdoPageDataProvider\n * to inject frontmatter + toc into the React context for TOC and content.\n */\n\ntype EstreeProgram = {\n type: string\n body: EstreeNode[]\n}\n\ntype EstreeNode = {\n type: string\n declaration?: EstreeNode\n id?: { type?: string; name: string }\n [key: string]: unknown\n}\n\nfunction findDefaultExport(body: EstreeNode[]): { index: number; name: string } {\n for (const [i, node] of body.entries()) {\n if (\n node.type === \"ExportDefaultDeclaration\" &&\n node.declaration?.type === \"FunctionDeclaration\" &&\n node.declaration.id?.name !== undefined &&\n node.declaration.id.name !== \"\"\n ) {\n return { index: i, name: node.declaration.id.name }\n }\n }\n return { index: -1, name: \"\" }\n}\n\nfunction createImport(imported: string, local: string, source: string): EstreeNode {\n return {\n type: \"ImportDeclaration\",\n specifiers: [\n {\n type: \"ImportSpecifier\",\n imported: { type: \"Identifier\", name: imported },\n local: { type: \"Identifier\", name: local },\n },\n ],\n source: { type: \"Literal\", value: source },\n }\n}\n\nfunction createShorthandProp(name: string): EstreeNode {\n return {\n type: \"Property\",\n key: { type: \"Identifier\", name },\n value: { type: \"Identifier\", name },\n kind: \"init\",\n shorthand: true,\n computed: false,\n method: false,\n }\n}\n\nfunction createWrapperFunction(fnName: string): EstreeNode {\n return {\n type: \"FunctionDeclaration\",\n id: { type: \"Identifier\", name: \"_ArdoWrapped\" },\n params: [{ type: \"Identifier\", name: \"props\" }],\n body: {\n type: \"BlockStatement\",\n body: [\n {\n type: \"ReturnStatement\",\n argument: {\n type: \"CallExpression\",\n callee: { type: \"Identifier\", name: \"_ardoJsx\" },\n arguments: [\n { type: \"Identifier\", name: \"_ArdoPageDP\" },\n {\n type: \"ObjectExpression\",\n properties: [\n createShorthandProp(\"frontmatter\"),\n createShorthandProp(\"toc\"),\n {\n type: \"Property\",\n key: { type: \"Identifier\", name: \"children\" },\n value: {\n type: \"CallExpression\",\n callee: { type: \"Identifier\", name: \"_ardoJsx\" },\n arguments: [\n { type: \"Identifier\", name: fnName },\n { type: \"Identifier\", name: \"props\" },\n ],\n optional: false,\n },\n kind: \"init\",\n shorthand: false,\n computed: false,\n method: false,\n },\n ],\n },\n ],\n optional: false,\n },\n },\n ],\n },\n generator: false,\n async: false,\n }\n}\n\n// eslint-disable-next-line @cspell/spellchecker\nexport function recmaWrapExport() {\n return (tree: EstreeProgram) => {\n const { index, name } = findDefaultExport(tree.body)\n if (index === -1) return\n\n // Remove `export default` — keep just the function declaration\n const decl = tree.body[index].declaration\n if (decl == null) return\n tree.body[index] = decl\n\n // Add imports, wrapper, and new default export\n tree.body.unshift(\n createImport(\"ArdoPageDataProvider\", \"_ArdoPageDP\", \"ardo/runtime\"),\n createImport(\"jsx\", \"_ardoJsx\", \"react/jsx-runtime\")\n )\n tree.body.push(createWrapperFunction(name), {\n type: \"ExportDefaultDeclaration\",\n declaration: { type: \"Identifier\", name: \"_ArdoWrapped\" },\n })\n }\n}\n","import type { Plugin } from \"vite\"\n\nimport mdx from \"@mdx-js/rollup\"\nimport { reactRouter } from \"@react-router/dev/vite\"\nimport rehypeShiki from \"@shikijs/rehype\"\nimport remarkFrontmatter from \"remark-frontmatter\"\nimport remarkGfm from \"remark-gfm\"\nimport remarkMdxFrontmatter from \"remark-mdx-frontmatter\"\n\nimport type { ArdoConfig } from \"../config/types\"\n\nimport { defaultMarkdownConfig } from \"../config/index\"\nimport { remarkCallouts } from \"../markdown/remark-callouts\"\nimport { remarkMdxHandle } from \"../markdown/remark-mdx-handle\"\nimport { remarkMdxToc } from \"../markdown/remark-mdx-toc\"\nimport { remarkStripFrontmatterH1 } from \"../markdown/remark-strip-frontmatter-h1\"\nimport { ardoLineTransformer, remarkCodeMeta } from \"../markdown/shiki\"\nimport { recmaWrapExport } from \"./recma-wrap-export\"\n\nexport function createMdxPlugin(markdownConfig: ArdoConfig[\"markdown\"]): Plugin {\n const themeConfig = markdownConfig?.theme ?? defaultMarkdownConfig.theme\n const lineNumbers = markdownConfig?.lineNumbers ?? false\n const shikiOptions = isShikiThemeObject(themeConfig)\n ? {\n themes: { light: themeConfig.light, dark: themeConfig.dark },\n defaultColor: false as const,\n transformers: [ardoLineTransformer({ globalLineNumbers: lineNumbers })],\n }\n : {\n theme: themeConfig,\n transformers: [ardoLineTransformer({ globalLineNumbers: lineNumbers })],\n }\n\n return mdx({\n include: /\\.(md|mdx)$/,\n remarkPlugins: [\n remarkFrontmatter,\n remarkStripFrontmatterH1,\n [remarkMdxFrontmatter, { name: \"frontmatter\" }],\n remarkMdxHandle,\n remarkGfm,\n remarkCallouts,\n remarkCodeMeta,\n [remarkMdxToc, { levels: markdownConfig?.toc?.level ?? [2, 3] }],\n ],\n rehypePlugins: [[rehypeShiki, shikiOptions]],\n recmaPlugins: [recmaWrapExport],\n providerImportSource: \"ardo/mdx-provider\",\n }) as Plugin\n}\n\nexport function getReactRouterPlugins(): Plugin[] {\n const routerPlugin = reactRouter()\n return Array.isArray(routerPlugin) ? routerPlugin : [routerPlugin]\n}\n\nfunction isShikiThemeObject(themeConfig: unknown): themeConfig is { dark: string; light: string } {\n return (\n typeof themeConfig === \"object\" &&\n themeConfig != null &&\n \"light\" in themeConfig &&\n \"dark\" in themeConfig\n )\n}\n","import fs from \"node:fs\"\nimport path from \"node:path\"\n\nimport type { ProjectMeta } from \"../config/types\"\n\ntype PackageJsonShape = {\n author?: { name?: string } | string\n homepage?: string\n license?: string\n name?: string\n repository?: { url?: string } | string\n version?: string\n}\n\n/**\n * Reads project metadata from package.json.\n */\nexport function readProjectMeta(root: string): ProjectMeta {\n const packageJsonPath = path.join(root, \"package.json\")\n\n try {\n const rawPackageJson = fs.readFileSync(packageJsonPath, \"utf8\")\n const parsedPackageJson: unknown = JSON.parse(rawPackageJson)\n if (!isPackageJsonShape(parsedPackageJson)) {\n return {}\n }\n\n const repository = extractRepository(parsedPackageJson.repository)\n const author = extractAuthor(parsedPackageJson.author)\n\n return {\n name: parsedPackageJson.name,\n homepage: parsedPackageJson.homepage,\n repository,\n version: parsedPackageJson.version,\n author,\n license: parsedPackageJson.license,\n }\n } catch {\n return {}\n }\n}\n\nfunction extractRepository(repository: PackageJsonShape[\"repository\"]): string | undefined {\n if (typeof repository === \"string\") {\n return normalizeRepository(repository)\n }\n\n if (repository == null || typeof repository.url !== \"string\") {\n return undefined\n }\n\n return normalizeRepository(repository.url)\n}\n\nfunction extractAuthor(author: PackageJsonShape[\"author\"]): string | undefined {\n if (typeof author === \"string\") {\n return author\n }\n\n if (author == null || typeof author.name !== \"string\") {\n return undefined\n }\n\n return author.name\n}\n\nfunction normalizeRepository(repository: string): string {\n return repository\n .replace(/^git\\+/, \"\")\n .replace(/^git:\\/\\//, \"https://\")\n .replace(/\\.git$/, \"\")\n}\n\nfunction isPackageJsonShape(value: unknown): value is PackageJsonShape {\n return typeof value === \"object\" && value != null\n}\n","import fsSync from \"node:fs\"\nimport fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nexport type RouteInfo = {\n /** File path relative to app directory (e.g., \"routes/guide/getting-started.mdx\") */\n file: string\n /** True if this is an index route */\n isIndex?: boolean\n /** URL path (e.g., \"/guide/getting-started\") */\n path: string\n}\n\nexport function scanRoutesSync(params: { dir: string; rootDir: string }): RouteInfo[] {\n const { dir, rootDir } = params\n const routes: RouteInfo[] = []\n const entries = readDirectoryEntries(dir)\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n\n if (entry.isDirectory()) {\n routes.push(...scanRoutesSync({ dir: fullPath, rootDir }))\n continue\n }\n\n const route = createRouteInfo({ entryName: entry.name, fullPath, rootDir })\n if (route != null) {\n routes.push(route)\n }\n }\n\n return routes\n}\n\nfunction readDirectoryEntries(dir: string): fsSync.Dirent[] {\n try {\n return fsSync.readdirSync(dir, { withFileTypes: true })\n } catch {\n return []\n }\n}\n\nfunction createRouteInfo(params: {\n entryName: string\n fullPath: string\n rootDir: string\n}): null | RouteInfo {\n const { entryName, fullPath, rootDir } = params\n if (!isRouteFile(entryName) || isIgnoredRouteFile(entryName)) {\n return null\n }\n\n const extension = getRouteExtension(entryName)\n if (extension == null) {\n return null\n }\n\n const relativePath = path.relative(rootDir, fullPath)\n const baseName = entryName.replace(extension, \"\")\n const urlPath = toRoutePath({\n baseName,\n extension,\n relativePath,\n })\n\n return {\n file: `routes/${relativePath.replaceAll(\"\\\\\", \"/\")}`,\n isIndex: isIndexRoute(baseName),\n path: urlPath,\n }\n}\n\nfunction isRouteFile(entryName: string): boolean {\n return entryName.endsWith(\".md\") || entryName.endsWith(\".mdx\") || entryName.endsWith(\".tsx\")\n}\n\nfunction isIgnoredRouteFile(entryName: string): boolean {\n return entryName === \"root.tsx\" || entryName.startsWith(\"_\")\n}\n\nfunction getRouteExtension(entryName: string): \".md\" | \".mdx\" | \".tsx\" | null {\n if (entryName.endsWith(\".mdx\")) {\n return \".mdx\"\n }\n\n if (entryName.endsWith(\".md\")) {\n return \".md\"\n }\n\n if (entryName.endsWith(\".tsx\")) {\n return \".tsx\"\n }\n\n return null\n}\n\nfunction toRoutePath(params: {\n baseName: string\n extension: \".md\" | \".mdx\" | \".tsx\"\n relativePath: string\n}): string {\n const { baseName, extension, relativePath } = params\n\n if (isIndexRoute(baseName)) {\n const parentDir = path.dirname(relativePath)\n const normalizedParent = parentDir === \".\" ? \"\" : parentDir.replaceAll(\"\\\\\", \"/\")\n return applyDynamicSegments(`/${normalizedParent}`)\n }\n\n const withoutExtension = relativePath.replace(extension, \"\")\n return applyDynamicSegments(`/${withoutExtension.replaceAll(\"\\\\\", \"/\")}`)\n}\n\nfunction isIndexRoute(baseName: string): boolean {\n return baseName === \"index\" || baseName === \"home\"\n}\n\nfunction applyDynamicSegments(urlPath: string): string {\n return urlPath.replaceAll(/\\$(\\w+)/gu, \":$1\")\n}\n\nexport function generateRoutesFile(routes: RouteInfo[]): string {\n const sortedRoutes = sortRoutes(routes)\n const entries = sortedRoutes.map((routeInfo) => renderRouteEntry(routeInfo))\n\n return `// AUTO-GENERATED by Ardo - Do not edit manually\n\nimport { type RouteConfig, route, index } from \"@react-router/dev/routes\"\n\nexport default [\n${entries.join(\"\\n\")}\n] satisfies RouteConfig\n`\n}\n\nfunction sortRoutes(routes: RouteInfo[]): RouteInfo[] {\n return [...routes].sort((left, right) => {\n if (left.path === \"/\" && right.path !== \"/\") {\n return -1\n }\n\n if (right.path === \"/\" && left.path !== \"/\") {\n return 1\n }\n\n if (left.isIndex && !right.isIndex) {\n return -1\n }\n\n if (right.isIndex && !left.isIndex) {\n return 1\n }\n\n return left.path.localeCompare(right.path)\n })\n}\n\nfunction renderRouteEntry(routeInfo: RouteInfo): string {\n if (routeInfo.path === \"/\") {\n return ` index(\"${routeInfo.file}\"),`\n }\n\n const routePath = routeInfo.path.slice(1)\n return ` route(\"${routePath}\", \"${routeInfo.file}\"),`\n}\n\nexport function writeRoutesFileSync(params: {\n appDir: string\n routesDir: string\n routesFilePath: string\n}): void {\n const { appDir, routesDir, routesFilePath } = params\n const routes = scanRoutesSync({ dir: routesDir, rootDir: routesDir })\n if (routes.length === 0) {\n return\n }\n\n const content = generateRoutesFile(routes)\n const hasChanges = hasRoutesContentChangedSync(routesFilePath, content)\n if (!hasChanges) {\n return\n }\n\n fsSync.mkdirSync(appDir, { recursive: true })\n fsSync.writeFileSync(routesFilePath, content, \"utf8\")\n console.log(`[ardo] Generated routes.ts with ${routes.length} routes`)\n}\n\nfunction hasRoutesContentChangedSync(routesFilePath: string, nextContent: string): boolean {\n try {\n const existing = fsSync.readFileSync(routesFilePath, \"utf8\")\n return existing !== nextContent\n } catch {\n return true\n }\n}\n\nexport async function writeRoutesFile(params: {\n appDir: string\n routesDir: string\n routesFilePath: string\n}): Promise<void> {\n const { appDir, routesDir, routesFilePath } = params\n const routes = scanRoutesSync({ dir: routesDir, rootDir: routesDir })\n if (routes.length === 0) {\n return\n }\n\n const content = generateRoutesFile(routes)\n const hasChanges = await hasRoutesContentChanged(routesFilePath, content)\n if (!hasChanges) {\n return\n }\n\n await fs.mkdir(appDir, { recursive: true })\n await fs.writeFile(routesFilePath, content, \"utf8\")\n}\n\nasync function hasRoutesContentChanged(\n routesFilePath: string,\n nextContent: string\n): Promise<boolean> {\n try {\n const existing = await fs.readFile(routesFilePath, \"utf8\")\n return existing !== nextContent\n } catch {\n return true\n }\n}\n","import type { Plugin } from \"vite\"\n\nimport path from \"node:path\"\n\nimport { writeRoutesFile, writeRoutesFileSync } from \"./routes-core\"\n\nexport type ArdoRoutesPluginOptions = {\n /** Directory where routes are located (default: \"./app/routes\") */\n routesDir?: string\n}\n\ntype ResolvedRoutePaths = {\n appDir: string\n routesDir: string\n routesFilePath: string\n}\n\n/**\n * Vite plugin that generates routes.ts for React Router Framework Mode.\n */\nexport function ardoRoutesPlugin(options: ArdoRoutesPluginOptions = {}): Plugin {\n let paths = createDefaultPaths(process.cwd(), options)\n\n return {\n name: \"ardo:routes\",\n enforce: \"pre\",\n\n config(userConfig) {\n const root = userConfig.root ?? process.cwd()\n paths = createDefaultPaths(root, options)\n\n try {\n writeRoutesFileSync(paths)\n } catch (error) {\n console.warn(\"[ardo] Could not generate routes.ts in config phase:\", error)\n }\n },\n\n configResolved(resolvedConfig) {\n paths = createDefaultPaths(resolvedConfig.root, options)\n },\n\n async buildStart() {\n await writeRoutesFile(paths)\n },\n\n configureServer(server) {\n server.watcher.add(paths.routesDir)\n\n const handleChange = (changedPath: string) => {\n if (shouldHandleRouteChange(changedPath, paths.routesDir)) {\n void writeRoutesFile(paths)\n }\n }\n\n server.watcher.on(\"add\", handleChange)\n server.watcher.on(\"unlink\", handleChange)\n },\n }\n}\n\nfunction createDefaultPaths(root: string, options: ArdoRoutesPluginOptions): ResolvedRoutePaths {\n const appDir = path.join(root, \"app\")\n const routesDir = options.routesDir ?? path.join(appDir, \"routes\")\n const routesFilePath = path.join(appDir, \"routes.ts\")\n return { appDir, routesDir, routesFilePath }\n}\n\nfunction shouldHandleRouteChange(changedPath: string, routesDir: string): boolean {\n if (!changedPath.startsWith(routesDir)) {\n return false\n }\n\n return changedPath.endsWith(\".md\") || changedPath.endsWith(\".mdx\") || changedPath.endsWith(\".tsx\")\n}\n","import type { Dirent } from \"node:fs\"\n\nimport matter from \"gray-matter\"\nimport fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nexport type SearchDoc = {\n id: string\n title: string\n content: string\n path: string\n section?: string\n}\n\ntype SearchScanContext = {\n docs: SearchDoc[]\n routesDir: string\n}\n\ntype SearchDocBuildContext = {\n routesDir: string\n section?: string\n}\n\ntype SearchEntryContext = {\n dir: string\n section?: string\n scanContext: SearchScanContext\n}\n\nexport async function generateSearchIndex(routesDir: string): Promise<SearchDoc[]> {\n const context: SearchScanContext = { docs: [], routesDir }\n await scanDirectoryForSearch(routesDir, undefined, context)\n return context.docs\n}\n\nasync function scanDirectoryForSearch(\n dir: string,\n section: string | undefined,\n context: SearchScanContext\n): Promise<void> {\n let entries: Dirent[]\n\n try {\n entries = await fs.readdir(dir, { withFileTypes: true })\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error)\n console.warn(\"[ardo] Failed to scan for search index:\", errorMessage)\n return\n }\n\n for (const entry of entries) {\n await processSearchEntry(entry, { dir, section, scanContext: context })\n }\n}\n\nasync function processSearchEntry(entry: Dirent, context: SearchEntryContext): Promise<void> {\n const fullPath = path.join(context.dir, entry.name)\n if (entry.isDirectory()) {\n const nestedSection = createNestedSection(context.section, entry.name)\n await scanDirectoryForSearch(fullPath, nestedSection, context.scanContext)\n return\n }\n\n if (entry.name.endsWith(\".mdx\") || entry.name.endsWith(\".md\")) {\n const doc = await createSearchDocFromFile(entry.name, fullPath, {\n routesDir: context.scanContext.routesDir,\n section: context.section,\n })\n if (doc != null) {\n context.scanContext.docs.push(doc)\n }\n }\n}\n\nasync function createSearchDocFromFile(\n fileName: string,\n filePath: string,\n context: SearchDocBuildContext\n): Promise<null | SearchDoc> {\n const fileContent = await fs.readFile(filePath, \"utf8\")\n const parsed = matter(fileContent)\n const extension = fileName.endsWith(\".mdx\") ? \".mdx\" : \".md\"\n const title =\n typeof parsed.data.title === \"string\"\n ? parsed.data.title\n : formatTitle(fileName.replace(extension, \"\"))\n\n const relativePath = path.relative(context.routesDir, filePath)\n const routePath = buildRoutePath(relativePath, fileName, extension)\n const content = sanitizeSearchContent(parsed.content)\n\n return {\n id: relativePath,\n title,\n content,\n path: routePath,\n section: context.section,\n }\n}\n\nfunction sanitizeSearchContent(content: string): string {\n const withoutCodeFences = removeCodeFences(content)\n const withoutImportLines = removeImportLines(withoutCodeFences)\n const normalizedText = replacePunctuationWithSpaces(withoutImportLines)\n const collapsedWhitespace = collapseWhitespace(normalizedText)\n return collapsedWhitespace.slice(0, 2000)\n}\n\nfunction removeCodeFences(content: string): string {\n const lines = content.split(\"\\n\")\n const keptLines: string[] = []\n let isInsideFence = false\n\n for (const line of lines) {\n if (line.trimStart().startsWith(\"```\")) {\n isInsideFence = !isInsideFence\n continue\n }\n\n if (!isInsideFence) {\n keptLines.push(line)\n }\n }\n\n return keptLines.join(\"\\n\")\n}\n\nfunction removeImportLines(content: string): string {\n const lines = content.split(\"\\n\")\n const keptLines: string[] = []\n\n for (const line of lines) {\n if (!line.trimStart().startsWith(\"import \")) {\n keptLines.push(line)\n }\n }\n\n return keptLines.join(\"\\n\")\n}\n\nfunction replacePunctuationWithSpaces(content: string): string {\n let normalized = content\n for (const token of [\"`\", \"#\", \"*\", \"_\", \"~\", \"[\", \"]\", \"(\", \")\", \"<\", \">\", \"|\", \"!\"]) {\n normalized = normalized.replaceAll(token, \" \")\n }\n\n return normalized\n}\n\nfunction collapseWhitespace(content: string): string {\n let result = \"\"\n let previousWasSpace = false\n\n for (const character of content) {\n const isSpace =\n character === \" \" || character === \"\\n\" || character === \"\\t\" || character === \"\\r\"\n if (isSpace) {\n if (!previousWasSpace) {\n result += \" \"\n }\n previousWasSpace = true\n continue\n }\n\n result += character\n previousWasSpace = false\n }\n\n return result.trim()\n}\n\nfunction buildRoutePath(relativePath: string, fileName: string, extension: string): string {\n if (fileName === \"index.mdx\" || fileName === \"index.md\") {\n const directoryPath = path.dirname(relativePath).replaceAll(\"\\\\\", \"/\")\n return directoryPath === \".\" ? \"/\" : `/${directoryPath}`\n }\n\n return `/${relativePath.replace(extension, \"\").replaceAll(\"\\\\\", \"/\")}`\n}\n\nfunction createNestedSection(section: string | undefined, directoryName: string): string {\n const currentTitle = formatTitle(directoryName)\n return section != null ? `${section} > ${currentTitle}` : currentTitle\n}\n\nfunction formatTitle(name: string): string {\n return name.replaceAll(/[_-]/g, \" \").replaceAll(/\\b\\w/g, (char) => char.toUpperCase())\n}\n","import type { Dirent } from \"node:fs\"\n\nimport matter from \"gray-matter\"\nimport fs from \"node:fs/promises\"\nimport path from \"node:path\"\n\nimport type { SidebarConfig, SidebarItem } from \"../config/types\"\n\ntype SidebarNode = {\n text: string\n link?: string\n items?: SidebarNode[]\n collapsed?: boolean\n order?: number\n sectionId: string\n}\n\ntype SidebarFrontmatter = {\n collapsed?: boolean\n order?: number\n /**\n * Sidebar inclusion mode:\n * - `false` → hide this file/folder entirely\n * - `\"leaf\"` (directory index only) → show the folder as a single link,\n * without auto-listing its children. The folder's index page is\n * expected to render the detail list itself.\n * - `true` / `undefined` → default tree behaviour\n */\n sidebar?: \"leaf\" | boolean\n title?: string\n}\n\nexport async function generateSidebar(\n routesDir: string,\n options: SidebarConfig = {}\n): Promise<SidebarItem[]> {\n try {\n const nodes = await scanSidebarDirectory(routesDir, routesDir)\n sortNodesBySectionOrder(nodes, options.sectionOrder)\n return nodes.map((node) => stripOrderFromNode(node))\n } catch {\n return []\n }\n}\n\n/**\n * Build one sidebar tree per top-level routes folder.\n *\n * The flat `generateSidebar` returns a single nested array — fine for sites\n * where everything lives in one column. For context-driven sites (Guide vs.\n * API vs. …) each top-level folder gets its own subtree, keyed by folder\n * name (`guide`, `api-reference`, …). Top-level files like `home.tsx` are\n * skipped — they belong to a bare layout, not a sidebar context.\n */\nexport async function generateContextSidebars(\n routesDir: string\n): Promise<Record<string, SidebarItem[]>> {\n try {\n const entries = await fs.readdir(routesDir, { withFileTypes: true })\n const sidebars: Record<string, SidebarItem[]> = {}\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n const subDir = path.join(routesDir, entry.name)\n // Pass `routesDir` as the root so links remain absolute (`/guide/foo`),\n // not relative to the sub-folder.\n const nodes = await scanSidebarDirectory(subDir, routesDir)\n if (nodes.length > 0) {\n sidebars[entry.name] = nodes.map((node) => stripOrderFromNode(node))\n }\n }\n return sidebars\n } catch {\n return {}\n }\n}\n\nasync function scanSidebarDirectory(dir: string, rootDir: string): Promise<SidebarNode[]> {\n const entries = await fs.readdir(dir, { withFileTypes: true })\n const nodes: SidebarNode[] = []\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name)\n const relativePath = path.relative(rootDir, fullPath)\n\n if (entry.isDirectory()) {\n const directoryNode = await createDirectoryNode(entry, fullPath, rootDir)\n if (directoryNode != null) {\n nodes.push(directoryNode)\n }\n continue\n }\n\n const fileNode = await createMarkdownNode(entry, fullPath, relativePath)\n if (fileNode != null) {\n nodes.push(fileNode)\n }\n }\n\n sortNodes(nodes)\n return nodes\n}\n\nasync function createDirectoryNode(\n entry: Dirent,\n fullPath: string,\n rootDir: string\n): Promise<null | SidebarNode> {\n const relativePath = path.relative(rootDir, fullPath)\n const metadata = await readDirectoryIndexMetadata(fullPath)\n\n if (metadata?.sidebar === false) {\n return null\n }\n\n const link = metadata == null ? undefined : `/${relativePath.replaceAll(\"\\\\\", \"/\")}`\n\n if (metadata?.sidebar === \"leaf\") {\n // Show the folder as a single link without auto-listing its children.\n // Requires an index page to provide a valid link.\n if (link === undefined) return null\n return {\n text: metadata.title ?? formatTitle(entry.name),\n link,\n order: metadata.order,\n sectionId: entry.name,\n }\n }\n\n const children = await scanSidebarDirectory(fullPath, rootDir)\n if (children.length === 0) {\n return null\n }\n\n return {\n text: metadata?.title ?? formatTitle(entry.name),\n link,\n items: children,\n collapsed: metadata?.collapsed,\n order: metadata?.order,\n sectionId: entry.name,\n }\n}\n\nasync function createMarkdownNode(\n entry: Dirent,\n fullPath: string,\n relativePath: string\n): Promise<null | SidebarNode> {\n if (!isSidebarMarkdownFile(entry.name)) {\n return null\n }\n\n const extension = entry.name.endsWith(\".mdx\") ? \".mdx\" : \".md\"\n const fileContent = await fs.readFile(fullPath, \"utf8\")\n const frontmatter = readFrontmatter(fileContent)\n if (frontmatter.sidebar === false) {\n return null\n }\n\n const title = frontmatter.title ?? formatTitle(entry.name.replace(extension, \"\"))\n const link = `/${relativePath.replace(extension, \"\").replaceAll(\"\\\\\", \"/\")}`\n\n return {\n text: title,\n link,\n order: frontmatter.order,\n sectionId: entry.name.replace(extension, \"\"),\n }\n}\n\nasync function readDirectoryIndexMetadata(fullPath: string): Promise<null | SidebarFrontmatter> {\n for (const indexFileName of [\"index.mdx\", \"index.md\"]) {\n const metadata = await readFrontmatterFile(path.join(fullPath, indexFileName))\n if (metadata != null) {\n return metadata\n }\n }\n\n return null\n}\n\nasync function readFrontmatterFile(filePath: string): Promise<null | SidebarFrontmatter> {\n try {\n const fileContent = await fs.readFile(filePath, \"utf8\")\n return readFrontmatter(fileContent)\n } catch {\n return null\n }\n}\n\nfunction readFrontmatter(fileContent: string): SidebarFrontmatter {\n const parsed = matter(fileContent)\n const title = typeof parsed.data.title === \"string\" ? parsed.data.title : undefined\n const order = typeof parsed.data.order === \"number\" ? parsed.data.order : undefined\n const collapsed = typeof parsed.data.collapsed === \"boolean\" ? parsed.data.collapsed : undefined\n const sidebar = parseSidebarValue(parsed.data.sidebar)\n return { title, order, collapsed, sidebar }\n}\n\nfunction parseSidebarValue(raw: unknown): SidebarFrontmatter[\"sidebar\"] {\n if (typeof raw === \"boolean\") return raw\n if (raw === \"leaf\") return \"leaf\"\n return undefined\n}\n\nfunction sortNodes(nodes: SidebarNode[]): void {\n nodes.sort((leftNode, rightNode) => {\n if (leftNode.order != null && rightNode.order != null) {\n return leftNode.order - rightNode.order\n }\n\n if (leftNode.order != null) {\n return -1\n }\n\n if (rightNode.order != null) {\n return 1\n }\n\n return leftNode.text.localeCompare(rightNode.text)\n })\n}\n\nfunction sortNodesBySectionOrder(nodes: SidebarNode[], sectionOrder: string[] | undefined): void {\n if (sectionOrder == null || sectionOrder.length === 0) {\n return\n }\n\n const sectionOrderMap = new Map<string, number>()\n for (const [index, section] of sectionOrder.entries()) {\n const normalizedSection = normalizeSectionId(section)\n if (normalizedSection !== \"\" && !sectionOrderMap.has(normalizedSection)) {\n sectionOrderMap.set(normalizedSection, index)\n }\n }\n\n if (sectionOrderMap.size === 0) {\n return\n }\n\n nodes.sort((leftNode, rightNode) => {\n const leftIndex = sectionOrderMap.get(leftNode.sectionId)\n const rightIndex = sectionOrderMap.get(rightNode.sectionId)\n\n if (leftIndex != null && rightIndex != null) {\n return leftIndex - rightIndex\n }\n\n if (leftIndex != null) {\n return -1\n }\n\n if (rightIndex != null) {\n return 1\n }\n\n return 0\n })\n}\n\nfunction isSidebarMarkdownFile(fileName: string): boolean {\n const isMarkdownFile = fileName.endsWith(\".mdx\") || fileName.endsWith(\".md\")\n const isIndexFile = fileName === \"index.mdx\" || fileName === \"index.md\"\n return isMarkdownFile && !isIndexFile\n}\n\nfunction formatTitle(name: string): string {\n return name.replaceAll(/[_-]/g, \" \").replaceAll(/\\b\\w/g, (char) => char.toUpperCase())\n}\n\nfunction stripOrderFromNode(node: SidebarNode): SidebarItem {\n return {\n text: node.text,\n link: node.link,\n collapsed: node.collapsed,\n items: node.items?.map((item) => stripOrderFromNode(item)),\n }\n}\n\nfunction normalizeSectionId(section: string): string {\n const normalizedSection = section.replaceAll(\"\\\\\", \"/\")\n let startIndex = 0\n let endIndex = normalizedSection.length\n\n while (startIndex < endIndex && normalizedSection[startIndex] === \"/\") {\n startIndex += 1\n }\n\n while (endIndex > startIndex && normalizedSection[endIndex - 1] === \"/\") {\n endIndex -= 1\n }\n\n return normalizedSection.slice(startIndex, endIndex)\n}\n","import type { Plugin } from \"vite\"\n\nimport type { TypeDocConfig } from \"../typedoc/types\"\n\nimport { generateApiDocs } from \"../typedoc/generator\"\nimport { findPackageRoot } from \"./git-utils\"\n\nlet typedocGenerated = false\n\nexport function resolveTypedocConfig(\n typedoc: true | TypeDocConfig | undefined\n): TypeDocConfig | undefined {\n if (typedoc == null) {\n return undefined\n }\n\n const packageRoot = findPackageRoot(process.cwd())\n const defaultEntryPoint = packageRoot != null ? `${packageRoot}/src/index.ts` : \"./src/index.ts\"\n const defaultTsconfig = packageRoot != null ? `${packageRoot}/tsconfig.json` : \"./tsconfig.json\"\n const defaults: TypeDocConfig = {\n enabled: true,\n entryPoints: [defaultEntryPoint],\n tsconfig: defaultTsconfig,\n out: \"api-reference\",\n excludePrivate: true,\n excludeInternal: true,\n }\n\n return typedoc === true ? defaults : { ...defaults, ...typedoc }\n}\n\nexport function createTypeDocPlugin(typedocConfig: TypeDocConfig, routesDir: string): Plugin {\n return {\n name: \"ardo:typedoc\",\n async buildStart() {\n if (!typedocConfig.enabled || typedocGenerated) {\n return\n }\n\n typedocGenerated = true\n console.log(\"[ardo] Generating API documentation with TypeDoc...\")\n const startTime = Date.now()\n\n try {\n const docs = await generateApiDocs(typedocConfig, routesDir)\n const duration = Date.now() - startTime\n console.log(`[ardo] Generated ${docs.length} API documentation pages in ${duration}ms`)\n } catch (error) {\n console.warn(\"[ardo] TypeDoc generation failed. API documentation will not be available.\")\n console.warn(\"[ardo] Check your typedoc.entryPoints configuration.\")\n if (error instanceof Error) {\n console.warn(`[ardo] Error: ${error.message}`)\n }\n }\n },\n }\n}\n","import type { Plugin, UserConfig } from \"vite\"\n\nimport { vanillaExtractPlugin } from \"@vanilla-extract/vite-plugin\"\nimport path from \"node:path\"\n\nimport type { ArdoConfig, ProjectMeta, ResolvedConfig } from \"../config/types\"\n\nimport { resolveConfig } from \"../config/index\"\nimport { ardoCodeBlockPlugin } from \"./codeblock-plugin\"\nimport { createFlattenPlugin } from \"./flatten-plugin\"\nimport { detectGitHash, detectGitHubBasename, detectGitHubRepoName } from \"./git-utils\"\nimport { type ArdoIconOptions, createIconsPlugin } from \"./icons\"\nimport { transformMarkdownMeta } from \"./markdown-meta\"\nimport { createMdxPlugin, getReactRouterPlugins } from \"./mdx-plugin\"\nimport { readProjectMeta } from \"./project-meta\"\nimport { ardoRoutesPlugin, type ArdoRoutesPluginOptions } from \"./routes-plugin\"\nimport { generateSearchIndex } from \"./search-index\"\nimport { generateContextSidebars, generateSidebar } from \"./sidebar-index\"\nimport { createTypeDocPlugin, resolveTypedocConfig } from \"./typedoc-plugin\"\n\nconst VIRTUAL_MODULE_ID = \"virtual:ardo/config\"\nconst VIRTUAL_SIDEBAR_ID = \"virtual:ardo/sidebar\"\nconst VIRTUAL_SIDEBARS_ID = \"virtual:ardo/sidebars\"\nconst VIRTUAL_SEARCH_ID = \"virtual:ardo/search-index\"\nconst RESOLVED_IDS: Record<string, string> = {\n [VIRTUAL_MODULE_ID]: `\\0${VIRTUAL_MODULE_ID}`,\n [VIRTUAL_SIDEBAR_ID]: `\\0${VIRTUAL_SIDEBAR_ID}`,\n [VIRTUAL_SIDEBARS_ID]: `\\0${VIRTUAL_SIDEBARS_ID}`,\n [VIRTUAL_SEARCH_ID]: `\\0${VIRTUAL_SEARCH_ID}`,\n}\n\ntype PluginState = {\n resolvedConfig?: ResolvedConfig\n routesDir: string\n}\n\ntype MainPluginOptions = {\n githubPages: boolean\n pressConfig: PressConfigOptions\n routesDirOption: string | undefined\n}\n\ntype PressConfigOptions = Omit<\n ArdoPluginOptions,\n \"githubPages\" | \"icons\" | \"routes\" | \"routesDir\" | \"typedoc\"\n>\n\nexport type ArdoPluginOptions = {\n /** Options for the routes generator plugin */\n routes?: ArdoRoutesPluginOptions | false\n /**\n * Generate the lean favicon set recommended for modern websites:\n * /favicon.ico, /icon.svg, and /apple-touch-icon.png.\n *\n * @default true\n */\n icons?: ArdoIconOptions\n /**\n * Auto-detect GitHub repository and set base path for GitHub Pages.\n * @default true\n */\n githubPages?: boolean\n /**\n * Directory where routes are located.\n * @default \"./app/routes\"\n */\n routesDir?: string\n} & Partial<ArdoConfig>\n\nexport { detectGitHubBasename }\n\nexport function ardoPlugin(options: ArdoPluginOptions = {}): Plugin[] {\n const {\n icons = {},\n routes,\n typedoc,\n githubPages = true,\n routesDir: routesDirOption,\n ...pressConfig\n } = options\n const state: PluginState = { routesDir: resolveRoutesDir(process.cwd(), routesDirOption) }\n\n const mainPluginOptions: MainPluginOptions = { githubPages, pressConfig, routesDirOption }\n const plugins: Plugin[] = [createMainPlugin(state, mainPluginOptions)]\n plugins.push(...createIconsPlugin(icons))\n addRoutesPlugin(plugins, routes, routesDirOption)\n addTypeDocPlugin(plugins, typedoc, state)\n\n plugins.push(ardoCodeBlockPlugin(pressConfig.markdown))\n plugins.push(createMdxPlugin(pressConfig.markdown))\n plugins.push(...vanillaExtractPlugin({ identifiers: \"short\" }))\n plugins.push(...getReactRouterPlugins())\n\n if (githubPages) {\n plugins.push(createFlattenPlugin())\n }\n\n return plugins\n}\n\nfunction addRoutesPlugin(\n plugins: Plugin[],\n routes: ArdoPluginOptions[\"routes\"],\n routesDirOption: string | undefined\n): void {\n if (routes === false) {\n return\n }\n\n const routePluginOptions = routes ?? {}\n plugins.push(ardoRoutesPlugin({ routesDir: routesDirOption, ...routePluginOptions }))\n}\n\nfunction addTypeDocPlugin(\n plugins: Plugin[],\n typedoc: ArdoPluginOptions[\"typedoc\"],\n state: PluginState\n): void {\n const typedocConfig = resolveTypedocConfig(typedoc)\n if (typedocConfig != null) {\n plugins.unshift(createTypeDocPlugin(typedocConfig, state.routesDir))\n }\n}\n\nfunction createMainPlugin(state: PluginState, options: MainPluginOptions): Plugin {\n return {\n name: \"ardo\",\n enforce: \"pre\",\n config(userConfig, env): UserConfig {\n return createMainConfig(state, {\n userConfig,\n command: env.command,\n githubPages: options.githubPages,\n routesDirOption: options.routesDirOption,\n })\n },\n configResolved(config) {\n state.routesDir = resolveRoutesDir(config.root, options.routesDirOption)\n state.resolvedConfig = resolveArdoConfig(config.root, state.routesDir, options.pressConfig)\n },\n resolveId(id) {\n return resolveVirtualModuleId(id)\n },\n async load(id) {\n return loadVirtualModule(id, state)\n },\n transform(code, id) {\n return transformMarkdownMeta(code, id, state)\n },\n }\n}\n\nfunction createMainConfig(\n state: PluginState,\n input: {\n command: string\n githubPages: boolean\n routesDirOption: string | undefined\n userConfig: UserConfig\n }\n): UserConfig {\n const { command, githubPages, routesDirOption, userConfig } = input\n const root = userConfig.root ?? process.cwd()\n state.routesDir = resolveRoutesDir(root, routesDirOption)\n\n const config: UserConfig = {\n define: { __BUILD_TIME__: JSON.stringify(new Date().toISOString()) },\n optimizeDeps: { exclude: [\"ardo/ui/styles.css\"] },\n ssr: { noExternal: [\"ardo\"] },\n }\n\n if (githubPages && command === \"build\" && userConfig.base == null) {\n const repoName = detectGitHubRepoName(root)\n if (repoName != null) {\n config.base = `/${repoName}/`\n console.log(`[ardo] GitHub Pages detected, using base: ${config.base}`)\n }\n }\n\n return config\n}\n\nfunction resolveArdoConfig(\n root: string,\n routesDir: string,\n pressConfig: PressConfigOptions\n): ResolvedConfig {\n const detectedProject = readProjectMeta(root)\n const project: ProjectMeta = { ...detectedProject, ...pressConfig.project }\n const configWithDefaults: ArdoConfig = {\n title: pressConfig.title ?? \"Ardo\",\n description: pressConfig.description ?? \"Documentation powered by Ardo\",\n }\n\n return resolveConfig(\n {\n ...configWithDefaults,\n ...pressConfig,\n project,\n srcDir: routesDir,\n },\n root\n )\n}\n\nfunction resolveVirtualModuleId(id: string): string | undefined {\n return RESOLVED_IDS[id]\n}\n\nasync function loadVirtualModule(id: string, state: PluginState): Promise<string | undefined> {\n if (state.resolvedConfig == null) {\n return undefined\n }\n\n if (id === RESOLVED_IDS[VIRTUAL_MODULE_ID]) {\n const clientConfig = {\n title: state.resolvedConfig.title,\n description: state.resolvedConfig.description,\n base: state.resolvedConfig.base,\n lang: state.resolvedConfig.lang,\n project: state.resolvedConfig.project,\n buildTime: new Date().toISOString(),\n buildHash: detectGitHash(state.resolvedConfig.root),\n }\n return `export default ${JSON.stringify(clientConfig)}`\n }\n\n if (id === RESOLVED_IDS[VIRTUAL_SIDEBAR_ID]) {\n const sidebar = await generateSidebar(state.routesDir, state.resolvedConfig.sidebar)\n return `export default ${JSON.stringify(sidebar)}`\n }\n\n if (id === RESOLVED_IDS[VIRTUAL_SIDEBARS_ID]) {\n const sidebars = await generateContextSidebars(state.routesDir)\n return `export default ${JSON.stringify(sidebars)}`\n }\n\n if (id === RESOLVED_IDS[VIRTUAL_SEARCH_ID]) {\n const searchIndex = await generateSearchIndex(state.routesDir)\n return `export default ${JSON.stringify(searchIndex)}`\n }\n\n return undefined\n}\n\nfunction resolveRoutesDir(root: string, routesDirOption: string | undefined): string {\n return routesDirOption ?? path.join(root, \"app\", \"routes\")\n}\n"],"x_google_ignoreList":[20,21,22,23,24,25,26,27],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAgB,YAAY,SAA4B;CACtD,MAAM,EAAE,aAAa;CAGrB,MAAM,iBAAiB,aAAa,MAAM,KAAK,SAAS,QAAQ,OAAO,GAAG;CAE1E,QAAQ,SAAe;EACrB,IAAI,CAAC,gBAEH;EAGF,MAAM,MAAM,YAAY,SAAkB;GACxC,IAAI,KAAK,YAAY,KACnB;GAGF,MAAM,OAAO,KAAK,WAAW;GAI7B,IACE,OAAO,SAAS,YAChB,KAAK,WAAW,IAAI,IACpB,CAAC,KAAK,WAAW,KAAK,IACtB,CAAC,KAAK,WA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