ssqch 0.8.0 → 0.9.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 (52) hide show
  1. package/README.md +2 -0
  2. package/bundled/README.md +144 -77
  3. package/bundled/ssqch.d.ts +17 -9
  4. package/bundled/trailheads/from-jekyll.md +79 -0
  5. package/lib/assets.js +7 -7
  6. package/lib/{chunk-RI2L3VGO.js → chunk-3A647I3N.js} +19 -11
  7. package/lib/{chunk-AMBFWPZ4.js → chunk-3K3ANWZ2.js} +3 -3
  8. package/lib/{chunk-WMOVCQO6.js → chunk-47P4YREZ.js} +6 -6
  9. package/lib/{chunk-C35KIPAR.js → chunk-76NTVE34.js} +98 -7
  10. package/lib/{chunk-TWCVHOKO.js → chunk-7PWCYHTJ.js} +125 -4
  11. package/lib/{chunk-JSPSMIJ2.js → chunk-7RDRZHJD.js} +9 -9
  12. package/lib/{chunk-JRT7TQQP.js → chunk-7SD7K567.js} +1 -1
  13. package/lib/{chunk-IRHRK7XB.js → chunk-7XLK2GEG.js} +1 -1
  14. package/lib/{chunk-YSH2NMIE.js → chunk-BEGC7YP6.js} +6 -6
  15. package/lib/{chunk-HR2RU2LY.js → chunk-CZ4XQC56.js} +6 -6
  16. package/lib/{chunk-DHHQKW4F.js → chunk-D2XE2GTY.js} +7 -7
  17. package/lib/{chunk-BOBPVAX2.js → chunk-DELWRJAO.js} +373 -52
  18. package/lib/{chunk-6XYSFG6V.js → chunk-GRWMGC7D.js} +15 -3
  19. package/lib/{chunk-N5QTGQ5N.js → chunk-GUKSZ2XM.js} +1 -1
  20. package/lib/{chunk-TDGBQNGW.js → chunk-HPXAZ2HU.js} +1 -1
  21. package/lib/{chunk-3PHCFZEU.js → chunk-II5DEH3Q.js} +2 -2
  22. package/lib/{chunk-FYGE634X.js → chunk-IJWHOFRP.js} +9 -9
  23. package/lib/{chunk-UGEGUUBT.js → chunk-LPHNACE4.js} +8 -8
  24. package/lib/{chunk-KBGE5MCY.js → chunk-MI6EJWA2.js} +1 -1
  25. package/lib/{chunk-EIT4ZDT4.js → chunk-NCWFYT74.js} +61 -5
  26. package/lib/{chunk-VVPZ5PDP.js → chunk-NNUKIGOO.js} +11 -11
  27. package/lib/{chunk-TN6EEDX2.js → chunk-R7K3D5W5.js} +28 -6
  28. package/lib/{chunk-37KSIVNY.js → chunk-RNJFPFXE.js} +3 -3
  29. package/lib/{chunk-CDEPYU7W.js → chunk-SF4I6Z7S.js} +2 -2
  30. package/lib/{chunk-GSKVRAHF.js → chunk-SURPOAW7.js} +6 -6
  31. package/lib/{chunk-BRK4MXXO.js → chunk-SXMJ52IK.js} +18 -11
  32. package/lib/{chunk-EZZUUPI4.js → chunk-TICWN55Z.js} +2 -2
  33. package/lib/{chunk-NUKCUDC4.js → chunk-TVU3OPPK.js} +3 -3
  34. package/lib/{chunk-GOE4ZSAB.js → chunk-XMXBHXZR.js} +9 -9
  35. package/lib/{chunk-WP3RPVUM.js → chunk-YTHQBMDJ.js} +1 -1
  36. package/lib/cli.js +32 -25
  37. package/lib/elements.js +7 -7
  38. package/lib/image.js +8 -8
  39. package/lib/links.js +7 -7
  40. package/lib/minify.js +7 -7
  41. package/lib/redirects.js +7 -7
  42. package/lib/rss.js +8 -8
  43. package/lib/sass.js +45 -10
  44. package/lib/sitemap.js +36 -11
  45. package/lib/ssqch.js +4 -4
  46. package/package.json +1 -1
  47. package/types/image.d.ts +5 -5
  48. package/types/index.d.ts +10 -4
  49. package/types/sitemap.d.ts +2 -0
  50. package/wasm/markdown.wasm +0 -0
  51. /package/lib/{chunk-BOBPVAX2.js.LEGAL.txt → chunk-DELWRJAO.js.LEGAL.txt} +0 -0
  52. /package/lib/{chunk-6XYSFG6V.js.LEGAL.txt → chunk-GRWMGC7D.js.LEGAL.txt} +0 -0
@@ -2,24 +2,24 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  OUTPUT_LIST
5
- } from "./chunk-BOBPVAX2.js";
5
+ } from "./chunk-DELWRJAO.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-3A647I3N.js";
8
+ import "./chunk-II5DEH3Q.js";
9
+ import "./chunk-R7K3D5W5.js";
10
+ import "./chunk-7XLK2GEG.js";
11
11
  import {
12
12
  count
13
13
  } from "./chunk-NKXEPHRZ.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
