@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,807 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
|
+
|
|
4
|
+
// node_modules/@dogsbay/tree-diff/dist/compare.js
|
|
5
|
+
var ADDRESS_PROPS = /* @__PURE__ */ new Set(["href", "src", "url", "link", "poster", "icon"]);
|
|
6
|
+
var TEXT_PROPS = /* @__PURE__ */ new Set(["title", "label", "description", "alt", "caption", "summary"]);
|
|
7
|
+
var markup = (cv, v) => cv("href", cv("text", v));
|
|
8
|
+
var inlineCode = (cv, v) => cv("code", cv("text", v));
|
|
9
|
+
function scrubProps(props, cv) {
|
|
10
|
+
const out = {};
|
|
11
|
+
for (const [k, v] of Object.entries(props)) {
|
|
12
|
+
out[k] = typeof v !== "string" ? v : ADDRESS_PROPS.has(k) ? cv("href", v) : TEXT_PROPS.has(k) ? cv("text", v) : v;
|
|
13
|
+
}
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
16
|
+
function scrubInline(span, cv) {
|
|
17
|
+
const out = { ...span };
|
|
18
|
+
if (typeof span.text === "string")
|
|
19
|
+
out.text = span.type === "code" ? inlineCode(cv, span.text) : cv("text", span.text);
|
|
20
|
+
if (typeof span.html === "string")
|
|
21
|
+
out.html = markup(cv, span.html);
|
|
22
|
+
if (typeof span.href === "string")
|
|
23
|
+
out.href = cv("href", span.href);
|
|
24
|
+
if (typeof span.src === "string")
|
|
25
|
+
out.src = cv("href", span.src);
|
|
26
|
+
if (typeof span.alt === "string")
|
|
27
|
+
out.alt = cv("text", span.alt);
|
|
28
|
+
if (typeof span.title === "string")
|
|
29
|
+
out.title = cv("text", span.title);
|
|
30
|
+
if (typeof span.latex === "string")
|
|
31
|
+
out.latex = cv("text", span.latex);
|
|
32
|
+
if (Array.isArray(span.keys))
|
|
33
|
+
out.keys = span.keys.map((k) => typeof k === "string" ? cv("text", k) : k);
|
|
34
|
+
if (Array.isArray(span.children))
|
|
35
|
+
out.children = span.children.map((c) => scrubInline(c, cv));
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
function scrubNode(node, cv, cache) {
|
|
39
|
+
const hit = cache?.get(node);
|
|
40
|
+
if (hit)
|
|
41
|
+
return hit;
|
|
42
|
+
const out = { ...node };
|
|
43
|
+
if (typeof node.html === "string")
|
|
44
|
+
out.html = node.type === "code" ? cv("code", node.html) : markup(cv, node.html);
|
|
45
|
+
if (node.props)
|
|
46
|
+
out.props = scrubProps(node.props, cv);
|
|
47
|
+
if (node.inline)
|
|
48
|
+
out.inline = node.inline.map((s) => scrubInline(s, cv));
|
|
49
|
+
if (node.children)
|
|
50
|
+
out.children = node.children.map((c) => scrubNode(c, cv, cache));
|
|
51
|
+
cache?.set(node, out);
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
function runningText(cv) {
|
|
55
|
+
return (_kind, v) => inlineCode(cv, v);
|
|
56
|
+
}
|
|
57
|
+
function equalizeSegments(segments, cv, kind = "text") {
|
|
58
|
+
const parts = [];
|
|
59
|
+
for (const s of segments) {
|
|
60
|
+
if (s.op === "eq") {
|
|
61
|
+
parts.push(s);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const last = parts[parts.length - 1];
|
|
65
|
+
const hunk = last && !("op" in last) ? last : { del: "", ins: "" };
|
|
66
|
+
if (hunk !== last)
|
|
67
|
+
parts.push(hunk);
|
|
68
|
+
if (s.op === "del")
|
|
69
|
+
hunk.del += s.text;
|
|
70
|
+
else
|
|
71
|
+
hunk.ins += s.text;
|
|
72
|
+
}
|
|
73
|
+
const newText = parts.map((p) => "op" in p ? p.text : p.ins).join("");
|
|
74
|
+
const target = cv(kind, newText);
|
|
75
|
+
let ignored = 0;
|
|
76
|
+
const out = [];
|
|
77
|
+
const push = (s) => {
|
|
78
|
+
const last = out[out.length - 1];
|
|
79
|
+
if (last && last.op === s.op)
|
|
80
|
+
last.text += s.text;
|
|
81
|
+
else
|
|
82
|
+
out.push({ ...s });
|
|
83
|
+
};
|
|
84
|
+
parts.forEach((p, i) => {
|
|
85
|
+
if ("op" in p)
|
|
86
|
+
return push(p);
|
|
87
|
+
const withOld = parts.map((q, j) => "op" in q ? q.text : j === i ? q.del : q.ins).join("");
|
|
88
|
+
if (cv(kind, withOld) === target) {
|
|
89
|
+
ignored++;
|
|
90
|
+
if (p.ins)
|
|
91
|
+
push({ op: "eq", text: p.ins });
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (p.del)
|
|
95
|
+
push({ op: "del", text: p.del });
|
|
96
|
+
if (p.ins)
|
|
97
|
+
push({ op: "ins", text: p.ins });
|
|
98
|
+
});
|
|
99
|
+
return { segments: out, ignored };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// node_modules/@dogsbay/tree-diff/dist/text.js
|
|
103
|
+
function decodeNumericEntities(s) {
|
|
104
|
+
return s.replace(/&#(\d+);/g, (m, d) => {
|
|
105
|
+
const cp = Number(d);
|
|
106
|
+
return cp <= 1114111 ? String.fromCodePoint(cp) : m;
|
|
107
|
+
}).replace(/&#x([0-9a-f]+);/gi, (m, h) => {
|
|
108
|
+
const cp = parseInt(h, 16);
|
|
109
|
+
return cp <= 1114111 ? String.fromCodePoint(cp) : m;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function nodeText(node) {
|
|
113
|
+
const parts = [];
|
|
114
|
+
if (node.inline)
|
|
115
|
+
parts.push(inlineText(node.inline));
|
|
116
|
+
else if (typeof node.html === "string") {
|
|
117
|
+
parts.push(decodeNumericEntities(node.html.replace(/<[^>]+>/g, "")));
|
|
118
|
+
}
|
|
119
|
+
for (const child of node.children ?? [])
|
|
120
|
+
parts.push(nodeText(child));
|
|
121
|
+
return parts.join(" ").replace(/\s+/g, " ").trim();
|
|
122
|
+
}
|
|
123
|
+
function inlineText(spans) {
|
|
124
|
+
return spans.map((s) => {
|
|
125
|
+
switch (s.type) {
|
|
126
|
+
case "text":
|
|
127
|
+
case "code":
|
|
128
|
+
return s.text ?? "";
|
|
129
|
+
case "link":
|
|
130
|
+
return inlineText(s.children ?? []);
|
|
131
|
+
default:
|
|
132
|
+
return s.text ?? "";
|
|
133
|
+
}
|
|
134
|
+
}).join("");
|
|
135
|
+
}
|
|
136
|
+
function tokenize(text) {
|
|
137
|
+
return text.match(/\S+\s*/g) ?? [];
|
|
138
|
+
}
|
|
139
|
+
var WORD_DIFF_MAX_TOKENS = 1500;
|
|
140
|
+
function wordDiff(oldText, newText) {
|
|
141
|
+
const a = tokenize(oldText);
|
|
142
|
+
const b = tokenize(newText);
|
|
143
|
+
const m = a.length;
|
|
144
|
+
const n = b.length;
|
|
145
|
+
if (m > WORD_DIFF_MAX_TOKENS || n > WORD_DIFF_MAX_TOKENS)
|
|
146
|
+
return null;
|
|
147
|
+
const lcs = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
|
|
148
|
+
for (let i2 = m - 1; i2 >= 0; i2--) {
|
|
149
|
+
for (let j2 = n - 1; j2 >= 0; j2--) {
|
|
150
|
+
lcs[i2][j2] = a[i2].trim() === b[j2].trim() ? lcs[i2 + 1][j2 + 1] + 1 : Math.max(lcs[i2 + 1][j2], lcs[i2][j2 + 1]);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const segments = [];
|
|
154
|
+
const push = (op, text) => {
|
|
155
|
+
const last = segments[segments.length - 1];
|
|
156
|
+
if (last && last.op === op)
|
|
157
|
+
last.text += text;
|
|
158
|
+
else
|
|
159
|
+
segments.push({ op, text });
|
|
160
|
+
};
|
|
161
|
+
let i = 0;
|
|
162
|
+
let j = 0;
|
|
163
|
+
while (i < m && j < n) {
|
|
164
|
+
if (a[i].trim() === b[j].trim()) {
|
|
165
|
+
push("eq", b[j]);
|
|
166
|
+
i++;
|
|
167
|
+
j++;
|
|
168
|
+
} else if (lcs[i + 1][j] >= lcs[i][j + 1]) {
|
|
169
|
+
push("del", a[i]);
|
|
170
|
+
i++;
|
|
171
|
+
} else {
|
|
172
|
+
push("ins", b[j]);
|
|
173
|
+
j++;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
while (i < m)
|
|
177
|
+
push("del", a[i++]);
|
|
178
|
+
while (j < n)
|
|
179
|
+
push("ins", b[j++]);
|
|
180
|
+
return segments;
|
|
181
|
+
}
|
|
182
|
+
function similarity(a, b) {
|
|
183
|
+
if (a === b)
|
|
184
|
+
return 1;
|
|
185
|
+
const ta = new Set(a.toLowerCase().split(/\s+/).filter(Boolean));
|
|
186
|
+
const tb = new Set(b.toLowerCase().split(/\s+/).filter(Boolean));
|
|
187
|
+
if (ta.size === 0 && tb.size === 0)
|
|
188
|
+
return 1;
|
|
189
|
+
let common = 0;
|
|
190
|
+
for (const t of ta)
|
|
191
|
+
if (tb.has(t))
|
|
192
|
+
common++;
|
|
193
|
+
return common / Math.max(ta.size, tb.size);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// node_modules/@dogsbay/tree-diff/dist/diff.js
|
|
197
|
+
var PROSE_TYPES = /* @__PURE__ */ new Set(["paragraph", "blockquote", "list-item", "li"]);
|
|
198
|
+
var CONTAINER_TYPES = /* @__PURE__ */ new Set([
|
|
199
|
+
"callout",
|
|
200
|
+
"tabs",
|
|
201
|
+
"tab",
|
|
202
|
+
"steps",
|
|
203
|
+
"step",
|
|
204
|
+
"details",
|
|
205
|
+
"blockquote",
|
|
206
|
+
// lists recurse so their ITEMS prose-diff individually — the
|
|
207
|
+
// endpoint request-body rows (`- \`password\` … — required`) are
|
|
208
|
+
// list items, and the required→optional drift must surface as
|
|
209
|
+
// word-level marks, not an opaque changed list.
|
|
210
|
+
"unordered-list",
|
|
211
|
+
"ordered-list"
|
|
212
|
+
]);
|
|
213
|
+
var SIMILARITY_THRESHOLD = 0.5;
|
|
214
|
+
function headingText(node) {
|
|
215
|
+
return nodeText(node);
|
|
216
|
+
}
|
|
217
|
+
function sectionize(nodes, compareText = headingText) {
|
|
218
|
+
const root = { path: [], key: "", heading: null, level: 0, blocks: [], children: [] };
|
|
219
|
+
const stack = [root];
|
|
220
|
+
for (const node of nodes) {
|
|
221
|
+
if (node.type === "heading") {
|
|
222
|
+
const level = Number(node.props?.level ?? 1);
|
|
223
|
+
while (stack.length > 1 && stack[stack.length - 1].level >= level)
|
|
224
|
+
stack.pop();
|
|
225
|
+
const parent = stack[stack.length - 1];
|
|
226
|
+
const section = {
|
|
227
|
+
path: [...parent.path, headingText(node)],
|
|
228
|
+
key: compareText(node),
|
|
229
|
+
heading: node,
|
|
230
|
+
level,
|
|
231
|
+
blocks: [],
|
|
232
|
+
children: []
|
|
233
|
+
};
|
|
234
|
+
parent.children.push(section);
|
|
235
|
+
stack.push(section);
|
|
236
|
+
} else {
|
|
237
|
+
stack[stack.length - 1].blocks.push(node);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return root;
|
|
241
|
+
}
|
|
242
|
+
var WHERE_AND_HOW = /* @__PURE__ */ new Set(["line", "endLine", "source", "form", "closer", "delimiter", "marker", "indented", "fence", "row", "idGenerated", "pageId"]);
|
|
243
|
+
var withoutLines = (key, value) => {
|
|
244
|
+
if (key !== "meta" || !value || typeof value !== "object")
|
|
245
|
+
return value;
|
|
246
|
+
const meta = value;
|
|
247
|
+
if (!Object.keys(meta).some((k) => WHERE_AND_HOW.has(k)))
|
|
248
|
+
return value;
|
|
249
|
+
const rest = Object.fromEntries(Object.entries(meta).filter(([k]) => !WHERE_AND_HOW.has(k)));
|
|
250
|
+
return Object.keys(rest).length ? rest : void 0;
|
|
251
|
+
};
|
|
252
|
+
var sameContent = (a, b) => JSON.stringify(a, withoutLines) === JSON.stringify(b, withoutLines);
|
|
253
|
+
var mark = (node, diff, extra) => ({
|
|
254
|
+
...node,
|
|
255
|
+
diff,
|
|
256
|
+
...extra
|
|
257
|
+
});
|
|
258
|
+
var hasAnyMark = (node) => Boolean(node.diff || node.diffInline) || (node.children ?? []).some(hasAnyMark);
|
|
259
|
+
var HIDDEN_CONTAINERS = /* @__PURE__ */ new Set(["tabs", "tab", "details"]);
|
|
260
|
+
var stripBlockMarks = (node) => {
|
|
261
|
+
const keep = node.type === "code" || !node.diffInline;
|
|
262
|
+
const out = {
|
|
263
|
+
...node,
|
|
264
|
+
...node.children ? { children: node.children.map(stripBlockMarks) } : {}
|
|
265
|
+
};
|
|
266
|
+
if (!keep && out.diff === "changed")
|
|
267
|
+
delete out.diff;
|
|
268
|
+
return out;
|
|
269
|
+
};
|
|
270
|
+
var Differ = class {
|
|
271
|
+
compareValue;
|
|
272
|
+
stats = {
|
|
273
|
+
sectionsAdded: 0,
|
|
274
|
+
sectionsRemoved: 0,
|
|
275
|
+
sectionsChanged: 0,
|
|
276
|
+
sectionsMoved: 0,
|
|
277
|
+
blocksChanged: 0
|
|
278
|
+
};
|
|
279
|
+
/** Each node's compare copy, made once (only with compareValue). */
|
|
280
|
+
scrubbed = /* @__PURE__ */ new WeakMap();
|
|
281
|
+
constructor(compareValue) {
|
|
282
|
+
this.compareValue = compareValue;
|
|
283
|
+
if (compareValue)
|
|
284
|
+
this.stats.ignored = 0;
|
|
285
|
+
}
|
|
286
|
+
/** The node as compared: itself, or its copy with the host's compare values. */
|
|
287
|
+
view(node) {
|
|
288
|
+
if (!this.compareValue)
|
|
289
|
+
return node;
|
|
290
|
+
return scrubNode(node, this.compareValue, this.scrubbed);
|
|
291
|
+
}
|
|
292
|
+
text(node) {
|
|
293
|
+
return nodeText(this.view(node));
|
|
294
|
+
}
|
|
295
|
+
/** Same content as compared; counts a difference the compare values made equal. */
|
|
296
|
+
same(a, b) {
|
|
297
|
+
if (!this.compareValue)
|
|
298
|
+
return sameContent(a, b);
|
|
299
|
+
if (!sameContent(this.view(a), this.view(b)))
|
|
300
|
+
return false;
|
|
301
|
+
if (!sameContent(a, b))
|
|
302
|
+
this.stats.ignored++;
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
/** The word diff of two texts, runs the compare values make equal shown as unchanged. */
|
|
306
|
+
words(oldText, newText) {
|
|
307
|
+
const segments = wordDiff(oldText, newText);
|
|
308
|
+
if (!segments || !this.compareValue)
|
|
309
|
+
return segments;
|
|
310
|
+
const { segments: out, ignored } = equalizeSegments(segments, runningText(this.compareValue));
|
|
311
|
+
this.stats.ignored += ignored;
|
|
312
|
+
return out;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* After the rules made every word run of a changed block equal: is that ALL that differed? The
|
|
316
|
+
* rules see a block's text whole when equalizing and piece by piece in the copies (a rule
|
|
317
|
+
* reaching across bold or a link), so the copies can differ only in text the word diff has
|
|
318
|
+
* already found equal. Then the block is unchanged as compared.
|
|
319
|
+
*/
|
|
320
|
+
onlyTextDiffered(a, b, segments) {
|
|
321
|
+
if (!this.compareValue || !segments || segments.some((s) => s.op !== "eq"))
|
|
322
|
+
return false;
|
|
323
|
+
const noText = (key, value) => key === "text" || key === "keys" ? void 0 : withoutLines(key, value);
|
|
324
|
+
return JSON.stringify(this.view(a), noText) === JSON.stringify(this.view(b), noText);
|
|
325
|
+
}
|
|
326
|
+
/** Stable content fingerprint of a section (its own blocks + subtree). */
|
|
327
|
+
fingerprint(s) {
|
|
328
|
+
const parts = [s.blocks.map((b) => this.text(b)).join("")];
|
|
329
|
+
for (const c of s.children)
|
|
330
|
+
parts.push(c.key, this.fingerprint(c));
|
|
331
|
+
return parts.join("");
|
|
332
|
+
}
|
|
333
|
+
/** Removed old-side sections, indexed for move detection. */
|
|
334
|
+
removedByFingerprint = /* @__PURE__ */ new Map();
|
|
335
|
+
/** heading text → ALL removed sections with that heading (no last-writer-wins). */
|
|
336
|
+
removedByHeading = /* @__PURE__ */ new Map();
|
|
337
|
+
/** removed old-side section → the old-side section it sat in. */
|
|
338
|
+
removedParent = /* @__PURE__ */ new Map();
|
|
339
|
+
/** added new-side section → the old-side section it relocates. */
|
|
340
|
+
moveClaims = /* @__PURE__ */ new Map();
|
|
341
|
+
diff(oldTree, newTree) {
|
|
342
|
+
const name = (n) => this.text(n);
|
|
343
|
+
const oldRoot = sectionize(oldTree, name);
|
|
344
|
+
const newRoot = sectionize(newTree, name);
|
|
345
|
+
this.indexRemoved(oldRoot, newRoot);
|
|
346
|
+
this.claimMoves(oldRoot, newRoot);
|
|
347
|
+
return this.diffSectionInto(oldRoot, newRoot);
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Sibling keys are occurrence-disambiguated (`name#n`, mirroring
|
|
351
|
+
* blockKeys) — duplicate heading texts among siblings must not
|
|
352
|
+
* collapse in a Map (a page diffed against itself must be
|
|
353
|
+
* unchanged).
|
|
354
|
+
*/
|
|
355
|
+
childKeys(sec) {
|
|
356
|
+
const seen = /* @__PURE__ */ new Map();
|
|
357
|
+
const out = /* @__PURE__ */ new Map();
|
|
358
|
+
for (const c of sec.children) {
|
|
359
|
+
const name = c.key;
|
|
360
|
+
const n = seen.get(name) ?? 0;
|
|
361
|
+
seen.set(name, n + 1);
|
|
362
|
+
out.set(`${name}#${n}`, c);
|
|
363
|
+
}
|
|
364
|
+
return out;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Pre-pass 2: added new-side sections claim removed old-side
|
|
368
|
+
* sections as MOVES — globally, before any emission, so a parent's
|
|
369
|
+
* removed loop can't emit a section that relocates deeper in the
|
|
370
|
+
* tree. Guards (review findings 1–2):
|
|
371
|
+
* - claims require identical content (fingerprint) OR same heading
|
|
372
|
+
* text WITH similar content — a coincidental name never claims;
|
|
373
|
+
* - claims never recurse INTO an unclaimed added subtree, because
|
|
374
|
+
* emitSection renders added subtrees whole and a claim there
|
|
375
|
+
* would silently swallow the removed section's content.
|
|
376
|
+
*/
|
|
377
|
+
claimMoves(oldSec, newSec) {
|
|
378
|
+
const oldKeys = this.childKeys(oldSec);
|
|
379
|
+
const newKeys = this.childKeys(newSec);
|
|
380
|
+
for (const [key, newChild] of newKeys) {
|
|
381
|
+
const match = oldKeys.get(key);
|
|
382
|
+
if (match) {
|
|
383
|
+
this.claimMoves(match, newChild);
|
|
384
|
+
continue;
|
|
385
|
+
}
|
|
386
|
+
const name = newChild.key;
|
|
387
|
+
const fp = this.fingerprint(newChild);
|
|
388
|
+
let moved = this.removedByFingerprint.get(fp);
|
|
389
|
+
if (moved?.claimedAsMove)
|
|
390
|
+
moved = void 0;
|
|
391
|
+
if (!moved) {
|
|
392
|
+
let best;
|
|
393
|
+
let bestScore = 0;
|
|
394
|
+
for (const cand of this.removedByHeading.get(name) ?? []) {
|
|
395
|
+
if (cand.claimedAsMove)
|
|
396
|
+
continue;
|
|
397
|
+
const score = similarity(this.fingerprint(cand), fp);
|
|
398
|
+
if (score > bestScore) {
|
|
399
|
+
best = cand;
|
|
400
|
+
bestScore = score;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
if (best && bestScore >= SIMILARITY_THRESHOLD)
|
|
404
|
+
moved = best;
|
|
405
|
+
}
|
|
406
|
+
if (moved) {
|
|
407
|
+
moved.claimedAsMove = true;
|
|
408
|
+
this.moveClaims.set(newChild, moved);
|
|
409
|
+
this.claimMoves(moved, newChild);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Pre-pass: find sections present only on the old side and index
|
|
415
|
+
* them, so additions elsewhere can claim them as MOVES.
|
|
416
|
+
*/
|
|
417
|
+
indexRemoved(oldSec, newSec) {
|
|
418
|
+
const oldKeys = this.childKeys(oldSec);
|
|
419
|
+
const newKeys = this.childKeys(newSec);
|
|
420
|
+
for (const [key, oldChild] of oldKeys) {
|
|
421
|
+
const match = newKeys.get(key);
|
|
422
|
+
if (match)
|
|
423
|
+
this.indexRemoved(oldChild, match);
|
|
424
|
+
else {
|
|
425
|
+
const name = oldChild.key;
|
|
426
|
+
this.removedParent.set(oldChild, oldSec);
|
|
427
|
+
this.removedByFingerprint.set(this.fingerprint(oldChild), oldChild);
|
|
428
|
+
const list = this.removedByHeading.get(name) ?? [];
|
|
429
|
+
list.push(oldChild);
|
|
430
|
+
this.removedByHeading.set(name, list);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
/** Union of one matched section pair, marks applied. */
|
|
435
|
+
diffSectionInto(oldSec, newSec) {
|
|
436
|
+
const out = [];
|
|
437
|
+
const blocksBefore = this.stats.blocksChanged;
|
|
438
|
+
out.push(...this.diffBlocks(oldSec.blocks, newSec.blocks));
|
|
439
|
+
if (this.stats.blocksChanged !== blocksBefore)
|
|
440
|
+
this.stats.sectionsChanged++;
|
|
441
|
+
const oldKeys = this.childKeys(oldSec);
|
|
442
|
+
const newKeys = this.childKeys(newSec);
|
|
443
|
+
for (const [key, oldChild] of oldKeys) {
|
|
444
|
+
if (newKeys.has(key))
|
|
445
|
+
continue;
|
|
446
|
+
if (oldChild.claimedAsMove)
|
|
447
|
+
continue;
|
|
448
|
+
this.stats.sectionsRemoved++;
|
|
449
|
+
out.push(...this.emitSection(oldChild, "removed"));
|
|
450
|
+
}
|
|
451
|
+
for (const [key, newChild] of newKeys) {
|
|
452
|
+
const oldChild = oldKeys.get(key);
|
|
453
|
+
if (oldChild) {
|
|
454
|
+
if (this.compareValue && oldChild.heading && newChild.heading && !sameContent(oldChild.heading, newChild.heading))
|
|
455
|
+
this.stats.ignored++;
|
|
456
|
+
const body = this.diffSectionInto(oldChild, newChild);
|
|
457
|
+
const changedInside = body.some(hasAnyMark);
|
|
458
|
+
if (newChild.heading) {
|
|
459
|
+
out.push(changedInside ? mark(newChild.heading, "changed") : { ...newChild.heading });
|
|
460
|
+
}
|
|
461
|
+
out.push(...body);
|
|
462
|
+
} else {
|
|
463
|
+
const moved = this.moveClaims.get(newChild);
|
|
464
|
+
if (moved) {
|
|
465
|
+
const oldWords = moved.heading ? nodeText(moved.heading) : void 0;
|
|
466
|
+
const newWords = newChild.heading ? nodeText(newChild.heading) : void 0;
|
|
467
|
+
const renamedFrom = oldWords !== void 0 && newWords !== void 0 && oldWords !== newWords ? oldWords : void 0;
|
|
468
|
+
const inPlace = renamedFrom !== void 0 && this.removedParent.get(moved) === oldSec;
|
|
469
|
+
if (inPlace)
|
|
470
|
+
this.stats.blocksChanged++;
|
|
471
|
+
else
|
|
472
|
+
this.stats.sectionsMoved++;
|
|
473
|
+
if (newChild.heading) {
|
|
474
|
+
const segments = renamedFrom !== void 0 ? this.words(renamedFrom, newWords) : null;
|
|
475
|
+
const renamed = renamedFrom !== void 0 ? { diffRenamedFrom: renamedFrom, ...segments ? { diffInline: segments } : {} } : {};
|
|
476
|
+
out.push(inPlace ? mark(newChild.heading, "changed", { diffMovedFrom: moved.path, ...renamed }) : mark(newChild.heading, "moved", { diffMovedFrom: moved.path, ...renamed }));
|
|
477
|
+
}
|
|
478
|
+
const changedBefore = this.stats.sectionsChanged;
|
|
479
|
+
out.push(...this.diffSectionInto(moved, newChild));
|
|
480
|
+
if (inPlace && this.stats.sectionsChanged === changedBefore)
|
|
481
|
+
this.stats.sectionsChanged++;
|
|
482
|
+
} else {
|
|
483
|
+
this.stats.sectionsAdded++;
|
|
484
|
+
out.push(...this.emitSection(newChild, "added"));
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return out;
|
|
489
|
+
}
|
|
490
|
+
/** Emit a whole section subtree under one mark (root-marked). */
|
|
491
|
+
emitSection(sec, diff) {
|
|
492
|
+
const out = [];
|
|
493
|
+
if (sec.heading)
|
|
494
|
+
out.push(mark(sec.heading, diff));
|
|
495
|
+
for (const block of sec.blocks)
|
|
496
|
+
out.push(mark(block, diff));
|
|
497
|
+
for (const child of sec.children)
|
|
498
|
+
out.push(...this.emitSection(child, diff));
|
|
499
|
+
return out;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Merge consecutive raw-HTML siblings into one block on BOTH sides
|
|
503
|
+
* before matching. Markdown parsers split one HTML structure (a
|
|
504
|
+
* hand-written table) into fragments at internal blank lines, and
|
|
505
|
+
* a blank line added upstream would otherwise shard the diff into
|
|
506
|
+
* "1 changed + N added" pieces of the same table (found via
|
|
507
|
+
* better-auth adapters/mysql). Joining with the original separator
|
|
508
|
+
* renders identically.
|
|
509
|
+
*/
|
|
510
|
+
coalesceHtml(blocks) {
|
|
511
|
+
const out = [];
|
|
512
|
+
for (const b of blocks) {
|
|
513
|
+
const prev = out[out.length - 1];
|
|
514
|
+
if (b.type === "html" && prev?.type === "html") {
|
|
515
|
+
out[out.length - 1] = { ...prev, html: `${prev.html ?? ""}
|
|
516
|
+
${b.html ?? ""}` };
|
|
517
|
+
} else {
|
|
518
|
+
out.push(b);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return out;
|
|
522
|
+
}
|
|
523
|
+
/** Match the non-heading blocks of one matched section pair. */
|
|
524
|
+
diffBlocks(oldBlocksIn, newBlocksIn) {
|
|
525
|
+
const oldBlocks = this.coalesceHtml(oldBlocksIn);
|
|
526
|
+
const newBlocks = this.coalesceHtml(newBlocksIn);
|
|
527
|
+
const out = [];
|
|
528
|
+
const usedOld = /* @__PURE__ */ new Set();
|
|
529
|
+
const oldKey = this.blockKeys(oldBlocks);
|
|
530
|
+
const newKey = this.blockKeys(newBlocks);
|
|
531
|
+
const oldByKey = /* @__PURE__ */ new Map();
|
|
532
|
+
oldKey.forEach((k, i) => {
|
|
533
|
+
if (k && !oldByKey.has(k))
|
|
534
|
+
oldByKey.set(k, i);
|
|
535
|
+
});
|
|
536
|
+
const matchedPairs = /* @__PURE__ */ new Map();
|
|
537
|
+
newKey.forEach((k, j) => {
|
|
538
|
+
if (!k)
|
|
539
|
+
return;
|
|
540
|
+
const i = oldByKey.get(k);
|
|
541
|
+
if (i !== void 0 && !usedOld.has(i)) {
|
|
542
|
+
matchedPairs.set(j, i);
|
|
543
|
+
usedOld.add(i);
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
const oldText = oldBlocks.map((b) => this.text(b));
|
|
547
|
+
const newText = newBlocks.map((b) => this.text(b));
|
|
548
|
+
const oldLeft = oldBlocks.map((_, i) => i).filter((i) => !usedOld.has(i) && !oldKey[i]);
|
|
549
|
+
const newLeft = newBlocks.map((_, j) => j).filter((j) => !matchedPairs.has(j) && !newKey[j]);
|
|
550
|
+
let ol = 0;
|
|
551
|
+
for (const j of newLeft) {
|
|
552
|
+
for (let k = ol; k < oldLeft.length; k++) {
|
|
553
|
+
const i = oldLeft[k];
|
|
554
|
+
if (oldBlocks[i].type === newBlocks[j].type && similarity(oldText[i], newText[j]) >= SIMILARITY_THRESHOLD) {
|
|
555
|
+
matchedPairs.set(j, i);
|
|
556
|
+
usedOld.add(i);
|
|
557
|
+
ol = k + 1;
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
const removedBefore = /* @__PURE__ */ new Map();
|
|
563
|
+
let pending = [];
|
|
564
|
+
for (let i = 0; i < oldBlocks.length; i++) {
|
|
565
|
+
if (usedOld.has(i)) {
|
|
566
|
+
if (pending.length)
|
|
567
|
+
removedBefore.set(i, pending);
|
|
568
|
+
pending = [];
|
|
569
|
+
} else {
|
|
570
|
+
pending.push(oldBlocks[i]);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const removedAtEnd = pending;
|
|
574
|
+
for (let j = 0; j < newBlocks.length; j++) {
|
|
575
|
+
const i = matchedPairs.get(j);
|
|
576
|
+
if (i !== void 0) {
|
|
577
|
+
for (const r of removedBefore.get(i) ?? []) {
|
|
578
|
+
this.stats.blocksChanged++;
|
|
579
|
+
out.push(mark(r, "removed"));
|
|
580
|
+
}
|
|
581
|
+
out.push(this.diffMatchedBlock(oldBlocks[i], newBlocks[j]));
|
|
582
|
+
} else {
|
|
583
|
+
this.stats.blocksChanged++;
|
|
584
|
+
out.push(mark(newBlocks[j], "added"));
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
for (const r of removedAtEnd) {
|
|
588
|
+
this.stats.blocksChanged++;
|
|
589
|
+
out.push(mark(r, "removed"));
|
|
590
|
+
}
|
|
591
|
+
return out;
|
|
592
|
+
}
|
|
593
|
+
/** Identity keys per block; empty string = positional/prose block. */
|
|
594
|
+
blockKeys(blocks) {
|
|
595
|
+
const seen = /* @__PURE__ */ new Map();
|
|
596
|
+
return blocks.map((block) => {
|
|
597
|
+
const b = this.view(block);
|
|
598
|
+
let base = "";
|
|
599
|
+
if (b.type === "code") {
|
|
600
|
+
base = `code${b.props?.language ?? ""}${b.props?.title ?? ""}`;
|
|
601
|
+
} else if (b.type === "table") {
|
|
602
|
+
base = "table";
|
|
603
|
+
} else if (CONTAINER_TYPES.has(b.type)) {
|
|
604
|
+
base = `container${b.type}${b.props?.type ?? ""}`;
|
|
605
|
+
} else {
|
|
606
|
+
return "";
|
|
607
|
+
}
|
|
608
|
+
const n = seen.get(base) ?? 0;
|
|
609
|
+
seen.set(base, n + 1);
|
|
610
|
+
return `${base}#${n}`;
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
/** Same-identity pair: unchanged, or changed with the right marks. */
|
|
614
|
+
diffMatchedBlock(oldB, newB) {
|
|
615
|
+
if (this.same(oldB, newB))
|
|
616
|
+
return { ...newB };
|
|
617
|
+
if (newB.type === "code") {
|
|
618
|
+
this.stats.blocksChanged++;
|
|
619
|
+
return mark(newB, "changed", { diffPeer: oldB });
|
|
620
|
+
}
|
|
621
|
+
if (newB.type === "table") {
|
|
622
|
+
return this.diffTable(oldB, newB);
|
|
623
|
+
}
|
|
624
|
+
if (CONTAINER_TYPES.has(newB.type)) {
|
|
625
|
+
const children = this.diffBlocks(oldB.children ?? [], newB.children ?? []);
|
|
626
|
+
const loose = (b) => b.meta?.loose === true;
|
|
627
|
+
const propsChanged = JSON.stringify(this.view(oldB).props ?? {}) !== JSON.stringify(this.view(newB).props ?? {}) || loose(oldB) !== loose(newB);
|
|
628
|
+
const childChanged = children.some(hasAnyMark);
|
|
629
|
+
const ownOld = oldB.inline ? inlineText(oldB.inline) : "";
|
|
630
|
+
const ownNew = newB.inline ? inlineText(newB.inline) : "";
|
|
631
|
+
const ownChanged = this.compareValue ? inlineText(this.view(oldB).inline ?? []) !== inlineText(this.view(newB).inline ?? []) : ownOld !== ownNew;
|
|
632
|
+
if (ownChanged) {
|
|
633
|
+
const segments = this.words(ownOld, ownNew);
|
|
634
|
+
if (!(this.onlyTextDiffered({ ...oldB, children: [] }, { ...newB, children: [] }, segments) && !children.some(hasAnyMark))) {
|
|
635
|
+
this.stats.blocksChanged++;
|
|
636
|
+
return { ...newB, diff: "changed", ...segments ? { diffInline: segments } : {}, diffPeer: oldB, children };
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
if (HIDDEN_CONTAINERS.has(newB.type) && (childChanged || propsChanged)) {
|
|
640
|
+
this.stats.blocksChanged++;
|
|
641
|
+
return { ...newB, diff: "changed", children };
|
|
642
|
+
}
|
|
643
|
+
if (newB.type === "callout" && (childChanged || propsChanged)) {
|
|
644
|
+
this.stats.blocksChanged++;
|
|
645
|
+
return {
|
|
646
|
+
...newB,
|
|
647
|
+
diff: "changed",
|
|
648
|
+
children: children.map(stripBlockMarks)
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
if (propsChanged) {
|
|
652
|
+
this.stats.blocksChanged++;
|
|
653
|
+
return { ...newB, diff: "changed", children };
|
|
654
|
+
}
|
|
655
|
+
return { ...newB, children };
|
|
656
|
+
}
|
|
657
|
+
if (newB.type === "html") {
|
|
658
|
+
const comparable = (s) => {
|
|
659
|
+
const decoded = decodeNumericEntities(s);
|
|
660
|
+
return decoded.includes("<pre") ? decoded : decoded.replace(/\s+/g, " ").trim();
|
|
661
|
+
};
|
|
662
|
+
if (comparable(String(this.view(oldB).html ?? "")) === comparable(String(this.view(newB).html ?? ""))) {
|
|
663
|
+
if (this.compareValue && comparable(String(oldB.html ?? "")) !== comparable(String(newB.html ?? "")))
|
|
664
|
+
this.stats.ignored++;
|
|
665
|
+
return { ...newB };
|
|
666
|
+
}
|
|
667
|
+
this.stats.blocksChanged++;
|
|
668
|
+
return mark(newB, "changed", { diffPeer: oldB });
|
|
669
|
+
}
|
|
670
|
+
if (PROSE_TYPES.has(newB.type) || newB.inline) {
|
|
671
|
+
const segments = this.words(nodeText(oldB), nodeText(newB));
|
|
672
|
+
if (this.onlyTextDiffered(oldB, newB, segments))
|
|
673
|
+
return { ...newB };
|
|
674
|
+
this.stats.blocksChanged++;
|
|
675
|
+
return mark(newB, "changed", {
|
|
676
|
+
...segments ? { diffInline: segments } : {},
|
|
677
|
+
diffPeer: oldB
|
|
678
|
+
});
|
|
679
|
+
}
|
|
680
|
+
this.stats.blocksChanged++;
|
|
681
|
+
return mark(newB, "changed", { diffPeer: oldB });
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Row-level table diff. Rows are keyed by section (thead/tbody) +
|
|
685
|
+
* first-cell text + occurrence, so duplicate first cells never
|
|
686
|
+
* collapse (a deleted duplicate row MUST surface — silent
|
|
687
|
+
* false-negatives are the worst failure class here).
|
|
688
|
+
*/
|
|
689
|
+
diffTable(oldT, newT) {
|
|
690
|
+
const keyRows = (t) => {
|
|
691
|
+
const seen = /* @__PURE__ */ new Map();
|
|
692
|
+
const out = /* @__PURE__ */ new Map();
|
|
693
|
+
for (const part of t.children ?? []) {
|
|
694
|
+
if (part.type !== "tbody" && part.type !== "thead")
|
|
695
|
+
continue;
|
|
696
|
+
for (const tr of part.children ?? []) {
|
|
697
|
+
const base = `${part.type}:${this.text((tr.children ?? [])[0] ?? tr)}`;
|
|
698
|
+
const n = seen.get(base) ?? 0;
|
|
699
|
+
seen.set(base, n + 1);
|
|
700
|
+
out.set(`${base}#${n}`, tr);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return out;
|
|
704
|
+
};
|
|
705
|
+
const oldRows = keyRows(oldT);
|
|
706
|
+
const newRowKeys = keyRows(newT);
|
|
707
|
+
const keyOfNew = /* @__PURE__ */ new Map();
|
|
708
|
+
for (const [k, tr] of newRowKeys)
|
|
709
|
+
keyOfNew.set(tr, k);
|
|
710
|
+
let changed = false;
|
|
711
|
+
const mapPart = (part) => {
|
|
712
|
+
if (part.type !== "tbody" && part.type !== "thead")
|
|
713
|
+
return { ...part };
|
|
714
|
+
const children = (part.children ?? []).map((tr) => {
|
|
715
|
+
const key = keyOfNew.get(tr);
|
|
716
|
+
const old = oldRows.get(key);
|
|
717
|
+
if (!old) {
|
|
718
|
+
changed = true;
|
|
719
|
+
return mark(tr, "added");
|
|
720
|
+
}
|
|
721
|
+
oldRows.delete(key);
|
|
722
|
+
if (!this.same(old, tr)) {
|
|
723
|
+
changed = true;
|
|
724
|
+
return mark(tr, "changed", { diffPeer: old });
|
|
725
|
+
}
|
|
726
|
+
return { ...tr };
|
|
727
|
+
});
|
|
728
|
+
return { ...part, children };
|
|
729
|
+
};
|
|
730
|
+
let parts = (newT.children ?? []).map(mapPart);
|
|
731
|
+
const leftover = [...oldRows.values()];
|
|
732
|
+
if (leftover.length) {
|
|
733
|
+
changed = true;
|
|
734
|
+
let lastBody = [...parts].reverse().find((p) => p.type === "tbody");
|
|
735
|
+
if (!lastBody) {
|
|
736
|
+
lastBody = { type: "tbody", children: [] };
|
|
737
|
+
parts = [...parts, lastBody];
|
|
738
|
+
}
|
|
739
|
+
lastBody.children = [
|
|
740
|
+
...lastBody.children ?? [],
|
|
741
|
+
...leftover.map((r) => mark(r, "removed"))
|
|
742
|
+
];
|
|
743
|
+
}
|
|
744
|
+
if (changed)
|
|
745
|
+
this.stats.blocksChanged++;
|
|
746
|
+
return changed ? { ...newT, diff: "changed", children: parts } : { ...newT, children: parts };
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
function diffTrees(oldTree, newTree, options = {}) {
|
|
750
|
+
const differ = new Differ(options.compareValue);
|
|
751
|
+
const tree = differ.diff(oldTree, newTree);
|
|
752
|
+
const stats = differ.stats;
|
|
753
|
+
const unchanged = stats.sectionsAdded === 0 && stats.sectionsRemoved === 0 && stats.sectionsChanged === 0 && stats.sectionsMoved === 0 && stats.blocksChanged === 0;
|
|
754
|
+
return { tree, stats, unchanged };
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// node_modules/@dogsbay/tree-diff/dist/views.js
|
|
758
|
+
var hasAnyMark2 = (node) => Boolean(node.diff || node.diffInline) || (node.children ?? []).some(hasAnyMark2);
|
|
759
|
+
var sectionNodes = (sec) => [
|
|
760
|
+
...sec.heading ? [sec.heading] : [],
|
|
761
|
+
...sec.blocks,
|
|
762
|
+
...sec.children.flatMap(sectionNodes)
|
|
763
|
+
];
|
|
764
|
+
var sectionUnchanged = (sec) => !sectionNodes(sec).some(hasAnyMark2);
|
|
765
|
+
function foldUnchangedSections(tree, options = {}) {
|
|
766
|
+
const title = options.title ?? ((heading) => `Unchanged: ${heading}`);
|
|
767
|
+
const root = sectionize(tree);
|
|
768
|
+
let folded = 0;
|
|
769
|
+
const emitSection = (sec) => {
|
|
770
|
+
if (sec.level >= 2 && sec.heading && sectionUnchanged(sec)) {
|
|
771
|
+
folded++;
|
|
772
|
+
return [
|
|
773
|
+
{
|
|
774
|
+
type: "details",
|
|
775
|
+
props: {
|
|
776
|
+
title: title(nodeText(sec.heading)),
|
|
777
|
+
// `plain` = chrome, not content: a fold is collapsed
|
|
778
|
+
// CONTEXT, not a note, so it gets no alert semantics, no
|
|
779
|
+
// icon, and no ARIA role (the previous `note` variant put
|
|
780
|
+
// role="note" on a <details>, which axe rejects — details
|
|
781
|
+
// has an implicit `group` role that ARIA won't let you
|
|
782
|
+
// override). Styled as dashed/dimmed chrome by DIFF_CSS.
|
|
783
|
+
variant: "plain",
|
|
784
|
+
class: "db-diff-fold"
|
|
785
|
+
},
|
|
786
|
+
children: sectionNodes(sec)
|
|
787
|
+
}
|
|
788
|
+
];
|
|
789
|
+
}
|
|
790
|
+
return [
|
|
791
|
+
...sec.heading ? [sec.heading] : [],
|
|
792
|
+
...sec.blocks,
|
|
793
|
+
...sec.children.flatMap(emitSection)
|
|
794
|
+
];
|
|
795
|
+
};
|
|
796
|
+
const out = [
|
|
797
|
+
...root.blocks,
|
|
798
|
+
// page lead never folds
|
|
799
|
+
...root.children.flatMap(emitSection)
|
|
800
|
+
];
|
|
801
|
+
return { tree: out, folded };
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
export {
|
|
805
|
+
diffTrees,
|
|
806
|
+
foldUnchangedSections
|
|
807
|
+
};
|