ssqch 0.10.1 → 0.11.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 (93) hide show
  1. package/bundled/completions/bash +61 -15
  2. package/bundled/completions/elvish +27 -12
  3. package/bundled/completions/fish +35 -23
  4. package/bundled/completions/powershell +29 -12
  5. package/bundled/completions/zsh +39 -19
  6. package/bundled/docs/agents.md +11 -0
  7. package/bundled/docs/comparing-builds.md +37 -5
  8. package/bundled/docs/configuring.md +30 -5
  9. package/bundled/docs/field-guide.md +1 -1
  10. package/bundled/docs/github-pages.md +1 -1
  11. package/bundled/docs/index.md +1 -1
  12. package/bundled/docs/known-gaps.md +1 -1
  13. package/bundled/docs/markdown.md +63 -5
  14. package/bundled/docs/multilingual.md +20 -3
  15. package/bundled/docs/nav.yml +1 -0
  16. package/bundled/docs/netlify.md +2 -2
  17. package/bundled/docs/plugins.md +4 -4
  18. package/bundled/docs/seo.md +39 -1
  19. package/bundled/docs/template-languages.md +6 -4
  20. package/bundled/docs/templates.md +3 -3
  21. package/bundled/docs/trailheads/from-eleventy.md +25 -13
  22. package/bundled/docs/trailheads/from-hugo.md +103 -0
  23. package/bundled/docs/trailheads/from-jekyll.md +49 -15
  24. package/bundled/docs/trailheads/from-mkdocs.md +54 -9
  25. package/bundled/docs/trailheads/from-zola.md +2 -2
  26. package/bundled/docs/trailheads.md +22 -5
  27. package/bundled/docs/where-values-come-from.md +1 -1
  28. package/bundled/mkdocs/404.jinja +6 -0
  29. package/bundled/ssqch.d.ts +71 -16
  30. package/lib/assets.js +10 -9
  31. package/lib/{chunk-MUYWL4ZX.js → chunk-2L3HR67O.js} +71 -18
  32. package/lib/{chunk-ERNVEZOK.js → chunk-2QTJTEBV.js} +1 -1
  33. package/lib/{chunk-CXRHH5P5.js → chunk-3HZZY3Y7.js} +5 -5
  34. package/lib/{chunk-G67W2FTJ.js → chunk-3K237XAX.js} +9 -8
  35. package/lib/{chunk-6RSZV5O2.js → chunk-443ZQLVX.js} +3 -3
  36. package/lib/{chunk-ZZBHBLDB.js → chunk-5ELAUHRL.js} +18 -16
  37. package/lib/{chunk-MDG5A4NI.js → chunk-A75EVUJX.js} +5 -5
  38. package/lib/{chunk-JFPLNHEQ.js → chunk-AIMEXBTK.js} +28 -5
  39. package/lib/{chunk-6OUT5VFK.js → chunk-B5E27PLU.js} +10 -39
  40. package/lib/{chunk-R2YGC3VE.js → chunk-CMJ7X5WW.js} +3 -2
  41. package/lib/{chunk-MDB3D3LP.js → chunk-ERAIEV3O.js} +2 -2
  42. package/lib/{chunk-DTSTCVRX.js → chunk-FCM3NYFR.js} +11 -8
  43. package/lib/{chunk-X7C6GFUM.js → chunk-GJNIQAIH.js} +8 -8
  44. package/lib/{chunk-FYRC2HBU.js → chunk-GLJQ4C76.js} +39 -18
  45. package/lib/{chunk-BXARVN5Z.js → chunk-GS5B3CBW.js} +1 -1
  46. package/lib/chunk-H5K2ZE7B.js +219 -0
  47. package/lib/{chunk-DNWA7WNO.js → chunk-HFSWUTXX.js} +1 -1
  48. package/lib/{chunk-7JGYYAKI.js → chunk-HWW5NCVJ.js} +1 -1
  49. package/lib/{chunk-BT3NVQOD.js → chunk-I3HYKEEW.js} +1 -1
  50. package/lib/{chunk-RFNLZM7W.js → chunk-IOBC665M.js} +1 -1
  51. package/lib/chunk-JC54PHIT.js +7992 -0
  52. package/lib/{chunk-3BQJY6GF.js → chunk-KCF2Z6N7.js} +1 -1
  53. package/lib/{chunk-HMVYNV6M.js → chunk-KZZS4W2V.js} +14 -12
  54. package/lib/{chunk-XR7GFL4B.js → chunk-LJOURBYT.js} +14 -12
  55. package/lib/chunk-OQGXZYZS.js +45 -0
  56. package/lib/chunk-OSBEH67S.js +6296 -0
  57. package/lib/{chunk-FYU22VDK.js → chunk-QJ5ZFTML.js} +14 -12
  58. package/lib/{chunk-LU73FTIR.js → chunk-QLUTNR37.js} +11 -10
  59. package/lib/{chunk-DUGGZ4EE.js → chunk-RBNPBTDP.js} +1 -1
  60. package/lib/{chunk-F65YUXZ7.js → chunk-RIAOXEXC.js} +10 -4
  61. package/lib/chunk-RVXGUMFI.js +21 -0
  62. package/lib/{chunk-FZGJUJAL.js → chunk-RYIWYWRQ.js} +3 -3
  63. package/lib/{chunk-LYPKL524.js → chunk-RZYAIX2R.js} +12 -10
  64. package/lib/{chunk-3NDFUMV2.js → chunk-V2FSMOFX.js} +3 -3
  65. package/lib/{chunk-26SHWRC6.js → chunk-X2GAVYV2.js} +524 -72
  66. package/lib/chunk-XS4EJSEK.js +279 -0
  67. package/lib/chunk-YCOTX2VM.js +37 -0
  68. package/lib/{chunk-P2TRR6XK.js → chunk-Z44IAMNG.js} +85 -16
  69. package/lib/chunk-Z5OP43HU.js +2945 -0
  70. package/lib/{chunk-3LODFCCH.js → chunk-ZINLHOX4.js} +2 -2
  71. package/lib/{chunk-HNG372DW.js → chunk-ZR3JYLFB.js} +814 -12347
  72. package/lib/cli.js +78 -37
  73. package/lib/elements.js +10 -9
  74. package/lib/image.js +11 -10
  75. package/lib/links.js +10 -9
  76. package/lib/minify.js +71 -12
  77. package/lib/redirects.js +10 -9
  78. package/lib/rss.js +13 -10
  79. package/lib/sass.js +13 -243
  80. package/lib/sitemap.js +18 -15
  81. package/lib/ssqch.js +6 -4
  82. package/package.json +1 -1
  83. package/types/index.d.ts +52 -11
  84. package/types/minify.d.ts +15 -3
  85. package/types/sass.d.ts +2 -0
  86. package/types/sitemap.d.ts +2 -2
  87. package/wasm/markdown.wasm +0 -0
  88. package/wasm/minify.wasm +0 -0
  89. package/wasm/sass.wasm +0 -0
  90. package/lib/chunk-II7ZRIAC.js +0 -1285
  91. package/lib/chunk-IOXCGMSF.js +0 -1539
  92. /package/lib/{chunk-JFPLNHEQ.js.LEGAL.txt → chunk-AIMEXBTK.js.LEGAL.txt} +0 -0
  93. /package/lib/{chunk-HNG372DW.js.LEGAL.txt → chunk-ZR3JYLFB.js.LEGAL.txt} +0 -0
