ssqch 0.10.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 (60) hide show
  1. package/bundled/completions/bash +1 -1
  2. package/bundled/completions/elvish +1 -0
  3. package/bundled/completions/fish +1 -0
  4. package/bundled/completions/powershell +1 -0
  5. package/bundled/completions/zsh +1 -0
  6. package/bundled/docs/agents.md +1 -1
  7. package/bundled/docs/build-summary.md +31 -1
  8. package/bundled/docs/configuring.md +1 -1
  9. package/bundled/docs/netlify.md +2 -2
  10. package/bundled/ssqch.d.ts +7 -2
  11. package/lib/assets.js +10 -12
  12. package/lib/{chunk-HDQ4SRWM.js → chunk-26SHWRC6.js} +6 -8
  13. package/lib/{chunk-2LEOPLTZ.js → chunk-3BQJY6GF.js} +3 -5
  14. package/lib/{chunk-JXZT5L7W.js → chunk-3LODFCCH.js} +2 -3
  15. package/lib/{chunk-7HXCQEGA.js → chunk-3NDFUMV2.js} +3 -3
  16. package/lib/{chunk-Y2ESFAAD.js → chunk-6OUT5VFK.js} +2 -4
  17. package/lib/{chunk-HXCLCXRT.js → chunk-6RSZV5O2.js} +5 -3
  18. package/lib/{chunk-4Q6WMTER.js → chunk-7JGYYAKI.js} +1 -1
  19. package/lib/{chunk-LAV3DEY4.js → chunk-BT3NVQOD.js} +1 -1
  20. package/lib/{chunk-DDV6JEC2.js → chunk-BXARVN5Z.js} +1 -1
  21. package/lib/{chunk-RVBNVGZV.js → chunk-CXRHH5P5.js} +5 -6
  22. package/lib/{chunk-NFJJKDRI.js → chunk-DNWA7WNO.js} +1 -1
  23. package/lib/{chunk-E5UB2YY7.js → chunk-DTSTCVRX.js} +8 -9
  24. package/lib/{chunk-HGJ5VWUR.js → chunk-DUGGZ4EE.js} +1 -1
  25. package/lib/{chunk-LCPSKHAV.js → chunk-ERNVEZOK.js} +1 -1
  26. package/lib/{chunk-CB6YFUXU.js → chunk-FYRC2HBU.js} +4 -6
  27. package/lib/{chunk-DW7VMJEZ.js → chunk-FYU22VDK.js} +12 -13
  28. package/lib/{chunk-N4O5MDIB.js → chunk-FZGJUJAL.js} +5 -7
  29. package/lib/{chunk-RKFZSVNF.js → chunk-G67W2FTJ.js} +9 -11
  30. package/lib/{chunk-DMVJ53SM.js → chunk-HMVYNV6M.js} +13 -15
  31. package/lib/{chunk-SRNLKWXL.js → chunk-HNG372DW.js} +91 -47
  32. package/lib/{chunk-ZM6TU2JB.js → chunk-II7ZRIAC.js} +11 -13
  33. package/lib/{chunk-5DNDSNTP.js → chunk-IOXCGMSF.js} +5 -7
  34. package/lib/{chunk-BGCBSQ4A.js → chunk-JFPLNHEQ.js} +136 -25
  35. package/lib/{chunk-NUUEOGLZ.js → chunk-LU73FTIR.js} +10 -11
  36. package/lib/{chunk-EEJDLCD3.js → chunk-LYPKL524.js} +9 -10
  37. package/lib/{chunk-NKXEPHRZ.js → chunk-MDB3D3LP.js} +106 -4
  38. package/lib/{chunk-SA5KSJ4Y.js → chunk-MDG5A4NI.js} +10 -12
  39. package/lib/{chunk-3HHRKG33.js → chunk-MUYWL4ZX.js} +11 -12
  40. package/lib/{chunk-QMA7CK7B.js → chunk-P2TRR6XK.js} +59 -23
  41. package/lib/{chunk-RJFWTW2Y.js → chunk-R2YGC3VE.js} +2 -3
  42. package/lib/{chunk-JWCCVTTR.js → chunk-RFNLZM7W.js} +2 -4
  43. package/lib/{chunk-3EPHKJEG.js → chunk-X7C6GFUM.js} +4 -4
  44. package/lib/{chunk-RM5Q3KFB.js → chunk-XR7GFL4B.js} +12 -13
  45. package/lib/{chunk-Q4LFTYK2.js → chunk-ZZBHBLDB.js} +16 -18
  46. package/lib/cli.js +25 -25
  47. package/lib/elements.js +10 -12
  48. package/lib/image.js +10 -11
  49. package/lib/links.js +10 -12
  50. package/lib/minify.js +9 -10
  51. package/lib/redirects.js +10 -12
  52. package/lib/rss.js +10 -11
  53. package/lib/sass.js +10 -12
  54. package/lib/sitemap.js +10 -12
  55. package/lib/ssqch.js +4 -5
  56. package/package.json +1 -1
  57. package/types/index.d.ts +7 -2
  58. package/lib/chunk-VJWQSYEG.js +0 -119
  59. /package/lib/{chunk-SRNLKWXL.js.LEGAL.txt → chunk-HNG372DW.js.LEGAL.txt} +0 -0
  60. /package/lib/{chunk-BGCBSQ4A.js.LEGAL.txt → chunk-JFPLNHEQ.js.LEGAL.txt} +0 -0
