ssqch 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/bundled/completions/bash +61 -15
  2. package/bundled/completions/elvish +27 -12
  3. package/bundled/completions/fish +35 -23
  4. package/bundled/completions/powershell +29 -12
  5. package/bundled/completions/zsh +39 -19
  6. package/bundled/docs/agents.md +11 -0
  7. package/bundled/docs/comparing-builds.md +37 -5
  8. package/bundled/docs/configuring.md +30 -5
  9. package/bundled/docs/field-guide.md +1 -1
  10. package/bundled/docs/github-pages.md +1 -1
  11. package/bundled/docs/index.md +1 -1
  12. package/bundled/docs/known-gaps.md +1 -1
  13. package/bundled/docs/markdown.md +63 -5
  14. package/bundled/docs/multilingual.md +20 -3
  15. package/bundled/docs/nav.yml +1 -0
  16. package/bundled/docs/netlify.md +2 -2
  17. package/bundled/docs/plugins.md +4 -4
  18. package/bundled/docs/seo.md +39 -1
  19. package/bundled/docs/template-languages.md +6 -4
  20. package/bundled/docs/templates.md +3 -3
  21. package/bundled/docs/trailheads/from-eleventy.md +25 -13
  22. package/bundled/docs/trailheads/from-hugo.md +103 -0
  23. package/bundled/docs/trailheads/from-jekyll.md +49 -15
  24. package/bundled/docs/trailheads/from-mkdocs.md +54 -9
  25. package/bundled/docs/trailheads/from-zola.md +2 -2
  26. package/bundled/docs/trailheads.md +22 -5
  27. package/bundled/docs/where-values-come-from.md +1 -1
  28. package/bundled/mkdocs/404.jinja +6 -0
  29. package/bundled/ssqch.d.ts +71 -16
  30. package/lib/assets.js +10 -9
  31. package/lib/{chunk-MUYWL4ZX.js → chunk-2L3HR67O.js} +71 -18
  32. package/lib/{chunk-ERNVEZOK.js → chunk-2QTJTEBV.js} +1 -1
  33. package/lib/{chunk-CXRHH5P5.js → chunk-3HZZY3Y7.js} +5 -5
  34. package/lib/{chunk-G67W2FTJ.js → chunk-3K237XAX.js} +9 -8
  35. package/lib/{chunk-6RSZV5O2.js → chunk-443ZQLVX.js} +3 -3
  36. package/lib/{chunk-ZZBHBLDB.js → chunk-5ELAUHRL.js} +18 -16
  37. package/lib/{chunk-MDG5A4NI.js → chunk-A75EVUJX.js} +5 -5
  38. package/lib/{chunk-JFPLNHEQ.js → chunk-AIMEXBTK.js} +28 -5
  39. package/lib/{chunk-6OUT5VFK.js → chunk-B5E27PLU.js} +10 -39
  40. package/lib/{chunk-R2YGC3VE.js → chunk-CMJ7X5WW.js} +3 -2
  41. package/lib/{chunk-MDB3D3LP.js → chunk-ERAIEV3O.js} +2 -2
  42. package/lib/{chunk-DTSTCVRX.js → chunk-FCM3NYFR.js} +11 -8
  43. package/lib/{chunk-X7C6GFUM.js → chunk-GJNIQAIH.js} +8 -8
  44. package/lib/{chunk-FYRC2HBU.js → chunk-GLJQ4C76.js} +39 -18
  45. package/lib/{chunk-BXARVN5Z.js → chunk-GS5B3CBW.js} +1 -1
  46. package/lib/chunk-H5K2ZE7B.js +219 -0
  47. package/lib/{chunk-DNWA7WNO.js → chunk-HFSWUTXX.js} +1 -1
  48. package/lib/{chunk-7JGYYAKI.js → chunk-HWW5NCVJ.js} +1 -1
  49. package/lib/{chunk-BT3NVQOD.js → chunk-I3HYKEEW.js} +1 -1
  50. package/lib/{chunk-RFNLZM7W.js → chunk-IOBC665M.js} +1 -1
  51. package/lib/chunk-JC54PHIT.js +7992 -0
  52. package/lib/{chunk-3BQJY6GF.js → chunk-KCF2Z6N7.js} +1 -1
  53. package/lib/{chunk-HMVYNV6M.js → chunk-KZZS4W2V.js} +14 -12
  54. package/lib/{chunk-XR7GFL4B.js → chunk-LJOURBYT.js} +14 -12
  55. package/lib/chunk-OQGXZYZS.js +45 -0
  56. package/lib/chunk-OSBEH67S.js +6296 -0
  57. package/lib/{chunk-FYU22VDK.js → chunk-QJ5ZFTML.js} +14 -12
  58. package/lib/{chunk-LU73FTIR.js → chunk-QLUTNR37.js} +11 -10
  59. package/lib/{chunk-DUGGZ4EE.js → chunk-RBNPBTDP.js} +1 -1
  60. package/lib/{chunk-F65YUXZ7.js → chunk-RIAOXEXC.js} +10 -4
  61. package/lib/chunk-RVXGUMFI.js +21 -0
  62. package/lib/{chunk-FZGJUJAL.js → chunk-RYIWYWRQ.js} +3 -3
  63. package/lib/{chunk-LYPKL524.js → chunk-RZYAIX2R.js} +12 -10
  64. package/lib/{chunk-3NDFUMV2.js → chunk-V2FSMOFX.js} +3 -3
  65. package/lib/{chunk-26SHWRC6.js → chunk-X2GAVYV2.js} +524 -72
  66. package/lib/chunk-XS4EJSEK.js +279 -0
  67. package/lib/chunk-YCOTX2VM.js +37 -0
  68. package/lib/{chunk-P2TRR6XK.js → chunk-Z44IAMNG.js} +85 -16
  69. package/lib/chunk-Z5OP43HU.js +2945 -0
  70. package/lib/{chunk-3LODFCCH.js → chunk-ZINLHOX4.js} +2 -2
  71. package/lib/{chunk-HNG372DW.js → chunk-ZR3JYLFB.js} +814 -12347
  72. package/lib/cli.js +78 -37
  73. package/lib/elements.js +10 -9
  74. package/lib/image.js +11 -10
  75. package/lib/links.js +10 -9
  76. package/lib/minify.js +71 -12
  77. package/lib/redirects.js +10 -9
  78. package/lib/rss.js +13 -10
  79. package/lib/sass.js +13 -243
  80. package/lib/sitemap.js +18 -15
  81. package/lib/ssqch.js +6 -4
  82. package/package.json +1 -1
  83. package/types/index.d.ts +52 -11
  84. package/types/minify.d.ts +15 -3
  85. package/types/sass.d.ts +2 -0
  86. package/types/sitemap.d.ts +2 -2
  87. package/wasm/markdown.wasm +0 -0
  88. package/wasm/minify.wasm +0 -0
  89. package/wasm/sass.wasm +0 -0
  90. package/lib/chunk-II7ZRIAC.js +0 -1285
  91. package/lib/chunk-IOXCGMSF.js +0 -1539
  92. /package/lib/{chunk-JFPLNHEQ.js.LEGAL.txt → chunk-AIMEXBTK.js.LEGAL.txt} +0 -0
  93. /package/lib/{chunk-HNG372DW.js.LEGAL.txt → chunk-ZR3JYLFB.js.LEGAL.txt} +0 -0
