@vendure-io/docs-provider 0.2.0 → 0.4.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 +97 -17
- package/dist/folder-utils.d.ts +136 -0
- package/dist/folder-utils.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +240 -31
- package/dist/loader.cjs +1 -1
- package/dist/loader.js +1 -1
- package/dist/manifest-BYUKRuRu.cjs +3 -0
- package/dist/manifest-CVIfw0ha.js +228 -0
- package/dist/manifest-resolver.d.ts +59 -0
- package/dist/manifest-resolver.d.ts.map +1 -0
- package/dist/mdx-components.d.ts +66 -1
- package/dist/mdx-components.d.ts.map +1 -1
- package/dist/schema.d.ts +120 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/slug-utils.d.ts +52 -0
- package/dist/slug-utils.d.ts.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/creating-a-docs-package.md +140 -0
- package/docs/frontmatter-reference.md +36 -0
- package/docs/manifest-reference.md +251 -1
- package/docs/mdx-components-reference.md +97 -0
- package/package.json +1 -1
- package/dist/manifest-B1CxKK1i.js +0 -207
- package/dist/manifest-D2yANQB-.cjs +0 -3
|
@@ -45,6 +45,36 @@ Embeds a Stackblitz editor for interactive code examples.
|
|
|
45
45
|
<Stackblitz id="vendure-getting-started" />
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
### LinkCard
|
|
49
|
+
|
|
50
|
+
A card-style link that provides more visual prominence than a standard link. Useful for navigation and highlighting important pages.
|
|
51
|
+
|
|
52
|
+
#### Props
|
|
53
|
+
|
|
54
|
+
| Prop | Type | Required | Description |
|
|
55
|
+
| ---------- | ----------- | -------- | -------------------------------------------- |
|
|
56
|
+
| `href` | `string` | Yes | URL to navigate to (internal or external) |
|
|
57
|
+
| `title` | `string` | Yes | Primary text displayed on the card |
|
|
58
|
+
| `subtitle` | `string` | No | Secondary text displayed below the title |
|
|
59
|
+
| `children` | `ReactNode` | No | Additional content (alternative to subtitle) |
|
|
60
|
+
|
|
61
|
+
#### Example
|
|
62
|
+
|
|
63
|
+
```mdx
|
|
64
|
+
<LinkCard
|
|
65
|
+
href="/guides/getting-started"
|
|
66
|
+
title="Getting Started"
|
|
67
|
+
subtitle="Learn how to set up your first project"
|
|
68
|
+
/>
|
|
69
|
+
|
|
70
|
+
<LinkCard
|
|
71
|
+
href="/reference/api"
|
|
72
|
+
title="API Reference"
|
|
73
|
+
>
|
|
74
|
+
Complete API documentation including methods and examples.
|
|
75
|
+
</LinkCard>
|
|
76
|
+
```
|
|
77
|
+
|
|
48
78
|
---
|
|
49
79
|
|
|
50
80
|
## Reference Documentation Components
|
|
@@ -179,6 +209,71 @@ Shows required/optional status and type information for custom fields. Used in c
|
|
|
179
209
|
/>
|
|
180
210
|
```
|
|
181
211
|
|
|
212
|
+
### GraphQLDoc
|
|
213
|
+
|
|
214
|
+
Displays GraphQL schema definitions with syntax highlighting and clickable type links. Used in GraphQL API reference documentation.
|
|
215
|
+
|
|
216
|
+
**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.).
|
|
217
|
+
|
|
218
|
+
#### Props
|
|
219
|
+
|
|
220
|
+
| Prop | Type | Required | Description |
|
|
221
|
+
| ------------ | ---------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------- |
|
|
222
|
+
| `type` | `'mutation' \| 'query' \| 'subscription' \| 'type' \| 'input' \| 'enum' \| 'scalar' \| 'interface' \| 'union' \| 'fragment'` | Yes | The GraphQL definition kind |
|
|
223
|
+
| `typeName` | `string` | Yes | The primary type/operation name |
|
|
224
|
+
| `since` | `string` | No | Version when this API was introduced |
|
|
225
|
+
| `deprecated` | `boolean \| string` | No | Mark as deprecated (string provides deprecation message) |
|
|
226
|
+
| `typeLinks` | `Record<string, string>` | No | Map of type names to their documentation URLs. Only types in this map become clickable. |
|
|
227
|
+
| `children` | `ReactNode` | Yes | GraphQL SDL content |
|
|
228
|
+
|
|
229
|
+
#### Example
|
|
230
|
+
|
|
231
|
+
```mdx
|
|
232
|
+
{/* Simple mutation without type links */}
|
|
233
|
+
|
|
234
|
+
<GraphQLDoc
|
|
235
|
+
type="mutation"
|
|
236
|
+
typeName="logout"
|
|
237
|
+
since="1.0.0"
|
|
238
|
+
>
|
|
239
|
+
{`type Mutation {
|
|
240
|
+
logout: Success!
|
|
241
|
+
}`}
|
|
242
|
+
</GraphQLDoc>
|
|
243
|
+
|
|
244
|
+
{/* Mutation with clickable type links */}
|
|
245
|
+
|
|
246
|
+
<GraphQLDoc
|
|
247
|
+
type="mutation"
|
|
248
|
+
typeName="addCustomersToGroup"
|
|
249
|
+
since="1.0.0"
|
|
250
|
+
typeLinks={{
|
|
251
|
+
CustomerGroup: '/reference/graphql-api/admin/customer-group',
|
|
252
|
+
ID: '/reference/graphql-api/common/scalars#id',
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
255
|
+
{`"""
|
|
256
|
+
Add Customers to a CustomerGroup
|
|
257
|
+
"""
|
|
258
|
+
type Mutation {
|
|
259
|
+
addCustomersToGroup(customerGroupId: ID!, customerIds: [ID!]!): CustomerGroup!
|
|
260
|
+
}`}
|
|
261
|
+
</GraphQLDoc>
|
|
262
|
+
|
|
263
|
+
{/* Deprecated type */}
|
|
264
|
+
|
|
265
|
+
<GraphQLDoc
|
|
266
|
+
type="type"
|
|
267
|
+
typeName="OldProduct"
|
|
268
|
+
deprecated="Use Product instead"
|
|
269
|
+
>
|
|
270
|
+
{`type OldProduct {
|
|
271
|
+
id: ID!
|
|
272
|
+
name: String!
|
|
273
|
+
}`}
|
|
274
|
+
</GraphQLDoc>
|
|
275
|
+
```
|
|
276
|
+
|
|
182
277
|
---
|
|
183
278
|
|
|
184
279
|
## Complete Reference Page Example
|
|
@@ -271,6 +366,8 @@ All component props have TypeScript interfaces defined in `@vendure-io/docs-prov
|
|
|
271
366
|
```typescript
|
|
272
367
|
import type {
|
|
273
368
|
GenerationInfoProps,
|
|
369
|
+
GraphQLDocProps,
|
|
370
|
+
LinkCardProps,
|
|
274
371
|
MemberInfoProps,
|
|
275
372
|
MemberDescriptionProps,
|
|
276
373
|
CustomFieldPropertyProps,
|
package/package.json
CHANGED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
var N = Object.defineProperty;
|
|
2
|
-
var S = (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) => S(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
-
import g from "gray-matter";
|
|
5
|
-
import { z as t } from "zod";
|
|
6
|
-
const P = t.enum(["v1", "v2", "v3"]), j = t.object({
|
|
7
|
-
indexFields: t.array(t.enum(["title", "description", "content", "keywords"])),
|
|
8
|
-
boosts: t.record(t.string(), t.number()).optional()
|
|
9
|
-
}), $ = t.object({
|
|
10
|
-
repository: t.string().regex(/^[^/]+\/[^/]+$/, 'Repository must be in format "owner/repo"'),
|
|
11
|
-
branch: t.string().optional(),
|
|
12
|
-
docsPath: t.string().optional()
|
|
13
|
-
}), u = t.lazy(
|
|
14
|
-
() => t.object({
|
|
15
|
-
title: t.string().min(1, "Navigation title is required"),
|
|
16
|
-
slug: t.string().min(1, "Navigation slug is required"),
|
|
17
|
-
file: t.string().optional(),
|
|
18
|
-
children: t.array(u).optional(),
|
|
19
|
-
badge: t.string().optional()
|
|
20
|
-
})
|
|
21
|
-
), f = t.object({
|
|
22
|
-
id: t.string().min(1, "Package ID is required"),
|
|
23
|
-
name: t.string().min(1, "Package name is required"),
|
|
24
|
-
version: t.string().regex(/^\d+\.\d+\.\d+/, "Version must be valid semver"),
|
|
25
|
-
vendureVersion: P,
|
|
26
|
-
navigation: t.array(u),
|
|
27
|
-
search: j.optional(),
|
|
28
|
-
github: $.optional()
|
|
29
|
-
}), m = t.object({
|
|
30
|
-
title: t.string().min(1, "Page title is required"),
|
|
31
|
-
description: t.string().optional(),
|
|
32
|
-
keywords: t.array(t.string()).optional(),
|
|
33
|
-
sidebarLabel: t.string().optional(),
|
|
34
|
-
hidden: t.boolean().optional()
|
|
35
|
-
}), M = t.object({
|
|
36
|
-
meta: m,
|
|
37
|
-
content: t.string(),
|
|
38
|
-
filePath: t.string()
|
|
39
|
-
}), B = t.object({
|
|
40
|
-
manifest: f,
|
|
41
|
-
basePath: t.string()
|
|
42
|
-
}), V = t.object({
|
|
43
|
-
title: t.string(),
|
|
44
|
-
slug: t.string(),
|
|
45
|
-
path: t.string()
|
|
46
|
-
}), I = t.object({
|
|
47
|
-
title: t.string(),
|
|
48
|
-
slug: t.string(),
|
|
49
|
-
file: t.string().optional(),
|
|
50
|
-
children: t.array(t.lazy(() => u)).optional(),
|
|
51
|
-
badge: t.string().optional(),
|
|
52
|
-
path: t.string(),
|
|
53
|
-
depth: t.number().int().min(0),
|
|
54
|
-
parentPath: t.string().optional()
|
|
55
|
-
});
|
|
56
|
-
class d extends Error {
|
|
57
|
-
constructor(n, i, a) {
|
|
58
|
-
super(n);
|
|
59
|
-
l(this, "filePath");
|
|
60
|
-
l(this, "originalError");
|
|
61
|
-
this.name = "FrontmatterParseError", this.filePath = i, this.originalError = a;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function q(r, e) {
|
|
65
|
-
try {
|
|
66
|
-
const { data: n, content: i } = g(r);
|
|
67
|
-
return {
|
|
68
|
-
meta: y(n, e),
|
|
69
|
-
content: i.trim()
|
|
70
|
-
};
|
|
71
|
-
} catch (n) {
|
|
72
|
-
throw n instanceof d ? n : new d(
|
|
73
|
-
`Failed to parse frontmatter${e ? ` in ${e}` : ""}`,
|
|
74
|
-
e,
|
|
75
|
-
n
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
function y(r, e) {
|
|
80
|
-
const n = m.safeParse(r);
|
|
81
|
-
if (!n.success) {
|
|
82
|
-
const i = n.error.issues.map((a) => ` - ${a.path.join(".")}: ${a.message}`).join(`
|
|
83
|
-
`);
|
|
84
|
-
throw new d(
|
|
85
|
-
`Invalid frontmatter${e ? ` in ${e}` : ""}:
|
|
86
|
-
${i}`,
|
|
87
|
-
e,
|
|
88
|
-
n.error
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
return n.data;
|
|
92
|
-
}
|
|
93
|
-
function L(r) {
|
|
94
|
-
return r.trimStart().startsWith("---");
|
|
95
|
-
}
|
|
96
|
-
function z(r) {
|
|
97
|
-
const { data: e } = g(r);
|
|
98
|
-
return e;
|
|
99
|
-
}
|
|
100
|
-
class x extends Error {
|
|
101
|
-
constructor(n, i) {
|
|
102
|
-
super(n);
|
|
103
|
-
l(this, "issues");
|
|
104
|
-
this.name = "ManifestValidationError", this.issues = i;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
function A(r) {
|
|
108
|
-
const e = f.safeParse(r);
|
|
109
|
-
if (!e.success) {
|
|
110
|
-
const n = e.error.issues.map((i) => `${i.path.join(".")}: ${i.message}`);
|
|
111
|
-
throw new x("Invalid manifest", n);
|
|
112
|
-
}
|
|
113
|
-
return e.data;
|
|
114
|
-
}
|
|
115
|
-
function C(r, e) {
|
|
116
|
-
const n = e.split("/").filter(Boolean);
|
|
117
|
-
return h(r.navigation, n);
|
|
118
|
-
}
|
|
119
|
-
function h(r, e) {
|
|
120
|
-
if (e.length === 0) return;
|
|
121
|
-
const [n, ...i] = e, a = r.find((s) => s.slug === n);
|
|
122
|
-
if (a) {
|
|
123
|
-
if (i.length === 0) return a;
|
|
124
|
-
if (a.children)
|
|
125
|
-
return h(a.children, i);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function p(r) {
|
|
129
|
-
const e = [];
|
|
130
|
-
return v(r.navigation, "", 0, void 0, e), e;
|
|
131
|
-
}
|
|
132
|
-
function v(r, e, n, i, a) {
|
|
133
|
-
for (const s of r) {
|
|
134
|
-
const o = e ? `${e}/${s.slug}` : s.slug;
|
|
135
|
-
a.push({
|
|
136
|
-
...s,
|
|
137
|
-
path: o,
|
|
138
|
-
depth: n,
|
|
139
|
-
parentPath: i
|
|
140
|
-
}), s.children && s.children.length > 0 && v(s.children, o, n + 1, o, a);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function G(r, e) {
|
|
144
|
-
const n = e.split("/").filter(Boolean), i = [];
|
|
145
|
-
let a = r.navigation, s = "";
|
|
146
|
-
for (const o of n) {
|
|
147
|
-
const c = a.find((b) => b.slug === o);
|
|
148
|
-
if (!c) break;
|
|
149
|
-
s = s ? `${s}/${o}` : o, i.push({
|
|
150
|
-
title: c.title,
|
|
151
|
-
slug: c.slug,
|
|
152
|
-
path: s
|
|
153
|
-
}), a = c.children ?? [];
|
|
154
|
-
}
|
|
155
|
-
return i;
|
|
156
|
-
}
|
|
157
|
-
function w(r) {
|
|
158
|
-
return p(r).filter((e) => e.file !== void 0);
|
|
159
|
-
}
|
|
160
|
-
function H(r, e) {
|
|
161
|
-
const n = w(r), i = n.findIndex((a) => a.path === e);
|
|
162
|
-
return i === -1 ? {} : {
|
|
163
|
-
prev: i > 0 ? n[i - 1] : void 0,
|
|
164
|
-
next: i < n.length - 1 ? n[i + 1] : void 0
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function F(r, e) {
|
|
168
|
-
const n = e.split("/").filter(Boolean);
|
|
169
|
-
if (n.length === 0) return !1;
|
|
170
|
-
if (r.slug === n[0]) {
|
|
171
|
-
if (n.length === 1) return !0;
|
|
172
|
-
if (r.children) {
|
|
173
|
-
const i = n.slice(1).join("/");
|
|
174
|
-
return r.children.some((a) => F(a, i));
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return !1;
|
|
178
|
-
}
|
|
179
|
-
function R(r, e) {
|
|
180
|
-
return p(r).filter((n) => n.depth === e);
|
|
181
|
-
}
|
|
182
|
-
export {
|
|
183
|
-
V as B,
|
|
184
|
-
m as D,
|
|
185
|
-
I as F,
|
|
186
|
-
$ as G,
|
|
187
|
-
B as L,
|
|
188
|
-
x as M,
|
|
189
|
-
u as N,
|
|
190
|
-
j as S,
|
|
191
|
-
P as V,
|
|
192
|
-
M as a,
|
|
193
|
-
f as b,
|
|
194
|
-
d as c,
|
|
195
|
-
G as d,
|
|
196
|
-
z as e,
|
|
197
|
-
C as f,
|
|
198
|
-
p as g,
|
|
199
|
-
L as h,
|
|
200
|
-
w as i,
|
|
201
|
-
R as j,
|
|
202
|
-
H as k,
|
|
203
|
-
F as l,
|
|
204
|
-
A as m,
|
|
205
|
-
q as p,
|
|
206
|
-
y as v
|
|
207
|
-
};
|
|
@@ -1,3 +0,0 @@
|
|
|
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(`
|
|
2
|
-
`);throw new l(`Invalid frontmatter${e?` in ${e}`:""}:
|
|
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;
|