ssqch 0.12.0 → 0.13.1

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.
Files changed (130) hide show
  1. package/bundled/completions/bash +66 -8
  2. package/bundled/completions/elvish +23 -4
  3. package/bundled/completions/fish +36 -25
  4. package/bundled/completions/powershell +25 -4
  5. package/bundled/completions/zsh +44 -10
  6. package/bundled/docs/agents.md +2 -2
  7. package/bundled/docs/build-summary.md +1 -1
  8. package/bundled/docs/comparing-builds.md +2 -2
  9. package/bundled/docs/configuring.md +3 -6
  10. package/bundled/docs/deploying.md +1 -1
  11. package/bundled/docs/field-guide.md +4 -4
  12. package/bundled/docs/github-pages.md +1 -0
  13. package/bundled/docs/index.md +1 -1
  14. package/bundled/docs/install.md +1 -1
  15. package/bundled/docs/known-gaps.md +1 -1
  16. package/bundled/docs/markdown.md +8 -12
  17. package/bundled/docs/nav.yml +5 -1
  18. package/bundled/docs/netlify.md +4 -2
  19. package/bundled/docs/patrol.md +48 -0
  20. package/bundled/docs/plugins.md +6 -6
  21. package/bundled/docs/robots.md +85 -0
  22. package/bundled/docs/seo.md +2 -38
  23. package/bundled/docs/serving-markdown.md +142 -0
  24. package/bundled/docs/template-languages.md +1 -1
  25. package/bundled/docs/templates.md +1 -1
  26. package/bundled/docs/trailheads/from-hugo.md +5 -3
  27. package/bundled/docs/trailheads/from-jekyll.md +54 -13
  28. package/bundled/docs/trailheads/from-mkdocs.md +15 -12
  29. package/bundled/docs/trailheads/from-vitepress.md +13 -11
  30. package/bundled/docs/trailheads.md +3 -3
  31. package/bundled/docs/where-values-come-from.md +5 -5
  32. package/bundled/docs/writing-plugins.md +69 -0
  33. package/bundled/ssqch.d.ts +118 -44
  34. package/bundled/starter/engines/index.edge +1 -0
  35. package/bundled/starter/engines/index.ejs +1 -0
  36. package/bundled/starter/engines/index.hbs +1 -0
  37. package/bundled/starter/engines/index.liquid +1 -0
  38. package/bundled/starter/engines/layout.edge +7 -0
  39. package/bundled/starter/engines/layout.ejs +4 -0
  40. package/bundled/starter/engines/layout.hbs +4 -0
  41. package/bundled/starter/engines/layout.liquid +4 -0
  42. package/bundled/starter/src/_data/site.json +1 -0
  43. package/bundled/starter/src/_includes/layout.jinja +4 -0
  44. package/bundled/starter/src/index.jinja +1 -0
  45. package/bundled/starter/ssqch.config.js +14 -1
  46. package/bundled/starter-docs/engines/edge/base.edge +7 -0
  47. package/bundled/starter-docs/engines/edge/doc.edge +4 -0
  48. package/bundled/starter-docs/engines/ejs/base.ejs +4 -0
  49. package/bundled/starter-docs/engines/ejs/doc.ejs +4 -0
  50. package/bundled/starter-docs/engines/hbs/base.hbs +4 -0
  51. package/bundled/starter-docs/engines/hbs/doc.hbs +3 -0
  52. package/bundled/starter-docs/engines/liquid/base.liquid +4 -0
  53. package/bundled/starter-docs/engines/liquid/doc.liquid +4 -0
  54. package/bundled/starter-docs/src/_data/site.json +1 -0
  55. package/bundled/starter-docs/src/_includes/base.jinja +4 -0
  56. package/bundled/starter-docs/src/_includes/doc.jinja +4 -0
  57. package/bundled/starter-docs/src/assets/docs.css +4 -0
  58. package/bundled/starter-docs/src/assets/docs.js +17 -0
  59. package/bundled/starter-docs/ssqch.config.js +14 -1
  60. package/lib/assets.js +9 -9
  61. package/lib/chunk-25WERNDD.js +112 -0
  62. package/lib/{chunk-4ZMNLWE4.js → chunk-2BJFGKOE.js} +2 -2
  63. package/lib/{chunk-M2BBE2C3.js → chunk-3ZTRIO6O.js} +18 -17
  64. package/lib/{chunk-57HLSKZS.js → chunk-4AZFCSGJ.js} +2 -2
  65. package/lib/{chunk-ULQHJ4TS.js → chunk-55WXDGO4.js} +3 -3
  66. package/lib/{chunk-JX43SJHU.js → chunk-6FY77I4M.js} +24 -22
  67. package/lib/{chunk-RY3KLUQ3.js → chunk-6OUCRDYI.js} +267 -202
  68. package/lib/{chunk-EVFNYUTR.js → chunk-6U5VIQVY.js} +5 -5
  69. package/lib/{chunk-N3IZ44XY.js → chunk-7U5GWTEH.js} +88 -54
  70. package/lib/{chunk-VTYQ3JKL.js → chunk-AIJNG6MJ.js} +2 -2
  71. package/lib/{chunk-IIBZPHAW.js → chunk-C2Q7JKFI.js} +8 -8
  72. package/lib/{chunk-6CSH757V.js → chunk-DFJFHULZ.js} +33 -8
  73. package/lib/{chunk-XVV7JJK7.js → chunk-ENWDM2RW.js} +40 -39
  74. package/lib/{chunk-JUALMFW3.js → chunk-ER72RPD6.js} +1 -1
  75. package/lib/{chunk-RFREB3SI.js → chunk-F3JPNFCZ.js} +7 -7
  76. package/lib/{chunk-LLOA3QXV.js → chunk-FENJHLNM.js} +3 -2
  77. package/lib/{chunk-UU43WIZG.js → chunk-FJML7INB.js} +4 -2
  78. package/lib/{chunk-IZCF4UH3.js → chunk-FQZDUDFK.js} +1 -1
  79. package/lib/chunk-GM5SHCTU.js +272 -0
  80. package/lib/{chunk-GVHQ37JE.js → chunk-GSNRAGKQ.js} +10 -5
  81. package/lib/{chunk-L2IY4P6O.js → chunk-GU7BBYWB.js} +3 -3
  82. package/lib/{chunk-RGYJQYW3.js → chunk-HDKU6LRI.js} +32 -5
  83. package/lib/{chunk-IQUGLVZY.js → chunk-K5WZ2VYK.js} +4 -4
  84. package/lib/{chunk-JVT5ZRRH.js → chunk-OOKBXQAY.js} +5 -5
  85. package/lib/{chunk-MOLTDO5A.js → chunk-SNQOHNXE.js} +1 -1
  86. package/lib/{chunk-Z3XH4KWX.js → chunk-SPIFZBIW.js} +1 -1
  87. package/lib/{chunk-FNNXRVSU.js → chunk-T5IUI7W7.js} +10 -10
  88. package/lib/{chunk-5HEZ3WUQ.js → chunk-TGSVSG2G.js} +2 -2
  89. package/lib/{chunk-3GROJ3TY.js → chunk-U2KEMVXO.js} +24 -17
  90. package/lib/{chunk-4B3N44SN.js → chunk-UHRBPZ4A.js} +3 -3
  91. package/lib/{chunk-GWWA5Y3X.js → chunk-ULCT3PAV.js} +1 -1
  92. package/lib/{chunk-7RGEWDLF.js → chunk-UZNUS7RP.js} +10 -8
  93. package/lib/{chunk-DZ5F5XSI.js → chunk-V3G2QGL3.js} +10 -105
  94. package/lib/{chunk-DOHOKUGB.js → chunk-VILOEVK7.js} +50 -26
  95. package/lib/{chunk-DXMDXHV7.js → chunk-WGAIE3DD.js} +15 -14
  96. package/lib/{chunk-G3RFQDKO.js → chunk-WUCRAV36.js} +8 -6
  97. package/lib/{chunk-52ROOMBZ.js → chunk-XYAWJTHM.js} +9 -9
  98. package/lib/{chunk-L3K7MMFC.js → chunk-YA23NDMW.js} +2 -2
  99. package/lib/{chunk-R7PBREXL.js → chunk-YNJNMQWU.js} +8 -5
  100. package/lib/{chunk-AK7ZKSZP.js → chunk-ZMG25MXF.js} +17 -16
  101. package/lib/cli.js +56 -34
  102. package/lib/elements.js +9 -9
  103. package/lib/from-hugo.js +36 -0
  104. package/lib/from-jekyll.js +41 -0
  105. package/lib/from-mkdocs.js +49 -0
  106. package/lib/from-vitepress.js +49 -0
  107. package/lib/image.js +10 -10
  108. package/lib/links.js +9 -9
  109. package/lib/llms.js +619 -54
  110. package/lib/minify.js +10 -10
  111. package/lib/redirects.js +9 -9
  112. package/lib/robots.js +87 -0
  113. package/lib/rss.js +22 -12
  114. package/lib/sass.js +10 -10
  115. package/lib/sitemap.js +22 -33
  116. package/lib/ssqch.js +5 -5
  117. package/lib/vue.js +14 -13
  118. package/package.json +21 -1
  119. package/types/from-hugo.d.ts +5 -0
  120. package/types/from-jekyll.d.ts +11 -0
  121. package/types/from-mkdocs.d.ts +11 -0
  122. package/types/from-vitepress.d.ts +5 -0
  123. package/types/index.d.ts +45 -29
  124. package/types/llms.d.ts +18 -8
  125. package/types/robots.d.ts +13 -0
  126. package/types/sass.d.ts +1 -1
  127. package/types/sitemap.d.ts +3 -5
  128. package/wasm/markdown.wasm +0 -0
  129. /package/lib/{chunk-JX43SJHU.js.LEGAL.txt → chunk-6FY77I4M.js.LEGAL.txt} +0 -0
  130. /package/lib/{chunk-R7PBREXL.js.LEGAL.txt → chunk-YNJNMQWU.js.LEGAL.txt} +0 -0
