ssqch 0.8.0 → 0.10.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.
- package/README.md +3 -1
- package/bundled/docs/agents.md +70 -0
- package/bundled/docs/benchmarks.md +29 -0
- package/bundled/docs/build-summary.md +27 -0
- package/bundled/docs/comparing-builds.md +51 -0
- package/bundled/docs/configuring.md +138 -0
- package/bundled/docs/content-schemas.md +54 -0
- package/bundled/docs/css-and-javascript.md +33 -0
- package/bundled/docs/data-files.md +55 -0
- package/bundled/docs/deploying.md +47 -0
- package/bundled/docs/field-guide.md +144 -0
- package/bundled/docs/footprint.md +27 -0
- package/bundled/docs/github-pages.md +41 -0
- package/bundled/docs/index.md +26 -0
- package/bundled/docs/install.md +27 -0
- package/bundled/docs/known-gaps.md +18 -0
- package/bundled/docs/markdown.md +114 -0
- package/bundled/docs/multilingual.md +14 -0
- package/bundled/docs/nav.yml +50 -0
- package/bundled/docs/netlify.md +30 -0
- package/bundled/docs/new-pages.md +42 -0
- package/bundled/docs/plugins.md +13 -0
- package/bundled/docs/rust-plugins.md +32 -0
- package/bundled/docs/seo.md +19 -0
- package/bundled/docs/template-languages.md +106 -0
- package/bundled/docs/templates.md +37 -0
- package/bundled/docs/themes.md +31 -0
- package/bundled/{trailheads → docs/trailheads}/from-component-frameworks.md +7 -3
- package/bundled/{trailheads → docs/trailheads}/from-docusaurus.md +7 -4
- package/bundled/{trailheads → docs/trailheads}/from-eleventy.md +7 -4
- package/bundled/{trailheads → docs/trailheads}/from-hexo.md +7 -4
- package/bundled/docs/trailheads/from-jekyll.md +82 -0
- package/bundled/{trailheads → docs/trailheads}/from-mkdocs.md +8 -5
- package/bundled/{trailheads → docs/trailheads}/from-zola.md +6 -3
- package/bundled/docs/trailheads.md +38 -0
- package/bundled/docs/where-values-come-from.md +57 -0
- package/bundled/ssqch.d.ts +20 -10
- package/lib/assets.js +15 -7
- package/lib/{chunk-N5QTGQ5N.js → chunk-2LEOPLTZ.js} +2 -2
- package/lib/{chunk-AMBFWPZ4.js → chunk-3EPHKJEG.js} +3 -3
- package/lib/{chunk-BRK4MXXO.js → chunk-3HHRKG33.js} +65 -18
- package/lib/{chunk-EIT4ZDT4.js → chunk-5DNDSNTP.js} +61 -5
- package/lib/{chunk-NUKCUDC4.js → chunk-7HXCQEGA.js} +3 -3
- package/lib/{chunk-6XYSFG6V.js → chunk-BGCBSQ4A.js} +3067 -3054
- package/lib/{chunk-RI2L3VGO.js → chunk-CB6YFUXU.js} +19 -11
- package/lib/{chunk-JSPSMIJ2.js → chunk-DMVJ53SM.js} +9 -9
- package/lib/{chunk-FYGE634X.js → chunk-DW7VMJEZ.js} +9 -9
- package/lib/{chunk-GSKVRAHF.js → chunk-E5UB2YY7.js} +6 -6
- package/lib/{chunk-DHHQKW4F.js → chunk-EEJDLCD3.js} +7 -7
- package/lib/{chunk-TWCVHOKO.js → chunk-HDQ4SRWM.js} +125 -4
- package/lib/{chunk-JRT7TQQP.js → chunk-HGJ5VWUR.js} +1 -1
- package/lib/{chunk-C35KIPAR.js → chunk-JWCCVTTR.js} +98 -7
- package/lib/{chunk-EZZUUPI4.js → chunk-JXZT5L7W.js} +2 -2
- package/lib/{chunk-KBGE5MCY.js → chunk-LAV3DEY4.js} +1 -1
- package/lib/{chunk-IRHRK7XB.js → chunk-LCPSKHAV.js} +1 -1
- package/lib/{chunk-3PHCFZEU.js → chunk-N4O5MDIB.js} +2 -2
- package/lib/{chunk-TDGBQNGW.js → chunk-NFJJKDRI.js} +1 -1
- package/lib/{chunk-UGEGUUBT.js → chunk-NUUEOGLZ.js} +8 -8
- package/lib/{chunk-VVPZ5PDP.js → chunk-Q4LFTYK2.js} +11 -11
- package/lib/{chunk-TN6EEDX2.js → chunk-QMA7CK7B.js} +51 -6
- package/lib/{chunk-CDEPYU7W.js → chunk-RJFWTW2Y.js} +2 -2
- package/lib/{chunk-YSH2NMIE.js → chunk-RKFZSVNF.js} +6 -6
- package/lib/{chunk-GOE4ZSAB.js → chunk-RM5Q3KFB.js} +9 -9
- package/lib/{chunk-37KSIVNY.js → chunk-RVBNVGZV.js} +3 -3
- package/lib/{chunk-HR2RU2LY.js → chunk-SA5KSJ4Y.js} +11 -7
- package/lib/{chunk-BOBPVAX2.js → chunk-SRNLKWXL.js} +424 -78
- package/lib/{chunk-WP3RPVUM.js → chunk-Y2ESFAAD.js} +2 -3
- package/lib/{chunk-WMOVCQO6.js → chunk-ZM6TU2JB.js} +6 -6
- package/lib/cli.js +32 -25
- package/lib/elements.js +7 -7
- package/lib/image.js +8 -8
- package/lib/links.js +10 -10
- package/lib/minify.js +7 -7
- package/lib/redirects.js +8 -8
- package/lib/rss.js +20 -19
- package/lib/sass.js +45 -10
- package/lib/sitemap.js +36 -11
- package/lib/ssqch.js +4 -4
- package/package.json +2 -2
- package/types/image.d.ts +5 -5
- package/types/index.d.ts +12 -4
- package/types/rss.d.ts +1 -1
- package/types/sitemap.d.ts +2 -0
- package/wasm/markdown.wasm +0 -0
- package/bundled/README.md +0 -1247
- package/lib/{chunk-6XYSFG6V.js.LEGAL.txt → chunk-BGCBSQ4A.js.LEGAL.txt} +3 -3
- /package/lib/{chunk-BOBPVAX2.js.LEGAL.txt → chunk-SRNLKWXL.js.LEGAL.txt} +0 -0
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
builtinFilters,
|
|
8
8
|
excerpt,
|
|
9
9
|
headings
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CB6YFUXU.js";
|
|
11
11
|
import {
|
|
12
12
|
measure,
|
|
13
13
|
overBudget
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-N4O5MDIB.js";
|
|
15
15
|
import {
|
|
16
16
|
checkPages,
|
|
17
17
|
rewriteBase
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-QMA7CK7B.js";
|
|
19
19
|
import {
|
|
20
20
|
VERSION
|
|
21
21
|
} from "./chunk-AD3HAW3W.js";
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
saveFenceCache,
|
|
33
33
|
site,
|
|
34
34
|
writeHighlightCss
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-5DNDSNTP.js";
|
|
36
36
|
import {
|
|
37
37
|
closest,
|
|
38
38
|
closestPath
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
globSet,
|
|
43
43
|
globToRegExp,
|
|
44
44
|
isGlob
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-NFJJKDRI.js";
|
|
46
46
|
import {
|
|
47
47
|
ISSUES_URL,
|
|
48
48
|
PASSED_THIS_TREE,
|
|
@@ -50,10 +50,11 @@ import {
|
|
|
50
50
|
} from "./chunk-UU43WIZG.js";
|
|
51
51
|
import {
|
|
52
52
|
describeThrown,
|
|
53
|
+
loadedFiles,
|
|
53
54
|
settle,
|
|
54
55
|
shownPath,
|
|
55
56
|
watchSettle
|
|
56
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-JWCCVTTR.js";
|
|
57
58
|
import {
|
|
58
59
|
BuildError,
|
|
59
60
|
Diagnostics,
|
|
@@ -62,6 +63,7 @@ import {
|
|
|
62
63
|
TABLE,
|
|
63
64
|
aliasUsed,
|
|
64
65
|
bail,
|
|
66
|
+
buildTime,
|
|
65
67
|
context,
|
|
66
68
|
decodeText,
|
|
67
69
|
error,
|
|
@@ -78,10 +80,11 @@ import {
|
|
|
78
80
|
readText,
|
|
79
81
|
sameValue,
|
|
80
82
|
setOwn,
|
|
83
|
+
sourceDateEpoch,
|
|
81
84
|
toDate,
|
|
82
85
|
warn,
|
|
83
86
|
warning
|
|
84
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-BGCBSQ4A.js";
|
|
85
88
|
import {
|
|
86
89
|
comparePaths,
|
|
87
90
|
compareText,
|
|
@@ -9010,7 +9013,7 @@ var require_liquid_node = __commonJS({
|
|
|
9010
9013
|
function toValue(value) {
|
|
9011
9014
|
return value instanceof Drop && isFunction2(value.valueOf) ? value.valueOf() : value;
|
|
9012
9015
|
}
|
|
9013
|
-
function
|
|
9016
|
+
function toNumber2(value) {
|
|
9014
9017
|
return +toValue(value) || 0;
|
|
9015
9018
|
}
|
|
9016
9019
|
function isNumber(value) {
|
|
@@ -9115,7 +9118,7 @@ var require_liquid_node = __commonJS({
|
|
|
9115
9118
|
}
|
|
9116
9119
|
function argumentsToNumber(fn) {
|
|
9117
9120
|
return function(...args) {
|
|
9118
|
-
return fn.call(this, ...args.map(
|
|
9121
|
+
return fn.call(this, ...args.map(toNumber2));
|
|
9119
9122
|
};
|
|
9120
9123
|
}
|
|
9121
9124
|
function* strictUniq(array) {
|
|
@@ -11997,8 +12000,8 @@ var require_liquid_node = __commonJS({
|
|
|
11997
12000
|
return Number(`${mantissa}e${Number(power) + exponent}`);
|
|
11998
12001
|
}
|
|
11999
12002
|
function round2(v, arg = 0) {
|
|
12000
|
-
v =
|
|
12001
|
-
arg =
|
|
12003
|
+
v = toNumber2(v);
|
|
12004
|
+
arg = toNumber2(arg);
|
|
12002
12005
|
const scaled = shiftDecimal(Math.abs(v), arg);
|
|
12003
12006
|
if (!(scaled <= Number.MAX_SAFE_INTEGER))
|
|
12004
12007
|
return v;
|
|
@@ -31952,7 +31955,7 @@ function parseDate(text4) {
|
|
|
31952
31955
|
}
|
|
31953
31956
|
function newDate(...args) {
|
|
31954
31957
|
let date;
|
|
31955
|
-
if (args.length === 0) date =
|
|
31958
|
+
if (args.length === 0) date = buildTime();
|
|
31956
31959
|
else if (args.length === 1) {
|
|
31957
31960
|
const [value] = args;
|
|
31958
31961
|
date = typeof value === "string" ? new Date(parseDate(value)) : new Date(value);
|
|
@@ -33623,7 +33626,7 @@ function parseDate2(text4) {
|
|
|
33623
33626
|
const s = text4;
|
|
33624
33627
|
if (s === "") return void 0;
|
|
33625
33628
|
const lower = s.trim().toLowerCase();
|
|
33626
|
-
if (lower === "now" || lower === "today") return { ms:
|
|
33629
|
+
if (lower === "now" || lower === "today") return { ms: buildTime().getTime(), offset: 0 };
|
|
33627
33630
|
if (/^[+-]?[0-9]+$/.test(s)) {
|
|
33628
33631
|
const seconds = Number(s);
|
|
33629
33632
|
return Number.isSafeInteger(seconds) ? { ms: seconds * 1e3, offset: 0 } : void 0;
|
|
@@ -33723,7 +33726,7 @@ function liquidjs() {
|
|
|
33723
33726
|
return library3;
|
|
33724
33727
|
}
|
|
33725
33728
|
function liquidRenderer(env, loaded) {
|
|
33726
|
-
const { Liquid, IfTag, IncludeTag, UnlessTag, TypeGuards } = liquidjs();
|
|
33729
|
+
const { Liquid, IfTag, IncludeTag, UnlessTag, Tag, Hash, TypeGuards, evalToken } = liquidjs();
|
|
33727
33730
|
const root = env.config.root;
|
|
33728
33731
|
const isFile2 = (file) => fs3.statSync(file, { throwIfNoEntry: false })?.isFile() ?? false;
|
|
33729
33732
|
const includes = /* @__PURE__ */ new Map();
|
|
@@ -33772,6 +33775,56 @@ function liquidRenderer(env, loaded) {
|
|
|
33772
33775
|
super(token, remain, liquid2, parser);
|
|
33773
33776
|
}
|
|
33774
33777
|
});
|
|
33778
|
+
const relative3 = /* @__PURE__ */ new Map();
|
|
33779
|
+
liquid.registerTag("include_relative", class extends Tag {
|
|
33780
|
+
file;
|
|
33781
|
+
hash;
|
|
33782
|
+
from;
|
|
33783
|
+
constructor(token, remain, engine) {
|
|
33784
|
+
super(token, remain, engine);
|
|
33785
|
+
const tk = this.tokenizer;
|
|
33786
|
+
tk.skipBlank();
|
|
33787
|
+
const begin = tk.p;
|
|
33788
|
+
const quoted = tk.readQuoted();
|
|
33789
|
+
if (quoted) this.file = quoted.content;
|
|
33790
|
+
else {
|
|
33791
|
+
while (!tk.end() && !/\s/.test(tk.peek())) {
|
|
33792
|
+
if (tk.input.startsWith("{{", tk.p)) {
|
|
33793
|
+
const close = tk.input.indexOf("}}", tk.p);
|
|
33794
|
+
if (close === -1) throw tk.error("include_relative: `{{` without `}}` in the file name");
|
|
33795
|
+
tk.p = close + 2;
|
|
33796
|
+
} else tk.advance();
|
|
33797
|
+
}
|
|
33798
|
+
this.file = tk.input.slice(begin, tk.p);
|
|
33799
|
+
}
|
|
33800
|
+
if (!this.file) throw tk.error("include_relative needs a file name (`{% include_relative part.md %}`)");
|
|
33801
|
+
this.hash = new Hash(tk, true);
|
|
33802
|
+
const file = token.file ?? "";
|
|
33803
|
+
this.from = path4.dirname(path4.isAbsolute(file) ? file : path4.resolve(root, file));
|
|
33804
|
+
}
|
|
33805
|
+
*render(ctx, emitter) {
|
|
33806
|
+
const r = this.liquid.renderer;
|
|
33807
|
+
let name = this.file;
|
|
33808
|
+
if (name.includes("{{")) name = String(yield r.renderTemplates(this.liquid.parse(name), ctx));
|
|
33809
|
+
if (name.split(/[\\/]/).includes("..")) throw new BuildError(`include_relative "${name}": the file has to be in the template's folder or below it, without ".."`);
|
|
33810
|
+
const file = path4.resolve(this.from, name);
|
|
33811
|
+
let templates = relative3.get(file);
|
|
33812
|
+
if (!templates) {
|
|
33813
|
+
if (!isFile2(file)) throw new BuildError(`include_relative "${name}": ${path4.relative(root, file).split(path4.sep).join("/")} not found (it's read beside the template, not in _includes)`);
|
|
33814
|
+
const text4 = fs3.readFileSync(file, "utf8");
|
|
33815
|
+
includes.set(text4, file);
|
|
33816
|
+
templates = this.liquid.parse(text4, file);
|
|
33817
|
+
relative3.set(file, templates);
|
|
33818
|
+
}
|
|
33819
|
+
const include2 = yield this.hash.render(ctx);
|
|
33820
|
+
ctx.push({ include: include2 });
|
|
33821
|
+
try {
|
|
33822
|
+
emitter.write(yield r.renderTemplates(templates, ctx));
|
|
33823
|
+
} finally {
|
|
33824
|
+
ctx.pop();
|
|
33825
|
+
}
|
|
33826
|
+
}
|
|
33827
|
+
});
|
|
33775
33828
|
if (env.strict) {
|
|
33776
33829
|
const existence = (value) => value.filters.length === 0 && value.initial.postfix.every((t) => !TypeGuards.isOperatorToken(t) || ["and", "or", "not"].includes(t.operator));
|
|
33777
33830
|
const lenientWhereAsked = (branches) => {
|
|
@@ -33794,6 +33847,28 @@ function liquidRenderer(env, loaded) {
|
|
|
33794
33847
|
}
|
|
33795
33848
|
});
|
|
33796
33849
|
}
|
|
33850
|
+
const BLANK_TAGS = /* @__PURE__ */ new Set(["assign", "capture", "comment", "#"]);
|
|
33851
|
+
const isBlank = (templates) => (templates ?? []).every((t) => {
|
|
33852
|
+
if (t.blankBlock === true) return true;
|
|
33853
|
+
if (typeof t.name === "string") return BLANK_TAGS.has(t.name);
|
|
33854
|
+
return typeof t.str === "string" && /^\s*$/.test(t.str);
|
|
33855
|
+
});
|
|
33856
|
+
const discard = { write() {
|
|
33857
|
+
}, buffer: "" };
|
|
33858
|
+
for (const name of ["if", "unless", "for", "case"]) {
|
|
33859
|
+
const Base = liquid.tags[name];
|
|
33860
|
+
liquid.registerTag(name, class extends Base {
|
|
33861
|
+
blankBlock;
|
|
33862
|
+
constructor(...args) {
|
|
33863
|
+
super(...args);
|
|
33864
|
+
const self2 = this;
|
|
33865
|
+
this.blankBlock = isBlank(self2.templates) && isBlank(self2.elseTemplates) && (self2.branches ?? []).every((b) => isBlank(b.templates));
|
|
33866
|
+
}
|
|
33867
|
+
*render(ctx, emitter) {
|
|
33868
|
+
return yield super.render(ctx, this.blankBlock ? discard : emitter);
|
|
33869
|
+
}
|
|
33870
|
+
});
|
|
33871
|
+
}
|
|
33797
33872
|
for (const [name, impl] of Object.entries(liquid.filters)) {
|
|
33798
33873
|
if (["json", "jsonify", "inspect"].includes(name)) continue;
|
|
33799
33874
|
const handler = typeof impl === "function" ? impl : impl.handler;
|
|
@@ -33824,7 +33899,34 @@ function liquidRenderer(env, loaded) {
|
|
|
33824
33899
|
liquid.registerFilter("date_to_long_string", dateString("%B"));
|
|
33825
33900
|
for (const [name, fn] of Object.entries(MATH)) liquid.registerFilter(name, fn);
|
|
33826
33901
|
for (const [name, fn] of Object.entries(TEXT)) liquid.registerFilter(name, fn);
|
|
33902
|
+
fastWhere(liquid);
|
|
33827
33903
|
const functions = new Map([...env.pipeFilters, ...env.globals]);
|
|
33904
|
+
const invoke = (context2, name, fn, args) => {
|
|
33905
|
+
const answers = context2?.globals?.[ANSWERS];
|
|
33906
|
+
const at2 = answers ? answers.at++ : -1;
|
|
33907
|
+
const known = answers?.calls[at2];
|
|
33908
|
+
if (known?.fn === fn) return known.value;
|
|
33909
|
+
let out;
|
|
33910
|
+
try {
|
|
33911
|
+
out = fn(...args);
|
|
33912
|
+
} catch (e) {
|
|
33913
|
+
throw thrown2(name, e, root);
|
|
33914
|
+
}
|
|
33915
|
+
if (out instanceof Promise) {
|
|
33916
|
+
const settled2 = watchSettle(out).catch((e) => {
|
|
33917
|
+
throw thrown2(name, e, root);
|
|
33918
|
+
});
|
|
33919
|
+
answers?.calls.splice(at2, Infinity, { fn, value: settled2 });
|
|
33920
|
+
if (context2?.sync) {
|
|
33921
|
+
settled2.catch(() => {
|
|
33922
|
+
});
|
|
33923
|
+
throw new NeedsAsync();
|
|
33924
|
+
}
|
|
33925
|
+
return settled2;
|
|
33926
|
+
}
|
|
33927
|
+
answers?.calls.splice(at2, Infinity, { fn, value: out });
|
|
33928
|
+
return out;
|
|
33929
|
+
};
|
|
33828
33930
|
for (const [name, fn] of functions) {
|
|
33829
33931
|
liquid.registerFilter(name, function(input, ...rest) {
|
|
33830
33932
|
const args = [given2(input)];
|
|
@@ -33834,30 +33936,64 @@ function liquidRenderer(env, loaded) {
|
|
|
33834
33936
|
else args.push(given2(arg));
|
|
33835
33937
|
});
|
|
33836
33938
|
if (options) args.push(options);
|
|
33837
|
-
|
|
33838
|
-
|
|
33839
|
-
|
|
33840
|
-
|
|
33841
|
-
|
|
33842
|
-
|
|
33843
|
-
|
|
33844
|
-
|
|
33845
|
-
|
|
33939
|
+
return invoke(this.context, name, fn, args);
|
|
33940
|
+
});
|
|
33941
|
+
}
|
|
33942
|
+
for (const [name, fn] of functions) {
|
|
33943
|
+
if (name in liquid.tags) continue;
|
|
33944
|
+
liquid.registerTag(name, class extends Tag {
|
|
33945
|
+
values = [];
|
|
33946
|
+
named = [];
|
|
33947
|
+
templates;
|
|
33948
|
+
constructor(token, remain, engine, parser) {
|
|
33949
|
+
super(token, remain, engine);
|
|
33950
|
+
const tk = this.tokenizer;
|
|
33951
|
+
for (; ; ) {
|
|
33952
|
+
tk.skipBlank();
|
|
33953
|
+
if (tk.peek() === ",") {
|
|
33954
|
+
tk.advance();
|
|
33955
|
+
tk.skipBlank();
|
|
33956
|
+
}
|
|
33957
|
+
if (tk.end()) break;
|
|
33958
|
+
const start = tk.p;
|
|
33959
|
+
const key = tk.readIdentifier();
|
|
33960
|
+
tk.skipBlank();
|
|
33961
|
+
const sep = tk.peek();
|
|
33962
|
+
if (key.content && (sep === ":" || sep === "=" && tk.input[tk.p + 1] !== "=")) {
|
|
33963
|
+
tk.advance();
|
|
33964
|
+
this.named.push([key.content, tk.readValueOrThrow()]);
|
|
33965
|
+
continue;
|
|
33966
|
+
}
|
|
33967
|
+
tk.p = start;
|
|
33968
|
+
const value = tk.readValue();
|
|
33969
|
+
if (!value && tk.peek() === "|") throw tk.error(`a filter can't go in {% ${name} %}'s arguments ("${tk.remaining().trim()}"): \`assign\` the value first, then pass the variable`);
|
|
33970
|
+
if (!value) throw tk.error(`expected a value in {% ${name} %}'s arguments, at "${tk.remaining()}"`);
|
|
33971
|
+
this.values.push(value);
|
|
33972
|
+
}
|
|
33973
|
+
if (remain.some((t) => TypeGuards.isTagToken(t) && t.name === `end${name}`)) {
|
|
33974
|
+
this.templates = [];
|
|
33975
|
+
while (remain.length) {
|
|
33976
|
+
const next = remain.shift();
|
|
33977
|
+
if (TypeGuards.isTagToken(next) && next.name === `end${name}`) break;
|
|
33978
|
+
this.templates.push(parser.parseToken(next, remain));
|
|
33979
|
+
}
|
|
33980
|
+
}
|
|
33846
33981
|
}
|
|
33847
|
-
|
|
33848
|
-
const
|
|
33849
|
-
|
|
33850
|
-
|
|
33851
|
-
|
|
33852
|
-
|
|
33853
|
-
|
|
33854
|
-
|
|
33855
|
-
throw new NeedsAsync();
|
|
33982
|
+
*render(ctx, emitter) {
|
|
33983
|
+
const args = [];
|
|
33984
|
+
if (this.templates) args.push(yield this.liquid.renderer.renderTemplates(this.templates, ctx));
|
|
33985
|
+
for (const value of this.values) args.push(given2(yield evalToken(value, ctx)));
|
|
33986
|
+
if (this.named.length) {
|
|
33987
|
+
const options = {};
|
|
33988
|
+
for (const [key, value] of this.named) options[key] = given2(yield evalToken(value, ctx));
|
|
33989
|
+
args.push(options);
|
|
33856
33990
|
}
|
|
33857
|
-
|
|
33991
|
+
const out = yield invoke(ctx, name, fn, args);
|
|
33992
|
+
emitter.write(tagText(out));
|
|
33993
|
+
}
|
|
33994
|
+
*children() {
|
|
33995
|
+
return this.templates ?? [];
|
|
33858
33996
|
}
|
|
33859
|
-
answers?.calls.splice(at2, Infinity, { fn, value: out });
|
|
33860
|
-
return out;
|
|
33861
33997
|
});
|
|
33862
33998
|
}
|
|
33863
33999
|
const filterNames = () => Object.keys(liquid.filters);
|
|
@@ -33866,7 +34002,30 @@ function liquidRenderer(env, loaded) {
|
|
|
33866
34002
|
const fail = (e, ctx) => {
|
|
33867
34003
|
throw new BuildError(describe(e, ctx, env, filterNames(), includes));
|
|
33868
34004
|
};
|
|
33869
|
-
|
|
34005
|
+
const told = /* @__PURE__ */ new Set();
|
|
34006
|
+
const watched = (data2, ctx) => {
|
|
34007
|
+
const page = data2.page;
|
|
34008
|
+
if (!isPlainObject(page) || told.size >= 20) return data2;
|
|
34009
|
+
const look = (key) => {
|
|
34010
|
+
if (typeof key !== "string" || told.has(key) || Object.hasOwn(page, key) || !Object.hasOwn(data2, key) || data2[key] === void 0) return;
|
|
34011
|
+
told.add(key);
|
|
34012
|
+
const shown2 = typeof page.inputPath === "string" ? page.inputPath.replace(/^\.\//, "") : path4.relative(root, path4.resolve(root, ctx.inputPath)).split(path4.sep).join("/");
|
|
34013
|
+
warn(warning("template", `rendering ${shown2}: \`page.${key}\` is empty: in ssqch, front matter is at the top level, so it's \`${key}\` (\`page\` has the page's url, inputPath, date and headings). Said once for each name.`, { file: shown2 }));
|
|
34014
|
+
};
|
|
34015
|
+
const proxy = new Proxy(page, {
|
|
34016
|
+
getOwnPropertyDescriptor(target, key) {
|
|
34017
|
+
look(key);
|
|
34018
|
+
return Reflect.getOwnPropertyDescriptor(target, key);
|
|
34019
|
+
},
|
|
34020
|
+
get(target, key, receiver) {
|
|
34021
|
+
if (!(key in target)) look(key);
|
|
34022
|
+
return Reflect.get(target, key, receiver);
|
|
34023
|
+
}
|
|
34024
|
+
});
|
|
34025
|
+
return { ...data2, page: proxy };
|
|
34026
|
+
};
|
|
34027
|
+
return (source, given3, ctx) => {
|
|
34028
|
+
const data2 = watched(given3, ctx);
|
|
33870
34029
|
let templates = ctx.cacheKey === void 0 ? void 0 : compiled.get(ctx.cacheKey);
|
|
33871
34030
|
if (!templates) {
|
|
33872
34031
|
try {
|
|
@@ -33898,6 +34057,12 @@ function needsAsync(e) {
|
|
|
33898
34057
|
return false;
|
|
33899
34058
|
}
|
|
33900
34059
|
var given2 = (v) => v === void 0 ? null : isFloat(v) ? v.n : v;
|
|
34060
|
+
function tagText(v) {
|
|
34061
|
+
if (v === void 0 || v === null) return "";
|
|
34062
|
+
if (Array.isArray(v)) return v.map(tagText).join("");
|
|
34063
|
+
const shown2 = printable2(v);
|
|
34064
|
+
return typeof shown2 === "string" ? shown2 : String(shown2);
|
|
34065
|
+
}
|
|
33901
34066
|
function printable2(v) {
|
|
33902
34067
|
if (v instanceof Date) return Number.isNaN(v.getTime()) ? String(v) : showDate2(v);
|
|
33903
34068
|
if (isFloat(v)) return v.n;
|
|
@@ -33925,13 +34090,79 @@ function number2(v, what) {
|
|
|
33925
34090
|
}
|
|
33926
34091
|
throw new BuildError(what === "input" ? "invalid input: Number expected" : "invalid argument `operand`: Number expected");
|
|
33927
34092
|
}
|
|
34093
|
+
function toNumber(v) {
|
|
34094
|
+
if (isFloat(v)) return { value: v.n, float: true };
|
|
34095
|
+
if (typeof v === "number") return { value: v, float: !Number.isInteger(v) };
|
|
34096
|
+
if (typeof v === "string") {
|
|
34097
|
+
const t = v.trim();
|
|
34098
|
+
if (/^-?\d+\.\d+$/.test(t)) return { value: Number(t), float: true };
|
|
34099
|
+
const whole = /^[+-]?\d+(?:_\d+)*/.exec(t)?.[0];
|
|
34100
|
+
return { value: whole === void 0 ? 0 : Number(whole.replaceAll("_", "")), float: false };
|
|
34101
|
+
}
|
|
34102
|
+
return { value: 0, float: false };
|
|
34103
|
+
}
|
|
33928
34104
|
var float = (n) => Number.isInteger(n) ? new FloatValue(n) : n;
|
|
33929
34105
|
var arithmetic = (whole, exact, checkZero = false) => (input, operand) => {
|
|
33930
|
-
const a =
|
|
34106
|
+
const a = toNumber(input), b = toNumber(operand);
|
|
33931
34107
|
if (checkZero && b.value === 0) throw new BuildError("invalid argument `operand`: Can't divide by zero");
|
|
33932
34108
|
return a.float || b.float ? float(exact(a.value, b.value)) : whole(a.value, b.value);
|
|
33933
34109
|
};
|
|
33934
34110
|
var round = (n) => Math.sign(n) * Math.round(Math.abs(n));
|
|
34111
|
+
function fastWhere(liquid) {
|
|
34112
|
+
const { Tokenizer: Tokenizer2, TypeGuards, evalTokenValue, toValueSync, isTruthy, toValue } = liquidjs();
|
|
34113
|
+
const comparable = (v) => v && typeof v.equals === "function" && typeof v.gt === "function" && typeof v.geq === "function" && typeof v.lt === "function" && typeof v.leq === "function";
|
|
34114
|
+
const SLOW = /* @__PURE__ */ Symbol("slow");
|
|
34115
|
+
const equals = (lhs, rhs) => {
|
|
34116
|
+
if (comparable(lhs)) {
|
|
34117
|
+
const r = lhs.equals(rhs);
|
|
34118
|
+
return typeof r === "boolean" ? r : SLOW;
|
|
34119
|
+
}
|
|
34120
|
+
if (comparable(rhs)) {
|
|
34121
|
+
const r = rhs.equals(lhs);
|
|
34122
|
+
return typeof r === "boolean" ? r : SLOW;
|
|
34123
|
+
}
|
|
34124
|
+
lhs = toValue(lhs);
|
|
34125
|
+
rhs = toValue(rhs);
|
|
34126
|
+
if (Array.isArray(lhs)) {
|
|
34127
|
+
if (!Array.isArray(rhs) || lhs.length !== rhs.length) return false;
|
|
34128
|
+
for (let i2 = 0; i2 < lhs.length; i2++) {
|
|
34129
|
+
const same4 = equals(lhs[i2], rhs[i2]);
|
|
34130
|
+
if (same4 !== true) return same4;
|
|
34131
|
+
}
|
|
34132
|
+
return true;
|
|
34133
|
+
}
|
|
34134
|
+
return lhs === rhs;
|
|
34135
|
+
};
|
|
34136
|
+
const isAsync = (v) => v !== null && typeof v === "object" && (typeof v.then === "function" || typeof v.next === "function");
|
|
34137
|
+
for (const [name, include2] of [["where", true], ["reject", false]]) {
|
|
34138
|
+
const slow = liquid.filters[name];
|
|
34139
|
+
const slowHandler = typeof slow === "function" ? slow : slow.handler;
|
|
34140
|
+
liquid.registerFilter(name, function(input, property, ...rest) {
|
|
34141
|
+
const fallback = () => slowHandler.call(this, input, property, ...rest);
|
|
34142
|
+
const ctx = this.context;
|
|
34143
|
+
const list2 = asText(input);
|
|
34144
|
+
if (!Array.isArray(list2) || ctx.strictVariables || rest.length > 1) return fallback();
|
|
34145
|
+
const token = new Tokenizer2(String(property ?? "")).readScopeValue();
|
|
34146
|
+
if (!token || token.variable || !token.props.every((p) => TypeGuards.isWordToken(p) || TypeGuards.isQuotedToken(p) || TypeGuards.isNumberToken(p))) return fallback();
|
|
34147
|
+
const keys = token.props.map((p) => toValueSync(evalTokenValue(p, ctx)));
|
|
34148
|
+
const expected = rest.length ? asText(rest[0]) : void 0;
|
|
34149
|
+
ctx.memoryLimit.use(list2.length);
|
|
34150
|
+
const out = [];
|
|
34151
|
+
for (const item of list2) {
|
|
34152
|
+
if (item === null || typeof item !== "object" && typeof item !== "function") return fallback();
|
|
34153
|
+
let value = keys[0] in item ? item : ctx.globals;
|
|
34154
|
+
for (const key of keys) {
|
|
34155
|
+
value = ctx.readProperty(value, key);
|
|
34156
|
+
if (isAsync(value)) return fallback();
|
|
34157
|
+
}
|
|
34158
|
+
const matched = expected === void 0 ? isTruthy(value, ctx) : equals(value, expected);
|
|
34159
|
+
if (matched === SLOW) return fallback();
|
|
34160
|
+
if (matched === include2) out.push(item);
|
|
34161
|
+
}
|
|
34162
|
+
return out;
|
|
34163
|
+
});
|
|
34164
|
+
}
|
|
34165
|
+
}
|
|
33935
34166
|
var MATH = {
|
|
33936
34167
|
plus: arithmetic((a, b) => a + b, (a, b) => a + b),
|
|
33937
34168
|
minus: arithmetic((a, b) => a - b, (a, b) => a - b),
|
|
@@ -33941,18 +34172,18 @@ var MATH = {
|
|
|
33941
34172
|
at_least: arithmetic((a, b) => Math.max(a, b), (a, b) => Math.max(a, b)),
|
|
33942
34173
|
at_most: arithmetic((a, b) => Math.min(a, b), (a, b) => Math.min(a, b)),
|
|
33943
34174
|
abs: (input) => {
|
|
33944
|
-
const n =
|
|
34175
|
+
const n = toNumber(input);
|
|
33945
34176
|
return n.float ? float(Math.abs(n.value)) : Math.abs(n.value);
|
|
33946
34177
|
},
|
|
33947
34178
|
round: (input, places) => {
|
|
33948
|
-
const n =
|
|
33949
|
-
const p = places === void 0 || places === null ? 0 :
|
|
34179
|
+
const n = toNumber(input).value;
|
|
34180
|
+
const p = places === void 0 || places === null ? 0 : toNumber(places).value;
|
|
33950
34181
|
if (p <= 0) return round(n);
|
|
33951
34182
|
const m = 10 ** p;
|
|
33952
34183
|
return float(round(n * m) / m);
|
|
33953
34184
|
},
|
|
33954
|
-
ceil: (input) => Math.ceil(
|
|
33955
|
-
floor: (input) => Math.floor(
|
|
34185
|
+
ceil: (input) => Math.ceil(toNumber(input).value),
|
|
34186
|
+
floor: (input) => Math.floor(toNumber(input).value)
|
|
33956
34187
|
};
|
|
33957
34188
|
function same2(a, b) {
|
|
33958
34189
|
if (a === b) return true;
|
|
@@ -33989,10 +34220,16 @@ var TEXT = {
|
|
|
33989
34220
|
throw new BuildError("invalid input: Malformed UTF-8");
|
|
33990
34221
|
}
|
|
33991
34222
|
},
|
|
34223
|
+
// Ruby's `String#split`, as Ruby's Liquid calls it: by nothing, the characters; by one space, at
|
|
34224
|
+
// each run of whitespace, with none at the start; and empty strings at the end dropped
|
|
34225
|
+
// (`"a,b,,"` is two). 0.7, after the liquid crate, kept them and split at each space.
|
|
33992
34226
|
split: (input, pattern) => {
|
|
33993
34227
|
const s = text2(input), by = text2(pattern);
|
|
33994
34228
|
if (s === "") return [];
|
|
33995
|
-
|
|
34229
|
+
if (by === "") return [...s];
|
|
34230
|
+
const parts = by === " " ? s.replace(/^[ \t\n\v\f\r]+/, "").split(/[ \t\n\v\f\r]+/) : s.split(by);
|
|
34231
|
+
while (parts.length && parts[parts.length - 1] === "") parts.pop();
|
|
34232
|
+
return parts;
|
|
33996
34233
|
},
|
|
33997
34234
|
array_to_sentence_string: (input, connector) => {
|
|
33998
34235
|
if (!Array.isArray(input)) throw new BuildError("invalid input: Array expected");
|
|
@@ -35264,11 +35501,42 @@ function nunjucksEngine(env, flavor = "njk") {
|
|
|
35264
35501
|
names.set(found2, name.replaceAll("\\", "/"));
|
|
35265
35502
|
}
|
|
35266
35503
|
const source = found2 ? { src: fs4.readFileSync(found2, "utf8"), path: found2, noCache: false } : null;
|
|
35504
|
+
if (source) shadows(source.src, found2);
|
|
35267
35505
|
sources.set(name, source);
|
|
35268
35506
|
return source;
|
|
35269
35507
|
}
|
|
35270
35508
|
});
|
|
35271
35509
|
const loader = new Loader2();
|
|
35510
|
+
const shadowed = /* @__PURE__ */ new Set();
|
|
35511
|
+
const shadows = (src, file) => {
|
|
35512
|
+
if (!env.config.siteFilters?.size) return;
|
|
35513
|
+
const lineOf = (at2) => src.slice(0, at2).split("\n").length;
|
|
35514
|
+
const report = (name, kind2, at2) => {
|
|
35515
|
+
if (!env.config.siteFilters?.has(name)) return;
|
|
35516
|
+
const calls = src.replace(new RegExp(`\\{%-?\\s*macro\\s+${name}\\s*\\(`, "g"), "").match(new RegExp(`(?<!\\|\\s*)(?<![\\w.])${name}\\s*\\(`));
|
|
35517
|
+
if (!calls) return;
|
|
35518
|
+
const shown2 = path5.relative(root, file).split(path5.sep).join("/");
|
|
35519
|
+
const key = `${shown2}\0${name}`;
|
|
35520
|
+
if (shadowed.has(key)) return;
|
|
35521
|
+
shadowed.add(key);
|
|
35522
|
+
warn(warning("template", `${shown2}:${lineOf(at2)}: the ${kind2} \`${name}\` has the name of the config's filter \`${name}\`, so \`${name}(...)\` in this template means the ${kind2}, not the filter. Rename one of them.`, { file: shown2, line: lineOf(at2) }));
|
|
35523
|
+
};
|
|
35524
|
+
const names2 = (list2) => list2.split(",").map((n) => n.trim().split(/\s*=|\s/)[0]).filter((n) => /^[A-Za-z_]\w*$/.test(n));
|
|
35525
|
+
for (const m of src.matchAll(/\{%-?\s*macro\s+([A-Za-z_]\w*)\s*\(([^)]*)\)/g)) {
|
|
35526
|
+
report(m[1], "macro", m.index);
|
|
35527
|
+
for (const param of names2(m[2])) report(param, "macro parameter", m.index);
|
|
35528
|
+
}
|
|
35529
|
+
for (const m of src.matchAll(/\{%-?\s*from\s+\S+\s+import\s+([\s\S]*?)\s*-?%\}/g)) {
|
|
35530
|
+
for (const item of m[1].replace(/\s+(with|without)\s+context\s*$/, "").split(",")) {
|
|
35531
|
+
const parts = item.trim().split(/\s+as\s+/);
|
|
35532
|
+
const name = (parts[1] ?? parts[0]).trim();
|
|
35533
|
+
if (/^[A-Za-z_]\w*$/.test(name)) report(name, "imported macro", m.index);
|
|
35534
|
+
}
|
|
35535
|
+
}
|
|
35536
|
+
for (const m of src.matchAll(/\{%-?\s*import\s+\S+\s+as\s+([A-Za-z_]\w*)/g)) report(m[1], "import", m.index);
|
|
35537
|
+
for (const m of src.matchAll(/\{%-?\s*set\s+([A-Za-z_]\w*(?:\s*,\s*[A-Za-z_]\w*)*)/g)) for (const name of names2(m[1])) report(name, "variable", m.index);
|
|
35538
|
+
for (const m of src.matchAll(/\{%-?\s*for\s+([A-Za-z_]\w*(?:\s*,\s*[A-Za-z_]\w*)*)\s+in\b/g)) for (const name of names2(m[1])) report(name, "loop variable", m.index);
|
|
35539
|
+
};
|
|
35272
35540
|
const njk = new import_nunjucks2.default.Environment(loader, { autoescape: true, throwOnUndefined: env.strict, dev: true });
|
|
35273
35541
|
includeNames.set(njk, names);
|
|
35274
35542
|
const escape3 = flavor === "jinja" ? escapeJinja : import_nunjucks2.default.lib.escape;
|
|
@@ -35280,7 +35548,7 @@ function nunjucksEngine(env, flavor = "njk") {
|
|
|
35280
35548
|
const call3 = (name, fn, args) => callSite(name, fn, siteArgs(args), root);
|
|
35281
35549
|
for (const [name, fn] of functions) njk.addFilter(name, (...args) => call3(name, fn, args));
|
|
35282
35550
|
for (const [name, fn] of env.globals) njk.addGlobal(name, (...args) => call3(name, fn, args));
|
|
35283
|
-
const now = () =>
|
|
35551
|
+
const now = () => buildTime();
|
|
35284
35552
|
njk.addGlobal("now", (...args) => call3("now", now, args));
|
|
35285
35553
|
if (env.globals.size) {
|
|
35286
35554
|
const text4 = flavor === "njk" ? njkString : pyString;
|
|
@@ -35313,6 +35581,7 @@ function nunjucksEngine(env, flavor = "njk") {
|
|
|
35313
35581
|
const template = (source, ctx) => {
|
|
35314
35582
|
const kept = ctx.cacheKey === void 0 ? void 0 : compiled.get(ctx.cacheKey);
|
|
35315
35583
|
if (kept) return kept;
|
|
35584
|
+
shadows(source, path5.resolve(root, ctx.inputPath));
|
|
35316
35585
|
const made = new import_nunjucks2.default.Template(MARKDOWN.test(ctx.inputPath) ? markdownAttributes(source) : source, njk, ctx.inputPath, true);
|
|
35317
35586
|
if (ctx.cacheKey !== void 0) compiled.set(ctx.cacheKey, made);
|
|
35318
35587
|
return made;
|
|
@@ -35513,8 +35782,17 @@ var Site = class {
|
|
|
35513
35782
|
for (const row of TABLE) {
|
|
35514
35783
|
if (row.kind !== "filter" || !row.alias || config.filters.has(row.word)) continue;
|
|
35515
35784
|
const target = globals.get(row.ssqch);
|
|
35785
|
+
const takesUrl = row.ssqch === "base";
|
|
35786
|
+
let warned = false;
|
|
35516
35787
|
pipeFilters.set(row.word, (...args) => {
|
|
35517
35788
|
aliasUsed(row);
|
|
35789
|
+
if (takesUrl && args[0] === false) {
|
|
35790
|
+
if (!warned) {
|
|
35791
|
+
warned = true;
|
|
35792
|
+
warn(warning("template", `\`${row.word}\` got false, the url of a page with \`permalink: false\`, and printed nothing instead of "false". Leave such pages out first: \`{% if p.url %}\``));
|
|
35793
|
+
}
|
|
35794
|
+
return "";
|
|
35795
|
+
}
|
|
35518
35796
|
return target ? target(...args) : args[0];
|
|
35519
35797
|
});
|
|
35520
35798
|
}
|
|
@@ -35592,7 +35870,7 @@ var Site = class {
|
|
|
35592
35870
|
const [themePages, themeCopies] = this.themeFiles();
|
|
35593
35871
|
this.files.push(...themePages);
|
|
35594
35872
|
this.themeCopies = themeCopies;
|
|
35595
|
-
const commitDates = config.lastModified === "git" ? this.gitDates() : /* @__PURE__ */ new Map();
|
|
35873
|
+
const commitDates = config.lastModified === "git" || config.dateFallback === "git" ? this.gitDates(config.lastModified === "git" ? "lastModified" : "dateFallback") : /* @__PURE__ */ new Map();
|
|
35596
35874
|
const dirData = await this.loadDirectoryData();
|
|
35597
35875
|
const sources = await readAll(this.files);
|
|
35598
35876
|
const tpls = await collectErrors(this.files.map((file, i2) => () => this.loadTemplate(file, sources[i2], dirData, commitDates)));
|
|
@@ -35604,8 +35882,9 @@ var Site = class {
|
|
|
35604
35882
|
this.drafts = tpls.length - this.tpls.length;
|
|
35605
35883
|
timer.lap("read");
|
|
35606
35884
|
const overCollections = (t) => typeof t.data.pagination?.data === "string" && t.data.pagination.data.startsWith("collections");
|
|
35607
|
-
const
|
|
35608
|
-
const
|
|
35885
|
+
const waits = (t) => overCollections(t) || readsCollections(t.data.computed);
|
|
35886
|
+
const immediate = this.tpls.filter((t) => !waits(t));
|
|
35887
|
+
const deferred = this.tpls.filter(waits);
|
|
35609
35888
|
const add2 = (pages) => {
|
|
35610
35889
|
for (const page of pages.flat()) {
|
|
35611
35890
|
page.index = this.pages.length;
|
|
@@ -35674,12 +35953,14 @@ var Site = class {
|
|
|
35674
35953
|
if (name.startsWith(".") || name === "node_modules") continue;
|
|
35675
35954
|
if (skipDirs.has(entry.real)) continue;
|
|
35676
35955
|
if (entry.isDirectory) {
|
|
35956
|
+
if (isBundlerInstall(file)) continue;
|
|
35677
35957
|
walk2(file, [...above, entry.real]);
|
|
35678
35958
|
continue;
|
|
35679
35959
|
}
|
|
35680
35960
|
if (!entry.isFile) continue;
|
|
35681
35961
|
this.seen.add(file);
|
|
35682
35962
|
if (isDataFile(name)) continue;
|
|
35963
|
+
if (file === config.file || loadedFiles.has(file)) continue;
|
|
35683
35964
|
const ext = path6.extname(name).slice(1).toLowerCase();
|
|
35684
35965
|
if (!formats.has(ext) && !engines.has(ext)) continue;
|
|
35685
35966
|
const rel = relative(dirs.input, file);
|
|
@@ -35763,12 +36044,12 @@ var Site = class {
|
|
|
35763
36044
|
* with uncommitted changes are left out (they use their modification time). Not a
|
|
35764
36045
|
* repository, or no git: nothing, with a warning.
|
|
35765
36046
|
*/
|
|
35766
|
-
gitDates() {
|
|
36047
|
+
gitDates(setting) {
|
|
35767
36048
|
const { config, dirs } = this;
|
|
35768
36049
|
const git = (...args) => spawnSync("git", ["-C", dirs.root, "-c", "core.quotepath=off", ...args], { encoding: "utf8", maxBuffer: 1 << 30 });
|
|
35769
36050
|
const dates = /* @__PURE__ */ new Map();
|
|
35770
36051
|
const lost = (message) => {
|
|
35771
|
-
if (!config.quiet) warn(warning("last-modified",
|
|
36052
|
+
if (!config.quiet) warn(warning("last-modified", `${setting}: ${message}`));
|
|
35772
36053
|
};
|
|
35773
36054
|
const top = git("rev-parse", "--show-toplevel");
|
|
35774
36055
|
if (top.error) {
|
|
@@ -35918,21 +36199,9 @@ var Site = class {
|
|
|
35918
36199
|
own = merge(own, front, config.deepMerge);
|
|
35919
36200
|
if (this.keepLayers && frontKeys.length) layers.push(["front matter", front]);
|
|
35920
36201
|
const computedLayout = own.computed?.layout;
|
|
35921
|
-
if (computedLayout
|
|
35922
|
-
|
|
35923
|
-
|
|
35924
|
-
}
|
|
35925
|
-
const chain = [];
|
|
35926
|
-
const names = [];
|
|
35927
|
-
let next = typeof own.layout === "string" && own.layout !== "" ? own.layout : void 0;
|
|
35928
|
-
while (typeof next === "string") {
|
|
35929
|
-
const start = names.indexOf(next);
|
|
35930
|
-
if (start !== -1) bail(`${PASSED_THIS_TREE}. Layout loop: ${names.slice(start).join(" -> ")} -> ${next}`);
|
|
35931
|
-
const layout = this.loadLayout(next);
|
|
35932
|
-
names.push(next);
|
|
35933
|
-
chain.push(layout);
|
|
35934
|
-
next = layout.data.layout;
|
|
35935
|
-
}
|
|
36202
|
+
if (typeof computedLayout === "string" && !dependsOnPage(computedLayout)) own.layout = computedLayout;
|
|
36203
|
+
if (isPlainObject(own.computed) && Object.hasOwn(own.computed, "page")) bail("`page` in computed isn't applied, because `page` is ssqch's: its url, inputPath, date and headings. Give the value another name (`computed: { meta: ... }`); front matter is at the top level already (`title`, not `page.title`)");
|
|
36204
|
+
const chain = this.layoutChain(own.layout);
|
|
35936
36205
|
let data2 = this.global;
|
|
35937
36206
|
let layoutLayers = 0;
|
|
35938
36207
|
for (const layout of [...chain].reverse()) {
|
|
@@ -35963,14 +36232,29 @@ var Site = class {
|
|
|
35963
36232
|
fileSlug,
|
|
35964
36233
|
filePathStem: parent === "" ? `/${stem}` : `/${parent}/${stem}`,
|
|
35965
36234
|
mtime,
|
|
35966
|
-
mtimeNs: stat.mtimeNs,
|
|
35967
36235
|
fileDate,
|
|
35968
|
-
lastModified: config.lastModified === "git" ? commitDates.get(file) ?? mtime : config.lastModified === "file" ? mtime : void 0
|
|
36236
|
+
lastModified: config.lastModified === "git" ? commitDates.get(file) ?? mtime : config.lastModified === "file" ? mtime : void 0,
|
|
36237
|
+
commitDate: config.dateFallback === "git" ? commitDates.get(file) : void 0
|
|
35969
36238
|
};
|
|
35970
36239
|
} catch (e) {
|
|
35971
36240
|
throw context(e, `in ${rel}`);
|
|
35972
36241
|
}
|
|
35973
36242
|
}
|
|
36243
|
+
/** The layouts `layout` names, innermost first: that layout, the one its front matter names, and so on. `""`, `false` and `null` are none. */
|
|
36244
|
+
layoutChain(layout) {
|
|
36245
|
+
const chain = [];
|
|
36246
|
+
const names = [];
|
|
36247
|
+
let next = typeof layout === "string" && layout !== "" ? layout : void 0;
|
|
36248
|
+
while (typeof next === "string") {
|
|
36249
|
+
const start = names.indexOf(next);
|
|
36250
|
+
if (start !== -1) bail(`${PASSED_THIS_TREE}. Layout loop: ${names.slice(start).join(" -> ")} -> ${next}`);
|
|
36251
|
+
const found2 = this.loadLayout(next);
|
|
36252
|
+
names.push(next);
|
|
36253
|
+
chain.push(found2);
|
|
36254
|
+
next = found2.data.layout;
|
|
36255
|
+
}
|
|
36256
|
+
return chain;
|
|
36257
|
+
}
|
|
35974
36258
|
// ---- pagination, computed data and permalinks ----------------------------------------------
|
|
35975
36259
|
async expand(tpl, collections) {
|
|
35976
36260
|
try {
|
|
@@ -35986,6 +36270,8 @@ var Site = class {
|
|
|
35986
36270
|
let fromFileTime = false;
|
|
35987
36271
|
if (tpl.data.date !== void 0 && tpl.data.date !== null) date = toDate(tpl.data.date) ?? bail(`can't parse date ${show(tpl.data.date)}`);
|
|
35988
36272
|
else if (tpl.fileDate) date = tpl.fileDate;
|
|
36273
|
+
else if (tpl.commitDate) [date, fromFileTime] = [tpl.commitDate, true];
|
|
36274
|
+
else if (sourceDateEpoch() !== void 0) date = new Date(sourceDateEpoch());
|
|
35989
36275
|
else [date, fromFileTime] = [tpl.mtime, true];
|
|
35990
36276
|
const basePage = (url, outputPath, when) => {
|
|
35991
36277
|
const page = { url, outputPath, inputPath, fileSlug: tpl.fileSlug, filePathStem: tpl.filePathStem, date: when };
|
|
@@ -36029,6 +36315,15 @@ var Site = class {
|
|
|
36029
36315
|
}
|
|
36030
36316
|
}
|
|
36031
36317
|
}
|
|
36318
|
+
let layouts;
|
|
36319
|
+
if (isPlainObject(computed) && Object.hasOwn(computed, "layout") && !(typeof computed.layout === "string" && !dependsOnPage(computed.layout))) {
|
|
36320
|
+
const value = data2.layout;
|
|
36321
|
+
if (value !== void 0 && value !== null && value !== false && typeof value !== "string") bail(`computed.layout must be a layout's name, \`""\` or \`false\`, not ${show(value)}`);
|
|
36322
|
+
layouts = this.layoutChain(value);
|
|
36323
|
+
for (const layout of layouts) {
|
|
36324
|
+
for (const [key, v] of Object.entries(layout.data)) if (key !== "layout" && data2[key] === void 0) data2[key] = v;
|
|
36325
|
+
}
|
|
36326
|
+
}
|
|
36032
36327
|
let pageDate = date;
|
|
36033
36328
|
let fromFile = fromFileTime;
|
|
36034
36329
|
if (isPlainObject(computed) && computed.date !== void 0 && computed.date !== null && data2.date !== void 0 && data2.date !== null) {
|
|
@@ -36061,7 +36356,7 @@ var Site = class {
|
|
|
36061
36356
|
delete data2.collections;
|
|
36062
36357
|
const excluded = Boolean(data2.excludeFromCollections);
|
|
36063
36358
|
const inCollections = !excluded && !tpl.plainCopy && (index2 === 0 || Boolean(pagination?.addAllPagesToCollections));
|
|
36064
|
-
pages.push({ index: -1, tpl, data: data2, url, output, date: pageDate, when: fromFile ?
|
|
36359
|
+
pages.push({ index: -1, tpl, data: data2, url, output, date: pageDate, when: fromFile ? UNDATED : BigInt(pageDate.getTime()) * 1000000n, inCollections, ...layouts ? { layouts } : {} });
|
|
36065
36360
|
}
|
|
36066
36361
|
if (pagination && pages.length) {
|
|
36067
36362
|
const hrefs = pages.map((p) => p.url ?? void 0);
|
|
@@ -36164,9 +36459,16 @@ var Site = class {
|
|
|
36164
36459
|
const site2 = this;
|
|
36165
36460
|
let found2;
|
|
36166
36461
|
return Object.defineProperties({ ...page.data.page }, {
|
|
36167
|
-
|
|
36168
|
-
|
|
36169
|
-
|
|
36462
|
+
// Not remembered until the page has rendered: a read before that (from `computed`, which
|
|
36463
|
+
// runs before any page renders) gets an empty list, and a later one the real headings.
|
|
36464
|
+
headings: {
|
|
36465
|
+
enumerable: true,
|
|
36466
|
+
get() {
|
|
36467
|
+
if (found2) return found2;
|
|
36468
|
+
const html3 = site2.contentOf(page);
|
|
36469
|
+
return html3 === void 0 ? [] : found2 = headings(html3);
|
|
36470
|
+
}
|
|
36471
|
+
},
|
|
36170
36472
|
excerpt: { enumerable: true, get() {
|
|
36171
36473
|
return excerpt(site2.contentOf(page) ?? "");
|
|
36172
36474
|
} }
|
|
@@ -36210,6 +36512,16 @@ function collectionApi(items) {
|
|
|
36210
36512
|
}
|
|
36211
36513
|
};
|
|
36212
36514
|
}
|
|
36515
|
+
var UNDATED = 1n << 80n;
|
|
36516
|
+
function isBundlerInstall(dir) {
|
|
36517
|
+
const ruby = path6.join(dir, "ruby");
|
|
36518
|
+
if (!fs5.existsSync(ruby)) return false;
|
|
36519
|
+
try {
|
|
36520
|
+
return fs5.readdirSync(ruby).some((version2) => fs5.existsSync(path6.join(ruby, version2, "gems")));
|
|
36521
|
+
} catch {
|
|
36522
|
+
return false;
|
|
36523
|
+
}
|
|
36524
|
+
}
|
|
36213
36525
|
var show = (v) => {
|
|
36214
36526
|
try {
|
|
36215
36527
|
return JSON.stringify(v) ?? String(v);
|
|
@@ -36252,6 +36564,14 @@ function renderEngines(v) {
|
|
|
36252
36564
|
if (!names.length) bail("`render` is empty: name an engine (`md`), or use `render: false` to skip processing");
|
|
36253
36565
|
return names;
|
|
36254
36566
|
}
|
|
36567
|
+
var dependsOnPage = (value) => value.includes("{{") || value.includes("{%") || value.includes("<%");
|
|
36568
|
+
function readsCollections(computed) {
|
|
36569
|
+
if (typeof computed === "string") return computed.includes("collections");
|
|
36570
|
+
if (typeof computed === "function") return Function.prototype.toString.call(computed).includes("collections");
|
|
36571
|
+
if (Array.isArray(computed)) return computed.some(readsCollections);
|
|
36572
|
+
if (isPlainObject(computed)) return Object.values(computed).some(readsCollections);
|
|
36573
|
+
return false;
|
|
36574
|
+
}
|
|
36255
36575
|
function dataStringEngine(tpl) {
|
|
36256
36576
|
return tpl.engines.find((e) => e !== "md" && e !== "html" && e !== "txt") ?? "edge";
|
|
36257
36577
|
}
|
|
@@ -36292,6 +36612,7 @@ function errorsTogether(failed) {
|
|
|
36292
36612
|
// src/build.ts
|
|
36293
36613
|
var MAX_WRITES = 64;
|
|
36294
36614
|
async function build(config) {
|
|
36615
|
+
sourceDateEpoch();
|
|
36295
36616
|
const started = performance.now();
|
|
36296
36617
|
const timer = new Timer();
|
|
36297
36618
|
const site2 = new Site(config);
|
|
@@ -36379,7 +36700,7 @@ async function inspectPages(config) {
|
|
|
36379
36700
|
input: p.tpl.input,
|
|
36380
36701
|
output: p.output,
|
|
36381
36702
|
engines: p.tpl.engines,
|
|
36382
|
-
layouts: p.tpl.layouts.map((l) => l.name),
|
|
36703
|
+
layouts: (p.layouts ?? p.tpl.layouts).map((l) => l.name),
|
|
36383
36704
|
date: p.date,
|
|
36384
36705
|
dateFromName: p.tpl.fileDate !== void 0,
|
|
36385
36706
|
inCollections: p.inCollections,
|
|
@@ -36525,13 +36846,14 @@ var Renderer = class {
|
|
|
36525
36846
|
}
|
|
36526
36847
|
this.renderMs += performance.now() - start;
|
|
36527
36848
|
if (page.output === null) return;
|
|
36528
|
-
|
|
36849
|
+
const layouts = page.layouts ?? tpl.layouts;
|
|
36850
|
+
if (layouts.length) {
|
|
36529
36851
|
const data2 = this.data(page);
|
|
36530
36852
|
const had = this.bodies.get(page.index);
|
|
36531
36853
|
this.bodies.set(page.index, content);
|
|
36532
36854
|
try {
|
|
36533
36855
|
data2.page = site2.pageWithBody(page);
|
|
36534
|
-
for (const layout of
|
|
36856
|
+
for (const layout of layouts) {
|
|
36535
36857
|
data2.content = content;
|
|
36536
36858
|
let text4 = layout.body;
|
|
36537
36859
|
for (const name of layout.engines) {
|
|
@@ -36741,7 +37063,7 @@ function checkForeignGlobals(site2) {
|
|
|
36741
37063
|
const sources = [];
|
|
36742
37064
|
const seen = /* @__PURE__ */ new Set();
|
|
36743
37065
|
for (const tpl of site2.tpls) {
|
|
36744
|
-
sources.push([site2.display(tpl.input), tpl.body, tpl]);
|
|
37066
|
+
if (tpl.engines.some((e) => e !== "md" && e !== "html" && e !== "txt")) sources.push([site2.display(tpl.input), tpl.body, tpl]);
|
|
36745
37067
|
for (const layout of tpl.layouts) {
|
|
36746
37068
|
if (seen.has(layout.path)) continue;
|
|
36747
37069
|
seen.add(layout.path);
|
|
@@ -36796,7 +37118,7 @@ function unusedTemplates(site2) {
|
|
|
36796
37118
|
}
|
|
36797
37119
|
function hookEvent(config, dirs, report) {
|
|
36798
37120
|
const rel = (dir) => dir === dirs.root ? "./" : isInside(dirs.root, dir) ? `./${relative(dirs.root, dir)}/` : `${dir}/`;
|
|
36799
|
-
const event = { env: config.env, serving: config.serving, dirs: { input: rel(dirs.input), output: rel(dirs.output), includes: rel(dirs.includes), data: rel(dirs.data) } };
|
|
37121
|
+
const event = { env: config.env, serving: config.serving, quiet: config.quiet, verbose: config.verbose, dirs: { input: rel(dirs.input), output: rel(dirs.output), includes: rel(dirs.includes), data: rel(dirs.data) } };
|
|
36800
37122
|
if (report) event.written = [...report.written];
|
|
36801
37123
|
return event;
|
|
36802
37124
|
}
|
|
@@ -36819,7 +37141,7 @@ async function runHooks(config, dirs, event, hooks, report) {
|
|
|
36819
37141
|
}
|
|
36820
37142
|
function runCommand(config, dirs, event, command) {
|
|
36821
37143
|
if (!config.quiet) progress(`[ssqch] ${event}: ${command}`);
|
|
36822
|
-
const { file, args, options } = commandLine(command, dirs.root, { SSQCH_ENV: config.env, SSQCH_SERVING: config.serving ? "true" : "false", SSQCH_INPUT: dirs.input, SSQCH_OUTPUT: dirs.output });
|
|
37144
|
+
const { file, args, options } = commandLine(command, dirs.root, { SSQCH_ENV: config.env, SSQCH_SERVING: config.serving ? "true" : "false", SSQCH_QUIET: config.quiet ? "true" : "false", SSQCH_INPUT: dirs.input, SSQCH_OUTPUT: dirs.output });
|
|
36823
37145
|
const ran = spawnSync2(file, args, {
|
|
36824
37146
|
...options,
|
|
36825
37147
|
// Standard output is kept for the JSON report, so the command's goes to standard error.
|
|
@@ -36971,6 +37293,27 @@ function globJobs(config, dirs, glob, to) {
|
|
|
36971
37293
|
if (!jobs.length && !config.serving) warn(warning("passthrough", `passthrough glob ${JSON.stringify(pattern)} matches no files`));
|
|
36972
37294
|
return jobs;
|
|
36973
37295
|
}
|
|
37296
|
+
function sameDestinations(jobs, dirs) {
|
|
37297
|
+
const at2 = /* @__PURE__ */ new Map();
|
|
37298
|
+
const kept = [];
|
|
37299
|
+
const same4 = (a, b) => {
|
|
37300
|
+
if (realPath(a) === realPath(b)) return true;
|
|
37301
|
+
const [x, y] = [fs6.statSync(a), fs6.statSync(b)];
|
|
37302
|
+
return x.size === y.size && fs6.readFileSync(a).equals(fs6.readFileSync(b));
|
|
37303
|
+
};
|
|
37304
|
+
for (const job of jobs) {
|
|
37305
|
+
const earlier = at2.get(job[1]);
|
|
37306
|
+
if (earlier === void 0) {
|
|
37307
|
+
at2.set(job[1], kept.length);
|
|
37308
|
+
kept.push(job);
|
|
37309
|
+
continue;
|
|
37310
|
+
}
|
|
37311
|
+
const [first] = kept[earlier];
|
|
37312
|
+
if (!same4(first, job[0])) warn(warning("passthrough", `${shown(dirs.root, first)} and ${shown(dirs.root, job[0])} are both copied to ${shown(dirs.root, job[1])}, and they differ: the one listed later (${shown(dirs.root, job[0])}) is the one written. Remove one, or give one another \`to\``, { file: shown(dirs.root, job[0]) }));
|
|
37313
|
+
kept[earlier] = job;
|
|
37314
|
+
}
|
|
37315
|
+
jobs.splice(0, jobs.length, ...kept);
|
|
37316
|
+
}
|
|
36974
37317
|
async function passthroughCopy(config, dirs, extra) {
|
|
36975
37318
|
const jobs = [...extra];
|
|
36976
37319
|
for (const { from, to } of config.passthrough) {
|
|
@@ -36989,7 +37332,10 @@ async function passthroughCopy(config, dirs, extra) {
|
|
|
36989
37332
|
jobs.push([src, dest]);
|
|
36990
37333
|
}
|
|
36991
37334
|
}
|
|
36992
|
-
|
|
37335
|
+
sameDestinations(jobs, dirs);
|
|
37336
|
+
const renamed = jobs.filter(([, to]) => config.renamedCopies.has(to)).map(([, to]) => config.renamedCopies.get(to));
|
|
37337
|
+
if (renamed.length) jobs.splice(0, jobs.length, ...jobs.filter(([, to]) => !config.renamedCopies.has(to)));
|
|
37338
|
+
const stats = { copied: 0, unchanged: 0, bytes: 0, paths: [...jobs.map(([, to]) => to), ...renamed] };
|
|
36993
37339
|
const folders = /* @__PURE__ */ new Map();
|
|
36994
37340
|
const failed = [];
|
|
36995
37341
|
let next = 0;
|
|
@@ -37085,4 +37431,4 @@ export {
|
|
|
37085
37431
|
runCommand,
|
|
37086
37432
|
OUTPUT_LIST
|
|
37087
37433
|
};
|
|
37088
|
-
/*! For license information please see chunk-
|
|
37434
|
+
/*! For license information please see chunk-SRNLKWXL.js.LEGAL.txt */
|