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
@@ -2,17 +2,20 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
2
2
  const require = __ssqchCreateRequire(import.meta.url);
3
3
  import {
4
4
  budget
5
- } from "./chunk-LCPSKHAV.js";
5
+ } from "./chunk-2QTJTEBV.js";
6
6
  import {
7
7
  bytes,
8
8
  count
9
- } from "./chunk-NKXEPHRZ.js";
9
+ } from "./chunk-ERAIEV3O.js";
10
10
  import {
11
11
  VERSION
12
12
  } from "./chunk-AD3HAW3W.js";
13
+ import {
14
+ bundledPath
15
+ } from "./chunk-YCOTX2VM.js";
13
16
  import {
14
17
  CONFIG_FILES
15
- } from "./chunk-DDV6JEC2.js";
18
+ } from "./chunk-GS5B3CBW.js";
16
19
  import {
17
20
  WebAssembly,
18
21
  applyMarkdownOptions,
@@ -21,15 +24,16 @@ import {
21
24
  oriented,
22
25
  probeFile,
23
26
  site,
24
- undecodable
25
- } from "./chunk-5DNDSNTP.js";
26
- import {
27
- closest
28
- } from "./chunk-FVZ5JBRI.js";
27
+ undecodable,
28
+ withPage
29
+ } from "./chunk-JC54PHIT.js";
29
30
  import {
30
31
  globProblem,
31
32
  globToRegExp
32
- } from "./chunk-NFJJKDRI.js";
33
+ } from "./chunk-HFSWUTXX.js";
34
+ import {
35
+ closest
36
+ } from "./chunk-FVZ5JBRI.js";
33
37
  import {
34
38
  describeThrown,
35
39
  hookModules,
@@ -37,7 +41,7 @@ import {
37
41
  loadedFiles,
38
42
  settle,
39
43
  watchSettle
40
- } from "./chunk-JWCCVTTR.js";
44
+ } from "./chunk-IOBC665M.js";
41
45
  import {
42
46
  charCount,
43
47
  firstChars,
@@ -51,7 +55,9 @@ import {
51
55
  TomlError,
52
56
  aliasUsed,
53
57
  bail,
58
+ compareText,
54
59
  context,
60
+ displayPath,
55
61
  error,
56
62
  find,
57
63
  isPlainObject,
@@ -59,17 +65,13 @@ import {
59
65
  otherGenerator,
60
66
  progress,
61
67
  readToml,
68
+ realPath,
69
+ shown,
62
70
  toDate,
63
71
  tomlReason,
64
72
  warn,
65
73
  warning
66
- } from "./chunk-BGCBSQ4A.js";
67
- import {
68
- compareText,
69
- displayPath,
70
- realPath,
71
- shown
72
- } from "./chunk-VJWQSYEG.js";
74
+ } from "./chunk-AIMEXBTK.js";
73
75
  import {
74
76
  __require
75
77
  } from "./chunk-I3PS26CI.js";
@@ -1992,6 +1994,20 @@ function publish(cache, out, a = statOf(cache)) {
1992
1994
  linkOrCopy(cache, out);
1993
1995
  return Number(a?.size ?? statOf(out)?.size ?? 0);
1994
1996
  }
1997
+ async function publishLater(cache, out) {
1998
+ try {
1999
+ await fs4.promises.link(cache, out);
2000
+ } catch {
2001
+ const [there, source] = [statOf(out), statOf(cache)];
2002
+ if (there && source && there.size === source.size) return void 0;
2003
+ try {
2004
+ await fs4.promises.copyFile(cache, out);
2005
+ } catch (e) {
2006
+ return new Error(`copying ${out} into the output: ${e.message}`);
2007
+ }
2008
+ }
2009
+ return void 0;
2010
+ }
1995
2011
  function linkOrCopy(from, to) {
1996
2012
  try {
1997
2013
  fs4.linkSync(from, to);
@@ -2059,9 +2075,13 @@ var ImageProcessor = class {
2059
2075
  sizes = /* @__PURE__ */ new Map();
2060
2076
  /** Everything this build is still waiting for, settled or not. */
2061
2077
  pending = [];
2078
+ /** Cached files being linked into the output (publishLater), each resolving to its error if it failed. */
2079
+ placing = [];
2062
2080
  /** Each source with files still to make that something points at, by its path: one that fails fails the build. */
2063
2081
  watched = /* @__PURE__ */ new Map();
2064
2082
  generated = 0;
2083
+ /** GIFs and SVGs copied as they are (no encode, and no cache), apart from `generated`. */
2084
+ copied = 0;
2065
2085
  pruned = 0;
2066
2086
  converted = /* @__PURE__ */ new Set();
2067
2087
  used = /* @__PURE__ */ new Set();
@@ -2111,6 +2131,7 @@ var ImageProcessor = class {
2111
2131
  this.made.clear();
2112
2132
  this.sizes.clear();
2113
2133
  this.pending = [];
2134
+ this.placing = [];
2114
2135
  this.watched.clear();
2115
2136
  this.used.clear();
2116
2137
  this.sources.clear();
@@ -2118,6 +2139,7 @@ var ImageProcessor = class {
2118
2139
  this.timings = [];
2119
2140
  if (this.options.hashCache) this.hashes.load(path4.join(root, CACHE_FILE));
2120
2141
  this.generated = 0;
2142
+ this.copied = 0;
2121
2143
  this.pruned = 0;
2122
2144
  }
2123
2145
  /**
@@ -2133,6 +2155,10 @@ var ImageProcessor = class {
2133
2155
  this.pending = [];
2134
2156
  await Promise.all(waiting2);
2135
2157
  }
2158
+ const placing = this.placing;
2159
+ this.placing = [];
2160
+ const failed2 = (await Promise.all(placing)).find((e) => e !== void 0);
2161
+ if (failed2) throw new BuildError(`images: ${failed2.message}`);
2136
2162
  const root = this.context().root;
2137
2163
  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);
2138
2164
  if (!failures.length) return;
@@ -2328,8 +2354,9 @@ var ImageProcessor = class {
2328
2354
  const e = entry(srcFormat, w, h, w > 0 ? `${id}-${w}.${srcFormat}` : `${id}.${srcFormat}`);
2329
2355
  const t = mtimeOf(e.path);
2330
2356
  if (!(t !== void 0 && (sourceTime === void 0 || t >= sourceTime)) && !this.files.has(e.path)) {
2331
- fs4.copyFileSync(src, e.path);
2332
- this.generated++;
2357
+ const out = e.path;
2358
+ this.placing.push(fs4.promises.copyFile(src, out).then(() => void 0, (err) => new Error(`copying ${src} to ${out}: ${err.message}`)));
2359
+ this.copied++;
2333
2360
  }
2334
2361
  this.files.set(e.path, "reused");
2335
2362
  return { formats: /* @__PURE__ */ new Map([[srcFormat, [e]]]), auto: formats.includes("auto") ? srcFormat : void 0, ready: READY };
@@ -2375,11 +2402,18 @@ var ImageProcessor = class {
2375
2402
  const cached = s.file !== s.e.path;
2376
2403
  if (s.found === "cache") {
2377
2404
  if (cached) {
2378
- try {
2379
- this.sizes.set(s.e.path, publish(s.file, s.e.path, s.stat));
2380
- } catch (e) {
2381
- throw new Error(`copying ${s.e.path} into the output: ${e.message}`);
2405
+ const [a, b] = [s.stat, statOf(s.e.path)];
2406
+ if (!(a && b && a.size === b.size && b.mtimeNs >= a.mtimeNs)) {
2407
+ if (b) {
2408
+ try {
2409
+ fs4.rmSync(s.e.path, { force: true });
2410
+ } catch (e) {
2411
+ throw new Error(`copying ${s.e.path} into the output: ${e.message}`);
2412
+ }
2413
+ }
2414
+ this.placing.push(publishLater(s.file, s.e.path));
2382
2415
  }
2416
+ this.sizes.set(s.e.path, Number(a?.size ?? 0));
2383
2417
  } else this.sizes.set(s.e.path, Number(s.stat.size));
2384
2418
  } else {
2385
2419
  try {
@@ -2573,8 +2607,9 @@ var ImageProcessor = class {
2573
2607
  let size = 0;
2574
2608
  for (const p of this.used) size += this.sizes.get(p) ?? fs4.statSync(p, { throwIfNoEntry: false })?.size ?? 0;
2575
2609
  const sources = this.sources.size;
2576
- const encoded = Math.min(this.generated, this.used.size);
2577
- 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`;
2610
+ const copied = Math.min(this.copied, this.used.size);
2611
+ const encoded = Math.min(this.generated, this.used.size - copied);
2612
+ 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`;
2578
2613
  if (this.converted.size > 0) line += ` (${count(this.converted.size)} source${this.converted.size === 1 ? "" : "s"} converted to sRGB)`;
2579
2614
  if (this.options.prune) line += `, ${count(this.pruned)} pruned`;
2580
2615
  return line;
@@ -3304,6 +3339,8 @@ function emptyConfig(options) {
3304
3339
  serving: options.serving ?? false,
3305
3340
  quiet: options.quiet ?? false,
3306
3341
  verbose: options.verbose ?? false,
3342
+ profile: options.profile ?? false,
3343
+ definedIn: /* @__PURE__ */ new Map(),
3307
3344
  input: ".",
3308
3345
  output: "_site",
3309
3346
  includes: "_includes",
@@ -3318,9 +3355,14 @@ function emptyConfig(options) {
3318
3355
  ignore: [],
3319
3356
  bundles: false,
3320
3357
  strict: false,
3358
+ trimAfterFrontMatter: false,
3359
+ jekyllTemplates: false,
3360
+ mkdocsTemplates: null,
3361
+ jinjaAutoescape: null,
3321
3362
  lastModified: null,
3322
3363
  dateFallback: "file",
3323
3364
  timeZone: null,
3365
+ layoutAliases: /* @__PURE__ */ new Map(),
3324
3366
  base: "",
3325
3367
  serveRun: [],
3326
3368
  budgets: [],
@@ -3336,6 +3378,7 @@ function emptyConfig(options) {
3336
3378
  transforms: [],
3337
3379
  htmlTransforms: [],
3338
3380
  engines: /* @__PURE__ */ new Map(),
3381
+ engineCaches: [],
3339
3382
  beforeBuild: [],
3340
3383
  afterBuild: [],
3341
3384
  watch: [],
@@ -3412,9 +3455,27 @@ async function loadJsData(file, root) {
3412
3455
  throw new BuildError(`${name}: ${describeThrown(e, root)}`);
3413
3456
  }
3414
3457
  }
3415
- var SETTINGS = ["dirs", "templateFormats", "markdownEngine", "htmlEngine", "markdown", "deepMerge", "leaveNoTrace", "clean", "ignore", "bundles", "strict", "lastModified", "dateFallback", "timeZone", "base", "schemas", "theme", "serve", "budgets"];
3458
+ var EngineCache = class {
3459
+ now = /* @__PURE__ */ new Map();
3460
+ before = /* @__PURE__ */ new Map();
3461
+ startBuild() {
3462
+ this.before = this.now;
3463
+ this.now = /* @__PURE__ */ new Map();
3464
+ }
3465
+ get(source) {
3466
+ const kept = this.now.get(source);
3467
+ if (kept !== void 0) return kept;
3468
+ const earlier = this.before.get(source);
3469
+ if (earlier !== void 0) this.now.set(source, earlier);
3470
+ return earlier;
3471
+ }
3472
+ set(source, html) {
3473
+ this.now.set(source, html);
3474
+ }
3475
+ };
3476
+ var SETTINGS = ["dirs", "templateFormats", "markdownEngine", "htmlEngine", "markdown", "deepMerge", "leaveNoTrace", "clean", "ignore", "bundles", "strict", "trimAfterFrontMatter", "jekyllTemplates", "mkdocsTemplates", "jinja", "lastModified", "dateFallback", "timeZone", "layoutAliases", "base", "schemas", "theme", "serve", "budgets"];
3416
3477
  var PARTS = ["data", "filters", "collections", "transforms", "engines", "passthrough", "watch", "beforeBuild", "afterBuild", "plugins"];
3417
- var CORE_ENGINES = ["edge", "md", "html", "txt"];
3478
+ var CORE_ENGINES = ["edge", "html", "txt"];
3418
3479
  var DIRS = ["input", "output", "includes", "layouts", "data"];
3419
3480
  var configOptions = () => [...SETTINGS, ...PARTS];
3420
3481
  var isObject2 = (v) => v !== null && typeof v === "object" && !Array.isArray(v);
@@ -3500,6 +3561,9 @@ async function loadJs(config, file) {
3500
3561
  const earlier = names[kind].get(key);
3501
3562
  if (earlier) fail(`${where}: ${singular} "${key}" is already defined by ${earlier}`);
3502
3563
  names[kind].set(key, where);
3564
+ ops.push(() => {
3565
+ config.definedIn.set(`${kind}.${key}`, where);
3566
+ });
3503
3567
  };
3504
3568
  const functions = (kind, singular, value, where, add) => {
3505
3569
  if (value === void 0) return;
@@ -3628,7 +3692,7 @@ async function loadJs(config, file) {
3628
3692
  }
3629
3693
  }
3630
3694
  functions("filters", "filter", part.filters, where, (key, fn) => ops.push(() => {
3631
- config.filters.set(key, fn);
3695
+ config.filters.set(key, withPage(fn));
3632
3696
  config.siteFilters.add(key);
3633
3697
  }));
3634
3698
  functions("collections", "collection", part.collections, where, (key, fn) => ops.push(() => {
@@ -3651,6 +3715,8 @@ async function loadJs(config, file) {
3651
3715
  for (const [key, engine] of Object.entries(part.engines)) {
3652
3716
  const render = typeof engine === "function" ? engine : engine?.render;
3653
3717
  if (typeof render !== "function") fail(`${where}: engines.${key} must be a function (source, data) or an object with a render(source, data) method`);
3718
+ if (isPlainObject(engine) && engine.cache !== void 0 && typeof engine.cache !== "boolean") fail(`${where}: engines.${key}.cache must be true or false`);
3719
+ const cache = typeof engine === "object" && engine.cache === true ? new EngineCache() : void 0;
3654
3720
  if (!/^[A-Za-z0-9_-]+$/.test(key)) fail(`${where}: engines.${key}: an engine's name is a file extension (letters, digits, - and _)`);
3655
3721
  if (CORE_ENGINES.includes(key)) fail(`${where}: engines.${key}: "${key}" is built in and can't be replaced`);
3656
3722
  claim("engines", "engine", key, where);
@@ -3658,12 +3724,26 @@ async function loadJs(config, file) {
3658
3724
  if (typeof out !== "string") throw new TypeError(`engine "${key}" returned ${out === void 0 ? "undefined" : typeof out} for ${inputPath}; return the rendered text`);
3659
3725
  return out;
3660
3726
  };
3661
- const run = (source, data, inputPath) => {
3662
- const out = render.call(engine, source, data);
3727
+ const run = (source, data, inputPath, context2) => {
3728
+ const out = render.call(engine, source, data, context2);
3663
3729
  return out instanceof Promise ? watchSettle(out).then((v) => checked(v, inputPath)) : checked(out, inputPath);
3664
3730
  };
3665
3731
  ops.push(() => {
3666
- config.engines.set(key, run);
3732
+ if (!cache) {
3733
+ config.engines.set(key, run);
3734
+ return;
3735
+ }
3736
+ config.engineCaches.push(cache);
3737
+ config.engines.set(key, (source, data, inputPath, context2) => {
3738
+ if (context2.kind !== "body") return run(source, data, inputPath, context2);
3739
+ const kept = cache.get(source);
3740
+ if (kept !== void 0) return kept;
3741
+ const out = run(source, data, inputPath, context2);
3742
+ if (typeof out === "string") cache.set(source, out);
3743
+ else out.then((html) => cache.set(source, html), () => {
3744
+ });
3745
+ return out;
3746
+ });
3667
3747
  });
3668
3748
  }
3669
3749
  }
@@ -3749,12 +3829,23 @@ function applySettings(config, settings) {
3749
3829
  trace = value;
3750
3830
  }
3751
3831
  if (trace !== void 0) config.leaveNoTrace = trace;
3752
- for (const key of ["bundles", "strict"]) {
3832
+ for (const key of ["bundles", "strict", "trimAfterFrontMatter", "jekyllTemplates"]) {
3753
3833
  const value = settings[key];
3754
3834
  if (value === void 0) continue;
3755
3835
  if (typeof value !== "boolean") bail(`${key} must be true or false, not ${typeof value}`);
3756
3836
  config[key] = value;
3757
3837
  }
3838
+ const mkdocs = settings.mkdocsTemplates;
3839
+ if (mkdocs === true) config.mkdocsTemplates = "mkdocs.yml";
3840
+ else if (typeof mkdocs === "string" && mkdocs.trim() !== "") config.mkdocsTemplates = mkdocs;
3841
+ else if (mkdocs !== void 0 && mkdocs !== false && mkdocs !== null) bail(`mkdocsTemplates must be true, false or the path of an mkdocs.yml, not ${typeof mkdocs === "string" ? "an empty string" : typeof mkdocs}`);
3842
+ const jinja = settings.jinja;
3843
+ if (isObject2(jinja)) {
3844
+ const unknown = Object.keys(jinja).find((k) => k !== "autoescape");
3845
+ if (unknown !== void 0) bail(`jinja: "${unknown}" isn't an option${meant(unknown, ["autoescape"])} (options: autoescape)`);
3846
+ if (jinja.autoescape !== void 0 && typeof jinja.autoescape !== "boolean") bail(`jinja.autoescape must be true or false, not ${typeof jinja.autoescape}`);
3847
+ if (typeof jinja.autoescape === "boolean") config.jinjaAutoescape = jinja.autoescape;
3848
+ } else if (jinja !== void 0 && jinja !== null) bail(`jinja must be an object, like { autoescape: false }, not ${typeof jinja}`);
3758
3849
  const modified = settings.lastModified;
3759
3850
  if (modified === true) config.lastModified = "git";
3760
3851
  else if (modified === "git" || modified === "file") config.lastModified = modified;
@@ -3764,11 +3855,20 @@ function applySettings(config, settings) {
3764
3855
  if (fallback === "git" || fallback === "file") config.dateFallback = fallback;
3765
3856
  else if (fallback !== void 0 && fallback !== null) bail(`dateFallback must be "git" or "file", not ${typeof fallback === "string" ? `"${fallback}"` : typeof fallback}`);
3766
3857
  if (settings.timeZone !== void 0 && settings.timeZone !== null) config.timeZone = checkTimeZone(settings.timeZone);
3858
+ if (settings.layoutAliases !== void 0 && settings.layoutAliases !== null) {
3859
+ if (!isObject2(settings.layoutAliases)) bail(`layoutAliases must be an object of { name: layout }, like { post: "layouts/post.njk" }, not ${typeof settings.layoutAliases}`);
3860
+ for (const [name, target] of Object.entries(settings.layoutAliases)) {
3861
+ if (typeof target !== "string" || target === "") bail(`layoutAliases.${name} must be a layout's name, like "layouts/post.njk"`);
3862
+ if (target === name) bail(`layoutAliases.${name} names itself`);
3863
+ config.layoutAliases.set(name, target);
3864
+ }
3865
+ }
3767
3866
  if (typeof settings.base === "string") config.base = normalizeBase(settings.base);
3768
3867
  else if (settings.base !== void 0 && settings.base !== null) bail(`base must be a URL path like "/docs/", not ${typeof settings.base}`);
3769
3868
  const theme = settings.theme;
3770
3869
  const themes = theme === void 0 || theme === null || theme === false ? [] : Array.isArray(theme) ? theme : [theme];
3771
3870
  for (const one of themes) addTheme(config, one);
3871
+ if (config.mkdocsTemplates !== null) addMkdocsTheme(config);
3772
3872
  if (isObject2(settings.schemas)) {
3773
3873
  for (const [name, spec] of Object.entries(settings.schemas)) {
3774
3874
  const schema = parseSchema(name, spec);
@@ -3794,6 +3894,10 @@ function applySettings(config, settings) {
3794
3894
  else if (Array.isArray(ignore)) config.ignore = ignore.map((g) => typeof g === "string" ? g : bail(`ignore must be a glob or an array of globs, not an array with ${typeof g}`));
3795
3895
  else if (ignore !== void 0) bail(`ignore must be a glob or an array of globs, not ${typeof ignore}`);
3796
3896
  }
3897
+ function addMkdocsTheme(config) {
3898
+ const dir = bundledPath("mkdocs");
3899
+ if (!config.themes.includes(dir)) config.themes.push(dir);
3900
+ }
3797
3901
  function addTheme(config, theme) {
3798
3902
  let dir;
3799
3903
  if (typeof theme === "string") dir = resolveTheme(config.root, theme, config.quiet);
@@ -3973,6 +4077,7 @@ export {
3973
4077
  DEFAULTS2 as DEFAULTS,
3974
4078
  findConfig,
3975
4079
  loadConfig,
4080
+ EngineCache,
3976
4081
  configOptions,
3977
4082
  meant,
3978
4083
  BUILTINS,