15
  import "./chunk-DDV6JEC2.js";
16
- import "./chunk-EIT4ZDT4.js";
16
+ import "./chunk-NCWFYT74.js";
17
17
  import "./chunk-FVZ5JBRI.js";
18
- import "./chunk-TDGBQNGW.js";
18
+ import "./chunk-HPXAZ2HU.js";
19
19
  import "./chunk-UU43WIZG.js";
20
- import "./chunk-C35KIPAR.js";
20
+ import "./chunk-76NTVE34.js";
21
21
  import "./chunk-CMUWRPSQ.js";
22
- import "./chunk-6XYSFG6V.js";
22
+ import "./chunk-GRWMGC7D.js";
23
23
  import "./chunk-VJWQSYEG.js";
24
24
  import "./chunk-I3PS26CI.js";
25
25
 
@@ -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-GRWMGC7D.js";
6
6
  import {
7
7
  joinAsGiven,
8
8
  parentAsGiven,
package/lib/cli.js CHANGED
@@ -2,7 +2,7 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  BUILDER
5
- } from "./chunk-KBGE5MCY.js";
5
+ } from "./chunk-MI6EJWA2.js";
6
6
  import {
7
7
  Printed,
8
8
  UsageError,
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  DEFAULT_ENGINE,
13
13
  bundled
14
- } from "./chunk-WP3RPVUM.js";
14
+ } from "./chunk-YTHQBMDJ.js";
15
15
  import {
16
16
  VERSION
17
17
  } from "./chunk-AD3HAW3W.js";
@@ -23,7 +23,7 @@ import {
23
23
  } from "./chunk-DDV6JEC2.js";
24
24
  import {
25
25
  describeThrown
26
- } from "./chunk-C35KIPAR.js";
26
+ } from "./chunk-76NTVE34.js";
27
27
  import {
28
28
  prettyJson,
29
29
  quoted
@@ -48,7 +48,7 @@ import {
48
48
  toJson2,
49
49
  warn,
50
50
  warning
51
- } from "./chunk-6XYSFG6V.js";
51
+ } from "./chunk-GRWMGC7D.js";
52
52
  import {
53
53
  relative
54
54
  } from "./chunk-VJWQSYEG.js";
@@ -120,7 +120,7 @@ var COMMANDS = [
120
120
  },
