ssqch 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/completions/bash +67 -9
- package/bundled/completions/elvish +24 -4
- package/bundled/completions/fish +37 -25
- package/bundled/completions/powershell +26 -4
- package/bundled/completions/zsh +45 -10
- package/bundled/docs/agents.md +2 -2
- package/bundled/docs/build-summary.md +1 -1
- package/bundled/docs/comparing-builds.md +7 -4
- package/bundled/docs/configuring.md +7 -12
- package/bundled/docs/deploying.md +1 -1
- package/bundled/docs/field-guide.md +4 -4
- package/bundled/docs/github-pages.md +2 -1
- package/bundled/docs/index.md +1 -1
- package/bundled/docs/install.md +1 -1
- package/bundled/docs/known-gaps.md +1 -1
- package/bundled/docs/markdown.md +11 -13
- package/bundled/docs/nav.yml +6 -1
- package/bundled/docs/netlify.md +4 -2
- package/bundled/docs/patrol.md +48 -0
- package/bundled/docs/plugins.md +6 -4
- package/bundled/docs/robots.md +72 -0
- package/bundled/docs/seo.md +2 -38
- package/bundled/docs/serving-markdown.md +142 -0
- package/bundled/docs/template-languages.md +2 -1
- package/bundled/docs/templates.md +2 -1
- package/bundled/docs/trailheads/from-component-frameworks.md +9 -10
- package/bundled/docs/trailheads/from-hugo.md +5 -3
- package/bundled/docs/trailheads/from-jekyll.md +54 -13
- package/bundled/docs/trailheads/from-mkdocs.md +15 -12
- package/bundled/docs/trailheads/from-vitepress.md +142 -0
- package/bundled/docs/trailheads.md +5 -5
- package/bundled/docs/where-values-come-from.md +5 -5
- package/bundled/docs/writing-plugins.md +69 -0
- package/bundled/ssqch.d.ts +150 -34
- package/bundled/starter/engines/index.edge +1 -0
- package/bundled/starter/engines/index.ejs +1 -0
- package/bundled/starter/engines/index.hbs +1 -0
- package/bundled/starter/engines/index.liquid +1 -0
- package/bundled/starter/engines/layout.edge +7 -0
- package/bundled/starter/engines/layout.ejs +4 -0
- package/bundled/starter/engines/layout.hbs +4 -0
- package/bundled/starter/engines/layout.liquid +4 -0
- package/bundled/starter/src/_data/site.json +1 -0
- package/bundled/starter/src/_includes/layout.jinja +4 -0
- package/bundled/starter/src/index.jinja +1 -0
- package/bundled/starter/ssqch.config.js +14 -1
- package/bundled/starter-docs/engines/edge/base.edge +7 -0
- package/bundled/starter-docs/engines/edge/doc.edge +4 -0
- package/bundled/starter-docs/engines/ejs/base.ejs +4 -0
- package/bundled/starter-docs/engines/ejs/doc.ejs +4 -0
- package/bundled/starter-docs/engines/hbs/base.hbs +4 -0
- package/bundled/starter-docs/engines/hbs/doc.hbs +3 -0
- package/bundled/starter-docs/engines/liquid/base.liquid +4 -0
- package/bundled/starter-docs/engines/liquid/doc.liquid +4 -0
- package/bundled/starter-docs/src/_data/site.json +1 -0
- package/bundled/starter-docs/src/_includes/base.jinja +4 -0
- package/bundled/starter-docs/src/_includes/doc.jinja +4 -0
- package/bundled/starter-docs/src/assets/docs.css +4 -0
- package/bundled/starter-docs/src/assets/docs.js +17 -0
- package/bundled/starter-docs/ssqch.config.js +14 -1
- package/lib/assets.js +13 -11
- package/lib/chunk-25WERNDD.js +112 -0
- package/lib/{chunk-H5K2ZE7B.js → chunk-2BJFGKOE.js} +13 -5
- package/lib/chunk-2FKYWYAB.js +268 -0
- package/lib/{chunk-LJOURBYT.js → chunk-3ZTRIO6O.js} +21 -19
- package/lib/{chunk-IOBC665M.js → chunk-4AZFCSGJ.js} +5 -3
- package/lib/{chunk-HWW5NCVJ.js → chunk-4Q6WMTER.js} +1 -1
- package/lib/{chunk-V2FSMOFX.js → chunk-55WXDGO4.js} +3 -3
- package/lib/{chunk-ZR3JYLFB.js → chunk-6FY77I4M.js} +331 -58
- package/lib/{chunk-JC54PHIT.js → chunk-6OUCRDYI.js} +514 -141
- package/lib/{chunk-ERAIEV3O.js → chunk-6U5VIQVY.js} +9 -7
- package/lib/{chunk-Z5OP43HU.js → chunk-7U5GWTEH.js} +455 -94
- package/lib/{chunk-CMJ7X5WW.js → chunk-AIJNG6MJ.js} +3 -2
- package/lib/{chunk-3K237XAX.js → chunk-C2Q7JKFI.js} +12 -10
- package/lib/{chunk-GS5B3CBW.js → chunk-DDV6JEC2.js} +1 -1
- package/lib/{chunk-A75EVUJX.js → chunk-DFJFHULZ.js} +47 -20
- package/lib/{chunk-KZZS4W2V.js → chunk-ENWDM2RW.js} +45 -42
- package/lib/{chunk-I3HYKEEW.js → chunk-ER72RPD6.js} +3 -3
- package/lib/chunk-F3JPNFCZ.js +23 -0
- package/lib/{chunk-B5E27PLU.js → chunk-FENJHLNM.js} +6 -3
- package/lib/{chunk-UU43WIZG.js → chunk-FJML7INB.js} +4 -2
- package/lib/{chunk-KCF2Z6N7.js → chunk-FQZDUDFK.js} +5 -3
- package/lib/{chunk-GJNIQAIH.js → chunk-GSNRAGKQ.js} +13 -6
- package/lib/{chunk-443ZQLVX.js → chunk-GU7BBYWB.js} +5 -4
- package/lib/{chunk-X2GAVYV2.js → chunk-HDKU6LRI.js} +110 -748
- package/lib/chunk-J3C2LEW7.js +121 -0
- package/lib/{chunk-XS4EJSEK.js → chunk-K5WZ2VYK.js} +7 -5
- package/lib/{chunk-3HZZY3Y7.js → chunk-OOKBXQAY.js} +7 -6
- package/lib/chunk-P2WS4RM4.js +707 -0
- package/lib/{chunk-RBNPBTDP.js → chunk-SNQOHNXE.js} +1 -1
- package/lib/{chunk-HFSWUTXX.js → chunk-SPIFZBIW.js} +1 -1
- package/lib/{chunk-QLUTNR37.js → chunk-T5IUI7W7.js} +12 -11
- package/lib/{chunk-ZINLHOX4.js → chunk-TGSVSG2G.js} +3 -2
- package/lib/{chunk-2L3HR67O.js → chunk-U2KEMVXO.js} +24 -16
- package/lib/{chunk-RYIWYWRQ.js → chunk-UHRBPZ4A.js} +7 -5
- package/lib/{chunk-2QTJTEBV.js → chunk-ULCT3PAV.js} +1 -1
- package/lib/{chunk-FCM3NYFR.js → chunk-UZNUS7RP.js} +12 -9
- package/lib/{chunk-GLJQ4C76.js → chunk-V3G2QGL3.js} +13 -106
- package/lib/{chunk-Z44IAMNG.js → chunk-VILOEVK7.js} +60 -28
- package/lib/chunk-VJWQSYEG.js +119 -0
- package/lib/{chunk-5ELAUHRL.js → chunk-WGAIE3DD.js} +23 -19
- package/lib/{chunk-OQGXZYZS.js → chunk-WUCRAV36.js} +13 -7
- package/lib/{chunk-RZYAIX2R.js → chunk-XYAWJTHM.js} +11 -10
- package/lib/{chunk-OSBEH67S.js → chunk-YA23NDMW.js} +5 -3
- package/lib/{chunk-AIMEXBTK.js → chunk-YNJNMQWU.js} +37 -142
- package/lib/{chunk-QJ5ZFTML.js → chunk-ZMG25MXF.js} +20 -18
- package/lib/cli.js +72 -35
- package/lib/elements.js +13 -11
- package/lib/from-hugo.js +36 -0
- package/lib/from-jekyll.js +41 -0
- package/lib/from-mkdocs.js +49 -0
- package/lib/from-vitepress.js +49 -0
- package/lib/image.js +12 -11
- package/lib/links.js +13 -11
- package/lib/llms.js +613 -0
- package/lib/minify.js +14 -12
- package/lib/redirects.js +13 -11
- package/lib/robots.js +87 -0
- package/lib/rss.js +24 -13
- package/lib/sass.js +12 -11
- package/lib/sitemap.js +23 -18
- package/lib/ssqch.js +6 -5
- package/lib/vue.js +400 -0
- package/package.json +29 -1
- package/types/from-hugo.d.ts +5 -0
- package/types/from-jekyll.d.ts +11 -0
- package/types/from-mkdocs.d.ts +11 -0
- package/types/from-vitepress.d.ts +5 -0
- package/types/index.d.ts +51 -31
- package/types/llms.d.ts +27 -0
- package/types/robots.d.ts +13 -0
- package/types/sass.d.ts +1 -1
- package/types/sitemap.d.ts +2 -2
- package/types/vue.d.ts +17 -0
- package/wasm/markdown.wasm +0 -0
- package/lib/chunk-RVXGUMFI.js +0 -21
- /package/lib/{chunk-ZR3JYLFB.js.LEGAL.txt → chunk-6FY77I4M.js.LEGAL.txt} +0 -0
- /package/lib/{chunk-AIMEXBTK.js.LEGAL.txt → chunk-YNJNMQWU.js.LEGAL.txt} +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { createRequire as __ssqchCreateRequire } from "node:module";
|
|
2
|
+
const require = __ssqchCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
diffOps
|
|
5
|
+
} from "./chunk-P2WS4RM4.js";
|
|
6
|
+
import {
|
|
7
|
+
compareText
|
|
8
|
+
} from "./chunk-VJWQSYEG.js";
|
|
9
|
+
import "./chunk-I3PS26CI.js";
|
|
10
|
+
|
|
11
|
+
// src/text-match.ts
|
|
12
|
+
import fs from "node:fs";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
var ENTITIES = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'", nbsp: " ", ZeroWidthSpace: "" };
|
|
15
|
+
var BREAKS = /* @__PURE__ */ new Set(["p", "li", "ul", "ol", "div", "h1", "h2", "h3", "h4", "h5", "h6", "tr", "td", "th", "table", "thead", "tbody", "pre", "br", "hr", "section", "article", "header", "footer", "nav", "main", "aside", "details", "summary", "blockquote", "dl", "dt", "dd", "label", "button", "input", "img", "figure", "figcaption"]);
|
|
16
|
+
var TAG = /<(\/?)([A-Za-z][\w:-]*)(?:\s+[^\s"'>/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'>]+))?)*\s*\/?>/g;
|
|
17
|
+
function articleWords(html) {
|
|
18
|
+
const part = /<main\b[\s\S]*<\/main>/i.exec(html)?.[0] ?? /<article\b[\s\S]*<\/article>/i.exec(html)?.[0] ?? /<body\b[\s\S]*<\/body>/i.exec(html)?.[0] ?? html;
|
|
19
|
+
return part.replace(/<(script|style|template)\b[\s\S]*?<\/\1>/gi, " ").replace(/<!--[\s\S]*?-->/g, "").replace(TAG, (_, _close, name) => BREAKS.has(name.toLowerCase()) ? " " : "").replace(/&(#x[0-9a-f]+|#\d+|\w+);/gi, (whole, e) => e[0] === "#" ? String.fromCodePoint(e[1] === "x" || e[1] === "X" ? parseInt(e.slice(2), 16) : Number(e.slice(1))) : ENTITIES[e] ?? whole).replace(//g, "").split(/\s+/).filter(Boolean);
|
|
20
|
+
}
|
|
21
|
+
function commonWords(a, b) {
|
|
22
|
+
const ids = /* @__PURE__ */ new Map();
|
|
23
|
+
const intern = (words) => Int32Array.from(words, (w) => {
|
|
24
|
+
let id = ids.get(w);
|
|
25
|
+
if (id === void 0) {
|
|
26
|
+
id = ids.size;
|
|
27
|
+
ids.set(w, id);
|
|
28
|
+
}
|
|
29
|
+
return id;
|
|
30
|
+
});
|
|
31
|
+
let common = 0;
|
|
32
|
+
for (const op of diffOps(intern(a), intern(b))) if (op.tag === "equal") common += op.oldLen;
|
|
33
|
+
return common;
|
|
34
|
+
}
|
|
35
|
+
function htmlFiles(dir, base = dir) {
|
|
36
|
+
return fs.readdirSync(dir, { withFileTypes: true }).flatMap((e) => e.isDirectory() ? htmlFiles(path.join(dir, e.name), base) : e.name.endsWith(".html") ? [path.relative(base, path.join(dir, e.name)).split(path.sep).join("/")] : []);
|
|
37
|
+
}
|
|
38
|
+
function compareArticleText(before, after, keep = () => true, ignore = []) {
|
|
39
|
+
const read = (file) => ignore.reduce((html, re) => html.replace(re, ""), fs.readFileSync(file, "utf8"));
|
|
40
|
+
const pages = [];
|
|
41
|
+
for (const file of htmlFiles(before).filter(keep).sort(compareText)) {
|
|
42
|
+
const url = `/${file}`;
|
|
43
|
+
const a = articleWords(read(path.join(before, file)));
|
|
44
|
+
const other = path.join(after, file);
|
|
45
|
+
if (!fs.existsSync(other)) {
|
|
46
|
+
pages.push({ url, before: a.length, after: null, match: 0 });
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
const b = articleWords(read(other));
|
|
50
|
+
const longer = Math.max(a.length, b.length);
|
|
51
|
+
pages.push({ url, before: a.length, after: b.length, match: longer === 0 ? 1 : commonWords(a, b) / longer });
|
|
52
|
+
}
|
|
53
|
+
return { before, after, pages };
|
|
54
|
+
}
|
|
55
|
+
var pct = (x) => `${(Math.floor(x * 1e3) / 10).toFixed(1)}%`;
|
|
56
|
+
var n = (x) => String(x).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
57
|
+
function textSummary(report) {
|
|
58
|
+
const compared = report.pages.filter((p) => p.before > 0 && p.after !== null);
|
|
59
|
+
const words = compared.reduce((s, p) => s + p.before, 0);
|
|
60
|
+
const longer = compared.reduce((s, p) => s + Math.max(p.before, p.after), 0);
|
|
61
|
+
const common = compared.reduce((s, p) => s + p.match * Math.max(p.before, p.after), 0);
|
|
62
|
+
return {
|
|
63
|
+
pages: compared.length,
|
|
64
|
+
identical: compared.filter((p) => p.match === 1).length,
|
|
65
|
+
atLeast99: compared.filter((p) => p.match >= 0.99).length,
|
|
66
|
+
atLeast95: compared.filter((p) => p.match >= 0.95).length,
|
|
67
|
+
words,
|
|
68
|
+
match: longer === 0 ? 1 : common / longer,
|
|
69
|
+
noText: report.pages.filter((p) => p.before === 0).map((p) => p.url),
|
|
70
|
+
missing: report.pages.filter((p) => p.after === null && p.before > 0).map((p) => p.url)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function textMatchText(report, lines) {
|
|
74
|
+
const s = textSummary(report);
|
|
75
|
+
const shown = (dir) => path.basename(path.resolve(dir));
|
|
76
|
+
let out = `Comparing the article text (in <main>, or else <article> or <body>) of ${s.pages} ${s.pages === 1 ? "page" : "pages"}: ${report.before} and ${report.after}, word by word.
|
|
77
|
+
|
|
78
|
+
`;
|
|
79
|
+
out += `Identical: ${s.identical} of ${s.pages}; at least 99%: ${s.atLeast99}; at least 95%: ${s.atLeast95}.
|
|
80
|
+
`;
|
|
81
|
+
out += `All the words together: ${pct(s.match)} of ${n(s.words)} match.
|
|
82
|
+
`;
|
|
83
|
+
const differ = report.pages.filter((p) => p.before > 0 && p.after !== null && p.match < 1).sort((a, b) => a.match - b.match || compareText(a.url, b.url));
|
|
84
|
+
if (differ.length) {
|
|
85
|
+
const list = lines === 0 ? differ : differ.slice(0, lines);
|
|
86
|
+
out += `
|
|
87
|
+
The least alike${list.length < differ.length ? ` (${list.length} of ${differ.length}; --lines 0 for all)` : ""}:
|
|
88
|
+
`;
|
|
89
|
+
for (const p of list) out += ` ${pct(p.match).padStart(6)} ${p.url} (${n(p.before)} words, ${n(p.after)} in ${shown(report.after)})
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
if (s.missing.length) out += `
|
|
93
|
+
Not in ${shown(report.after)}: ${s.missing.slice(0, 10).join(", ")}${s.missing.length > 10 ? `, and ${s.missing.length - 10} more` : ""}
|
|
94
|
+
`;
|
|
95
|
+
if (s.noText.length) out += `
|
|
96
|
+
No article text in ${shown(report.before)}: ${s.noText.slice(0, 10).join(", ")}${s.noText.length > 10 ? `, and ${s.noText.length - 10} more` : ""}
|
|
97
|
+
`;
|
|
98
|
+
const off = s.pages - s.identical + s.missing.length;
|
|
99
|
+
out += off === 0 ? "\nThe text matches on every page.\n" : `
|
|
100
|
+
The text differs on ${off} ${off === 1 ? "page" : "pages"}; \`ssqch diff\` without --text shows how.
|
|
101
|
+
`;
|
|
102
|
+
return out;
|
|
103
|
+
}
|
|
104
|
+
function textMatchJson(report) {
|
|
105
|
+
const s = textSummary(report);
|
|
106
|
+
return {
|
|
107
|
+
schemaVersion: 1,
|
|
108
|
+
before: report.before.replaceAll("\\", "/"),
|
|
109
|
+
after: report.after.replaceAll("\\", "/"),
|
|
110
|
+
summary: { pages: s.pages, identical: s.identical, atLeast99: s.atLeast99, atLeast95: s.atLeast95, words: s.words, match: Math.round(s.match * 1e4) / 1e4 },
|
|
111
|
+
pages: report.pages.map((p) => ({ url: p.url, before: p.before, after: p.after, match: Math.round(p.match * 1e4) / 1e4 }))
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
articleWords,
|
|
116
|
+
commonWords,
|
|
117
|
+
compareArticleText,
|
|
118
|
+
textMatchJson,
|
|
119
|
+
textMatchText,
|
|
120
|
+
textSummary
|
|
121
|
+
};
|
|
@@ -5,26 +5,28 @@ import {
|
|
|
5
5
|
} from "./chunk-3NYSSA2C.js";
|
|
6
6
|
import {
|
|
7
7
|
Options
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SNQOHNXE.js";
|
|
9
9
|
import {
|
|
10
10
|
BUILTINS,
|
|
11
11
|
cssWithBase,
|
|
12
12
|
debugString,
|
|
13
13
|
wasi
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-VILOEVK7.js";
|
|
15
15
|
import {
|
|
16
16
|
WebAssembly
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6OUCRDYI.js";
|
|
18
18
|
import {
|
|
19
19
|
BuildError,
|
|
20
20
|
bail,
|
|
21
|
+
messageOf
|
|
22
|
+
} from "./chunk-YNJNMQWU.js";
|
|
23
|
+
import {
|
|
21
24
|
comparePaths,
|
|
22
25
|
displayPath,
|
|
23
26
|
isInside,
|
|
24
|
-
messageOf,
|
|
25
27
|
realPath,
|
|
26
28
|
slashes
|
|
27
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-VJWQSYEG.js";
|
|
28
30
|
|
|
29
31
|
// src/modules/sass.ts
|
|
30
32
|
import fs from "node:fs";
|
|
@@ -8,14 +8,15 @@ import {
|
|
|
8
8
|
measure,
|
|
9
9
|
overBudget,
|
|
10
10
|
urlOf
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-UHRBPZ4A.js";
|
|
12
|
+
import "./chunk-ULCT3PAV.js";
|
|
13
|
+
import "./chunk-6U5VIQVY.js";
|
|
14
|
+
import "./chunk-DDV6JEC2.js";
|
|
15
15
|
import "./chunk-FVZ5JBRI.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-FJML7INB.js";
|
|
17
17
|
import "./chunk-CMUWRPSQ.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-YNJNMQWU.js";
|
|
19
|
+
import "./chunk-VJWQSYEG.js";
|
|
19
20
|
import "./chunk-I3PS26CI.js";
|
|
20
21
|
export {
|
|
21
22
|
buildFiles,
|