zudoku 0.29.1 → 0.30.1

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.
@@ -1,39 +1,18 @@
1
- var d = Object.defineProperty;
2
- var m = (n, t, o) => t in n ? d(n, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[t] = o;
3
- var f = (n, t, o) => m(n, typeof t != "symbol" ? t + "" : t, o);
4
- import { j as P } from "./jsx-runtime-Bdg6XQ1m.js";
5
- import { f as u } from "./__vite-browser-external-BYRIRx8p.js";
6
- const x = "/pages/**/*.{md,mdx}", D = [".md", ".mdx"];
7
- class c {
1
+ var h = Object.defineProperty;
2
+ var g = (e, t, o) => t in e ? h(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var c = (e, t, o) => g(e, typeof t != "symbol" ? t + "" : t, o);
4
+ import { j as d } from "./jsx-runtime-Bdg6XQ1m.js";
5
+ const m = "/pages/**/*.{md,mdx}";
6
+ class w {
8
7
  constructor(t) {
9
- f(this, "fileMap", /* @__PURE__ */ new Map());
8
+ c(this, "fileMap", /* @__PURE__ */ new Map());
10
9
  this.config = t;
11
10
  }
12
11
  /**
13
12
  * Gets the default docs config from the zudoku config
14
13
  */
15
14
  getDocsConfigs() {
16
- return this.config.docs ? Array.isArray(this.config.docs) ? this.config.docs : [this.config.docs] : [{ files: x }];
17
- }
18
- /**
19
- * Resolves the first matching file system path for a given docId
20
- * @param docId - The docId to resolve
21
- * @returns
22
- */
23
- resolveFilePath(t) {
24
- const o = this.getDocsConfigs();
25
- let e;
26
- return o.forEach(({ files: i }) => {
27
- if (e)
28
- return;
29
- const s = c.getRootDir(i);
30
- for (const a of D) {
31
- if (e)
32
- return;
33
- const r = u.join(s, `${t}${a}`);
34
- u.existsSync(r) && (e = r);
35
- }
36
- }), e;
15
+ return this.config.docs ? Array.isArray(this.config.docs) ? this.config.docs : [this.config.docs] : [{ files: m }];
37
16
  }
38
17
  /**
39
18
  * Gets the root directory from a files glob
@@ -53,17 +32,17 @@ class c {
53
32
  filesGlob: t,
54
33
  fsPath: o
55
34
  }) {
56
- const e = this.getRootDir(t), i = new RegExp(`^${e}(.*).mdx?`), s = o.match(i);
35
+ const n = this.getRootDir(t), a = new RegExp(`^${n}(.*).mdx?`), s = o.match(a);
57
36
  return s == null ? void 0 : s.at(1);
58
37
  }
59
38
  }
60
- const C = (n) => ({
39
+ const P = (e) => ({
61
40
  getRoutes: () => {
62
41
  const t = /* @__PURE__ */ new Map();
63
- return n.forEach(
64
- ({ fileImports: o, files: e, defaultOptions: i }) => Object.entries(o).flatMap(([s, a]) => {
65
- const r = c.resolveRoutePath({
66
- filesGlob: e,
42
+ return e.forEach(
43
+ ({ fileImports: o, files: n, defaultOptions: a }) => Object.entries(o).flatMap(([s, i]) => {
44
+ const r = w.resolveRoutePath({
45
+ filesGlob: n,
67
46
  fsPath: s
68
47
  });
69
48
  if (!r) return [];
@@ -71,29 +50,29 @@ const C = (n) => ({
71
50
  return console.warn(
72
51
  `Duplicate route path found for ${r}. Skipping file at '${s}'.`
73
52
  ), [];
74
- const h = {
53
+ const u = {
75
54
  path: r,
76
55
  lazy: async () => {
77
- const { MdxPage: l } = await import("./MdxPage-BalfwlsD.js"), { default: p, ...g } = await a();
56
+ const { MdxPage: p } = await import("./MdxPage-BalfwlsD.js"), { default: f, ...l } = await i();
78
57
  return {
79
- element: /* @__PURE__ */ P.jsx(
80
- l,
58
+ element: /* @__PURE__ */ d.jsx(
59
+ p,
81
60
  {
82
61
  file: s,
83
- mdxComponent: p,
84
- ...g,
85
- defaultOptions: i
62
+ mdxComponent: f,
63
+ ...l,
64
+ defaultOptions: a
86
65
  }
87
66
  )
88
67
  };
89
68
  }
90
69
  };
91
- t.set(r, h);
70
+ t.set(r, u);
92
71
  })
93
72
  ), [...t.values()];
94
73
  }
95
74
  });
96
75
  export {
97
- C as markdownPlugin
76
+ P as markdownPlugin
98
77
  };
99
78
  //# sourceMappingURL=zudoku.plugin-markdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zudoku.plugin-markdown.js","sources":["../src/lib/plugins/markdown/resolver.ts","../src/lib/plugins/markdown/index.tsx"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport { ZudokuDocsConfig } from \"../../../config/validators/common.js\";\nimport { ZudokuConfig } from \"../../../config/validators/validate.js\";\n\nconst DEFAULT_DOCS_FILES = \"/pages/**/*.{md,mdx}\";\n\n// TODO: This should be dynamic based on the glob selector\nconst SUPPORTED_EXTENSIONS = [\".md\", \".mdx\"];\n\n/**\n * Utilities for resolving markdown file paths and routes\n */\nexport class DocResolver {\n constructor(private config: ZudokuConfig) {}\n\n fileMap = new Map<string, string>();\n\n /**\n * Gets the default docs config from the zudoku config\n */\n getDocsConfigs() {\n const docsConfigs: ZudokuDocsConfig[] = this.config.docs\n ? Array.isArray(this.config.docs)\n ? this.config.docs\n : [this.config.docs]\n : [{ files: DEFAULT_DOCS_FILES }];\n\n return docsConfigs;\n }\n\n /**\n * Resolves the first matching file system path for a given docId\n * @param docId - The docId to resolve\n * @returns\n */\n resolveFilePath(docId: string) {\n const docsConfigs = this.getDocsConfigs();\n let fsPath: string | undefined;\n\n docsConfigs.forEach(({ files: fileGlob }) => {\n if (fsPath) {\n return;\n }\n const rootDir = DocResolver.getRootDir(fileGlob);\n for (const ext of SUPPORTED_EXTENSIONS) {\n if (fsPath) {\n return;\n }\n const checkPath = path.join(rootDir, `${docId}${ext}`);\n if (fs.existsSync(checkPath)) {\n fsPath = checkPath;\n }\n }\n });\n\n return fsPath;\n }\n\n /**\n * Gets the root directory from a files glob\n */\n private static getRootDir(filesGlob: string) {\n let rootDir = filesGlob.split(\"**\")[0];\n if (!rootDir) {\n throw new Error(\"Invalid files glob. Must have '**' in the path.\");\n }\n rootDir = rootDir.replace(\"/**\", \"/\");\n return rootDir;\n }\n\n /**\n * Resolves the route path for a given file system path\n * @param options - The options to resolve the route path\n * @returns The string route path\n */\n static resolveRoutePath({\n filesGlob,\n fsPath,\n }: {\n filesGlob: string;\n fsPath: string;\n }) {\n const rootDir = this.getRootDir(filesGlob);\n const re = new RegExp(`^${rootDir}(.*).mdx?`);\n const match = fsPath.match(re);\n const routePath = match?.at(1);\n return routePath;\n }\n}\n","import type { Toc } from \"@stefanprobst/rehype-extract-toc\";\nimport type { MDXProps } from \"mdx/types.js\";\nimport { type JSX } from \"react\";\nimport { RouteObject } from \"react-router\";\nimport { ZudokuDocsConfig } from \"../../../config/validators/common.js\";\nimport type { ZudokuPlugin } from \"../../core/plugins.js\";\nimport { DocResolver } from \"./resolver.js\";\n\nexport interface MarkdownPluginOptions extends ZudokuDocsConfig {\n fileImports: Record<string, () => Promise<MDXImport>>;\n}\nexport type MarkdownPluginDefaultOptions = Pick<\n Frontmatter,\n \"toc\" | \"disablePager\"\n>;\n\nexport type Frontmatter = {\n title?: string;\n description?: string;\n category?: string;\n toc?: boolean;\n disablePager?: boolean;\n};\n\nexport type MDXImport = {\n tableOfContents: Toc;\n frontmatter: Frontmatter;\n excerpt?: string;\n default: (props: MDXProps) => JSX.Element;\n};\n\nexport const markdownPlugin = (\n options: MarkdownPluginOptions[],\n): ZudokuPlugin => ({\n getRoutes: () => {\n const routeMap = new Map<string, RouteObject>();\n options.forEach(({ fileImports, files, defaultOptions }) =>\n Object.entries(fileImports).flatMap(([file, importPromise]) => {\n const routePath = DocResolver.resolveRoutePath({\n filesGlob: files,\n fsPath: file,\n });\n\n if (!routePath) return [];\n\n if (routeMap.has(routePath)) {\n // eslint-disable-next-line no-console\n console.warn(\n `Duplicate route path found for ${routePath}. Skipping file at '${file}'.`,\n );\n return [];\n }\n\n const route: RouteObject = {\n path: routePath,\n lazy: async () => {\n const { MdxPage } = await import(\"./MdxPage.js\");\n const { default: Component, ...props } = await importPromise();\n return {\n element: (\n <MdxPage\n file={file}\n mdxComponent={Component}\n {...props}\n defaultOptions={defaultOptions}\n />\n ),\n };\n },\n };\n routeMap.set(routePath, route);\n }),\n );\n return [...routeMap.values()];\n },\n});\n"],"names":["DEFAULT_DOCS_FILES","SUPPORTED_EXTENSIONS","DocResolver","config","__publicField","docId","docsConfigs","fsPath","fileGlob","rootDir","ext","checkPath","path","fs","filesGlob","re","match","markdownPlugin","options","routeMap","fileImports","files","defaultOptions","file","importPromise","routePath","route","MdxPage","Component","props","jsx"],"mappings":";;;;;AAKA,MAAMA,IAAqB,wBAGrBC,IAAuB,CAAC,OAAO,MAAM;AAKpC,MAAMC,EAAY;AAAA,EACvB,YAAoBC,GAAsB;AAE1C,IAAAC,EAAA,qCAAc,IAAoB;AAFd,SAAA,SAAAD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAOpB,iBAAiB;AAOR,WANiC,KAAK,OAAO,OAChD,MAAM,QAAQ,KAAK,OAAO,IAAI,IAC5B,KAAK,OAAO,OACZ,CAAC,KAAK,OAAO,IAAI,IACnB,CAAC,EAAE,OAAOH,GAAoB;AAAA,EAE3B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQT,gBAAgBK,GAAe;AACvB,UAAAC,IAAc,KAAK,eAAe;AACpC,QAAAC;AAEJ,WAAAD,EAAY,QAAQ,CAAC,EAAE,OAAOE,QAAe;AAC3C,UAAID;AACF;AAEI,YAAAE,IAAUP,EAAY,WAAWM,CAAQ;AAC/C,iBAAWE,KAAOT,GAAsB;AACtC,YAAIM;AACF;AAEI,cAAAI,IAAYC,EAAK,KAAKH,GAAS,GAAGJ,CAAK,GAAGK,CAAG,EAAE;AACjD,QAAAG,EAAG,WAAWF,CAAS,MAChBJ,IAAAI;AAAA,MACX;AAAA,IACF,CACD,GAEMJ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAMT,OAAe,WAAWO,GAAmB;AAC3C,QAAIL,IAAUK,EAAU,MAAM,IAAI,EAAE,CAAC;AACrC,QAAI,CAACL;AACG,YAAA,IAAI,MAAM,iDAAiD;AAEzD,WAAAA,IAAAA,EAAQ,QAAQ,OAAO,GAAG,GAC7BA;AAAA,E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CAAC,GAAGP,EAAS,QAAQ;AAAA,EAAA;AAEhC;"}
1
+ {"version":3,"file":"zudoku.plugin-markdown.js","sources":["../src/lib/plugins/markdown/resolver.ts","../src/lib/plugins/markdown/index.tsx"],"sourcesContent":["import { ZudokuDocsConfig } from \"../../../config/validators/common.js\";\nimport { ZudokuConfig } from \"../../../config/validators/validate.js\";\n\nconst DEFAULT_DOCS_FILES = \"/pages/**/*.{md,mdx}\";\n\n/**\n * Utilities for resolving markdown file paths and routes\n */\nexport class DocResolver {\n constructor(private config: ZudokuConfig) {}\n\n fileMap = new Map<string, string>();\n\n /**\n * Gets the default docs config from the zudoku config\n */\n getDocsConfigs() {\n const docsConfigs: ZudokuDocsConfig[] = this.config.docs\n ? Array.isArray(this.config.docs)\n ? this.config.docs\n : [this.config.docs]\n : [{ files: DEFAULT_DOCS_FILES }];\n\n return docsConfigs;\n }\n\n /**\n * Gets the root directory from a files glob\n */\n private static getRootDir(filesGlob: string) {\n let rootDir = filesGlob.split(\"**\")[0];\n if (!rootDir) {\n throw new Error(\"Invalid files glob. Must have '**' in the path.\");\n }\n rootDir = rootDir.replace(\"/**\", \"/\");\n return rootDir;\n }\n\n /**\n * Resolves the route path for a given file system path\n * @param options - The options to resolve the route path\n * @returns The string route path\n */\n static resolveRoutePath({\n filesGlob,\n fsPath,\n }: {\n filesGlob: string;\n fsPath: string;\n }) {\n const rootDir = this.getRootDir(filesGlob);\n const re = new RegExp(`^${rootDir}(.*).mdx?`);\n const match = fsPath.match(re);\n const routePath = match?.at(1);\n return routePath;\n }\n}\n","import type { Toc } from \"@stefanprobst/rehype-extract-toc\";\nimport type { MDXProps } from \"mdx/types.js\";\nimport { type JSX } from \"react\";\nimport { RouteObject } from \"react-router\";\nimport { ZudokuDocsConfig } from \"../../../config/validators/common.js\";\nimport type { ZudokuPlugin } from \"../../core/plugins.js\";\nimport { DocResolver } from \"./resolver.js\";\n\nexport interface MarkdownPluginOptions extends ZudokuDocsConfig {\n fileImports: Record<string, () => Promise<MDXImport>>;\n}\nexport type MarkdownPluginDefaultOptions = Pick<\n Frontmatter,\n \"toc\" | \"disablePager\"\n>;\n\nexport type Frontmatter = {\n title?: string;\n description?: string;\n category?: string;\n toc?: boolean;\n disablePager?: boolean;\n};\n\nexport type MDXImport = {\n tableOfContents: Toc;\n frontmatter: Frontmatter;\n excerpt?: string;\n default: (props: MDXProps) => JSX.Element;\n};\n\nexport const markdownPlugin = (\n options: MarkdownPluginOptions[],\n): ZudokuPlugin => ({\n getRoutes: () => {\n const routeMap = new Map<string, RouteObject>();\n options.forEach(({ fileImports, files, defaultOptions }) =>\n Object.entries(fileImports).flatMap(([file, importPromise]) => {\n const routePath = DocResolver.resolveRoutePath({\n filesGlob: files,\n fsPath: file,\n });\n\n if (!routePath) return [];\n\n if (routeMap.has(routePath)) {\n // eslint-disable-next-line no-console\n console.warn(\n `Duplicate route path found for ${routePath}. Skipping file at '${file}'.`,\n );\n return [];\n }\n\n const route: RouteObject = {\n path: routePath,\n lazy: async () => {\n const { MdxPage } = await import(\"./MdxPage.js\");\n const { default: Component, ...props } = await importPromise();\n return {\n element: (\n <MdxPage\n file={file}\n mdxComponent={Component}\n {...props}\n defaultOptions={defaultOptions}\n />\n ),\n };\n },\n };\n routeMap.set(routePath, route);\n }),\n );\n return [...routeMap.values()];\n },\n});\n"],"names":["DEFAULT_DOCS_FILES","DocResolver","config","__publicField","filesGlob","rootDir","fsPath","re","match","markdownPlugin","options","routeMap","fileImports","files","defaultOptions","file","importPromise","routePath","route","MdxPage","Component","props","jsx"],"mappings":";;;;AAGA,MAAMA,IAAqB;AAKpB,MAAMC,EAAY;AAAA,EACvB,YAAoBC,GAAsB;AAE1C,IAAAC,EAAA,qCAAc,IAAoB;AAFd,SAAA,SAAAD;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,EAOpB,iBAAiB;AAOR,WANiC,KAAK,OAAO,OAChD,MAAM,QAAQ,KAAK,OAAO,IAAI,IAC5B,KAAK,OAAO,OACZ,CAAC,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A;AAAA,cACL,SACEM,gBAAAA,EAAA;AAAA,gBAACH;AAAA,gBAAA;AAAA,kBACC,MAAAJ;AAAA,kBACA,cAAcK;AAAA,kBACb,GAAGC;AAAA,kBACJ,gBAAAP;AAAA,gBAAA;AAAA,cAAA;AAAA,YAGN;AAAA,UAAA;AAAA,QAEJ;AACS,QAAAH,EAAA,IAAIM,GAAWC,CAAK;AAAA,MAC9B,CAAA;AAAA,IACH,GACO,CAAC,GAAGP,EAAS,QAAQ;AAAA,EAAA;AAEhC;"}
@@ -5,7 +5,7 @@ import "./chunk-SYFQ2XB5-QijJrSf0.js";
5
5
  import "./hook-NIpDSpau.js";
6
6
  import "./ui/Button.js";
7
7
  import "./joinUrl-nLx9pD-Z.js";
8
- import { o as f } from "./index-P0YUtHIb.js";
8
+ import { o as f } from "./index-CnKeVT2S.js";
9
9
  export {
10
10
  f as openApiPlugin
11
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.29.1",
3
+ "version": "0.30.1",
4
4
  "type": "module",
5
5
  "homepage": "https://zudoku.dev",
6
6
  "repository": {
@@ -240,7 +240,7 @@
240
240
  "react-dom": "19.0.0",
241
241
  "rollup-plugin-visualizer": "5.14.0",
242
242
  "typescript": "5.7.3",
243
- "vitest": "3.0.2"
243
+ "vitest": "3.0.5"
244
244
  },
245
245
  "peerDependencies": {
246
246
  "react": ">=19",
@@ -1,13 +1,8 @@
1
- import fs from "fs";
2
- import path from "path";
3
1
  import { ZudokuDocsConfig } from "../../../config/validators/common.js";
4
2
  import { ZudokuConfig } from "../../../config/validators/validate.js";
5
3
 
6
4
  const DEFAULT_DOCS_FILES = "/pages/**/*.{md,mdx}";
7
5
 
8
- // TODO: This should be dynamic based on the glob selector
9
- const SUPPORTED_EXTENSIONS = [".md", ".mdx"];
10
-
11
6
  /**
12
7
  * Utilities for resolving markdown file paths and routes
13
8
  */
@@ -29,34 +24,6 @@ export class DocResolver {
29
24
  return docsConfigs;
30
25
  }
31
26
 
32
- /**
33
- * Resolves the first matching file system path for a given docId
34
- * @param docId - The docId to resolve
35
- * @returns
36
- */
37
- resolveFilePath(docId: string) {
38
- const docsConfigs = this.getDocsConfigs();
39
- let fsPath: string | undefined;
40
-
41
- docsConfigs.forEach(({ files: fileGlob }) => {
42
- if (fsPath) {
43
- return;
44
- }
45
- const rootDir = DocResolver.getRootDir(fileGlob);
46
- for (const ext of SUPPORTED_EXTENSIONS) {
47
- if (fsPath) {
48
- return;
49
- }
50
- const checkPath = path.join(rootDir, `${docId}${ext}`);
51
- if (fs.existsSync(checkPath)) {
52
- fsPath = checkPath;
53
- }
54
- }
55
- });
56
-
57
- return fsPath;
58
- }
59
-
60
27
  /**
61
28
  * Gets the root directory from a files glob
62
29
  */
@@ -226,7 +226,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
226
226
  }
227
227
  },
228
228
  getRoutes: () => {
229
- const versionsInPath = [null, ...versions];
229
+ const versionsInPath = versions.length > 1 ? [null, ...versions] : [null];
230
230
 
231
231
  const tagPages = (config.tagPages ?? []).map((tag) => ({
232
232
  tag,
@@ -234,7 +234,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
234
234
  }));
235
235
 
236
236
  return versionsInPath.map((version) => {
237
- const versionPath = joinUrl(basePath, version ? `/${version}` : "");
237
+ const versionPath = joinUrl(basePath, version);
238
238
 
239
239
  return {
240
240
  path: versionPath,