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.
Files changed (138) hide show
  1. package/bundled/completions/bash +67 -9
  2. package/bundled/completions/elvish +24 -4
  3. package/bundled/completions/fish +37 -25
  4. package/bundled/completions/powershell +26 -4
  5. package/bundled/completions/zsh +45 -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 +7 -4
  9. package/bundled/docs/configuring.md +7 -12
  10. package/bundled/docs/deploying.md +1 -1
  11. package/bundled/docs/field-guide.md +4 -4
  12. package/bundled/docs/github-pages.md +2 -1
  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 +11 -13
  17. package/bundled/docs/nav.yml +6 -1
  18. package/bundled/docs/netlify.md +4 -2
  19. package/bundled/docs/patrol.md +48 -0
  20. package/bundled/docs/plugins.md +6 -4
  21. package/bundled/docs/robots.md +72 -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 +2 -1
  25. package/bundled/docs/templates.md +2 -1
  26. package/bundled/docs/trailheads/from-component-frameworks.md +9 -10
  27. package/bundled/docs/trailheads/from-hugo.md +5 -3
  28. package/bundled/docs/trailheads/from-jekyll.md +54 -13
  29. package/bundled/docs/trailheads/from-mkdocs.md +15 -12
  30. package/bundled/docs/trailheads/from-vitepress.md +142 -0
  31. package/bundled/docs/trailheads.md +5 -5
  32. package/bundled/docs/where-values-come-from.md +5 -5
  33. package/bundled/docs/writing-plugins.md +69 -0
  34. package/bundled/ssqch.d.ts +150 -34
  35. package/bundled/starter/engines/index.edge +1 -0
  36. package/bundled/starter/engines/index.ejs +1 -0
  37. package/bundled/starter/engines/index.hbs +1 -0
  38. package/bundled/starter/engines/index.liquid +1 -0
  39. package/bundled/starter/engines/layout.edge +7 -0
  40. package/bundled/starter/engines/layout.ejs +4 -0
  41. package/bundled/starter/engines/layout.hbs +4 -0
  42. package/bundled/starter/engines/layout.liquid +4 -0
  43. package/bundled/starter/src/_data/site.json +1 -0
  44. package/bundled/starter/src/_includes/layout.jinja +4 -0
  45. package/bundled/starter/src/index.jinja +1 -0
  46. package/bundled/starter/ssqch.config.js +14 -1
  47. package/bundled/starter-docs/engines/edge/base.edge +7 -0
  48. package/bundled/starter-docs/engines/edge/doc.edge +4 -0
  49. package/bundled/starter-docs/engines/ejs/base.ejs +4 -0
  50. package/bundled/starter-docs/engines/ejs/doc.ejs +4 -0
  51. package/bundled/starter-docs/engines/hbs/base.hbs +4 -0
  52. package/bundled/starter-docs/engines/hbs/doc.hbs +3 -0
  53. package/bundled/starter-docs/engines/liquid/base.liquid +4 -0
  54. package/bundled/starter-docs/engines/liquid/doc.liquid +4 -0
  55. package/bundled/starter-docs/src/_data/site.json +1 -0
  56. package/bundled/starter-docs/src/_includes/base.jinja +4 -0
  57. package/bundled/starter-docs/src/_includes/doc.jinja +4 -0
  58. package/bundled/starter-docs/src/assets/docs.css +4 -0
  59. package/bundled/starter-docs/src/assets/docs.js +17 -0
  60. package/bundled/starter-docs/ssqch.config.js +14 -1
  61. package/lib/assets.js +13 -11
  62. package/lib/chunk-25WERNDD.js +112 -0
  63. package/lib/{chunk-H5K2ZE7B.js → chunk-2BJFGKOE.js} +13 -5
  64. package/lib/chunk-2FKYWYAB.js +268 -0
  65. package/lib/{chunk-LJOURBYT.js → chunk-3ZTRIO6O.js} +21 -19
  66. package/lib/{chunk-IOBC665M.js → chunk-4AZFCSGJ.js} +5 -3
  67. package/lib/{chunk-HWW5NCVJ.js → chunk-4Q6WMTER.js} +1 -1
  68. package/lib/{chunk-V2FSMOFX.js → chunk-55WXDGO4.js} +3 -3
  69. package/lib/{chunk-ZR3JYLFB.js → chunk-6FY77I4M.js} +331 -58
  70. package/lib/{chunk-JC54PHIT.js → chunk-6OUCRDYI.js} +514 -141
  71. package/lib/{chunk-ERAIEV3O.js → chunk-6U5VIQVY.js} +9 -7
  72. package/lib/{chunk-Z5OP43HU.js → chunk-7U5GWTEH.js} +455 -94
  73. package/lib/{chunk-CMJ7X5WW.js → chunk-AIJNG6MJ.js} +3 -2
  74. package/lib/{chunk-3K237XAX.js → chunk-C2Q7JKFI.js} +12 -10
  75. package/lib/{chunk-GS5B3CBW.js → chunk-DDV6JEC2.js} +1 -1
  76. package/lib/{chunk-A75EVUJX.js → chunk-DFJFHULZ.js} +47 -20
  77. package/lib/{chunk-KZZS4W2V.js → chunk-ENWDM2RW.js} +45 -42
  78. package/lib/{chunk-I3HYKEEW.js → chunk-ER72RPD6.js} +3 -3
  79. package/lib/chunk-F3JPNFCZ.js +23 -0
  80. package/lib/{chunk-B5E27PLU.js → chunk-FENJHLNM.js} +6 -3
  81. package/lib/{chunk-UU43WIZG.js → chunk-FJML7INB.js} +4 -2
  82. package/lib/{chunk-KCF2Z6N7.js → chunk-FQZDUDFK.js} +5 -3
  83. package/lib/{chunk-GJNIQAIH.js → chunk-GSNRAGKQ.js} +13 -6
  84. package/lib/{chunk-443ZQLVX.js → chunk-GU7BBYWB.js} +5 -4
  85. package/lib/{chunk-X2GAVYV2.js → chunk-HDKU6LRI.js} +110 -748
  86. package/lib/chunk-J3C2LEW7.js +121 -0
  87. package/lib/{chunk-XS4EJSEK.js → chunk-K5WZ2VYK.js} +7 -5
  88. package/lib/{chunk-3HZZY3Y7.js → chunk-OOKBXQAY.js} +7 -6
  89. package/lib/chunk-P2WS4RM4.js +707 -0
  90. package/lib/{chunk-RBNPBTDP.js → chunk-SNQOHNXE.js} +1 -1
  91. package/lib/{chunk-HFSWUTXX.js → chunk-SPIFZBIW.js} +1 -1
  92. package/lib/{chunk-QLUTNR37.js → chunk-T5IUI7W7.js} +12 -11
  93. package/lib/{chunk-ZINLHOX4.js → chunk-TGSVSG2G.js} +3 -2
  94. package/lib/{chunk-2L3HR67O.js → chunk-U2KEMVXO.js} +24 -16
  95. package/lib/{chunk-RYIWYWRQ.js → chunk-UHRBPZ4A.js} +7 -5
  96. package/lib/{chunk-2QTJTEBV.js → chunk-ULCT3PAV.js} +1 -1
  97. package/lib/{chunk-FCM3NYFR.js → chunk-UZNUS7RP.js} +12 -9
  98. package/lib/{chunk-GLJQ4C76.js → chunk-V3G2QGL3.js} +13 -106
  99. package/lib/{chunk-Z44IAMNG.js → chunk-VILOEVK7.js} +60 -28
  100. package/lib/chunk-VJWQSYEG.js +119 -0
  101. package/lib/{chunk-5ELAUHRL.js → chunk-WGAIE3DD.js} +23 -19
  102. package/lib/{chunk-OQGXZYZS.js → chunk-WUCRAV36.js} +13 -7
  103. package/lib/{chunk-RZYAIX2R.js → chunk-XYAWJTHM.js} +11 -10
  104. package/lib/{chunk-OSBEH67S.js → chunk-YA23NDMW.js} +5 -3
  105. package/lib/{chunk-AIMEXBTK.js → chunk-YNJNMQWU.js} +37 -142
  106. package/lib/{chunk-QJ5ZFTML.js → chunk-ZMG25MXF.js} +20 -18
  107. package/lib/cli.js +72 -35
  108. package/lib/elements.js +13 -11
  109. package/lib/from-hugo.js +36 -0
  110. package/lib/from-jekyll.js +41 -0
  111. package/lib/from-mkdocs.js +49 -0
  112. package/lib/from-vitepress.js +49 -0
  113. package/lib/image.js +12 -11
  114. package/lib/links.js +13 -11
  115. package/lib/llms.js +613 -0
  116. package/lib/minify.js +14 -12
  117. package/lib/redirects.js +13 -11
  118. package/lib/robots.js +87 -0
  119. package/lib/rss.js +24 -13
  120. package/lib/sass.js +12 -11
  121. package/lib/sitemap.js +23 -18
  122. package/lib/ssqch.js +6 -5
  123. package/lib/vue.js +400 -0
  124. package/package.json +29 -1
  125. package/types/from-hugo.d.ts +5 -0
  126. package/types/from-jekyll.d.ts +11 -0
  127. package/types/from-mkdocs.d.ts +11 -0
  128. package/types/from-vitepress.d.ts +5 -0
  129. package/types/index.d.ts +51 -31
  130. package/types/llms.d.ts +27 -0
  131. package/types/robots.d.ts +13 -0
  132. package/types/sass.d.ts +1 -1
  133. package/types/sitemap.d.ts +2 -2
  134. package/types/vue.d.ts +17 -0
  135. package/wasm/markdown.wasm +0 -0
  136. package/lib/chunk-RVXGUMFI.js +0 -21
  137. /package/lib/{chunk-ZR3JYLFB.js.LEGAL.txt → chunk-6FY77I4M.js.LEGAL.txt} +0 -0
  138. /package/lib/{chunk-AIMEXBTK.js.LEGAL.txt → chunk-YNJNMQWU.js.LEGAL.txt} +0 -0