package/lib/cli.js CHANGED
@@ -2,28 +2,30 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  BUILDER
5
- } from "./chunk-BT3NVQOD.js";
5
+ } from "./chunk-I3HYKEEW.js";
6
6
  import {
7
7
  Printed,
8
8
  UsageError,
9
9
  parse
10
- } from "./chunk-F65YUXZ7.js";
10
+ } from "./chunk-RIAOXEXC.js";
11
11
  import {
12
- DEFAULT_ENGINE,
13
- bundled
14
- } from "./chunk-6OUT5VFK.js";
12
+ DEFAULT_ENGINE
13
+ } from "./chunk-B5E27PLU.js";
15
14
  import {
16
15
  VERSION
17
16
  } from "./chunk-AD3HAW3W.js";
17
+ import {
18
+ bundled
19
+ } from "./chunk-YCOTX2VM.js";
18
20
  import {
19
21
  dirsOf,
20
22
  parseEnvironment,
21
23
  shownDir,
22
24
  shownOutput
23
- } from "./chunk-BXARVN5Z.js";
25
+ } from "./chunk-GS5B3CBW.js";
24
26
  import {
25
27
  describeThrown
26
- } from "./chunk-RFNLZM7W.js";
28
+ } from "./chunk-IOBC665M.js";
27
29
  import {
28
30
  prettyJson,
29
31
  quoted
@@ -49,7 +51,7 @@ import {
49
51
  toJson2,
50
52
  warn,
51
53
  warning
52
- } from "./chunk-JFPLNHEQ.js";
54
+ } from "./chunk-AIMEXBTK.js";
53
55
  import "./chunk-I3PS26CI.js";
54
56
 
55
57
  // src/cli.ts
@@ -118,11 +120,14 @@ var COMMANDS = [
118
120
  },
