ssqch 0.8.0 → 0.10.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 (87) hide show
  1. package/README.md +3 -1
  2. package/bundled/docs/agents.md +70 -0
  3. package/bundled/docs/benchmarks.md +29 -0
  4. package/bundled/docs/build-summary.md +27 -0
  5. package/bundled/docs/comparing-builds.md +51 -0
  6. package/bundled/docs/configuring.md +138 -0
  7. package/bundled/docs/content-schemas.md +54 -0
  8. package/bundled/docs/css-and-javascript.md +33 -0
  9. package/bundled/docs/data-files.md +55 -0
  10. package/bundled/docs/deploying.md +47 -0
  11. package/bundled/docs/field-guide.md +144 -0
  12. package/bundled/docs/footprint.md +27 -0
  13. package/bundled/docs/github-pages.md +41 -0
  14. package/bundled/docs/index.md +26 -0
  15. package/bundled/docs/install.md +27 -0
  16. package/bundled/docs/known-gaps.md +18 -0
  17. package/bundled/docs/markdown.md +114 -0
  18. package/bundled/docs/multilingual.md +14 -0
  19. package/bundled/docs/nav.yml +50 -0
  20. package/bundled/docs/netlify.md +30 -0
  21. package/bundled/docs/new-pages.md +42 -0
  22. package/bundled/docs/plugins.md +13 -0
  23. package/bundled/docs/rust-plugins.md +32 -0
  24. package/bundled/docs/seo.md +19 -0
  25. package/bundled/docs/template-languages.md +106 -0
  26. package/bundled/docs/templates.md +37 -0
  27. package/bundled/docs/themes.md +31 -0
  28. package/bundled/{trailheads → docs/trailheads}/from-component-frameworks.md +7 -3
  29. package/bundled/{trailheads → docs/trailheads}/from-docusaurus.md +7 -4
  30. package/bundled/{trailheads → docs/trailheads}/from-eleventy.md +7 -4
  31. package/bundled/{trailheads → docs/trailheads}/from-hexo.md +7 -4
  32. package/bundled/docs/trailheads/from-jekyll.md +82 -0
  33. package/bundled/{trailheads → docs/trailheads}/from-mkdocs.md +8 -5
  34. package/bundled/{trailheads → docs/trailheads}/from-zola.md +6 -3
  35. package/bundled/docs/trailheads.md +38 -0
  36. package/bundled/docs/where-values-come-from.md +57 -0
  37. package/bundled/ssqch.d.ts +20 -10
  38. package/lib/assets.js +15 -7
  39. package/lib/{chunk-N5QTGQ5N.js → chunk-2LEOPLTZ.js} +2 -2
  40. package/lib/{chunk-AMBFWPZ4.js → chunk-3EPHKJEG.js} +3 -3
  41. package/lib/{chunk-BRK4MXXO.js → chunk-3HHRKG33.js} +65 -18
  42. package/lib/{chunk-EIT4ZDT4.js → chunk-5DNDSNTP.js} +61 -5
  43. package/lib/{chunk-NUKCUDC4.js → chunk-7HXCQEGA.js} +3 -3
  44. package/lib/{chunk-6XYSFG6V.js → chunk-BGCBSQ4A.js} +3067 -3054
  45. package/lib/{chunk-RI2L3VGO.js → chunk-CB6YFUXU.js} +19 -11
  46. package/lib/{chunk-JSPSMIJ2.js → chunk-DMVJ53SM.js} +9 -9
  47. package/lib/{chunk-FYGE634X.js → chunk-DW7VMJEZ.js} +9 -9
  48. package/lib/{chunk-GSKVRAHF.js → chunk-E5UB2YY7.js} +6 -6
  49. package/lib/{chunk-DHHQKW4F.js → chunk-EEJDLCD3.js} +7 -7
  50. package/lib/{chunk-TWCVHOKO.js → chunk-HDQ4SRWM.js} +125 -4
  51. package/lib/{chunk-JRT7TQQP.js → chunk-HGJ5VWUR.js} +1 -1
  52. package/lib/{chunk-C35KIPAR.js → chunk-JWCCVTTR.js} +98 -7
  53. package/lib/{chunk-EZZUUPI4.js → chunk-JXZT5L7W.js} +2 -2
  54. package/lib/{chunk-KBGE5MCY.js → chunk-LAV3DEY4.js} +1 -1
  55. package/lib/{chunk-IRHRK7XB.js → chunk-LCPSKHAV.js} +1 -1
  56. package/lib/{chunk-3PHCFZEU.js → chunk-N4O5MDIB.js} +2 -2
  57. package/lib/{chunk-TDGBQNGW.js → chunk-NFJJKDRI.js} +1 -1
  58. package/lib/{chunk-UGEGUUBT.js → chunk-NUUEOGLZ.js} +8 -8
  59. package/lib/{chunk-VVPZ5PDP.js → chunk-Q4LFTYK2.js} +11 -11
  60. package/lib/{chunk-TN6EEDX2.js → chunk-QMA7CK7B.js} +51 -6
  61. package/lib/{chunk-CDEPYU7W.js → chunk-RJFWTW2Y.js} +2 -2
  62. package/lib/{chunk-YSH2NMIE.js → chunk-RKFZSVNF.js} +6 -6
  63. package/lib/{chunk-GOE4ZSAB.js → chunk-RM5Q3KFB.js} +9 -9
  64. package/lib/{chunk-37KSIVNY.js → chunk-RVBNVGZV.js} +3 -3
  65. package/lib/{chunk-HR2RU2LY.js → chunk-SA5KSJ4Y.js} +11 -7
  66. package/lib/{chunk-BOBPVAX2.js → chunk-SRNLKWXL.js} +424 -78
  67. package/lib/{chunk-WP3RPVUM.js → chunk-Y2ESFAAD.js} +2 -3
  68. package/lib/{chunk-WMOVCQO6.js → chunk-ZM6TU2JB.js} +6 -6
  69. package/lib/cli.js +32 -25
  70. package/lib/elements.js +7 -7
  71. package/lib/image.js +8 -8
  72. package/lib/links.js +10 -10
  73. package/lib/minify.js +7 -7
  74. package/lib/redirects.js +8 -8
  75. package/lib/rss.js +20 -19
  76. package/lib/sass.js +45 -10
  77. package/lib/sitemap.js +36 -11
  78. package/lib/ssqch.js +4 -4
  79. package/package.json +2 -2
  80. package/types/image.d.ts +5 -5
  81. package/types/index.d.ts +12 -4
  82. package/types/rss.d.ts +1 -1
  83. package/types/sitemap.d.ts +2 -0
  84. package/wasm/markdown.wasm +0 -0
  85. package/bundled/README.md +0 -1247
  86. package/lib/{chunk-6XYSFG6V.js.LEGAL.txt → chunk-BGCBSQ4A.js.LEGAL.txt} +3 -3
  87. /package/lib/{chunk-BOBPVAX2.js.LEGAL.txt → chunk-SRNLKWXL.js.LEGAL.txt} +0 -0
