ssqch 0.9.0 → 0.10.1

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 (94) hide show
  1. package/README.md +1 -1
  2. package/bundled/completions/bash +1 -1
  3. package/bundled/completions/elvish +1 -0
  4. package/bundled/completions/fish +1 -0
  5. package/bundled/completions/powershell +1 -0
  6. package/bundled/completions/zsh +1 -0
  7. package/bundled/docs/agents.md +70 -0
  8. package/bundled/docs/benchmarks.md +29 -0
  9. package/bundled/docs/build-summary.md +57 -0
  10. package/bundled/docs/comparing-builds.md +51 -0
  11. package/bundled/docs/configuring.md +138 -0
  12. package/bundled/docs/content-schemas.md +54 -0
  13. package/bundled/docs/css-and-javascript.md +33 -0
  14. package/bundled/docs/data-files.md +55 -0
  15. package/bundled/docs/deploying.md +47 -0
  16. package/bundled/docs/field-guide.md +144 -0
  17. package/bundled/docs/footprint.md +27 -0
  18. package/bundled/docs/github-pages.md +41 -0
  19. package/bundled/docs/index.md +26 -0
  20. package/bundled/docs/install.md +27 -0
  21. package/bundled/docs/known-gaps.md +18 -0
  22. package/bundled/docs/markdown.md +114 -0
  23. package/bundled/docs/multilingual.md +14 -0
  24. package/bundled/docs/nav.yml +50 -0
  25. package/bundled/docs/netlify.md +30 -0
  26. package/bundled/docs/new-pages.md +42 -0
  27. package/bundled/docs/plugins.md +13 -0
  28. package/bundled/docs/rust-plugins.md +32 -0
  29. package/bundled/docs/seo.md +19 -0
  30. package/bundled/docs/template-languages.md +106 -0
  31. package/bundled/docs/templates.md +37 -0
  32. package/bundled/docs/themes.md +31 -0
  33. package/bundled/{trailheads → docs/trailheads}/from-component-frameworks.md +7 -3
  34. package/bundled/{trailheads → docs/trailheads}/from-docusaurus.md +7 -4
  35. package/bundled/{trailheads → docs/trailheads}/from-eleventy.md +7 -4
  36. package/bundled/{trailheads → docs/trailheads}/from-hexo.md +7 -4
  37. package/bundled/{trailheads → docs/trailheads}/from-jekyll.md +6 -3
  38. package/bundled/{trailheads → docs/trailheads}/from-mkdocs.md +8 -5
  39. package/bundled/{trailheads → docs/trailheads}/from-zola.md +6 -3
  40. package/bundled/docs/trailheads.md +38 -0
  41. package/bundled/docs/where-values-come-from.md +57 -0
  42. package/bundled/ssqch.d.ts +10 -3
  43. package/lib/assets.js +18 -12
  44. package/lib/{chunk-7PWCYHTJ.js → chunk-26SHWRC6.js} +6 -8
  45. package/lib/{chunk-GUKSZ2XM.js → chunk-3BQJY6GF.js} +4 -6
  46. package/lib/{chunk-TICWN55Z.js → chunk-3LODFCCH.js} +2 -3
  47. package/lib/{chunk-TVU3OPPK.js → chunk-3NDFUMV2.js} +3 -3
  48. package/lib/{chunk-YTHQBMDJ.js → chunk-6OUT5VFK.js} +3 -6
  49. package/lib/{chunk-HXCLCXRT.js → chunk-6RSZV5O2.js} +5 -3
  50. package/lib/{chunk-4Q6WMTER.js → chunk-7JGYYAKI.js} +1 -1
  51. package/lib/{chunk-MI6EJWA2.js → chunk-BT3NVQOD.js} +1 -1
  52. package/lib/{chunk-DDV6JEC2.js → chunk-BXARVN5Z.js} +1 -1
  53. package/lib/{chunk-RNJFPFXE.js → chunk-CXRHH5P5.js} +5 -6
  54. package/lib/{chunk-HPXAZ2HU.js → chunk-DNWA7WNO.js} +1 -1
  55. package/lib/{chunk-SURPOAW7.js → chunk-DTSTCVRX.js} +8 -9
  56. package/lib/{chunk-7SD7K567.js → chunk-DUGGZ4EE.js} +1 -1
  57. package/lib/{chunk-7XLK2GEG.js → chunk-ERNVEZOK.js} +1 -1
  58. package/lib/{chunk-3A647I3N.js → chunk-FYRC2HBU.js} +4 -6
  59. package/lib/{chunk-IJWHOFRP.js → chunk-FYU22VDK.js} +12 -13
  60. package/lib/{chunk-II5DEH3Q.js → chunk-FZGJUJAL.js} +5 -7
  61. package/lib/{chunk-BEGC7YP6.js → chunk-G67W2FTJ.js} +9 -11
  62. package/lib/{chunk-7RDRZHJD.js → chunk-HMVYNV6M.js} +13 -15
  63. package/lib/{chunk-DELWRJAO.js → chunk-HNG372DW.js} +143 -74
  64. package/lib/{chunk-47P4YREZ.js → chunk-II7ZRIAC.js} +11 -13
  65. package/lib/{chunk-NCWFYT74.js → chunk-IOXCGMSF.js} +5 -7
  66. package/lib/{chunk-GRWMGC7D.js → chunk-JFPLNHEQ.js} +2410 -2298
  67. package/lib/{chunk-LPHNACE4.js → chunk-LU73FTIR.js} +10 -11
  68. package/lib/{chunk-D2XE2GTY.js → chunk-LYPKL524.js} +9 -10
  69. package/lib/{chunk-NKXEPHRZ.js → chunk-MDB3D3LP.js} +106 -4
  70. package/lib/{chunk-CZ4XQC56.js → chunk-MDG5A4NI.js} +15 -13
  71. package/lib/{chunk-SXMJ52IK.js → chunk-MUYWL4ZX.js} +58 -19
  72. package/lib/{chunk-R7K3D5W5.js → chunk-P2TRR6XK.js} +83 -24
  73. package/lib/{chunk-SF4I6Z7S.js → chunk-R2YGC3VE.js} +2 -3
  74. package/lib/{chunk-76NTVE34.js → chunk-RFNLZM7W.js} +2 -4
  75. package/lib/{chunk-3K3ANWZ2.js → chunk-X7C6GFUM.js} +4 -4
  76. package/lib/{chunk-XMXBHXZR.js → chunk-XR7GFL4B.js} +12 -13
  77. package/lib/{chunk-NNUKIGOO.js → chunk-ZZBHBLDB.js} +16 -18
  78. package/lib/cli.js +25 -25
  79. package/lib/elements.js +10 -12
  80. package/lib/image.js +10 -11
  81. package/lib/links.js +13 -15
  82. package/lib/minify.js +9 -10
  83. package/lib/redirects.js +11 -13
  84. package/lib/rss.js +22 -22
  85. package/lib/sass.js +10 -12
  86. package/lib/sitemap.js +10 -12
  87. package/lib/ssqch.js +4 -5
  88. package/package.json +2 -2
  89. package/types/index.d.ts +9 -2
  90. package/types/rss.d.ts +1 -1
  91. package/bundled/README.md +0 -1314
  92. package/lib/chunk-VJWQSYEG.js +0 -119
  93. package/lib/{chunk-DELWRJAO.js.LEGAL.txt → chunk-HNG372DW.js.LEGAL.txt} +0 -0
  94. package/lib/{chunk-GRWMGC7D.js.LEGAL.txt → chunk-JFPLNHEQ.js.LEGAL.txt} +3 -3