119
121
  {
120
122
  name: "diff",
123
+ helpGlobals: ["quiet"],
121
124
  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",
122
125
  options: [
123
126
  { long: "exact", help: "Compare bytes: don't match fingerprinted files or ignore whitespace" },
127
+ { long: "ungrouped", help: "List each file with all its changes, without grouping the ones shared by several files" },
124
128
  { long: "ignore", value: "REGEX", help: "Leave out text matching this regular expression before comparing (repeatable)", many: true },
125
129
  { long: "only", value: "GLOB", help: "Only compare files matching this glob, like '**/*.html' (repeatable)", many: true },
130
+ { long: "exclude", value: "GLOB", help: "Leave out files matching this glob, like 'img/**' (repeatable)", many: true },
126
131
  { long: "lines", value: "LINES", help: "Changed lines to show for each file (0 for all)", default: "10", check: number },
127
132
  FORMAT
128
133
  ],
@@ -148,11 +153,44 @@ var COMMANDS = [
148
153
  },
149
154
  { name: "types", about: "Write ssqch.d.ts, the types editors use for ssqch.config.js", options: [{ long: "out", value: "out", help: "Where to write it", default: "ssqch.d.ts" }], positionals: [], own: true },
150
155
  {
151
- name: "import",
152
- about: "Move a site from another generator: rename and rewrite what's mechanical, and list the rest",
153
- options: [{ long: "write", help: "Make the changes (without it, only list them)" }],
154
- positionals: [{ name: "generator", help: "The generator the site is built with: eleventy or zola", required: true }, { name: "dir", help: "The site's folder (default: the current folder)", required: false, default: "." }],
155
- afterHelp: "Run it in a clean git checkout, read the list, then run it again with --write. `ssqch docs --from <generator>` prints the trailhead for each generator.",
156
+ name: "scout",
157
+ helpGlobals: [],
158
+ strictGlobals: true,
159
+ about: "Scout a site built with another generator: what moving it to ssqch takes, with file and line, and what's left during a move. Changes nothing unless asked",
160
+ options: [
161
+ { long: "from", value: "GENERATOR", help: "The generator the site is built with, when it isn't the one scout finds: eleventy, jekyll, zola, hugo, mkdocs, docusaurus, astro, vitepress or hexo" },
162
+ FORMAT,
163
+ { long: "write-draft", help: "Write the draft's new files (a config draft, directory data, includes, hooks); never overwrites a file" },
164
+ { long: "patch", value: "FILE", help: "Write the mechanical edits (renames, a data file's name, an attribute) to FILE as a patch to review; nothing is applied" },
165
+ { long: "compare", help: "Also build with ssqch and compare the output with the reference build, listing the biggest groups of differences: what to fix next" },
166
+ { long: "reference", value: "DIR", help: "The reference build --compare compares with (default: ssqch baseline's, .cache/ssqch/baseline/ref-common or ref-1)" }
167
+ ],
168
+ positionals: [{ name: "dir", help: "The site's folder (default: the current folder)", required: false, default: "." }],
169
+ afterHelp: "Run it before a move, and again during one to see what's left. `ssqch docs \"scouting a site\"` explains the report and its JSON, and `ssqch docs --from <generator>` prints each generator's trailhead.",
170
+ own: true
171
+ },
172
+ {
173
+ name: "baseline",
174
+ helpGlobals: ["root", "quiet"],
175
+ strictGlobals: true,
176
+ insteadOf: { output: "to" },
177
+ about: "Build the site with its old generator, in fresh copies with the clock pinned, and compare the builds: what to compare ssqch's with",
178
+ options: [
179
+ { long: "from", value: "DIR", help: "The folder the command writes (Eleventy and Jekyll: _site; Hugo: public; Astro: dist)", default: "_site" },
180
+ { long: "runs", value: "RUNS", help: "How many builds to make and compare", default: "3", check: number },
181
+ { long: "commit", value: "REV", help: "Build this commit instead of the working tree (the one before the move's first change)" },
182
+ { long: "to", value: "NAME", help: "Where the builds go: the default makes .cache/ssqch/baseline/ref-1, -2 and -3", default: ".cache/ssqch/baseline/ref" },
183
+ { long: "link", value: "PATH", help: "Link this folder of the site into each copy, as node_modules, .bundle and vendor/bundle are (repeatable)", many: true },
184
+ { long: "patch", value: "FILE", help: "Apply this patch (git diff's) to each copy before building: a fix the --commit needs to build" },
185
+ { long: "copy-installs", help: "Copy node_modules and the other installs into each copy instead of linking them, for a tool that won't follow a link out of its folder (Hugo's are copied without it)" }
186
+ ],
187
+ positionals: [{ name: "COMMAND", help: `The old generator's build command, quoted: "npx @11ty/eleventy"`, required: true, many: true }],
188
+ afterHelp: `Each build runs in a fresh copy of the site (the files git would commit, or the --commit), with TZ=UTC, SOURCE_DATE_EPOCH and every file's time set to the commit's, and node_modules linked in. Then the builds are compared as \`ssqch diff ref-1 ref-2 ref-3\` compares them, so what changes by itself is known before anything is compared with ssqch's build.
189
+
190
+ ssqch baseline "npx @11ty/eleventy"
191
+ ssqch baseline "bundle exec jekyll build" --commit main
192
+ ssqch baseline "npx @11ty/eleventy" --commit HEAD~3 --patch fix-build.patch
193
+ ssqch diff ref-1 dist`,
156
194
  own: true
157
195
  },
158
196
  { name: "capabilities", about: "Say what this binary supports: template languages, modules, config options and optional features", options: [FORMAT], positionals: [], own: true },
@@ -185,7 +223,7 @@ var CAPABILITY_ORDER = (() => {
185
223
  return names;
186
224
  })();
187
225
  var GRAMMAR = { name: "ssqch", about: "SiteSquatch (ssqch): a fast, pluggable static site generator", version: VERSION, globals: GLOBALS, commands: COMMANDS };
188
- var VALUED = ["--root", "--output", "-o", "--base", "--env", "-d", "--destination", "--pathprefix", "--port", "-p", "--ready-file", "--format", "--title", "--date", "--blueprint", "--set", "--field", "--ignore", "--only", "--lines", "--top", "--starter", "--engine"];
226
+ var VALUED = ["--root", "--output", "-o", "--base", "--env", "-d", "--destination", "--pathprefix", "--port", "-p", "--ready-file", "--format", "--title", "--date", "--blueprint", "--set", "--field", "--ignore", "--only", "--exclude", "--lines", "--top", "--starter", "--engine"];
189
227
  var OWN = COMMANDS.filter((c) => c.raw || c.own).map((c) => c.name);
190
228
  function aliased(given, own = OWN) {
191
229
  const args = [...given];
@@ -316,28 +354,29 @@ async function main(argv) {
316
354
  `);
317
355
  return 1;
318
356
  }
319
- if (command === "import") return (await import("./chunk-II7ZRIAC.js")).runImport(cli.positionals[0], cli.positionals[1] ?? ".", flag("write"));
357
+ if (command === "baseline") return (await import("./chunk-RVXGUMFI.js")).runBaseline({ root: value("root") ?? ".", command: cli.positionals.join(" "), from: value("from") ?? "_site", runs: Number(value("runs") ?? "3"), commit: value("commit"), to: value("to") ?? ".cache/ssqch/baseline/ref", link: [cli.options.link ?? []].flat(), patch: value("patch"), copyInstalls: flag("copy-installs"), quiet: flag("quiet") });
358
+ if (command === "scout") return (await import("./chunk-Z5OP43HU.js")).runScout(cli.positionals[0] ?? ".", { from: value("from"), format: value("format") === "json" ? "json" : "text", writeDraft: flag("write-draft"), patch: value("patch"), compare: flag("compare") ? value("reference") ?? "" : void 0 });
320
359
  switch (command) {
321
360
  case "init":
322
- return (await import("./chunk-R2YGC3VE.js")).runInit({ dir: cli.positionals[0] ?? ".", starter: value("starter") ?? "site", engine: value("engine") ?? DEFAULT_ENGINE, quiet: flag("quiet") });
361
+ return (await import("./chunk-CMJ7X5WW.js")).runInit({ dir: cli.positionals[0] ?? ".", starter: value("starter") ?? "site", engine: value("engine") ?? DEFAULT_ENGINE, quiet: flag("quiet") });
323
362
  case "capabilities":
324
- return (await import("./chunk-LU73FTIR.js")).runCapabilities(format, CAPABILITY_ORDER);
363
+ return (await import("./chunk-QLUTNR37.js")).runCapabilities(format, CAPABILITY_ORDER);
325
364
  case "docs":
326
- return (await import("./chunk-MUYWL4ZX.js")).runDocs(GRAMMAR, { query: cli.positionals, from: value("from"), format });
365
+ return (await import("./chunk-2L3HR67O.js")).runDocs(GRAMMAR, { query: cli.positionals, from: value("from"), format });
327
366
  case "sighting":
328
- return (await import("./chunk-XR7GFL4B.js")).runSighting(path.resolve(value("root") ?? "."));
367
+ return (await import("./chunk-LJOURBYT.js")).runSighting(path.resolve(value("root") ?? "."));
329
368
  case "completions": {
330
369
  process.stdout.write(bundled(`completions/${cli.positionals[0]}`));
331
370
  return 0;
332
371
  }
333
372
  case "types": {
334
373
  routeConsole();
335
- return (await import("./chunk-LYPKL524.js")).runTypes({ root: value("root"), out: value("out") ?? "ssqch.d.ts" });
374
+ return (await import("./chunk-RZYAIX2R.js")).runTypes({ root: value("root"), out: value("out") ?? "ssqch.d.ts" });
336
375
  }
337
376
  }
338
377
  const many = (name) => Array.isArray(cli.options[name]) ? cli.options[name] : typeof cli.options[name] === "string" ? [cli.options[name]] : [];
339
378
  const top = Number(value("top") ?? "5");
340
- if (command === "diff") return runDiff(cli.positionals, { exact: flag("exact"), ignore: many("ignore"), only: many("only"), lines: Number(value("lines") ?? "10"), format });
379
+ if (command === "diff") return runDiff(cli.positionals, { exact: flag("exact"), ignore: many("ignore"), only: many("only"), exclude: many("exclude"), ungrouped: flag("ungrouped"), lines: Number(value("lines") ?? "10"), format });
341
380
  if (command === "footprint" && cli.positionals[0] !== void 0) {
342
381
  try {
343
382
  await runFootprint(cli.positionals[0], cli.positionals[0], top, format);
@@ -358,15 +397,15 @@ async function main(argv) {
358
397
  const root = path.resolve(value("root") ?? ".");
359
398
  siteRoot = root;
360
399
  routeConsole();
361
- const makeConfig = async () => (await import("./chunk-DTSTCVRX.js")).loadConfig({ root, rootGiven: value("root") ?? ".", env, serving, quiet: flag("quiet") || inspecting, verbose: flag("verbose"), profile: command === "build" && flag("profile"), output: value("output"), base: value("base") });
400
+ const makeConfig = async () => (await import("./chunk-FCM3NYFR.js")).loadConfig({ root, rootGiven: value("root") ?? ".", env, serving, quiet: flag("quiet") || inspecting, verbose: flag("verbose"), profile: command === "build" && flag("profile"), output: value("output"), base: value("base") });
362
401
  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 });
363
402
  if (serving) {
364
- if (building) return (await import("./chunk-ZZBHBLDB.js")).runBuilder(building, makeConfig, root);
403
+ if (building) return (await import("./chunk-5ELAUHRL.js")).runBuilder(building, makeConfig, root);
365
404
  const readyFile = value("ready-file") === void 0 ? void 0 : path.resolve(value("ready-file"));
366
405
  const options = { port: Number(value("port") ?? "8080"), readyFile, quiet: flag("quiet") };
367
406
  if (!flag("built")) {
368
407
  try {
369
- return await (await import("./chunk-MDG5A4NI.js")).serve(argv, options);
408
+ return await (await import("./chunk-A75EVUJX.js")).serve(argv, options);
370
409
  } catch (e) {
371
410
  printError("error:", e, "build", new Locator(root));
372
411
  return 1;
@@ -380,7 +419,7 @@ async function main(argv) {
380
419
  return 1;
381
420
  }
382
421
  try {
383
- return await (await import("./chunk-MDG5A4NI.js")).serveBuilt(config2, options);
422
+ return await (await import("./chunk-A75EVUJX.js")).serveBuilt(config2, options);
384
423
  } catch (e) {
385
424
  printError("error:", e, "build", locatorOf(config2));
386
425
  return 1;
@@ -409,7 +448,7 @@ async function main(argv) {
409
448
  await runFootprint(shownDir(config, config.output), shownOutput(config), top, format);
410
449
  return 0;
411
450
  }
412
- const [{ build }, { summary, profileText }] = await Promise.all([import("./chunk-FYU22VDK.js"), import("./chunk-6RSZV5O2.js")]);
451
+ const [{ build }, { summary, profileText }] = await Promise.all([import("./chunk-QJ5ZFTML.js"), import("./chunk-443ZQLVX.js")]);
413
452
  const report = await build(config);
414
453
  if (!config.quiet) process.stdout.write(summary(config, report));
415
454
  if (report.profile) process.stdout.write(profileText(report.profile));
@@ -428,7 +467,7 @@ async function newPage(makeConfig, root, command) {
428
467
  return 1;
429
468
  }
430
469
  try {
431
- (await import("./chunk-G67W2FTJ.js")).runNew(config, command);
470
+ (await import("./chunk-3K237XAX.js")).runNew(config, command);
432
471
  return 0;
433
472
  } catch (e) {
434
473
  printError("error:", e, "build", locatorOf(config));
@@ -440,7 +479,7 @@ var checkFormat = (format) => {
440
479
  };
441
480
  async function runInspect(config, target, name, format) {
442
481
  checkFormat(format);
443
- const { field, fieldText, inspect, inspectionJson, inspectionText } = await import("./chunk-HMVYNV6M.js");
482
+ const { field, fieldText, inspect, inspectionJson, inspectionText } = await import("./chunk-KZZS4W2V.js");
444
483
  let report;
445
484
  try {
446
485
  report = await inspect(config, target);
@@ -460,7 +499,7 @@ async function runDiff(dirs, options) {
460
499
  const [before, after] = dirs;
461
500
  try {
462
501
  checkFormat(options.format);
463
- const [{ rustRegExp }, { globProblem, globToRegExp }, { compare, compareRuns, diffJson, diffText, isSame, runsJson, runsText }] = await Promise.all([import("./chunk-IAFM5ITE.js"), import("./chunk-3LODFCCH.js"), import("./chunk-26SHWRC6.js")]);
502
+ const [{ rustRegExp }, { globProblem, globToRegExp }, { compare, compareRuns, diffJson, diffText, isSame, runsJson, runsText }] = await Promise.all([import("./chunk-IAFM5ITE.js"), import("./chunk-ZINLHOX4.js"), import("./chunk-OQGXZYZS.js")]);
464
503
  const ignore = options.ignore.map((pattern) => {
465
504
  try {
466
505
  return rustRegExp(pattern, "g");
@@ -468,19 +507,21 @@ async function runDiff(dirs, options) {
468
507
  return bail(`--ignore ${quoted(pattern)} isn't a regular expression: ${e.message}`);
469
508
  }
470
509
  });