@@ -2,15 +2,15 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  withBase
5
- } from "./chunk-TN6EEDX2.js";
5
+ } from "./chunk-QMA7CK7B.js";
6
6
  import {
7
7
  slugOptions,
8
8
  slugWith
9
- } from "./chunk-EIT4ZDT4.js";
9
+ } from "./chunk-5DNDSNTP.js";
10
10
  import {
11
11
  BuildError,
12
12
  isPlainObject
13
- } from "./chunk-6XYSFG6V.js";
13
+ } from "./chunk-BGCBSQ4A.js";
14
14
  import {
15
15
  compareText
16
16
  } from "./chunk-VJWQSYEG.js";
@@ -77,8 +77,11 @@ function excerpt(html) {
77
77
  if (more) return html.slice(0, more.index).trim();
78
78
  return /<p(?:\s[^>]*)?>.*?<\/p>/is.exec(html)?.[0];
79
79
  }
80
- function toc(list, from, to, ordered) {
80
+ function toc(list, from, to, ordered, markup = {}) {
81
81
  const tag = ordered ? "ol" : "ul";
82
+ const attr = (name, value) => value ? ` ${name}="${escapeHtml(value)}"` : "";
83
+ const open = (outer) => `<${tag}${outer ? attr("id", markup.id) + attr("class", markup.class) : attr("class", markup.sublistClass)}>`;
84
+ const link = attr("class", markup.linkClass);
82
85
  const items = [];
83
86
  for (const v of list) {
84
87
  const h = v;
@@ -91,7 +94,7 @@ function toc(list, from, to, ordered) {
91
94
  const stack = [];
92
95
  for (const h of items) {
93
96
  if (!stack.length) {
94
- out += `<${tag}>`;
97
+ out += open(true);
95
98
  stack.push(h.level);
96
99
  } else {
97
100
  while (stack.length > 1 && h.level < stack[stack.length - 1]) {
@@ -99,13 +102,13 @@ function toc(list, from, to, ordered) {
99
102
  stack.pop();
100
103
  }
101
104
  if (h.level > stack[stack.length - 1]) {
102
- out += `<${tag}>`;
105
+ out += open(false);
103
106
  stack.push(h.level);
104
107
  } else {
105
108
  out += "</li>";
106
109
  }
107
110
  }
108
- out += `<li><a href="#${escapeHtml(h.id ?? "")}">${escapeText(h.text)}</a>`;
111
+ out += `<li${attr("class", markup.itemClass?.replaceAll("{level}", String(h.level)))}><a href="#${escapeHtml(h.id ?? "")}"${link}>${escapeText(h.text)}</a>`;
109
112
  }
110
113
  for (const _ of stack) out += `</li></${tag}>`;
111
114
  return out;
@@ -312,7 +315,7 @@ function fromPages(items) {
312
315
  // src/filters.ts
313
316
  var BUILTIN_FILTERS = [
314
317
  ["markdown", '`markdown(text)` renders Markdown with the site\'s options; `markdown(text, "inline")` without the `<p>`.'],
315
- ["toc", "`toc(page.headings)` is a table of contents; `toc(page.headings, { from: 2, to: 4, ordered: true })` picks the levels."],
318
+ ["toc", "`toc(page.headings)` is a table of contents; `toc(page.headings, { from: 2, to: 4, ordered: true })` picks the levels, and `id`, `class`, `sublistClass`, `itemClass` (`{level}` is the heading's) and `linkClass` set the markup's."],
316
319
  ["navTree", "`navTree(nav, page.url)` marks a navigation tree's entries `current`, `ancestor` or `open`."],
317
320
  ["navPager", "`navPager(nav, page.url)` is `{ previous, next }` in reading order."],
318
321
  ["navBreadcrumbs", "`navBreadcrumbs(nav, page.url)` is the entries from the top down to the page."],
@@ -347,12 +350,17 @@ function builtinFilters(markdown, config) {
347
350
  const words = splitWhitespace(htmlText(String(text))).length;
348
351
  return Math.max(Math.ceil(words / wpm), 1);
349
352
  });
353
+ const TOC_MARKUP = ["id", "class", "sublistClass", "itemClass", "linkClass"];
350
354
  filters.set("toc", (list, option, last) => {
351
355
  const headings2 = Array.isArray(list) ? list : [];
352
356
  let [from, to, ordered] = [2, 3, false];
357
+ const markup = {};
353
358
  if (isPlainObject(option)) {
354
- for (const key of Object.keys(option)) {
355
- if (!["from", "to", "ordered"].includes(key)) throw new BuildError(`toc: unknown option \`${key}\` (options: from, to, ordered)`);
359
+ for (const [key, value] of Object.entries(option)) {
360
+ if (TOC_MARKUP.includes(key)) {
361
+ if (value !== void 0 && value !== null && typeof value !== "string") throw new BuildError(`toc: \`${key}\` must be text (a class name, or names with spaces between)`);
362
+ if (value) markup[key] = value;
363
+ } else if (!["from", "to", "ordered"].includes(key)) throw new BuildError(`toc: unknown option \`${key}\` (options: from, to, ordered, ${TOC_MARKUP.join(", ")})`);
356
364
  }
357
365
  if (typeof option.from === "number") from = option.from;
358
366
  if (typeof option.to === "number") to = option.to;
@@ -362,7 +370,7 @@ function builtinFilters(markdown, config) {
362
370
  to = typeof last === "number" ? last : Math.max(to, from);
363
371
  }
364
372
  const level = (n) => Math.trunc(Math.min(Math.max(n, 1), 6));
365
- return toc(headings2, level(from), level(to), ordered);
373
+ return toc(headings2, level(from), level(to), ordered, markup);
366
374
  });
367
375
  filters.set("withBase", (url) => withBase(config.base, url === void 0 ? "" : String(url)));
368
376
  return filters;
@@ -2,20 +2,20 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  inspectPages
5
- } from "./chunk-BOBPVAX2.js";
5
+ } from "./chunk-SRNLKWXL.js";
6
6
  import "./chunk-4Q6WMTER.js";
7
- import "./chunk-RI2L3VGO.js";
8
- import "./chunk-3PHCFZEU.js";
9
- import "./chunk-TN6EEDX2.js";
10
- import "./chunk-IRHRK7XB.js";
7
+ import "./chunk-CB6YFUXU.js";
8
+ import "./chunk-N4O5MDIB.js";
9
+ import "./chunk-QMA7CK7B.js";
10
+ import "./chunk-LCPSKHAV.js";
11
11
  import "./chunk-NKXEPHRZ.js";
12
12
  import "./chunk-AD3HAW3W.js";
13
13
  import "./chunk-DDV6JEC2.js";
14
- import "./chunk-EIT4ZDT4.js";
14
+ import "./chunk-5DNDSNTP.js";
15
15
  import "./chunk-FVZ5JBRI.js";
16
- import "./chunk-TDGBQNGW.js";
16
+ import "./chunk-NFJJKDRI.js";
17
17
  import "./chunk-UU43WIZG.js";
18
- import "./chunk-C35KIPAR.js";
18
+ import "./chunk-JWCCVTTR.js";
19
19
  import {
20
20
  charCount,
21
21
  firstChars,
@@ -28,7 +28,7 @@ import {
28
28
  import {
29
29
  bail,
30
30
  getPath
31
- } from "./chunk-6XYSFG6V.js";
31
+ } from "./chunk-BGCBSQ4A.js";
32
32
  import {
33
33
  comparePaths,
34
34
  compareText,
@@ -9,25 +9,25 @@ import {
9
9
  inspectPages,
10
10
  runCommand,
11
11
  sameContentsForTest
12
- } from "./chunk-BOBPVAX2.js";
12
+ } from "./chunk-SRNLKWXL.js";
13
13
  import {
14
14
  commandLine,
15
15
  toolPath
16
16
  } from "./chunk-4Q6WMTER.js";
17
- import "./chunk-RI2L3VGO.js";
18
- import "./chunk-3PHCFZEU.js";
19
- import "./chunk-TN6EEDX2.js";
20
- import "./chunk-IRHRK7XB.js";
17
+ import "./chunk-CB6YFUXU.js";
18
+ import "./chunk-N4O5MDIB.js";
19
+ import "./chunk-QMA7CK7B.js";
20
+ import "./chunk-LCPSKHAV.js";
21
21
  import "./chunk-NKXEPHRZ.js";
22
22
  import "./chunk-AD3HAW3W.js";
23
23
  import "./chunk-DDV6JEC2.js";
24
- import "./chunk-EIT4ZDT4.js";
24
+ import "./chunk-5DNDSNTP.js";
25
25
  import "./chunk-FVZ5JBRI.js";
26
- import "./chunk-TDGBQNGW.js";
26
+ import "./chunk-NFJJKDRI.js";
27
27
  import "./chunk-UU43WIZG.js";
28
- import "./chunk-C35KIPAR.js";
28
+ import "./chunk-JWCCVTTR.js";
29
29
  import "./chunk-CMUWRPSQ.js";
30
- import "./chunk-6XYSFG6V.js";
30
+ import "./chunk-BGCBSQ4A.js";
31
31
  import "./chunk-VJWQSYEG.js";
32
32
  import "./chunk-I3PS26CI.js";
33
33
  export {
@@ -8,8 +8,8 @@ import {
8
8
  loadConfig,
9
9
  meant,
10
10
  tomlKeyLine
11
- } from "./chunk-TN6EEDX2.js";
12
- import "./chunk-IRHRK7XB.js";
11
+ } from "./chunk-QMA7CK7B.js";
12
+ import "./chunk-LCPSKHAV.js";
13
13
  import "./chunk-NKXEPHRZ.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
15
  import {
@@ -19,13 +19,13 @@ import {
19
19
  shownDir,
20
20
  shownOutput
21
21
  } from "./chunk-DDV6JEC2.js";
22
- import "./chunk-EIT4ZDT4.js";
22
+ import "./chunk-5DNDSNTP.js";
23
23
  import "./chunk-FVZ5JBRI.js";
24
- import "./chunk-TDGBQNGW.js";
24
+ import "./chunk-NFJJKDRI.js";
25
25
  import "./chunk-UU43WIZG.js";
26
- import "./chunk-C35KIPAR.js";
26
+ import "./chunk-JWCCVTTR.js";
27
27
  import "./chunk-CMUWRPSQ.js";
28
- import "./chunk-6XYSFG6V.js";
28
+ import "./chunk-BGCBSQ4A.js";
29
29
  import "./chunk-VJWQSYEG.js";
30
30
  import "./chunk-I3PS26CI.js";
31
31
  export {
@@ -3,25 +3,25 @@ const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  types,
5
5
  write
6
- } from "./chunk-WP3RPVUM.js";
6
+ } from "./chunk-Y2ESFAAD.js";
7
7
  import {
8
8
  loadConfig,
9
9
  schemaTypes
10
- } from "./chunk-TN6EEDX2.js";
11
- import "./chunk-IRHRK7XB.js";
10
+ } from "./chunk-QMA7CK7B.js";
11
+ import "./chunk-LCPSKHAV.js";
12
12
  import "./chunk-NKXEPHRZ.js";
13
13
  import "./chunk-AD3HAW3W.js";
14
14
  import "./chunk-DDV6JEC2.js";
15
- import "./chunk-EIT4ZDT4.js";
15
+ import "./chunk-5DNDSNTP.js";
16
16
  import "./chunk-FVZ5JBRI.js";
17
- import "./chunk-TDGBQNGW.js";
17
+ import "./chunk-NFJJKDRI.js";
18
18
  import "./chunk-UU43WIZG.js";
19
- import "./chunk-C35KIPAR.js";
19
+ import "./chunk-JWCCVTTR.js";
20
20
  import "./chunk-CMUWRPSQ.js";
21
21
  import {
22
22
  messageOf,
23
23
  red
24
- } from "./chunk-6XYSFG6V.js";
24
+ } from "./chunk-BGCBSQ4A.js";
25
25
  import "./chunk-VJWQSYEG.js";
26
26
  import "./chunk-I3PS26CI.js";
27
27
 
@@ -3,8 +3,8 @@ const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  buildFiles,
5
5
  urlOf
6
- } from "./chunk-3PHCFZEU.js";
7
- import "./chunk-IRHRK7XB.js";
6
+ } from "./chunk-N4O5MDIB.js";
7
+ import "./chunk-LCPSKHAV.js";
8
8
  import {
9
9
  bytes,
10
10
  count
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  BuildError,
22
22
  bail
23
- } from "./chunk-6XYSFG6V.js";
23
+ } from "./chunk-BGCBSQ4A.js";
24
24
  import {
25
25
  compareText
26
26
  } from "./chunk-VJWQSYEG.js";
@@ -327,7 +327,7 @@ function recordActions(ids2, oppositeCounts) {
327
327
  }
328
328
  function scanConfusingRun(actions, from, step) {
329
329
  let discards = 0, investigates = 0;
330
- for (let i = from, seen = 0; i >= 0 && i < actions.length && seen < CONFUSING_RECORD_SCAN_WINDOW; i += step, seen++) {
330
+ for (let i = from, seen2 = 0; i >= 0 && i < actions.length && seen2 < CONFUSING_RECORD_SCAN_WINDOW; i += step, seen2++) {
331
331
  if (actions[i] === DISCARD) discards++;
332
332
  else if (actions[i] === INVESTIGATE) investigates++;
333
333
  else break;
@@ -1218,12 +1218,133 @@ function diffJson(report, limit) {
1218
1218
  changed
1219
1219
  };
1220
1220
  }
1221
+ async function compareRuns(dirs, options) {
1222
+ const keep = (paths) => options.only ? paths.filter((p) => options.only.some((re) => re.test(p))) : paths;
1223
+ const walks = await Promise.allSettled(dirs.map(files));
1224
+ for (const walk of walks) if (walk.status === "rejected") throw walk.reason;
1225
+ const maps = walks.map((w) => keyed(keep(w.value), options.exact));
1226
+ const keys = [...new Set(maps.flatMap((m) => [...m.keys()]))].sort(compareText);
1227
+ const report = { runs: dirs, exact: options.exact, varies: [], steadyPages: 0, steadyFiles: 0 };
1228
+ const found = new Array(keys.length);
1229
+ let next = 0;
1230
+ const worker = async () => {
1231
+ while (next < keys.length) {
1232
+ const i = next++;
1233
+ const key = keys[i];
1234
+ const buffers = await Promise.all(maps.map(async (m, run) => {
1235
+ const file = m.get(key);
1236
+ return file === void 0 ? void 0 : Buffer.from(await fs.promises.readFile(path.join(dirs[run], file)));
1237
+ }));
1238
+ found[i] = varies(key, buffers, maps, options);
1239
+ }
1240
+ };
1241
+ await Promise.all(Array.from({ length: Math.min(READS_AT_ONCE, keys.length) }, worker));
1242
+ keys.forEach((key, i) => {
1243
+ const v = found[i];
1244
+ if (v) report.varies.push(v);
1245
+ else if (isPage(key)) report.steadyPages += 1;
1246
+ else report.steadyFiles += 1;
1247
+ });
1248
+ return report;
1249
+ }
1250
+ function seen(key, data, options) {
1251
+ const text = decode(data);
1252
+ if (text === void 0) return `b:${data.toString("base64")}`;
1253
+ const normal = normalize(text, options);
1254
+ if (isPage(key) && !options.exact) return `p:${tokens(normal).map((t) => `${t.tag ? 1 : 0}${t.text}`).join("\0")}`;
1255
+ return `t:${normal}`;
1256
+ }
1257
+ function varies(key, buffers, maps, options) {
1258
+ const groups = /* @__PURE__ */ new Map();
1259
+ buffers.forEach((data, run) => {
1260
+ const id = data === void 0 ? "missing" : seen(key, data, options);
1261
+ const list = groups.get(id);
1262
+ if (list) list.push(run);
1263
+ else groups.set(id, [run]);
1264
+ });
1265
+ if (groups.size === 1 && !groups.has("missing")) return void 0;
1266
+ const versions = [...groups].map(([id, runs]) => ({ runs, missing: id === "missing" }));
1267
+ versions.sort((a, b) => b.runs.length - a.runs.length || a.runs[0] - b.runs[0]);
1268
+ const present = versions.filter((v) => !v.missing);
1269
+ let sample;
1270
+ if (present.length >= 2) {
1271
+ const [x, y] = [present[0].runs[0], present[1].runs[0]];
1272
+ sample = comparePair(buffers[x], buffers[y], { key, before: maps[x].get(key), after: maps[y].get(key) }, options);
1273
+ }
1274
+ const first = buffers.find((b) => b !== void 0);
1275
+ const kind = decode(first) === void 0 ? "binary" : isPage(key) ? "page" : "text";
1276
+ return { path: key, url: urlOf(key), kind, versions, sample };
1277
+ }
1278
+ var named = (report, runs) => runs.map((r) => report.runs[r]).join(", ");
1279
+ function runsText(report, limit, color) {
1280
+ const paint = (code, s) => color ? `\x1B[${code}m${s}\x1B[0m` : s;
1281
+ let out = `Comparing ${count(report.runs.length)} builds: ${report.runs.join(", ")}
1282
+ `;
1283
+ out += report.exact ? "Comparing bytes (--exact).\n" : "Ignoring asset fingerprints, integrity hashes, the generator's version, and whitespace between tags (--exact compares bytes).\n";
1284
+ const steady = `${plural(report.steadyPages, "page", "pages")} and ${plural(report.steadyFiles, "other file", "other files")}`;
1285
+ if (!report.varies.length) return `${out}
1286
+ Every build is the same: ${steady}. The tracks match every time.
1287
+ `;
1288
+ out += `
1289
+ Varies (${report.varies.length})
1290
+ `;
1291
+ for (const file of report.varies) {
1292
+ const [most, ...rest] = file.versions;
1293
+ const onlyIn = most.missing && rest.length === 1;
1294
+ const others = rest.map((v) => v.missing ? `missing from ${named(report, v.runs)}` : onlyIn ? `only in ${named(report, v.runs)}` : `${named(report, v.runs)} differ${v.runs.length === 1 ? "s" : ""}`);
1295
+ const agree = most.missing ? `missing from ${named(report, most.runs)}` : `${named(report, most.runs)} agree${most.runs.length === 1 ? "s" : ""}`;
1296
+ out += ` ~ ${file.url} (${file.versions.length} versions: ${agree}; ${others.join("; ")})
1297
+ `;
1298
+ const sample = file.sample;
1299
+ if (!sample) continue;
1300
+ for (const note of sample.notes) out += ` ${note}
1301
+ `;
1302
+ let shown = 0;
1303
+ done: for (const hunk of sample.hunks) {
1304
+ for (const [sign, code, side] of [["-", "31", hunk.removed], ["+", "32", hunk.added]]) {
1305
+ for (const line of side) {
1306
+ if (limit > 0 && shown >= limit) break done;
1307
+ out += paint(code, ` ${sign} ${clip(line)}
1308
+ `);
1309
+ shown += 1;
1310
+ }
1311
+ }
1312
+ }
1313
+ if (sample.changedLines > shown) out += ` ... ${count(sample.changedLines - shown)} more changed ${sample.changedLines - shown === 1 ? "line" : "lines"} (--lines 0 shows all)
1314
+ `;
1315
+ }
1316
+ out += `
1317
+ ${plural(report.varies.length, "file varies", "files vary")} between builds made the same way; ${steady} are the same in all of them. Pin what changes (the build's time, random ids) before comparing another build with these, or leave it out with --ignore.
1318
+ `;
1319
+ return out;
1320
+ }
1321
+ function runsJson(report, limit) {
1322
+ const runs = report.runs.map((r) => r.replaceAll("\\", "/"));
1323
+ return {
1324
+ schemaVersion: 1,
1325
+ runs,
1326
+ exact: report.exact,
1327
+ same: report.varies.length === 0,
1328
+ summary: { varies: report.varies.length, steadyPages: report.steadyPages, steadyFiles: report.steadyFiles },
1329
+ varies: report.varies.map((f) => ({
1330
+ url: f.url,
1331
+ path: f.path,
1332
+ kind: f.kind,
1333
+ versions: f.versions.map((v) => ({ runs: v.runs.map((r) => runs[r]), missing: v.missing })),
1334
+ changedLines: f.sample?.changedLines ?? 0,
1335
+ hunks: f.sample ? firstLines(f.sample.hunks, limit) : []
1336
+ }))
1337
+ };
1338
+ }
1221
1339
  export {
1222
1340
  compare,
1341
+ compareRuns,
1223
1342
  diffJson,
1224
1343
  diffText,
1225
1344
  isSame,
1226
1345
  keyed,
1346
+ runsJson,
1347
+ runsText,
1227
1348
  tokens,
1228
1349
  withoutFingerprints
1229
1350
  };
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-FVZ5JBRI.js";
6
6
  import {
7
7
  bail
8
- } from "./chunk-6XYSFG6V.js";
8
+ } from "./chunk-BGCBSQ4A.js";
9
9
 
10
10
  // src/modules/options.ts
11
11
  var Options = class {
@@ -2,7 +2,7 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  BuildError
5
- } from "./chunk-6XYSFG6V.js";
5
+ } from "./chunk-BGCBSQ4A.js";
6
6
  import {
7
7
  realPath
8
8
  } from "./chunk-VJWQSYEG.js";
@@ -54,22 +54,113 @@ function hookModules() {
54
54
  }
55
55
  return next(name, context);
56
56
  };
57
- try {
58
- return attempt(specifier);
59
- } catch (e) {
60
- const relative = specifier.startsWith("./") || specifier.startsWith("../") || path.isAbsolute(specifier) || specifier.startsWith("file:");
61
- if (!fromSite || !relative || !["ERR_MODULE_NOT_FOUND", "ERR_UNSUPPORTED_DIR_IMPORT"].includes(e?.code)) throw e;
62
- const [bare, query = ""] = specifier.split(/(?=\?)/, 2);
57
+ const withEndings = (name) => {
58
+ const [bare, query = ""] = name.split(/(?=\?)/, 2);
59
+ try {
60
+ return attempt(name);
61
+ } catch {
62
+ }
63
63
  for (const ending of ENDINGS) {
64
64
  try {
65
65
  return attempt(bare.replace(/\/$/, "") + ending + query);
66
66
  } catch {
67
67
  }
68
68
  }
69
+ return void 0;
70
+ };
71
+ try {
72
+ return attempt(specifier);
73
+ } catch (e) {
74
+ const hashAlias = specifier.startsWith("#") && ["ERR_PACKAGE_IMPORT_NOT_DEFINED", "ERR_INVALID_MODULE_SPECIFIER"].includes(e?.code);
75
+ if (!fromSite || !hashAlias && !["ERR_MODULE_NOT_FOUND", "ERR_UNSUPPORTED_DIR_IMPORT"].includes(e?.code)) throw e;
76
+ const relative = specifier.startsWith("./") || specifier.startsWith("../") || path.isAbsolute(specifier) || specifier.startsWith("file:");
77
+ if (relative) return withEndings(specifier) ?? (() => {
78
+ throw e;
79
+ })();
80
+ for (const file of aliasTargets(specifier, path.dirname(fileURLToPath(context.parentURL)))) {
81
+ const found = withEndings(pathToFileURL(file).href);
82
+ if (found) return found;
83
+ }
69
84
  throw e;
70
85
  }
71
86
  }
72
87
  }
