@vendure-io/docs-provider 0.7.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apply-dates.d.ts +44 -0
- package/dist/apply-dates.d.ts.map +1 -0
- package/dist/browser.cjs +1 -1
- package/dist/browser.js +1 -1
- package/dist/{frontmatter-C0Wmtdep.js → frontmatter-B5d9WZzh.js} +1 -1
- package/dist/{frontmatter-CJYZSUYM.cjs → frontmatter-QFErVd9b.cjs} +1 -1
- package/dist/generate-dates.d.ts +46 -0
- package/dist/generate-dates.d.ts.map +1 -0
- package/dist/git-utils.d.ts +39 -0
- package/dist/git-utils.d.ts.map +1 -0
- package/dist/index.cjs +14 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +282 -153
- package/dist/loader.cjs +1 -1
- package/dist/loader.js +2 -2
- package/dist/manifest-BkO3d77g.cjs +1 -0
- package/dist/manifest-DlSWyjsA.js +186 -0
- package/dist/remark-plugins/index.d.ts +1 -1
- package/dist/remark-plugins/index.d.ts.map +1 -1
- package/dist/schema.d.ts +31 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing.cjs +1 -1
- package/dist/testing.js +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/creating-a-docs-package.md +1 -0
- package/docs/getting-started.md +1 -0
- package/docs/last-modified-dates.md +325 -0
- package/docs/mdx-testing.md +16 -13
- package/package.json +1 -1
- package/dist/manifest-D-EWZlSh.cjs +0 -1
- package/dist/manifest-ZCrzbFSf.js +0 -182
package/dist/index.js
CHANGED
|
@@ -1,233 +1,362 @@
|
|
|
1
1
|
var A = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { B as
|
|
5
|
-
import { e as
|
|
6
|
-
import { F as
|
|
7
|
-
import { s as
|
|
8
|
-
import { f as
|
|
9
|
-
import { readdirSync as
|
|
10
|
-
import { join as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
var U = (e, t, r) => t in e ? A(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var v = (e, t, r) => U(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { B as ye, D as Ne, a as Se, b as $e, c as xe, F as be, G as De, L as Pe, M as Me, N as ke, d as Ee, S as Ie, V as We, e as je, f as Ce, g as Ge, h as Le, i as Ve, j as Re, k as Te, v as Be } from "./manifest-DlSWyjsA.js";
|
|
5
|
+
import { e as I } from "./frontmatter-B5d9WZzh.js";
|
|
6
|
+
import { F as ze, h as Ae, p as Ue, v as He } from "./frontmatter-B5d9WZzh.js";
|
|
7
|
+
import { s as F, t as w } from "./slug-utils-DVKYe9h8.js";
|
|
8
|
+
import { f as qe, g as Je, a as Ke } from "./slug-utils-DVKYe9h8.js";
|
|
9
|
+
import { readdirSync as W, readFileSync as j, statSync as H } from "fs";
|
|
10
|
+
import { join as y } from "path";
|
|
11
|
+
import { exec as _ } from "node:child_process";
|
|
12
|
+
import { promisify as q } from "node:util";
|
|
13
|
+
import { writeFile as C, readdir as J } from "node:fs/promises";
|
|
14
|
+
import { join as G, relative as K } from "node:path";
|
|
15
|
+
const L = (e, t) => e.order !== t.order ? e.order - t.order : e.title.localeCompare(t.title);
|
|
16
|
+
function ue(e, t = {}) {
|
|
17
|
+
const { extensions: r = [".mdx", ".md"], filter: i, sort: n = L } = t, s = R(e, r);
|
|
18
|
+
return (i ? s.filter(i) : s).sort(n).map((l) => ({
|
|
19
|
+
title: l.title,
|
|
20
|
+
slug: l.slug,
|
|
21
|
+
file: l.path
|
|
18
22
|
}));
|
|
19
23
|
}
|
|
20
|
-
function
|
|
21
|
-
return
|
|
24
|
+
function he(e, t = {}) {
|
|
25
|
+
return V(e, t, 0);
|
|
22
26
|
}
|
|
23
|
-
function
|
|
27
|
+
function V(e, t, r) {
|
|
24
28
|
const {
|
|
25
|
-
extensions:
|
|
26
|
-
filter:
|
|
27
|
-
sort:
|
|
28
|
-
maxDepth:
|
|
29
|
-
folderFilter:
|
|
30
|
-
} = t,
|
|
31
|
-
for (const
|
|
32
|
-
|
|
33
|
-
title:
|
|
34
|
-
slug:
|
|
35
|
-
file:
|
|
29
|
+
extensions: i = [".mdx", ".md"],
|
|
30
|
+
filter: n,
|
|
31
|
+
sort: s = L,
|
|
32
|
+
maxDepth: o = 1 / 0,
|
|
33
|
+
folderFilter: a
|
|
34
|
+
} = t, l = W(e, { withFileTypes: !0 }), c = [], h = R(e, i), g = (n ? h.filter(n) : h).sort(s);
|
|
35
|
+
for (const u of g)
|
|
36
|
+
c.push({
|
|
37
|
+
title: u.title,
|
|
38
|
+
slug: u.slug,
|
|
39
|
+
file: u.path
|
|
36
40
|
});
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
39
|
-
for (const
|
|
40
|
-
if (
|
|
41
|
-
const
|
|
42
|
-
if (!d
|
|
41
|
+
if (r < o) {
|
|
42
|
+
const u = l.filter((d) => d.isDirectory());
|
|
43
|
+
for (const d of u) {
|
|
44
|
+
if (a) {
|
|
45
|
+
const f = y(e, d.name);
|
|
46
|
+
if (!a(d.name, f))
|
|
43
47
|
continue;
|
|
44
48
|
}
|
|
45
|
-
const
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
title: (
|
|
50
|
-
slug:
|
|
51
|
-
file:
|
|
52
|
-
children:
|
|
49
|
+
const m = y(e, d.name), p = V(m, t, r + 1);
|
|
50
|
+
if (p.length > 0) {
|
|
51
|
+
const f = Q(m, i);
|
|
52
|
+
c.push({
|
|
53
|
+
title: (f == null ? void 0 : f.title) || w(d.name),
|
|
54
|
+
slug: F(d.name),
|
|
55
|
+
file: f == null ? void 0 : f.path,
|
|
56
|
+
children: p.filter((S) => !(f && S.file === f.path))
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
|
-
return
|
|
58
|
-
var
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
62
|
-
const
|
|
63
|
-
return
|
|
61
|
+
return c.sort((u, d) => {
|
|
62
|
+
var P, M;
|
|
63
|
+
const m = g.find(($) => $.slug === u.slug), p = g.find(($) => $.slug === d.slug);
|
|
64
|
+
if (m && p)
|
|
65
|
+
return s(m, p);
|
|
66
|
+
const f = !!u.file && !((P = u.children) != null && P.length), S = !!d.file && !((M = d.children) != null && M.length);
|
|
67
|
+
return f !== S ? f ? -1 : 1 : (u.title || "").localeCompare(d.title || "");
|
|
64
68
|
});
|
|
65
69
|
}
|
|
66
|
-
function
|
|
70
|
+
function R(e, t) {
|
|
67
71
|
try {
|
|
68
|
-
const
|
|
69
|
-
for (const
|
|
70
|
-
if (!
|
|
71
|
-
const
|
|
72
|
-
if (!
|
|
73
|
-
const
|
|
74
|
-
|
|
72
|
+
const r = W(e, { withFileTypes: !0 }), i = [];
|
|
73
|
+
for (const n of r) {
|
|
74
|
+
if (!n.isFile()) continue;
|
|
75
|
+
const s = t.find((c) => n.name.toLowerCase().endsWith(c));
|
|
76
|
+
if (!s || n.name.slice(0, -s.length).toLowerCase() === "index") continue;
|
|
77
|
+
const a = y(e, n.name), l = T(a, n.name, s);
|
|
78
|
+
i.push(l);
|
|
75
79
|
}
|
|
76
|
-
return
|
|
80
|
+
return i;
|
|
77
81
|
} catch {
|
|
78
82
|
return [];
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
|
-
function
|
|
82
|
-
let
|
|
85
|
+
function T(e, t, r) {
|
|
86
|
+
let i = {}, n = w(t), s = 1 / 0;
|
|
83
87
|
try {
|
|
84
|
-
const
|
|
85
|
-
|
|
88
|
+
const o = j(e, "utf-8");
|
|
89
|
+
i = I(o), i.title && typeof i.title == "string" && (n = i.title), typeof i.order == "number" && (s = i.order);
|
|
86
90
|
} catch {
|
|
87
91
|
}
|
|
88
92
|
return {
|
|
89
93
|
path: e,
|
|
90
94
|
filename: t,
|
|
91
|
-
extension:
|
|
92
|
-
frontmatter:
|
|
93
|
-
order:
|
|
94
|
-
title:
|
|
95
|
-
slug:
|
|
95
|
+
extension: r,
|
|
96
|
+
frontmatter: i,
|
|
97
|
+
order: s,
|
|
98
|
+
title: n,
|
|
99
|
+
slug: F(t)
|
|
96
100
|
};
|
|
97
101
|
}
|
|
98
|
-
function
|
|
99
|
-
for (const
|
|
100
|
-
const
|
|
102
|
+
function Q(e, t) {
|
|
103
|
+
for (const r of t) {
|
|
104
|
+
const i = y(e, `index${r}`);
|
|
101
105
|
try {
|
|
102
|
-
if (
|
|
103
|
-
return
|
|
106
|
+
if (H(i).isFile())
|
|
107
|
+
return T(i, `index${r}`, r);
|
|
104
108
|
} catch {
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
}
|
|
108
|
-
class
|
|
109
|
-
constructor(
|
|
110
|
-
super(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
this.name = "ManifestResolutionError", this.nodePath =
|
|
112
|
+
class x extends Error {
|
|
113
|
+
constructor(r, i, n, s) {
|
|
114
|
+
super(r);
|
|
115
|
+
v(this, "nodePath");
|
|
116
|
+
v(this, "filePath");
|
|
117
|
+
v(this, "originalError");
|
|
118
|
+
this.name = "ManifestResolutionError", this.nodePath = i, this.filePath = n, this.originalError = s;
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
|
-
function
|
|
118
|
-
const { strict:
|
|
121
|
+
function ge(e, t = {}) {
|
|
122
|
+
const { strict: r = !0 } = t, i = b(e.navigation, "", r);
|
|
119
123
|
return {
|
|
120
124
|
id: e.id,
|
|
121
125
|
name: e.name,
|
|
122
126
|
version: e.version,
|
|
123
127
|
vendureVersion: e.vendureVersion,
|
|
124
|
-
navigation:
|
|
128
|
+
navigation: i,
|
|
125
129
|
search: e.search,
|
|
126
130
|
github: e.github,
|
|
127
131
|
basePath: e.basePath
|
|
128
132
|
};
|
|
129
133
|
}
|
|
130
|
-
function
|
|
131
|
-
return e.map((
|
|
134
|
+
function b(e, t, r) {
|
|
135
|
+
return e.map((i, n) => X(i, t, n, r));
|
|
132
136
|
}
|
|
133
|
-
function
|
|
134
|
-
const
|
|
137
|
+
function X(e, t, r, i) {
|
|
138
|
+
const n = t ? `${t}[${r}]` : `navigation[${r}]`;
|
|
135
139
|
if (e.title && e.slug)
|
|
136
140
|
return {
|
|
137
141
|
title: e.title,
|
|
138
142
|
slug: e.slug,
|
|
139
143
|
file: e.file,
|
|
140
|
-
children: e.children ?
|
|
144
|
+
children: e.children ? b(e.children, `${n}.children`, i) : void 0,
|
|
141
145
|
badge: e.badge,
|
|
142
146
|
hidden: e.hidden
|
|
143
147
|
};
|
|
144
|
-
let
|
|
145
|
-
if (e.file && (
|
|
146
|
-
if (
|
|
147
|
-
throw new
|
|
148
|
-
`Navigation node at ${
|
|
149
|
-
|
|
148
|
+
let s = e.title, o = e.slug;
|
|
149
|
+
if (e.file && (o || (o = F(e.file)), s || (s = Y(e.file, n, i))), !s) {
|
|
150
|
+
if (i)
|
|
151
|
+
throw new x(
|
|
152
|
+
`Navigation node at ${n} is missing title and has no file to derive it from`,
|
|
153
|
+
n,
|
|
150
154
|
e.file
|
|
151
155
|
);
|
|
152
|
-
|
|
156
|
+
s = o || `Unknown (${r})`;
|
|
153
157
|
}
|
|
154
|
-
if (!
|
|
155
|
-
if (
|
|
156
|
-
throw new
|
|
157
|
-
`Navigation node at ${
|
|
158
|
-
|
|
158
|
+
if (!o) {
|
|
159
|
+
if (i)
|
|
160
|
+
throw new x(
|
|
161
|
+
`Navigation node at ${n} is missing slug and has no file to derive it from`,
|
|
162
|
+
n,
|
|
159
163
|
e.file
|
|
160
164
|
);
|
|
161
|
-
|
|
165
|
+
o = s ? F(s) : `node-${r}`;
|
|
162
166
|
}
|
|
163
167
|
return {
|
|
164
|
-
title:
|
|
165
|
-
slug:
|
|
168
|
+
title: s,
|
|
169
|
+
slug: o,
|
|
166
170
|
file: e.file,
|
|
167
|
-
children: e.children ?
|
|
171
|
+
children: e.children ? b(e.children, `${n}.children`, i) : void 0,
|
|
168
172
|
badge: e.badge,
|
|
169
173
|
hidden: e.hidden
|
|
170
174
|
};
|
|
171
175
|
}
|
|
172
|
-
function
|
|
176
|
+
function Y(e, t, r) {
|
|
173
177
|
try {
|
|
174
|
-
const
|
|
175
|
-
return
|
|
176
|
-
} catch (
|
|
177
|
-
if (
|
|
178
|
-
throw new
|
|
178
|
+
const i = j(e, "utf-8"), n = I(i);
|
|
179
|
+
return n.title && typeof n.title == "string" ? n.title : w(e);
|
|
180
|
+
} catch (i) {
|
|
181
|
+
if (r)
|
|
182
|
+
throw new x(
|
|
179
183
|
`Failed to read file for title derivation at ${t}: ${e}`,
|
|
180
184
|
t,
|
|
181
185
|
e,
|
|
182
|
-
|
|
186
|
+
i
|
|
183
187
|
);
|
|
184
|
-
return
|
|
188
|
+
return w(e);
|
|
185
189
|
}
|
|
186
190
|
}
|
|
187
|
-
function
|
|
188
|
-
return
|
|
191
|
+
function me(e) {
|
|
192
|
+
return B(e.navigation);
|
|
189
193
|
}
|
|
190
|
-
function
|
|
194
|
+
function B(e) {
|
|
191
195
|
for (const t of e)
|
|
192
|
-
if (!t.title || !t.slug || t.children &&
|
|
196
|
+
if (!t.title || !t.slug || t.children && B(t.children))
|
|
193
197
|
return !0;
|
|
194
198
|
return !1;
|
|
195
199
|
}
|
|
200
|
+
const O = q(_);
|
|
201
|
+
async function z(e = process.cwd()) {
|
|
202
|
+
try {
|
|
203
|
+
return await O("git rev-parse --git-dir", { cwd: e }), !0;
|
|
204
|
+
} catch {
|
|
205
|
+
return !1;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
async function Z(e, t = {}) {
|
|
209
|
+
const r = t.cwd ?? process.cwd();
|
|
210
|
+
try {
|
|
211
|
+
const { stdout: i } = await O(`git log -1 --format=%cI -- "${e}"`, { cwd: r }), n = i.trim();
|
|
212
|
+
return n || null;
|
|
213
|
+
} catch {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
async function ee(e, t = {}) {
|
|
218
|
+
const r = t.cwd ?? process.cwd(), i = {}, n = [];
|
|
219
|
+
return await z(r) ? (await Promise.all(
|
|
220
|
+
e.map(async (s) => {
|
|
221
|
+
const o = await Z(s, t);
|
|
222
|
+
o ? i[s] = o : n.push(s);
|
|
223
|
+
})
|
|
224
|
+
), { dates: i, skipped: n }) : {
|
|
225
|
+
dates: {},
|
|
226
|
+
skipped: e
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
async function te(e, t) {
|
|
230
|
+
const r = [];
|
|
231
|
+
async function i(n) {
|
|
232
|
+
const s = await J(n, { withFileTypes: !0 });
|
|
233
|
+
for (const o of s) {
|
|
234
|
+
const a = G(n, o.name);
|
|
235
|
+
o.isDirectory() ? !o.name.startsWith(".") && o.name !== "node_modules" && await i(a) : o.isFile() && t.some((c) => o.name.endsWith(c)) && r.push(a);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return await i(e), r;
|
|
239
|
+
}
|
|
240
|
+
async function pe(e) {
|
|
241
|
+
const { docsDir: t, outputPath: r, extensions: i = [".mdx", ".md"] } = e, n = e.gitCwd ?? G(t, "..");
|
|
242
|
+
if (!await z(n))
|
|
243
|
+
return console.warn("Warning: Not a git repository. Generating empty dates file."), await k(r), {
|
|
244
|
+
filesWithDates: 0,
|
|
245
|
+
filesSkipped: 0,
|
|
246
|
+
outputPath: r
|
|
247
|
+
};
|
|
248
|
+
const s = await te(t, i);
|
|
249
|
+
if (s.length === 0)
|
|
250
|
+
return console.warn(`Warning: No files found in ${t} with extensions ${i.join(", ")}`), await k(r), {
|
|
251
|
+
filesWithDates: 0,
|
|
252
|
+
filesSkipped: 0,
|
|
253
|
+
outputPath: r
|
|
254
|
+
};
|
|
255
|
+
const o = s.map((h) => K(n, h)), { dates: a, skipped: l } = await ee(o, { cwd: n }), c = ie(a);
|
|
256
|
+
return await C(r, c, "utf-8"), {
|
|
257
|
+
filesWithDates: Object.keys(a).length,
|
|
258
|
+
filesSkipped: l.length,
|
|
259
|
+
outputPath: r
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
async function k(e) {
|
|
263
|
+
const t = `// dates.generated.ts (auto-generated, do not edit)
|
|
264
|
+
// Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
265
|
+
// Warning: Git repository not available, no dates extracted
|
|
266
|
+
|
|
267
|
+
export const lastModifiedDates: Record<string, string> = {}
|
|
268
|
+
`;
|
|
269
|
+
await C(e, t, "utf-8");
|
|
270
|
+
}
|
|
271
|
+
function ie(e) {
|
|
272
|
+
const t = Object.entries(e).sort(([i], [n]) => i.localeCompare(n)), r = t.map(([i, n]) => ` '${i}': '${n}',`).join(`
|
|
273
|
+
`);
|
|
274
|
+
return `// dates.generated.ts (auto-generated, do not edit)
|
|
275
|
+
// Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
276
|
+
// Total files: ${t.length}
|
|
277
|
+
|
|
278
|
+
export const lastModifiedDates: Record<string, string> = {
|
|
279
|
+
${r}
|
|
280
|
+
}
|
|
281
|
+
`;
|
|
282
|
+
}
|
|
283
|
+
function D(e) {
|
|
284
|
+
return e.replace(/\\/g, "/").replace(/\/+/g, "/").replace(/\/$/, "");
|
|
285
|
+
}
|
|
286
|
+
function E(...e) {
|
|
287
|
+
return D(e.filter(Boolean).join("/"));
|
|
288
|
+
}
|
|
289
|
+
function ve(e, t, r = {}) {
|
|
290
|
+
const { basePath: i } = r;
|
|
291
|
+
function n(s) {
|
|
292
|
+
const o = { ...s };
|
|
293
|
+
if (s.file) {
|
|
294
|
+
const a = D(s.file), l = [];
|
|
295
|
+
if (i) {
|
|
296
|
+
const h = `/${D(i)}/`, N = a.indexOf(h);
|
|
297
|
+
if (N !== -1) {
|
|
298
|
+
const g = a.slice(N + 1);
|
|
299
|
+
l.push(g);
|
|
300
|
+
}
|
|
301
|
+
l.push(E(i, a)), l.push(E(i, a).replace(/^\//, ""));
|
|
302
|
+
}
|
|
303
|
+
if (l.push(a), l.push(a.replace(/^\//, "")), i) {
|
|
304
|
+
const c = a.split(`/${i}/`);
|
|
305
|
+
if (c.length > 1) {
|
|
306
|
+
const h = c[c.length - 1];
|
|
307
|
+
l.push(`${i}/${h}`), l.push(h);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
for (const c of l)
|
|
311
|
+
if (t[c]) {
|
|
312
|
+
o.lastModified = t[c];
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return s.children && s.children.length > 0 && (o.children = s.children.map(n)), o;
|
|
317
|
+
}
|
|
318
|
+
return e.map(n);
|
|
319
|
+
}
|
|
196
320
|
export {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
321
|
+
ye as BreadcrumbItemSchema,
|
|
322
|
+
Ne as DocPageMetaSchema,
|
|
323
|
+
Se as DocPageSchema,
|
|
324
|
+
$e as DocsPackageManifestInputSchema,
|
|
325
|
+
xe as DocsPackageManifestSchema,
|
|
326
|
+
be as FlatNavigationNodeSchema,
|
|
327
|
+
ze as FrontmatterParseError,
|
|
328
|
+
De as GitHubConfigSchema,
|
|
329
|
+
Pe as LoadedDocsPackageSchema,
|
|
330
|
+
x as ManifestResolutionError,
|
|
331
|
+
Me as ManifestValidationError,
|
|
332
|
+
ke as NavigationNodeInputSchema,
|
|
333
|
+
Ee as NavigationNodeSchema,
|
|
334
|
+
Ie as SearchConfigSchema,
|
|
335
|
+
We as VendureVersionSchema,
|
|
336
|
+
ve as applyLastModifiedDates,
|
|
337
|
+
je as buildBreadcrumbs,
|
|
338
|
+
ue as createNavigationFromFolder,
|
|
339
|
+
he as createNestedNavigationFromFolder,
|
|
340
|
+
I as extractFrontmatterData,
|
|
341
|
+
qe as filterVisibleNavigation,
|
|
342
|
+
Ce as findNavigationNode,
|
|
343
|
+
Ge as flattenNavigation,
|
|
344
|
+
pe as generateDatesFile,
|
|
345
|
+
Je as getAllFilePaths,
|
|
346
|
+
Z as getGitLastModified,
|
|
347
|
+
ee as getGitLastModifiedBatch,
|
|
348
|
+
Le as getLeafNodes,
|
|
349
|
+
Ve as getNodesAtDepth,
|
|
350
|
+
Re as getPrevNextNodes,
|
|
351
|
+
Ae as hasFrontmatter,
|
|
352
|
+
z as isGitRepository,
|
|
353
|
+
Te as isNodeActive,
|
|
354
|
+
me as manifestNeedsResolution,
|
|
355
|
+
Ue as parseFrontmatter,
|
|
356
|
+
ge as resolveManifest,
|
|
357
|
+
F as slugFromFilename,
|
|
358
|
+
w as titleFromFilename,
|
|
359
|
+
Ke as toSlug,
|
|
360
|
+
He as validateFrontmatter,
|
|
361
|
+
Be as validateManifest
|
|
233
362
|
};
|
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-
|
|
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-QFErVd9b.cjs"),p=require("./manifest-BkO3d77g.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-
|
|
7
|
-
import { v as m } from "./manifest-
|
|
6
|
+
import { p as g } from "./frontmatter-B5d9WZzh.js";
|
|
7
|
+
import { v as m } from "./manifest-DlSWyjsA.js";
|
|
8
8
|
class a extends Error {
|
|
9
9
|
constructor(r, n) {
|
|
10
10
|
super(r);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var M=Object.defineProperty;var D=(n,t,i)=>t in n?M(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i;var m=(n,t,i)=>D(n,typeof t!="symbol"?t+"":t,i);const e=require("zod"),d=e.z.enum(["v1","v2","v3"]),g=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(),lastModified:e.z.string().datetime({offset:!0}).optional()})),f=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:d,navigation:e.z.array(l),search:g.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(),lastModified:e.z.string().datetime({offset:!0}).optional()}),j=e.z.object({meta:p,content:e.z.string(),filePath:e.z.string()}),k=e.z.object({manifest:f,basePath:e.z.string()}),I=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(),lastModified:e.z.string().datetime({offset:!0}).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(),lastModified:e.z.string().datetime({offset:!0}).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:d,navigation:e.z.array(z),search:g.optional(),github:u.optional(),basePath:e.z.string().optional()});class b extends Error{constructor(i,o){super(i);m(this,"issues");this.name="ManifestValidationError",this.issues=o}}function q(n){const t=f.safeParse(n);if(!t.success){const i=t.error.issues.map(o=>`${o.path.join(".")}: ${o.message}`);throw new b("Invalid manifest",i)}return t.data}function B(n,t){const i=t.split("/").filter(Boolean);return v(n.navigation,i)}function v(n,t){if(t.length===0)return;const[i,...o]=t,a=n.find(r=>r.slug===i);if(a){if(o.length===0)return a;if(a.children)return v(a.children,o)}}function h(n){const t=[];return N(n.navigation,"",0,void 0,t),t}function N(n,t,i,o,a){for(const r of n){const s=t?`${t}/${r.slug}`:r.slug;a.push({...r,path:s,depth:i,parentPath:o}),r.children&&r.children.length>0&&N(r.children,s,i+1,s,a)}}function $(n,t){const i=t.split("/").filter(Boolean),o=[];let a=n.navigation,r="";for(const s of i){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(n){return h(n).filter(t=>t.file!==void 0)}function w(n,t){const i=S(n),o=i.findIndex(a=>a.path===t);return o===-1?{}:{prev:o>0?i[o-1]:void 0,next:o<i.length-1?i[o+1]:void 0}}function P(n,t){const i=t.split("/").filter(Boolean);if(i.length===0)return!1;if(n.slug===i[0]){if(i.length===1)return!0;if(n.children){const o=i.slice(1).join("/");return n.children.some(a=>P(a,o))}}return!1}function L(n,t){return h(n).filter(i=>i.depth===t)}exports.BreadcrumbItemSchema=I;exports.DocPageMetaSchema=p;exports.DocPageSchema=j;exports.DocsPackageManifestInputSchema=x;exports.DocsPackageManifestSchema=f;exports.FlatNavigationNodeSchema=V;exports.GitHubConfigSchema=u;exports.LoadedDocsPackageSchema=k;exports.ManifestValidationError=b;exports.NavigationNodeInputSchema=z;exports.NavigationNodeSchema=l;exports.SearchConfigSchema=g;exports.VendureVersionSchema=d;exports.buildBreadcrumbs=$;exports.findNavigationNode=B;exports.flattenNavigation=h;exports.getLeafNodes=S;exports.getNodesAtDepth=L;exports.getPrevNextNodes=w;exports.isNodeActive=P;exports.validateManifest=q;
|