ssqch 0.8.0 → 0.9.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 +2 -0
- package/bundled/README.md +144 -77
- package/bundled/ssqch.d.ts +17 -9
- package/bundled/trailheads/from-jekyll.md +79 -0
- package/lib/assets.js +7 -7
- package/lib/{chunk-RI2L3VGO.js → chunk-3A647I3N.js} +19 -11
- package/lib/{chunk-AMBFWPZ4.js → chunk-3K3ANWZ2.js} +3 -3
- package/lib/{chunk-WMOVCQO6.js → chunk-47P4YREZ.js} +6 -6
- package/lib/{chunk-C35KIPAR.js → chunk-76NTVE34.js} +98 -7
- package/lib/{chunk-TWCVHOKO.js → chunk-7PWCYHTJ.js} +125 -4
- package/lib/{chunk-JSPSMIJ2.js → chunk-7RDRZHJD.js} +9 -9
- package/lib/{chunk-JRT7TQQP.js → chunk-7SD7K567.js} +1 -1
- package/lib/{chunk-IRHRK7XB.js → chunk-7XLK2GEG.js} +1 -1
- package/lib/{chunk-YSH2NMIE.js → chunk-BEGC7YP6.js} +6 -6
- package/lib/{chunk-HR2RU2LY.js → chunk-CZ4XQC56.js} +6 -6
- package/lib/{chunk-DHHQKW4F.js → chunk-D2XE2GTY.js} +7 -7
- package/lib/{chunk-BOBPVAX2.js → chunk-DELWRJAO.js} +373 -52
- package/lib/{chunk-6XYSFG6V.js → chunk-GRWMGC7D.js} +15 -3
- package/lib/{chunk-N5QTGQ5N.js → chunk-GUKSZ2XM.js} +1 -1
- package/lib/{chunk-TDGBQNGW.js → chunk-HPXAZ2HU.js} +1 -1
- package/lib/{chunk-3PHCFZEU.js → chunk-II5DEH3Q.js} +2 -2
- package/lib/{chunk-FYGE634X.js → chunk-IJWHOFRP.js} +9 -9
- package/lib/{chunk-UGEGUUBT.js → chunk-LPHNACE4.js} +8 -8
- package/lib/{chunk-KBGE5MCY.js → chunk-MI6EJWA2.js} +1 -1
- package/lib/{chunk-EIT4ZDT4.js → chunk-NCWFYT74.js} +61 -5
- package/lib/{chunk-VVPZ5PDP.js → chunk-NNUKIGOO.js} +11 -11
- package/lib/{chunk-TN6EEDX2.js → chunk-R7K3D5W5.js} +28 -6
- package/lib/{chunk-37KSIVNY.js → chunk-RNJFPFXE.js} +3 -3
- package/lib/{chunk-CDEPYU7W.js → chunk-SF4I6Z7S.js} +2 -2
- package/lib/{chunk-GSKVRAHF.js → chunk-SURPOAW7.js} +6 -6
- package/lib/{chunk-BRK4MXXO.js → chunk-SXMJ52IK.js} +18 -11
- package/lib/{chunk-EZZUUPI4.js → chunk-TICWN55Z.js} +2 -2
- package/lib/{chunk-NUKCUDC4.js → chunk-TVU3OPPK.js} +3 -3
- package/lib/{chunk-GOE4ZSAB.js → chunk-XMXBHXZR.js} +9 -9
- package/lib/{chunk-WP3RPVUM.js → chunk-YTHQBMDJ.js} +1 -1
- package/lib/cli.js +32 -25
- package/lib/elements.js +7 -7
- package/lib/image.js +8 -8
- package/lib/links.js +7 -7
- package/lib/minify.js +7 -7
- package/lib/redirects.js +7 -7
- package/lib/rss.js +8 -8
- package/lib/sass.js +45 -10
- package/lib/sitemap.js +36 -11
- package/lib/ssqch.js +4 -4
- package/package.json +1 -1
- package/types/image.d.ts +5 -5
- package/types/index.d.ts +10 -4
- package/types/sitemap.d.ts +2 -0
- package/wasm/markdown.wasm +0 -0
- /package/lib/{chunk-BOBPVAX2.js.LEGAL.txt → chunk-DELWRJAO.js.LEGAL.txt} +0 -0
- /package/lib/{chunk-6XYSFG6V.js.LEGAL.txt → chunk-GRWMGC7D.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-3A647I3N.js";
|
|
11
11
|
import {
|
|
12
12
|
measure,
|
|
13
13
|
overBudget
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-II5DEH3Q.js";
|
|
15
15
|
import {
|
|
16
16
|
checkPages,
|
|
17
17
|
rewriteBase
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-R7K3D5W5.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-NCWFYT74.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-HPXAZ2HU.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-76NTVE34.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-GRWMGC7D.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
|
}
|
|
@@ -35674,12 +35952,14 @@ var Site = class {
|
|
|
35674
35952
|
if (name.startsWith(".") || name === "node_modules") continue;
|
|
35675
35953
|
if (skipDirs.has(entry.real)) continue;
|
|
35676
35954
|
if (entry.isDirectory) {
|
|
35955
|
+
if (isBundlerInstall(file)) continue;
|
|
35677
35956
|
walk2(file, [...above, entry.real]);
|
|
35678
35957
|
continue;
|
|
35679
35958
|
}
|
|
35680
35959
|
if (!entry.isFile) continue;
|
|
35681
35960
|
this.seen.add(file);
|
|
35682
35961
|
if (isDataFile(name)) continue;
|
|
35962
|
+
if (file === config.file || loadedFiles.has(file)) continue;
|
|
35683
35963
|
const ext = path6.extname(name).slice(1).toLowerCase();
|
|
35684
35964
|
if (!formats.has(ext) && !engines.has(ext)) continue;
|
|
35685
35965
|
const rel = relative(dirs.input, file);
|
|
@@ -35922,6 +36202,7 @@ var Site = class {
|
|
|
35922
36202
|
if (typeof computedLayout === "string" && !computedLayout.includes("{{") && !computedLayout.includes("{%") && !computedLayout.includes("<%")) own.layout = computedLayout;
|
|
35923
36203
|
else bail("`layout` in computed isn't applied, because the layout is chosen before computed runs. Set `layout` in the front matter or a data file");
|
|
35924
36204
|
}
|
|
36205
|
+
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`)");
|
|
35925
36206
|
const chain = [];
|
|
35926
36207
|
const names = [];
|
|
35927
36208
|
let next = typeof own.layout === "string" && own.layout !== "" ? own.layout : void 0;
|
|
@@ -35963,7 +36244,6 @@ var Site = class {
|
|
|
35963
36244
|
fileSlug,
|
|
35964
36245
|
filePathStem: parent === "" ? `/${stem}` : `/${parent}/${stem}`,
|
|
35965
36246
|
mtime,
|
|
35966
|
-
mtimeNs: stat.mtimeNs,
|
|
35967
36247
|
fileDate,
|
|
35968
36248
|
lastModified: config.lastModified === "git" ? commitDates.get(file) ?? mtime : config.lastModified === "file" ? mtime : void 0
|
|
35969
36249
|
};
|
|
@@ -35986,6 +36266,7 @@ var Site = class {
|
|
|
35986
36266
|
let fromFileTime = false;
|
|
35987
36267
|
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
36268
|
else if (tpl.fileDate) date = tpl.fileDate;
|
|
36269
|
+
else if (sourceDateEpoch() !== void 0) date = new Date(sourceDateEpoch());
|
|
35989
36270
|
else [date, fromFileTime] = [tpl.mtime, true];
|
|
35990
36271
|
const basePage = (url, outputPath, when) => {
|
|
35991
36272
|
const page = { url, outputPath, inputPath, fileSlug: tpl.fileSlug, filePathStem: tpl.filePathStem, date: when };
|
|
@@ -36061,7 +36342,7 @@ var Site = class {
|
|
|
36061
36342
|
delete data2.collections;
|
|
36062
36343
|
const excluded = Boolean(data2.excludeFromCollections);
|
|
36063
36344
|
const inCollections = !excluded && !tpl.plainCopy && (index2 === 0 || Boolean(pagination?.addAllPagesToCollections));
|
|
36064
|
-
pages.push({ index: -1, tpl, data: data2, url, output, date: pageDate, when: fromFile ?
|
|
36345
|
+
pages.push({ index: -1, tpl, data: data2, url, output, date: pageDate, when: fromFile ? UNDATED : BigInt(pageDate.getTime()) * 1000000n, inCollections });
|
|
36065
36346
|
}
|
|
36066
36347
|
if (pagination && pages.length) {
|
|
36067
36348
|
const hrefs = pages.map((p) => p.url ?? void 0);
|
|
@@ -36164,9 +36445,16 @@ var Site = class {
|
|
|
36164
36445
|
const site2 = this;
|
|
36165
36446
|
let found2;
|
|
36166
36447
|
return Object.defineProperties({ ...page.data.page }, {
|
|
36167
|
-
|
|
36168
|
-
|
|
36169
|
-
|
|
36448
|
+
// Not remembered until the page has rendered: a read before that (from `computed`, which
|
|
36449
|
+
// runs before any page renders) gets an empty list, and a later one the real headings.
|
|
36450
|
+
headings: {
|
|
36451
|
+
enumerable: true,
|
|
36452
|
+
get() {
|
|
36453
|
+
if (found2) return found2;
|
|
36454
|
+
const html3 = site2.contentOf(page);
|
|
36455
|
+
return html3 === void 0 ? [] : found2 = headings(html3);
|
|
36456
|
+
}
|
|
36457
|
+
},
|
|
36170
36458
|
excerpt: { enumerable: true, get() {
|
|
36171
36459
|
return excerpt(site2.contentOf(page) ?? "");
|
|
36172
36460
|
} }
|
|
@@ -36210,6 +36498,16 @@ function collectionApi(items) {
|
|
|
36210
36498
|
}
|
|
36211
36499
|
};
|
|
36212
36500
|
}
|
|
36501
|
+
var UNDATED = 1n << 80n;
|
|
36502
|
+
function isBundlerInstall(dir) {
|
|
36503
|
+
const ruby = path6.join(dir, "ruby");
|
|
36504
|
+
if (!fs5.existsSync(ruby)) return false;
|
|
36505
|
+
try {
|
|
36506
|
+
return fs5.readdirSync(ruby).some((version2) => fs5.existsSync(path6.join(ruby, version2, "gems")));
|
|
36507
|
+
} catch {
|
|
36508
|
+
return false;
|
|
36509
|
+
}
|
|
36510
|
+
}
|
|
36213
36511
|
var show = (v) => {
|
|
36214
36512
|
try {
|
|
36215
36513
|
return JSON.stringify(v) ?? String(v);
|
|
@@ -36292,6 +36590,7 @@ function errorsTogether(failed) {
|
|
|
36292
36590
|
// src/build.ts
|
|
36293
36591
|
var MAX_WRITES = 64;
|
|
36294
36592
|
async function build(config) {
|
|
36593
|
+
sourceDateEpoch();
|
|
36295
36594
|
const started = performance.now();
|
|
36296
36595
|
const timer = new Timer();
|
|
36297
36596
|
const site2 = new Site(config);
|
|
@@ -36796,7 +37095,7 @@ function unusedTemplates(site2) {
|
|
|
36796
37095
|
}
|
|
36797
37096
|
function hookEvent(config, dirs, report) {
|
|
36798
37097
|
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) } };
|
|
37098
|
+
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
37099
|
if (report) event.written = [...report.written];
|
|
36801
37100
|
return event;
|
|
36802
37101
|
}
|
|
@@ -36819,7 +37118,7 @@ async function runHooks(config, dirs, event, hooks, report) {
|
|
|
36819
37118
|
}
|
|
36820
37119
|
function runCommand(config, dirs, event, command) {
|
|
36821
37120
|
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 });
|
|
37121
|
+
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
37122
|
const ran = spawnSync2(file, args, {
|
|
36824
37123
|
...options,
|
|
36825
37124
|
// Standard output is kept for the JSON report, so the command's goes to standard error.
|
|
@@ -36971,6 +37270,27 @@ function globJobs(config, dirs, glob, to) {
|
|
|
36971
37270
|
if (!jobs.length && !config.serving) warn(warning("passthrough", `passthrough glob ${JSON.stringify(pattern)} matches no files`));
|
|
36972
37271
|
return jobs;
|
|
36973
37272
|
}
|
|
37273
|
+
function sameDestinations(jobs, dirs) {
|
|
37274
|
+
const at2 = /* @__PURE__ */ new Map();
|
|
37275
|
+
const kept = [];
|
|
37276
|
+
const same4 = (a, b) => {
|
|
37277
|
+
if (realPath(a) === realPath(b)) return true;
|
|
37278
|
+
const [x, y] = [fs6.statSync(a), fs6.statSync(b)];
|
|
37279
|
+
return x.size === y.size && fs6.readFileSync(a).equals(fs6.readFileSync(b));
|
|
37280
|
+
};
|
|
37281
|
+
for (const job of jobs) {
|
|
37282
|
+
const earlier = at2.get(job[1]);
|
|
37283
|
+
if (earlier === void 0) {
|
|
37284
|
+
at2.set(job[1], kept.length);
|
|
37285
|
+
kept.push(job);
|
|
37286
|
+
continue;
|
|
37287
|
+
}
|
|
37288
|
+
const [first] = kept[earlier];
|
|
37289
|
+
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]) }));
|
|
37290
|
+
kept[earlier] = job;
|
|
37291
|
+
}
|
|
37292
|
+
jobs.splice(0, jobs.length, ...kept);
|
|
37293
|
+
}
|
|
36974
37294
|
async function passthroughCopy(config, dirs, extra) {
|
|
36975
37295
|
const jobs = [...extra];
|
|
36976
37296
|
for (const { from, to } of config.passthrough) {
|
|
@@ -36989,6 +37309,7 @@ async function passthroughCopy(config, dirs, extra) {
|
|
|
36989
37309
|
jobs.push([src, dest]);
|
|
36990
37310
|
}
|
|
36991
37311
|
}
|
|
37312
|
+
sameDestinations(jobs, dirs);
|
|
36992
37313
|
const stats = { copied: 0, unchanged: 0, bytes: 0, paths: jobs.map(([, to]) => to) };
|
|
36993
37314
|
const folders = /* @__PURE__ */ new Map();
|
|
36994
37315
|
const failed = [];
|
|
@@ -37085,4 +37406,4 @@ export {
|
|
|
37085
37406
|
runCommand,
|
|
37086
37407
|
OUTPUT_LIST
|
|
37087
37408
|
};
|
|
37088
|
-
/*! For license information please see chunk-
|
|
37409
|
+
/*! For license information please see chunk-DELWRJAO.js.LEGAL.txt */
|