88
+ var aliasesByDir = /* @__PURE__ */ new Map();
89
+ function parseJsonc(text) {
90
+ let out = "";
91
+ for (let i = 0; i < text.length; i++) {
92
+ const c = text[i];
93
+ if (c === '"') {
94
+ const end = /^"(?:[^"\\]|\\.)*"/.exec(text.slice(i))?.[0] ?? c;
95
+ out += end;
96
+ i += end.length - 1;
97
+ } else if (c === "/" && text[i + 1] === "/") {
98
+ while (i < text.length && text[i] !== "\n") i++;
99
+ out += "\n";
100
+ } else if (c === "/" && text[i + 1] === "*") {
101
+ const end = text.indexOf("*/", i + 2);
102
+ i = end === -1 ? text.length : end + 1;
103
+ } else out += c;
104
+ }
105
+ return JSON.parse(out.replace(/,(\s*[}\]])/g, "$1"));
106
+ }
107
+ function readAliases(file, seen = /* @__PURE__ */ new Set()) {
108
+ if (seen.has(file)) return null;
109
+ seen.add(file);
110
+ let json;
111
+ try {
112
+ json = parseJsonc(fs.readFileSync(file, "utf8"));
113
+ } catch {
114
+ return null;
115
+ }
116
+ const dir = path.dirname(file);
117
+ const options = json?.compilerOptions ?? {};
118
+ if (options.paths && typeof options.paths === "object") {
119
+ const base = typeof options.baseUrl === "string" ? path.resolve(dir, options.baseUrl) : dir;
120
+ const paths = Object.entries(options.paths).filter((e) => Array.isArray(e[1])).map(([k, v]) => [k, v.filter((t) => typeof t === "string")]);
121
+ return { base, paths };
122
+ }
123
+ const parents = (Array.isArray(json?.extends) ? json.extends : [json?.extends]).filter((x) => typeof x === "string" && (x.startsWith("./") || x.startsWith("../")));
124
+ for (const parent of parents) {
125
+ const found = readAliases(path.resolve(dir, parent.endsWith(".json") ? parent : `${parent}.json`), seen);
126
+ if (found) return found;
127
+ }
128
+ return null;
129
+ }
130
+ function aliasesFor(dir) {
131
+ if (aliasesByDir.has(dir)) return aliasesByDir.get(dir);
132
+ let found = null;
133
+ for (const name of ["tsconfig.json", "jsconfig.json"]) {
134
+ const file = path.join(dir, name);
135
+ if (fs.existsSync(file)) {
136
+ found = readAliases(file);
137
+ break;
138
+ }
139
+ }
140
+ if (!found && !fs.existsSync(path.join(dir, "tsconfig.json")) && !fs.existsSync(path.join(dir, "jsconfig.json"))) {
141
+ const up = path.dirname(dir);
142
+ if (up !== dir) found = aliasesFor(up);
143
+ }
144
+ aliasesByDir.set(dir, found);
145
+ return found;
146
+ }
147
+ function aliasTargets(specifier, fromDir) {
148
+ const aliases = aliasesFor(fromDir);
149
+ if (!aliases) return [];
150
+ let best;
151
+ for (const [pattern, targets] of aliases.paths) {
152
+ const at = pattern.indexOf("*");
153
+ if (at === -1) {
154
+ if (pattern === specifier) return targets.map((t) => path.resolve(aliases.base, t));
155
+ continue;
156
+ }
157
+ const prefix = pattern.slice(0, at), suffix = pattern.slice(at + 1);
158
+ if (!specifier.startsWith(prefix) || !specifier.endsWith(suffix) || specifier.length < prefix.length + suffix.length) continue;
159
+ if (best && prefix.length <= best.pattern.indexOf("*")) continue;
160
+ best = { pattern, star: specifier.slice(prefix.length, specifier.length - suffix.length), targets };
161
+ }
162
+ return best ? best.targets.map((t) => path.resolve(aliases.base, t.replace("*", best.star))) : [];
163
+ }
73
164
  var versions = /* @__PURE__ */ new Map();