package/lib/minify.js CHANGED
@@ -2,35 +2,35 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  compressCss
5
- } from "./chunk-IQUGLVZY.js";
5
+ } from "./chunk-K5WZ2VYK.js";
6
6
  import "./chunk-3NYSSA2C.js";
7
7
  import {
8
8
  Options
9
- } from "./chunk-MOLTDO5A.js";
9
+ } from "./chunk-SNQOHNXE.js";
10
10
  import {
11
11
  BUILTINS,
12
12
  RustPlugin,
13
13
  compilePlugin
14
- } from "./chunk-DOHOKUGB.js";
15
- import "./chunk-GWWA5Y3X.js";
16
- import "./chunk-EVFNYUTR.js";
14
+ } from "./chunk-VILOEVK7.js";
15
+ import "./chunk-ULCT3PAV.js";
16
+ import "./chunk-6U5VIQVY.js";
17
17
  import "./chunk-AD3HAW3W.js";
18
18
  import "./chunk-YCOTX2VM.js";
19
19
  import "./chunk-DDV6JEC2.js";
20
- import "./chunk-RY3KLUQ3.js";
20
+ import "./chunk-6OUCRDYI.js";
21
+ import "./chunk-SPIFZBIW.js";
21
22
  import {
22
23
  closest
23
24
  } from "./chunk-FVZ5JBRI.js";
