@vendure-io/docs-provider 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.cjs +1 -1
- package/dist/loader.js +1 -1
- package/dist/{manifest-B1CxKK1i.js → manifest-BJ3t6hu2.js} +15 -14
- package/dist/{manifest-D2yANQB-.cjs → manifest-CNnJGNwK.cjs} +1 -1
- package/dist/mdx-components.d.ts +160 -0
- package/dist/mdx-components.d.ts.map +1 -0
- package/dist/schema.d.ts +10 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/creating-a-docs-package.md +61 -0
- package/docs/manifest-reference.md +3 -0
- package/docs/mdx-components-reference.md +347 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,7 @@ Contract types and utilities for Vendure documentation packages. This package de
|
|
|
8
8
|
- [Creating a Docs Package](./docs/creating-a-docs-package.md) - Step-by-step guide to building a documentation package
|
|
9
9
|
- [Manifest Reference](./docs/manifest-reference.md) - Complete API documentation for manifest types and utilities
|
|
10
10
|
- [Frontmatter Reference](./docs/frontmatter-reference.md) - All available MDX frontmatter options
|
|
11
|
+
- [MDX Components Reference](./docs/mdx-components-reference.md) - Available MDX components for reference documentation
|
|
11
12
|
- [Publishing](./docs/publishing.md) - How to publish and integrate with vendure.io
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
@@ -171,6 +172,17 @@ if (hasFrontmatter(mdxContent)) {
|
|
|
171
172
|
| `LoadedDocsPackage` | Result of loading a docs package |
|
|
172
173
|
| `GitHubConfig` | GitHub repository configuration for edit links |
|
|
173
174
|
|
|
175
|
+
### MDX Component Props
|
|
176
|
+
|
|
177
|
+
| Type | Description |
|
|
178
|
+
| -------------------------- | --------------------------------------- |
|
|
179
|
+
| `GenerationInfoProps` | Props for GenerationInfo component |
|
|
180
|
+
| `MemberInfoProps` | Props for MemberInfo component |
|
|
181
|
+
| `MemberDescriptionProps` | Props for MemberDescription component |
|
|
182
|
+
| `CustomFieldPropertyProps` | Props for CustomFieldProperty component |
|
|
183
|
+
| `StackblitzProps` | Props for Stackblitz component |
|
|
184
|
+
| `MdxComponentProps` | Union type of all MDX component props |
|
|
185
|
+
|
|
174
186
|
### Schemas (Zod)
|
|
175
187
|
|
|
176
188
|
All types have corresponding Zod schemas for runtime validation:
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./manifest-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./manifest-CNnJGNwK.cjs");function i(o){const a=[];return r(o.navigation,a),a}function r(o,a){for(const t of o)t.file&&a.push(t.file),t.children&&r(t.children,a)}exports.BreadcrumbItemSchema=e.BreadcrumbItemSchema;exports.DocPageMetaSchema=e.DocPageMetaSchema;exports.DocPageSchema=e.DocPageSchema;exports.DocsPackageManifestSchema=e.DocsPackageManifestSchema;exports.FlatNavigationNodeSchema=e.FlatNavigationNodeSchema;exports.FrontmatterParseError=e.FrontmatterParseError;exports.GitHubConfigSchema=e.GitHubConfigSchema;exports.LoadedDocsPackageSchema=e.LoadedDocsPackageSchema;exports.ManifestValidationError=e.ManifestValidationError;exports.NavigationNodeSchema=e.NavigationNodeSchema;exports.SearchConfigSchema=e.SearchConfigSchema;exports.VendureVersionSchema=e.VendureVersionSchema;exports.buildBreadcrumbs=e.buildBreadcrumbs;exports.extractFrontmatterData=e.extractFrontmatterData;exports.findNavigationNode=e.findNavigationNode;exports.flattenNavigation=e.flattenNavigation;exports.getLeafNodes=e.getLeafNodes;exports.getNodesAtDepth=e.getNodesAtDepth;exports.getPrevNextNodes=e.getPrevNextNodes;exports.hasFrontmatter=e.hasFrontmatter;exports.isNodeActive=e.isNodeActive;exports.parseFrontmatter=e.parseFrontmatter;exports.validateFrontmatter=e.validateFrontmatter;exports.validateManifest=e.validateManifest;exports.getAllFilePaths=i;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ export { FrontmatterParseError, extractFrontmatterData, hasFrontmatter, parseFro
|
|
|
4
4
|
export type { ParsedFrontmatter } from './frontmatter';
|
|
5
5
|
export { ManifestValidationError, buildBreadcrumbs, findNavigationNode, flattenNavigation, getLeafNodes, getNodesAtDepth, getPrevNextNodes, isNodeActive, validateManifest, } from './manifest';
|
|
6
6
|
export { getAllFilePaths } from './navigation-utils';
|
|
7
|
+
export type { CustomFieldPropertyProps, GenerationInfoProps, GraphQLDocProps, MdxComponentProps, MemberDescriptionProps, MemberInfoProps, StackblitzProps, } from './mdx-components';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAA;AAGhB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,UAAU,CAAA;AAGjB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,cAAc,EACd,OAAO,EACP,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,cAAc,GACf,MAAM,SAAS,CAAA;AAGhB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,UAAU,CAAA;AAGjB,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAGpD,YAAY,EACV,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,eAAe,GAChB,MAAM,kBAAkB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as n, D as c, a as d, b as m, F as h, c as f, G as l, L as g, M as N, N as S, S as v, V as u, d as F, e as P, f as D, g as p, i as b, j as M, k as x, h as V, l as k, p as A, v as B, m as L } from "./manifest-
|
|
1
|
+
import { B as n, D as c, a as d, b as m, F as h, c as f, G as l, L as g, M as N, N as S, S as v, V as u, d as F, e as P, f as D, g as p, i as b, j as M, k as x, h as V, l as k, p as A, v as B, m as L } from "./manifest-BJ3t6hu2.js";
|
|
2
2
|
function o(t) {
|
|
3
3
|
const a = [];
|
|
4
4
|
return s(t.navigation, a), a;
|
package/dist/loader.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var h=(e,r,t)=>r in e?g(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var i=(e,r,t)=>h(e,typeof r!="symbol"?r+"":r,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("fs/promises"),m=require("module"),u=require("./manifest-
|
|
1
|
+
"use strict";var g=Object.defineProperty;var h=(e,r,t)=>r in e?g(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var i=(e,r,t)=>h(e,typeof r!="symbol"?r+"":r,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("fs/promises"),m=require("module"),u=require("./manifest-CNnJGNwK.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 p(e,r={}){try{const t=r.resolver?await r.resolver(e):l(e),n=await import(e);if(!n.manifest)throw new a(`Package "${e}" does not export a manifest`,e);return{manifest:u.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 l(e){try{return m.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 d(e,r){try{const t=`${e.basePath}/${r}`,n=await P.readFile(t,"utf-8"),{meta:o,content:s}=u.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 $(e,r){const t=f(e.manifest.navigation,r.split("/"));if(t!=null&&t.file)return d(e,t.file)}function f(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 f(o.children,n)}}function v(e,r){if(r.file)return`${e.basePath}/${r.file}`}function y(e){try{return l(e),!0}catch{return!1}}exports.DocsPackageLoadError=a;exports.isDocsPackageInstalled=y;exports.loadDocPage=d;exports.loadDocPageBySlug=$;exports.loadDocsPackage=p;exports.resolveFilePath=v;
|
package/dist/loader.js
CHANGED
|
@@ -3,7 +3,7 @@ var l = (t, e, r) => e in t ? f(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 { m as g, p as m } from "./manifest-
|
|
6
|
+
import { m as g, p as m } from "./manifest-BJ3t6hu2.js";
|
|
7
7
|
class a extends Error {
|
|
8
8
|
constructor(r, n) {
|
|
9
9
|
super(r);
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
var N = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var l = (r, e, n) =>
|
|
4
|
-
import
|
|
2
|
+
var P = (r, e, n) => e in r ? N(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var l = (r, e, n) => P(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import u from "gray-matter";
|
|
5
5
|
import { z as t } from "zod";
|
|
6
|
-
const
|
|
6
|
+
const S = t.enum(["v1", "v2", "v3"]), j = t.object({
|
|
7
7
|
indexFields: t.array(t.enum(["title", "description", "content", "keywords"])),
|
|
8
8
|
boosts: t.record(t.string(), t.number()).optional()
|
|
9
9
|
}), $ = t.object({
|
|
10
10
|
repository: t.string().regex(/^[^/]+\/[^/]+$/, 'Repository must be in format "owner/repo"'),
|
|
11
11
|
branch: t.string().optional(),
|
|
12
12
|
docsPath: t.string().optional()
|
|
13
|
-
}),
|
|
13
|
+
}), g = t.lazy(
|
|
14
14
|
() => t.object({
|
|
15
15
|
title: t.string().min(1, "Navigation title is required"),
|
|
16
16
|
slug: t.string().min(1, "Navigation slug is required"),
|
|
17
17
|
file: t.string().optional(),
|
|
18
|
-
children: t.array(
|
|
18
|
+
children: t.array(g).optional(),
|
|
19
19
|
badge: t.string().optional()
|
|
20
20
|
})
|
|
21
21
|
), f = t.object({
|
|
22
22
|
id: t.string().min(1, "Package ID is required"),
|
|
23
23
|
name: t.string().min(1, "Package name is required"),
|
|
24
24
|
version: t.string().regex(/^\d+\.\d+\.\d+/, "Version must be valid semver"),
|
|
25
|
-
vendureVersion:
|
|
26
|
-
navigation: t.array(
|
|
25
|
+
vendureVersion: S,
|
|
26
|
+
navigation: t.array(g),
|
|
27
27
|
search: j.optional(),
|
|
28
|
-
github: $.optional()
|
|
28
|
+
github: $.optional(),
|
|
29
|
+
basePath: t.string().optional()
|
|
29
30
|
}), m = t.object({
|
|
30
31
|
title: t.string().min(1, "Page title is required"),
|
|
31
32
|
description: t.string().optional(),
|
|
@@ -47,7 +48,7 @@ const P = t.enum(["v1", "v2", "v3"]), j = t.object({
|
|
|
47
48
|
title: t.string(),
|
|
48
49
|
slug: t.string(),
|
|
49
50
|
file: t.string().optional(),
|
|
50
|
-
children: t.array(t.lazy(() =>
|
|
51
|
+
children: t.array(t.lazy(() => g)).optional(),
|
|
51
52
|
badge: t.string().optional(),
|
|
52
53
|
path: t.string(),
|
|
53
54
|
depth: t.number().int().min(0),
|
|
@@ -63,7 +64,7 @@ class d extends Error {
|
|
|
63
64
|
}
|
|
64
65
|
function q(r, e) {
|
|
65
66
|
try {
|
|
66
|
-
const { data: n, content: i } =
|
|
67
|
+
const { data: n, content: i } = u(r);
|
|
67
68
|
return {
|
|
68
69
|
meta: y(n, e),
|
|
69
70
|
content: i.trim()
|
|
@@ -94,7 +95,7 @@ function L(r) {
|
|
|
94
95
|
return r.trimStart().startsWith("---");
|
|
95
96
|
}
|
|
96
97
|
function z(r) {
|
|
97
|
-
const { data: e } =
|
|
98
|
+
const { data: e } = u(r);
|
|
98
99
|
return e;
|
|
99
100
|
}
|
|
100
101
|
class x extends Error {
|
|
@@ -186,9 +187,9 @@ export {
|
|
|
186
187
|
$ as G,
|
|
187
188
|
B as L,
|
|
188
189
|
x as M,
|
|
189
|
-
|
|
190
|
+
g as N,
|
|
190
191
|
j as S,
|
|
191
|
-
|
|
192
|
+
S as V,
|
|
192
193
|
M as a,
|
|
193
194
|
f as b,
|
|
194
195
|
d as c,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var D=(r,e,n)=>e in r?y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var d=(r,e,n)=>D(r,typeof e!="symbol"?e+"":e,n);const h=require("gray-matter"),t=require("zod"),z=t.z.enum(["v1","v2","v3"]),p=t.z.object({indexFields:t.z.array(t.z.enum(["title","description","content","keywords"])),boosts:t.z.record(t.z.string(),t.z.number()).optional()}),v=t.z.object({repository:t.z.string().regex(/^[^/]+\/[^/]+$/,'Repository must be in format "owner/repo"'),branch:t.z.string().optional(),docsPath:t.z.string().optional()}),g=t.z.lazy(()=>t.z.object({title:t.z.string().min(1,"Navigation title is required"),slug:t.z.string().min(1,"Navigation slug is required"),file:t.z.string().optional(),children:t.z.array(g).optional(),badge:t.z.string().optional()})),u=t.z.object({id:t.z.string().min(1,"Package ID is required"),name:t.z.string().min(1,"Package name is required"),version:t.z.string().regex(/^\d+\.\d+\.\d+/,"Version must be valid semver"),vendureVersion:z,navigation:t.z.array(g),search:p.optional(),github:v.optional()}),m=t.z.object({title:t.z.string().min(1,"Page title is required"),description:t.z.string().optional(),keywords:t.z.array(t.z.string()).optional(),sidebarLabel:t.z.string().optional(),hidden:t.z.boolean().optional()}),x=t.z.object({meta:m,content:t.z.string(),filePath:t.z.string()}),M=t.z.object({manifest:u,basePath:t.z.string()}),w=t.z.object({title:t.z.string(),slug:t.z.string(),path:t.z.string()}),E=t.z.object({title:t.z.string(),slug:t.z.string(),file:t.z.string().optional(),children:t.z.array(t.z.lazy(()=>g)).optional(),badge:t.z.string().optional(),path:t.z.string(),depth:t.z.number().int().min(0),parentPath:t.z.string().optional()});class l extends Error{constructor(n,i,a){super(n);d(this,"filePath");d(this,"originalError");this.name="FrontmatterParseError",this.filePath=i,this.originalError=a}}function k(r,e){try{const{data:n,content:i}=h(r);return{meta:b(n,e),content:i.trim()}}catch(n){throw n instanceof l?n:new l(`Failed to parse frontmatter${e?` in ${e}`:""}`,e,n)}}function b(r,e){const n=m.safeParse(r);if(!n.success){const i=n.error.issues.map(a=>` - ${a.path.join(".")}: ${a.message}`).join(`
|
|
1
|
+
"use strict";var y=Object.defineProperty;var D=(r,e,n)=>e in r?y(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var d=(r,e,n)=>D(r,typeof e!="symbol"?e+"":e,n);const h=require("gray-matter"),t=require("zod"),z=t.z.enum(["v1","v2","v3"]),p=t.z.object({indexFields:t.z.array(t.z.enum(["title","description","content","keywords"])),boosts:t.z.record(t.z.string(),t.z.number()).optional()}),v=t.z.object({repository:t.z.string().regex(/^[^/]+\/[^/]+$/,'Repository must be in format "owner/repo"'),branch:t.z.string().optional(),docsPath:t.z.string().optional()}),g=t.z.lazy(()=>t.z.object({title:t.z.string().min(1,"Navigation title is required"),slug:t.z.string().min(1,"Navigation slug is required"),file:t.z.string().optional(),children:t.z.array(g).optional(),badge:t.z.string().optional()})),u=t.z.object({id:t.z.string().min(1,"Package ID is required"),name:t.z.string().min(1,"Package name is required"),version:t.z.string().regex(/^\d+\.\d+\.\d+/,"Version must be valid semver"),vendureVersion:z,navigation:t.z.array(g),search:p.optional(),github:v.optional(),basePath:t.z.string().optional()}),m=t.z.object({title:t.z.string().min(1,"Page title is required"),description:t.z.string().optional(),keywords:t.z.array(t.z.string()).optional(),sidebarLabel:t.z.string().optional(),hidden:t.z.boolean().optional()}),x=t.z.object({meta:m,content:t.z.string(),filePath:t.z.string()}),M=t.z.object({manifest:u,basePath:t.z.string()}),w=t.z.object({title:t.z.string(),slug:t.z.string(),path:t.z.string()}),E=t.z.object({title:t.z.string(),slug:t.z.string(),file:t.z.string().optional(),children:t.z.array(t.z.lazy(()=>g)).optional(),badge:t.z.string().optional(),path:t.z.string(),depth:t.z.number().int().min(0),parentPath:t.z.string().optional()});class l extends Error{constructor(n,i,a){super(n);d(this,"filePath");d(this,"originalError");this.name="FrontmatterParseError",this.filePath=i,this.originalError=a}}function k(r,e){try{const{data:n,content:i}=h(r);return{meta:b(n,e),content:i.trim()}}catch(n){throw n instanceof l?n:new l(`Failed to parse frontmatter${e?` in ${e}`:""}`,e,n)}}function b(r,e){const n=m.safeParse(r);if(!n.success){const i=n.error.issues.map(a=>` - ${a.path.join(".")}: ${a.message}`).join(`
|
|
2
2
|
`);throw new l(`Invalid frontmatter${e?` in ${e}`:""}:
|
|
3
3
|
${i}`,e,n.error)}return n.data}function V(r){return r.trimStart().startsWith("---")}function B(r){const{data:e}=h(r);return e}class N extends Error{constructor(n,i){super(n);d(this,"issues");this.name="ManifestValidationError",this.issues=i}}function q(r){const e=u.safeParse(r);if(!e.success){const n=e.error.issues.map(i=>`${i.path.join(".")}: ${i.message}`);throw new N("Invalid manifest",n)}return e.data}function I(r,e){const n=e.split("/").filter(Boolean);return S(r.navigation,n)}function S(r,e){if(e.length===0)return;const[n,...i]=e,a=r.find(o=>o.slug===n);if(a){if(i.length===0)return a;if(a.children)return S(a.children,i)}}function f(r){const e=[];return P(r.navigation,"",0,void 0,e),e}function P(r,e,n,i,a){for(const o of r){const s=e?`${e}/${o.slug}`:o.slug;a.push({...o,path:s,depth:n,parentPath:i}),o.children&&o.children.length>0&&P(o.children,s,n+1,s,a)}}function L(r,e){const n=e.split("/").filter(Boolean),i=[];let a=r.navigation,o="";for(const s of n){const c=a.find(j=>j.slug===s);if(!c)break;o=o?`${o}/${s}`:s,i.push({title:c.title,slug:c.slug,path:o}),a=c.children??[]}return i}function F(r){return f(r).filter(e=>e.file!==void 0)}function A(r,e){const n=F(r),i=n.findIndex(a=>a.path===e);return i===-1?{}:{prev:i>0?n[i-1]:void 0,next:i<n.length-1?n[i+1]:void 0}}function $(r,e){const n=e.split("/").filter(Boolean);if(n.length===0)return!1;if(r.slug===n[0]){if(n.length===1)return!0;if(r.children){const i=n.slice(1).join("/");return r.children.some(a=>$(a,i))}}return!1}function C(r,e){return f(r).filter(n=>n.depth===e)}exports.BreadcrumbItemSchema=w;exports.DocPageMetaSchema=m;exports.DocPageSchema=x;exports.DocsPackageManifestSchema=u;exports.FlatNavigationNodeSchema=E;exports.FrontmatterParseError=l;exports.GitHubConfigSchema=v;exports.LoadedDocsPackageSchema=M;exports.ManifestValidationError=N;exports.NavigationNodeSchema=g;exports.SearchConfigSchema=p;exports.VendureVersionSchema=z;exports.buildBreadcrumbs=L;exports.extractFrontmatterData=B;exports.findNavigationNode=I;exports.flattenNavigation=f;exports.getLeafNodes=F;exports.getNodesAtDepth=C;exports.getPrevNextNodes=A;exports.hasFrontmatter=V;exports.isNodeActive=$;exports.parseFrontmatter=k;exports.validateFrontmatter=b;exports.validateManifest=q;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MDX Component Contract Types
|
|
3
|
+
*
|
|
4
|
+
* This file defines TypeScript interfaces for MDX components used in Vendure documentation.
|
|
5
|
+
* These contracts are framework-agnostic (no React dependency) and define the expected
|
|
6
|
+
* props for each component.
|
|
7
|
+
*
|
|
8
|
+
* The actual React implementations live in `apps/docs/src/components/mdx/`.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* GenerationInfo Component
|
|
12
|
+
*
|
|
13
|
+
* Displays package metadata with NPM and GitHub source links.
|
|
14
|
+
* Typically shown at the top of reference documentation pages.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```mdx
|
|
18
|
+
* <GenerationInfo
|
|
19
|
+
* packageName="@vendure/core"
|
|
20
|
+
* sourceFile="src/entity/product.entity.ts"
|
|
21
|
+
* sourceLine={42}
|
|
22
|
+
* since="1.0.0"
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export interface GenerationInfoProps {
|
|
27
|
+
/** NPM package name (e.g., "@vendure/core") */
|
|
28
|
+
packageName: string;
|
|
29
|
+
/** Path to source file relative to package root */
|
|
30
|
+
sourceFile: string;
|
|
31
|
+
/** Line number in source file */
|
|
32
|
+
sourceLine: number;
|
|
33
|
+
/** Version when this API was introduced */
|
|
34
|
+
since?: string;
|
|
35
|
+
/** Mark as experimental API */
|
|
36
|
+
experimental?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* MemberInfo Component
|
|
40
|
+
*
|
|
41
|
+
* Displays type information for class/interface members.
|
|
42
|
+
* Used in TypeScript API reference documentation.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```mdx
|
|
46
|
+
* <MemberInfo
|
|
47
|
+
* kind="method"
|
|
48
|
+
* type={<>(<a href="/reference/ctx">RequestContext</a>) => Promise<Product></>}
|
|
49
|
+
* since="2.0.0"
|
|
50
|
+
* />
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export interface MemberInfoProps {
|
|
54
|
+
/** Member kind: method, property, getter, setter, constructor */
|
|
55
|
+
kind: 'method' | 'property' | 'getter' | 'setter' | 'constructor';
|
|
56
|
+
/** TypeScript type signature (accepts JSX with links) */
|
|
57
|
+
type: unknown;
|
|
58
|
+
/** Version when this member was introduced */
|
|
59
|
+
since?: string;
|
|
60
|
+
/** Mark as experimental API */
|
|
61
|
+
experimental?: boolean;
|
|
62
|
+
/** Default value (accepts JSX) */
|
|
63
|
+
default?: unknown;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* MemberDescription Component
|
|
67
|
+
*
|
|
68
|
+
* Simple wrapper for member descriptions in API reference documentation.
|
|
69
|
+
* Provides consistent styling for description content.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```mdx
|
|
73
|
+
* <MemberDescription>
|
|
74
|
+
* The `Product` entity represents items in your catalog.
|
|
75
|
+
* It includes pricing, variants, and inventory information.
|
|
76
|
+
* </MemberDescription>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export interface MemberDescriptionProps {
|
|
80
|
+
/** Description content (MDX/JSX) */
|
|
81
|
+
children: unknown;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* CustomFieldProperty Component
|
|
85
|
+
*
|
|
86
|
+
* Shows required/optional status and type information for custom fields.
|
|
87
|
+
* Used in custom field configuration documentation.
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```mdx
|
|
91
|
+
* <CustomFieldProperty required={true} type="string" typeLink="/reference/types/string" />
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export interface CustomFieldPropertyProps {
|
|
95
|
+
/** Whether the field is required */
|
|
96
|
+
required: boolean;
|
|
97
|
+
/** Type name to display */
|
|
98
|
+
type: string;
|
|
99
|
+
/** Optional link for the type */
|
|
100
|
+
typeLink?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Stackblitz Component
|
|
104
|
+
*
|
|
105
|
+
* Embeds a Stackblitz editor for interactive code examples.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```mdx
|
|
109
|
+
* <Stackblitz id="vendure-getting-started" />
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export interface StackblitzProps {
|
|
113
|
+
/** Stackblitz project ID */
|
|
114
|
+
id: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* GraphQLDoc Component
|
|
118
|
+
*
|
|
119
|
+
* Displays GraphQL schema definitions with syntax highlighting and clickable type links.
|
|
120
|
+
* Used in GraphQL API reference documentation.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```mdx
|
|
124
|
+
* <GraphQLDoc
|
|
125
|
+
* type="mutation"
|
|
126
|
+
* typeName="addCustomersToGroup"
|
|
127
|
+
* since="1.0.0"
|
|
128
|
+
* typeLinks={{
|
|
129
|
+
* "CustomerGroup": "/v3/vendure/reference/graphql-api/admin/customer-group",
|
|
130
|
+
* "ID": "/v3/vendure/reference/graphql-api/common/scalars#id"
|
|
131
|
+
* }}
|
|
132
|
+
* >
|
|
133
|
+
* {`"""
|
|
134
|
+
* Add Customers to a CustomerGroup
|
|
135
|
+
* """
|
|
136
|
+
* type Mutation {
|
|
137
|
+
* addCustomersToGroup(customerGroupId: ID!, customerIds: [ID!]!): CustomerGroup!
|
|
138
|
+
* }`}
|
|
139
|
+
* </GraphQLDoc>
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export interface GraphQLDocProps {
|
|
143
|
+
/** GraphQL definition kind */
|
|
144
|
+
type: 'mutation' | 'query' | 'subscription' | 'type' | 'input' | 'enum' | 'scalar' | 'interface' | 'union' | 'fragment';
|
|
145
|
+
/** The primary type/operation name */
|
|
146
|
+
typeName: string;
|
|
147
|
+
/** Version when this API was introduced */
|
|
148
|
+
since?: string;
|
|
149
|
+
/** Mark as deprecated */
|
|
150
|
+
deprecated?: boolean | string;
|
|
151
|
+
/** Map of type names to their documentation URLs. Only types in this map become clickable. */
|
|
152
|
+
typeLinks?: Record<string, string>;
|
|
153
|
+
/** GraphQL SDL content */
|
|
154
|
+
children: unknown;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Union type of all MDX component props for type checking
|
|
158
|
+
*/
|
|
159
|
+
export type MdxComponentProps = GenerationInfoProps | MemberInfoProps | MemberDescriptionProps | CustomFieldPropertyProps | StackblitzProps | GraphQLDocProps;
|
|
160
|
+
//# sourceMappingURL=mdx-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-components.d.ts","sourceRoot":"","sources":["../src/mdx-components.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,WAAW,EAAE,MAAM,CAAA;IACnB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,IAAI,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAAA;IACjE,yDAAyD;IACzD,IAAI,EAAE,OAAO,CAAA;IACb,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,+BAA+B;IAC/B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,kCAAkC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,sBAAsB;IACrC,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,wBAAwB;IACvC,oCAAoC;IACpC,QAAQ,EAAE,OAAO,CAAA;IACjB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,IAAI,EACA,UAAU,GACV,OAAO,GACP,cAAc,GACd,MAAM,GACN,OAAO,GACP,MAAM,GACN,QAAQ,GACR,WAAW,GACX,OAAO,GACP,UAAU,CAAA;IACd,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yBAAyB;IACzB,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC7B,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,0BAA0B;IAC1B,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,eAAe,GACf,sBAAsB,GACtB,wBAAwB,GACxB,eAAe,GACf,eAAe,CAAA"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export declare const DocsPackageManifestSchema: z.ZodObject<{
|
|
|
86
86
|
branch?: string | undefined;
|
|
87
87
|
docsPath?: string | undefined;
|
|
88
88
|
}>>;
|
|
89
|
+
basePath: z.ZodOptional<z.ZodString>;
|
|
89
90
|
}, "strip", z.ZodTypeAny, {
|
|
90
91
|
id: string;
|
|
91
92
|
name: string;
|
|
@@ -107,6 +108,7 @@ export declare const DocsPackageManifestSchema: z.ZodObject<{
|
|
|
107
108
|
branch?: string | undefined;
|
|
108
109
|
docsPath?: string | undefined;
|
|
109
110
|
} | undefined;
|
|
111
|
+
basePath?: string | undefined;
|
|
110
112
|
}, {
|
|
111
113
|
id: string;
|
|
112
114
|
name: string;
|
|
@@ -128,6 +130,7 @@ export declare const DocsPackageManifestSchema: z.ZodObject<{
|
|
|
128
130
|
branch?: string | undefined;
|
|
129
131
|
docsPath?: string | undefined;
|
|
130
132
|
} | undefined;
|
|
133
|
+
basePath?: string | undefined;
|
|
131
134
|
}>;
|
|
132
135
|
/**
|
|
133
136
|
* Schema for documentation page frontmatter/metadata
|
|
@@ -242,6 +245,7 @@ export declare const LoadedDocsPackageSchema: z.ZodObject<{
|
|
|
242
245
|
branch?: string | undefined;
|
|
243
246
|
docsPath?: string | undefined;
|
|
244
247
|
}>>;
|
|
248
|
+
basePath: z.ZodOptional<z.ZodString>;
|
|
245
249
|
}, "strip", z.ZodTypeAny, {
|
|
246
250
|
id: string;
|
|
247
251
|
name: string;
|
|
@@ -263,6 +267,7 @@ export declare const LoadedDocsPackageSchema: z.ZodObject<{
|
|
|
263
267
|
branch?: string | undefined;
|
|
264
268
|
docsPath?: string | undefined;
|
|
265
269
|
} | undefined;
|
|
270
|
+
basePath?: string | undefined;
|
|
266
271
|
}, {
|
|
267
272
|
id: string;
|
|
268
273
|
name: string;
|
|
@@ -284,9 +289,11 @@ export declare const LoadedDocsPackageSchema: z.ZodObject<{
|
|
|
284
289
|
branch?: string | undefined;
|
|
285
290
|
docsPath?: string | undefined;
|
|
286
291
|
} | undefined;
|
|
292
|
+
basePath?: string | undefined;
|
|
287
293
|
}>;
|
|
288
294
|
basePath: z.ZodString;
|
|
289
295
|
}, "strip", z.ZodTypeAny, {
|
|
296
|
+
basePath: string;
|
|
290
297
|
manifest: {
|
|
291
298
|
id: string;
|
|
292
299
|
name: string;
|
|
@@ -308,9 +315,10 @@ export declare const LoadedDocsPackageSchema: z.ZodObject<{
|
|
|
308
315
|
branch?: string | undefined;
|
|
309
316
|
docsPath?: string | undefined;
|
|
310
317
|
} | undefined;
|
|
318
|
+
basePath?: string | undefined;
|
|
311
319
|
};
|
|
312
|
-
basePath: string;
|
|
313
320
|
}, {
|
|
321
|
+
basePath: string;
|
|
314
322
|
manifest: {
|
|
315
323
|
id: string;
|
|
316
324
|
name: string;
|
|
@@ -332,8 +340,8 @@ export declare const LoadedDocsPackageSchema: z.ZodObject<{
|
|
|
332
340
|
branch?: string | undefined;
|
|
333
341
|
docsPath?: string | undefined;
|
|
334
342
|
} | undefined;
|
|
343
|
+
basePath?: string | undefined;
|
|
335
344
|
};
|
|
336
|
-
basePath: string;
|
|
337
345
|
}>;
|
|
338
346
|
/**
|
|
339
347
|
* Schema for breadcrumb items
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,eAAO,MAAM,oBAAoB,+BAA6B,CAAA;AAE9D;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAQA,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;eAlB7B,MAAM;cACP,MAAM;eACL,MAAM;mBACF,OAAO,EAAE;gBACZ,MAAM;;eAJP,MAAM;cACP,MAAM;eACL,MAAM;mBACF,OAAO,EAAE;gBACZ,MAAM
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,eAAO,MAAM,oBAAoB,+BAA6B,CAAA;AAE9D;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;EAG7B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM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BAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAC/E,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACzE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -55,6 +55,8 @@ export interface DocsPackageManifest {
|
|
|
55
55
|
search?: SearchConfig;
|
|
56
56
|
/** Optional GitHub repository configuration for edit links and issue reporting */
|
|
57
57
|
github?: GitHubConfig;
|
|
58
|
+
/** Absolute path to package root for asset resolution (e.g., images) */
|
|
59
|
+
basePath?: string;
|
|
58
60
|
}
|
|
59
61
|
/**
|
|
60
62
|
* Frontmatter metadata for a documentation page
|
package/dist/types.d.ts.map
CHANGED
|
@@ -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,YAAY;IAC3B,+CAA+C;IAC/C,UAAU,EAAE,MAAM,CAAA;IAClB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,I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;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,eAAe;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAA;CACb;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"}
|
|
@@ -130,6 +130,9 @@ export const manifest: DocsPackageManifest = {
|
|
|
130
130
|
// Target Vendure version
|
|
131
131
|
vendureVersion: 'v3',
|
|
132
132
|
|
|
133
|
+
// Package root path - required for image resolution
|
|
134
|
+
basePath: packageRoot,
|
|
135
|
+
|
|
133
136
|
// Navigation tree structure
|
|
134
137
|
navigation: [
|
|
135
138
|
{
|
|
@@ -291,6 +294,64 @@ This action cannot be undone.
|
|
|
291
294
|
See the [Configuration Guide](/v3/my-plugin/getting-started/configuration) for more details.
|
|
292
295
|
```
|
|
293
296
|
|
|
297
|
+
### Using Images
|
|
298
|
+
|
|
299
|
+
Images can be placed alongside your MDX files and referenced using relative paths. The docs application automatically resolves these paths and serves images through an API route.
|
|
300
|
+
|
|
301
|
+
**Place images next to your MDX files:**
|
|
302
|
+
|
|
303
|
+
```
|
|
304
|
+
docs/
|
|
305
|
+
├── guides/
|
|
306
|
+
│ ├── custom-plugins.mdx
|
|
307
|
+
│ └── diagram.webp # Image in same directory
|
|
308
|
+
└── getting-started/
|
|
309
|
+
├── installation.mdx
|
|
310
|
+
└── assets/
|
|
311
|
+
└── screenshot.png # Image in subdirectory
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Reference images with relative paths:**
|
|
315
|
+
|
|
316
|
+
```mdx
|
|
317
|
+
<!-- Same directory -->
|
|
318
|
+
|
|
319
|
+

|
|
320
|
+
|
|
321
|
+
<!-- Subdirectory -->
|
|
322
|
+
|
|
323
|
+

|
|
324
|
+
|
|
325
|
+
<!-- Parent directory -->
|
|
326
|
+
|
|
327
|
+

|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Important:** For images to work, you must set the `basePath` property in your manifest:
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
export const manifest: DocsPackageManifest = {
|
|
334
|
+
id: 'my-plugin',
|
|
335
|
+
basePath: packageRoot, // Required for image resolution
|
|
336
|
+
// ...
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Supported image formats:**
|
|
341
|
+
|
|
342
|
+
- PNG (`.png`)
|
|
343
|
+
- JPEG (`.jpg`, `.jpeg`)
|
|
344
|
+
- WebP (`.webp`)
|
|
345
|
+
- GIF (`.gif`)
|
|
346
|
+
- SVG (`.svg`)
|
|
347
|
+
- AVIF (`.avif`)
|
|
348
|
+
|
|
349
|
+
**How it works:**
|
|
350
|
+
|
|
351
|
+
1. Relative image paths like `./diagram.webp` are detected during MDX compilation
|
|
352
|
+
2. They're transformed to API routes: `/api/docs-image/my-plugin/docs/guides/diagram.webp`
|
|
353
|
+
3. The API route serves images from the npm package with proper caching headers (1 year, immutable)
|
|
354
|
+
|
|
294
355
|
## Step 7: Navigation Structure Patterns
|
|
295
356
|
|
|
296
357
|
### Nested Navigation
|
|
@@ -15,6 +15,7 @@ interface DocsPackageManifest {
|
|
|
15
15
|
navigation: NavigationNode[]
|
|
16
16
|
search?: SearchConfig
|
|
17
17
|
github?: GitHubConfig
|
|
18
|
+
basePath?: string
|
|
18
19
|
}
|
|
19
20
|
```
|
|
20
21
|
|
|
@@ -29,6 +30,7 @@ interface DocsPackageManifest {
|
|
|
29
30
|
| `navigation` | `NavigationNode[]` | Yes | Array of top-level navigation nodes |
|
|
30
31
|
| `search` | `SearchConfig` | No | Search indexing configuration |
|
|
31
32
|
| `github` | `GitHubConfig` | No | GitHub repository configuration for edit links |
|
|
33
|
+
| `basePath` | `string` | No | Absolute path to package root for asset resolution |
|
|
32
34
|
|
|
33
35
|
### Example
|
|
34
36
|
|
|
@@ -38,6 +40,7 @@ const manifest: DocsPackageManifest = {
|
|
|
38
40
|
name: 'My Plugin Documentation',
|
|
39
41
|
version: '1.0.0',
|
|
40
42
|
vendureVersion: 'v3',
|
|
43
|
+
basePath: packageRoot, // Enable image resolution
|
|
41
44
|
navigation: [
|
|
42
45
|
{
|
|
43
46
|
title: 'Getting Started',
|
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
# MDX Components Reference
|
|
2
|
+
|
|
3
|
+
This document describes the MDX components available for use in Vendure documentation. These components are particularly useful for TypeScript and GraphQL API reference documentation.
|
|
4
|
+
|
|
5
|
+
## General Components
|
|
6
|
+
|
|
7
|
+
### Callout
|
|
8
|
+
|
|
9
|
+
Displays an informational callout box with different variants.
|
|
10
|
+
|
|
11
|
+
#### Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ---------- | ----------------------------------------------------------------- | -------- | ------------------------------ |
|
|
15
|
+
| `type` | `'info' \| 'warning' \| 'danger' \| 'tip' \| 'caution' \| 'note'` | `'info'` | The callout variant |
|
|
16
|
+
| `title` | `string` | - | Optional title for the callout |
|
|
17
|
+
| `children` | `ReactNode` | - | Content of the callout |
|
|
18
|
+
|
|
19
|
+
#### Example
|
|
20
|
+
|
|
21
|
+
```mdx
|
|
22
|
+
<Callout
|
|
23
|
+
type="warning"
|
|
24
|
+
title="Deprecation Notice"
|
|
25
|
+
>
|
|
26
|
+
This API will be removed in version 4.0. Please migrate to the new API.
|
|
27
|
+
</Callout>
|
|
28
|
+
|
|
29
|
+
<Callout type="tip">Use the `RequestContext` to access the current user and channel.</Callout>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Stackblitz
|
|
33
|
+
|
|
34
|
+
Embeds a Stackblitz editor for interactive code examples.
|
|
35
|
+
|
|
36
|
+
#### Props
|
|
37
|
+
|
|
38
|
+
| Prop | Type | Required | Description |
|
|
39
|
+
| ---- | -------- | -------- | ------------------------- |
|
|
40
|
+
| `id` | `string` | Yes | The Stackblitz project ID |
|
|
41
|
+
|
|
42
|
+
#### Example
|
|
43
|
+
|
|
44
|
+
```mdx
|
|
45
|
+
<Stackblitz id="vendure-getting-started" />
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Reference Documentation Components
|
|
51
|
+
|
|
52
|
+
These components are designed for TypeScript/GraphQL API reference documentation.
|
|
53
|
+
|
|
54
|
+
### GenerationInfo
|
|
55
|
+
|
|
56
|
+
Displays package metadata with NPM and GitHub source links. Typically shown at the top of reference documentation pages.
|
|
57
|
+
|
|
58
|
+
#### Props
|
|
59
|
+
|
|
60
|
+
| Prop | Type | Required | Description |
|
|
61
|
+
| -------------- | --------- | -------- | -------------------------------------------- |
|
|
62
|
+
| `packageName` | `string` | Yes | NPM package name (e.g., `@vendure/core`) |
|
|
63
|
+
| `sourceFile` | `string` | Yes | Path to source file relative to package root |
|
|
64
|
+
| `sourceLine` | `number` | Yes | Line number in source file |
|
|
65
|
+
| `since` | `string` | No | Version when this API was introduced |
|
|
66
|
+
| `experimental` | `boolean` | No | Mark as experimental API |
|
|
67
|
+
|
|
68
|
+
#### Example
|
|
69
|
+
|
|
70
|
+
```mdx
|
|
71
|
+
<GenerationInfo
|
|
72
|
+
packageName="@vendure/core"
|
|
73
|
+
sourceFile="src/entity/product.entity.ts"
|
|
74
|
+
sourceLine={42}
|
|
75
|
+
since="1.0.0"
|
|
76
|
+
/>
|
|
77
|
+
|
|
78
|
+
<GenerationInfo
|
|
79
|
+
packageName="@vendure/core"
|
|
80
|
+
sourceFile="src/service/services/product.service.ts"
|
|
81
|
+
sourceLine={156}
|
|
82
|
+
experimental={true}
|
|
83
|
+
/>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### MemberInfo
|
|
87
|
+
|
|
88
|
+
Displays type information for class/interface members. Used in TypeScript API reference documentation.
|
|
89
|
+
|
|
90
|
+
#### Props
|
|
91
|
+
|
|
92
|
+
| Prop | Type | Required | Description |
|
|
93
|
+
| -------------- | ----------------------------------------------------------------- | -------- | -------------------------------------------------- |
|
|
94
|
+
| `kind` | `'method' \| 'property' \| 'getter' \| 'setter' \| 'constructor'` | Yes | The kind of member |
|
|
95
|
+
| `type` | `ReactNode` | Yes | TypeScript type signature (accepts JSX with links) |
|
|
96
|
+
| `since` | `string` | No | Version when this member was introduced |
|
|
97
|
+
| `experimental` | `boolean` | No | Mark as experimental API |
|
|
98
|
+
| `default` | `ReactNode` | No | Default value (accepts JSX) |
|
|
99
|
+
|
|
100
|
+
#### Example
|
|
101
|
+
|
|
102
|
+
```mdx
|
|
103
|
+
{/* Simple property */}
|
|
104
|
+
|
|
105
|
+
<MemberInfo
|
|
106
|
+
kind="property"
|
|
107
|
+
type={<>string</>}
|
|
108
|
+
default={<>'default-value'</>}
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
{/* Method with type links */}
|
|
112
|
+
|
|
113
|
+
<MemberInfo
|
|
114
|
+
kind="method"
|
|
115
|
+
type={
|
|
116
|
+
<>
|
|
117
|
+
(<a href="/reference/ctx">RequestContext</a>, productId: <a href="/reference/id">ID</a>) =>
|
|
118
|
+
Promise<<a href="/reference/product">Product</a>>
|
|
119
|
+
</>
|
|
120
|
+
}
|
|
121
|
+
since="2.0.0"
|
|
122
|
+
/>
|
|
123
|
+
|
|
124
|
+
{/* Experimental getter */}
|
|
125
|
+
|
|
126
|
+
<MemberInfo
|
|
127
|
+
kind="getter"
|
|
128
|
+
type={<>boolean</>}
|
|
129
|
+
experimental={true}
|
|
130
|
+
/>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### MemberDescription
|
|
134
|
+
|
|
135
|
+
Simple wrapper for member descriptions in API reference documentation. Provides consistent styling for description content.
|
|
136
|
+
|
|
137
|
+
#### Props
|
|
138
|
+
|
|
139
|
+
| Prop | Type | Required | Description |
|
|
140
|
+
| ---------- | ----------- | -------- | ----------------------------- |
|
|
141
|
+
| `children` | `ReactNode` | Yes | Description content (MDX/JSX) |
|
|
142
|
+
|
|
143
|
+
#### Example
|
|
144
|
+
|
|
145
|
+
```mdx
|
|
146
|
+
<MemberDescription>
|
|
147
|
+
The `Product` entity represents items in your catalog.
|
|
148
|
+
It includes pricing, variants, and inventory information.
|
|
149
|
+
|
|
150
|
+
See the [Product Guide](/guides/products) for more details.
|
|
151
|
+
|
|
152
|
+
</MemberDescription>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### CustomFieldProperty
|
|
156
|
+
|
|
157
|
+
Shows required/optional status and type information for custom fields. Used in custom field configuration documentation.
|
|
158
|
+
|
|
159
|
+
#### Props
|
|
160
|
+
|
|
161
|
+
| Prop | Type | Required | Description |
|
|
162
|
+
| ---------- | --------- | -------- | ----------------------------- |
|
|
163
|
+
| `required` | `boolean` | Yes | Whether the field is required |
|
|
164
|
+
| `type` | `string` | Yes | Type name to display |
|
|
165
|
+
| `typeLink` | `string` | No | Optional link for the type |
|
|
166
|
+
|
|
167
|
+
#### Example
|
|
168
|
+
|
|
169
|
+
```mdx
|
|
170
|
+
<CustomFieldProperty
|
|
171
|
+
required={true}
|
|
172
|
+
type="string"
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
<CustomFieldProperty
|
|
176
|
+
required={false}
|
|
177
|
+
type="LocalizedString"
|
|
178
|
+
typeLink="/reference/types/localized-string"
|
|
179
|
+
/>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### GraphQLDoc
|
|
183
|
+
|
|
184
|
+
Displays GraphQL schema definitions with syntax highlighting and clickable type links. Used in GraphQL API reference documentation.
|
|
185
|
+
|
|
186
|
+
**Note:** The component automatically formats and indents the GraphQL SDL content. Since MDX strips leading whitespace from template literals, you don't need to worry about indentation in your source files - the component will add proper indentation based on GraphQL syntax (braces, etc.).
|
|
187
|
+
|
|
188
|
+
#### Props
|
|
189
|
+
|
|
190
|
+
| Prop | Type | Required | Description |
|
|
191
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------- |
|
|
192
|
+
| `type` | `'mutation' \| 'query' \| 'subscription' \| 'type' \| 'input' \| 'enum' \| 'scalar' \| 'interface' \| 'union' \| 'fragment'` | Yes | The GraphQL definition kind |
|
|
193
|
+
| `typeName` | `string` | Yes | The primary type/operation name |
|
|
194
|
+
| `since` | `string` | No | Version when this API was introduced |
|
|
195
|
+
| `deprecated` | `boolean \| string` | No | Mark as deprecated (string provides deprecation message) |
|
|
196
|
+
| `typeLinks` | `Record<string, string>` | No | Map of type names to their documentation URLs. Only types in this map become clickable. |
|
|
197
|
+
| `children` | `ReactNode` | Yes | GraphQL SDL content |
|
|
198
|
+
|
|
199
|
+
#### Example
|
|
200
|
+
|
|
201
|
+
```mdx
|
|
202
|
+
{/* Simple mutation without type links */}
|
|
203
|
+
|
|
204
|
+
<GraphQLDoc
|
|
205
|
+
type="mutation"
|
|
206
|
+
typeName="logout"
|
|
207
|
+
since="1.0.0"
|
|
208
|
+
>
|
|
209
|
+
{`type Mutation {
|
|
210
|
+
logout: Success!
|
|
211
|
+
}`}
|
|
212
|
+
</GraphQLDoc>
|
|
213
|
+
|
|
214
|
+
{/* Mutation with clickable type links */}
|
|
215
|
+
|
|
216
|
+
<GraphQLDoc
|
|
217
|
+
type="mutation"
|
|
218
|
+
typeName="addCustomersToGroup"
|
|
219
|
+
since="1.0.0"
|
|
220
|
+
typeLinks={{
|
|
221
|
+
CustomerGroup: '/reference/graphql-api/admin/customer-group',
|
|
222
|
+
ID: '/reference/graphql-api/common/scalars#id',
|
|
223
|
+
}}
|
|
224
|
+
>
|
|
225
|
+
{`"""
|
|
226
|
+
Add Customers to a CustomerGroup
|
|
227
|
+
"""
|
|
228
|
+
type Mutation {
|
|
229
|
+
addCustomersToGroup(customerGroupId: ID!, customerIds: [ID!]!): CustomerGroup!
|
|
230
|
+
}`}
|
|
231
|
+
</GraphQLDoc>
|
|
232
|
+
|
|
233
|
+
{/* Deprecated type */}
|
|
234
|
+
|
|
235
|
+
<GraphQLDoc
|
|
236
|
+
type="type"
|
|
237
|
+
typeName="OldProduct"
|
|
238
|
+
deprecated="Use Product instead"
|
|
239
|
+
>
|
|
240
|
+
{`type OldProduct {
|
|
241
|
+
id: ID!
|
|
242
|
+
name: String!
|
|
243
|
+
}`}
|
|
244
|
+
</GraphQLDoc>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Complete Reference Page Example
|
|
250
|
+
|
|
251
|
+
Here's an example of how these components can be used together for a complete reference page:
|
|
252
|
+
|
|
253
|
+
```mdx
|
|
254
|
+
---
|
|
255
|
+
title: Product
|
|
256
|
+
description: The Product entity represents items in your catalog.
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
# Product
|
|
260
|
+
|
|
261
|
+
<GenerationInfo
|
|
262
|
+
packageName="@vendure/core"
|
|
263
|
+
sourceFile="src/entity/product/product.entity.ts"
|
|
264
|
+
sourceLine={25}
|
|
265
|
+
since="1.0.0"
|
|
266
|
+
/>
|
|
267
|
+
|
|
268
|
+
The `Product` entity represents items in your catalog.
|
|
269
|
+
|
|
270
|
+
## Properties
|
|
271
|
+
|
|
272
|
+
### name
|
|
273
|
+
|
|
274
|
+
<MemberInfo
|
|
275
|
+
kind="property"
|
|
276
|
+
type={<>string</>}
|
|
277
|
+
/>
|
|
278
|
+
|
|
279
|
+
<MemberDescription>The name of the product as displayed to customers.</MemberDescription>
|
|
280
|
+
|
|
281
|
+
### slug
|
|
282
|
+
|
|
283
|
+
<MemberInfo
|
|
284
|
+
kind="property"
|
|
285
|
+
type={<>string</>}
|
|
286
|
+
/>
|
|
287
|
+
|
|
288
|
+
<MemberDescription>The URL-friendly identifier for this product.</MemberDescription>
|
|
289
|
+
|
|
290
|
+
## Methods
|
|
291
|
+
|
|
292
|
+
### getVariants
|
|
293
|
+
|
|
294
|
+
<MemberInfo
|
|
295
|
+
kind="method"
|
|
296
|
+
type={
|
|
297
|
+
<>
|
|
298
|
+
(<a href="/reference/ctx">RequestContext</a>) => Promise<
|
|
299
|
+
<a href="/reference/product-variant">ProductVariant</a>[]>
|
|
300
|
+
</>
|
|
301
|
+
}
|
|
302
|
+
since="1.1.0"
|
|
303
|
+
/>
|
|
304
|
+
|
|
305
|
+
<MemberDescription>Returns all variants associated with this product.</MemberDescription>
|
|
306
|
+
|
|
307
|
+
## Custom Fields
|
|
308
|
+
|
|
309
|
+
Products support the following custom field types:
|
|
310
|
+
|
|
311
|
+
<CustomFieldProperty
|
|
312
|
+
required={false}
|
|
313
|
+
type="string"
|
|
314
|
+
/>
|
|
315
|
+
<CustomFieldProperty
|
|
316
|
+
required={false}
|
|
317
|
+
type="int"
|
|
318
|
+
/>
|
|
319
|
+
<CustomFieldProperty
|
|
320
|
+
required={false}
|
|
321
|
+
type="boolean"
|
|
322
|
+
/>
|
|
323
|
+
<CustomFieldProperty
|
|
324
|
+
required={false}
|
|
325
|
+
type="relation"
|
|
326
|
+
typeLink="/reference/custom-fields#relation"
|
|
327
|
+
/>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## TypeScript Contracts
|
|
333
|
+
|
|
334
|
+
All component props have TypeScript interfaces defined in `@vendure-io/docs-provider`:
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
import type {
|
|
338
|
+
GenerationInfoProps,
|
|
339
|
+
GraphQLDocProps,
|
|
340
|
+
MemberInfoProps,
|
|
341
|
+
MemberDescriptionProps,
|
|
342
|
+
CustomFieldPropertyProps,
|
|
343
|
+
StackblitzProps,
|
|
344
|
+
} from '@vendure-io/docs-provider'
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
These interfaces are framework-agnostic and can be used for type checking without importing React.
|