471
- const only = options.only.length ? options.only.map((given) => {
472
- const glob = given.replace(/^[./]+/, "");
510
+ const globs = (flag, given) => given.map((one) => {
511
+ const glob = one.replace(/^[./]+/, "").replace(/\/$/, "/**");
473
512
  const problem = globProblem(glob);
474
- if (problem !== void 0) bail(`--only ${quoted(given)} isn't a glob: error parsing glob '${glob}': ${problem}`);
513
+ if (problem !== void 0) bail(`--${flag} ${quoted(one)} isn't a glob: error parsing glob '${glob}': ${problem}`);
475
514
  return globToRegExp(glob);
476
- }) : void 0;
515
+ });
516
+ const only = options.only.length ? globs("only", options.only) : void 0;
517
+ const exclude = globs("exclude", options.exclude);
477
518
  if (dirs.length > 2) {
478
- const runs = await compareRuns(dirs, { exact: options.exact, ignore, only, lines: options.lines });
519
+ const runs = await compareRuns(dirs, { exact: options.exact, ungrouped: options.ungrouped, ignore, only, onlyGiven: options.only, exclude, lines: options.lines });
479
520
  if (options.format === "json") process.stdout.write(JSON.stringify(runsJson(runs, options.lines), null, 2) + "\n");
480
521
  else process.stdout.write(runsText(runs, options.lines, process.stdout.isTTY === true));
481
522
  return runs.varies.length ? 1 : 0;
482
523
  }