121
121
  {
122
122
  name: "diff",
123
- about: "Compare two builds of a site: URLs added and removed, and what changed on each page",
123
+ about: "Compare two builds of a site: URLs added and removed, and what changed on each page. Given three or more, list what varies between them",
124
124
  options: [
125
125
  { long: "exact", help: "Compare bytes: don't match fingerprinted files or ignore whitespace" },
126
126
  { long: "ignore", value: "REGEX", help: "Leave out text matching this regular expression before comparing (repeatable)", many: true },
@@ -128,8 +128,8 @@ var COMMANDS = [
128
128
  { long: "lines", value: "LINES", help: "Changed lines to show for each file (0 for all)", default: "10", check: number },
129
129
  FORMAT
130
130
  ],
131
- positionals: [{ name: "BEFORE", help: "The build from before the change", required: true, path: true }, { name: "AFTER", help: "The build from after it", required: true, path: true }],
132
- afterHelp: "Build the site into one folder before a change and another after it:\n\n ssqch build --output dist-before\n (upgrade ssqch, edit a layout, ...)\n ssqch build\n ssqch diff dist-before dist\n\nExits with 0 when the builds are the same, 1 when they differ, and 2 on an error."
131
+ positionals: [{ name: "BEFORE", help: "The build from before the change", required: true, path: true }, { name: "AFTER", help: "The build from after it", required: true, path: true }, { name: "MORE", help: "More builds: with three or more, which files vary between them (builds made the same way)", required: false, many: true, path: true }],
132
+ afterHelp: "Build the site into one folder before a change and another after it:\n\n ssqch build --output dist-before\n (upgrade ssqch, edit a layout, ...)\n ssqch build\n ssqch diff dist-before dist\n\nTo see whether a build is the same every time (another generator's, before a move), build it three times and compare all three:\n\n ssqch diff ref-1 ref-2 ref-3\n\nExits with 0 when the builds are the same, 1 when they differ, and 2 on an error."
133
133
  },
134
134
  {
135
135
  name: "footprint",
@@ -318,28 +318,28 @@ async function main(argv) {
318
318
  `);
319
319
  return 1;
320
320
  }
321
- if (command === "import") return (await import("./chunk-WMOVCQO6.js")).runImport(cli.positionals[0], cli.positionals[1] ?? ".", flag("write"));
321
+ if (command === "import") return (await import("./chunk-47P4YREZ.js")).runImport(cli.positionals[0], cli.positionals[1] ?? ".", flag("write"));
322
322
  switch (command) {
323
323
  case "init":
324
- return (await import("./chunk-CDEPYU7W.js")).runInit({ dir: cli.positionals[0] ?? ".", starter: value("starter") ?? "site", engine: value("engine") ?? DEFAULT_ENGINE, quiet: flag("quiet") });
324
+ return (await import("./chunk-SF4I6Z7S.js")).runInit({ dir: cli.positionals[0] ?? ".", starter: value("starter") ?? "site", engine: value("engine") ?? DEFAULT_ENGINE, quiet: flag("quiet") });
325
325
  case "capabilities":
326
- return (await import("./chunk-UGEGUUBT.js")).runCapabilities(format, CAPABILITY_ORDER);
326
+ return (await import("./chunk-LPHNACE4.js")).runCapabilities(format, CAPABILITY_ORDER);
327
327
  case "docs":
328
- return (await import("./chunk-BRK4MXXO.js")).runDocs(GRAMMAR, { query: cli.positionals, from: value("from"), format });
328
+ return (await import("./chunk-SXMJ52IK.js")).runDocs(GRAMMAR, { query: cli.positionals, from: value("from"), format });
329
329
  case "sighting":
330
- return (await import("./chunk-GOE4ZSAB.js")).runSighting(path.resolve(value("root") ?? "."));
330
+ return (await import("./chunk-XMXBHXZR.js")).runSighting(path.resolve(value("root") ?? "."));
331
331
  case "completions": {
332
332
  process.stdout.write(bundled(`completions/${cli.positionals[0]}`));
333
333
  return 0;
334
334
  }
335
335
  case "types": {
336
336
  routeConsole();
337
- return (await import("./chunk-DHHQKW4F.js")).runTypes({ root: value("root"), out: value("out") ?? "ssqch.d.ts" });
337
+ return (await import("./chunk-D2XE2GTY.js")).runTypes({ root: value("root"), out: value("out") ?? "ssqch.d.ts" });
338
338
  }
339
339
  }
340
340
  const many = (name) => Array.isArray(cli.options[name]) ? cli.options[name] : typeof cli.options[name] === "string" ? [cli.options[name]] : [];
341
341
  const top = Number(value("top") ?? "5");
342
- if (command === "diff") return runDiff(cli.positionals[0], cli.positionals[1], { exact: flag("exact"), ignore: many("ignore"), only: many("only"), lines: Number(value("lines") ?? "10"), format });
342
+ if (command === "diff") return runDiff(cli.positionals, { exact: flag("exact"), ignore: many("ignore"), only: many("only"), lines: Number(value("lines") ?? "10"), format });
343
343
  if (command === "footprint" && cli.positionals[0] !== void 0) {
344
344
  try {
345
345
  await runFootprint(cli.positionals[0], cli.positionals[0], top, format);
@@ -360,15 +360,15 @@ async function main(argv) {
360
360
  const root = path.resolve(value("root") ?? ".");
361
361
  siteRoot = root;
362
362
  routeConsole();
363
- const makeConfig = async () => (await import("./chunk-GSKVRAHF.js")).loadConfig({ root, rootGiven: value("root") ?? ".", env, serving, quiet: flag("quiet") || inspecting, verbose: flag("verbose"), output: value("output"), base: value("base") });
363
+ const makeConfig = async () => (await import("./chunk-SURPOAW7.js")).loadConfig({ root, rootGiven: value("root") ?? ".", env, serving, quiet: flag("quiet") || inspecting, verbose: flag("verbose"), output: value("output"), base: value("base") });
364
364
  if (command === "new") return newPage(makeConfig, root, { path: cli.positionals[0], title: value("title"), date: value("date"), blueprint: value("blueprint"), set: cli.options.set ?? [], format });
365
365
  if (serving) {
366
- if (building) return (await import("./chunk-VVPZ5PDP.js")).runBuilder(building, makeConfig, root);
366
+ if (building) return (await import("./chunk-NNUKIGOO.js")).runBuilder(building, makeConfig, root);
367
367
  const readyFile = value("ready-file") === void 0 ? void 0 : path.resolve(value("ready-file"));
368
368
  const options = { port: Number(value("port") ?? "8080"), readyFile, quiet: flag("quiet") };
369
369
  if (!flag("built")) {
370
370
  try {
371
- return await (await import("./chunk-HR2RU2LY.js")).serve(argv, options);
371
+ return await (await import("./chunk-CZ4XQC56.js")).serve(argv, options);
372
372
  } catch (e) {
373
373
  printError("error:", e, "build", new Locator(root));
374
374
  return 1;
@@ -382,7 +382,7 @@ async function main(argv) {
382
382
  return 1;
383
383
  }
384
384
  try {
385
- return await (await import("./chunk-HR2RU2LY.js")).serveBuilt(config2, options);
385
+ return await (await import("./chunk-CZ4XQC56.js")).serveBuilt(config2, options);
386
386
  } catch (e) {
387
387
  printError("error:", e, "build", locatorOf(config2));
388
388
  return 1;
@@ -411,7 +411,7 @@ async function main(argv) {
411
411
  await runFootprint(shownDir(config, config.output), shownOutput(config), top, format);
412
412
  return 0;
413
413
  }
414
- const [{ build }, { summary }] = await Promise.all([import("./chunk-FYGE634X.js"), import("./chunk-HXCLCXRT.js")]);
414
+ const [{ build }, { summary }] = await Promise.all([import("./chunk-IJWHOFRP.js"), import("./chunk-HXCLCXRT.js")]);
415
415
  const report = await build(config);
416
416
  if (!config.quiet) process.stdout.write(summary(config, report));
417
417
  return 0;
@@ -429,7 +429,7 @@ async function newPage(makeConfig, root, command) {
429
429
  return 1;
430
430
  }
431
431
  try {
432
- (await import("./chunk-YSH2NMIE.js")).runNew(config, command);
432
+ (await import("./chunk-BEGC7YP6.js")).runNew(config, command);
433
433
  return 0;
434
434
  } catch (e) {
435
435
  printError("error:", e, "build", locatorOf(config));
@@ -441,7 +441,7 @@ var checkFormat = (format) => {
441
441
  };
442
442
  async function runInspect(config, target, name, format) {
443
443
  checkFormat(format);
444
- const { field, fieldText, inspect, inspectionJson, inspectionText } = await import("./chunk-JSPSMIJ2.js");
444
+ const { field, fieldText, inspect, inspectionJson, inspectionText } = await import("./chunk-7RDRZHJD.js");
445
445
  let report;
446
446
  try {
447
447
  report = await inspect(config, target);
@@ -457,10 +457,11 @@ async function runInspect(config, target, name, format) {
457
457
  if (format === "json") process.stdout.write(prettyJson(inspectionJson(report, one)) + "\n");
458
458
  else process.stdout.write(one ? fieldText(one) : inspectionText(report));
459
459
  }
460
- async function runDiff(before, after, options) {
460
+ async function runDiff(dirs, options) {
461
+ const [before, after] = dirs;
461
462
  try {
462
463
  checkFormat(options.format);
463
- const [{ rustRegExp }, { globProblem, globToRegExp }, { compare, diffJson, diffText, isSame }] = await Promise.all([import("./chunk-IAFM5ITE.js"), import("./chunk-EZZUUPI4.js"), import("./chunk-TWCVHOKO.js")]);
464
+ const [{ rustRegExp }, { globProblem, globToRegExp }, { compare, compareRuns, diffJson, diffText, isSame, runsJson, runsText }] = await Promise.all([import("./chunk-IAFM5ITE.js"), import("./chunk-TICWN55Z.js"), import("./chunk-7PWCYHTJ.js")]);
464
465
  const ignore = options.ignore.map((pattern) => {
465
466
  try {
466
467
  return rustRegExp(pattern, "g");
@@ -474,6 +475,12 @@ async function runDiff(before, after, options) {
474
475
  if (problem !== void 0) bail(`--only ${quoted(given)} isn't a glob: error parsing glob '${glob}': ${problem}`);
475
476
  return globToRegExp(glob);
476
477
  }) : void 0;
478
+ if (dirs.length > 2) {
479
+ const runs = await compareRuns(dirs, { exact: options.exact, ignore, only, lines: options.lines });
480
+ if (options.format === "json") process.stdout.write(JSON.stringify(runsJson(runs, options.lines), null, 2) + "\n");
481
+ else process.stdout.write(runsText(runs, options.lines, process.stdout.isTTY === true));
482
+ return runs.varies.length ? 1 : 0;
483
+ }
477
484
  const report = await compare(before, after, { exact: options.exact, ignore, only, lines: options.lines });
478
485
  if (options.format === "json") process.stdout.write(JSON.stringify(diffJson(report, options.lines), null, 2) + "\n");
479
486
  else process.stdout.write(diffText(report, options.lines, process.stdout.isTTY === true));
@@ -486,7 +493,7 @@ async function runDiff(before, after, options) {
486
493
  }
487
494
  async function runFootprint(dir, shown, top, format) {
488
495
  checkFormat(format);
489
- const { footprintJson, footprintText, measure } = await import("./chunk-37KSIVNY.js");
496
+ const { footprintJson, footprintText, measure } = await import("./chunk-RNJFPFXE.js");
490
497
  const measured = await measure(dir);
491
498
  if (format === "json") process.stdout.write(JSON.stringify(footprintJson(measured, shown, top), null, 2) + "\n");
492
499
  else process.stdout.write(footprintText(measured, shown, top));
@@ -510,7 +517,7 @@ async function buildJson(makeConfig, root, env) {
510
517
  const dirs = dirsOf(config);
511
518
  out.output = shownOutput(config);
512
519
  try {
513
- const report = await (await import("./chunk-FYGE634X.js")).build(config);
520
+ const report = await (await import("./chunk-IJWHOFRP.js")).build(config);
514
521
  out.durationMs = ms(report.durationMs);
515
522
  out.pages = { written: report.pagesWritten, templates: report.templates, bytes: report.pageBytes, new: report.pagesNew ?? null, gone: report.pagesGone ?? null };
516
523
  out.copied = { files: report.filesCopied, unchanged: report.filesUnchanged, bytes: report.passthroughBytes };
package/lib/elements.js CHANGED
@@ -2,29 +2,29 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-JRT7TQQP.js";
5
+ } from "./chunk-7SD7K567.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  rewriteHtml,
10
10
  withBase
11
- } from "./chunk-TN6EEDX2.js";
12
- import "./chunk-IRHRK7XB.js";
11
+ } from "./chunk-R7K3D5W5.js";
12
+ import "./chunk-7XLK2GEG.js";
13
13
  import {
14
14
  count
15
15
  } from "./chunk-NKXEPHRZ.js";
16
16
  import "./chunk-AD3HAW3W.js";
17
17
  import "./chunk-DDV6JEC2.js";
18
- import "./chunk-EIT4ZDT4.js";
18
+ import "./chunk-NCWFYT74.js";
19
19
  import "./chunk-FVZ5JBRI.js";
20
- import "./chunk-TDGBQNGW.js";
20
+ import "./chunk-HPXAZ2HU.js";
21
21
  import "./chunk-UU43WIZG.js";
22
- import "./chunk-C35KIPAR.js";
22
+ import "./chunk-76NTVE34.js";
23
23
  import "./chunk-CMUWRPSQ.js";
24
24
  import {
25
25
  bail,
26
26
  context
27
- } from "./chunk-6XYSFG6V.js";
27
+ } from "./chunk-GRWMGC7D.js";
28
28
  import {
29
29
  compareText,
30
30
  displayPath,
package/lib/image.js CHANGED
@@ -4,20 +4,20 @@ import {
4
4
  image,
5
5
  imagePlugin,
6
6
  imageUrl
7
- } from "./chunk-NUKCUDC4.js";
8
- import "./chunk-JRT7TQQP.js";
9
- import "./chunk-TN6EEDX2.js";
10
- import "./chunk-IRHRK7XB.js";
7
+ } from "./chunk-TVU3OPPK.js";
8
+ import "./chunk-7SD7K567.js";
9
+ import "./chunk-R7K3D5W5.js";
10
+ import "./chunk-7XLK2GEG.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-NCWFYT74.js";
15
15
  import "./chunk-FVZ5JBRI.js";
