@vendure-io/docs-provider 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/browser.cjs +1 -1
  2. package/dist/browser.js +1 -1
  3. package/dist/{frontmatter-8Bwpoi8r.js → frontmatter-C0Wmtdep.js} +1 -1
  4. package/dist/{frontmatter-_wRoVeyd.cjs → frontmatter-CJYZSUYM.cjs} +1 -1
  5. package/dist/index.cjs +1 -1
  6. package/dist/index.js +3 -3
  7. package/dist/loader.cjs +1 -1
  8. package/dist/loader.js +2 -2
  9. package/dist/{manifest-D8kEDc9X.cjs → manifest-D-EWZlSh.cjs} +1 -1
  10. package/dist/{manifest-B_cvT6F9.js → manifest-ZCrzbFSf.js} +10 -9
  11. package/dist/manifest.d.ts.map +1 -1
  12. package/dist/remark-plugins/index.d.ts +11 -0
  13. package/dist/remark-plugins/index.d.ts.map +1 -0
  14. package/dist/remark-plugins/remark-admonitions.d.ts +18 -0
  15. package/dist/remark-plugins/remark-admonitions.d.ts.map +1 -0
  16. package/dist/remark-plugins/remark-code-meta.d.ts +15 -0
  17. package/dist/remark-plugins/remark-code-meta.d.ts.map +1 -0
  18. package/dist/remark-plugins/remark-strip-html-comments.d.ts +8 -0
  19. package/dist/remark-plugins/remark-strip-html-comments.d.ts.map +1 -0
  20. package/dist/remark-plugins/remark-strip-imports.d.ts +8 -0
  21. package/dist/remark-plugins/remark-strip-imports.d.ts.map +1 -0
  22. package/dist/testing/index.d.ts +32 -0
  23. package/dist/testing/index.d.ts.map +1 -0
  24. package/dist/testing/mdx-compiler.d.ts +49 -0
  25. package/dist/testing/mdx-compiler.d.ts.map +1 -0
  26. package/dist/testing/test-manifest.d.ts +33 -0
  27. package/dist/testing/test-manifest.d.ts.map +1 -0
  28. package/dist/testing/types.d.ts +76 -0
  29. package/dist/testing/types.d.ts.map +1 -0
  30. package/dist/testing.cjs +4 -0
  31. package/dist/testing.js +201 -0
  32. package/dist/types.d.ts +2 -0
  33. package/dist/types.d.ts.map +1 -1
  34. package/docs/getting-started.md +1 -0
  35. package/docs/mdx-components-reference.md +4 -4
  36. package/docs/mdx-testing.md +423 -0
  37. package/docs/publishing.md +1 -0
  38. package/package.json +20 -1
package/dist/browser.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./manifest-D8kEDc9X.cjs"),a=require("./slug-utils-DUQgikEz.cjs");exports.BreadcrumbItemSchema=e.BreadcrumbItemSchema;exports.DocPageMetaSchema=e.DocPageMetaSchema;exports.DocPageSchema=e.DocPageSchema;exports.DocsPackageManifestInputSchema=e.DocsPackageManifestInputSchema;exports.DocsPackageManifestSchema=e.DocsPackageManifestSchema;exports.FlatNavigationNodeSchema=e.FlatNavigationNodeSchema;exports.GitHubConfigSchema=e.GitHubConfigSchema;exports.LoadedDocsPackageSchema=e.LoadedDocsPackageSchema;exports.ManifestValidationError=e.ManifestValidationError;exports.NavigationNodeInputSchema=e.NavigationNodeInputSchema;exports.NavigationNodeSchema=e.NavigationNodeSchema;exports.SearchConfigSchema=e.SearchConfigSchema;exports.VendureVersionSchema=e.VendureVersionSchema;exports.buildBreadcrumbs=e.buildBreadcrumbs;exports.findNavigationNode=e.findNavigationNode;exports.flattenNavigation=e.flattenNavigation;exports.getLeafNodes=e.getLeafNodes;exports.getNodesAtDepth=e.getNodesAtDepth;exports.getPrevNextNodes=e.getPrevNextNodes;exports.isNodeActive=e.isNodeActive;exports.validateManifest=e.validateManifest;exports.filterVisibleNavigation=a.filterVisibleNavigation;exports.getAllFilePaths=a.getAllFilePaths;exports.slugFromFilename=a.slugFromFilename;exports.titleFromFilename=a.titleFromFilename;exports.toSlug=a.toSlug;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./manifest-D-EWZlSh.cjs"),a=require("./slug-utils-DUQgikEz.cjs");exports.BreadcrumbItemSchema=e.BreadcrumbItemSchema;exports.DocPageMetaSchema=e.DocPageMetaSchema;exports.DocPageSchema=e.DocPageSchema;exports.DocsPackageManifestInputSchema=e.DocsPackageManifestInputSchema;exports.DocsPackageManifestSchema=e.DocsPackageManifestSchema;exports.FlatNavigationNodeSchema=e.FlatNavigationNodeSchema;exports.GitHubConfigSchema=e.GitHubConfigSchema;exports.LoadedDocsPackageSchema=e.LoadedDocsPackageSchema;exports.ManifestValidationError=e.ManifestValidationError;exports.NavigationNodeInputSchema=e.NavigationNodeInputSchema;exports.NavigationNodeSchema=e.NavigationNodeSchema;exports.SearchConfigSchema=e.SearchConfigSchema;exports.VendureVersionSchema=e.VendureVersionSchema;exports.buildBreadcrumbs=e.buildBreadcrumbs;exports.findNavigationNode=e.findNavigationNode;exports.flattenNavigation=e.flattenNavigation;exports.getLeafNodes=e.getLeafNodes;exports.getNodesAtDepth=e.getNodesAtDepth;exports.getPrevNextNodes=e.getPrevNextNodes;exports.isNodeActive=e.isNodeActive;exports.validateManifest=e.validateManifest;exports.filterVisibleNavigation=a.filterVisibleNavigation;exports.getAllFilePaths=a.getAllFilePaths;exports.slugFromFilename=a.slugFromFilename;exports.titleFromFilename=a.titleFromFilename;exports.toSlug=a.toSlug;
package/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- import { B as s, D as t, a as i, b as o, c, F as g, G as m, L as n, M as d, N as r, d as h, S as N, V as l, e as S, f, g as v, h as u, i as D, j as F, k as P, v as b } from "./manifest-B_cvT6F9.js";
1
+ import { B as s, D as t, a as i, b as o, c, F as g, G as m, L as n, M as d, N as r, d as h, S as N, V as l, e as S, f, g as v, h as u, i as D, j as F, k as P, v as b } from "./manifest-ZCrzbFSf.js";
2
2
  import { f as p, g as V, s as k, t as x, a as A } from "./slug-utils-DVKYe9h8.js";