@@ -3544,13 +3544,15 @@ var TABLE = [
3544
3544
  // Front-matter keys that can't be a site's own.
3545
3545
  { word: "eleventyComputed", kind: "frontMatter", alias: true, from: ["Eleventy"], ssqch: "computed", say: "ssqch's name is `computed`.", more: "ssqch docs computed" },
3546
3546
  { word: "eleventyExcludeFromCollections", kind: "frontMatter", alias: true, from: ["Eleventy"], ssqch: "excludeFromCollections", say: "ssqch's name is `excludeFromCollections`.", more: "ssqch docs excludeFromCollections" },
3547
- { word: "eleventyNavigation", kind: "frontMatter", alias: false, from: ["Eleventy"], ssqch: "nav", say: "ssqch's own navigation (`pagesTree` and `navTree`) reads `nav`, so these pages aren't in it. Templates and filters that read `eleventyNavigation` (eleventy-navigation's `findNavigationEntries`) still get it as it is.", more: "ssqch docs nav" },
3547
+ { word: "eleventyNavigation", kind: "frontMatter", alias: false, from: ["Eleventy"], ssqch: "nav", say: 'ssqch\'s own navigation (`pagesTree` and `navTree`) reads `nav`, so these pages aren\'t in it: rename it to `nav` (the same `key`, `parent`, `order` and `title`), and `collections.all | eleventyNavigation: "Feature"` is `pagesTree(collections.all, { root: "Feature" })`. Templates and filters that read `eleventyNavigation` (eleventy-navigation\'s `findNavigationEntries`) still get it as it is.', more: "ssqch docs nav" },
3548
3548
  { word: "templateEngineOverride", kind: "frontMatter", alias: true, from: ["Eleventy"], ssqch: "render", say: "ssqch's name is `render`, a list: render: [njk, md].", more: "ssqch docs render" },
3549
3549
  { word: "redirect_from", kind: "frontMatter", alias: true, from: ["Jekyll"], ssqch: "aliases", say: 'ssqch\'s name is `aliases`; `redirectsPlugin()` from "ssqch/redirects" writes the redirects.', more: "ssqch docs aliases" },
3550
3550
  { word: "published", kind: "frontMatter", alias: false, from: ["Jekyll"], ssqch: "draft", say: "`published: false` doesn't hold a page back in ssqch, so it's published: use `draft: true`.", more: "ssqch docs draft" },
3551
3551
  // Filters.
3552
3552
  { word: "url", kind: "filter", alias: true, from: ["Eleventy"], ssqch: "base", say: 'It returns the URL as it is: the build adds `base` to every URL from the site\'s root, so `href="/about/"` needs no filter (use `withBase()` outside HTML attributes).', more: "ssqch docs base" },
3553
3553
  { word: "relative_url", kind: "filter", alias: true, from: ["Jekyll"], ssqch: "base", say: 'It returns the URL as it is: the build adds `base` to every URL from the site\'s root, so `href="/about/"` needs no filter (use `withBase()` outside HTML attributes).', more: "ssqch docs base" },
3554
+ { word: "getPreviousCollectionItem", kind: "filter", alias: true, from: ["Eleventy"], ssqch: "navPager", say: "`collection | getPreviousCollectionItem(page)` works: it's `navPager(collection, page.url).previous`, which gives `previous` and `next` at once.", more: "ssqch docs navPager" },
3555
+ { word: "getNextCollectionItem", kind: "filter", alias: true, from: ["Eleventy"], ssqch: "navPager", say: "`collection | getNextCollectionItem(page)` works: it's `navPager(collection, page.url).next`, which gives `previous` and `next` at once.", more: "ssqch docs navPager" },
3554
3556
  { word: "slug", kind: "filter", alias: false, from: ["Eleventy"], ssqch: "slugify", say: "ssqch's is `slugify`, which differs: Eleventy's `slug` (the `slugify` npm package) keeps `.` and some punctuation, so `Node.js` is `node.js` there and `node-js` in ssqch. To keep old URLs, define `slug` in `filters` with that package: slug: (s) => slugify(String(s), { lower: true }).", more: "ssqch docs slugify" },
3555
3557
  { word: "absolute_url", kind: "filter", alias: false, from: ["Jekyll"], ssqch: "absoluteUrl", say: '`absoluteUrl(url, base)` comes with `rssPlugin()` from "ssqch/rss".', more: "ssqch docs absoluteUrl" },
3556
3558
  { word: "markdownify", kind: "filter", alias: true, from: ["Jekyll", "Hugo"], ssqch: "markdown", say: 'ssqch\'s function is `markdown(text)` (or `markdown(text, "inline")`).', more: "ssqch docs markdown" },
@@ -3614,9 +3616,9 @@ function otherGenerator(root) {
3614
3616
  }
3615
3617
  }
