ssqch 0.10.0 → 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 (95) hide show
  1. package/bundled/completions/bash +62 -16
  2. package/bundled/completions/elvish +28 -12
  3. package/bundled/completions/fish +36 -23
  4. package/bundled/completions/powershell +30 -12
  5. package/bundled/completions/zsh +40 -19
  6. package/bundled/docs/agents.md +12 -1
  7. package/bundled/docs/build-summary.md +31 -1
  8. package/bundled/docs/comparing-builds.md +37 -5
  9. package/bundled/docs/configuring.md +30 -5
  10. package/bundled/docs/field-guide.md +1 -1
  11. package/bundled/docs/github-pages.md +1 -1
  12. package/bundled/docs/index.md +1 -1
  13. package/bundled/docs/known-gaps.md +1 -1
  14. package/bundled/docs/markdown.md +63 -5
  15. package/bundled/docs/multilingual.md +20 -3
  16. package/bundled/docs/nav.yml +1 -0
  17. package/bundled/docs/netlify.md +2 -2
  18. package/bundled/docs/plugins.md +4 -4
  19. package/bundled/docs/seo.md +39 -1
  20. package/bundled/docs/template-languages.md +6 -4
  21. package/bundled/docs/templates.md +3 -3
  22. package/bundled/docs/trailheads/from-eleventy.md +25 -13
  23. package/bundled/docs/trailheads/from-hugo.md +103 -0
  24. package/bundled/docs/trailheads/from-jekyll.md +49 -15
  25. package/bundled/docs/trailheads/from-mkdocs.md +54 -9
  26. package/bundled/docs/trailheads/from-zola.md +2 -2
  27. package/bundled/docs/trailheads.md +22 -5
  28. package/bundled/docs/where-values-come-from.md +1 -1
  29. package/bundled/mkdocs/404.jinja +6 -0
  30. package/bundled/ssqch.d.ts +78 -18
  31. package/lib/assets.js +11 -12
  32. package/lib/{chunk-3HHRKG33.js → chunk-2L3HR67O.js} +71 -19
  33. package/lib/{chunk-LCPSKHAV.js → chunk-2QTJTEBV.js} +1 -1
  34. package/lib/{chunk-RVBNVGZV.js → chunk-3HZZY3Y7.js} +5 -6
  35. package/lib/{chunk-RKFZSVNF.js → chunk-3K237XAX.js} +10 -11
  36. package/lib/{chunk-HXCLCXRT.js → chunk-443ZQLVX.js} +5 -3
  37. package/lib/{chunk-Q4LFTYK2.js → chunk-5ELAUHRL.js} +20 -20
  38. package/lib/{chunk-SA5KSJ4Y.js → chunk-A75EVUJX.js} +10 -12
  39. package/lib/{chunk-BGCBSQ4A.js → chunk-AIMEXBTK.js} +163 -29
  40. package/lib/{chunk-Y2ESFAAD.js → chunk-B5E27PLU.js} +10 -41
  41. package/lib/{chunk-RJFWTW2Y.js → chunk-CMJ7X5WW.js} +3 -3
  42. package/lib/{chunk-NKXEPHRZ.js → chunk-ERAIEV3O.js} +106 -4
  43. package/lib/{chunk-E5UB2YY7.js → chunk-FCM3NYFR.js} +11 -9
  44. package/lib/{chunk-3EPHKJEG.js → chunk-GJNIQAIH.js} +8 -8
  45. package/lib/{chunk-CB6YFUXU.js → chunk-GLJQ4C76.js} +40 -21
  46. package/lib/{chunk-DDV6JEC2.js → chunk-GS5B3CBW.js} +1 -1
  47. package/lib/chunk-H5K2ZE7B.js +219 -0
  48. package/lib/{chunk-NFJJKDRI.js → chunk-HFSWUTXX.js} +1 -1
  49. package/lib/{chunk-4Q6WMTER.js → chunk-HWW5NCVJ.js} +1 -1
  50. package/lib/{chunk-LAV3DEY4.js → chunk-I3HYKEEW.js} +1 -1
  51. package/lib/{chunk-JWCCVTTR.js → chunk-IOBC665M.js} +2 -4
  52. package/lib/chunk-JC54PHIT.js +7992 -0
  53. package/lib/{chunk-2LEOPLTZ.js → chunk-KCF2Z6N7.js} +3 -5
  54. package/lib/{chunk-DMVJ53SM.js → chunk-KZZS4W2V.js} +15 -15
  55. package/lib/{chunk-RM5Q3KFB.js → chunk-LJOURBYT.js} +14 -13
  56. package/lib/chunk-OQGXZYZS.js +45 -0
  57. package/lib/chunk-OSBEH67S.js +6296 -0
  58. package/lib/{chunk-DW7VMJEZ.js → chunk-QJ5ZFTML.js} +14 -13
  59. package/lib/{chunk-NUUEOGLZ.js → chunk-QLUTNR37.js} +11 -11
  60. package/lib/{chunk-HGJ5VWUR.js → chunk-RBNPBTDP.js} +1 -1
  61. package/lib/{chunk-F65YUXZ7.js → chunk-RIAOXEXC.js} +10 -4
  62. package/lib/chunk-RVXGUMFI.js +21 -0
  63. package/lib/{chunk-N4O5MDIB.js → chunk-RYIWYWRQ.js} +5 -7
  64. package/lib/{chunk-EEJDLCD3.js → chunk-RZYAIX2R.js} +12 -11
  65. package/lib/{chunk-7HXCQEGA.js → chunk-V2FSMOFX.js} +3 -3
  66. package/lib/{chunk-HDQ4SRWM.js → chunk-X2GAVYV2.js} +525 -75
  67. package/lib/chunk-XS4EJSEK.js +279 -0
  68. package/lib/chunk-YCOTX2VM.js +37 -0
  69. package/lib/{chunk-QMA7CK7B.js → chunk-Z44IAMNG.js} +137 -32
  70. package/lib/chunk-Z5OP43HU.js +2945 -0
  71. package/lib/{chunk-JXZT5L7W.js → chunk-ZINLHOX4.js} +2 -3
  72. package/lib/{chunk-SRNLKWXL.js → chunk-ZR3JYLFB.js} +893 -12382
  73. package/lib/cli.js +82 -41
  74. package/lib/elements.js +11 -12
  75. package/lib/image.js +11 -11
  76. package/lib/links.js +11 -12
  77. package/lib/minify.js +71 -13
  78. package/lib/redirects.js +11 -12
  79. package/lib/rss.js +13 -11
  80. package/lib/sass.js +13 -245
  81. package/lib/sitemap.js +19 -18
  82. package/lib/ssqch.js +6 -5
  83. package/package.json +1 -1
  84. package/types/index.d.ts +59 -13
  85. package/types/minify.d.ts +15 -3
  86. package/types/sass.d.ts +2 -0
  87. package/types/sitemap.d.ts +2 -2
  88. package/wasm/markdown.wasm +0 -0
  89. package/wasm/minify.wasm +0 -0
  90. package/wasm/sass.wasm +0 -0
  91. package/lib/chunk-5DNDSNTP.js +0 -1541
  92. package/lib/chunk-VJWQSYEG.js +0 -119
  93. package/lib/chunk-ZM6TU2JB.js +0 -1287
  94. /package/lib/{chunk-BGCBSQ4A.js.LEGAL.txt → chunk-AIMEXBTK.js.LEGAL.txt} +0 -0
  95. /package/lib/{chunk-SRNLKWXL.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-LAV3DEY4.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-Y2ESFAAD.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-DDV6JEC2.js";
25
+ } from "./chunk-GS5B3CBW.js";
24
26
  import {
25
27
  describeThrown
26
- } from "./chunk-JWCCVTTR.js";
28
+ } from "./chunk-IOBC665M.js";
27
29
  import {
28
30
  prettyJson,
29
31
  quoted
@@ -42,16 +44,14 @@ import {
42
44
  printError,
43
45
  progress,
44
46
  red,
47
+ relative,
45
48
  setQuiet,
46
49
  takeWarnings,
47
50
  toJson,
48
51
  toJson2,
49
52
  warn,
50
53
  warning
51
- } from "./chunk-BGCBSQ4A.js";
52
- import {
53
- relative
54
- } from "./chunk-VJWQSYEG.js";
54
+ } from "./chunk-AIMEXBTK.js";
55
55
  import "./chunk-I3PS26CI.js";