24
- import "./chunk-Z3XH4KWX.js";
25
- import "./chunk-UU43WIZG.js";
26
- import "./chunk-57HLSKZS.js";
25
+ import "./chunk-FJML7INB.js";
26
+ import "./chunk-4AZFCSGJ.js";
27
27
  import "./chunk-CMUWRPSQ.js";
28
28
  import {
29
29
  BuildError,
30
30
  messageOf,
31
31
  warn,
32
32
  warning
33
- } from "./chunk-R7PBREXL.js";
33
+ } from "./chunk-YNJNMQWU.js";
34
34
  import {
35
35
  displayPath
36
36
  } from "./chunk-VJWQSYEG.js";
package/lib/redirects.js CHANGED
@@ -2,28 +2,28 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-MOLTDO5A.js";
5
+ } from "./chunk-SNQOHNXE.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  escapeHtml,
10
10
  withBase
11
- } from "./chunk-DOHOKUGB.js";
12
- import "./chunk-GWWA5Y3X.js";
13
- import "./chunk-EVFNYUTR.js";
11
+ } from "./chunk-VILOEVK7.js";
12
+ import "./chunk-ULCT3PAV.js";
13
+ import "./chunk-6U5VIQVY.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
15
  import "./chunk-YCOTX2VM.js";
16
16
  import "./chunk-DDV6JEC2.js";
17
- import "./chunk-RY3KLUQ3.js";
17
+ import "./chunk-6OUCRDYI.js";
18
+ import "./chunk-SPIFZBIW.js";
18
19
  import "./chunk-FVZ5JBRI.js";
19
- import "./chunk-Z3XH4KWX.js";
20
- import "./chunk-UU43WIZG.js";
21
- import "./chunk-57HLSKZS.js";
20
+ import "./chunk-FJML7INB.js";
21
+ import "./chunk-4AZFCSGJ.js";
22
22
  import "./chunk-CMUWRPSQ.js";