3616
3618
  if (!found) return void 0;
3617
- const [file, generator, importer] = found;
3619
+ const [file, generator] = found;
3618
3620
  const docs = `\`ssqch docs --from ${generator.toLowerCase()}\` says what maps to what`;
3619
- const next = importer ? `\`ssqch import ${importer}\` drafts one from it, and ${docs}` : `\`ssqch init\` starts one, and ${docs}`;
3621
+ const next = `\`ssqch scout\` lists what moving it takes and drafts a config (\`--write-draft\`), and ${docs}`;
3620
3622
  const article = /^[AEIOU]/.test(generator) ? "an" : "a";
3621
3623
  return `this folder has ${article} ${generator} config (${file}) and no ssqch.config.js, so ssqch builds it with its own defaults. ${next}.`;
3622
3624
  }
@@ -3935,6 +3937,7 @@ var isPlainObject = (v) => {
3935
3937
  const proto = Object.getPrototypeOf(v);
3936
3938
  return proto === Object.prototype || proto === null;
3937
3939
  };
3940
+ var frontMatterSettings = { trimAfter: false };
3938
3941
  function parseFrontMatter(src) {
3939
3942
  let format;
3940
3943
  let fence;
@@ -3963,7 +3966,7 @@ function parseFrontMatter(src) {
3963
3966
  const next = newline === -1 ? rest.length : newline + 1;
3964
3967
  if (rest.slice(offset, next).trimEnd() === fence) {
3965
3968
  const text = rest.slice(0, offset);
3966
- const body = rest.slice(next);
3969
+ const body = frontMatterSettings.trimAfter ? rest.slice(next).replace(/^(?:[ \t]*\r?\n)+/, "") : rest.slice(next);
3967
3970
  if (format === "json") {
3968
3971
  let value;
3969
3972
  try {
@@ -3985,6 +3988,15 @@ function parseFrontMatter(src) {
3985
3988
  try {
3986
3989
  return { data: parseYaml(text), body };
3987
3990
  } catch (e) {
3991
+ if (e instanceof jsYaml.YAMLException && /duplicated mapping key/.test(e.reason)) {
3992
+ try {
3993
+ const value = jsYaml.load(text, { schema: YAML_SCHEMA, json: true });
3994
+ const line = e.mark ? e.mark.line + 1 : 0;
3995
+ const key = e.mark ? /^\s*["']?([^"':]+)["']?\s*:/.exec(text.split("\n")[e.mark.line] ?? "")?.[1]?.trim() : void 0;
3996
+ return { data: frontMatterObject(value ?? {}, "YAML"), body, duplicate: { key: key ?? "", line } };
3997
+ } catch {
3998
+ }
3999
+ }
3988
4000
  throw new BuildError(`invalid YAML front matter: ${yamlReason(e)}`);
3989
4001
  }
3990
4002
  }
@@ -4440,6 +4452,7 @@ function toDate(value) {
4440
4452
  return void 0;
4441
4453
  }
4442
4454
  var RFC3339 = /^(\d{4})-(\d{2})-(\d{2})[Tt ](\d{2}):(\d{2}):(\d{2})(\.\d+)?([Zz]|[+-]\d{2}:\d{2})$/;
4455
+ var ZONED = /^(\d{4})-(\d{1,2})-(\d{1,2})[Tt ](\d{1,2}):(\d{2})(?::(\d{2})(\.\d+)?)? ?([Zz]|[+-]\d{2}:?\d{2}|UTC)$/;
4443
4456
  var DATE_ONLY = /^([+-]?\d{1,6})-(\d{1,2})-(\d{1,2})$/;
4444
4457
  var NAIVE = /^([+-]?\d{1,6})-(\d{1,2})-(\d{1,2})[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(\.\d+)?)?$/;
4445
4458
  function parseDate2(text) {
@@ -4456,6 +4469,14 @@ function parseDate2(text) {
4456
4469
  }
4457
4470
  return new Date(utc - offset);
4458
4471
  }
4472
+ m = ZONED.exec(s);
4473
+ if (m) {
4474
+ const utc = utcMs(m[1], m[2], m[3], m[4], m[5], m[6] ?? "0", m[7]);
4475
+ if (utc === void 0) return void 0;
4476
+ const zone = m[8].replace(":", "");
4477
+ const minutes = /^[Zz]|UTC$/.test(zone) ? 0 : Number(zone.slice(1, 3)) * 60 + Number(zone.slice(3, 5));
4478
+ return new Date(utc - (zone[0] === "-" ? -minutes : minutes) * 6e4);
4479
+ }
4459
4480
  m = DATE_ONLY.exec(s);
4460
4481
  if (m) {
4461
4482
  const utc = utcMs(m[1], m[2], m[3]);
@@ -4500,7 +4521,9 @@ export {
4500
4521
  buildTime,
4501
4522
  sourceDateEpoch,
4502
4523
  isPlainObject,
4524
+ frontMatterSettings,
4503
4525
  parseFrontMatter,
4526
+ parseYaml,
4504
4527
  tomlReason,
4505
4528
  readToml,
4506
4529
  setOwn,
@@ -4544,4 +4567,4 @@ export {
4544
4567
  describe,
4545
4568
  printError
4546
4569
  };
4547
- /*! For license information please see chunk-JFPLNHEQ.js.LEGAL.txt */
4570
+ /*! For license information please see chunk-AIMEXBTK.js.LEGAL.txt */
@@ -1,45 +1,19 @@
1
1
  import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
+ import {
4
+ bundled,
5
+ types
6
+ } from "./chunk-YCOTX2VM.js";
3
7
  import {
4
8
  joinAsGiven,
5
9
  parentAsGiven,
6
10
  red,
7
11
  slashes
8
- } from "./chunk-JFPLNHEQ.js";
12
+ } from "./chunk-AIMEXBTK.js";
9
13
 
10
14
  // src/commands/init.ts
11
- import fs2 from "node:fs";
12
- import path2 from "node:path";
13
-
14
- // src/bundled.ts
15
15
  import fs from "node:fs";
16
16
  import path from "node:path";
17
- import { fileURLToPath } from "node:url";
18
- var PACKAGE = path.dirname(path.dirname(fileURLToPath(new URL("../src/bundled.ts", import.meta.url).href)));
19
- var BUNDLED = path.join(PACKAGE, "bundled");
20
- var FROM_REPOSITORY = [
21
- ["docs", "site/src/docs"]
22
- ];
23
- function bundledPath(rel) {
24
- const inPackage = path.join(BUNDLED, rel);
25
- if (fs.existsSync(inPackage)) return inPackage;
26
- for (const [prefix, original] of FROM_REPOSITORY) {
27
- if (rel === prefix || rel.startsWith(`${prefix}/`)) return path.join(PACKAGE, "../..", original + rel.slice(prefix.length));
28
- }
29
- return inPackage;
30
- }
31
- var cache = /* @__PURE__ */ new Map();
32
- function bundled(rel) {
33
- let text = cache.get(rel);
34
- if (text === void 0) cache.set(rel, text = fs.readFileSync(bundledPath(rel), "utf8"));
35
- return text;
36
- }
37
- function bundledNames(rel) {
38
- return fs.readdirSync(bundledPath(rel)).sort();
39
- }
40
- var types = () => bundled("ssqch.d.ts");
41
-
42
- // src/commands/init.ts
43
17
  var STARTER = [
44
18
  ["ssqch.config.js", "starter/ssqch.config.js"],
45
19
  ["src/_data/site.json", "starter/src/_data/site.json"],
@@ -148,18 +122,18 @@ function write(file, contents, shown = file) {
148
122
  const parent = parentAsGiven(shown);
149
123
  if (parent !== "") {
150
124
  try {
151
- fs2.mkdirSync(path2.dirname(file), { recursive: true });
125
+ fs.mkdirSync(path.dirname(file), { recursive: true });
152
126
  } catch (e) {
153
127
  throw new Error(`creating ${parent}: ${e.message}`);
154
128
  }
155
129
  }
156
130
  try {
157
- fs2.writeFileSync(file, contents);
131
+ fs.writeFileSync(file, contents);
158
132
  } catch (e) {
159
133
  throw new Error(`writing ${shown}: ${e.message}`);
160
134
  }
161
135
  }
162
- var isCurrentFolder = (dir) => dir.startsWith(".") && dir.split(path2.sep === "/" ? "/" : /[\\/]/).every((part) => part === "" || part === ".");
136
+ var isCurrentFolder = (dir) => dir.startsWith(".") && dir.split(path.sep === "/" ? "/" : /[\\/]/).every((part) => part === "" || part === ".");
163
137
  function runInit(options) {
164
138
  const { dir, starter, engine, quiet } = options;
165
139
  const written = [], skipped = [];
@@ -167,8 +141,8 @@ function runInit(options) {
167
141
  if (!STARTERS.includes(starter)) throw new Error(`--starter ${starter}: not a starter (use ${STARTERS.join(" or ")})`);
168
142
  if (!ENGINES.includes(engine)) throw new Error(`--engine ${engine}: not a starter engine (use ${ENGINES.join(", ")})`);
169
143
  for (const [rel, contents] of starterFiles(starter, engine)) {
170
- const file = path2.join(dir, rel);
171
- if (fs2.existsSync(file)) skipped.push(rel);
144
+ const file = path.join(dir, rel);
145
+ if (fs.existsSync(file)) skipped.push(rel);
172
146
  else {
173
147
  write(file, contents, joinAsGiven(dir, rel));
174
148
  written.push(rel);
@@ -194,9 +168,6 @@ Camp is set up. Next: ${isCurrentFolder(dir) ? "" : `cd ${dir} && `}ssqch serve,
194
168
  }
195
169
 
196
170
  export {
197
- bundled,
198
- bundledNames,
199
- types,
200
171
  STARTERS,
201
172
  ENGINES,
202
173
  DEFAULT_ENGINE,
@@ -9,8 +9,9 @@ import {
9
9
  starterEngines,
10
10
  starterFiles,
11
11
  write
12
- } from "./chunk-6OUT5VFK.js";
13
- import "./chunk-JFPLNHEQ.js";
12
+ } from "./chunk-B5E27PLU.js";
13
+ import "./chunk-YCOTX2VM.js";
14
+ import "./chunk-AIMEXBTK.js";
14
15
  import "./chunk-I3PS26CI.js";
15
16
  export {
16
17
  DEFAULT_ENGINE,
@@ -3,7 +3,7 @@ const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  dirsOf,
5
5
  shownOutput
6
- } from "./chunk-BXARVN5Z.js";
6
+ } from "./chunk-GS5B3CBW.js";
7
7
  import {
8
8
  FIRST_SITING,
9
9
  LEFT_NO_TRACE,
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  relative,
14
14
  warning
15
- } from "./chunk-JFPLNHEQ.js";
15
+ } from "./chunk-AIMEXBTK.js";
16
16
 
17
17
  // src/report.ts
18
18
  import fs from "node:fs";
@@ -3,34 +3,37 @@ const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  BUILTINS,
5
5
  DEFAULTS,
6
+ EngineCache,
6
7
  configOptions,
7
8
  findConfig,
8
9
  loadConfig,
9
10
  meant,
10
11
  tomlKeyLine
11
- } from "./chunk-P2TRR6XK.js";
12
- import "./chunk-ERNVEZOK.js";
13
- import "./chunk-MDB3D3LP.js";
12
+ } from "./chunk-Z44IAMNG.js";
13
+ import "./chunk-2QTJTEBV.js";
14
+ import "./chunk-ERAIEV3O.js";
14
15
  import "./chunk-AD3HAW3W.js";
16
+ import "./chunk-YCOTX2VM.js";
15
17
  import {
16
18
  CONFIG_FILES,
17
19
  dirsOf,
18
20
  parseEnvironment,
19
21
  shownDir,
20
22
  shownOutput
21
- } from "./chunk-BXARVN5Z.js";
22
- import "./chunk-IOXCGMSF.js";
23
+ } from "./chunk-GS5B3CBW.js";
24
+ import "./chunk-JC54PHIT.js";
25
+ import "./chunk-HFSWUTXX.js";
23
26
  import "./chunk-FVZ5JBRI.js";
24
- import "./chunk-DNWA7WNO.js";
25
27
  import "./chunk-UU43WIZG.js";
26
- import "./chunk-RFNLZM7W.js";
28
+ import "./chunk-IOBC665M.js";
27
29
  import "./chunk-CMUWRPSQ.js";
28
- import "./chunk-JFPLNHEQ.js";
30
+ import "./chunk-AIMEXBTK.js";
29
31
  import "./chunk-I3PS26CI.js";
30
32
  export {
31
33
  BUILTINS,
32
34
  CONFIG_FILES,
33
35
  DEFAULTS,
36
+ EngineCache,
34
37
  configOptions,
35
38
  dirsOf,
36
39
  findConfig,
@@ -2,24 +2,24 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  starterEngines
5
- } from "./chunk-6OUT5VFK.js";
5
+ } from "./chunk-B5E27PLU.js";
6
6
  import {
7
7
  DEFAULTS,
8
8
  configOptions
9
- } from "./chunk-P2TRR6XK.js";
9
+ } from "./chunk-Z44IAMNG.js";
10
10
  import {
11
11
  VERSION
12
12
  } from "./chunk-AD3HAW3W.js";
13
13
  import {
14
14
  CONFIG_FILES
15
- } from "./chunk-BXARVN5Z.js";
15
+ } from "./chunk-GS5B3CBW.js";
16
16
  import {
17
17
  red
18
- } from "./chunk-JFPLNHEQ.js";
18
+ } from "./chunk-AIMEXBTK.js";
19
19
 
20
20
  // src/commands/capabilities.ts
21
21
  var MODULE_EXPORTS = [
22
- ["ssqch", ["defineConfig", "markdown", "readData", "files", "slugify", "slugger"]],
22
+ ["ssqch", ["defineConfig", "markdown", "readData", "files", "slugify", "slugger", "safe"]],
23
23
  ["ssqch/image", ["imagePlugin", "image", "imageUrl"]],
24
24
  ["ssqch/rss", ["rssPlugin", "getNewestCollectionItemDate", "dateToRfc3339", "dateToRfc822", "absoluteUrl", "htmlToAbsoluteUrls", "feedHtml"]],
25
25
  ["ssqch/assets", ["assetsPlugin"]],
@@ -28,7 +28,7 @@ var MODULE_EXPORTS = [
28
28
  ["ssqch/redirects", ["redirectsPlugin"]],
29
29
  ["ssqch/sass", ["sassPlugin"]],
30
30
  ["ssqch/elements", ["elementsPlugin"]],
31
- ["ssqch/minify", ["minifyPlugin", "minify"]]
31
+ ["ssqch/minify", ["minifyPlugin", "minify", "minifyCss"]]
32
32
  ];
33
33
  var NODE_MODULES = ["fs", "fs/promises", "path", "path/posix", "url", "process", "buffer", "crypto", "module", "util", "events", "os", "assert", "assert/strict", "timers", "timers/promises", "string_decoder", "http", "https", "http2", "net", "tls", "dns", "child_process", "worker_threads", "cluster", "readline", "zlib", "vm", "stream", "tty", "perf_hooks"];
34
34
  function modules() {
@@ -73,7 +73,7 @@ async function capabilities(commands) {
73
73
  imageFormats: avif ? ["avif", "webp", "jpeg", "png", "gif", "svg"] : ["webp", "jpeg", "png", "gif", "svg"],
74
74
  starters: ["site", "docs"],
75
75
  starterEngines: starterEngines(),
76
- importers: ["eleventy", "zola"]
76
+ importers: ["eleventy", "jekyll", "zola", "hugo", "mkdocs"]
77
77
  };
78
78
  }
79
79
  function text(caps) {
@@ -96,7 +96,7 @@ function text(caps) {
96
96
  row("Globals", caps.globals.join(", "));
97
97
  row("Image formats", caps.imageFormats.join(", "));
98
98
  row("Starters", `${caps.starters.join(", ")} (in ${caps.starterEngines.join(", ")})`);
99
- row("Importers", caps.importers.join(", "));
99
+ row("Scout reads", caps.importers.join(", "));
100
100
  return out + "\n--format json has all of it, with each module's exports.\n";
101
101
  }
102
102
  async function runCapabilities(format, commands) {
@@ -2,28 +2,30 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  withBase
5
- } from "./chunk-P2TRR6XK.js";
5
+ } from "./chunk-Z44IAMNG.js";
6
6
  import {
7
7
  slugOptions,
8
+ slugText,
8
9
  slugWith
9
- } from "./chunk-IOXCGMSF.js";
10
+ } from "./chunk-JC54PHIT.js";
10
11
  import {
11
12
  BuildError,
12
13
  compareText,
13
14
  isPlainObject
14
- } from "./chunk-JFPLNHEQ.js";
15
+ } from "./chunk-AIMEXBTK.js";
15
16
 
