@11ty/client 4.0.0-alpha.7 → 4.0.0-alpha.8

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.
@@ -1,4 +1,4 @@
1
- /*! Eleventy v4.0.0-alpha.7 (@11ty/client/liquid Engine Bundle) */
1
+ /*! Eleventy (Build Awesome) v4.0.0-alpha.8 (@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
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
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
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
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 sha256(data) {
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 sha256 = require_lib_sha256();
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 = sha256();
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
- let n = length - str.length;
2418
- while (n-- > 0)
2419
- str = add(str, ch);
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 == null && b == null)
2472
+ if (isNil(a) && isNil(b))
2438
2473
  return 0;
2439
- if (a == null)
2474
+ if (isNil(a))
2440
2475
  return 1;
2441
- if (b == null)
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) {
@@ -2869,6 +2900,13 @@ function __awaiter(thisArg, _arguments, P, generator) {
2869
2900
  });
2870
2901
  }
2871
2902
  __name(__awaiter, "__awaiter");
2903
+ function toLiquidAsync(asyncFn, syncFn) {
2904
+ const syncImpl = syncFn || asyncFn;
2905
+ return (sync, ...args) => {
2906
+ return sync ? syncImpl(...args) : asyncFn(...args);
2907
+ };
2908
+ }
2909
+ __name(toLiquidAsync, "toLiquidAsync");
2872
2910
  function toPromise(val) {
2873
2911
  return __awaiter(this, void 0, void 0, function* () {
2874
2912
  if (!isIterator(val))
@@ -3005,8 +3043,10 @@ var formatCodes = {
3005
3043
  m: /* @__PURE__ */ __name((d) => d.getMonth() + 1, "m"),
3006
3044
  M: /* @__PURE__ */ __name((d) => d.getMinutes(), "M"),
3007
3045
  N: /* @__PURE__ */ __name((d, opts) => {
3046
+ var _a;
3008
3047
  const width = Number(opts.width) || 9;
3009
3048
  const str = String(d.getMilliseconds()).slice(0, width);
3049
+ (_a = opts.memoryLimit) === null || _a === void 0 ? void 0 : _a.use(width - str.length);
3010
3050
  return padEnd(str, width, "0");
3011
3051
  }, "N"),
3012
3052
  p: /* @__PURE__ */ __name((d) => d.getHours() < 12 ? "AM" : "PM", "p"),
@@ -3029,19 +3069,19 @@ var formatCodes = {
3029
3069
  "%": /* @__PURE__ */ __name(() => "%", "%")
3030
3070
  };
3031
3071
  formatCodes.h = formatCodes.b;
