@lonik/prestige 0.10.1 → 0.11.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 (2) hide show
  1. package/dist/vite.js.map +1 -1
  2. package/package.json +1 -1
package/dist/vite.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"vite.js","names":["CollectionGroupSchema: z.ZodType<CollectionGroup, CollectionGroup>","CollectionItemSchema: z.ZodType<CollectionItem, CollectionItem>","sidebarLinks: SidebarLinkType[]","processItem","data","typeMap: Record<\"note\" | \"tip\" | \"caution\" | \"danger\", string>","titleChildren: any[]","toc: TocItem[]","prev: SiblingNavigationType | undefined","next: SiblingNavigationType | undefined","join","navigation: Record<string, NavigationLinks>","items: SidebarItemType[]","group: CollectionGroup","join","collections: CollectionNavigation[]","config: PrestigeConfig","contentDir: string","isDocsMatcher: Matcher","collections: Collections","linksMap: Map<string, SidebarLinkType[]>","collectionNavigations: string","sidebarsMap: Map<string, SidebarType>","logger: Logger"],"sources":["../src/vite/utils/errors.ts","../src/vite/core/content/content.types.ts","../src/vite/config/config.types.ts","../src/vite/utils/file-utils.ts","../src/vite/config/config.ts","../src/vite/content/content-links.ts","../src/vite/content/content-compiler.ts","../src/vite/content/content.store.ts","../src/vite/content/content-sidebar.store.ts","../src/vite/content/router-compiler.ts","../src/vite/utils/code-generation.ts","../src/vite/core/content/content-collection.store.ts","../src/vite/utils/logger.ts","../src/vite/content/content-watcher.ts","../src/vite/plugin.ts"],"sourcesContent":["import { type ZodType, input } from \"zod\";\n\nexport class PrestigeError extends Error {}\n\n/**\n * Parse data with zod schema and if fails throw PrestigeError that is friendly error\n * for prestige ecosystem\n */\nexport function parseWithFriendlyErrors<T extends ZodType>(s: T, input: input<T>, message: string) {\n try {\n return s.parse(input);\n } catch (e) {\n if (e instanceof Error) {\n throw new PrestigeError(`Prestige error cause: ${message}, with error: ${e.message} `);\n } else {\n throw new PrestigeError(`Prestige error cause: ${message} `);\n }\n }\n}\n","import { z } from \"zod\";\n\nexport const ContentHeadFrontmatterSchema = z.object({\n meta: z.array(z.record(z.string(), z.any())).optional(),\n links: z.array(z.record(z.string(), z.any())).optional(),\n styles: z.array(z.record(z.string(), z.any())).optional(),\n scripts: z.array(z.record(z.string(), z.any())).optional(),\n});\n\nexport type ContentHeadFrontmatterType = z.infer<\n typeof ContentHeadFrontmatterSchema\n>;\n\nexport const ContentFrontmatterSchema = z.object({\n title: z.string().describe(\"The title of the article\"),\n description: z.string().optional().describe(\"The description of the article\"),\n label: z.string().optional().describe(\"The label of the content\"),\n head: ContentHeadFrontmatterSchema.optional(),\n});\n\nexport type ContentFrontmatterType = z.infer<typeof ContentFrontmatterSchema>;\n\nexport const ContentSchema = z.object({\n matter: ContentFrontmatterSchema,\n html: z.string().describe(\"The html of the content\"),\n});\n\nexport type ContentType = z.infer<typeof ContentSchema>;\n\nconst InternalCollectionLinkSchema = z.union([\n z.object({\n label: z.string(),\n slug: z.string(),\n }),\n z.string(),\n]);\n\nconst ExternalCollectionLinkSchema = z.object({\n label: z.string(),\n link: z.string(),\n});\n\nexport type ExternalCollectionLink = z.infer<\n typeof ExternalCollectionLinkSchema\n>;\n\nexport type InternalCollectionLink = z.infer<\n typeof InternalCollectionLinkSchema\n>;\n\nexport type CollectionGroup = {\n label: string;\n items?: CollectionItem[] | undefined;\n collapsed?: boolean | undefined;\n autogenerate?: { directory: string } | undefined;\n};\n\nexport type CollectionItem =\n | InternalCollectionLink\n | CollectionGroup\n | ExternalCollectionLink;\n\nconst CollectionGroupSchema: z.ZodType<CollectionGroup, CollectionGroup> =\n z.object({\n label: z.string(),\n items: z.lazy(() => z.array(CollectionItemSchema)).optional(),\n collapsed: z.boolean().optional(),\n autogenerate: z\n .object({\n directory: z.string(),\n })\n .optional(),\n });\n\nconst CollectionItemSchema: z.ZodType<CollectionItem, CollectionItem> = z.union(\n [\n ExternalCollectionLinkSchema,\n InternalCollectionLinkSchema,\n z.lazy(() => CollectionGroupSchema),\n ],\n);\n\nexport const CollectionSchema = z.object({\n id: z\n .string()\n .min(1, { message: \"Folder name cannot be empty\" })\n .max(50, { message: \"Folder name too long\" })\n // Allows alphanumeric, hyphens, and underscores\n .regex(/^[a-zA-Z0-9-_]+$/, {\n message: \"Only alphanumeric, hyphens, and underscores allowed\",\n })\n .describe(\"The id of the collection, must match the folder name\"),\n items: z.array(CollectionItemSchema),\n label: z.string().optional().describe(\"The label of the collection\"),\n defaultLink: z\n .string()\n .optional()\n .describe(\"The default link of the collection\"),\n});\n\nexport type Collection = z.infer<typeof CollectionSchema>;\n\nexport type CollectionNavigation = {\n id: string;\n label: string;\n defaultLink?: string;\n};\n\nexport type CollectionInput = z.input<typeof CollectionSchema>;\n\nexport const CollectionsSchema = z.array(CollectionSchema);\n\nexport type Collections = z.infer<typeof CollectionsSchema>;\n\nexport interface InternalSidebarLinkType {\n slug: string;\n label: string;\n}\n\nexport interface ExternalSidebarLinkType {\n label: string;\n link: string;\n}\n\nexport type SidebarLinkType = InternalSidebarLinkType | ExternalSidebarLinkType;\n\nexport interface SidebarGroupType {\n label: string;\n items: SidebarItemType[];\n collapsed?: boolean | undefined;\n}\n\nexport type SidebarItemType =\n | InternalSidebarLinkType\n | SidebarGroupType\n | ExternalSidebarLinkType;\n\nexport interface SidebarType {\n items: SidebarItemType[];\n defaultLink: string;\n navigation: Record<string, NavigationLinks>;\n}\n\nexport interface SiblingNavigationType {\n label: string;\n link: string;\n}\n\nexport interface NavigationLinks {\n prev: SiblingNavigationType | null | undefined;\n next: SiblingNavigationType | null | undefined;\n}\n","import { FlexibleTocOptions } from \"remark-flexible-toc\";\nimport type { Options as RemarkGfmOptions } from \"remark-gfm\";\nimport { PluggableList } from \"unified\";\nimport { z } from \"zod\";\nimport { CollectionsSchema } from \"../core/content/content.types\";\n\nexport const PrestigeConfigSchema = z.object({\n title: z.string().describe(\"Title of the website\"),\n disableLog: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Disable logger, default is false\"),\n enableDebugLog: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Enable debug log, default is false\"),\n collections: CollectionsSchema,\n markdown: z\n .object({\n gfmOptions: z\n .custom<RemarkGfmOptions>()\n .optional()\n .describe(\"Options for remark-gfm\"),\n rehypePlugins: z\n .custom<PluggableList>()\n .optional()\n .describe(\"Additional rehype plugins\"),\n remarkPlugins: z\n .custom<PluggableList>()\n .optional()\n .describe(\"Additional remark plugins\"),\n remarkFlexibleToc: z\n .custom<FlexibleTocOptions>()\n .optional()\n .describe(\"Options for remark-flexible-toc\"),\n rehypeSlug: z\n .custom<{\n prefix?: string;\n }>()\n .optional()\n .describe(\"Options for rehype-slug\"),\n })\n .optional()\n .describe(\"Markdown options, configure how markdown is parsed\"),\n});\n\nexport type PrestigeConfigInput = z.input<typeof PrestigeConfigSchema>;\nexport type PrestigeConfig = z.infer<typeof PrestigeConfigSchema>;\n","import { mkdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"pathe\";\n\nexport async function pathExists(path: string) {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function ensureDir(dirPath: string) {\n await mkdir(dirPath, { recursive: true });\n}\n\nexport async function outputFile(\n filePath: string,\n data: string | NodeJS.ArrayBufferView,\n) {\n const dir = dirname(filePath);\n\n // recursive: true won't throw if the dir already exists\n await mkdir(dir, { recursive: true });\n await writeFile(filePath, data);\n}\n\nexport async function rmSafe(path: string) {\n try {\n await rm(path, { recursive: true, force: true });\n return true;\n } catch {\n return false;\n }\n}\n\n// Helper function to extract the virtual ID from a messy path\nexport function extractVirtualId(fullId: string, virtualPrefix: string) {\n const startIndex = fullId.indexOf(virtualPrefix);\n if (startIndex !== -1) {\n // Slice from the start of the virtual prefix to the end of the string\n return \"\\0\" + fullId.slice(startIndex);\n }\n return null;\n}\n","import { parseWithFriendlyErrors, PrestigeError } from \"../utils/errors\";\nimport { PrestigeConfigInput, PrestigeConfigSchema } from \"./config.types\";\nimport { join } from \"pathe\";\nimport { pathExists } from \"../utils/file-utils\";\n\nexport function validateConfig(config: PrestigeConfigInput) {\n return parseWithFriendlyErrors(PrestigeConfigSchema, config, \"Invalid schema\");\n}\n\nexport async function resolvePrestigeConfig(\n configInput: PrestigeConfigInput | undefined,\n root: string,\n) {\n if (!configInput) {\n throw new PrestigeError(\"Prestige config is required\");\n }\n\n const validatedConfig = validateConfig(configInput);\n const docsDirPath = join(root, \"src/content\");\n\n if (!(await pathExists(docsDirPath))) {\n throw new PrestigeError(`Docs! directory not found: ${docsDirPath}`);\n }\n\n return { config: validatedConfig, fullDocsDir: docsDirPath };\n}\n","import { SidebarLinkType, SidebarItemType, SidebarType } from \"../core/content/content.types\";\n\nexport function resolveContentLinks(sidebars: Map<string, SidebarType>) {\n const links = new Map<string, SidebarLinkType[]>();\n for (const [key, sidebar] of sidebars) {\n const sidebarLinks: SidebarLinkType[] = [];\n for (const item of sidebar.items) {\n processItem(item, sidebarLinks);\n }\n links.set(key, sidebarLinks);\n }\n return links;\n}\n\nfunction processItem(item: SidebarItemType, links: SidebarLinkType[] = []) {\n if (\"slug\" in item || \"link\" in item) {\n links.push(item);\n } else if (\"items\" in item) {\n for (const childItem of item.items) {\n processItem(childItem, links);\n }\n }\n return links;\n}\n","import { compile } from \"@mdx-js/mdx\";\nimport rehypePrism from \"rehype-prism-plus\";\nimport rehypeSlug from \"rehype-slug\";\nimport remarkDirective from \"remark-directive\";\nimport remarkFlexibleToc, { TocItem } from \"remark-flexible-toc\";\nimport remarkFrontmatter from \"remark-frontmatter\";\nimport remarkGfm from \"remark-gfm\";\nimport { PluggableList } from \"unified\";\nimport { Compatible, VFile } from \"vfile\";\nimport matter from \"gray-matter\";\nimport { PrestigeConfig } from \"../config/config.types\";\n\nimport { h } from \"hastscript\";\nimport type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\n\nexport default function remarkAdmonitions() {\n return (tree: Node) => {\n visit(tree, (node: any) => {\n if (\n node.type === \"textDirective\" ||\n node.type === \"leafDirective\" ||\n node.type === \"containerDirective\"\n ) {\n if (node.type !== \"containerDirective\") {\n const data = node.data || (node.data = {});\n const hast = h(node.type === \"textDirective\" ? \"span\" : \"aside\", {\n className: [\"admonition\", `admonition-${node.name}`],\n ...node.attributes,\n });\n data.hName = hast.tagName;\n data.hProperties = hast.properties;\n return;\n }\n\n const type = [\"note\", \"tip\", \"caution\", \"danger\"].includes(node.name)\n ? node.name\n : \"note\";\n\n const typeMap: Record<\"note\" | \"tip\" | \"caution\" | \"danger\", string> = {\n note: \"bg-blue-50/50 dark:bg-blue-900/20 border-blue-500 text-blue-900 dark:text-blue-200\",\n tip: \"bg-purple-50/50 dark:bg-purple-900/20 border-purple-500 text-purple-900 dark:text-purple-200\",\n caution:\n \"bg-yellow-50/50 dark:bg-yellow-900/20 border-yellow-500 text-yellow-900 dark:text-yellow-200\",\n danger:\n \"bg-red-50/50 dark:bg-red-900/20 border-red-500 text-red-900 dark:text-red-200\",\n };\n\n const data = node.data || (node.data = {});\n data.hName = \"aside\";\n data.hProperties = {\n \"aria-label\": type.charAt(0).toUpperCase() + type.slice(1),\n className: [\n \"relative\",\n \"my-6\",\n \"px-4\",\n \"py-3\",\n \"border-l-4\",\n \"rounded-lg\",\n ...(typeMap[type as keyof typeof typeMap] || typeMap[\"note\"]).split(\n \" \",\n ),\n ],\n ...node.attributes,\n };\n\n let titleNodeIndex = node.children.findIndex(\n (c: any) => c.data?.directiveLabel,\n );\n let titleChildren: any[];\n\n if (titleNodeIndex !== -1) {\n titleChildren = node.children[titleNodeIndex].children;\n node.children.splice(titleNodeIndex, 1);\n } else {\n titleChildren = [\n {\n type: \"text\",\n value: type.charAt(0).toUpperCase() + type.slice(1),\n },\n ];\n }\n\n const getIconHast = (t: string) => {\n const props = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: \"2\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n className: [\"w-5\", \"h-5\", \"flex-shrink-0\"],\n };\n if (t === \"note\")\n return h(\"svg\", props, [\n h(\"circle\", { cx: \"12\", cy: \"12\", r: \"10\" }),\n h(\"path\", { d: \"M12 16v-4\" }),\n h(\"path\", { d: \"M12 8h.01\" }),\n ]);\n if (t === \"tip\")\n return h(\"svg\", props, [\n h(\"path\", {\n d: \"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z\",\n }),\n h(\"path\", {\n d: \"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z\",\n }),\n h(\"path\", { d: \"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0\" }),\n h(\"path\", { d: \"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5\" }),\n ]);\n if (t === \"caution\")\n return h(\"svg\", props, [\n h(\"path\", {\n d: \"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\",\n }),\n h(\"path\", { d: \"M12 9v4\" }),\n h(\"path\", { d: \"M12 17h.01\" }),\n ]);\n if (t === \"danger\")\n return h(\"svg\", props, [\n h(\"polygon\", {\n points:\n \"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\",\n }),\n h(\"path\", { d: \"M12 8v4\" }),\n h(\"path\", { d: \"M12 16h.01\" }),\n ]);\n return null;\n };\n\n const titleBlock = {\n type: \"paragraph\",\n data: {\n hName: \"p\",\n hProperties: {\n className: [\n \"flex\",\n \"items-center\",\n \"gap-2\",\n \"mb-2\",\n \"mt-0\",\n \"font-bold\",\n \"text-lg\",\n ],\n },\n },\n children: [\n {\n type: \"text\",\n value: \"\",\n data: { hName: \"span\", hChildren: [getIconHast(type)] },\n },\n ...titleChildren,\n ],\n };\n\n const contentBlock = {\n type: \"paragraph\",\n data: {\n hName: \"section\",\n hProperties: {\n className: [\n \"[&>p]:mt-0\",\n \"[&>p]:mb-2\",\n \"[&>p:last-child]:mb-0\",\n ],\n },\n },\n children: node.children,\n };\n\n node.children = [titleBlock, contentBlock];\n }\n });\n };\n}\n\nexport function rehypeAddNotProseToPre() {\n return (tree: Node) => {\n visit(tree, (node: any) => {\n // Look specifically for HTML elements that are <pre> tags\n if (node.type === \"element\" && node.tagName === \"pre\") {\n node.properties = node.properties || {};\n\n // HAST classNames are generally arrays of strings\n const currentClass = node.properties.className || [];\n node.properties.className = Array.isArray(currentClass)\n ? [...currentClass, \"not-prose\"]\n : [currentClass, \"not-prose\"];\n }\n });\n };\n}\n\nexport async function compileMarkdown(\n content: Readonly<Compatible>,\n baseUrl: string,\n options?: PrestigeConfig[\"markdown\"],\n) {\n const toc: TocItem[] = [];\n\n const rehypePlugins: PluggableList = [\n ...(options?.rehypePlugins ?? []),\n rehypeSlug,\n [rehypePrism, { options: { showLineNumbers: false } }],\n rehypeAddNotProseToPre,\n ];\n\n const remarkPlugins: PluggableList = [\n ...(options?.remarkPlugins ?? []),\n remarkFrontmatter,\n [remarkGfm, options?.gfmOptions || {}],\n remarkDirective,\n remarkAdmonitions,\n [remarkFlexibleToc, { tocRef: toc }],\n ];\n\n const code = await compile(content, {\n outputFormat: \"program\",\n rehypePlugins,\n remarkPlugins,\n baseUrl: baseUrl,\n });\n return { code: String(code), toc };\n}\n\nexport async function compileFrontmatter(vFile: VFile) {\n const result = matter(String(vFile.value));\n return result.data || {};\n}\n\nexport function warmupCompiler(options?: PrestigeConfig[\"markdown\"]) {\n compileMarkdown(\"```js\\n```\", \"http://localhost\", options).catch(() => {});\n}\n","import { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { parse, relative } from \"pathe\";\nimport { glob } from \"tinyglobby\";\nimport { read } from \"to-vfile\";\nimport {\n SiblingNavigationType,\n SidebarLinkType,\n} from \"../core/content/content.types\";\nimport { compileMarkdown } from \"./content-compiler\";\n\nimport { PrestigeError } from \"../utils/errors\";\nimport { compileFrontmatter } from \"./content-compiler\";\n\nexport const CONTENT_VIRTUAL_ID = \"virtual:prestige/content/\";\n\nfunction getSiblingLink(\n link: SidebarLinkType | undefined,\n): SiblingNavigationType | undefined {\n if (!link) {\n return undefined;\n }\n return {\n label: link.label,\n link: \"slug\" in link ? link.slug : link.link,\n };\n}\n\nexport function resolveSiblings(\n base: string,\n slug: string,\n linksMap: Map<string, SidebarLinkType[]>,\n) {\n const links = linksMap.get(base);\n if (!links?.length) {\n return { prev: undefined, next: undefined };\n }\n\n const validLinks = links.filter((l) => {\n if (\"slug\" in l) return true;\n if (\"link\" in l) {\n return !l.link.startsWith(\"http://\") && !l.link.startsWith(\"https://\");\n }\n return false;\n });\n\n const linkIndex = validLinks.findIndex((link) => {\n return (\n (\"slug\" in link && link.slug === slug) ||\n (\"link\" in link && link.link === slug)\n );\n });\n\n let prev: SiblingNavigationType | undefined;\n let next: SiblingNavigationType | undefined;\n\n if (linkIndex !== -1) {\n if (linkIndex > 0) {\n prev = getSiblingLink(validLinks[linkIndex - 1]);\n }\n if (linkIndex < validLinks.length - 1) {\n next = getSiblingLink(validLinks[linkIndex + 1]);\n }\n }\n\n return { prev, next };\n}\n\nexport async function resolveMarkdown(slug: string, contentDir: string) {\n const filePath = await getPathBySlug(slug, contentDir);\n const baseUrl = pathToFileURL(filePath).href;\n const file = await read(filePath);\n const frontmatter = await compileFrontmatter(file);\n const { code, toc } = await compileMarkdown(file, baseUrl);\n return { code, toc, frontmatter };\n}\n\nexport async function resolveContent(\n id: string,\n linksMap: Map<string, SidebarLinkType[]>,\n contentDir: string,\n) {\n const slug = id.replace(CONTENT_VIRTUAL_ID, \"\").replace(\"\\0\", \"\");\n const base = slug.split(\"/\")[0] as string;\n\n const { prev, next } = resolveSiblings(base, slug, linksMap);\n const { toc, code, frontmatter } = await resolveMarkdown(slug, contentDir);\n let resolvedCode = code;\n\n resolvedCode += `\\n export const toc = ${JSON.stringify(toc)}\\n`;\n resolvedCode += `\\n export const prev = ${JSON.stringify(prev)}\\n`;\n resolvedCode += `\\n export const next = ${JSON.stringify(next)}\\n`;\n resolvedCode += `\\n export const frontmatter = ${JSON.stringify(\n frontmatter,\n )}\\n`;\n return resolvedCode;\n}\n\nexport async function getPathBySlug(slug: string, contentDir: string) {\n const pathMatch = join(contentDir, slug);\n const matches = await glob(`${pathMatch}.{md,mdx}`);\n if (matches.length === 0) {\n throw new PrestigeError(\n `[Prestige] Could not find markdown file for slug: \"${slug}\". Searched at: ${pathMatch}.{md,mdx}. If you want to link to a custom page, use 'link: \"${slug}\"' instead of 'slug: \"${slug}\"' in your collection config.`,\n );\n }\n return matches[0] as string;\n}\n\nexport async function getFileBySlug(slug: string, contentDir: string) {\n return await read(await getPathBySlug(slug, contentDir));\n}\n\nexport function getVirtualModuleIdsForFile(path: string, contentDir: string) {\n const slug = getSlugByPath(path, contentDir);\n return [\"\\0\" + CONTENT_VIRTUAL_ID + slug];\n}\n\nexport function getSlugByPath(path: string, contentDir: string) {\n // 1. Get the relative path: \"zz/zz/myFile.json\"\n const relativePath = relative(contentDir, path);\n\n // 2. Parse the path to separate the extension\n const pathInfo = parse(relativePath);\n\n const result = join(pathInfo.dir, pathInfo.name);\n\n return result;\n}\n","import { readdir } from \"node:fs/promises\";\nimport { basename } from \"node:path\";\nimport { join } from \"pathe\";\nimport {\n Collection,\n CollectionGroup,\n CollectionItem,\n Collections,\n ExternalSidebarLinkType,\n InternalCollectionLink,\n InternalSidebarLinkType,\n NavigationLinks,\n SiblingNavigationType,\n SidebarGroupType,\n SidebarItemType,\n SidebarType,\n} from \"../core/content/content.types\";\nimport { PrestigeError } from \"../utils/errors\";\nimport { pathExists } from \"../utils/file-utils\";\nimport { compileFrontmatter } from \"./content-compiler\";\nimport { getFileBySlug } from \"./content.store\";\nimport { Logger } from \"../utils/logger\";\n\nexport const SIDEBAR_VIRTUAL_ID = \"virtual:prestige/sidebar/\";\n\nfunction flattenSidebar(items: SidebarItemType[]): SiblingNavigationType[] {\n return items.flatMap((item) => {\n if (\"slug\" in item) {\n return [{ label: item.label, link: `/${item.slug}` }];\n }\n if (\"link\" in item) {\n // Ignore external links\n if (item.link.startsWith(\"http://\") || item.link.startsWith(\"https://\")) {\n return [];\n }\n return [{ label: item.label, link: item.link }];\n }\n if (\"items\" in item) {\n return flattenSidebar(item.items);\n }\n return [];\n });\n}\n\nfunction computeNavigation(\n items: SidebarItemType[],\n): Record<string, NavigationLinks> {\n const flattenedLinks = flattenSidebar(items);\n const navigation: Record<string, NavigationLinks> = {};\n\n for (let i = 0; i < flattenedLinks.length; i++) {\n const link = flattenedLinks[i];\n if (link) {\n navigation[link.link] = {\n prev: i > 0 ? flattenedLinks[i - 1] : null,\n next: i < flattenedLinks.length - 1 ? flattenedLinks[i + 1] : null,\n };\n }\n }\n\n return navigation;\n}\n\nfunction resolveDefaultLink(\n items: SidebarItemType[],\n defaultLink?: string,\n): string | undefined {\n if (defaultLink) {\n return defaultLink;\n }\n for (const item of items) {\n if (\"slug\" in item) {\n return item.slug;\n } else if (\"link\" in item) {\n return item.link;\n } else if (\"items\" in item && item.items.length > 0) {\n const link = resolveDefaultLink(item.items);\n if (link) return link;\n }\n }\n return undefined;\n}\n\nexport async function resolveSidebars(\n collections: Collections,\n contentDir: string,\n logger: Logger,\n) {\n const store = new Map<string, SidebarType>();\n\n for (const collection of collections) {\n const sidebar = await processCollection(collection, contentDir, logger);\n store.set(collection.id, sidebar);\n }\n return store;\n}\n\n/** @visibleForTesting */\nasync function processCollection(\n collection: Collection,\n contentDir: string,\n logger: Logger,\n): Promise<SidebarType> {\n const items: SidebarItemType[] = [];\n for (const item of collection.items) {\n items.push(await processItem(item, contentDir, logger));\n }\n const defaultLink = resolveDefaultLink(items, collection.defaultLink);\n if (!defaultLink) {\n throw new PrestigeError(\n `No default link found in collection, it means there are no links in the collection. Please define one in ${collection.id}`,\n );\n }\n return {\n items,\n defaultLink: defaultLink,\n navigation: computeNavigation(items),\n };\n}\n\n/** @visibleForTesting */\nasync function processItem(\n item: CollectionItem,\n contentDir: string,\n logger: Logger,\n): Promise<SidebarItemType> {\n if (typeof item === \"string\" || \"slug\" in item) {\n return resolveInternalSidebarLink(\n item as InternalCollectionLink,\n contentDir,\n );\n } else if (\"link\" in item) {\n return resolveSidebarLink(item, contentDir);\n } else {\n return resolveSidebarGroup(item as CollectionGroup, contentDir, logger);\n }\n}\n\n/** @visibleForTesting */\nasync function resolveSidebarGroup(\n group: CollectionGroup,\n contentDir: string,\n logger: Logger,\n): Promise<SidebarGroupType> {\n const label = await resolveLabel(group, contentDir);\n const items: SidebarItemType[] = [];\n\n if (group.items?.length && group.autogenerate) {\n logger.warn(\n `${group.label} has both items and autogenerate. Only items will be used.`,\n );\n }\n\n if (group.items) {\n for (const childItem of group.items) {\n items.push(await processItem(childItem, contentDir, logger));\n }\n } else if (group.autogenerate?.directory) {\n const generatedItems = await autogenerateSidebar(\n group.autogenerate.directory,\n contentDir,\n logger,\n );\n items.push(...generatedItems);\n }\n\n return {\n label,\n collapsed: group.collapsed,\n items,\n };\n}\n\n/** @visibleForTesting */\nasync function resolveInternalSidebarLink(\n item: InternalCollectionLink,\n contentDir: string,\n): Promise<InternalSidebarLinkType> {\n const label = await resolveLabel(item, contentDir);\n const slug = resolveSlug(item);\n\n if (slug.startsWith(\"/\") || slug.endsWith(\"/\")) {\n throw new PrestigeError(\n `The slug ${slug} cannot start or end with a slash. Remove it and try again.`,\n );\n }\n\n if (!slug) {\n throw new PrestigeError(\n `The slug cannot be empty. Remove it and try again. link label is ${label}`,\n );\n }\n\n return {\n label,\n slug,\n };\n}\n\n/** @visibleForTesting */\nasync function resolveSidebarLink(\n item: ExternalSidebarLinkType,\n contentDir: string,\n): Promise<ExternalSidebarLinkType> {\n const label = await resolveLabel(item, contentDir);\n const link = resolveLink(item);\n\n if (!link) {\n throw new PrestigeError(\n `The link cannot be empty. Remove it and try again. link label is ${label}`,\n );\n }\n\n return {\n label,\n link,\n };\n}\n\n/** @visibleForTesting */\nasync function autogenerateSidebar(\n directory: string,\n contentDir: string,\n logger: Logger,\n): Promise<SidebarItemType[]> {\n const fileExtRegex = /\\.mdx?$/i;\n\n const items: SidebarItemType[] = [];\n const dirPath = join(contentDir, directory);\n if (!(await pathExists(dirPath))) {\n logger.warn(`Directory doesn't exist: ${directory}`);\n return [];\n }\n\n const dirents = await readdir(dirPath, { withFileTypes: true });\n dirents.sort((a, b) => a.name.localeCompare(b.name));\n for (const dirent of dirents) {\n if (dirent.isDirectory()) {\n const subDir = join(directory, dirent.name);\n const group: CollectionGroup = {\n label: dirent.name,\n autogenerate: { directory: subDir },\n };\n items.push(await resolveSidebarGroup(group, contentDir, logger));\n } else if (dirent.isFile() && fileExtRegex.test(dirent.name)) {\n const fullPath = join(directory, dirent.name);\n const slug = fullPath.replace(fileExtRegex, \"\");\n items.push(await resolveInternalSidebarLink(slug, contentDir));\n }\n }\n return items;\n}\n\n/** @visibleForTesting */\nasync function resolveLabel(\n item: CollectionItem,\n contentDir: string,\n): Promise<string> {\n if (typeof item !== \"string\" && \"label\" in item && item.label) {\n return item.label;\n }\n\n if (typeof item === \"string\" || \"slug\" in item) {\n const slug = resolveSlug(item);\n\n const file = await getFileBySlug(slug, contentDir);\n if (!file) {\n throw new PrestigeError(\n `markdown file not found with slug: ${slug} add one in content folder or update config`,\n );\n }\n const data = (await compileFrontmatter(file)) as any;\n if (data?.label) {\n return data?.label;\n }\n\n return basename(slug);\n }\n\n // is a group\n if (typeof item !== \"string\" && (\"items\" in item || \"autogenerate\" in item)) {\n return item.label;\n }\n\n return \"\";\n}\n\n/** @visibleForTesting */\nexport function resolveSlug(item: CollectionItem) {\n if (typeof item === \"string\") {\n return item;\n } else {\n if (\"slug\" in item) {\n return item.slug;\n }\n return \"\";\n }\n}\n\n/** @visibleForTesting */\nexport function resolveLink(item: CollectionItem) {\n if (typeof item === \"object\" && \"link\" in item) {\n return item.link;\n }\n return \"\";\n}\n","import { mkdir, readdir, readFile, unlink, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { SidebarLinkType } from \"../core/content/content.types\";\nimport { Logger } from \"../utils/logger\";\n\nexport async function compileRoutes(\n linksMap: Map<string, SidebarLinkType[]>,\n routesDir: string,\n logger: Logger,\n) {\n const prestigePath = \"(prestige)\";\n const prestigeFullPath = join(routesDir, prestigePath);\n\n try {\n await mkdir(prestigeFullPath, { recursive: true });\n\n const generatedFiles = new Map<string, string>();\n\n for (const [key, links] of linksMap) {\n const onlyInternalLinks = links.filter((l) => \"slug\" in l);\n\n const sidebarPath = key;\n const sidebarFile = sidebarPath + \".lazy.tsx\";\n generatedFiles.set(sidebarFile, createLayoutRoute(key));\n\n for (const l of onlyInternalLinks) {\n const pathified = l.slug.replaceAll(\"/\", \".\");\n generatedFiles.set(pathified + \".tsx\", createContentHeadRoute(l.slug));\n generatedFiles.set(pathified + \".lazy.tsx\", createContentRoute(l.slug));\n }\n }\n\n // Write files only if they have changed or do not exist\n await Promise.all(\n [...generatedFiles.entries()].map(async ([fileName, contents]) => {\n const filePath = join(prestigeFullPath, fileName);\n try {\n const existingContent = await readFile(filePath, \"utf-8\");\n if (existingContent === contents) {\n return; // Skip writing if identical\n }\n } catch (e) {\n // File doesn't exist yet, proceed to write\n }\n logger.info(`Writing route file: ${fileName}`);\n return writeFile(filePath, contents);\n }),\n );\n\n const existingFiles = await readdir(prestigeFullPath);\n const staleLazyFiles = existingFiles.filter(\n (fileName) =>\n fileName.endsWith(\".lazy.tsx\") && !generatedFiles.has(fileName),\n );\n const staleHeadFiles = staleLazyFiles\n .map((fileName) => fileName.replace(\".lazy.tsx\", \".tsx\"))\n .filter(\n (fileName) =>\n existingFiles.includes(fileName) && !generatedFiles.has(fileName),\n );\n const staleFiles = [...new Set([...staleLazyFiles, ...staleHeadFiles])];\n\n await Promise.all(\n staleFiles.map((fileName) => {\n logger.debug(`Removing stale route file: ${fileName}`);\n return unlink(join(prestigeFullPath, fileName));\n }),\n );\n } catch (error) {\n logger.error(\n `[Prestige Router Compiler] Failed to compile routes: ${error}`,\n );\n console.error(\n \"[Prestige Router Compiler] Failed to compile routes:\",\n error,\n );\n }\n}\n\nfunction createLayoutRoute(id: string) {\n return (\n `\nimport { createLazyFileRoute } from '@tanstack/react-router';\nimport sidebar from \"virtual:prestige/sidebar/${id}\";\nimport { CollectionRoute } from \"@lonik/prestige/ui\";\n\nexport const Route = createLazyFileRoute('/(prestige)/${id}')(CollectionRoute(sidebar, \"${id}\"));\n`.trim() + \"\\n\"\n );\n}\n\nfunction createContentHeadRoute(slug: string) {\n return (\n `\nimport { createFileRoute } from \"@tanstack/react-router\";\nimport * as contentData from \"virtual:prestige/content/${slug}\";\nimport { ContentRoute } from \"@lonik/prestige/ui\";\n\nexport const Route = createFileRoute('/(prestige)/${slug}')(ContentRoute(contentData));\n`.trim() + \"\\n\"\n );\n}\n\nfunction createContentRoute(slug: string) {\n return (\n `\nimport { createLazyFileRoute } from \"@tanstack/react-router\";\nimport * as contentData from \"virtual:prestige/content/${slug}\";\nimport { LazyContentRoute } from \"@lonik/prestige/ui\";\n\nexport const Route = createLazyFileRoute('/(prestige)/${slug}')(LazyContentRoute(contentData));\n`.trim() + \"\\n\"\n );\n}\n","import { genDynamicImport } from \"knitwork\";\n\nexport function genExportDefault(specifier: string) {\n return `export default ${specifier};`;\n}\n\n/** exports default undefined */\nexport function genExportUndefined() {\n return genExportDefault(\"undefined\");\n}\n\nexport function genDynamicImportWithDefault(specifier: string) {\n return `${genDynamicImport(specifier)}.then(m => m.default)`;\n}\n","import { genArrayFromRaw, genObjectFromValues } from \"knitwork\";\nimport { genExportDefault } from \"../../utils/code-generation\";\nimport { PrestigeError } from \"../../utils/errors\";\nimport {\n CollectionNavigation,\n Collections,\n SidebarLinkType,\n} from \"./content.types\";\n\nexport const COLLECTION_VIRTUAL_ID = \"virtual:prestige/collection-all\";\n\nexport function resolveCollectionNavigations(\n inlineCollections: Collections,\n linksMap: Map<string, SidebarLinkType[]>,\n) {\n const collections: CollectionNavigation[] = inlineCollections.map((c) => ({\n id: c.id,\n label: c.label ?? c.id,\n defaultLink: c.defaultLink ?? \"\",\n }));\n if (collections.length === 0) {\n throw new PrestigeError(\n `No collections found, add one in prestige plugin config`,\n );\n }\n\n for (const coll of collections) {\n const links = linksMap.get(coll.id);\n const firstInternalLink = links?.find(l => \"slug\" in l);\n if (coll.defaultLink || !firstInternalLink) {\n continue;\n }\n coll.defaultLink = firstInternalLink.slug;\n }\n\n for (const coll of collections) {\n if (!coll.defaultLink) {\n console.warn(\n `No default link found for collection ${coll.id}, it won't be displayed in the header navigation`,\n );\n }\n }\n\n const validCollections = collections.filter((c) => c.defaultLink);\n\n return genExportDefault(\n genArrayFromRaw(validCollections.map((c) => genObjectFromValues(c))),\n );\n}\n","import pc from \"picocolors\";\nexport interface Logger {\n debug: (message: string) => void;\n info: (message: string) => void;\n warn: (message: string) => void;\n error: (message: string) => void;\n}\n\nexport function createLogger(config: {\n disabled: boolean;\n debug: boolean;\n}): Logger {\n function formatLogArgs(message: string) {\n const now = new Date();\n\n // Format: 11:14:22 PM\n const timestamp = now.toLocaleTimeString(\"en-US\", {\n hour12: true,\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n\n // Vite's signature: Gray timestamp + Bold Cyan tag\n const fullMessage = `${pc.dim(timestamp)} ${pc.bold(pc.cyan(\"[prestige]\"))} ${message}`;\n return fullMessage;\n }\n\n return {\n debug: (message: string) => {\n if (!config.disabled && config.debug)\n console.debug(formatLogArgs(pc.gray(message)));\n },\n info: (message: string) => {\n if (!config.disabled) console.info(formatLogArgs(pc.reset(message)));\n },\n warn: (message: string) => {\n if (!config.disabled) console.warn(formatLogArgs(pc.yellow(message)));\n },\n error: (message: string) => {\n if (!config.disabled) console.error(formatLogArgs(pc.red(message)));\n },\n };\n}\n\nexport default createLogger;\n","import chokidar from \"chokidar\";\nimport debounce from \"debounce\";\n\nexport function initContentWatcher(contentDir: string, onUpdate: () => void) {\n const UPDATE_INTERVAL = 1000;\n const scheduleUpdate = debounce(onUpdate, UPDATE_INTERVAL);\n\n const watcher = chokidar\n .watch(contentDir, {\n awaitWriteFinish: true,\n ignoreInitial: true,\n })\n .on(\"all\", (event) => {\n if (event !== \"add\" && event !== \"unlink\") {\n return;\n }\n\n // Coalesce bursts of filesystem events into one update run per interval.\n scheduleUpdate();\n });\n\n return () => {\n scheduleUpdate.clear();\n return watcher.close();\n };\n}\n","import { join } from \"pathe\";\nimport picomatch, { type Matcher } from \"picomatch\";\nimport { EnvironmentModuleNode, type Plugin } from \"vite\";\nimport { resolvePrestigeConfig } from \"./config/config\";\nimport { PrestigeConfig, PrestigeConfigInput } from \"./config/config.types\";\n\nimport { genObjectFromValues } from \"knitwork\";\nimport { resolveContentLinks } from \"./content/content-links\";\nimport {\n resolveSidebars,\n SIDEBAR_VIRTUAL_ID,\n} from \"./content/content-sidebar.store\";\nimport {\n CONTENT_VIRTUAL_ID,\n getSlugByPath,\n resolveContent,\n} from \"./content/content.store\";\nimport { compileRoutes } from \"./content/router-compiler\";\nimport {\n COLLECTION_VIRTUAL_ID,\n resolveCollectionNavigations,\n} from \"./core/content/content-collection.store\";\nimport {\n Collections,\n SidebarLinkType,\n SidebarType,\n} from \"./core/content/content.types\";\nimport { genExportDefault, genExportUndefined } from \"./utils/code-generation\";\nimport { extractVirtualId } from \"./utils/file-utils\";\nimport { createLogger, Logger } from \"./utils/logger\";\nimport { initContentWatcher } from \"./content/content-watcher\";\n\nexport const CONFIG_VIRTUAL_ID = \"virtual:prestige/config\";\n\nexport default function prestige(inlineConfig?: PrestigeConfigInput): Plugin {\n let config: PrestigeConfig;\n let contentDir: string;\n let isDocsMatcher: Matcher;\n let collections: Collections = [];\n let linksMap: Map<string, SidebarLinkType[]>;\n let collectionNavigations: string;\n let sidebarsMap: Map<string, SidebarType>;\n let logger: Logger;\n\n return {\n name: \"vite-plugin-prestige\",\n enforce: \"pre\",\n async configResolved(resolvedConfig) {\n const { config: loadedConfig } = await resolvePrestigeConfig(\n inlineConfig,\n resolvedConfig.root,\n );\n\n config = loadedConfig;\n logger = createLogger({\n disabled: config.disableLog,\n debug: config.enableDebugLog,\n });\n\n contentDir = join(resolvedConfig.root, \"src/content\");\n isDocsMatcher = picomatch(join(contentDir, \"**/*.{md,mdx}\"));\n collections = config.collections ?? [];\n\n logger.debug(\"Resolving sidebars...\");\n sidebarsMap = await resolveSidebars(collections, contentDir, logger);\n\n logger.debug(\"Resolving content links...\");\n linksMap = resolveContentLinks(sidebarsMap);\n\n logger.debug(\"Resolving collection navigations....\");\n collectionNavigations = resolveCollectionNavigations(\n collections,\n linksMap,\n );\n const routesDir = join(resolvedConfig.root, \"src\", \"routes\");\n\n logger.debug(\"Compiling routes...\");\n await compileRoutes(linksMap, routesDir, logger);\n },\n configureServer(server) {\n const contentWatcher = initContentWatcher(contentDir, () => {\n server.restart();\n });\n server.httpServer?.on(\"close\", () => {\n contentWatcher();\n });\n },\n resolveId(id) {\n // even though the import will be import * from \"virtual:prestige/docs/introduction\"\n // it is not guaranteed that some other plugin doesn't modify this import and attach full path\n // we call extractVirtualId to trim the import\n\n if (id.includes(CONFIG_VIRTUAL_ID)) {\n logger.debug(`Resolving config virtual ID: ${id}`);\n return extractVirtualId(id, CONFIG_VIRTUAL_ID);\n }\n\n if (id.includes(CONTENT_VIRTUAL_ID)) {\n logger.debug(`Resolving content virtual ID: ${id}`);\n return extractVirtualId(id, CONTENT_VIRTUAL_ID);\n }\n\n if (id.includes(COLLECTION_VIRTUAL_ID)) {\n logger.debug(`Resolving collection virtual ID: ${id}`);\n return extractVirtualId(id, COLLECTION_VIRTUAL_ID);\n }\n\n if (id.includes(SIDEBAR_VIRTUAL_ID)) {\n logger.debug(`Resolving sidebar virtual ID: ${id}`);\n return extractVirtualId(id, SIDEBAR_VIRTUAL_ID);\n }\n\n return null;\n },\n async load(id) {\n if (id === `\\0${CONFIG_VIRTUAL_ID}`) {\n logger.debug(`Loading config virtual module: ${id}`);\n return genExportDefault(JSON.stringify(config));\n }\n if (id.includes(CONTENT_VIRTUAL_ID)) {\n logger.debug(`Loading content virtual module: ${id}`);\n return await resolveContent(id, linksMap, contentDir);\n }\n if (id.includes(COLLECTION_VIRTUAL_ID)) {\n logger.debug(`Loading collection virtual module: ${id}`);\n return collectionNavigations;\n }\n\n if (id.includes(SIDEBAR_VIRTUAL_ID)) {\n logger.debug(`Loading sidebar virtual module: ${id}`);\n const sidebarId = id.replace(SIDEBAR_VIRTUAL_ID, \"\").replace(\"\\0\", \"\");\n const sidebar = sidebarsMap.get(sidebarId);\n if (!sidebar) {\n return genExportUndefined();\n }\n return genExportDefault(genObjectFromValues(sidebar));\n }\n\n return null;\n },\n\n async hotUpdate({ file, timestamp, type }) {\n if (type !== \"update\" || !isDocsMatcher(file)) {\n return;\n }\n logger.debug(`Invalidating module ${file}...`);\n const invalidatedModules = new Set<EnvironmentModuleNode>();\n const slug = getSlugByPath(file, contentDir);\n const virtualModuleId = `\\0${CONTENT_VIRTUAL_ID}${slug}`;\n const module =\n this.environment.moduleGraph.getModuleById(virtualModuleId);\n if (module) {\n this.environment.moduleGraph.invalidateModule(\n module,\n invalidatedModules,\n timestamp,\n true,\n );\n logger.debug(`Reloading application...`);\n this.environment.hot.send({ type: \"full-reload\" });\n }\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,gBAAb,cAAmC,MAAM;;;;;AAMzC,SAAgB,wBAA2C,GAAM,OAAiB,SAAiB;AACjG,KAAI;AACF,SAAO,EAAE,MAAM,MAAM;UACd,GAAG;AACV,MAAI,aAAa,MACf,OAAM,IAAI,cAAc,yBAAyB,QAAQ,gBAAgB,EAAE,QAAQ,GAAG;MAEtF,OAAM,IAAI,cAAc,yBAAyB,QAAQ,GAAG;;;;;;ACblE,MAAa,+BAA+B,EAAE,OAAO;CACnD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAA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AY,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;;;EAGvD"}
1
+ {"version":3,"file":"vite.js","names":["CollectionGroupSchema: z.ZodType<CollectionGroup, CollectionGroup>","CollectionItemSchema: z.ZodType<CollectionItem, CollectionItem>","sidebarLinks: SidebarLinkType[]","processItem","data","typeMap: Record<\"note\" | \"tip\" | \"caution\" | \"danger\", string>","titleChildren: any[]","toc: TocItem[]","prev: SiblingNavigationType | undefined","next: SiblingNavigationType | undefined","join","navigation: Record<string, NavigationLinks>","items: SidebarItemType[]","group: CollectionGroup","join","collections: CollectionNavigation[]","config: PrestigeConfig","contentDir: string","isDocsMatcher: Matcher","collections: Collections","linksMap: Map<string, SidebarLinkType[]>","collectionNavigations: string","sidebarsMap: Map<string, SidebarType>","logger: Logger"],"sources":["../src/vite/utils/errors.ts","../src/vite/core/content/content.types.ts","../src/vite/config/config.types.ts","../src/vite/utils/file-utils.ts","../src/vite/config/config.ts","../src/vite/content/content-links.ts","../src/vite/content/content-compiler.ts","../src/vite/content/content.store.ts","../src/vite/content/content-sidebar.store.ts","../src/vite/content/router-compiler.ts","../src/vite/utils/code-generation.ts","../src/vite/core/content/content-collection.store.ts","../src/vite/utils/logger.ts","../src/vite/content/content-watcher.ts","../src/vite/plugin.ts"],"sourcesContent":["import { type ZodType, input } from \"zod\";\n\nexport class PrestigeError extends Error {}\n\n/**\n * Parse data with zod schema and if fails throw PrestigeError that is friendly error\n * for prestige ecosystem\n */\nexport function parseWithFriendlyErrors<T extends ZodType>(s: T, input: input<T>, message: string) {\n try {\n return s.parse(input);\n } catch (e) {\n if (e instanceof Error) {\n throw new PrestigeError(`Prestige error cause: ${message}, with error: ${e.message} `);\n } else {\n throw new PrestigeError(`Prestige error cause: ${message} `);\n }\n }\n}\n","import { z } from \"zod\";\n\nexport const ContentHeadFrontmatterSchema = z.object({\n meta: z.array(z.record(z.string(), z.any())).optional(),\n links: z.array(z.record(z.string(), z.any())).optional(),\n styles: z.array(z.record(z.string(), z.any())).optional(),\n scripts: z.array(z.record(z.string(), z.any())).optional(),\n});\n\nexport type ContentHeadFrontmatterType = z.infer<\n typeof ContentHeadFrontmatterSchema\n>;\n\nexport const ContentFrontmatterSchema = z.object({\n title: z.string().describe(\"The title of the article\"),\n description: z.string().optional().describe(\"The description of the article\"),\n label: z.string().optional().describe(\"The label of the content\"),\n head: ContentHeadFrontmatterSchema.optional(),\n});\n\nexport type ContentFrontmatterType = z.infer<typeof ContentFrontmatterSchema>;\n\nexport const ContentSchema = z.object({\n matter: ContentFrontmatterSchema,\n html: z.string().describe(\"The html of the content\"),\n});\n\nexport type ContentType = z.infer<typeof ContentSchema>;\n\nconst InternalCollectionLinkSchema = z.union([\n z.object({\n label: z.string(),\n slug: z.string(),\n }),\n z.string(),\n]);\n\nconst ExternalCollectionLinkSchema = z.object({\n label: z.string(),\n link: z.string(),\n});\n\nexport type ExternalCollectionLink = z.infer<\n typeof ExternalCollectionLinkSchema\n>;\n\nexport type InternalCollectionLink = z.infer<\n typeof InternalCollectionLinkSchema\n>;\n\nexport type CollectionGroup = {\n label: string;\n items?: CollectionItem[] | undefined;\n collapsed?: boolean | undefined;\n autogenerate?: { directory: string } | undefined;\n};\n\nexport type CollectionItem =\n | InternalCollectionLink\n | CollectionGroup\n | ExternalCollectionLink;\n\nconst CollectionGroupSchema: z.ZodType<CollectionGroup, CollectionGroup> =\n z.object({\n label: z.string(),\n items: z.lazy(() => z.array(CollectionItemSchema)).optional(),\n collapsed: z.boolean().optional(),\n autogenerate: z\n .object({\n directory: z.string(),\n })\n .optional(),\n });\n\nconst CollectionItemSchema: z.ZodType<CollectionItem, CollectionItem> = z.union(\n [\n ExternalCollectionLinkSchema,\n InternalCollectionLinkSchema,\n z.lazy(() => CollectionGroupSchema),\n ],\n);\n\nexport const CollectionSchema = z.object({\n id: z\n .string()\n .min(1, { message: \"Folder name cannot be empty\" })\n .max(50, { message: \"Folder name too long\" })\n // Allows alphanumeric, hyphens, and underscores\n .regex(/^[a-zA-Z0-9-_]+$/, {\n message: \"Only alphanumeric, hyphens, and underscores allowed\",\n })\n .describe(\"The id of the collection, must match the folder name\"),\n items: z.array(CollectionItemSchema),\n label: z.string().optional().describe(\"The label of the collection\"),\n defaultLink: z\n .string()\n .optional()\n .describe(\"The default link of the collection\"),\n});\n\nexport type Collection = z.infer<typeof CollectionSchema>;\n\nexport type CollectionNavigation = {\n id: string;\n label: string;\n defaultLink?: string;\n};\n\nexport type CollectionInput = z.input<typeof CollectionSchema>;\n\nexport const CollectionsSchema = z.array(CollectionSchema);\n\nexport type Collections = z.infer<typeof CollectionsSchema>;\n\nexport interface InternalSidebarLinkType {\n slug: string;\n label: string;\n}\n\nexport interface ExternalSidebarLinkType {\n label: string;\n link: string;\n}\n\nexport type SidebarLinkType = InternalSidebarLinkType | ExternalSidebarLinkType;\n\nexport interface SidebarGroupType {\n label: string;\n items: SidebarItemType[];\n collapsed?: boolean | undefined;\n}\n\nexport type SidebarItemType =\n | InternalSidebarLinkType\n | SidebarGroupType\n | ExternalSidebarLinkType;\n\nexport interface SidebarType {\n items: SidebarItemType[];\n defaultLink: string;\n navigation: Record<string, NavigationLinks>;\n}\n\nexport interface SiblingNavigationType {\n label: string;\n link: string;\n}\n\nexport interface NavigationLinks {\n prev: SiblingNavigationType | null | undefined;\n next: SiblingNavigationType | null | undefined;\n}\n","import { FlexibleTocOptions } from \"remark-flexible-toc\";\nimport type { Options as RemarkGfmOptions } from \"remark-gfm\";\nimport { PluggableList } from \"unified\";\nimport { z } from \"zod\";\nimport { CollectionsSchema } from \"../core/content/content.types\";\n\nexport const PrestigeConfigSchema = z.object({\n title: z.string().describe(\"Title of the website\"),\n disableLog: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Disable logger, default is false\"),\n enableDebugLog: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Enable debug log, default is false\"),\n collections: CollectionsSchema,\n markdown: z\n .object({\n gfmOptions: z\n .custom<RemarkGfmOptions>()\n .optional()\n .describe(\"Options for remark-gfm\"),\n rehypePlugins: z\n .custom<PluggableList>()\n .optional()\n .describe(\"Additional rehype plugins\"),\n remarkPlugins: z\n .custom<PluggableList>()\n .optional()\n .describe(\"Additional remark plugins\"),\n remarkFlexibleToc: z\n .custom<FlexibleTocOptions>()\n .optional()\n .describe(\"Options for remark-flexible-toc\"),\n rehypeSlug: z\n .custom<{\n prefix?: string;\n }>()\n .optional()\n .describe(\"Options for rehype-slug\"),\n })\n .optional()\n .describe(\"Markdown options, configure how markdown is parsed\"),\n});\n\nexport type PrestigeConfigInput = z.input<typeof PrestigeConfigSchema>;\nexport type PrestigeConfig = z.infer<typeof PrestigeConfigSchema>;\n","import { mkdir, rm, stat, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"pathe\";\n\nexport async function pathExists(path: string) {\n try {\n await stat(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function ensureDir(dirPath: string) {\n await mkdir(dirPath, { recursive: true });\n}\n\nexport async function outputFile(\n filePath: string,\n data: string | NodeJS.ArrayBufferView,\n) {\n const dir = dirname(filePath);\n\n // recursive: true won't throw if the dir already exists\n await mkdir(dir, { recursive: true });\n await writeFile(filePath, data);\n}\n\nexport async function rmSafe(path: string) {\n try {\n await rm(path, { recursive: true, force: true });\n return true;\n } catch {\n return false;\n }\n}\n\n// Helper function to extract the virtual ID from a messy path\nexport function extractVirtualId(fullId: string, virtualPrefix: string) {\n const startIndex = fullId.indexOf(virtualPrefix);\n if (startIndex !== -1) {\n // Slice from the start of the virtual prefix to the end of the string\n return \"\\0\" + fullId.slice(startIndex);\n }\n return null;\n}\n","import { parseWithFriendlyErrors, PrestigeError } from \"../utils/errors\";\nimport { PrestigeConfigInput, PrestigeConfigSchema } from \"./config.types\";\nimport { join } from \"pathe\";\nimport { pathExists } from \"../utils/file-utils\";\n\nexport function validateConfig(config: PrestigeConfigInput) {\n return parseWithFriendlyErrors(PrestigeConfigSchema, config, \"Invalid schema\");\n}\n\nexport async function resolvePrestigeConfig(\n configInput: PrestigeConfigInput | undefined,\n root: string,\n) {\n if (!configInput) {\n throw new PrestigeError(\"Prestige config is required\");\n }\n\n const validatedConfig = validateConfig(configInput);\n const docsDirPath = join(root, \"src/content\");\n\n if (!(await pathExists(docsDirPath))) {\n throw new PrestigeError(`Docs! directory not found: ${docsDirPath}`);\n }\n\n return { config: validatedConfig, fullDocsDir: docsDirPath };\n}\n","import { SidebarLinkType, SidebarItemType, SidebarType } from \"../core/content/content.types\";\n\nexport function resolveContentLinks(sidebars: Map<string, SidebarType>) {\n const links = new Map<string, SidebarLinkType[]>();\n for (const [key, sidebar] of sidebars) {\n const sidebarLinks: SidebarLinkType[] = [];\n for (const item of sidebar.items) {\n processItem(item, sidebarLinks);\n }\n links.set(key, sidebarLinks);\n }\n return links;\n}\n\nfunction processItem(item: SidebarItemType, links: SidebarLinkType[] = []) {\n if (\"slug\" in item || \"link\" in item) {\n links.push(item);\n } else if (\"items\" in item) {\n for (const childItem of item.items) {\n processItem(childItem, links);\n }\n }\n return links;\n}\n","import { compile } from \"@mdx-js/mdx\";\nimport rehypePrism from \"rehype-prism-plus\";\nimport rehypeSlug from \"rehype-slug\";\nimport remarkDirective from \"remark-directive\";\nimport remarkFlexibleToc, { TocItem } from \"remark-flexible-toc\";\nimport remarkFrontmatter from \"remark-frontmatter\";\nimport remarkGfm from \"remark-gfm\";\nimport { PluggableList } from \"unified\";\nimport { Compatible, VFile } from \"vfile\";\nimport matter from \"gray-matter\";\nimport { PrestigeConfig } from \"../config/config.types\";\n\nimport { h } from \"hastscript\";\nimport type { Node } from \"unist\";\nimport { visit } from \"unist-util-visit\";\n\nexport default function remarkAdmonitions() {\n return (tree: Node) => {\n visit(tree, (node: any) => {\n if (\n node.type === \"textDirective\" ||\n node.type === \"leafDirective\" ||\n node.type === \"containerDirective\"\n ) {\n if (node.type !== \"containerDirective\") {\n const data = node.data || (node.data = {});\n const hast = h(node.type === \"textDirective\" ? \"span\" : \"aside\", {\n className: [\"admonition\", `admonition-${node.name}`],\n ...node.attributes,\n });\n data.hName = hast.tagName;\n data.hProperties = hast.properties;\n return;\n }\n\n const type = [\"note\", \"tip\", \"caution\", \"danger\"].includes(node.name)\n ? node.name\n : \"note\";\n\n const typeMap: Record<\"note\" | \"tip\" | \"caution\" | \"danger\", string> = {\n note: \"bg-blue-50/50 dark:bg-blue-900/20 border-blue-500 text-blue-900 dark:text-blue-200\",\n tip: \"bg-purple-50/50 dark:bg-purple-900/20 border-purple-500 text-purple-900 dark:text-purple-200\",\n caution:\n \"bg-yellow-50/50 dark:bg-yellow-900/20 border-yellow-500 text-yellow-900 dark:text-yellow-200\",\n danger:\n \"bg-red-50/50 dark:bg-red-900/20 border-red-500 text-red-900 dark:text-red-200\",\n };\n\n const data = node.data || (node.data = {});\n data.hName = \"aside\";\n data.hProperties = {\n \"aria-label\": type.charAt(0).toUpperCase() + type.slice(1),\n className: [\n \"relative\",\n \"my-6\",\n \"px-4\",\n \"py-3\",\n \"border-l-4\",\n \"rounded-lg\",\n ...(typeMap[type as keyof typeof typeMap] || typeMap[\"note\"]).split(\n \" \",\n ),\n ],\n ...node.attributes,\n };\n\n let titleNodeIndex = node.children.findIndex(\n (c: any) => c.data?.directiveLabel,\n );\n let titleChildren: any[];\n\n if (titleNodeIndex !== -1) {\n titleChildren = node.children[titleNodeIndex].children;\n node.children.splice(titleNodeIndex, 1);\n } else {\n titleChildren = [\n {\n type: \"text\",\n value: type.charAt(0).toUpperCase() + type.slice(1),\n },\n ];\n }\n\n const getIconHast = (t: string) => {\n const props = {\n xmlns: \"http://www.w3.org/2000/svg\",\n width: \"24\",\n height: \"24\",\n viewBox: \"0 0 24 24\",\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: \"2\",\n strokeLinecap: \"round\",\n strokeLinejoin: \"round\",\n className: [\"w-5\", \"h-5\", \"flex-shrink-0\"],\n };\n if (t === \"note\")\n return h(\"svg\", props, [\n h(\"circle\", { cx: \"12\", cy: \"12\", r: \"10\" }),\n h(\"path\", { d: \"M12 16v-4\" }),\n h(\"path\", { d: \"M12 8h.01\" }),\n ]);\n if (t === \"tip\")\n return h(\"svg\", props, [\n h(\"path\", {\n d: \"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z\",\n }),\n h(\"path\", {\n d: \"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z\",\n }),\n h(\"path\", { d: \"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0\" }),\n h(\"path\", { d: \"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5\" }),\n ]);\n if (t === \"caution\")\n return h(\"svg\", props, [\n h(\"path\", {\n d: \"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z\",\n }),\n h(\"path\", { d: \"M12 9v4\" }),\n h(\"path\", { d: \"M12 17h.01\" }),\n ]);\n if (t === \"danger\")\n return h(\"svg\", props, [\n h(\"polygon\", {\n points:\n \"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2\",\n }),\n h(\"path\", { d: \"M12 8v4\" }),\n h(\"path\", { d: \"M12 16h.01\" }),\n ]);\n return null;\n };\n\n const titleBlock = {\n type: \"paragraph\",\n data: {\n hName: \"p\",\n hProperties: {\n className: [\n \"flex\",\n \"items-center\",\n \"gap-2\",\n \"mb-2\",\n \"mt-0\",\n \"font-bold\",\n \"text-lg\",\n ],\n },\n },\n children: [\n {\n type: \"text\",\n value: \"\",\n data: { hName: \"span\", hChildren: [getIconHast(type)] },\n },\n ...titleChildren,\n ],\n };\n\n const contentBlock = {\n type: \"paragraph\",\n data: {\n hName: \"section\",\n hProperties: {\n className: [\n \"[&>p]:mt-0\",\n \"[&>p]:mb-2\",\n \"[&>p:last-child]:mb-0\",\n ],\n },\n },\n children: node.children,\n };\n\n node.children = [titleBlock, contentBlock];\n }\n });\n };\n}\n\nexport function rehypeAddNotProseToPre() {\n return (tree: Node) => {\n visit(tree, (node: any) => {\n // Look specifically for HTML elements that are <pre> tags\n if (node.type === \"element\" && node.tagName === \"pre\") {\n node.properties = node.properties || {};\n\n // HAST classNames are generally arrays of strings\n const currentClass = node.properties.className || [];\n node.properties.className = Array.isArray(currentClass)\n ? [...currentClass, \"not-prose\"]\n : [currentClass, \"not-prose\"];\n }\n });\n };\n}\n\nexport async function compileMarkdown(\n content: Readonly<Compatible>,\n baseUrl: string,\n options?: PrestigeConfig[\"markdown\"],\n) {\n const toc: TocItem[] = [];\n\n const rehypePlugins: PluggableList = [\n ...(options?.rehypePlugins ?? []),\n rehypeSlug,\n [rehypePrism, { options: { showLineNumbers: false } }],\n rehypeAddNotProseToPre,\n ];\n\n const remarkPlugins: PluggableList = [\n ...(options?.remarkPlugins ?? []),\n remarkFrontmatter,\n [remarkGfm, options?.gfmOptions || {}],\n remarkDirective,\n remarkAdmonitions,\n [remarkFlexibleToc, { tocRef: toc }],\n ];\n\n const code = await compile(content, {\n outputFormat: \"program\",\n rehypePlugins,\n remarkPlugins,\n baseUrl: baseUrl,\n });\n return { code: String(code), toc };\n}\n\nexport async function compileFrontmatter(vFile: VFile) {\n const result = matter(String(vFile.value));\n return result.data || {};\n}\n\nexport function warmupCompiler(options?: PrestigeConfig[\"markdown\"]) {\n compileMarkdown(\"```js\\n```\", \"http://localhost\", options).catch(() => {});\n}\n","import { join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\nimport { parse, relative } from \"pathe\";\nimport { glob } from \"tinyglobby\";\nimport { read } from \"to-vfile\";\nimport {\n SiblingNavigationType,\n SidebarLinkType,\n} from \"../core/content/content.types\";\nimport { compileMarkdown } from \"./content-compiler\";\n\nimport { PrestigeError } from \"../utils/errors\";\nimport { compileFrontmatter } from \"./content-compiler\";\n\nexport const CONTENT_VIRTUAL_ID = \"virtual:prestige/content/\";\n\nfunction getSiblingLink(\n link: SidebarLinkType | undefined,\n): SiblingNavigationType | undefined {\n if (!link) {\n return undefined;\n }\n return {\n label: link.label,\n link: \"slug\" in link ? link.slug : link.link,\n };\n}\n\nexport function resolveSiblings(\n base: string,\n slug: string,\n linksMap: Map<string, SidebarLinkType[]>,\n) {\n const links = linksMap.get(base);\n if (!links?.length) {\n return { prev: undefined, next: undefined };\n }\n\n const validLinks = links.filter((l) => {\n if (\"slug\" in l) return true;\n if (\"link\" in l) {\n return !l.link.startsWith(\"http://\") && !l.link.startsWith(\"https://\");\n }\n return false;\n });\n\n const linkIndex = validLinks.findIndex((link) => {\n return (\n (\"slug\" in link && link.slug === slug) ||\n (\"link\" in link && link.link === slug)\n );\n });\n\n let prev: SiblingNavigationType | undefined;\n let next: SiblingNavigationType | undefined;\n\n if (linkIndex !== -1) {\n if (linkIndex > 0) {\n prev = getSiblingLink(validLinks[linkIndex - 1]);\n }\n if (linkIndex < validLinks.length - 1) {\n next = getSiblingLink(validLinks[linkIndex + 1]);\n }\n }\n\n return { prev, next };\n}\n\nexport async function resolveMarkdown(slug: string, contentDir: string) {\n const filePath = await getPathBySlug(slug, contentDir);\n const baseUrl = pathToFileURL(filePath).href;\n const file = await read(filePath);\n const frontmatter = await compileFrontmatter(file);\n const { code, toc } = await compileMarkdown(file, baseUrl);\n return { code, toc, frontmatter };\n}\n\nexport async function resolveContent(\n id: string,\n linksMap: Map<string, SidebarLinkType[]>,\n contentDir: string,\n) {\n const slug = id.replace(CONTENT_VIRTUAL_ID, \"\").replace(\"\\0\", \"\");\n const base = slug.split(\"/\")[0] as string;\n\n const { prev, next } = resolveSiblings(base, slug, linksMap);\n const { toc, code, frontmatter } = await resolveMarkdown(slug, contentDir);\n let resolvedCode = code;\n\n resolvedCode += `\\n export const toc = ${JSON.stringify(toc)}\\n`;\n resolvedCode += `\\n export const prev = ${JSON.stringify(prev)}\\n`;\n resolvedCode += `\\n export const next = ${JSON.stringify(next)}\\n`;\n resolvedCode += `\\n export const frontmatter = ${JSON.stringify(\n frontmatter,\n )}\\n`;\n return resolvedCode;\n}\n\nexport async function getPathBySlug(slug: string, contentDir: string) {\n const pathMatch = join(contentDir, slug);\n const matches = await glob(`${pathMatch}.{md,mdx}`);\n if (matches.length === 0) {\n throw new PrestigeError(\n `[Prestige] Could not find markdown file for slug: \"${slug}\". Searched at: ${pathMatch}.{md,mdx}. If you want to link to a custom page, use 'link: \"${slug}\"' instead of 'slug: \"${slug}\"' in your collection config.`,\n );\n }\n return matches[0] as string;\n}\n\nexport async function getFileBySlug(slug: string, contentDir: string) {\n return await read(await getPathBySlug(slug, contentDir));\n}\n\nexport function getVirtualModuleIdsForFile(path: string, contentDir: string) {\n const slug = getSlugByPath(path, contentDir);\n return [\"\\0\" + CONTENT_VIRTUAL_ID + slug];\n}\n\nexport function getSlugByPath(path: string, contentDir: string) {\n // 1. Get the relative path: \"zz/zz/myFile.json\"\n const relativePath = relative(contentDir, path);\n\n // 2. Parse the path to separate the extension\n const pathInfo = parse(relativePath);\n\n const result = join(pathInfo.dir, pathInfo.name);\n\n return result;\n}\n","import { readdir } from \"node:fs/promises\";\nimport { basename } from \"node:path\";\nimport { join } from \"pathe\";\nimport {\n Collection,\n CollectionGroup,\n CollectionItem,\n Collections,\n ExternalSidebarLinkType,\n InternalCollectionLink,\n InternalSidebarLinkType,\n NavigationLinks,\n SiblingNavigationType,\n SidebarGroupType,\n SidebarItemType,\n SidebarType,\n} from \"../core/content/content.types\";\nimport { PrestigeError } from \"../utils/errors\";\nimport { pathExists } from \"../utils/file-utils\";\nimport { compileFrontmatter } from \"./content-compiler\";\nimport { getFileBySlug } from \"./content.store\";\nimport { Logger } from \"../utils/logger\";\n\nexport const SIDEBAR_VIRTUAL_ID = \"virtual:prestige/sidebar/\";\n\nfunction flattenSidebar(items: SidebarItemType[]): SiblingNavigationType[] {\n return items.flatMap((item) => {\n if (\"slug\" in item) {\n return [{ label: item.label, link: `/${item.slug}` }];\n }\n if (\"link\" in item) {\n // Ignore external links\n if (item.link.startsWith(\"http://\") || item.link.startsWith(\"https://\")) {\n return [];\n }\n return [{ label: item.label, link: item.link }];\n }\n if (\"items\" in item) {\n return flattenSidebar(item.items);\n }\n return [];\n });\n}\n\nfunction computeNavigation(\n items: SidebarItemType[],\n): Record<string, NavigationLinks> {\n const flattenedLinks = flattenSidebar(items);\n const navigation: Record<string, NavigationLinks> = {};\n\n for (let i = 0; i < flattenedLinks.length; i++) {\n const link = flattenedLinks[i];\n if (link) {\n navigation[link.link] = {\n prev: i > 0 ? flattenedLinks[i - 1] : null,\n next: i < flattenedLinks.length - 1 ? flattenedLinks[i + 1] : null,\n };\n }\n }\n\n return navigation;\n}\n\nfunction resolveDefaultLink(\n items: SidebarItemType[],\n defaultLink?: string,\n): string | undefined {\n if (defaultLink) {\n return defaultLink;\n }\n for (const item of items) {\n if (\"slug\" in item) {\n return item.slug;\n } else if (\"link\" in item) {\n return item.link;\n } else if (\"items\" in item && item.items.length > 0) {\n const link = resolveDefaultLink(item.items);\n if (link) return link;\n }\n }\n return undefined;\n}\n\nexport async function resolveSidebars(\n collections: Collections,\n contentDir: string,\n logger: Logger,\n) {\n const store = new Map<string, SidebarType>();\n\n for (const collection of collections) {\n const sidebar = await processCollection(collection, contentDir, logger);\n store.set(collection.id, sidebar);\n }\n return store;\n}\n\n/** @visibleForTesting */\nasync function processCollection(\n collection: Collection,\n contentDir: string,\n logger: Logger,\n): Promise<SidebarType> {\n const items: SidebarItemType[] = [];\n for (const item of collection.items) {\n items.push(await processItem(item, contentDir, logger));\n }\n const defaultLink = resolveDefaultLink(items, collection.defaultLink);\n if (!defaultLink) {\n throw new PrestigeError(\n `No default link found in collection, it means there are no links in the collection. Please define one in ${collection.id}`,\n );\n }\n return {\n items,\n defaultLink: defaultLink,\n navigation: computeNavigation(items),\n };\n}\n\n/** @visibleForTesting */\nasync function processItem(\n item: CollectionItem,\n contentDir: string,\n logger: Logger,\n): Promise<SidebarItemType> {\n if (typeof item === \"string\" || \"slug\" in item) {\n return resolveInternalSidebarLink(\n item as InternalCollectionLink,\n contentDir,\n );\n } else if (\"link\" in item) {\n return resolveSidebarLink(item, contentDir);\n } else {\n return resolveSidebarGroup(item as CollectionGroup, contentDir, logger);\n }\n}\n\n/** @visibleForTesting */\nasync function resolveSidebarGroup(\n group: CollectionGroup,\n contentDir: string,\n logger: Logger,\n): Promise<SidebarGroupType> {\n const label = await resolveLabel(group, contentDir);\n const items: SidebarItemType[] = [];\n\n if (group.items?.length && group.autogenerate) {\n logger.warn(\n `${group.label} has both items and autogenerate. Only items will be used.`,\n );\n }\n\n if (group.items) {\n for (const childItem of group.items) {\n items.push(await processItem(childItem, contentDir, logger));\n }\n } else if (group.autogenerate?.directory) {\n const generatedItems = await autogenerateSidebar(\n group.autogenerate.directory,\n contentDir,\n logger,\n );\n items.push(...generatedItems);\n }\n\n return {\n label,\n collapsed: group.collapsed,\n items,\n };\n}\n\n/** @visibleForTesting */\nasync function resolveInternalSidebarLink(\n item: InternalCollectionLink,\n contentDir: string,\n): Promise<InternalSidebarLinkType> {\n const label = await resolveLabel(item, contentDir);\n const slug = resolveSlug(item);\n\n if (slug.startsWith(\"/\") || slug.endsWith(\"/\")) {\n throw new PrestigeError(\n `The slug ${slug} cannot start or end with a slash. Remove it and try again.`,\n );\n }\n\n if (!slug) {\n throw new PrestigeError(\n `The slug cannot be empty. Remove it and try again. link label is ${label}`,\n );\n }\n\n return {\n label,\n slug,\n };\n}\n\n/** @visibleForTesting */\nasync function resolveSidebarLink(\n item: ExternalSidebarLinkType,\n contentDir: string,\n): Promise<ExternalSidebarLinkType> {\n const label = await resolveLabel(item, contentDir);\n const link = resolveLink(item);\n\n if (!link) {\n throw new PrestigeError(\n `The link cannot be empty. Remove it and try again. link label is ${label}`,\n );\n }\n\n return {\n label,\n link,\n };\n}\n\n/** @visibleForTesting */\nasync function autogenerateSidebar(\n directory: string,\n contentDir: string,\n logger: Logger,\n): Promise<SidebarItemType[]> {\n const fileExtRegex = /\\.mdx?$/i;\n\n const items: SidebarItemType[] = [];\n const dirPath = join(contentDir, directory);\n if (!(await pathExists(dirPath))) {\n logger.warn(`Directory doesn't exist: ${directory}`);\n return [];\n }\n\n const dirents = await readdir(dirPath, { withFileTypes: true });\n dirents.sort((a, b) => a.name.localeCompare(b.name));\n for (const dirent of dirents) {\n if (dirent.isDirectory()) {\n const subDir = join(directory, dirent.name);\n const group: CollectionGroup = {\n label: dirent.name,\n autogenerate: { directory: subDir },\n };\n items.push(await resolveSidebarGroup(group, contentDir, logger));\n } else if (dirent.isFile() && fileExtRegex.test(dirent.name)) {\n const fullPath = join(directory, dirent.name);\n const slug = fullPath.replace(fileExtRegex, \"\");\n items.push(await resolveInternalSidebarLink(slug, contentDir));\n }\n }\n return items;\n}\n\n/** @visibleForTesting */\nasync function resolveLabel(\n item: CollectionItem,\n contentDir: string,\n): Promise<string> {\n if (typeof item !== \"string\" && \"label\" in item && item.label) {\n return item.label;\n }\n\n if (typeof item === \"string\" || \"slug\" in item) {\n const slug = resolveSlug(item);\n\n const file = await getFileBySlug(slug, contentDir);\n if (!file) {\n throw new PrestigeError(\n `markdown file not found with slug: ${slug} add one in content folder or update config`,\n );\n }\n const data = (await compileFrontmatter(file)) as any;\n if (data?.label) {\n return data?.label;\n }\n\n return basename(slug);\n }\n\n // is a group\n if (typeof item !== \"string\" && (\"items\" in item || \"autogenerate\" in item)) {\n return item.label;\n }\n\n return \"\";\n}\n\n/** @visibleForTesting */\nexport function resolveSlug(item: CollectionItem) {\n if (typeof item === \"string\") {\n return item;\n } else {\n if (\"slug\" in item) {\n return item.slug;\n }\n return \"\";\n }\n}\n\n/** @visibleForTesting */\nexport function resolveLink(item: CollectionItem) {\n if (typeof item === \"object\" && \"link\" in item) {\n return item.link;\n }\n return \"\";\n}\n","import { mkdir, readdir, readFile, unlink, writeFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { SidebarLinkType } from \"../core/content/content.types\";\nimport { Logger } from \"../utils/logger\";\n\nexport async function compileRoutes(\n linksMap: Map<string, SidebarLinkType[]>,\n routesDir: string,\n logger: Logger,\n) {\n const prestigePath = \"(prestige)\";\n const prestigeFullPath = join(routesDir, prestigePath);\n\n try {\n await mkdir(prestigeFullPath, { recursive: true });\n\n const generatedFiles = new Map<string, string>();\n\n for (const [key, links] of linksMap) {\n const onlyInternalLinks = links.filter((l) => \"slug\" in l);\n \n const sidebarPath = key;\n const sidebarFile = sidebarPath + \".lazy.tsx\";\n generatedFiles.set(sidebarFile, createLayoutRoute(key));\n\n for (const l of onlyInternalLinks) {\n const pathified = l.slug.replaceAll(\"/\", \".\");\n generatedFiles.set(pathified + \".tsx\", createContentHeadRoute(l.slug));\n generatedFiles.set(pathified + \".lazy.tsx\", createContentRoute(l.slug));\n }\n }\n\n // Write files only if they have changed or do not exist\n await Promise.all(\n [...generatedFiles.entries()].map(async ([fileName, contents]) => {\n const filePath = join(prestigeFullPath, fileName);\n try {\n const existingContent = await readFile(filePath, \"utf-8\");\n if (existingContent === contents) {\n return; // Skip writing if identical\n }\n } catch (e) {\n // File doesn't exist yet, proceed to write\n }\n logger.info(`Writing route file: ${fileName}`);\n return writeFile(filePath, contents);\n }),\n );\n\n const existingFiles = await readdir(prestigeFullPath);\n const staleLazyFiles = existingFiles.filter(\n (fileName) =>\n fileName.endsWith(\".lazy.tsx\") && !generatedFiles.has(fileName),\n );\n const staleHeadFiles = staleLazyFiles\n .map((fileName) => fileName.replace(\".lazy.tsx\", \".tsx\"))\n .filter(\n (fileName) =>\n existingFiles.includes(fileName) && !generatedFiles.has(fileName),\n );\n const staleFiles = [...new Set([...staleLazyFiles, ...staleHeadFiles])];\n\n await Promise.all(\n staleFiles.map((fileName) => {\n logger.debug(`Removing stale route file: ${fileName}`);\n return unlink(join(prestigeFullPath, fileName));\n }),\n );\n } catch (error) {\n logger.error(\n `[Prestige Router Compiler] Failed to compile routes: ${error}`,\n );\n console.error(\n \"[Prestige Router Compiler] Failed to compile routes:\",\n error,\n );\n }\n}\n\nfunction createLayoutRoute(id: string) {\n return (\n `\nimport { createLazyFileRoute } from '@tanstack/react-router';\nimport sidebar from \"virtual:prestige/sidebar/${id}\";\nimport { CollectionRoute } from \"@lonik/prestige/ui\";\n\nexport const Route = createLazyFileRoute('/(prestige)/${id}')(CollectionRoute(sidebar, \"${id}\"));\n`.trim() + \"\\n\"\n );\n}\n\nfunction createContentHeadRoute(slug: string) {\n return (\n `\nimport { createFileRoute } from \"@tanstack/react-router\";\nimport * as contentData from \"virtual:prestige/content/${slug}\";\nimport { ContentRoute } from \"@lonik/prestige/ui\";\n\nexport const Route = createFileRoute('/(prestige)/${slug}')(ContentRoute(contentData));\n`.trim() + \"\\n\"\n );\n}\n\nfunction createContentRoute(slug: string) {\n return (\n `\nimport { createLazyFileRoute } from \"@tanstack/react-router\";\nimport * as contentData from \"virtual:prestige/content/${slug}\";\nimport { LazyContentRoute } from \"@lonik/prestige/ui\";\n\nexport const Route = createLazyFileRoute('/(prestige)/${slug}')(LazyContentRoute(contentData));\n`.trim() + \"\\n\"\n );\n}\n","import { genDynamicImport } from \"knitwork\";\n\nexport function genExportDefault(specifier: string) {\n return `export default ${specifier};`;\n}\n\n/** exports default undefined */\nexport function genExportUndefined() {\n return genExportDefault(\"undefined\");\n}\n\nexport function genDynamicImportWithDefault(specifier: string) {\n return `${genDynamicImport(specifier)}.then(m => m.default)`;\n}\n","import { genArrayFromRaw, genObjectFromValues } from \"knitwork\";\nimport { genExportDefault } from \"../../utils/code-generation\";\nimport { PrestigeError } from \"../../utils/errors\";\nimport {\n CollectionNavigation,\n Collections,\n SidebarLinkType,\n} from \"./content.types\";\n\nexport const COLLECTION_VIRTUAL_ID = \"virtual:prestige/collection-all\";\n\nexport function resolveCollectionNavigations(\n inlineCollections: Collections,\n linksMap: Map<string, SidebarLinkType[]>,\n) {\n const collections: CollectionNavigation[] = inlineCollections.map((c) => ({\n id: c.id,\n label: c.label ?? c.id,\n defaultLink: c.defaultLink ?? \"\",\n }));\n if (collections.length === 0) {\n throw new PrestigeError(\n `No collections found, add one in prestige plugin config`,\n );\n }\n\n for (const coll of collections) {\n const links = linksMap.get(coll.id);\n const firstInternalLink = links?.find(l => \"slug\" in l);\n if (coll.defaultLink || !firstInternalLink) {\n continue;\n }\n coll.defaultLink = firstInternalLink.slug;\n }\n\n for (const coll of collections) {\n if (!coll.defaultLink) {\n console.warn(\n `No default link found for collection ${coll.id}, it won't be displayed in the header navigation`,\n );\n }\n }\n\n const validCollections = collections.filter((c) => c.defaultLink);\n\n return genExportDefault(\n genArrayFromRaw(validCollections.map((c) => genObjectFromValues(c))),\n );\n}\n","import pc from \"picocolors\";\nexport interface Logger {\n debug: (message: string) => void;\n info: (message: string) => void;\n warn: (message: string) => void;\n error: (message: string) => void;\n}\n\nexport function createLogger(config: {\n disabled: boolean;\n debug: boolean;\n}): Logger {\n function formatLogArgs(message: string) {\n const now = new Date();\n\n // Format: 11:14:22 PM\n const timestamp = now.toLocaleTimeString(\"en-US\", {\n hour12: true,\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n });\n\n // Vite's signature: Gray timestamp + Bold Cyan tag\n const fullMessage = `${pc.dim(timestamp)} ${pc.bold(pc.cyan(\"[prestige]\"))} ${message}`;\n return fullMessage;\n }\n\n return {\n debug: (message: string) => {\n if (!config.disabled && config.debug)\n console.debug(formatLogArgs(pc.gray(message)));\n },\n info: (message: string) => {\n if (!config.disabled) console.info(formatLogArgs(pc.reset(message)));\n },\n warn: (message: string) => {\n if (!config.disabled) console.warn(formatLogArgs(pc.yellow(message)));\n },\n error: (message: string) => {\n if (!config.disabled) console.error(formatLogArgs(pc.red(message)));\n },\n };\n}\n\nexport default createLogger;\n","import chokidar from \"chokidar\";\nimport debounce from \"debounce\";\n\nexport function initContentWatcher(contentDir: string, onUpdate: () => void) {\n const UPDATE_INTERVAL = 1000;\n const scheduleUpdate = debounce(onUpdate, UPDATE_INTERVAL);\n\n const watcher = chokidar\n .watch(contentDir, {\n awaitWriteFinish: true,\n ignoreInitial: true,\n })\n .on(\"all\", (event) => {\n if (event !== \"add\" && event !== \"unlink\") {\n return;\n }\n\n // Coalesce bursts of filesystem events into one update run per interval.\n scheduleUpdate();\n });\n\n return () => {\n scheduleUpdate.clear();\n return watcher.close();\n };\n}\n","import { join } from \"pathe\";\nimport picomatch, { type Matcher } from \"picomatch\";\nimport { EnvironmentModuleNode, type Plugin } from \"vite\";\nimport { resolvePrestigeConfig } from \"./config/config\";\nimport { PrestigeConfig, PrestigeConfigInput } from \"./config/config.types\";\n\nimport { genObjectFromValues } from \"knitwork\";\nimport { resolveContentLinks } from \"./content/content-links\";\nimport {\n resolveSidebars,\n SIDEBAR_VIRTUAL_ID,\n} from \"./content/content-sidebar.store\";\nimport {\n CONTENT_VIRTUAL_ID,\n getSlugByPath,\n resolveContent,\n} from \"./content/content.store\";\nimport { compileRoutes } from \"./content/router-compiler\";\nimport {\n COLLECTION_VIRTUAL_ID,\n resolveCollectionNavigations,\n} from \"./core/content/content-collection.store\";\nimport {\n Collections,\n SidebarLinkType,\n SidebarType,\n} from \"./core/content/content.types\";\nimport { genExportDefault, genExportUndefined } from \"./utils/code-generation\";\nimport { extractVirtualId } from \"./utils/file-utils\";\nimport { createLogger, Logger } from \"./utils/logger\";\nimport { initContentWatcher } from \"./content/content-watcher\";\n\nexport const CONFIG_VIRTUAL_ID = \"virtual:prestige/config\";\n\nexport default function prestige(inlineConfig?: PrestigeConfigInput): Plugin {\n let config: PrestigeConfig;\n let contentDir: string;\n let isDocsMatcher: Matcher;\n let collections: Collections = [];\n let linksMap: Map<string, SidebarLinkType[]>;\n let collectionNavigations: string;\n let sidebarsMap: Map<string, SidebarType>;\n let logger: Logger;\n\n return {\n name: \"vite-plugin-prestige\",\n enforce: \"pre\",\n async configResolved(resolvedConfig) {\n const { config: loadedConfig } = await resolvePrestigeConfig(\n inlineConfig,\n resolvedConfig.root,\n );\n\n config = loadedConfig;\n logger = createLogger({\n disabled: config.disableLog,\n debug: config.enableDebugLog,\n });\n\n contentDir = join(resolvedConfig.root, \"src/content\");\n isDocsMatcher = picomatch(join(contentDir, \"**/*.{md,mdx}\"));\n collections = config.collections ?? [];\n\n logger.debug(\"Resolving sidebars...\");\n sidebarsMap = await resolveSidebars(collections, contentDir, logger);\n\n logger.debug(\"Resolving content links...\");\n linksMap = resolveContentLinks(sidebarsMap);\n\n logger.debug(\"Resolving collection navigations....\");\n collectionNavigations = resolveCollectionNavigations(\n collections,\n linksMap,\n );\n const routesDir = join(resolvedConfig.root, \"src\", \"routes\");\n\n logger.debug(\"Compiling routes...\");\n await compileRoutes(linksMap, routesDir, logger);\n },\n configureServer(server) {\n const contentWatcher = initContentWatcher(contentDir, () => {\n server.restart();\n });\n server.httpServer?.on(\"close\", () => {\n contentWatcher();\n });\n },\n resolveId(id) {\n // even though the import will be import * from \"virtual:prestige/docs/introduction\"\n // it is not guaranteed that some other plugin doesn't modify this import and attach full path\n // we call extractVirtualId to trim the import\n\n if (id.includes(CONFIG_VIRTUAL_ID)) {\n logger.debug(`Resolving config virtual ID: ${id}`);\n return extractVirtualId(id, CONFIG_VIRTUAL_ID);\n }\n\n if (id.includes(CONTENT_VIRTUAL_ID)) {\n logger.debug(`Resolving content virtual ID: ${id}`);\n return extractVirtualId(id, CONTENT_VIRTUAL_ID);\n }\n\n if (id.includes(COLLECTION_VIRTUAL_ID)) {\n logger.debug(`Resolving collection virtual ID: ${id}`);\n return extractVirtualId(id, COLLECTION_VIRTUAL_ID);\n }\n\n if (id.includes(SIDEBAR_VIRTUAL_ID)) {\n logger.debug(`Resolving sidebar virtual ID: ${id}`);\n return extractVirtualId(id, SIDEBAR_VIRTUAL_ID);\n }\n\n return null;\n },\n async load(id) {\n if (id === `\\0${CONFIG_VIRTUAL_ID}`) {\n logger.debug(`Loading config virtual module: ${id}`);\n return genExportDefault(JSON.stringify(config));\n }\n if (id.includes(CONTENT_VIRTUAL_ID)) {\n logger.debug(`Loading content virtual module: ${id}`);\n return await resolveContent(id, linksMap, contentDir);\n }\n if (id.includes(COLLECTION_VIRTUAL_ID)) {\n logger.debug(`Loading collection virtual module: ${id}`);\n return collectionNavigations;\n }\n\n if (id.includes(SIDEBAR_VIRTUAL_ID)) {\n logger.debug(`Loading sidebar virtual module: ${id}`);\n const sidebarId = id.replace(SIDEBAR_VIRTUAL_ID, \"\").replace(\"\\0\", \"\");\n const sidebar = sidebarsMap.get(sidebarId);\n if (!sidebar) {\n return genExportUndefined();\n }\n return genExportDefault(genObjectFromValues(sidebar));\n }\n\n return null;\n },\n\n async hotUpdate({ file, timestamp, type }) {\n if (type !== \"update\" || !isDocsMatcher(file)) {\n return;\n }\n logger.debug(`Invalidating module ${file}...`);\n const invalidatedModules = new Set<EnvironmentModuleNode>();\n const slug = getSlugByPath(file, contentDir);\n const virtualModuleId = `\\0${CONTENT_VIRTUAL_ID}${slug}`;\n const module =\n this.environment.moduleGraph.getModuleById(virtualModuleId);\n if (module) {\n this.environment.moduleGraph.invalidateModule(\n module,\n invalidatedModules,\n timestamp,\n true,\n );\n logger.debug(`Reloading application...`);\n this.environment.hot.send({ type: \"full-reload\" });\n }\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,gBAAb,cAAmC,MAAM;;;;;AAMzC,SAAgB,wBAA2C,GAAM,OAAiB,SAAiB;AACjG,KAAI;AACF,SAAO,EAAE,MAAM,MAAM;UACd,GAAG;AACV,MAAI,aAAa,MACf,OAAM,IAAI,cAAc,yBAAyB,QAAQ,gBAAgB,EAAE,QAAQ,GAAG;MAEtF,OAAM,IAAI,cAAc,yBAAyB,QAAQ,GAAG;;;;;;ACblE,MAAa,+BAA+B,EAAE,OAAO;CACnD,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU;CACvD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,UAAU;CACxD,QAAQ,EAAE,MAA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0",
4
4
  "description": "Static Site Generator for Tanstack Start",
5
5
  "homepage": "https://github.com/lukonik/prestige#readme",
6
6
  "bugs": {