74
165
  async function importFile(file) {
75
166
  hookModules();
@@ -6,9 +6,9 @@ import {
6
6
  globSet,
7
7
  globToRegExp,
8
8
  isGlob
9
- } from "./chunk-TDGBQNGW.js";
9
+ } from "./chunk-NFJJKDRI.js";
10
10
  import "./chunk-CMUWRPSQ.js";
11
- import "./chunk-6XYSFG6V.js";
11
+ import "./chunk-BGCBSQ4A.js";
12
12
  import "./chunk-VJWQSYEG.js";
13
13
  import "./chunk-I3PS26CI.js";
14
14
  export {
@@ -2,7 +2,7 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  red
5
- } from "./chunk-6XYSFG6V.js";
5
+ } from "./chunk-BGCBSQ4A.js";
6
6
 
7
7
  // src/serve/builder.ts
8
8
  import { fork } from "node:child_process";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-CMUWRPSQ.js";
9
9
  import {
10
10
  bail
11
- } from "./chunk-6XYSFG6V.js";
11
+ } from "./chunk-BGCBSQ4A.js";
12
12
 
13
13
  // src/budgets.ts
14
14
  var BUDGETS = [
@@ -2,7 +2,7 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  BUDGETS
5
- } from "./chunk-IRHRK7XB.js";
5
+ } from "./chunk-LCPSKHAV.js";
6
6
  import {
7
7
  bytes,
8
8
  count,
@@ -16,7 +16,7 @@ import {
16
16
  BuildError,
17
17
  bail,
18
18
  warning
19
- } from "./chunk-6XYSFG6V.js";
19
+ } from "./chunk-BGCBSQ4A.js";
20
20
  import {
21
21
  compareText,
22
22
  realPath
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-CMUWRPSQ.js";
6
6
  import {
7
7
  bail
8
- } from "./chunk-6XYSFG6V.js";
8
+ } from "./chunk-BGCBSQ4A.js";
9
9
 