23
23
  import {
24
24
  bail,
25
25
  context
26
- } from "./chunk-R7PBREXL.js";
26
+ } from "./chunk-YNJNMQWU.js";
27
27
  import {
28
28
  compareText,
29
29
  displayPath,
package/lib/robots.js ADDED
@@ -0,0 +1,87 @@
1
+ import { createRequire as __ssqchCreateRequire } from "node:module";
2
+ const require = __ssqchCreateRequire(import.meta.url);
3
+ import {
4
+ Options
5
+ } from "./chunk-SNQOHNXE.js";
6
+ import {
7
+ BUILTINS,
8
+ debugString
9
+ } from "./chunk-VILOEVK7.js";
10
+ import "./chunk-ULCT3PAV.js";
11
+ import "./chunk-6U5VIQVY.js";
12
+ import "./chunk-AD3HAW3W.js";
13
+ import "./chunk-YCOTX2VM.js";
14
+ import "./chunk-DDV6JEC2.js";
15
+ import "./chunk-6OUCRDYI.js";
16
+ import "./chunk-SPIFZBIW.js";
17
+ import "./chunk-FVZ5JBRI.js";
18
+ import "./chunk-FJML7INB.js";
19
+ import "./chunk-4AZFCSGJ.js";
20
+ import "./chunk-CMUWRPSQ.js";
21
+ import {
22
+ bail
23
+ } from "./chunk-YNJNMQWU.js";
24
+ import "./chunk-VJWQSYEG.js";
25
+ import "./chunk-I3PS26CI.js";
26
+
27
+ // src/modules/robots.ts
28
+ function robotsPlugin(options = {}) {
29
+ return { name: "ssqch/robots", builtin: "ssqch/robots", options };
30
+ }
31
+ var CRAWLERS = [
32
+ { token: "GPTBot", purpose: "training", who: "OpenAI", source: "https://developers.openai.com/api/docs/bots" },
33
+ { token: "ClaudeBot", purpose: "training", who: "Anthropic", source: "https://support.claude.com/en/articles/8896518" },
34
+ { token: "Google-Extended", purpose: "training", who: "Google (Gemini; Search isn't affected)", source: "https://specification.website/spec/agent-readiness/robots-for-ai-crawlers/" },
35
+ { token: "Applebot-Extended", purpose: "training", who: "Apple (Apple Intelligence; Siri and Spotlight aren't affected)", source: "https://specification.website/spec/agent-readiness/robots-for-ai-crawlers/" },
36
+ { token: "CCBot", purpose: "training", who: "Common Crawl", source: "https://commoncrawl.org/ccbot" },
37
+ { token: "meta-externalagent", purpose: "training", who: "Meta", source: "https://developers.facebook.com/docs/sharing/webmasters/web-crawlers" },
38
+ { token: "Bytespider", purpose: "training", who: "ByteDance", source: "https://specification.website/spec/agent-readiness/robots-for-ai-crawlers/" },
39
+ { token: "OAI-SearchBot", purpose: "search", who: "OpenAI (ChatGPT search)", source: "https://developers.openai.com/api/docs/bots" },
40
+ { token: "Claude-SearchBot", purpose: "search", who: "Anthropic", source: "https://support.claude.com/en/articles/8896518" },
41
+ { token: "PerplexityBot", purpose: "search", who: "Perplexity", source: "https://docs.perplexity.ai/docs/resources/perplexity-crawlers" },
42
+ { token: "ChatGPT-User", purpose: "fetch", who: "OpenAI", source: "https://developers.openai.com/api/docs/bots" },
43
+ { token: "Claude-User", purpose: "fetch", who: "Anthropic", source: "https://support.claude.com/en/articles/8896518" },
44
+ { token: "Perplexity-User", purpose: "fetch", who: "Perplexity", source: "https://docs.perplexity.ai/docs/resources/perplexity-crawlers" },
45
+ { token: "meta-externalfetcher", purpose: "fetch", who: "Meta", source: "https://developers.facebook.com/docs/sharing/webmasters/web-crawlers" }
46
+ ];
47
+ var PURPOSES = ["training", "search", "fetch"];
48
+ function robotsTxt(disallow, ai, sitemap) {
49
+ const lines = ["User-agent: *", ...disallow.length ? disallow.map((p) => `Disallow: ${p}`) : ["Allow: /"]];
50
+ for (const purpose of PURPOSES) {
51
+ if (ai[purpose]) continue;
52
+ lines.push("", ...CRAWLERS.filter((c) => c.purpose === purpose).map((c) => `User-agent: ${c.token}`), "Disallow: /");
53
+ }
54
+ if (sitemap) lines.push("", `Sitemap: ${sitemap}`);
55
+ return `${lines.join("\n")}
56
+ `;
57
+ }
58
+ BUILTINS.set("ssqch/robots", (config, given) => {
59
+ const o = new Options(given, ["ai", "disallow", "sitemap"]);
60
+ const disallow = o.list("disallow") ?? [];
61
+ for (const p of disallow) if (!p.startsWith("/")) bail(`disallow: ${debugString(p)} must be a URL path starting with /, like "/drafts/"`);
62
+ const ai = { training: true, search: true, fetch: true };
63
+ const given_ = o.get("ai");
64
+ if (given_ !== void 0) {
65
+ if (typeof given_ !== "object" || given_ === null || Array.isArray(given_)) bail("ai must be an object, like { training: false, search: true, fetch: true }");
66
+ for (const [key, value] of Object.entries(given_)) {
67
+ if (!PURPOSES.includes(key)) bail(`ai: unknown purpose "${key}" (purposes: ${PURPOSES.join(", ")})`);
68
+ if (typeof value !== "boolean") bail(`ai.${key} must be true or false`);
69
+ ai[key] = value;
70
+ }
71
+ }
72
+ const sitemap = o.get("sitemap");
73
+ if (sitemap !== void 0 && typeof sitemap !== "boolean" && !(typeof sitemap === "string" && /^https?:\/\//.test(sitemap))) bail(`sitemap must be true, false or the sitemap's whole address, like "https://example.com/sitemap.xml" (got ${debugString(sitemap)})`);
74
+ config.generators.push(["ssqch/robots", (config2) => {
75
+ const named = (v) => typeof v === "string" ? /(^|\/)robots\.txt$/.test(v) : v !== null && typeof v === "object" && Object.entries(v).some(([k, x]) => named(k) || named(x));
76
+ if (config2.passthrough.some(named)) bail("the site copies its own robots.txt (passthrough) and robotsPlugin() writes one: keep one of them. robotsPlugin() writes the sitemap line, `disallow` and the AI crawlers' groups (`ssqch docs robotsPlugin`)");
77
+ let line;
78
+ if (typeof sitemap === "string") line = sitemap;
79
+ else if (sitemap !== false && config2.sitemap) line = config2.sitemap();
80
+ else if (sitemap === true) bail(`sitemap: true needs sitemapPlugin({ url }) in the config, for the sitemap's address (or give the address: sitemap: "https://example.com/sitemap.xml")`);
81
+ const base = config2.base.replace(/\/$/, "");
82
+ return [{ path: "/robots.txt", contents: robotsTxt(disallow.map((p) => base + p), ai, line) }];
83
+ }]);
84
+ });
85
+ export {
86
+ robotsPlugin
87
+ };
package/lib/rss.js CHANGED
@@ -2,30 +2,32 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  feedImages
5
- } from "./chunk-ULQHJ4TS.js";
5
+ } from "./chunk-55WXDGO4.js";
6
6
  import {
7
7
  Options
8
- } from "./chunk-MOLTDO5A.js";
8
+ } from "./chunk-SNQOHNXE.js";
9
9
  import {
10
10
  BUILTINS,
11
11
  rewriteHtml,
12
12
  withBaseOnce
13
- } from "./chunk-DOHOKUGB.js";
14
- import "./chunk-GWWA5Y3X.js";
15
- import "./chunk-EVFNYUTR.js";
13
+ } from "./chunk-VILOEVK7.js";
14
+ import "./chunk-ULCT3PAV.js";
15
+ import "./chunk-6U5VIQVY.js";
16
16
  import "./chunk-AD3HAW3W.js";
17
17
  import "./chunk-YCOTX2VM.js";
18
18
  import "./chunk-DDV6JEC2.js";
19
- import "./chunk-RY3KLUQ3.js";
19
+ import "./chunk-6OUCRDYI.js";
20
+ import "./chunk-SPIFZBIW.js";
20
21
  import "./chunk-FVZ5JBRI.js";
21
- import "./chunk-Z3XH4KWX.js";
22
- import "./chunk-UU43WIZG.js";
23
- import "./chunk-57HLSKZS.js";
22
+ import "./chunk-FJML7INB.js";
23
+ import "./chunk-4AZFCSGJ.js";
24
24
  import "./chunk-CMUWRPSQ.js";
25
25
  import {
26
+ aliasUsed,
26
27
  bail,
28
+ find,
27
29
  toDate
28
- } from "./chunk-R7PBREXL.js";
30
+ } from "./chunk-YNJNMQWU.js";
29
31
  import "./chunk-VJWQSYEG.js";
30
32
  import "./chunk-I3PS26CI.js";
31
33
 