483
- const report = await compare(before, after, { exact: options.exact, ignore, only, lines: options.lines });
524
+ const report = await compare(before, after, { exact: options.exact, ungrouped: options.ungrouped, ignore, only, onlyGiven: options.only, exclude, lines: options.lines });
484
525
  if (options.format === "json") process.stdout.write(JSON.stringify(diffJson(report, options.lines), null, 2) + "\n");
485
526
  else process.stdout.write(diffText(report, options.lines, process.stdout.isTTY === true));
486
527
  return isSame(report) ? 0 : 1;
@@ -492,7 +533,7 @@ async function runDiff(dirs, options) {
492
533
  }
493
534
  async function runFootprint(dir, shown, top, format) {
494
535
  checkFormat(format);
495
- const { footprintJson, footprintText, measure } = await import("./chunk-CXRHH5P5.js");
536
+ const { footprintJson, footprintText, measure } = await import("./chunk-3HZZY3Y7.js");
496
537
  const measured = await measure(dir);
497
538
  if (format === "json") process.stdout.write(JSON.stringify(footprintJson(measured, shown, top), null, 2) + "\n");
498
539
  else process.stdout.write(footprintText(measured, shown, top));
@@ -516,7 +557,7 @@ async function buildJson(makeConfig, root, env) {
516
557
  const dirs = dirsOf(config);
517
558
  out.output = shownOutput(config);
518
559
  try {
519
- const report = await (await import("./chunk-FYU22VDK.js")).build(config);
560
+ const report = await (await import("./chunk-QJ5ZFTML.js")).build(config);
520
561
  out.durationMs = ms(report.durationMs);
521
562
  out.pages = { written: report.pagesWritten, templates: report.templates, bytes: report.pageBytes, new: report.pagesNew ?? null, gone: report.pagesGone ?? null };
522
563
  out.copied = { files: report.filesCopied, unchanged: report.filesUnchanged, bytes: report.passthroughBytes };
package/lib/elements.js CHANGED
@@ -2,24 +2,25 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-DUGGZ4EE.js";
5
+ } from "./chunk-RBNPBTDP.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  rewriteHtml,
10
10
  withBase
11
- } from "./chunk-P2TRR6XK.js";
12
- import "./chunk-ERNVEZOK.js";
11
+ } from "./chunk-Z44IAMNG.js";
12
+ import "./chunk-2QTJTEBV.js";
13
13
  import {
14
14
  count
15
- } from "./chunk-MDB3D3LP.js";
15
+ } from "./chunk-ERAIEV3O.js";
16
16
  import "./chunk-AD3HAW3W.js";