@@ -21,26 +21,28 @@ import {
21
21
  siteArgs,
22
22
  sitePath,
23
23
  tocOf
24
- } from "./chunk-OSBEH67S.js";
24
+ } from "./chunk-YA23NDMW.js";
25
25
  import {
26
- commandLine
27
- } from "./chunk-HWW5NCVJ.js";
26
+ builtinFilters
27
+ } from "./chunk-V3G2QGL3.js";
28
28
  import {
29
- builtinFilters,
30
- excerpt,
31
- headings
32
- } from "./chunk-GLJQ4C76.js";
29
+ commandLine
30
+ } from "./chunk-4Q6WMTER.js";
33
31
  import {
34
32
  measure,
35
33
  overBudget
36
- } from "./chunk-RYIWYWRQ.js";
34
+ } from "./chunk-UHRBPZ4A.js";
35
+ import {
36
+ excerpt,
37
+ headings
38
+ } from "./chunk-25WERNDD.js";
37
39
  import {
38
40
  checkPages,
39
41
  rewriteBase
40
- } from "./chunk-Z44IAMNG.js";
42
+ } from "./chunk-VILOEVK7.js";
41
43
  import {
42
44
  Profile
43
- } from "./chunk-ERAIEV3O.js";
45
+ } from "./chunk-6U5VIQVY.js";
44
46
  import {
45
47
  VERSION
46
48
  } from "./chunk-AD3HAW3W.js";
