ssqch 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/completions/bash +1 -1
- package/bundled/completions/elvish +1 -0
- package/bundled/completions/fish +1 -0
- package/bundled/completions/powershell +1 -0
- package/bundled/completions/zsh +1 -0
- package/bundled/docs/agents.md +1 -1
- package/bundled/docs/build-summary.md +31 -1
- package/bundled/docs/configuring.md +1 -1
- package/bundled/docs/netlify.md +2 -2
- package/bundled/ssqch.d.ts +7 -2
- package/lib/assets.js +10 -12
- package/lib/{chunk-HDQ4SRWM.js → chunk-26SHWRC6.js} +6 -8
- package/lib/{chunk-2LEOPLTZ.js → chunk-3BQJY6GF.js} +3 -5
- package/lib/{chunk-JXZT5L7W.js → chunk-3LODFCCH.js} +2 -3
- package/lib/{chunk-7HXCQEGA.js → chunk-3NDFUMV2.js} +3 -3
- package/lib/{chunk-Y2ESFAAD.js → chunk-6OUT5VFK.js} +2 -4
- package/lib/{chunk-HXCLCXRT.js → chunk-6RSZV5O2.js} +5 -3
- package/lib/{chunk-4Q6WMTER.js → chunk-7JGYYAKI.js} +1 -1
- package/lib/{chunk-LAV3DEY4.js → chunk-BT3NVQOD.js} +1 -1
- package/lib/{chunk-DDV6JEC2.js → chunk-BXARVN5Z.js} +1 -1
- package/lib/{chunk-RVBNVGZV.js → chunk-CXRHH5P5.js} +5 -6
- package/lib/{chunk-NFJJKDRI.js → chunk-DNWA7WNO.js} +1 -1
- package/lib/{chunk-E5UB2YY7.js → chunk-DTSTCVRX.js} +8 -9
- package/lib/{chunk-HGJ5VWUR.js → chunk-DUGGZ4EE.js} +1 -1
- package/lib/{chunk-LCPSKHAV.js → chunk-ERNVEZOK.js} +1 -1
- package/lib/{chunk-CB6YFUXU.js → chunk-FYRC2HBU.js} +4 -6
- package/lib/{chunk-DW7VMJEZ.js → chunk-FYU22VDK.js} +12 -13
- package/lib/{chunk-N4O5MDIB.js → chunk-FZGJUJAL.js} +5 -7
- package/lib/{chunk-RKFZSVNF.js → chunk-G67W2FTJ.js} +9 -11
- package/lib/{chunk-DMVJ53SM.js → chunk-HMVYNV6M.js} +13 -15
- package/lib/{chunk-SRNLKWXL.js → chunk-HNG372DW.js} +91 -47
- package/lib/{chunk-ZM6TU2JB.js → chunk-II7ZRIAC.js} +11 -13
- package/lib/{chunk-5DNDSNTP.js → chunk-IOXCGMSF.js} +5 -7
- package/lib/{chunk-BGCBSQ4A.js → chunk-JFPLNHEQ.js} +136 -25
- package/lib/{chunk-NUUEOGLZ.js → chunk-LU73FTIR.js} +10 -11
- package/lib/{chunk-EEJDLCD3.js → chunk-LYPKL524.js} +9 -10
- package/lib/{chunk-NKXEPHRZ.js → chunk-MDB3D3LP.js} +106 -4
- package/lib/{chunk-SA5KSJ4Y.js → chunk-MDG5A4NI.js} +10 -12
- package/lib/{chunk-3HHRKG33.js → chunk-MUYWL4ZX.js} +11 -12
- package/lib/{chunk-QMA7CK7B.js → chunk-P2TRR6XK.js} +59 -23
- package/lib/{chunk-RJFWTW2Y.js → chunk-R2YGC3VE.js} +2 -3
- package/lib/{chunk-JWCCVTTR.js → chunk-RFNLZM7W.js} +2 -4
- package/lib/{chunk-3EPHKJEG.js → chunk-X7C6GFUM.js} +4 -4
- package/lib/{chunk-RM5Q3KFB.js → chunk-XR7GFL4B.js} +12 -13
- package/lib/{chunk-Q4LFTYK2.js → chunk-ZZBHBLDB.js} +16 -18
- package/lib/cli.js +25 -25
- package/lib/elements.js +10 -12
- package/lib/image.js +10 -11
- package/lib/links.js +10 -12
- package/lib/minify.js +9 -10
- package/lib/redirects.js +10 -12
- package/lib/rss.js +10 -11
- package/lib/sass.js +10 -12
- package/lib/sitemap.js +10 -12
- package/lib/ssqch.js +4 -5
- package/package.json +1 -1
- package/types/index.d.ts +7 -2
- package/lib/chunk-VJWQSYEG.js +0 -119
- /package/lib/{chunk-SRNLKWXL.js.LEGAL.txt → chunk-HNG372DW.js.LEGAL.txt} +0 -0
- /package/lib/{chunk-BGCBSQ4A.js.LEGAL.txt → chunk-JFPLNHEQ.js.LEGAL.txt} +0 -0
|
@@ -2,20 +2,23 @@ import { createRequire as __ssqchCreateRequire } from "node:module";
|
|
|
2
2
|
const require = __ssqchCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
commandLine
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7JGYYAKI.js";
|
|
6
6
|
import {
|
|
7
7
|
builtinFilters,
|
|
8
8
|
excerpt,
|
|
9
9
|
headings
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-FYRC2HBU.js";
|
|
11
11
|
import {
|
|
12
12
|
measure,
|
|
13
13
|
overBudget
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-FZGJUJAL.js";
|
|
15
15
|
import {
|
|
16
16
|
checkPages,
|
|
17
17
|
rewriteBase
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-P2TRR6XK.js";
|
|
19
|
+
import {
|
|
20
|
+
Profile
|
|
21
|
+
} from "./chunk-MDB3D3LP.js";
|
|
19
22
|
import {
|
|
20
23
|
VERSION
|
|
21
24
|
} from "./chunk-AD3HAW3W.js";
|
|
@@ -23,7 +26,7 @@ import {
|
|
|
23
26
|
dirsOf,
|
|
24
27
|
shownDir,
|
|
25
28
|
shownOutput
|
|
26
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-BXARVN5Z.js";
|
|
27
30
|
import {
|
|
28
31
|
beginFenceCache,
|
|
29
32
|
loadHookTemplates,
|
|
@@ -32,7 +35,7 @@ import {
|
|
|
32
35
|
saveFenceCache,
|
|
33
36
|
site,
|
|
34
37
|
writeHighlightCss
|
|
35
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-IOXCGMSF.js";
|
|
36
39
|
import {
|
|
37
40
|
closest,
|
|
38
41
|
closestPath
|
|
@@ -42,7 +45,7 @@ import {
|
|
|
42
45
|
globSet,
|
|
43
46
|
globToRegExp,
|
|
44
47
|
isGlob
|
|
45
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-DNWA7WNO.js";
|
|
46
49
|
import {
|
|
47
50
|
ISSUES_URL,
|
|
48
51
|
PASSED_THIS_TREE,
|
|
@@ -54,7 +57,7 @@ import {
|
|
|
54
57
|
settle,
|
|
55
58
|
shownPath,
|
|
56
59
|
watchSettle
|
|
57
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-RFNLZM7W.js";
|
|
58
61
|
import {
|
|
59
62
|
BuildError,
|
|
60
63
|
Diagnostics,
|
|
@@ -64,12 +67,18 @@ import {
|
|
|
64
67
|
aliasUsed,
|
|
65
68
|
bail,
|
|
66
69
|
buildTime,
|
|
70
|
+
comparePaths,
|
|
71
|
+
compareText,
|
|
67
72
|
context,
|
|
68
73
|
decodeText,
|
|
74
|
+
displayPath,
|
|
69
75
|
error,
|
|
70
76
|
find,
|
|
71
77
|
getPath,
|
|
72
78
|
isCapturing,
|
|
79
|
+
isDir,
|
|
80
|
+
isFile,
|
|
81
|
+
isInside,
|
|
73
82
|
isPlainObject,
|
|
74
83
|
loadDataFile,
|
|
75
84
|
merge,
|
|
@@ -77,28 +86,20 @@ import {
|
|
|
77
86
|
normalizeTags,
|
|
78
87
|
parseFrontMatter,
|
|
79
88
|
progress,
|
|
89
|
+
readFollowing,
|
|
80
90
|
readText,
|
|
91
|
+
realPath,
|
|
92
|
+
relative,
|
|
81
93
|
sameValue,
|
|
82
94
|
setOwn,
|
|
95
|
+
shown,
|
|
96
|
+
slashes,
|
|
83
97
|
sourceDateEpoch,
|
|
84
98
|
toDate,
|
|
99
|
+
walkFiles,
|
|
85
100
|
warn,
|
|
86
101
|
warning
|
|
87
|
-
} from "./chunk-
|
|
88
|
-
import {
|
|
89
|
-
comparePaths,
|
|
90
|
-
compareText,
|
|
91
|
-
displayPath,
|
|
92
|
-
isDir,
|
|
93
|
-
isFile,
|
|
94
|
-
isInside,
|
|
95
|
-
readFollowing,
|
|
96
|
-
realPath,
|
|
97
|
-
relative,
|
|
98
|
-
shown,
|
|
99
|
-
slashes,
|
|
100
|
-
walkFiles
|
|
101
|
-
} from "./chunk-VJWQSYEG.js";
|
|
102
|
+
} from "./chunk-JFPLNHEQ.js";
|
|
102
103
|
import {
|
|
103
104
|
__commonJS,
|
|
104
105
|
__export,
|
|
@@ -35741,10 +35742,18 @@ var Site = class {
|
|
|
35741
35742
|
keepLayers;
|
|
35742
35743
|
/** Set by the build: a page's rendered body, on demand (for `templateContent`). */
|
|
35743
35744
|
contentOf = () => void 0;
|
|
35745
|
+
/** What `ssqch build --profile` reports, and the `slow-call` warnings (src/profile.ts). */
|
|
35746
|
+
profile;
|
|
35744
35747
|
constructor(config, keepLayers = false) {
|
|
35745
35748
|
this.config = config;
|
|
35746
35749
|
this.dirs = dirsOf(config);
|
|
35747
35750
|
this.keepLayers = keepLayers;
|
|
35751
|
+
this.profile = new Profile(config.profile);
|
|
35752
|
+
}
|
|
35753
|
+
/** A data file's value, timed with `--profile`. One that fetches can take a while on purpose, so it's no `slow-call`. */
|
|
35754
|
+
loadData(file) {
|
|
35755
|
+
const load = () => loadDataFile(file, this.config.dataExtensions);
|
|
35756
|
+
return this.profile.detailed ? this.profile.time("data", shown(this.dirs.root, file), false, load) : load();
|
|
35748
35757
|
}
|
|
35749
35758
|
seenLower;
|
|
35750
35759
|
caseBlind;
|
|
@@ -35797,6 +35806,10 @@ var Site = class {
|
|
|
35797
35806
|
});
|
|
35798
35807
|
}
|
|
35799
35808
|
for (const [name, fn] of config.filters) globals.set(name, fn);
|
|
35809
|
+
for (const [name, fn] of globals) {
|
|
35810
|
+
const own = config.siteFilters.has(name);
|
|
35811
|
+
if (this.profile.times(own)) globals.set(name, this.profile.wrap("filters", name, fn, own, config.definedIn.get(`filters.${name}`)));
|
|
35812
|
+
}
|
|
35800
35813
|
this.themeIncludes = config.themes.map((theme) => path6.join(theme, "_includes"));
|
|
35801
35814
|
const env = { config, dirs, includeDirs: [dirs.includes, ...this.themeIncludes], globals, pipeFilters, strict: config.strict };
|
|
35802
35815
|
const byName = this.engines.byName;
|
|
@@ -35815,7 +35828,7 @@ var Site = class {
|
|
|
35815
35828
|
byName.set(name, {
|
|
35816
35829
|
render: (source, data2, ctx) => {
|
|
35817
35830
|
try {
|
|
35818
|
-
const out = fn(source, data2, ctx.name);
|
|
35831
|
+
const out = fn(source, data2, ctx.name, { kind: ctx.kind ?? "body", path: this.display(ctx.inputPath) });
|
|
35819
35832
|
return typeof out === "string" ? out : out.catch((e) => {
|
|
35820
35833
|
throw new BuildError(describeThrown(e, dirs.root));
|
|
35821
35834
|
});
|
|
@@ -35825,6 +35838,13 @@ var Site = class {
|
|
|
35825
35838
|
}
|
|
35826
35839
|
});
|
|
35827
35840
|
}
|
|
35841
|
+
if (this.profile.detailed) {
|
|
35842
|
+
for (const [name, engine] of byName) {
|
|
35843
|
+
const timed = Object.create(engine);
|
|
35844
|
+
timed.render = (source, data2, ctx) => this.profile.time("engines", name, false, () => engine.render(source, data2, ctx));
|
|
35845
|
+
byName.set(name, timed);
|
|
35846
|
+
}
|
|
35847
|
+
}
|
|
35828
35848
|
for (const format2 of config.templateFormats) {
|
|
35829
35849
|
try {
|
|
35830
35850
|
this.engines.get(format2);
|
|
@@ -35846,7 +35866,7 @@ var Site = class {
|
|
|
35846
35866
|
const provided = await Promise.all(config.globalData.map(async ({ name, value, fn }) => {
|
|
35847
35867
|
if (!fn) return [name, value];
|
|
35848
35868
|
try {
|
|
35849
|
-
return [name, await settle(fn())];
|
|
35869
|
+
return [name, await settle(this.profile.detailed ? this.profile.time("data", `data.${name}`, false, fn) : fn())];
|
|
35850
35870
|
} catch (e) {
|
|
35851
35871
|
throw new BuildError(`global data \`${name}\` failed: data.${name}: ${describeThrown(e, dirs.root)}`);
|
|
35852
35872
|
}
|
|
@@ -35912,7 +35932,7 @@ var Site = class {
|
|
|
35912
35932
|
const stem = name.slice(0, name.length - path6.extname(name).length);
|
|
35913
35933
|
if (isDir(file)) setOwn(data2, name, await this.loadGlobalData(file, skipped, `${prefix}${name}/`));
|
|
35914
35934
|
else {
|
|
35915
|
-
const value = await
|
|
35935
|
+
const value = await this.loadData(file);
|
|
35916
35936
|
if (value === NOT_DATA) skipped.push(`${prefix}${name}`);
|
|
35917
35937
|
else setOwn(data2, stem, value);
|
|
35918
35938
|
}
|
|
@@ -36107,7 +36127,7 @@ var Site = class {
|
|
|
36107
36127
|
for (const candidate of candidates) {
|
|
36108
36128
|
const file = path6.join(dir, candidate);
|
|
36109
36129
|
if (!(this.seen.has(file) || isFile(file))) continue;
|
|
36110
|
-
const value = await
|
|
36130
|
+
const value = await this.loadData(file);
|
|
36111
36131
|
if (!isPlainObject(value)) continue;
|
|
36112
36132
|
const layer = { ...value };
|
|
36113
36133
|
try {
|
|
@@ -36184,7 +36204,7 @@ var Site = class {
|
|
|
36184
36204
|
for (const suffix of ["json", "data.json", ...[...config.dataExtensions.keys()].map((ext2) => `data.${ext2}`)]) {
|
|
36185
36205
|
const candidate = path6.join(path6.dirname(file), `${stem}.${suffix}`);
|
|
36186
36206
|
if (!this.sawFile(candidate)) continue;
|
|
36187
|
-
const value = await
|
|
36207
|
+
const value = await this.loadData(candidate);
|
|
36188
36208
|
if (!isPlainObject(value)) continue;
|
|
36189
36209
|
const layer = { ...value };
|
|
36190
36210
|
try {
|
|
@@ -36335,7 +36355,8 @@ var Site = class {
|
|
|
36335
36355
|
if (permalink === false) url = null;
|
|
36336
36356
|
else if (typeof permalink === "string") {
|
|
36337
36357
|
const dynamic = data2.dynamicPermalink !== false;
|
|
36338
|
-
url = (dynamic && hasTags(tpl, permalink) ? await this.renderDataString(tpl, "permalink", permalink, data2) : permalink).trim();
|
|
36358
|
+
url = (dynamic && hasTags(tpl, this.config, permalink) ? await this.renderDataString(tpl, "permalink", permalink, data2) : permalink).trim();
|
|
36359
|
+
if (dynamic && (/\{\{|\{%|<%/.test(url) || /^<p>/i.test(url))) bail(`permalink ${show(url)} isn't a URL: it was rendered with \`${dataStringEngine(tpl, this.config)}\`, which left it like that. Write it in that template language, or set \`dynamicPermalink: false\` to use it as written`);
|
|
36339
36360
|
} else if (permalink !== void 0 && permalink !== null) bail("permalink must be a string or false");
|
|
36340
36361
|
else if (tpl.engines.length && tpl.engines.every((e) => e === "txt")) url = `/${tpl.rel}`;
|
|
36341
36362
|
else {
|
|
@@ -36394,11 +36415,11 @@ var Site = class {
|
|
|
36394
36415
|
}
|
|
36395
36416
|
/** Renders a `permalink` or `computed` string with the page's own template language. */
|
|
36396
36417
|
async renderDataString(tpl, what, text4, data2) {
|
|
36397
|
-
const ctx = { name: `${tpl.rel} (${what})`, inputPath: tpl.input };
|
|
36398
|
-
return this.engines.get(dataStringEngine(tpl)).render(text4, data2, ctx);
|
|
36418
|
+
const ctx = { name: `${tpl.rel} (${what})`, inputPath: tpl.input, kind: what };
|
|
36419
|
+
return this.engines.get(dataStringEngine(tpl, this.config)).render(text4, data2, ctx);
|
|
36399
36420
|
}
|
|
36400
36421
|
async renderComputed(value, data2, tpl) {
|
|
36401
|
-
if (typeof value === "string") return hasTags(tpl, value) ? this.renderDataString(tpl, "computed", value, data2) : value;
|
|
36422
|
+
if (typeof value === "string") return hasTags(tpl, this.config, value) ? this.renderDataString(tpl, "computed", value, data2) : value;
|
|
36402
36423
|
if (isPlainObject(value)) {
|
|
36403
36424
|
const out = {};
|
|
36404
36425
|
for (const [k, v] of Object.entries(value)) out[k] = await this.renderComputed(v, data2, tpl);
|
|
@@ -36491,8 +36512,9 @@ var Site = class {
|
|
|
36491
36512
|
for (const [tag, items] of byTag) collections[tag] = items;
|
|
36492
36513
|
const pages = collectionApi(all);
|
|
36493
36514
|
for (const [name, fn] of this.config.collections) {
|
|
36515
|
+
const from = this.config.definedIn.get(`collections.${name}`);
|
|
36494
36516
|
try {
|
|
36495
|
-
collections[name] = await settle(fn(pages));
|
|
36517
|
+
collections[name] = await settle(this.profile.time("collections", name, true, () => fn(pages), from));
|
|
36496
36518
|
} catch (e) {
|
|
36497
36519
|
throw new BuildError(`collection \`${name}\` failed: ${describeThrown(e, this.dirs.root)}`);
|
|
36498
36520
|
}
|
|
@@ -36572,11 +36594,14 @@ function readsCollections(computed) {
|
|
|
36572
36594
|
if (isPlainObject(computed)) return Object.values(computed).some(readsCollections);
|
|
36573
36595
|
return false;
|
|
36574
36596
|
}
|
|
36575
|
-
|
|
36576
|
-
|
|
36597
|
+
var TEMPLATE_LANGUAGES = /* @__PURE__ */ new Set(["edge", "njk", "jinja", "j2", "liquid", "hbs", "handlebars", "mustache", "ejs"]);
|
|
36598
|
+
function dataStringEngine(tpl, config) {
|
|
36599
|
+
const own = (e) => TEMPLATE_LANGUAGES.has(e) && !config.engines.has(e);
|
|
36600
|
+
const markdown = config.markdownEngine;
|
|
36601
|
+
return tpl.engines.find(own) ?? (markdown !== null && own(markdown) ? markdown : "edge");
|
|
36577
36602
|
}
|
|
36578
|
-
function hasTags(tpl, s) {
|
|
36579
|
-
return dataStringEngine(tpl) === "ejs" ? s.includes("<%") : s.includes("{{") || s.includes("{%");
|
|
36603
|
+
function hasTags(tpl, config, s) {
|
|
36604
|
+
return dataStringEngine(tpl, config) === "ejs" ? s.includes("<%") : s.includes("{{") || s.includes("{%");
|
|
36580
36605
|
}
|
|
36581
36606
|
async function readAll(files) {
|
|
36582
36607
|
const out = new Array(files.length);
|
|
@@ -36620,7 +36645,7 @@ async function build(config) {
|
|
|
36620
36645
|
beginFenceCache(dirs.root);
|
|
36621
36646
|
if (!isDir(dirs.input)) bail(`input directory ${shownDir(config, config.input)} does not exist`);
|
|
36622
36647
|
const built = await runFileBuilders(config, dirs);
|
|
36623
|
-
await runHooks(config, dirs, "beforeBuild", config.beforeBuild, void 0);
|
|
36648
|
+
await runHooks(config, dirs, "beforeBuild", config.beforeBuild, void 0, site2.profile);
|
|
36624
36649
|
await site2.prepare(timer);
|
|
36625
36650
|
await checkPages(site2);
|
|
36626
36651
|
checkForeignKeys(site2);
|
|
@@ -36676,7 +36701,7 @@ async function build(config) {
|
|
|
36676
36701
|
timings: [],
|
|
36677
36702
|
summary: []
|
|
36678
36703
|
};
|
|
36679
|
-
await runHooks(config, dirs, "afterBuild", config.afterBuild, report);
|
|
36704
|
+
await runHooks(config, dirs, "afterBuild", config.afterBuild, report, site2.profile);
|
|
36680
36705
|
if (config.budgets.length) for (const found2 of overBudget(await measure(dirs.output), config.budgets)) warn(found2);
|
|
36681
36706
|
for (const [label, line] of config.summaries) {
|
|
36682
36707
|
const value = line(config);
|
|
@@ -36686,6 +36711,8 @@ async function build(config) {
|
|
|
36686
36711
|
timer.lap("after");
|
|
36687
36712
|
report.durationMs = performance.now() - started;
|
|
36688
36713
|
report.timings = timer.timings;
|
|
36714
|
+
for (const slow of site2.profile.slowCalls()) warn(slow);
|
|
36715
|
+
if (config.profile) report.profile = site2.profile.report();
|
|
36689
36716
|
return report;
|
|
36690
36717
|
}
|
|
36691
36718
|
async function inspectPages(config) {
|
|
@@ -36806,6 +36833,7 @@ var Renderer = class {
|
|
|
36806
36833
|
for (const page of pages) {
|
|
36807
36834
|
this.borrowedFailure = false;
|
|
36808
36835
|
rendering(this.site.display(page.tpl.input));
|
|
36836
|
+
this.site.profile.at = shown(this.site.dirs.root, page.tpl.input);
|
|
36809
36837
|
try {
|
|
36810
36838
|
await this.render(page);
|
|
36811
36839
|
} catch (e) {
|
|
@@ -36816,6 +36844,7 @@ var Renderer = class {
|
|
|
36816
36844
|
}
|
|
36817
36845
|
}
|
|
36818
36846
|
rendering(void 0);
|
|
36847
|
+
this.site.profile.at = void 0;
|
|
36819
36848
|
await Promise.all(this.pending);
|
|
36820
36849
|
if (this.writeError !== void 0) this.errors.push({ error: this.writeError, phase: 2 });
|
|
36821
36850
|
if (this.errors.length) {
|
|
@@ -36854,10 +36883,11 @@ var Renderer = class {
|
|
|
36854
36883
|
try {
|
|
36855
36884
|
data2.page = site2.pageWithBody(page);
|
|
36856
36885
|
for (const layout of layouts) {
|
|
36886
|
+
const layoutStart = performance.now();
|
|
36857
36887
|
data2.content = content;
|
|
36858
36888
|
let text4 = layout.body;
|
|
36859
36889
|
for (const name of layout.engines) {
|
|
36860
|
-
const ctx = { name: layout.name, inputPath: layout.path, cacheKey: `${layout.name}#${name}
|
|
36890
|
+
const ctx = { name: layout.name, inputPath: layout.path, cacheKey: `${layout.name}#${name}`, kind: "layout" };
|
|
36861
36891
|
const engine = site2.engines.get(name);
|
|
36862
36892
|
try {
|
|
36863
36893
|
const out = engine.render(text4, data2, ctx);
|
|
@@ -36867,6 +36897,7 @@ var Renderer = class {
|
|
|
36867
36897
|
}
|
|
36868
36898
|
}
|
|
36869
36899
|
content = text4;
|
|
36900
|
+
if (site2.profile.detailed) site2.profile.add("layouts", layout.name, performance.now() - layoutStart, false);
|
|
36870
36901
|
}
|
|
36871
36902
|
} finally {
|
|
36872
36903
|
if (had === void 0 && !this.keep) this.bodies.delete(page.index);
|
|
@@ -36874,9 +36905,13 @@ var Renderer = class {
|
|
|
36874
36905
|
}
|
|
36875
36906
|
const output = page.output;
|
|
36876
36907
|
const info = { url: page.url ?? "", inputPath: site2.display(tpl.input), outputPath: output };
|
|
36877
|
-
|
|
36908
|
+
const transforms = [...config.htmlTransforms, ...config.transforms];
|
|
36909
|
+
for (let i2 = 0; i2 < transforms.length; i2++) {
|
|
36910
|
+
const [name, transform] = transforms[i2];
|
|
36911
|
+
const own = i2 >= config.htmlTransforms.length;
|
|
36912
|
+
const run = () => transform(content, info);
|
|
36878
36913
|
try {
|
|
36879
|
-
content = await
|
|
36914
|
+
content = await (site2.profile.times(own) ? site2.profile.time("transforms", name, own, run, config.definedIn.get(`transforms.${name}`)) : run());
|
|
36880
36915
|
} catch (e) {
|
|
36881
36916
|
throw new BuildError(`transform \`${name}\` failed for ${tpl.rel}: ${describeThrown(e, dirs.root)}`);
|
|
36882
36917
|
}
|
|
@@ -36888,6 +36923,11 @@ var Renderer = class {
|
|
|
36888
36923
|
throw context(e, `in ${tpl.rel}`);
|
|
36889
36924
|
}
|
|
36890
36925
|
}
|
|
36926
|
+
if (site2.profile.detailed) {
|
|
36927
|
+
const ms = performance.now() - start;
|
|
36928
|
+
site2.profile.add("pages", page.url ?? shown(dirs.root, output), ms, false);
|
|
36929
|
+
site2.profile.add("templates", shown(dirs.root, tpl.input), ms, false);
|
|
36930
|
+
}
|
|
36891
36931
|
const changed = !(config.serving && sameContents(output, content));
|
|
36892
36932
|
this.written.set(page.index, { file: output, bytes: Buffer.byteLength(content), changed });
|
|
36893
36933
|
if (changed) await this.write(output, content);
|
|
@@ -37122,14 +37162,18 @@ function hookEvent(config, dirs, report) {
|
|
|
37122
37162
|
if (report) event.written = [...report.written];
|
|
37123
37163
|
return event;
|
|
37124
37164
|
}
|
|
37125
|
-
async function runHooks(config, dirs, event, hooks, report) {
|
|
37165
|
+
async function runHooks(config, dirs, event, hooks, report, profile) {
|
|
37126
37166
|
const failed = event === "beforeBuild" ? "before_build hook failed" : "after_build hook failed";
|
|
37127
37167
|
for (const hook of hooks) {
|
|
37128
37168
|
try {
|
|
37129
|
-
if ("run" in hook)
|
|
37130
|
-
|
|
37169
|
+
if ("run" in hook) {
|
|
37170
|
+
const run = () => runCommand(config, dirs, event, hook.run);
|
|
37171
|
+
if (profile?.detailed) profile.time("hooks", `${event}: ${hook.run}`, false, run);
|
|
37172
|
+
else run();
|
|
37173
|
+
} else {
|
|
37174
|
+
const call3 = () => hook.fn(hookEvent(config, dirs, report));
|
|
37131
37175
|
try {
|
|
37132
|
-
await settle(
|
|
37176
|
+
await settle(profile?.detailed ? profile.time("hooks", hook.label || `${event} (built in)`, false, call3) : call3());
|
|
37133
37177
|
} catch (e) {
|
|
37134
37178
|
throw hook.label === "" && e instanceof Error ? e : new BuildError(`${hook.label}: ${describeThrown(e, dirs.root)}`);
|
|
37135
37179
|
}
|
|
@@ -37431,4 +37475,4 @@ export {
|
|
|
37431
37475
|
runCommand,
|
|
37432
37476
|
OUTPUT_LIST
|
|
37433
37477
|
};
|
|
37434
|
-
/*! For license information please see chunk-
|
|
37478
|
+
/*! For license information please see chunk-HNG372DW.js.LEGAL.txt */
|
|
@@ -5,32 +5,30 @@ import {
|
|
|
5
5
|
} from "./chunk-3GYLOC6Y.js";
|
|
6
6
|
import {
|
|
7
7
|
findConfig
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-P2TRR6XK.js";
|
|
9
|
+
import "./chunk-ERNVEZOK.js";
|
|
10
|
+
import "./chunk-MDB3D3LP.js";
|
|
11
11
|
import {
|
|
12
12
|
VERSION
|
|
13
13
|
} from "./chunk-AD3HAW3W.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-BXARVN5Z.js";
|
|
15
|
+
import "./chunk-IOXCGMSF.js";
|
|
16
16
|
import "./chunk-FVZ5JBRI.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-DNWA7WNO.js";
|
|
18
18
|
import "./chunk-UU43WIZG.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-RFNLZM7W.js";
|
|
20
20
|
import "./chunk-CMUWRPSQ.js";
|
|
21
21
|
import {
|
|
22
22
|
TABLE,
|
|
23
23
|
TomlError,
|
|
24
|
+
compareText,
|
|
25
|
+
isDir,
|
|
26
|
+
isFile,
|
|
24
27
|
isPlainObject,
|
|
25
28
|
readToml,
|
|
26
29
|
red,
|
|
27
30
|
tomlReason
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import {
|
|
30
|
-
compareText,
|
|
31
|
-
isDir,
|
|
32
|
-
isFile
|
|
33
|
-
} from "./chunk-VJWQSYEG.js";
|
|
31
|
+
} from "./chunk-JFPLNHEQ.js";
|
|
34
32
|
import "./chunk-I3PS26CI.js";
|
|
35
33
|
|
|
36
34
|
// src/import.ts
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
globProblem,
|
|
9
9
|
globToRegExp,
|
|
10
10
|
isGlob
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-DNWA7WNO.js";
|
|
12
12
|
import {
|
|
13
13
|
ISSUES_URL,
|
|
14
14
|
SOMETHING_LARGE
|
|
@@ -16,11 +16,12 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
describeThrown,
|
|
18
18
|
settle
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RFNLZM7W.js";
|
|
20
20
|
import {
|
|
21
21
|
BuildError,
|
|
22
22
|
Diagnostics,
|
|
23
23
|
bail,
|
|
24
|
+
comparePaths,
|
|
24
25
|
context,
|
|
25
26
|
isPlainObject,
|
|
26
27
|
loadStaticDataFile,
|
|
@@ -29,10 +30,7 @@ import {
|
|
|
29
30
|
readText,
|
|
30
31
|
warn,
|
|
31
32
|
warning
|
|
32
|
-
} from "./chunk-
|
|
33
|
-
import {
|
|
34
|
-
comparePaths
|
|
35
|
-
} from "./chunk-VJWQSYEG.js";
|
|
33
|
+
} from "./chunk-JFPLNHEQ.js";
|
|
36
34
|
|
|
37
35
|
// src/engines/markdown.ts
|
|
38
36
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
@@ -351,7 +349,7 @@ var WasmMarkdown = class {
|
|
|
351
349
|
let text = template.body;
|
|
352
350
|
for (const name2 of template.engines) {
|
|
353
351
|
const engine = engines.get(name2);
|
|
354
|
-
const ctx = { name: template.name, inputPath: template.path, cacheKey: `${template.name}#${name2}
|
|
352
|
+
const ctx = { name: template.name, inputPath: template.path, cacheKey: `${template.name}#${name2}`, kind: "hook" };
|
|
355
353
|
let out;
|
|
356
354
|
try {
|
|
357
355
|
out = engine.render(text, hookData, ctx);
|