@@ -1,8 +1,105 @@
1
1
  import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
- import {
4
- realPath
5
- } from "./chunk-VJWQSYEG.js";
3
+
4
+ // src/paths.ts
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ var slashes = (p) => path.sep === "/" ? p : p.split(path.sep).join("/");
8
+ function displayPath(root, file) {
9
+ if (file === root) return "./";
10
+ return file.startsWith(root + path.sep) ? `./${slashes(file.slice(root.length + 1))}` : file;
11
+ }
12
+ var shown = (root, file) => displayPath(root, file).replace(/^\.\//, "");
13
+ var relative = (dir, file) => slashes(path.relative(dir, file));
14
+ var joinAsGiven = (base, rel) => path.isAbsolute(rel) || base === "" ? rel : /[\\/]$/.test(base) ? base + rel : base + path.sep + rel;
15
+ function parentAsGiven(p) {
16
+ const separators = path.sep === "/" ? "/" : "\\/";
17
+ let end = p.length;
18
+ while (end > 1 && separators.includes(p[end - 1])) end--;
19
+ let at = end - 1;
20
+ while (at >= 0 && !separators.includes(p[at])) at--;
21
+ if (at < 0) return "";
22
+ let parent = at;
23
+ while (parent > 0 && separators.includes(p[parent - 1])) parent--;
24
+ return parent === 0 ? p.slice(0, 1) : p.slice(0, parent);
25
+ }
26
+ var realPath = (p) => {
27
+ try {
28
+ return fs.realpathSync.native(p);
29
+ } catch {
30
+ return p;
31
+ }
32
+ };
33
+ var isFile = (p) => fs.statSync(p, { throwIfNoEntry: false })?.isFile() ?? false;
34
+ var isDir = (p) => fs.statSync(p, { throwIfNoEntry: false })?.isDirectory() ?? false;
35
+ var isInside = (dir, file) => file === dir || file.startsWith(dir.endsWith(path.sep) ? dir : dir + path.sep);
36
+ function compareText(a, b) {
37
+ const n = Math.min(a.length, b.length);
38
+ for (let i2 = 0; i2 < n; i2++) {
39
+ let x = a.charCodeAt(i2), y = b.charCodeAt(i2);
40
+ if (x === y) continue;
41
+ if (x >= 55296 && y >= 55296) {
42
+ x = x >= 57344 ? x - 2048 : x + 8192;
43
+ y = y >= 57344 ? y - 2048 : y + 8192;
44
+ }
45
+ return x - y;
46
+ }
47
+ return a.length - b.length;
48
+ }
49
+ function comparePaths(a, b) {
50
+ if (a === b) return 0;
51
+ const x = a.split(path.sep), y = b.split(path.sep);
52
+ const n = Math.min(x.length, y.length);
53
+ for (let i2 = 0; i2 < n; i2++) {
54
+ if (x[i2] === y[i2]) continue;
55
+ return compareText(x[i2], y[i2]);
56
+ }
57
+ return x.length - y.length;
58
+ }
59
+ function walkFiles(dir) {
60
+ const out = [];
61
+ const walk = (d) => {
62
+ let entries;
63
+ try {
64
+ entries = fs.readdirSync(d, { withFileTypes: true });
65
+ } catch {
66
+ return;
67
+ }
68
+ for (const entry of entries) {
69
+ const p = path.join(d, entry.name);
70
+ if (entry.isDirectory()) walk(p);
71
+ else if (entry.isFile()) out.push(p);
72
+ }
73
+ };
74
+ walk(dir);
75
+ return out;
76
+ }
77
+ function readFollowing(dir, above, onError) {
78
+ const out = [];
79
+ const here = above[above.length - 1] ?? realPath(dir);
80
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
81
+ const file = path.join(dir, entry.name);
82
+ if (!entry.isSymbolicLink()) {
83
+ out.push({ name: entry.name, path: file, isDirectory: entry.isDirectory(), isFile: entry.isFile(), real: path.join(here, entry.name) });
84
+ continue;
85
+ }
86
+ const stat = fs.statSync(file, { throwIfNoEntry: false });
87
+ if (!stat) {
88
+ onError({ path: file, broken: true });
89
+ continue;
90
+ }
91
+ const real = realPath(file);
92
+ if (stat.isDirectory()) {
93
+ const at = above.indexOf(real);
94
+ if (at !== -1) {
95
+ onError({ path: file, loop: above[at] });
96
+ continue;
97
+ }
98
+ }
99
+ out.push({ name: entry.name, path: file, isDirectory: stat.isDirectory(), isFile: stat.isFile(), real });
100
+ }
101
+ return out;
102
+ }
6
103
 