3
3
  export {
4
4
  s as BreadcrumbItemSchema,
@@ -2,7 +2,7 @@ var c = Object.defineProperty;
2
2
  var m = (a, t, r) => t in a ? c(a, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : a[t] = r;
3
3
  var o = (a, t, r) => m(a, typeof t != "symbol" ? t + "" : t, r);
4
4
  import i from "gray-matter";
5
- import { D as u } from "./manifest-B_cvT6F9.js";
5
+ import { D as u } from "./manifest-ZCrzbFSf.js";
6
6
  class s extends Error {
7
7
  constructor(r, e, n) {
8
8
  super(r);
@@ -1,3 +1,3 @@
1
- "use strict";var m=Object.defineProperty;var u=(a,t,r)=>t in a?m(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r;var s=(a,t,r)=>u(a,typeof t!="symbol"?t+"":t,r);const i=require("gray-matter"),d=require("./manifest-D8kEDc9X.cjs");class o extends Error{constructor(r,e,n){super(r);s(this,"filePath");s(this,"originalError");this.name="FrontmatterParseError",this.filePath=e,this.originalError=n}}function F(a,t){try{const{data:r,content:e}=i(a);return{meta:c(r,t),content:e.trim()}}catch(r){throw r instanceof o?r:new o(`Failed to parse frontmatter${t?` in ${t}`:""}`,t,r)}}function c(a,t){const r=d.DocPageMetaSchema.safeParse(a);if(!r.success){const e=r.error.issues.map(n=>` - ${n.path.join(".")}: ${n.message}`).join(`
1
+ "use strict";var m=Object.defineProperty;var u=(a,t,r)=>t in a?m(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r;var s=(a,t,r)=>u(a,typeof t!="symbol"?t+"":t,r);const i=require("gray-matter"),d=require("./manifest-D-EWZlSh.cjs");class o extends Error{constructor(r,e,n){super(r);s(this,"filePath");s(this,"originalError");this.name="FrontmatterParseError",this.filePath=e,this.originalError=n}}function F(a,t){try{const{data:r,content:e}=i(a);return{meta:c(r,t),content:e.trim()}}catch(r){throw r instanceof o?r:new o(`Failed to parse frontmatter${t?` in ${t}`:""}`,t,r)}}function c(a,t){const r=d.DocPageMetaSchema.safeParse(a);if(!r.success){const e=r.error.issues.map(n=>` - ${n.path.join(".")}: ${n.message}`).join(`
2
2
  `);throw new o(`Invalid frontmatter${t?` in ${t}`:""}:
3
3
  ${e}`,t,r.error)}return r.data}function h(a){return a.trimStart().startsWith("---")}function f(a){const{data:t}=i(a);return t}exports.FrontmatterParseError=o;exports.extractFrontmatterData=f;exports.hasFrontmatter=h;exports.parseFrontmatter=F;exports.validateFrontmatter=c;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var L=Object.defineProperty;var R=(e,t,r)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var S=(e,t,r)=>R(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./manifest-D8kEDc9X.cjs"),g=require("./frontmatter-_wRoVeyd.cjs"),l=require("./slug-utils-DUQgikEz.cjs"),N=require("fs"),y=require("path"),I=(e,t)=>e.order!==t.order?e.order-t.order:e.title.localeCompare(t.title);function j(e,t={}){const{extensions:r=[".mdx",".md"],filter:i,sort:o=I}=t,n=C(e,r);return(i?n.filter(i):n).sort(o).map(m=>({title:m.title,slug:m.slug,file:m.path}))}function q(e,t={}){return V(e,t,0)}function V(e,t,r){const{extensions:i=[".mdx",".md"],filter:o,sort:n=I,maxDepth:c=1/0,folderFilter:u}=t,m=N.readdirSync(e,{withFileTypes:!0}),h=[],$=C(e,i),D=(o?$.filter(o):$).sort(n);for(const f of D)h.push({title:f.title,slug:f.slug,file:f.path});if(r<c){const f=m.filter(d=>d.isDirectory());for(const d of f){if(u){const s=y.join(e,d.name);if(!u(d.name,s))continue}const F=y.join(e,d.name),v=V(F,t,r+1);if(v.length>0){const s=B(F,i);h.push({title:(s==null?void 0:s.title)||l.titleFromFilename(d.name),slug:l.slugFromFilename(d.name),file:s==null?void 0:s.path,children:v.filter(P=>!(s&&P.file===s.path))})}}}return h.sort((f,d)=>{var E,w;const F=D.find(M=>M.slug===f.slug),v=D.find(M=>M.slug===d.slug);if(F&&v)return n(F,v);const s=!!f.file&&!((E=f.children)!=null&&E.length),P=!!d.file&&!((w=d.children)!=null&&w.length);return s!==P?s?-1:1:(f.title||"").localeCompare(d.title||"")})}function C(e,t){try{const r=N.readdirSync(e,{withFileTypes:!0}),i=[];for(const o of r){if(!o.isFile())continue;const n=t.find(h=>o.name.toLowerCase().endsWith(h));if(!n||o.name.slice(0,-n.length).toLowerCase()==="index")continue;const u=y.join(e,o.name),m=k(u,o.name,n);i.push(m)}return i}catch{return[]}}function k(e,t,r){let i={},o=l.titleFromFilename(t),n=1/0;try{const c=N.readFileSync(e,"utf-8");i=g.extractFrontmatterData(c),i.title&&typeof i.title=="string"&&(o=i.title),typeof i.order=="number"&&(n=i.order)}catch{}return{path:e,filename:t,extension:r,frontmatter:i,order:n,title:o,slug:l.slugFromFilename(t)}}function B(e,t){for(const r of t){const i=y.join(e,`index${r}`);try{if(N.statSync(i).isFile())return k(i,`index${r}`,r)}catch{}}}class b extends Error{constructor(r,i,o,n){super(r);S(this,"nodePath");S(this,"filePath");S(this,"originalError");this.name="ManifestResolutionError",this.nodePath=i,this.filePath=o,this.originalError=n}}function T(e,t={}){const{strict:r=!0}=t,i=x(e.navigation,"",r);return{id:e.id,name:e.name,version:e.version,vendureVersion:e.vendureVersion,navigation:i,search:e.search,github:e.github,basePath:e.basePath}}function x(e,t,r){return e.map((i,o)=>U(i,t,o,r))}function U(e,t,r,i){const o=t?`${t}[${r}]`:`navigation[${r}]`;if(e.title&&e.slug)return{title:e.title,slug:e.slug,file:e.file,children:e.children?x(e.children,`${o}.children`,i):void 0,badge:e.badge,hidden:e.hidden};let n=e.title,c=e.slug;if(e.file&&(c||(c=l.slugFromFilename(e.file)),n||(n=W(e.file,o,i))),!n){if(i)throw new b(`Navigation node at ${o} is missing title and has no file to derive it from`,o,e.file);n=c||`Unknown (${r})`}if(!c){if(i)throw new b(`Navigation node at ${o} is missing slug and has no file to derive it from`,o,e.file);c=n?l.slugFromFilename(n):`node-${r}`}return{title:n,slug:c,file:e.file,children:e.children?x(e.children,`${o}.children`,i):void 0,badge:e.badge,hidden:e.hidden}}function W(e,t,r){try{const i=N.readFileSync(e,"utf-8"),o=g.extractFrontmatterData(i);return o.title&&typeof o.title=="string"?o.title:l.titleFromFilename(e)}catch(i){if(r)throw new b(`Failed to read file for title derivation at ${t}: ${e}`,t,e,i);return l.titleFromFilename(e)}}function G(e){return A(e.navigation)}function A(e){for(const t of e)if(!t.title||!t.slug||t.children&&A(t.children))return!0;return!1}exports.BreadcrumbItemSchema=a.BreadcrumbItemSchema;exports.DocPageMetaSchema=a.DocPageMetaSchema;exports.DocPageSchema=a.DocPageSchema;exports.DocsPackageManifestInputSchema=a.DocsPackageManifestInputSchema;exports.DocsPackageManifestSchema=a.DocsPackageManifestSchema;exports.FlatNavigationNodeSchema=a.FlatNavigationNodeSchema;exports.GitHubConfigSchema=a.GitHubConfigSchema;exports.LoadedDocsPackageSchema=a.LoadedDocsPackageSchema;exports.ManifestValidationError=a.ManifestValidationError;exports.NavigationNodeInputSchema=a.NavigationNodeInputSchema;exports.NavigationNodeSchema=a.NavigationNodeSchema;exports.SearchConfigSchema=a.SearchConfigSchema;exports.VendureVersionSchema=a.VendureVersionSchema;exports.buildBreadcrumbs=a.buildBreadcrumbs;exports.findNavigationNode=a.findNavigationNode;exports.flattenNavigation=a.flattenNavigation;exports.getLeafNodes=a.getLeafNodes;exports.getNodesAtDepth=a.getNodesAtDepth;exports.getPrevNextNodes=a.getPrevNextNodes;exports.isNodeActive=a.isNodeActive;exports.validateManifest=a.validateManifest;exports.FrontmatterParseError=g.FrontmatterParseError;exports.extractFrontmatterData=g.extractFrontmatterData;exports.hasFrontmatter=g.hasFrontmatter;exports.parseFrontmatter=g.parseFrontmatter;exports.validateFrontmatter=g.validateFrontmatter;exports.filterVisibleNavigation=l.filterVisibleNavigation;exports.getAllFilePaths=l.getAllFilePaths;exports.slugFromFilename=l.slugFromFilename;exports.titleFromFilename=l.titleFromFilename;exports.toSlug=l.toSlug;exports.ManifestResolutionError=b;exports.createNavigationFromFolder=j;exports.createNestedNavigationFromFolder=q;exports.manifestNeedsResolution=G;exports.resolveManifest=T;
1
+ "use strict";var L=Object.defineProperty;var R=(e,t,r)=>t in e?L(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var S=(e,t,r)=>R(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./manifest-D-EWZlSh.cjs"),g=require("./frontmatter-CJYZSUYM.cjs"),l=require("./slug-utils-DUQgikEz.cjs"),N=require("fs"),y=require("path"),I=(e,t)=>e.order!==t.order?e.order-t.order:e.title.localeCompare(t.title);function j(e,t={}){const{extensions:r=[".mdx",".md"],filter:i,sort:o=I}=t,n=C(e,r);return(i?n.filter(i):n).sort(o).map(m=>({title:m.title,slug:m.slug,file:m.path}))}function q(e,t={}){return V(e,t,0)}function V(e,t,r){const{extensions:i=[".mdx",".md"],filter:o,sort:n=I,maxDepth:c=1/0,folderFilter:u}=t,m=N.readdirSync(e,{withFileTypes:!0}),h=[],$=C(e,i),D=(o?$.filter(o):$).sort(n);for(const f of D)h.push({title:f.title,slug:f.slug,file:f.path});if(r<c){const f=m.filter(d=>d.isDirectory());for(const d of f){if(u){const s=y.join(e,d.name);if(!u(d.name,s))continue}const F=y.join(e,d.name),v=V(F,t,r+1);if(v.length>0){const s=B(F,i);h.push({title:(s==null?void 0:s.title)||l.titleFromFilename(d.name),slug:l.slugFromFilename(d.name),file:s==null?void 0:s.path,children:v.filter(P=>!(s&&P.file===s.path))})}}}return h.sort((f,d)=>{var E,w;const F=D.find(M=>M.slug===f.slug),v=D.find(M=>M.slug===d.slug);if(F&&v)return n(F,v);const s=!!f.file&&!((E=f.children)!=null&&E.length),P=!!d.file&&!((w=d.children)!=null&&w.length);return s!==P?s?-1:1:(f.title||"").localeCompare(d.title||"")})}function C(e,t){try{const r=N.readdirSync(e,{withFileTypes:!0}),i=[];for(const o of r){if(!o.isFile())continue;const n=t.find(h=>o.name.toLowerCase().endsWith(h));if(!n||o.name.slice(0,-n.length).toLowerCase()==="index")continue;const u=y.join(e,o.name),m=k(u,o.name,n);i.push(m)}return i}catch{return[]}}function k(e,t,r){let i={},o=l.titleFromFilename(t),n=1/0;try{const c=N.readFileSync(e,"utf-8");i=g.extractFrontmatterData(c),i.title&&typeof i.title=="string"&&(o=i.title),typeof i.order=="number"&&(n=i.order)}catch{}return{path:e,filename:t,extension:r,frontmatter:i,order:n,title:o,slug:l.slugFromFilename(t)}}function B(e,t){for(const r of t){const i=y.join(e,`index${r}`);try{if(N.statSync(i).isFile())return k(i,`index${r}`,r)}catch{}}}class b extends Error{constructor(r,i,o,n){super(r);S(this,"nodePath");S(this,"filePath");S(this,"originalError");this.name="ManifestResolutionError",this.nodePath=i,this.filePath=o,this.originalError=n}}function T(e,t={}){const{strict:r=!0}=t,i=x(e.navigation,"",r);return{id:e.id,name:e.name,version:e.version,vendureVersion:e.vendureVersion,navigation:i,search:e.search,github:e.github,basePath:e.basePath}}function x(e,t,r){return e.map((i,o)=>U(i,t,o,r))}function U(e,t,r,i){const o=t?`${t}[${r}]`:`navigation[${r}]`;if(e.title&&e.slug)return{title:e.title,slug:e.slug,file:e.file,children:e.children?x(e.children,`${o}.children`,i):void 0,badge:e.badge,hidden:e.hidden};let n=e.title,c=e.slug;if(e.file&&(c||(c=l.slugFromFilename(e.file)),n||(n=W(e.file,o,i))),!n){if(i)throw new b(`Navigation node at ${o} is missing title and has no file to derive it from`,o,e.file);n=c||`Unknown (${r})`}if(!c){if(i)throw new b(`Navigation node at ${o} is missing slug and has no file to derive it from`,o,e.file);c=n?l.slugFromFilename(n):`node-${r}`}return{title:n,slug:c,file:e.file,children:e.children?x(e.children,`${o}.children`,i):void 0,badge:e.badge,hidden:e.hidden}}function W(e,t,r){try{const i=N.readFileSync(e,"utf-8"),o=g.extractFrontmatterData(i);return o.title&&typeof o.title=="string"?o.title:l.titleFromFilename(e)}catch(i){if(r)throw new b(`Failed to read file for title derivation at ${t}: ${e}`,t,e,i);return l.titleFromFilename(e)}}function G(e){return A(e.navigation)}function A(e){for(const t of e)if(!t.title||!t.slug||t.children&&A(t.children))return!0;return!1}exports.BreadcrumbItemSchema=a.BreadcrumbItemSchema;exports.DocPageMetaSchema=a.DocPageMetaSchema;exports.DocPageSchema=a.DocPageSchema;exports.DocsPackageManifestInputSchema=a.DocsPackageManifestInputSchema;exports.DocsPackageManifestSchema=a.DocsPackageManifestSchema;exports.FlatNavigationNodeSchema=a.FlatNavigationNodeSchema;exports.GitHubConfigSchema=a.GitHubConfigSchema;exports.LoadedDocsPackageSchema=a.LoadedDocsPackageSchema;exports.ManifestValidationError=a.ManifestValidationError;exports.NavigationNodeInputSchema=a.NavigationNodeInputSchema;exports.NavigationNodeSchema=a.NavigationNodeSchema;exports.SearchConfigSchema=a.SearchConfigSchema;exports.VendureVersionSchema=a.VendureVersionSchema;exports.buildBreadcrumbs=a.buildBreadcrumbs;exports.findNavigationNode=a.findNavigationNode;exports.flattenNavigation=a.flattenNavigation;exports.getLeafNodes=a.getLeafNodes;exports.getNodesAtDepth=a.getNodesAtDepth;exports.getPrevNextNodes=a.getPrevNextNodes;exports.isNodeActive=a.isNodeActive;exports.validateManifest=a.validateManifest;exports.FrontmatterParseError=g.FrontmatterParseError;exports.extractFrontmatterData=g.extractFrontmatterData;exports.hasFrontmatter=g.hasFrontmatter;exports.parseFrontmatter=g.parseFrontmatter;exports.validateFrontmatter=g.validateFrontmatter;exports.filterVisibleNavigation=l.filterVisibleNavigation;exports.getAllFilePaths=l.getAllFilePaths;exports.slugFromFilename=l.slugFromFilename;exports.titleFromFilename=l.titleFromFilename;exports.toSlug=l.toSlug;exports.ManifestResolutionError=b;exports.createNavigationFromFolder=j;exports.createNestedNavigationFromFolder=q;exports.manifestNeedsResolution=G;exports.resolveManifest=T;
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  var A = Object.defineProperty;
2
2
  var B = (e, t, i) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
3
  var m = (e, t, i) => B(e, typeof t != "symbol" ? t + "" : t, i);
4
- import { B as _, D as ee, a as te, b as re, c as ie, F as oe, G as ne, L as se, M as ae, N as le, d as ce, S as fe, V as de, e as he, f as ue, g as ge, h as me, i as ve, j as Fe, k as Ne, v as Se } from "./manifest-B_cvT6F9.js";
5
- import { e as M } from "./frontmatter-8Bwpoi8r.js";
6
- import { F as xe, h as be, p as $e, v as we } from "./frontmatter-8Bwpoi8r.js";
4
+ import { B as _, D as ee, a as te, b as re, c as ie, F as oe, G as ne, L as se, M as ae, N as le, d as ce, S as fe, V as de, e as he, f as ue, g as ge, h as me, i as ve, j as Fe, k as Ne, v as Se } from "./manifest-ZCrzbFSf.js";
5
+ import { e as M } from "./frontmatter-C0Wmtdep.js";
6
+ import { F as xe, h as be, p as $e, v as we } from "./frontmatter-C0Wmtdep.js";
7
7
  import { s as v, t as F } from "./slug-utils-DVKYe9h8.js";
8
8
  import { f as Ee, g as Me, a as Ie } from "./slug-utils-DVKYe9h8.js";
9
9
  import { readdirSync as I, readFileSync as P, statSync as T } from "fs";
package/dist/loader.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var f=Object.defineProperty;var g=(e,r,t)=>r in e?f(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var i=(e,r,t)=>g(e,typeof r!="symbol"?r+"":r,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("fs/promises"),P=require("module"),m=require("./frontmatter-_wRoVeyd.cjs"),p=require("./manifest-D8kEDc9X.cjs");var c=typeof document<"u"?document.currentScript:null;class a extends Error{constructor(t,n){super(t);i(this,"packageName");this.name="DocsPackageLoadError",this.packageName=n}}async function $(e,r={}){try{const t=r.resolver?await r.resolver(e):u(e),n=await import(e);if(!n.manifest)throw new a(`Package "${e}" does not export a manifest`,e);return{manifest:p.validateManifest(n.manifest),basePath:t}}catch(t){throw t instanceof a?t:new a(`Failed to load docs package "${e}": ${t instanceof Error?t.message:String(t)}`,e)}}function u(e){try{return P.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:c&&c.tagName.toUpperCase()==="SCRIPT"&&c.src||new URL("loader.cjs",document.baseURI).href).resolve(`${e}/package.json`).replace(/\/package\.json$/,"")}catch{throw new a(`Cannot resolve package "${e}". Make sure it is installed.`,e)}}async function l(e,r){try{const t=`${e.basePath}/${r}`,n=await h.readFile(t,"utf-8"),{meta:o,content:s}=m.parseFrontmatter(n,r);return{meta:o,content:s,filePath:r}}catch(t){throw new a(`Failed to load doc page "${r}": ${t instanceof Error?t.message:String(t)}`,e.manifest.id)}}async function v(e,r){const t=d(e.manifest.navigation,r.split("/"));if(t!=null&&t.file)return l(e,t.file)}function d(e,r){if(r.length===0)return;const[t,...n]=r,o=e.find(s=>s.slug===t);if(o){if(n.length===0)return o;if(o.children)return d(o.children,n)}}function y(e,r){if(r.file)return`${e.basePath}/${r.file}`}function w(e){try{return u(e),!0}catch{return!1}}exports.DocsPackageLoadError=a;exports.isDocsPackageInstalled=w;exports.loadDocPage=l;exports.loadDocPageBySlug=v;exports.loadDocsPackage=$;exports.resolveFilePath=y;
1
+ "use strict";var f=Object.defineProperty;var g=(e,r,t)=>r in e?f(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var i=(e,r,t)=>g(e,typeof r!="symbol"?r+"":r,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("fs/promises"),P=require("module"),m=require("./frontmatter-CJYZSUYM.cjs"),p=require("./manifest-D-EWZlSh.cjs");var c=typeof document<"u"?document.currentScript:null;class a extends Error{constructor(t,n){super(t);i(this,"packageName");this.name="DocsPackageLoadError",this.packageName=n}}async function $(e,r={}){try{const t=r.resolver?await r.resolver(e):u(e),n=await import(e);if(!n.manifest)throw new a(`Package "${e}" does not export a manifest`,e);return{manifest:p.validateManifest(n.manifest),basePath:t}}catch(t){throw t instanceof a?t:new a(`Failed to load docs package "${e}": ${t instanceof Error?t.message:String(t)}`,e)}}function u(e){try{return P.createRequire(typeof document>"u"?require("url").pathToFileURL(__filename).href:c&&c.tagName.toUpperCase()==="SCRIPT"&&c.src||new URL("loader.cjs",document.baseURI).href).resolve(`${e}/package.json`).replace(/\/package\.json$/,"")}catch{throw new a(`Cannot resolve package "${e}". Make sure it is installed.`,e)}}async function l(e,r){try{const t=`${e.basePath}/${r}`,n=await h.readFile(t,"utf-8"),{meta:o,content:s}=m.parseFrontmatter(n,r);return{meta:o,content:s,filePath:r}}catch(t){throw new a(`Failed to load doc page "${r}": ${t instanceof Error?t.message:String(t)}`,e.manifest.id)}}async function v(e,r){const t=d(e.manifest.navigation,r.split("/"));if(t!=null&&t.file)return l(e,t.file)}function d(e,r){if(r.length===0)return;const[t,...n]=r,o=e.find(s=>s.slug===t);if(o){if(n.length===0)return o;if(o.children)return d(o.children,n)}}function y(e,r){if(r.file)return`${e.basePath}/${r.file}`}function w(e){try{return u(e),!0}catch{return!1}}exports.DocsPackageLoadError=a;exports.isDocsPackageInstalled=w;exports.loadDocPage=l;exports.loadDocPageBySlug=v;exports.loadDocsPackage=$;exports.resolveFilePath=y;
package/dist/loader.js CHANGED
@@ -3,8 +3,8 @@ var l = (t, e, r) => e in t ? u(t, e, { enumerable: !0, configurable: !0, writab
3
3
  var i = (t, e, r) => l(t, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { readFile as d } from "fs/promises";
5
5
  import { createRequire as h } from "module";
6
- import { p as g } from "./frontmatter-8Bwpoi8r.js";
7
- import { v as m } from "./manifest-B_cvT6F9.js";
6
+ import { p as g } from "./frontmatter-C0Wmtdep.js";
7
+ import { v as m } from "./manifest-ZCrzbFSf.js";
8
8
  class a extends Error {
9
9
  constructor(r, n) {
10
10
  super(r);
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var j=(i,t,n)=>t in i?D(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var f=(i,t,n)=>j(i,typeof t!="symbol"?t+"":t,n);const e=require("zod"),g=e.z.enum(["v1","v2","v3"]),d=e.z.object({indexFields:e.z.array(e.z.enum(["title","description","content","keywords"])),boosts:e.z.record(e.z.string(),e.z.number()).optional()}),u=e.z.object({repository:e.z.string().regex(/^[^/]+\/[^/]+$/,'Repository must be in format "owner/repo"'),branch:e.z.string().optional(),docsPath:e.z.string().optional()}),l=e.z.lazy(()=>e.z.object({title:e.z.string().min(1,"Navigation title is required"),slug:e.z.string().min(1,"Navigation slug is required"),file:e.z.string().optional(),children:e.z.array(l).optional(),badge:e.z.string().optional(),hidden:e.z.boolean().optional()})),h=e.z.object({id:e.z.string().min(1,"Package ID is required"),name:e.z.string().min(1,"Package name is required"),version:e.z.string().regex(/^\d+\.\d+\.\d+/,"Version must be valid semver"),vendureVersion:g,navigation:e.z.array(l),search:d.optional(),github:u.optional(),basePath:e.z.string().optional()}),p=e.z.object({title:e.z.string().min(1,"Page title is required"),description:e.z.string().optional(),keywords:e.z.array(e.z.string()).optional(),sidebarLabel:e.z.string().optional(),hidden:e.z.boolean().optional(),order:e.z.number().int().optional()}),k=e.z.object({meta:p,content:e.z.string(),filePath:e.z.string()}),I=e.z.object({manifest:h,basePath:e.z.string()}),M=e.z.object({title:e.z.string(),slug:e.z.string(),path:e.z.string()}),V=e.z.object({title:e.z.string(),slug:e.z.string(),file:e.z.string().optional(),children:e.z.array(e.z.lazy(()=>l)).optional(),badge:e.z.string().optional(),hidden:e.z.boolean().optional(),path:e.z.string(),depth:e.z.number().int().min(0),parentPath:e.z.string().optional()}),z=e.z.lazy(()=>e.z.object({title:e.z.string().min(1).optional(),slug:e.z.string().min(1).optional(),file:e.z.string().optional(),children:e.z.array(z).optional(),badge:e.z.string().optional(),hidden:e.z.boolean().optional()})),x=e.z.object({id:e.z.string().min(1,"Package ID is required"),name:e.z.string().min(1,"Package name is required"),version:e.z.string().regex(/^\d+\.\d+\.\d+/,"Version must be valid semver"),vendureVersion:g,navigation:e.z.array(z),search:d.optional(),github:u.optional(),basePath:e.z.string().optional()});class b extends Error{constructor(n,o){super(n);f(this,"issues");this.name="ManifestValidationError",this.issues=o}}function q(i){const t=h.safeParse(i);if(!t.success){const n=t.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`);throw new b("Invalid manifest",n)}return t.data}function B(i,t){const n=t.split("/").filter(Boolean);return v(i.navigation,n)}function v(i,t){if(t.length===0)return;const[n,...o]=t,a=i.find(r=>r.slug===n);if(a){if(o.length===0)return a;if(a.children)return v(a.children,o)}}function m(i){const t=[];return N(i.navigation,"",0,void 0,t),t}function N(i,t,n,o,a){for(const r of i){const s=t?`${t}/${r.slug}`:r.slug;a.push({...r,path:s,depth:n,parentPath:o}),r.children&&r.children.length>0&&N(r.children,s,n+1,s,a)}}function $(i,t){const n=t.split("/").filter(Boolean),o=[];let a=i.navigation,r="";for(const s of n){const c=a.find(y=>y.slug===s);if(!c)break;r=r?`${r}/${s}`:s,o.push({title:c.title,slug:c.slug,path:r}),a=c.children??[]}return o}function S(i){return m(i).filter(t=>t.file!==void 0)}function w(i,t){const n=S(i),o=n.findIndex(a=>a.path===t);return o===-1?{}:{prev:o>0?n[o-1]:void 0,next:o<n.length-1?n[o+1]:void 0}}function P(i,t){const n=t.split("/").filter(Boolean);if(n.length===0)return!1;if(i.slug===n[0]){if(n.length===1)return!0;if(i.children){const o=n.slice(1).join("/");return i.children.some(a=>P(a,o))}}return!1}function L(i,t){return m(i).filter(n=>n.depth===t)}exports.BreadcrumbItemSchema=M;exports.DocPageMetaSchema=p;exports.DocPageSchema=k;exports.DocsPackageManifestInputSchema=x;exports.DocsPackageManifestSchema=h;exports.FlatNavigationNodeSchema=V;exports.GitHubConfigSchema=u;exports.LoadedDocsPackageSchema=I;exports.ManifestValidationError=b;exports.NavigationNodeInputSchema=z;exports.NavigationNodeSchema=l;exports.SearchConfigSchema=d;exports.VendureVersionSchema=g;exports.buildBreadcrumbs=$;exports.findNavigationNode=B;exports.flattenNavigation=m;exports.getLeafNodes=S;exports.getNodesAtDepth=L;exports.getPrevNextNodes=w;exports.isNodeActive=P;exports.validateManifest=q;
1
+ "use strict";var D=Object.defineProperty;var j=(i,t,n)=>t in i?D(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var f=(i,t,n)=>j(i,typeof t!="symbol"?t+"":t,n);const e=require("zod"),g=e.z.enum(["v1","v2","v3"]),d=e.z.object({indexFields:e.z.array(e.z.enum(["title","description","content","keywords"])),boosts:e.z.record(e.z.string(),e.z.number()).optional()}),u=e.z.object({repository:e.z.string().regex(/^[^/]+\/[^/]+$/,'Repository must be in format "owner/repo"'),branch:e.z.string().optional(),docsPath:e.z.string().optional()}),l=e.z.lazy(()=>e.z.object({title:e.z.string().min(1,"Navigation title is required"),slug:e.z.string().min(1,"Navigation slug is required"),file:e.z.string().optional(),children:e.z.array(l).optional(),badge:e.z.string().optional(),hidden:e.z.boolean().optional()})),h=e.z.object({id:e.z.string().min(1,"Package ID is required"),name:e.z.string().min(1,"Package name is required"),version:e.z.string().regex(/^\d+\.\d+\.\d+/,"Version must be valid semver"),vendureVersion:g,navigation:e.z.array(l),search:d.optional(),github:u.optional(),basePath:e.z.string().optional()}),p=e.z.object({title:e.z.string().min(1,"Page title is required"),description:e.z.string().optional(),keywords:e.z.array(e.z.string()).optional(),sidebarLabel:e.z.string().optional(),hidden:e.z.boolean().optional(),order:e.z.number().int().optional()}),k=e.z.object({meta:p,content:e.z.string(),filePath:e.z.string()}),I=e.z.object({manifest:h,basePath:e.z.string()}),M=e.z.object({title:e.z.string(),slug:e.z.string(),path:e.z.string()}),V=e.z.object({title:e.z.string(),slug:e.z.string(),file:e.z.string().optional(),children:e.z.array(e.z.lazy(()=>l)).optional(),badge:e.z.string().optional(),hidden:e.z.boolean().optional(),path:e.z.string(),depth:e.z.number().int().min(0),parentPath:e.z.string().optional()}),z=e.z.lazy(()=>e.z.object({title:e.z.string().min(1).optional(),slug:e.z.string().min(1).optional(),file:e.z.string().optional(),children:e.z.array(z).optional(),badge:e.z.string().optional(),hidden:e.z.boolean().optional()})),x=e.z.object({id:e.z.string().min(1,"Package ID is required"),name:e.z.string().min(1,"Package name is required"),version:e.z.string().regex(/^\d+\.\d+\.\d+/,"Version must be valid semver"),vendureVersion:g,navigation:e.z.array(z),search:d.optional(),github:u.optional(),basePath:e.z.string().optional()});class b extends Error{constructor(n,o){super(n);f(this,"issues");this.name="ManifestValidationError",this.issues=o}}function q(i){const t=h.safeParse(i);if(!t.success){const n=t.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`);throw new b("Invalid manifest",n)}return t.data}function B(i,t){const n=t.split("/").filter(Boolean);return v(i.navigation,n)}function v(i,t){if(t.length===0)return;const[n,...o]=t,a=i.find(r=>r.slug===n);if(a){if(o.length===0)return a;if(a.children)return v(a.children,o)}}function m(i){const t=[];return N(i.navigation,"",0,void 0,t),t}function N(i,t,n,o,a){for(const r of i){const s=t?`${t}/${r.slug}`:r.slug;a.push({...r,path:s,depth:n,parentPath:o}),r.children&&r.children.length>0&&N(r.children,s,n+1,s,a)}}function $(i,t){const n=t.split("/").filter(Boolean),o=[];let a=i.navigation,r="";for(const s of n){const c=a.find(y=>y.slug===s);if(!c)break;r=r?`${r}/${s}`:s,o.push({title:c.title,slug:c.slug,path:r,file:c.file}),a=c.children??[]}return o}function S(i){return m(i).filter(t=>t.file!==void 0)}function w(i,t){const n=S(i),o=n.findIndex(a=>a.path===t);return o===-1?{}:{prev:o>0?n[o-1]:void 0,next:o<n.length-1?n[o+1]:void 0}}function P(i,t){const n=t.split("/").filter(Boolean);if(n.length===0)return!1;if(i.slug===n[0]){if(n.length===1)return!0;if(i.children){const o=n.slice(1).join("/");return i.children.some(a=>P(a,o))}}return!1}function L(i,t){return m(i).filter(n=>n.depth===t)}exports.BreadcrumbItemSchema=M;exports.DocPageMetaSchema=p;exports.DocPageSchema=k;exports.DocsPackageManifestInputSchema=x;exports.DocsPackageManifestSchema=h;exports.FlatNavigationNodeSchema=V;exports.GitHubConfigSchema=u;exports.LoadedDocsPackageSchema=I;exports.ManifestValidationError=b;exports.NavigationNodeInputSchema=z;exports.NavigationNodeSchema=l;exports.SearchConfigSchema=d;exports.VendureVersionSchema=g;exports.buildBreadcrumbs=$;exports.findNavigationNode=B;exports.flattenNavigation=m;exports.getLeafNodes=S;exports.getNodesAtDepth=L;exports.getPrevNextNodes=w;exports.isNodeActive=P;exports.validateManifest=q;
@@ -5,7 +5,7 @@ import { z as n } from "zod";
5
5
  const d = n.enum(["v1", "v2", "v3"]), u = n.object({
6
6
  indexFields: n.array(n.enum(["title", "description", "content", "keywords"])),
7
7
  boosts: n.record(n.string(), n.number()).optional()
8
- }), h = n.object({
8
+ }), f = n.object({
9
9
  repository: n.string().regex(/^[^/]+\/[^/]+$/, 'Repository must be in format "owner/repo"'),
10
10
  branch: n.string().optional(),
11
11
  docsPath: n.string().optional()
@@ -18,14 +18,14 @@ const d = n.enum(["v1", "v2", "v3"]), u = n.object({
18
18
  badge: n.string().optional(),
19
19
  hidden: n.boolean().optional()
20
20
  })
21
- ), f = n.object({
21
+ ), h = n.object({
22
22
  id: n.string().min(1, "Package ID is required"),
23
23
  name: n.string().min(1, "Package name is required"),
24
24
  version: n.string().regex(/^\d+\.\d+\.\d+/, "Version must be valid semver"),
25
25
  vendureVersion: d,
26
26
  navigation: n.array(c),
27
27
  search: u.optional(),
28
- github: h.optional(),
28
+ github: f.optional(),
29
29
  basePath: n.string().optional()
30
30
  }), y = n.object({
31
31
  title: n.string().min(1, "Page title is required"),
@@ -39,7 +39,7 @@ const d = n.enum(["v1", "v2", "v3"]), u = n.object({
39
39
  content: n.string(),
40
40
  filePath: n.string()
41
41
  }), q = n.object({
42
- manifest: f,
42
+ manifest: h,
43
43
  basePath: n.string()
44
44
  }), B = n.object({
45
45
  title: n.string(),
@@ -71,7 +71,7 @@ const d = n.enum(["v1", "v2", "v3"]), u = n.object({
71
71
  vendureVersion: d,
72
72
  navigation: n.array(m),
73
73
  search: u.optional(),
74
- github: h.optional(),
74
+ github: f.optional(),
75
75
  basePath: n.string().optional()
76
76
  });
77
77
  class j extends Error {
@@ -82,7 +82,7 @@ class j extends Error {
82
82
  }
83
83
  }
84
84
  function w(i) {
85
- const t = f.safeParse(i);
85
+ const t = h.safeParse(i);
86
86
  if (!t.success) {
87
87
  const e = t.error.issues.map((o) => `${o.path.join(".")}: ${o.message}`);
88
88
  throw new j("Invalid manifest", e);
@@ -126,7 +126,8 @@ function L(i, t) {
126
126
  r = r ? `${r}/${s}` : s, o.push({
127
127
  title: l.title,
128
128
  slug: l.slug,
129
- path: r
129
+ path: r,
130
+ file: l.file
130
131
  }), a = l.children ?? [];
131
132
  }
132
133
  return o;
@@ -160,7 +161,7 @@ export {
160
161
  B,
161
162
  y as D,
162
163
  M as F,
163
- h as G,
164
+ f as G,
164
165
  q as L,
165
166
  j as M,
166
167
  m as N,
@@ -168,7 +169,7 @@ export {
168
169
  d as V,
169
170
  I as a,
170
171
  $ as b,
171
- f as c,
172
+ h as c,
172
173
  c as d,
173
174
  L as e,
174
175
  z as f,
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAChD,SAAgB,MAAM,EAAE,MAAM,EAAE,CAAA;gBAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;CAK9C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,mBAAmB,CAWvE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,mBAAmB,EAC7B,QAAQ,EAAE,MAAM,GACf,cAAc,GAAG,SAAS,CAG5B;AAqBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,kBAAkB,EAAE,CAIrF;AA4BD;;;;;;;;;;;;;;;GAe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AAQ,EAAE,mBAAmB,GAAG,kBAAkB,EAAE,CAIrF;AA4BD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,mBAAmB,EAC7B,QAAQ,EAAE,MAAM,GACf,cAAc,EAAE,CAsBlB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,kBAAkB,EAAE,CAEhF;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,mBAAmB,EAC7B,QAAQ,EAAE,MAAM,GACf;IAAE,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAAC,IAAI,CAAC,EAAE,kBAAkB,CAAA;CAAE,CAY1D;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAc/E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,MAAM,GACZ,kBAAkB,EAAE,CAEtB"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Remark plugins for MDX processing
3
+ *
4
+ * These plugins are used by the MDX compiler to transform
5
+ * documentation content during compilation.
6
+ */
7
+ export { remarkAdmonitions, default as remarkAdmonitionsDefault } from './remark-admonitions';
8
+ export { remarkCodeMeta } from './remark-code-meta';
9
+ export { remarkStripImports, default as remarkStripImportsDefault } from './remark-strip-imports';
10
+ export { remarkStripHtmlComments, default as remarkStripHtmlCommentsDefault, } from './remark-strip-html-comments';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/remark-plugins/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,sBAAsB,CAAA;AAC7F,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AACjG,OAAO,EACL,uBAAuB,EACvB,OAAO,IAAI,8BAA8B,GAC1C,MAAM,8BAA8B,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { Root } from 'mdast';
2
+ import { Plugin } from 'unified';
3
+ /**
4
+ * Remark plugin that transforms container directives into Callout JSX components.
5
+ *
6
+ * This plugin works with remark-directive to convert markdown like:
7
+ *
8
+ * ```md
9
+ * :::caution
10
+ * Some warning content
11
+ * :::
12
+ * ```
13
+ *
14
+ * Into a Callout component that can be rendered by MDX.
15
+ */
16
+ export declare const remarkAdmonitions: Plugin<[], Root>;
17
+ export default remarkAdmonitions;
18
+ //# sourceMappingURL=remark-admonitions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-admonitions.d.ts","sourceRoot":"","sources":["../../src/remark-plugins/remark-admonitions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAuBrC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,CAwD9C,CAAA;AAED,eAAe,iBAAiB,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { Root } from 'mdast';
2
+ /**
3
+ * Remark plugin that extracts title/filename from code fence meta strings
4
+ * and converts them to `// filename:` comments that CodeBlock can parse.
5
+ *
6
+ * Supports:
7
+ * - ```ts title="path/to/file.ts"
8
+ * - ```ts filename="path/to/file.ts"
9
+ *
10
+ * Converts to:
11
+ * // filename: path/to/file.ts
12
+ * <code content>
13
+ */
14
+ export declare function remarkCodeMeta(): (tree: Root) => void;
15
+ //# sourceMappingURL=remark-code-meta.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-code-meta.d.ts","sourceRoot":"","sources":["../../src/remark-plugins/remark-code-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,IAAI,EAAE,MAAM,OAAO,CAAA;AAGvC;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,KACpB,MAAM,IAAI,UAkBnB"}
@@ -0,0 +1,8 @@
1
+ import { Root } from 'mdast';
2
+ import { Plugin } from 'unified';
3
+ /**
4
+ * Remark plugin that removes HTML comment nodes from the AST.
5
+ */
6
+ export declare const remarkStripHtmlComments: Plugin<[], Root>;
7
+ export default remarkStripHtmlComments;
8
+ //# sourceMappingURL=remark-strip-html-comments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-strip-html-comments.d.ts","sourceRoot":"","sources":["../../src/remark-plugins/remark-strip-html-comments.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAGrC;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,CAsBpD,CAAA;AAED,eAAe,uBAAuB,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { Root } from 'mdast';
2
+ import { Plugin } from 'unified';
3
+ /**
4
+ * Remark plugin that removes import statements for specified modules.
5
+ */
6
+ export declare const remarkStripImports: Plugin<[], Root>;
7
+ export default remarkStripImports;
8
+ //# sourceMappingURL=remark-strip-imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remark-strip-imports.d.ts","sourceRoot":"","sources":["../../src/remark-plugins/remark-strip-imports.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAEjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAQrC;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,CA0B/C,CAAA;AAED,eAAe,kBAAkB,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { MdxCompilationResult, MdxTestReport } from './types';
2
+ export type { CompileMdxOptions, MdxCompilationResult, MdxTestReport, TestManifestOptions, } from './types';
3
+ export { compileMdx, getDefaultRehypePlugins, getDefaultRemarkPlugins } from './mdx-compiler';
4
+ export { testManifestMdx } from './test-manifest';
5
+ /**
6
+ * Format a test report for console output.
7
+ *
8
+ * @param report - The test report to format
9
+ * @param verbose - If true, show details for all files. If false, only show failures.
10
+ * @returns A formatted string suitable for console output
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const report = await testManifestMdx(manifest)
15
+ * console.log(formatTestReport(report, true))
16
+ * ```
17
+ */
18
+ export declare function formatTestReport(report: MdxTestReport, verbose?: boolean): string;
19
+ /**
20
+ * Create a simple progress reporter for console output.
21
+ *
22
+ * @returns A progress callback function for use with testManifestMdx
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const report = await testManifestMdx(manifest, {
27
+ * onProgress: createProgressReporter(),
28
+ * })
29
+ * ```
30
+ */
31
+ export declare function createProgressReporter(): (current: number, total: number, result: MdxCompilationResult) => void;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGlE,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,GACpB,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,UAAQ,GAAG,MAAM,CA2D/E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,IAAI,CACxC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,oBAAoB,KACzB,IAAI,CAcR"}
@@ -0,0 +1,49 @@
1
+ import { PluggableList } from 'unified';
2
+ import { CompileMdxOptions, MdxCompilationResult } from './types';
3
+ /**
4
+ * Get the default remark plugins used for MDX compilation.
5
+ *
6
+ * These plugins match those used in @apps/docs and provide:
7
+ * - GitHub Flavored Markdown support
8
+ * - Directive support (for admonitions)
9
+ * - Admonition transformation
10
+ * - Code fence metadata handling
11
+ * - Import stripping (Docusaurus compatibility)
12
+ * - HTML comment stripping
13
+ *
14
+ * @returns Array of remark plugins
15
+ */
16
+ export declare function getDefaultRemarkPlugins(): PluggableList;
17
+ /**
18
+ * Get the default rehype plugins used for MDX compilation.
19
+ *
20
+ * These plugins provide:
21
+ * - Automatic slug generation for headings
22
+ *
23
+ * @returns Array of rehype plugins
24
+ */
25
+ export declare function getDefaultRehypePlugins(): PluggableList;
26
+ /**
27
+ * Compile an MDX string and return the compilation result.
28
+ *
29
+ * This function uses the same plugin configuration as @apps/docs,
30
+ * allowing documentation packages to validate their MDX content
31
+ * before publishing.
32
+ *
33
+ * @param content - The MDX content to compile
34
+ * @param filePath - The file path (used for error reporting)
35
+ * @param options - Optional compilation options
36
+ * @returns The compilation result with success status and any errors
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * const result = await compileMdx('# Hello World', 'example.mdx')
41
+ * if (result.success) {
42
+ * console.log('Compilation successful!')
43
+ * } else {
44
+ * console.error(`Error at line ${result.line}: ${result.error}`)
45
+ * }
46
+ * ```
47
+ */
48
+ export declare function compileMdx(content: string, filePath: string, options?: CompileMdxOptions): Promise<MdxCompilationResult>;
49
+ //# sourceMappingURL=mdx-compiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mdx-compiler.d.ts","sourceRoot":"","sources":["../../src/testing/mdx-compiler.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAO5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAA;AAEtE;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CASvD;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CAEvD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,CAuE/B"}
@@ -0,0 +1,33 @@
1
+ import { DocsPackageManifest } from '../types';
2
+ import { MdxTestReport, TestManifestOptions } from './types';
3
+ /**
4
+ * Test all MDX files in a manifest by compiling them.
5
+ *
6
+ * This function iterates through all leaf nodes (pages with files) in the
7
+ * manifest's navigation tree and attempts to compile each MDX file using
8
+ * the same plugins as @apps/docs.
9
+ *
10
+ * Note: Manifests must contain absolute file paths. The function reads
11
+ * files directly from the paths specified in the navigation nodes.
12
+ *
13
+ * @param manifest - The documentation package manifest to test
14
+ * @param options - Optional configuration for testing
15
+ * @returns A report containing results for each file
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import { manifest } from '../src/manifest'
20
+ * import { testManifestMdx, formatTestReport } from '@vendure-io/docs-provider/testing'
21
+ *
22
+ * const report = await testManifestMdx(manifest, {
23
+ * onProgress: (current, total, result) => {
24
+ * console.log(`[${current}/${total}] ${result.success ? '✓' : '✗'} ${result.filePath}`)
25
+ * },
26
+ * })
27
+ *
28
+ * console.log(formatTestReport(report))
29
+ * process.exit(report.failed > 0 ? 1 : 0)
30
+ * ```
31
+ */
32
+ export declare function testManifestMdx(manifest: DocsPackageManifest, options?: TestManifestOptions): Promise<MdxTestReport>;
33
+ //# sourceMappingURL=test-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-manifest.d.ts","sourceRoot":"","sources":["../../src/testing/test-manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAGnD,OAAO,KAAK,EAAwB,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,CAAC,CA4ExB"}
@@ -0,0 +1,76 @@
1
+ import { PluggableList } from 'unified';
2
+ /**
3
+ * Result of compiling a single MDX file
4
+ */
5
+ export interface MdxCompilationResult {
6
+ /** Path to the MDX file that was compiled */
7
+ filePath: string;
8
+ /** Whether compilation was successful */
9
+ success: boolean;
10
+ /** Error message if compilation failed */
11
+ error?: string;
12
+ /** Line number where the error occurred (if available) */
13
+ line?: number;
14
+ /** Column number where the error occurred (if available) */
15
+ column?: number;
16
+ /** Time taken to compile the file in milliseconds */
17
+ compilationTime: number;
18
+ }
19
+ /**
20
+ * Report from testing all MDX files in a manifest
21
+ */
22
+ export interface MdxTestReport {
23
+ /** Package ID from the manifest */
24
+ packageId: string;
25
+ /** Total number of MDX files tested */
26
+ totalFiles: number;
27
+ /** Number of files that compiled successfully */
28
+ passed: number;
29
+ /** Number of files that failed to compile */
30
+ failed: number;
31
+ /** Individual results for each file */
32
+ results: MdxCompilationResult[];
33
+ /** Total time taken for all compilations in milliseconds */
34
+ totalTime: number;
35
+ }
36
+ /**
37
+ * Options for testing a manifest's MDX files
38
+ */
39
+ export interface TestManifestOptions {
40
+ /**
41
+ * Stop on first failure.
42
+ * @default false
43
+ */
44
+ failFast?: boolean;
45
+ /**
46
+ * Custom remark plugins to use instead of defaults.
47
+ * If not provided, uses the standard docs-provider plugins.
48
+ */
49
+ remarkPlugins?: PluggableList;
50
+ /**
51
+ * Custom rehype plugins to use instead of defaults.
52
+ * If not provided, uses the standard docs-provider plugins.
53
+ */
54
+ rehypePlugins?: PluggableList;
55
+ /**
56
+ * Callback invoked after each file is processed.
57
+ * Useful for progress reporting.
58
+ */
59
+ onProgress?: (current: number, total: number, result: MdxCompilationResult) => void;
60
+ }
61
+ /**
62
+ * Options for compiling a single MDX file
63
+ */
64
+ export interface CompileMdxOptions {
65
+ /**
66
+ * Custom remark plugins to use.
67
+ * If not provided, uses the standard docs-provider plugins.
68
+ */
69
+ remarkPlugins?: PluggableList;
70
+ /**
71
+ * Custom rehype plugins to use.
72
+ * If not provided, uses the standard docs-provider plugins.
73
+ */
74
+ rehypePlugins?: PluggableList;
75
+ }
76
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/testing/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAE5C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAA;IAChB,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAA;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qDAAqD;IACrD,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAA;IACd,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAA;IACd,uCAAuC;IACvC,OAAO,EAAE,oBAAoB,EAAE,CAAA;IAC/B,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAA;CACpF;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B"}
@@ -0,0 +1,4 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("@mdx-js/mdx"),F=require("rehype-slug"),w=require("remark-directive"),M=require("remark-gfm"),p=require("unist-util-visit"),x=require("fs/promises"),R=require("./manifest-D-EWZlSh.cjs"),$={info:"info",note:"note",tip:"tip",warning:"warning",caution:"caution",danger:"danger"},D={info:"Info",note:"Note",tip:"Tip",warning:"Warning",caution:"Caution",danger:"Danger"},I=()=>s=>{p.visit(s,"containerDirective",t=>{var a;const e=t.name.toLowerCase();if(!(e in $))return;const i=$[e];let r;if(t.children.length>0){const l=t.children[0];if(l.type==="paragraph"&&"data"in l&&((a=l.data)==null?void 0:a.directiveLabel)===!0){const u=[];for(const o of l.children)o.type==="text"&&u.push(o.value);u.length>0&&(r=u.join("")),t.children=t.children.slice(1)}}const n=r||D[e],c=t.data||(t.data={});c.hName="Callout",c.hProperties={type:i,title:n}})};function E(){return s=>{p.visit(s,"code",t=>{if(!t.meta)return;const e=t.meta.match(/(?:title|filename)=["']([^"']+)["']/);if(!e)return;const i=e[1];t.value.trim().startsWith("// filename:")||(t.value=`// filename: ${i}
2
+ ${t.value}`)})}}const S=()=>s=>{const t=[];p.visit(s,"html",(e,i,r)=>{i!==void 0&&r&&typeof e.value=="string"&&e.value.trim().startsWith("<!--")&&e.value.trim().endsWith("-->")&&t.push(i)});for(const e of t.reverse())s.children.splice(e,1)},b=["@theme/Tabs","@theme/TabItem"],C=()=>s=>{const t=[];p.visit(s,"mdxjsEsm",e=>{const i=e.value;b.some(n=>i.includes(`from '${n}'`)||i.includes(`from "${n}"`))&&t.push(e)});for(const e of t){const i=s.children.indexOf(e);i!==-1&&s.children.splice(i,1)}};function v(){return[M,w,I,E,C,S]}function T(){return[F]}async function y(s,t,e){var c,a,l,u;const i=performance.now(),r=(e==null?void 0:e.remarkPlugins)??v(),n=(e==null?void 0:e.rehypePlugins)??T();try{return await k.compile(s,{remarkPlugins:r,rehypePlugins:n,outputFormat:"function-body",development:!1}),{filePath:t,success:!0,compilationTime:performance.now()-i}}catch(o){const f=performance.now()-i;let h="Unknown compilation error",d,g;if(o instanceof Error){h=o.message;const m=o;if(m.line!==void 0?d=m.line:((a=(c=m.position)==null?void 0:c.start)==null?void 0:a.line)!==void 0&&(d=m.position.start.line),m.column!==void 0?g=m.column:((u=(l=m.position)==null?void 0:l.start)==null?void 0:u.column)!==void 0&&(g=m.position.start.column),d===void 0){const P=h.match(/\((\d+):(\d+)\)/);P&&(d=parseInt(P[1],10),g=parseInt(P[2],10))}}return{filePath:t,success:!1,error:h,line:d,column:g,compilationTime:f}}}async function L(s,t){const e=performance.now(),i=R.getLeafNodes(s),r=[];let n=0,c=0;for(let a=0;a<i.length;a++){const l=i[a];if(!l.file)continue;const u=l.file;try{const o=await x.readFile(u,"utf-8"),f=await y(o,l.file,{remarkPlugins:t==null?void 0:t.remarkPlugins,rehypePlugins:t==null?void 0:t.rehypePlugins});if(r.push(f),f.success?n++:c++,t!=null&&t.onProgress&&t.onProgress(a+1,i.length,f),t!=null&&t.failFast&&!f.success)break}catch(o){const f=o instanceof Error?o.message:"Unknown error reading file",h={filePath:l.file,success:!1,error:`Failed to read file: ${f}`,compilationTime:0};if(r.push(h),c++,t!=null&&t.onProgress&&t.onProgress(a+1,i.length,h),t!=null&&t.failFast)break}}return{packageId:s.id,totalFiles:r.length,passed:n,failed:c,results:r,totalTime:performance.now()-e}}function q(s,t=!1){const e=[];e.push(""),e.push(`MDX Compilation Report: ${s.packageId}`),e.push("=".repeat(50)),e.push("");const i=s.totalFiles>0?(s.passed/s.totalFiles*100).toFixed(1):"0";if(e.push(`Total files: ${s.totalFiles}`),e.push(`Passed: ${s.passed} (${i}%)`),e.push(`Failed: ${s.failed}`),e.push(`Total time: ${s.totalTime.toFixed(2)}ms`),e.push(""),t){e.push("Results:"),e.push("-".repeat(50));for(const r of s.results){const n=r.success?"[PASS]":"[FAIL]",c=`(${r.compilationTime.toFixed(2)}ms)`;if(e.push(`${n} ${r.filePath} ${c}`),!r.success&&r.error){const a=r.line?` (line ${r.line}${r.column?`:${r.column}`:""})`:"";e.push(` Error${a}: ${r.error}`)}}}else if(s.failed>0){e.push("Failures:"),e.push("-".repeat(50));for(const r of s.results.filter(n=>!n.success))if(e.push(`[FAIL] ${r.filePath}`),r.error){const n=r.line?` (line ${r.line}${r.column?`:${r.column}`:""})`:"";e.push(` Error${n}: ${r.error}`)}}return e.push(""),s.failed===0?e.push("All MDX files compiled successfully!"):e.push(`${s.failed} file(s) failed to compile.`),e.push(""),e.join(`
3
+ `)}function A(){return(s,t,e)=>{const i=e.success?"✓":"✗",r=(s/t*100).toFixed(0);process.stdout.write(`\r[${s}/${t}] (${r}%) ${i} ${e.filePath}`),process.stdout.write("\x1B[K"),s===t&&process.stdout.write(`
4
+ `)}}exports.compileMdx=y;exports.createProgressReporter=A;exports.formatTestReport=q;exports.getDefaultRehypePlugins=T;exports.getDefaultRemarkPlugins=v;exports.testManifestMdx=L;
@@ -0,0 +1,201 @@
1
+ import { compile as T } from "@mdx-js/mdx";
2
+ import v from "rehype-slug";
3
+ import F from "remark-directive";
4
+ import k from "remark-gfm";
5
+ import { visit as g } from "unist-util-visit";
6
+ import { readFile as w } from "fs/promises";
7
+ import { h as y } from "./manifest-ZCrzbFSf.js";
8
+ const P = {
9
+ info: "info",
10
+ note: "note",
11
+ tip: "tip",
12
+ warning: "warning",
13
+ caution: "caution",
14
+ danger: "danger"
15
+ }, x = {
16
+ info: "Info",
17
+ note: "Note",
18
+ tip: "Tip",
19
+ warning: "Warning",
20
+ caution: "Caution",
21
+ danger: "Danger"
22
+ }, I = () => (r) => {
23
+ g(r, "containerDirective", (t) => {
24
+ var a;
25
+ const e = t.name.toLowerCase();
26
+ if (!(e in P))
27
+ return;
28
+ const i = P[e];
29
+ let s;
30
+ if (t.children.length > 0) {
31
+ const l = t.children[0];
32
+ if (l.type === "paragraph" && "data" in l && ((a = l.data) == null ? void 0 : a.directiveLabel) === !0) {
33
+ const u = [];
34
+ for (const o of l.children)
35
+ o.type === "text" && u.push(o.value);
36
+ u.length > 0 && (s = u.join("")), t.children = t.children.slice(1);
37
+ }
38
+ }
39
+ const n = s || x[e], c = t.data || (t.data = {});
40
+ c.hName = "Callout", c.hProperties = {
41
+ type: i,
42
+ title: n
43
+ };
44
+ });
45
+ };
46
+ function E() {
47
+ return (r) => {
48
+ g(r, "code", (t) => {
49
+ if (!t.meta) return;
50
+ const e = t.meta.match(/(?:title|filename)=["']([^"']+)["']/);
51
+ if (!e) return;
52
+ const i = e[1];
53
+ t.value.trim().startsWith("// filename:") || (t.value = `// filename: ${i}
54
+ ${t.value}`);
55
+ });
56
+ };
57
+ }
58
+ const M = () => (r) => {
59
+ const t = [];
60
+ g(r, "html", (e, i, s) => {
61
+ i !== void 0 && s && typeof e.value == "string" && e.value.trim().startsWith("<!--") && e.value.trim().endsWith("-->") && t.push(i);
62
+ });
63
+ for (const e of t.reverse())
64
+ r.children.splice(e, 1);
65
+ }, D = ["@theme/Tabs", "@theme/TabItem"], R = () => (r) => {
66
+ const t = [];
67
+ g(r, "mdxjsEsm", (e) => {
68
+ const i = e.value;
69
+ D.some(
70
+ (n) => i.includes(`from '${n}'`) || i.includes(`from "${n}"`)
71
+ ) && t.push(e);
72
+ });
73
+ for (const e of t) {
74
+ const i = r.children.indexOf(e);
75
+ i !== -1 && r.children.splice(i, 1);
76
+ }
77
+ };
78
+ function S() {
79
+ return [
80
+ k,
81
+ F,
82
+ I,
83
+ E,
84
+ R,
85
+ M
86
+ ];
87
+ }
88
+ function C() {
89
+ return [v];
90
+ }
91
+ async function L(r, t, e) {
92
+ var c, a, l, u;
93
+ const i = performance.now(), s = (e == null ? void 0 : e.remarkPlugins) ?? S(), n = (e == null ? void 0 : e.rehypePlugins) ?? C();
94
+ try {
95
+ return await T(r, {
96
+ remarkPlugins: s,
97
+ rehypePlugins: n,
98
+ // Don't output to JS, just compile to check for errors
99
+ outputFormat: "function-body",
100
+ // Suppress development warnings about missing 'development' option
101
+ development: !1
102
+ }), {
103
+ filePath: t,
104
+ success: !0,
105
+ compilationTime: performance.now() - i
106
+ };
107
+ } catch (o) {
108
+ const f = performance.now() - i;
109
+ let h = "Unknown compilation error", d, p;
110
+ if (o instanceof Error) {
111
+ h = o.message;
112
+ const m = o;
113
+ if (m.line !== void 0 ? d = m.line : ((a = (c = m.position) == null ? void 0 : c.start) == null ? void 0 : a.line) !== void 0 && (d = m.position.start.line), m.column !== void 0 ? p = m.column : ((u = (l = m.position) == null ? void 0 : l.start) == null ? void 0 : u.column) !== void 0 && (p = m.position.start.column), d === void 0) {
114
+ const $ = h.match(/\((\d+):(\d+)\)/);
115
+ $ && (d = parseInt($[1], 10), p = parseInt($[2], 10));
116
+ }
117
+ }
118
+ return {
119
+ filePath: t,
120
+ success: !1,
121
+ error: h,
122
+ line: d,
123
+ column: p,
124
+ compilationTime: f
125
+ };
126
+ }
127
+ }
128
+ async function O(r, t) {
129
+ const e = performance.now(), i = y(r), s = [];
130
+ let n = 0, c = 0;
131
+ for (let a = 0; a < i.length; a++) {
132
+ const l = i[a];
133
+ if (!l.file)
134
+ continue;
135
+ const u = l.file;
136
+ try {
137
+ const o = await w(u, "utf-8"), f = await L(o, l.file, {
138
+ remarkPlugins: t == null ? void 0 : t.remarkPlugins,
139
+ rehypePlugins: t == null ? void 0 : t.rehypePlugins
140
+ });
141
+ if (s.push(f), f.success ? n++ : c++, t != null && t.onProgress && t.onProgress(a + 1, i.length, f), t != null && t.failFast && !f.success)
142
+ break;
143
+ } catch (o) {
144
+ const f = o instanceof Error ? o.message : "Unknown error reading file", h = {
145
+ filePath: l.file,
146
+ success: !1,
147
+ error: `Failed to read file: ${f}`,
148
+ compilationTime: 0
149
+ };
150
+ if (s.push(h), c++, t != null && t.onProgress && t.onProgress(a + 1, i.length, h), t != null && t.failFast)
151
+ break;
152
+ }
153
+ }
154
+ return {
155
+ packageId: r.id,
156
+ totalFiles: s.length,
157
+ passed: n,
158
+ failed: c,
159
+ results: s,
160
+ totalTime: performance.now() - e
161
+ };
162
+ }
163
+ function X(r, t = !1) {
164
+ const e = [];
165
+ e.push(""), e.push(`MDX Compilation Report: ${r.packageId}`), e.push("=".repeat(50)), e.push("");
166
+ const i = r.totalFiles > 0 ? (r.passed / r.totalFiles * 100).toFixed(1) : "0";
167
+ if (e.push(`Total files: ${r.totalFiles}`), e.push(`Passed: ${r.passed} (${i}%)`), e.push(`Failed: ${r.failed}`), e.push(`Total time: ${r.totalTime.toFixed(2)}ms`), e.push(""), t) {
168
+ e.push("Results:"), e.push("-".repeat(50));
169
+ for (const s of r.results) {
170
+ const n = s.success ? "[PASS]" : "[FAIL]", c = `(${s.compilationTime.toFixed(2)}ms)`;
171
+ if (e.push(`${n} ${s.filePath} ${c}`), !s.success && s.error) {
172
+ const a = s.line ? ` (line ${s.line}${s.column ? `:${s.column}` : ""})` : "";
173
+ e.push(` Error${a}: ${s.error}`);
174
+ }
175
+ }
176
+ } else if (r.failed > 0) {
177
+ e.push("Failures:"), e.push("-".repeat(50));
178
+ for (const s of r.results.filter((n) => !n.success))
179
+ if (e.push(`[FAIL] ${s.filePath}`), s.error) {
180
+ const n = s.line ? ` (line ${s.line}${s.column ? `:${s.column}` : ""})` : "";
181
+ e.push(` Error${n}: ${s.error}`);
182
+ }
183
+ }
184
+ return e.push(""), r.failed === 0 ? e.push("All MDX files compiled successfully!") : e.push(`${r.failed} file(s) failed to compile.`), e.push(""), e.join(`
185
+ `);
186
+ }
187
+ function B() {
188
+ return (r, t, e) => {
189
+ const i = e.success ? "✓" : "✗", s = (r / t * 100).toFixed(0);
190
+ process.stdout.write(`\r[${r}/${t}] (${s}%) ${i} ${e.filePath}`), process.stdout.write("\x1B[K"), r === t && process.stdout.write(`
191
+ `);
192
+ };
193
+ }
194
+ export {
195
+ L as compileMdx,
196
+ B as createProgressReporter,
197
+ X as formatTestReport,
198
+ C as getDefaultRehypePlugins,
199
+ S as getDefaultRemarkPlugins,
200
+ O as testManifestMdx
201
+ };
package/dist/types.d.ts CHANGED
@@ -107,6 +107,8 @@ export interface BreadcrumbItem {
107
107
  slug: string;
108
108
  /** Full path from root */
109
109
  path: string;
110
+ /** Path to MDX file (indicates this item has an actual page) */
111
+ file?: string;
110
112
  }
111
113
  /**
112
114
  * Flattened navigation node with full path information
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAE/C;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,WAAW,EAAE,CAAC,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC,EAAE,CAAA;IACjE,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,YA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AI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAA;IACb,iCAAiC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,0EAA0E;IAC1E,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,QAAQ,CAAC,EAAE,mBAAmB,EAAE,CAAA;IAChC,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,2EAA2E;IAC3E,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAA;IACV,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,iDAAiD;IACjD,cAAc,EAAE,cAAc,CAAA;IAC9B,sEAAsE;IACtE,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC,0CAA0C;IAC1C,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,kFAAkF;IAClF,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB"}
@@ -153,4 +153,5 @@ Welcome to My Plugin documentation!
153
153
  - [Creating a Docs Package](./creating-a-docs-package.md) - Complete guide to building a documentation package
154
154
  - [Manifest Reference](./manifest-reference.md) - Full API documentation for manifest configuration
155
155
  - [Frontmatter Reference](./frontmatter-reference.md) - All available frontmatter options
156
+ - [MDX Testing](./mdx-testing.md) - Validate MDX files before publishing
156
157
  - [Publishing](./publishing.md) - How to publish and integrate with vendure.io
@@ -88,10 +88,10 @@ An inline link component that automatically prefixes relative URLs with the curr
88
88
 
89
89
  #### Props
90
90
 
91
- | Prop | Type | Required | Description |
92
- | ---------- | ----------- | -------- | ------------------------------------------------------ |
93
- | `href` | `string` | Yes | URL to navigate to (relative paths will be prefixed) |
94
- | `children` | `ReactNode` | Yes | Link text content |
91
+ | Prop | Type | Required | Description |
92
+ | ---------- | ----------- | -------- | ---------------------------------------------------- |
93
+ | `href` | `string` | Yes | URL to navigate to (relative paths will be prefixed) |
94
+ | `children` | `ReactNode` | Yes | Link text content |
95
95
 
96
96
  #### Example
97
97
 
@@ -0,0 +1,423 @@
1
+ # MDX Compilation Testing
2
+
3
+ `@vendure-io/docs-provider` includes a testing module that allows you to validate MDX files **before publishing** your documentation package. This catches compilation errors early, reducing the feedback loop between publishing and discovering issues.
4
+
5
+ ## Why Test MDX Files?
6
+
7
+ MDX compilation errors only surface when the documentation website attempts to render your pages. Without pre-publish testing, this creates a slow feedback loop:
8
+
9
+ 1. Write MDX content
10
+ 2. Publish package to npm
11
+ 3. Update docs website dependency
12
+ 4. Build docs website
13
+ 5. Discover compilation errors
14
+ 6. Fix and repeat
15
+
16
+ The testing module lets you catch errors at step 1, before any publishing occurs.
17
+
18
+ ## Installation
19
+
20
+ The testing module is included in `@vendure-io/docs-provider`. No additional installation is required, but ensure you have the package installed:
21
+
22
+ ```bash
23
+ npm install @vendure-io/docs-provider
24
+ # or
25
+ bun add @vendure-io/docs-provider
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ### Testing Your Manifest
31
+
32
+ The simplest way to test all MDX files in your documentation package:
33
+
34
+ ```typescript
35
+ import { manifest } from './src/manifest'
36
+ import { testManifestMdx, formatTestReport } from '@vendure-io/docs-provider/testing'
37
+
38
+ async function main() {
39
+ const report = await testManifestMdx(manifest)
40
+
41
+ console.log(formatTestReport(report))
42
+ process.exit(report.failed > 0 ? 1 : 0)
43
+ }
44
+
45
+ main()
46
+ ```
47
+
48
+ Save this as `scripts/test-mdx.ts` and run it:
49
+
50
+ ```bash
51
+ npx tsx scripts/test-mdx.ts
52
+ # or with bun
53
+ bun run scripts/test-mdx.ts
54
+ ```
55
+
56
+ ### Adding to package.json
57
+
58
+ Add a script to your `package.json` for easy execution:
59
+
60
+ ```json
61
+ {
62
+ "scripts": {
63
+ "test:mdx": "tsx scripts/test-mdx.ts",
64
+ "prepublishOnly": "npm run test:mdx"
65
+ }
66
+ }
67
+ ```
68
+
69
+ The `prepublishOnly` script ensures MDX validation runs before every npm publish.
70
+
71
+ ## API Reference
72
+
73
+ ### testManifestMdx
74
+
75
+ Tests all MDX files referenced in a manifest's navigation tree.
76
+
77
+ ```typescript
78
+ async function testManifestMdx(
79
+ manifest: DocsPackageManifest,
80
+ options?: TestManifestOptions
81
+ ): Promise<MdxTestReport>
82
+ ```
83
+
84
+ **Parameters:**
85
+
86
+ - `manifest` - The documentation package manifest to test (must contain absolute file paths)
87
+ - `options` - Optional configuration (see below)
88
+
89
+ **Options:**
90
+
91
+ | Option | Type | Default | Description |
92
+ |--------|------|---------|-------------|
93
+ | `failFast` | `boolean` | `false` | Stop on first failure |
94
+ | `remarkPlugins` | `PluggableList` | Default plugins | Custom remark plugins |
95
+ | `rehypePlugins` | `PluggableList` | Default plugins | Custom rehype plugins |
96
+ | `onProgress` | `Function` | `undefined` | Progress callback |
97
+
98
+ **Example with progress reporting:**
99
+
100
+ ```typescript
101
+ const report = await testManifestMdx(manifest, {
102
+ onProgress: (current, total, result) => {
103
+ const status = result.success ? '✓' : '✗'
104
+ console.log(`[${current}/${total}] ${status} ${result.filePath}`)
105
+ },
106
+ })
107
+ ```
108
+
109
+ ### compileMdx
110
+
111
+ Compiles a single MDX string and returns the result.
112
+
113
+ ```typescript
114
+ async function compileMdx(
115
+ content: string,
116
+ filePath: string,
117
+ options?: CompileMdxOptions
118
+ ): Promise<MdxCompilationResult>
119
+ ```
120
+
121
+ **Example:**
122
+
123
+ ```typescript
124
+ import { compileMdx } from '@vendure-io/docs-provider/testing'
125
+
126
+ const content = `
127
+ ---
128
+ title: Test Page
129
+ ---
130
+
131
+ # Hello World
132
+
133
+ This is a test.
134
+ `
135
+
136
+ const result = await compileMdx(content, 'test.mdx')
137
+
138
+ if (result.success) {
139
+ console.log('Compilation successful!')
140
+ } else {
141
+ console.error(`Error at line ${result.line}: ${result.error}`)
142
+ }
143
+ ```
144
+
145
+ ### formatTestReport
146
+
147
+ Formats a test report for console output.
148
+
149
+ ```typescript
150
+ function formatTestReport(report: MdxTestReport, verbose?: boolean): string
151
+ ```
152
+
153
+ **Parameters:**
154
+
155
+ - `report` - The test report to format
156
+ - `verbose` - If `true`, shows all results. If `false`, only shows failures.
157
+
158
+ **Example output (verbose):**
159
+
160
+ ```
161
+ MDX Compilation Report: my-plugin
162
+ ==================================================
163
+
164
+ Total files: 5
165
+ Passed: 4 (80.0%)
166
+ Failed: 1
167
+ Total time: 156.32ms
168
+
169
+ Results:
170
+ --------------------------------------------------
171
+ [PASS] docs/getting-started.mdx (45.21ms)
172
+ [PASS] docs/installation.mdx (32.11ms)
173
+ [PASS] docs/configuration.mdx (28.54ms)
174
+ [PASS] docs/api-reference.mdx (35.67ms)
175
+ [FAIL] docs/advanced.mdx (14.79ms)
176
+ Error (line 42:15): Unexpected token
177
+
178
+ 1 file(s) failed to compile.
179
+ ```
180
+
181
+ ### createProgressReporter
182
+
183
+ Creates a simple progress reporter for console output.
184
+
185
+ ```typescript
186
+ function createProgressReporter(): (
187
+ current: number,
188
+ total: number,
189
+ result: MdxCompilationResult
190
+ ) => void
191
+ ```
192
+
193
+ **Example:**
194
+
195
+ ```typescript
196
+ import { testManifestMdx, createProgressReporter } from '@vendure-io/docs-provider/testing'
197
+
198
+ const report = await testManifestMdx(manifest, {
199
+ onProgress: createProgressReporter(),
200
+ })
201
+ ```
202
+
203
+ ### getDefaultRemarkPlugins / getDefaultRehypePlugins
204
+
205
+ Get the default plugins used for MDX compilation. Useful for extending the plugin list.
206
+
207
+ ```typescript
208
+ function getDefaultRemarkPlugins(): PluggableList
209
+ function getDefaultRehypePlugins(): PluggableList
210
+ ```
211
+
212
+ **Example (extending plugins):**
213
+
214
+ ```typescript
215
+ import {
216
+ testManifestMdx,
217
+ getDefaultRemarkPlugins,
218
+ getDefaultRehypePlugins,
219
+ } from '@vendure-io/docs-provider/testing'
220
+ import myCustomPlugin from './my-plugin'
221
+
222
+ const report = await testManifestMdx(manifest, {
223
+ remarkPlugins: [...getDefaultRemarkPlugins(), myCustomPlugin],
224
+ rehypePlugins: getDefaultRehypePlugins(),
225
+ })
226
+ ```
227
+
228
+ ## Types
229
+
230
+ ### MdxCompilationResult
231
+
232
+ ```typescript
233
+ interface MdxCompilationResult {
234
+ /** Path to the MDX file that was compiled */
235
+ filePath: string
236
+ /** Whether compilation was successful */
237
+ success: boolean
238
+ /** Error message if compilation failed */
239
+ error?: string
240
+ /** Line number where the error occurred */
241
+ line?: number
242
+ /** Column number where the error occurred */
243
+ column?: number
244
+ /** Time taken to compile in milliseconds */
245
+ compilationTime: number
246
+ }
247
+ ```
248
+
249
+ ### MdxTestReport
250
+
251
+ ```typescript
252
+ interface MdxTestReport {
253
+ /** Package ID from the manifest */
254
+ packageId: string
255
+ /** Total number of MDX files tested */
256
+ totalFiles: number
257
+ /** Number of files that compiled successfully */
258
+ passed: number
259
+ /** Number of files that failed to compile */
260
+ failed: number
261
+ /** Individual results for each file */
262
+ results: MdxCompilationResult[]
263
+ /** Total time taken in milliseconds */
264
+ totalTime: number
265
+ }
266
+ ```
267
+
268
+ ## Integration with Vitest
269
+
270
+ You can integrate MDX testing into your existing test suite:
271
+
272
+ ```typescript
273
+ // tests/mdx-compilation.test.ts
274
+ import { describe, it, expect } from 'vitest'
275
+ import { manifest } from '../src/manifest'
276
+ import { testManifestMdx } from '@vendure-io/docs-provider/testing'
277
+
278
+ describe('MDX Compilation', () => {
279
+ it('should compile all MDX files without errors', async () => {
280
+ const report = await testManifestMdx(manifest)
281
+
282
+ expect(report.failed).toBe(0)
283
+ }, 30000) // Increase timeout for large doc sets
284
+ })
285
+ ```
286
+
287
+ ## Supported MDX Features
288
+
289
+ The testing module uses the same remark/rehype plugins as the Vendure documentation website:
290
+
291
+ ### Admonitions
292
+
293
+ ```mdx
294
+ :::info
295
+ This is an info callout.
296
+ :::
297
+
298
+ :::warning Custom Title
299
+ This is a warning with a custom title.
300
+ :::
301
+ ```
302
+
303
+ Supported types: `info`, `note`, `tip`, `warning`, `caution`, `danger`
304
+
305
+ ### Code Fence Metadata
306
+
307
+ ```mdx
308
+ ```typescript title="src/example.ts"
309
+ export function example() {
310
+ return 'Hello'
311
+ }
312
+ ```
313
+ ```
314
+
315
+ ### GitHub Flavored Markdown
316
+
317
+ - Tables
318
+ - Task lists
319
+ - Strikethrough
320
+ - Autolinks
321
+
322
+ ### JSX Components
323
+
324
+ ```mdx
325
+ <Callout type="info" title="Note">
326
+ Custom JSX components work as expected.
327
+ </Callout>
328
+ ```
329
+
330
+ ## Common Errors
331
+
332
+ ### Unclosed JSX Tags
333
+
334
+ ```
335
+ Error (line 15): Expected closing tag for `<div>`
336
+ ```
337
+
338
+ Ensure all JSX tags are properly closed:
339
+
340
+ ```mdx
341
+ <!-- Wrong -->
342
+ <div>
343
+ Content here
344
+
345
+ <!-- Correct -->
346
+ <div>
347
+ Content here
348
+ </div>
349
+ ```
350
+
351
+ ### Invalid JSX Syntax
352
+
353
+ ```
354
+ Error (line 8:5): Unexpected token
355
+ ```
356
+
357
+ Check for:
358
+ - Missing quotes around attribute values
359
+ - Unescaped special characters (`<`, `>`, `{`, `}`)
360
+ - JavaScript expressions not wrapped in curly braces
361
+
362
+ ### Missing Frontmatter
363
+
364
+ While the MDX compiler doesn't require frontmatter, the docs website does. Ensure all files have at least a `title`:
365
+
366
+ ```mdx
367
+ ---
368
+ title: My Page Title
369
+ ---
370
+
371
+ # Content
372
+ ```
373
+
374
+ ## Best Practices
375
+
376
+ 1. **Run tests before commits**: Add MDX testing to your pre-commit hooks
377
+ 2. **Use CI/CD**: Include MDX testing in your continuous integration pipeline
378
+ 3. **Test incrementally**: Use `failFast: true` during development for faster feedback
379
+ 4. **Verbose output for debugging**: Use `formatTestReport(report, true)` when troubleshooting
380
+
381
+ ## Example: Complete Test Script
382
+
383
+ Here's a complete test script with all features:
384
+
385
+ ```typescript
386
+ // scripts/test-mdx.ts
387
+ import { manifest } from '../src/manifest'
388
+ import {
389
+ testManifestMdx,
390
+ formatTestReport,
391
+ createProgressReporter,
392
+ } from '@vendure-io/docs-provider/testing'
393
+
394
+ async function main() {
395
+ console.log('Testing MDX files...\n')
396
+
397
+ const report = await testManifestMdx(manifest, {
398
+ onProgress: createProgressReporter(),
399
+ })
400
+
401
+ console.log('\n')
402
+ console.log(formatTestReport(report, process.argv.includes('--verbose')))
403
+
404
+ if (report.failed > 0) {
405
+ process.exit(1)
406
+ }
407
+ }
408
+
409
+ main().catch((error) => {
410
+ console.error('Test runner error:', error)
411
+ process.exit(1)
412
+ })
413
+ ```
414
+
415
+ Run with:
416
+
417
+ ```bash
418
+ # Standard output
419
+ bun run scripts/test-mdx.ts
420
+
421
+ # Verbose output showing all results
422
+ bun run scripts/test-mdx.ts --verbose
423
+ ```
@@ -319,6 +319,7 @@ Before publishing, verify:
319
319
  - [ ] All file paths resolve correctly
320
320
  - [ ] All MDX files have valid frontmatter
321
321
  - [ ] All MDX files have at least a `title` in frontmatter
322
+ - [ ] All MDX files compile successfully (see [MDX Testing](./mdx-testing.md))
322
323
  - [ ] `package.json` includes `src` and `docs` in `files`
323
324
  - [ ] `package.json` has correct exports configuration
324
325
  - [ ] Manifest validation passes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vendure-io/docs-provider",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Contract types and utilities for Vendure documentation packages",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -36,6 +36,16 @@
36
36
  "types": "./dist/loader.d.ts",
37
37
  "default": "./dist/loader.js"
38
38
  }
39
+ },
40
+ "./testing": {
41
+ "import": {
42
+ "types": "./dist/testing/index.d.ts",
43
+ "default": "./dist/testing.js"
44
+ },
45
+ "require": {
46
+ "types": "./dist/testing/index.d.ts",
47
+ "default": "./dist/testing.cjs"
48
+ }
39
49
  }
40
50
  },
41
51
  "files": [
@@ -53,11 +63,20 @@
53
63
  "publish:local": "bun run build && npm publish --registry http://localhost:4873"
54
64
  },
55
65
  "dependencies": {
66
+ "@mdx-js/mdx": "^3.0.0",
56
67
  "gray-matter": "^4.0.3",
68
+ "rehype-slug": "^6.0.0",
69
+ "remark-directive": "^4.0.0",
70
+ "remark-gfm": "^4.0.1",
71
+ "unist-util-visit": "^5.0.0",
57
72
  "zod": "^3.24.2"
58
73
  },
59
74
  "devDependencies": {
75
+ "@types/mdast": "^4.0.4",
60
76
  "ajv": "^8.17.1",
77
+ "mdast-util-directive": "^3.1.0",
78
+ "mdast-util-mdx": "^3.0.0",
79
+ "unified": "^11.0.5",
61
80
  "vite": "^6.0.0",
62
81
  "vite-plugin-dts": "^4.5.4",
63
82
  "vitest": "^3.0.0"