16
- import "./chunk-TDGBQNGW.js";
16
+ import "./chunk-HPXAZ2HU.js";
17
17
  import "./chunk-UU43WIZG.js";
18
- import "./chunk-C35KIPAR.js";
18
+ import "./chunk-76NTVE34.js";
19
19
  import "./chunk-CMUWRPSQ.js";
20
- import "./chunk-6XYSFG6V.js";
20
+ import "./chunk-GRWMGC7D.js";
21
21
  import "./chunk-VJWQSYEG.js";
22
22
  import "./chunk-I3PS26CI.js";
23
23
  export {
package/lib/links.js CHANGED
@@ -2,12 +2,12 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-JRT7TQQP.js";
5
+ } from "./chunk-7SD7K567.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  rewriteHtml
9
- } from "./chunk-TN6EEDX2.js";
10
- import "./chunk-IRHRK7XB.js";
9
+ } from "./chunk-R7K3D5W5.js";
10
+ import "./chunk-7XLK2GEG.js";
11
11
  import {
12
12
  count
13
13
  } from "./chunk-NKXEPHRZ.js";
@@ -15,16 +15,16 @@ import "./chunk-AD3HAW3W.js";
15
15
  import {
16
16
  dirsOf
17
17
  } from "./chunk-DDV6JEC2.js";