3032
- function strftime(d, formatStr) {
3072
+ function strftime(d, formatStr, memoryLimit) {
3033
3073
  let output = "";
3034
3074
  let remaining = formatStr;
3035
3075
  let match;
3036
3076
  while (match = rFormat.exec(remaining)) {
3037
3077
  output += remaining.slice(0, match.index);
3038
3078
  remaining = remaining.slice(match.index + match[0].length);
3039
- output += format(d, match);
3079
+ output += format(d, match, memoryLimit);
3040
3080
  }
3041
3081
  return output + remaining;
3042
3082
  }
3043
3083
  __name(strftime, "strftime");
3044
- function format(d, match) {
3084
+ function format(d, match, memoryLimit) {
3045
3085
  const [input, flagStr = "", width, modifier, conversion] = match;
3046
3086
  const convert = formatCodes[conversion];
3047
3087
  if (!convert)
@@ -3049,7 +3089,7 @@ function format(d, match) {
3049
3089
  const flags = {};
3050
3090
  for (const flag of flagStr)
3051
3091
  flags[flag] = true;
3052
- let ret = String(convert(d, { flags, width, modifier }));
3092
+ let ret = String(convert(d, { flags, width, modifier, memoryLimit }));
3053
3093
  let padChar = padSpaceChars.has(conversion) ? " " : "0";
3054
3094
  let padWidth = width || padWidths[conversion] || 0;
3055
3095
  if (flags["^"])
@@ -3062,6 +3102,7 @@ function format(d, match) {
3062
3102
  padChar = "0";
3063
3103
  if (flags["-"])
3064
3104
  padWidth = 0;
3105
+ memoryLimit === null || memoryLimit === void 0 ? void 0 : memoryLimit.use(Number(padWidth) - ret.length);
3065
3106
  return padStart(ret, padWidth, padChar);
3066
3107
  }
3067
3108
  __name(format, "format");
@@ -3228,13 +3269,15 @@ var Limiter = class {
3228
3269
  this.limit = limit2;
3229
3270
  }
3230
3271
  use(count) {
3231
- count = +count || 0;
3232
- assert(this.base + count <= this.limit, this.message);
3233
- this.base += count;
3272
+ if (+count > 0) {
3273
+ assert(this.base + +count <= this.limit, this.message);
3274
+ this.base += +count;
3275
+ }
3234
3276
  }
3235
3277
  check(count) {
3236
- count = +count || 0;
3237
- assert(count <= this.limit, this.message);
3278
+ if (+count > 0) {
3279
+ assert(+count <= this.limit, this.message);
3280
+ }
3238
3281
  }
3239
3282
  };
3240
3283
  var DelimitedToken = class extends Token {
@@ -3546,6 +3589,7 @@ var Render = class {
3546
3589
  if (!emitter) {
3547
3590
  emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter();
3548
3591
  }
3592
+ ctx.renderLimit.check(getPerformance().now());
3549
3593
  const errors = [];
3550
3594
  for (const tpl of templates) {
3551
3595
  ctx.renderLimit.check(getPerformance().now());
@@ -3962,7 +4006,28 @@ __name(newline_to_br, "newline_to_br");
3962
4006
  function strip_html(v) {
3963
4007
  const str = stringify(v);
3964
4008
  this.context.memoryLimit.use(str.length);
3965
- return str.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g, "");
4009
+ const blocks = /* @__PURE__ */ new Map([["<script", "<\/script>"], ["<style", "</style>"], ["<!--", "-->"], ["<", ">"]]);
4010
+ let out = "";
4011
+ let i = 0;
4012
+ while (i < str.length) {
4013
+ const lt = str.indexOf("<", i);
4014
+ if (lt < 0)
4015
+ return out + str.slice(i);
4016
+ out += str.slice(i, lt);
4017
+ for (const [opener, closer] of blocks) {
4018
+ if (!str.startsWith(opener, lt))
4019
+ continue;
4020
+ const e = str.indexOf(closer, lt + opener.length);
4021
+ if (e >= 0) {
4022
+ i = e + closer.length;
4023
+ break;
4024
+ }
4025
+ blocks.delete(opener);
4026
+ }
4027
+ if (i === lt)
4028
+ return out + str.slice(lt);
4029
+ }
4030
+ return out;
3966
4031
  }
3967
4032
  __name(strip_html, "strip_html");
3968
4033
  var htmlFilters = /* @__PURE__ */ Object.freeze({
@@ -5089,50 +5154,54 @@ var Loader = class {
5089
5154
  __name(this, "Loader");
5090
5155
  }
5091
5156
  constructor(options) {
5157
+ var _a, _b, _c, _d;
5092
5158
  this.options = options;
5093
5159
  if (options.relativeReference) {
5094
5160
  const sep2 = options.fs.sep;
5095
5161
  assert(sep2, "`fs.sep` is required for relative reference");
5096
- const rRelativePath = new RegExp(["." + sep2, ".." + sep2, "./", "../"].map((prefix) => escapeRegex(prefix)).join("|"));
5097
- this.shouldLoadRelative = (referencedFile) => rRelativePath.test(referencedFile);
5162
+ const prefixes = ["." + sep2, ".." + sep2, "./", "../"];
5163
+ this.shouldLoadRelative = (referencedFile) => prefixes.some((prefix) => referencedFile.startsWith(prefix));
5098
5164
  } else {
5099
5165
  this.shouldLoadRelative = (_referencedFile) => false;
5100
5166
  }
5101
- this.contains = this.options.fs.contains || (() => true);
5167
+ const fs3 = options.fs;
5168
+ this.contains = toLiquidAsync(((_a = fs3.contains) === null || _a === void 0 ? void 0 : _a.bind(fs3)) || (() => __awaiter(this, void 0, void 0, function* () {
5169
+ return true;
5170
+ })), ((_b = fs3.containsSync) === null || _b === void 0 ? void 0 : _b.bind(fs3)) || (() => true));
5171
+ this.exists = toLiquidAsync(((_c = fs3.exists) === null || _c === void 0 ? void 0 : _c.bind(fs3)) || (() => __awaiter(this, void 0, void 0, function* () {
5172
+ return false;
5173
+ })), (_d = fs3.existsSync) === null || _d === void 0 ? void 0 : _d.bind(fs3));
5102
5174
  }
5103
5175
  *lookup(file, type, sync, currentFile) {
5104
- const { fs: fs3 } = this.options;
5105
5176
  const dirs = this.options[type];
5106
- for (const filepath of this.candidates(file, dirs, currentFile, type !== LookupType.Root)) {
5107
- if (sync ? fs3.existsSync(filepath) : yield fs3.exists(filepath))
5177
+ for (const filepath of this.candidates(file, dirs, currentFile)) {
5178
+ let allowed = false;
5179
+ for (const dir of dirs) {
5180
+ if (yield this.contains(!!sync, dir, filepath)) {
5181
+ allowed = true;
5182
+ break;
5183
+ }
5184
+ }
5185
+ if (!allowed)
5186
+ continue;
5187
+ if (yield this.exists(!!sync, filepath))
5108
5188
  return filepath;
5109
5189
  }
5110
5190
  throw this.lookupError(file, dirs);
5111
5191
  }
5112
- *candidates(file, dirs, currentFile, enforceRoot) {
5192
+ *candidates(file, dirs, currentFile) {
5113
5193
  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
5194
  if (this.shouldLoadRelative(file) && currentFile) {
5124
5195
  const referenced = fs3.resolve(this.dirname(currentFile), file, extname);
5125
- if (isAllowed(referenced))
5126
- yield referenced;
5196
+ yield referenced;
5127
5197
  }
5128
5198
  for (const dir of dirs) {
5129
5199
  const referenced = fs3.resolve(dir, file, extname);
5130
- if (isAllowed(referenced))
5131
- yield referenced;
5200
+ yield referenced;
5132
5201
  }
5133
5202
  if (fs3.fallback !== void 0) {
5134
5203
  const filepath = fs3.fallback(file);
5135
- if (filepath !== void 0 && isAllowed(filepath))
5204
+ if (filepath !== void 0)
5136
5205
  yield filepath;
5137
5206
  }
5138
5207
  }
@@ -5153,12 +5222,16 @@ var Parser = class {
5153
5222
  __name(this, "Parser");
5154
5223
  }
5155
5224
  constructor(liquid) {
5225
+ var _a, _b;
5156
5226
  this.liquid = liquid;
5157
5227
  this.cache = this.liquid.options.cache;
5158
5228
  this.fs = this.liquid.options.fs;
5159
5229
  this.parseFile = this.cache ? this._parseFileCached : this._parseFile;
5160
5230
  this.loader = new Loader(this.liquid.options);
5161
5231
  this.parseLimit = new Limiter("parse length", liquid.options.parseLimit);
5232
+ this.readFile = toLiquidAsync(((_a = this.fs.readFile) === null || _a === void 0 ? void 0 : _a.bind(this.fs)) || (() => __awaiter(this, void 0, void 0, function* () {
5233
+ throw new Error("readFile not implemented");
5234
+ })), (_b = this.fs.readFileSync) === null || _b === void 0 ? void 0 : _b.bind(this.fs));
5162
5235
  }
5163
5236
  parse(html, filepath) {
5164
5237
  html = String(html);
@@ -5223,7 +5296,7 @@ var Parser = class {
5223
5296
  }
5224
5297
  *_parseFile(file, sync, type = LookupType.Root, currentFile) {
5225
5298
  const filepath = yield this.loader.lookup(file, type, sync, currentFile);
5226
- return this.parse(sync ? this.fs.readFileSync(filepath) : yield this.fs.readFile(filepath), filepath);
5299
+ return this.parse(yield this.readFile(!!sync, filepath), filepath);
5227
5300
  }
5228
5301
  };
5229
5302
  var TokenKind;
@@ -5291,13 +5364,20 @@ function getKind(val) {
5291
5364
  return val ? val.kind : -1;
5292
5365
  }
5293
5366
  __name(getKind, "getKind");
5367
+ function createScope(from) {
5368
+ const scope = /* @__PURE__ */ Object.create(null);
5369
+ if (from)
5370
+ Object.assign(scope, from);
5371
+ return scope;
5372
+ }
5373
+ __name(createScope, "createScope");
5294
5374
  var Context = class _Context {
5295
5375
  static {
5296
5376
  __name(this, "Context");
5297
5377
  }
5298
5378
  constructor(env = {}, opts = defaultOptions, renderOptions = {}, { memoryLimit, renderLimit } = {}) {
5299
5379
  var _a, _b, _c, _d, _e;
5300
- this.scopes = [{}];
5380
+ this.scopes = [createScope()];
5301
5381
  this.registers = {};
5302
5382
  this.breakCalled = false;
5303
5383
  this.continueCalled = false;
@@ -5310,8 +5390,8 @@ var Context = class _Context {
5310
5390
  this.memoryLimit = memoryLimit !== null && memoryLimit !== void 0 ? memoryLimit : new Limiter("memory alloc", (_d = renderOptions.memoryLimit) !== null && _d !== void 0 ? _d : opts.memoryLimit);
5311
5391
  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
5392
  }
5313
- getRegister(key) {
5314
- return this.registers[key] = this.registers[key] || {};
5393
+ getRegister(key, defaultValue = void 0) {
5394
+ return this.registers[key] = this.registers[key] || defaultValue;
5315
5395
  }
5316
5396
  setRegister(key, value) {
5317
5397
  return this.registers[key] = value;
@@ -5368,7 +5448,8 @@ var Context = class _Context {
5368
5448
  return new _Context(scope, this.opts, {
5369
5449
  sync: this.sync,
5370
5450
  globals: this.globals,
5371
- strictVariables: this.strictVariables
5451
+ strictVariables: this.strictVariables,
5452
+ ownPropertyOnly: this.ownPropertyOnly
5372
5453
  }, {
5373
5454
  renderLimit: this.renderLimit,
5374
5455
  memoryLimit: this.memoryLimit
@@ -5451,7 +5532,8 @@ function round(v, arg = 0) {
5451
5532
  v = toNumber(v);
5452
5533
  arg = toNumber(arg);
5453
5534
  const amp = Math.pow(10, arg);
5454
- return Math.round(v * amp) / amp;
5535
+ const scaled = v * amp;
5536
+ return Math.sign(v) * Math.round(Math.abs(scaled)) / amp;
5455
5537
  }
5456
5538
  __name(round, "round");
5457
5539
  var mathFilters = /* @__PURE__ */ Object.freeze({
@@ -5518,7 +5600,7 @@ var reverse = argumentsToValue(function(v) {
5518
5600
  this.context.memoryLimit.use(array.length);
5519
5601
  return [...array].reverse();
5520
5602
  });
5521
- function* sort(arr, property) {
5603
+ function* sortBy(arr, property, comparator) {
5522
5604
  const values = [];
5523
5605
  const array = toArray(arr);
5524
5606
  this.context.memoryLimit.use(array.length);
@@ -5528,19 +5610,15 @@ function* sort(arr, property) {
5528
5610
  property ? yield this.context._getFromScope(item, stringify(property).split("."), false) : item
5529
5611
  ]);
5530
5612
  }
5531
- return values.sort((lhs, rhs) => {
5532
- const lvalue = lhs[1];
5533
- const rvalue = rhs[1];
5534
- return lvalue < rvalue ? -1 : lvalue > rvalue ? 1 : 0;
5535
- }).map((tuple) => tuple[0]);
5613
+ return values.sort((lhs, rhs) => comparator(lhs[1], rhs[1])).map((tuple) => tuple[0]);
5614
+ }
5615
+ __name(sortBy, "sortBy");
5616
+ function* sort(arr, property) {
5617
+ return yield* sortBy.call(this, arr, property, orderedCompare);
5536
5618
  }
5537
5619
  __name(sort, "sort");
5538
- function sort_natural(input, property) {
5539
- const propertyString = stringify(property);
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);
5620
+ function* sort_natural(arr, property) {
5621
+ return yield* sortBy.call(this, arr, property, caseInsensitiveCompare);
5544
5622
  }
5545
5623
  __name(sort_natural, "sort_natural");
5546
5624
  var size = /* @__PURE__ */ __name((v) => v && v.length || 0, "size");
@@ -5803,15 +5881,16 @@ var arrayFilters = /* @__PURE__ */ Object.freeze({
5803
5881
  sample
5804
5882
  });
5805
5883
  function date(v, format2, timezoneOffset) {
5806
- var _a, _b, _c;
5807
- const size2 = ((_a = v === null || v === void 0 ? void 0 : v.length) !== null && _a !== void 0 ? _a : 0) + ((_b = format2 === null || format2 === void 0 ? void 0 : format2.length) !== null && _b !== void 0 ? _b : 0) + ((_c = timezoneOffset === null || timezoneOffset === void 0 ? void 0 : timezoneOffset.length) !== null && _c !== void 0 ? _c : 0);
5884
+ var _a, _b;
5885
+ 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
5886
  this.context.memoryLimit.use(size2);
5809
5887
  const date2 = parseDate(v, this.context.opts, timezoneOffset);
5810
5888
  if (!date2)
5811
5889
  return v;
5812
5890
  format2 = toValue(format2);
5813
5891
  format2 = isNil(format2) ? this.context.opts.dateFormat : stringify(format2);
5814
- return strftime(date2, format2);
5892
+ this.context.memoryLimit.use(format2.length);
5893
+ return strftime(date2, format2, this.context.memoryLimit);
5815
5894
  }
5816
5895
  __name(date, "date");
5817
5896
  function date_to_xmlschema(v) {
@@ -5834,11 +5913,12 @@ function stringify_date(v, month_type, type, style) {
5834
5913
  const date2 = parseDate(v, this.context.opts);
5835
5914
  if (!date2)
5836
5915
  return v;
5916
+ const ml = this.context.memoryLimit;
5837
5917
  if (type === "ordinal") {
5838
5918
  const d = date2.getDate();
5839
- return style === "US" ? strftime(date2, `${month_type} ${d}%q, %Y`) : strftime(date2, `${d}%q ${month_type} %Y`);
5919
+ return style === "US" ? strftime(date2, `${month_type} ${d}%q, %Y`, ml) : strftime(date2, `${d}%q ${month_type} %Y`, ml);
5840
5920
  }
5841
- return strftime(date2, `%d ${month_type} %Y`);
5921
+ return strftime(date2, `%d ${month_type} %Y`, ml);
5842
5922
  }
5843
5923
  __name(stringify_date, "stringify_date");
5844
5924
  function parseDate(v, opts, timezoneOffset) {
@@ -5846,7 +5926,9 @@ function parseDate(v, opts, timezoneOffset) {
5846
5926
  const defaultTimezoneOffset = timezoneOffset !== null && timezoneOffset !== void 0 ? timezoneOffset : opts.timezoneOffset;
5847
5927
  const locale = opts.locale;
5848
5928
  v = toValue(v);
5849
- if (v === "now" || v === "today") {
5929
+ if (isNil(v)) {
5930
+ return void 0;
5931
+ } else if (v === "now" || v === "today") {
5850
5932
  date2 = new LiquidDate(Date.now(), locale, defaultTimezoneOffset);
5851
5933
  } else if (isNumber(v)) {
5852
5934
  date2 = new LiquidDate(v * 1e3, locale, defaultTimezoneOffset);
@@ -5894,10 +5976,15 @@ function lstrip(v, chars) {
5894
5976
  const str = stringify(v);
5895
5977
  this.context.memoryLimit.use(str.length);
5896
5978
  if (chars) {
5897
- chars = escapeRegExp(stringify(chars));
5898
- return str.replace(new RegExp(`^[${chars}]+`, "g"), "");
5979
+ chars = stringify(chars);
5980
+ this.context.memoryLimit.use(chars.length);
5981
+ for (let i = 0, set = new Set(chars); i < str.length; i++) {
5982
+ if (!set.has(str[i]))
5983
+ return str.slice(i);
5984
+ }
5985
+ return "";
5899
5986
  }
5900
- return str.replace(/^\s+/, "");
5987
+ return str.trimStart();
5901
5988
  }
5902
5989
  __name(lstrip, "lstrip");
5903
5990
  function downcase(v) {
@@ -5914,20 +6001,22 @@ function upcase(v) {
5914
6001
  __name(upcase, "upcase");
5915
6002
  function remove(v, arg) {
5916
6003
  const str = stringify(v);
5917
- this.context.memoryLimit.use(str.length);
5918
- return str.split(stringify(arg)).join("");
6004
+ arg = stringify(arg);
6005
+ this.context.memoryLimit.use(str.length + arg.length);
6006
+ return str.split(arg).join("");
5919
6007
  }
5920
6008
  __name(remove, "remove");
5921
6009
  function remove_first(v, l) {
5922
6010
  const str = stringify(v);
5923
- this.context.memoryLimit.use(str.length);
5924
- return str.replace(stringify(l), "");
6011
+ l = stringify(l);
6012
+ this.context.memoryLimit.use(str.length + l.length);
6013
+ return str.replace(l, "");
5925
6014
  }
5926
6015
  __name(remove_first, "remove_first");
5927
6016
  function remove_last(v, l) {
5928
6017
  const str = stringify(v);
5929
- this.context.memoryLimit.use(str.length);
5930
6018
  const pattern = stringify(l);
6019
+ this.context.memoryLimit.use(str.length + pattern.length);
5931
6020
  const index = str.lastIndexOf(pattern);
5932
6021
  if (index === -1)
5933
6022
  return str;
@@ -5938,10 +6027,15 @@ function rstrip(str, chars) {
5938
6027
  str = stringify(str);
5939
6028
  this.context.memoryLimit.use(str.length);
5940
6029
  if (chars) {
5941
- chars = escapeRegExp(stringify(chars));
5942
- return str.replace(new RegExp(`[${chars}]+$`, "g"), "");
6030
+ chars = stringify(chars);
6031
+ this.context.memoryLimit.use(chars.length);
6032
+ for (let i = str.length - 1, set = new Set(chars); i >= 0; i--) {
6033
+ if (!set.has(str[i]))
6034
+ return str.slice(0, i + 1);
6035
+ }
6036
+ return "";
5943
6037
  }
5944
- return str.replace(/\s+$/, "");
6038
+ return str.trimEnd();
5945
6039
  }
5946
6040
  __name(rstrip, "rstrip");
5947
6041
  function split(v, arg) {
@@ -5957,8 +6051,15 @@ function strip(v, chars) {
5957
6051
  const str = stringify(v);
5958
6052
  this.context.memoryLimit.use(str.length);
5959
6053
  if (chars) {
5960
- chars = escapeRegExp(stringify(chars));
5961
- return str.replace(new RegExp(`^[${chars}]+`, "g"), "").replace(new RegExp(`[${chars}]+$`, "g"), "");
6054
+ const set = new Set(stringify(chars));
6055
+ this.context.memoryLimit.use(set.size);
6056
+ let i = 0;
6057
+ let j = str.length - 1;
6058
+ while (set.has(str[i]))
6059
+ i++;
6060
+ while (j >= i && set.has(str[j]))
6061
+ j--;
6062
+ return str.slice(i, j + 1);
5962
6063
  }
5963
6064
  return str.trim();
5964
6065
  }
@@ -5977,30 +6078,37 @@ function capitalize(str) {
5977
6078
  __name(capitalize, "capitalize");
5978
6079
  function replace(v, pattern, replacement) {
5979
6080
  const str = stringify(v);
5980
- this.context.memoryLimit.use(str.length);
5981
- return str.split(stringify(pattern)).join(replacement);
6081
+ pattern = stringify(pattern);
6082
+ replacement = stringify(replacement);
6083
+ const parts = str.split(pattern);
6084
+ const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length);
6085
+ this.context.memoryLimit.use(outputSize);
6086
+ return parts.join(replacement);
5982
6087
  }
5983
6088
  __name(replace, "replace");
5984
6089
  function replace_first(v, arg1, arg2) {
5985
6090
  const str = stringify(v);
5986
- this.context.memoryLimit.use(str.length);
5987
- return str.replace(stringify(arg1), arg2);
6091
+ arg1 = stringify(arg1);
6092
+ arg2 = stringify(arg2);
6093
+ this.context.memoryLimit.use(str.length + arg1.length + arg2.length);
6094
+ return str.replace(arg1, () => arg2);
5988
6095
  }
5989
6096
  __name(replace_first, "replace_first");
5990
6097
  function replace_last(v, arg1, arg2) {
5991
6098
  const str = stringify(v);
5992
- this.context.memoryLimit.use(str.length);
5993
6099
  const pattern = stringify(arg1);
6100
+ const replacement = stringify(arg2);
6101
+ this.context.memoryLimit.use(str.length + pattern.length + replacement.length);
5994
6102
  const index = str.lastIndexOf(pattern);
5995
6103
  if (index === -1)
5996
6104
  return str;
5997
- const replacement = stringify(arg2);
5998
6105
  return str.substring(0, index) + replacement + str.substring(index + pattern.length);
5999
6106
  }
6000
6107
  __name(replace_last, "replace_last");
6001
6108
  function truncate(v, l = 50, o = "...") {
6002
6109
  const str = stringify(v);
6003
- this.context.memoryLimit.use(str.length);
6110
+ o = stringify(o);
6111
+ this.context.memoryLimit.use(str.length + o.length);
6004
6112
  if (str.length <= l)
6005
6113
  return v;
6006
6114
  return str.substring(0, l - o.length) + o;
@@ -6008,7 +6116,8 @@ function truncate(v, l = 50, o = "...") {
6008
6116
  __name(truncate, "truncate");
6009
6117
  function truncatewords(v, words = 15, o = "...") {
6010
6118
  const str = stringify(v);
6011
- this.context.memoryLimit.use(str.length);
6119
+ o = stringify(o);
6120
+ this.context.memoryLimit.use(str.length + o.length);
6012
6121
  const arr = str.split(/\s+/);
6013
6122
  if (words <= 0)
6014
6123
  words = 1;
@@ -6041,7 +6150,8 @@ function number_of_words(input, mode) {
6041
6150
  }
6042
6151
  __name(number_of_words, "number_of_words");
6043
6152
  function array_to_sentence_string(array, connector = "and") {
6044
- this.context.memoryLimit.use(array.length);
6153
+ connector = stringify(connector);
6154
+ this.context.memoryLimit.use(array.length + connector.length);
6045
6155
  switch (array.length) {
6046
6156
  case 0:
6047
6157
  return "";
@@ -6087,6 +6197,10 @@ function base64Decode(str) {
6087
6197
  }
6088
6198
  __name(base64Decode, "base64Decode");
6089
6199
  function base64_encode(value) {
6200
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer(value)) {
6201
+ this.context.memoryLimit.use(value.byteLength);
6202
+ return value.toString("base64");
6203
+ }
6090
6204
  const str = stringify(value);
6091
6205
  this.context.memoryLimit.use(str.length);
6092
6206
  return base64Encode(str);
@@ -6103,7 +6217,51 @@ var base64Filters = /* @__PURE__ */ Object.freeze({
6103
6217
  base64_encode,
6104
6218
  base64_decode
6105
6219
  });
6106
- var filters = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, htmlFilters), mathFilters), urlFilters), arrayFilters), dateFilters), stringFilters), base64Filters), misc);
6220
+ function bufferToHex(buffer) {
6221
+ const bytes = new Uint8Array(buffer);
6222
+ let hex = "";
6223
+ for (let i = 0; i < bytes.length; i++) {
6224
+ hex += bytes[i].toString(16).padStart(2, "0");
6225
+ }
6226
+ return hex;
6227
+ }
6228
+ __name(bufferToHex, "bufferToHex");
6229
+ function sha256(str) {
6230
+ return __awaiter(this, void 0, void 0, function* () {
6231
+ const data = new TextEncoder().encode(str);
6232
+ const digest = yield crypto.subtle.digest("SHA-256", data);
6233
+ return bufferToHex(digest);
6234
+ });
6235
+ }
6236
+ __name(sha256, "sha256");
6237
+ function hmacSha256(str, key) {
6238
+ return __awaiter(this, void 0, void 0, function* () {
6239
+ const encoder = new TextEncoder();
6240
+ const cryptoKey = yield crypto.subtle.importKey("raw", encoder.encode(key), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
6241
+ const signature = yield crypto.subtle.sign("HMAC", cryptoKey, encoder.encode(str));
6242
+ return bufferToHex(signature);
6243
+ });
6244
+ }
6245
+ __name(hmacSha256, "hmacSha256");
6246
+ function sha256$1(value) {
6247
+ const str = stringify(value);
6248
+ this.context.memoryLimit.use(str.length);
6249
+ return sha256(str);
6250
+ }
6251
+ __name(sha256$1, "sha256$1");
6252
+ function hmac_sha256(value, key) {
6253
+ const str = stringify(value);
6254
+ const keyStr = stringify(key);
6255
+ this.context.memoryLimit.use(str.length + keyStr.length);
6256
+ return hmacSha256(str, keyStr);
6257
+ }
6258
+ __name(hmac_sha256, "hmac_sha256");
6259
+ var cryptoFilters = /* @__PURE__ */ Object.freeze({
6260
+ __proto__: null,
6261
+ sha256: sha256$1,
6262
+ hmac_sha256
6263
+ });
6264
+ 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
6265
  var AssignTag = class extends Tag {
6108
6266
  static {
6109
6267
  __name(this, "AssignTag");
@@ -6166,7 +6324,7 @@ var ForTag = class extends Tag {
6166
6324
  return;
6167
6325
  }
6168
6326
  const continueKey = "continue-" + this.variable + "-" + this.collection.getText();
6169
- ctx.push({ continue: ctx.getRegister(continueKey) });
6327
+ ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) }));
6170
6328
  const hash = yield this.hash.render(ctx);
6171
6329
  ctx.pop();
6172
6330
  const modifiers = this.liquid.options.orderedFilterParameters ? Object.keys(hash).filter((x) => MODIFIERS.includes(x)) : MODIFIERS.filter((x) => hash[x] !== void 0);
@@ -6178,7 +6336,7 @@ var ForTag = class extends Tag {
6178
6336
  return reversed(collection2);
6179
6337
  }, collection);
6180
6338
  ctx.setRegister(continueKey, (hash["offset"] || 0) + collection.length);
6181
- const scope = { forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) };
6339
+ const scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) });
6182
6340
  ctx.push(scope);
6183
6341
  for (const item of collection) {
6184
6342
  scope[this.variable] = item;
@@ -6421,24 +6579,24 @@ var RenderTag = class extends Tag {
6421
6579
  }
6422
6580
  partialScope() {
6423
6581
  if (isString(this["file"])) {
6424
- const names = Object.keys(this.hash.hash);
6582
+ const names2 = Object.keys(this.hash.hash);
6425
6583
  if (this["with"]) {
6426
6584
  const { value, alias } = this["with"];
6427
6585
  if (isString(alias)) {
6428
- names.push([alias, value]);
6586
+ names2.push([alias, value]);
6429
6587
  } else if (isString(this.file)) {
6430
- names.push([this.file, value]);
6588
+ names2.push([this.file, value]);
6431
6589
  }
6432
6590
  }
6433
6591
  if (this["for"]) {
6434
6592
  const { value, alias } = this["for"];
6435
6593
  if (isString(alias)) {
6436
- names.push([alias, value]);
6594
+ names2.push([alias, value]);
6437
6595
  } else if (isString(this.file)) {
6438
- names.push([this.file, value]);
6596
+ names2.push([this.file, value]);
6439
6597
  }
6440
6598
  }
6441
- return { name: this["file"], isolated: true, scope: names };
6599
+ return { name: this["file"], isolated: true, scope: names2 };
6442
6600
  }
6443
6601
  }
6444
6602
  *arguments() {
@@ -6521,11 +6679,11 @@ var IncludeTag = class extends Tag {
6521
6679
  const saved = ctx.saveRegister("blocks", "blockMode");
6522
6680
  ctx.setRegister("blocks", {});
6523
6681
  ctx.setRegister("blockMode", BlockMode.OUTPUT);
6524
- const scope = yield hash.render(ctx);
6682
+ const scope = createScope(yield hash.render(ctx));
6525
6683
  if (withVar)
6526
6684
  scope[filepath] = yield evalToken(withVar, ctx);
6527
6685
  const templates = yield liquid._parsePartialFile(filepath, ctx.sync, this["currentFile"]);
6528
- ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
6686
+ ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope);
6529
6687
  yield renderer.renderTemplates(templates, ctx, emitter);
6530
6688
  ctx.pop();
6531
6689
  ctx.restoreRegister(saved);
@@ -6538,16 +6696,16 @@ var IncludeTag = class extends Tag {
6538
6696
  }
6539
6697
  partialScope() {
6540
6698
  if (isString(this["file"])) {
6541
- let names;
6699
+ let names2;
6542
6700
  if (this.liquid.options.jekyllInclude) {
6543
- names = ["include"];
6701
+ names2 = ["include"];
6544
6702
  } else {
6545
- names = Object.keys(this.hash.hash);
6703
+ names2 = Object.keys(this.hash.hash);
6546
6704
  if (this.withVar) {
6547
- names.push([this["file"], this.withVar]);
6705
+ names2.push([this["file"], this.withVar]);
6548
6706
  }
6549
6707
  }
6550
- return { name: this["file"], isolated: false, scope: names };
6708
+ return { name: this["file"], isolated: false, scope: names2 };
6551
6709
  }
6552
6710
  }
6553
6711
  *arguments() {
@@ -6607,7 +6765,7 @@ var CycleTag = class extends Tag {
6607
6765
  *render(ctx, emitter) {
6608
6766
  const group = yield evalToken(this.group, ctx);
6609
6767
  const fingerprint = `cycle:${group}:` + this.candidates.join(",");
6610
- const groups = ctx.getRegister("cycle");
6768
+ const groups = ctx.getRegister("cycle", {});
6611
6769
  let idx = groups[fingerprint];
6612
6770
  if (idx === void 0) {
6613
6771
  idx = groups[fingerprint] = 0;
@@ -6720,11 +6878,11 @@ var LayoutTag = class extends Tag {
6720
6878
  const templates = yield liquid._parseLayoutFile(filepath, ctx.sync, this["currentFile"]);
6721
6879
  ctx.setRegister("blockMode", BlockMode.STORE);
6722
6880
  const html = yield renderer.renderTemplates(this.templates, ctx);
6723
- const blocks = ctx.getRegister("blocks");
6881
+ const blocks = ctx.getRegister("blocks", {});
6724
6882
  if (blocks[""] === void 0)
6725
6883
  blocks[""] = (parent, emitter2) => emitter2.write(html);
6726
6884
  ctx.setRegister("blockMode", BlockMode.OUTPUT);
6727
- ctx.push(yield args.render(ctx));
6885
+ ctx.push(createScope(yield args.render(ctx)));
6728
6886
  yield renderer.renderTemplates(templates, ctx, emitter);
6729
6887
  ctx.pop();
6730
6888
  }
@@ -6772,18 +6930,24 @@ var BlockTag = class extends Tag {
6772
6930
  *render(ctx, emitter) {
6773
6931
  const blockRender = this.getBlockRender(ctx);
6774
6932
  if (ctx.getRegister("blockMode") === BlockMode.STORE) {
6775
- ctx.getRegister("blocks")[this.block] = blockRender;
6933
+ ctx.getRegister("blocks", {})[this.block] = blockRender;
6776
6934
  } else {
6777
6935
  yield blockRender(new BlockDrop(), emitter);
6778
6936
  }
6779
6937
  }
6780
6938
  getBlockRender(ctx) {
6939
+ const self = this;
6781
6940
  const { liquid, templates } = this;
6782
- const renderChild = ctx.getRegister("blocks")[this.block];
6941
+ const renderChild = ctx.getRegister("blocks", {})[this.block];
6783
6942
  const renderCurrent = /* @__PURE__ */ __name(function* (superBlock, emitter) {
6784
- ctx.push({ block: superBlock });
6943
+ const stack = ctx.getRegister("blockStack", []);
6944
+ if (stack.includes(self))
6945
+ throw new Error("block tag cannot be nested");
6946
+ stack.push(self);
6947
+ ctx.push(createScope({ block: superBlock }));
6785
6948
  yield liquid.renderer.renderTemplates(templates, ctx, emitter);
6786
6949
  ctx.pop();
6950
+ stack.pop();
6787
6951
  }, "renderCurrent");
6788
6952
  return renderChild ? (superBlock, emitter) => renderChild(new BlockDrop((emitter2) => renderCurrent(superBlock, emitter2)), emitter) : renderCurrent;
6789
6953
  }
@@ -6870,7 +7034,7 @@ var TablerowTag = class extends Tag {
6870
7034
  const cols = args.cols || collection.length;
6871
7035
  const r = this.liquid.renderer;
6872
7036
  const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable);
6873
- const scope = { tablerowloop };
7037
+ const scope = createScope({ tablerowloop });
6874
7038
  ctx.push(scope);
6875
7039
  for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) {
6876
7040
  scope[this.variable] = collection[idx];
@@ -7058,8 +7222,8 @@ var Liquid = class _Liquid {
7058
7222
  }
7059
7223
  constructor(opts = {}) {
7060
7224
  this.renderer = new Render();
7061
- this.filters = {};
7062
- this.tags = {};
7225
+ this.filters = /* @__PURE__ */ Object.create(null);
7226
+ this.tags = /* @__PURE__ */ Object.create(null);
7063
7227
  this.options = normalize(opts);
7064
7228
  this.parser = new Parser(this);
7065
7229
  forOwn(tags, (conf, name) => this.registerTag(name, conf));
@@ -7261,21 +7425,289 @@ var Liquid = class _Liquid {
7261
7425
  // ../../src/Engines/Liquid.js
7262
7426
  var import_eleventy_utils = __toESM(require_eleventy_utils(), 1);
7263
7427
 
7264
- // ../../node_modules/@11ty/package-bundler/shims/debug.js
7265
- function debug_default() {
7266
- return function() {
7428
+ // ../../node_modules/obug/dist/core.js
7429
+ function coerce(value) {
7430
+ if (value instanceof Error) return value.stack || value.message;
7431
+ return value;
7432
+ }
7433
+ __name(coerce, "coerce");
7434
+ function selectColor(colors2, namespace) {
7435
+ let hash = 0;
7436
+ for (let i = 0; i < namespace.length; i++) {
7437
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
7438
+ hash |= 0;
7439
+ }
7440
+ return colors2[Math.abs(hash) % colors2.length];
7441
+ }
7442
+ __name(selectColor, "selectColor");
7443
+ function matchesTemplate(search2, template) {
7444
+ let searchIndex = 0;
7445
+ let templateIndex = 0;
7446
+ let starIndex = -1;
7447
+ let matchIndex = 0;
7448
+ while (searchIndex < search2.length) if (templateIndex < template.length && (template[templateIndex] === search2[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
7449
+ starIndex = templateIndex;
7450
+ matchIndex = searchIndex;
7451
+ templateIndex++;
7452
+ } else {
7453
+ searchIndex++;
7454
+ templateIndex++;
7455
+ }
7456
+ else if (starIndex !== -1) {
7457
+ templateIndex = starIndex + 1;
7458
+ matchIndex++;
7459
+ searchIndex = matchIndex;
7460
+ } else return false;
7461
+ while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
7462
+ return templateIndex === template.length;
7463
+ }
7464
+ __name(matchesTemplate, "matchesTemplate");
7465
+ function humanize(value) {
7466
+ if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`;
7467
+ return `${value}ms`;
7468
+ }
7469
+ __name(humanize, "humanize");
7470
+ var globalNamespaces = "";
7471
+ function createDebug(namespace, options) {
7472
+ let prevTime;
7473
+ let enableOverride;
7474
+ let namespacesCache;
7475
+ let enabledCache;
7476
+ const debug2 = /* @__PURE__ */ __name((...args) => {
7477
+ if (!debug2.enabled) return;
7478
+ const curr = Date.now();
7479
+ const diff = curr - (prevTime || curr);
7480
+ prevTime = curr;
7481
+ args[0] = coerce(args[0]);
7482
+ if (typeof args[0] !== "string") args.unshift("%O");
7483
+ let index = 0;
7484
+ args[0] = args[0].replace(/%([a-z%])/gi, (match, format2) => {
7485
+ if (match === "%%") return "%";
7486
+ index++;
7487
+ const formatter = options.formatters[format2];
7488
+ if (typeof formatter === "function") {
7489
+ const value = args[index];
7490
+ match = formatter.call(debug2, value);
7491
+ args.splice(index, 1);
7492
+ index--;
7493
+ }
7494
+ return match;
7495
+ });
7496
+ options.formatArgs.call(debug2, diff, args);
7497
+ debug2.log(...args);
7498
+ }, "debug");
7499
+ debug2.extend = function(namespace2, delimiter = ":") {
7500
+ return createDebug(this.namespace + delimiter + namespace2, {
7501
+ useColors: this.useColors,
7502
+ color: this.color,
7503
+ formatArgs: this.formatArgs,
7504
+ formatters: this.formatters,
7505
+ inspectOpts: this.inspectOpts,
7506
+ log: this.log,
7507
+ humanize: this.humanize
7508
+ });
7267
7509
  };
7510
+ Object.assign(debug2, options);
7511
+ debug2.namespace = namespace;
7512
+ Object.defineProperty(debug2, "enabled", {
7513
+ enumerable: true,
7514
+ configurable: false,
7515
+ get: /* @__PURE__ */ __name(() => {
7516
+ if (enableOverride != null) return enableOverride;
7517
+ if (namespacesCache !== globalNamespaces) {
7518
+ namespacesCache = globalNamespaces;
7519
+ enabledCache = enabled(namespace);
7520
+ }
7521
+ return enabledCache;
7522
+ }, "get"),
7523
+ set: /* @__PURE__ */ __name((v) => {
7524
+ enableOverride = v;
7525
+ }, "set")
7526
+ });
7527
+ return debug2;
7528
+ }
7529
+ __name(createDebug, "createDebug");
7530
+ var names = [];
7531
+ var skips = [];
7532
+ function enable(namespaces2) {
7533
+ globalNamespaces = namespaces2;
7534
+ names = [];
7535
+ skips = [];
7536
+ const split2 = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
7537
+ for (const ns of split2) if (ns[0] === "-") skips.push(ns.slice(1));
7538
+ else names.push(ns);
7539
+ }
7540
+ __name(enable, "enable");
7541
+ function enabled(name) {
7542
+ for (const skip of skips) if (matchesTemplate(name, skip)) return false;
7543
+ for (const ns of names) if (matchesTemplate(name, ns)) return true;
7544
+ return false;
7545
+ }
7546
+ __name(enabled, "enabled");
7547
+
7548
+ // ../../node_modules/obug/dist/browser.js
7549
+ var colors = [
7550
+ "#0000CC",
7551
+ "#0000FF",
7552
+ "#0033CC",
7553
+ "#0033FF",
7554
+ "#0066CC",
7555
+ "#0066FF",
7556
+ "#0099CC",
7557
+ "#0099FF",
7558
+ "#00CC00",
7559
+ "#00CC33",
7560
+ "#00CC66",
7561
+ "#00CC99",
7562
+ "#00CCCC",
7563
+ "#00CCFF",
7564
+ "#3300CC",
7565
+ "#3300FF",
7566
+ "#3333CC",
7567
+ "#3333FF",
7568
+ "#3366CC",
7569
+ "#3366FF",
7570
+ "#3399CC",
7571
+ "#3399FF",
7572
+ "#33CC00",
7573
+ "#33CC33",
7574
+ "#33CC66",
7575
+ "#33CC99",
7576
+ "#33CCCC",
7577
+ "#33CCFF",
7578
+ "#6600CC",
7579
+ "#6600FF",
7580
+ "#6633CC",
7581
+ "#6633FF",
7582
+ "#66CC00",
7583
+ "#66CC33",
7584
+ "#9900CC",
7585
+ "#9900FF",
7586
+ "#9933CC",
7587
+ "#9933FF",
7588
+ "#99CC00",
7589
+ "#99CC33",
7590
+ "#CC0000",
7591
+ "#CC0033",
7592
+ "#CC0066",
7593
+ "#CC0099",
7594
+ "#CC00CC",
7595
+ "#CC00FF",
7596
+ "#CC3300",
7597
+ "#CC3333",
7598
+ "#CC3366",
7599
+ "#CC3399",
7600
+ "#CC33CC",
7601
+ "#CC33FF",
7602
+ "#CC6600",
7603
+ "#CC6633",
7604
+ "#CC9900",
7605
+ "#CC9933",
7606
+ "#CCCC00",
7607
+ "#CCCC33",
7608
+ "#FF0000",
7609
+ "#FF0033",
7610
+ "#FF0066",
7611
+ "#FF0099",
7612
+ "#FF00CC",
7613
+ "#FF00FF",
7614
+ "#FF3300",
7615
+ "#FF3333",
7616
+ "#FF3366",
7617
+ "#FF3399",
7618
+ "#FF33CC",
7619
+ "#FF33FF",
7620
+ "#FF6600",
7621
+ "#FF6633",
7622
+ "#FF9900",
7623
+ "#FF9933",
7624
+ "#FFCC00",
7625
+ "#FFCC33"
7626
+ ];
7627
+ function formatArgs(diff, args) {
7628
+ const { useColors } = this;
7629
+ args[0] = `${(useColors ? "%c" : "") + this.namespace + (useColors ? " %c" : " ") + args[0] + (useColors ? "%c " : " ")}+${this.humanize(diff)}`;
7630
+ if (!useColors) return;
7631
+ const c = `color: ${this.color}`;
7632
+ args.splice(1, 0, c, "color: inherit");
7633
+ let index = 0;
7634
+ let lastC = 0;
7635
+ args[0].replace(/%[a-z%]/gi, (match) => {
7636
+ if (match === "%%") return;
7637
+ index++;
7638
+ if (match === "%c") lastC = index;
7639
+ });
7640
+ args.splice(lastC, 0, c);
7641
+ }
7642
+ __name(formatArgs, "formatArgs");
7643
+ var log = console.debug || console.log || (() => {
7644
+ });
7645
+ var storage = localstorage();
7646
+ var defaultOptions2 = {
7647
+ useColors: true,
7648
+ formatArgs,
7649
+ formatters: {
7650
+ /**
7651
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
7652
+ */
7653
+ j(v) {
7654
+ try {
7655
+ return JSON.stringify(v);
7656
+ } catch (error) {
7657
+ return `[UnexpectedJSONParseError]: ${error.message}`;
7658
+ }
7659
+ }
7660
+ },
7661
+ inspectOpts: {},
7662
+ humanize,
7663
+ log
7664
+ };
7665
+ function createDebug2(namespace, options) {
7666
+ var _ref;
7667
+ const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace);
7668
+ return createDebug(namespace, Object.assign(defaultOptions2, { color }, options));
7669
+ }
7670
+ __name(createDebug2, "createDebug");
7671
+ function localstorage() {
7672
+ try {
7673
+ return localStorage;
7674
+ } catch (_unused) {
7675
+ }
7676
+ }
7677
+ __name(localstorage, "localstorage");
7678
+ function load() {
7679
+ let r;
7680
+ try {
7681
+ r = storage.getItem("debug") || storage.getItem("DEBUG");
7682
+ } catch (_unused2) {
7683
+ }
7684
+ if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
7685
+ return r || "";
7686
+ }
7687
+ __name(load, "load");
7688
+ enable(load());
7689
+
7690
+ // ../../src/Util/IsBuildAwesome.js
7691
+ function isUsingBuildAwesome() {
7692
+ return process?.env?.BUILDAWESOME_PACKAGE === "@awesome.me/buildawesome";
7693
+ }
7694
+ __name(isUsingBuildAwesome, "isUsingBuildAwesome");
7695
+
7696
+ // ../../src/Util/DebugLogUtil.js
7697
+ var PREFIX = isUsingBuildAwesome() ? "BuildAwesome:" : "Eleventy:";
7698
+ function createDebug3(name) {
7699
+ return createDebug2(`${PREFIX}:${name}`);
7268
7700
  }
7269
- __name(debug_default, "default");
7701
+ __name(createDebug3, "createDebug");
7270
7702
 
7271
- // ../../src/Errors/EleventyBaseError.js
7272
- var EleventyBaseError = class extends Error {
7703
+ // ../../src/Errors/BaseError.js
7704
+ var BaseError = class extends Error {
7273
7705
  static {
7274
- __name(this, "EleventyBaseError");
7706
+ __name(this, "BaseError");
7275
7707
  }
7276
7708
  /**
7277
7709
  * @param {string} message - The error message to display.
7278
- * @param {unknown} [originalError] - The original error caught.
7710
+ * @param {Error} [originalError] - The original error caught.
7279
7711
  */
7280
7712
  constructor(message, originalError) {
7281
7713
  if (originalError) {
@@ -7292,15 +7724,14 @@ var EleventyBaseError = class extends Error {
7292
7724
  }
7293
7725
  }
7294
7726
  };
7295
- var EleventyBaseError_default = EleventyBaseError;
7296
7727
 
7297
7728
  // ../../src/Engines/TemplateEngine.js
7298
- var TemplateEngineConfigError = class extends EleventyBaseError_default {
7729
+ var TemplateEngineConfigError = class extends BaseError {
7299
7730
  static {
7300
7731
  __name(this, "TemplateEngineConfigError");
7301
7732
  }
7302
7733
  };
7303
- var debug = debug_default("Eleventy:TemplateEngine");
7734
+ var debug = createDebug3("TemplateEngine");
7304
7735
  var AMENDED_INSTANCES = /* @__PURE__ */ new Set();
7305
7736
  var TemplateEngine = class {
7306
7737
  static {
@@ -7746,6 +8177,7 @@ var Liquid2 = class _Liquid extends TemplateEngine {
7746
8177
  {
7747
8178
  page: data?.page,
7748
8179
  eleventy: data?.eleventy,
8180
+ buildawesome: data?.buildawesome,
7749
8181
  collections: data?.collections
7750
8182
  },
7751
8183
  liquidOptions?.globals