@@ -113,8 +115,16 @@ BUILTINS.set("ssqch/rss", (config, options) => {
113
115
  filters.set("getNewestCollectionItemDate", (items) => getNewestCollectionItemDate(items));
114
116
  filters.set("dateToRfc3339", (date) => dateToRfc3339(date));
115
117
  filters.set("dateToRfc822", (date) => dateToRfc822(date));
116
- filters.set("rssDate", (date) => dateToRfc3339(date));
117
- filters.set("rssLastUpdatedDate", (items) => dateToRfc3339(getNewestCollectionItemDate(items)));
118
+ const rssDate = find("rssDate", "filter");
119
+ const rssLastUpdatedDate = find("rssLastUpdatedDate", "filter");
120
+ filters.set("rssDate", (date) => {
121
+ aliasUsed(rssDate);
122
+ return dateToRfc3339(date);
123
+ });
124
+ filters.set("rssLastUpdatedDate", (items) => {
125
+ aliasUsed(rssLastUpdatedDate);
126
+ return dateToRfc3339(getNewestCollectionItemDate(items));
127
+ });
118
128
  filters.set("absoluteUrl", (url, base) => absoluteUrl(output(url), output(base), config.base));
119
129
  filters.set("htmlToAbsoluteUrls", (html, base) => htmlToAbsoluteUrls(output(html), output(base), config.base));
120
130
  const unprefixed = (e) => {
package/lib/sass.js CHANGED
@@ -2,22 +2,22 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  sassPlugin
5
- } from "./chunk-IQUGLVZY.js";
5
+ } from "./chunk-K5WZ2VYK.js";
6
6
  import "./chunk-3NYSSA2C.js";
7
- import "./chunk-MOLTDO5A.js";
8
- import "./chunk-DOHOKUGB.js";
9
- import "./chunk-GWWA5Y3X.js";
10
- import "./chunk-EVFNYUTR.js";
7
+ import "./chunk-SNQOHNXE.js";
8
+ import "./chunk-VILOEVK7.js";
9
+ import "./chunk-ULCT3PAV.js";
10
+ import "./chunk-6U5VIQVY.js";
11
11
  import "./chunk-AD3HAW3W.js";
12
12
  import "./chunk-YCOTX2VM.js";
13
13
  import "./chunk-DDV6JEC2.js";
14
- import "./chunk-RY3KLUQ3.js";
14
+ import "./chunk-6OUCRDYI.js";
15
+ import "./chunk-SPIFZBIW.js";
15
16
  import "./chunk-FVZ5JBRI.js";
16
- import "./chunk-Z3XH4KWX.js";
17
- import "./chunk-UU43WIZG.js";
18
- import "./chunk-57HLSKZS.js";
17
+ import "./chunk-FJML7INB.js";
18
+ import "./chunk-4AZFCSGJ.js";
19
19
  import "./chunk-CMUWRPSQ.js";
20
- import "./chunk-R7PBREXL.js";
20
+ import "./chunk-YNJNMQWU.js";
21
21
  import "./chunk-VJWQSYEG.js";
22
22
  import "./chunk-I3PS26CI.js";
23
23
  export {
package/lib/sitemap.js CHANGED
@@ -2,32 +2,30 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-MOLTDO5A.js";
5
+ } from "./chunk-SNQOHNXE.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  escapeHtml,
10
10
  isoDay
11
- } from "./chunk-DOHOKUGB.js";
12
- import "./chunk-GWWA5Y3X.js";
13
- import "./chunk-EVFNYUTR.js";
11
+ } from "./chunk-VILOEVK7.js";
12
+ import "./chunk-ULCT3PAV.js";
13
+ import "./chunk-6U5VIQVY.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
15
  import "./chunk-YCOTX2VM.js";
16
16
  import "./chunk-DDV6JEC2.js";
17
- import "./chunk-RY3KLUQ3.js";
18
- import "./chunk-FVZ5JBRI.js";
17
+ import "./chunk-6OUCRDYI.js";
19
18
  import {
20
19
  globSet
21
- } from "./chunk-Z3XH4KWX.js";
22
- import "./chunk-UU43WIZG.js";
23
- import "./chunk-57HLSKZS.js";
20
+ } from "./chunk-SPIFZBIW.js";
21
+ import "./chunk-FVZ5JBRI.js";
22
+ import "./chunk-FJML7INB.js";
23
+ import "./chunk-4AZFCSGJ.js";
24
24
  import "./chunk-CMUWRPSQ.js";
25
25
  import {
26
26
  bail,
27
- toDate,
28
- warn,
29
- warning
30
- } from "./chunk-R7PBREXL.js";
27
+ toDate
28
+ } from "./chunk-YNJNMQWU.js";
31
29
  import {
32
30
  compareText
33
31
  } from "./chunk-VJWQSYEG.js";
@@ -45,26 +43,29 @@ function isLaterPage(data) {
45
43
  return number > 0 && size > 1;
46
44
  }