18
- import "./chunk-EIT4ZDT4.js";
18
+ import "./chunk-NCWFYT74.js";
19
19
  import {
20
20
  closest,
21
21
  closestPathFinder
22
22
  } from "./chunk-FVZ5JBRI.js";
23
- import "./chunk-TDGBQNGW.js";
23
+ import "./chunk-HPXAZ2HU.js";
24
24
  import {
25
25
  TRAIL_GOES_COLD
26
26
  } from "./chunk-UU43WIZG.js";
27
- import "./chunk-C35KIPAR.js";
27
+ import "./chunk-76NTVE34.js";
28
28
  import "./chunk-CMUWRPSQ.js";
29
29
  import {
30
30
  Diagnostics,
@@ -33,7 +33,7 @@ import {
33
33
  isCapturing,
34
34
  warn,
35
35
  warning
36
- } from "./chunk-6XYSFG6V.js";
36
+ } from "./chunk-GRWMGC7D.js";
37
37
  import {
38
38
  compareText
39
39
  } from "./chunk-VJWQSYEG.js";
package/lib/minify.js CHANGED
@@ -2,27 +2,27 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-JRT7TQQP.js";
5
+ } from "./chunk-7SD7K567.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  RustPlugin,
9
9
  compilePlugin
10
- } from "./chunk-TN6EEDX2.js";
11
- import "./chunk-IRHRK7XB.js";
10
+ } from "./chunk-R7K3D5W5.js";
11
+ import "./chunk-7XLK2GEG.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-NCWFYT74.js";
16
16
  import {
17
17
  closest
18
18
  } from "./chunk-FVZ5JBRI.js";