@@ -2,17 +2,17 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  budget
5
- } from "./chunk-7XLK2GEG.js";
5
+ } from "./chunk-ERNVEZOK.js";
6
6
  import {
7
7
  bytes,
8
8
  count
9
- } from "./chunk-NKXEPHRZ.js";
9
+ } from "./chunk-MDB3D3LP.js";
10
10
  import {
11
11
  VERSION
12
12
  } from "./chunk-AD3HAW3W.js";
13
13
  import {
14
14
  CONFIG_FILES
15
- } from "./chunk-DDV6JEC2.js";
15
+ } from "./chunk-BXARVN5Z.js";
16
16
  import {
17
17
  WebAssembly,
18
18
  applyMarkdownOptions,
@@ -22,14 +22,14 @@ import {
22
22
  probeFile,
23
23
  site,
24
24
  undecodable
25
- } from "./chunk-NCWFYT74.js";
25
+ } from "./chunk-IOXCGMSF.js";
26
26
  import {
27
27
  closest
28
28
  } from "./chunk-FVZ5JBRI.js";
29
29
  import {
30
30
  globProblem,
31
31
  globToRegExp
32
- } from "./chunk-HPXAZ2HU.js";
32
+ } from "./chunk-DNWA7WNO.js";
33
33
  import {
34
34
  describeThrown,
35
35
  hookModules,
@@ -37,7 +37,7 @@ import {
37
37
  loadedFiles,
38
38
  settle,
39
39
  watchSettle
40
- } from "./chunk-76NTVE34.js";
40
+ } from "./chunk-RFNLZM7W.js";
41
41
  import {
42
42
  charCount,
43
43
  firstChars,
@@ -51,7 +51,9 @@ import {
51
51
  TomlError,
52
52
  aliasUsed,
53
53
  bail,
54
+ compareText,
54
55
  context,
56
+ displayPath,
55
57
  error,
56
58
  find,
57
59
  isPlainObject,
@@ -59,17 +61,13 @@ import {
59
61
  otherGenerator,
60
62
  progress,
61
63
  readToml,
64
+ realPath,
65
+ shown,
62
66
  toDate,
63
67
  tomlReason,
64
68
  warn,
65
69
  warning
66
- } from "./chunk-GRWMGC7D.js";
67
- import {
68
- compareText,
69
- displayPath,
70
- realPath,
71
- shown
72
- } from "./chunk-VJWQSYEG.js";
70
+ } from "./chunk-JFPLNHEQ.js";
73
71
  import {
74
72
  __require
75
73
  } from "./chunk-I3PS26CI.js";
@@ -556,6 +554,11 @@ function normalizeBase(base) {
556
554
  return trimmed.replace(/\/+$/, "");
557
555
  }
558
556
  var fromRoot = (url) => url.startsWith("/") && !url.startsWith("//");
557
+ function withBaseOnce(base, url) {
558
+ if (base === "" || !fromRoot(url)) return url;
559
+ const rest = url.slice(base.length);
560
+ return url.startsWith(base) && (rest === "" || /^[/?#]/.test(rest)) ? url : base + url;
561
+ }
559
562
  function withBase(base, url) {
560
563
  return base === "" || !fromRoot(url) ? url : base + url;
561
564
  }
@@ -1987,6 +1990,20 @@ function publish(cache, out, a = statOf(cache)) {
1987
1990
  linkOrCopy(cache, out);
1988
1991
  return Number(a?.size ?? statOf(out)?.size ?? 0);
1989
1992
  }
1993
+ async function publishLater(cache, out) {
1994
+ try {
1995
+ await fs4.promises.link(cache, out);
1996
+ } catch {
1997
+ const [there, source] = [statOf(out), statOf(cache)];
1998
+ if (there && source && there.size === source.size) return void 0;
1999
+ try {
2000
+ await fs4.promises.copyFile(cache, out);
2001
+ } catch (e) {
2002
+ return new Error(`copying ${out} into the output: ${e.message}`);
2003
+ }
2004
+ }
2005
+ return void 0;
2006
+ }
1990
2007
  function linkOrCopy(from, to) {
1991
2008
  try {
1992
2009
  fs4.linkSync(from, to);
@@ -2017,6 +2034,14 @@ var Queue = class {
2017
2034
  constructor(limit) {
2018
2035
  this.limit = limit;
2019
2036
  }
2037
+ /** For tests: nothing starts until the answer is called, then as many as there are places. */
2038
+ hold() {
2039
+ this.running += this.limit;
2040
+ return () => {
2041
+ this.running -= this.limit;
2042
+ for (let i = 0; i < this.limit; i++) this.waiting.shift()?.();
2043
+ };
2044
+ }
2020
2045
  /** `task`, once a place is free; `first` goes ahead of everything waiting (the files of a source already decoded, so its pixels are let go of soon). */
2021
2046
  async run(task, first = false) {
2022
2047
  if (this.running >= this.limit) await new Promise((resolve) => first ? this.waiting.unshift(resolve) : this.waiting.push(resolve));
@@ -2046,9 +2071,13 @@ var ImageProcessor = class {
2046
2071
  sizes = /* @__PURE__ */ new Map();
2047
2072
  /** Everything this build is still waiting for, settled or not. */
2048
2073
  pending = [];
2074
+ /** Cached files being linked into the output (publishLater), each resolving to its error if it failed. */
2075
+ placing = [];
2049
2076
  /** Each source with files still to make that something points at, by its path: one that fails fails the build. */
2050
2077
  watched = /* @__PURE__ */ new Map();
2051
2078
  generated = 0;
2079
+ /** GIFs and SVGs copied as they are (no encode, and no cache), apart from `generated`. */
2080
+ copied = 0;
2052
2081
  pruned = 0;
2053
2082
  converted = /* @__PURE__ */ new Set();
2054
2083
  used = /* @__PURE__ */ new Set();
@@ -2059,6 +2088,10 @@ var ImageProcessor = class {
2059
2088
  warned = /* @__PURE__ */ new Set();
2060
2089
  queue = new Queue(ENCODES);
2061
2090
  settings;
2091
+ /** For tests: holds every encode back until the answer is called, so a test can change what they'll find first. */
2092
+ holdEncodesForTest() {
2093
+ return this.queue.hold();
2094
+ }
2062
2095
  /** The settings as image names hold them (`legacySettings`). */
2063
2096
  named;
2064
2097
  constructor(options) {
@@ -2094,6 +2127,7 @@ var ImageProcessor = class {
2094
2127
  this.made.clear();
2095
2128
  this.sizes.clear();
2096
2129
  this.pending = [];
2130
+ this.placing = [];
2097
2131
  this.watched.clear();
2098
2132
  this.used.clear();
2099
2133
  this.sources.clear();
@@ -2101,6 +2135,7 @@ var ImageProcessor = class {
2101
2135
  this.timings = [];
2102
2136
  if (this.options.hashCache) this.hashes.load(path4.join(root, CACHE_FILE));
2103
2137
  this.generated = 0;
2138
+ this.copied = 0;
2104
2139
  this.pruned = 0;
2105
2140
  }
2106
2141
  /**
@@ -2116,6 +2151,10 @@ var ImageProcessor = class {
2116
2151
  this.pending = [];
2117
2152
  await Promise.all(waiting2);
2118
2153
  }
2154
+ const placing = this.placing;
2155
+ this.placing = [];
2156
+ const failed2 = (await Promise.all(placing)).find((e) => e !== void 0);
2157
+ if (failed2) throw new BuildError(`images: ${failed2.message}`);
2119
2158
  const root = this.context().root;
2120
2159
  const failures = [...this.watched.values()].filter((w) => w.error !== void 0).map((w) => ({ ...w, file: shown(root, w.src) })).sort((a, b) => a.file < b.file ? -1 : a.file > b.file ? 1 : 0);
2121
2160
  if (!failures.length) return;
@@ -2311,8 +2350,9 @@ var ImageProcessor = class {
2311
2350
  const e = entry(srcFormat, w, h, w > 0 ? `${id}-${w}.${srcFormat}` : `${id}.${srcFormat}`);
2312
2351
  const t = mtimeOf(e.path);
2313
2352
  if (!(t !== void 0 && (sourceTime === void 0 || t >= sourceTime)) && !this.files.has(e.path)) {
2314
- fs4.copyFileSync(src, e.path);
2315
- this.generated++;
2353
+ const out = e.path;
2354
+ this.placing.push(fs4.promises.copyFile(src, out).then(() => void 0, (err) => new Error(`copying ${src} to ${out}: ${err.message}`)));
2355
+ this.copied++;
2316
2356
  }
2317
2357
  this.files.set(e.path, "reused");
2318
2358
  return { formats: /* @__PURE__ */ new Map([[srcFormat, [e]]]), auto: formats.includes("auto") ? srcFormat : void 0, ready: READY };
@@ -2358,11 +2398,18 @@ var ImageProcessor = class {
2358
2398
  const cached = s.file !== s.e.path;
2359
2399
  if (s.found === "cache") {
2360
2400
  if (cached) {
2361
- try {
2362
- this.sizes.set(s.e.path, publish(s.file, s.e.path, s.stat));
2363
- } catch (e) {
2364
- throw new Error(`copying ${s.e.path} into the output: ${e.message}`);
2401
+ const [a, b] = [s.stat, statOf(s.e.path)];
2402
+ if (!(a && b && a.size === b.size && b.mtimeNs >= a.mtimeNs)) {
2403
+ if (b) {
2404
+ try {
2405
+ fs4.rmSync(s.e.path, { force: true });
2406
+ } catch (e) {
2407
+ throw new Error(`copying ${s.e.path} into the output: ${e.message}`);
2408
+ }
2409
+ }
2410
+ this.placing.push(publishLater(s.file, s.e.path));
2365
2411
  }
2412
+ this.sizes.set(s.e.path, Number(a?.size ?? 0));
2366
2413
  } else this.sizes.set(s.e.path, Number(s.stat.size));
2367
2414
  } else {
2368
2415
  try {
@@ -2556,8 +2603,9 @@ var ImageProcessor = class {
2556
2603
  let size = 0;
2557
2604
  for (const p of this.used) size += this.sizes.get(p) ?? fs4.statSync(p, { throwIfNoEntry: false })?.size ?? 0;
2558
2605
  const sources = this.sources.size;
2559
- const encoded = Math.min(this.generated, this.used.size);
2560
- let line = `${count(this.used.size)} file${this.used.size === 1 ? "" : "s"} from ${count(sources)} source${sources === 1 ? "" : "s"}, ${bytes(size)}: ${count(encoded)} encoded, ${count(this.used.size - encoded)} reused`;
2606
+ const copied = Math.min(this.copied, this.used.size);
2607
+ const encoded = Math.min(this.generated, this.used.size - copied);
2608
+ let line = `${count(this.used.size)} file${this.used.size === 1 ? "" : "s"} from ${count(sources)} source${sources === 1 ? "" : "s"}, ${bytes(size)}: ${count(encoded)} encoded, ${copied > 0 ? `${count(copied)} copied, ` : ""}${count(this.used.size - encoded - copied)} reused`;
2561
2609
  if (this.converted.size > 0) line += ` (${count(this.converted.size)} source${this.converted.size === 1 ? "" : "s"} converted to sRGB)`;
2562
2610
  if (this.options.prune) line += `, ${count(this.pruned)} pruned`;
2563
2611
  return line;
@@ -3287,6 +3335,8 @@ function emptyConfig(options) {
3287
3335
  serving: options.serving ?? false,
3288
3336
  quiet: options.quiet ?? false,
3289
3337
  verbose: options.verbose ?? false,
3338
+ profile: options.profile ?? false,
3339
+ definedIn: /* @__PURE__ */ new Map(),
3290
3340
  input: ".",
3291
3341
  output: "_site",
3292
3342
  includes: "_includes",
@@ -3302,6 +3352,7 @@ function emptyConfig(options) {
3302
3352
  bundles: false,
3303
3353
  strict: false,
3304
3354
  lastModified: null,
3355
+ dateFallback: "file",
3305
3356
  timeZone: null,
3306
3357
  base: "",
3307
3358
  serveRun: [],
@@ -3309,6 +3360,7 @@ function emptyConfig(options) {
3309
3360
  schemas: [],
3310
3361
  themes: [],
3311
3362
  passthrough: [],
3363
+ renamedCopies: /* @__PURE__ */ new Map(),
3312
3364
  filters: /* @__PURE__ */ new Map(),
3313
3365
  siteFilters: /* @__PURE__ */ new Set(),
3314
3366
  globalData: [],
@@ -3393,7 +3445,7 @@ async function loadJsData(file, root) {
3393
3445
  throw new BuildError(`${name}: ${describeThrown(e, root)}`);
3394
3446
  }
3395
3447
  }
3396
- var SETTINGS = ["dirs", "templateFormats", "markdownEngine", "htmlEngine", "markdown", "deepMerge", "leaveNoTrace", "clean", "ignore", "bundles", "strict", "lastModified", "timeZone", "base", "schemas", "theme", "serve", "budgets"];
3448
+ var SETTINGS = ["dirs", "templateFormats", "markdownEngine", "htmlEngine", "markdown", "deepMerge", "leaveNoTrace", "clean", "ignore", "bundles", "strict", "lastModified", "dateFallback", "timeZone", "base", "schemas", "theme", "serve", "budgets"];
3397
3449
  var PARTS = ["data", "filters", "collections", "transforms", "engines", "passthrough", "watch", "beforeBuild", "afterBuild", "plugins"];
3398
3450
  var CORE_ENGINES = ["edge", "md", "html", "txt"];
3399
3451
  var DIRS = ["input", "output", "includes", "layouts", "data"];
@@ -3481,6 +3533,9 @@ async function loadJs(config, file) {
3481
3533
  const earlier = names[kind].get(key);
3482
3534
  if (earlier) fail(`${where}: ${singular} "${key}" is already defined by ${earlier}`);
3483
3535
  names[kind].set(key, where);
3536
+ ops.push(() => {
3537
+ config.definedIn.set(`${kind}.${key}`, where);
3538
+ });
3484
3539
  };
3485
3540
  const functions = (kind, singular, value, where, add) => {
3486
3541
  if (value === void 0) return;
@@ -3639,8 +3694,8 @@ async function loadJs(config, file) {
3639
3694
  if (typeof out !== "string") throw new TypeError(`engine "${key}" returned ${out === void 0 ? "undefined" : typeof out} for ${inputPath}; return the rendered text`);
3640
3695
  return out;
3641
3696
  };
3642
- const run = (source, data, inputPath) => {
3643
- const out = render.call(engine, source, data);
3697
+ const run = (source, data, inputPath, context2) => {
3698
+ const out = render.call(engine, source, data, context2);
3644
3699
  return out instanceof Promise ? watchSettle(out).then((v) => checked(v, inputPath)) : checked(out, inputPath);
3645
3700
  };
3646
3701
  ops.push(() => {
@@ -3741,6 +3796,9 @@ function applySettings(config, settings) {
3741
3796
  else if (modified === "git" || modified === "file") config.lastModified = modified;
3742
3797
  else if (typeof modified === "string") bail(`lastModified must be "git", "file" or false, not "${modified}"`);
3743
3798
  else if (modified !== void 0 && modified !== null && modified !== false) bail(`lastModified must be "git", "file" or false, not ${typeof modified}`);
3799
+ const fallback = settings.dateFallback;
3800
+ if (fallback === "git" || fallback === "file") config.dateFallback = fallback;
3801
+ else if (fallback !== void 0 && fallback !== null) bail(`dateFallback must be "git" or "file", not ${typeof fallback === "string" ? `"${fallback}"` : typeof fallback}`);
3744
3802
  if (settings.timeZone !== void 0 && settings.timeZone !== null) config.timeZone = checkTimeZone(settings.timeZone);
3745
3803
  if (typeof settings.base === "string") config.base = normalizeBase(settings.base);
3746
3804
  else if (settings.base !== void 0 && settings.base !== null) bail(`base must be a URL path like "/docs/", not ${typeof settings.base}`);
@@ -3930,6 +3988,7 @@ function applyToml(config, file) {
3930
3988
 
3931
3989
  export {
3932
3990
  rewriteHtml,
3991
+ withBaseOnce,
3933
3992
  withBase,
3934
3993
  cssWithBase,
3935
3994
  rewriteBase,
@@ -9,9 +9,8 @@ import {
9
9
  starterEngines,
10
10
  starterFiles,
11
11
  write
12
- } from "./chunk-YTHQBMDJ.js";
13
- import "./chunk-GRWMGC7D.js";
14
- import "./chunk-VJWQSYEG.js";
12
+ } from "./chunk-6OUT5VFK.js";
13
+ import "./chunk-JFPLNHEQ.js";
15
14
  import "./chunk-I3PS26CI.js";
16
15
  export {
17
16
  DEFAULT_ENGINE,
@@ -1,11 +1,9 @@
1
1
  import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
- BuildError
5
- } from "./chunk-GRWMGC7D.js";
6
- import {
4
+ BuildError,
7
5
  realPath
8
- } from "./chunk-VJWQSYEG.js";
6
+ } from "./chunk-JFPLNHEQ.js";
9
7
 
10
8
  // src/modules.ts
11
9
  import fs from "node:fs";
@@ -2,20 +2,20 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  starterEngines
5
- } from "./chunk-YTHQBMDJ.js";
5
+ } from "./chunk-6OUT5VFK.js";
6
6
  import {
7
7
  DEFAULTS,
8
8
  configOptions
9
- } from "./chunk-R7K3D5W5.js";
9
+ } from "./chunk-P2TRR6XK.js";
10
10
  import {
11
11
  VERSION
12
12
  } from "./chunk-AD3HAW3W.js";
13
13
  import {
14
14
  CONFIG_FILES
15
- } from "./chunk-DDV6JEC2.js";
15
+ } from "./chunk-BXARVN5Z.js";
16
16
  import {
17
17
  red
18
- } from "./chunk-GRWMGC7D.js";
18
+ } from "./chunk-JFPLNHEQ.js";
19
19
 
20
20
  // src/commands/capabilities.ts
21
21
  var MODULE_EXPORTS = [
@@ -2,25 +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-DELWRJAO.js";
6
- import "./chunk-4Q6WMTER.js";
7
- import "./chunk-3A647I3N.js";
8
- import "./chunk-II5DEH3Q.js";
9
- import "./chunk-R7K3D5W5.js";
10
- import "./chunk-7XLK2GEG.js";
5
+ } from "./chunk-HNG372DW.js";
6
+ import "./chunk-7JGYYAKI.js";
7
+ import "./chunk-FYRC2HBU.js";
8
+ import "./chunk-FZGJUJAL.js";
9
+ import "./chunk-P2TRR6XK.js";
10
+ import "./chunk-ERNVEZOK.js";
11
11
  import {
12
12
  count
13
- } from "./chunk-NKXEPHRZ.js";
13
+ } from "./chunk-MDB3D3LP.js";
14
14
  import "./chunk-AD3HAW3W.js";
15
- import "./chunk-DDV6JEC2.js";
16
- import "./chunk-NCWFYT74.js";
15
+ import "./chunk-BXARVN5Z.js";
16
+ import "./chunk-IOXCGMSF.js";
17
17
  import "./chunk-FVZ5JBRI.js";
18
- import "./chunk-HPXAZ2HU.js";
18
+ import "./chunk-DNWA7WNO.js";
19
19
  import "./chunk-UU43WIZG.js";
20
- import "./chunk-76NTVE34.js";
20
+ import "./chunk-RFNLZM7W.js";
21
21
  import "./chunk-CMUWRPSQ.js";
22
- import "./chunk-GRWMGC7D.js";
23
- import "./chunk-VJWQSYEG.js";
22
+ import "./chunk-JFPLNHEQ.js";
24
23
  import "./chunk-I3PS26CI.js";
25
24
 
26
25
  // src/commands/sighting.ts
@@ -2,36 +2,36 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  isAsset
5
- } from "./chunk-GUKSZ2XM.js";
5
+ } from "./chunk-3BQJY6GF.js";
6
6
  import {
7
7
  build
8
- } from "./chunk-DELWRJAO.js";
9
- import "./chunk-4Q6WMTER.js";
10
- import "./chunk-3A647I3N.js";
11
- import "./chunk-II5DEH3Q.js";
8
+ } from "./chunk-HNG372DW.js";
9
+ import "./chunk-7JGYYAKI.js";
10
+ import "./chunk-FYRC2HBU.js";
11
+ import "./chunk-FZGJUJAL.js";
12
12
  import {
13
13
  filesRead
14
14
  } from "./chunk-3NYSSA2C.js";
15
15
  import {
16
16
  fileHash
17
- } from "./chunk-MI6EJWA2.js";
18
- import "./chunk-R7K3D5W5.js";
19
- import "./chunk-7XLK2GEG.js";
17
+ } from "./chunk-BT3NVQOD.js";
18
+ import "./chunk-P2TRR6XK.js";
19
+ import "./chunk-ERNVEZOK.js";
20
20
  import {
21
21
  summary
22
- } from "./chunk-NKXEPHRZ.js";
22
+ } from "./chunk-MDB3D3LP.js";
23
23
  import "./chunk-AD3HAW3W.js";
24
24
  import {
25
25
  dirsOf
26
- } from "./chunk-DDV6JEC2.js";
27
- import "./chunk-NCWFYT74.js";
26
+ } from "./chunk-BXARVN5Z.js";
27
+ import "./chunk-IOXCGMSF.js";
28
28
  import "./chunk-FVZ5JBRI.js";
29
- import "./chunk-HPXAZ2HU.js";
29
+ import "./chunk-DNWA7WNO.js";
30
30
  import "./chunk-UU43WIZG.js";
31
31
  import {
32
32
  describeThrown,
33
33
  loadedFiles
34
- } from "./chunk-76NTVE34.js";
34
+ } from "./chunk-RFNLZM7W.js";
35
35
  import "./chunk-CMUWRPSQ.js";
36
36
  import {
37
37
  BuildError,
@@ -40,16 +40,14 @@ import {
40
40
  aliasesKnown,
41
41
  aliasesUsed,
42
42
  describe,
43
+ isInside,
43
44
  messageOf,
44
45
  printError,
45
- red
46
- } from "./chunk-GRWMGC7D.js";
47
- import {
48
- isInside,
49
46
  realPath,
47
+ red,
50
48
  relative,
51
49
  slashes
52
- } from "./chunk-VJWQSYEG.js";
50
+ } from "./chunk-JFPLNHEQ.js";
53
51
  import "./chunk-I3PS26CI.js";
54
52
 
55
53
  // src/serve/build-process.ts
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-MI6EJWA2.js";
5
+ } from "./chunk-BT3NVQOD.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-YTHQBMDJ.js";
14
+ } from "./chunk-6OUT5VFK.js";
15
15
  import {
16
16
  VERSION
17
17
  } from "./chunk-AD3HAW3W.js";
@@ -20,10 +20,10 @@ import {
20
20
  parseEnvironment,
21
21
  shownDir,
22
22
  shownOutput
23
- } from "./chunk-DDV6JEC2.js";
23
+ } from "./chunk-BXARVN5Z.js";
24
24
  import {
25
25
  describeThrown
26
- } from "./chunk-76NTVE34.js";
26
+ } from "./chunk-RFNLZM7W.js";
27
27
  import {
28
28
  prettyJson,
29
29
  quoted
@@ -42,16 +42,14 @@ import {
42
42
  printError,
43
43
  progress,
44
44
  red,
45
+ relative,
45
46
  setQuiet,
46
47
  takeWarnings,
47
48
  toJson,
48
49
  toJson2,
49
50
  warn,
50
51
  warning
51
- } from "./chunk-GRWMGC7D.js";
52
- import {
53
- relative
54
- } from "./chunk-VJWQSYEG.js";
52
+ } from "./chunk-JFPLNHEQ.js";
55
53
  import "./chunk-I3PS26CI.js";
56
54
 
57
55
  // src/cli.ts
@@ -75,7 +73,7 @@ var COMMANDS = [
75
73
  {
76
74
  name: "build",
77
75
  about: "Build the site (default)",
78
- options: [FORMAT],
76
+ options: [FORMAT, { long: "profile", help: "Also time every page, template, layout, engine, filter, transform, data file, collection and hook, and list the slowest" }],
79
77
  positionals: [],
80
78
  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
79
  },
@@ -318,23 +316,23 @@ async function main(argv) {
318
316
  `);
319
317
  return 1;
320
318
  }
321
- if (command === "import") return (await import("./chunk-47P4YREZ.js")).runImport(cli.positionals[0], cli.positionals[1] ?? ".", flag("write"));
319
+ if (command === "import") return (await import("./chunk-II7ZRIAC.js")).runImport(cli.positionals[0], cli.positionals[1] ?? ".", flag("write"));
322
320
  switch (command) {
323
321
  case "init":
324
- return (await import("./chunk-SF4I6Z7S.js")).runInit({ dir: cli.positionals[0] ?? ".", starter: value("starter") ?? "site", engine: value("engine") ?? DEFAULT_ENGINE, quiet: flag("quiet") });
322
+ return (await import("./chunk-R2YGC3VE.js")).runInit({ dir: cli.positionals[0] ?? ".", starter: value("starter") ?? "site", engine: value("engine") ?? DEFAULT_ENGINE, quiet: flag("quiet") });
325
323
  case "capabilities":
326
- return (await import("./chunk-LPHNACE4.js")).runCapabilities(format, CAPABILITY_ORDER);
324
+ return (await import("./chunk-LU73FTIR.js")).runCapabilities(format, CAPABILITY_ORDER);
327
325
  case "docs":
328
- return (await import("./chunk-SXMJ52IK.js")).runDocs(GRAMMAR, { query: cli.positionals, from: value("from"), format });
326
+ return (await import("./chunk-MUYWL4ZX.js")).runDocs(GRAMMAR, { query: cli.positionals, from: value("from"), format });
329
327
  case "sighting":
330
- return (await import("./chunk-XMXBHXZR.js")).runSighting(path.resolve(value("root") ?? "."));
328
+ return (await import("./chunk-XR7GFL4B.js")).runSighting(path.resolve(value("root") ?? "."));
331
329
  case "completions": {
332
330
  process.stdout.write(bundled(`completions/${cli.positionals[0]}`));
333
331
  return 0;
334
332
  }
335
333
  case "types": {
336
334
  routeConsole();
337
- return (await import("./chunk-D2XE2GTY.js")).runTypes({ root: value("root"), out: value("out") ?? "ssqch.d.ts" });
335
+ return (await import("./chunk-LYPKL524.js")).runTypes({ root: value("root"), out: value("out") ?? "ssqch.d.ts" });
338
336
  }
339
337
  }
340
338
  const many = (name) => Array.isArray(cli.options[name]) ? cli.options[name] : typeof cli.options[name] === "string" ? [cli.options[name]] : [];
@@ -360,15 +358,15 @@ async function main(argv) {
360
358
  const root = path.resolve(value("root") ?? ".");
361
359
  siteRoot = root;
362
360
  routeConsole();
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") });
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") });
364
362
  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
363
  if (serving) {
366
- if (building) return (await import("./chunk-NNUKIGOO.js")).runBuilder(building, makeConfig, root);
364
+ if (building) return (await import("./chunk-ZZBHBLDB.js")).runBuilder(building, makeConfig, root);
367
365
  const readyFile = value("ready-file") === void 0 ? void 0 : path.resolve(value("ready-file"));
368
366
  const options = { port: Number(value("port") ?? "8080"), readyFile, quiet: flag("quiet") };
369
367
  if (!flag("built")) {
370
368
  try {
371
- return await (await import("./chunk-CZ4XQC56.js")).serve(argv, options);
369
+ return await (await import("./chunk-MDG5A4NI.js")).serve(argv, options);
372
370
  } catch (e) {
373
371
  printError("error:", e, "build", new Locator(root));
374
372
  return 1;
@@ -382,7 +380,7 @@ async function main(argv) {
382
380
  return 1;
383
381
  }
384
382
  try {
385
- return await (await import("./chunk-CZ4XQC56.js")).serveBuilt(config2, options);
383
+ return await (await import("./chunk-MDG5A4NI.js")).serveBuilt(config2, options);
386
384
  } catch (e) {
387
385
  printError("error:", e, "build", locatorOf(config2));
388
386
  return 1;
@@ -411,9 +409,10 @@ async function main(argv) {
411
409
  await runFootprint(shownDir(config, config.output), shownOutput(config), top, format);
412
410
  return 0;
413
411
  }
414
- const [{ build }, { summary }] = await Promise.all([import("./chunk-IJWHOFRP.js"), import("./chunk-HXCLCXRT.js")]);
412
+ const [{ build }, { summary, profileText }] = await Promise.all([import("./chunk-FYU22VDK.js"), import("./chunk-6RSZV5O2.js")]);
415
413
  const report = await build(config);
416
414
  if (!config.quiet) process.stdout.write(summary(config, report));
415
+ if (report.profile) process.stdout.write(profileText(report.profile));
417
416
  return 0;
418
417
  } catch (e) {
419
418
  printError("error:", e, "build", locatorOf(config));
@@ -429,7 +428,7 @@ async function newPage(makeConfig, root, command) {
429
428
  return 1;
430
429
  }
431
430
  try {
432
- (await import("./chunk-BEGC7YP6.js")).runNew(config, command);
431
+ (await import("./chunk-G67W2FTJ.js")).runNew(config, command);
433
432
  return 0;
434
433
  } catch (e) {
435
434
  printError("error:", e, "build", locatorOf(config));
@@ -441,7 +440,7 @@ var checkFormat = (format) => {
441
440
  };
442
441
  async function runInspect(config, target, name, format) {
443
442
  checkFormat(format);
444
- const { field, fieldText, inspect, inspectionJson, inspectionText } = await import("./chunk-7RDRZHJD.js");
443
+ const { field, fieldText, inspect, inspectionJson, inspectionText } = await import("./chunk-HMVYNV6M.js");
445
444
  let report;
446
445
  try {
447
446
  report = await inspect(config, target);
@@ -461,7 +460,7 @@ async function runDiff(dirs, options) {
461
460
  const [before, after] = dirs;
462
461
  try {
463
462
  checkFormat(options.format);
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")]);
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")]);
465
464
  const ignore = options.ignore.map((pattern) => {
466
465
  try {
467
466
  return rustRegExp(pattern, "g");
@@ -493,7 +492,7 @@ async function runDiff(dirs, options) {
493
492
  }
494
493
  async function runFootprint(dir, shown, top, format) {
495
494
  checkFormat(format);
496
- const { footprintJson, footprintText, measure } = await import("./chunk-RNJFPFXE.js");
495
+ const { footprintJson, footprintText, measure } = await import("./chunk-CXRHH5P5.js");
497
496
  const measured = await measure(dir);
498
497
  if (format === "json") process.stdout.write(JSON.stringify(footprintJson(measured, shown, top), null, 2) + "\n");
499
498
  else process.stdout.write(footprintText(measured, shown, top));
@@ -517,7 +516,7 @@ async function buildJson(makeConfig, root, env) {
517
516
  const dirs = dirsOf(config);
518
517
  out.output = shownOutput(config);
519
518
  try {
520
- const report = await (await import("./chunk-IJWHOFRP.js")).build(config);
519
+ const report = await (await import("./chunk-FYU22VDK.js")).build(config);
521
520
  out.durationMs = ms(report.durationMs);
522
521
  out.pages = { written: report.pagesWritten, templates: report.templates, bytes: report.pageBytes, new: report.pagesNew ?? null, gone: report.pagesGone ?? null };
523
522
  out.copied = { files: report.filesCopied, unchanged: report.filesUnchanged, bytes: report.passthroughBytes };
@@ -526,6 +525,7 @@ async function buildJson(makeConfig, root, env) {
526
525
  out.written = report.written.map((file) => relative(dirs.output, file));
527
526
  out.summary = report.summary.map(([label, text]) => ({ label, value: text }));
528
527
  out.timings = report.timings.map(([phase, time]) => ({ phase, ms: ms(time) }));
528
+ 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
529
  errors = [];
530
530
  } catch (e) {
531
531
  errors = fromError(e, "build", locatorOf(config));