17
- import "./chunk-BXARVN5Z.js";
18
- import "./chunk-IOXCGMSF.js";
17
+ import "./chunk-YCOTX2VM.js";
18
+ import "./chunk-GS5B3CBW.js";
19
+ import "./chunk-JC54PHIT.js";
20
+ import "./chunk-HFSWUTXX.js";
19
21
  import "./chunk-FVZ5JBRI.js";
20
- import "./chunk-DNWA7WNO.js";
21
22
  import "./chunk-UU43WIZG.js";
22
- import "./chunk-RFNLZM7W.js";
23
+ import "./chunk-IOBC665M.js";
23
24
  import "./chunk-CMUWRPSQ.js";
24
25
  import {
25
26
  bail,
@@ -29,7 +30,7 @@ import {
29
30
  isDir,
30
31
  isFile,
31
32
  slashes
32
- } from "./chunk-JFPLNHEQ.js";
33
+ } from "./chunk-AIMEXBTK.js";
33
34
  import "./chunk-I3PS26CI.js";
34
35
 
35
36
  // src/modules/elements.ts
package/lib/image.js CHANGED
@@ -4,20 +4,21 @@ import {
4
4
  image,
5
5
  imagePlugin,
6
6
  imageUrl
7
- } from "./chunk-3NDFUMV2.js";
8
- import "./chunk-DUGGZ4EE.js";
9
- import "./chunk-P2TRR6XK.js";
10
- import "./chunk-ERNVEZOK.js";
11
- import "./chunk-MDB3D3LP.js";
7
+ } from "./chunk-V2FSMOFX.js";
8
+ import "./chunk-RBNPBTDP.js";
9
+ import "./chunk-Z44IAMNG.js";
10
+ import "./chunk-2QTJTEBV.js";
11
+ import "./chunk-ERAIEV3O.js";
12
12
  import "./chunk-AD3HAW3W.js";
13
- import "./chunk-BXARVN5Z.js";
14
- import "./chunk-IOXCGMSF.js";
13
+ import "./chunk-YCOTX2VM.js";
14
+ import "./chunk-GS5B3CBW.js";
15
+ import "./chunk-JC54PHIT.js";
16
+ import "./chunk-HFSWUTXX.js";
15
17
  import "./chunk-FVZ5JBRI.js";
16
- import "./chunk-DNWA7WNO.js";
17
18
  import "./chunk-UU43WIZG.js";
18
- import "./chunk-RFNLZM7W.js";
19
+ import "./chunk-IOBC665M.js";
19
20
  import "./chunk-CMUWRPSQ.js";
20
- import "./chunk-JFPLNHEQ.js";
21
+ import "./chunk-AIMEXBTK.js";
21
22
  import "./chunk-I3PS26CI.js";
22
23
  export {
23
24
  image,
package/lib/links.js CHANGED
@@ -2,29 +2,30 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-DUGGZ4EE.js";
5
+ } from "./chunk-RBNPBTDP.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  rewriteHtml
9
- } from "./chunk-P2TRR6XK.js";
10
- import "./chunk-ERNVEZOK.js";
9
+ } from "./chunk-Z44IAMNG.js";
10
+ import "./chunk-2QTJTEBV.js";
11
11
  import {
12
12
  count
13
- } from "./chunk-MDB3D3LP.js";
13
+ } from "./chunk-ERAIEV3O.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
+ import "./chunk-YCOTX2VM.js";
15
16
  import {
16
17
  dirsOf
17
- } from "./chunk-BXARVN5Z.js";
18
- import "./chunk-IOXCGMSF.js";
18
+ } from "./chunk-GS5B3CBW.js";
19
+ import "./chunk-JC54PHIT.js";
20
+ import "./chunk-HFSWUTXX.js";
19
21
  import {
20
22
  closest,
21
23
  closestPathFinder
22
24
  } from "./chunk-FVZ5JBRI.js";
23
- import "./chunk-DNWA7WNO.js";
24
25
  import {
25
26
  TRAIL_GOES_COLD
26
27
  } from "./chunk-UU43WIZG.js";