47
45
  BUILTINS.set("ssqch/sitemap", (config, given) => {
48
- const o = new Options(given, ["url", "exclude", "lastmod", "output", "paginated", "alternates", "format"]);
49
- const format = o.string("format") ?? "ssqch";
50
- if (format !== "ssqch" && format !== "vitepress") bail(`format must be "ssqch" or "vitepress" (got ${debugString(format)})`);
46
+ if (given !== null && typeof given === "object" && Object.hasOwn(given, "format")) bail("`format` is gone: the sitemap is ssqch's own, with the same URLs as any other generator's. Leave it out (`ssqch diff` lists sitemap.xml as changed, and that's expected)");
47
+ const o = new Options(given, ["url", "exclude", "lastmod", "output", "paginated", "alternates"]);
51
48
  const alternates = o.get("alternates");
52
49
  if (alternates !== void 0 && typeof alternates !== "function") bail(`alternates must be a function that gets each page and returns its translations, like (page) => [{ hreflang: "fr", href: "/fr/" }] (got ${typeof alternates})`);
53
- const url = o.string("url") || void 0;
50
+ const url = o.string("url");
51
+ if (url === void 0 || url === "") bail(`needs the site's address, like sitemapPlugin({ url: "https://example.com" }): a sitemap lists whole addresses, and search engines read only those`);
54
52
  const exclude = o.list("exclude") ?? [];
55
- const lastmod = o.bool("lastmod") ?? format === "ssqch";
53
+ const lastmod = o.bool("lastmod") ?? true;
56
54
  const output = o.string("output") ?? "/sitemap.xml";
57
55
  const paginated = o.bool("paginated") ?? false;
58
- if (url !== void 0 && !(url.startsWith("https://") || url.startsWith("http://"))) bail(`url must be the site's address, like "https://example.com" (got ${debugString(url)})`);
56
+ if (!(url.startsWith("https://") || url.startsWith("http://"))) bail(`url must be the site's address, like "https://example.com" (got ${debugString(url)})`);
59
57
  if (!output.startsWith("/") || output.endsWith("/")) bail(`output must be a URL path to a file, like "/sitemap.xml" (got ${debugString(output)})`);
60
58
  const matchers = exclude.map((glob) => {
61
59
  if (!glob.startsWith("/")) bail(`exclude: ${debugString(glob)} must be a URL path or glob starting with /, like "/tags/**"`);
62
60
  return globSet("exclude", [glob]);
63
61
  });
64
62
  const excluded = (url2) => matchers.some((m) => m(url2));
63
+ config.sitemap = () => {
64
+ const trimmed = url.replace(/\/+$/, "");
65
+ return `${trimmed.endsWith(config.base) ? trimmed : trimmed + config.base}${output}`;
66
+ };
65
67
  config.generators.push(["ssqch/sitemap", (config2, pages) => {
66
- if (url === void 0) warn(warning("config", `sitemapPlugin() has no url, so ${output}'s <loc>s are paths from the site's root (as jekyll-sitemap writes them without one), and search engines read only whole addresses: give it the site's address, like { url: "https://example.com" }`));
67
- const trimmed = (url ?? "").replace(/\/+$/, "");
68
+ const trimmed = url.replace(/\/+$/, "");
68
69
  const withBase = trimmed.endsWith(config2.base) ? trimmed : trimmed + config2.base;
69
70
  const entries = [];
70
71
  const absolute = (href) => href.startsWith("/") ? withBase + href : href;
@@ -95,18 +96,6 @@ BUILTINS.set("ssqch/sitemap", (config, given) => {
95
96
  }
96
97
  entries.sort((a, b) => compareText(a[0], b[0]) || compareText(a[1], b[1]));
97
98
  const loc = escapeHtml(withBase);
98
- if (format === "vitepress") {
99
- const file = (u) => u.endsWith("/") ? `${u}index.html` : u;
100
- entries.sort((a, b) => compareText(file(a[0]), file(b[0])));
101
- let xml2 = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">';
102
- for (const [pageUrl, date, links] of entries) {
103
- xml2 += `<url><loc>${loc}${escapeHtml(pageUrl)}</loc>`;
104
- if (lastmod) xml2 += `<lastmod>${date}</lastmod>`;
105
- for (const [hreflang, href] of links) xml2 += `<xhtml:link rel="alternate" hreflang="${escapeHtml(hreflang)}" href="${escapeHtml(href)}"/>`;
106
- xml2 += "</url>";
107
- }
108
- return [{ path: output, contents: `${xml2}</urlset>` }];
109
- }
110
99
  const xhtml = entries.some((e) => e[2].length) ? ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' : "";
111
100
  let xml = `<?xml version="1.0" encoding="utf-8"?>
112
101
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${xhtml}>
package/lib/ssqch.js CHANGED
@@ -9,13 +9,13 @@ import {
9
9
  safe,
10
10
  slugger,
11
11
  slugify
12
- } from "./chunk-RY3KLUQ3.js";
12
+ } from "./chunk-6OUCRDYI.js";
13
+ import "./chunk-SPIFZBIW.js";
13
14
  import "./chunk-FVZ5JBRI.js";
14
- import "./chunk-Z3XH4KWX.js";
15
- import "./chunk-UU43WIZG.js";
16
- import "./chunk-57HLSKZS.js";
15
+ import "./chunk-FJML7INB.js";
16
+ import "./chunk-4AZFCSGJ.js";
17
17
  import "./chunk-CMUWRPSQ.js";
18
- import "./chunk-R7PBREXL.js";
18
+ import "./chunk-YNJNMQWU.js";
19
19
  import "./chunk-VJWQSYEG.js";
20
20
  import "./chunk-I3PS26CI.js";
21
21
  export {
package/lib/vue.js CHANGED
@@ -2,26 +2,26 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-MOLTDO5A.js";
5
+ } from "./chunk-SNQOHNXE.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString
9
- } from "./chunk-DOHOKUGB.js";
10
- import "./chunk-GWWA5Y3X.js";
11
- import "./chunk-EVFNYUTR.js";
9
+ } from "./chunk-VILOEVK7.js";
10
+ import "./chunk-ULCT3PAV.js";
11
+ import "./chunk-6U5VIQVY.js";
12
12
  import "./chunk-AD3HAW3W.js";
13
13
  import "./chunk-YCOTX2VM.js";
14
14
  import "./chunk-DDV6JEC2.js";
15
- import "./chunk-RY3KLUQ3.js";
15
+ import "./chunk-6OUCRDYI.js";
16
+ import "./chunk-SPIFZBIW.js";
16
17
  import "./chunk-FVZ5JBRI.js";
17
- import "./chunk-Z3XH4KWX.js";
18
- import "./chunk-UU43WIZG.js";
19
- import "./chunk-57HLSKZS.js";
18
+ import "./chunk-FJML7INB.js";
19
+ import "./chunk-4AZFCSGJ.js";
20
20
  import "./chunk-CMUWRPSQ.js";
21
21
  import {
22
22
  BuildError,
23
23
  bail
24
- } from "./chunk-R7PBREXL.js";
24
+ } from "./chunk-YNJNMQWU.js";
25
25
  import "./chunk-VJWQSYEG.js";
26
26
  import "./chunk-I3PS26CI.js";
27
27
 
@@ -106,7 +106,8 @@ var HYDRATE = ["load", "idle", "visible"];
106
106
  var MARK = (n) => `\uE050${n}\uE051`;
107
107
  var MARKS = /\uE050(\d+)\uE051/g;
108
108
  BUILTINS.set("ssqch/vue", (config, given) => {
109
- const o = new Options(given, ["components", "root", "hydrate", "css", "vite", "vitepress"]);
109
+ if (given !== null && typeof given === "object" && Object.hasOwn(given, "vitepress")) bail('`vitepress` is fromVitepress() from "ssqch/from-vitepress" now: add it to plugins, and vuePlugin() gives the components VitePress\'s `useData()`, `@theme/` and data loaders (`ssqch docs fromVitepress`)');
110
+ const o = new Options(given, ["components", "root", "hydrate", "css", "vite"]);
110
111
  const globals = o.get("components") ?? {};
111
112
  if (typeof globals !== "object" || globals === null || Array.isArray(globals)) bail(`components must be an object of { Name: "path/to/Name.vue" }, the ones the site registers for every page (VitePress's \`app.component()\`) (got ${shown(globals)})`);
112
113
  for (const [name, file] of Object.entries(globals)) if (!/^[A-Z]\w*$/.test(name) || typeof file !== "string") bail(`components: ${debugString(name)} must be a PascalCase name with a .vue file's path, like { Badge: ".vitepress/theme/Badge.vue" }`);
@@ -120,7 +121,6 @@ BUILTINS.set("ssqch/vue", (config, given) => {
120
121
  if (typeof extra !== "object" || extra === null) bail(`vite must be Vite's options to add, like { resolve: { alias: { "@theme": "./.vitepress/theme" } } } (got ${shown(extra)})`);
121
122
  const rootGiven = o.string("root");
122
123
  const vitepressFolder = [".vitepress", "docs/.vitepress"].map((f) => path.join(config.root, f)).find((f) => fs.existsSync(f));
123
- const vitepress = o.bool("vitepress") ?? vitepressFolder !== void 0;
124
124
  const cache = path.join(config.root, ".cache", "ssqch", "vue");
125
125
  const globalFile = (file) => file.startsWith(".") ? path.resolve(config.root, file) : file;
126
126
  let byPage = /* @__PURE__ */ new Map();
@@ -180,6 +180,7 @@ BUILTINS.set("ssqch/vue", (config, given) => {
180
180
  const vue = vuePluginModule.default ?? vuePluginModule;
181
181
  fs.rmSync(cache, { recursive: true, force: true });
182
182
  fs.mkdirSync(cache, { recursive: true });
183
+ const vitepress = config.vitepress;
183
184
  const shim = path.join(cache, "vitepress.js");
184
185
  const quiet = { logLevel: config.quiet ? "silent" : "warn" };
185
186
  const root = path.resolve(config.root, rootGiven ?? config.input);
@@ -276,7 +277,7 @@ BUILTINS.set("ssqch/vue", (config, given) => {
276
277
  ""
277
278
  ].join("\n"));
278
279
  try {
279
- await vite.build({ ...base, plugins: [loaders, ...base.plugins], ...quiet, base: config.base || "/", build: { ssr: server, outDir: path.join(cache, "ssr"), emptyOutDir: true, minify: false, cssCodeSplit: false, ssrEmitAssets: true, rollupOptions: { output: { entryFileNames: "server.mjs" } } } });
280
+ await vite.build({ ...base, plugins: [...vitepress ? [loaders] : [], ...base.plugins], ...quiet, base: config.base || "/", build: { ssr: server, outDir: path.join(cache, "ssr"), emptyOutDir: true, minify: false, cssCodeSplit: false, ssrEmitAssets: true, rollupOptions: { output: { entryFileNames: "server.mjs" } } } });
280
281
  } catch (e) {
281
282
  throw e instanceof BuildError ? e : new BuildError(`vuePlugin(): Vite couldn't build the components for the server: ${e instanceof Error ? e.message : String(e)}`);
282
283
  }
@@ -299,7 +300,7 @@ BUILTINS.set("ssqch/vue", (config, given) => {
299
300
  ""
300
301
  ].join("\n"));
301
302
  try {
302
- await vite.build({ ...base, plugins: [loaders, ...base.plugins], ...quiet, base: `${config.base.replace(/\/$/, "")}/assets/vue/`, build: { outDir: path.join(cache, "client"), emptyOutDir: true, manifest: false, cssCodeSplit: false, rollupOptions: { input: client, output: { entryFileNames: "islands.js", chunkFileNames: "[name]-[hash].js", assetFileNames: "[name]-[hash][extname]" } } } });
303
+ await vite.build({ ...base, plugins: [...vitepress ? [loaders] : [], ...base.plugins], ...quiet, base: `${config.base.replace(/\/$/, "")}/assets/vue/`, build: { outDir: path.join(cache, "client"), emptyOutDir: true, manifest: false, cssCodeSplit: false, rollupOptions: { input: client, output: { entryFileNames: "islands.js", chunkFileNames: "[name]-[hash].js", assetFileNames: "[name]-[hash][extname]" } } } });
303
304
  } catch (e) {
304
305
  throw new BuildError(`vuePlugin(): Vite couldn't build the components for the browser: ${e instanceof Error ? e.message : String(e)}`);
305
306
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssqch",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "SiteSquatch (ssqch): a fast static site generator, configured with JavaScript",
5
5
  "keywords": [
6
6
  "static site generator",
@@ -54,6 +54,22 @@
54
54
  "types": "./types/sitemap.d.ts",
55
55
  "default": "./lib/sitemap.js"
56
56
  },
57
+ "./from-vitepress": {
58
+ "types": "./types/from-vitepress.d.ts",
59
+ "default": "./lib/from-vitepress.js"
60
+ },
61
+ "./from-mkdocs": {
62
+ "types": "./types/from-mkdocs.d.ts",
63
+ "default": "./lib/from-mkdocs.js"
64
+ },
65
+ "./from-jekyll": {
66
+ "types": "./types/from-jekyll.d.ts",
67
+ "default": "./lib/from-jekyll.js"
68
+ },
69
+ "./from-hugo": {
70
+ "types": "./types/from-hugo.d.ts",
71
+ "default": "./lib/from-hugo.js"
72
+ },
57
73
  "./vue": {
58
74
  "types": "./types/vue.d.ts",
59
75
  "default": "./lib/vue.js"
@@ -62,6 +78,10 @@
62
78
  "types": "./types/llms.d.ts",
63
79
  "default": "./lib/llms.js"
64
80
  },
81
+ "./robots": {
82
+ "types": "./types/robots.d.ts",
83
+ "default": "./lib/robots.js"
84
+ },
65
85
  "./elements": {
66
86
  "types": "./types/elements.d.ts",
67
87
  "default": "./lib/elements.js"
@@ -0,0 +1,5 @@
1
+ // ssqch/from-hugo: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+ /** Hugo's shortcodes for a site moving from Hugo, as a default under the site's own `markdown` options (`shortcodes: "hugo"`): a shortcode on a line of its own (`{{< note type="tip" >}}` to `{{< /note >}}`, or `{{% %}}`) is a container rendered by `_includes/containers/<name>.*`, with its arguments as `container.props`, and one inside a line of text renders the same template in its place, with `container.inline` true. Takes no options. */
5
+ export function fromHugo(): BuiltinPlugin;
@@ -0,0 +1,11 @@
1
+ // ssqch/from-jekyll: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+ export interface FromJekyllOptions {
5
+ /** Templates see Jekyll's `page` and `site`, so a Jekyll site's layouts and includes run as written: `page` has the page's front matter too (`page.title`; ssqch's own keys, like `url` and `date`, win), `page.path` and `page.categories`; `site` has the site's own keys, `posts` (newest first), each collection by its tag (`site.articles`), `pages`, `html_pages`, `categories`, `tags`, `data` (the global data) and `time`; and items read in Jekyll's shape (`post.title`, `post.content`, `post.excerpt`). Default `true`. */
6
+ templates?: boolean;
7
+ /** kramdown's Markdown, each a default under the site's own `markdown` options: Markdown inside HTML with `markdown="1"` (`htmlMarkdown: "kramdown"`), kramdown's heading ids (`headingIds: "kramdown"`), smart quotes (`smartPunctuation: true`) and no links from bare URLs (`autolinks: false`). Default `true`. */
8
+ kramdown?: boolean;
9
+ }
10
+ /** What a Jekyll site's templates and Markdown expect, for a site moving from Jekyll: Jekyll's `page` and `site` in templates, and kramdown's Markdown. */
11
+ export function fromJekyll(options?: FromJekyllOptions): BuiltinPlugin;
@@ -0,0 +1,11 @@
1
+ // ssqch/from-mkdocs: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+ export interface FromMkdocsOptions {
5
+ /** The mkdocs.yml, from the project root, that `templates` reads. Default `"mkdocs.yml"`. */
6
+ config?: string;
7
+ /** What MkDocs gives a theme's templates, so an MkDocs theme's Jinja (Material for MkDocs') runs as written: `config`, `nav`, `page` (with `content` and `toc` in layouts), `base_url`, the `url` filter, `main.html` (or a page's `template`) as a Markdown page's layout, the theme's `404.html` as the 404 page, and `.jinja` not escaping what it prints, as MkDocs' Jinja doesn't. Default `false`: turn it on once the theme's templates are in the site (`theme: "theme"`). */
8
+ templates?: boolean;
9
+ }
10
+ /** MkDocs' Markdown for a site moving from MkDocs, each a default under the site's own `markdown` options: Python-Markdown's reading (`dialect: "python-markdown"`: raw HTML blocks to their closing tag, lists at four spaces), its toc's heading ids, `!!! note` admonitions and `=== "Tab"` tabs as Material writes them, and `.md` links from the page; and with `templates`, MkDocs' context for a theme's templates. */
11
+ export function fromMkdocs(options?: FromMkdocsOptions): BuiltinPlugin;
@@ -0,0 +1,5 @@
1
+ // ssqch/from-vitepress: from ssqch.d.ts, the types `ssqch types` writes.
2
+ /// <reference path="./globals.d.ts" />
3
+ import type { BuiltinPlugin } from "ssqch";
4
+ /** VitePress's Markdown, for a site moving from VitePress, and VitePress's ways for `vuePlugin()`'s components (`useData()` and the rest from "vitepress", `@theme/`, and `./x.data` imports running its data loaders): Vue's `<script>` and `<style>` blocks and `<ClientOnly>` left out, VitePress's markup for headings (`header-anchor`), links (`.html` with `urls: "html"`, external ones in a new tab), code blocks and tables, its `tip`, `info`, `warning`, `danger`, `details`, `raw` and `code-group` containers, `[[toc]]`, and, under the site's own `markdown` options, its heading ids and email autolinks. A site's own hook or container template of the same name replaces VitePress's. Takes no options. */
5
+ export function fromVitepress(): BuiltinPlugin;