@dogsbay/ssg-cli 0.2.0-beta.186 → 0.2.0-beta.188
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/AGENTS.md +168 -0
- package/README.md +3 -1
- package/THIRD-PARTY-NOTICES.txt +23 -17
- package/chunks/{build-command-X76EICE4.mjs → build-command-NJATVOUY.mjs} +34 -25
- package/chunks/check-command-FL5O3AXB.mjs +577 -0
- package/chunks/chunk-2EM7IEQT.mjs +95 -0
- package/chunks/{chunk-JABACD5T.mjs → chunk-5A2QPRCV.mjs} +1 -30
- package/chunks/chunk-5NQOUB5I.mjs +4534 -0
- package/chunks/{chunk-YQ2K646L.mjs → chunk-CYJ6GFVM.mjs} +32 -3
- package/chunks/{chunk-XQORVEL6.mjs → chunk-FFIXBXHD.mjs} +60 -233
- package/chunks/chunk-GFG5I7WI.mjs +807 -0
- package/chunks/{chunk-AOHGXC4D.mjs → chunk-GZ3E45TE.mjs} +518 -240
- package/chunks/chunk-IAAKV7V2.mjs +37 -0
- package/chunks/{chunk-YA6TJOAM.mjs → chunk-VJ6AESSJ.mjs} +216 -24
- package/chunks/chunk-X3UPCLX5.mjs +503 -0
- package/chunks/{chunk-TRECVC6H.mjs → chunk-ZDH4JRVX.mjs} +1041 -4051
- package/chunks/{chunk-FNP5PNJW.mjs → chunk-ZRGJHNES.mjs} +6 -0
- package/chunks/compare-W4DJYVHT.mjs +239 -0
- package/chunks/compare-command-U36H55IE.mjs +144 -0
- package/chunks/{css-build-VKKTSP6P.mjs → css-build-MKIHYHCX.mjs} +2 -1
- package/chunks/{dev-DXMZPST7.mjs → dev-X3PKN4G3.mjs} +77 -26
- package/chunks/{menu-W7ZXME4A.mjs → menu-J3CLVADF.mjs} +5 -3
- package/chunks/{publish-command-AVMRM4UZ.mjs → publish-command-SAPICGGM.mjs} +15 -8
- package/chunks/{release-diff-3OZOYBXR.mjs → release-diff-Y7X63MT3.mjs} +13 -7
- package/chunks/{serve-U2YV7AQH.mjs → serve-7DR4WSYA.mjs} +2 -2
- package/cli.mjs +17 -10
- package/package.json +4 -3
- package/chunks/check-command-SXDUKSAZ.mjs +0 -256
|
@@ -0,0 +1,4534 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
normalize,
|
|
5
|
+
scriptUrl
|
|
6
|
+
} from "./chunk-GZ3E45TE.mjs";
|
|
7
|
+
import {
|
|
8
|
+
load,
|
|
9
|
+
parseChoices,
|
|
10
|
+
readMarkdownStyle
|
|
11
|
+
} from "./chunk-VJ6AESSJ.mjs";
|
|
12
|
+
|
|
13
|
+
// node_modules/@dogsbay/site-files/dist/linear-regex.js
|
|
14
|
+
var LinearRegexError = class extends Error {
|
|
15
|
+
};
|
|
16
|
+
var LinearRegexBudgetError = class extends Error {
|
|
17
|
+
};
|
|
18
|
+
var MAX_COUNT = 100;
|
|
19
|
+
var MAX_PROGRAM = 2e4;
|
|
20
|
+
var MAX_GROUPS = 20;
|
|
21
|
+
var isWord = (c) => c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || c === 95;
|
|
22
|
+
var isDigit = (c) => c >= 48 && c <= 57;
|
|
23
|
+
var SPACE = /* @__PURE__ */ new Set([9, 10, 11, 12, 13, 32, 160, 5760, 8232, 8233, 8239, 8287, 12288, 65279]);
|
|
24
|
+
var isSpace = (c) => SPACE.has(c) || c >= 8192 && c <= 8202;
|
|
25
|
+
var isLineEnd = (c) => c === 10 || c === 13 || c === 8232 || c === 8233;
|
|
26
|
+
var Parser = class {
|
|
27
|
+
src;
|
|
28
|
+
i = 0;
|
|
29
|
+
groups = 0;
|
|
30
|
+
names = /* @__PURE__ */ new Map();
|
|
31
|
+
constructor(src) {
|
|
32
|
+
this.src = src;
|
|
33
|
+
}
|
|
34
|
+
parse() {
|
|
35
|
+
const node = this.alternation();
|
|
36
|
+
if (this.i < this.src.length)
|
|
37
|
+
throw this.fail(this.src[this.i] === ")" ? "unmatched )" : `unexpected ${this.src[this.i]}`);
|
|
38
|
+
return node;
|
|
39
|
+
}
|
|
40
|
+
newGroup() {
|
|
41
|
+
if (this.groups >= MAX_GROUPS)
|
|
42
|
+
throw this.fail(`more than ${MAX_GROUPS} groups; use (?:\u2026) for grouping`);
|
|
43
|
+
return ++this.groups;
|
|
44
|
+
}
|
|
45
|
+
fail(why) {
|
|
46
|
+
return new LinearRegexError(`${why} at ${this.i}`);
|
|
47
|
+
}
|
|
48
|
+
alternation() {
|
|
49
|
+
const options = [this.sequence()];
|
|
50
|
+
while (this.src[this.i] === "|") {
|
|
51
|
+
this.i++;
|
|
52
|
+
options.push(this.sequence());
|
|
53
|
+
}
|
|
54
|
+
return options.length === 1 ? options[0] : { t: "alt", options };
|
|
55
|
+
}
|
|
56
|
+
sequence() {
|
|
57
|
+
const parts = [];
|
|
58
|
+
while (this.i < this.src.length && this.src[this.i] !== "|" && this.src[this.i] !== ")") {
|
|
59
|
+
parts.push(this.quantified(this.atom()));
|
|
60
|
+
}
|
|
61
|
+
return parts.length === 0 ? { t: "empty" } : parts.length === 1 ? parts[0] : { t: "cat", parts };
|
|
62
|
+
}
|
|
63
|
+
quantified(atom) {
|
|
64
|
+
const c = this.src[this.i];
|
|
65
|
+
let min, max;
|
|
66
|
+
if (c === "*")
|
|
67
|
+
[min, max] = [0, Infinity];
|
|
68
|
+
else if (c === "+")
|
|
69
|
+
[min, max] = [1, Infinity];
|
|
70
|
+
else if (c === "?")
|
|
71
|
+
[min, max] = [0, 1];
|
|
72
|
+
else if (c === "{") {
|
|
73
|
+
const m = /^\{(\d+)(,(\d*))?\}/.exec(this.src.slice(this.i));
|
|
74
|
+
if (!m)
|
|
75
|
+
return atom;
|
|
76
|
+
min = Number(m[1]);
|
|
77
|
+
max = m[2] === void 0 ? min : m[3] === "" ? Infinity : Number(m[3]);
|
|
78
|
+
if (max < min)
|
|
79
|
+
throw this.fail("numbers out of order in {}");
|
|
80
|
+
if (min > MAX_COUNT || max !== Infinity && max > MAX_COUNT)
|
|
81
|
+
throw this.fail(`a count over ${MAX_COUNT}`);
|
|
82
|
+
this.i += m[0].length - 1;
|
|
83
|
+
} else
|
|
84
|
+
return atom;
|
|
85
|
+
this.i++;
|
|
86
|
+
if (atom.t === "assert")
|
|
87
|
+
throw this.fail("nothing to repeat");
|
|
88
|
+
if (max > min && nullable(atom))
|
|
89
|
+
throw this.fail("a repeated part that can match nothing (like (a?)* or (|a)+) is not supported");
|
|
90
|
+
const lazy = this.src[this.i] === "?";
|
|
91
|
+
if (lazy)
|
|
92
|
+
this.i++;
|
|
93
|
+
const next = this.src[this.i];
|
|
94
|
+
if (next === "*" || next === "+" || next === "?" || next === "{" && /^\{\d+(,\d*)?\}/.test(this.src.slice(this.i)))
|
|
95
|
+
throw this.fail("nothing to repeat");
|
|
96
|
+
return { t: "repeat", body: atom, min, max, lazy };
|
|
97
|
+
}
|
|
98
|
+
atom() {
|
|
99
|
+
const c = this.src[this.i];
|
|
100
|
+
if (c === "(")
|
|
101
|
+
return this.group();
|
|
102
|
+
if (c === "[")
|
|
103
|
+
return { t: "char", test: this.charClass() };
|
|
104
|
+
if (c === ".") {
|
|
105
|
+
this.i++;
|
|
106
|
+
return { t: "char", test: (x) => !isLineEnd(x) };
|
|
107
|
+
}
|
|
108
|
+
if (c === "^") {
|
|
109
|
+
this.i++;
|
|
110
|
+
return { t: "assert", kind: "start" };
|
|
111
|
+
}
|
|
112
|
+
if (c === "$") {
|
|
113
|
+
this.i++;
|
|
114
|
+
return { t: "assert", kind: "end" };
|
|
115
|
+
}
|
|
116
|
+
if (c === "\\") {
|
|
117
|
+
const next = this.src[this.i + 1];
|
|
118
|
+
if (next === "b" || next === "B") {
|
|
119
|
+
this.i += 2;
|
|
120
|
+
return { t: "assert", kind: next === "b" ? "word" : "notword" };
|
|
121
|
+
}
|
|
122
|
+
return { t: "char", test: this.escape(false) };
|
|
123
|
+
}
|
|
124
|
+
if (c === "*" || c === "+" || c === "?")
|
|
125
|
+
throw this.fail("nothing to repeat");
|
|
126
|
+
if (c === "{" && /^\{\d+(,\d*)?\}/.test(this.src.slice(this.i)))
|
|
127
|
+
throw this.fail("nothing to repeat");
|
|
128
|
+
this.i++;
|
|
129
|
+
const code = c.charCodeAt(0);
|
|
130
|
+
return { t: "char", test: (x) => x === code };
|
|
131
|
+
}
|
|
132
|
+
group() {
|
|
133
|
+
this.i++;
|
|
134
|
+
let index;
|
|
135
|
+
if (this.src[this.i] === "?") {
|
|
136
|
+
const rest = this.src.slice(this.i);
|
|
137
|
+
if (rest.startsWith("?:"))
|
|
138
|
+
this.i += 2;
|
|
139
|
+
else if (rest.startsWith("?=") || rest.startsWith("?!") || rest.startsWith("?<=") || rest.startsWith("?<!")) {
|
|
140
|
+
throw this.fail("lookahead and lookbehind are not supported");
|
|
141
|
+
} else if (rest.startsWith("?<")) {
|
|
142
|
+
const m = /^\?<([A-Za-z_$][\w$]*)>/.exec(rest);
|
|
143
|
+
if (!m)
|
|
144
|
+
throw this.fail("a group name must be letters, digits and _");
|
|
145
|
+
if (this.names.has(m[1]))
|
|
146
|
+
throw this.fail(`the group name ${m[1]} is used twice`);
|
|
147
|
+
index = this.newGroup();
|
|
148
|
+
this.names.set(m[1], index);
|
|
149
|
+
this.i += m[0].length;
|
|
150
|
+
} else
|
|
151
|
+
throw this.fail("flags and other (? groups are not supported");
|
|
152
|
+
} else
|
|
153
|
+
index = this.newGroup();
|
|
154
|
+
const body = this.alternation();
|
|
155
|
+
if (this.src[this.i] !== ")")
|
|
156
|
+
throw this.fail("missing )");
|
|
157
|
+
this.i++;
|
|
158
|
+
return { t: "group", index, body };
|
|
159
|
+
}
|
|
160
|
+
/** The character the last `escape` stood for, when it stood for one (not a class like `\d`). */
|
|
161
|
+
lastCode;
|
|
162
|
+
/** An escape after `\`, as a character test. `inClass`: `\b` is a backspace there. */
|
|
163
|
+
escape(inClass) {
|
|
164
|
+
this.i++;
|
|
165
|
+
const c = this.src[this.i++];
|
|
166
|
+
if (c === void 0)
|
|
167
|
+
throw this.fail("\\ at end of pattern");
|
|
168
|
+
this.lastCode = void 0;
|
|
169
|
+
const one = (code) => {
|
|
170
|
+
this.lastCode = code;
|
|
171
|
+
return (x) => x === code;
|
|
172
|
+
};
|
|
173
|
+
switch (c) {
|
|
174
|
+
case "d":
|
|
175
|
+
return isDigit;
|
|
176
|
+
case "D":
|
|
177
|
+
return (x) => !isDigit(x);
|
|
178
|
+
case "w":
|
|
179
|
+
return isWord;
|
|
180
|
+
case "W":
|
|
181
|
+
return (x) => !isWord(x);
|
|
182
|
+
case "s":
|
|
183
|
+
return isSpace;
|
|
184
|
+
case "S":
|
|
185
|
+
return (x) => !isSpace(x);
|
|
186
|
+
case "n":
|
|
187
|
+
return one(10);
|
|
188
|
+
case "r":
|
|
189
|
+
return one(13);
|
|
190
|
+
case "t":
|
|
191
|
+
return one(9);
|
|
192
|
+
case "f":
|
|
193
|
+
return one(12);
|
|
194
|
+
case "v":
|
|
195
|
+
return one(11);
|
|
196
|
+
case "0":
|
|
197
|
+
if (/\d/.test(this.src[this.i] ?? ""))
|
|
198
|
+
throw this.fail("octal escapes are not supported");
|
|
199
|
+
return one(0);
|
|
200
|
+
case "x": {
|
|
201
|
+
const m = /^[0-9a-fA-F]{2}/.exec(this.src.slice(this.i));
|
|
202
|
+
if (!m)
|
|
203
|
+
throw this.fail("\\x needs two hex digits");
|
|
204
|
+
this.i += 2;
|
|
205
|
+
return one(parseInt(m[0], 16));
|
|
206
|
+
}
|
|
207
|
+
case "u": {
|
|
208
|
+
const m = /^[0-9a-fA-F]{4}/.exec(this.src.slice(this.i));
|
|
209
|
+
if (!m)
|
|
210
|
+
throw this.fail("\\u needs four hex digits");
|
|
211
|
+
this.i += 4;
|
|
212
|
+
return one(parseInt(m[0], 16));
|
|
213
|
+
}
|
|
214
|
+
case "b":
|
|
215
|
+
if (inClass)
|
|
216
|
+
return one(8);
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
if (/[1-9]/.test(c) || c === "k")
|
|
220
|
+
throw this.fail("backreferences are not supported");
|
|
221
|
+
if (c === "p" || c === "P")
|
|
222
|
+
throw this.fail("\\p{\u2026} is not supported");
|
|
223
|
+
if (/[A-Za-z0-9]/.test(c))
|
|
224
|
+
throw this.fail(`\\${c} is not supported`);
|
|
225
|
+
return one(c.charCodeAt(0));
|
|
226
|
+
}
|
|
227
|
+
charClass() {
|
|
228
|
+
this.i++;
|
|
229
|
+
let negate = false;
|
|
230
|
+
if (this.src[this.i] === "^") {
|
|
231
|
+
negate = true;
|
|
232
|
+
this.i++;
|
|
233
|
+
}
|
|
234
|
+
const tests = [];
|
|
235
|
+
while (this.src[this.i] !== "]") {
|
|
236
|
+
if (this.i >= this.src.length)
|
|
237
|
+
throw this.fail("missing ]");
|
|
238
|
+
const lo = this.classAtom();
|
|
239
|
+
if (this.src[this.i] === "-" && this.src[this.i + 1] !== "]" && this.i + 1 < this.src.length) {
|
|
240
|
+
this.i++;
|
|
241
|
+
const hi = this.classAtom();
|
|
242
|
+
if (lo.code === void 0 || hi.code === void 0)
|
|
243
|
+
throw this.fail("a range needs single characters");
|
|
244
|
+
if (hi.code < lo.code)
|
|
245
|
+
throw this.fail("range out of order in []");
|
|
246
|
+
const [a, b] = [lo.code, hi.code];
|
|
247
|
+
tests.push((x) => x >= a && x <= b);
|
|
248
|
+
} else
|
|
249
|
+
tests.push(lo.test);
|
|
250
|
+
}
|
|
251
|
+
this.i++;
|
|
252
|
+
return negate ? (x) => !tests.some((t) => t(x)) : (x) => tests.some((t) => t(x));
|
|
253
|
+
}
|
|
254
|
+
classAtom() {
|
|
255
|
+
if (this.src[this.i] === "\\") {
|
|
256
|
+
const test = this.escape(true);
|
|
257
|
+
return { test, code: this.lastCode };
|
|
258
|
+
}
|
|
259
|
+
const code = this.src.charCodeAt(this.i++);
|
|
260
|
+
return { test: (x) => x === code, code };
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
function nullable(n) {
|
|
264
|
+
switch (n.t) {
|
|
265
|
+
case "char":
|
|
266
|
+
return false;
|
|
267
|
+
case "assert":
|
|
268
|
+
case "empty":
|
|
269
|
+
return true;
|
|
270
|
+
case "cat":
|
|
271
|
+
return n.parts.every(nullable);
|
|
272
|
+
case "alt":
|
|
273
|
+
return n.options.some(nullable);
|
|
274
|
+
case "group":
|
|
275
|
+
return nullable(n.body);
|
|
276
|
+
case "repeat":
|
|
277
|
+
return n.min === 0 || nullable(n.body);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function groupSpan(n) {
|
|
281
|
+
let lo = Infinity, hi = 0;
|
|
282
|
+
const walk = (x) => {
|
|
283
|
+
if (x.t === "group") {
|
|
284
|
+
if (x.index !== void 0)
|
|
285
|
+
lo = Math.min(lo, x.index), hi = Math.max(hi, x.index);
|
|
286
|
+
walk(x.body);
|
|
287
|
+
} else if (x.t === "cat")
|
|
288
|
+
x.parts.forEach(walk);
|
|
289
|
+
else if (x.t === "alt")
|
|
290
|
+
x.options.forEach(walk);
|
|
291
|
+
else if (x.t === "repeat")
|
|
292
|
+
walk(x.body);
|
|
293
|
+
};
|
|
294
|
+
walk(n);
|
|
295
|
+
return hi === 0 ? [0, 0] : [lo, hi];
|
|
296
|
+
}
|
|
297
|
+
function compile(node) {
|
|
298
|
+
const prog = [];
|
|
299
|
+
const emit = (inst) => {
|
|
300
|
+
if (prog.length >= MAX_PROGRAM)
|
|
301
|
+
throw new LinearRegexError("the pattern is too large once its counts are expanded");
|
|
302
|
+
prog.push(inst);
|
|
303
|
+
return prog.length - 1;
|
|
304
|
+
};
|
|
305
|
+
let visits = 0;
|
|
306
|
+
const gen = (n) => {
|
|
307
|
+
if (++visits > MAX_PROGRAM)
|
|
308
|
+
throw new LinearRegexError("the pattern is too large once its counts are expanded");
|
|
309
|
+
switch (n.t) {
|
|
310
|
+
case "empty":
|
|
311
|
+
return;
|
|
312
|
+
case "char":
|
|
313
|
+
emit({ op: "char", test: n.test });
|
|
314
|
+
return;
|
|
315
|
+
case "assert":
|
|
316
|
+
emit({ op: "assert", kind: n.kind });
|
|
317
|
+
return;
|
|
318
|
+
case "cat":
|
|
319
|
+
for (const p of n.parts)
|
|
320
|
+
gen(p);
|
|
321
|
+
return;
|
|
322
|
+
case "group":
|
|
323
|
+
if (n.index !== void 0)
|
|
324
|
+
emit({ op: "save", slot: 2 * n.index });
|
|
325
|
+
gen(n.body);
|
|
326
|
+
if (n.index !== void 0)
|
|
327
|
+
emit({ op: "save", slot: 2 * n.index + 1 });
|
|
328
|
+
return;
|
|
329
|
+
case "alt": {
|
|
330
|
+
const jumps = [];
|
|
331
|
+
n.options.forEach((opt, k) => {
|
|
332
|
+
if (k < n.options.length - 1) {
|
|
333
|
+
const split = emit({ op: "split", x: 0, y: 0 });
|
|
334
|
+
prog[split].x = prog.length;
|
|
335
|
+
gen(opt);
|
|
336
|
+
jumps.push(emit({ op: "jmp", to: 0 }));
|
|
337
|
+
prog[split].y = prog.length;
|
|
338
|
+
} else
|
|
339
|
+
gen(opt);
|
|
340
|
+
});
|
|
341
|
+
for (const j of jumps)
|
|
342
|
+
prog[j].to = prog.length;
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
case "repeat": {
|
|
346
|
+
const [lo, hi] = groupSpan(n.body);
|
|
347
|
+
const body = () => {
|
|
348
|
+
if (hi > 0)
|
|
349
|
+
emit({ op: "reset", from: 2 * lo, to: 2 * hi + 2 });
|
|
350
|
+
gen(n.body);
|
|
351
|
+
};
|
|
352
|
+
for (let k = 0; k < n.min; k++)
|
|
353
|
+
body();
|
|
354
|
+
if (n.max === Infinity) {
|
|
355
|
+
const split = emit({ op: "split", x: 0, y: 0 });
|
|
356
|
+
const bodyAt = prog.length;
|
|
357
|
+
body();
|
|
358
|
+
emit({ op: "jmp", to: split });
|
|
359
|
+
const out = prog.length;
|
|
360
|
+
prog[split] = n.lazy ? { op: "split", x: out, y: bodyAt } : { op: "split", x: bodyAt, y: out };
|
|
361
|
+
} else {
|
|
362
|
+
const splits = [];
|
|
363
|
+
for (let k = n.min; k < n.max; k++) {
|
|
364
|
+
splits.push(emit({ op: "split", x: 0, y: 0 }));
|
|
365
|
+
body();
|
|
366
|
+
}
|
|
367
|
+
const out = prog.length;
|
|
368
|
+
for (const s of splits)
|
|
369
|
+
prog[s] = n.lazy ? { op: "split", x: out, y: s + 1 } : { op: "split", x: s + 1, y: out };
|
|
370
|
+
}
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
};
|
|
375
|
+
gen(node);
|
|
376
|
+
emit({ op: "match" });
|
|
377
|
+
return prog;
|
|
378
|
+
}
|
|
379
|
+
var DEFAULT_STEPS = 1e6;
|
|
380
|
+
function linearRegex(source) {
|
|
381
|
+
const parser = new Parser(source);
|
|
382
|
+
const prog = compile(parser.parse());
|
|
383
|
+
const nslots = 2 * (parser.groups + 1);
|
|
384
|
+
const seen = new Float64Array(prog.length).fill(-1);
|
|
385
|
+
let generation = 0;
|
|
386
|
+
const exec = (input, from = 0, budget = { steps: DEFAULT_STEPS }) => {
|
|
387
|
+
const n = input.length;
|
|
388
|
+
let clist = [];
|
|
389
|
+
let nlist = [];
|
|
390
|
+
generation++;
|
|
391
|
+
let matched = null;
|
|
392
|
+
const charAt = (i) => i >= 0 && i < n ? input.charCodeAt(i) : -1;
|
|
393
|
+
const add = (list2, pc, slots, pos) => {
|
|
394
|
+
const stack = [{ pc, slots }];
|
|
395
|
+
while (stack.length) {
|
|
396
|
+
const top = stack.pop();
|
|
397
|
+
if (--budget.steps < 0)
|
|
398
|
+
throw new LinearRegexBudgetError("the pattern ran past its step budget");
|
|
399
|
+
if (seen[top.pc] === generation)
|
|
400
|
+
continue;
|
|
401
|
+
seen[top.pc] = generation;
|
|
402
|
+
const inst = prog[top.pc];
|
|
403
|
+
switch (inst.op) {
|
|
404
|
+
case "jmp":
|
|
405
|
+
stack.push({ pc: inst.to, slots: top.slots });
|
|
406
|
+
break;
|
|
407
|
+
case "split":
|
|
408
|
+
stack.push({ pc: inst.y, slots: top.slots }, { pc: inst.x, slots: top.slots });
|
|
409
|
+
break;
|
|
410
|
+
case "save": {
|
|
411
|
+
budget.steps -= nslots;
|
|
412
|
+
const s = top.slots.slice();
|
|
413
|
+
s[inst.slot] = pos;
|
|
414
|
+
stack.push({ pc: top.pc + 1, slots: s });
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
case "reset": {
|
|
418
|
+
budget.steps -= nslots;
|
|
419
|
+
const s = top.slots.slice();
|
|
420
|
+
s.fill(-1, inst.from, inst.to);
|
|
421
|
+
stack.push({ pc: top.pc + 1, slots: s });
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
case "assert": {
|
|
425
|
+
const ok = inst.kind === "start" ? pos === 0 : inst.kind === "end" ? pos === n : isWord(charAt(pos - 1)) !== isWord(charAt(pos)) === (inst.kind === "word");
|
|
426
|
+
if (ok)
|
|
427
|
+
stack.push({ pc: top.pc + 1, slots: top.slots });
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
default:
|
|
431
|
+
list2.push(top);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
for (let pos = from; ; pos++) {
|
|
436
|
+
if (!matched) {
|
|
437
|
+
const start = new Int32Array(nslots).fill(-1);
|
|
438
|
+
start[0] = pos;
|
|
439
|
+
add(clist, 0, start, pos);
|
|
440
|
+
}
|
|
441
|
+
if (clist.length === 0) {
|
|
442
|
+
if (matched || pos >= n)
|
|
443
|
+
break;
|
|
444
|
+
generation++;
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
generation++;
|
|
448
|
+
const c = pos < n ? input.charCodeAt(pos) : -1;
|
|
449
|
+
for (const th of clist) {
|
|
450
|
+
if (--budget.steps < 0)
|
|
451
|
+
throw new LinearRegexBudgetError("the pattern ran past its step budget");
|
|
452
|
+
const inst = prog[th.pc];
|
|
453
|
+
if (inst.op === "match") {
|
|
454
|
+
budget.steps -= nslots;
|
|
455
|
+
matched = th.slots.slice();
|
|
456
|
+
matched[1] = pos;
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
if (inst.op === "char" && c >= 0 && inst.test(c))
|
|
460
|
+
add(nlist, th.pc + 1, th.slots, pos + 1);
|
|
461
|
+
}
|
|
462
|
+
if (pos >= n)
|
|
463
|
+
break;
|
|
464
|
+
[clist, nlist] = [nlist, clist];
|
|
465
|
+
nlist.length = 0;
|
|
466
|
+
}
|
|
467
|
+
return matched ? { slots: matched } : null;
|
|
468
|
+
};
|
|
469
|
+
const replace = (input, replacement, budget = { steps: DEFAULT_STEPS }, maxOutput = Infinity) => {
|
|
470
|
+
let out = "";
|
|
471
|
+
let pos = 0;
|
|
472
|
+
let last = 0;
|
|
473
|
+
while (pos <= input.length) {
|
|
474
|
+
const m = exec(input, pos, budget);
|
|
475
|
+
if (!m)
|
|
476
|
+
break;
|
|
477
|
+
const [s, e] = [m.slots[0], m.slots[1]];
|
|
478
|
+
out += input.slice(last, s) + expand(replacement, input, m.slots, parser.groups, parser.names, maxOutput - out.length);
|
|
479
|
+
if (out.length > maxOutput)
|
|
480
|
+
throw new LinearRegexBudgetError("the replacements made the text too long");
|
|
481
|
+
last = e;
|
|
482
|
+
pos = e === s ? e + 1 : e;
|
|
483
|
+
}
|
|
484
|
+
return out + input.slice(last);
|
|
485
|
+
};
|
|
486
|
+
return { source, groups: parser.groups, names: parser.names, exec, replace };
|
|
487
|
+
}
|
|
488
|
+
function expand(rep, input, slots, groups, names, room) {
|
|
489
|
+
if (!rep.includes("$"))
|
|
490
|
+
return rep;
|
|
491
|
+
const group = (k) => slots[2 * k] < 0 ? "" : input.slice(slots[2 * k], slots[2 * k + 1]);
|
|
492
|
+
let out = "";
|
|
493
|
+
for (let i = 0; i < rep.length; i++) {
|
|
494
|
+
if (out.length > room)
|
|
495
|
+
return out;
|
|
496
|
+
const c = rep[i];
|
|
497
|
+
if (c !== "$" || i === rep.length - 1) {
|
|
498
|
+
out += c;
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
501
|
+
const d = rep[i + 1];
|
|
502
|
+
if (d === "$")
|
|
503
|
+
out += "$", i++;
|
|
504
|
+
else if (d === "&")
|
|
505
|
+
out += group(0), i++;
|
|
506
|
+
else if (d === "`")
|
|
507
|
+
out += input.slice(0, slots[0]), i++;
|
|
508
|
+
else if (d === "'")
|
|
509
|
+
out += input.slice(slots[1]), i++;
|
|
510
|
+
else if (/\d/.test(d)) {
|
|
511
|
+
const two = Number(rep.slice(i + 1, i + 3));
|
|
512
|
+
if (/^\d\d$/.test(rep.slice(i + 1, i + 3)) && two >= 1 && two <= groups)
|
|
513
|
+
out += group(two), i += 2;
|
|
514
|
+
else if (Number(d) >= 1 && Number(d) <= groups)
|
|
515
|
+
out += group(Number(d)), i++;
|
|
516
|
+
else
|
|
517
|
+
out += "$";
|
|
518
|
+
} else if (d === "<" && names.size) {
|
|
519
|
+
const close = rep.indexOf(">", i + 2);
|
|
520
|
+
if (close < 0)
|
|
521
|
+
out += "$";
|
|
522
|
+
else {
|
|
523
|
+
const k = names.get(rep.slice(i + 2, close));
|
|
524
|
+
out += k === void 0 ? "" : group(k);
|
|
525
|
+
i = close;
|
|
526
|
+
}
|
|
527
|
+
} else
|
|
528
|
+
out += "$";
|
|
529
|
+
}
|
|
530
|
+
return out;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// node_modules/@dogsbay/site-files/dist/compare.js
|
|
534
|
+
var IGNORE_LIMITS = {
|
|
535
|
+
/** Rules per comparison. */
|
|
536
|
+
rules: 32,
|
|
537
|
+
/** Characters per pattern. */
|
|
538
|
+
pattern: 500,
|
|
539
|
+
/** Characters per replacement. */
|
|
540
|
+
replace: 200,
|
|
541
|
+
/** Characters of one value the rules see; a longer value is compared as written. */
|
|
542
|
+
value: 64 * 1024,
|
|
543
|
+
/**
|
|
544
|
+
* Engine steps for one value, all rules together (linear-regex.ts: every step is counted). Past
|
|
545
|
+
* it the value is compared as written and `onLimit` hears which rule stopped.
|
|
546
|
+
*/
|
|
547
|
+
steps: 2e6,
|
|
548
|
+
/**
|
|
549
|
+
* Engine steps for a whole comparison (every value of every page of one pair): past it, the
|
|
550
|
+
* remaining values are compared as written. A step is about 20 ns, so about 2 s of work.
|
|
551
|
+
*/
|
|
552
|
+
totalSteps: 1e8
|
|
553
|
+
};
|
|
554
|
+
var IGNORED_TOKEN = "\uFFFC";
|
|
555
|
+
var SCOPE_KINDS = {
|
|
556
|
+
links: ["href"],
|
|
557
|
+
text: ["text"],
|
|
558
|
+
code: ["code"],
|
|
559
|
+
all: ["href", "text", "code"]
|
|
560
|
+
};
|
|
561
|
+
function escapeRegExp(s) {
|
|
562
|
+
return s.replace(/[.*+?^${}()|[\]\\/-]/g, "\\$&");
|
|
563
|
+
}
|
|
564
|
+
function withVersions(pattern, pair) {
|
|
565
|
+
return pattern.replace(/(\\*)\{(old|new)\}/g, (m, slashes, which) => slashes.length % 2 === 1 ? m : `${slashes}(?:${escapeRegExp(pair[which])})`);
|
|
566
|
+
}
|
|
567
|
+
function compileIgnoreRules(rules, pair, opts = {}) {
|
|
568
|
+
const errors = [];
|
|
569
|
+
if (!rules || Array.isArray(rules) && rules.length === 0)
|
|
570
|
+
return { errors };
|
|
571
|
+
if (!Array.isArray(rules))
|
|
572
|
+
return { errors: ["ignore: must be a list of rules"] };
|
|
573
|
+
if (rules.length > IGNORE_LIMITS.rules)
|
|
574
|
+
errors.push(`ignore: ${rules.length} rules; at most ${IGNORE_LIMITS.rules}`);
|
|
575
|
+
const compiled = [];
|
|
576
|
+
rules.forEach((rule, n) => {
|
|
577
|
+
const name = `ignore[${n}]`;
|
|
578
|
+
if (!rule || typeof rule !== "object" || typeof rule.pattern !== "string" || rule.pattern === "") {
|
|
579
|
+
errors.push(`${name}: needs a pattern`);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const scope = rule.in ?? "all";
|
|
583
|
+
if (typeof scope !== "string" || !Object.hasOwn(SCOPE_KINDS, scope)) {
|
|
584
|
+
errors.push(`${name}: in: ${String(scope)} \u2014 one of links, text, code, all`);
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
if (rule.replace !== void 0 && typeof rule.replace !== "string") {
|
|
588
|
+
errors.push(`${name}: replace must be text`);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (rule.pattern.length > IGNORE_LIMITS.pattern) {
|
|
592
|
+
errors.push(`${name}: the pattern is ${rule.pattern.length} characters; at most ${IGNORE_LIMITS.pattern}`);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if ((rule.replace ?? "").length > IGNORE_LIMITS.replace) {
|
|
596
|
+
errors.push(`${name}: replace is ${rule.replace.length} characters; at most ${IGNORE_LIMITS.replace}`);
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
const source = withVersions(rule.pattern, pair);
|
|
600
|
+
let re;
|
|
601
|
+
try {
|
|
602
|
+
re = linearRegex(source);
|
|
603
|
+
} catch (e) {
|
|
604
|
+
if (!(e instanceof LinearRegexError))
|
|
605
|
+
throw e;
|
|
606
|
+
errors.push(`${name}: ${e.message.replace(/ at \d+$/, "")} (in ${JSON.stringify(rule.pattern)})`);
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
if (re.exec("") !== null) {
|
|
610
|
+
errors.push(`${name}: the pattern matches empty text`);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
compiled.push({ re, replace: rule.replace ?? IGNORED_TOKEN, kinds: SCOPE_KINDS[scope], name });
|
|
614
|
+
});
|
|
615
|
+
if (errors.length)
|
|
616
|
+
return { errors };
|
|
617
|
+
let total = opts.totalSteps ?? IGNORE_LIMITS.totalSteps;
|
|
618
|
+
let spent = false;
|
|
619
|
+
const compareValue = (kind, value) => {
|
|
620
|
+
if (value.length > IGNORE_LIMITS.value || spent)
|
|
621
|
+
return value;
|
|
622
|
+
const perValue = opts.steps ?? IGNORE_LIMITS.steps;
|
|
623
|
+
const budget = { steps: Math.min(perValue, total) };
|
|
624
|
+
const maxOutput = 2 * value.length + 64;
|
|
625
|
+
let out = value;
|
|
626
|
+
try {
|
|
627
|
+
for (const rule of compiled) {
|
|
628
|
+
if (!rule.kinds.includes(kind))
|
|
629
|
+
continue;
|
|
630
|
+
try {
|
|
631
|
+
out = rule.re.replace(out, rule.replace, budget, maxOutput);
|
|
632
|
+
} catch (e) {
|
|
633
|
+
if (!(e instanceof LinearRegexBudgetError))
|
|
634
|
+
throw e;
|
|
635
|
+
if (budget.steps < 0 && total <= perValue) {
|
|
636
|
+
spent = true;
|
|
637
|
+
opts.onLimit?.(rule.name, "the comparison ran past its total step budget; the remaining values are compared as written");
|
|
638
|
+
} else {
|
|
639
|
+
opts.onLimit?.(rule.name, `${e.message}; the value is compared as written`);
|
|
640
|
+
}
|
|
641
|
+
return value;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return out;
|
|
645
|
+
} finally {
|
|
646
|
+
total -= Math.min(perValue, total) - Math.max(budget.steps, 0);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
return { compareValue, errors };
|
|
650
|
+
}
|
|
651
|
+
function pairVersions(versions, pairs) {
|
|
652
|
+
const errors = [];
|
|
653
|
+
if (pairs === void 0)
|
|
654
|
+
return { pairs: [], errors };
|
|
655
|
+
if (pairs === "previous") {
|
|
656
|
+
const out2 = [];
|
|
657
|
+
versions.forEach((v, i) => {
|
|
658
|
+
if (v.hidden)
|
|
659
|
+
return;
|
|
660
|
+
const older = versions.slice(i + 1).find((o) => !o.prerelease && !o.hidden);
|
|
661
|
+
if (older)
|
|
662
|
+
out2.push({ old: older.id, new: v.id });
|
|
663
|
+
});
|
|
664
|
+
return { pairs: out2, errors };
|
|
665
|
+
}
|
|
666
|
+
if (!Array.isArray(pairs))
|
|
667
|
+
return { pairs: [], errors: ["pairs: previous, or a list of { old, new }"] };
|
|
668
|
+
const ids = new Set(versions.map((v) => v.id));
|
|
669
|
+
const out = [];
|
|
670
|
+
const seen = /* @__PURE__ */ new Map();
|
|
671
|
+
pairs.forEach((p, n) => {
|
|
672
|
+
const name = `pairs[${n}]`;
|
|
673
|
+
if (!p || typeof p !== "object" || p.old === void 0 || p.new === void 0) {
|
|
674
|
+
errors.push(`${name}: needs old and new`);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
let ok = true;
|
|
678
|
+
for (const side of ["old", "new"]) {
|
|
679
|
+
const end = p[side];
|
|
680
|
+
if (typeof end === "string" && !ids.has(end)) {
|
|
681
|
+
errors.push(`${name}: ${side}: no version "${end}"`);
|
|
682
|
+
ok = false;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
for (const side of ["old", "new"]) {
|
|
686
|
+
const end = p[side];
|
|
687
|
+
if (typeof end !== "string" && (end === null || typeof end !== "object" || Array.isArray(end) || Object.keys(end).length === 0)) {
|
|
688
|
+
errors.push(`${name}: ${side}: a version id, or what the builder reads as one end ({ ref: \u2026 })`);
|
|
689
|
+
ok = false;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
const key = JSON.stringify([p.old, p.new]);
|
|
693
|
+
if (JSON.stringify(p.old) === JSON.stringify(p.new)) {
|
|
694
|
+
errors.push(`${name}: old and new are the same version`);
|
|
695
|
+
ok = false;
|
|
696
|
+
} else if (seen.has(key)) {
|
|
697
|
+
errors.push(`${name}: the same pair as pairs[${seen.get(key)}]`);
|
|
698
|
+
ok = false;
|
|
699
|
+
}
|
|
700
|
+
if (p.label !== void 0 && (typeof p.label !== "string" || !p.label.trim())) {
|
|
701
|
+
errors.push(`${name}: label must be text`);
|
|
702
|
+
ok = false;
|
|
703
|
+
}
|
|
704
|
+
if (ok) {
|
|
705
|
+
seen.set(key, n);
|
|
706
|
+
out.push({ old: p.old, new: p.new, ...p.label !== void 0 ? { label: p.label } : {} });
|
|
707
|
+
}
|
|
708
|
+
});
|
|
709
|
+
return { pairs: out, errors };
|
|
710
|
+
}
|
|
711
|
+
function matchPages(oldPaths, newPaths, opts = {}) {
|
|
712
|
+
const oldSet = new Set(oldPaths);
|
|
713
|
+
const newSet = new Set(newPaths);
|
|
714
|
+
const norm = (p) => p.replace(/[?#].*$/, "").replace(/^\/+|\/+$/g, "").replace(/\.md$/, "").replace(/(^|\/)index$/, "").replace(/\/+$/, "") || "index";
|
|
715
|
+
const onPurpose = new Set((opts.removed ?? []).map(norm));
|
|
716
|
+
const entries = new Map((opts.release?.entries ?? []).map((e) => [e.path, e]));
|
|
717
|
+
const out = [];
|
|
718
|
+
const landed = /* @__PURE__ */ new Set();
|
|
719
|
+
for (const path of oldSet) {
|
|
720
|
+
if (newSet.has(path)) {
|
|
721
|
+
out.push({ status: "both", old: path, new: path });
|
|
722
|
+
continue;
|
|
723
|
+
}
|
|
724
|
+
const e = entries.get(path);
|
|
725
|
+
const inside = e?.to !== void 0 && !e.to.startsWith("/") && !/^[a-z][a-z0-9+.-]*:/i.test(e.to);
|
|
726
|
+
const to = inside ? norm(e.to) : void 0;
|
|
727
|
+
const movesTo = e && to !== void 0 && newSet.has(to) && (e.status === "moved" || e.status === "candidate" || e.status === "redirected") ? to : void 0;
|
|
728
|
+
if (movesTo !== void 0 && (oldSet.has(movesTo) || landed.has(movesTo))) {
|
|
729
|
+
out.push({ status: "removed", old: path, mergedInto: movesTo, ...e?.evidence?.length ? { evidence: [...e.evidence] } : {} });
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
if (movesTo !== void 0) {
|
|
733
|
+
landed.add(movesTo);
|
|
734
|
+
out.push({
|
|
735
|
+
status: "moved",
|
|
736
|
+
old: path,
|
|
737
|
+
new: movesTo,
|
|
738
|
+
...e.status === "candidate" ? { probable: true } : {},
|
|
739
|
+
...e.evidence?.length ? { evidence: [...e.evidence] } : {}
|
|
740
|
+
});
|
|
741
|
+
continue;
|
|
742
|
+
}
|
|
743
|
+
out.push({
|
|
744
|
+
status: "removed",
|
|
745
|
+
old: path,
|
|
746
|
+
...e?.status === "removed-ok" || onPurpose.has(path) ? { onPurpose: true } : {}
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
for (const path of newSet) {
|
|
750
|
+
if (!oldSet.has(path) && !landed.has(path))
|
|
751
|
+
out.push({ status: "added", new: path });
|
|
752
|
+
}
|
|
753
|
+
return out;
|
|
754
|
+
}
|
|
755
|
+
var RANK = { removed: 3, added: 2, moved: 1, changed: 0 };
|
|
756
|
+
var WORD = { removed: "removed", added: "new", moved: "moved", changed: "changed" };
|
|
757
|
+
var defaultPathOf = (href) => {
|
|
758
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//"))
|
|
759
|
+
return void 0;
|
|
760
|
+
const bare = href.replace(/[?#].*$/, "").replace(/^\/+|\/+$/g, "");
|
|
761
|
+
return bare || "index";
|
|
762
|
+
};
|
|
763
|
+
function changeMarks(newNav, oldNav, changes, opts = {}) {
|
|
764
|
+
const pathOf = opts.pathOf ?? defaultPathOf;
|
|
765
|
+
const subtreeLabel = opts.subtreeLabel ?? ((k, n) => `contains ${n} ${WORD[k]} page${n === 1 ? "" : "s"}`);
|
|
766
|
+
const markOf = (kind) => ({ kind });
|
|
767
|
+
const decorate = (items) => items.map((item) => {
|
|
768
|
+
const path = item.href !== void 0 ? pathOf(item.href) : void 0;
|
|
769
|
+
const kind = path !== void 0 ? changes.get(path) : void 0;
|
|
770
|
+
const { mark: _mark, children: _children, ...rest } = item;
|
|
771
|
+
const own = kind && kind !== "removed" ? markOf(kind) : item.mark && !item.mark.subtree ? item.mark : void 0;
|
|
772
|
+
return {
|
|
773
|
+
...rest,
|
|
774
|
+
...own ? { mark: own } : {},
|
|
775
|
+
...item.children ? { children: decorate(item.children) } : {}
|
|
776
|
+
};
|
|
777
|
+
});
|
|
778
|
+
const nav = decorate(newNav);
|
|
779
|
+
const removed = new Set([...changes].filter(([, k]) => k === "removed").map(([p]) => p));
|
|
780
|
+
const ensureGroup = (labels) => {
|
|
781
|
+
let items = nav;
|
|
782
|
+
for (const label of labels) {
|
|
783
|
+
let group = items.find((i) => i.children && i.label === label);
|
|
784
|
+
if (!group) {
|
|
785
|
+
group = { label, children: [] };
|
|
786
|
+
items.push(group);
|
|
787
|
+
}
|
|
788
|
+
items = group.children;
|
|
789
|
+
}
|
|
790
|
+
return items;
|
|
791
|
+
};
|
|
792
|
+
const pathFor = /* @__PURE__ */ new WeakMap();
|
|
793
|
+
const pathIn = (t) => pathFor.get(t) ?? (t.href !== void 0 ? pathOf(t.href) : void 0);
|
|
794
|
+
const placed = /* @__PURE__ */ new Set();
|
|
795
|
+
const splice = (oldItems, labels) => {
|
|
796
|
+
oldItems.forEach((item, i) => {
|
|
797
|
+
const path = item.href !== void 0 ? pathOf(item.href) : void 0;
|
|
798
|
+
if (path !== void 0 && removed.has(path) && !placed.has(path)) {
|
|
799
|
+
placed.add(path);
|
|
800
|
+
const target = ensureGroup(labels);
|
|
801
|
+
const href = opts.removedHref ? opts.removedHref(path, item.href) : item.href;
|
|
802
|
+
const entry2 = {
|
|
803
|
+
label: item.label,
|
|
804
|
+
...href !== void 0 ? { href } : {},
|
|
805
|
+
mark: markOf("removed"),
|
|
806
|
+
...item.children?.length ? { children: [] } : {}
|
|
807
|
+
};
|
|
808
|
+
pathFor.set(entry2, path);
|
|
809
|
+
let at = -1;
|
|
810
|
+
for (let k = i - 1; k >= 0 && at === -1; k--) {
|
|
811
|
+
const was = oldItems[k].href !== void 0 ? pathOf(oldItems[k].href) : void 0;
|
|
812
|
+
if (was === void 0)
|
|
813
|
+
continue;
|
|
814
|
+
const prev = opts.moved?.get(was) ?? was;
|
|
815
|
+
at = target.findIndex((t) => pathIn(t) === prev);
|
|
816
|
+
}
|
|
817
|
+
target.splice(at + 1, 0, entry2);
|
|
818
|
+
}
|
|
819
|
+
if (item.children)
|
|
820
|
+
splice(item.children, [...labels, item.label]);
|
|
821
|
+
});
|
|
822
|
+
};
|
|
823
|
+
splice(oldNav, []);
|
|
824
|
+
const rollUp = (item) => {
|
|
825
|
+
const own = item.mark && !item.mark.subtree ? item.mark : void 0;
|
|
826
|
+
if (!item.children?.length)
|
|
827
|
+
return { item, kinds: own ? [own.kind] : [] };
|
|
828
|
+
const walked = item.children.map(rollUp);
|
|
829
|
+
const kinds = walked.flatMap((w) => w.kinds).concat(own ? [own.kind] : []);
|
|
830
|
+
const children = walked.map((w) => w.item);
|
|
831
|
+
const { mark: _m, ...rest } = item;
|
|
832
|
+
if (own)
|
|
833
|
+
return { item: { ...rest, children, mark: own }, kinds };
|
|
834
|
+
if (!kinds.length)
|
|
835
|
+
return { item: { ...rest, children }, kinds };
|
|
836
|
+
const top = [...kinds].sort((a, b) => RANK[b] - RANK[a])[0];
|
|
837
|
+
const count = kinds.filter((k) => k === top).length;
|
|
838
|
+
return { item: { ...rest, children, mark: { kind: top, subtree: true, label: subtreeLabel(top, count) } }, kinds };
|
|
839
|
+
};
|
|
840
|
+
return nav.map((i) => rollUp(i).item);
|
|
841
|
+
}
|
|
842
|
+
function createSummary() {
|
|
843
|
+
const s = { pages: 0, same: 0, changed: 0, added: 0, removed: 0, removedOnPurpose: 0, moved: 0, ignored: 0 };
|
|
844
|
+
return {
|
|
845
|
+
add(row) {
|
|
846
|
+
s.pages++;
|
|
847
|
+
s.ignored += row.stats?.ignored ?? 0;
|
|
848
|
+
switch (row.status) {
|
|
849
|
+
case "added":
|
|
850
|
+
s.added++;
|
|
851
|
+
return "added";
|
|
852
|
+
case "removed":
|
|
853
|
+
s.removed++;
|
|
854
|
+
if (row.onPurpose)
|
|
855
|
+
s.removedOnPurpose++;
|
|
856
|
+
return "removed";
|
|
857
|
+
case "moved":
|
|
858
|
+
s.moved++;
|
|
859
|
+
return "moved";
|
|
860
|
+
case "both": {
|
|
861
|
+
const changed = row.changed ?? (row.stats ? row.stats.unchanged === false : false);
|
|
862
|
+
if (changed) {
|
|
863
|
+
s.changed++;
|
|
864
|
+
return "changed";
|
|
865
|
+
}
|
|
866
|
+
s.same++;
|
|
867
|
+
return void 0;
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
},
|
|
871
|
+
result: () => ({ ...s })
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
function readCompare(raw, versions, at = "content.compare") {
|
|
875
|
+
if (raw === void 0)
|
|
876
|
+
return { errors: [] };
|
|
877
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw))
|
|
878
|
+
return { errors: [`${at}: a mapping with pairs: and ignore:`] };
|
|
879
|
+
const block = raw;
|
|
880
|
+
const errors = [];
|
|
881
|
+
for (const key of Object.keys(block))
|
|
882
|
+
if (key !== "pairs" && key !== "ignore")
|
|
883
|
+
errors.push(`${at}: unknown key ${JSON.stringify(key)} (pairs, ignore)`);
|
|
884
|
+
if (!versions?.length)
|
|
885
|
+
errors.push(`${at}: compares versions, and there are none declared beside it`);
|
|
886
|
+
const pairs = block.pairs ?? "previous";
|
|
887
|
+
if (pairs !== "previous" && !Array.isArray(pairs))
|
|
888
|
+
errors.push(`${at}.pairs: previous, or a list of { old, new }`);
|
|
889
|
+
else if (versions?.length) {
|
|
890
|
+
for (const e of pairVersions(versions, pairs).errors)
|
|
891
|
+
errors.push(`${at}.${e}`);
|
|
892
|
+
}
|
|
893
|
+
if (block.ignore !== void 0) {
|
|
894
|
+
if (!Array.isArray(block.ignore))
|
|
895
|
+
errors.push(`${at}.ignore: a list of rules ({ in, pattern, replace })`);
|
|
896
|
+
else {
|
|
897
|
+
for (const [n, rule] of block.ignore.entries()) {
|
|
898
|
+
if (rule && typeof rule === "object" && !Array.isArray(rule)) {
|
|
899
|
+
for (const key of Object.keys(rule))
|
|
900
|
+
if (!["in", "pattern", "replace"].includes(key))
|
|
901
|
+
errors.push(`${at}.ignore[${n}]: unknown key ${JSON.stringify(key)} (in, pattern, replace)`);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
const names = versions?.length && (pairs === "previous" || Array.isArray(pairs)) ? pairVersions(versions, pairs).pairs : [];
|
|
905
|
+
const ends = names.filter((p) => typeof p.old === "string" && typeof p.new === "string");
|
|
906
|
+
const seenErrors = /* @__PURE__ */ new Set();
|
|
907
|
+
for (const pair of ends.length ? ends : [{ old: "0", new: "1" }]) {
|
|
908
|
+
for (const e of compileIgnoreRules(block.ignore, pair).errors)
|
|
909
|
+
seenErrors.add(`${at}.${e}`);
|
|
910
|
+
}
|
|
911
|
+
errors.push(...seenErrors);
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
if (errors.length)
|
|
915
|
+
return { errors };
|
|
916
|
+
return {
|
|
917
|
+
compare: {
|
|
918
|
+
pairs,
|
|
919
|
+
...block.ignore !== void 0 ? { ignore: block.ignore } : {}
|
|
920
|
+
},
|
|
921
|
+
errors
|
|
922
|
+
};
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
// node_modules/@dogsbay/site-check/dist/lib/page.js
|
|
926
|
+
function titleOf(page) {
|
|
927
|
+
const fm = page.frontmatter?.["title"];
|
|
928
|
+
return (typeof fm === "string" && fm.trim() ? fm : page.title ?? "").trim();
|
|
929
|
+
}
|
|
930
|
+
function flat(s) {
|
|
931
|
+
return JSON.parse(JSON.stringify(s));
|
|
932
|
+
}
|
|
933
|
+
function pageKey(pathOrUrl, urlBase = "") {
|
|
934
|
+
let p = pathOrUrl.replace(/[?#].*$/, "");
|
|
935
|
+
const m = /^[a-z][a-z0-9+.-]*:\/\/[^/]*(.*)$/i.exec(p) ?? /^\/\/[^/]*(.*)$/.exec(p);
|
|
936
|
+
if (m)
|
|
937
|
+
p = m[1];
|
|
938
|
+
p = p.replace(/^\/+/, "");
|
|
939
|
+
const base = urlBase.replace(/^\/+|\/+$/g, "");
|
|
940
|
+
if (m && base && (p === base || p.startsWith(base + "/")))
|
|
941
|
+
p = p.slice(base.length);
|
|
942
|
+
return p.replace(/^\/+|\/+$/g, "").replace(/(^|\/)index\.html$/, "").replace(/\.html$/, "").replace(/\/+$/, "");
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// node_modules/@dogsbay/site-check/dist/lib/release.js
|
|
946
|
+
var MOVED_SIMILARITY = 0.6;
|
|
947
|
+
var MIN_SHINGLES = 8;
|
|
948
|
+
function compareRelease(input) {
|
|
949
|
+
const toPaths = new Set(input.to.map((p) => p.path));
|
|
950
|
+
const fromPaths = new Set(input.from.map((p) => p.path));
|
|
951
|
+
const removed = new Set((input.removed ?? []).map(normalizeRemoved));
|
|
952
|
+
const fresh = input.to.filter((p) => !fromPaths.has(p.path)).sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
953
|
+
const entries = [];
|
|
954
|
+
for (const page of input.from) {
|
|
955
|
+
if (toPaths.has(page.path))
|
|
956
|
+
continue;
|
|
957
|
+
const about = { ...page.source !== void 0 ? { source: page.source } : {}, ...page.index ? { index: true } : {} };
|
|
958
|
+
const redirect = input.redirects?.get(page.path);
|
|
959
|
+
if (redirect !== void 0) {
|
|
960
|
+
entries.push({ path: page.path, status: "redirected", to: redirect, ...about });
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
if (removed.has(page.path)) {
|
|
964
|
+
entries.push({ path: page.path, status: "removed-ok", ...about });
|
|
965
|
+
continue;
|
|
966
|
+
}
|
|
967
|
+
entries.push({ ...match(page, fresh, toPaths, input.renames), ...about });
|
|
968
|
+
}
|
|
969
|
+
return entries;
|
|
970
|
+
}
|
|
971
|
+
function normalizeRemoved(raw) {
|
|
972
|
+
const p = raw.trim().replace(/^\/+|\/+$/g, "").replace(/\.(md|markdown|mdx)$/i, "").replace(/(^|\/)index$/, "");
|
|
973
|
+
return p || "index";
|
|
974
|
+
}
|
|
975
|
+
function match(page, fresh, toPaths, renames) {
|
|
976
|
+
const renamed = renames?.get(page.path);
|
|
977
|
+
if (renamed !== void 0 && toPaths.has(renamed)) {
|
|
978
|
+
return { path: page.path, status: "moved", to: renamed, evidence: ["git rename"] };
|
|
979
|
+
}
|
|
980
|
+
if (page.id) {
|
|
981
|
+
const same2 = fresh.find((p) => p.id === page.id);
|
|
982
|
+
if (same2)
|
|
983
|
+
return { path: page.path, status: "moved", to: same2.path, evidence: ["same id"] };
|
|
984
|
+
}
|
|
985
|
+
let best;
|
|
986
|
+
let bestScore = 0;
|
|
987
|
+
for (const p of page.shingles >= MIN_SHINGLES ? fresh : []) {
|
|
988
|
+
if (p.shingles < MIN_SHINGLES)
|
|
989
|
+
continue;
|
|
990
|
+
const s = similarity(page.signature, p.signature);
|
|
991
|
+
if (s > bestScore) {
|
|
992
|
+
best = p;
|
|
993
|
+
bestScore = s;
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
if (best && bestScore >= MOVED_SIMILARITY) {
|
|
997
|
+
return { path: page.path, status: "moved", to: best.path, evidence: [`same text, ${Math.round(bestScore * 100)}%`] };
|
|
998
|
+
}
|
|
999
|
+
const title = page.title.toLowerCase();
|
|
1000
|
+
const byTitle = title ? fresh.find((p) => p.title.toLowerCase() === title) : void 0;
|
|
1001
|
+
if (byTitle)
|
|
1002
|
+
return { path: page.path, status: "candidate", to: byTitle.path, evidence: ["same title"] };
|
|
1003
|
+
const name = baseName(page.path);
|
|
1004
|
+
const byName = fresh.find((p) => baseName(p.path) === name);
|
|
1005
|
+
if (byName)
|
|
1006
|
+
return { path: page.path, status: "candidate", to: byName.path, evidence: ["same file name"] };
|
|
1007
|
+
return { path: page.path, status: "removed" };
|
|
1008
|
+
}
|
|
1009
|
+
function baseName(path) {
|
|
1010
|
+
const parts = path.split("/").filter((s) => s !== "index");
|
|
1011
|
+
return parts[parts.length - 1] ?? "index";
|
|
1012
|
+
}
|
|
1013
|
+
var HASHES = 64;
|
|
1014
|
+
var SHINGLE = 5;
|
|
1015
|
+
function releasePage(page, path, o = {}) {
|
|
1016
|
+
const id = page.frontmatter?.["id"];
|
|
1017
|
+
const text2 = treeText(page.tree);
|
|
1018
|
+
return {
|
|
1019
|
+
path: flat(path),
|
|
1020
|
+
title: flat(titleOf(page)),
|
|
1021
|
+
...typeof id === "string" && id.trim() ? { id: flat(id.trim()) } : {},
|
|
1022
|
+
...o.source !== void 0 ? { source: flat(o.source) } : {},
|
|
1023
|
+
...o.index && path !== "index" ? { index: true } : {},
|
|
1024
|
+
signature: signature(text2),
|
|
1025
|
+
shingles: shingleCount(text2)
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
function shingleCount(text2) {
|
|
1029
|
+
const words = text2.match(/[\p{L}\p{N}]+/gu)?.length ?? 0;
|
|
1030
|
+
return words ? Math.max(1, words - SHINGLE + 1) : 0;
|
|
1031
|
+
}
|
|
1032
|
+
function signature(text2) {
|
|
1033
|
+
const words = text2.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [];
|
|
1034
|
+
const mins = new Array(HASHES).fill(4294967295);
|
|
1035
|
+
if (!words.length)
|
|
1036
|
+
return mins;
|
|
1037
|
+
const count = Math.max(1, words.length - SHINGLE + 1);
|
|
1038
|
+
for (let i = 0; i < count; i++) {
|
|
1039
|
+
const h = fnv1a(words.slice(i, i + SHINGLE).join(" "));
|
|
1040
|
+
for (let k = 0; k < HASHES; k++) {
|
|
1041
|
+
const v = mix(h, k);
|
|
1042
|
+
if (v < mins[k])
|
|
1043
|
+
mins[k] = v;
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
return mins;
|
|
1047
|
+
}
|
|
1048
|
+
function similarity(a, b) {
|
|
1049
|
+
if (a.length !== b.length || !a.length || a[0] === 4294967295 || b[0] === 4294967295)
|
|
1050
|
+
return 0;
|
|
1051
|
+
let same2 = 0;
|
|
1052
|
+
for (let i = 0; i < a.length; i++)
|
|
1053
|
+
if (a[i] === b[i])
|
|
1054
|
+
same2++;
|
|
1055
|
+
return same2 / a.length;
|
|
1056
|
+
}
|
|
1057
|
+
function fnv1a(s) {
|
|
1058
|
+
let h = 2166136261;
|
|
1059
|
+
for (let i = 0; i < s.length; i++) {
|
|
1060
|
+
h ^= s.charCodeAt(i);
|
|
1061
|
+
h = Math.imul(h, 16777619);
|
|
1062
|
+
}
|
|
1063
|
+
return h >>> 0;
|
|
1064
|
+
}
|
|
1065
|
+
function mix(h, k) {
|
|
1066
|
+
let x = (h ^ Math.imul(k + 1, 2654435769)) >>> 0;
|
|
1067
|
+
x ^= x >>> 16;
|
|
1068
|
+
x = Math.imul(x, 2246822507);
|
|
1069
|
+
x ^= x >>> 13;
|
|
1070
|
+
x = Math.imul(x, 3266489909);
|
|
1071
|
+
x ^= x >>> 16;
|
|
1072
|
+
return x >>> 0;
|
|
1073
|
+
}
|
|
1074
|
+
function treeText(nodes) {
|
|
1075
|
+
const out = [];
|
|
1076
|
+
const walk = (list2) => {
|
|
1077
|
+
for (const node of list2) {
|
|
1078
|
+
if (node.inline)
|
|
1079
|
+
out.push(inlineText(node.inline));
|
|
1080
|
+
if (node.html)
|
|
1081
|
+
out.push(node.html.replace(/<[^>]+>/g, " "));
|
|
1082
|
+
if (typeof node.props?.code === "string")
|
|
1083
|
+
out.push(node.props.code);
|
|
1084
|
+
if (node.children)
|
|
1085
|
+
walk(node.children);
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
walk(nodes);
|
|
1089
|
+
return out.join(" ");
|
|
1090
|
+
}
|
|
1091
|
+
function inlineText(nodes) {
|
|
1092
|
+
let s = "";
|
|
1093
|
+
for (const n of nodes) {
|
|
1094
|
+
if (typeof n.text === "string")
|
|
1095
|
+
s += n.text;
|
|
1096
|
+
else if (typeof n.value === "string")
|
|
1097
|
+
s += n.value;
|
|
1098
|
+
if (Array.isArray(n.children))
|
|
1099
|
+
s += inlineText(n.children);
|
|
1100
|
+
s += " ";
|
|
1101
|
+
}
|
|
1102
|
+
return s;
|
|
1103
|
+
}
|
|
1104
|
+
function releaseBaseline(versions, defaultVersion, from) {
|
|
1105
|
+
if (from !== void 0)
|
|
1106
|
+
return versions.some((v) => v.id === from) && from !== defaultVersion ? from : void 0;
|
|
1107
|
+
const i = versions.findIndex((v) => v.id === defaultVersion);
|
|
1108
|
+
if (i < 0)
|
|
1109
|
+
return void 0;
|
|
1110
|
+
return versions.slice(i + 1).find((v) => !v.prerelease && !v.hidden)?.id;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// node_modules/@dogsbay/site-files/dist/json-ld.js
|
|
1114
|
+
function jsonLdTypeFor(pageType) {
|
|
1115
|
+
switch (pageType) {
|
|
1116
|
+
case "tutorial":
|
|
1117
|
+
case "how-to":
|
|
1118
|
+
case "howto":
|
|
1119
|
+
return "HowTo";
|
|
1120
|
+
case "reference":
|
|
1121
|
+
case "ref":
|
|
1122
|
+
case "api":
|
|
1123
|
+
return "TechArticle";
|
|
1124
|
+
case "course":
|
|
1125
|
+
return "Course";
|
|
1126
|
+
default:
|
|
1127
|
+
return "Article";
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
function buildArticleJsonLd(opts) {
|
|
1131
|
+
const { type, title, siteName, keywords, description, image, url, headings } = opts;
|
|
1132
|
+
const block = {
|
|
1133
|
+
"@context": "https://schema.org",
|
|
1134
|
+
"@type": type,
|
|
1135
|
+
name: title
|
|
1136
|
+
};
|
|
1137
|
+
if (keywords.length > 0)
|
|
1138
|
+
block.keywords = keywords.join(", ");
|
|
1139
|
+
if (type === "Article" || type === "TechArticle") {
|
|
1140
|
+
block.headline = title;
|
|
1141
|
+
}
|
|
1142
|
+
if (description)
|
|
1143
|
+
block.description = description;
|
|
1144
|
+
if (image)
|
|
1145
|
+
block.image = image;
|
|
1146
|
+
if (url)
|
|
1147
|
+
block.url = url;
|
|
1148
|
+
if (type === "HowTo") {
|
|
1149
|
+
let stepHeadings = (headings ?? []).filter((h) => h.depth === 2);
|
|
1150
|
+
if (stepHeadings.length === 0) {
|
|
1151
|
+
stepHeadings = (headings ?? []).filter((h) => h.depth === 3);
|
|
1152
|
+
}
|
|
1153
|
+
block.step = stepHeadings.map((h) => ({
|
|
1154
|
+
"@type": "HowToStep",
|
|
1155
|
+
name: h.text,
|
|
1156
|
+
url: url ? `${url}#${h.slug}` : `#${h.slug}`
|
|
1157
|
+
}));
|
|
1158
|
+
}
|
|
1159
|
+
if (type === "Course") {
|
|
1160
|
+
block.provider = { "@type": "Organization", name: siteName };
|
|
1161
|
+
if (!block.description)
|
|
1162
|
+
block.description = title;
|
|
1163
|
+
}
|
|
1164
|
+
return block;
|
|
1165
|
+
}
|
|
1166
|
+
function buildWebSiteJsonLd(opts) {
|
|
1167
|
+
const block = {
|
|
1168
|
+
"@context": "https://schema.org",
|
|
1169
|
+
"@type": "WebSite",
|
|
1170
|
+
name: opts.siteName
|
|
1171
|
+
};
|
|
1172
|
+
if (opts.title && opts.title !== opts.siteName)
|
|
1173
|
+
block.headline = opts.title;
|
|
1174
|
+
if (opts.description)
|
|
1175
|
+
block.description = opts.description;
|
|
1176
|
+
if (opts.url)
|
|
1177
|
+
block.url = opts.url;
|
|
1178
|
+
return block;
|
|
1179
|
+
}
|
|
1180
|
+
function buildBreadcrumbJsonLd(items) {
|
|
1181
|
+
const kept = items.filter((it, i) => it.url || i === items.length - 1);
|
|
1182
|
+
if (kept.length < 2)
|
|
1183
|
+
return void 0;
|
|
1184
|
+
return {
|
|
1185
|
+
"@context": "https://schema.org",
|
|
1186
|
+
"@type": "BreadcrumbList",
|
|
1187
|
+
itemListElement: kept.map((it, i) => ({
|
|
1188
|
+
"@type": "ListItem",
|
|
1189
|
+
position: i + 1,
|
|
1190
|
+
name: it.name,
|
|
1191
|
+
...it.url ? { item: it.url } : {}
|
|
1192
|
+
}))
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// node_modules/@dogsbay/site-files/dist/text.js
|
|
1197
|
+
var DESCRIPTION_LIMIT = 160;
|
|
1198
|
+
function truncate(text2, limit = DESCRIPTION_LIMIT) {
|
|
1199
|
+
const collapsed = text2.replace(/\s+/g, " ").trim();
|
|
1200
|
+
if (collapsed.length <= limit)
|
|
1201
|
+
return collapsed;
|
|
1202
|
+
const slice = collapsed.slice(0, limit);
|
|
1203
|
+
const lastSpace = slice.lastIndexOf(" ");
|
|
1204
|
+
const cut = lastSpace > limit * 0.5 ? slice.slice(0, lastSpace) : slice;
|
|
1205
|
+
return `${cut.trimEnd()}\u2026`;
|
|
1206
|
+
}
|
|
1207
|
+
function escapeXml(s) {
|
|
1208
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1209
|
+
}
|
|
1210
|
+
function dateField(fm, keys) {
|
|
1211
|
+
for (const k of keys) {
|
|
1212
|
+
const v = fm[k];
|
|
1213
|
+
if (typeof v === "string" && v.trim())
|
|
1214
|
+
return v.trim();
|
|
1215
|
+
if (v instanceof Date && !isNaN(v.getTime()))
|
|
1216
|
+
return v.toISOString().slice(0, 10);
|
|
1217
|
+
}
|
|
1218
|
+
return void 0;
|
|
1219
|
+
}
|
|
1220
|
+
function lastmodOf(fm) {
|
|
1221
|
+
return dateField(fm, ["lastUpdated", "lastmod", "updated", "created", "date", "published"]);
|
|
1222
|
+
}
|
|
1223
|
+
function jsonForScript(v) {
|
|
1224
|
+
return JSON.stringify(v).replace(/</g, "\\u003c");
|
|
1225
|
+
}
|
|
1226
|
+
var CONTENT_SIGNAL_PREAMBLE = "# As a condition of accessing this website, you agree to abide by the following\n# content signals:\n\n# (a) If a Content-Signal = yes, you may collect content for the corresponding\n# use.\n# (b) If a Content-Signal = no, you may not collect content for the\n# corresponding use.\n# (c) If the website operator does not include a Content-Signal for a\n# corresponding use, the website operator neither grants nor restricts\n# permission via Content-Signal with respect to the corresponding use.\n\n# The content signals and their meanings are:\n\n# search: building a search index and providing search results (e.g., returning\n# hyperlinks and short excerpts from your website's contents). Search does not\n# include providing AI-generated search summaries.\n# ai-input: inputting content into one or more AI models (e.g., retrieval\n# augmented generation, grounding, or other real-time taking of content for\n# generative AI search answers).\n# ai-train: training or fine-tuning AI models.\n\n# ANY RESTRICTIONS EXPRESSED VIA CONTENT SIGNALS ARE EXPRESS RESERVATIONS OF\n# RIGHTS UNDER ARTICLE 4 OF THE EUROPEAN UNION DIRECTIVE 2019/790 ON COPYRIGHT\n# AND RELATED RIGHTS IN THE DIGITAL SINGLE MARKET.\n\n";
|
|
1227
|
+
|
|
1228
|
+
// node_modules/@dogsbay/site-files/dist/robots.js
|
|
1229
|
+
function buildRobotsTxt(o) {
|
|
1230
|
+
const s = o.signals ?? {};
|
|
1231
|
+
return (o.preamble ? CONTENT_SIGNAL_PREAMBLE : "") + `User-agent: *
|
|
1232
|
+
Allow: /
|
|
1233
|
+
Content-Signal: search=${s.search ?? "yes"}, ai-input=${s.aiInput ?? "yes"}, ai-train=${s.aiTrain ?? "no"}
|
|
1234
|
+
` + (o.sitemapUrl ? `Sitemap: ${o.sitemapUrl}
|
|
1235
|
+
` : "") + (o.llmsTxtUrl ? `Llms-Txt: ${o.llmsTxtUrl}
|
|
1236
|
+
` : "");
|
|
1237
|
+
}
|
|
1238
|
+
function buildHeadersFile(llmsPath) {
|
|
1239
|
+
return ["/*", ` Link: <${llmsPath}>; rel="describedby"; type="text/plain"`, ""].join("\n");
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
// node_modules/@dogsbay/site-files/dist/sitemap.js
|
|
1243
|
+
var SITEMAP_NS = "http://www.sitemaps.org/schemas/sitemap/0.9";
|
|
1244
|
+
var SITEMAP_MAX_URLS = 5e4;
|
|
1245
|
+
function buildUrlset(entries) {
|
|
1246
|
+
const lines = ['<?xml version="1.0" encoding="UTF-8"?>', `<urlset xmlns="${SITEMAP_NS}">`];
|
|
1247
|
+
for (const e of entries) {
|
|
1248
|
+
lines.push(" <url>", ` <loc>${escapeXml(e.loc)}</loc>`);
|
|
1249
|
+
if (e.lastmod)
|
|
1250
|
+
lines.push(` <lastmod>${escapeXml(e.lastmod)}</lastmod>`);
|
|
1251
|
+
lines.push(" </url>");
|
|
1252
|
+
}
|
|
1253
|
+
lines.push("</urlset>", "");
|
|
1254
|
+
return lines.join("\n");
|
|
1255
|
+
}
|
|
1256
|
+
function buildSitemaps(entries, maxUrls = SITEMAP_MAX_URLS) {
|
|
1257
|
+
const files = [];
|
|
1258
|
+
for (let i = 0; i === 0 || i * maxUrls < entries.length; i++) {
|
|
1259
|
+
files.push([`sitemap-${i}.xml`, buildUrlset(entries.slice(i * maxUrls, (i + 1) * maxUrls))]);
|
|
1260
|
+
}
|
|
1261
|
+
return files;
|
|
1262
|
+
}
|
|
1263
|
+
function assertLeafSitemap(url) {
|
|
1264
|
+
if (/sitemap[-_]?index\.xml$/i.test(url)) {
|
|
1265
|
+
throw new Error(`Aggregated sitemap must be a leaf <urlset>, not a sitemap index: ${url}
|
|
1266
|
+
The sitemaps.org protocol forbids nesting index files inside index files.
|
|
1267
|
+
DogsBay emits both \u2014 use the numbered leaf instead, e.g. ${url.replace(/sitemap[-_]?index\.xml$/i, "sitemap-0.xml")}`);
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
function buildSitemapIndex(sitemaps, extra = []) {
|
|
1271
|
+
for (const url of extra)
|
|
1272
|
+
assertLeafSitemap(url);
|
|
1273
|
+
return [
|
|
1274
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
1275
|
+
`<sitemapindex xmlns="${SITEMAP_NS}">`,
|
|
1276
|
+
...[...sitemaps, ...extra].flatMap((url) => [" <sitemap>", ` <loc>${escapeXml(url)}</loc>`, " </sitemap>"]),
|
|
1277
|
+
"</sitemapindex>",
|
|
1278
|
+
""
|
|
1279
|
+
].join("\n");
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
// node_modules/@dogsbay/site-files/dist/llms.js
|
|
1283
|
+
function buildLlmsTxt(site, nav, pages, o) {
|
|
1284
|
+
const out = header(site);
|
|
1285
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
1286
|
+
const leaves = [];
|
|
1287
|
+
const groups = [];
|
|
1288
|
+
for (const item of nav) {
|
|
1289
|
+
if (item.children.length) {
|
|
1290
|
+
const lines = [`## ${item.label}`, ""];
|
|
1291
|
+
pushEntry(lines, item, pages, o, emitted);
|
|
1292
|
+
collectEntries(item.children, pages, o, lines, emitted);
|
|
1293
|
+
lines.push("");
|
|
1294
|
+
groups.push(lines);
|
|
1295
|
+
} else if (item.key != null) {
|
|
1296
|
+
leaves.push(item);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
if (leaves.length) {
|
|
1300
|
+
out.push(`## ${o.topLevelLabel ?? "Documentation"}`, "");
|
|
1301
|
+
for (const leaf of leaves)
|
|
1302
|
+
pushEntry(out, leaf, pages, o, emitted);
|
|
1303
|
+
out.push("");
|
|
1304
|
+
}
|
|
1305
|
+
for (const g of groups)
|
|
1306
|
+
out.push(...g);
|
|
1307
|
+
const otherLabel = o.otherPagesLabel === void 0 ? "Other pages" : o.otherPagesLabel;
|
|
1308
|
+
if (otherLabel !== false) {
|
|
1309
|
+
const orphans = [...pages.keys()].filter((k) => !emitted.has(k)).sort(byKey);
|
|
1310
|
+
if (orphans.length) {
|
|
1311
|
+
out.push(`## ${otherLabel}`, "");
|
|
1312
|
+
for (const k of orphans) {
|
|
1313
|
+
const p = pages.get(k);
|
|
1314
|
+
out.push(entry(p.title || k, o.url(k), p.description, o));
|
|
1315
|
+
}
|
|
1316
|
+
out.push("");
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
const aggregates = (site.aggregates ?? []).filter((a) => a.llmsTxt || a.url);
|
|
1320
|
+
if (aggregates.length) {
|
|
1321
|
+
out.push(`## ${o.aggregatesLabel ?? "Other sites"}`, "");
|
|
1322
|
+
for (const a of aggregates)
|
|
1323
|
+
out.push(`- [${a.name}](${a.llmsTxt ?? a.url})${a.description ? `: ${a.description}` : ""}`);
|
|
1324
|
+
out.push("");
|
|
1325
|
+
}
|
|
1326
|
+
return finish(out.join("\n"));
|
|
1327
|
+
}
|
|
1328
|
+
function buildSectionLlmsTxt(site, group, pages, o) {
|
|
1329
|
+
const out = [`# ${heading(site.name)} \u2014 ${heading(group.label)}`, "", `## ${heading(group.label)}`, ""];
|
|
1330
|
+
pushEntry(out, group, pages, o);
|
|
1331
|
+
collectEntries(group.children, pages, o, out);
|
|
1332
|
+
return finish(out.join("\n"));
|
|
1333
|
+
}
|
|
1334
|
+
function llmsFullOrder(nav, pages) {
|
|
1335
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1336
|
+
const order = [];
|
|
1337
|
+
const walk = (items) => {
|
|
1338
|
+
for (const it of items) {
|
|
1339
|
+
if (it.key != null && pages.has(it.key) && !seen.has(it.key)) {
|
|
1340
|
+
seen.add(it.key);
|
|
1341
|
+
order.push(it.key);
|
|
1342
|
+
}
|
|
1343
|
+
walk(it.children);
|
|
1344
|
+
}
|
|
1345
|
+
};
|
|
1346
|
+
walk(nav);
|
|
1347
|
+
return [...order, ...[...pages.keys()].filter((k) => !seen.has(k)).sort(byKey)];
|
|
1348
|
+
}
|
|
1349
|
+
async function* llmsFullChunks(site, order, pages, url, load2) {
|
|
1350
|
+
yield collapse(header(site).join("\n")).trimEnd();
|
|
1351
|
+
let first = true;
|
|
1352
|
+
for (const key of order) {
|
|
1353
|
+
const p = pages.get(key);
|
|
1354
|
+
if (!p)
|
|
1355
|
+
continue;
|
|
1356
|
+
const body = (await load2(key)).trimEnd();
|
|
1357
|
+
yield "\n\n" + collapse(`${first ? "" : "---\n\n"}# ${p.title}
|
|
1358
|
+
|
|
1359
|
+
URL: ${url(key)}
|
|
1360
|
+
|
|
1361
|
+
${body}`).trimEnd();
|
|
1362
|
+
first = false;
|
|
1363
|
+
}
|
|
1364
|
+
yield "\n";
|
|
1365
|
+
}
|
|
1366
|
+
function heading(text2) {
|
|
1367
|
+
return text2.replace(/[\r\n\u2028\u2029]+/g, " ").trim();
|
|
1368
|
+
}
|
|
1369
|
+
function header(site) {
|
|
1370
|
+
const out = [`# ${heading(site.name)}`, ""];
|
|
1371
|
+
if (site.description)
|
|
1372
|
+
out.push(`> ${site.description}`, "");
|
|
1373
|
+
if (site.whenToUse?.trim())
|
|
1374
|
+
out.push("## When to use this", "", site.whenToUse.trim(), "");
|
|
1375
|
+
return out;
|
|
1376
|
+
}
|
|
1377
|
+
function collectEntries(items, pages, o, out, emitted) {
|
|
1378
|
+
for (const it of items) {
|
|
1379
|
+
pushEntry(out, it, pages, o, emitted);
|
|
1380
|
+
collectEntries(it.children, pages, o, out, emitted);
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
function pushEntry(out, item, pages, o, emitted) {
|
|
1384
|
+
if (item.key == null)
|
|
1385
|
+
return;
|
|
1386
|
+
const p = pages.get(item.key);
|
|
1387
|
+
if (!p && o.missing !== "link")
|
|
1388
|
+
return;
|
|
1389
|
+
if (p)
|
|
1390
|
+
emitted?.add(item.key);
|
|
1391
|
+
out.push(entry(item.label || p?.title || item.key, o.url(item.key) + (item.fragment ?? ""), p?.description, o));
|
|
1392
|
+
}
|
|
1393
|
+
function entry(label, url, description, o) {
|
|
1394
|
+
const text2 = o.escapeLabels ? label.replace(/[[\]]/g, "\\$&") : label;
|
|
1395
|
+
return description ? `- [${text2}](${url}): ${description}` : `- [${text2}](${url})`;
|
|
1396
|
+
}
|
|
1397
|
+
function byKey(a, b) {
|
|
1398
|
+
return (a || "index").localeCompare(b || "index");
|
|
1399
|
+
}
|
|
1400
|
+
function collapse(s) {
|
|
1401
|
+
return s.includes("\n\n\n") ? s.replace(/\n{3,}/g, "\n\n") : s;
|
|
1402
|
+
}
|
|
1403
|
+
function finish(s) {
|
|
1404
|
+
return collapse(s).trimEnd() + "\n";
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
// node_modules/@dogsbay/site-files/dist/redirects.js
|
|
1408
|
+
var MAX_REDIRECT_RULES = 2100;
|
|
1409
|
+
var MAX_REDIRECT_RULE_CHARS = 1e3;
|
|
1410
|
+
function isExternalUrl(target) {
|
|
1411
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(target) || target.startsWith("//");
|
|
1412
|
+
}
|
|
1413
|
+
var UNSAFE_PATH_CHARS = /[\s*:?#\\"<>`{}|^\u0000-\u001f\u007f]/;
|
|
1414
|
+
function isSafeSitePath(path) {
|
|
1415
|
+
return path !== "" && !path.startsWith("//") && !UNSAFE_PATH_CHARS.test(path) && !path.split("/").some((seg) => seg === "." || seg === "..");
|
|
1416
|
+
}
|
|
1417
|
+
function isSafeExternalUrl(target) {
|
|
1418
|
+
if (/[\s\u0000-\u001f\u007f]/.test(target))
|
|
1419
|
+
return false;
|
|
1420
|
+
try {
|
|
1421
|
+
const u = new URL(target);
|
|
1422
|
+
return u.protocol === "https:" || u.protocol === "http:";
|
|
1423
|
+
} catch {
|
|
1424
|
+
return false;
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
function unsafeRedirect(from, to) {
|
|
1428
|
+
if (!isSafeSitePath(from))
|
|
1429
|
+
return `source ${JSON.stringify(from)} is not a plain site path`;
|
|
1430
|
+
if (isExternalUrl(to))
|
|
1431
|
+
return isSafeExternalUrl(to) ? void 0 : `target ${JSON.stringify(to)} is not an http(s) URL`;
|
|
1432
|
+
const m = /^([^?#]*)([?#].*)?$/.exec(to);
|
|
1433
|
+
const path = m?.[1] ?? to;
|
|
1434
|
+
if (!isSafeSitePath(path) || /[\s\u0000-\u001f\u007f]/.test(m?.[2] ?? ""))
|
|
1435
|
+
return `target ${JSON.stringify(to)} is not a plain site path`;
|
|
1436
|
+
return void 0;
|
|
1437
|
+
}
|
|
1438
|
+
function resolveRedirects(candidates, o) {
|
|
1439
|
+
const errors = [];
|
|
1440
|
+
const warnings = [];
|
|
1441
|
+
const problem = (strictMessage, lenientMessage) => o.strict ? errors.push(strictMessage) : warnings.push(lenientMessage);
|
|
1442
|
+
const show = o.show ?? ((p) => p);
|
|
1443
|
+
const target = (to) => isExternalUrl(to) ? to : show(to);
|
|
1444
|
+
const declared = (r) => r.declaredBy ? ` (declared on ${r.declaredBy})` : "";
|
|
1445
|
+
const bySource = /* @__PURE__ */ new Map();
|
|
1446
|
+
for (const r of candidates) {
|
|
1447
|
+
const unsafe = unsafeRedirect(r.from, r.to);
|
|
1448
|
+
if (unsafe) {
|
|
1449
|
+
problem(`redirect ${JSON.stringify(r.from)} \u2192 ${JSON.stringify(r.to)}${declared(r)} cannot be emitted: ${unsafe}. To fix: use an absolute path such as /old/page/, and an http(s) URL for an external target.`, `redirect ${JSON.stringify(r.from)} \u2192 ${JSON.stringify(r.to)}${declared(r)} dropped: ${unsafe}`);
|
|
1450
|
+
continue;
|
|
1451
|
+
}
|
|
1452
|
+
const prev = bySource.get(r.from);
|
|
1453
|
+
if (prev && (prev.origin === r.origin || r.origin !== "config")) {
|
|
1454
|
+
if (prev.to !== r.to) {
|
|
1455
|
+
problem(`two redirects for ${show(r.from)} (\u2192 ${target(prev.to)} and \u2192 ${target(r.to)}). To fix: keep one; a duplicate source has no defined winner.`, `two redirects for ${show(r.from)} (\u2192 ${target(prev.to)} and \u2192 ${target(r.to)}); keeping the first`);
|
|
1456
|
+
}
|
|
1457
|
+
continue;
|
|
1458
|
+
}
|
|
1459
|
+
bySource.set(r.from, { ...r });
|
|
1460
|
+
}
|
|
1461
|
+
let rules = [...bySource.values()].filter((r) => {
|
|
1462
|
+
if (r.from !== r.to)
|
|
1463
|
+
return true;
|
|
1464
|
+
problem(`redirect ${show(r.from)} \u2192 ${target(r.to)} points at itself${declared(r)}. To fix: remove it.`, `redirect ${show(r.from)} points at itself${declared(r)}; dropped`);
|
|
1465
|
+
return false;
|
|
1466
|
+
});
|
|
1467
|
+
rules = rules.filter((r) => {
|
|
1468
|
+
if (!o.isPage(r.from))
|
|
1469
|
+
return true;
|
|
1470
|
+
problem(`redirect source ${show(r.from)} is also a page this build emits. To fix: remove the page or the redirect \u2014 on Cloudflare the redirect wins and the page is unreachable; on a static host the page wins and the redirect never fires.`, `redirect source ${show(r.from)} is also a page; the page is kept and the redirect dropped`);
|
|
1471
|
+
return false;
|
|
1472
|
+
});
|
|
1473
|
+
const next = new Map(rules.map((r) => [r.from, r.to]));
|
|
1474
|
+
const looped = /* @__PURE__ */ new Set();
|
|
1475
|
+
for (const r of rules) {
|
|
1476
|
+
const seen = [r.from];
|
|
1477
|
+
let to = r.to;
|
|
1478
|
+
while (!isExternalUrl(to) && next.has(to)) {
|
|
1479
|
+
if (seen.includes(to)) {
|
|
1480
|
+
const cycle = [...seen, to].map(show).join(" \u2192 ");
|
|
1481
|
+
problem(`redirect loop: ${cycle}. To fix: break the cycle.`, `redirect loop: ${cycle}; dropped`);
|
|
1482
|
+
looped.add(r.from);
|
|
1483
|
+
break;
|
|
1484
|
+
}
|
|
1485
|
+
seen.push(to);
|
|
1486
|
+
to = next.get(to);
|
|
1487
|
+
}
|
|
1488
|
+
if (!looped.has(r.from) && to !== r.to) {
|
|
1489
|
+
warnings.push(`collapsed a redirect chain: ${show(r.from)} now points straight at ${target(to)} (${seen.length - 1} hop(s) removed)`);
|
|
1490
|
+
r.to = to;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
rules = rules.filter((r) => !looped.has(r.from));
|
|
1494
|
+
rules = rules.filter((r) => {
|
|
1495
|
+
if (isExternalUrl(r.to) || o.isPage(r.to) || o.canSee && !o.canSee(r.to))
|
|
1496
|
+
return true;
|
|
1497
|
+
problem(`redirect ${show(r.from)} \u2192 ${show(r.to)} points at a page this build does not emit${declared(r)}. To fix: correct the target, or point it at an external URL.`, `redirect ${show(r.from)} \u2192 ${show(r.to)} points at a page this build does not emit${declared(r)}; dropped`);
|
|
1498
|
+
return false;
|
|
1499
|
+
});
|
|
1500
|
+
if (o.cloudflareLimits) {
|
|
1501
|
+
if (rules.length > MAX_REDIRECT_RULES) {
|
|
1502
|
+
problem(`${rules.length} redirects exceeds the ${MAX_REDIRECT_RULES}-rule limit for _redirects. To fix: use Cloudflare Bulk Redirects for the long tail.`, `${rules.length} redirects exceeds the ${MAX_REDIRECT_RULES}-rule limit for _redirects; Cloudflare ignores the rest`);
|
|
1503
|
+
}
|
|
1504
|
+
for (const r of rules) {
|
|
1505
|
+
const length = `${show(r.from)} ${target(r.to)} ${r.status}`.length;
|
|
1506
|
+
if (length > MAX_REDIRECT_RULE_CHARS) {
|
|
1507
|
+
problem(`redirect rule for ${show(r.from)} is ${length} characters, over the ${MAX_REDIRECT_RULE_CHARS}-character limit. To fix: shorten the paths.`, `redirect rule for ${show(r.from)} is ${length} characters, over the ${MAX_REDIRECT_RULE_CHARS}-character limit; Cloudflare ignores it`);
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
rules.sort((a, b) => a.from.localeCompare(b.from));
|
|
1512
|
+
return { rules, errors, warnings };
|
|
1513
|
+
}
|
|
1514
|
+
function renderRedirectsFile(lines) {
|
|
1515
|
+
return [
|
|
1516
|
+
"# Generated by dogsbay. Do not edit \u2014 declare redirects with `redirect:`",
|
|
1517
|
+
"# or `aliases:` frontmatter, or the `redirects:` block in dogsbay.config.yml.",
|
|
1518
|
+
...lines.map((r) => `${r.from} ${r.to} ${r.status}`),
|
|
1519
|
+
""
|
|
1520
|
+
].join("\n");
|
|
1521
|
+
}
|
|
1522
|
+
function renderRedirectStub(href, canonical) {
|
|
1523
|
+
const esc = (s) => s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
1524
|
+
return [
|
|
1525
|
+
"<!doctype html>",
|
|
1526
|
+
'<html lang="en">',
|
|
1527
|
+
"<head>",
|
|
1528
|
+
'<meta charset="utf-8">',
|
|
1529
|
+
`<meta http-equiv="refresh" content="0; url=${esc(href)}">`,
|
|
1530
|
+
'<meta name="robots" content="noindex">',
|
|
1531
|
+
canonical ? `<link rel="canonical" href="${esc(canonical)}">` : "",
|
|
1532
|
+
`<title>Redirecting to ${esc(href)}</title>`,
|
|
1533
|
+
"</head>",
|
|
1534
|
+
"<body>",
|
|
1535
|
+
`<p>This page has moved to <a href="${esc(href)}">${esc(href)}</a>.</p>`,
|
|
1536
|
+
"</body>",
|
|
1537
|
+
"</html>",
|
|
1538
|
+
""
|
|
1539
|
+
].filter(Boolean).join("\n");
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// node_modules/@dogsbay/site-files/dist/canonical.js
|
|
1543
|
+
var URL_RE = /^[a-z][a-z0-9+.-]*:/i;
|
|
1544
|
+
var ABSOLUTE = /^https?:\/\//i;
|
|
1545
|
+
var same = (a, b) => a.replace(/\/+$/, "") === b.replace(/\/+$/, "");
|
|
1546
|
+
function decideCanonical(q) {
|
|
1547
|
+
const v = q.version ?? {};
|
|
1548
|
+
const self = (warning2) => v.noindex ? { target: { kind: "self" }, sitemap: false, noindex: true } : { target: { kind: "self" }, sitemap: v.sitemap ?? true, noindex: false, ...warning2 ? { warning: warning2 } : {} };
|
|
1549
|
+
const override = q.frontmatter?.trim();
|
|
1550
|
+
let warning;
|
|
1551
|
+
if (override) {
|
|
1552
|
+
if (!ABSOLUTE.test(override)) {
|
|
1553
|
+
warning = `canonicalUrl "${override}" is not an absolute URL (https://\u2026); ignored`;
|
|
1554
|
+
} else if (q.selfUrl && same(override, q.selfUrl)) {
|
|
1555
|
+
return self();
|
|
1556
|
+
} else {
|
|
1557
|
+
return { target: { kind: "url", url: override }, sitemap: v.sitemap ?? false, noindex: !!v.noindex };
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
if (v.noindex || q.isDefault || v.canonical === "self")
|
|
1561
|
+
return self(warning);
|
|
1562
|
+
const moved = (target) => ({ target, sitemap: v.sitemap ?? false, noindex: false, ...warning ? { warning } : {} });
|
|
1563
|
+
if (q.defaultHas(q.path))
|
|
1564
|
+
return moved({ kind: "default", path: q.path });
|
|
1565
|
+
const r = q.defaultRedirect?.(q.path);
|
|
1566
|
+
if (r !== void 0 && URL_RE.test(r))
|
|
1567
|
+
return moved({ kind: "url", url: r });
|
|
1568
|
+
if (r !== void 0 && !r.startsWith("/") && r !== q.path && q.defaultHas(r))
|
|
1569
|
+
return moved({ kind: "default", path: r });
|
|
1570
|
+
return self(warning);
|
|
1571
|
+
}
|
|
1572
|
+
function checkVersionsSeo(versions, defaultVersion) {
|
|
1573
|
+
for (const v of versions) {
|
|
1574
|
+
const bad = checkVersionSeo(v.id, v);
|
|
1575
|
+
if (bad)
|
|
1576
|
+
return bad;
|
|
1577
|
+
if (v.id === defaultVersion && v.noindex === true)
|
|
1578
|
+
return `versions: "${v.id}" is the defaultVersion and has noindex: true; older versions' pages name it as their canonical`;
|
|
1579
|
+
}
|
|
1580
|
+
return void 0;
|
|
1581
|
+
}
|
|
1582
|
+
function checkVersionSeo(id, v) {
|
|
1583
|
+
if (v.canonical !== void 0 && v.canonical !== "self")
|
|
1584
|
+
return `versions: "${id}".canonical must be "self" (or left out for the canonical-to-latest rule); got ${JSON.stringify(v.canonical)}`;
|
|
1585
|
+
if (v.noindex !== void 0 && typeof v.noindex !== "boolean")
|
|
1586
|
+
return `versions: "${id}".noindex must be true or false`;
|
|
1587
|
+
if (v.sitemap !== void 0 && typeof v.sitemap !== "boolean")
|
|
1588
|
+
return `versions: "${id}".sitemap must be true or false`;
|
|
1589
|
+
if (v.noindex === true && v.sitemap === true)
|
|
1590
|
+
return `versions: "${id}" has noindex: true and sitemap: true; a sitemap should not list pages search engines are told to skip`;
|
|
1591
|
+
return void 0;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
// node_modules/@dogsbay/site-files/dist/hreflang.js
|
|
1595
|
+
function buildHreflangLinks(alternates, defaultLang) {
|
|
1596
|
+
const byLang = /* @__PURE__ */ new Map();
|
|
1597
|
+
for (const a of alternates)
|
|
1598
|
+
if (a.lang && a.url && !byLang.has(a.lang))
|
|
1599
|
+
byLang.set(a.lang, a.url);
|
|
1600
|
+
if (byLang.size < 2)
|
|
1601
|
+
return [];
|
|
1602
|
+
const links = [...byLang].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([hreflang, href]) => ({ hreflang, href }));
|
|
1603
|
+
const def = defaultLang !== void 0 ? byLang.get(defaultLang) : void 0;
|
|
1604
|
+
if (def)
|
|
1605
|
+
links.push({ hreflang: "x-default", href: def });
|
|
1606
|
+
return links;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
// node_modules/@dogsbay/site-files/dist/translations.js
|
|
1610
|
+
function missingTranslations(units, defaultLocale) {
|
|
1611
|
+
const have = /* @__PURE__ */ new Map();
|
|
1612
|
+
const unitKey = (locale, version) => `${version ?? ""}\0${locale}`;
|
|
1613
|
+
const locales = [];
|
|
1614
|
+
const listed = units.map((u) => ({ ...u, pages: [...u.pages] }));
|
|
1615
|
+
for (const u of listed) {
|
|
1616
|
+
const pages = u.pages;
|
|
1617
|
+
if (!pages.length)
|
|
1618
|
+
continue;
|
|
1619
|
+
if (!locales.includes(u.locale))
|
|
1620
|
+
locales.push(u.locale);
|
|
1621
|
+
const k = unitKey(u.locale, u.version);
|
|
1622
|
+
const set = have.get(k) ?? /* @__PURE__ */ new Set();
|
|
1623
|
+
for (const p of pages)
|
|
1624
|
+
set.add(p);
|
|
1625
|
+
have.set(k, set);
|
|
1626
|
+
}
|
|
1627
|
+
if (locales.length < 2 || !locales.includes(defaultLocale))
|
|
1628
|
+
return [];
|
|
1629
|
+
const out = [];
|
|
1630
|
+
const done = /* @__PURE__ */ new Set();
|
|
1631
|
+
for (const u of listed) {
|
|
1632
|
+
if (u.locale !== defaultLocale)
|
|
1633
|
+
continue;
|
|
1634
|
+
for (const page of u.pages) {
|
|
1635
|
+
for (const locale of locales) {
|
|
1636
|
+
if (locale === defaultLocale || have.get(unitKey(locale, u.version))?.has(page))
|
|
1637
|
+
continue;
|
|
1638
|
+
const k = `${unitKey(locale, u.version)}\0${page}`;
|
|
1639
|
+
if (done.has(k))
|
|
1640
|
+
continue;
|
|
1641
|
+
done.add(k);
|
|
1642
|
+
out.push({ locale, ...u.version !== void 0 ? { version: u.version } : {}, page });
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
return out;
|
|
1647
|
+
}
|
|
1648
|
+
function translationFallbacks(units, defaultLocale, options = {}) {
|
|
1649
|
+
const listed = units.map((u) => ({ ...u, pages: [...u.pages] }));
|
|
1650
|
+
const missing = missingTranslations(listed, defaultLocale);
|
|
1651
|
+
if (options.mode !== "page")
|
|
1652
|
+
return missing.map((m) => ({ ...m, decision: { kind: "redirect" } }));
|
|
1653
|
+
const key = (locale, version) => `${version ?? ""}\0${locale}`;
|
|
1654
|
+
const have = /* @__PURE__ */ new Map();
|
|
1655
|
+
for (const u of listed) {
|
|
1656
|
+
const set = have.get(key(u.locale, u.version)) ?? /* @__PURE__ */ new Set();
|
|
1657
|
+
for (const p of u.pages)
|
|
1658
|
+
set.add(p);
|
|
1659
|
+
have.set(key(u.locale, u.version), set);
|
|
1660
|
+
}
|
|
1661
|
+
const built = (m) => (have.get(key(m.locale, m.version))?.size ?? 0) > 0 && options.buildable?.(m) !== false;
|
|
1662
|
+
const orders = /* @__PURE__ */ new Map();
|
|
1663
|
+
const orderOf = (version) => {
|
|
1664
|
+
const k = version ?? "";
|
|
1665
|
+
let o = orders.get(k);
|
|
1666
|
+
if (!o) {
|
|
1667
|
+
o = options.order?.(version) ?? [...have.get(key(defaultLocale, version)) ?? []];
|
|
1668
|
+
orders.set(k, o);
|
|
1669
|
+
}
|
|
1670
|
+
return o;
|
|
1671
|
+
};
|
|
1672
|
+
return missing.map((m) => {
|
|
1673
|
+
if (!built(m))
|
|
1674
|
+
return { ...m, decision: { kind: "redirect" } };
|
|
1675
|
+
const order = orderOf(m.version);
|
|
1676
|
+
const at = order.indexOf(m.page);
|
|
1677
|
+
return {
|
|
1678
|
+
...m,
|
|
1679
|
+
decision: {
|
|
1680
|
+
kind: "page",
|
|
1681
|
+
contentLang: defaultLocale,
|
|
1682
|
+
inSitemap: false,
|
|
1683
|
+
inHreflang: false,
|
|
1684
|
+
inSearch: false,
|
|
1685
|
+
inLlms: false,
|
|
1686
|
+
inMdMirror: false,
|
|
1687
|
+
inNav: at >= 0
|
|
1688
|
+
}
|
|
1689
|
+
};
|
|
1690
|
+
});
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
// node_modules/@dogsbay/site-files/dist/strings.js
|
|
1694
|
+
var UNTRANSLATED = {
|
|
1695
|
+
en: "This content is not available in your language yet.",
|
|
1696
|
+
fr: "Ce contenu n\u2019est pas encore disponible dans votre langue.",
|
|
1697
|
+
de: "Dieser Inhalt ist noch nicht in deiner Sprache verf\xFCgbar.",
|
|
1698
|
+
es: "Esta p\xE1gina a\xFAn no est\xE1 disponible en tu idioma.",
|
|
1699
|
+
ja: "\u3053\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u306F\u307E\u3060\u65E5\u672C\u8A9E\u8A33\u304C\u3042\u308A\u307E\u305B\u3093\u3002"
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
// node_modules/@dogsbay/site-files/dist/translation-nav.js
|
|
1703
|
+
function position(items, entry2, owner) {
|
|
1704
|
+
for (let i = 0; i < items.length; i++) {
|
|
1705
|
+
if (items[i] === entry2)
|
|
1706
|
+
return { list: items, i, owner };
|
|
1707
|
+
const kids = items[i].children;
|
|
1708
|
+
const inner = kids && position(kids, entry2, items[i]);
|
|
1709
|
+
if (inner)
|
|
1710
|
+
return inner;
|
|
1711
|
+
}
|
|
1712
|
+
return void 0;
|
|
1713
|
+
}
|
|
1714
|
+
function placeFallbackInNav(source, target, from, item, options) {
|
|
1715
|
+
if (from.href && options.counterpart(from))
|
|
1716
|
+
return;
|
|
1717
|
+
const locate2 = (e) => e.href ? options.counterpart(e) : locateHeading(e);
|
|
1718
|
+
const locateHeading = (h) => {
|
|
1719
|
+
for (const c of h.children ?? []) {
|
|
1720
|
+
const t = locate2(c);
|
|
1721
|
+
const owner = t && position(target, t)?.owner;
|
|
1722
|
+
if (owner && !owner.href)
|
|
1723
|
+
return owner;
|
|
1724
|
+
}
|
|
1725
|
+
return void 0;
|
|
1726
|
+
};
|
|
1727
|
+
const place = (at, entry2, seen) => {
|
|
1728
|
+
const pos = position(source, at);
|
|
1729
|
+
if (!pos || seen.has(at)) {
|
|
1730
|
+
target.splice(options.topIndex?.() ?? target.length, 0, entry2);
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
seen.add(at);
|
|
1734
|
+
for (let j = pos.i - 1; j >= 0; j--) {
|
|
1735
|
+
const t = locate2(pos.list[j]);
|
|
1736
|
+
const tp = t && position(target, t);
|
|
1737
|
+
if (tp)
|
|
1738
|
+
return void tp.list.splice(tp.i + 1, 0, entry2);
|
|
1739
|
+
}
|
|
1740
|
+
for (let j = pos.i + 1; j < pos.list.length; j++) {
|
|
1741
|
+
const t = locate2(pos.list[j]);
|
|
1742
|
+
const tp = t && position(target, t);
|
|
1743
|
+
if (tp)
|
|
1744
|
+
return void tp.list.splice(tp.i, 0, entry2);
|
|
1745
|
+
}
|
|
1746
|
+
if (!pos.owner) {
|
|
1747
|
+
target.splice(options.topIndex?.() ?? target.length, 0, entry2);
|
|
1748
|
+
return;
|
|
1749
|
+
}
|
|
1750
|
+
const ot = locate2(pos.owner);
|
|
1751
|
+
if (ot) {
|
|
1752
|
+
ot.children = [entry2, ...ot.children ?? []];
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
place(pos.owner, pos.owner.href ? entry2 : { ...pos.owner, children: [entry2] }, seen);
|
|
1756
|
+
};
|
|
1757
|
+
place(from, item, /* @__PURE__ */ new Set());
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
// node_modules/@dogsbay/site-files/dist/markdown-links.js
|
|
1761
|
+
function rewriteMarkdownLinks(md, fn, options = {}) {
|
|
1762
|
+
const local = options.local === true;
|
|
1763
|
+
if (local ? !/\]\(|\]:|href/i.test(md) : !md.includes("/"))
|
|
1764
|
+
return md;
|
|
1765
|
+
const re = local ? LOCAL_LINK_REF : LINK_REF;
|
|
1766
|
+
let out = "";
|
|
1767
|
+
let last = 0;
|
|
1768
|
+
for (const [start, end] of codeRanges(md)) {
|
|
1769
|
+
out += rewriteText(md.slice(last, start), fn, re) + md.slice(start, end);
|
|
1770
|
+
last = end;
|
|
1771
|
+
}
|
|
1772
|
+
return out + rewriteText(md.slice(last), fn, re);
|
|
1773
|
+
}
|
|
1774
|
+
var ROOTED = String.raw`\/(?!\/)`;
|
|
1775
|
+
var LOCAL = String.raw`(?![a-zA-Z][a-zA-Z0-9+.-]*:|\/\/|#)(?=[^\s)>"'<])`;
|
|
1776
|
+
var linkRef = (start) => new RegExp([
|
|
1777
|
+
// An inline link or image destination
|
|
1778
|
+
String.raw`(?<lh>(?<!\\)\]\([ \t]*(?:\n[ \t]*)?<?)(?<lu>${start}[^\s)>]*)`,
|
|
1779
|
+
// <a href="/x">
|
|
1780
|
+
String.raw`(?<ah><a\b[^>]{0,200}?\bhref[ \t\n]*=[ \t\n]*)(?:(?<aq>["'])(?<au>${start}[^"'\n]*)\k<aq>|(?<bu>${start}[^\s"'<>=\x60]*))`,
|
|
1781
|
+
// A reference definition
|
|
1782
|
+
String.raw`(?<dh>^ {0,3}\[[^\]\n]{1,999}\]:[ \t]*<?)(?<du>${start}[^\s>]*)`
|
|
1783
|
+
].join("|"), "gim");
|
|
1784
|
+
var LINK_REF = linkRef(ROOTED);
|
|
1785
|
+
var LOCAL_LINK_REF = linkRef(LOCAL);
|
|
1786
|
+
function rewriteText(text2, fn, re) {
|
|
1787
|
+
if (re === LINK_REF && !text2.includes("/"))
|
|
1788
|
+
return text2;
|
|
1789
|
+
return text2.replace(re, (match2, ...args) => {
|
|
1790
|
+
const g = args[args.length - 1];
|
|
1791
|
+
if (g.lh !== void 0)
|
|
1792
|
+
return `${g.lh}${fn(g.lu)}`;
|
|
1793
|
+
if (g.ah !== void 0)
|
|
1794
|
+
return g.au !== void 0 ? `${g.ah}${g.aq}${fn(g.au)}${g.aq}` : `${g.ah}${fn(g.bu)}`;
|
|
1795
|
+
if (g.dh !== void 0)
|
|
1796
|
+
return `${g.dh}${fn(g.du)}`;
|
|
1797
|
+
return match2;
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
function codeRanges(md) {
|
|
1801
|
+
const ranges = [];
|
|
1802
|
+
const lineRe = /[^\n]*(?:\n|$)/g;
|
|
1803
|
+
let fence;
|
|
1804
|
+
let textStart = 0;
|
|
1805
|
+
for (let m = lineRe.exec(md); m && m[0] !== ""; m = lineRe.exec(md)) {
|
|
1806
|
+
const line = m[0];
|
|
1807
|
+
const open = /^ {0,3}(`{3,}|~{3,})/.exec(line);
|
|
1808
|
+
if (fence) {
|
|
1809
|
+
const close = open && open[1][0] === fence.char && open[1].length >= fence.len && /^ {0,3}[`~]+[ \t]*\r?\n?$/.test(line);
|
|
1810
|
+
if (close) {
|
|
1811
|
+
ranges.push([fence.start, m.index + line.length]);
|
|
1812
|
+
fence = void 0;
|
|
1813
|
+
textStart = m.index + line.length;
|
|
1814
|
+
}
|
|
1815
|
+
} else if (open && !(open[1][0] === "`" && line.slice(open[0].length).includes("`"))) {
|
|
1816
|
+
ranges.push(...spanRanges(md, textStart, m.index));
|
|
1817
|
+
fence = { char: open[1][0], len: open[1].length, start: m.index };
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
if (fence)
|
|
1821
|
+
ranges.push([fence.start, md.length]);
|
|
1822
|
+
else
|
|
1823
|
+
ranges.push(...spanRanges(md, textStart, md.length));
|
|
1824
|
+
return ranges;
|
|
1825
|
+
}
|
|
1826
|
+
function spanRanges(md, from, to) {
|
|
1827
|
+
const runs = [];
|
|
1828
|
+
const re = /`+/g;
|
|
1829
|
+
re.lastIndex = from;
|
|
1830
|
+
for (let m = re.exec(md); m && m.index < to; m = re.exec(md))
|
|
1831
|
+
runs.push({ at: m.index, len: Math.min(m[0].length, to - m.index) });
|
|
1832
|
+
const next = new Array(runs.length).fill(-1);
|
|
1833
|
+
const seen = /* @__PURE__ */ new Map();
|
|
1834
|
+
for (let i = runs.length - 1; i >= 0; i--) {
|
|
1835
|
+
next[i] = seen.get(runs[i].len) ?? -1;
|
|
1836
|
+
seen.set(runs[i].len, i);
|
|
1837
|
+
}
|
|
1838
|
+
const ranges = [];
|
|
1839
|
+
for (let i = 0; i < runs.length; i++) {
|
|
1840
|
+
const j = next[i];
|
|
1841
|
+
if (j === -1)
|
|
1842
|
+
continue;
|
|
1843
|
+
ranges.push([runs[i].at, runs[j].at + runs[j].len]);
|
|
1844
|
+
i = j;
|
|
1845
|
+
}
|
|
1846
|
+
return ranges;
|
|
1847
|
+
}
|
|
1848
|
+
function rewriteEndpointMarkdown(props, fn) {
|
|
1849
|
+
if (!props || typeof props !== "object")
|
|
1850
|
+
return;
|
|
1851
|
+
const p = props;
|
|
1852
|
+
const desc = (o) => {
|
|
1853
|
+
if (o && typeof o === "object" && typeof o.description === "string") {
|
|
1854
|
+
o.description = rewriteMarkdownLinks(o.description, fn);
|
|
1855
|
+
}
|
|
1856
|
+
};
|
|
1857
|
+
const fields = (list2, depth = 0) => {
|
|
1858
|
+
if (!Array.isArray(list2) || depth > 64)
|
|
1859
|
+
return;
|
|
1860
|
+
for (const f of list2) {
|
|
1861
|
+
desc(f);
|
|
1862
|
+
if (f && typeof f === "object") {
|
|
1863
|
+
fields(f.properties, depth + 1);
|
|
1864
|
+
fields(f.items, depth + 1);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
};
|
|
1868
|
+
desc(p);
|
|
1869
|
+
if (Array.isArray(p.parameters))
|
|
1870
|
+
p.parameters.forEach(desc);
|
|
1871
|
+
fields(p.requestBody);
|
|
1872
|
+
if (Array.isArray(p.responses)) {
|
|
1873
|
+
for (const r of p.responses) {
|
|
1874
|
+
desc(r);
|
|
1875
|
+
if (r && typeof r === "object")
|
|
1876
|
+
fields(r.schema);
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
// node_modules/@dogsbay/site-files/dist/tree-links.js
|
|
1882
|
+
var IMAGE_FILE = /\.(svg|png|jpe?g|gif|webp|avif)$/i;
|
|
1883
|
+
var MARKDOWN_PROPS = {
|
|
1884
|
+
callout: ["title"],
|
|
1885
|
+
details: ["title", "summary"],
|
|
1886
|
+
table: ["caption"],
|
|
1887
|
+
figure: ["caption"]
|
|
1888
|
+
};
|
|
1889
|
+
var TEXT_HTML_NODES = /* @__PURE__ */ new Set(["code", "math", "math-block", "diagram", "mermaid"]);
|
|
1890
|
+
var TEXT_HTML = TEXT_HTML_NODES;
|
|
1891
|
+
function htmlIsText(node) {
|
|
1892
|
+
return TEXT_HTML_NODES.has(String(node.type));
|
|
1893
|
+
}
|
|
1894
|
+
function rewriteTreeLinks(tree, fn) {
|
|
1895
|
+
const undo = [];
|
|
1896
|
+
const set = (o, k, v) => {
|
|
1897
|
+
if (o[k] === v)
|
|
1898
|
+
return;
|
|
1899
|
+
undo.push([o, k, o[k]]);
|
|
1900
|
+
o[k] = v;
|
|
1901
|
+
};
|
|
1902
|
+
const html = (h) => (
|
|
1903
|
+
// `<!-->` and `<!--->` close at once, as a browser reads them (review)
|
|
1904
|
+
h.replace(/<!--(?:-?>|[\s\S]*?(?:-->|$))|<[a-zA-Z][^<>]*>/g, (tag) => tag.startsWith("<!--") ? tag : tag.replace(/(\s)(href|src)(\s*=\s*)("([^"]*)"|'([^']*)')/gi, (m, sp, attr, eq, _q, dq, sq) => {
|
|
1905
|
+
const v = unescAttr(dq ?? sq ?? "");
|
|
1906
|
+
if (!v || v.startsWith("#") || /^[a-z][a-z0-9+.-]*:|^\/\//i.test(v))
|
|
1907
|
+
return m;
|
|
1908
|
+
const out = attr.toLowerCase() === "href" ? fn.link(v, true) : fn.asset(v, true);
|
|
1909
|
+
return `${sp}${attr}${eq}"${escAttr(out)}"`;
|
|
1910
|
+
}))
|
|
1911
|
+
);
|
|
1912
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
1913
|
+
const seenProps = /* @__PURE__ */ new WeakSet();
|
|
1914
|
+
const walk = (node) => {
|
|
1915
|
+
if (node && typeof node === "object") {
|
|
1916
|
+
if (seen.has(node))
|
|
1917
|
+
return;
|
|
1918
|
+
seen.add(node);
|
|
1919
|
+
}
|
|
1920
|
+
if (Array.isArray(node)) {
|
|
1921
|
+
for (const n of node)
|
|
1922
|
+
walk(n);
|
|
1923
|
+
return;
|
|
1924
|
+
}
|
|
1925
|
+
if (!node || typeof node !== "object")
|
|
1926
|
+
return;
|
|
1927
|
+
const o = node;
|
|
1928
|
+
if (o.type === "endpoint") {
|
|
1929
|
+
const props = structuredClone(o.props);
|
|
1930
|
+
rewriteEndpointMarkdown(props, fn.link);
|
|
1931
|
+
set(o, "props", props);
|
|
1932
|
+
return;
|
|
1933
|
+
}
|
|
1934
|
+
if (typeof o.href === "string")
|
|
1935
|
+
set(o, "href", fn.link(o.href));
|
|
1936
|
+
if (typeof o.src === "string")
|
|
1937
|
+
set(o, "src", fn.asset(o.src));
|
|
1938
|
+
if (typeof o.poster === "string")
|
|
1939
|
+
set(o, "poster", fn.asset(o.poster));
|
|
1940
|
+
if (typeof o.icon === "string" && IMAGE_FILE.test(o.icon))
|
|
1941
|
+
set(o, "icon", fn.asset(o.icon));
|
|
1942
|
+
if (typeof o.html === "string" && !TEXT_HTML.has(String(o.type)))
|
|
1943
|
+
set(o, "html", html(o.html));
|
|
1944
|
+
const mdProps = typeof o.type === "string" && Object.hasOwn(MARKDOWN_PROPS, o.type) ? MARKDOWN_PROPS[o.type] : void 0;
|
|
1945
|
+
if (mdProps && o.props && typeof o.props === "object" && !seenProps.has(o.props)) {
|
|
1946
|
+
seenProps.add(o.props);
|
|
1947
|
+
const props = o.props;
|
|
1948
|
+
for (const key of mdProps) {
|
|
1949
|
+
const v = props[key];
|
|
1950
|
+
if (typeof v === "string")
|
|
1951
|
+
set(props, key, rewriteMarkdownLinks(v, (u) => IMAGE_FILE.test(u.split(/[?#]/)[0]) ? fn.asset(u) : fn.link(u), { local: true }));
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
for (const v of Object.values(o))
|
|
1955
|
+
if (v && typeof v === "object")
|
|
1956
|
+
walk(v);
|
|
1957
|
+
};
|
|
1958
|
+
const restore = () => {
|
|
1959
|
+
for (let i = undo.length - 1; i >= 0; i--)
|
|
1960
|
+
undo[i][0][undo[i][1]] = undo[i][2];
|
|
1961
|
+
};
|
|
1962
|
+
try {
|
|
1963
|
+
walk(tree);
|
|
1964
|
+
} catch (e) {
|
|
1965
|
+
restore();
|
|
1966
|
+
throw e;
|
|
1967
|
+
}
|
|
1968
|
+
return restore;
|
|
1969
|
+
}
|
|
1970
|
+
function unescAttr(v) {
|
|
1971
|
+
return v.replace(/&(amp|quot|lt|gt|#(\d{1,7})|#x([0-9a-f]{1,6}));/gi, (m, e, dec, hex) => {
|
|
1972
|
+
if (dec !== void 0 || hex !== void 0) {
|
|
1973
|
+
const cp = dec !== void 0 ? Number(dec) : parseInt(hex, 16);
|
|
1974
|
+
return cp > 0 && cp <= 1114111 ? String.fromCodePoint(cp) : m;
|
|
1975
|
+
}
|
|
1976
|
+
return { amp: "&", quot: '"', lt: "<", gt: ">" }[e.toLowerCase()];
|
|
1977
|
+
});
|
|
1978
|
+
}
|
|
1979
|
+
function escAttr(v) {
|
|
1980
|
+
return v.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
// node_modules/@dogsbay/site-files/dist/namespaces.js
|
|
1984
|
+
function sourceNamespace(source) {
|
|
1985
|
+
return source.name;
|
|
1986
|
+
}
|
|
1987
|
+
function isNamespaceAxisActive(sources) {
|
|
1988
|
+
if (sources.length < 2)
|
|
1989
|
+
return false;
|
|
1990
|
+
return new Set(sources.map(sourceNamespace)).size >= 2;
|
|
1991
|
+
}
|
|
1992
|
+
function namespaceSegments(source, sources) {
|
|
1993
|
+
const ns = isNamespaceAxisActive(sources) ? sourceNamespace(source) : void 0;
|
|
1994
|
+
return ns === void 0 ? [] : [ns];
|
|
1995
|
+
}
|
|
1996
|
+
function namespaceLabel(ns) {
|
|
1997
|
+
return ns.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
1998
|
+
}
|
|
1999
|
+
function prefixSlug(prefix, slug) {
|
|
2000
|
+
if (prefix.length === 0)
|
|
2001
|
+
return slug;
|
|
2002
|
+
if (!slug)
|
|
2003
|
+
return prefix.join("/");
|
|
2004
|
+
return `${prefix.join("/")}/${slug}`;
|
|
2005
|
+
}
|
|
2006
|
+
function localeLink(u, prefixSegs, axes) {
|
|
2007
|
+
if (!u.startsWith("/") || u.startsWith("//"))
|
|
2008
|
+
return void 0;
|
|
2009
|
+
const first = u.slice(1).split(/[/#?]/)[0];
|
|
2010
|
+
if (!first || !axes.localeIds.has(first))
|
|
2011
|
+
return void 0;
|
|
2012
|
+
const hasVersion = axes.versionSegment !== void 0;
|
|
2013
|
+
const out = [...prefixSegs];
|
|
2014
|
+
let versionAt = hasVersion ? out.length - 1 : -1;
|
|
2015
|
+
if (axes.locale !== void 0) {
|
|
2016
|
+
const localeAt = out.length - (hasVersion ? 2 : 1);
|
|
2017
|
+
if (localeAt < 0 || out[localeAt] !== axes.locale)
|
|
2018
|
+
return void 0;
|
|
2019
|
+
out[localeAt] = first;
|
|
2020
|
+
} else {
|
|
2021
|
+
const at = hasVersion ? out.length - 1 : out.length;
|
|
2022
|
+
out.splice(at, 0, first);
|
|
2023
|
+
if (hasVersion)
|
|
2024
|
+
versionAt = at + 1;
|
|
2025
|
+
}
|
|
2026
|
+
let rest = u.slice(1 + first.length);
|
|
2027
|
+
const second = rest.startsWith("/") ? rest.slice(1).split(/[/#?]/)[0] : "";
|
|
2028
|
+
const path = second ? axes.versionPaths?.get(second) : void 0;
|
|
2029
|
+
if (second && (axes.versionSegments.has(second) || path !== void 0)) {
|
|
2030
|
+
if (versionAt >= 0)
|
|
2031
|
+
out.splice(versionAt, 1);
|
|
2032
|
+
if (path !== void 0 && path !== second) {
|
|
2033
|
+
const after = rest.slice(1 + second.length);
|
|
2034
|
+
rest = path ? `/${path}${after}` : after;
|
|
2035
|
+
}
|
|
2036
|
+
}
|
|
2037
|
+
if (rest === "" || rest[0] === "?" || rest[0] === "#")
|
|
2038
|
+
rest = `/${rest}`;
|
|
2039
|
+
return `/${out.join("/")}${rest}`;
|
|
2040
|
+
}
|
|
2041
|
+
function namespacePrefixes(sources) {
|
|
2042
|
+
if (!isNamespaceAxisActive(sources))
|
|
2043
|
+
return /* @__PURE__ */ new Set();
|
|
2044
|
+
return new Set(sources.map(sourceNamespace).filter((n) => n !== void 0));
|
|
2045
|
+
}
|
|
2046
|
+
function namespaceNavGroup(ns, nav) {
|
|
2047
|
+
return ns === void 0 ? void 0 : { label: namespaceLabel(ns), children: nav };
|
|
2048
|
+
}
|
|
2049
|
+
function rewriteContentRefs(tree, prefixSegs, globalPrefixes, isSiteFile, locales) {
|
|
2050
|
+
if (prefixSegs.length === 0)
|
|
2051
|
+
return;
|
|
2052
|
+
const seg = prefixSegs.join("/");
|
|
2053
|
+
const fullPrefix = `/${seg}/`;
|
|
2054
|
+
const prefix = (u) => {
|
|
2055
|
+
if (!u)
|
|
2056
|
+
return u;
|
|
2057
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(u))
|
|
2058
|
+
return u;
|
|
2059
|
+
if (u.startsWith("//") || u.startsWith("#"))
|
|
2060
|
+
return u;
|
|
2061
|
+
if (!u.startsWith("/"))
|
|
2062
|
+
return u;
|
|
2063
|
+
if (u === "/" || u === "")
|
|
2064
|
+
return u;
|
|
2065
|
+
if (u.startsWith(fullPrefix) || u === `/${seg}`)
|
|
2066
|
+
return u;
|
|
2067
|
+
const firstSeg = u.slice(1).split(/[/#?]/)[0];
|
|
2068
|
+
if (globalPrefixes.has(firstSeg))
|
|
2069
|
+
return u;
|
|
2070
|
+
const other = locales ? localeLink(u, prefixSegs, locales) : void 0;
|
|
2071
|
+
if (other !== void 0)
|
|
2072
|
+
return other;
|
|
2073
|
+
if (isSiteFile?.(u.split(/[#?]/)[0]))
|
|
2074
|
+
return u;
|
|
2075
|
+
return `/${seg}${u}`;
|
|
2076
|
+
};
|
|
2077
|
+
const rewriteHtml = (html) => html.replace(/\b(href|src)=("|')(.*?)\2/gi, (_m, attr, q, val) => `${attr}=${q}${prefix(val)}${q}`);
|
|
2078
|
+
const walk = (node) => {
|
|
2079
|
+
if (Array.isArray(node)) {
|
|
2080
|
+
for (const item of node)
|
|
2081
|
+
walk(item);
|
|
2082
|
+
return;
|
|
2083
|
+
}
|
|
2084
|
+
if (!node || typeof node !== "object")
|
|
2085
|
+
return;
|
|
2086
|
+
const obj = node;
|
|
2087
|
+
if (typeof obj.src === "string")
|
|
2088
|
+
obj.src = prefix(obj.src);
|
|
2089
|
+
if (typeof obj.href === "string")
|
|
2090
|
+
obj.href = prefix(obj.href);
|
|
2091
|
+
if (typeof obj.html === "string" && !htmlIsText(obj))
|
|
2092
|
+
obj.html = rewriteHtml(obj.html);
|
|
2093
|
+
if (obj.type === "endpoint") {
|
|
2094
|
+
rewriteEndpointMarkdown(obj.props, prefix);
|
|
2095
|
+
return;
|
|
2096
|
+
}
|
|
2097
|
+
if (obj.type === "child-links" && obj.props && typeof obj.props.folder === "string") {
|
|
2098
|
+
const props = obj.props;
|
|
2099
|
+
props.folder = prefix(`/${String(props.folder).replace(/^\/+/, "")}`);
|
|
2100
|
+
}
|
|
2101
|
+
if (obj.type === "child-links" && obj.props && obj.props.scope === "section") {
|
|
2102
|
+
obj.props.scopeBase = `/${seg}`;
|
|
2103
|
+
}
|
|
2104
|
+
for (const key of Object.keys(obj)) {
|
|
2105
|
+
const val = obj[key];
|
|
2106
|
+
if (val && typeof val === "object")
|
|
2107
|
+
walk(val);
|
|
2108
|
+
}
|
|
2109
|
+
};
|
|
2110
|
+
walk(tree);
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
// node_modules/@dogsbay/site-files/dist/mounts.js
|
|
2114
|
+
function parseMount(mount) {
|
|
2115
|
+
if (typeof mount !== "string")
|
|
2116
|
+
return { error: "mount must be a string" };
|
|
2117
|
+
const trimmed = mount.trim().replace(/^\/+|\/+$/g, "");
|
|
2118
|
+
if (!trimmed)
|
|
2119
|
+
return { error: "mount must name a path, like reference/rest-api" };
|
|
2120
|
+
const segments2 = trimmed.split("/");
|
|
2121
|
+
if (segments2.length > 8)
|
|
2122
|
+
return { error: `mount "${mount}" has more than 8 segments` };
|
|
2123
|
+
for (const s of segments2) {
|
|
2124
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(s) || s.length > 100) {
|
|
2125
|
+
return {
|
|
2126
|
+
error: `mount "${mount}": "${s}" is not a path segment (letters, digits, \`.\`, \`_\` and \`-\`, starting with a letter or digit)`
|
|
2127
|
+
};
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
return { segments: segments2 };
|
|
2131
|
+
}
|
|
2132
|
+
function mountSlug(segments2, slug) {
|
|
2133
|
+
const base = segments2.join("/");
|
|
2134
|
+
return slug === "" || slug === "index" ? base : `${base}/${slug}`;
|
|
2135
|
+
}
|
|
2136
|
+
function isMountRoot(slug) {
|
|
2137
|
+
return slug === "" || slug === "index";
|
|
2138
|
+
}
|
|
2139
|
+
function mountRefs(tree, segments2, ownSlugs) {
|
|
2140
|
+
const base = segments2.join("/");
|
|
2141
|
+
const move = (u) => {
|
|
2142
|
+
if (!u.startsWith("/") || u.startsWith("//"))
|
|
2143
|
+
return u;
|
|
2144
|
+
const cut = u.search(/[?#]/);
|
|
2145
|
+
const path = cut === -1 ? u : u.slice(0, cut);
|
|
2146
|
+
const rest = cut === -1 ? "" : u.slice(cut);
|
|
2147
|
+
const slug = path.replace(/^\/+|\/+$/g, "");
|
|
2148
|
+
const own = slug === "" ? ownSlugs.has("index") || ownSlugs.has("") : ownSlugs.has(slug);
|
|
2149
|
+
if (!own)
|
|
2150
|
+
return u;
|
|
2151
|
+
return `/${slug === "" ? base : `${base}/${slug}`}${path.endsWith("/") && slug !== "" ? "/" : ""}${rest}`;
|
|
2152
|
+
};
|
|
2153
|
+
const walk = (node) => {
|
|
2154
|
+
if (Array.isArray(node)) {
|
|
2155
|
+
for (const item of node)
|
|
2156
|
+
walk(item);
|
|
2157
|
+
return;
|
|
2158
|
+
}
|
|
2159
|
+
if (!node || typeof node !== "object")
|
|
2160
|
+
return;
|
|
2161
|
+
const obj = node;
|
|
2162
|
+
if (typeof obj.href === "string")
|
|
2163
|
+
obj.href = move(obj.href);
|
|
2164
|
+
if (typeof obj.html === "string" && !htmlIsText(obj)) {
|
|
2165
|
+
obj.html = obj.html.replace(/\bhref=("|')(.*?)\1/gi, (_m, q, val) => `href=${q}${move(val)}${q}`);
|
|
2166
|
+
}
|
|
2167
|
+
if (obj.type === "endpoint") {
|
|
2168
|
+
rewriteEndpointMarkdown(obj.props, move);
|
|
2169
|
+
return;
|
|
2170
|
+
}
|
|
2171
|
+
for (const key of Object.keys(obj)) {
|
|
2172
|
+
const val = obj[key];
|
|
2173
|
+
if (val && typeof val === "object")
|
|
2174
|
+
walk(val);
|
|
2175
|
+
}
|
|
2176
|
+
};
|
|
2177
|
+
walk(tree);
|
|
2178
|
+
}
|
|
2179
|
+
function hrefKey(href) {
|
|
2180
|
+
if (href === void 0)
|
|
2181
|
+
return void 0;
|
|
2182
|
+
const bare = href.split(/[#?]/)[0];
|
|
2183
|
+
return bare.length > 1 ? bare.replace(/\/+$/, "") : bare;
|
|
2184
|
+
}
|
|
2185
|
+
function placeMountedNav(host, mounted, mountHref, label, mount) {
|
|
2186
|
+
const mountKey = hrefKey(mountHref);
|
|
2187
|
+
const sections = hrefKey(mounted[0]?.href) === mountKey ? mounted.slice(1) : mounted.slice();
|
|
2188
|
+
const clone = (items) => items.map((i) => ({ ...i, ...i.children ? { children: clone(i.children) } : {} }));
|
|
2189
|
+
const nav = clone(host);
|
|
2190
|
+
const atPage = (items) => {
|
|
2191
|
+
for (const item of items) {
|
|
2192
|
+
if (hrefKey(item.href) === mountKey)
|
|
2193
|
+
return item;
|
|
2194
|
+
const found = item.children ? atPage(item.children) : void 0;
|
|
2195
|
+
if (found)
|
|
2196
|
+
return found;
|
|
2197
|
+
}
|
|
2198
|
+
return void 0;
|
|
2199
|
+
};
|
|
2200
|
+
const page = atPage(nav);
|
|
2201
|
+
if (page) {
|
|
2202
|
+
page.children = [...page.children ?? [], ...sections];
|
|
2203
|
+
return { nav, placement: "at-page" };
|
|
2204
|
+
}
|
|
2205
|
+
const entry2 = { label, href: mountHref, children: sections };
|
|
2206
|
+
const cut = mountKey.lastIndexOf("/");
|
|
2207
|
+
const parent = cut > 0 ? mountKey.slice(0, cut) : "";
|
|
2208
|
+
if (parent && mount.split("/").filter(Boolean).length > 1) {
|
|
2209
|
+
let best;
|
|
2210
|
+
let outer;
|
|
2211
|
+
const under = (items) => items.some((c) => hrefKey(c.href)?.startsWith(`${parent}/`) || (c.children ? under(c.children) : false));
|
|
2212
|
+
const visit = (items, depth) => {
|
|
2213
|
+
for (const item of items) {
|
|
2214
|
+
const children = item.children;
|
|
2215
|
+
if (!children || children.length === 0)
|
|
2216
|
+
continue;
|
|
2217
|
+
const holds2 = hrefKey(item.href) === parent || children.some((c) => {
|
|
2218
|
+
const k = hrefKey(c.href);
|
|
2219
|
+
return k !== void 0 && (k === parent || k.startsWith(`${parent}/`) && !k.slice(parent.length + 1).includes("/"));
|
|
2220
|
+
});
|
|
2221
|
+
if (holds2 && (!best || depth > best.depth))
|
|
2222
|
+
best = { items: children, depth };
|
|
2223
|
+
if (!holds2 && (!outer || depth < outer.depth) && under(children))
|
|
2224
|
+
outer = { items: children, depth };
|
|
2225
|
+
visit(children, depth + 1);
|
|
2226
|
+
}
|
|
2227
|
+
};
|
|
2228
|
+
visit(nav, 0);
|
|
2229
|
+
best ??= outer;
|
|
2230
|
+
if (best) {
|
|
2231
|
+
best.items.push(entry2);
|
|
2232
|
+
return { nav, placement: "in-section" };
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
nav.push(entry2);
|
|
2236
|
+
return { nav, placement: "top-level" };
|
|
2237
|
+
}
|
|
2238
|
+
function mountRootNote(mount, slug) {
|
|
2239
|
+
return `${slug}: the content page is the API root of the source mounted at "${mount}"; the generated root page is skipped`;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
// node_modules/@dogsbay/site-files/dist/errors.js
|
|
2243
|
+
var ProductConfigError = class extends Error {
|
|
2244
|
+
name = "ProductConfigError";
|
|
2245
|
+
};
|
|
2246
|
+
|
|
2247
|
+
// node_modules/@dogsbay/site-files/dist/version-menu.js
|
|
2248
|
+
var SITE_PATH = /^\/(?![/\\])[^\s\x00-\x1f\\]*$/;
|
|
2249
|
+
var WEB = /^https?:\/\/\S+$/;
|
|
2250
|
+
var fail = (msg) => {
|
|
2251
|
+
throw new ProductConfigError(msg);
|
|
2252
|
+
};
|
|
2253
|
+
function isSiteLinkHref(href) {
|
|
2254
|
+
return typeof href === "string" && (SITE_PATH.test(href) || WEB.test(href));
|
|
2255
|
+
}
|
|
2256
|
+
var isVersionMenuHref = isSiteLinkHref;
|
|
2257
|
+
function readVersionMenu(raw, at) {
|
|
2258
|
+
if (raw === void 0 || raw === null)
|
|
2259
|
+
return void 0;
|
|
2260
|
+
if (typeof raw !== "object" || Array.isArray(raw))
|
|
2261
|
+
return fail(`${at}: expected a mapping (links, limit)`);
|
|
2262
|
+
const m = raw;
|
|
2263
|
+
const links = [];
|
|
2264
|
+
if (m.links != null) {
|
|
2265
|
+
if (!Array.isArray(m.links))
|
|
2266
|
+
fail(`${at}.links: expected a list of { label, href }`);
|
|
2267
|
+
for (const [i, e] of m.links.entries()) {
|
|
2268
|
+
const where = `${at}.links[${i}]`;
|
|
2269
|
+
if (!e || typeof e !== "object" || Array.isArray(e))
|
|
2270
|
+
fail(`${where}: expected a mapping { label, href }`);
|
|
2271
|
+
const l = e;
|
|
2272
|
+
if (typeof l.label !== "string" || !l.label.trim())
|
|
2273
|
+
fail(`${where}: needs a label`);
|
|
2274
|
+
if (!isVersionMenuHref(l.href))
|
|
2275
|
+
fail(`${where}.href: a path from the site root (/archive/) or an http(s) address; got ${JSON.stringify(l.href ?? null)}`);
|
|
2276
|
+
links.push({ label: l.label, href: l.href });
|
|
2277
|
+
}
|
|
2278
|
+
}
|
|
2279
|
+
let limit;
|
|
2280
|
+
if (m.limit != null) {
|
|
2281
|
+
if (typeof m.limit !== "number" || !Number.isInteger(m.limit) || m.limit < 1)
|
|
2282
|
+
fail(`${at}.limit: expected a whole number of 1 or more`);
|
|
2283
|
+
limit = m.limit;
|
|
2284
|
+
if (limit === 1 && !links.length)
|
|
2285
|
+
fail(`${at}.limit: 1 needs links`);
|
|
2286
|
+
}
|
|
2287
|
+
return { links, ...limit !== void 0 ? { limit } : {} };
|
|
2288
|
+
}
|
|
2289
|
+
function readVersionBadge(raw, at) {
|
|
2290
|
+
if (raw == null)
|
|
2291
|
+
return void 0;
|
|
2292
|
+
if (typeof raw !== "boolean")
|
|
2293
|
+
return fail(`${at}.badge must be true or false`);
|
|
2294
|
+
return raw;
|
|
2295
|
+
}
|
|
2296
|
+
function limitVersionRows(rows, limit, isCurrent) {
|
|
2297
|
+
if (limit === void 0 || rows.length <= limit)
|
|
2298
|
+
return [...rows];
|
|
2299
|
+
const shown = rows.slice(0, limit);
|
|
2300
|
+
const current = rows.slice(limit).find(isCurrent);
|
|
2301
|
+
return current ? [...shown, current] : shown;
|
|
2302
|
+
}
|
|
2303
|
+
|
|
2304
|
+
// node_modules/@dogsbay/site-files/dist/products.js
|
|
2305
|
+
var NAME = /^[a-z0-9][a-z0-9-]*$/i;
|
|
2306
|
+
var ID = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
2307
|
+
var fail2 = (msg) => {
|
|
2308
|
+
throw new ProductConfigError(msg);
|
|
2309
|
+
};
|
|
2310
|
+
var idOf = (v, at, quoted = false) => {
|
|
2311
|
+
if (v == null)
|
|
2312
|
+
return void 0;
|
|
2313
|
+
if (quoted && typeof v === "number")
|
|
2314
|
+
return fail2(`${at}: ${v} is a number; write ids as quoted text ("${v}"), since YAML reads 1.0 as 1`);
|
|
2315
|
+
if (typeof v === "number" && !Number.isInteger(v))
|
|
2316
|
+
return fail2(`${at}: ${v} is read as a number, which drops trailing zeros (1.0 \u2192 1); quote it: "${v}"`);
|
|
2317
|
+
if (typeof v !== "string" && typeof v !== "number")
|
|
2318
|
+
return fail2(`${at}: ${JSON.stringify(v)} must be text`);
|
|
2319
|
+
return String(v);
|
|
2320
|
+
};
|
|
2321
|
+
function versionList(raw, at, quoted = false) {
|
|
2322
|
+
if (raw == null)
|
|
2323
|
+
return void 0;
|
|
2324
|
+
if (!Array.isArray(raw) || raw.length === 0)
|
|
2325
|
+
return fail2(`${at} must be a non-empty list of versions`);
|
|
2326
|
+
const out = [];
|
|
2327
|
+
for (const [i, e] of raw.entries()) {
|
|
2328
|
+
if (!e || typeof e !== "object" || Array.isArray(e))
|
|
2329
|
+
return fail2(`${at}[${i}] must be a mapping with an id`);
|
|
2330
|
+
const v = e;
|
|
2331
|
+
const id = idOf(v.id, `${at}[${i}].id`, quoted);
|
|
2332
|
+
if (!id || !ID.test(id))
|
|
2333
|
+
return fail2(`${at}[${i}]: id ${JSON.stringify(id ?? null)} must be one URL segment of letters, digits, dots, dashes and underscores`);
|
|
2334
|
+
const path = v.path == null ? id : idOf(v.path, `${at}: "${id}".path`, quoted);
|
|
2335
|
+
if (path !== "" && !ID.test(path))
|
|
2336
|
+
return fail2(`${at}: "${id}".path ${JSON.stringify(path)} must be "" or one URL segment of letters, digits, dots, dashes and underscores`);
|
|
2337
|
+
for (const flag of ["eol", "prerelease", "hidden"]) {
|
|
2338
|
+
if (v[flag] != null && typeof v[flag] !== "boolean")
|
|
2339
|
+
return fail2(`${at}: "${id}".${flag} must be true or false`);
|
|
2340
|
+
}
|
|
2341
|
+
if (v.label != null && (typeof v.label !== "string" || !v.label.trim()) && typeof v.label !== "number")
|
|
2342
|
+
return fail2(`${at}: "${id}".label must be text`);
|
|
2343
|
+
if (v.banner != null && typeof v.banner !== "string")
|
|
2344
|
+
return fail2(`${at}: "${id}".banner must be text`);
|
|
2345
|
+
const badge = readVersionBadge(v.badge, `${at}: "${id}"`);
|
|
2346
|
+
out.push({
|
|
2347
|
+
id,
|
|
2348
|
+
label: v.label == null ? id : String(v.label),
|
|
2349
|
+
path,
|
|
2350
|
+
...v.eol ? { eol: true } : {},
|
|
2351
|
+
...v.prerelease ? { prerelease: true } : {},
|
|
2352
|
+
...v.hidden ? { hidden: true } : {},
|
|
2353
|
+
...v.banner ? { banner: v.banner } : {},
|
|
2354
|
+
...badge ? { badge: true } : {},
|
|
2355
|
+
...v.canonical !== void 0 ? { canonical: v.canonical } : {},
|
|
2356
|
+
...v.noindex !== void 0 ? { noindex: v.noindex } : {},
|
|
2357
|
+
...v.sitemap !== void 0 ? { sitemap: v.sitemap } : {}
|
|
2358
|
+
});
|
|
2359
|
+
}
|
|
2360
|
+
return out;
|
|
2361
|
+
}
|
|
2362
|
+
function settle(versions, rawDefault, at, localeIds, quoted = false) {
|
|
2363
|
+
const ids = /* @__PURE__ */ new Set();
|
|
2364
|
+
const paths = /* @__PURE__ */ new Map();
|
|
2365
|
+
for (const v of versions) {
|
|
2366
|
+
if (ids.has(v.id))
|
|
2367
|
+
fail2(`${at}: version "${v.id}" is listed twice`);
|
|
2368
|
+
ids.add(v.id);
|
|
2369
|
+
}
|
|
2370
|
+
for (const v of versions) {
|
|
2371
|
+
const other = paths.get(v.path);
|
|
2372
|
+
if (other !== void 0)
|
|
2373
|
+
fail2(`${at}: versions "${other}" and "${v.id}" are both served at ${v.path ? `"${v.path}"` : `the product's root (path: "")`}`);
|
|
2374
|
+
paths.set(v.path, v.id);
|
|
2375
|
+
if (v.path !== v.id && ids.has(v.path))
|
|
2376
|
+
fail2(`${at}: "${v.id}".path "${v.path}" is another version's id`);
|
|
2377
|
+
if (localeIds.has(v.path))
|
|
2378
|
+
fail2(`${at}: "${v.id}".path "${v.path}" is a locale code`);
|
|
2379
|
+
}
|
|
2380
|
+
const given = idOf(rawDefault, `${at}: defaultVersion`, quoted);
|
|
2381
|
+
const dv = given ?? versions.find((v) => !v.prerelease)?.id;
|
|
2382
|
+
if (dv === void 0)
|
|
2383
|
+
return fail2(`${at}: every version is a prerelease; set defaultVersion to the one readers land on`);
|
|
2384
|
+
const entry2 = versions.find((v) => v.id === dv);
|
|
2385
|
+
if (!entry2)
|
|
2386
|
+
return fail2(`${at}: defaultVersion "${dv}" is not in its versions (${versions.map((v) => v.id).join(", ")})`);
|
|
2387
|
+
if (entry2.prerelease)
|
|
2388
|
+
fail2(`${at}: defaultVersion "${dv}" is a prerelease`);
|
|
2389
|
+
for (const v of versions)
|
|
2390
|
+
if (v.path === "" && v.id !== dv)
|
|
2391
|
+
fail2(`${at}: "${v.id}".path: "" is only allowed on the defaultVersion`);
|
|
2392
|
+
const seo = checkVersionsSeo(versions, dv);
|
|
2393
|
+
if (seo)
|
|
2394
|
+
fail2(`${at}: ${seo}`);
|
|
2395
|
+
return dv;
|
|
2396
|
+
}
|
|
2397
|
+
function productModel(content) {
|
|
2398
|
+
if (content.products == null)
|
|
2399
|
+
return void 0;
|
|
2400
|
+
const raw = content.products;
|
|
2401
|
+
if (typeof raw !== "object" || Array.isArray(raw))
|
|
2402
|
+
return fail2("content.products must be a mapping of product name to its settings");
|
|
2403
|
+
const sources = content.sources ?? [];
|
|
2404
|
+
const localeIds = /* @__PURE__ */ new Set();
|
|
2405
|
+
for (const l of content.locales ?? []) {
|
|
2406
|
+
const id = String(l?.id);
|
|
2407
|
+
if (!ID.test(id))
|
|
2408
|
+
fail2(`content.locales: ${JSON.stringify(l?.id)} must be one URL segment of letters, digits, dots, dashes and underscores`);
|
|
2409
|
+
localeIds.add(id);
|
|
2410
|
+
}
|
|
2411
|
+
for (const l of [content.defaultLocale, ...sources.map((s) => s.locale)]) {
|
|
2412
|
+
if (l == null)
|
|
2413
|
+
continue;
|
|
2414
|
+
if (typeof l !== "string" || !ID.test(l))
|
|
2415
|
+
fail2(`locale ${JSON.stringify(l)} must be one URL segment of letters, digits, dots, dashes and underscores`);
|
|
2416
|
+
if (localeIds.size && !localeIds.has(l))
|
|
2417
|
+
fail2(`locale "${l}" is not in content.locales (${[...localeIds].join(", ")})`);
|
|
2418
|
+
}
|
|
2419
|
+
const siteMenu = readVersionMenu(content.versionMenu, "content.versionMenu");
|
|
2420
|
+
const siteVersions = versionList(content.versions, "content.versions");
|
|
2421
|
+
const siteDefault = siteVersions ? settle(siteVersions, content.defaultVersion, "content.versions", localeIds) : void 0;
|
|
2422
|
+
const products = [];
|
|
2423
|
+
const byName = /* @__PURE__ */ new Map();
|
|
2424
|
+
if (sources.some((s) => s.name == null)) {
|
|
2425
|
+
const bucket2 = { label: "", versions: siteVersions ?? [], ...siteDefault ? { defaultVersion: siteDefault } : {}, ...siteMenu ? { versionMenu: siteMenu } : {} };
|
|
2426
|
+
products.push(bucket2);
|
|
2427
|
+
byName.set(void 0, bucket2);
|
|
2428
|
+
}
|
|
2429
|
+
for (const [name, settings] of Object.entries(raw)) {
|
|
2430
|
+
const at = `content.products.${name}`;
|
|
2431
|
+
if (!NAME.test(name))
|
|
2432
|
+
fail2(`${at}: a product name must be one URL segment of letters, digits and dashes`);
|
|
2433
|
+
if (localeIds.has(name))
|
|
2434
|
+
fail2(`${at}: "${name}" is a locale code`);
|
|
2435
|
+
const p = settings ?? {};
|
|
2436
|
+
if (typeof p !== "object" || Array.isArray(p))
|
|
2437
|
+
fail2(`${at} must be a mapping (label, defaultVersion, versions)`);
|
|
2438
|
+
if (p.label != null && (typeof p.label !== "string" || !p.label.trim()))
|
|
2439
|
+
fail2(`${at}.label must be text`);
|
|
2440
|
+
const own = versionList(p.versions, `${at}.versions`, true);
|
|
2441
|
+
if (!own && p.defaultVersion != null)
|
|
2442
|
+
fail2(`${at}: defaultVersion without versions`);
|
|
2443
|
+
const versions = own ?? siteVersions ?? [];
|
|
2444
|
+
if (!own && typeof p.defaultVersion === "number")
|
|
2445
|
+
idOf(p.defaultVersion, `${at}: defaultVersion`, true);
|
|
2446
|
+
const defaultVersion = own ? settle(own, p.defaultVersion, `${at}.versions`, localeIds, true) : siteDefault;
|
|
2447
|
+
const versionMenu = readVersionMenu(p.versionMenu, `${at}.versionMenu`) ?? siteMenu;
|
|
2448
|
+
const product = { name, label: p.label ?? name, versions, ...defaultVersion ? { defaultVersion } : {}, ...versionMenu ? { versionMenu } : {} };
|
|
2449
|
+
products.push(product);
|
|
2450
|
+
byName.set(name, product);
|
|
2451
|
+
}
|
|
2452
|
+
const bucket = byName.get(void 0);
|
|
2453
|
+
for (const v of bucket?.versions ?? []) {
|
|
2454
|
+
if (byName.has(v.path))
|
|
2455
|
+
fail2(`content.versions: "${v.id}".path "${v.path}" is a product name, so both are served at /${v.path}/`);
|
|
2456
|
+
}
|
|
2457
|
+
const effectiveLocales = new Set(sources.map((s) => s.locale ?? content.defaultLocale).filter((l) => l != null));
|
|
2458
|
+
const localeAxis = effectiveLocales.size >= 2;
|
|
2459
|
+
const units = [];
|
|
2460
|
+
const built = /* @__PURE__ */ new Set();
|
|
2461
|
+
const unitOfSource = (s) => {
|
|
2462
|
+
const where = `content.sources (${s.path ?? s.name ?? "unnamed"})`;
|
|
2463
|
+
const product = byName.get(s.name);
|
|
2464
|
+
if (!product)
|
|
2465
|
+
return fail2(`${where}: name "${s.name}" is not a product in content.products (${[...byName.keys()].filter(Boolean).join(", ")})`);
|
|
2466
|
+
if (s.mount !== void 0 && (typeof s.mount !== "string" || !s.mount))
|
|
2467
|
+
fail2(`${where}: mount must be a path inside the unit`);
|
|
2468
|
+
const given = idOf(s.version, `${where}: version`, s.name != null);
|
|
2469
|
+
let version;
|
|
2470
|
+
if (product.versions.length === 0) {
|
|
2471
|
+
if (given !== void 0)
|
|
2472
|
+
fail2(`${where}: version "${given}", but ${s.name ? `product "${s.name}"` : "the site"} has no versions`);
|
|
2473
|
+
} else {
|
|
2474
|
+
version = given ?? product.defaultVersion;
|
|
2475
|
+
if (!product.versions.some((v) => v.id === version))
|
|
2476
|
+
fail2(`${where}: version "${version}" is not one of ${s.name ? `product "${s.name}"'s` : "content.versions'"} ids (${product.versions.map((v) => v.id).join(", ")})`);
|
|
2477
|
+
}
|
|
2478
|
+
const locale = localeAxis ? s.locale ?? content.defaultLocale : void 0;
|
|
2479
|
+
return { ...s.name != null ? { product: s.name } : {}, ...locale ? { locale } : {}, ...version ? { version } : {} };
|
|
2480
|
+
};
|
|
2481
|
+
for (const s of sources) {
|
|
2482
|
+
if (s.mount !== void 0)
|
|
2483
|
+
continue;
|
|
2484
|
+
const u = unitOfSource(s);
|
|
2485
|
+
const k = unitKeyString(u);
|
|
2486
|
+
if (!built.has(k)) {
|
|
2487
|
+
built.add(k);
|
|
2488
|
+
units.push(u);
|
|
2489
|
+
}
|
|
2490
|
+
}
|
|
2491
|
+
for (const s of sources) {
|
|
2492
|
+
if (s.mount === void 0)
|
|
2493
|
+
continue;
|
|
2494
|
+
const u = unitOfSource(s);
|
|
2495
|
+
if (!built.has(unitKeyString(u))) {
|
|
2496
|
+
fail2(`content.sources (${s.path ?? s.mount}): mount "${s.mount}" joins ${describeUnit(u)}, which no other source builds${s.name ? "" : " (a mount inside a product's version takes that product's name:)"}`);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
const model = {
|
|
2500
|
+
products,
|
|
2501
|
+
units,
|
|
2502
|
+
localeAxis,
|
|
2503
|
+
// A products: block always gives named sources their product segment, so a site's URLs do not
|
|
2504
|
+
// move when a second product is added (the namespace rule drops it for a single named source).
|
|
2505
|
+
productAxis: true,
|
|
2506
|
+
...content.defaultLocale ? { defaultLocale: content.defaultLocale } : {},
|
|
2507
|
+
...siteMenu ? { versionMenu: siteMenu } : {}
|
|
2508
|
+
};
|
|
2509
|
+
const homes = /* @__PURE__ */ new Map();
|
|
2510
|
+
for (const u of units) {
|
|
2511
|
+
const home = homeOf(unitSegments(model, u));
|
|
2512
|
+
const other = homes.get(home);
|
|
2513
|
+
if (other)
|
|
2514
|
+
fail2(`${describeUnit(other)} and ${describeUnit(u)} are both served at ${home}`);
|
|
2515
|
+
homes.set(home, u);
|
|
2516
|
+
}
|
|
2517
|
+
return model;
|
|
2518
|
+
}
|
|
2519
|
+
function sourceUnit(model, s, defaultLocale = model.defaultLocale) {
|
|
2520
|
+
const product = productOf(model, s.name);
|
|
2521
|
+
const version = product.versions.length ? s.version != null ? String(s.version) : product.defaultVersion : void 0;
|
|
2522
|
+
const locale = model.localeAxis ? s.locale ?? defaultLocale : void 0;
|
|
2523
|
+
return { ...s.name != null ? { product: s.name } : {}, ...locale ? { locale } : {}, ...version ? { version } : {} };
|
|
2524
|
+
}
|
|
2525
|
+
function unitKeyString(u) {
|
|
2526
|
+
return `${u.product ?? "_"}/${u.locale ?? "_"}/${u.version ?? "_"}`;
|
|
2527
|
+
}
|
|
2528
|
+
function describeUnit(u) {
|
|
2529
|
+
const parts = [u.product ? `product "${u.product}"` : "the unnamed source", u.locale ? `locale "${u.locale}"` : "", u.version ? `version "${u.version}"` : ""];
|
|
2530
|
+
return parts.filter(Boolean).join(", ");
|
|
2531
|
+
}
|
|
2532
|
+
function productOf(model, product) {
|
|
2533
|
+
const p = model.products.find((x) => x.name === product);
|
|
2534
|
+
if (!p)
|
|
2535
|
+
throw new ProductConfigError(`no product "${product ?? "(unnamed)"}"`);
|
|
2536
|
+
return p;
|
|
2537
|
+
}
|
|
2538
|
+
function unitSegments(model, u) {
|
|
2539
|
+
const product = productOf(model, u.product);
|
|
2540
|
+
const path = u.version === void 0 ? "" : product.versions.find((v) => v.id === u.version)?.path ?? u.version;
|
|
2541
|
+
return [model.productAxis ? u.product : void 0, model.localeAxis ? u.locale : void 0, path || void 0].filter((s) => !!s);
|
|
2542
|
+
}
|
|
2543
|
+
var homeOf = (segments2) => segments2.length ? `/${segments2.join("/")}/` : "/";
|
|
2544
|
+
var pagesScriptOf = (home) => `${home}_dogsbay/pages.js`;
|
|
2545
|
+
function defaultUnitOf(model, p, locale) {
|
|
2546
|
+
const units = model.units.filter((u) => u.product === p.name && u.version === p.defaultVersion);
|
|
2547
|
+
return units.find((u) => u.locale === locale) ?? units.find((u) => u.locale === model.defaultLocale) ?? units[0];
|
|
2548
|
+
}
|
|
2549
|
+
function unitOf(model, u) {
|
|
2550
|
+
const product = productOf(model, u.product);
|
|
2551
|
+
const versionDef = u.version === void 0 ? void 0 : product.versions.find((v) => v.id === u.version);
|
|
2552
|
+
if (u.version !== void 0 && !versionDef)
|
|
2553
|
+
throw new ProductConfigError(`${describeUnit(u)}: not a version of this product`);
|
|
2554
|
+
const segments2 = unitSegments(model, u);
|
|
2555
|
+
const isDefault = !versionDef || versionDef.id === product.defaultVersion;
|
|
2556
|
+
const kind = versionDef?.banner ? { kind: "custom", text: versionDef.banner } : versionDef?.eol ? { kind: "eol" } : versionDef?.prerelease ? { kind: "prerelease" } : versionDef && !isDefault ? { kind: "old" } : void 0;
|
|
2557
|
+
const target = kind && !isDefault ? defaultUnitOf(model, product, u.locale) : void 0;
|
|
2558
|
+
const targetDef = target && product.versions.find((v) => v.id === target.version);
|
|
2559
|
+
const banner = kind && (targetDef ? { ...kind, latest: { id: targetDef.id, label: targetDef.label, home: homeOf(unitSegments(model, target)) } } : kind);
|
|
2560
|
+
const home = homeOf(segments2);
|
|
2561
|
+
const sameLocaleDefault = { ...u, version: product.defaultVersion };
|
|
2562
|
+
const canonicalUnit = !isDefault && versionDef?.canonical !== "self" && model.units.some((x) => unitKeyString(x) === unitKeyString(sameLocaleDefault)) ? sameLocaleDefault : void 0;
|
|
2563
|
+
return {
|
|
2564
|
+
...u,
|
|
2565
|
+
segments: segments2,
|
|
2566
|
+
home,
|
|
2567
|
+
...versionDef ? { versionDef } : {},
|
|
2568
|
+
isDefault,
|
|
2569
|
+
...canonicalUnit ? { canonicalUnit } : {},
|
|
2570
|
+
...banner ? { banner } : {},
|
|
2571
|
+
pagesScript: pagesScriptOf(home),
|
|
2572
|
+
dataKey: unitKeyString(u)
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
function productRootRedirects(model) {
|
|
2576
|
+
const out = [];
|
|
2577
|
+
for (const p of model.products) {
|
|
2578
|
+
if (!p.versions.length)
|
|
2579
|
+
continue;
|
|
2580
|
+
for (const u of model.units) {
|
|
2581
|
+
if (u.product !== p.name || u.version !== p.defaultVersion)
|
|
2582
|
+
continue;
|
|
2583
|
+
const segments2 = unitSegments(model, u);
|
|
2584
|
+
const root = homeOf(unitSegments(model, { ...u, version: void 0 }));
|
|
2585
|
+
const home = homeOf(segments2);
|
|
2586
|
+
if (root !== home && root !== "/")
|
|
2587
|
+
out.push([root, home]);
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
return out;
|
|
2591
|
+
}
|
|
2592
|
+
function siteRootTarget(model) {
|
|
2593
|
+
if (model.units.some((u) => u.product === void 0))
|
|
2594
|
+
return void 0;
|
|
2595
|
+
return productSwitcher(model, model.defaultLocale)[0]?.home;
|
|
2596
|
+
}
|
|
2597
|
+
function switcher(model, product, locale) {
|
|
2598
|
+
const p = productOf(model, product);
|
|
2599
|
+
const built = new Set(model.units.map(unitKeyString));
|
|
2600
|
+
const rows = [];
|
|
2601
|
+
for (const v of p.versions) {
|
|
2602
|
+
if (v.hidden)
|
|
2603
|
+
continue;
|
|
2604
|
+
const u = { ...product ? { product } : {}, ...model.localeAxis && locale ? { locale } : {}, version: v.id };
|
|
2605
|
+
if (!built.has(unitKeyString(u)))
|
|
2606
|
+
continue;
|
|
2607
|
+
const home = homeOf(unitSegments(model, u));
|
|
2608
|
+
rows.push({ id: v.id, label: v.label, home, isDefault: v.id === p.defaultVersion, ...v.eol ? { eol: true } : {}, ...v.prerelease ? { prerelease: true } : {}, ...v.badge ? { badge: true } : {}, pagesScript: pagesScriptOf(home) });
|
|
2609
|
+
}
|
|
2610
|
+
return rows;
|
|
2611
|
+
}
|
|
2612
|
+
function productSwitcher(model, locale) {
|
|
2613
|
+
const out = [];
|
|
2614
|
+
for (const p of model.products) {
|
|
2615
|
+
if (!p.name)
|
|
2616
|
+
continue;
|
|
2617
|
+
const units = model.units.filter((u) => u.product === p.name);
|
|
2618
|
+
if (!units.length)
|
|
2619
|
+
continue;
|
|
2620
|
+
const at = (l) => units.find((u) => u.locale === l && u.version === p.defaultVersion);
|
|
2621
|
+
const unit = at(model.localeAxis ? locale : void 0) ?? at(model.defaultLocale) ?? units.find((u) => u.version === p.defaultVersion) ?? units[0];
|
|
2622
|
+
out.push({ name: p.name, label: p.label, home: homeOf(unitSegments(model, unit)) });
|
|
2623
|
+
}
|
|
2624
|
+
return out;
|
|
2625
|
+
}
|
|
2626
|
+
function unitManifest(u, m) {
|
|
2627
|
+
return { schemaVersion: 1, product: u.product ?? null, locale: u.locale ?? null, version: u.version ?? null, ...m };
|
|
2628
|
+
}
|
|
2629
|
+
function siteFiles(model, manifests) {
|
|
2630
|
+
const byKey2 = /* @__PURE__ */ new Map();
|
|
2631
|
+
for (const m of manifests) {
|
|
2632
|
+
const k = unitKeyString({ product: m.product ?? void 0, locale: m.locale ?? void 0, version: m.version ?? void 0 });
|
|
2633
|
+
if (!model.units.some((u) => unitKeyString(u) === k))
|
|
2634
|
+
throw new ProductConfigError(`a manifest for ${k}, which the config does not build`);
|
|
2635
|
+
if (byKey2.has(k))
|
|
2636
|
+
throw new ProductConfigError(`two manifests for ${k}`);
|
|
2637
|
+
byKey2.set(k, m);
|
|
2638
|
+
}
|
|
2639
|
+
const locales = model.localeAxis ? [...new Set(model.units.map((u) => u.locale))] : [void 0];
|
|
2640
|
+
const switchers = /* @__PURE__ */ Object.create(null);
|
|
2641
|
+
for (const p of model.products) {
|
|
2642
|
+
if (!p.versions.length)
|
|
2643
|
+
continue;
|
|
2644
|
+
const perLocale = /* @__PURE__ */ Object.create(null);
|
|
2645
|
+
for (const l of locales) {
|
|
2646
|
+
const rows = switcher(model, p.name, l);
|
|
2647
|
+
if (rows.length)
|
|
2648
|
+
perLocale[l ?? "_"] = rows;
|
|
2649
|
+
}
|
|
2650
|
+
switchers[p.name ?? "_"] = perLocale;
|
|
2651
|
+
}
|
|
2652
|
+
const products = /* @__PURE__ */ Object.create(null);
|
|
2653
|
+
for (const l of locales)
|
|
2654
|
+
products[l ?? "_"] = productSwitcher(model, l);
|
|
2655
|
+
const ordered = model.units.map((u) => byKey2.get(unitKeyString(u))).filter((m) => !!m);
|
|
2656
|
+
return {
|
|
2657
|
+
versions: { schemaVersion: 1, switchers, products },
|
|
2658
|
+
sitemap: ordered.flatMap((m) => m.sitemap),
|
|
2659
|
+
redirects: ordered.flatMap((m) => m.redirects),
|
|
2660
|
+
llms: ordered.flatMap((m) => m.llms ? [m.llms] : []),
|
|
2661
|
+
missing: model.units.map(unitKeyString).filter((k) => !byKey2.has(k))
|
|
2662
|
+
};
|
|
2663
|
+
}
|
|
2664
|
+
function toScript(global, value) {
|
|
2665
|
+
if (!/^__DOGSBAY_[A-Z_]+__$/.test(global))
|
|
2666
|
+
throw new Error(`toScript: global must look like __DOGSBAY_NAME__; got ${JSON.stringify(global)}`);
|
|
2667
|
+
const json = JSON.stringify(value).replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
2668
|
+
return `window.${global}=${json};
|
|
2669
|
+
`;
|
|
2670
|
+
}
|
|
2671
|
+
|
|
2672
|
+
// node_modules/@dogsbay/site-files/dist/static-folder.js
|
|
2673
|
+
var PASSIVE = /* @__PURE__ */ new Set([
|
|
2674
|
+
"png",
|
|
2675
|
+
"jpg",
|
|
2676
|
+
"jpeg",
|
|
2677
|
+
"gif",
|
|
2678
|
+
"webp",
|
|
2679
|
+
"avif",
|
|
2680
|
+
"ico",
|
|
2681
|
+
"bmp",
|
|
2682
|
+
"tif",
|
|
2683
|
+
"tiff",
|
|
2684
|
+
"woff",
|
|
2685
|
+
"woff2",
|
|
2686
|
+
"ttf",
|
|
2687
|
+
"otf",
|
|
2688
|
+
"eot",
|
|
2689
|
+
"mp4",
|
|
2690
|
+
"webm",
|
|
2691
|
+
"ogv",
|
|
2692
|
+
"ogg",
|
|
2693
|
+
"oga",
|
|
2694
|
+
"mp3",
|
|
2695
|
+
"wav",
|
|
2696
|
+
"m4a",
|
|
2697
|
+
"flac",
|
|
2698
|
+
"pdf",
|
|
2699
|
+
"txt",
|
|
2700
|
+
"md",
|
|
2701
|
+
"csv",
|
|
2702
|
+
"tsv",
|
|
2703
|
+
"json",
|
|
2704
|
+
"yaml",
|
|
2705
|
+
"yml",
|
|
2706
|
+
"toml",
|
|
2707
|
+
"zip",
|
|
2708
|
+
"gz",
|
|
2709
|
+
"tgz",
|
|
2710
|
+
"tar",
|
|
2711
|
+
"bz2",
|
|
2712
|
+
"xz",
|
|
2713
|
+
"7z",
|
|
2714
|
+
"epub",
|
|
2715
|
+
"doc",
|
|
2716
|
+
"docx",
|
|
2717
|
+
"xls",
|
|
2718
|
+
"xlsx",
|
|
2719
|
+
"ppt",
|
|
2720
|
+
"pptx",
|
|
2721
|
+
"odt",
|
|
2722
|
+
"ods",
|
|
2723
|
+
"odp",
|
|
2724
|
+
"sh",
|
|
2725
|
+
"ps1",
|
|
2726
|
+
"py",
|
|
2727
|
+
"conf",
|
|
2728
|
+
"ini",
|
|
2729
|
+
"env",
|
|
2730
|
+
"cfg",
|
|
2731
|
+
"pem",
|
|
2732
|
+
"crt",
|
|
2733
|
+
"pub",
|
|
2734
|
+
"asc",
|
|
2735
|
+
"sig",
|
|
2736
|
+
"sha256"
|
|
2737
|
+
]);
|
|
2738
|
+
function staticPathServed(path) {
|
|
2739
|
+
const segments2 = path.split("/");
|
|
2740
|
+
return segments2.every((seg, i) => !seg.startsWith(".") || i === 0 && seg === ".well-known" && segments2.length > 1);
|
|
2741
|
+
}
|
|
2742
|
+
function isPassiveStaticFile(path) {
|
|
2743
|
+
const name = path.slice(path.lastIndexOf("/") + 1);
|
|
2744
|
+
const dot = name.lastIndexOf(".");
|
|
2745
|
+
return dot > 0 && PASSIVE.has(name.slice(dot + 1).toLowerCase());
|
|
2746
|
+
}
|
|
2747
|
+
var SVG_DENIED = /* @__PURE__ */ new Set([
|
|
2748
|
+
"script",
|
|
2749
|
+
"animate",
|
|
2750
|
+
"animatemotion",
|
|
2751
|
+
"animatetransform",
|
|
2752
|
+
"animatecolor",
|
|
2753
|
+
"set",
|
|
2754
|
+
"discard",
|
|
2755
|
+
"iframe",
|
|
2756
|
+
"frame",
|
|
2757
|
+
"frameset",
|
|
2758
|
+
"embed",
|
|
2759
|
+
"object",
|
|
2760
|
+
"applet",
|
|
2761
|
+
"portal",
|
|
2762
|
+
"handler",
|
|
2763
|
+
"listener",
|
|
2764
|
+
"form",
|
|
2765
|
+
"input",
|
|
2766
|
+
"button",
|
|
2767
|
+
"textarea",
|
|
2768
|
+
"select",
|
|
2769
|
+
"meta",
|
|
2770
|
+
"base",
|
|
2771
|
+
"link"
|
|
2772
|
+
]);
|
|
2773
|
+
var SVG_URL_ATTRS = /* @__PURE__ */ new Set(["href", "src", "srcset", "poster", "data", "action", "formaction", "base", "background", "codebase", "dynsrc", "lowsrc"]);
|
|
2774
|
+
var XML_ENTITIES = { lt: "<", gt: ">", amp: "&", quot: '"', apos: "'" };
|
|
2775
|
+
function svgValue(raw) {
|
|
2776
|
+
let bad = false;
|
|
2777
|
+
const decoded = raw.replace(/&(#x[0-9a-f]+|#\d+|[a-z][a-z0-9]*);?/gi, (_m, n) => {
|
|
2778
|
+
if (n[0] !== "#") {
|
|
2779
|
+
const named = XML_ENTITIES[n.toLowerCase()];
|
|
2780
|
+
if (named === void 0)
|
|
2781
|
+
bad = true;
|
|
2782
|
+
return named ?? "";
|
|
2783
|
+
}
|
|
2784
|
+
const code = n[1] === "x" || n[1] === "X" ? parseInt(n.slice(2), 16) : parseInt(n.slice(1), 10);
|
|
2785
|
+
return code > 0 && code <= 1114111 ? String.fromCodePoint(code) : "";
|
|
2786
|
+
});
|
|
2787
|
+
return bad ? void 0 : decoded.replace(/[\x00-\x20]+/g, "");
|
|
2788
|
+
}
|
|
2789
|
+
function passiveSvg(text2) {
|
|
2790
|
+
if (/[\x1b\ufffd\ufffe]/.test(text2) || text2.indexOf("\uFEFF", 1) >= 0)
|
|
2791
|
+
return false;
|
|
2792
|
+
const decl = /^\ufeff?<\?xml[^?]*\?>/.exec(text2)?.[0];
|
|
2793
|
+
if (decl && /encoding\s*=/i.test(decl) && !/encoding\s*=\s*(["'])(utf-8|utf8|us-ascii)\1/i.test(decl))
|
|
2794
|
+
return false;
|
|
2795
|
+
const flat2 = svgValue(text2);
|
|
2796
|
+
if (flat2 === void 0 || /(javascript|vbscript|livescript):/i.test(flat2))
|
|
2797
|
+
return false;
|
|
2798
|
+
const NAME2 = /[A-Za-z_][A-Za-z0-9_.:-]*/y;
|
|
2799
|
+
const SPACE2 = /[ \t\r\n]*/y;
|
|
2800
|
+
const n = text2.length;
|
|
2801
|
+
let i = 0;
|
|
2802
|
+
while (i < n) {
|
|
2803
|
+
const lt = text2.indexOf("<", i);
|
|
2804
|
+
if (lt < 0)
|
|
2805
|
+
break;
|
|
2806
|
+
if (text2.startsWith("<!--", lt)) {
|
|
2807
|
+
const end = text2.indexOf("-->", lt + 4);
|
|
2808
|
+
if (end < 0)
|
|
2809
|
+
return false;
|
|
2810
|
+
i = end + 3;
|
|
2811
|
+
continue;
|
|
2812
|
+
}
|
|
2813
|
+
if (text2.startsWith("<![CDATA[", lt)) {
|
|
2814
|
+
const end = text2.indexOf("]]>", lt + 9);
|
|
2815
|
+
if (end < 0)
|
|
2816
|
+
return false;
|
|
2817
|
+
i = end + 3;
|
|
2818
|
+
continue;
|
|
2819
|
+
}
|
|
2820
|
+
if (text2[lt + 1] === "?") {
|
|
2821
|
+
const end = text2.indexOf("?>", lt + 2);
|
|
2822
|
+
if (end < 0 || !/^<\?xml[ \t\r\n]/.test(text2.slice(lt, lt + 6)) || lt !== text2.search(/\S/))
|
|
2823
|
+
return false;
|
|
2824
|
+
i = end + 2;
|
|
2825
|
+
continue;
|
|
2826
|
+
}
|
|
2827
|
+
if (text2[lt + 1] === "!")
|
|
2828
|
+
return false;
|
|
2829
|
+
let j = lt + 1;
|
|
2830
|
+
if (text2[j] === "/")
|
|
2831
|
+
j++;
|
|
2832
|
+
NAME2.lastIndex = j;
|
|
2833
|
+
const name = NAME2.exec(text2)?.[0];
|
|
2834
|
+
if (!name)
|
|
2835
|
+
return false;
|
|
2836
|
+
j += name.length;
|
|
2837
|
+
const local = name.slice(name.lastIndexOf(":") + 1).toLowerCase();
|
|
2838
|
+
if (SVG_DENIED.has(local))
|
|
2839
|
+
return false;
|
|
2840
|
+
for (; ; ) {
|
|
2841
|
+
SPACE2.lastIndex = j;
|
|
2842
|
+
j += SPACE2.exec(text2)[0].length;
|
|
2843
|
+
if (text2[j] === ">") {
|
|
2844
|
+
j++;
|
|
2845
|
+
break;
|
|
2846
|
+
}
|
|
2847
|
+
if (text2[j] === "/" && text2[j + 1] === ">") {
|
|
2848
|
+
j += 2;
|
|
2849
|
+
break;
|
|
2850
|
+
}
|
|
2851
|
+
NAME2.lastIndex = j;
|
|
2852
|
+
const attr = NAME2.exec(text2)?.[0];
|
|
2853
|
+
if (!attr)
|
|
2854
|
+
return false;
|
|
2855
|
+
j += attr.length;
|
|
2856
|
+
SPACE2.lastIndex = j;
|
|
2857
|
+
j += SPACE2.exec(text2)[0].length;
|
|
2858
|
+
if (text2[j] !== "=")
|
|
2859
|
+
return false;
|
|
2860
|
+
j++;
|
|
2861
|
+
SPACE2.lastIndex = j;
|
|
2862
|
+
j += SPACE2.exec(text2)[0].length;
|
|
2863
|
+
const q = text2[j];
|
|
2864
|
+
if (q !== '"' && q !== "'")
|
|
2865
|
+
return false;
|
|
2866
|
+
const close = text2.indexOf(q, j + 1);
|
|
2867
|
+
if (close < 0)
|
|
2868
|
+
return false;
|
|
2869
|
+
const raw = text2.slice(j + 1, close);
|
|
2870
|
+
j = close + 1;
|
|
2871
|
+
const aLocal = attr.slice(attr.lastIndexOf(":") + 1).toLowerCase();
|
|
2872
|
+
if (aLocal.startsWith("on"))
|
|
2873
|
+
return false;
|
|
2874
|
+
if (!SVG_URL_ATTRS.has(aLocal))
|
|
2875
|
+
continue;
|
|
2876
|
+
const value = svgValue(raw);
|
|
2877
|
+
if (value === void 0)
|
|
2878
|
+
return false;
|
|
2879
|
+
if (local === "use" && aLocal === "href") {
|
|
2880
|
+
if (!value.startsWith("#"))
|
|
2881
|
+
return false;
|
|
2882
|
+
} else if (local === "a") {
|
|
2883
|
+
if (!/^(https?:\/\/|#)/i.test(value))
|
|
2884
|
+
return false;
|
|
2885
|
+
} else if (/^[a-z][a-z0-9+.-]*:/i.test(value) && !/^(https?:\/\/|data:image\/(png|jpe?g|gif|webp|avif)[;,])/i.test(value)) {
|
|
2886
|
+
return false;
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
i = j;
|
|
2890
|
+
}
|
|
2891
|
+
return true;
|
|
2892
|
+
}
|
|
2893
|
+
function passiveSvgBytes(bytes) {
|
|
2894
|
+
let text2;
|
|
2895
|
+
try {
|
|
2896
|
+
text2 = new TextDecoder("utf-8", { fatal: true }).decode(bytes);
|
|
2897
|
+
} catch {
|
|
2898
|
+
return false;
|
|
2899
|
+
}
|
|
2900
|
+
return passiveSvg(text2);
|
|
2901
|
+
}
|
|
2902
|
+
var PASSIVE_SVG_MAX_BYTES = 5 * 1024 * 1024;
|
|
2903
|
+
function staticFolderPlan(files, o) {
|
|
2904
|
+
const label = o.label ?? "content.static";
|
|
2905
|
+
const plan = { copy: [], robots: false, leftOut: [], errors: [], warnings: [] };
|
|
2906
|
+
const hostRoot = [];
|
|
2907
|
+
for (const file of [...files].sort()) {
|
|
2908
|
+
if (file === "_headers" || file === "_redirects") {
|
|
2909
|
+
plan[file === "_headers" ? "headers" : "redirects"] = file;
|
|
2910
|
+
hostRoot.push(file);
|
|
2911
|
+
continue;
|
|
2912
|
+
}
|
|
2913
|
+
const svgOk = () => {
|
|
2914
|
+
const bytes = /\.svg$/i.test(file) ? o.readBytes?.(file) : void 0;
|
|
2915
|
+
return bytes !== void 0 && passiveSvgBytes(bytes);
|
|
2916
|
+
};
|
|
2917
|
+
if (o.untrusted && !isPassiveStaticFile(file) && !svgOk()) {
|
|
2918
|
+
plan.leftOut.push(file);
|
|
2919
|
+
continue;
|
|
2920
|
+
}
|
|
2921
|
+
if (file === "robots.txt") {
|
|
2922
|
+
plan.robots = true;
|
|
2923
|
+
hostRoot.push(file);
|
|
2924
|
+
plan.copy.push(file);
|
|
2925
|
+
continue;
|
|
2926
|
+
}
|
|
2927
|
+
const clash = o.writes(file);
|
|
2928
|
+
if (clash) {
|
|
2929
|
+
plan.errors.push(`${label}: ${file} is at a path the build writes (${clash}). Rename or remove one.`);
|
|
2930
|
+
continue;
|
|
2931
|
+
}
|
|
2932
|
+
if (!file.includes("/") && /\.html?$/i.test(file))
|
|
2933
|
+
hostRoot.push(file);
|
|
2934
|
+
plan.copy.push(file);
|
|
2935
|
+
}
|
|
2936
|
+
if (plan.leftOut.length) {
|
|
2937
|
+
plan.warnings.push(`${label}: ${plan.leftOut.length} file(s) left out, as the folder is untrusted (only passive files are served): ${plan.leftOut.slice(0, 5).join(", ")}${plan.leftOut.length > 5 ? ", \u2026" : ""}`);
|
|
2938
|
+
}
|
|
2939
|
+
const base = (o.basePath ?? "").replace(/\/+$/, "");
|
|
2940
|
+
if (base && hostRoot.length) {
|
|
2941
|
+
plan.warnings.push(`${label}: ${hostRoot.join(", ")} only work at the host's root, and the folder is served under ${base}/`);
|
|
2942
|
+
}
|
|
2943
|
+
return plan;
|
|
2944
|
+
}
|
|
2945
|
+
function staticRobotsWarnings(text2, label = "content.static") {
|
|
2946
|
+
const out = [`${label}: its robots.txt replaces the generated one, so no Content-Signal line is added`];
|
|
2947
|
+
if (!/^\s*sitemap\s*:/im.test(text2))
|
|
2948
|
+
out.push(`${label}: its robots.txt names no Sitemap:, so crawlers are not pointed at the site's sitemap`);
|
|
2949
|
+
return out;
|
|
2950
|
+
}
|
|
2951
|
+
|
|
2952
|
+
// node_modules/@dogsbay/site-files/dist/host-files.js
|
|
2953
|
+
var CLOUDFLARE_LIMITS = { headerRules: 100, staticRedirects: 2e3, dynamicRedirects: 100 };
|
|
2954
|
+
var withNewline = (s) => s && !s.endsWith("\n") ? s + "\n" : s;
|
|
2955
|
+
var joinBlocks = (theirs, ours) => theirs.trim() && ours ? `${withNewline(theirs)}
|
|
2956
|
+
${withNewline(ours)}` : withNewline(theirs.trim() ? theirs : ours);
|
|
2957
|
+
var meaningful = (line) => !!line.trim() && !line.trim().startsWith("#");
|
|
2958
|
+
var isDynamic = (from) => /\*|:[A-Za-z]/.test(from);
|
|
2959
|
+
function redirectLines(text2) {
|
|
2960
|
+
return text2.split(/\r?\n/).filter(meaningful).map((line) => {
|
|
2961
|
+
const [from, ...rest] = line.trim().split(/\s+/);
|
|
2962
|
+
return { from, line, conditional: rest.some((t) => /^[\w-]+=/.test(t)) };
|
|
2963
|
+
});
|
|
2964
|
+
}
|
|
2965
|
+
function matcher(from) {
|
|
2966
|
+
const ANY = "**any";
|
|
2967
|
+
const SEGMENT = "**segment";
|
|
2968
|
+
const tokens = [];
|
|
2969
|
+
for (let i = 0; i < from.length; ) {
|
|
2970
|
+
if (from[i] === "*") {
|
|
2971
|
+
if (tokens[tokens.length - 1] !== ANY)
|
|
2972
|
+
tokens.push(ANY);
|
|
2973
|
+
i++;
|
|
2974
|
+
} else if (from[i] === ":" && /[A-Za-z]/.test(from[i + 1] ?? "")) {
|
|
2975
|
+
tokens.push(SEGMENT);
|
|
2976
|
+
i += 2;
|
|
2977
|
+
while (i < from.length && /\w/.test(from[i]))
|
|
2978
|
+
i++;
|
|
2979
|
+
} else
|
|
2980
|
+
tokens.push(from[i++]);
|
|
2981
|
+
}
|
|
2982
|
+
return {
|
|
2983
|
+
test(path) {
|
|
2984
|
+
const n = path.length;
|
|
2985
|
+
let prev = new Uint8Array(n + 1);
|
|
2986
|
+
prev[0] = 1;
|
|
2987
|
+
for (const t of tokens) {
|
|
2988
|
+
const cur = new Uint8Array(n + 1);
|
|
2989
|
+
for (let j = 0; j <= n; j++) {
|
|
2990
|
+
if (t === ANY)
|
|
2991
|
+
cur[j] = prev[j] || (j > 0 ? cur[j - 1] : 0);
|
|
2992
|
+
else if (t === SEGMENT)
|
|
2993
|
+
cur[j] = j > 0 && path[j - 1] !== "/" ? prev[j - 1] || cur[j - 1] : 0;
|
|
2994
|
+
else
|
|
2995
|
+
cur[j] = j > 0 && path[j - 1] === t ? prev[j - 1] : 0;
|
|
2996
|
+
}
|
|
2997
|
+
prev = cur;
|
|
2998
|
+
}
|
|
2999
|
+
return prev[n] === 1;
|
|
3000
|
+
}
|
|
3001
|
+
};
|
|
3002
|
+
}
|
|
3003
|
+
function mergeRedirects(theirs, ours, cloudflare) {
|
|
3004
|
+
const notes = [];
|
|
3005
|
+
const own = redirectLines(theirs);
|
|
3006
|
+
const matchers = own.filter((r) => r.from.startsWith("/") && !r.conditional).map((r) => ({ from: r.from, re: matcher(r.from) }));
|
|
3007
|
+
const kept = [];
|
|
3008
|
+
const dropped = [];
|
|
3009
|
+
for (const line of (ours ?? "").split("\n")) {
|
|
3010
|
+
if (!meaningful(line)) {
|
|
3011
|
+
if (line.trim())
|
|
3012
|
+
kept.push(line);
|
|
3013
|
+
continue;
|
|
3014
|
+
}
|
|
3015
|
+
const from = line.trim().split(/\s+/)[0];
|
|
3016
|
+
const by = matchers.find((m) => m.re.test(from));
|
|
3017
|
+
if (by)
|
|
3018
|
+
dropped.push(by.from === from ? from : `${from} (by ${by.from})`);
|
|
3019
|
+
else
|
|
3020
|
+
kept.push(line);
|
|
3021
|
+
}
|
|
3022
|
+
if (dropped.length)
|
|
3023
|
+
notes.push(`${dropped.length} generated redirect(s) left out: the project's _redirects already has a rule for them: ${dropped.slice(0, 5).join(", ")}${dropped.length > 5 ? ", \u2026" : ""}`);
|
|
3024
|
+
const generated = kept.filter(meaningful);
|
|
3025
|
+
const text2 = joinBlocks(theirs, generated.length ? kept.join("\n") : "");
|
|
3026
|
+
if (cloudflare) {
|
|
3027
|
+
const froms = [...own.map((r) => r.from), ...generated.map((l) => l.trim().split(/\s+/)[0])];
|
|
3028
|
+
const dynamic = froms.filter(isDynamic).length;
|
|
3029
|
+
const fixed = froms.length - dynamic;
|
|
3030
|
+
if (fixed > CLOUDFLARE_LIMITS.staticRedirects || dynamic > CLOUDFLARE_LIMITS.dynamicRedirects) {
|
|
3031
|
+
notes.push(`_redirects has ${fixed} static and ${dynamic} dynamic rule(s); Cloudflare reads at most ${CLOUDFLARE_LIMITS.staticRedirects} static and ${CLOUDFLARE_LIMITS.dynamicRedirects} dynamic ones (use Bulk Redirects for more)`);
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
return { text: text2, notes };
|
|
3035
|
+
}
|
|
3036
|
+
function headerRules(text2) {
|
|
3037
|
+
const rules = [];
|
|
3038
|
+
for (const line of text2.split(/\r?\n/)) {
|
|
3039
|
+
if (!meaningful(line))
|
|
3040
|
+
continue;
|
|
3041
|
+
if (!/^\s/.test(line))
|
|
3042
|
+
rules.push({ path: line.trim(), lines: [] });
|
|
3043
|
+
else if (rules.length) {
|
|
3044
|
+
const t = line.trim();
|
|
3045
|
+
const at = t.indexOf(":");
|
|
3046
|
+
rules[rules.length - 1].lines.push({ line, key: at > 0 ? `${t.slice(0, at).trim().toLowerCase()}:${t.slice(at + 1).trim().replace(/\s+/g, " ")}` : t.toLowerCase().replace(/\s+/g, " ") });
|
|
3047
|
+
}
|
|
3048
|
+
}
|
|
3049
|
+
return rules;
|
|
3050
|
+
}
|
|
3051
|
+
function mergeHeaders(theirs, ours, cloudflare) {
|
|
3052
|
+
const notes = [];
|
|
3053
|
+
const own = headerRules(theirs);
|
|
3054
|
+
const set = new Set(own.flatMap((r) => r.lines.map((l) => `${r.path}\0${l.key}`)));
|
|
3055
|
+
const added = [];
|
|
3056
|
+
let rules = own.length;
|
|
3057
|
+
for (const r of headerRules(ours ?? "")) {
|
|
3058
|
+
const detached = (l) => set.has(`${r.path}\0! ${l.key.slice(0, l.key.indexOf(":"))}`);
|
|
3059
|
+
const lines = r.lines.filter((l) => !set.has(`${r.path}\0${l.key}`) && !detached(l));
|
|
3060
|
+
if (lines.length < r.lines.length)
|
|
3061
|
+
notes.push(`${r.lines.length - lines.length} generated header(s) on ${r.path} left out: the project's _headers already sets or detaches them`);
|
|
3062
|
+
if (!lines.length)
|
|
3063
|
+
continue;
|
|
3064
|
+
added.push(r.path, ...lines.map((l) => l.line));
|
|
3065
|
+
rules++;
|
|
3066
|
+
}
|
|
3067
|
+
if (cloudflare && rules > CLOUDFLARE_LIMITS.headerRules)
|
|
3068
|
+
notes.push(`_headers has ${rules} rules; Cloudflare reads at most ${CLOUDFLARE_LIMITS.headerRules}`);
|
|
3069
|
+
return { text: joinBlocks(theirs, added.join("\n")), notes };
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
// node_modules/@dogsbay/site-files/dist/inline-markdown.js
|
|
3073
|
+
var INLINE_MARKDOWN_MAX = 2e3;
|
|
3074
|
+
var MAILTO = /^mailto:[A-Za-z0-9._+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+$/;
|
|
3075
|
+
function isTextLinkHref(href) {
|
|
3076
|
+
return isSiteLinkHref(href) || MAILTO.test(href);
|
|
3077
|
+
}
|
|
3078
|
+
var MAX_DEPTH = 8;
|
|
3079
|
+
var PUNCT = /[!-/:-@[-`{-~]/;
|
|
3080
|
+
var ENTITY = /^&(?:#\d{1,7}|#[xX][0-9a-fA-F]{1,6}|[A-Za-z][A-Za-z0-9]{1,31});/;
|
|
3081
|
+
var escText = (c) => c === "&" ? "&" : c === "<" ? "<" : c === ">" ? ">" : c === '"' ? """ : c === "'" ? "'" : c;
|
|
3082
|
+
var escAll = (s) => s.replace(/[&<>"']/g, escText);
|
|
3083
|
+
function inlineMarkdownHtml(text2, options = {}) {
|
|
3084
|
+
if (text2.length > INLINE_MARKDOWN_MAX)
|
|
3085
|
+
throw new ProductConfigError(`inline Markdown longer than ${INLINE_MARKDOWN_MAX} characters`);
|
|
3086
|
+
const line = text2.replace(/\s+/g, " ").trim();
|
|
3087
|
+
return render(line, options, 0, false);
|
|
3088
|
+
}
|
|
3089
|
+
function render(s, o, depth, inLink) {
|
|
3090
|
+
let out = "";
|
|
3091
|
+
let i = 0;
|
|
3092
|
+
const n = s.length;
|
|
3093
|
+
while (i < n) {
|
|
3094
|
+
const c = s[i];
|
|
3095
|
+
if (c === "\\" && i + 1 < n && PUNCT.test(s[i + 1])) {
|
|
3096
|
+
out += escText(s[i + 1]);
|
|
3097
|
+
i += 2;
|
|
3098
|
+
continue;
|
|
3099
|
+
}
|
|
3100
|
+
if (c === "`") {
|
|
3101
|
+
let run = 1;
|
|
3102
|
+
while (s[i + run] === "`")
|
|
3103
|
+
run++;
|
|
3104
|
+
const close = findRun(s, i + run, run);
|
|
3105
|
+
if (close < 0) {
|
|
3106
|
+
out += "`".repeat(run);
|
|
3107
|
+
i += run;
|
|
3108
|
+
continue;
|
|
3109
|
+
}
|
|
3110
|
+
let code = s.slice(i + run, close);
|
|
3111
|
+
if (code.length > 2 && code.startsWith(" ") && code.endsWith(" ") && code.trim())
|
|
3112
|
+
code = code.slice(1, -1);
|
|
3113
|
+
out += `<code>${escAll(code)}</code>`;
|
|
3114
|
+
i = close + run;
|
|
3115
|
+
continue;
|
|
3116
|
+
}
|
|
3117
|
+
if (c === "[" && !inLink) {
|
|
3118
|
+
const link2 = readLink(s, i);
|
|
3119
|
+
if (link2) {
|
|
3120
|
+
if (!isTextLinkHref(link2.href))
|
|
3121
|
+
throw new ProductConfigError(`a link to ${JSON.stringify(link2.href)}: a path from the site root (/guide/), an http(s) address or a mailto: address`);
|
|
3122
|
+
const href = o.href && !link2.href.toLowerCase().startsWith("mailto:") ? o.href(link2.href) : link2.href;
|
|
3123
|
+
out += `<a href="${escAll(href)}">${render(link2.label, o, depth, true)}</a>`;
|
|
3124
|
+
i = link2.end;
|
|
3125
|
+
continue;
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
if ((c === "*" || c === "_") && depth < MAX_DEPTH) {
|
|
3129
|
+
const span = readEmphasis(s, i);
|
|
3130
|
+
if (span) {
|
|
3131
|
+
const tag = span.strong ? "strong" : "em";
|
|
3132
|
+
out += `<${tag}>${render(span.inner, o, depth + 1, inLink)}</${tag}>`;
|
|
3133
|
+
i = span.end;
|
|
3134
|
+
continue;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
if (c === "&") {
|
|
3138
|
+
const m = ENTITY.exec(s.slice(i, i + 40));
|
|
3139
|
+
if (m) {
|
|
3140
|
+
out += m[0];
|
|
3141
|
+
i += m[0].length;
|
|
3142
|
+
continue;
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
out += escText(c);
|
|
3146
|
+
i++;
|
|
3147
|
+
}
|
|
3148
|
+
return out;
|
|
3149
|
+
}
|
|
3150
|
+
function findRun(s, from, len) {
|
|
3151
|
+
for (let j = s.indexOf("`", from); j >= 0; j = s.indexOf("`", j)) {
|
|
3152
|
+
let run = 1;
|
|
3153
|
+
while (s[j + run] === "`")
|
|
3154
|
+
run++;
|
|
3155
|
+
if (run === len)
|
|
3156
|
+
return j;
|
|
3157
|
+
j += run;
|
|
3158
|
+
}
|
|
3159
|
+
return -1;
|
|
3160
|
+
}
|
|
3161
|
+
function readLink(s, at) {
|
|
3162
|
+
let depth = 0;
|
|
3163
|
+
let j = at;
|
|
3164
|
+
for (; j < s.length; j++) {
|
|
3165
|
+
const c = s[j];
|
|
3166
|
+
if (c === "\\") {
|
|
3167
|
+
j++;
|
|
3168
|
+
continue;
|
|
3169
|
+
}
|
|
3170
|
+
if (c === "[")
|
|
3171
|
+
depth++;
|
|
3172
|
+
else if (c === "]" && --depth === 0)
|
|
3173
|
+
break;
|
|
3174
|
+
}
|
|
3175
|
+
if (j >= s.length || s[j + 1] !== "(")
|
|
3176
|
+
return null;
|
|
3177
|
+
const close = s.indexOf(")", j + 2);
|
|
3178
|
+
if (close < 0)
|
|
3179
|
+
return null;
|
|
3180
|
+
const href = s.slice(j + 2, close).trim();
|
|
3181
|
+
if (!href || /\s/.test(href))
|
|
3182
|
+
return null;
|
|
3183
|
+
return { label: s.slice(at + 1, j), href, end: close + 1 };
|
|
3184
|
+
}
|
|
3185
|
+
function readEmphasis(s, at) {
|
|
3186
|
+
const ch = s[at];
|
|
3187
|
+
if (ch === "_" && at > 0 && /[\p{L}\p{N}]/u.test(s[at - 1]))
|
|
3188
|
+
return null;
|
|
3189
|
+
for (const len of s[at + 1] === ch ? [2, 1] : [1]) {
|
|
3190
|
+
const delim = ch.repeat(len);
|
|
3191
|
+
const start = at + len;
|
|
3192
|
+
if (start >= s.length || s[start] === " ")
|
|
3193
|
+
continue;
|
|
3194
|
+
for (let j = s.indexOf(delim, start + 1); j >= 0; j = s.indexOf(delim, j + 1)) {
|
|
3195
|
+
if (s[j - 1] === " " || s[j - 1] === "\\")
|
|
3196
|
+
continue;
|
|
3197
|
+
if (len === 1 && (s[j + 1] === ch || s[j - 1] === ch))
|
|
3198
|
+
continue;
|
|
3199
|
+
if (ch === "_" && j + len < s.length && /[\p{L}\p{N}]/u.test(s[j + len]))
|
|
3200
|
+
continue;
|
|
3201
|
+
return { strong: len === 2, inner: s.slice(start, j), end: j + len };
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
return null;
|
|
3205
|
+
}
|
|
3206
|
+
|
|
3207
|
+
// node_modules/@dogsbay/site-files/dist/site-chrome.js
|
|
3208
|
+
var SOCIAL_ICON_NAMES = [
|
|
3209
|
+
"bitbucket",
|
|
3210
|
+
"bluesky",
|
|
3211
|
+
"discord",
|
|
3212
|
+
"facebook",
|
|
3213
|
+
"git",
|
|
3214
|
+
"github",
|
|
3215
|
+
"gitlab",
|
|
3216
|
+
"huggingface",
|
|
3217
|
+
"instagram",
|
|
3218
|
+
"linkedin",
|
|
3219
|
+
"mastodon",
|
|
3220
|
+
"medium",
|
|
3221
|
+
"npm",
|
|
3222
|
+
"reddit",
|
|
3223
|
+
"rss",
|
|
3224
|
+
"slack",
|
|
3225
|
+
"stackoverflow",
|
|
3226
|
+
"telegram",
|
|
3227
|
+
"threads",
|
|
3228
|
+
"twitch",
|
|
3229
|
+
"x",
|
|
3230
|
+
"youtube"
|
|
3231
|
+
];
|
|
3232
|
+
var ANNOUNCEMENT_TONES = ["note", "tip", "warning", "caution"];
|
|
3233
|
+
function isChromeMenu(link2) {
|
|
3234
|
+
return "items" in link2;
|
|
3235
|
+
}
|
|
3236
|
+
var LOGO_TYPES = /\.(svg|png|webp|jpe?g)$/i;
|
|
3237
|
+
var ANNOUNCEMENT_ID = /^[A-Za-z0-9._-]{1,64}$/;
|
|
3238
|
+
var HTML_TAG = /<\/?[A-Za-z][^>]*>/;
|
|
3239
|
+
var MAX_LINKS = 100;
|
|
3240
|
+
var fail3 = (msg) => {
|
|
3241
|
+
throw new ProductConfigError(msg);
|
|
3242
|
+
};
|
|
3243
|
+
var isMap = (v) => !!v && typeof v === "object" && !Array.isArray(v);
|
|
3244
|
+
function text(raw, at, required = true) {
|
|
3245
|
+
if (raw === void 0 || raw === null)
|
|
3246
|
+
return required ? fail3(`${at}: required`) : void 0;
|
|
3247
|
+
if (typeof raw !== "string" || !raw.trim())
|
|
3248
|
+
return fail3(`${at}: expected text`);
|
|
3249
|
+
return raw.trim();
|
|
3250
|
+
}
|
|
3251
|
+
function list(raw, at) {
|
|
3252
|
+
if (raw === void 0 || raw === null)
|
|
3253
|
+
return [];
|
|
3254
|
+
if (!Array.isArray(raw))
|
|
3255
|
+
return fail3(`${at}: expected a list`);
|
|
3256
|
+
if (raw.length > MAX_LINKS)
|
|
3257
|
+
fail3(`${at}: more than ${MAX_LINKS} entries`);
|
|
3258
|
+
return raw;
|
|
3259
|
+
}
|
|
3260
|
+
function link(raw, at) {
|
|
3261
|
+
if (!isMap(raw))
|
|
3262
|
+
return fail3(`${at}: expected a mapping { label, href }`);
|
|
3263
|
+
const label = text(raw.label, `${at}.label`);
|
|
3264
|
+
if (!isSiteLinkHref(raw.href))
|
|
3265
|
+
fail3(`${at}.href: a path from the site root (/guide/) or an http(s) address; got ${JSON.stringify(raw.href ?? null)}`);
|
|
3266
|
+
return { label, href: raw.href };
|
|
3267
|
+
}
|
|
3268
|
+
function social(raw, at) {
|
|
3269
|
+
return list(raw, at).map((e, i) => {
|
|
3270
|
+
const where = `${at}[${i}]`;
|
|
3271
|
+
if (!isMap(e))
|
|
3272
|
+
return fail3(`${where}: expected a mapping { icon, href, label }`);
|
|
3273
|
+
if (!SOCIAL_ICON_NAMES.includes(e.icon))
|
|
3274
|
+
fail3(`${where}.icon: one of ${SOCIAL_ICON_NAMES.join(", ")}; got ${JSON.stringify(e.icon ?? null)}`);
|
|
3275
|
+
const { href } = link({ label: e.label ?? e.icon, href: e.href }, where);
|
|
3276
|
+
return { icon: e.icon, href, label: text(e.label, `${where}.label`, false) ?? String(e.icon) };
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3279
|
+
function markdown(raw, at, warnings) {
|
|
3280
|
+
const t = text(typeof raw === "number" && Number.isFinite(raw) ? String(raw) : raw, at, false);
|
|
3281
|
+
if (t === void 0)
|
|
3282
|
+
return void 0;
|
|
3283
|
+
try {
|
|
3284
|
+
inlineMarkdownHtml(t);
|
|
3285
|
+
} catch (e) {
|
|
3286
|
+
fail3(`${at}: ${e.message}`);
|
|
3287
|
+
}
|
|
3288
|
+
if (HTML_TAG.test(t))
|
|
3289
|
+
warnings.push(`${at}: HTML is shown as text; write inline Markdown ([label](https://\u2026), **bold**)`);
|
|
3290
|
+
return t;
|
|
3291
|
+
}
|
|
3292
|
+
function logoPath(raw, at) {
|
|
3293
|
+
const p = text(raw, at).replace(/^\.\//, "");
|
|
3294
|
+
if (p.startsWith("/") || /^[A-Za-z][A-Za-z0-9+.-]*:/.test(p) || p.includes("\\") || p.split("/").some((s) => s === ".." || s === "." || s === ""))
|
|
3295
|
+
fail3(`${at}: a path inside the project, relative to the config (assets/logo.svg); got ${JSON.stringify(raw)}`);
|
|
3296
|
+
if (!LOGO_TYPES.test(p))
|
|
3297
|
+
fail3(`${at}: an SVG, PNG, WebP or JPEG image; got ${JSON.stringify(raw)}`);
|
|
3298
|
+
return p;
|
|
3299
|
+
}
|
|
3300
|
+
function repoSocialLink(repoUrl) {
|
|
3301
|
+
if (!/^https?:\/\/\S+$/.test(repoUrl))
|
|
3302
|
+
return void 0;
|
|
3303
|
+
let host;
|
|
3304
|
+
try {
|
|
3305
|
+
host = new URL(repoUrl).hostname.toLowerCase();
|
|
3306
|
+
} catch {
|
|
3307
|
+
return void 0;
|
|
3308
|
+
}
|
|
3309
|
+
const icon = /(^|\.)github\.com$/.test(host) ? "github" : /(^|\.)gitlab\.com$/.test(host) ? "gitlab" : /(^|\.)bitbucket\.org$/.test(host) ? "bitbucket" : "git";
|
|
3310
|
+
return { icon, href: repoUrl, label: "Source repository" };
|
|
3311
|
+
}
|
|
3312
|
+
function siteChrome(config) {
|
|
3313
|
+
const warnings = [];
|
|
3314
|
+
const site = config.site === void 0 || config.site === null ? {} : isMap(config.site) ? config.site : fail3("site: expected a mapping");
|
|
3315
|
+
const header2 = config.header === void 0 || config.header === null ? {} : isMap(config.header) ? config.header : fail3("header: expected a mapping (links, social)");
|
|
3316
|
+
const footer = config.footer === void 0 || config.footer === null ? {} : isMap(config.footer) ? config.footer : fail3("footer: expected a mapping (columns, social)");
|
|
3317
|
+
let logo;
|
|
3318
|
+
if (site.logo !== void 0 && site.logo !== null) {
|
|
3319
|
+
const l = isMap(site.logo) ? site.logo : fail3("site.logo: expected a mapping { light, dark, alt, replacesName }");
|
|
3320
|
+
if (l.replacesName !== void 0 && typeof l.replacesName !== "boolean")
|
|
3321
|
+
fail3("site.logo.replacesName: true or false");
|
|
3322
|
+
logo = {
|
|
3323
|
+
light: logoPath(l.light, "site.logo.light"),
|
|
3324
|
+
...l.dark !== void 0 && l.dark !== null ? { dark: logoPath(l.dark, "site.logo.dark") } : {},
|
|
3325
|
+
alt: text(l.alt, "site.logo.alt", false) ?? (typeof site.name === "string" ? site.name : ""),
|
|
3326
|
+
replacesName: l.replacesName === true
|
|
3327
|
+
};
|
|
3328
|
+
}
|
|
3329
|
+
const colorMode = site.colorMode ?? "system";
|
|
3330
|
+
if (colorMode !== "light" && colorMode !== "dark" && colorMode !== "system")
|
|
3331
|
+
fail3(`site.colorMode: light, dark or system; got ${JSON.stringify(site.colorMode)}`);
|
|
3332
|
+
let announcement;
|
|
3333
|
+
if (site.announcement !== void 0 && site.announcement !== null) {
|
|
3334
|
+
const a = isMap(site.announcement) ? site.announcement : fail3("site.announcement: expected a mapping { id, text, tone, closeable }");
|
|
3335
|
+
const id = text(a.id, "site.announcement.id");
|
|
3336
|
+
if (!ANNOUNCEMENT_ID.test(id))
|
|
3337
|
+
fail3(`site.announcement.id: letters, digits, ".", "_" and "-" (up to 64); got ${JSON.stringify(id)}`);
|
|
3338
|
+
const tone = a.tone ?? "note";
|
|
3339
|
+
if (!ANNOUNCEMENT_TONES.includes(tone))
|
|
3340
|
+
fail3(`site.announcement.tone: one of ${ANNOUNCEMENT_TONES.join(", ")}; got ${JSON.stringify(a.tone)}`);
|
|
3341
|
+
if (a.closeable !== void 0 && typeof a.closeable !== "boolean")
|
|
3342
|
+
fail3("site.announcement.closeable: true or false");
|
|
3343
|
+
const t = markdown(a.text, "site.announcement.text", warnings);
|
|
3344
|
+
if (t === void 0)
|
|
3345
|
+
fail3("site.announcement.text: required");
|
|
3346
|
+
announcement = { id, text: t, tone, closeable: a.closeable !== false };
|
|
3347
|
+
}
|
|
3348
|
+
const copyright = markdown(site.copyright, "site.copyright", warnings);
|
|
3349
|
+
const links = list(header2.links, "header.links").map((e, i) => {
|
|
3350
|
+
const at = `header.links[${i}]`;
|
|
3351
|
+
if (isMap(e) && e.items !== void 0) {
|
|
3352
|
+
if (e.href !== void 0)
|
|
3353
|
+
fail3(`${at}: a dropdown has items, not an href`);
|
|
3354
|
+
const items = list(e.items, `${at}.items`).map((item, j) => {
|
|
3355
|
+
if (isMap(item) && item.items !== void 0)
|
|
3356
|
+
fail3(`${at}.items[${j}]: dropdowns are one level deep`);
|
|
3357
|
+
return link(item, `${at}.items[${j}]`);
|
|
3358
|
+
});
|
|
3359
|
+
if (!items.length)
|
|
3360
|
+
fail3(`${at}.items: at least one link`);
|
|
3361
|
+
return { label: text(e.label, `${at}.label`), items };
|
|
3362
|
+
}
|
|
3363
|
+
return link(e, at);
|
|
3364
|
+
});
|
|
3365
|
+
let headerSocial;
|
|
3366
|
+
if (header2.social !== void 0)
|
|
3367
|
+
headerSocial = social(header2.social, "header.social");
|
|
3368
|
+
else {
|
|
3369
|
+
const repo = typeof site.repoUrl === "string" ? repoSocialLink(site.repoUrl) : void 0;
|
|
3370
|
+
if (typeof site.repoUrl === "string" && site.repoUrl.trim() && !repo) {
|
|
3371
|
+
warnings.push(`site.repoUrl: ${JSON.stringify(site.repoUrl)} is not an http(s) address, so the header has no repository icon (set header.social)`);
|
|
3372
|
+
}
|
|
3373
|
+
headerSocial = repo ? [repo] : [];
|
|
3374
|
+
}
|
|
3375
|
+
const columns = list(footer.columns, "footer.columns").map((e, i) => {
|
|
3376
|
+
const at = `footer.columns[${i}]`;
|
|
3377
|
+
if (!isMap(e))
|
|
3378
|
+
return fail3(`${at}: expected a mapping { title, links }`);
|
|
3379
|
+
return { title: text(e.title, `${at}.title`), links: list(e.links, `${at}.links`).map((l, j) => link(l, `${at}.links[${j}]`)) };
|
|
3380
|
+
});
|
|
3381
|
+
return {
|
|
3382
|
+
...logo ? { logo } : {},
|
|
3383
|
+
colorMode,
|
|
3384
|
+
...announcement ? { announcement } : {},
|
|
3385
|
+
...copyright !== void 0 ? { copyright } : {},
|
|
3386
|
+
header: { links, social: headerSocial },
|
|
3387
|
+
footer: { columns, social: social(footer.social, "footer.social") },
|
|
3388
|
+
warnings
|
|
3389
|
+
};
|
|
3390
|
+
}
|
|
3391
|
+
|
|
3392
|
+
// node_modules/@dogsbay/site-files/dist/facets.js
|
|
3393
|
+
var BUILT_IN = /* @__PURE__ */ new Set(["tags", "category", "audience", "type", "status"]);
|
|
3394
|
+
function segments(value) {
|
|
3395
|
+
if (/[\\\0]/.test(value))
|
|
3396
|
+
return void 0;
|
|
3397
|
+
const segs = value.split("/");
|
|
3398
|
+
return segs.every((s) => s !== "" && s !== "." && s !== "..") ? segs : void 0;
|
|
3399
|
+
}
|
|
3400
|
+
function pageFacets(meta, options = {}) {
|
|
3401
|
+
const out = /* @__PURE__ */ Object.create(null);
|
|
3402
|
+
const nested = new Set(options.hierarchical ?? []);
|
|
3403
|
+
const add = (name, value, hierarchical) => {
|
|
3404
|
+
if (typeof value !== "string" || !value)
|
|
3405
|
+
return;
|
|
3406
|
+
const segs = segments(value);
|
|
3407
|
+
if (!segs)
|
|
3408
|
+
return;
|
|
3409
|
+
const values = out[name] ??= [];
|
|
3410
|
+
const levels = hierarchical ? segs.map((_, i) => segs.slice(0, i + 1).join("/")) : [segs.join("/")];
|
|
3411
|
+
for (const v of levels)
|
|
3412
|
+
if (!values.includes(v))
|
|
3413
|
+
values.push(v);
|
|
3414
|
+
};
|
|
3415
|
+
const list2 = (v) => Array.isArray(v) ? v : [];
|
|
3416
|
+
const tagsNested = nested.has("tags");
|
|
3417
|
+
for (const tag of list2(meta?.tags)) {
|
|
3418
|
+
if (typeof tag !== "string")
|
|
3419
|
+
continue;
|
|
3420
|
+
const slash = tag.indexOf("/");
|
|
3421
|
+
const prefix = slash > 0 ? tag.slice(0, slash) : "";
|
|
3422
|
+
if (prefix && options.tagPrefixes && Object.prototype.hasOwnProperty.call(options.tagPrefixes, prefix) && options.tagPrefixes[prefix]) {
|
|
3423
|
+
add(prefix, tag.slice(slash + 1), tagsNested);
|
|
3424
|
+
} else {
|
|
3425
|
+
add("tag", tag, tagsNested);
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
for (const v of list2(meta?.audience))
|
|
3429
|
+
add("audience", v, nested.has("audience"));
|
|
3430
|
+
for (const v of list2(meta?.category))
|
|
3431
|
+
add("category", v, nested.has("category"));
|
|
3432
|
+
add("status", meta?.status, nested.has("status"));
|
|
3433
|
+
for (const v of list2(meta?.taxonomies?.status))
|
|
3434
|
+
add("status", v, nested.has("status"));
|
|
3435
|
+
add("type", meta?.type, nested.has("type"));
|
|
3436
|
+
for (const v of list2(meta?.taxonomies?.type))
|
|
3437
|
+
add("type", v, nested.has("type"));
|
|
3438
|
+
add("product", options.unit?.product, false);
|
|
3439
|
+
add("version", options.unit?.version, false);
|
|
3440
|
+
for (const [name, values] of Object.entries(meta?.taxonomies ?? {})) {
|
|
3441
|
+
if (BUILT_IN.has(name))
|
|
3442
|
+
continue;
|
|
3443
|
+
for (const v of list2(values))
|
|
3444
|
+
add(name, v, nested.has(name));
|
|
3445
|
+
}
|
|
3446
|
+
return { ...out };
|
|
3447
|
+
}
|
|
3448
|
+
|
|
3449
|
+
// node_modules/@dogsbay/site-files/dist/blog-order.js
|
|
3450
|
+
function postsNewestFirst(nav, rank) {
|
|
3451
|
+
const walk = (items) => {
|
|
3452
|
+
const posts = items.filter((n) => rank(n) !== void 0).sort((a, b) => rank(a) - rank(b));
|
|
3453
|
+
let i = 0;
|
|
3454
|
+
return items.map((n) => {
|
|
3455
|
+
const placed = rank(n) !== void 0 ? posts[i++] : n;
|
|
3456
|
+
return placed.children?.length ? { ...placed, children: walk(placed.children) } : placed;
|
|
3457
|
+
});
|
|
3458
|
+
};
|
|
3459
|
+
return walk(nav);
|
|
3460
|
+
}
|
|
3461
|
+
function authorOrdered(frontmatters) {
|
|
3462
|
+
for (const fm of frontmatters) {
|
|
3463
|
+
if (!fm)
|
|
3464
|
+
continue;
|
|
3465
|
+
const sidebar = fm.sidebar;
|
|
3466
|
+
if (fm.order != null || fm.weight != null)
|
|
3467
|
+
return true;
|
|
3468
|
+
if (sidebar && typeof sidebar === "object" && sidebar.order != null)
|
|
3469
|
+
return true;
|
|
3470
|
+
}
|
|
3471
|
+
return false;
|
|
3472
|
+
}
|
|
3473
|
+
function postsInDateOrder(o) {
|
|
3474
|
+
return o.blog && !o.navFromFile && !authorOrdered(o.frontmatters);
|
|
3475
|
+
}
|
|
3476
|
+
|
|
3477
|
+
// node_modules/@dogsbay/site-files/dist/nav-sections.js
|
|
3478
|
+
function normalizeNavHref(href) {
|
|
3479
|
+
const bare = href.replace(/[?#].*$/, "");
|
|
3480
|
+
return bare.replace(/\/+$/, "") || (bare.startsWith("/") ? "/" : "");
|
|
3481
|
+
}
|
|
3482
|
+
function holds(item, current, norm) {
|
|
3483
|
+
if (item.href !== void 0 && norm(item.href) === current)
|
|
3484
|
+
return true;
|
|
3485
|
+
return item.children?.some((c) => holds(c, current, norm)) ?? false;
|
|
3486
|
+
}
|
|
3487
|
+
function firstHref(item) {
|
|
3488
|
+
if (item.href)
|
|
3489
|
+
return item.href;
|
|
3490
|
+
for (const c of item.children ?? []) {
|
|
3491
|
+
const h = firstHref(c);
|
|
3492
|
+
if (h)
|
|
3493
|
+
return h;
|
|
3494
|
+
}
|
|
3495
|
+
return void 0;
|
|
3496
|
+
}
|
|
3497
|
+
function sectionLevel(nav) {
|
|
3498
|
+
let level = nav;
|
|
3499
|
+
while (level.length === 1 && level[0].children?.length)
|
|
3500
|
+
level = level[0].children;
|
|
3501
|
+
return level;
|
|
3502
|
+
}
|
|
3503
|
+
function homesOf(level, opts) {
|
|
3504
|
+
const norm = opts.normalize ?? normalizeNavHref;
|
|
3505
|
+
const homes = /* @__PURE__ */ new Set();
|
|
3506
|
+
if (opts.home !== void 0)
|
|
3507
|
+
homes.add(norm(opts.home));
|
|
3508
|
+
for (const item of level) {
|
|
3509
|
+
if (item.children?.length || item.href === void 0)
|
|
3510
|
+
continue;
|
|
3511
|
+
const h = norm(item.href);
|
|
3512
|
+
if (!h.startsWith("/") || h === "/")
|
|
3513
|
+
continue;
|
|
3514
|
+
const under = (o) => (o.href === void 0 || norm(o.href).startsWith(`${h}/`)) && (o.children ?? []).every(under);
|
|
3515
|
+
const others = level.filter((o) => o !== item);
|
|
3516
|
+
if (others.some((o) => firstHref(o) !== void 0) && others.every(under))
|
|
3517
|
+
homes.add(h);
|
|
3518
|
+
}
|
|
3519
|
+
return homes;
|
|
3520
|
+
}
|
|
3521
|
+
function isSection(item, homes, norm) {
|
|
3522
|
+
return Boolean(item.children?.length) || item.href === void 0 || !homes.has(norm(item.href));
|
|
3523
|
+
}
|
|
3524
|
+
function locate(nav, current, opts) {
|
|
3525
|
+
const norm = opts.normalize ?? normalizeNavHref;
|
|
3526
|
+
const level = sectionLevel(nav);
|
|
3527
|
+
const homes = homesOf(level, opts);
|
|
3528
|
+
const cur = norm(current);
|
|
3529
|
+
const index = homes.has(cur) ? -1 : level.findIndex((item) => isSection(item, homes, norm) && holds(item, cur, norm));
|
|
3530
|
+
return { level, index, homes, norm };
|
|
3531
|
+
}
|
|
3532
|
+
function sectionItems(section, opts = {}) {
|
|
3533
|
+
const norm = opts.normalize ?? normalizeNavHref;
|
|
3534
|
+
const children = section.children ?? [];
|
|
3535
|
+
if (!children.length)
|
|
3536
|
+
return [section];
|
|
3537
|
+
if (section.href === void 0)
|
|
3538
|
+
return children;
|
|
3539
|
+
const own = norm(section.href);
|
|
3540
|
+
if (children.some((c) => holds(c, own, norm)))
|
|
3541
|
+
return children;
|
|
3542
|
+
return [{ label: section.label, href: section.href }, ...children];
|
|
3543
|
+
}
|
|
3544
|
+
function entriesOf(l) {
|
|
3545
|
+
const out = [];
|
|
3546
|
+
l.level.forEach((item, index) => {
|
|
3547
|
+
if (!isSection(item, l.homes, l.norm))
|
|
3548
|
+
return;
|
|
3549
|
+
const href = firstHref(item);
|
|
3550
|
+
if (href)
|
|
3551
|
+
out.push({ label: item.label, href, index });
|
|
3552
|
+
});
|
|
3553
|
+
return out;
|
|
3554
|
+
}
|
|
3555
|
+
function scopeNav(nav, current, scope, opts = {}) {
|
|
3556
|
+
if (scope !== "section")
|
|
3557
|
+
return { items: [...nav], section: -1 };
|
|
3558
|
+
const l = locate(nav, current, opts);
|
|
3559
|
+
if (l.index >= 0)
|
|
3560
|
+
return { items: sectionItems(l.level[l.index], opts), section: l.index };
|
|
3561
|
+
return { items: entriesOf(l).map((e) => ({ label: e.label, href: e.href })), section: -1 };
|
|
3562
|
+
}
|
|
3563
|
+
function sectionMenu(nav, current, opts = {}) {
|
|
3564
|
+
const l = locate(nav, current, opts);
|
|
3565
|
+
const entries = entriesOf(l);
|
|
3566
|
+
const own = entries.find((e) => e.index === l.index);
|
|
3567
|
+
return own ? { entries, current: own } : { entries };
|
|
3568
|
+
}
|
|
3569
|
+
|
|
3570
|
+
// node_modules/@dogsbay/site-files/dist/unlisted.js
|
|
3571
|
+
function navHrefSlug(href) {
|
|
3572
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//"))
|
|
3573
|
+
return void 0;
|
|
3574
|
+
const bare = href.replace(/[?#].*$/, "").replace(/^\/+|\/+$/g, "");
|
|
3575
|
+
return bare || "index";
|
|
3576
|
+
}
|
|
3577
|
+
function markUnlisted(nav, pages, opts = {}) {
|
|
3578
|
+
const slugOf = opts.slugOf ?? navHrefSlug;
|
|
3579
|
+
const slugs = /* @__PURE__ */ new Set();
|
|
3580
|
+
const byFrontMatter = [];
|
|
3581
|
+
for (const p of pages) {
|
|
3582
|
+
if (p.unlisted !== true)
|
|
3583
|
+
continue;
|
|
3584
|
+
slugs.add(p.slug);
|
|
3585
|
+
byFrontMatter.push(p);
|
|
3586
|
+
}
|
|
3587
|
+
const linked = /* @__PURE__ */ new Set();
|
|
3588
|
+
const unlistedBy = /* @__PURE__ */ new Set();
|
|
3589
|
+
const listedBy = /* @__PURE__ */ new Set();
|
|
3590
|
+
const walk = (items, inherited) => items.map((item) => {
|
|
3591
|
+
const unlisted = inherited || item.unlisted === true;
|
|
3592
|
+
if (item.href !== void 0) {
|
|
3593
|
+
const slug = slugOf(item.href);
|
|
3594
|
+
if (slug !== void 0) {
|
|
3595
|
+
linked.add(slug);
|
|
3596
|
+
if (!item.href.includes("#"))
|
|
3597
|
+
(unlisted ? unlistedBy : listedBy).add(slug);
|
|
3598
|
+
}
|
|
3599
|
+
}
|
|
3600
|
+
const children = item.children ? walk(item.children, unlisted) : void 0;
|
|
3601
|
+
const out = { ...item, ...children ? { children } : {} };
|
|
3602
|
+
if (unlisted)
|
|
3603
|
+
out.unlisted = true;
|
|
3604
|
+
return out;
|
|
3605
|
+
});
|
|
3606
|
+
const marked = walk(nav, false);
|
|
3607
|
+
for (const slug of unlistedBy)
|
|
3608
|
+
if (!listedBy.has(slug))
|
|
3609
|
+
slugs.add(slug);
|
|
3610
|
+
const warnings = [];
|
|
3611
|
+
for (const p of byFrontMatter) {
|
|
3612
|
+
const keep = [p.noindex === false ? "noindex: false" : "", p.excludeFromSearch === false ? "excludeFromSearch: false" : ""].filter(Boolean);
|
|
3613
|
+
if (keep.length)
|
|
3614
|
+
warnings.push({ slug: p.slug, message: `${p.slug}: unlisted: true with ${keep.join(" and ")} \u2014 an unlisted page is noindex and out of search; it stays unlisted` });
|
|
3615
|
+
}
|
|
3616
|
+
return { nav: marked, slugs, outsideNav: byFrontMatter.map((p) => p.slug).filter((s) => !linked.has(s)), warnings };
|
|
3617
|
+
}
|
|
3618
|
+
function listedNav(nav, slugs = /* @__PURE__ */ new Set(), opts = {}) {
|
|
3619
|
+
const slugOf = opts.slugOf ?? navHrefSlug;
|
|
3620
|
+
const out = [];
|
|
3621
|
+
for (const item of nav) {
|
|
3622
|
+
if (item.unlisted === true)
|
|
3623
|
+
continue;
|
|
3624
|
+
const children = item.children ? listedNav(item.children, slugs, opts) : void 0;
|
|
3625
|
+
const slug = item.href === void 0 ? void 0 : slugOf(item.href);
|
|
3626
|
+
const hidden = slug !== void 0 && slugs.has(slug);
|
|
3627
|
+
const hadChildren = (item.children?.length ?? 0) > 0;
|
|
3628
|
+
if (hidden && !children?.length)
|
|
3629
|
+
continue;
|
|
3630
|
+
if (!hidden && item.href === void 0 && hadChildren && !children?.length)
|
|
3631
|
+
continue;
|
|
3632
|
+
const { href: _href, children: _children, ...rest } = item;
|
|
3633
|
+
out.push({
|
|
3634
|
+
...rest,
|
|
3635
|
+
...hidden || item.href === void 0 ? {} : { href: item.href },
|
|
3636
|
+
...children && (children.length || !hadChildren) ? { children } : {}
|
|
3637
|
+
});
|
|
3638
|
+
}
|
|
3639
|
+
return out;
|
|
3640
|
+
}
|
|
3641
|
+
function listedLocations(nav, slugs, opts = {}) {
|
|
3642
|
+
const slugOf = opts.slugOf ?? navHrefSlug;
|
|
3643
|
+
const home = opts.home === void 0 ? void 0 : slugOf(opts.home);
|
|
3644
|
+
const first = /* @__PURE__ */ new Map();
|
|
3645
|
+
const firstListed = (item) => {
|
|
3646
|
+
if (first.has(item))
|
|
3647
|
+
return first.get(item);
|
|
3648
|
+
let found;
|
|
3649
|
+
if (item.unlisted !== true) {
|
|
3650
|
+
if (item.href !== void 0) {
|
|
3651
|
+
const s = slugOf(item.href);
|
|
3652
|
+
if ((s === void 0 || !slugs.has(s)) && (home === void 0 || s !== home))
|
|
3653
|
+
found = item.href;
|
|
3654
|
+
}
|
|
3655
|
+
for (const c of item.children ?? []) {
|
|
3656
|
+
if (found !== void 0)
|
|
3657
|
+
break;
|
|
3658
|
+
found = firstListed(c);
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
first.set(item, found);
|
|
3662
|
+
return found;
|
|
3663
|
+
};
|
|
3664
|
+
const out = /* @__PURE__ */ new Map();
|
|
3665
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3666
|
+
const walk = (items, nearest) => {
|
|
3667
|
+
for (const item of items) {
|
|
3668
|
+
const own = item.unlisted === true ? void 0 : firstListed(item);
|
|
3669
|
+
if (item.href !== void 0) {
|
|
3670
|
+
const s = slugOf(item.href);
|
|
3671
|
+
if (s !== void 0 && slugs.has(s) && !seen.has(s)) {
|
|
3672
|
+
seen.add(s);
|
|
3673
|
+
const at = own ?? nearest;
|
|
3674
|
+
if (at !== void 0)
|
|
3675
|
+
out.set(s, at);
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
if (item.children)
|
|
3679
|
+
walk(item.children, own ?? nearest);
|
|
3680
|
+
}
|
|
3681
|
+
};
|
|
3682
|
+
walk(nav, void 0);
|
|
3683
|
+
return out;
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
// node_modules/@dogsbay/site-files/dist/link-summary.js
|
|
3687
|
+
var ENTITIES = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
3688
|
+
amp: "&",
|
|
3689
|
+
lt: "<",
|
|
3690
|
+
gt: ">",
|
|
3691
|
+
quot: '"',
|
|
3692
|
+
apos: "'",
|
|
3693
|
+
nbsp: "\xA0",
|
|
3694
|
+
hellip: "\u2026",
|
|
3695
|
+
mdash: "\u2014",
|
|
3696
|
+
ndash: "\u2013",
|
|
3697
|
+
lsquo: "\u2018",
|
|
3698
|
+
rsquo: "\u2019",
|
|
3699
|
+
ldquo: "\u201C",
|
|
3700
|
+
rdquo: "\u201D",
|
|
3701
|
+
laquo: "\xAB",
|
|
3702
|
+
raquo: "\xBB",
|
|
3703
|
+
copy: "\xA9",
|
|
3704
|
+
reg: "\xAE",
|
|
3705
|
+
trade: "\u2122",
|
|
3706
|
+
middot: "\xB7",
|
|
3707
|
+
times: "\xD7",
|
|
3708
|
+
para: "\xB6",
|
|
3709
|
+
sect: "\xA7",
|
|
3710
|
+
deg: "\xB0",
|
|
3711
|
+
rarr: "\u2192",
|
|
3712
|
+
larr: "\u2190",
|
|
3713
|
+
bull: "\u2022",
|
|
3714
|
+
shy: ""
|
|
3715
|
+
});
|
|
3716
|
+
|
|
3717
|
+
// src/core/yaml.ts
|
|
3718
|
+
function loadYaml(text2) {
|
|
3719
|
+
if (text2.split(/\r?\n/).every((l) => /^\s*(?:\.\.\.\s*)?(?:#.*)?$/.test(l))) return void 0;
|
|
3720
|
+
return load(text2);
|
|
3721
|
+
}
|
|
3722
|
+
|
|
3723
|
+
// src/core/config.ts
|
|
3724
|
+
function shared(f) {
|
|
3725
|
+
try {
|
|
3726
|
+
return f();
|
|
3727
|
+
} catch (e) {
|
|
3728
|
+
if (e instanceof ProductConfigError) throw new ConfigError(e.message);
|
|
3729
|
+
throw e;
|
|
3730
|
+
}
|
|
3731
|
+
}
|
|
3732
|
+
function versionsOf(cfg, product) {
|
|
3733
|
+
return cfg.productVersions?.get(product ?? "") ?? { versions: cfg.versions, defaultVersion: cfg.defaultVersion, ...cfg.versionMenu ? { menu: cfg.versionMenu } : {}, ...cfg.compare ? { compare: cfg.compare } : {} };
|
|
3734
|
+
}
|
|
3735
|
+
function declaresCompare(cfg) {
|
|
3736
|
+
return !!cfg.compare || [...cfg.productVersions?.values() ?? []].some((p) => p.compare);
|
|
3737
|
+
}
|
|
3738
|
+
var ConfigError = class extends Error {
|
|
3739
|
+
};
|
|
3740
|
+
function compareOf(raw, versions, at = "content.compare") {
|
|
3741
|
+
const { compare, errors } = readCompare(raw, versions, at);
|
|
3742
|
+
if (errors.length || !compare) throw new ConfigError(errors.join("; ") || `${at}: nothing to compare`);
|
|
3743
|
+
return compare;
|
|
3744
|
+
}
|
|
3745
|
+
function translationFallbackOf(v) {
|
|
3746
|
+
if (v == null || v === "redirect") return "redirect";
|
|
3747
|
+
if (v === "page") return "page";
|
|
3748
|
+
throw new ConfigError(`content.translationFallback must be redirect or page, not ${JSON.stringify(v)}`);
|
|
3749
|
+
}
|
|
3750
|
+
function sourceTemplates(v, path) {
|
|
3751
|
+
if (v == null) return void 0;
|
|
3752
|
+
if (v === "jinja") return "jinja";
|
|
3753
|
+
throw new ConfigError(`content.sources[${path}].templates must be "jinja"; got ${JSON.stringify(v)}`);
|
|
3754
|
+
}
|
|
3755
|
+
function sourcePath(s) {
|
|
3756
|
+
const raw = String(s.path);
|
|
3757
|
+
if (/^[a-z][a-z0-9+.-]*:/i.test(raw)) throw new ConfigError(`content.sources[${raw}]: a source cannot be a URL, since the build does not fetch; download it into the project and give its path`);
|
|
3758
|
+
return insideProject("content.sources path", raw) || ".";
|
|
3759
|
+
}
|
|
3760
|
+
function insideProject(what, raw) {
|
|
3761
|
+
const p = normalize(raw.replace(/\\/g, "/"));
|
|
3762
|
+
if (p.startsWith("/") || p === ".." || p.startsWith("../") || /^[a-z]:/i.test(p)) throw new ConfigError(`${what} "${raw.slice(0, 80)}" is outside the project: paths the build reads must be inside the folder of dogsbay.config.yml`);
|
|
3763
|
+
return p;
|
|
3764
|
+
}
|
|
3765
|
+
function checked(what, raw) {
|
|
3766
|
+
insideProject(what, raw);
|
|
3767
|
+
return raw;
|
|
3768
|
+
}
|
|
3769
|
+
function sourceName(v) {
|
|
3770
|
+
const name = String(v);
|
|
3771
|
+
if (!/^[a-z0-9][a-z0-9-]*$/i.test(name)) throw new ConfigError(`content.sources name "${name}" must be one URL segment of letters, digits and dashes`);
|
|
3772
|
+
return name;
|
|
3773
|
+
}
|
|
3774
|
+
function unitId(kind, v) {
|
|
3775
|
+
const id = String(v);
|
|
3776
|
+
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(id)) throw new ConfigError(`${kind}: id "${id.slice(0, 80)}" must be one URL segment of letters, digits, dots, dashes and underscores`);
|
|
3777
|
+
return id;
|
|
3778
|
+
}
|
|
3779
|
+
function sourceMount(s, products) {
|
|
3780
|
+
const at = `content.sources[${String(s.path)}]`;
|
|
3781
|
+
if (s.from !== "openapi") throw new ConfigError(`${at}: mount is only for a "from: openapi" source`);
|
|
3782
|
+
if (s.name != null && !products) throw new ConfigError(`${at} has both name and mount: a mounted source goes inside its version, so it takes no name (with content.products:, it names its product)`);
|
|
3783
|
+
const parsed = parseMount(s.mount);
|
|
3784
|
+
if ("error" in parsed) throw new ConfigError(`${at}: ${parsed.error}`);
|
|
3785
|
+
return parsed.segments.join("/");
|
|
3786
|
+
}
|
|
3787
|
+
function sourceFrom(v, path) {
|
|
3788
|
+
if (v === "auto") return "dogsbay-md";
|
|
3789
|
+
if (v === "dogsbay-md" || v === "openapi") return v;
|
|
3790
|
+
throw new ConfigError(`content.sources[${path}].from must be "dogsbay-md" or "openapi"; got ${JSON.stringify(v)}`);
|
|
3791
|
+
}
|
|
3792
|
+
var LINK_STYLES = ["html", "pretty", "directory", "no-slash"];
|
|
3793
|
+
function linkStyleOf(v) {
|
|
3794
|
+
if (v == null) return "html";
|
|
3795
|
+
if (LINK_STYLES.includes(v)) return v;
|
|
3796
|
+
throw new ConfigError(`ssg.linkStyle must be one of ${LINK_STYLES.join(", ")}; got ${JSON.stringify(v)}`);
|
|
3797
|
+
}
|
|
3798
|
+
var strOrUndef = (v) => v == null ? void 0 : String(v);
|
|
3799
|
+
function versionMenuOf(raw, where) {
|
|
3800
|
+
return shared(() => readVersionMenu(raw, where));
|
|
3801
|
+
}
|
|
3802
|
+
function chromeOf(raw) {
|
|
3803
|
+
return shared(() => siteChrome({ site: raw.site, header: raw.header, footer: raw.footer }));
|
|
3804
|
+
}
|
|
3805
|
+
function stringsOf(raw) {
|
|
3806
|
+
const out = { all: {}, byLocale: {} };
|
|
3807
|
+
if (raw == null) return out;
|
|
3808
|
+
if (typeof raw !== "object" || Array.isArray(raw)) throw new ConfigError("ssg.strings: expected a mapping of string keys to text");
|
|
3809
|
+
for (const [k, v] of Object.entries(raw)) {
|
|
3810
|
+
if (typeof v === "string") out.all[k] = v;
|
|
3811
|
+
else if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
3812
|
+
out.byLocale[k.toLowerCase()] = Object.fromEntries(
|
|
3813
|
+
Object.entries(v).map(([key, text2]) => {
|
|
3814
|
+
if (typeof text2 !== "string") throw new ConfigError(`ssg.strings.${k}.${key}: expected text`);
|
|
3815
|
+
return [key, text2];
|
|
3816
|
+
})
|
|
3817
|
+
);
|
|
3818
|
+
} else throw new ConfigError(`ssg.strings.${k}: expected text, or a mapping of keys to text for that language`);
|
|
3819
|
+
}
|
|
3820
|
+
return out;
|
|
3821
|
+
}
|
|
3822
|
+
var VERSION_FLAGS = ["eol", "prerelease", "hidden", "noindex", "sitemap", "badge"];
|
|
3823
|
+
var FLAG_PATHS = [
|
|
3824
|
+
"poweredBy",
|
|
3825
|
+
"linkPreviews",
|
|
3826
|
+
"granularity.book",
|
|
3827
|
+
"ssg.breadcrumbs",
|
|
3828
|
+
"ssg.strictTemplates",
|
|
3829
|
+
"ssg.math",
|
|
3830
|
+
"agent.mdMirror",
|
|
3831
|
+
"agent.llmsTxt",
|
|
3832
|
+
"agent.llmsFull",
|
|
3833
|
+
"agent.llmsTxtDirective",
|
|
3834
|
+
"agent.contentSignal.preamble",
|
|
3835
|
+
"agent.pageActions.enabled",
|
|
3836
|
+
"agent.pageActions.copyButton",
|
|
3837
|
+
"agent.pageActions.footerLink",
|
|
3838
|
+
"site.noindex",
|
|
3839
|
+
"site.nofollow",
|
|
3840
|
+
"content.codeBlockTitle",
|
|
3841
|
+
"content.linkIcons",
|
|
3842
|
+
...VERSION_FLAGS.flatMap((k) => [`versions.*.${k}`, `content.versions.*.${k}`]),
|
|
3843
|
+
// Checked again by site-files' model; here first, for the YAML 1.2 hint (`badge: yes`).
|
|
3844
|
+
"content.products.*.versions.*.badge",
|
|
3845
|
+
"taxonomies.*.hierarchical",
|
|
3846
|
+
"taxonomies.*.autoColor",
|
|
3847
|
+
"blog",
|
|
3848
|
+
"blog.rss"
|
|
3849
|
+
];
|
|
3850
|
+
var YAML11_BOOL = /^(?:y|Y|yes|Yes|YES|n|N|no|No|NO|on|On|ON|off|Off|OFF)$/;
|
|
3851
|
+
function flagError(at, word) {
|
|
3852
|
+
const fix = /^(?:y|yes|on)$/i.test(word) ? "true" : "false";
|
|
3853
|
+
return new ConfigError(`${at} is on/off: write ${fix}, not ${JSON.stringify(word)} (YAML 1.2, as the Dogsbay CLI reads the config, makes a bare yes, no, on or off a word, not a boolean)`);
|
|
3854
|
+
}
|
|
3855
|
+
function refuseYaml11Flags(raw) {
|
|
3856
|
+
const walk = (v, parts, at) => {
|
|
3857
|
+
if (!parts.length) {
|
|
3858
|
+
if (typeof v === "string" && YAML11_BOOL.test(v)) throw flagError(at, v);
|
|
3859
|
+
return;
|
|
3860
|
+
}
|
|
3861
|
+
if (!v || typeof v !== "object") return;
|
|
3862
|
+
const [p, ...rest] = parts;
|
|
3863
|
+
if (p === "*") {
|
|
3864
|
+
for (const [k, x] of Object.entries(v)) walk(x, rest, Array.isArray(v) ? `${at}[${k}]` : `${at}.${k}`);
|
|
3865
|
+
} else walk(v[p], rest, at ? `${at}.${p}` : p);
|
|
3866
|
+
};
|
|
3867
|
+
for (const path of FLAG_PATHS) walk(raw, path.split("."), "");
|
|
3868
|
+
for (const [i, e] of (Array.isArray(raw.plugins) ? raw.plugins : []).entries()) {
|
|
3869
|
+
if (e && typeof e === "object" && [IMAGE_ZOOM, "image-zoom", "dogsbay-plugin-image-zoom"].includes(e.name)) walk(e.options, ["excludeInsideLinks"], `plugins[${i}].options`);
|
|
3870
|
+
}
|
|
3871
|
+
}
|
|
3872
|
+
function linkPreviewsOf(v) {
|
|
3873
|
+
if (v === void 0) return false;
|
|
3874
|
+
if (typeof v === "boolean") return v;
|
|
3875
|
+
throw new ConfigError(`linkPreviews must be true or false, not ${JSON.stringify(v)}`);
|
|
3876
|
+
}
|
|
3877
|
+
function granularityOf(v) {
|
|
3878
|
+
if (v === void 0) return { book: false, maxSinglePageMB: 3 };
|
|
3879
|
+
if (v === null || typeof v !== "object" || Array.isArray(v)) throw new ConfigError(`granularity must be a mapping (book, maxSinglePageMB), not ${JSON.stringify(v)}`);
|
|
3880
|
+
const g = v;
|
|
3881
|
+
if (g.book !== void 0 && typeof g.book !== "boolean") throw new ConfigError(`granularity.book must be true or false, not ${JSON.stringify(g.book)}`);
|
|
3882
|
+
const mb = g.maxSinglePageMB ?? 3;
|
|
3883
|
+
if (typeof mb !== "number" || !Number.isFinite(mb) || mb <= 0) throw new ConfigError(`granularity.maxSinglePageMB must be a positive number, not ${JSON.stringify(g.maxSinglePageMB)}`);
|
|
3884
|
+
return { book: g.book === true, maxSinglePageMB: mb };
|
|
3885
|
+
}
|
|
3886
|
+
function htmlOf(v) {
|
|
3887
|
+
if (v === void 0 || v === null) return void 0;
|
|
3888
|
+
if (v === "keep" || v === "sanitize") return v;
|
|
3889
|
+
throw new ConfigError(`content.html must be "keep" or "sanitize"; got ${JSON.stringify(v)}`);
|
|
3890
|
+
}
|
|
3891
|
+
function assetsFolderOf(v) {
|
|
3892
|
+
if (v == null || v === "") return "_dogsbay";
|
|
3893
|
+
if (typeof v !== "string" || !/^[A-Za-z0-9._-]+$/.test(v) || /^\.+$/.test(v)) throw new ConfigError(`ssg.assetsFolder must be one folder name of letters, digits, ".", "_" and "-" (such as dogsbay); got ${JSON.stringify(v)}`);
|
|
3894
|
+
if (v.toLowerCase() === "pagefind") throw new ConfigError("ssg.assetsFolder: pagefind is Pagefind's folder; choose another name, such as dogsbay");
|
|
3895
|
+
return v;
|
|
3896
|
+
}
|
|
3897
|
+
function parseConfig(text2, overrides = {}) {
|
|
3898
|
+
const raw = text2 ? loadYaml(text2) ?? {} : {};
|
|
3899
|
+
if (typeof raw !== "object" || Array.isArray(raw)) throw new ConfigError("config must be a YAML mapping");
|
|
3900
|
+
refuseYaml11Flags(raw);
|
|
3901
|
+
const buildBlock = raw.build;
|
|
3902
|
+
if (buildBlock != null && (typeof buildBlock !== "object" || Array.isArray(buildBlock))) throw new ConfigError("build must be a mapping (for example build: { navMode: client })");
|
|
3903
|
+
const navMode = buildBlock?.navMode ?? void 0;
|
|
3904
|
+
if (navMode !== void 0 && navMode !== "client" && navMode !== "hybrid" && navMode !== "ssr-full") throw new ConfigError(`build.navMode must be "client", "hybrid" or "ssr-full"; got ${JSON.stringify(navMode)}`);
|
|
3905
|
+
const navScope = buildBlock?.navScope ?? void 0;
|
|
3906
|
+
if (navScope !== void 0 && navScope !== "site" && navScope !== "section") throw new ConfigError(`build.navScope must be "site" or "section"; got ${JSON.stringify(navScope)}`);
|
|
3907
|
+
const site = raw.site ?? {};
|
|
3908
|
+
const content = raw.content ?? {};
|
|
3909
|
+
const productsBlock = content.products != null;
|
|
3910
|
+
const ssg = raw.ssg ?? {};
|
|
3911
|
+
const agent = raw.agent ?? {};
|
|
3912
|
+
const signal = agent.contentSignal ?? {};
|
|
3913
|
+
const sources = (Array.isArray(content.sources) ? content.sources : []).filter((s) => typeof s?.path === "string").map((s) => ({
|
|
3914
|
+
path: sourcePath(s),
|
|
3915
|
+
...s.name != null ? { name: sourceName(s.name) } : {},
|
|
3916
|
+
...s.from != null ? { from: sourceFrom(s.from, String(s.path)) } : {},
|
|
3917
|
+
...s.mount != null ? { mount: sourceMount(s, productsBlock) } : {},
|
|
3918
|
+
version: s.version != null ? unitId("version", s.version) : void 0,
|
|
3919
|
+
locale: s.locale != null ? unitId("locale", s.locale) : void 0,
|
|
3920
|
+
attributes: s.attributes ?? void 0,
|
|
3921
|
+
templates: sourceTemplates(s.templates, String(s.path)),
|
|
3922
|
+
...s.nav != null ? { nav: sourceNav(s.nav, String(s.path), s.from) } : {},
|
|
3923
|
+
...s.data != null ? { data: dataFolder(`content.sources (${String(s.path)}): data`, s.data) } : {}
|
|
3924
|
+
}));
|
|
3925
|
+
if (sources.length === 0) sources.push({ path: "content" });
|
|
3926
|
+
const versions = (content.versions ?? raw.versions ?? []).map((v) => ({
|
|
3927
|
+
id: unitId("versions", v.id),
|
|
3928
|
+
label: String(v.label ?? v.id),
|
|
3929
|
+
eol: v.eol || void 0,
|
|
3930
|
+
prerelease: v.prerelease || void 0,
|
|
3931
|
+
hidden: v.hidden || void 0,
|
|
3932
|
+
removed: removedOf(v.removed, String(v.id)),
|
|
3933
|
+
...shared(() => readVersionBadge(v.badge, `versions: "${String(v.id)}"`)) ? { badge: true } : {},
|
|
3934
|
+
...versionSeoOf(v, String(v.id)),
|
|
3935
|
+
...versionPathOf(v, String(v.id), productsBlock)
|
|
3936
|
+
}));
|
|
3937
|
+
const locales = (content.locales ?? raw.locales ?? []).map((l) => ({
|
|
3938
|
+
id: unitId("locales", l.id),
|
|
3939
|
+
label: String(l.label ?? l.id)
|
|
3940
|
+
}));
|
|
3941
|
+
const basePath = String(site.basePath ?? "").replace(/^\/+|\/+$/g, "");
|
|
3942
|
+
if (typeof site.repoUrl === "string" && scriptUrl(site.repoUrl, "link")) throw new ConfigError(`site.repoUrl must be a web address; got ${JSON.stringify(site.repoUrl.slice(0, 80))}`);
|
|
3943
|
+
const cfg = {
|
|
3944
|
+
name: String(site.name ?? "Documentation"),
|
|
3945
|
+
description: site.description,
|
|
3946
|
+
url: site.url,
|
|
3947
|
+
basePath,
|
|
3948
|
+
repoUrl: site.repoUrl,
|
|
3949
|
+
editUri: site.editUri,
|
|
3950
|
+
copyright: site.copyright,
|
|
3951
|
+
chrome: chromeOf(raw),
|
|
3952
|
+
linkStyle: linkStyleOf(ssg.linkStyle),
|
|
3953
|
+
attributes: { ...raw.attributes ?? {} },
|
|
3954
|
+
sources,
|
|
3955
|
+
excludeFromRoutes: (content.excludeFromRoutes ?? []).map(String),
|
|
3956
|
+
routablesFrom: content.routablesFrom === "nav" ? "nav" : "all",
|
|
3957
|
+
versions,
|
|
3958
|
+
// YAML reads `4.22` as a number; ids are strings everywhere else.
|
|
3959
|
+
defaultVersion: strOrUndef(content.defaultVersion ?? raw.defaultVersion) ?? (versions.length ? versions.find((v) => !v.prerelease)?.id : void 0),
|
|
3960
|
+
locales,
|
|
3961
|
+
defaultLocale: strOrUndef(content.defaultLocale ?? raw.defaultLocale) ?? locales[0]?.id,
|
|
3962
|
+
translationFallback: translationFallbackOf(content.translationFallback),
|
|
3963
|
+
...content.compare !== void 0 ? { compare: compareOf(content.compare, versions) } : {},
|
|
3964
|
+
search: ssg.search !== false && ssg.search !== "off",
|
|
3965
|
+
searchEngine: searchEngineOf(ssg.search),
|
|
3966
|
+
fullNavLimit: typeof ssg.fullNavLimit === "number" ? ssg.fullNavLimit : 600,
|
|
3967
|
+
navMode,
|
|
3968
|
+
navScope,
|
|
3969
|
+
undefinedRefs: raw.undefinedRefs === "asciidoc-literal" ? "asciidoc-literal" : "preserve",
|
|
3970
|
+
theme: raw.theme === "mintlify" ? "mintlify" : "default",
|
|
3971
|
+
toc: ["top", "popover", "rail", "off"].includes(raw.toc) ? raw.toc : "top",
|
|
3972
|
+
layout: typeof ssg.layout === "string" ? ssg.layout : "docs",
|
|
3973
|
+
linkPrefixes: Array.isArray(ssg.linkPrefixes) ? ssg.linkPrefixes.map((x) => String(x).replace(/^\/+|\/+$/g, "")) : [],
|
|
3974
|
+
themeDir: checked("ssg.themeDir", String(ssg.themeDir ?? "theme")).replace(/^\.\/|\/+$/g, ""),
|
|
3975
|
+
css: Array.isArray(ssg.css) ? ssg.css.map((c) => checked("ssg.css", String(c))) : [],
|
|
3976
|
+
breadcrumbs: ssg.breadcrumbs === true,
|
|
3977
|
+
strings: stringsOf(ssg.strings),
|
|
3978
|
+
versionMenu: versionMenuOf(content.versionMenu, "content.versionMenu"),
|
|
3979
|
+
strictTemplates: ssg.strictTemplates === true,
|
|
3980
|
+
// An empty tagline falls back too, as DocsLayout's `siteTagline || "Documentation"`.
|
|
3981
|
+
tagline: String(site.tagline || "Documentation"),
|
|
3982
|
+
poweredBy: raw.poweredBy !== false,
|
|
3983
|
+
linkPreviews: linkPreviewsOf(raw.linkPreviews),
|
|
3984
|
+
granularity: granularityOf(raw.granularity),
|
|
3985
|
+
// Same defaults as the Astro pipeline: the mirror, llms.txt and page actions are on unless turned off.
|
|
3986
|
+
assetsFolder: assetsFolderOf(ssg.assetsFolder),
|
|
3987
|
+
mdMirror: agent.mdMirror !== false,
|
|
3988
|
+
mdMirrorLinks: (() => {
|
|
3989
|
+
const v = agent.mdMirrorLinks ?? "html";
|
|
3990
|
+
if (v !== "html" && v !== "md") throw new ConfigError(`agent.mdMirrorLinks: expected html or md, not ${JSON.stringify(v)}`);
|
|
3991
|
+
return v;
|
|
3992
|
+
})(),
|
|
3993
|
+
keyWarnings: [
|
|
3994
|
+
...site.title !== void 0 ? [`site.title is not read: the site's name is site.name${site.name == null ? ` (it is "Documentation" now)` : ""}`] : [],
|
|
3995
|
+
...raw.title !== void 0 ? [`title: is not read: the site's name is site.name, under site:`] : [],
|
|
3996
|
+
...site.redirects !== void 0 ? [`site.redirects is not read: redirects go at the top level, not under site:`] : []
|
|
3997
|
+
],
|
|
3998
|
+
...(() => {
|
|
3999
|
+
const { style, errors } = readMarkdownStyle(raw.style);
|
|
4000
|
+
return { markdownStyle: style, styleWarnings: errors };
|
|
4001
|
+
})(),
|
|
4002
|
+
...(() => {
|
|
4003
|
+
const { choices, problems } = parseChoices(raw.choices);
|
|
4004
|
+
return { choices, choiceProblems: problems };
|
|
4005
|
+
})(),
|
|
4006
|
+
llmsTxt: agent.llmsTxt !== false,
|
|
4007
|
+
llmsFull: agent.llmsFull !== false,
|
|
4008
|
+
pageActions: {
|
|
4009
|
+
enabled: agent.pageActions?.enabled ?? agent.mdMirror !== false,
|
|
4010
|
+
providers: Array.isArray(agent.pageActions?.providers) ? agent.pageActions.providers.map(String) : ["claude", "chatgpt", "perplexity", "gemini"],
|
|
4011
|
+
promptTemplate: agent.pageActions?.promptTemplate,
|
|
4012
|
+
placement: ["inline", "both"].includes(agent.pageActions?.placement) ? agent.pageActions.placement : "header",
|
|
4013
|
+
copyButton: agent.pageActions?.copyButton !== false,
|
|
4014
|
+
footerLink: agent.pageActions?.footerLink !== false
|
|
4015
|
+
},
|
|
4016
|
+
llmsWhenToUse: typeof agent.llmsWhenToUse === "string" && agent.llmsWhenToUse.trim() ? agent.llmsWhenToUse : void 0,
|
|
4017
|
+
llmsTxtDirective: agent.llmsTxtDirective === true,
|
|
4018
|
+
contentSignal: {
|
|
4019
|
+
search: yesNo(signal.search, "yes", "agent.contentSignal.search"),
|
|
4020
|
+
aiInput: yesNo(signal.aiInput, "yes", "agent.contentSignal.aiInput"),
|
|
4021
|
+
aiTrain: yesNo(signal.aiTrain, "no", "agent.contentSignal.aiTrain"),
|
|
4022
|
+
preamble: signal.preamble === true
|
|
4023
|
+
},
|
|
4024
|
+
aggregates: (Array.isArray(site.aggregates) ? site.aggregates : []).filter((a) => a && typeof a.name === "string").map((a) => {
|
|
4025
|
+
const sitemap = strOrUndef(a.sitemap);
|
|
4026
|
+
if (sitemap) {
|
|
4027
|
+
try {
|
|
4028
|
+
assertLeafSitemap(sitemap);
|
|
4029
|
+
} catch (e) {
|
|
4030
|
+
throw new ConfigError(`site.aggregates (${a.name}): ${e.message}`);
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
return { name: a.name, description: strOrUndef(a.description), url: strOrUndef(a.url), llmsTxt: strOrUndef(a.llmsTxt), ...sitemap ? { sitemap } : {} };
|
|
4034
|
+
}),
|
|
4035
|
+
ogImage: strOrUndef(site.ogImage),
|
|
4036
|
+
twitterHandle: strOrUndef(site.twitterHandle),
|
|
4037
|
+
themeColor: strOrUndef(site.themeColor),
|
|
4038
|
+
noindex: site.noindex === true,
|
|
4039
|
+
nofollow: site.nofollow === true,
|
|
4040
|
+
redirects: redirectsOf(raw.redirects),
|
|
4041
|
+
deployTarget: strOrUndef(raw.deploy?.target),
|
|
4042
|
+
math: ssg.math !== false,
|
|
4043
|
+
diagrams: content.diagrams !== false,
|
|
4044
|
+
diagramEngine: diagramEngineOf(content.diagrams, ssg.diagrams),
|
|
4045
|
+
...pluginsOf(raw.plugins),
|
|
4046
|
+
taxonomies: taxonomiesOf(raw.taxonomies),
|
|
4047
|
+
blog: blogOf(raw.blog),
|
|
4048
|
+
linkIcons: linkIconsOf(content.linkIcons),
|
|
4049
|
+
codeBlockTitle: content.codeBlockTitle === false ? false : content.codeBlockTitle === "auto" ? "auto" : true,
|
|
4050
|
+
imageCaptions: content.imageCaptions === "title" ? "title" : false,
|
|
4051
|
+
html: htmlOf(content.html),
|
|
4052
|
+
dataDir: content.data != null ? dataFolder("content.data", content.data) : "data",
|
|
4053
|
+
dataDirSet: content.data != null,
|
|
4054
|
+
...content.static != null ? { staticDir: staticFolder(content.static) } : {},
|
|
4055
|
+
...content.examples != null ? { examplesDir: examplesFolder(content.examples) } : {},
|
|
4056
|
+
plausible: typeof raw.analytics?.plausible?.domain === "string" ? { domain: raw.analytics.plausible.domain, scriptUrl: strOrUndef(raw.analytics.plausible.scriptUrl) } : void 0,
|
|
4057
|
+
...overrides
|
|
4058
|
+
};
|
|
4059
|
+
if (cfg.defaultVersion && versions.length) {
|
|
4060
|
+
const dv = versions.find((v) => v.id === cfg.defaultVersion);
|
|
4061
|
+
if (!dv) throw new ConfigError(`defaultVersion "${cfg.defaultVersion}" is not in versions`);
|
|
4062
|
+
if (dv.prerelease) throw new ConfigError(`defaultVersion "${cfg.defaultVersion}" is a prerelease`);
|
|
4063
|
+
for (const v of versions) {
|
|
4064
|
+
if (v.path === "" && v.id !== cfg.defaultVersion) throw new ConfigError(`versions: "${v.id}".path: "" is only allowed on the defaultVersion`);
|
|
4065
|
+
}
|
|
4066
|
+
if (dv.noindex) throw new ConfigError(`versions: "${dv.id}" is the defaultVersion and has noindex: true; older versions' pages name it as their canonical`);
|
|
4067
|
+
}
|
|
4068
|
+
if (productsBlock) Object.assign(cfg, productsOf(content, raw, cfg));
|
|
4069
|
+
if (cfg.staticDir) {
|
|
4070
|
+
const st = cfg.staticDir;
|
|
4071
|
+
const clash = cfg.sources.find((x) => {
|
|
4072
|
+
const xp = x.path.replace(/^(\.\/)+/, "").replace(/\/+$/, "");
|
|
4073
|
+
return x.from !== "openapi" && (xp === "." || xp === "" || xp === st || xp.startsWith(st + "/") || st.startsWith(xp + "/"));
|
|
4074
|
+
});
|
|
4075
|
+
if (clash) throw new ConfigError(`content.static (${st}) and the source "${clash.path}" overlap: the static folder is served as it is, so it must be a folder of its own, beside the sources`);
|
|
4076
|
+
const input = [["content.data", cfg.dataDir], ...cfg.examplesDir ? [["content.examples", cfg.examplesDir]] : [], ...cfg.sources.flatMap((x) => x.data ? [[`content.sources (${x.path}) data`, x.data]] : []), ["ssg.themeDir", cfg.themeDir], ...cfg.css.map((f) => ["ssg.css", f])];
|
|
4077
|
+
const inside = input.find(([, p]) => {
|
|
4078
|
+
const q = p.replace(/^(\.\/)+/, "").replace(/\/+$/, "");
|
|
4079
|
+
return q === st || q.startsWith(st + "/");
|
|
4080
|
+
});
|
|
4081
|
+
if (inside) throw new ConfigError(`${inside[0]} (${inside[1]}) is inside content.static (${st}), whose files are served as they are: move it out of the folder`);
|
|
4082
|
+
}
|
|
4083
|
+
return cfg;
|
|
4084
|
+
}
|
|
4085
|
+
var TAG_COLORS = /* @__PURE__ */ new Set(["blue", "amber", "emerald", "violet", "rose", "slate"]);
|
|
4086
|
+
function folderOf(v, fallback, key) {
|
|
4087
|
+
const p = typeof v === "string" ? v : fallback;
|
|
4088
|
+
const f = p.replace(/^\/+|\/+$/g, "");
|
|
4089
|
+
if (f.split("/").some((s) => s === ".." || s === ".")) throw new ConfigError(`${key} must not contain "." or ".." segments`);
|
|
4090
|
+
return f;
|
|
4091
|
+
}
|
|
4092
|
+
function taxonomiesOf(v) {
|
|
4093
|
+
if (v == null) return [];
|
|
4094
|
+
if (typeof v !== "object" || Array.isArray(v)) throw new ConfigError("taxonomies must be a mapping of taxonomy name to its settings");
|
|
4095
|
+
return Object.entries(v).map(([name, t]) => {
|
|
4096
|
+
const o = t && typeof t === "object" ? t : {};
|
|
4097
|
+
const path = folderOf(o.indexPath, `/${name}`, `taxonomies.${name}.indexPath`);
|
|
4098
|
+
if (!path) throw new ConfigError(`taxonomies.${name}.indexPath cannot be the site root`);
|
|
4099
|
+
const prefixes = {};
|
|
4100
|
+
for (const [seg, d] of Object.entries(o.prefixes ?? {})) {
|
|
4101
|
+
const e = d && typeof d === "object" ? d : {};
|
|
4102
|
+
prefixes[seg] = {
|
|
4103
|
+
label: typeof e.label === "string" ? e.label : void 0,
|
|
4104
|
+
color: TAG_COLORS.has(e.color) ? e.color : void 0
|
|
4105
|
+
};
|
|
4106
|
+
}
|
|
4107
|
+
const labels = Object.fromEntries(Object.entries(o.labels ?? {}).filter(([, l]) => typeof l === "string"));
|
|
4108
|
+
return {
|
|
4109
|
+
name,
|
|
4110
|
+
path,
|
|
4111
|
+
// As the Dogsbay CLI: declaring prefixes makes the taxonomy hierarchical unless it says otherwise.
|
|
4112
|
+
hierarchical: o.hierarchical === void 0 ? Object.keys(prefixes).length > 0 : o.hierarchical === true,
|
|
4113
|
+
prefixes: Object.keys(prefixes).length ? prefixes : void 0,
|
|
4114
|
+
labels: Object.keys(labels).length ? labels : void 0,
|
|
4115
|
+
autoColor: o.autoColor === true
|
|
4116
|
+
};
|
|
4117
|
+
});
|
|
4118
|
+
}
|
|
4119
|
+
function blogOf(v) {
|
|
4120
|
+
if (v == null || v === false) return void 0;
|
|
4121
|
+
const o = v && typeof v === "object" ? v : {};
|
|
4122
|
+
return {
|
|
4123
|
+
path: folderOf(o.indexPath, "/", "blog.indexPath"),
|
|
4124
|
+
postsPerPage: typeof o.postsPerPage === "number" && o.postsPerPage >= 1 ? Math.floor(o.postsPerPage) : 20,
|
|
4125
|
+
rss: o.rss !== false,
|
|
4126
|
+
dateField: o.dateField === "updated" ? "updated" : "created"
|
|
4127
|
+
};
|
|
4128
|
+
}
|
|
4129
|
+
var IMAGE_ZOOM = "@dogsbay/plugin-image-zoom";
|
|
4130
|
+
function pluginsOf(v) {
|
|
4131
|
+
const out = { unsupportedPlugins: [] };
|
|
4132
|
+
for (const e of Array.isArray(v) ? v : []) {
|
|
4133
|
+
const name = typeof e === "string" ? e : typeof e?.name === "string" ? e.name : void 0;
|
|
4134
|
+
if (!name) continue;
|
|
4135
|
+
if (![IMAGE_ZOOM, "image-zoom", "dogsbay-plugin-image-zoom"].includes(name)) {
|
|
4136
|
+
out.unsupportedPlugins.push(name);
|
|
4137
|
+
continue;
|
|
4138
|
+
}
|
|
4139
|
+
const o = typeof e === "object" && e?.options || {};
|
|
4140
|
+
out.imageZoom = {
|
|
4141
|
+
background: typeof o.background === "string" && o.background.trim() ? o.background : "rgba(0, 0, 0, 0.85)",
|
|
4142
|
+
margin: typeof o.margin === "number" ? o.margin : 20,
|
|
4143
|
+
scrollOffset: typeof o.scrollOffset === "number" ? o.scrollOffset : 40,
|
|
4144
|
+
excludeInsideLinks: o.excludeInsideLinks !== false
|
|
4145
|
+
};
|
|
4146
|
+
}
|
|
4147
|
+
return out;
|
|
4148
|
+
}
|
|
4149
|
+
function linkIconsOf(v) {
|
|
4150
|
+
if (!v) return void 0;
|
|
4151
|
+
if (v === true) return { external: "\u2197" };
|
|
4152
|
+
if (typeof v !== "object") return void 0;
|
|
4153
|
+
const o = v;
|
|
4154
|
+
const external = typeof o.external === "string" && o.external.trim() ? o.external : void 0;
|
|
4155
|
+
const internal = typeof o.internal === "string" && o.internal.trim() ? o.internal : void 0;
|
|
4156
|
+
return external || internal ? { external, internal } : void 0;
|
|
4157
|
+
}
|
|
4158
|
+
function yesNo(v, def, key) {
|
|
4159
|
+
if (v === void 0 || v === null) return def;
|
|
4160
|
+
if (v === "yes" || v === "no") return v;
|
|
4161
|
+
if (v === true) return "yes";
|
|
4162
|
+
if (v === false) return "no";
|
|
4163
|
+
throw new ConfigError(`${key} must be "yes" or "no" (got ${JSON.stringify(v)})`);
|
|
4164
|
+
}
|
|
4165
|
+
var REDIRECT_STATUS = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
|
|
4166
|
+
function redirectsOf(v) {
|
|
4167
|
+
if (v == null) return [];
|
|
4168
|
+
if (typeof v !== "object" || Array.isArray(v)) throw new ConfigError("redirects must be a mapping of source path to target");
|
|
4169
|
+
return Object.entries(v).map(([from, value]) => {
|
|
4170
|
+
const to = typeof value === "string" ? value : value?.to;
|
|
4171
|
+
const status = typeof value === "object" && value?.status != null ? Number(value.status) : 301;
|
|
4172
|
+
if (typeof to !== "string" || !to.trim()) throw new ConfigError(`redirects: entry "${from}" has no target`);
|
|
4173
|
+
if (!REDIRECT_STATUS.has(status)) throw new ConfigError(`redirects: entry "${from}" has status ${status}; use one of ${[...REDIRECT_STATUS].join(", ")}`);
|
|
4174
|
+
return { from, to: to.trim(), status };
|
|
4175
|
+
});
|
|
4176
|
+
}
|
|
4177
|
+
function diagramEngineOf(v, old) {
|
|
4178
|
+
if (old !== void 0) {
|
|
4179
|
+
const fix = old === "pele" ? "content.diagrams: pele" : "remove it (Merman is the default; content.diagrams: false turns diagrams off)";
|
|
4180
|
+
throw new ConfigError(`ssg.diagrams is now content.diagrams, shared with the Astro pipeline: ${fix} (got ssg.diagrams: ${JSON.stringify(old)})`);
|
|
4181
|
+
}
|
|
4182
|
+
if (v === void 0 || v === true || v === false || v === "mermaid-cli") return "merman";
|
|
4183
|
+
if (v === "pele") return "pele";
|
|
4184
|
+
throw new ConfigError(`content.diagrams must be true, false, "mermaid-cli" or "pele"; got ${JSON.stringify(v)}`);
|
|
4185
|
+
}
|
|
4186
|
+
function searchEngineOf(v) {
|
|
4187
|
+
if (v === void 0 || v === true || v === false || v === "off") return "builtin";
|
|
4188
|
+
if (v === "builtin" || v === "pagefind" || v === "both") return v;
|
|
4189
|
+
throw new ConfigError(`ssg.search must be builtin, pagefind, both, off, true or false (got ${JSON.stringify(v)})`);
|
|
4190
|
+
}
|
|
4191
|
+
function removedOf(v, id) {
|
|
4192
|
+
if (v == null) return void 0;
|
|
4193
|
+
if (!Array.isArray(v) || v.some((p) => typeof p !== "string" || !p.trim())) throw new ConfigError(`versions: "${id}".removed must be a list of page paths`);
|
|
4194
|
+
return v.map(normalizeRemoved);
|
|
4195
|
+
}
|
|
4196
|
+
function versionSeoOf(v, id) {
|
|
4197
|
+
const bad = checkVersionSeo(id, v);
|
|
4198
|
+
if (bad) throw new ConfigError(bad);
|
|
4199
|
+
return {
|
|
4200
|
+
...v.canonical === "self" ? { canonical: "self" } : {},
|
|
4201
|
+
...typeof v.noindex === "boolean" ? { noindex: v.noindex } : {},
|
|
4202
|
+
...typeof v.sitemap === "boolean" ? { sitemap: v.sitemap } : {}
|
|
4203
|
+
};
|
|
4204
|
+
}
|
|
4205
|
+
function versionPathOf(v, id, products = false) {
|
|
4206
|
+
if (v.path === void 0 || v.path === null) return {};
|
|
4207
|
+
if (products && v.path !== "") return { path: String(v.path) };
|
|
4208
|
+
if (v.path !== "") throw new ConfigError(`versions: "${id}".path can only be "" (serve the version at the root); another segment needs content.products:`);
|
|
4209
|
+
return { path: "" };
|
|
4210
|
+
}
|
|
4211
|
+
function productsOf(content, raw, cfg) {
|
|
4212
|
+
const siteVersions = content.versions ?? raw.versions;
|
|
4213
|
+
const written = (Array.isArray(content.sources) ? content.sources : []).filter((s) => typeof s?.path === "string");
|
|
4214
|
+
const sources = written.length ? written : [{ path: "content" }];
|
|
4215
|
+
const model = shared(() => productModel({ products: content.products, sources, versions: siteVersions, defaultVersion: content.defaultVersion ?? raw.defaultVersion, versionMenu: content.versionMenu, locales: cfg.locales, defaultLocale: cfg.defaultLocale }));
|
|
4216
|
+
if (!model) return {};
|
|
4217
|
+
const productVersions = /* @__PURE__ */ new Map();
|
|
4218
|
+
for (const p of model.products) {
|
|
4219
|
+
const rawList = (p.name ? content.products[p.name]?.versions : void 0) ?? siteVersions ?? [];
|
|
4220
|
+
const versions = p.versions.map((v) => {
|
|
4221
|
+
const r = rawList.find((x) => String(x?.id) === v.id) ?? {};
|
|
4222
|
+
return {
|
|
4223
|
+
id: v.id,
|
|
4224
|
+
label: v.label,
|
|
4225
|
+
...v.eol ? { eol: true } : {},
|
|
4226
|
+
...v.prerelease ? { prerelease: true } : {},
|
|
4227
|
+
...v.hidden ? { hidden: true } : {},
|
|
4228
|
+
...r.removed != null ? { removed: removedOf(r.removed, v.id) } : {},
|
|
4229
|
+
...v.canonical ? { canonical: v.canonical } : {},
|
|
4230
|
+
...v.noindex !== void 0 ? { noindex: v.noindex } : {},
|
|
4231
|
+
...v.sitemap !== void 0 ? { sitemap: v.sitemap } : {},
|
|
4232
|
+
...v.path !== v.id ? { path: v.path } : {},
|
|
4233
|
+
...v.banner ? { banner: v.banner } : {},
|
|
4234
|
+
...v.badge ? { badge: true } : {}
|
|
4235
|
+
};
|
|
4236
|
+
});
|
|
4237
|
+
const ownCompare = p.name ? content.products[p.name]?.compare : void 0;
|
|
4238
|
+
const compare = ownCompare !== void 0 ? compareOf(ownCompare, versions, `content.products.${p.name}.compare`) : cfg.compare;
|
|
4239
|
+
if (ownCompare === void 0 && cfg.compare && p.name) {
|
|
4240
|
+
const { errors } = readCompare(content.compare, versions, "content.compare");
|
|
4241
|
+
if (errors.length) throw new ConfigError(`content.products.${p.name} has no compare: of its own, so it uses content.compare, which does not fit its versions: ${errors.join("; ")}. Give ${p.name} its own compare:`);
|
|
4242
|
+
}
|
|
4243
|
+
productVersions.set(p.name ?? "", { versions, ...p.defaultVersion ? { defaultVersion: p.defaultVersion } : {}, ...p.versionMenu ? { menu: p.versionMenu } : {}, ...compare ? { compare } : {} });
|
|
4244
|
+
}
|
|
4245
|
+
return { products: model, productVersions };
|
|
4246
|
+
}
|
|
4247
|
+
function unitOfPath(units, sitePath) {
|
|
4248
|
+
let best;
|
|
4249
|
+
for (const u of units) {
|
|
4250
|
+
if (u.prefix === "" || sitePath === u.prefix || sitePath.startsWith(u.prefix + "/")) {
|
|
4251
|
+
if (!best || u.prefix.length > best.prefix.length) best = u;
|
|
4252
|
+
}
|
|
4253
|
+
}
|
|
4254
|
+
return best;
|
|
4255
|
+
}
|
|
4256
|
+
function groupPrefix(u) {
|
|
4257
|
+
return [u.product, u.locale].filter(Boolean).join("/");
|
|
4258
|
+
}
|
|
4259
|
+
var sameProduct = (a, b) => (a.product ?? "") === (b.product ?? "");
|
|
4260
|
+
function buildUnits(cfg) {
|
|
4261
|
+
if (cfg.products) return productUnits(cfg, cfg.products);
|
|
4262
|
+
const withDefaults = cfg.sources.map((s) => ({
|
|
4263
|
+
source: s,
|
|
4264
|
+
version: s.version ?? cfg.defaultVersion,
|
|
4265
|
+
locale: s.locale ?? cfg.defaultLocale
|
|
4266
|
+
}));
|
|
4267
|
+
const distinct = (k) => new Set(withDefaults.map((u) => u[k]).filter(Boolean)).size;
|
|
4268
|
+
const versionAxis = distinct("version") > 1 || cfg.versions.length > 1;
|
|
4269
|
+
const localeAxis = distinct("locale") > 1 || cfg.locales.length > 1;
|
|
4270
|
+
for (const u of withDefaults) {
|
|
4271
|
+
if (cfg.versions.length && u.version && !cfg.versions.some((v) => v.id === u.version)) {
|
|
4272
|
+
throw new ConfigError(`source "${u.source.path}" has version "${u.version}" which is not declared in versions`);
|
|
4273
|
+
}
|
|
4274
|
+
if (cfg.locales.length && u.locale && !cfg.locales.some((l) => l.id === u.locale)) {
|
|
4275
|
+
throw new ConfigError(`source "${u.source.path}" has locale "${u.locale}" which is not declared in locales`);
|
|
4276
|
+
}
|
|
4277
|
+
}
|
|
4278
|
+
const namespaces = isNamespaceAxisActive(cfg.sources.filter((s) => !s.mount));
|
|
4279
|
+
const products = namespaces && (versionAxis || localeAxis);
|
|
4280
|
+
for (const s of cfg.sources) {
|
|
4281
|
+
if (s.from === "openapi" && cfg.sources.length > 1 && !s.name && !s.mount) throw new ConfigError(`content.sources[${s.path}]: an OpenAPI source beside other sources needs a name: or a mount:, so its pages do not land on theirs`);
|
|
4282
|
+
}
|
|
4283
|
+
const units = /* @__PURE__ */ new Map();
|
|
4284
|
+
for (const u of withDefaults) {
|
|
4285
|
+
const atRoot = cfg.versions.find((v) => v.id === u.version)?.path === "";
|
|
4286
|
+
const product = products && !u.source.mount ? sourceNamespace(u.source) : void 0;
|
|
4287
|
+
const prefix = [product, localeAxis ? u.locale : void 0, versionAxis && !atRoot ? u.version : void 0].filter(Boolean).join("/");
|
|
4288
|
+
const member = u.source.mount ? { source: u.source, namespace: "", mount: u.source.mount } : { source: u.source, namespace: products ? "" : namespaceSegments(u.source, cfg.sources).join("/") };
|
|
4289
|
+
const unit = units.get(prefix);
|
|
4290
|
+
if (!unit) {
|
|
4291
|
+
units.set(prefix, { source: u.source, members: [member], version: versionAxis ? u.version : void 0, ...versionAxis && u.version ? { versionPath: atRoot ? "" : u.version } : {}, locale: localeAxis ? u.locale : void 0, ...product ? { product } : {}, prefix });
|
|
4292
|
+
continue;
|
|
4293
|
+
}
|
|
4294
|
+
if (member.mount) {
|
|
4295
|
+
const taken = unit.members.find((m) => m.mount === member.mount);
|
|
4296
|
+
if (taken) throw new ConfigError(`two sources are mounted at "${member.mount}" in the same version and locale (${taken.source.path}, ${u.source.path})`);
|
|
4297
|
+
} else if (unit.members.some((m) => !m.mount)) {
|
|
4298
|
+
if (products) throw new ConfigError(`two sources publish to "${prefix || "/"}" (${unit.members.find((m) => !m.mount).source.path}, ${u.source.path}): give each its own name, version or locale`);
|
|
4299
|
+
if (!namespaces) throw new ConfigError(`two sources publish to the same prefix "${prefix || "/"}"`);
|
|
4300
|
+
if (unit.members.some((m) => !m.mount && m.namespace === member.namespace)) {
|
|
4301
|
+
throw new ConfigError(member.namespace ? `two sources are named "${member.namespace}"` : `two unnamed sources publish to the same prefix "${prefix || "/"}"`);
|
|
4302
|
+
}
|
|
4303
|
+
}
|
|
4304
|
+
unit.members.push(member);
|
|
4305
|
+
const main = unit.members.find((m) => m.source === unit.source);
|
|
4306
|
+
if (!member.namespace && !member.mount && (main.namespace || main.mount)) unit.source = u.source;
|
|
4307
|
+
}
|
|
4308
|
+
if (products) {
|
|
4309
|
+
const names = new Set([...units.values()].map((u) => u.product).filter(Boolean));
|
|
4310
|
+
for (const unit of units.values()) {
|
|
4311
|
+
const main = unit.members.find((m) => !m.mount);
|
|
4312
|
+
for (const m of unit.members.filter((x) => x.mount)) {
|
|
4313
|
+
if (!main) throw new ConfigError(`content.sources[${m.source.path}]: a mounted source goes beside the unnamed source of its version and locale, and there is none at "${unit.prefix || "/"}"; a mount inside a named source's version is not supported yet`);
|
|
4314
|
+
if (names.has(m.mount.split("/")[0])) throw new ConfigError(`content.sources[${m.source.path}]: mount "${m.mount}" starts with the name of a source, where that source's pages are; mount it elsewhere`);
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
}
|
|
4318
|
+
for (const unit of units.values()) {
|
|
4319
|
+
for (const m of unit.members) {
|
|
4320
|
+
const ns = m.mount && unit.members.find((o) => o.namespace && m.mount.split("/")[0] === o.namespace);
|
|
4321
|
+
if (ns) throw new ConfigError(`content.sources[${m.source.path}]: mount "${m.mount}" is inside the folder of the source named "${ns.namespace}"; mount it elsewhere`);
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
return [...units.values()];
|
|
4325
|
+
}
|
|
4326
|
+
function productUnits(cfg, model) {
|
|
4327
|
+
const units = /* @__PURE__ */ new Map();
|
|
4328
|
+
for (const s of cfg.sources) {
|
|
4329
|
+
const key = shared(() => sourceUnit(model, s, cfg.defaultLocale));
|
|
4330
|
+
const prefix = shared(() => unitSegments(model, key)).join("/");
|
|
4331
|
+
const member = s.mount ? { source: s, namespace: "", mount: s.mount } : { source: s, namespace: "" };
|
|
4332
|
+
const unit = units.get(prefix);
|
|
4333
|
+
if (!unit) {
|
|
4334
|
+
const versionPath = key.version === void 0 ? void 0 : shared(() => productOf(model, key.product)).versions.find((v) => v.id === key.version)?.path;
|
|
4335
|
+
units.set(prefix, {
|
|
4336
|
+
source: s,
|
|
4337
|
+
members: [member],
|
|
4338
|
+
...key.version !== void 0 ? { version: key.version, versionPath } : {},
|
|
4339
|
+
...key.locale !== void 0 ? { locale: key.locale } : {},
|
|
4340
|
+
...key.product ? { product: key.product } : {},
|
|
4341
|
+
prefix
|
|
4342
|
+
});
|
|
4343
|
+
continue;
|
|
4344
|
+
}
|
|
4345
|
+
if (member.mount) {
|
|
4346
|
+
const taken = unit.members.find((m) => m.mount === member.mount);
|
|
4347
|
+
if (taken) throw new ConfigError(`two sources are mounted at "${member.mount}" in the same version and locale (${taken.source.path}, ${s.path})`);
|
|
4348
|
+
} else if (unit.members.some((m) => !m.mount)) {
|
|
4349
|
+
throw new ConfigError(`two sources publish to "${prefix || "/"}" (${unit.members.find((m) => !m.mount).source.path}, ${s.path}): give each its own name, version or locale`);
|
|
4350
|
+
}
|
|
4351
|
+
unit.members.push(member);
|
|
4352
|
+
if (!member.mount) unit.source = s;
|
|
4353
|
+
}
|
|
4354
|
+
const names = new Set(model.products.map((p) => p.name).filter(Boolean));
|
|
4355
|
+
for (const unit of units.values()) {
|
|
4356
|
+
if (unit.prefix !== "") continue;
|
|
4357
|
+
for (const m of unit.members) {
|
|
4358
|
+
if (m.mount && names.has(m.mount.split("/")[0])) throw new ConfigError(`content.sources[${m.source.path}]: mount "${m.mount}" starts with the name of a product, where that product's pages are; mount it elsewhere`);
|
|
4359
|
+
}
|
|
4360
|
+
}
|
|
4361
|
+
return [...units.values()];
|
|
4362
|
+
}
|
|
4363
|
+
function memberPaths(unit, projectPath2) {
|
|
4364
|
+
let len = -1;
|
|
4365
|
+
let found = [];
|
|
4366
|
+
for (const m of unit.members) {
|
|
4367
|
+
if (m.source.from === "openapi") continue;
|
|
4368
|
+
const root = sourceRoot(m.source);
|
|
4369
|
+
if (!projectPath2.startsWith(root) || root.length < len) continue;
|
|
4370
|
+
if (root.length > len) {
|
|
4371
|
+
len = root.length;
|
|
4372
|
+
found = [];
|
|
4373
|
+
}
|
|
4374
|
+
found.push({ member: m, rel: projectPath2.slice(root.length) });
|
|
4375
|
+
}
|
|
4376
|
+
return found.map((f) => ({ member: f.member, path: f.member.namespace ? `${f.member.namespace}/${f.rel}` : f.rel }));
|
|
4377
|
+
}
|
|
4378
|
+
function memberPath(unit, projectPath2) {
|
|
4379
|
+
let best;
|
|
4380
|
+
for (const m of unit.members) {
|
|
4381
|
+
if (m.source.from === "openapi") continue;
|
|
4382
|
+
const root = sourceRoot(m.source);
|
|
4383
|
+
if (projectPath2.startsWith(root) && (!best || root.length > best.len)) best = { member: m, rel: projectPath2.slice(root.length), len: root.length };
|
|
4384
|
+
}
|
|
4385
|
+
if (!best) return void 0;
|
|
4386
|
+
return { member: best.member, path: best.member.namespace ? `${best.member.namespace}/${best.rel}` : best.rel };
|
|
4387
|
+
}
|
|
4388
|
+
function projectPath(unit, path) {
|
|
4389
|
+
for (const m of unit.members) {
|
|
4390
|
+
if (m.namespace && m.source.from !== "openapi" && (path === m.namespace || path.startsWith(m.namespace + "/"))) return sourceRoot(m.source) + path.slice(m.namespace.length + 1);
|
|
4391
|
+
}
|
|
4392
|
+
return sourceRoot(unit.source) + path;
|
|
4393
|
+
}
|
|
4394
|
+
var MENU_FILE = /(?:^|\/|\.)nav\.(?:ya?ml|json)$/i;
|
|
4395
|
+
function sourceNav(v, path, from) {
|
|
4396
|
+
const p = typeof v === "string" ? v.replace(/^\.\//, "") : "";
|
|
4397
|
+
if (from === "openapi") throw new ConfigError(`content.sources (${path}): nav is for a Markdown source; an OpenAPI source's nav comes from its spec`);
|
|
4398
|
+
if (!p || p.startsWith("/") || p.split("/").includes("..")) throw new ConfigError(`content.sources (${path}): nav must be a path inside the project, such as menus/guide.nav.yml; got ${JSON.stringify(v)}`);
|
|
4399
|
+
if (!/\.(ya?ml|json)$/i.test(p)) throw new ConfigError(`content.sources (${path}): nav must be a menu file, .yml or .json; got ${JSON.stringify(v)}`);
|
|
4400
|
+
return p;
|
|
4401
|
+
}
|
|
4402
|
+
function projectRoots(cfg) {
|
|
4403
|
+
const roots = cfg.sources.map((s) => s.path === "." ? "" : s.path);
|
|
4404
|
+
const dataDirs = [cfg.dataDir, ...cfg.sources.flatMap((s) => s.data ? [s.data] : [])].filter((d) => !!d);
|
|
4405
|
+
if (roots.includes("")) return [.../* @__PURE__ */ new Set(["", ...dataDirs, ...cfg.examplesDir ? [cfg.examplesDir] : []])];
|
|
4406
|
+
const navDirs = cfg.sources.flatMap((s) => s.nav ? [s.nav.includes("/") ? s.nav.slice(0, s.nav.lastIndexOf("/")) : s.nav] : []);
|
|
4407
|
+
const logos = cfg.chrome.logo ? [cfg.chrome.logo.light, ...cfg.chrome.logo.dark ? [cfg.chrome.logo.dark] : []] : [];
|
|
4408
|
+
return [.../* @__PURE__ */ new Set([...roots, cfg.themeDir, ...cfg.css, ...navDirs, ...dataDirs, ...cfg.staticDir ? [cfg.staticDir] : [], ...cfg.examplesDir ? [cfg.examplesDir] : [], ...logos])].filter(Boolean);
|
|
4409
|
+
}
|
|
4410
|
+
function dataFolder(what, v) {
|
|
4411
|
+
if (typeof v !== "string" || !v.trim()) throw new ConfigError(`${what} must be a folder inside the project, such as ./data; got ${JSON.stringify(v)}`);
|
|
4412
|
+
const p = insideProject(what, v.trim()).replace(/^(\.\/)+/, "").replace(/\/+$/, "");
|
|
4413
|
+
if (!p || p === ".") throw new ConfigError(`${what} must be a folder inside the project, not the project itself (every file would be a data file)`);
|
|
4414
|
+
return p;
|
|
4415
|
+
}
|
|
4416
|
+
function inDataFolder(cfg, path) {
|
|
4417
|
+
return [cfg.dataDir, ...cfg.sources.flatMap((s) => s.data ? [s.data] : []), ...cfg.examplesDir ? [cfg.examplesDir] : []].some((d) => path.startsWith(`${d}/`));
|
|
4418
|
+
}
|
|
4419
|
+
function examplesFolder(v) {
|
|
4420
|
+
if (typeof v !== "string" || !v.trim()) throw new ConfigError(`content.examples must be a folder inside the project, such as node_modules/@dogsbay/samples/examples; got ${JSON.stringify(v)}`);
|
|
4421
|
+
const p = insideProject("content.examples", v.trim()).replace(/^(\.\/)+/, "").replace(/\/+$/, "");
|
|
4422
|
+
if (!p || p === ".") throw new ConfigError("content.examples must be a folder inside the project, not the project itself (its pages would be read as examples)");
|
|
4423
|
+
return p;
|
|
4424
|
+
}
|
|
4425
|
+
function staticFolder(v) {
|
|
4426
|
+
if (typeof v !== "string" || !v.trim()) throw new ConfigError(`content.static must be a folder inside the project, such as ./static; got ${JSON.stringify(v)}`);
|
|
4427
|
+
const p = insideProject("content.static", v.trim()).replace(/^(\.\/)+/, "").replace(/\/+$/, "");
|
|
4428
|
+
if (!p || p === ".") throw new ConfigError("content.static must be a folder inside the project, not the project itself (every file would be served as it is)");
|
|
4429
|
+
return p;
|
|
4430
|
+
}
|
|
4431
|
+
function dataDirOf(cfg, s) {
|
|
4432
|
+
return s.data ?? cfg.dataDir;
|
|
4433
|
+
}
|
|
4434
|
+
function sourceRoot(s) {
|
|
4435
|
+
return s.path === "." ? "" : s.path.replace(/^\.\//, "").replace(/\/+$/, "") + "/";
|
|
4436
|
+
}
|
|
4437
|
+
|
|
4438
|
+
export {
|
|
4439
|
+
jsonLdTypeFor,
|
|
4440
|
+
buildArticleJsonLd,
|
|
4441
|
+
buildWebSiteJsonLd,
|
|
4442
|
+
buildBreadcrumbJsonLd,
|
|
4443
|
+
truncate,
|
|
4444
|
+
escapeXml,
|
|
4445
|
+
dateField,
|
|
4446
|
+
lastmodOf,
|
|
4447
|
+
jsonForScript,
|
|
4448
|
+
buildRobotsTxt,
|
|
4449
|
+
buildHeadersFile,
|
|
4450
|
+
buildSitemaps,
|
|
4451
|
+
buildSitemapIndex,
|
|
4452
|
+
buildLlmsTxt,
|
|
4453
|
+
buildSectionLlmsTxt,
|
|
4454
|
+
llmsFullOrder,
|
|
4455
|
+
llmsFullChunks,
|
|
4456
|
+
resolveRedirects,
|
|
4457
|
+
renderRedirectsFile,
|
|
4458
|
+
renderRedirectStub,
|
|
4459
|
+
decideCanonical,
|
|
4460
|
+
buildHreflangLinks,
|
|
4461
|
+
missingTranslations,
|
|
4462
|
+
translationFallbacks,
|
|
4463
|
+
UNTRANSLATED,
|
|
4464
|
+
placeFallbackInNav,
|
|
4465
|
+
htmlIsText,
|
|
4466
|
+
rewriteTreeLinks,
|
|
4467
|
+
escAttr,
|
|
4468
|
+
prefixSlug,
|
|
4469
|
+
localeLink,
|
|
4470
|
+
namespacePrefixes,
|
|
4471
|
+
namespaceNavGroup,
|
|
4472
|
+
rewriteContentRefs,
|
|
4473
|
+
mountSlug,
|
|
4474
|
+
isMountRoot,
|
|
4475
|
+
mountRefs,
|
|
4476
|
+
placeMountedNav,
|
|
4477
|
+
mountRootNote,
|
|
4478
|
+
limitVersionRows,
|
|
4479
|
+
unitKeyString,
|
|
4480
|
+
unitOf,
|
|
4481
|
+
productRootRedirects,
|
|
4482
|
+
siteRootTarget,
|
|
4483
|
+
productSwitcher,
|
|
4484
|
+
unitManifest,
|
|
4485
|
+
siteFiles,
|
|
4486
|
+
toScript,
|
|
4487
|
+
staticPathServed,
|
|
4488
|
+
isPassiveStaticFile,
|
|
4489
|
+
passiveSvgBytes,
|
|
4490
|
+
PASSIVE_SVG_MAX_BYTES,
|
|
4491
|
+
staticFolderPlan,
|
|
4492
|
+
staticRobotsWarnings,
|
|
4493
|
+
mergeRedirects,
|
|
4494
|
+
mergeHeaders,
|
|
4495
|
+
inlineMarkdownHtml,
|
|
4496
|
+
isChromeMenu,
|
|
4497
|
+
pageFacets,
|
|
4498
|
+
postsNewestFirst,
|
|
4499
|
+
postsInDateOrder,
|
|
4500
|
+
scopeNav,
|
|
4501
|
+
sectionMenu,
|
|
4502
|
+
markUnlisted,
|
|
4503
|
+
listedNav,
|
|
4504
|
+
listedLocations,
|
|
4505
|
+
compileIgnoreRules,
|
|
4506
|
+
pairVersions,
|
|
4507
|
+
matchPages,
|
|
4508
|
+
changeMarks,
|
|
4509
|
+
createSummary,
|
|
4510
|
+
titleOf,
|
|
4511
|
+
flat,
|
|
4512
|
+
pageKey,
|
|
4513
|
+
compareRelease,
|
|
4514
|
+
releasePage,
|
|
4515
|
+
releaseBaseline,
|
|
4516
|
+
loadYaml,
|
|
4517
|
+
shared,
|
|
4518
|
+
versionsOf,
|
|
4519
|
+
declaresCompare,
|
|
4520
|
+
ConfigError,
|
|
4521
|
+
parseConfig,
|
|
4522
|
+
unitOfPath,
|
|
4523
|
+
groupPrefix,
|
|
4524
|
+
sameProduct,
|
|
4525
|
+
buildUnits,
|
|
4526
|
+
memberPaths,
|
|
4527
|
+
memberPath,
|
|
4528
|
+
projectPath,
|
|
4529
|
+
MENU_FILE,
|
|
4530
|
+
projectRoots,
|
|
4531
|
+
inDataFolder,
|
|
4532
|
+
dataDirOf,
|
|
4533
|
+
sourceRoot
|
|
4534
|
+
};
|