@11ty/client 4.0.0-alpha.7 → 4.0.0-alpha.9
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 +1 -1
- package/dist/{eleventy.js → core-fs.js} +12612 -8018
- package/dist/{eleventy.core.js → core-minimal.js} +2356 -1656
- package/dist/formats/{eleventy-liquid.js → liquid.js} +617 -175
- package/dist/formats/{eleventy-markdown.js → markdown.js} +479 -114
- package/dist/formats/{eleventy-nunjucks.js → nunjucks.js} +2321 -2440
- package/dist/plugins/{eleventy-plugin-i18n.js → plugin-i18n.js} +33 -8
- package/package.json +16 -16
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Eleventy v4.0.0-alpha.
|
|
1
|
+
/*! Eleventy (Build Awesome) v4.0.0-alpha.9 (@11ty/client/liquid Engine Bundle) */
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -12,11 +12,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
12
12
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
13
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
14
|
});
|
|
15
|
-
var __esm = (fn, res) => function __init() {
|
|
16
|
-
|
|
15
|
+
var __esm = (fn, res, err) => function __init() {
|
|
16
|
+
if (err) throw err[0];
|
|
17
|
+
try {
|
|
18
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw err = [e], e;
|
|
21
|
+
}
|
|
17
22
|
};
|
|
18
23
|
var __commonJS = (cb, mod) => function __require2() {
|
|
19
|
-
|
|
24
|
+
try {
|
|
25
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
throw mod = 0, e;
|
|
28
|
+
}
|
|
20
29
|
};
|
|
21
30
|
var __export = (target, all) => {
|
|
22
31
|
for (var name in all)
|
|
@@ -1512,10 +1521,15 @@ __export(shim_consume_fs_exports, {
|
|
|
1512
1521
|
promises: () => promises,
|
|
1513
1522
|
readFileSync: () => readFileSync2,
|
|
1514
1523
|
readSync: () => readSync,
|
|
1524
|
+
readdir: () => readdir,
|
|
1525
|
+
readdirSync: () => readdirSync,
|
|
1526
|
+
realpath: () => realpath,
|
|
1527
|
+
realpathSync: () => realpathSync,
|
|
1528
|
+
stat: () => stat,
|
|
1515
1529
|
statSync: () => statSync,
|
|
1516
1530
|
writeFileSync: () => writeFileSync
|
|
1517
1531
|
});
|
|
1518
|
-
var GLOBAL_FS_NAME, fs2, mkdir, existsSync2, mkdirSync, readFileSync2, statSync, writeFileSync, promises, readSync, fstatSync, closeSync, openSync, shim_consume_fs_default;
|
|
1532
|
+
var GLOBAL_FS_NAME, fs2, mkdir, existsSync2, mkdirSync, readFileSync2, statSync, writeFileSync, promises, readSync, fstatSync, closeSync, openSync, readdir, readdirSync, realpath, realpathSync, stat, shim_consume_fs_default;
|
|
1519
1533
|
var init_shim_consume_fs = __esm({
|
|
1520
1534
|
"../../node_modules/@11ty/package-bundler/shims/shim-consume-fs.js"() {
|
|
1521
1535
|
GLOBAL_FS_NAME = "eleventyFileSystem";
|
|
@@ -1537,7 +1551,13 @@ var init_shim_consume_fs = __esm({
|
|
|
1537
1551
|
readSync: noopError,
|
|
1538
1552
|
fstatSync: noopError,
|
|
1539
1553
|
closeSync: noopError,
|
|
1540
|
-
openSync: noopError
|
|
1554
|
+
openSync: noopError,
|
|
1555
|
+
// tinyglobby
|
|
1556
|
+
readdir: noopError,
|
|
1557
|
+
readdirSync: noopError,
|
|
1558
|
+
realpath: noopError,
|
|
1559
|
+
realpathSync: noopError,
|
|
1560
|
+
stat: noopError
|
|
1541
1561
|
};
|
|
1542
1562
|
}
|
|
1543
1563
|
mkdir = fs2.mkdir;
|
|
@@ -1551,6 +1571,11 @@ var init_shim_consume_fs = __esm({
|
|
|
1551
1571
|
fstatSync = fs2.fstatSync;
|
|
1552
1572
|
closeSync = fs2.closeSync;
|
|
1553
1573
|
openSync = fs2.openSync;
|
|
1574
|
+
readdir = fs2.readdir;
|
|
1575
|
+
readdirSync = fs2.readdirSync;
|
|
1576
|
+
realpath = fs2.realpath;
|
|
1577
|
+
realpathSync = fs2.realpathSync;
|
|
1578
|
+
stat = fs2.stat;
|
|
1554
1579
|
shim_consume_fs_default = fs2;
|
|
1555
1580
|
}
|
|
1556
1581
|
});
|
|
@@ -1876,7 +1901,7 @@ var require_Buffer = __commonJS({
|
|
|
1876
1901
|
// ../../node_modules/@11ty/eleventy-utils/src/lib-sha256.js
|
|
1877
1902
|
var require_lib_sha256 = __commonJS({
|
|
1878
1903
|
"../../node_modules/@11ty/eleventy-utils/src/lib-sha256.js"(exports, module) {
|
|
1879
|
-
module.exports = /* @__PURE__ */ __name(function
|
|
1904
|
+
module.exports = /* @__PURE__ */ __name(function sha2562(data) {
|
|
1880
1905
|
let h0 = 1779033703, h1 = 3144134277, h2 = 1013904242, h3 = 2773480762, h4 = 1359893119, h5 = 2600822924, h6 = 528734635, h7 = 1541459225, tsz = 0, bp = 0;
|
|
1881
1906
|
const k = [
|
|
1882
1907
|
1116352408,
|
|
@@ -2050,7 +2075,7 @@ var require_HashTypes = __commonJS({
|
|
|
2050
2075
|
"../../node_modules/@11ty/eleventy-utils/src/HashTypes.js"(exports, module) {
|
|
2051
2076
|
var { base64UrlSafe } = require_Url();
|
|
2052
2077
|
var { isBuffer } = require_Buffer();
|
|
2053
|
-
var
|
|
2078
|
+
var sha2562 = require_lib_sha256();
|
|
2054
2079
|
function hasNodeCryptoModule() {
|
|
2055
2080
|
try {
|
|
2056
2081
|
__require("node:crypto");
|
|
@@ -2165,7 +2190,7 @@ var require_HashTypes = __commonJS({
|
|
|
2165
2190
|
__name(this, "ScriptHash");
|
|
2166
2191
|
}
|
|
2167
2192
|
static toHash(...content) {
|
|
2168
|
-
let hash =
|
|
2193
|
+
let hash = sha2562();
|
|
2169
2194
|
for (let c of content) {
|
|
2170
2195
|
hash.add(c);
|
|
2171
2196
|
}
|
|
@@ -2301,10 +2326,6 @@ function isIterator(val) {
|
|
|
2301
2326
|
return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return);
|
|
2302
2327
|
}
|
|
2303
2328
|
__name(isIterator, "isIterator");
|
|
2304
|
-
function escapeRegex(str) {
|
|
2305
|
-
return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
2306
|
-
}
|
|
2307
|
-
__name(escapeRegex, "escapeRegex");
|
|
2308
2329
|
function stringify(value) {
|
|
2309
2330
|
value = toValue(value);
|
|
2310
2331
|
if (isString(value))
|
|
@@ -2414,10 +2435,10 @@ function padEnd(str, length, ch = " ") {
|
|
|
2414
2435
|
__name(padEnd, "padEnd");
|
|
2415
2436
|
function pad(str, length, ch, add) {
|
|
2416
2437
|
str = String(str);
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
return str;
|
|
2438
|
+
const n = length - str.length;
|
|
2439
|
+
if (n <= 0)
|
|
2440
|
+
return str;
|
|
2441
|
+
return add(str, ch.repeat(n));
|
|
2421
2442
|
}
|
|
2422
2443
|
__name(pad, "pad");
|
|
2423
2444
|
function identify(val) {
|
|
@@ -2433,12 +2454,26 @@ function ellipsis(str, N) {
|
|
|
2433
2454
|
return str.length > N ? str.slice(0, N - 3) + "..." : str;
|
|
2434
2455
|
}
|
|
2435
2456
|
__name(ellipsis, "ellipsis");
|
|
2457
|
+
function orderedCompare(a, b) {
|
|
2458
|
+
if (isNil(a) && isNil(b))
|
|
2459
|
+
return 0;
|
|
2460
|
+
if (isNil(a))
|
|
2461
|
+
return 1;
|
|
2462
|
+
if (isNil(b))
|
|
2463
|
+
return -1;
|
|
2464
|
+
if (a < b)
|
|
2465
|
+
return -1;
|
|
2466
|
+
if (a > b)
|
|
2467
|
+
return 1;
|
|
2468
|
+
return 0;
|
|
2469
|
+
}
|
|
2470
|
+
__name(orderedCompare, "orderedCompare");
|
|
2436
2471
|
function caseInsensitiveCompare(a, b) {
|
|
2437
|
-
if (a
|
|
2472
|
+
if (isNil(a) && isNil(b))
|
|
2438
2473
|
return 0;
|
|
2439
|
-
if (a
|
|
2474
|
+
if (isNil(a))
|
|
2440
2475
|
return 1;
|
|
2441
|
-
if (b
|
|
2476
|
+
if (isNil(b))
|
|
2442
2477
|
return -1;
|
|
2443
2478
|
a = toLowerCase.call(a);
|
|
2444
2479
|
b = toLowerCase.call(b);
|
|
@@ -2461,10 +2496,6 @@ function argumentsToNumber(fn) {
|
|
|
2461
2496
|
};
|
|
2462
2497
|
}
|
|
2463
2498
|
__name(argumentsToNumber, "argumentsToNumber");
|
|
2464
|
-
function escapeRegExp(text) {
|
|
2465
|
-
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
2466
|
-
}
|
|
2467
|
-
__name(escapeRegExp, "escapeRegExp");
|
|
2468
2499
|
function* strictUniq(array) {
|
|
2469
2500
|
const seen = /* @__PURE__ */ new Set();
|
|
2470
2501
|
for (const element of array) {
|
|
@@ -2809,7 +2840,11 @@ var literalValues = {
|
|
|
2809
2840
|
"empty": new EmptyDrop(),
|
|
2810
2841
|
"blank": new BlankDrop()
|
|
2811
2842
|
};
|
|
2843
|
+
var trieCache = /* @__PURE__ */ new WeakMap();
|
|
2812
2844
|
function createTrie(input) {
|
|
2845
|
+
const cached = trieCache.get(input);
|
|
2846
|
+
if (cached)
|
|
2847
|
+
return cached;
|
|
2813
2848
|
const trie = {};
|
|
2814
2849
|
for (const [name, data] of Object.entries(input)) {
|
|
2815
2850
|
let node = trie;
|
|
@@ -2824,6 +2859,7 @@ function createTrie(input) {
|
|
|
2824
2859
|
node.data = data;
|
|
2825
2860
|
node.end = true;
|
|
2826
2861
|
}
|
|
2862
|
+
trieCache.set(input, trie);
|
|
2827
2863
|
return trie;
|
|
2828
2864
|
}
|
|
2829
2865
|
__name(createTrie, "createTrie");
|
|
@@ -2869,6 +2905,13 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
2869
2905
|
});
|
|
2870
2906
|
}
|
|
2871
2907
|
__name(__awaiter, "__awaiter");
|
|
2908
|
+
function toLiquidAsync(asyncFn, syncFn) {
|
|
2909
|
+
const syncImpl = syncFn || asyncFn;
|
|
2910
|
+
return (sync, ...args) => {
|
|
2911
|
+
return sync ? syncImpl(...args) : asyncFn(...args);
|
|
2912
|
+
};
|
|
2913
|
+
}
|
|
2914
|
+
__name(toLiquidAsync, "toLiquidAsync");
|
|
2872
2915
|
function toPromise(val) {
|
|
2873
2916
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2874
2917
|
if (!isIterator(val))
|
|
@@ -2878,7 +2921,7 @@ function toPromise(val) {
|
|
|
2878
2921
|
let next = "next";
|
|
2879
2922
|
do {
|
|
2880
2923
|
const state = val[next](value);
|
|
2881
|
-
done = state.done;
|
|
2924
|
+
done = !!state.done;
|
|
2882
2925
|
value = state.value;
|
|
2883
2926
|
next = "next";
|
|
2884
2927
|
try {
|
|
@@ -2903,7 +2946,7 @@ function toValueSync(val) {
|
|
|
2903
2946
|
let next = "next";
|
|
2904
2947
|
do {
|
|
2905
2948
|
const state = val[next](value);
|
|
2906
|
-
done = state.done;
|
|
2949
|
+
done = !!state.done;
|
|
2907
2950
|
value = state.value;
|
|
2908
2951
|
next = "next";
|
|
2909
2952
|
if (isIterator(value)) {
|
|
@@ -3005,8 +3048,10 @@ var formatCodes = {
|
|
|
3005
3048
|
m: /* @__PURE__ */ __name((d) => d.getMonth() + 1, "m"),
|
|
3006
3049
|
M: /* @__PURE__ */ __name((d) => d.getMinutes(), "M"),
|
|
3007
3050
|
N: /* @__PURE__ */ __name((d, opts) => {
|
|
3051
|
+
var _a;
|
|
3008
3052
|
const width = Number(opts.width) || 9;
|
|
3009
3053
|
const str = String(d.getMilliseconds()).slice(0, width);
|
|
3054
|
+
(_a = opts.memoryLimit) === null || _a === void 0 ? void 0 : _a.use(width - str.length);
|
|
3010
3055
|
return padEnd(str, width, "0");
|
|
3011
3056
|
}, "N"),
|
|
3012
3057
|
p: /* @__PURE__ */ __name((d) => d.getHours() < 12 ? "AM" : "PM", "p"),
|
|
@@ -3029,19 +3074,19 @@ var formatCodes = {
|
|
|
3029
3074
|
"%": /* @__PURE__ */ __name(() => "%", "%")
|
|
3030
3075
|
};
|
|
3031
3076
|
formatCodes.h = formatCodes.b;
|
|
3032
|
-
function strftime(d, formatStr) {
|
|
3077
|
+
function strftime(d, formatStr, memoryLimit) {
|
|
3033
3078
|
let output = "";
|
|
3034
3079
|
let remaining = formatStr;
|
|
3035
3080
|
let match;
|
|
3036
3081
|
while (match = rFormat.exec(remaining)) {
|
|
3037
3082
|
output += remaining.slice(0, match.index);
|
|
3038
3083
|
remaining = remaining.slice(match.index + match[0].length);
|
|
3039
|
-
output += format(d, match);
|
|
3084
|
+
output += format(d, match, memoryLimit);
|
|
3040
3085
|
}
|
|
3041
3086
|
return output + remaining;
|
|
3042
3087
|
}
|
|
3043
3088
|
__name(strftime, "strftime");
|
|
3044
|
-
function format(d, match) {
|
|
3089
|
+
function format(d, match, memoryLimit) {
|
|
3045
3090
|
const [input, flagStr = "", width, modifier, conversion] = match;
|
|
3046
3091
|
const convert = formatCodes[conversion];
|
|
3047
3092
|
if (!convert)
|
|
@@ -3049,9 +3094,9 @@ function format(d, match) {
|
|
|
3049
3094
|
const flags = {};
|
|
3050
3095
|
for (const flag of flagStr)
|
|
3051
3096
|
flags[flag] = true;
|
|
3052
|
-
let ret = String(convert(d, { flags, width, modifier }));
|
|
3097
|
+
let ret = String(convert(d, { flags, width, modifier, memoryLimit }));
|
|
3053
3098
|
let padChar = padSpaceChars.has(conversion) ? " " : "0";
|
|
3054
|
-
let padWidth = width || padWidths[conversion] || 0;
|
|
3099
|
+
let padWidth = Number(width) || padWidths[conversion] || 0;
|
|
3055
3100
|
if (flags["^"])
|
|
3056
3101
|
ret = ret.toUpperCase();
|
|
3057
3102
|
else if (flags["#"])
|
|
@@ -3062,6 +3107,7 @@ function format(d, match) {
|
|
|
3062
3107
|
padChar = "0";
|
|
3063
3108
|
if (flags["-"])
|
|
3064
3109
|
padWidth = 0;
|
|
3110
|
+
memoryLimit === null || memoryLimit === void 0 ? void 0 : memoryLimit.use(Number(padWidth) - ret.length);
|
|
3065
3111
|
return padStart(ret, padWidth, padChar);
|
|
3066
3112
|
}
|
|
3067
3113
|
__name(format, "format");
|
|
@@ -3228,13 +3274,15 @@ var Limiter = class {
|
|
|
3228
3274
|
this.limit = limit2;
|
|
3229
3275
|
}
|
|
3230
3276
|
use(count) {
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3277
|
+
if (+count > 0) {
|
|
3278
|
+
assert(this.base + +count <= this.limit, this.message);
|
|
3279
|
+
this.base += +count;
|
|
3280
|
+
}
|
|
3234
3281
|
}
|
|
3235
3282
|
check(count) {
|
|
3236
|
-
|
|
3237
|
-
|
|
3283
|
+
if (+count > 0) {
|
|
3284
|
+
assert(+count <= this.limit, this.message);
|
|
3285
|
+
}
|
|
3238
3286
|
}
|
|
3239
3287
|
};
|
|
3240
3288
|
var DelimitedToken = class extends Token {
|
|
@@ -3381,8 +3429,7 @@ var OperatorToken = class extends Token {
|
|
|
3381
3429
|
this.operator = this.getText();
|
|
3382
3430
|
}
|
|
3383
3431
|
getPrecedence() {
|
|
3384
|
-
|
|
3385
|
-
return key in operatorPrecedences ? operatorPrecedences[key] : 1;
|
|
3432
|
+
return this.operator in operatorPrecedences ? operatorPrecedences[this.operator] : 1;
|
|
3386
3433
|
}
|
|
3387
3434
|
};
|
|
3388
3435
|
var PropertyAccessToken = class extends Token {
|
|
@@ -3546,6 +3593,7 @@ var Render = class {
|
|
|
3546
3593
|
if (!emitter) {
|
|
3547
3594
|
emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter();
|
|
3548
3595
|
}
|
|
3596
|
+
ctx.renderLimit.check(getPerformance().now());
|
|
3549
3597
|
const errors = [];
|
|
3550
3598
|
for (const tpl of templates) {
|
|
3551
3599
|
ctx.renderLimit.check(getPerformance().now());
|
|
@@ -3962,7 +4010,28 @@ __name(newline_to_br, "newline_to_br");
|
|
|
3962
4010
|
function strip_html(v) {
|
|
3963
4011
|
const str = stringify(v);
|
|
3964
4012
|
this.context.memoryLimit.use(str.length);
|
|
3965
|
-
|
|
4013
|
+
const blocks = /* @__PURE__ */ new Map([["<script", "<\/script>"], ["<style", "</style>"], ["<!--", "-->"], ["<", ">"]]);
|
|
4014
|
+
let out = "";
|
|
4015
|
+
let i = 0;
|
|
4016
|
+
while (i < str.length) {
|
|
4017
|
+
const lt = str.indexOf("<", i);
|
|
4018
|
+
if (lt < 0)
|
|
4019
|
+
return out + str.slice(i);
|
|
4020
|
+
out += str.slice(i, lt);
|
|
4021
|
+
for (const [opener, closer] of blocks) {
|
|
4022
|
+
if (!str.startsWith(opener, lt))
|
|
4023
|
+
continue;
|
|
4024
|
+
const e = str.indexOf(closer, lt + opener.length);
|
|
4025
|
+
if (e >= 0) {
|
|
4026
|
+
i = e + closer.length;
|
|
4027
|
+
break;
|
|
4028
|
+
}
|
|
4029
|
+
blocks.delete(opener);
|
|
4030
|
+
}
|
|
4031
|
+
if (i <= lt)
|
|
4032
|
+
return out + str.slice(lt);
|
|
4033
|
+
}
|
|
4034
|
+
return out;
|
|
3966
4035
|
}
|
|
3967
4036
|
__name(strip_html, "strip_html");
|
|
3968
4037
|
var htmlFilters = /* @__PURE__ */ Object.freeze({
|
|
@@ -5089,50 +5158,54 @@ var Loader = class {
|
|
|
5089
5158
|
__name(this, "Loader");
|
|
5090
5159
|
}
|
|
5091
5160
|
constructor(options) {
|
|
5161
|
+
var _a, _b, _c, _d;
|
|
5092
5162
|
this.options = options;
|
|
5093
5163
|
if (options.relativeReference) {
|
|
5094
5164
|
const sep2 = options.fs.sep;
|
|
5095
5165
|
assert(sep2, "`fs.sep` is required for relative reference");
|
|
5096
|
-
const
|
|
5097
|
-
this.shouldLoadRelative = (referencedFile) =>
|
|
5166
|
+
const prefixes = ["." + sep2, ".." + sep2, "./", "../"];
|
|
5167
|
+
this.shouldLoadRelative = (referencedFile) => prefixes.some((prefix) => referencedFile.startsWith(prefix));
|
|
5098
5168
|
} else {
|
|
5099
5169
|
this.shouldLoadRelative = (_referencedFile) => false;
|
|
5100
5170
|
}
|
|
5101
|
-
|
|
5171
|
+
const fs3 = options.fs;
|
|
5172
|
+
this.contains = toLiquidAsync(((_a = fs3.contains) === null || _a === void 0 ? void 0 : _a.bind(fs3)) || (() => __awaiter(this, void 0, void 0, function* () {
|
|
5173
|
+
return true;
|
|
5174
|
+
})), ((_b = fs3.containsSync) === null || _b === void 0 ? void 0 : _b.bind(fs3)) || (() => true));
|
|
5175
|
+
this.exists = toLiquidAsync(((_c = fs3.exists) === null || _c === void 0 ? void 0 : _c.bind(fs3)) || (() => __awaiter(this, void 0, void 0, function* () {
|
|
5176
|
+
return false;
|
|
5177
|
+
})), (_d = fs3.existsSync) === null || _d === void 0 ? void 0 : _d.bind(fs3));
|
|
5102
5178
|
}
|
|
5103
5179
|
*lookup(file, type, sync, currentFile) {
|
|
5104
|
-
const { fs: fs3 } = this.options;
|
|
5105
5180
|
const dirs = this.options[type];
|
|
5106
|
-
for (const filepath of this.candidates(file, dirs, currentFile
|
|
5107
|
-
|
|
5181
|
+
for (const filepath of this.candidates(file, dirs, currentFile)) {
|
|
5182
|
+
let allowed = false;
|
|
5183
|
+
for (const dir of dirs) {
|
|
5184
|
+
if (yield this.contains(!!sync, dir, filepath)) {
|
|
5185
|
+
allowed = true;
|
|
5186
|
+
break;
|
|
5187
|
+
}
|
|
5188
|
+
}
|
|
5189
|
+
if (!allowed)
|
|
5190
|
+
continue;
|
|
5191
|
+
if (yield this.exists(!!sync, filepath))
|
|
5108
5192
|
return filepath;
|
|
5109
5193
|
}
|
|
5110
5194
|
throw this.lookupError(file, dirs);
|
|
5111
5195
|
}
|
|
5112
|
-
*candidates(file, dirs, currentFile
|
|
5196
|
+
*candidates(file, dirs, currentFile) {
|
|
5113
5197
|
const { fs: fs3, extname } = this.options;
|
|
5114
|
-
const isAllowed = /* @__PURE__ */ __name((filepath) => {
|
|
5115
|
-
if (!enforceRoot)
|
|
5116
|
-
return true;
|
|
5117
|
-
for (const dir of dirs) {
|
|
5118
|
-
if (this.contains(dir, filepath))
|
|
5119
|
-
return true;
|
|
5120
|
-
}
|
|
5121
|
-
return false;
|
|
5122
|
-
}, "isAllowed");
|
|
5123
5198
|
if (this.shouldLoadRelative(file) && currentFile) {
|
|
5124
5199
|
const referenced = fs3.resolve(this.dirname(currentFile), file, extname);
|
|
5125
|
-
|
|
5126
|
-
yield referenced;
|
|
5200
|
+
yield referenced;
|
|
5127
5201
|
}
|
|
5128
5202
|
for (const dir of dirs) {
|
|
5129
5203
|
const referenced = fs3.resolve(dir, file, extname);
|
|
5130
|
-
|
|
5131
|
-
yield referenced;
|
|
5204
|
+
yield referenced;
|
|
5132
5205
|
}
|
|
5133
5206
|
if (fs3.fallback !== void 0) {
|
|
5134
5207
|
const filepath = fs3.fallback(file);
|
|
5135
|
-
if (filepath !== void 0
|
|
5208
|
+
if (filepath !== void 0)
|
|
5136
5209
|
yield filepath;
|
|
5137
5210
|
}
|
|
5138
5211
|
}
|
|
@@ -5153,12 +5226,16 @@ var Parser = class {
|
|
|
5153
5226
|
__name(this, "Parser");
|
|
5154
5227
|
}
|
|
5155
5228
|
constructor(liquid) {
|
|
5229
|
+
var _a, _b;
|
|
5156
5230
|
this.liquid = liquid;
|
|
5157
5231
|
this.cache = this.liquid.options.cache;
|
|
5158
5232
|
this.fs = this.liquid.options.fs;
|
|
5159
5233
|
this.parseFile = this.cache ? this._parseFileCached : this._parseFile;
|
|
5160
5234
|
this.loader = new Loader(this.liquid.options);
|
|
5161
5235
|
this.parseLimit = new Limiter("parse length", liquid.options.parseLimit);
|
|
5236
|
+
this.readFile = toLiquidAsync(((_a = this.fs.readFile) === null || _a === void 0 ? void 0 : _a.bind(this.fs)) || (() => __awaiter(this, void 0, void 0, function* () {
|
|
5237
|
+
throw new Error("readFile not implemented");
|
|
5238
|
+
})), (_b = this.fs.readFileSync) === null || _b === void 0 ? void 0 : _b.bind(this.fs));
|
|
5162
5239
|
}
|
|
5163
5240
|
parse(html, filepath) {
|
|
5164
5241
|
html = String(html);
|
|
@@ -5223,7 +5300,7 @@ var Parser = class {
|
|
|
5223
5300
|
}
|
|
5224
5301
|
*_parseFile(file, sync, type = LookupType.Root, currentFile) {
|
|
5225
5302
|
const filepath = yield this.loader.lookup(file, type, sync, currentFile);
|
|
5226
|
-
return this.parse(
|
|
5303
|
+
return this.parse(yield this.readFile(!!sync, filepath), filepath);
|
|
5227
5304
|
}
|
|
5228
5305
|
};
|
|
5229
5306
|
var TokenKind;
|
|
@@ -5291,13 +5368,20 @@ function getKind(val) {
|
|
|
5291
5368
|
return val ? val.kind : -1;
|
|
5292
5369
|
}
|
|
5293
5370
|
__name(getKind, "getKind");
|
|
5371
|
+
function createScope(from) {
|
|
5372
|
+
const scope = /* @__PURE__ */ Object.create(null);
|
|
5373
|
+
if (from)
|
|
5374
|
+
Object.assign(scope, from);
|
|
5375
|
+
return scope;
|
|
5376
|
+
}
|
|
5377
|
+
__name(createScope, "createScope");
|
|
5294
5378
|
var Context = class _Context {
|
|
5295
5379
|
static {
|
|
5296
5380
|
__name(this, "Context");
|
|
5297
5381
|
}
|
|
5298
5382
|
constructor(env = {}, opts = defaultOptions, renderOptions = {}, { memoryLimit, renderLimit } = {}) {
|
|
5299
5383
|
var _a, _b, _c, _d, _e;
|
|
5300
|
-
this.scopes = [
|
|
5384
|
+
this.scopes = [createScope()];
|
|
5301
5385
|
this.registers = {};
|
|
5302
5386
|
this.breakCalled = false;
|
|
5303
5387
|
this.continueCalled = false;
|
|
@@ -5310,8 +5394,8 @@ var Context = class _Context {
|
|
|
5310
5394
|
this.memoryLimit = memoryLimit !== null && memoryLimit !== void 0 ? memoryLimit : new Limiter("memory alloc", (_d = renderOptions.memoryLimit) !== null && _d !== void 0 ? _d : opts.memoryLimit);
|
|
5311
5395
|
this.renderLimit = renderLimit !== null && renderLimit !== void 0 ? renderLimit : new Limiter("template render", getPerformance().now() + ((_e = renderOptions.renderLimit) !== null && _e !== void 0 ? _e : opts.renderLimit));
|
|
5312
5396
|
}
|
|
5313
|
-
getRegister(key) {
|
|
5314
|
-
return this.registers[key] = this.registers[key] ||
|
|
5397
|
+
getRegister(key, defaultValue = void 0) {
|
|
5398
|
+
return this.registers[key] = this.registers[key] || defaultValue;
|
|
5315
5399
|
}
|
|
5316
5400
|
setRegister(key, value) {
|
|
5317
5401
|
return this.registers[key] = value;
|
|
@@ -5368,7 +5452,8 @@ var Context = class _Context {
|
|
|
5368
5452
|
return new _Context(scope, this.opts, {
|
|
5369
5453
|
sync: this.sync,
|
|
5370
5454
|
globals: this.globals,
|
|
5371
|
-
strictVariables: this.strictVariables
|
|
5455
|
+
strictVariables: this.strictVariables,
|
|
5456
|
+
ownPropertyOnly: this.ownPropertyOnly
|
|
5372
5457
|
}, {
|
|
5373
5458
|
renderLimit: this.renderLimit,
|
|
5374
5459
|
memoryLimit: this.memoryLimit
|
|
@@ -5451,7 +5536,8 @@ function round(v, arg = 0) {
|
|
|
5451
5536
|
v = toNumber(v);
|
|
5452
5537
|
arg = toNumber(arg);
|
|
5453
5538
|
const amp = Math.pow(10, arg);
|
|
5454
|
-
|
|
5539
|
+
const scaled = v * amp * (1 + Number.EPSILON);
|
|
5540
|
+
return Math.round(scaled) / amp;
|
|
5455
5541
|
}
|
|
5456
5542
|
__name(round, "round");
|
|
5457
5543
|
var mathFilters = /* @__PURE__ */ Object.freeze({
|
|
@@ -5518,7 +5604,7 @@ var reverse = argumentsToValue(function(v) {
|
|
|
5518
5604
|
this.context.memoryLimit.use(array.length);
|
|
5519
5605
|
return [...array].reverse();
|
|
5520
5606
|
});
|
|
5521
|
-
function*
|
|
5607
|
+
function* sortBy(arr, property, comparator) {
|
|
5522
5608
|
const values = [];
|
|
5523
5609
|
const array = toArray(arr);
|
|
5524
5610
|
this.context.memoryLimit.use(array.length);
|
|
@@ -5528,19 +5614,15 @@ function* sort(arr, property) {
|
|
|
5528
5614
|
property ? yield this.context._getFromScope(item, stringify(property).split("."), false) : item
|
|
5529
5615
|
]);
|
|
5530
5616
|
}
|
|
5531
|
-
return values.sort((lhs, rhs) =>
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5617
|
+
return values.sort((lhs, rhs) => comparator(lhs[1], rhs[1])).map((tuple) => tuple[0]);
|
|
5618
|
+
}
|
|
5619
|
+
__name(sortBy, "sortBy");
|
|
5620
|
+
function* sort(arr, property) {
|
|
5621
|
+
return yield* sortBy.call(this, arr, property, orderedCompare);
|
|
5536
5622
|
}
|
|
5537
5623
|
__name(sort, "sort");
|
|
5538
|
-
function sort_natural(
|
|
5539
|
-
|
|
5540
|
-
const compare = property === void 0 ? caseInsensitiveCompare : (lhs, rhs) => caseInsensitiveCompare(lhs[propertyString], rhs[propertyString]);
|
|
5541
|
-
const array = toArray(input);
|
|
5542
|
-
this.context.memoryLimit.use(array.length);
|
|
5543
|
-
return [...array].sort(compare);
|
|
5624
|
+
function* sort_natural(arr, property) {
|
|
5625
|
+
return yield* sortBy.call(this, arr, property, caseInsensitiveCompare);
|
|
5544
5626
|
}
|
|
5545
5627
|
__name(sort_natural, "sort_natural");
|
|
5546
5628
|
var size = /* @__PURE__ */ __name((v) => v && v.length || 0, "size");
|
|
@@ -5590,7 +5672,9 @@ function unshift(v, arg) {
|
|
|
5590
5672
|
}
|
|
5591
5673
|
__name(unshift, "unshift");
|
|
5592
5674
|
function pop(v) {
|
|
5593
|
-
const
|
|
5675
|
+
const array = toArray(v);
|
|
5676
|
+
this.context.memoryLimit.use(array.length);
|
|
5677
|
+
const clone = [...array];
|
|
5594
5678
|
clone.pop();
|
|
5595
5679
|
return clone;
|
|
5596
5680
|
}
|
|
@@ -5762,7 +5846,7 @@ function sample(v, count = 1) {
|
|
|
5762
5846
|
return [];
|
|
5763
5847
|
if (!isArray(v))
|
|
5764
5848
|
v = stringify(v);
|
|
5765
|
-
this.context.memoryLimit.use(
|
|
5849
|
+
this.context.memoryLimit.use(v.length);
|
|
5766
5850
|
const shuffled = [...v].sort(() => Math.random() - 0.5);
|
|
5767
5851
|
if (count === 1)
|
|
5768
5852
|
return shuffled[0];
|
|
@@ -5803,15 +5887,16 @@ var arrayFilters = /* @__PURE__ */ Object.freeze({
|
|
|
5803
5887
|
sample
|
|
5804
5888
|
});
|
|
5805
5889
|
function date(v, format2, timezoneOffset) {
|
|
5806
|
-
var _a, _b
|
|
5807
|
-
const size2 = ((_a = v === null || v === void 0 ? void 0 : v.length) !== null && _a !== void 0 ? _a : 0) + ((_b =
|
|
5890
|
+
var _a, _b;
|
|
5891
|
+
const size2 = ((_a = v === null || v === void 0 ? void 0 : v.length) !== null && _a !== void 0 ? _a : 0) + ((_b = timezoneOffset === null || timezoneOffset === void 0 ? void 0 : timezoneOffset.length) !== null && _b !== void 0 ? _b : 0);
|
|
5808
5892
|
this.context.memoryLimit.use(size2);
|
|
5809
5893
|
const date2 = parseDate(v, this.context.opts, timezoneOffset);
|
|
5810
5894
|
if (!date2)
|
|
5811
5895
|
return v;
|
|
5812
5896
|
format2 = toValue(format2);
|
|
5813
5897
|
format2 = isNil(format2) ? this.context.opts.dateFormat : stringify(format2);
|
|
5814
|
-
|
|
5898
|
+
this.context.memoryLimit.use(format2.length);
|
|
5899
|
+
return strftime(date2, format2, this.context.memoryLimit);
|
|
5815
5900
|
}
|
|
5816
5901
|
__name(date, "date");
|
|
5817
5902
|
function date_to_xmlschema(v) {
|
|
@@ -5834,11 +5919,12 @@ function stringify_date(v, month_type, type, style) {
|
|
|
5834
5919
|
const date2 = parseDate(v, this.context.opts);
|
|
5835
5920
|
if (!date2)
|
|
5836
5921
|
return v;
|
|
5922
|
+
const ml = this.context.memoryLimit;
|
|
5837
5923
|
if (type === "ordinal") {
|
|
5838
5924
|
const d = date2.getDate();
|
|
5839
|
-
return style === "US" ? strftime(date2, `${month_type} ${d}%q, %Y
|
|
5925
|
+
return style === "US" ? strftime(date2, `${month_type} ${d}%q, %Y`, ml) : strftime(date2, `${d}%q ${month_type} %Y`, ml);
|
|
5840
5926
|
}
|
|
5841
|
-
return strftime(date2, `%d ${month_type} %Y
|
|
5927
|
+
return strftime(date2, `%d ${month_type} %Y`, ml);
|
|
5842
5928
|
}
|
|
5843
5929
|
__name(stringify_date, "stringify_date");
|
|
5844
5930
|
function parseDate(v, opts, timezoneOffset) {
|
|
@@ -5846,7 +5932,9 @@ function parseDate(v, opts, timezoneOffset) {
|
|
|
5846
5932
|
const defaultTimezoneOffset = timezoneOffset !== null && timezoneOffset !== void 0 ? timezoneOffset : opts.timezoneOffset;
|
|
5847
5933
|
const locale = opts.locale;
|
|
5848
5934
|
v = toValue(v);
|
|
5849
|
-
if (v
|
|
5935
|
+
if (isNil(v)) {
|
|
5936
|
+
return void 0;
|
|
5937
|
+
} else if (v === "now" || v === "today") {
|
|
5850
5938
|
date2 = new LiquidDate(Date.now(), locale, defaultTimezoneOffset);
|
|
5851
5939
|
} else if (isNumber(v)) {
|
|
5852
5940
|
date2 = new LiquidDate(v * 1e3, locale, defaultTimezoneOffset);
|
|
@@ -5894,10 +5982,15 @@ function lstrip(v, chars) {
|
|
|
5894
5982
|
const str = stringify(v);
|
|
5895
5983
|
this.context.memoryLimit.use(str.length);
|
|
5896
5984
|
if (chars) {
|
|
5897
|
-
chars =
|
|
5898
|
-
|
|
5985
|
+
chars = stringify(chars);
|
|
5986
|
+
this.context.memoryLimit.use(chars.length);
|
|
5987
|
+
for (let i = 0, set = new Set(chars); i < str.length; i++) {
|
|
5988
|
+
if (!set.has(str[i]))
|
|
5989
|
+
return str.slice(i);
|
|
5990
|
+
}
|
|
5991
|
+
return "";
|
|
5899
5992
|
}
|
|
5900
|
-
return str.
|
|
5993
|
+
return str.trimStart();
|
|
5901
5994
|
}
|
|
5902
5995
|
__name(lstrip, "lstrip");
|
|
5903
5996
|
function downcase(v) {
|
|
@@ -5914,20 +6007,22 @@ function upcase(v) {
|
|
|
5914
6007
|
__name(upcase, "upcase");
|
|
5915
6008
|
function remove(v, arg) {
|
|
5916
6009
|
const str = stringify(v);
|
|
5917
|
-
|
|
5918
|
-
|
|
6010
|
+
arg = stringify(arg);
|
|
6011
|
+
this.context.memoryLimit.use(str.length + arg.length);
|
|
6012
|
+
return str.split(arg).join("");
|
|
5919
6013
|
}
|
|
5920
6014
|
__name(remove, "remove");
|
|
5921
6015
|
function remove_first(v, l) {
|
|
5922
6016
|
const str = stringify(v);
|
|
5923
|
-
|
|
5924
|
-
|
|
6017
|
+
l = stringify(l);
|
|
6018
|
+
this.context.memoryLimit.use(str.length + l.length);
|
|
6019
|
+
return str.replace(l, "");
|
|
5925
6020
|
}
|
|
5926
6021
|
__name(remove_first, "remove_first");
|
|
5927
6022
|
function remove_last(v, l) {
|
|
5928
6023
|
const str = stringify(v);
|
|
5929
|
-
this.context.memoryLimit.use(str.length);
|
|
5930
6024
|
const pattern = stringify(l);
|
|
6025
|
+
this.context.memoryLimit.use(str.length + pattern.length);
|
|
5931
6026
|
const index = str.lastIndexOf(pattern);
|
|
5932
6027
|
if (index === -1)
|
|
5933
6028
|
return str;
|
|
@@ -5938,10 +6033,15 @@ function rstrip(str, chars) {
|
|
|
5938
6033
|
str = stringify(str);
|
|
5939
6034
|
this.context.memoryLimit.use(str.length);
|
|
5940
6035
|
if (chars) {
|
|
5941
|
-
chars =
|
|
5942
|
-
|
|
6036
|
+
chars = stringify(chars);
|
|
6037
|
+
this.context.memoryLimit.use(chars.length);
|
|
6038
|
+
for (let i = str.length - 1, set = new Set(chars); i >= 0; i--) {
|
|
6039
|
+
if (!set.has(str[i]))
|
|
6040
|
+
return str.slice(0, i + 1);
|
|
6041
|
+
}
|
|
6042
|
+
return "";
|
|
5943
6043
|
}
|
|
5944
|
-
return str.
|
|
6044
|
+
return str.trimEnd();
|
|
5945
6045
|
}
|
|
5946
6046
|
__name(rstrip, "rstrip");
|
|
5947
6047
|
function split(v, arg) {
|
|
@@ -5957,8 +6057,15 @@ function strip(v, chars) {
|
|
|
5957
6057
|
const str = stringify(v);
|
|
5958
6058
|
this.context.memoryLimit.use(str.length);
|
|
5959
6059
|
if (chars) {
|
|
5960
|
-
|
|
5961
|
-
|
|
6060
|
+
const set = new Set(stringify(chars));
|
|
6061
|
+
this.context.memoryLimit.use(set.size);
|
|
6062
|
+
let i = 0;
|
|
6063
|
+
let j = str.length - 1;
|
|
6064
|
+
while (set.has(str[i]))
|
|
6065
|
+
i++;
|
|
6066
|
+
while (j >= i && set.has(str[j]))
|
|
6067
|
+
j--;
|
|
6068
|
+
return str.slice(i, j + 1);
|
|
5962
6069
|
}
|
|
5963
6070
|
return str.trim();
|
|
5964
6071
|
}
|
|
@@ -5977,30 +6084,37 @@ function capitalize(str) {
|
|
|
5977
6084
|
__name(capitalize, "capitalize");
|
|
5978
6085
|
function replace(v, pattern, replacement) {
|
|
5979
6086
|
const str = stringify(v);
|
|
5980
|
-
|
|
5981
|
-
|
|
6087
|
+
pattern = stringify(pattern);
|
|
6088
|
+
replacement = stringify(replacement);
|
|
6089
|
+
const parts = str.split(pattern);
|
|
6090
|
+
const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length);
|
|
6091
|
+
this.context.memoryLimit.use(outputSize);
|
|
6092
|
+
return parts.join(replacement);
|
|
5982
6093
|
}
|
|
5983
6094
|
__name(replace, "replace");
|
|
5984
6095
|
function replace_first(v, arg1, arg2) {
|
|
5985
6096
|
const str = stringify(v);
|
|
5986
|
-
|
|
5987
|
-
|
|
6097
|
+
arg1 = stringify(arg1);
|
|
6098
|
+
arg2 = stringify(arg2);
|
|
6099
|
+
this.context.memoryLimit.use(str.length + arg1.length + arg2.length);
|
|
6100
|
+
return str.replace(arg1, () => arg2);
|
|
5988
6101
|
}
|
|
5989
6102
|
__name(replace_first, "replace_first");
|
|
5990
6103
|
function replace_last(v, arg1, arg2) {
|
|
5991
6104
|
const str = stringify(v);
|
|
5992
|
-
this.context.memoryLimit.use(str.length);
|
|
5993
6105
|
const pattern = stringify(arg1);
|
|
6106
|
+
const replacement = stringify(arg2);
|
|
6107
|
+
this.context.memoryLimit.use(str.length + pattern.length + replacement.length);
|
|
5994
6108
|
const index = str.lastIndexOf(pattern);
|
|
5995
6109
|
if (index === -1)
|
|
5996
6110
|
return str;
|
|
5997
|
-
const replacement = stringify(arg2);
|
|
5998
6111
|
return str.substring(0, index) + replacement + str.substring(index + pattern.length);
|
|
5999
6112
|
}
|
|
6000
6113
|
__name(replace_last, "replace_last");
|
|
6001
6114
|
function truncate(v, l = 50, o = "...") {
|
|
6002
6115
|
const str = stringify(v);
|
|
6003
|
-
|
|
6116
|
+
o = stringify(o);
|
|
6117
|
+
this.context.memoryLimit.use(str.length + o.length);
|
|
6004
6118
|
if (str.length <= l)
|
|
6005
6119
|
return v;
|
|
6006
6120
|
return str.substring(0, l - o.length) + o;
|
|
@@ -6008,7 +6122,8 @@ function truncate(v, l = 50, o = "...") {
|
|
|
6008
6122
|
__name(truncate, "truncate");
|
|
6009
6123
|
function truncatewords(v, words = 15, o = "...") {
|
|
6010
6124
|
const str = stringify(v);
|
|
6011
|
-
|
|
6125
|
+
o = stringify(o);
|
|
6126
|
+
this.context.memoryLimit.use(str.length + o.length);
|
|
6012
6127
|
const arr = str.split(/\s+/);
|
|
6013
6128
|
if (words <= 0)
|
|
6014
6129
|
words = 1;
|
|
@@ -6041,7 +6156,8 @@ function number_of_words(input, mode) {
|
|
|
6041
6156
|
}
|
|
6042
6157
|
__name(number_of_words, "number_of_words");
|
|
6043
6158
|
function array_to_sentence_string(array, connector = "and") {
|
|
6044
|
-
|
|
6159
|
+
connector = stringify(connector);
|
|
6160
|
+
this.context.memoryLimit.use(array.length + connector.length);
|
|
6045
6161
|
switch (array.length) {
|
|
6046
6162
|
case 0:
|
|
6047
6163
|
return "";
|
|
@@ -6087,6 +6203,10 @@ function base64Decode(str) {
|
|
|
6087
6203
|
}
|
|
6088
6204
|
__name(base64Decode, "base64Decode");
|
|
6089
6205
|
function base64_encode(value) {
|
|
6206
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer(value)) {
|
|
6207
|
+
this.context.memoryLimit.use(value.byteLength);
|
|
6208
|
+
return value.toString("base64");
|
|
6209
|
+
}
|
|
6090
6210
|
const str = stringify(value);
|
|
6091
6211
|
this.context.memoryLimit.use(str.length);
|
|
6092
6212
|
return base64Encode(str);
|
|
@@ -6103,7 +6223,51 @@ var base64Filters = /* @__PURE__ */ Object.freeze({
|
|
|
6103
6223
|
base64_encode,
|
|
6104
6224
|
base64_decode
|
|
6105
6225
|
});
|
|
6106
|
-
|
|
6226
|
+
function bufferToHex(buffer) {
|
|
6227
|
+
const bytes = new Uint8Array(buffer);
|
|
6228
|
+
let hex = "";
|
|
6229
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
6230
|
+
hex += bytes[i].toString(16).padStart(2, "0");
|
|
6231
|
+
}
|
|
6232
|
+
return hex;
|
|
6233
|
+
}
|
|
6234
|
+
__name(bufferToHex, "bufferToHex");
|
|
6235
|
+
function sha256(str) {
|
|
6236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6237
|
+
const data = new TextEncoder().encode(str);
|
|
6238
|
+
const digest = yield crypto.subtle.digest("SHA-256", data);
|
|
6239
|
+
return bufferToHex(digest);
|
|
6240
|
+
});
|
|
6241
|
+
}
|
|
6242
|
+
__name(sha256, "sha256");
|
|
6243
|
+
function hmacSha256(str, key) {
|
|
6244
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
6245
|
+
const encoder = new TextEncoder();
|
|
6246
|
+
const cryptoKey = yield crypto.subtle.importKey("raw", encoder.encode(key), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
|
|
6247
|
+
const signature = yield crypto.subtle.sign("HMAC", cryptoKey, encoder.encode(str));
|
|
6248
|
+
return bufferToHex(signature);
|
|
6249
|
+
});
|
|
6250
|
+
}
|
|
6251
|
+
__name(hmacSha256, "hmacSha256");
|
|
6252
|
+
function sha256$1(value) {
|
|
6253
|
+
const str = stringify(value);
|
|
6254
|
+
this.context.memoryLimit.use(str.length);
|
|
6255
|
+
return sha256(str);
|
|
6256
|
+
}
|
|
6257
|
+
__name(sha256$1, "sha256$1");
|
|
6258
|
+
function hmac_sha256(value, key) {
|
|
6259
|
+
const str = stringify(value);
|
|
6260
|
+
const keyStr = stringify(key);
|
|
6261
|
+
this.context.memoryLimit.use(str.length + keyStr.length);
|
|
6262
|
+
return hmacSha256(str, keyStr);
|
|
6263
|
+
}
|
|
6264
|
+
__name(hmac_sha256, "hmac_sha256");
|
|
6265
|
+
var cryptoFilters = /* @__PURE__ */ Object.freeze({
|
|
6266
|
+
__proto__: null,
|
|
6267
|
+
sha256: sha256$1,
|
|
6268
|
+
hmac_sha256
|
|
6269
|
+
});
|
|
6270
|
+
var filters = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, htmlFilters), mathFilters), urlFilters), arrayFilters), dateFilters), stringFilters), base64Filters), cryptoFilters), misc);
|
|
6107
6271
|
var AssignTag = class extends Tag {
|
|
6108
6272
|
static {
|
|
6109
6273
|
__name(this, "AssignTag");
|
|
@@ -6166,7 +6330,7 @@ var ForTag = class extends Tag {
|
|
|
6166
6330
|
return;
|
|
6167
6331
|
}
|
|
6168
6332
|
const continueKey = "continue-" + this.variable + "-" + this.collection.getText();
|
|
6169
|
-
ctx.push({ continue: ctx.getRegister(continueKey) });
|
|
6333
|
+
ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) }));
|
|
6170
6334
|
const hash = yield this.hash.render(ctx);
|
|
6171
6335
|
ctx.pop();
|
|
6172
6336
|
const modifiers = this.liquid.options.orderedFilterParameters ? Object.keys(hash).filter((x) => MODIFIERS.includes(x)) : MODIFIERS.filter((x) => hash[x] !== void 0);
|
|
@@ -6178,7 +6342,7 @@ var ForTag = class extends Tag {
|
|
|
6178
6342
|
return reversed(collection2);
|
|
6179
6343
|
}, collection);
|
|
6180
6344
|
ctx.setRegister(continueKey, (hash["offset"] || 0) + collection.length);
|
|
6181
|
-
const scope = { forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) };
|
|
6345
|
+
const scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) });
|
|
6182
6346
|
ctx.push(scope);
|
|
6183
6347
|
for (const item of collection) {
|
|
6184
6348
|
scope[this.variable] = item;
|
|
@@ -6374,7 +6538,11 @@ var RenderTag = class extends Tag {
|
|
|
6374
6538
|
alias = tokenizer.readIdentifier();
|
|
6375
6539
|
else
|
|
6376
6540
|
tokenizer.p = beforeAs;
|
|
6377
|
-
|
|
6541
|
+
const binding = { value, alias: alias && alias.content };
|
|
6542
|
+
if (keyword.content === "with")
|
|
6543
|
+
this.with = binding;
|
|
6544
|
+
else
|
|
6545
|
+
this.forBinding = binding;
|
|
6378
6546
|
tokenizer.skipBlank();
|
|
6379
6547
|
if (tokenizer.peek() === ",")
|
|
6380
6548
|
tokenizer.advance();
|
|
@@ -6389,56 +6557,56 @@ var RenderTag = class extends Tag {
|
|
|
6389
6557
|
}
|
|
6390
6558
|
*render(ctx, emitter) {
|
|
6391
6559
|
const { liquid, hash } = this;
|
|
6392
|
-
const filepath = yield renderFilePath(this
|
|
6560
|
+
const filepath = yield renderFilePath(this.file, ctx, liquid);
|
|
6393
6561
|
assert(filepath, () => `illegal file path "${filepath}"`);
|
|
6394
6562
|
const childCtx = ctx.spawn();
|
|
6395
6563
|
const scope = childCtx.bottom();
|
|
6396
6564
|
__assign(scope, yield hash.render(ctx));
|
|
6397
|
-
if (this
|
|
6398
|
-
const { value, alias } = this
|
|
6565
|
+
if (this.with) {
|
|
6566
|
+
const { value, alias } = this.with;
|
|
6399
6567
|
scope[alias || filepath] = yield evalToken(value, ctx);
|
|
6400
6568
|
}
|
|
6401
|
-
if (this
|
|
6402
|
-
const { value, alias } = this
|
|
6569
|
+
if (this.forBinding) {
|
|
6570
|
+
const { value, alias } = this.forBinding;
|
|
6403
6571
|
const collection = toEnumerable(yield evalToken(value, ctx));
|
|
6404
6572
|
scope["forloop"] = new ForloopDrop(collection.length, value.getText(), alias);
|
|
6405
6573
|
for (const item of collection) {
|
|
6406
6574
|
scope[alias] = item;
|
|
6407
|
-
const templates = yield liquid._parsePartialFile(filepath, childCtx.sync, this
|
|
6575
|
+
const templates = yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile);
|
|
6408
6576
|
yield liquid.renderer.renderTemplates(templates, childCtx, emitter);
|
|
6409
6577
|
scope["forloop"].next();
|
|
6410
6578
|
}
|
|
6411
6579
|
} else {
|
|
6412
|
-
const templates = yield liquid._parsePartialFile(filepath, childCtx.sync, this
|
|
6580
|
+
const templates = yield liquid._parsePartialFile(filepath, childCtx.sync, this.currentFile);
|
|
6413
6581
|
yield liquid.renderer.renderTemplates(templates, childCtx, emitter);
|
|
6414
6582
|
}
|
|
6415
6583
|
}
|
|
6416
6584
|
*children(partials, sync) {
|
|
6417
|
-
if (partials && isString(this
|
|
6418
|
-
return yield this.liquid._parsePartialFile(this
|
|
6585
|
+
if (partials && isString(this.file)) {
|
|
6586
|
+
return yield this.liquid._parsePartialFile(this.file, sync, this.currentFile);
|
|
6419
6587
|
}
|
|
6420
6588
|
return [];
|
|
6421
6589
|
}
|
|
6422
6590
|
partialScope() {
|
|
6423
|
-
if (isString(this
|
|
6424
|
-
const
|
|
6425
|
-
if (this
|
|
6426
|
-
const { value, alias } = this
|
|
6591
|
+
if (isString(this.file)) {
|
|
6592
|
+
const names2 = Object.keys(this.hash.hash);
|
|
6593
|
+
if (this.with) {
|
|
6594
|
+
const { value, alias } = this.with;
|
|
6427
6595
|
if (isString(alias)) {
|
|
6428
|
-
|
|
6596
|
+
names2.push([alias, value]);
|
|
6429
6597
|
} else if (isString(this.file)) {
|
|
6430
|
-
|
|
6598
|
+
names2.push([this.file, value]);
|
|
6431
6599
|
}
|
|
6432
6600
|
}
|
|
6433
|
-
if (this
|
|
6434
|
-
const { value, alias } = this
|
|
6601
|
+
if (this.forBinding) {
|
|
6602
|
+
const { value, alias } = this.forBinding;
|
|
6435
6603
|
if (isString(alias)) {
|
|
6436
|
-
|
|
6604
|
+
names2.push([alias, value]);
|
|
6437
6605
|
} else if (isString(this.file)) {
|
|
6438
|
-
|
|
6606
|
+
names2.push([this.file, value]);
|
|
6439
6607
|
}
|
|
6440
6608
|
}
|
|
6441
|
-
return { name: this
|
|
6609
|
+
return { name: this.file, isolated: true, scope: names2 };
|
|
6442
6610
|
}
|
|
6443
6611
|
}
|
|
6444
6612
|
*arguments() {
|
|
@@ -6447,14 +6615,14 @@ var RenderTag = class extends Tag {
|
|
|
6447
6615
|
yield v;
|
|
6448
6616
|
}
|
|
6449
6617
|
}
|
|
6450
|
-
if (this
|
|
6451
|
-
const { value } = this
|
|
6618
|
+
if (this.with) {
|
|
6619
|
+
const { value } = this.with;
|
|
6452
6620
|
if (isValueToken(value)) {
|
|
6453
6621
|
yield value;
|
|
6454
6622
|
}
|
|
6455
6623
|
}
|
|
6456
|
-
if (this
|
|
6457
|
-
const { value } = this
|
|
6624
|
+
if (this.forBinding) {
|
|
6625
|
+
const { value } = this.forBinding;
|
|
6458
6626
|
if (isValueToken(value)) {
|
|
6459
6627
|
yield value;
|
|
6460
6628
|
}
|
|
@@ -6499,8 +6667,8 @@ var IncludeTag = class extends Tag {
|
|
|
6499
6667
|
constructor(token, remainTokens, liquid, parser) {
|
|
6500
6668
|
super(token, remainTokens, liquid);
|
|
6501
6669
|
const { tokenizer } = token;
|
|
6502
|
-
this
|
|
6503
|
-
this
|
|
6670
|
+
this.file = parseFilePath(tokenizer, this.liquid, parser);
|
|
6671
|
+
this.currentFile = token.file;
|
|
6504
6672
|
const begin = tokenizer.p;
|
|
6505
6673
|
const withStr = tokenizer.readIdentifier();
|
|
6506
6674
|
if (withStr.content === "with") {
|
|
@@ -6516,44 +6684,44 @@ var IncludeTag = class extends Tag {
|
|
|
6516
6684
|
*render(ctx, emitter) {
|
|
6517
6685
|
const { liquid, hash, withVar } = this;
|
|
6518
6686
|
const { renderer } = liquid;
|
|
6519
|
-
const filepath = yield renderFilePath(this
|
|
6687
|
+
const filepath = yield renderFilePath(this.file, ctx, liquid);
|
|
6520
6688
|
assert(filepath, () => `illegal file path "${filepath}"`);
|
|
6521
6689
|
const saved = ctx.saveRegister("blocks", "blockMode");
|
|
6522
6690
|
ctx.setRegister("blocks", {});
|
|
6523
6691
|
ctx.setRegister("blockMode", BlockMode.OUTPUT);
|
|
6524
|
-
const scope = yield hash.render(ctx);
|
|
6692
|
+
const scope = createScope(yield hash.render(ctx));
|
|
6525
6693
|
if (withVar)
|
|
6526
6694
|
scope[filepath] = yield evalToken(withVar, ctx);
|
|
6527
|
-
const templates = yield liquid._parsePartialFile(filepath, ctx.sync, this
|
|
6528
|
-
ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
|
|
6695
|
+
const templates = yield liquid._parsePartialFile(filepath, ctx.sync, this.currentFile);
|
|
6696
|
+
ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope);
|
|
6529
6697
|
yield renderer.renderTemplates(templates, ctx, emitter);
|
|
6530
6698
|
ctx.pop();
|
|
6531
6699
|
ctx.restoreRegister(saved);
|
|
6532
6700
|
}
|
|
6533
6701
|
*children(partials, sync) {
|
|
6534
|
-
if (partials && isString(this
|
|
6535
|
-
return yield this.liquid._parsePartialFile(this
|
|
6702
|
+
if (partials && isString(this.file)) {
|
|
6703
|
+
return yield this.liquid._parsePartialFile(this.file, sync, this.currentFile);
|
|
6536
6704
|
}
|
|
6537
6705
|
return [];
|
|
6538
6706
|
}
|
|
6539
6707
|
partialScope() {
|
|
6540
|
-
if (isString(this
|
|
6541
|
-
let
|
|
6708
|
+
if (isString(this.file)) {
|
|
6709
|
+
let names2;
|
|
6542
6710
|
if (this.liquid.options.jekyllInclude) {
|
|
6543
|
-
|
|
6711
|
+
names2 = ["include"];
|
|
6544
6712
|
} else {
|
|
6545
|
-
|
|
6713
|
+
names2 = Object.keys(this.hash.hash);
|
|
6546
6714
|
if (this.withVar) {
|
|
6547
|
-
|
|
6715
|
+
names2.push([this.file, this.withVar]);
|
|
6548
6716
|
}
|
|
6549
6717
|
}
|
|
6550
|
-
return { name: this
|
|
6718
|
+
return { name: this.file, isolated: false, scope: names2 };
|
|
6551
6719
|
}
|
|
6552
6720
|
}
|
|
6553
6721
|
*arguments() {
|
|
6554
6722
|
yield* Object.values(this.hash.hash).filter(isValueToken);
|
|
6555
|
-
if (isValueToken(this
|
|
6556
|
-
yield this
|
|
6723
|
+
if (isValueToken(this.file)) {
|
|
6724
|
+
yield this.file;
|
|
6557
6725
|
}
|
|
6558
6726
|
if (isValueToken(this.withVar)) {
|
|
6559
6727
|
yield this.withVar;
|
|
@@ -6607,7 +6775,7 @@ var CycleTag = class extends Tag {
|
|
|
6607
6775
|
*render(ctx, emitter) {
|
|
6608
6776
|
const group = yield evalToken(this.group, ctx);
|
|
6609
6777
|
const fingerprint = `cycle:${group}:` + this.candidates.join(",");
|
|
6610
|
-
const groups = ctx.getRegister("cycle");
|
|
6778
|
+
const groups = ctx.getRegister("cycle", {});
|
|
6611
6779
|
let idx = groups[fingerprint];
|
|
6612
6780
|
if (idx === void 0) {
|
|
6613
6781
|
idx = groups[fingerprint] = 0;
|
|
@@ -6703,7 +6871,7 @@ var LayoutTag = class extends Tag {
|
|
|
6703
6871
|
constructor(token, remainTokens, liquid, parser) {
|
|
6704
6872
|
super(token, remainTokens, liquid);
|
|
6705
6873
|
this.file = parseFilePath(this.tokenizer, this.liquid, parser);
|
|
6706
|
-
this
|
|
6874
|
+
this.currentFile = token.file;
|
|
6707
6875
|
this.args = new Hash(this.tokenizer, liquid.options.keyValueSeparator);
|
|
6708
6876
|
this.templates = parser.parseTokens(remainTokens);
|
|
6709
6877
|
}
|
|
@@ -6717,21 +6885,21 @@ var LayoutTag = class extends Tag {
|
|
|
6717
6885
|
}
|
|
6718
6886
|
const filepath = yield renderFilePath(this.file, ctx, liquid);
|
|
6719
6887
|
assert(filepath, () => `illegal file path "${filepath}"`);
|
|
6720
|
-
const templates = yield liquid._parseLayoutFile(filepath, ctx.sync, this
|
|
6888
|
+
const templates = yield liquid._parseLayoutFile(filepath, ctx.sync, this.currentFile);
|
|
6721
6889
|
ctx.setRegister("blockMode", BlockMode.STORE);
|
|
6722
6890
|
const html = yield renderer.renderTemplates(this.templates, ctx);
|
|
6723
|
-
const blocks = ctx.getRegister("blocks");
|
|
6891
|
+
const blocks = ctx.getRegister("blocks", {});
|
|
6724
6892
|
if (blocks[""] === void 0)
|
|
6725
6893
|
blocks[""] = (parent, emitter2) => emitter2.write(html);
|
|
6726
6894
|
ctx.setRegister("blockMode", BlockMode.OUTPUT);
|
|
6727
|
-
ctx.push(yield args.render(ctx));
|
|
6895
|
+
ctx.push(createScope(yield args.render(ctx)));
|
|
6728
6896
|
yield renderer.renderTemplates(templates, ctx, emitter);
|
|
6729
6897
|
ctx.pop();
|
|
6730
6898
|
}
|
|
6731
6899
|
*children(partials) {
|
|
6732
6900
|
const templates = this.templates.slice();
|
|
6733
6901
|
if (partials && isString(this.file)) {
|
|
6734
|
-
templates.push(...yield this.liquid._parsePartialFile(this.file, true, this
|
|
6902
|
+
templates.push(...yield this.liquid._parsePartialFile(this.file, true, this.currentFile));
|
|
6735
6903
|
}
|
|
6736
6904
|
return templates;
|
|
6737
6905
|
}
|
|
@@ -6772,18 +6940,24 @@ var BlockTag = class extends Tag {
|
|
|
6772
6940
|
*render(ctx, emitter) {
|
|
6773
6941
|
const blockRender = this.getBlockRender(ctx);
|
|
6774
6942
|
if (ctx.getRegister("blockMode") === BlockMode.STORE) {
|
|
6775
|
-
ctx.getRegister("blocks")[this.block] = blockRender;
|
|
6943
|
+
ctx.getRegister("blocks", {})[this.block] = blockRender;
|
|
6776
6944
|
} else {
|
|
6777
6945
|
yield blockRender(new BlockDrop(), emitter);
|
|
6778
6946
|
}
|
|
6779
6947
|
}
|
|
6780
6948
|
getBlockRender(ctx) {
|
|
6949
|
+
const self = this;
|
|
6781
6950
|
const { liquid, templates } = this;
|
|
6782
|
-
const renderChild = ctx.getRegister("blocks")[this.block];
|
|
6951
|
+
const renderChild = ctx.getRegister("blocks", {})[this.block];
|
|
6783
6952
|
const renderCurrent = /* @__PURE__ */ __name(function* (superBlock, emitter) {
|
|
6784
|
-
ctx.
|
|
6953
|
+
const stack = ctx.getRegister("blockStack", []);
|
|
6954
|
+
if (stack.includes(self))
|
|
6955
|
+
throw new Error("block tag cannot be nested");
|
|
6956
|
+
stack.push(self);
|
|
6957
|
+
ctx.push(createScope({ block: superBlock }));
|
|
6785
6958
|
yield liquid.renderer.renderTemplates(templates, ctx, emitter);
|
|
6786
6959
|
ctx.pop();
|
|
6960
|
+
stack.pop();
|
|
6787
6961
|
}, "renderCurrent");
|
|
6788
6962
|
return renderChild ? (superBlock, emitter) => renderChild(new BlockDrop((emitter2) => renderCurrent(superBlock, emitter2)), emitter) : renderCurrent;
|
|
6789
6963
|
}
|
|
@@ -6870,7 +7044,7 @@ var TablerowTag = class extends Tag {
|
|
|
6870
7044
|
const cols = args.cols || collection.length;
|
|
6871
7045
|
const r = this.liquid.renderer;
|
|
6872
7046
|
const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable);
|
|
6873
|
-
const scope = { tablerowloop };
|
|
7047
|
+
const scope = createScope({ tablerowloop });
|
|
6874
7048
|
ctx.push(scope);
|
|
6875
7049
|
for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) {
|
|
6876
7050
|
scope[this.variable] = collection[idx];
|
|
@@ -7058,8 +7232,8 @@ var Liquid = class _Liquid {
|
|
|
7058
7232
|
}
|
|
7059
7233
|
constructor(opts = {}) {
|
|
7060
7234
|
this.renderer = new Render();
|
|
7061
|
-
this.filters =
|
|
7062
|
-
this.tags =
|
|
7235
|
+
this.filters = /* @__PURE__ */ Object.create(null);
|
|
7236
|
+
this.tags = /* @__PURE__ */ Object.create(null);
|
|
7063
7237
|
this.options = normalize(opts);
|
|
7064
7238
|
this.parser = new Parser(this);
|
|
7065
7239
|
forOwn(tags, (conf, name) => this.registerTag(name, conf));
|
|
@@ -7261,21 +7435,289 @@ var Liquid = class _Liquid {
|
|
|
7261
7435
|
// ../../src/Engines/Liquid.js
|
|
7262
7436
|
var import_eleventy_utils = __toESM(require_eleventy_utils(), 1);
|
|
7263
7437
|
|
|
7264
|
-
// ../../node_modules
|
|
7265
|
-
function
|
|
7266
|
-
|
|
7438
|
+
// ../../node_modules/obug/dist/core.js
|
|
7439
|
+
function coerce(value) {
|
|
7440
|
+
if (value instanceof Error) return value.stack || value.message;
|
|
7441
|
+
return value;
|
|
7442
|
+
}
|
|
7443
|
+
__name(coerce, "coerce");
|
|
7444
|
+
function selectColor(colors2, namespace) {
|
|
7445
|
+
let hash = 0;
|
|
7446
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
7447
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
7448
|
+
hash |= 0;
|
|
7449
|
+
}
|
|
7450
|
+
return colors2[Math.abs(hash) % colors2.length];
|
|
7451
|
+
}
|
|
7452
|
+
__name(selectColor, "selectColor");
|
|
7453
|
+
function matchesTemplate(search2, template) {
|
|
7454
|
+
let searchIndex = 0;
|
|
7455
|
+
let templateIndex = 0;
|
|
7456
|
+
let starIndex = -1;
|
|
7457
|
+
let matchIndex = 0;
|
|
7458
|
+
while (searchIndex < search2.length) if (templateIndex < template.length && (template[templateIndex] === search2[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
|
|
7459
|
+
starIndex = templateIndex;
|
|
7460
|
+
matchIndex = searchIndex;
|
|
7461
|
+
templateIndex++;
|
|
7462
|
+
} else {
|
|
7463
|
+
searchIndex++;
|
|
7464
|
+
templateIndex++;
|
|
7465
|
+
}
|
|
7466
|
+
else if (starIndex !== -1) {
|
|
7467
|
+
templateIndex = starIndex + 1;
|
|
7468
|
+
matchIndex++;
|
|
7469
|
+
searchIndex = matchIndex;
|
|
7470
|
+
} else return false;
|
|
7471
|
+
while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
|
|
7472
|
+
return templateIndex === template.length;
|
|
7473
|
+
}
|
|
7474
|
+
__name(matchesTemplate, "matchesTemplate");
|
|
7475
|
+
function humanize(value) {
|
|
7476
|
+
if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`;
|
|
7477
|
+
return `${value}ms`;
|
|
7478
|
+
}
|
|
7479
|
+
__name(humanize, "humanize");
|
|
7480
|
+
var globalNamespaces = "";
|
|
7481
|
+
function createDebug(namespace, options) {
|
|
7482
|
+
let prevTime;
|
|
7483
|
+
let enableOverride;
|
|
7484
|
+
let namespacesCache;
|
|
7485
|
+
let enabledCache;
|
|
7486
|
+
const debug2 = /* @__PURE__ */ __name((...args) => {
|
|
7487
|
+
if (!debug2.enabled) return;
|
|
7488
|
+
const curr = Date.now();
|
|
7489
|
+
const diff = curr - (prevTime || curr);
|
|
7490
|
+
prevTime = curr;
|
|
7491
|
+
args[0] = coerce(args[0]);
|
|
7492
|
+
if (typeof args[0] !== "string") args.unshift("%O");
|
|
7493
|
+
let index = 0;
|
|
7494
|
+
args[0] = args[0].replace(/%([a-z%])/gi, (match, format2) => {
|
|
7495
|
+
if (match === "%%") return "%";
|
|
7496
|
+
index++;
|
|
7497
|
+
const formatter = options.formatters[format2];
|
|
7498
|
+
if (typeof formatter === "function") {
|
|
7499
|
+
const value = args[index];
|
|
7500
|
+
match = formatter.call(debug2, value);
|
|
7501
|
+
args.splice(index, 1);
|
|
7502
|
+
index--;
|
|
7503
|
+
}
|
|
7504
|
+
return match;
|
|
7505
|
+
});
|
|
7506
|
+
options.formatArgs.call(debug2, diff, args);
|
|
7507
|
+
debug2.log(...args);
|
|
7508
|
+
}, "debug");
|
|
7509
|
+
debug2.extend = function(namespace2, delimiter = ":") {
|
|
7510
|
+
return createDebug(this.namespace + delimiter + namespace2, {
|
|
7511
|
+
useColors: this.useColors,
|
|
7512
|
+
color: this.color,
|
|
7513
|
+
formatArgs: this.formatArgs,
|
|
7514
|
+
formatters: this.formatters,
|
|
7515
|
+
inspectOpts: this.inspectOpts,
|
|
7516
|
+
log: this.log,
|
|
7517
|
+
humanize: this.humanize
|
|
7518
|
+
});
|
|
7267
7519
|
};
|
|
7520
|
+
Object.assign(debug2, options);
|
|
7521
|
+
debug2.namespace = namespace;
|
|
7522
|
+
Object.defineProperty(debug2, "enabled", {
|
|
7523
|
+
enumerable: true,
|
|
7524
|
+
configurable: false,
|
|
7525
|
+
get: /* @__PURE__ */ __name(() => {
|
|
7526
|
+
if (enableOverride != null) return enableOverride;
|
|
7527
|
+
if (namespacesCache !== globalNamespaces) {
|
|
7528
|
+
namespacesCache = globalNamespaces;
|
|
7529
|
+
enabledCache = enabled(namespace);
|
|
7530
|
+
}
|
|
7531
|
+
return enabledCache;
|
|
7532
|
+
}, "get"),
|
|
7533
|
+
set: /* @__PURE__ */ __name((v) => {
|
|
7534
|
+
enableOverride = v;
|
|
7535
|
+
}, "set")
|
|
7536
|
+
});
|
|
7537
|
+
return debug2;
|
|
7538
|
+
}
|
|
7539
|
+
__name(createDebug, "createDebug");
|
|
7540
|
+
var names = [];
|
|
7541
|
+
var skips = [];
|
|
7542
|
+
function enable(namespaces2) {
|
|
7543
|
+
globalNamespaces = namespaces2;
|
|
7544
|
+
names = [];
|
|
7545
|
+
skips = [];
|
|
7546
|
+
const split2 = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
7547
|
+
for (const ns of split2) if (ns[0] === "-") skips.push(ns.slice(1));
|
|
7548
|
+
else names.push(ns);
|
|
7549
|
+
}
|
|
7550
|
+
__name(enable, "enable");
|
|
7551
|
+
function enabled(name) {
|
|
7552
|
+
for (const skip of skips) if (matchesTemplate(name, skip)) return false;
|
|
7553
|
+
for (const ns of names) if (matchesTemplate(name, ns)) return true;
|
|
7554
|
+
return false;
|
|
7555
|
+
}
|
|
7556
|
+
__name(enabled, "enabled");
|
|
7557
|
+
|
|
7558
|
+
// ../../node_modules/obug/dist/browser.js
|
|
7559
|
+
var colors = [
|
|
7560
|
+
"#0000CC",
|
|
7561
|
+
"#0000FF",
|
|
7562
|
+
"#0033CC",
|
|
7563
|
+
"#0033FF",
|
|
7564
|
+
"#0066CC",
|
|
7565
|
+
"#0066FF",
|
|
7566
|
+
"#0099CC",
|
|
7567
|
+
"#0099FF",
|
|
7568
|
+
"#00CC00",
|
|
7569
|
+
"#00CC33",
|
|
7570
|
+
"#00CC66",
|
|
7571
|
+
"#00CC99",
|
|
7572
|
+
"#00CCCC",
|
|
7573
|
+
"#00CCFF",
|
|
7574
|
+
"#3300CC",
|
|
7575
|
+
"#3300FF",
|
|
7576
|
+
"#3333CC",
|
|
7577
|
+
"#3333FF",
|
|
7578
|
+
"#3366CC",
|
|
7579
|
+
"#3366FF",
|
|
7580
|
+
"#3399CC",
|
|
7581
|
+
"#3399FF",
|
|
7582
|
+
"#33CC00",
|
|
7583
|
+
"#33CC33",
|
|
7584
|
+
"#33CC66",
|
|
7585
|
+
"#33CC99",
|
|
7586
|
+
"#33CCCC",
|
|
7587
|
+
"#33CCFF",
|
|
7588
|
+
"#6600CC",
|
|
7589
|
+
"#6600FF",
|
|
7590
|
+
"#6633CC",
|
|
7591
|
+
"#6633FF",
|
|
7592
|
+
"#66CC00",
|
|
7593
|
+
"#66CC33",
|
|
7594
|
+
"#9900CC",
|
|
7595
|
+
"#9900FF",
|
|
7596
|
+
"#9933CC",
|
|
7597
|
+
"#9933FF",
|
|
7598
|
+
"#99CC00",
|
|
7599
|
+
"#99CC33",
|
|
7600
|
+
"#CC0000",
|
|
7601
|
+
"#CC0033",
|
|
7602
|
+
"#CC0066",
|
|
7603
|
+
"#CC0099",
|
|
7604
|
+
"#CC00CC",
|
|
7605
|
+
"#CC00FF",
|
|
7606
|
+
"#CC3300",
|
|
7607
|
+
"#CC3333",
|
|
7608
|
+
"#CC3366",
|
|
7609
|
+
"#CC3399",
|
|
7610
|
+
"#CC33CC",
|
|
7611
|
+
"#CC33FF",
|
|
7612
|
+
"#CC6600",
|
|
7613
|
+
"#CC6633",
|
|
7614
|
+
"#CC9900",
|
|
7615
|
+
"#CC9933",
|
|
7616
|
+
"#CCCC00",
|
|
7617
|
+
"#CCCC33",
|
|
7618
|
+
"#FF0000",
|
|
7619
|
+
"#FF0033",
|
|
7620
|
+
"#FF0066",
|
|
7621
|
+
"#FF0099",
|
|
7622
|
+
"#FF00CC",
|
|
7623
|
+
"#FF00FF",
|
|
7624
|
+
"#FF3300",
|
|
7625
|
+
"#FF3333",
|
|
7626
|
+
"#FF3366",
|
|
7627
|
+
"#FF3399",
|
|
7628
|
+
"#FF33CC",
|
|
7629
|
+
"#FF33FF",
|
|
7630
|
+
"#FF6600",
|
|
7631
|
+
"#FF6633",
|
|
7632
|
+
"#FF9900",
|
|
7633
|
+
"#FF9933",
|
|
7634
|
+
"#FFCC00",
|
|
7635
|
+
"#FFCC33"
|
|
7636
|
+
];
|
|
7637
|
+
function formatArgs(diff, args) {
|
|
7638
|
+
const { useColors } = this;
|
|
7639
|
+
args[0] = `${(useColors ? "%c" : "") + this.namespace + (useColors ? " %c" : " ") + args[0] + (useColors ? "%c " : " ")}+${this.humanize(diff)}`;
|
|
7640
|
+
if (!useColors) return;
|
|
7641
|
+
const c = `color: ${this.color}`;
|
|
7642
|
+
args.splice(1, 0, c, "color: inherit");
|
|
7643
|
+
let index = 0;
|
|
7644
|
+
let lastC = 0;
|
|
7645
|
+
args[0].replace(/%[a-z%]/gi, (match) => {
|
|
7646
|
+
if (match === "%%") return;
|
|
7647
|
+
index++;
|
|
7648
|
+
if (match === "%c") lastC = index;
|
|
7649
|
+
});
|
|
7650
|
+
args.splice(lastC, 0, c);
|
|
7651
|
+
}
|
|
7652
|
+
__name(formatArgs, "formatArgs");
|
|
7653
|
+
var log = console.debug || console.log || (() => {
|
|
7654
|
+
});
|
|
7655
|
+
var storage = localstorage();
|
|
7656
|
+
var defaultOptions2 = {
|
|
7657
|
+
useColors: true,
|
|
7658
|
+
formatArgs,
|
|
7659
|
+
formatters: {
|
|
7660
|
+
/**
|
|
7661
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
7662
|
+
*/
|
|
7663
|
+
j(v) {
|
|
7664
|
+
try {
|
|
7665
|
+
return JSON.stringify(v);
|
|
7666
|
+
} catch (error) {
|
|
7667
|
+
return `[UnexpectedJSONParseError]: ${error.message}`;
|
|
7668
|
+
}
|
|
7669
|
+
}
|
|
7670
|
+
},
|
|
7671
|
+
inspectOpts: {},
|
|
7672
|
+
humanize,
|
|
7673
|
+
log
|
|
7674
|
+
};
|
|
7675
|
+
function createDebug2(namespace, options) {
|
|
7676
|
+
var _ref;
|
|
7677
|
+
const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace);
|
|
7678
|
+
return createDebug(namespace, Object.assign(defaultOptions2, { color }, options));
|
|
7679
|
+
}
|
|
7680
|
+
__name(createDebug2, "createDebug");
|
|
7681
|
+
function localstorage() {
|
|
7682
|
+
try {
|
|
7683
|
+
return localStorage;
|
|
7684
|
+
} catch (_unused) {
|
|
7685
|
+
}
|
|
7686
|
+
}
|
|
7687
|
+
__name(localstorage, "localstorage");
|
|
7688
|
+
function load() {
|
|
7689
|
+
let r;
|
|
7690
|
+
try {
|
|
7691
|
+
r = storage.getItem("debug") || storage.getItem("DEBUG");
|
|
7692
|
+
} catch (_unused2) {
|
|
7693
|
+
}
|
|
7694
|
+
if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
|
|
7695
|
+
return r || "";
|
|
7696
|
+
}
|
|
7697
|
+
__name(load, "load");
|
|
7698
|
+
enable(load());
|
|
7699
|
+
|
|
7700
|
+
// ../../src/Util/IsBuildAwesome.js
|
|
7701
|
+
function isUsingBuildAwesome() {
|
|
7702
|
+
return process?.env?.BUILDAWESOME_PACKAGE === "@awesome.me/buildawesome";
|
|
7703
|
+
}
|
|
7704
|
+
__name(isUsingBuildAwesome, "isUsingBuildAwesome");
|
|
7705
|
+
|
|
7706
|
+
// ../../src/Util/DebugLogUtil.js
|
|
7707
|
+
var PREFIX = isUsingBuildAwesome() ? "BuildAwesome:" : "Eleventy:";
|
|
7708
|
+
function createDebug3(name) {
|
|
7709
|
+
return createDebug2(`${PREFIX}:${name}`);
|
|
7268
7710
|
}
|
|
7269
|
-
__name(
|
|
7711
|
+
__name(createDebug3, "createDebug");
|
|
7270
7712
|
|
|
7271
|
-
// ../../src/Errors/
|
|
7272
|
-
var
|
|
7713
|
+
// ../../src/Errors/BaseError.js
|
|
7714
|
+
var BaseError = class extends Error {
|
|
7273
7715
|
static {
|
|
7274
|
-
__name(this, "
|
|
7716
|
+
__name(this, "BaseError");
|
|
7275
7717
|
}
|
|
7276
7718
|
/**
|
|
7277
7719
|
* @param {string} message - The error message to display.
|
|
7278
|
-
* @param {
|
|
7720
|
+
* @param {Error} [originalError] - The original error caught.
|
|
7279
7721
|
*/
|
|
7280
7722
|
constructor(message, originalError) {
|
|
7281
7723
|
if (originalError) {
|
|
@@ -7292,15 +7734,14 @@ var EleventyBaseError = class extends Error {
|
|
|
7292
7734
|
}
|
|
7293
7735
|
}
|
|
7294
7736
|
};
|
|
7295
|
-
var EleventyBaseError_default = EleventyBaseError;
|
|
7296
7737
|
|
|
7297
7738
|
// ../../src/Engines/TemplateEngine.js
|
|
7298
|
-
var TemplateEngineConfigError = class extends
|
|
7739
|
+
var TemplateEngineConfigError = class extends BaseError {
|
|
7299
7740
|
static {
|
|
7300
7741
|
__name(this, "TemplateEngineConfigError");
|
|
7301
7742
|
}
|
|
7302
7743
|
};
|
|
7303
|
-
var debug =
|
|
7744
|
+
var debug = createDebug3("TemplateEngine");
|
|
7304
7745
|
var AMENDED_INSTANCES = /* @__PURE__ */ new Set();
|
|
7305
7746
|
var TemplateEngine = class {
|
|
7306
7747
|
static {
|
|
@@ -7746,6 +8187,7 @@ var Liquid2 = class _Liquid extends TemplateEngine {
|
|
|
7746
8187
|
{
|
|
7747
8188
|
page: data?.page,
|
|
7748
8189
|
eleventy: data?.eleventy,
|
|
8190
|
+
buildawesome: data?.buildawesome,
|
|
7749
8191
|
collections: data?.collections
|
|
7750
8192
|
},
|
|
7751
8193
|
liquidOptions?.globals
|