@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
CHOICES_HEAD_SCRIPT
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-VJ6AESSJ.mjs";
|
|
6
6
|
|
|
7
7
|
// node_modules/@dogsbay/elements/dist/chunk-77TPXX44.js
|
|
8
8
|
var ANNOUNCEMENT_HEAD_SCRIPT = `(function(){try{var m=document.querySelector('meta[name="db-announcement"]');if(m&&m.content&&localStorage.getItem("db-announcement-closed:"+m.content))document.documentElement.setAttribute("data-announcement-closed","")}catch(e){}})();`;
|
|
@@ -20,9 +20,35 @@ var COLOR_MODE_HEAD_SCRIPT_HASHES = Object.freeze({
|
|
|
20
20
|
dark: "sha256-rl7pDPoIM2Dkr1KlLP+OVtY1HGFLdszqURk3Let+fKI="
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
+
// src/core/served-base.ts
|
|
24
|
+
var SERVED_BASE_SCRIPT = (
|
|
25
|
+
// No `="` in the text: the Worker's rebaseServedPage rewrites attribute values, and the CSP allows the script by its hash
|
|
26
|
+
"(function(s){var o=s.getAttribute('data-out'),p=location.pathname;if(!o||location.protocol==='file:')return;try{p=decodeURIComponent(p)}catch(e){}if(p.slice(-o.length-1)==='/'+o)return;var b=document.createElement('base');b.href=s.getAttribute('data-root');document.head.appendChild(b);document.addEventListener('DOMContentLoaded',function(){var h=location.href.split('#')[0];document.querySelectorAll('a[href^=\\'#\\']').forEach(function(a){a.href=h+a.getAttribute('href')})})})(document.currentScript)"
|
|
27
|
+
);
|
|
28
|
+
function servedBaseScript(root, out, esc) {
|
|
29
|
+
return `<script data-root="${esc(root)}" data-out="${esc(out)}">${SERVED_BASE_SCRIPT}</script>
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
function relocateServedPage(html, prefix, siteRoot) {
|
|
33
|
+
const from = new URL(`https://h/${prefix.replace(/\/*$/, "/")}`);
|
|
34
|
+
return html.replace(/(\s(?:href|src|base|data-unit-root|data-site-root|data-search-page)=")([^"]*)"/g, (m, attr, raw) => {
|
|
35
|
+
const v = unescapeAttr(raw);
|
|
36
|
+
if (v.startsWith("#") || v.startsWith("/") || /^[a-z][a-z0-9+.-]*:/i.test(v)) return m;
|
|
37
|
+
const u = new URL(v, from);
|
|
38
|
+
return `${attr}${escapeAttr(u.pathname.slice(1) + u.search + u.hash || "./")}"`;
|
|
39
|
+
}).replace(/(<script data-root=")[^"]*(" data-out=")[^"]*(">)/, (_, a, b, c) => `${a}${escapeAttr(siteRoot)}${b}404.html${c}`);
|
|
40
|
+
}
|
|
41
|
+
var unescapeAttr = (v) => v.replace(/&(#x[0-9a-f]+|#\d+|amp|quot|apos|lt|gt);/gi, (m, e) => {
|
|
42
|
+
const k = e.toLowerCase();
|
|
43
|
+
if (k.startsWith("#x")) return String.fromCodePoint(parseInt(k.slice(2), 16));
|
|
44
|
+
if (k.startsWith("#")) return String.fromCodePoint(Number(k.slice(1)));
|
|
45
|
+
return { amp: "&", quot: '"', apos: "'", lt: "<", gt: ">" }[k] ?? m;
|
|
46
|
+
});
|
|
47
|
+
var escapeAttr = (v) => v.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
|
|
48
|
+
|
|
23
49
|
// src/core/csp.ts
|
|
24
50
|
var FORWARD_SCRIPT = "location.replace(document.documentElement.dataset.to+location.search+location.hash)";
|
|
25
|
-
var INLINE_SCRIPTS = [...new Set(Object.values(COLOR_MODE_HEAD_SCRIPTS)), ANNOUNCEMENT_HEAD_SCRIPT, FORWARD_SCRIPT, CHOICES_HEAD_SCRIPT];
|
|
51
|
+
var INLINE_SCRIPTS = [...new Set(Object.values(COLOR_MODE_HEAD_SCRIPTS)), ANNOUNCEMENT_HEAD_SCRIPT, FORWARD_SCRIPT, CHOICES_HEAD_SCRIPT, SERVED_BASE_SCRIPT];
|
|
26
52
|
var INLINE_HANDLERS = [];
|
|
27
53
|
async function sha256(text) {
|
|
28
54
|
const d = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(text)));
|
|
@@ -37,12 +63,15 @@ function cspHashes() {
|
|
|
37
63
|
async function sitePolicy(scripts) {
|
|
38
64
|
const h = await cspHashes();
|
|
39
65
|
const handlers = h.handlers.length ? ["'unsafe-hashes'", ...h.handlers] : [];
|
|
40
|
-
return [`script-src ${[scripts, ...h.scripts, ...handlers].join(" ")}`, "object-src 'none'",
|
|
66
|
+
return [`script-src ${[scripts, ...h.scripts, ...handlers].join(" ")}`, "object-src 'none'", `base-uri ${scripts}`].join("; ");
|
|
41
67
|
}
|
|
42
68
|
|
|
43
69
|
export {
|
|
44
70
|
ANNOUNCEMENT_HEAD_SCRIPT,
|
|
45
71
|
COLOR_MODE_HEAD_SCRIPTS,
|
|
72
|
+
servedBaseScript,
|
|
73
|
+
relocateServedPage,
|
|
46
74
|
FORWARD_SCRIPT,
|
|
75
|
+
INLINE_SCRIPTS,
|
|
47
76
|
sitePolicy
|
|
48
77
|
};
|
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
Comment,
|
|
5
|
-
ConfigError,
|
|
6
5
|
Document,
|
|
7
6
|
Element,
|
|
8
7
|
ProcessingInstruction,
|
|
9
8
|
Text,
|
|
10
9
|
build,
|
|
11
|
-
buildUnits,
|
|
12
10
|
cloneNode,
|
|
13
11
|
esm_default,
|
|
14
12
|
esm_exports,
|
|
@@ -29,27 +27,37 @@ import {
|
|
|
29
27
|
linkBaseDir,
|
|
30
28
|
nextElementSibling,
|
|
31
29
|
pageKeyCandidates,
|
|
32
|
-
parseConfig,
|
|
33
30
|
parseDocument,
|
|
34
31
|
prevElementSibling,
|
|
35
32
|
removeElement,
|
|
36
33
|
resolveLinkPath,
|
|
37
|
-
sameProduct,
|
|
38
34
|
splitHref,
|
|
39
35
|
textContent,
|
|
40
|
-
uniqueSort
|
|
41
|
-
|
|
42
|
-
versionsOf
|
|
43
|
-
} from "./chunk-TRECVC6H.mjs";
|
|
36
|
+
uniqueSort
|
|
37
|
+
} from "./chunk-ZDH4JRVX.mjs";
|
|
44
38
|
import {
|
|
45
39
|
slugFromPath
|
|
46
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-2EM7IEQT.mjs";
|
|
41
|
+
import {
|
|
42
|
+
ConfigError,
|
|
43
|
+
buildUnits,
|
|
44
|
+
compareRelease,
|
|
45
|
+
flat,
|
|
46
|
+
pageKey,
|
|
47
|
+
parseConfig,
|
|
48
|
+
releaseBaseline,
|
|
49
|
+
releasePage,
|
|
50
|
+
sameProduct,
|
|
51
|
+
titleOf,
|
|
52
|
+
unitOfPath,
|
|
53
|
+
versionsOf
|
|
54
|
+
} from "./chunk-5NQOUB5I.mjs";
|
|
47
55
|
import {
|
|
48
56
|
checkFrontmatter,
|
|
49
57
|
detectLeadingNodes,
|
|
50
58
|
extractFirstParagraph,
|
|
51
59
|
frontmatterKeyLines
|
|
52
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-VJ6AESSJ.mjs";
|
|
53
61
|
import {
|
|
54
62
|
__commonJS,
|
|
55
63
|
__export,
|
|
@@ -241,11 +249,11 @@ var require_parse = __commonJS({
|
|
|
241
249
|
function parseSelector(subselects2, selector, selectorIndex) {
|
|
242
250
|
var tokens = [];
|
|
243
251
|
function getName(offset) {
|
|
244
|
-
var
|
|
245
|
-
if (!
|
|
252
|
+
var match = selector.slice(selectorIndex + offset).match(reName);
|
|
253
|
+
if (!match) {
|
|
246
254
|
throw new Error("Expected name, found ".concat(selector.slice(selectorIndex)));
|
|
247
255
|
}
|
|
248
|
-
var name =
|
|
256
|
+
var name = match[0];
|
|
249
257
|
selectorIndex += offset + name.length;
|
|
250
258
|
return unescapeCSS(name);
|
|
251
259
|
}
|
|
@@ -17217,15 +17225,15 @@ var require_mock_utils = __commonJS({
|
|
|
17217
17225
|
}
|
|
17218
17226
|
} = __require("node:util");
|
|
17219
17227
|
var { InvalidArgumentError } = require_errors();
|
|
17220
|
-
function matchValue(
|
|
17221
|
-
if (typeof
|
|
17222
|
-
return
|
|
17228
|
+
function matchValue(match, value) {
|
|
17229
|
+
if (typeof match === "string") {
|
|
17230
|
+
return match === value;
|
|
17223
17231
|
}
|
|
17224
|
-
if (
|
|
17225
|
-
return
|
|
17232
|
+
if (match instanceof RegExp) {
|
|
17233
|
+
return match.test(value);
|
|
17226
17234
|
}
|
|
17227
|
-
if (typeof
|
|
17228
|
-
return
|
|
17235
|
+
if (typeof match === "function") {
|
|
17236
|
+
return match(value) === true;
|
|
17229
17237
|
}
|
|
17230
17238
|
return false;
|
|
17231
17239
|
}
|
|
@@ -18398,13 +18406,13 @@ var require_snapshot_recorder = __commonJS({
|
|
|
18398
18406
|
caseSensitive = false
|
|
18399
18407
|
} = matchOptions;
|
|
18400
18408
|
const filtered = {};
|
|
18401
|
-
const { ignore, exclude, match
|
|
18409
|
+
const { ignore, exclude, match } = headerFilters;
|
|
18402
18410
|
for (const [key, value] of Object.entries(headers)) {
|
|
18403
18411
|
const headerKey = caseSensitive ? key : key.toLowerCase();
|
|
18404
18412
|
if (exclude.has(headerKey)) continue;
|
|
18405
18413
|
if (ignore.has(headerKey)) continue;
|
|
18406
|
-
if (
|
|
18407
|
-
if (!
|
|
18414
|
+
if (match.size !== 0) {
|
|
18415
|
+
if (!match.has(headerKey)) continue;
|
|
18408
18416
|
}
|
|
18409
18417
|
filtered[headerKey] = value;
|
|
18410
18418
|
}
|
|
@@ -30858,26 +30866,6 @@ var titleMissing = {
|
|
|
30858
30866
|
}
|
|
30859
30867
|
};
|
|
30860
30868
|
|
|
30861
|
-
// node_modules/@dogsbay/site-check/dist/lib/page.js
|
|
30862
|
-
function titleOf(page) {
|
|
30863
|
-
const fm = page.frontmatter?.["title"];
|
|
30864
|
-
return (typeof fm === "string" && fm.trim() ? fm : page.title ?? "").trim();
|
|
30865
|
-
}
|
|
30866
|
-
function flat(s) {
|
|
30867
|
-
return JSON.parse(JSON.stringify(s));
|
|
30868
|
-
}
|
|
30869
|
-
function pageKey(pathOrUrl, urlBase = "") {
|
|
30870
|
-
let p = pathOrUrl.replace(/[?#].*$/, "");
|
|
30871
|
-
const m = /^[a-z][a-z0-9+.-]*:\/\/[^/]*(.*)$/i.exec(p) ?? /^\/\/[^/]*(.*)$/.exec(p);
|
|
30872
|
-
if (m)
|
|
30873
|
-
p = m[1];
|
|
30874
|
-
p = p.replace(/^\/+/, "");
|
|
30875
|
-
const base = urlBase.replace(/^\/+|\/+$/g, "");
|
|
30876
|
-
if (m && base && (p === base || p.startsWith(base + "/")))
|
|
30877
|
-
p = p.slice(base.length);
|
|
30878
|
-
return p.replace(/^\/+|\/+$/g, "").replace(/(^|\/)index\.html$/, "").replace(/\.html$/, "").replace(/\/+$/, "");
|
|
30879
|
-
}
|
|
30880
|
-
|
|
30881
30869
|
// node_modules/@dogsbay/site-check/dist/rules/seo/duplicate-title.js
|
|
30882
30870
|
var duplicateTitle = {
|
|
30883
30871
|
id: "seo/duplicate-title",
|
|
@@ -30983,7 +30971,7 @@ var sitemapPresent = {
|
|
|
30983
30971
|
stage: "dist",
|
|
30984
30972
|
scope: "site",
|
|
30985
30973
|
severity: "error",
|
|
30986
|
-
description: "`sitemap.xml` (or `sitemap-index.xml`) exists at the dist root and parses.",
|
|
30974
|
+
description: "`sitemap.xml` (or `sitemap-index.xml`) exists at the dist root and parses. A site with no `site.url` has no sitemap by design: reported as info.",
|
|
30987
30975
|
run(ctx) {
|
|
30988
30976
|
if (!ctx.readFile)
|
|
30989
30977
|
return [];
|
|
@@ -30992,7 +30980,14 @@ var sitemapPresent = {
|
|
|
30992
30980
|
return [];
|
|
30993
30981
|
state.emitted.add("seo/sitemap-present");
|
|
30994
30982
|
const issues = [];
|
|
30995
|
-
if (!state.sitemapPath) {
|
|
30983
|
+
if (!state.sitemapPath && !ctx.config?.siteUrl) {
|
|
30984
|
+
issues.push({
|
|
30985
|
+
ruleId: "seo/sitemap-present",
|
|
30986
|
+
severity: "info",
|
|
30987
|
+
file: "sitemap.xml",
|
|
30988
|
+
message: "No sitemap: the site has no `site.url`, and a sitemap needs absolute URLs. Set `site.url` in dogsbay.config.yml to get one."
|
|
30989
|
+
});
|
|
30990
|
+
} else if (!state.sitemapPath) {
|
|
30996
30991
|
issues.push({
|
|
30997
30992
|
ruleId: "seo/sitemap-present",
|
|
30998
30993
|
severity: "error",
|
|
@@ -34277,35 +34272,35 @@ function map(fn) {
|
|
|
34277
34272
|
}
|
|
34278
34273
|
return this._make(elems);
|
|
34279
34274
|
}
|
|
34280
|
-
function getFilterFn(
|
|
34281
|
-
if (typeof
|
|
34282
|
-
return (el, i) =>
|
|
34275
|
+
function getFilterFn(match) {
|
|
34276
|
+
if (typeof match === "function") {
|
|
34277
|
+
return (el, i) => match.call(el, i, el);
|
|
34283
34278
|
}
|
|
34284
|
-
if (isCheerio(
|
|
34285
|
-
return (el) => Array.prototype.includes.call(
|
|
34279
|
+
if (isCheerio(match)) {
|
|
34280
|
+
return (el) => Array.prototype.includes.call(match, el);
|
|
34286
34281
|
}
|
|
34287
34282
|
return function(el) {
|
|
34288
|
-
return
|
|
34283
|
+
return match === el;
|
|
34289
34284
|
};
|
|
34290
34285
|
}
|
|
34291
|
-
function filter2(
|
|
34286
|
+
function filter2(match) {
|
|
34292
34287
|
var _a3;
|
|
34293
|
-
return this._make(filterArray(this.toArray(),
|
|
34288
|
+
return this._make(filterArray(this.toArray(), match, this.options.xmlMode, (_a3 = this._root) === null || _a3 === void 0 ? void 0 : _a3[0]));
|
|
34294
34289
|
}
|
|
34295
|
-
function filterArray(nodes,
|
|
34296
|
-
return typeof
|
|
34290
|
+
function filterArray(nodes, match, xmlMode, root2) {
|
|
34291
|
+
return typeof match === "string" ? filter(match, nodes, { xmlMode, root: root2 }) : nodes.filter(getFilterFn(match));
|
|
34297
34292
|
}
|
|
34298
34293
|
function is3(selector) {
|
|
34299
34294
|
const nodes = this.toArray();
|
|
34300
34295
|
return typeof selector === "string" ? some(nodes.filter(isTag), selector, this.options) : selector ? nodes.some(getFilterFn(selector)) : false;
|
|
34301
34296
|
}
|
|
34302
|
-
function not(
|
|
34297
|
+
function not(match) {
|
|
34303
34298
|
let nodes = this.toArray();
|
|
34304
|
-
if (typeof
|
|
34305
|
-
const matches = new Set(filter(
|
|
34299
|
+
if (typeof match === "string") {
|
|
34300
|
+
const matches = new Set(filter(match, nodes, this.options));
|
|
34306
34301
|
nodes = nodes.filter((el) => !matches.has(el));
|
|
34307
34302
|
} else {
|
|
34308
|
-
const filterFn = getFilterFn(
|
|
34303
|
+
const filterFn = getFilterFn(match);
|
|
34309
34304
|
nodes = nodes.filter((el, i) => !filterFn(el, i));
|
|
34310
34305
|
}
|
|
34311
34306
|
return this._make(nodes);
|
|
@@ -42874,15 +42869,15 @@ var getCodePoint = (
|
|
|
42874
42869
|
);
|
|
42875
42870
|
function getEscaper(regex, map2) {
|
|
42876
42871
|
return function escape(data2) {
|
|
42877
|
-
let
|
|
42872
|
+
let match;
|
|
42878
42873
|
let lastIndex = 0;
|
|
42879
42874
|
let result = "";
|
|
42880
|
-
while (
|
|
42881
|
-
if (lastIndex !==
|
|
42882
|
-
result += data2.substring(lastIndex,
|
|
42875
|
+
while (match = regex.exec(data2)) {
|
|
42876
|
+
if (lastIndex !== match.index) {
|
|
42877
|
+
result += data2.substring(lastIndex, match.index);
|
|
42883
42878
|
}
|
|
42884
|
-
result += map2.get(
|
|
42885
|
-
lastIndex =
|
|
42879
|
+
result += map2.get(match[0].charCodeAt(0));
|
|
42880
|
+
lastIndex = match.index + 1;
|
|
42886
42881
|
}
|
|
42887
42882
|
return result + data2.substring(lastIndex);
|
|
42888
42883
|
};
|
|
@@ -43522,174 +43517,6 @@ function robotsMeta(html3) {
|
|
|
43522
43517
|
return "";
|
|
43523
43518
|
}
|
|
43524
43519
|
|
|
43525
|
-
// node_modules/@dogsbay/site-check/dist/lib/release.js
|
|
43526
|
-
var MOVED_SIMILARITY = 0.6;
|
|
43527
|
-
var MIN_SHINGLES = 8;
|
|
43528
|
-
function compareRelease(input) {
|
|
43529
|
-
const toPaths = new Set(input.to.map((p) => p.path));
|
|
43530
|
-
const fromPaths = new Set(input.from.map((p) => p.path));
|
|
43531
|
-
const removed = new Set((input.removed ?? []).map(normalizeRemoved));
|
|
43532
|
-
const fresh = input.to.filter((p) => !fromPaths.has(p.path)).sort((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
43533
|
-
const entries = [];
|
|
43534
|
-
for (const page of input.from) {
|
|
43535
|
-
if (toPaths.has(page.path))
|
|
43536
|
-
continue;
|
|
43537
|
-
const about = { ...page.source !== void 0 ? { source: page.source } : {}, ...page.index ? { index: true } : {} };
|
|
43538
|
-
const redirect = input.redirects?.get(page.path);
|
|
43539
|
-
if (redirect !== void 0) {
|
|
43540
|
-
entries.push({ path: page.path, status: "redirected", to: redirect, ...about });
|
|
43541
|
-
continue;
|
|
43542
|
-
}
|
|
43543
|
-
if (removed.has(page.path)) {
|
|
43544
|
-
entries.push({ path: page.path, status: "removed-ok", ...about });
|
|
43545
|
-
continue;
|
|
43546
|
-
}
|
|
43547
|
-
entries.push({ ...match(page, fresh, toPaths, input.renames), ...about });
|
|
43548
|
-
}
|
|
43549
|
-
return entries;
|
|
43550
|
-
}
|
|
43551
|
-
function normalizeRemoved(raw) {
|
|
43552
|
-
const p = raw.trim().replace(/^\/+|\/+$/g, "").replace(/\.(md|markdown|mdx)$/i, "").replace(/(^|\/)index$/, "");
|
|
43553
|
-
return p || "index";
|
|
43554
|
-
}
|
|
43555
|
-
function match(page, fresh, toPaths, renames) {
|
|
43556
|
-
const renamed = renames?.get(page.path);
|
|
43557
|
-
if (renamed !== void 0 && toPaths.has(renamed)) {
|
|
43558
|
-
return { path: page.path, status: "moved", to: renamed, evidence: ["git rename"] };
|
|
43559
|
-
}
|
|
43560
|
-
if (page.id) {
|
|
43561
|
-
const same = fresh.find((p) => p.id === page.id);
|
|
43562
|
-
if (same)
|
|
43563
|
-
return { path: page.path, status: "moved", to: same.path, evidence: ["same id"] };
|
|
43564
|
-
}
|
|
43565
|
-
let best;
|
|
43566
|
-
let bestScore = 0;
|
|
43567
|
-
for (const p of page.shingles >= MIN_SHINGLES ? fresh : []) {
|
|
43568
|
-
if (p.shingles < MIN_SHINGLES)
|
|
43569
|
-
continue;
|
|
43570
|
-
const s = similarity(page.signature, p.signature);
|
|
43571
|
-
if (s > bestScore) {
|
|
43572
|
-
best = p;
|
|
43573
|
-
bestScore = s;
|
|
43574
|
-
}
|
|
43575
|
-
}
|
|
43576
|
-
if (best && bestScore >= MOVED_SIMILARITY) {
|
|
43577
|
-
return { path: page.path, status: "moved", to: best.path, evidence: [`same text, ${Math.round(bestScore * 100)}%`] };
|
|
43578
|
-
}
|
|
43579
|
-
const title = page.title.toLowerCase();
|
|
43580
|
-
const byTitle = title ? fresh.find((p) => p.title.toLowerCase() === title) : void 0;
|
|
43581
|
-
if (byTitle)
|
|
43582
|
-
return { path: page.path, status: "candidate", to: byTitle.path, evidence: ["same title"] };
|
|
43583
|
-
const name = baseName(page.path);
|
|
43584
|
-
const byName = fresh.find((p) => baseName(p.path) === name);
|
|
43585
|
-
if (byName)
|
|
43586
|
-
return { path: page.path, status: "candidate", to: byName.path, evidence: ["same file name"] };
|
|
43587
|
-
return { path: page.path, status: "removed" };
|
|
43588
|
-
}
|
|
43589
|
-
function baseName(path) {
|
|
43590
|
-
const parts = path.split("/").filter((s) => s !== "index");
|
|
43591
|
-
return parts[parts.length - 1] ?? "index";
|
|
43592
|
-
}
|
|
43593
|
-
var HASHES = 64;
|
|
43594
|
-
var SHINGLE = 5;
|
|
43595
|
-
function releasePage(page, path, o = {}) {
|
|
43596
|
-
const id = page.frontmatter?.["id"];
|
|
43597
|
-
const text3 = treeText(page.tree);
|
|
43598
|
-
return {
|
|
43599
|
-
path: flat(path),
|
|
43600
|
-
title: flat(titleOf(page)),
|
|
43601
|
-
...typeof id === "string" && id.trim() ? { id: flat(id.trim()) } : {},
|
|
43602
|
-
...o.source !== void 0 ? { source: flat(o.source) } : {},
|
|
43603
|
-
...o.index && path !== "index" ? { index: true } : {},
|
|
43604
|
-
signature: signature(text3),
|
|
43605
|
-
shingles: shingleCount(text3)
|
|
43606
|
-
};
|
|
43607
|
-
}
|
|
43608
|
-
function shingleCount(text3) {
|
|
43609
|
-
const words = text3.match(/[\p{L}\p{N}]+/gu)?.length ?? 0;
|
|
43610
|
-
return words ? Math.max(1, words - SHINGLE + 1) : 0;
|
|
43611
|
-
}
|
|
43612
|
-
function signature(text3) {
|
|
43613
|
-
const words = text3.toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [];
|
|
43614
|
-
const mins = new Array(HASHES).fill(4294967295);
|
|
43615
|
-
if (!words.length)
|
|
43616
|
-
return mins;
|
|
43617
|
-
const count = Math.max(1, words.length - SHINGLE + 1);
|
|
43618
|
-
for (let i = 0; i < count; i++) {
|
|
43619
|
-
const h = fnv1a(words.slice(i, i + SHINGLE).join(" "));
|
|
43620
|
-
for (let k = 0; k < HASHES; k++) {
|
|
43621
|
-
const v = mix(h, k);
|
|
43622
|
-
if (v < mins[k])
|
|
43623
|
-
mins[k] = v;
|
|
43624
|
-
}
|
|
43625
|
-
}
|
|
43626
|
-
return mins;
|
|
43627
|
-
}
|
|
43628
|
-
function similarity(a, b) {
|
|
43629
|
-
if (a.length !== b.length || !a.length || a[0] === 4294967295 || b[0] === 4294967295)
|
|
43630
|
-
return 0;
|
|
43631
|
-
let same = 0;
|
|
43632
|
-
for (let i = 0; i < a.length; i++)
|
|
43633
|
-
if (a[i] === b[i])
|
|
43634
|
-
same++;
|
|
43635
|
-
return same / a.length;
|
|
43636
|
-
}
|
|
43637
|
-
function fnv1a(s) {
|
|
43638
|
-
let h = 2166136261;
|
|
43639
|
-
for (let i = 0; i < s.length; i++) {
|
|
43640
|
-
h ^= s.charCodeAt(i);
|
|
43641
|
-
h = Math.imul(h, 16777619);
|
|
43642
|
-
}
|
|
43643
|
-
return h >>> 0;
|
|
43644
|
-
}
|
|
43645
|
-
function mix(h, k) {
|
|
43646
|
-
let x = (h ^ Math.imul(k + 1, 2654435769)) >>> 0;
|
|
43647
|
-
x ^= x >>> 16;
|
|
43648
|
-
x = Math.imul(x, 2246822507);
|
|
43649
|
-
x ^= x >>> 13;
|
|
43650
|
-
x = Math.imul(x, 3266489909);
|
|
43651
|
-
x ^= x >>> 16;
|
|
43652
|
-
return x >>> 0;
|
|
43653
|
-
}
|
|
43654
|
-
function treeText(nodes) {
|
|
43655
|
-
const out = [];
|
|
43656
|
-
const walk2 = (list2) => {
|
|
43657
|
-
for (const node of list2) {
|
|
43658
|
-
if (node.inline)
|
|
43659
|
-
out.push(inlineText2(node.inline));
|
|
43660
|
-
if (node.html)
|
|
43661
|
-
out.push(node.html.replace(/<[^>]+>/g, " "));
|
|
43662
|
-
if (typeof node.props?.code === "string")
|
|
43663
|
-
out.push(node.props.code);
|
|
43664
|
-
if (node.children)
|
|
43665
|
-
walk2(node.children);
|
|
43666
|
-
}
|
|
43667
|
-
};
|
|
43668
|
-
walk2(nodes);
|
|
43669
|
-
return out.join(" ");
|
|
43670
|
-
}
|
|
43671
|
-
function inlineText2(nodes) {
|
|
43672
|
-
let s = "";
|
|
43673
|
-
for (const n of nodes) {
|
|
43674
|
-
if (typeof n.text === "string")
|
|
43675
|
-
s += n.text;
|
|
43676
|
-
else if (typeof n.value === "string")
|
|
43677
|
-
s += n.value;
|
|
43678
|
-
if (Array.isArray(n.children))
|
|
43679
|
-
s += inlineText2(n.children);
|
|
43680
|
-
s += " ";
|
|
43681
|
-
}
|
|
43682
|
-
return s;
|
|
43683
|
-
}
|
|
43684
|
-
function releaseBaseline(versions, defaultVersion, from) {
|
|
43685
|
-
if (from !== void 0)
|
|
43686
|
-
return versions.some((v) => v.id === from) && from !== defaultVersion ? from : void 0;
|
|
43687
|
-
const i = versions.findIndex((v) => v.id === defaultVersion);
|
|
43688
|
-
if (i < 0)
|
|
43689
|
-
return void 0;
|
|
43690
|
-
return versions.slice(i + 1).find((v) => !v.prerelease && !v.hidden)?.id;
|
|
43691
|
-
}
|
|
43692
|
-
|
|
43693
43520
|
// node_modules/@dogsbay/site-check/dist/index.js
|
|
43694
43521
|
function registerSharedRules() {
|
|
43695
43522
|
registerSeoRules();
|