56
56
 
57
57
  // src/cli.ts
@@ -75,7 +75,7 @@ var COMMANDS = [
75
75
  {
76
76
  name: "build",
77
77
  about: "Build the site (default)",
78
- options: [FORMAT],
78
+ options: [FORMAT, { long: "profile", help: "Also time every page, template, layout, engine, filter, transform, data file, collection and hook, and list the slowest" }],
79
79
  positionals: [],
80
80
  afterHelp: "With --format json, standard output is one JSON report: whether the build worked, what it wrote, and its\nwarnings and errors, each with a code, the file, the line when it's known, and the field for a content error.\nProgress lines and `console.log` go to standard error."
81
81
  },
@@ -120,11 +120,14 @@ var COMMANDS = [
120
120
  },
121
121
  {
122
122
  name: "diff",
123
+ helpGlobals: ["quiet"],
123
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",
124
125
  options: [
125
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" },
126
128
  { long: "ignore", value: "REGEX", help: "Leave out text matching this regular expression before comparing (repeatable)", many: true },
127
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 },
128
131
  { long: "lines", value: "LINES", help: "Changed lines to show for each file (0 for all)", default: "10", check: number },
129
132
  FORMAT
130
133
  ],
@@ -150,11 +153,44 @@ var COMMANDS = [
150
153
  },
151
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 },
152
155
  {
153
- name: "import",
154
- about: "Move a site from another generator: rename and rewrite what's mechanical, and list the rest",
155
- options: [{ long: "write", help: "Make the changes (without it, only list them)" }],
156
- 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: "." }],
157
- 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`,
158
194
  own: true
159
195
  },
160
196
  { name: "capabilities", about: "Say what this binary supports: template languages, modules, config options and optional features", options: [FORMAT], positionals: [], own: true },
@@ -187,7 +223,7 @@ var CAPABILITY_ORDER = (() => {
187
223
  return names;
188
224
  })();
189
225
  var GRAMMAR = { name: "ssqch", about: "SiteSquatch (ssqch): a fast, pluggable static site generator", version: VERSION, globals: GLOBALS, commands: COMMANDS };
190
- 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"];
191
227
  var OWN = COMMANDS.filter((c) => c.raw || c.own).map((c) => c.name);
192
228
  function aliased(given, own = OWN) {
193
229
  const args = [...given];
@@ -318,28 +354,29 @@ async function main(argv) {
318
354
  `);