16
17
  // src/content.ts
17
18
  var HEADING = /<h([1-6])(\s[^>]*)?>(.*?)<\/h[1-6]\s*>/gis;
18
19
  var ID_ATTR = /(?:^|\s)id\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/i;
19
20
  var TAG = /<(\/?)([A-Za-z][A-Za-z0-9-]*)([^>]*)>|<!--.*?-->/gs;
20
21
  var HIDDEN = /\saria-hidden\s*=\s*["']?true/i;
21
- var CODE = /<!--.*?-->|<(pre|code|script|style|template|textarea)\b.*?<\/(?:pre|code|script|style|template|textarea)\s*>/gis;
22
+ var CODE = /<!--.*?-->|<(pre|script|style|template|textarea)\b.*?<\/(?:pre|script|style|template|textarea)\s*>/gis;
23
+ var CODE_WITH_HEADING = /<code\b(?:(?!<\/code\s*>).)*?<h[1-6][\s>](?:(?!<\/code\s*>).)*<\/code\s*>/gis;
22
24
  var VOID = /* @__PURE__ */ new Set(["area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr"]);
23
25
  function headings(html) {
24
26
  if (!html.includes("<h") && !html.includes("<H")) return [];
25
27
  const out = [];
26
- for (const found of html.replace(CODE, "").matchAll(HEADING)) {
28
+ for (const found of html.replace(CODE, "").replace(CODE_WITH_HEADING, "").matchAll(HEADING)) {
27
29
  const id = ID_ATTR.exec(found[2] ?? "");
28
30
  const value = id ? id[1] ?? id[2] ?? id[3] : void 0;
29
31
  out.push({ level: Number(found[1]), id: value === void 0 ? void 0 : decodeEntities(value), text: htmlText(found[3]) });
@@ -285,19 +287,31 @@ function totalCompare(a, b) {
285
287
  return 0;
286
288
  }
287
289
  var get = (v, key) => isPlainObject(v) ? v[key] : void 0;
288
- function fromPages(items) {
289
- let nodes = [];
290
+ var NAV_OWN = /* @__PURE__ */ new Set(["title", "key", "parent", "order", "url", ...CHILD_KEYS]);
291
+ function fromPages(items, options = {}) {
292
+ const nodes = [];
290
293
  for (const item of items) {
291
294
  const data = get(item, "data");
292
295
  const nav = get(data, "nav");
293
296
  if (nav === void 0 || nav === null || nav === false) continue;
294
297
  const navTitle = get(nav, "title");
295
- const title = typeof navTitle === "string" ? navTitle : String(get(data, "title"));
296
298
  const navKey = get(nav, "key");
299
+ const pageTitle = get(data, "title");
300
+ const title = typeof navTitle === "string" ? navTitle : pageTitle !== void 0 && pageTitle !== null ? String(pageTitle) : typeof navKey === "string" ? navKey : "";
297
301
  const key = typeof navKey === "string" ? navKey : title;
298
302
  const parent = get(nav, "parent");
299
303
  const order = get(nav, "order");
300
- nodes.push({ key, parent: typeof parent === "string" ? parent : void 0, order: typeof order === "number" ? order : Number.MAX_VALUE, entry: { title, url: get(item, "url"), key } });
304
+ const navUrl = get(nav, "url");
305
+ const extra = isPlainObject(nav) ? Object.fromEntries(Object.entries(nav).filter(([k]) => !NAV_OWN.has(k))) : {};
306
+ nodes.push({ key, parent: typeof parent === "string" ? parent : void 0, order: typeof order === "number" ? order : Number.MAX_VALUE, entry: { ...extra, title, url: typeof navUrl === "string" ? navUrl : get(item, "url"), key } });
307
+ }
308
+ const keys = new Set(nodes.map((n) => n.key));
309
+ for (const n of [...nodes]) {
310
+ if (n.parent === void 0 || keys.has(n.parent)) continue;
311
+ keys.add(n.parent);
312
+ const siblings = nodes.filter((m) => m.parent === n.parent);
313
+ const order = Math.min(...siblings.map((m) => m.order));
314
+ nodes.push({ key: n.parent, parent: void 0, order, entry: { title: n.parent, key: n.parent } });
301
315
  }
302
316
  const build = (parent, depth) => {
303
317
  if (depth > 32) return [];
@@ -305,23 +319,21 @@ function fromPages(items) {
305
319
  level.sort((a, b) => totalCompare(a.order, b.order) || compareText(a.entry.title, b.entry.title));
306
320
  return level.map((n) => ({ ...n.entry, children: build(n.key, depth + 1) }));
307
321
  };
308
- const keys = new Set(nodes.map((n) => n.key));
309
- nodes = nodes.map((n) => n.parent !== void 0 && !keys.has(n.parent) ? { ...n, parent: void 0 } : n);
310
- return build(void 0, 0);
322
+ return options.root === void 0 ? build(void 0, 0) : build(options.root, 1);
311
323
  }
312
324
 
313
325
  // src/filters.ts
314
326
  var BUILTIN_FILTERS = [
315
327
  ["markdown", '`markdown(text)` renders Markdown with the site\'s options; `markdown(text, "inline")` without the `<p>`.'],
316
- ["toc", "`toc(page.headings)` is a table of contents; `toc(page.headings, { from: 2, to: 4, ordered: true })` picks the levels, and `id`, `class`, `sublistClass`, `itemClass` (`{level}` is the heading's) and `linkClass` set the markup's."],
328
+ ["toc", "`toc(page.headings)` is a table of contents (or `toc(html)`, from HTML's headings); `toc(page.headings, { from: 2, to: 4, ordered: true })` picks the levels, and `id`, `class`, `sublistClass`, `itemClass` (`{level}` is the heading's) and `linkClass` set the markup's."],
317
329
  ["navTree", "`navTree(nav, page.url)` marks a navigation tree's entries `current`, `ancestor` or `open`."],
318
330
  ["navPager", "`navPager(nav, page.url)` is `{ previous, next }` in reading order."],
319
331
  ["navBreadcrumbs", "`navBreadcrumbs(nav, page.url)` is the entries from the top down to the page."],
320
- ["pagesTree", "`pagesTree(collections.docs)` builds a navigation tree from pages' `nav` front matter."],
332
+ ["pagesTree", '`pagesTree(collections.docs)` builds a navigation tree from pages\' `nav` front matter; `pagesTree(collections.all, { root: "Feature" })` (or `pagesTree(collections.all, "Feature")`) is the tree below one key.'],
321
333
  ["highlight", "`highlight(code, lang)` is highlighted HTML for inside a `<code>`, with `hl-*` classes."],
322
334
  ["readingTime", "`readingTime(content)` is the minutes it takes to read some HTML, at 200 words a minute."],
323
335
  ["withBase", '`withBase("/feed.xml")` puts the site\'s `base` in front of a URL, for places outside HTML attributes.'],
324
- ["slugify", '`slugify("Pine Cone Crunch!")` is `pine-cone-crunch`: lowercase letters and digits, with a dash for each run of anything else; `slugify(title, { separator: "_" })` uses another separator, and `apostrophes: "separate"` splits words at an apostrophe instead of dropping it.']
336
+ ["slugify", '`slugify("Pine Cone Crunch!")` is `pine-cone-crunch`: lowercase letters and digits, with a dash for each run of anything else; `slugify(title, { separator: "_" })` uses another separator, `apostrophes: "separate"` splits words at an apostrophe instead of dropping it, `ascii: true` takes accents off and spells out symbols as the slugify package does (`Sj\xF6gren & co` is `sjogren-and-co`), and `stripTags: true` drops HTML tags first.']
325
337
  ];
326
338
  function builtinFilters(markdown, config) {
327
339
  const filters = /* @__PURE__ */ new Map();
@@ -338,10 +350,19 @@ function builtinFilters(markdown, config) {
338
350
  filters.set("navTree", (...args) => treeOf(args[0], urlArg(args)));
339
351
  filters.set("navPager", (...args) => pagerOf(args[0], urlArg(args)));
340
352
  filters.set("navBreadcrumbs", (...args) => breadcrumbsOf(args[0], urlArg(args)));
341
- filters.set("pagesTree", (...args) => fromPages(Array.isArray(args[0]) ? args[0] : []));
353
+ filters.set("pagesTree", (...args) => {
354
+ const option = args[1];
355
+ let root;
356
+ if (typeof option === "string") root = option;
357
+ else if (isPlainObject(option)) {
358
+ for (const key of Object.keys(option)) if (key !== "root") throw new BuildError(`pagesTree: unknown option \`${key}\` (options: root)`);
359
+ if (option.root !== void 0 && option.root !== null) root = String(option.root);
360
+ }
361
+ return fromPages(Array.isArray(args[0]) ? args[0] : [], { root });
362
+ });
342
363
  filters.set("slugify", (text, option) => {
343
364
  const [separator, apostrophes] = slugOptions(option);
344
- return slugWith(String(text), separator, apostrophes);
365
+ return slugWith(slugText(String(text), option), separator, apostrophes);
345
366
  });
346
367
  filters.set("readingTime", (text, wordsPerMinute) => {
347
368
  const wpm = typeof wordsPerMinute === "number" && wordsPerMinute > 0 ? wordsPerMinute : 200;
@@ -350,7 +371,7 @@ function builtinFilters(markdown, config) {
350
371
  });
351
372
  const TOC_MARKUP = ["id", "class", "sublistClass", "itemClass", "linkClass"];
352
373
  filters.set("toc", (list, option, last) => {
353
- const headings2 = Array.isArray(list) ? list : [];
374
+ const headings2 = Array.isArray(list) ? list : typeof list === "string" || list !== null && typeof list === "object" && typeof list.toString === "function" && !isPlainObject(list) ? headings(String(list)) : [];
354
375
  let [from, to, ordered] = [2, 3, false];
355
376
  const markup = {};
356
377
  if (isPlainObject(option)) {
@@ -2,7 +2,7 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  slashes
5
- } from "./chunk-JFPLNHEQ.js";
5
+ } from "./chunk-AIMEXBTK.js";
6
6
 
7
7
  // src/dirs.ts
8
8
  import fs from "node:fs";