27
- import "./chunk-RFNLZM7W.js";
28
+ import "./chunk-IOBC665M.js";
28
29
  import "./chunk-CMUWRPSQ.js";
29
30
  import {
30
31
  Diagnostics,
@@ -34,7 +35,7 @@ import {
34
35
  isCapturing,
35
36
  warn,
36
37
  warning
37
- } from "./chunk-JFPLNHEQ.js";
38
+ } from "./chunk-AIMEXBTK.js";
38
39
  import "./chunk-I3PS26CI.js";
39
40
 
40
41
  // src/modules/links.ts
package/lib/minify.js CHANGED
@@ -1,33 +1,43 @@
1
1
  import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
+ import {
4
+ compressCss
5
+ } from "./chunk-XS4EJSEK.js";
6
+ import "./chunk-3NYSSA2C.js";
3
7
  import {
4
8
  Options
5
- } from "./chunk-DUGGZ4EE.js";
9
+ } from "./chunk-RBNPBTDP.js";
6
10
  import {
7
11
  BUILTINS,
8
12
  RustPlugin,
9
13
  compilePlugin
10
- } from "./chunk-P2TRR6XK.js";
11
- import "./chunk-ERNVEZOK.js";
12
- import "./chunk-MDB3D3LP.js";
14
+ } from "./chunk-Z44IAMNG.js";
15
+ import "./chunk-2QTJTEBV.js";
16
+ import "./chunk-ERAIEV3O.js";
13
17
  import "./chunk-AD3HAW3W.js";
14
- import "./chunk-BXARVN5Z.js";
15
- import "./chunk-IOXCGMSF.js";
18
+ import "./chunk-YCOTX2VM.js";
19
+ import "./chunk-GS5B3CBW.js";
20
+ import "./chunk-JC54PHIT.js";
21
+ import "./chunk-HFSWUTXX.js";
16
22
  import {
17
23
  closest
18
24
  } from "./chunk-FVZ5JBRI.js";
19
- import "./chunk-DNWA7WNO.js";
20
25
  import "./chunk-UU43WIZG.js";
21
- import "./chunk-RFNLZM7W.js";
26
+ import "./chunk-IOBC665M.js";
22
27
  import "./chunk-CMUWRPSQ.js";
23
28
  import {
24
- BuildError
25
- } from "./chunk-JFPLNHEQ.js";
29
+ BuildError,
30
+ displayPath,
31
+ messageOf,
32
+ warn,
33
+ warning
34
+ } from "./chunk-AIMEXBTK.js";
26
35
  import "./chunk-I3PS26CI.js";
27
36
 
28
37
  // src/modules/minify.ts
29
38
  import { fileURLToPath } from "node:url";
30
39
  var OPTIONS = ["collapseWhitespace", "removeComments", "shortDoctype", "shortenAttributes"];
40
+ var MORE = ["css", "xml", "json"];
31
41
  var WASM_FILE = fileURLToPath(new URL("../../wasm/minify.wasm", new URL("../src/modules/minify.ts", import.meta.url).href));
32
42
  function minifier(options) {
33
43
  return new RustPlugin(compilePlugin(WASM_FILE, WASM_FILE), options, WASM_FILE);
@@ -52,17 +62,66 @@ function minify(html, options = {}) {
52
62
  throw e instanceof BuildError ? new Error(`minify(): ${e.message}`) : e;
53
63
  }
54
64
  }
65
+ function minifyCss(css) {
66
+ try {
67
+ return compressCss(String(css ?? ""), "minifyCss()");
68
+ } catch (e) {
69
+ throw new Error(messageOf(e));
70
+ }
71
+ }
72
+ var STYLE = /(<style\b[^>]*>)([\s\S]*?)(<\/style\s*>)/gi;
73
+ function minifyStyles(html, page) {
74
+ if (!/<style\b/i.test(html)) return html;
75
+ let warned = false;
76
+ return html.replace(STYLE, (whole, open, css, close) => {
77
+ const type = /\stype\s*=\s*["']?([^"'\s>]+)/i.exec(open)?.[1];
78
+ if (type !== void 0 && type.toLowerCase() !== "text/css" || css.trim() === "") return whole;
79
+ try {
80
+ return `${open}${compressCss(css, `${page} <style>`)}${close}`;
81
+ } catch (e) {
82
+ if (!warned) {
83
+ warned = true;
84
+ warn(warning("build", `minify: a <style> in ${page} stays as it is, because ssqch's Sass can't read it: ${messageOf(e).split("\n")[0]}`, { file: page }));
85
+ }
86
+ return whole;
87
+ }
88
+ });
89
+ }
90
+ function minifyXml(xml) {
91
+ const parts = xml.split(/(<!\[CDATA\[[\s\S]*?\]\]>|<!--[\s\S]*?-->)/);
92
+ const out = parts.map((part, i) => i % 2 === 1 ? part : part.replace(/>\s+</g, "><")).join("").trim();
93
+ return xml.endsWith("\n") ? `${out}
94
+ ` : out;
95
+ }
96
+ function minifyJson(json) {
97
+ try {
98
+ return JSON.stringify(JSON.parse(json)) + (json.endsWith("\n") ? "\n" : "");
99
+ } catch {
100
+ return json;
101
+ }
102
+ }
55
103
  BUILTINS.set("ssqch/minify", (config, given) => {
56
- const o = new Options(given, OPTIONS);
104
+ const o = new Options(given, [...OPTIONS, ...MORE]);
57
105
  const on = {};
58
106
  for (const key of OPTIONS) {
59
107
  const value = o.bool(key);
60
108
  if (value !== void 0) on[key] = value;
61
109
  }
110
+ const [css, xml, json] = MORE.map((key) => o.bool(key) === true);
62
111
  const plugin = minifier(on);
63
- config.transforms.push(["minify-html", (content, page) => page.outputPath.endsWith(".html") ? plugin.transform(content, page) ?? content : content]);
112
+ const shown = (outputPath) => displayPath(config.root, outputPath);
113
+ config.transforms.push(["minify-html", (content, page) => {
114
+ if (page.outputPath.endsWith(".html")) {
115
+ const html = plugin.transform(content, page) ?? content;
116
+ return css ? minifyStyles(html, shown(page.outputPath)) : html;
117
+ }
118
+ if (xml && /\.(?:xml|rss|atom)$/.test(page.outputPath)) return minifyXml(content);
119
+ if (json && /\.(?:json|webmanifest)$/.test(page.outputPath)) return minifyJson(content);
120
+ return content;
121
+ }]);
64
122
  });
65
123
  export {
66
124
  minify,
125
+ minifyCss,
67
126
  minifyPlugin
68
127
  };
package/lib/redirects.js CHANGED
@@ -2,22 +2,23 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-DUGGZ4EE.js";
5
+ } from "./chunk-RBNPBTDP.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  escapeHtml,
10
10
  withBase