@@ -51,7 +53,7 @@ import {
51
53
  dirsOf,
52
54
  shownDir,
53
55
  shownOutput
54
- } from "./chunk-GS5B3CBW.js";
56
+ } from "./chunk-DDV6JEC2.js";
55
57
  import {
56
58
  beginFenceCache,
57
59
  currentRendering,
@@ -66,13 +68,13 @@ import {
66
68
  site,
67
69
  withPage,
68
70
  writeHighlightCss
69
- } from "./chunk-JC54PHIT.js";
71
+ } from "./chunk-6OUCRDYI.js";
70
72
  import {
71
73
  globBase,
72
74
  globSet,
73
75
  globToRegExp,
74
76
  isGlob
75
- } from "./chunk-HFSWUTXX.js";
77
+ } from "./chunk-SPIFZBIW.js";
76
78
  import {
77
79
  closest,
78
80
  closestPath
@@ -81,14 +83,14 @@ import {
81
83
  ISSUES_URL,
82
84
  PASSED_THIS_TREE,
83
85
  SOMETHING_LARGE
84
- } from "./chunk-UU43WIZG.js";
86
+ } from "./chunk-FJML7INB.js";
85
87
  import {
86
88
  describeThrown,
87
89
  loadedFiles,
88
90
  settle,
89
91
  shownPath,
90
92
  watchSettle
91
- } from "./chunk-IOBC665M.js";
93
+ } from "./chunk-4AZFCSGJ.js";
92
94
  import {
93
95
  BuildError,
94
96
  Diagnostics,
@@ -98,19 +100,12 @@ import {
98
100
  aliasUsed,
99
101
  bail,
100
102
  buildTime,
101
- comparePaths,
102
- compareText,
103
103
  context,
104
104
  decodeText,
105
- displayPath,
106
105
  error,
107
106
  find,
108
- frontMatterSettings,
109
107
  getPath,
110
108
  isCapturing,
111
- isDir,
112
- isFile,
113
- isInside,
114
109
  isPlainObject,
115
110
  loadDataFile,
116
111
  merge,
@@ -118,20 +113,28 @@ import {
118
113
  normalizeTags,
119
114
  parseFrontMatter,
120
115
  progress,
121
- readFollowing,
122
116
  readText,
123
- realPath,
124
- relative,
125
117
  sameValue,
126
118
  setOwn,
127
- shown,
128
- slashes,
129
119
  sourceDateEpoch,
130
120
  toDate,
131
- walkFiles,
132
121
  warn,
133
122
  warning
134
- } from "./chunk-AIMEXBTK.js";
123
+ } from "./chunk-YNJNMQWU.js";
124
+ import {
125
+ comparePaths,
126
+ compareText,
127
+ displayPath,
128
+ isDir,
129
+ isFile,
130
+ isInside,
131
+ readFollowing,
132
+ realPath,
133
+ relative,
134
+ shown,
135
+ slashes,
136
+ walkFiles
137
+ } from "./chunk-VJWQSYEG.js";
135
138
  import {
136
139
  __commonJS,
137
140
  __export,
@@ -1200,8 +1203,8 @@ var require_he = __commonJS({
1200
1203
  "useNamedReferences": false,
1201
1204
  "decimal": false
1202
1205
  };
1203
- var decode = function(html3, options) {
1204
- options = merge3(options, decode.options);
1206
+ var decode2 = function(html3, options) {
1207
+ options = merge3(options, decode2.options);
1205
1208
  var strict = options.strict;
1206
1209
  if (strict && regexInvalidEntity.test(html3)) {
1207
1210
  parseError2("malformed character reference");
@@ -1260,7 +1263,7 @@ var require_he = __commonJS({
1260
1263
  return $0;
1261
1264
  });
1262
1265
  };
1263
- decode.options = {
1266
+ decode2.options = {
1264
1267
  "isAttributeValue": false,
1265
1268
  "strict": false
1266
1269
  };
@@ -1272,9 +1275,9 @@ var require_he = __commonJS({
1272
1275
  var he2 = {
1273
1276
  "version": "1.2.0",
1274
1277
  "encode": encode,
1275
- "decode": decode,
1278
+ "decode": decode2,
1276
1279
  "escape": escape3,
1277
- "unescape": decode
1280
+ "unescape": decode2
1278
1281
  };
1279
1282
  if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
1280
1283
  define(function() {
@@ -8936,6 +8939,165 @@ import fs6 from "node:fs";
8936
8939
  import path7 from "node:path";
8937
8940
  import { spawnSync as spawnSync2 } from "node:child_process";
8938
8941
 
8942
+ // src/components.ts
8943
+ var NAME = /^[A-Z][A-Za-z0-9]*$/;
8944
+ var isComponentName = (name) => NAME.test(name) && /[a-z]/.test(name);
8945
+ var RAW = ["pre", "code", "script", "style", "textarea"];
8946
+ function mayHaveComponents(html3) {
8947
+ return /<[A-Z][A-Za-z0-9]*[a-z]/.test(html3);
8948
+ }
8949
+ function renderComponents(html3, render, data2, unknown = () => {
8950
+ }) {
8951
+ if (!mayHaveComponents(html3)) return html3;
8952
+ let out = "";
8953
+ let i2 = 0;
8954
+ while (i2 < html3.length) {
8955
+ const lt = html3.indexOf("<", i2);
8956
+ if (lt === -1) break;
8957
+ out += html3.slice(i2, lt);
8958
+ if (html3.startsWith("<!--", lt)) {
8959
+ const end = html3.indexOf("-->", lt + 4);
8960
+ const stop2 = end === -1 ? html3.length : end + 3;
8961
+ out += html3.slice(lt, stop2);
8962
+ i2 = stop2;
8963
+ continue;
8964
+ }
8965
+ const raw = RAW.find((tag) => html3.slice(lt + 1, lt + 1 + tag.length).toLowerCase() === tag && /[\s/>]/.test(html3[lt + 1 + tag.length] ?? ""));
8966
+ if (raw) {
8967
+ const close2 = html3.toLowerCase().indexOf(`</${raw}`, lt + raw.length + 1);
8968
+ const stop2 = close2 === -1 ? html3.length : html3.indexOf(">", close2) + 1 || html3.length;
8969
+ out += html3.slice(lt, stop2);
8970
+ i2 = stop2;
8971
+ continue;
8972
+ }
8973
+ const name = /^<([A-Za-z][A-Za-z0-9]*)(?=[\s/>])/.exec(html3.slice(lt, lt + 80))?.[1];
8974
+ if (name === void 0 || !isComponentName(name)) {
8975
+ out += "<";
8976
+ i2 = lt + 1;
8977
+ continue;
8978
+ }
8979
+ const open = openTag(html3, lt + 1 + name.length);
8980
+ if (open === void 0) {
8981
+ out += "<";
8982
+ i2 = lt + 1;
8983
+ continue;
8984
+ }
8985
+ let content = "";
8986
+ let stop = open.end;
8987
+ let endTag2 = "";
8988
+ const close = open.selfClosing ? void 0 : closingTag(html3, name, open.end);
8989
+ if (close !== void 0) {
8990
+ content = renderComponents(html3.slice(open.end, close.start), render, data2, unknown);
8991
+ endTag2 = html3.slice(close.start, close.end);
8992
+ stop = close.end;
8993
+ }
8994
+ const value = { name, props: propsOf(open.attrs, data2), content, attrs: plainAttrs(open.attrs), bindings: bindingsOf(open.attrs) };
8995
+ const rendered = render(name, value);
8996
+ if (rendered === void 0) {
8997
+ unknown(name);
8998
+ out += html3.slice(lt, open.end) + content + endTag2;
8999
+ } else {
9000
+ out += rendered;
9001
+ }
9002
+ i2 = stop;
9003
+ }
9004
+ return out + html3.slice(i2);
9005
+ }
9006
+ function openTag(html3, from) {
9007
+ const attrs = [];
9008
+ let i2 = from;
9009
+ for (; ; ) {
9010
+ while (i2 < html3.length && /\s/.test(html3[i2])) i2++;
9011
+ if (i2 >= html3.length) return void 0;
9012
+ if (html3[i2] === ">") return { attrs, end: i2 + 1, selfClosing: false };
9013
+ if (html3.startsWith("/>", i2)) return { attrs, end: i2 + 2, selfClosing: true };
9014
+ const name = /^[^\s"'>/=]+/.exec(html3.slice(i2, i2 + 200))?.[0];
9015
+ if (name === void 0) {
9016
+ i2++;
9017
+ continue;
9018
+ }
9019
+ i2 += name.length;
9020
+ while (i2 < html3.length && /\s/.test(html3[i2])) i2++;
9021
+ if (html3[i2] !== "=") {
9022
+ attrs.push([name, true]);
9023
+ continue;
9024
+ }
9025
+ i2++;
9026
+ while (i2 < html3.length && /\s/.test(html3[i2])) i2++;
9027
+ const quote = html3[i2];
9028
+ if (quote === '"' || quote === "'") {
9029
+ const end = html3.indexOf(quote, i2 + 1);
9030
+ if (end === -1) return void 0;
9031
+ attrs.push([name, decode(html3.slice(i2 + 1, end))]);
9032
+ i2 = end + 1;
9033
+ } else {
9034
+ const value = /^[^\s>]*/.exec(html3.slice(i2))[0];
9035
+ attrs.push([name, decode(value.endsWith("/") && html3[i2 + value.length] === ">" ? value.slice(0, -1) : value)]);
9036
+ i2 += value.length;
9037
+ if (value.endsWith("/") && html3[i2] === ">") i2--;
9038
+ }
9039
+ }
9040
+ }
9041
+ function closingTag(html3, name, from) {
9042
+ const tags2 = new RegExp(`<(/?)${name}(?=[\\s/>])[^>]*?(/?)>`, "g");
9043
+ tags2.lastIndex = from;
9044
+ let depth = 1;
9045
+ for (let m = tags2.exec(html3); m; m = tags2.exec(html3)) {
9046
+ if (m[1] === "/") depth--;
9047
+ else if (m[2] !== "/") depth++;
9048
+ if (depth === 0) return { start: m.index, end: m.index + m[0].length };
9049
+ }
9050
+ return void 0;
9051
+ }
9052
+ var decode = (s) => s.replace(/&(quot|#39|apos|lt|gt|amp);/g, (_, e) => ({ quot: '"', "#39": "'", apos: "'", lt: "<", gt: ">", amp: "&" })[e]);
9053
+ var camel = (name) => name.replace(/-([a-z0-9])/g, (_, c) => c.toUpperCase());
9054
+ var isDirective = (name) => name.startsWith("v-") && !name.startsWith("v-bind:") || name.startsWith("@") || name.startsWith("#");
9055
+ function propsOf(attrs, data2) {
9056
+ const props = {};
9057
+ for (const [given3, value] of attrs) {
9058
+ if (isDirective(given3)) continue;
9059
+ const bound = given3.startsWith(":") || given3.startsWith("v-bind:");
9060
+ const name = bound ? given3.slice(given3.indexOf(":") + 1) : given3;
9061
+ const v = bound && value !== true ? bindingValue(value, data2) : value;
9062
+ props[name] = v;
9063
+ if (name.includes("-")) props[camel(name)] = v;
9064
+ }
9065
+ return props;
9066
+ }
9067
+ function bindingsOf(attrs) {
9068
+ const out = {};
9069
+ for (const [given3, value] of attrs) if ((given3.startsWith(":") || given3.startsWith("v-bind:")) && value !== true) out[given3.slice(given3.indexOf(":") + 1)] = value;
9070
+ return out;
9071
+ }
9072
+ function plainAttrs(attrs) {
9073
+ let out = "";
9074
+ for (const [name, value] of attrs) {
9075
+ if (isDirective(name) || name.startsWith(":") || name.startsWith("v-bind:")) continue;
9076
+ out += value === true ? ` ${name}` : ` ${name}="${value.replace(/&/g, "&amp;").replace(/"/g, "&quot;")}"`;
9077
+ }
9078
+ return out;
9079
+ }
9080
+ function bindingValue(expr, data2) {
9081
+ const text3 = expr.trim();
9082
+ const path8 = /^\$?(?:frontmatter\.)?([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*)$/.exec(text3.replace(/^\$frontmatter\./, ""));
9083
+ if (path8 && !["true", "false", "null", "undefined"].includes(text3)) {
9084
+ let at2 = data2;
9085
+ for (const key of path8[1].split(".")) at2 = at2 !== null && typeof at2 === "object" ? at2[key] : void 0;
9086
+ return at2;
9087
+ }
9088
+ if (text3 === "undefined") return void 0;
9089
+ try {
9090
+ return JSON.parse(text3);
9091
+ } catch {
9092
+ }
9093
+ const json = text3.replace(/'((?:[^'\\]|\\.)*)'/g, (_, s) => JSON.stringify(s.replace(/\\'/g, "'"))).replace(/([{,]\s*)([A-Za-z_$][\w$]*)\s*:/g, '$1"$2":').replace(/,\s*([}\]])/g, "$1");
9094
+ try {
9095
+ return JSON.parse(json);
9096
+ } catch {
9097
+ return text3;
9098
+ }
9099
+ }
9100
+
8939
9101
  // src/site.ts
8940
9102
  import fs5 from "node:fs";
8941
9103
  import path6 from "node:path";
@@ -23998,6 +24160,8 @@ var Site = class {
23998
24160
  collections = {};
23999
24161
  /** Every file seen while looking for templates, so a data file next to a template is found without asking the disk. */
24000
24162
  seen = /* @__PURE__ */ new Set();
24163
+ /** PascalCase tags the pages have with no template in `_includes/components/`, with the pages each is on. */
24164
+ unknownComponents = /* @__PURE__ */ new Map();
24001
24165
  keepLayers;
24002
24166
  /** Set by the build: a page's rendered body, on demand (for `templateContent`). */
24003
24167
  contentOf = () => void 0;
@@ -24005,12 +24169,30 @@ var Site = class {
24005
24169
  profile;
24006
24170
  constructor(config, keepLayers = false) {
24007
24171
  this.config = config;
24008
- frontMatterSettings.trimAfter = config.trimAfterFrontMatter;
24009
24172
  this.dirs = dirsOf(config);
24010
24173
  this.keepLayers = keepLayers;
24011
24174
  this.profile = new Profile(config.profile);
24012
24175
  }
24013
24176
  /** A data file's value, timed with `--profile`. One that fetches can take a while on purpose, so it's no `slow-call`. */
24177
+ ignoreGlobs;
24178
+ /**
24179
+ * Whether `ignore` lists a data file beside the templates. Data is read by its name
24180
+ * (`api/api.data.ts` is `api/`'s), so another generator's file with that name (VitePress's
24181
+ * loaders) would be imported as data: `ignore: ["**\/*.data.ts"]` keeps it out.
24182
+ */
24183
+ ignoredData(file) {
24184
+ this.ignoreGlobs ??= globSet("ignore", this.config.ignore);
24185
+ return this.ignoreGlobs(relative(this.dirs.input, file));
24186
+ }
24187
+ /** A data file's error, saying why ssqch read it: a file is data by its name, which another generator's file can have too. */
24188
+ async loadNamedData(file, why) {
24189
+ try {
24190
+ return await this.loadData(file);
24191
+ } catch (e) {
24192
+ const items = e instanceof Diagnostics || e instanceof BuildError ? e.items : void 0;
24193
+ throw new BuildError(`${messageOf(e)}. ssqch read ${shown(this.dirs.root, file)} as ${why}, by its name: if it isn't ssqch data (a VitePress loader is named this way too), list it in \`ignore\``, items);
24194
+ }
24195
+ }
24014
24196
  loadData(file) {
24015
24197
  const load = () => loadDataFile(file, this.config.dataExtensions);
24016
24198
  return this.profile.detailed ? this.profile.time("data", shown(this.dirs.root, file), false, load) : load();
@@ -24050,6 +24232,7 @@ var Site = class {
24050
24232
  const pipeFilters = /* @__PURE__ */ new Map();
24051
24233
  for (const row of TABLE) {
24052
24234
  if (row.kind !== "filter" || !row.alias || config.filters.has(row.word)) continue;
24235
+ if (row.ssqch !== "base" && !globals.has(row.ssqch)) continue;
24053
24236
  const takesUrl = row.ssqch === "base";
24054
24237
  let warned = false;
24055
24238
  pipeFilters.set(row.word, (...args) => {
@@ -24416,8 +24599,8 @@ var Site = class {
24416
24599
  let data2 = {};
24417
24600
  for (const candidate of candidates) {
24418
24601
  const file = path6.join(dir, candidate);
24419
- if (!(this.seen.has(file) || isFile(file))) continue;
24420
- const value = await this.loadData(file);
24602
+ if (!(this.seen.has(file) || isFile(file)) || this.ignoredData(file)) continue;
24603
+ const value = await this.loadNamedData(file, `the directory data for ${shown(this.dirs.root, dir)}/`);
24421
24604
  if (!isPlainObject(value)) continue;
24422
24605
  const layer = { ...value };
24423
24606
  try {
@@ -24501,8 +24684,8 @@ var Site = class {
24501
24684
  const stem = name.slice(0, name.length - path6.extname(name).length);
24502
24685
  for (const suffix of ["json", "data.json", ...[...config.dataExtensions.keys()].map((ext2) => `data.${ext2}`)]) {
24503
24686
  const candidate = path6.join(path6.dirname(file), `${stem}.${suffix}`);
24504
- if (!this.sawFile(candidate)) continue;
24505
- const value = await this.loadData(candidate);
24687
+ if (!this.sawFile(candidate) || this.ignoredData(candidate)) continue;
24688
+ const value = await this.loadNamedData(candidate, `the data for ${shown(dirs.root, file)}`);
24506
24689
  if (!isPlainObject(value)) continue;
24507
24690
  const layer = { ...value };
24508
24691
  try {
@@ -24661,8 +24844,13 @@ var Site = class {
24661
24844
  else if (tpl.engines.length && tpl.engines.every((e) => e === "txt")) url = `/${tpl.rel}`;
24662
24845
  else {
24663
24846
  const stem = tpl.filePathStem;
24664
- url = stem === "/index" ? "/" : stem.endsWith("/index") ? stem.slice(0, -5) : `${stem}/`;
24665
- if (index2 > 0) url = `${url}${index2}/`;
24847
+ if (this.config.urls === "html") {
24848
+ const folder = stem === "/index" ? "/" : stem.endsWith("/index") ? stem.slice(0, -5) : void 0;
24849
+ url = index2 > 0 ? `${folder ?? `${stem}/`}${index2}.html` : folder ?? `${stem}.html`;
24850
+ } else {
24851
+ url = stem === "/index" ? "/" : stem.endsWith("/index") ? stem.slice(0, -5) : `${stem}/`;
24852
+ if (index2 > 0) url = `${url}${index2}/`;
24853
+ }
24666
24854
  }
24667
24855
  if (url !== null && !url.startsWith("/")) url = `/${url}`;
24668
24856
  let output = null;
@@ -24952,8 +25140,38 @@ async function collectErrors(jobs) {
24952
25140
  function errorsTogether(failed) {
24953
25141
  const messages = failed.map(messageOf);
24954
25142
  const items = failed.flatMap((e, i2) => (e instanceof Diagnostics || e instanceof BuildError) && e.items ? e.items : [error("", messages[i2])]);
25143
+ const listed = sameErrorsTogether(messages);
24955
25144
  return new Diagnostics(`${failed.length} error(s):
24956
- - ${messages.slice(0, 10).join("\n - ")}${failed.length > 10 ? "\n ..." : ""}`, items);
25145
+ - ${listed.slice(0, 10).join("\n - ")}${listed.length > 10 ? "\n ..." : ""}`, items);
25146
+ }
25147
+ function sameErrorsTogether(messages) {
25148
+ const PAGE = /^(?:in |rendering layout [^\s]+ for |rendering )([^\s:]+?\.[A-Za-z0-9]+)(?:: | with )/;
25149
+ const keyOf = (m) => {
25150
+ const found2 = PAGE.exec(m);
25151
+ if (!found2) return void 0;
25152
+ const at2 = found2[0].indexOf(found2[1]);
25153
+ return [m.slice(0, at2) + "\0" + m.slice(at2 + found2[1].length), found2[1]];
25154
+ };
25155
+ const pages = /* @__PURE__ */ new Map();
25156
+ for (const m of messages) {
25157
+ const key = keyOf(m);
25158
+ if (key) pages.set(key[0], [...pages.get(key[0]) ?? [], key[1]]);
25159
+ }
25160
+ const out = [];
25161
+ const said = /* @__PURE__ */ new Set();
25162
+ for (const m of messages) {
25163
+ const key = keyOf(m);
25164
+ const all = key ? pages.get(key[0]) : [];
25165
+ if (!key || all.length === 1) {
25166
+ out.push(m);
25167
+ continue;
25168
+ }
25169
+ if (said.has(key[0])) continue;
25170
+ said.add(key[0]);
25171
+ const more = all.slice(1);
25172
+ out.push(`${m} (and ${more.length} more ${more.length === 1 ? "page" : "pages"} with the same error: ${more.slice(0, 3).join(", ")}${more.length > 3 ? ", ..." : ""})`);
25173
+ }
25174
+ return out;
24957
25175
  }
24958
25176
 
24959
25177
  // src/jekyll.ts
@@ -25078,6 +25296,7 @@ async function build(config) {
25078
25296
  }
25079
25297
  }
25080
25298
  await renderer.renderAll([...wanted.filter((p) => !late.has(p)), ...wanted.filter((p) => late.has(p))], late);
25299
+ warnUnknownComponents(site2);
25081
25300
  for (const wait of config.settle) await wait();
25082
25301
  timer.timings.push(["render", renderer.renderMs], ["write", performance.now() - timer.last - renderer.renderMs]);
25083
25302
  timer.last = performance.now();
@@ -25125,7 +25344,7 @@ async function build(config) {
25125
25344
  if (config.profile) report.profile = site2.profile.report();
25126
25345
  return report;
25127
25346
  }
25128
- async function inspectPages(config) {
25347
+ async function tracePages(config) {
25129
25348
  const site2 = new Site(config, true);
25130
25349
  const { dirs } = site2;
25131
25350
  if (!isDir(dirs.input)) bail(`input directory ${shownDir(config, config.input)} does not exist`);
@@ -25219,21 +25438,53 @@ var Renderer = class {
25219
25438
  for (let i2 = from; i2 < tpl.engines.length; i2++) {
25220
25439
  const name = tpl.engines[i2];
25221
25440
  const engine = this.site.engines.get(name);
25222
- let out;
25441
+ if (name === "md" && page.url !== null) this.site.config.markdownSources?.set(page.url, content);
25442
+ let out2;
25223
25443
  try {
25224
- out = engine.render(content, data2, ctx);
25225
- if (typeof out !== "string") out = asText2(out, name, tpl.rel);
25444
+ out2 = engine.render(content, data2, ctx);
25445
+ if (typeof out2 !== "string") out2 = asText2(out2, name, tpl.rel);
25226
25446
  } catch (e) {
25227
25447
  throw rendering2(e, tpl, name);
25228
25448
  }
25229
- if (typeof out !== "string") return out.then((text3) => run(i2 + 1, text3), (e) => {
25449
+ if (typeof out2 !== "string") return out2.then((text3) => run(i2 + 1, text3), (e) => {
25230
25450
  throw rendering2(e, tpl, name);
25231
25451
  });
25232
- content = out;
25452
+ content = out2;
25233
25453
  }
25234
25454
  return content;
25235
25455
  };
25236
- return run(0, tpl.body);
25456
+ const out = run(0, tpl.body);
25457
+ if (!this.componentsIn(page)) return out;
25458
+ return typeof out === "string" ? this.components(out, data2, page) : out.then((text3) => this.components(text3, data2, page));
25459
+ }
25460
+ /** Whether a page's HTML can have components: an HTML page, or one that's only read by others. */
25461
+ componentsIn(page) {
25462
+ return page.output === null || page.output.endsWith(".html");
25463
+ }
25464
+ /** `html` with its component tags rendered through `_includes/components/<Name>.*`. */
25465
+ components(html3, data2, page) {
25466
+ const md = this.site.markdown;
25467
+ const unknown = this.site.unknownComponents;
25468
+ try {
25469
+ const others = this.site.config.componentRenderers;
25470
+ const input = page.tpl.input;
25471
+ const render = (name, value) => {
25472
+ const own = md.component(name, value, data2);
25473
+ if (own !== void 0) return own;
25474
+ for (const other of others) {
25475
+ const html4 = other(name, value, input, data2);
25476
+ if (html4 !== void 0) return html4;
25477
+ }
25478
+ return void 0;
25479
+ };
25480
+ return renderComponents(html3, render, data2, (name) => {
25481
+ const files = unknown.get(name) ?? /* @__PURE__ */ new Set();
25482
+ files.add(this.site.display(page.tpl.input));
25483
+ unknown.set(name, files);
25484
+ });
25485
+ } catch (e) {
25486
+ throw context(e, `in ${page.tpl.rel}`);
25487
+ }
25237
25488
  }
25238
25489
  /**
25239
25490
  * A page's body for another page that reads it (`templateContent`), rendered now if it isn't
@@ -25353,6 +25604,7 @@ var Renderer = class {
25353
25604
  } finally {
25354
25605
  if (had === void 0 && !this.keep) this.bodies.delete(page.index);
25355
25606
  }
25607
+ if (this.componentsIn(page)) content = this.components(content, this.data(page), page);
25356
25608
  }
25357
25609
  const output = page.output;
25358
25610
  const info = { url: page.url ?? "", inputPath: site2.display(tpl.input), outputPath: output };
@@ -25540,13 +25792,33 @@ function checkForeignKeys(site2) {
25540
25792
  if (row.kind !== "frontMatter" || row.alias) continue;
25541
25793
  if (site2.config.filters.has(row.word)) continue;
25542
25794
  const sets = (page) => row.word in page.data && (row.word !== "published" || page.data[row.word] === false);
25543
- const files = dedup(site2.pages.filter(sets).map((p) => shown(site2.dirs.root, p.tpl.input)));
25544
- const n = files.length;
25795
+ const files2 = dedup(site2.pages.filter(sets).map((p) => shown(site2.dirs.root, p.tpl.input)));
25796
+ const n = files2.length;
25545
25797
  if (!n) continue;
25546
- const message = n === 1 ? `${files[0]} sets \`${row.word}\`${row.from.length ? ` (${row.from[0]}'s name)` : ""}. ${row.say}
25547
- More: ${row.more}` : `${n} pages set \`${row.word}\` (${files.slice(0, 3).join(", ")}${n > 3 ? ", ..." : ""}): ${row.say}
25798
+ const message = n === 1 ? `${files2[0]} sets \`${row.word}\`${row.from.length ? ` (${row.from[0]}'s name)` : ""}. ${row.say}
25799
+ More: ${row.more}` : `${n} pages set \`${row.word}\` (${files2.slice(0, 3).join(", ")}${n > 3 ? ", ..." : ""}): ${row.say}
25548
25800
  More: ${row.more}`;
25549
- warn(warning("foreign-key", message, n === 1 ? { field: row.word, file: files[0] } : { field: row.word }));
25801
+ warn(warning("foreign-key", message, n === 1 ? { field: row.word, file: files2[0] } : { field: row.word }));
25802
+ }
25803
+ const files = dedup(site2.pages.filter((p) => p.tpl.frontKeys.includes("page")).map((p) => shown(site2.dirs.root, p.tpl.input)));
25804
+ if (files.length) {
25805
+ const say = "`page` is ssqch's (the page's url, inputPath, date and headings), so the front matter's value is replaced and templates never see it. Give it another name (`pageLayout: true`); VitePress's `page: true`, a page without the docs layout, is a layout in ssqch (`layout: page`)";
25806
+ const message = files.length === 1 ? `${files[0]} sets \`page\` in its front matter. ${say}` : `${files.length} pages set \`page\` in their front matter (${files.slice(0, 3).join(", ")}${files.length > 3 ? ", ..." : ""}): ${say}`;
25807
+ warn(warning("foreign-key", message, files.length === 1 ? { field: "page", file: files[0] } : { field: "page" }));
25808
+ }
25809
+ }
25810
+ function warnUnknownComponents(site2) {
25811
+ const unknown = [...site2.unknownComponents].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
25812
+ if (unknown.length > 3) {
25813
+ const ranked = [...unknown].sort(([a, x], [b, y]) => y.size - x.size || (a < b ? -1 : 1));
25814
+ const listed = ranked.slice(0, 8).map(([name, files]) => `<${name}> (${files.size === 1 ? [...files][0] : `${files.size} pages`})`).join(", ");
25815
+ warn(warning("template", `${unknown.length} components (PascalCase tags) have no template: ${listed}${unknown.length > 8 ? `, and ${unknown.length - 8} more` : ""}. Browsers drop the tags and show what's inside them. Give each one in _includes/components/<Name>.* (it gets \`component.props\` and \`component.content\`; \`ssqch docs components\`), or write the HTML it stands for`));
25816
+ return;
25817
+ }
25818
+ for (const [name, files] of unknown) {
25819
+ const list2 = [...files].sort();
25820
+ const where = list2.length === 1 ? list2[0] : `${list2.length} pages (${list2.slice(0, 3).join(", ")}${list2.length > 3 ? ", ..." : ""})`;
25821
+ warn(warning("template", `\`<${name}>\` in ${where} is a component (a PascalCase tag) with no template: browsers drop the tag and show what's inside it. Give it one in _includes/components/${name}.* (it gets \`component.props\` and \`component.content\`; \`ssqch docs components\`), or write the HTML it stands for`, list2.length === 1 ? { file: list2[0] } : {}));
25550
25822
  }
25551
25823
  }
25552
25824
  var dedup = (list2) => list2.filter((item, i2) => i2 === 0 || item !== list2[i2 - 1]);
@@ -25626,6 +25898,7 @@ function hookEvent(config, dirs, report) {
25626
25898
  const rel = (dir) => dir === dirs.root ? "./" : isInside(dirs.root, dir) ? `./${relative(dirs.root, dir)}/` : `${dir}/`;
25627
25899
  const event = { env: config.env, serving: config.serving, quiet: config.quiet, verbose: config.verbose, dirs: { input: rel(dirs.input), output: rel(dirs.output), includes: rel(dirs.includes), data: rel(dirs.data) } };
25628
25900
  if (report) event.written = [...report.written];
25901
+ if (config.changed) event.changed = config.changed.map((file) => isInside(dirs.root, file) ? `./${relative(dirs.root, file)}` : file);
25629
25902
  return event;
25630
25903
  }
25631
25904
  async function runHooks(config, dirs, event, hooks, report, profile) {
@@ -25662,7 +25935,7 @@ function runCommand(config, dirs, event, command) {
25662
25935
  }
25663
25936
  var sameText = (file, contents) => {
25664
25937
  try {
25665
- return fs6.readFileSync(file, "utf8") === contents;
25938
+ return typeof contents === "string" ? fs6.readFileSync(file, "utf8") === contents : Buffer.from(contents).equals(fs6.readFileSync(file));
25666
25939
  } catch {
25667
25940
  return false;
25668
25941
  }
@@ -25726,7 +25999,7 @@ async function runGenerators(config, dirs, pages, pageOutputs, site2) {
25726
25999
  }
25727
26000
  if (rendered !== void 0) contents = rendered;
25728
26001
  }
25729
- if (file.append && (isPage || owners.has(target))) {
26002
+ if (file.append && typeof contents === "string" && (isPage || owners.has(target))) {
25730
26003
  let existing = "";
25731
26004
  try {
25732
26005
  existing = fs6.readFileSync(target, "utf8");
@@ -25934,7 +26207,7 @@ function recordOutputs(config, dirs, outputs, pagePaths) {
25934
26207
 
25935
26208
  export {
25936
26209
  build,
25937
- inspectPages,
26210
+ tracePages,
25938
26211
  inEdgeCode,
25939
26212
  edgeCodeMentionsForTest,
25940
26213
  asTextForTest,
@@ -25942,4 +26215,4 @@ export {
25942
26215
  runCommand,
25943
26216
  OUTPUT_LIST
25944
26217
  };
25945
- /*! For license information please see chunk-ZR3JYLFB.js.LEGAL.txt */
26218
+ /*! For license information please see chunk-6FY77I4M.js.LEGAL.txt */