10
10
  // src/glob.ts
11
11
  var stripDot = (p) => p.replace(/^(\.\/)+/, "");
@@ -5,20 +5,20 @@ import {
5
5
  capabilities,
6
6
  modules,
7
7
  runCapabilities
8
- } from "./chunk-AMBFWPZ4.js";
9
- import "./chunk-WP3RPVUM.js";
10
- import "./chunk-TN6EEDX2.js";
11
- import "./chunk-IRHRK7XB.js";
8
+ } from "./chunk-3EPHKJEG.js";
9
+ import "./chunk-Y2ESFAAD.js";
10
+ import "./chunk-QMA7CK7B.js";
11
+ import "./chunk-LCPSKHAV.js";
12
12
  import "./chunk-NKXEPHRZ.js";
13
13
  import "./chunk-AD3HAW3W.js";
14
14
  import "./chunk-DDV6JEC2.js";
15
- import "./chunk-EIT4ZDT4.js";
15
+ import "./chunk-5DNDSNTP.js";
16
16
  import "./chunk-FVZ5JBRI.js";
17
- import "./chunk-TDGBQNGW.js";
17
+ import "./chunk-NFJJKDRI.js";
18
18
  import "./chunk-UU43WIZG.js";
19
- import "./chunk-C35KIPAR.js";
19
+ import "./chunk-JWCCVTTR.js";
20
20
  import "./chunk-CMUWRPSQ.js";
21
- import "./chunk-6XYSFG6V.js";
21
+ import "./chunk-BGCBSQ4A.js";
22
22
  import "./chunk-VJWQSYEG.js";
23
23
  import "./chunk-I3PS26CI.js";
24
24
  export {