11
- } from "./chunk-P2TRR6XK.js";
12
- import "./chunk-ERNVEZOK.js";
13
- import "./chunk-MDB3D3LP.js";
11
+ } from "./chunk-Z44IAMNG.js";
12
+ import "./chunk-2QTJTEBV.js";
13
+ import "./chunk-ERAIEV3O.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
- import "./chunk-BXARVN5Z.js";
16
- import "./chunk-IOXCGMSF.js";
15
+ import "./chunk-YCOTX2VM.js";
16
+ import "./chunk-GS5B3CBW.js";
17
+ import "./chunk-JC54PHIT.js";
18
+ import "./chunk-HFSWUTXX.js";
17
19
  import "./chunk-FVZ5JBRI.js";
18
- import "./chunk-DNWA7WNO.js";
19
20
  import "./chunk-UU43WIZG.js";
20
- import "./chunk-RFNLZM7W.js";
21
+ import "./chunk-IOBC665M.js";
21
22
  import "./chunk-CMUWRPSQ.js";
22
23
  import {
23
24
  bail,
@@ -27,7 +28,7 @@ import {
27
28
  isInside,
28
29
  relative,
29
30
  slashes
30
- } from "./chunk-JFPLNHEQ.js";
31
+ } from "./chunk-AIMEXBTK.js";
31
32
  import "./chunk-I3PS26CI.js";
32
33
 
33
34
  // src/modules/redirects.ts
package/lib/rss.js CHANGED
@@ -2,29 +2,30 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  feedImages
5
- } from "./chunk-3NDFUMV2.js";
5
+ } from "./chunk-V2FSMOFX.js";
6
6
  import {
7
7
  Options
8
- } from "./chunk-DUGGZ4EE.js";
8
+ } from "./chunk-RBNPBTDP.js";
9
9
  import {
10
10
  BUILTINS,
11
11
  rewriteHtml,
12
12
  withBaseOnce
13
- } from "./chunk-P2TRR6XK.js";
14
- import "./chunk-ERNVEZOK.js";
15
- import "./chunk-MDB3D3LP.js";
13
+ } from "./chunk-Z44IAMNG.js";
14
+ import "./chunk-2QTJTEBV.js";
15
+ import "./chunk-ERAIEV3O.js";
16
16
  import "./chunk-AD3HAW3W.js";
17
- import "./chunk-BXARVN5Z.js";
18
- import "./chunk-IOXCGMSF.js";
17
+ import "./chunk-YCOTX2VM.js";
18
+ import "./chunk-GS5B3CBW.js";
19
+ import "./chunk-JC54PHIT.js";
20
+ import "./chunk-HFSWUTXX.js";
19
21
  import "./chunk-FVZ5JBRI.js";
20
- import "./chunk-DNWA7WNO.js";
21
22
  import "./chunk-UU43WIZG.js";
22
- import "./chunk-RFNLZM7W.js";
23
+ import "./chunk-IOBC665M.js";
23
24
  import "./chunk-CMUWRPSQ.js";
24
25
  import {
25
26
  bail,
26
27
  toDate
27
- } from "./chunk-JFPLNHEQ.js";
28
+ } from "./chunk-AIMEXBTK.js";
28
29
  import "./chunk-I3PS26CI.js";
29
30
 
30
31
  // src/modules/rss.ts
@@ -111,6 +112,8 @@ BUILTINS.set("ssqch/rss", (config, options) => {
111
112
  filters.set("getNewestCollectionItemDate", (items) => getNewestCollectionItemDate(items));
112
113
  filters.set("dateToRfc3339", (date) => dateToRfc3339(date));
113
114
  filters.set("dateToRfc822", (date) => dateToRfc822(date));
115
+ filters.set("rssDate", (date) => dateToRfc3339(date));
116
+ filters.set("rssLastUpdatedDate", (items) => dateToRfc3339(getNewestCollectionItemDate(items)));
114
117
  filters.set("absoluteUrl", (url, base) => absoluteUrl(output(url), output(base), config.base));
115
118
  filters.set("htmlToAbsoluteUrls", (html, base) => htmlToAbsoluteUrls(output(html), output(base), config.base));
116
119
  const unprefixed = (e) => {