7
104
  // node_modules/js-yaml/dist/js-yaml.mjs
8
105
  function isNothing(subject) {
@@ -3387,16 +3484,16 @@ function parse(toml, options = {}) {
3387
3484
  var HAS_WELLFORMED = !!"".isWellFormed;
3388
3485
 
3389
3486
  // src/data.ts
3487
+ import fs4 from "node:fs";
3488
+ import path4 from "node:path";
3489
+
3490
+ // src/diagnostics.ts
3390
3491
  import fs3 from "node:fs";
3391
3492
  import path3 from "node:path";
3392
3493
 
3393
- // src/diagnostics.ts
3494
+ // src/equivalents.ts
3394
3495
  import fs2 from "node:fs";
3395
3496
  import path2 from "node:path";
3396
-
3397
- // src/equivalents.ts
3398
- import fs from "node:fs";
3399
- import path from "node:path";
3400
3497
  var SERVE = "ssqch's dev server is `ssqch serve`: it builds, watches and reloads the browser.";
3401
3498
  var TABLE = [
3402
3499
  // Commands.
@@ -3498,15 +3595,15 @@ var OTHER_CONFIGS = [
3498
3595
  [".vitepress/config.js", "VitePress", null, "from-component-frameworks.md"]
3499
3596
  ];
3500
3597
  function otherGenerator(root) {
3501
- const isFile = (file2) => fs.statSync(path.join(root, file2), { throwIfNoEntry: false })?.isFile() ?? false;
3598
+ const isFile2 = (file2) => fs2.statSync(path2.join(root, file2), { throwIfNoEntry: false })?.isFile() ?? false;
3502
3599
  const read = (file2) => {
3503
3600
  try {
3504
- return fs.readFileSync(path.join(root, file2), "utf8");
3601
+ return fs2.readFileSync(path2.join(root, file2), "utf8");
3505
3602
  } catch {
3506
3603
  return void 0;
3507
3604
  }
3508
3605
  };
3509
- let found = OTHER_CONFIGS.find(([file2]) => isFile(file2));
3606
+ let found = OTHER_CONFIGS.find(([file2]) => isFile2(file2));
3510
3607
  if (!found) {
3511
3608
  const toml = read("config.toml");
3512
3609
  if (toml?.includes("base_url")) found = ["config.toml", "Zola", "zola", "from-zola.md"];
@@ -3627,20 +3724,20 @@ var Locator = class {
3627
3724
  name = name.replace(/^["'`]+|["'`]+$/g, "");
3628
3725
  if (name === "") return void 0;
3629
3726
  for (const dir of this.dirs) {
3630
- let file = path2.resolve(dir, name);
3631
- if (!fs2.statSync(file, { throwIfNoEntry: false })?.isFile()) continue;
3727
+ let file = path3.resolve(dir, name);
3728
+ if (!fs3.statSync(file, { throwIfNoEntry: false })?.isFile()) continue;
3632
3729
  file = realPath(file);
3633
- const rel = path2.relative(realPath(this.root), file);
3634
- const outside = rel === ".." || rel.startsWith(`..${path2.sep}`) || path2.isAbsolute(rel);
3635
- const shown = (outside ? file : rel).split(path2.sep).join("/");
3636
- return { path: file, shown };
3730
+ const rel = path3.relative(realPath(this.root), file);
3731
+ const outside = rel === ".." || rel.startsWith(`..${path3.sep}`) || path3.isAbsolute(rel);
3732
+ const shown2 = (outside ? file : rel).split(path3.sep).join("/");
3733
+ return { path: file, shown: shown2 };
3637
3734
  }
3638
3735
  return void 0;
3639
3736
  }
3640
3737
  };
3641
3738
  function linesBeforeBody(file) {
3642
3739
  try {
3643
- const src = fs2.readFileSync(file, "utf8");
3740
+ const src = fs3.readFileSync(file, "utf8");
3644
3741
  const { body } = parseFrontMatter(src);
3645
3742
  return src.slice(0, src.length - body.length).split("\n").length - 1;
3646
3743
  } catch {
@@ -3728,8 +3825,8 @@ function fileLines(message, at) {
3728
3825
  function frames(e, fallback, at) {
3729
3826
  const found = [];
3730
3827
  for (const problem of fromError(e, fallback, at)) {
3731
- const shown = frame(problem, at);
3732
- if (shown !== void 0 && !found.includes(shown)) found.push(shown);
3828
+ const shown2 = frame(problem, at);
3829
+ if (shown2 !== void 0 && !found.includes(shown2)) found.push(shown2);
3733
3830
  if (found.length === 3) break;
3734
3831
  }
3735
3832
  return found.length ? found.join("\n\n") : void 0;
@@ -3739,7 +3836,7 @@ function frame(problem, at) {
3739
3836
  if (problem.file === void 0) return void 0;
3740
3837
  let source;
3741
3838
  try {
3742
- source = fs2.readFileSync(path2.resolve(at.root, problem.file), "utf8");
3839
+ source = fs3.readFileSync(path3.resolve(at.root, problem.file), "utf8");
3743
3840
  } catch {
3744
3841
  return void 0;
3745
3842
  }
@@ -4239,7 +4336,7 @@ function tomlDateText(d) {
4239
4336
  return d.toISOString().replace(/\.(\d*?)0+(?=$|Z|[+-]\d\d:\d\d$)/, (_, digits) => digits ? `.${digits}` : "");
4240
4337
  }
4241
4338
  function readText(file) {
4242
- return decodeText(fs3.readFileSync(file));
4339
+ return decodeText(fs4.readFileSync(file));
4243
4340
  }
4244
4341
  var utf8 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
4245
4342
  function decodeText(bytes) {
@@ -4251,7 +4348,7 @@ function decodeText(bytes) {
4251
4348
  }
4252
4349
  var stripBom = (text) => text.charCodeAt(0) === 65279 ? text.slice(1) : text;
4253
4350
  function loadStaticDataFile(file) {
4254
- const ext = path3.extname(file).slice(1);
4351
+ const ext = path4.extname(file).slice(1);
4255
4352
  const read = () => {
4256
4353
  try {
4257
4354
  return readText(file);
@@ -4287,7 +4384,7 @@ function loadStaticDataFile(file) {
4287
4384
  }
4288
4385
  var STATIC_DATA_EXTENSIONS = ["json", "yaml", "yml", "toml"];
4289
4386
  function loadDataFile(file, extra) {
4290
- const ext = path3.extname(file).slice(1);
4387
+ const ext = path4.extname(file).slice(1);
4291
4388
  if (STATIC_DATA_EXTENSIONS.includes(ext)) return loadStaticDataFile(file);
4292
4389
  const load2 = extra.get(ext);
4293
4390
  return load2 ? load2(file) : NOT_DATA;
@@ -4384,6 +4481,20 @@ function utcMs(y, mo, d, h = "0", mi = "0", s = "0", fraction) {
4384
4481
  }
4385
4482
 
4386
4483
  export {
4484
+ slashes,
4485
+ displayPath,
4486
+ shown,
4487
+ relative,
4488
+ joinAsGiven,
4489
+ parentAsGiven,
4490
+ realPath,
4491
+ isFile,
4492
+ isDir,
4493
+ isInside,
4494
+ compareText,
4495
+ comparePaths,
4496
+ walkFiles,
4497
+ readFollowing,
4387
4498
  jsYaml,
4388
4499
  TomlError,
4389
4500
  buildTime,
@@ -4433,4 +4544,4 @@ export {
4433
4544
  describe,
4434
4545
  printError
4435
4546
  };
4436
- /*! For license information please see chunk-BGCBSQ4A.js.LEGAL.txt */
4547
+ /*! For license information please see chunk-JFPLNHEQ.js.LEGAL.txt */
@@ -5,21 +5,20 @@ import {
5
5
  capabilities,
6
6
  modules,
7
7
  runCapabilities
8
- } from "./chunk-3EPHKJEG.js";
9
- import "./chunk-Y2ESFAAD.js";
10
- import "./chunk-QMA7CK7B.js";
11
- import "./chunk-LCPSKHAV.js";
12
- import "./chunk-NKXEPHRZ.js";
8
+ } from "./chunk-X7C6GFUM.js";
9
+ import "./chunk-6OUT5VFK.js";
10
+ import "./chunk-P2TRR6XK.js";
11
+ import "./chunk-ERNVEZOK.js";
12
+ import "./chunk-MDB3D3LP.js";
13
13
  import "./chunk-AD3HAW3W.js";
14
- import "./chunk-DDV6JEC2.js";
15
- import "./chunk-5DNDSNTP.js";
14
+ import "./chunk-BXARVN5Z.js";
15
+ import "./chunk-IOXCGMSF.js";
16
16
  import "./chunk-FVZ5JBRI.js";
17
- import "./chunk-NFJJKDRI.js";
17
+ import "./chunk-DNWA7WNO.js";
18
18
  import "./chunk-UU43WIZG.js";
19
- import "./chunk-JWCCVTTR.js";
19
+ import "./chunk-RFNLZM7W.js";
20
20
  import "./chunk-CMUWRPSQ.js";
21
- import "./chunk-BGCBSQ4A.js";
22
- import "./chunk-VJWQSYEG.js";
21
+ import "./chunk-JFPLNHEQ.js";
23
22
  import "./chunk-I3PS26CI.js";
24
23
  export {
25
24
  MODULE_EXPORTS,
@@ -3,26 +3,25 @@ const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  types,
5
5
  write
6
- } from "./chunk-Y2ESFAAD.js";
6
+ } from "./chunk-6OUT5VFK.js";
7
7
  import {
8
8
  loadConfig,
9
9
  schemaTypes
10
- } from "./chunk-QMA7CK7B.js";
11
- import "./chunk-LCPSKHAV.js";
12
- import "./chunk-NKXEPHRZ.js";
10
+ } from "./chunk-P2TRR6XK.js";
11
+ import "./chunk-ERNVEZOK.js";
12
+ import "./chunk-MDB3D3LP.js";
13
13
  import "./chunk-AD3HAW3W.js";
14
- import "./chunk-DDV6JEC2.js";
15
- import "./chunk-5DNDSNTP.js";
14
+ import "./chunk-BXARVN5Z.js";
15
+ import "./chunk-IOXCGMSF.js";
16
16
  import "./chunk-FVZ5JBRI.js";
17
- import "./chunk-NFJJKDRI.js";
17
+ import "./chunk-DNWA7WNO.js";
18
18
  import "./chunk-UU43WIZG.js";
19
- import "./chunk-JWCCVTTR.js";
19
+ import "./chunk-RFNLZM7W.js";
20
20
  import "./chunk-CMUWRPSQ.js";
21
21
  import {
22
22
  messageOf,
23
23
  red
24
- } from "./chunk-BGCBSQ4A.js";
25
- import "./chunk-VJWQSYEG.js";
24
+ } from "./chunk-JFPLNHEQ.js";
26
25
  import "./chunk-I3PS26CI.js";
27
26
 
28
27
  // src/commands/types.ts
@@ -3,19 +3,96 @@ const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  dirsOf,
5
5
  shownOutput
6
- } from "./chunk-DDV6JEC2.js";
6
+ } from "./chunk-BXARVN5Z.js";
7
7
  import {
8
8
  FIRST_SITING,
9
9
  LEFT_NO_TRACE,
10
10
  RECOVERED
11
11
  } from "./chunk-UU43WIZG.js";
12
12
  import {
13
- relative
14
- } from "./chunk-VJWQSYEG.js";
13
+ relative,
14
+ warning
15
+ } from "./chunk-JFPLNHEQ.js";
15
16
 
16
17
  // src/report.ts
17
18
  import fs from "node:fs";
18
19
  import path from "node:path";
20
+
21
+ // src/profile.ts
22
+ var SLOW_MS = 1e3;
23
+ var KINDS = ["pages", "templates", "layouts", "engines", "filters", "transforms", "data", "collections", "hooks"];
24
+ var SINGULAR = { pages: "page", templates: "template", layouts: "layout", engines: "template engine", filters: "filter", transforms: "transform", data: "data", collections: "collection", hooks: "hook" };
25
+ var isPromise = (v) => typeof v?.then === "function";
26
+ var Profile = class {
27
+ /** `--profile`: time everything. Otherwise only the site's own functions, for `slow-call`. */
28
+ detailed;
29
+ /** The page being rendered, which a slow call is said to be working on (pages render one at a time). */
30
+ at;
31
+ stats = new Map(KINDS.map((k) => [k, /* @__PURE__ */ new Map()]));
32
+ constructor(detailed) {
33
+ this.detailed = detailed;
34
+ }
35
+ /** Records one call of `name`, which took `ms`. */
36
+ add(kind, name, ms, own, from, at = this.at, async = false) {
37
+ if (!this.detailed && !(own && ms >= SLOW_MS)) return;
38
+ const of = this.stats.get(kind);
39
+ let stat = of.get(name);
40
+ if (!stat) of.set(name, stat = { calls: 0, ms: 0, own, from, slowCalls: 0, async: false });
41
+ stat.calls++;
42
+ if (async) stat.async = true;
43
+ stat.ms += ms;
44
+ if (ms >= SLOW_MS && stat.slowCalls++ === 0) [stat.firstSlow, stat.firstSlowAt] = [ms, at];
45
+ }
46
+ /** Runs `call` and records its time, until it returns or, for a promise, settles. */
47
+ time(kind, name, own, call, from) {
48
+ const at = this.at;
49
+ const start = performance.now();
50
+ const out = call();
51
+ if (isPromise(out)) {
52
+ const done = () => this.add(kind, name, performance.now() - start, own, from, at, true);
53
+ out.then(done, done);
54
+ } else this.add(kind, name, performance.now() - start, own, from, at);
55
+ return out;
56
+ }
57
+ /** `fn`, timed whenever it's called (with the `this` it's called with: Nunjucks passes its context). */
58
+ wrap(kind, name, fn, own, from) {
59
+ const profile = this;
60
+ return function(...args) {
61
+ return profile.time(kind, name, own, () => fn.apply(this, args), from);
62
+ };
63
+ }
64
+ /** Whether a function of this kind is timed: every one with `--profile`, the site's own without. */
65
+ times(own) {
66
+ return this.detailed || own;
67
+ }
68
+ /** The `slow-call` warnings: one for each of the site's own functions with a call of a second or more. */
69
+ slowCalls() {
70
+ const out = [];
71
+ for (const kind of KINDS) {
72
+ for (const [name, s] of this.stats.get(kind)) {
73
+ if (!s.own || s.slowCalls === 0) continue;
74
+ const what = kind === "hooks" ? name : `${SINGULAR[kind]} \`${name}\``;
75
+ const from = s.from ? ` (from ${s.from})` : "";
76
+ const at = s.firstSlowAt ? ` working on ${s.firstSlowAt}` : "";
77
+ const more = s.slowCalls > 1 ? `, the first of ${s.slowCalls} calls that took over a second` : "";
78
+ out.push(warning("slow-call", `${what}${from} took ${seconds(s.firstSlow)}${at}${more}. \`ssqch build --profile\` shows where a build's time goes`));
79
+ }
80
+ }
81
+ return out;
82
+ }
83
+ /** Every kind's list, slowest first (by total time, then name). Empty without `--profile`. */
84
+ report() {
85
+ const out = {};
86
+ for (const kind of KINDS) {
87
+ const list = this.detailed ? [...this.stats.get(kind)].map(([name, s]) => ({ name, calls: s.calls, ms: s.ms, async: s.async })) : [];
88
+ out[kind] = list.sort((a, b) => b.ms - a.ms || (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
89
+ }
90
+ return out;
91
+ }
92
+ };
93
+ var seconds = (ms) => `${(ms / 1e3).toFixed(1)} s`;
94
+
95
+ // src/report.ts
19
96
  function summary(config, report, recovered = false) {
20
97
  const dirs = dirsOf(config);
21
98
  const nothing = report.templates === 0 && report.drafts === 0 && report.pagesWritten === 0;
@@ -126,11 +203,36 @@ function fixed(v, digits) {
126
203
  if (last % 2 === 0) return down;
127
204
  return v.toFixed(digits);
128
205
  }
206
+ var PROFILE_TOP = 10;
207
+ function profileText(profile) {
208
+ const titles = { pages: "Pages", templates: "Templates (pages)", layouts: "Layouts (renders)", engines: "Template engines (renders)", filters: "Filters (calls)", transforms: "Transforms (pages)", data: "Data", collections: "Collections", hooks: "Hooks" };
209
+ const withCalls = /* @__PURE__ */ new Set(["templates", "layouts", "engines", "filters", "transforms"]);
210
+ let out = "Profile: where the time went, slowest first (a call's time includes the calls it makes)\n";
211
+ if (KINDS.some((kind) => profile[kind].some((e) => e.async))) out += "Async ones are timed until they settle, and overlap: their totals can add up to more than the build took\n";
212
+ for (const kind of KINDS) {
213
+ const list = profile[kind];
214
+ if (!list.length) continue;
215
+ out += ` ${titles[kind]}
216
+ `;
217
+ const shown = list.slice(0, PROFILE_TOP);
218
+ const width = Math.max(...shown.map((e) => duration(e.ms).length));
219
+ for (const e of shown) {
220
+ const notes = [...withCalls.has(kind) ? [count(e.calls)] : [], ...e.async ? ["async"] : []];
221
+ out += ` ${duration(e.ms).padStart(width)} ${e.name}${notes.length ? ` (${notes.join(", ")})` : ""}
222
+ `;
223
+ }
224
+ if (list.length > PROFILE_TOP) out += ` ...and ${count(list.length - PROFILE_TOP)} more (--format json lists them all)
225
+ `;
226
+ }
227
+ return out;
228
+ }
129
229
 
130
230
  export {
231
+ Profile,
131
232
  summary,
132
233
  count,
133
234
  bytes,
134
235
  duration,
135
- fixed
236
+ fixed,
237
+ profileText
136
238
  };
@@ -6,18 +6,18 @@ import {
6
6
  fingerprint,
7
7
  isAsset,
8
8
  sameStamps
9
- } from "./chunk-2LEOPLTZ.js";
9
+ } from "./chunk-3BQJY6GF.js";
10
10
  import {
11
11
  commandLine
12
- } from "./chunk-4Q6WMTER.js";
12
+ } from "./chunk-7JGYYAKI.js";
13
13
  import {
14
14
  Builder,
15
15
  stopBuilders
16
- } from "./chunk-LAV3DEY4.js";
16
+ } from "./chunk-BT3NVQOD.js";
17
17
  import {
18
18
  CONFIG_FILES,
19
19
  dirsOf
20
- } from "./chunk-DDV6JEC2.js";
20
+ } from "./chunk-BXARVN5Z.js";
21
21
  import {
22
22
  closestPath
23
23
  } from "./chunk-FVZ5JBRI.js";
@@ -29,19 +29,17 @@ import {
29
29
  import {
30
30
  BuildError,
31
31
  aliasesUsed,
32
+ isInside,
32
33
  messageOf,
33
34
  progress,
34
- red,
35
- warn,
36
- warning
37
- } from "./chunk-BGCBSQ4A.js";
38
- import {
39
- isInside,
40
35
  realPath,
36
+ red,
41
37
  relative,
42
38
  slashes,
43
- walkFiles
44
- } from "./chunk-VJWQSYEG.js";
39
+ walkFiles,
40
+ warn,
41
+ warning
42
+ } from "./chunk-JFPLNHEQ.js";
45
43
  import "./chunk-I3PS26CI.js";
46
44
 
47
45
  // src/serve/server.ts
@@ -2,10 +2,10 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  modules
5
- } from "./chunk-3EPHKJEG.js";
5
+ } from "./chunk-X7C6GFUM.js";
6
6
  import {
7
7
  BUILTIN_FILTERS
8
- } from "./chunk-CB6YFUXU.js";
8
+ } from "./chunk-FYRC2HBU.js";
9
9
  import {
10
10
  longHelp
11
11
  } from "./chunk-F65YUXZ7.js";
@@ -14,23 +14,23 @@ import {
14
14
  bundled,
15
15
  bundledNames,
16
16
  types
17
- } from "./chunk-Y2ESFAAD.js";
17
+ } from "./chunk-6OUT5VFK.js";
18
18
  import {
19
19
  configOptions
20
- } from "./chunk-QMA7CK7B.js";
21
- import "./chunk-LCPSKHAV.js";
22
- import "./chunk-NKXEPHRZ.js";
20
+ } from "./chunk-P2TRR6XK.js";
21
+ import "./chunk-ERNVEZOK.js";
22
+ import "./chunk-MDB3D3LP.js";
23
23
  import {
24
24
  VERSION
25
25
  } from "./chunk-AD3HAW3W.js";
26
- import "./chunk-DDV6JEC2.js";
27
- import "./chunk-5DNDSNTP.js";
26
+ import "./chunk-BXARVN5Z.js";
27
+ import "./chunk-IOXCGMSF.js";
28
28
  import {
29
29
  closest
30
30
  } from "./chunk-FVZ5JBRI.js";
31
- import "./chunk-NFJJKDRI.js";
31
+ import "./chunk-DNWA7WNO.js";
32
32
  import "./chunk-UU43WIZG.js";
33
- import "./chunk-JWCCVTTR.js";
33
+ import "./chunk-RFNLZM7W.js";
34
34
  import "./chunk-CMUWRPSQ.js";
35
35
  import {
36
36
  OTHER_CONFIGS,
@@ -38,8 +38,7 @@ import {
38
38
  jsYaml,
39
39
  red,
40
40
  toJson
41
- } from "./chunk-BGCBSQ4A.js";
42
- import "./chunk-VJWQSYEG.js";
41
+ } from "./chunk-JFPLNHEQ.js";
43
42
  import "./chunk-I3PS26CI.js";
44
43
 
45
44
  // src/commands/docs.ts