@lonik/prestige 0.7.0 → 0.9.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.
package/dist/vite.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import { t as CollectionItem } from "./content.types-Iwprk4Pj.js";
2
2
  import { z } from "zod";
3
- import { Plugin } from "vite";
4
3
  import { FlexibleTocOptions } from "remark-flexible-toc";
5
4
  import { Options } from "remark-gfm";
5
+ import { Plugin } from "vite";
6
6
  import { PluggableList } from "unified";
7
7
 
8
8
  //#region src/vite/config/config.types.d.ts
9
9
  declare const PrestigeConfigSchema: z.ZodObject<{
10
10
  title: z.ZodString;
11
11
  github: z.ZodOptional<z.ZodString>;
12
+ disableLog: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
13
+ enableDebugLog: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
12
14
  algolia: z.ZodOptional<z.ZodObject<{
13
15
  appId: z.ZodString;
14
16
  apiKey: z.ZodString;
package/dist/vite.js CHANGED
@@ -4,7 +4,6 @@ import { z } from "zod";
4
4
  import { mkdir, readFile, readdir, stat, unlink, writeFile } from "node:fs/promises";
5
5
  import { genArrayFromRaw, genObjectFromValues } from "knitwork";
6
6
  import { basename, join as join$1 } from "node:path";
7
- import { createLogger } from "vite";
8
7
  import { compile } from "@mdx-js/mdx";
9
8
  import rehypePrism from "rehype-prism-plus";
10
9
  import rehypeSlug from "rehype-slug";
@@ -18,6 +17,9 @@ import { visit } from "unist-util-visit";
18
17
  import { pathToFileURL } from "node:url";
19
18
  import { glob } from "tinyglobby";
20
19
  import { read } from "to-vfile";
20
+ import pc from "picocolors";
21
+ import chokidar from "chokidar";
22
+ import debounce from "debounce";
21
23
 
22
24
  //#region src/vite/utils/errors.ts
23
25
  var PrestigeError = class extends Error {};
@@ -77,6 +79,8 @@ const CollectionsSchema = z.array(CollectionSchema);
77
79
  const PrestigeConfigSchema = z.object({
78
80
  title: z.string().describe("Title of the website"),
79
81
  github: z.string().optional().describe("Github repo"),
82
+ disableLog: z.boolean().optional().default(false).describe("Disable logger, default is false"),
83
+ enableDebugLog: z.boolean().optional().default(false).describe("Enable debug log, default is false"),
80
84
  algolia: z.object({
81
85
  appId: z.string().describe("Algolia app id"),
82
86
  apiKey: z.string().describe("Algolia api key"),
@@ -145,11 +149,6 @@ function processItem$1(item, links = []) {
145
149
  return links;
146
150
  }
147
151
 
148
- //#endregion
149
- //#region src/vite/utils/logger.ts
150
- const logger = createLogger(void 0, { prefix: "[Prestige]" });
151
- var logger_default = logger;
152
-
153
152
  //#endregion
154
153
  //#region src/vite/content/content-compiler.ts
155
154
  function remarkAdmonitions() {
@@ -438,18 +437,18 @@ function resolveDefaultLink(items, defaultLink) {
438
437
  if (link) return link;
439
438
  }
440
439
  }
441
- async function resolveSidebars(collections, contentDir) {
440
+ async function resolveSidebars(collections, contentDir, logger) {
442
441
  const store = /* @__PURE__ */ new Map();
443
442
  for (const collection of collections) {
444
- const sidebar = await processCollection(collection, contentDir);
443
+ const sidebar = await processCollection(collection, contentDir, logger);
445
444
  store.set(collection.id, sidebar);
446
445
  }
447
446
  return store;
448
447
  }
449
448
  /** @visibleForTesting */
450
- async function processCollection(collection, contentDir) {
449
+ async function processCollection(collection, contentDir, logger) {
451
450
  const items = [];
452
- for (const item of collection.items) items.push(await processItem(item, contentDir));
451
+ for (const item of collection.items) items.push(await processItem(item, contentDir, logger));
453
452
  const defaultLink = resolveDefaultLink(items, collection.defaultLink);
454
453
  if (!defaultLink) throw new PrestigeError(`No default link found in collection, it means there are no links in the collection. Please define one in ${collection.id}`);
455
454
  return {
@@ -459,19 +458,19 @@ async function processCollection(collection, contentDir) {
459
458
  };
460
459
  }
461
460
  /** @visibleForTesting */
462
- async function processItem(item, contentDir) {
461
+ async function processItem(item, contentDir, logger) {
463
462
  if (typeof item === "string" || "slug" in item) return resolveInternalSidebarLink(item, contentDir);
464
463
  else if ("link" in item) return resolveSidebarLink(item, contentDir);
465
- else return resolveSidebarGroup(item, contentDir);
464
+ else return resolveSidebarGroup(item, contentDir, logger);
466
465
  }
467
466
  /** @visibleForTesting */
468
- async function resolveSidebarGroup(group, contentDir) {
467
+ async function resolveSidebarGroup(group, contentDir, logger) {
469
468
  const label = await resolveLabel(group, contentDir);
470
469
  const items = [];
471
- if (group.items?.length && group.autogenerate) logger_default.warn(`${group.label} has both items and autogenerate. Only items will be used.`);
472
- if (group.items) for (const childItem of group.items) items.push(await processItem(childItem, contentDir));
470
+ if (group.items?.length && group.autogenerate) logger.warn(`${group.label} has both items and autogenerate. Only items will be used.`);
471
+ if (group.items) for (const childItem of group.items) items.push(await processItem(childItem, contentDir, logger));
473
472
  else if (group.autogenerate?.directory) {
474
- const generatedItems = await autogenerateSidebar(group.autogenerate.directory, contentDir);
473
+ const generatedItems = await autogenerateSidebar(group.autogenerate.directory, contentDir, logger);
475
474
  items.push(...generatedItems);
476
475
  }
477
476
  return {
@@ -502,12 +501,12 @@ async function resolveSidebarLink(item, contentDir) {
502
501
  };
503
502
  }
504
503
  /** @visibleForTesting */
505
- async function autogenerateSidebar(directory, contentDir) {
504
+ async function autogenerateSidebar(directory, contentDir, logger) {
506
505
  const fileExtRegex = /\.mdx?$/i;
507
506
  const items = [];
508
507
  const dirPath = join(contentDir, directory);
509
508
  if (!await pathExists(dirPath)) {
510
- logger_default.warn(`Directory doesn't exist: ${directory}`);
509
+ logger.warn(`Directory doesn't exist: ${directory}`);
511
510
  return [];
512
511
  }
513
512
  const dirents = await readdir(dirPath, { withFileTypes: true });
@@ -518,7 +517,7 @@ async function autogenerateSidebar(directory, contentDir) {
518
517
  label: dirent.name,
519
518
  autogenerate: { directory: subDir }
520
519
  };
521
- items.push(await resolveSidebarGroup(group, contentDir));
520
+ items.push(await resolveSidebarGroup(group, contentDir, logger));
522
521
  } else if (dirent.isFile() && fileExtRegex.test(dirent.name)) {
523
522
  const slug = join(directory, dirent.name).replace(fileExtRegex, "");
524
523
  items.push(await resolveInternalSidebarLink(slug, contentDir));
@@ -555,7 +554,7 @@ function resolveLink(item) {
555
554
 
556
555
  //#endregion
557
556
  //#region src/vite/content/router-compiler.ts
558
- async function compileRoutes(linksMap, routesDir) {
557
+ async function compileRoutes(linksMap, routesDir, logger) {
559
558
  const prestigeFullPath = join$1(routesDir, "(prestige)");
560
559
  try {
561
560
  await mkdir(prestigeFullPath, { recursive: true });
@@ -575,7 +574,7 @@ async function compileRoutes(linksMap, routesDir) {
575
574
  try {
576
575
  if (await readFile(filePath, "utf-8") === contents) return;
577
576
  } catch (e) {}
578
- logger_default.info(`Writing route file: ${fileName}`, { timestamp: true });
577
+ logger.info(`Writing route file: ${fileName}`);
579
578
  return writeFile(filePath, contents);
580
579
  }));
581
580
  const existingFiles = await readdir(prestigeFullPath);
@@ -583,11 +582,11 @@ async function compileRoutes(linksMap, routesDir) {
583
582
  const staleHeadFiles = staleLazyFiles.map((fileName) => fileName.replace(".lazy.tsx", ".tsx")).filter((fileName) => existingFiles.includes(fileName) && !generatedFiles.has(fileName));
584
583
  const staleFiles = [...new Set([...staleLazyFiles, ...staleHeadFiles])];
585
584
  await Promise.all(staleFiles.map((fileName) => {
586
- logger_default.info(`Removing stale route file: ${fileName}`, { timestamp: true });
585
+ logger.debug(`Removing stale route file: ${fileName}`);
587
586
  return unlink(join$1(prestigeFullPath, fileName));
588
587
  }));
589
588
  } catch (error) {
590
- logger_default.error(`[Prestige Router Compiler] Failed to compile routes: ${error}`, { timestamp: true });
589
+ logger.error(`[Prestige Router Compiler] Failed to compile routes: ${error}`);
591
590
  console.error("[Prestige Router Compiler] Failed to compile routes:", error);
592
591
  }
593
592
  }
@@ -648,6 +647,51 @@ function resolveCollectionNavigations(inlineCollections, linksMap) {
648
647
  return genExportDefault(genArrayFromRaw(collections.filter((c) => c.defaultLink).map((c) => genObjectFromValues(c))));
649
648
  }
650
649
 
650
+ //#endregion
651
+ //#region src/vite/utils/logger.ts
652
+ function createLogger(config) {
653
+ function formatLogArgs(message) {
654
+ const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", {
655
+ hour12: true,
656
+ hour: "2-digit",
657
+ minute: "2-digit",
658
+ second: "2-digit"
659
+ });
660
+ return `${pc.dim(timestamp)} ${pc.bold(pc.cyan("[prestige]"))} ${message}`;
661
+ }
662
+ return {
663
+ debug: (message) => {
664
+ if (!config.disabled && config.debug) console.debug(formatLogArgs(pc.gray(message)));
665
+ },
666
+ info: (message) => {
667
+ if (!config.disabled) console.info(formatLogArgs(pc.reset(message)));
668
+ },
669
+ warn: (message) => {
670
+ if (!config.disabled) console.warn(formatLogArgs(pc.yellow(message)));
671
+ },
672
+ error: (message) => {
673
+ if (!config.disabled) console.error(formatLogArgs(pc.red(message)));
674
+ }
675
+ };
676
+ }
677
+
678
+ //#endregion
679
+ //#region src/vite/content/content-watcher.ts
680
+ function initContentWatcher(contentDir, onUpdate) {
681
+ const scheduleUpdate = debounce(onUpdate, 1e3);
682
+ const watcher = chokidar.watch(contentDir, {
683
+ awaitWriteFinish: true,
684
+ ignoreInitial: true
685
+ }).on("all", (event) => {
686
+ if (event !== "add" && event !== "unlink") return;
687
+ scheduleUpdate();
688
+ });
689
+ return () => {
690
+ scheduleUpdate.clear();
691
+ return watcher.close();
692
+ };
693
+ }
694
+
651
695
  //#endregion
652
696
  //#region src/vite/plugin.ts
653
697
  const CONFIG_VIRTUAL_ID = "virtual:prestige/config";
@@ -659,60 +703,72 @@ function prestige(inlineConfig) {
659
703
  let linksMap;
660
704
  let collectionNavigations;
661
705
  let sidebarsMap;
706
+ let logger;
662
707
  return {
663
708
  name: "vite-plugin-prestige",
664
709
  enforce: "pre",
665
710
  async configResolved(resolvedConfig) {
666
- logger_default.info("Resolving Prestige configuration...", { timestamp: true });
667
711
  const { config: loadedConfig } = await resolvePrestigeConfig(inlineConfig, resolvedConfig.root);
668
712
  config = loadedConfig;
713
+ logger = createLogger({
714
+ disabled: config.disableLog,
715
+ debug: config.enableDebugLog
716
+ });
669
717
  contentDir = join(resolvedConfig.root, "src/content");
670
718
  isDocsMatcher = picomatch(join(contentDir, "**/*.{md,mdx}"));
671
719
  collections = config.collections ?? [];
672
- logger_default.info("Resolving sidebars...", { timestamp: true });
673
- sidebarsMap = await resolveSidebars(collections, contentDir);
674
- logger_default.info("Resolving content links...", { timestamp: true });
720
+ logger.debug("Resolving sidebars...");
721
+ sidebarsMap = await resolveSidebars(collections, contentDir, logger);
722
+ logger.debug("Resolving content links...");
675
723
  linksMap = resolveContentLinks(sidebarsMap);
676
- logger_default.info("Resolving collection navigations....", { timestamp: true });
724
+ logger.debug("Resolving collection navigations....");
677
725
  collectionNavigations = resolveCollectionNavigations(collections, linksMap);
678
726
  const routesDir = join(resolvedConfig.root, "src", "routes");
679
- logger_default.info("Compiling routes...", { timestamp: true });
680
- await compileRoutes(linksMap, routesDir);
727
+ logger.debug("Compiling routes...");
728
+ await compileRoutes(linksMap, routesDir, logger);
729
+ },
730
+ configureServer(server) {
731
+ const contentWatcher = initContentWatcher(contentDir, () => {
732
+ server.restart();
733
+ });
734
+ server.httpServer?.on("close", () => {
735
+ contentWatcher();
736
+ });
681
737
  },
682
738
  resolveId(id) {
683
739
  if (id.includes(CONFIG_VIRTUAL_ID)) {
684
- logger_default.info(`Resolving config virtual ID: ${id}`, { timestamp: true });
740
+ logger.debug(`Resolving config virtual ID: ${id}`);
685
741
  return extractVirtualId(id, CONFIG_VIRTUAL_ID);
686
742
  }
687
743
  if (id.includes(CONTENT_VIRTUAL_ID)) {
688
- logger_default.info(`Resolving content virtual ID: ${id}`, { timestamp: true });
744
+ logger.debug(`Resolving content virtual ID: ${id}`);
689
745
  return extractVirtualId(id, CONTENT_VIRTUAL_ID);
690
746
  }
691
747
  if (id.includes(COLLECTION_VIRTUAL_ID)) {
692
- logger_default.info(`Resolving collection virtual ID: ${id}`, { timestamp: true });
748
+ logger.debug(`Resolving collection virtual ID: ${id}`);
693
749
  return extractVirtualId(id, COLLECTION_VIRTUAL_ID);
694
750
  }
695
751
  if (id.includes(SIDEBAR_VIRTUAL_ID)) {
696
- logger_default.info(`Resolving sidebar virtual ID: ${id}`, { timestamp: true });
752
+ logger.debug(`Resolving sidebar virtual ID: ${id}`);
697
753
  return extractVirtualId(id, SIDEBAR_VIRTUAL_ID);
698
754
  }
699
755
  return null;
700
756
  },
701
757
  async load(id) {
702
758
  if (id === `\0${CONFIG_VIRTUAL_ID}`) {
703
- logger_default.info(`Loading config virtual module: ${id}`, { timestamp: true });
759
+ logger.debug(`Loading config virtual module: ${id}`);
704
760
  return genExportDefault(JSON.stringify(config));
705
761
  }
706
762
  if (id.includes(CONTENT_VIRTUAL_ID)) {
707
- logger_default.info(`Loading content virtual module: ${id}`, { timestamp: true });
763
+ logger.debug(`Loading content virtual module: ${id}`);
708
764
  return await resolveContent(id, linksMap, contentDir);
709
765
  }
710
766
  if (id.includes(COLLECTION_VIRTUAL_ID)) {
711
- logger_default.info(`Loading collection virtual module: ${id}`, { timestamp: true });
767
+ logger.debug(`Loading collection virtual module: ${id}`);
712
768
  return collectionNavigations;
713
769
  }
714
770
  if (id.includes(SIDEBAR_VIRTUAL_ID)) {
715
- logger_default.info(`Loading sidebar virtual module: ${id}`, { timestamp: true });
771
+ logger.debug(`Loading sidebar virtual module: ${id}`);
716
772
  const sidebarId = id.replace(SIDEBAR_VIRTUAL_ID, "").replace("\0", "");
717
773
  const sidebar = sidebarsMap.get(sidebarId);
718
774
  if (!sidebar) return genExportUndefined();
@@ -720,17 +776,16 @@ function prestige(inlineConfig) {
720
776
  }
721
777
  return null;
722
778
  },
723
- async hotUpdate({ file, timestamp }) {
724
- if (isDocsMatcher(file)) {
725
- logger_default.info(`Invalidating module ${file}...`, { timestamp: true });
726
- const invalidatedModules = /* @__PURE__ */ new Set();
727
- const virtualModuleId = `\0${CONTENT_VIRTUAL_ID}${getSlugByPath(file, contentDir)}`;
728
- const module = this.environment.moduleGraph.getModuleById(virtualModuleId);
729
- if (module) {
730
- this.environment.moduleGraph.invalidateModule(module, invalidatedModules, timestamp, true);
731
- logger_default.info(`Reloading application...`, { timestamp: true });
732
- this.environment.hot.send({ type: "full-reload" });
733
- }
779
+ async hotUpdate({ file, timestamp, type }) {
780
+ if (type !== "update" || !isDocsMatcher(file)) return;
781
+ logger.debug(`Invalidating module ${file}...`);
782
+ const invalidatedModules = /* @__PURE__ */ new Set();
783
+ const virtualModuleId = `\0${CONTENT_VIRTUAL_ID}${getSlugByPath(file, contentDir)}`;
784
+ const module = this.environment.moduleGraph.getModuleById(virtualModuleId);
785
+ if (module) {
786
+ this.environment.moduleGraph.invalidateModule(module, invalidatedModules, timestamp, true);
787
+ logger.debug(`Reloading application...`);
788
+ this.environment.hot.send({ type: "full-reload" });
734
789
  }
735
790
  }
736
791
  };
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>"],"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/utils/logger.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/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 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});\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 github: z.string().optional().describe(\"Github repo\"),\n algolia: z\n .object({\n appId: z.string().describe(\"Algolia app id\"),\n apiKey: z.string().describe(\"Algolia api key\"),\n indices: z.array(z.string()).describe(\"Algolia indices\"),\n })\n .optional()\n .describe(\"Algolia options\"),\n license: z\n .object({\n label: z.string().describe(\"License label\"),\n url: z.string().describe(\"License url\"),\n })\n .optional()\n .describe(\"License options\"),\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 { createLogger } from \"vite\";\nconst logger = createLogger(undefined, { prefix: \"[Prestige]\" });\nexport default logger;\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 logger from \"../utils/logger\";\nimport { compileFrontmatter } from \"./content-compiler\";\nimport { getFileBySlug } from \"./content.store\";\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) {\n const store = new Map<string, SidebarType>();\n\n for (const collection of collections) {\n const sidebar = await processCollection(collection, contentDir);\n store.set(collection.id, sidebar);\n }\n return store;\n}\n\n/** @visibleForTesting */\nasync function processCollection(\n collection: Collection,\n contentDir: string,\n): Promise<SidebarType> {\n const items: SidebarItemType[] = [];\n for (const item of collection.items) {\n items.push(await processItem(item, contentDir));\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): 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);\n }\n}\n\n/** @visibleForTesting */\nasync function resolveSidebarGroup(\n group: CollectionGroup,\n contentDir: string,\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));\n }\n } else if (group.autogenerate?.directory) {\n const generatedItems = await autogenerateSidebar(\n group.autogenerate.directory,\n contentDir,\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): 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));\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) {\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}`, { timestamp: true });\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.info(`Removing stale route file: ${fileName}`, {\n timestamp: true,\n });\n return unlink(join(prestigeFullPath, fileName));\n }),\n );\n } catch (error) {\n logger.error(\n `[Prestige Router Compiler] Failed to compile routes: ${error}`,\n { timestamp: true },\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 { 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 logger from \"./utils/logger\";\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 return {\n name: \"vite-plugin-prestige\",\n enforce: \"pre\",\n async configResolved(resolvedConfig) {\n logger.info(\"Resolving Prestige configuration...\", { timestamp: true });\n const { config: loadedConfig } = await resolvePrestigeConfig(\n inlineConfig,\n resolvedConfig.root,\n );\n config = loadedConfig;\n contentDir = join(resolvedConfig.root, \"src/content\");\n isDocsMatcher = picomatch(join(contentDir, \"**/*.{md,mdx}\"));\n collections = config.collections ?? [];\n\n logger.info(\"Resolving sidebars...\", { timestamp: true });\n sidebarsMap = await resolveSidebars(collections, contentDir);\n\n logger.info(\"Resolving content links...\", { timestamp: true });\n linksMap = resolveContentLinks(sidebarsMap);\n\n logger.info(\"Resolving collection navigations....\", { timestamp: true });\n collectionNavigations = resolveCollectionNavigations(\n collections,\n linksMap,\n );\n\n const routesDir = join(resolvedConfig.root, \"src\", \"routes\");\n\n logger.info(\"Compiling routes...\", { timestamp: true });\n await compileRoutes(linksMap, routesDir);\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.info(`Resolving config virtual ID: ${id}`, { timestamp: true });\n return extractVirtualId(id, CONFIG_VIRTUAL_ID);\n }\n\n if (id.includes(CONTENT_VIRTUAL_ID)) {\n logger.info(`Resolving content virtual ID: ${id}`, { timestamp: true });\n return extractVirtualId(id, CONTENT_VIRTUAL_ID);\n }\n\n if (id.includes(COLLECTION_VIRTUAL_ID)) {\n logger.info(`Resolving collection virtual ID: ${id}`, {\n timestamp: true,\n });\n return extractVirtualId(id, COLLECTION_VIRTUAL_ID);\n }\n\n if (id.includes(SIDEBAR_VIRTUAL_ID)) {\n logger.info(`Resolving sidebar virtual ID: ${id}`, { timestamp: true });\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.info(`Loading config virtual module: ${id}`, {\n timestamp: true,\n });\n return genExportDefault(JSON.stringify(config));\n }\n if (id.includes(CONTENT_VIRTUAL_ID)) {\n logger.info(`Loading content virtual module: ${id}`, {\n timestamp: true,\n });\n return await resolveContent(id, linksMap, contentDir);\n }\n if (id.includes(COLLECTION_VIRTUAL_ID)) {\n logger.info(`Loading collection virtual module: ${id}`, {\n timestamp: true,\n });\n return collectionNavigations;\n }\n\n if (id.includes(SIDEBAR_VIRTUAL_ID)) {\n logger.info(`Loading sidebar virtual module: ${id}`, {\n timestamp: true,\n });\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 }) {\n if (isDocsMatcher(file)) {\n logger.info(`Invalidating module ${file}...`, { timestamp: true });\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.info(`Reloading application...`, { timestamp: true });\n this.environment.hot.send({ type: \"full-reload\" });\n }\n }\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,IAAa,gBAAb,cAAmC,MAAM;;;;;AAMzC,SAAgB,wBAA2C,GAAM,O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AAM,YAAY,GAAG,QAAQ,oBAAoB,GAAG,CAAC,QAAQ,MAAM,GAAG;IACtE,MAAM,UAAU,YAAY,IAAI,UAAU;AAC1C,QAAI,CAAC,QACH,QAAO,oBAAoB;AAE7B,WAAO,iBAAiB,oBAAoB,QAAQ,CAAC;;AAGvD,UAAO;;EAGT,MAAM,UAAU,EAAE,MAAM,aAAa;AACnC,OAAI,cAAc,KAAK,EAAE;AACvB,mBAAO,KAAK,uBAAuB,KAAK,MAAM,EAAE,WAAW,MAAM,CAAC;IAClE,MAAM,qCAAqB,IAAI,KAA4B;IAE3D,MAAM,kBAAkB,KAAK,qBADhB,cAAc,MAAM,WAAW;IAE5C,MAAM,SACJ,KAAK,YAAY,YAAY,cAAc,gBAAgB;AAC7D,QAAI,QAAQ;AACV,UAAK,YAAY,YAAY,iBAC3B,QACA,oBACA,WACA,KACD;AACD,oBAAO,KAAK,4BAA4B,EAAE,WAAW,MAAM,CAAC;AAC5D,UAAK,YAAY,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;;;;EAIzD"}
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 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});\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 github: z.string().optional().describe(\"Github repo\"),\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 algolia: z\n .object({\n appId: z.string().describe(\"Algolia app id\"),\n apiKey: z.string().describe(\"Algolia api key\"),\n indices: z.array(z.string()).describe(\"Algolia indices\"),\n })\n .optional()\n .describe(\"Algolia options\"),\n license: z\n .object({\n label: z.string().describe(\"License label\"),\n url: z.string().describe(\"License url\"),\n })\n .optional()\n .describe(\"License options\"),\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(`Relo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B;AAE7B,WAAO,iBAAiB,oBAAoB,QAAQ,CAAC;;AAGvD,UAAO;;EAGT,MAAM,UAAU,EAAE,MAAM,WAAW,QAAQ;AACzC,OAAI,SAAS,YAAY,CAAC,cAAc,KAAK,CAC3C;AAEF,UAAO,MAAM,uBAAuB,KAAK,KAAK;GAC9C,MAAM,qCAAqB,IAAI,KAA4B;GAE3D,MAAM,kBAAkB,KAAK,qBADhB,cAAc,MAAM,WAAW;GAE5C,MAAM,SACJ,KAAK,YAAY,YAAY,cAAc,gBAAgB;AAC7D,OAAI,QAAQ;AACV,SAAK,YAAY,YAAY,iBAC3B,QACA,oBACA,WACA,KACD;AACD,WAAO,MAAM,2BAA2B;AACxC,SAAK,YAAY,IAAI,KAAK,EAAE,MAAM,eAAe,CAAC;;;EAGvD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lonik/prestige",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "Static Site Generator for Tanstack Start",
5
5
  "homepage": "https://github.com/lukonik/prestige#readme",
6
6
  "bugs": {
@@ -50,12 +50,15 @@
50
50
  "@mdx-js/react": "^3.1.1",
51
51
  "@mdx-js/rollup": "^3.1.1",
52
52
  "@tailwindcss/typography": "^0.5.19",
53
+ "chokidar": "^5.0.0",
53
54
  "clsx": "^2.1.1",
55
+ "debounce": "^3.0.0",
54
56
  "gray-matter": "^4.0.3",
55
57
  "hastscript": "9.0.1",
56
58
  "knitwork": "^1.3.0",
57
59
  "lucide-react": "^0.545.0",
58
60
  "pathe": "^2.0.3",
61
+ "picocolors": "^1.1.1",
59
62
  "picomatch": "^4.0.3",
60
63
  "prism-react-renderer": "^2.4.1",
61
64
  "rehype-prism-plus": "^2.0.2",