319
355
  return 1;
320
356
  }
321
- if (command === "import") return (await import("./chunk-ZM6TU2JB.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 });
322
359
  switch (command) {
323
360
  case "init":
324
- return (await import("./chunk-RJFWTW2Y.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") });
325
362
  case "capabilities":
326
- return (await import("./chunk-NUUEOGLZ.js")).runCapabilities(format, CAPABILITY_ORDER);
363
+ return (await import("./chunk-QLUTNR37.js")).runCapabilities(format, CAPABILITY_ORDER);
327
364
  case "docs":
328
- return (await import("./chunk-3HHRKG33.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 });
329
366
  case "sighting":
330
- return (await import("./chunk-RM5Q3KFB.js")).runSighting(path.resolve(value("root") ?? "."));
367
+ return (await import("./chunk-LJOURBYT.js")).runSighting(path.resolve(value("root") ?? "."));
331
368
  case "completions": {
332
369
  process.stdout.write(bundled(`completions/${cli.positionals[0]}`));
333
370
  return 0;
334
371
  }
335
372
  case "types": {
336
373
  routeConsole();
337
- return (await import("./chunk-EEJDLCD3.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" });
338
375
  }
339
376
  }
340
377
  const many = (name) => Array.isArray(cli.options[name]) ? cli.options[name] : typeof cli.options[name] === "string" ? [cli.options[name]] : [];
341
378
  const top = Number(value("top") ?? "5");
342
- 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 });
343
380
  if (command === "footprint" && cli.positionals[0] !== void 0) {
344
381
  try {
345
382
  await runFootprint(cli.positionals[0], cli.positionals[0], top, format);
@@ -360,15 +397,15 @@ async function main(argv) {
360
397
  const root = path.resolve(value("root") ?? ".");
361
398
  siteRoot = root;
362
399
  routeConsole();
363
- const makeConfig = async () => (await import("./chunk-E5UB2YY7.js")).loadConfig({ root, rootGiven: value("root") ?? ".", env, serving, quiet: flag("quiet") || inspecting, verbose: flag("verbose"), 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") });
364
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 });
365
402
  if (serving) {
366
- if (building) return (await import("./chunk-Q4LFTYK2.js")).runBuilder(building, makeConfig, root);
403
+ if (building) return (await import("./chunk-5ELAUHRL.js")).runBuilder(building, makeConfig, root);
367
404
  const readyFile = value("ready-file") === void 0 ? void 0 : path.resolve(value("ready-file"));
368
405
  const options = { port: Number(value("port") ?? "8080"), readyFile, quiet: flag("quiet") };
369
406
  if (!flag("built")) {
370
407
  try {
371
- return await (await import("./chunk-SA5KSJ4Y.js")).serve(argv, options);
408
+ return await (await import("./chunk-A75EVUJX.js")).serve(argv, options);
372
409
  } catch (e) {
373
410
  printError("error:", e, "build", new Locator(root));
374
411
  return 1;
@@ -382,7 +419,7 @@ async function main(argv) {
382
419
  return 1;
383
420
  }
384
421
  try {
385
- return await (await import("./chunk-SA5KSJ4Y.js")).serveBuilt(config2, options);
422
+ return await (await import("./chunk-A75EVUJX.js")).serveBuilt(config2, options);
386
423
  } catch (e) {
387
424
  printError("error:", e, "build", locatorOf(config2));
388
425
  return 1;
@@ -411,9 +448,10 @@ async function main(argv) {
411
448
  await runFootprint(shownDir(config, config.output), shownOutput(config), top, format);
412
449
  return 0;
413
450
  }
414
- const [{ build }, { summary }] = await Promise.all([import("./chunk-DW7VMJEZ.js"), import("./chunk-HXCLCXRT.js")]);
451
+ const [{ build }, { summary, profileText }] = await Promise.all([import("./chunk-QJ5ZFTML.js"), import("./chunk-443ZQLVX.js")]);
415
452
  const report = await build(config);
416
453
  if (!config.quiet) process.stdout.write(summary(config, report));
454
+ if (report.profile) process.stdout.write(profileText(report.profile));
417
455
  return 0;
418
456
  } catch (e) {
419
457
  printError("error:", e, "build", locatorOf(config));
@@ -429,7 +467,7 @@ async function newPage(makeConfig, root, command) {
429
467
  return 1;
430
468
  }
431
469
  try {
432
- (await import("./chunk-RKFZSVNF.js")).runNew(config, command);
470
+ (await import("./chunk-3K237XAX.js")).runNew(config, command);
433
471
  return 0;
434
472
  } catch (e) {
435
473
  printError("error:", e, "build", locatorOf(config));
@@ -441,7 +479,7 @@ var checkFormat = (format) => {
441
479
  };
442
480
  async function runInspect(config, target, name, format) {
443
481
  checkFormat(format);
444
- const { field, fieldText, inspect, inspectionJson, inspectionText } = await import("./chunk-DMVJ53SM.js");
482
+ const { field, fieldText, inspect, inspectionJson, inspectionText } = await import("./chunk-KZZS4W2V.js");
445
483
  let report;
446
484
  try {
447
485
  report = await inspect(config, target);
@@ -461,7 +499,7 @@ async function runDiff(dirs, options) {
461
499
  const [before, after] = dirs;
462
500
  try {
463
501
  checkFormat(options.format);
464
- const [{ rustRegExp }, { globProblem, globToRegExp }, { compare, compareRuns, diffJson, diffText, isSame, runsJson, runsText }] = await Promise.all([import("./chunk-IAFM5ITE.js"), import("./chunk-JXZT5L7W.js"), import("./chunk-HDQ4SRWM.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")]);
465
503
  const ignore = options.ignore.map((pattern) => {
466
504
  try {
467
505
  return rustRegExp(pattern, "g");
@@ -469,19 +507,21 @@ async function runDiff(dirs, options) {
469
507
  return bail(`--ignore ${quoted(pattern)} isn't a regular expression: ${e.message}`);
470
508
  }
471
509
  });
472
- const only = options.only.length ? options.only.map((given) => {
473
- const glob = given.replace(/^[./]+/, "");
510
+ const globs = (flag, given) => given.map((one) => {
511
+ const glob = one.replace(/^[./]+/, "").replace(/\/$/, "/**");
474
512
  const problem = globProblem(glob);
475
- 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}`);
476
514
  return globToRegExp(glob);
477
- }) : void 0;
515
+ });
516
+ const only = options.only.length ? globs("only", options.only) : void 0;
517
+ const exclude = globs("exclude", options.exclude);
478
518
  if (dirs.length > 2) {
479
- 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 });
480
520
  if (options.format === "json") process.stdout.write(JSON.stringify(runsJson(runs, options.lines), null, 2) + "\n");
481
521
  else process.stdout.write(runsText(runs, options.lines, process.stdout.isTTY === true));
482
522
  return runs.varies.length ? 1 : 0;
483
523
  }
484
- 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 });
485
525
  if (options.format === "json") process.stdout.write(JSON.stringify(diffJson(report, options.lines), null, 2) + "\n");
486
526
  else process.stdout.write(diffText(report, options.lines, process.stdout.isTTY === true));
487
527
  return isSame(report) ? 0 : 1;
@@ -493,7 +533,7 @@ async function runDiff(dirs, options) {
493
533
  }
494
534
  async function runFootprint(dir, shown, top, format) {
495
535
  checkFormat(format);
496
- const { footprintJson, footprintText, measure } = await import("./chunk-RVBNVGZV.js");
536
+ const { footprintJson, footprintText, measure } = await import("./chunk-3HZZY3Y7.js");
497
537
  const measured = await measure(dir);
498
538
  if (format === "json") process.stdout.write(JSON.stringify(footprintJson(measured, shown, top), null, 2) + "\n");
499
539
  else process.stdout.write(footprintText(measured, shown, top));
@@ -517,7 +557,7 @@ async function buildJson(makeConfig, root, env) {
517
557
  const dirs = dirsOf(config);
518
558
  out.output = shownOutput(config);
519
559
  try {
520
- const report = await (await import("./chunk-DW7VMJEZ.js")).build(config);
560
+ const report = await (await import("./chunk-QJ5ZFTML.js")).build(config);
521
561
  out.durationMs = ms(report.durationMs);
522
562
  out.pages = { written: report.pagesWritten, templates: report.templates, bytes: report.pageBytes, new: report.pagesNew ?? null, gone: report.pagesGone ?? null };
523
563
  out.copied = { files: report.filesCopied, unchanged: report.filesUnchanged, bytes: report.passthroughBytes };
@@ -526,6 +566,7 @@ async function buildJson(makeConfig, root, env) {
526
566
  out.written = report.written.map((file) => relative(dirs.output, file));
527
567
  out.summary = report.summary.map(([label, text]) => ({ label, value: text }));
528
568
  out.timings = report.timings.map(([phase, time]) => ({ phase, ms: ms(time) }));
569
+ if (report.profile) out.profile = Object.fromEntries(Object.entries(report.profile).map(([kind, list]) => [kind, list.map((e) => ({ name: e.name, calls: e.calls, ms: ms(e.ms), async: e.async }))]));
529
570
  errors = [];
530
571
  } catch (e) {
531
572
  errors = fromError(e, "build", locatorOf(config));
package/lib/elements.js CHANGED
@@ -2,36 +2,35 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-HGJ5VWUR.js";
5
+ } from "./chunk-RBNPBTDP.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  rewriteHtml,
10
10
  withBase
11
- } from "./chunk-QMA7CK7B.js";
12
- import "./chunk-LCPSKHAV.js";
11
+ } from "./chunk-Z44IAMNG.js";
12
+ import "./chunk-2QTJTEBV.js";
13
13
  import {
14
14
  count
15
- } from "./chunk-NKXEPHRZ.js";
15
+ } from "./chunk-ERAIEV3O.js";
16
16
  import "./chunk-AD3HAW3W.js";
17
- import "./chunk-DDV6JEC2.js";
18
- import "./chunk-5DNDSNTP.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-NFJJKDRI.js";
21
22
  import "./chunk-UU43WIZG.js";
22
- import "./chunk-JWCCVTTR.js";
23
+ import "./chunk-IOBC665M.js";
23
24
  import "./chunk-CMUWRPSQ.js";
24
25
  import {
25
26
  bail,
26
- context
27
- } from "./chunk-BGCBSQ4A.js";
28
- import {
29
27
  compareText,
28
+ context,
30
29
  displayPath,
31
30
  isDir,
32
31
  isFile,
33
32
  slashes
34
- } from "./chunk-VJWQSYEG.js";
33
+ } from "./chunk-AIMEXBTK.js";
35
34
  import "./chunk-I3PS26CI.js";
36
35
 
37
36
  // src/modules/elements.ts
package/lib/image.js CHANGED
@@ -4,21 +4,21 @@ import {
4
4
  image,
5
5
  imagePlugin,
6
6
  imageUrl
7
- } from "./chunk-7HXCQEGA.js";
8
- import "./chunk-HGJ5VWUR.js";
9
- import "./chunk-QMA7CK7B.js";
10
- import "./chunk-LCPSKHAV.js";
11
- import "./chunk-NKXEPHRZ.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-DDV6JEC2.js";
14
- import "./chunk-5DNDSNTP.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-NFJJKDRI.js";
17
18
  import "./chunk-UU43WIZG.js";
18
- import "./chunk-JWCCVTTR.js";
19
+ import "./chunk-IOBC665M.js";
19
20
  import "./chunk-CMUWRPSQ.js";
20
- import "./chunk-BGCBSQ4A.js";
21
- import "./chunk-VJWQSYEG.js";
21
+ import "./chunk-AIMEXBTK.js";
22
22
  import "./chunk-I3PS26CI.js";
23
23
  export {
24
24
  image,
package/lib/links.js CHANGED
@@ -2,41 +2,40 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-HGJ5VWUR.js";
5
+ } from "./chunk-RBNPBTDP.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  rewriteHtml
9
- } from "./chunk-QMA7CK7B.js";
10
- import "./chunk-LCPSKHAV.js";
9
+ } from "./chunk-Z44IAMNG.js";
10
+ import "./chunk-2QTJTEBV.js";
11
11
  import {
12
12
  count
13
- } from "./chunk-NKXEPHRZ.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-DDV6JEC2.js";
18
- import "./chunk-5DNDSNTP.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-NFJJKDRI.js";
24
25
  import {
25
26
  TRAIL_GOES_COLD
26
27
  } from "./chunk-UU43WIZG.js";
27
- import "./chunk-JWCCVTTR.js";
28
+ import "./chunk-IOBC665M.js";
28
29
  import "./chunk-CMUWRPSQ.js";
29
30
  import {
30
31
  Diagnostics,
31
32
  bail,
33
+ compareText,
32
34
  error,
33
35
  isCapturing,
34
36
  warn,
35
37
  warning
36
- } from "./chunk-BGCBSQ4A.js";
37
- import {
38
- compareText
39
- } from "./chunk-VJWQSYEG.js";
38
+ } from "./chunk-AIMEXBTK.js";
40
39
  import "./chunk-I3PS26CI.js";
41
40
 
42
41
  // src/modules/links.ts
package/lib/minify.js CHANGED
@@ -1,34 +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-HGJ5VWUR.js";
9
+ } from "./chunk-RBNPBTDP.js";
6
10
  import {
7
11
  BUILTINS,
8
12
  RustPlugin,
9
13
  compilePlugin
10
- } from "./chunk-QMA7CK7B.js";
11
- import "./chunk-LCPSKHAV.js";
12
- import "./chunk-NKXEPHRZ.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-DDV6JEC2.js";
15
- import "./chunk-5DNDSNTP.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-NFJJKDRI.js";
20
25
  import "./chunk-UU43WIZG.js";
21
- import "./chunk-JWCCVTTR.js";
26
+ import "./chunk-IOBC665M.js";
22
27
  import "./chunk-CMUWRPSQ.js";
23
28
  import {
24
- BuildError
25
- } from "./chunk-BGCBSQ4A.js";
26
- import "./chunk-VJWQSYEG.js";
29
+ BuildError,
30
+ displayPath,
31
+ messageOf,
32
+ warn,
33
+ warning
34
+ } from "./chunk-AIMEXBTK.js";
27
35
  import "./chunk-I3PS26CI.js";
28
36
 
29
37
  // src/modules/minify.ts
30
38
  import { fileURLToPath } from "node:url";
31
39
  var OPTIONS = ["collapseWhitespace", "removeComments", "shortDoctype", "shortenAttributes"];
40
+ var MORE = ["css", "xml", "json"];
32
41
  var WASM_FILE = fileURLToPath(new URL("../../wasm/minify.wasm", new URL("../src/modules/minify.ts", import.meta.url).href));
33
42
  function minifier(options) {
34
43
  return new RustPlugin(compilePlugin(WASM_FILE, WASM_FILE), options, WASM_FILE);
@@ -53,17 +62,66 @@ function minify(html, options = {}) {
53
62
  throw e instanceof BuildError ? new Error(`minify(): ${e.message}`) : e;
54
63
  }
55
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
+ }
56
103
  BUILTINS.set("ssqch/minify", (config, given) => {
57
- const o = new Options(given, OPTIONS);
104
+ const o = new Options(given, [...OPTIONS, ...MORE]);
58
105
  const on = {};
59
106
  for (const key of OPTIONS) {
60
107
  const value = o.bool(key);
61
108
  if (value !== void 0) on[key] = value;
62
109
  }
110
+ const [css, xml, json] = MORE.map((key) => o.bool(key) === true);
63
111
  const plugin = minifier(on);
64
- 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
+ }]);
65
122
  });
66
123
  export {
67
124
  minify,
125
+ minifyCss,
68
126
  minifyPlugin
69
127
  };
package/lib/redirects.js CHANGED
@@ -2,34 +2,33 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  Options
5
- } from "./chunk-HGJ5VWUR.js";
5
+ } from "./chunk-RBNPBTDP.js";
6
6
  import {
7
7
  BUILTINS,
8
8
  debugString,
9
9
  escapeHtml,
10
10
  withBase
11
- } from "./chunk-QMA7CK7B.js";
12
- import "./chunk-LCPSKHAV.js";
13
- import "./chunk-NKXEPHRZ.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-DDV6JEC2.js";
16
- import "./chunk-5DNDSNTP.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-NFJJKDRI.js";
19
20
  import "./chunk-UU43WIZG.js";
20
- import "./chunk-JWCCVTTR.js";
21
+ import "./chunk-IOBC665M.js";
21
22
  import "./chunk-CMUWRPSQ.js";
22
23
  import {
23
24
  bail,
24
- context
25
- } from "./chunk-BGCBSQ4A.js";
26
- import {
27
25
  compareText,
26
+ context,
28
27
  displayPath,
29
28
  isInside,
30
29
  relative,
31
30
  slashes
32
- } from "./chunk-VJWQSYEG.js";
31
+ } from "./chunk-AIMEXBTK.js";
33
32
  import "./chunk-I3PS26CI.js";
34
33
 
35
34
  // src/modules/redirects.ts
package/lib/rss.js CHANGED
@@ -2,30 +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-7HXCQEGA.js";
5
+ } from "./chunk-V2FSMOFX.js";
6
6
  import {
7
7
  Options
8
- } from "./chunk-HGJ5VWUR.js";
8
+ } from "./chunk-RBNPBTDP.js";
9
9
  import {
10
10
  BUILTINS,
11
11
  rewriteHtml,
12
12
  withBaseOnce
13
- } from "./chunk-QMA7CK7B.js";
14
- import "./chunk-LCPSKHAV.js";
15
- import "./chunk-NKXEPHRZ.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-DDV6JEC2.js";
18
- import "./chunk-5DNDSNTP.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-NFJJKDRI.js";
21
22
  import "./chunk-UU43WIZG.js";
22
- import "./chunk-JWCCVTTR.js";
23
+ import "./chunk-IOBC665M.js";
23
24
  import "./chunk-CMUWRPSQ.js";
24
25
  import {
25
26
  bail,
26
27
  toDate
27
- } from "./chunk-BGCBSQ4A.js";
28
- import "./chunk-VJWQSYEG.js";
28
+ } from "./chunk-AIMEXBTK.js";
29
29
  import "./chunk-I3PS26CI.js";
30
30
 
31
31
  // src/modules/rss.ts
@@ -112,6 +112,8 @@ BUILTINS.set("ssqch/rss", (config, options) => {
112
112
  filters.set("getNewestCollectionItemDate", (items) => getNewestCollectionItemDate(items));
113
113
  filters.set("dateToRfc3339", (date) => dateToRfc3339(date));
114
114
  filters.set("dateToRfc822", (date) => dateToRfc822(date));
115
+ filters.set("rssDate", (date) => dateToRfc3339(date));
116
+ filters.set("rssLastUpdatedDate", (items) => dateToRfc3339(getNewestCollectionItemDate(items)));
115
117
  filters.set("absoluteUrl", (url, base) => absoluteUrl(output(url), output(base), config.base));
116
118
  filters.set("htmlToAbsoluteUrls", (html, base) => htmlToAbsoluteUrls(output(html), output(base), config.base));
117
119
  const unprefixed = (e) => {