19
- import "./chunk-TDGBQNGW.js";
19
+ import "./chunk-HPXAZ2HU.js";
20
20
  import "./chunk-UU43WIZG.js";
21
- import "./chunk-C35KIPAR.js";
21
+ import "./chunk-76NTVE34.js";
22
22
  import "./chunk-CMUWRPSQ.js";
23
23
  import {
24
24
  BuildError
25
- } from "./chunk-6XYSFG6V.js";
25
+ } from "./chunk-GRWMGC7D.js";
26
26
  import "./chunk-VJWQSYEG.js";
27
27
  import "./chunk-I3PS26CI.js";
28
28
 
package/lib/redirects.js CHANGED
@@ -2,27 +2,27 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-JRT7TQQP.js";
5
+ } from "./chunk-7SD7K567.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  escapeHtml,
10
10
  withBase
11
- } from "./chunk-TN6EEDX2.js";
12
- import "./chunk-IRHRK7XB.js";
11
+ } from "./chunk-R7K3D5W5.js";
12
+ import "./chunk-7XLK2GEG.js";
13
13
  import "./chunk-NKXEPHRZ.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
15
  import "./chunk-DDV6JEC2.js";
16
- import "./chunk-EIT4ZDT4.js";
16
+ import "./chunk-NCWFYT74.js";
17
17
  import "./chunk-FVZ5JBRI.js";
18
- import "./chunk-TDGBQNGW.js";
18
+ import "./chunk-HPXAZ2HU.js";
19
19
  import "./chunk-UU43WIZG.js";
20
- import "./chunk-C35KIPAR.js";
20
+ import "./chunk-76NTVE34.js";
21
21
  import "./chunk-CMUWRPSQ.js";
22
22
  import {
23
23
  bail,
24
24
  context
25
- } from "./chunk-6XYSFG6V.js";
25
+ } from "./chunk-GRWMGC7D.js";
26
26
  import {
27
27
  compareText,
28
28
  displayPath,
package/lib/rss.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
  feedImages
5
- } from "./chunk-NUKCUDC4.js";
5
+ } from "./chunk-TVU3OPPK.js";
6
6
  import {
7
7
  Options
8
- } from "./chunk-JRT7TQQP.js";
8
+ } from "./chunk-7SD7K567.js";
9
9
  import {
10
10
  BUILTINS,
11
11
  rewriteHtml
12
- } from "./chunk-TN6EEDX2.js";
13
- import "./chunk-IRHRK7XB.js";
12
+ } from "./chunk-R7K3D5W5.js";
13
+ import "./chunk-7XLK2GEG.js";
14
14
  import "./chunk-NKXEPHRZ.js";
15
15
  import "./chunk-AD3HAW3W.js";
16
16
  import "./chunk-DDV6JEC2.js";
17
- import "./chunk-EIT4ZDT4.js";
17
+ import "./chunk-NCWFYT74.js";
18
18
  import "./chunk-FVZ5JBRI.js";
19
- import "./chunk-TDGBQNGW.js";
19
+ import "./chunk-HPXAZ2HU.js";
20
20
  import "./chunk-UU43WIZG.js";
21
- import "./chunk-C35KIPAR.js";
21
+ import "./chunk-76NTVE34.js";
22
22
  import "./chunk-CMUWRPSQ.js";
23
23
  import {
24
24
  bail,
25
25
  toDate
26
- } from "./chunk-6XYSFG6V.js";
26
+ } from "./chunk-GRWMGC7D.js";
27
27
  import "./chunk-VJWQSYEG.js";
28
28
  import "./chunk-I3PS26CI.js";
29
29
 
package/lib/sass.js CHANGED
@@ -5,30 +5,30 @@ import {
5
5
  } from "./chunk-3NYSSA2C.js";
6
6
  import {
7
7
  Options
8
- } from "./chunk-JRT7TQQP.js";
8
+ } from "./chunk-7SD7K567.js";
9
9
  import {
10
10
  BUILTINS,
11
11
  cssWithBase,
12
12
  debugString,
13
13
  wasi
14
- } from "./chunk-TN6EEDX2.js";
15
- import "./chunk-IRHRK7XB.js";
14
+ } from "./chunk-R7K3D5W5.js";
15
+ import "./chunk-7XLK2GEG.js";
16
16
  import "./chunk-NKXEPHRZ.js";
17
17
  import "./chunk-AD3HAW3W.js";
18
18
  import "./chunk-DDV6JEC2.js";
19
19
  import {
20
20
  WebAssembly
21
- } from "./chunk-EIT4ZDT4.js";
21
+ } from "./chunk-NCWFYT74.js";
22
22
  import "./chunk-FVZ5JBRI.js";
23
- import "./chunk-TDGBQNGW.js";
23
+ import "./chunk-HPXAZ2HU.js";
24
24
  import "./chunk-UU43WIZG.js";
25
- import "./chunk-C35KIPAR.js";
25
+ import "./chunk-76NTVE34.js";
26
26
  import "./chunk-CMUWRPSQ.js";
27
27
  import {
28
28
  BuildError,
29
29
  bail,
30
30
  messageOf
31
- } from "./chunk-6XYSFG6V.js";
31
+ } from "./chunk-GRWMGC7D.js";
32
32
  import {
33
33
  comparePaths,
34
34
  displayPath,
@@ -97,7 +97,7 @@ BUILTINS.set("ssqch/sass", (config, given) => {
97
97
  config.fileBuilders.push(["ssqch/sass", (config2) => {
98
98
  const chosen = style ?? (config2.env === "production" && !config2.serving ? "compressed" : "expanded");
99
99
  const used = startReading(config2, "ssqch/sass");
100
- const compiler = new Compiler(config2.root, used);
100
+ const compiler = new Compiler(config2.root, used, loadPaths.map((dir) => path.resolve(config2.root, dir)));
101
101
  const options = JSON.stringify({ style: chosen, loadPaths: loadPaths.map((dir) => compiler.name(path.resolve(config2.root, dir))) });
102
102
  const out = [];
103
103
  for (const [from, to] of files) {
@@ -119,9 +119,44 @@ var active;
119
119
  var Compiler = class {
120
120
  root;
121
121
  used;
122
- constructor(root, used) {
122
+ loadPaths;
123
+ constructor(root, used, loadPaths = []) {
123
124
  this.root = root;
124
125
  this.used = used;
126
+ this.loadPaths = loadPaths;
127
+ }
128
+ /**
129
+ * A stylesheet as grass should read it. Two things other compilers take that grass doesn't:
130
+ *
131
+ * - Front matter (Jekyll's `---` lines at the top of a site's main stylesheet) becomes blank
132
+ * lines, so error lines still match the file. Sass can't start with `---`, so nothing that
133
+ * compiled before reads differently.
134
+ * - An `@import`, `@use` or `@forward` that names its extension (`"primer-core/index.scss"`)
135
+ * is found in the load paths too: grass 0.13 looks for one only beside the importing file
136
+ * (`find_import`, "todo: consider load paths"), and Dart Sass and Ruby Sass look in both.
137
+ * Where the file isn't beside the importer but is in a load path, the import names it from
138
+ * the importer's folder. primer's packages all import this way (opensource.guide, osg #10).
139
+ */
140
+ source(file, data) {
141
+ if (!isSass(file)) return data;
142
+ let text = data.toString("utf8");
143
+ const front = /^---[ \t]*\r?\n(?:[\s\S]*?\r?\n)?---[ \t]*(?:\r?\n|$)/.exec(text);
144
+ if (front) text = front[0].replace(/[^\n]/g, "") + text.slice(front[0].length);
145
+ const dir = path.dirname(file);
146
+ const exists = (base, name) => {
147
+ const full = path.resolve(base, name);
148
+ const partial = path.join(path.dirname(full), `_${path.basename(full)}`);
149
+ return fs.existsSync(full) ? full : fs.existsSync(partial) ? partial : void 0;
150
+ };
151
+ const changed = text.replace(/@(import|use|forward)(\s+)([^;{}]+)/g, (statement, rule, space, rest) => `@${rule}${space}${rest.replace(/(["'])([^"'\n]+\.s[ac]ss)\1/g, (quoted, q, name) => {
152
+ if (path.isAbsolute(name) || /^[a-z]+:/i.test(name) || exists(dir, name)) return quoted;
153
+ for (const load of this.loadPaths) {
154
+ const found = exists(load, name);
155
+ if (found) return `${q}${slashes(path.relative(dir, path.join(path.dirname(found), path.basename(name))))}${q}`;
156
+ }
157
+ return quoted;
158
+ })}`);
159
+ return front || changed !== text ? Buffer.from(changed, "utf8") : data;
125
160
  }
126
161
  /** A path as grass sees it: from the root for the site's own files, else whole; with `/`. */
127
162
  name(file) {
@@ -196,7 +231,7 @@ function instance() {
196
231
  read: (ptr, len, out) => {
197
232
  const file = active.file(text(ptr, len));
198
233
  try {
199
- const data = fs.readFileSync(file);
234
+ const data = active.source(file, fs.readFileSync(file));
200
235
  active.used.add(realPath(file));
201
236
  return reply(out, 0, data);
202
237
  } catch (e) {
package/lib/sitemap.js CHANGED
@@ -2,29 +2,29 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-JRT7TQQP.js";
5
+ } from "./chunk-7SD7K567.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  escapeHtml,
10
10
  isoDay
11
- } from "./chunk-TN6EEDX2.js";
12
- import "./chunk-IRHRK7XB.js";
11
+ } from "./chunk-R7K3D5W5.js";
12
+ import "./chunk-7XLK2GEG.js";
13
13
  import "./chunk-NKXEPHRZ.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
15
  import "./chunk-DDV6JEC2.js";
16
- import "./chunk-EIT4ZDT4.js";
16
+ import "./chunk-NCWFYT74.js";
17
17
  import "./chunk-FVZ5JBRI.js";
18
18
  import {
19
19
  globSet
20
- } from "./chunk-TDGBQNGW.js";
20
+ } from "./chunk-HPXAZ2HU.js";
21
21
  import "./chunk-UU43WIZG.js";
22
- import "./chunk-C35KIPAR.js";
22
+ import "./chunk-76NTVE34.js";
23
23
  import "./chunk-CMUWRPSQ.js";
24
24
  import {
25
25
  bail,
26
26
  toDate
27
- } from "./chunk-6XYSFG6V.js";
27
+ } from "./chunk-GRWMGC7D.js";
28
28
  import {
29
29
  compareText
30
30
  } from "./chunk-VJWQSYEG.js";
@@ -42,7 +42,9 @@ function isLaterPage(data) {
42
42
  return number > 0 && size > 1;
43
43
  }
44
44
  BUILTINS.set("ssqch/sitemap", (config, given) => {
45
- const o = new Options(given, ["url", "exclude", "lastmod", "output", "paginated"]);
45
+ const o = new Options(given, ["url", "exclude", "lastmod", "output", "paginated", "alternates"]);
46
+ const alternates = o.get("alternates");
47
+ 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})`);
46
48
  const url = o.string("url");
47
49
  if (url === void 0) bail(`url is required: the site's address, like "https://example.com"`);
48
50
  const exclude = o.list("exclude") ?? [];
@@ -60,20 +62,43 @@ BUILTINS.set("ssqch/sitemap", (config, given) => {
60
62
  const trimmed = url.replace(/\/+$/, "");
61
63
  const withBase = trimmed.endsWith(config2.base) ? trimmed : trimmed + config2.base;
62
64
  const entries = [];
65
+ const absolute = (href) => href.startsWith("/") ? withBase + href : href;
66
+ const linksOf = (p) => {
67
+ if (!alternates) return [];
68
+ let out;
69
+ try {
70
+ out = alternates(p);
71
+ } catch (e) {
72
+ bail(`alternates(), for ${p.url}: ${e instanceof Error ? e.message : String(e)}`);
73
+ }
74
+ if (out === void 0 || out === null) return [];
75
+ if (out instanceof Promise) bail("alternates() answered with a promise; it has to answer at once (work the translations out in data or a collection first)");
76
+ if (!Array.isArray(out)) bail(`alternates(), for ${p.url}: expected a list of { hreflang, href } (got ${typeof out})`);
77
+ return out.map((a) => {
78
+ const { hreflang, href } = a ?? {};
79
+ if (typeof hreflang !== "string" || hreflang === "" || typeof href !== "string" || !(href.startsWith("/") || /^https?:\/\//.test(href))) bail(`alternates(), for ${p.url}: each one is { hreflang: "fr", href: "/fr/page/" } (an href from the site's root, or a whole address), got ${JSON.stringify(a) ?? String(a)}`);
80
+ return [hreflang, absolute(href)];
81
+ });
82
+ };
63
83
  for (const p of pages) {
64
84
  if (path.extname(p.outputPath) !== ".html") continue;
65
85
  if (p.data.sitemap === false) continue;
66
86
  if (!paginated && isLaterPage(p.data)) continue;
67
87
  if (p.url === "/404.html" || p.url === "/404/") continue;
68
88
  if (excluded(p.url)) continue;
69
- entries.push([p.url, isoDay(toDate(p.data.page?.lastModified) ?? p.date)]);
89
+ entries.push([p.url, isoDay(toDate(p.data.page?.lastModified) ?? p.date), linksOf(p)]);
70
90
  }
71
91
  entries.sort((a, b) => compareText(a[0], b[0]) || compareText(a[1], b[1]));
72
92
  const loc = escapeHtml(withBase);
73
- let xml = '<?xml version="1.0" encoding="utf-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n';
74
- for (const [pageUrl, date] of entries) {
93
+ const xhtml = entries.some((e) => e[2].length) ? ' xmlns:xhtml="http://www.w3.org/1999/xhtml"' : "";
94
+ let xml = `<?xml version="1.0" encoding="utf-8"?>
95
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"${xhtml}>
96
+ `;
97
+ for (const [pageUrl, date, links] of entries) {
75
98
  xml += ` <url>
76
99
  <loc>${loc}${escapeHtml(pageUrl)}</loc>
100
+ `;
101
+ for (const [hreflang, href] of links) xml += ` <xhtml:link rel="alternate" hreflang="${escapeHtml(hreflang)}" href="${escapeHtml(href)}"/>
77
102
  `;
78
103
  if (lastmod) xml += ` <lastmod>${date}</lastmod>
79
104
  `;