@11ty/client 4.0.0-alpha.11 → 4.0.0-alpha.12

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 (Build Awesome) v4.0.0-alpha.11 (@11ty/client Bundle) */
1
+ /*! Eleventy (Build Awesome) v4.0.0-alpha.12 (@11ty/client Bundle) */
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1337,7 +1337,7 @@ var require_IsPlainObject = __commonJS({
1337
1337
  var require_Merge = __commonJS({
1338
1338
  "../../node_modules/@11ty/eleventy-utils/src/Merge.js"(exports, module) {
1339
1339
  "use strict";
1340
- var isPlainObject16 = require_IsPlainObject();
1340
+ var isPlainObject17 = require_IsPlainObject();
1341
1341
  var OVERRIDE_PREFIX = "override:";
1342
1342
  var UNSAFE_KEY = "__proto__";
1343
1343
  function cleanKey(key, prefix) {
@@ -1348,7 +1348,7 @@ var require_Merge = __commonJS({
1348
1348
  }
1349
1349
  function getMergedItem(target, source, prefixes = {}) {
1350
1350
  let { override } = prefixes;
1351
- let sourcePlainObjectShortcut = isPlainObject16(source);
1351
+ let sourcePlainObjectShortcut = isPlainObject17(source);
1352
1352
  let targetPlainObjectShortcut = false;
1353
1353
  if (!target) {
1354
1354
  if (Object.isFrozen(source)) {
@@ -1359,10 +1359,13 @@ var require_Merge = __commonJS({
1359
1359
  target = {};
1360
1360
  }
1361
1361
  }
1362
+ if (sourcePlainObjectShortcut && Object.isFrozen(target) && isPlainObject17(target)) {
1363
+ target = Object.assign({}, target);
1364
+ }
1362
1365
  if (Array.isArray(target) && Array.isArray(source)) {
1363
1366
  return target.concat(source);
1364
1367
  }
1365
- if (targetPlainObjectShortcut || isPlainObject16(target)) {
1368
+ if (targetPlainObjectShortcut || isPlainObject17(target)) {
1366
1369
  if (sourcePlainObjectShortcut) {
1367
1370
  for (let key in source) {
1368
1371
  let overrideKey = cleanKey(key, override);
@@ -1377,7 +1380,7 @@ var require_Merge = __commonJS({
1377
1380
  }
1378
1381
  return source;
1379
1382
  }
1380
- function DeepCopy5(targetObject, ...sources) {
1383
+ function DeepCopy6(targetObject, ...sources) {
1381
1384
  for (let source of sources) {
1382
1385
  if (!source) {
1383
1386
  continue;
@@ -1387,9 +1390,12 @@ var require_Merge = __commonJS({
1387
1390
  return targetObject;
1388
1391
  }
1389
1392
  function Merge5(target, ...sources) {
1390
- if (isPlainObject16(target)) {
1393
+ if (isPlainObject17(target)) {
1391
1394
  for (let key in target) {
1392
1395
  if (key.indexOf(OVERRIDE_PREFIX) === 0) {
1396
+ if (Object.isFrozen(target)) {
1397
+ target = Object.assign({}, target);
1398
+ }
1393
1399
  let cleanedKey = key.slice(OVERRIDE_PREFIX.length);
1394
1400
  if (cleanedKey !== UNSAFE_KEY) {
1395
1401
  target[cleanedKey] = target[key];
@@ -1408,8 +1414,8 @@ var require_Merge = __commonJS({
1408
1414
  }
1409
1415
  return target;
1410
1416
  }
1417
+ Merge5.DeepCopy = DeepCopy6;
1411
1418
  module.exports = Merge5;
1412
- module.exports.DeepCopy = DeepCopy5;
1413
1419
  }
1414
1420
  });
1415
1421
 
@@ -1594,7 +1600,10 @@ var require_lib_sha256 = __commonJS({
1594
1600
  buf[bp++] = L >>> 8 & 255;
1595
1601
  buf[bp++] = L & 255;
1596
1602
  process3();
1597
- let reply = new Uint8Array(32);
1603
+ let reply = (
1604
+ /** @type {Uint8Array & { hex?: () => string }} */
1605
+ new Uint8Array(32)
1606
+ );
1598
1607
  reply[0] = h0 >>> 24;
1599
1608
  reply[1] = h0 >>> 16 & 255;
1600
1609
  reply[2] = h0 >>> 8 & 255;
@@ -1747,7 +1756,10 @@ var require_HashTypes = __commonJS({
1747
1756
  };
1748
1757
  var ScriptHash = class extends Hash {
1749
1758
  static toHash(...content) {
1750
- let hash = sha256();
1759
+ let hash = (
1760
+ /** @type {{ add: (data: any) => void, digest: () => Uint8Array }} */
1761
+ sha256()
1762
+ );
1751
1763
  for (let c of content) {
1752
1764
  hash.add(c);
1753
1765
  }
@@ -1813,17 +1825,17 @@ var require_Buffer = __commonJS({
1813
1825
  var require_eleventy_utils = __commonJS({
1814
1826
  "../../node_modules/@11ty/eleventy-utils/index.js"(exports, module) {
1815
1827
  var TemplatePath25 = require_TemplatePath();
1816
- var isPlainObject16 = require_IsPlainObject();
1828
+ var isPlainObject17 = require_IsPlainObject();
1817
1829
  var Merge5 = require_Merge();
1818
1830
  var DateCompare = require_DateCompare();
1819
- var { DeepCopy: DeepCopy5 } = Merge5;
1831
+ var { DeepCopy: DeepCopy6 } = Merge5;
1820
1832
  var { createHash, createHashHex, createHashSync, createHashHexSync } = require_CreateHash();
1821
1833
  var Buffer3 = require_Buffer();
1822
1834
  module.exports = {
1823
1835
  TemplatePath: TemplatePath25,
1824
- isPlainObject: isPlainObject16,
1836
+ isPlainObject: isPlainObject17,
1825
1837
  Merge: Merge5,
1826
- DeepCopy: DeepCopy5,
1838
+ DeepCopy: DeepCopy6,
1827
1839
  DateCompare,
1828
1840
  createHash,
1829
1841
  createHashHex,
@@ -2422,21 +2434,21 @@ async function dynamicImportAbsolutePath(absolutePath, options = {}) {
2422
2434
  );
2423
2435
  }
2424
2436
  async function dynamicImport(localPath, type, options = {}) {
2425
- let absolutePath = import_eleventy_utils2.TemplatePath.absolutePath(localPath);
2437
+ let absolutePath = import_eleventy_utils3.TemplatePath.absolutePath(localPath);
2426
2438
  options.type = type;
2427
2439
  return dynamicImportAbsolutePath(absolutePath, options);
2428
2440
  }
2429
2441
  async function dynamicImportRaw(localPath, type) {
2430
- let absolutePath = import_eleventy_utils2.TemplatePath.absolutePath(localPath);
2442
+ let absolutePath = import_eleventy_utils3.TemplatePath.absolutePath(localPath);
2431
2443
  return dynamicImportAbsolutePath(absolutePath, { type, returnRaw: true });
2432
2444
  }
2433
- var import_node_path, import_eleventy_utils2, ImportError, requestPromiseCache, lastModifiedPaths;
2445
+ var import_node_path, import_eleventy_utils3, ImportError, requestPromiseCache, lastModifiedPaths;
2434
2446
  var init_Require = __esm({
2435
2447
  "../../src/Util/Require.js"() {
2436
2448
  "use strict";
2437
2449
  init_shim_consume_fs();
2438
2450
  import_node_path = __toESM(require_path(), 1);
2439
- import_eleventy_utils2 = __toESM(require_eleventy_utils(), 1);
2451
+ import_eleventy_utils3 = __toESM(require_eleventy_utils(), 1);
2440
2452
  init_importer_client();
2441
2453
  init_RequireUtils_core();
2442
2454
  init_EsmResolverPortAdapter_core();
@@ -2454,7 +2466,7 @@ var init_package = __esm({
2454
2466
  "../../package.json"() {
2455
2467
  package_default = {
2456
2468
  name: "@11ty/eleventy",
2457
- version: "4.0.0-alpha.11",
2469
+ version: "4.0.0-alpha.12",
2458
2470
  description: "A simpler way to build awesome web sites.",
2459
2471
  publishConfig: {
2460
2472
  access: "public",
@@ -2587,12 +2599,13 @@ var init_package = __esm({
2587
2599
  "@11ty/dependency-tree": "^5.0.0-alpha.3",
2588
2600
  "@11ty/eleventy-dev-server": "^3.0.0-alpha.17",
2589
2601
  "@11ty/eleventy-plugin-bundle": "^4.1.0",
2590
- "@11ty/eleventy-utils": "^3.0.1",
2602
+ "@11ty/eleventy-utils": "^3.1.0",
2591
2603
  "@11ty/gray-matter": "^3.0.0",
2592
2604
  "@11ty/lodash-custom": "^5.0.0",
2593
2605
  "@11ty/node-version-check": "^1.0.1",
2594
2606
  "@11ty/nunjucks": "^4.0.0-alpha.4",
2595
2607
  "@11ty/parse-date-strings": "^2.0.6",
2608
+ "@11ty/posthtml": "^1.0.0",
2596
2609
  "@11ty/posthtml-match-selector": "^1.1.0",
2597
2610
  "@11ty/posthtml-urls": "^2.0.0",
2598
2611
  "@11ty/recursive-copy": "^5.2.0",
@@ -2606,7 +2619,6 @@ var init_package = __esm({
2606
2619
  minimist: "^1.2.8",
2607
2620
  obug: "^3.0.0",
2608
2621
  picomatch: "^4.0.7",
2609
- posthtml: "^0.16.7",
2610
2622
  semver: "^7.8.6",
2611
2623
  tinyglobby: "^0.2.17"
2612
2624
  },
@@ -3393,7 +3405,7 @@ var require_js_yaml_cjs = __commonJS({
3393
3405
  },
3394
3406
  identify: Array.isArray
3395
3407
  });
3396
- function isPlainObject16(data) {
3408
+ function isPlainObject17(data) {
3397
3409
  if (data === null || typeof data !== "object" || Array.isArray(data)) return false;
3398
3410
  const prototype = Object.getPrototypeOf(data);
3399
3411
  return prototype === null || prototype === Object.prototype;
@@ -3413,7 +3425,7 @@ var require_js_yaml_cjs = __commonJS({
3413
3425
  if (item instanceof Map) {
3414
3426
  if (item.size !== 1) return "cannot resolve an ordered map item";
3415
3427
  key = item.keys().next().value;
3416
- } else if (isPlainObject16(item)) {
3428
+ } else if (isPlainObject17(item)) {
3417
3429
  const itemKeys = Object.keys(item);
3418
3430
  if (itemKeys.length !== 1) return "cannot resolve an ordered map item";
3419
3431
  key = itemKeys[0];
@@ -3445,7 +3457,7 @@ var require_js_yaml_cjs = __commonJS({
3445
3457
  });
3446
3458
  var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
3447
3459
  create: () => ({}),
3448
- identify: isPlainObject16,
3460
+ identify: isPlainObject17,
3449
3461
  represent: (o) => {
3450
3462
  const map = /* @__PURE__ */ new Map();
3451
3463
  for (const key of Object.keys(o)) map.set(key, o[key]);
@@ -3768,7 +3780,7 @@ var require_js_yaml_cjs = __commonJS({
3768
3780
  has: (container, key) => container.has(key),
3769
3781
  keys: (container) => container.keys(),
3770
3782
  get: (container, key) => container.get(key),
3771
- identify: (data) => data instanceof Map || isPlainObject16(data),
3783
+ identify: (data) => data instanceof Map || isPlainObject17(data),
3772
3784
  represent: (data) => {
3773
3785
  if (data instanceof Map) return data;
3774
3786
  const map = /* @__PURE__ */ new Map();
@@ -3791,7 +3803,7 @@ var require_js_yaml_cjs = __commonJS({
3791
3803
  }
3792
3804
  var legacyMapTag = defineMappingTag("tag:yaml.org,2002:map", {
3793
3805
  create: () => ({}),
3794
- identify: isPlainObject16,
3806
+ identify: isPlainObject17,
3795
3807
  represent: (o) => {
3796
3808
  const map = /* @__PURE__ */ new Map();
3797
3809
  for (const key of Object.keys(o)) map.set(key, o[key]);
@@ -6957,11 +6969,15 @@ function augmentObject(targetObject, options = {}) {
6957
6969
  lazy: false
6958
6970
  // lazily fetch the property
6959
6971
  // getter: function() {},
6972
+ // dataGetter: function(source) {}, // defaults to `source`
6960
6973
  },
6961
6974
  options
6962
6975
  );
6976
+ if (targetObject === options.source) {
6977
+ return targetObject;
6978
+ }
6963
6979
  for (let key of DATA_KEYS) {
6964
- if (!options.overwrite && targetObject[key]) {
6980
+ if (!options.overwrite && isUserDefined(targetObject, key)) {
6965
6981
  continue;
6966
6982
  }
6967
6983
  if (options.lazy) {
@@ -6971,12 +6987,7 @@ function augmentObject(targetObject, options = {}) {
6971
6987
  } else {
6972
6988
  value = () => options.source?.[key];
6973
6989
  }
6974
- Object.defineProperty(targetObject, key, {
6975
- writable: true,
6976
- configurable: true,
6977
- enumerable: true,
6978
- value
6979
- });
6990
+ defineGetter(targetObject, key, value);
6980
6991
  } else {
6981
6992
  let value;
6982
6993
  if (typeof options.getter == "function") {
@@ -6986,16 +6997,49 @@ function augmentObject(targetObject, options = {}) {
6986
6997
  }
6987
6998
  if (value) {
6988
6999
  targetObject[key] = value;
7000
+ markAugmented(targetObject, key);
6989
7001
  }
6990
7002
  }
6991
7003
  }
7004
+ if (options.overwrite || !isUserDefined(targetObject, DATA_METHOD)) {
7005
+ let dataGetter = options.dataGetter ?? ((source) => source);
7006
+ targetObject[DATA_METHOD] = () => dataGetter(options.source);
7007
+ markAugmented(targetObject, DATA_METHOD);
7008
+ }
6992
7009
  return targetObject;
6993
7010
  }
6994
- var DATA_KEYS;
7011
+ function isUserDefined(targetObject, key) {
7012
+ return Boolean(targetObject[key]) && !augmented.get(targetObject)?.has(key);
7013
+ }
7014
+ function markAugmented(targetObject, key) {
7015
+ if (!augmented.has(targetObject)) {
7016
+ augmented.set(targetObject, /* @__PURE__ */ new Set());
7017
+ }
7018
+ augmented.get(targetObject).add(key);
7019
+ }
7020
+ function defineGetter(targetObject, key, get) {
7021
+ markAugmented(targetObject, key);
7022
+ Object.defineProperty(targetObject, key, {
7023
+ configurable: true,
7024
+ enumerable: true,
7025
+ get,
7026
+ set(value) {
7027
+ Object.defineProperty(this, key, {
7028
+ value,
7029
+ writable: true,
7030
+ configurable: true,
7031
+ enumerable: true
7032
+ });
7033
+ }
7034
+ });
7035
+ }
7036
+ var DATA_KEYS, DATA_METHOD, augmented;
6995
7037
  var init_ContextAugmenter = __esm({
6996
7038
  "../../src/Engines/Util/ContextAugmenter.js"() {
6997
7039
  "use strict";
6998
7040
  DATA_KEYS = ["page", "eleventy", "buildawesome", "collections"];
7041
+ DATA_METHOD = "getData";
7042
+ augmented = /* @__PURE__ */ new WeakMap();
6999
7043
  }
7000
7044
  });
7001
7045
 
@@ -7004,11 +7048,11 @@ var JavaScript_exports = {};
7004
7048
  __export(JavaScript_exports, {
7005
7049
  default: () => JavaScript
7006
7050
  });
7007
- var import_eleventy_utils7, JavaScriptTemplateNotDefined, JavaScript;
7051
+ var import_eleventy_utils8, JavaScriptTemplateNotDefined, JavaScript;
7008
7052
  var init_JavaScript = __esm({
7009
7053
  "../../src/Engines/JavaScript.js"() {
7010
7054
  "use strict";
7011
- import_eleventy_utils7 = __toESM(require_eleventy_utils(), 1);
7055
+ import_eleventy_utils8 = __toESM(require_eleventy_utils(), 1);
7012
7056
  init_TemplateEngine();
7013
7057
  init_BaseError();
7014
7058
  init_GetJavaScriptData();
@@ -7027,7 +7071,7 @@ var init_JavaScript = __esm({
7027
7071
  inputPath,
7028
7072
  ...usedByDependants || [],
7029
7073
  ...relevantLayouts || []
7030
- ].map((entry) => import_eleventy_utils7.TemplatePath.addLeadingDotSlash(entry));
7074
+ ].map((entry) => import_eleventy_utils8.TemplatePath.addLeadingDotSlash(entry));
7031
7075
  for (let inputPath2 of instancesToDelete) {
7032
7076
  if (inputPath2 in this.instances) {
7033
7077
  delete this.instances[inputPath2];
@@ -7158,6 +7202,7 @@ var init_JavaScript = __esm({
7158
7202
  }
7159
7203
  fns[key] = augmentFunction(configFns[key], {
7160
7204
  source: inst,
7205
+ dataGetter: (inst2) => inst2.getData(),
7161
7206
  overwrite: false
7162
7207
  });
7163
7208
  }
@@ -7166,7 +7211,8 @@ var init_JavaScript = __esm({
7166
7211
  // Backwards compat
7167
7212
  static wrapJavaScriptFunction(inst, fn) {
7168
7213
  return augmentFunction(fn, {
7169
- source: inst
7214
+ source: inst,
7215
+ dataGetter: (inst2) => inst2.getData()
7170
7216
  });
7171
7217
  }
7172
7218
  addExportsToBundles(inst, url) {
@@ -7183,10 +7229,10 @@ var init_JavaScript = __esm({
7183
7229
  }
7184
7230
  if (typeof inst[key] === "string") {
7185
7231
  mgr.addToPage(url, inst[key]);
7186
- } else if ((0, import_eleventy_utils7.isPlainObject)(inst[key])) {
7232
+ } else if ((0, import_eleventy_utils8.isPlainObject)(inst[key])) {
7187
7233
  if (typeof inst[key][name] === "string") {
7188
7234
  mgr.addToPage(url, inst[key][name]);
7189
- } else if ((0, import_eleventy_utils7.isPlainObject)(inst[key][name])) {
7235
+ } else if ((0, import_eleventy_utils8.isPlainObject)(inst[key][name])) {
7190
7236
  for (let bucketName in inst[key][name]) {
7191
7237
  mgr.addToPage(url, inst[key][name][bucketName], bucketName);
7192
7238
  }
@@ -8222,7 +8268,7 @@ var Buffer2 = class {
8222
8268
  window.Buffer = globalThis.Buffer = Buffer2;
8223
8269
 
8224
8270
  // ../../src/CoreMinimal.js
8225
- var import_eleventy_utils31 = __toESM(require_eleventy_utils(), 1);
8271
+ var import_eleventy_utils32 = __toESM(require_eleventy_utils(), 1);
8226
8272
 
8227
8273
  // ../../src/Adapters/Packages/chalk.client.js
8228
8274
  function noop(arg) {
@@ -8239,7 +8285,7 @@ var chalk_client_default = {
8239
8285
  // ../../src/Data/TemplateData.js
8240
8286
  var import_node_path2 = __toESM(require_path(), 1);
8241
8287
  var import_lodash_custom3 = __toESM(require_lodash_custom(), 1);
8242
- var import_eleventy_utils6 = __toESM(require_eleventy_utils(), 1);
8288
+ var import_eleventy_utils7 = __toESM(require_eleventy_utils(), 1);
8243
8289
 
8244
8290
  // ../../src/Adapters/Packages/inspect.core.js
8245
8291
  function inspect(target) {
@@ -8291,6 +8337,7 @@ init_BaseError();
8291
8337
  var import_lodash_custom = __toESM(require_lodash_custom(), 1);
8292
8338
 
8293
8339
  // ../../src/Util/ReservedData.js
8340
+ var import_eleventy_utils2 = __toESM(require_eleventy_utils(), 1);
8294
8341
  var CoreReservedDataError = class extends TypeError {
8295
8342
  };
8296
8343
  var ReservedData = class _ReservedData {
@@ -8360,6 +8407,15 @@ var ReservedData = class _ReservedData {
8360
8407
  static checkSubset(data, sourceLocation) {
8361
8408
  this.#check(data, sourceLocation, this.properties);
8362
8409
  }
8410
+ // Frozen global data is copied on write, so merging an object into a reserved global key no longer throws on its own
8411
+ static checkGlobalOverrides(data, globalKeys, sourceLocation) {
8412
+ let reservedNames = globalKeys.filter(
8413
+ (key) => (0, import_eleventy_utils2.isPlainObject)(data?.[key]) || (0, import_eleventy_utils2.isPlainObject)(data?.[`override:${key}`])
8414
+ );
8415
+ if (reservedNames.length > 0) {
8416
+ throw this.getError({ reservedNames, sourceLocation });
8417
+ }
8418
+ }
8363
8419
  static getError(options = {}) {
8364
8420
  let { reservedNames, cause, sourceLocation } = options || {};
8365
8421
  if (cause) {
@@ -8417,15 +8473,15 @@ var ConfigurationGlobalData = class {
8417
8473
 
8418
8474
  // ../../src/Util/ImportJsonSync.js
8419
8475
  init_shim_consume_fs();
8420
- var import_eleventy_utils3 = __toESM(require_eleventy_utils(), 1);
8476
+ var import_eleventy_utils4 = __toESM(require_eleventy_utils(), 1);
8421
8477
  init_DebugLogUtil();
8422
8478
  init_RequireUtils_core();
8423
8479
  var debug = createDebug4("ImportJsonSync");
8424
8480
  function findFilePathInParentDirs(dir, filename) {
8425
- let workingDir = import_eleventy_utils3.TemplatePath.getWorkingDir();
8426
- let allDirs = import_eleventy_utils3.TemplatePath.getAllDirs(dir).filter((entry) => entry.startsWith(workingDir));
8481
+ let workingDir = import_eleventy_utils4.TemplatePath.getWorkingDir();
8482
+ let allDirs = import_eleventy_utils4.TemplatePath.getAllDirs(dir).filter((entry) => entry.startsWith(workingDir));
8427
8483
  for (let dir2 of allDirs) {
8428
- let newPath = import_eleventy_utils3.TemplatePath.join(dir2, filename);
8484
+ let newPath = import_eleventy_utils4.TemplatePath.join(dir2, filename);
8429
8485
  if (existsSync(newPath)) {
8430
8486
  debug("Found %o searching parent directories at: %o", filename, dir2);
8431
8487
  return newPath;
@@ -8436,7 +8492,7 @@ function getCorePackageJson() {
8436
8492
  return package_default;
8437
8493
  }
8438
8494
  function getWorkingProjectPackageJsonPath() {
8439
- let dir = import_eleventy_utils3.TemplatePath.absolutePath(import_eleventy_utils3.TemplatePath.getWorkingDir());
8495
+ let dir = import_eleventy_utils4.TemplatePath.absolutePath(import_eleventy_utils4.TemplatePath.getWorkingDir());
8440
8496
  return findFilePathInParentDirs(dir, "package.json");
8441
8497
  }
8442
8498
  function getWorkingProjectPackageJson(filePath) {
@@ -8453,14 +8509,14 @@ function getWorkingProjectPackageJson(filePath) {
8453
8509
  init_Require();
8454
8510
 
8455
8511
  // ../../src/Util/Objects/DeepFreeze.js
8456
- var import_eleventy_utils4 = __toESM(require_eleventy_utils(), 1);
8512
+ var import_eleventy_utils5 = __toESM(require_eleventy_utils(), 1);
8457
8513
  function DeepFreeze(obj, topLevelExceptions) {
8458
8514
  for (let name of Reflect.ownKeys(obj)) {
8459
8515
  if ((topLevelExceptions || []).find((key) => key === name)) {
8460
8516
  continue;
8461
8517
  }
8462
8518
  const value = obj[name];
8463
- if ((0, import_eleventy_utils4.isPlainObject)(value)) {
8519
+ if ((0, import_eleventy_utils5.isPlainObject)(value)) {
8464
8520
  DeepFreeze(value);
8465
8521
  }
8466
8522
  }
@@ -8481,7 +8537,7 @@ var import_TypeScriptFeatureTest = __toESM(require_TypeScriptFeatureTest_core(),
8481
8537
 
8482
8538
  // ../../src/Data/ResolveConfigurationData.js
8483
8539
  var import_lodash_custom2 = __toESM(require_lodash_custom(), 1);
8484
- var import_eleventy_utils5 = __toESM(require_eleventy_utils(), 1);
8540
+ var import_eleventy_utils6 = __toESM(require_eleventy_utils(), 1);
8485
8541
  var { get: lodashGet } = import_lodash_custom2.default;
8486
8542
  var ResolveConfigurationData = class _ResolveConfigurationData {
8487
8543
  static EXCLUDE_FROM_COLLECTIONS_KEY = "buildawesomeExcludeFromCollections";
@@ -8512,7 +8568,7 @@ var ResolveConfigurationData = class _ResolveConfigurationData {
8512
8568
  }
8513
8569
  // Folds `eleventy*` aliases into `buildawesome*` per cascade layer so the cascade orders a single key, #4311
8514
8570
  static normalize(data) {
8515
- if (!(0, import_eleventy_utils5.isPlainObject)(data)) {
8571
+ if (!(0, import_eleventy_utils6.isPlainObject)(data)) {
8516
8572
  return data;
8517
8573
  }
8518
8574
  let normalized;
@@ -8540,10 +8596,10 @@ var ResolveConfigurationData = class _ResolveConfigurationData {
8540
8596
  }
8541
8597
  let merging;
8542
8598
  for (let val of values) {
8543
- if ((0, import_eleventy_utils5.isPlainObject)(val)) {
8544
- merging = (0, import_eleventy_utils5.DeepCopy)(merging || {}, val);
8599
+ if ((0, import_eleventy_utils6.isPlainObject)(val)) {
8600
+ merging = (0, import_eleventy_utils6.DeepCopy)(merging || {}, val);
8545
8601
  } else if (Array.isArray(val)) {
8546
- merging = (0, import_eleventy_utils5.DeepCopy)(merging || [], val);
8602
+ merging = (0, import_eleventy_utils6.DeepCopy)(merging || [], val);
8547
8603
  } else if (merging === void 0) {
8548
8604
  return val;
8549
8605
  }
@@ -8611,7 +8667,7 @@ var TemplateData = class _TemplateData {
8611
8667
  return this.dirs.data;
8612
8668
  }
8613
8669
  get absoluteDataDir() {
8614
- return import_eleventy_utils6.TemplatePath.absolutePath(this.dataDir);
8670
+ return import_eleventy_utils7.TemplatePath.absolutePath(this.dataDir);
8615
8671
  }
8616
8672
  // This was async in 2.0 and prior but doesn’t need to be any more.
8617
8673
  getInputDir() {
@@ -8802,14 +8858,14 @@ var TemplateData = class _TemplateData {
8802
8858
  if (suffixes.length === 0) {
8803
8859
  return [];
8804
8860
  }
8805
- return import_eleventy_utils6.TemplatePath.addLeadingDotSlashArray([`${this.inputDir}**/*.{${suffixes.join(",")}}`]);
8861
+ return import_eleventy_utils7.TemplatePath.addLeadingDotSlashArray([`${this.inputDir}**/*.{${suffixes.join(",")}}`]);
8806
8862
  }
8807
8863
  #getDataFileGlob(fileNames) {
8808
8864
  if (fileNames.length === 0) {
8809
8865
  return [];
8810
8866
  }
8811
8867
  let fileGlob = fileNames.length === 1 ? fileNames[0] : `{${fileNames.join(",")}}`;
8812
- return import_eleventy_utils6.TemplatePath.addLeadingDotSlashArray([`${this.inputDir}**/${fileGlob}`]);
8868
+ return import_eleventy_utils7.TemplatePath.addLeadingDotSlashArray([`${this.inputDir}**/${fileGlob}`]);
8813
8869
  }
8814
8870
  // This is used exclusively for --watch and --serve chokidar targets
8815
8871
  getTemplateDataFileGlob() {
@@ -8820,7 +8876,7 @@ var TemplateData = class _TemplateData {
8820
8876
  }
8821
8877
  // For spidering dependencies
8822
8878
  getTemplateJavaScriptDataFileGlob() {
8823
- let isJavaScript = (fileName) => this.#eligibleJavaScriptExtensions.includes(import_eleventy_utils6.TemplatePath.getExtension(fileName));
8879
+ let isJavaScript = (fileName) => this.#eligibleJavaScriptExtensions.includes(import_eleventy_utils7.TemplatePath.getExtension(fileName));
8824
8880
  if (!this.config.dataFileNames) {
8825
8881
  return this.#getLegacyDataFileGlob(isJavaScript);
8826
8882
  }
@@ -8871,8 +8927,8 @@ var TemplateData = class _TemplateData {
8871
8927
  return paths;
8872
8928
  }
8873
8929
  getObjectPathForDataFile(dataFilePath) {
8874
- let absoluteDataFilePath = import_eleventy_utils6.TemplatePath.absolutePath(dataFilePath);
8875
- let reducedPath = import_eleventy_utils6.TemplatePath.stripLeadingSubPath(absoluteDataFilePath, this.absoluteDataDir);
8930
+ let absoluteDataFilePath = import_eleventy_utils7.TemplatePath.absolutePath(dataFilePath);
8931
+ let reducedPath = import_eleventy_utils7.TemplatePath.stripLeadingSubPath(absoluteDataFilePath, this.absoluteDataDir);
8876
8932
  let parsed = import_node_path2.default.parse(reducedPath);
8877
8933
  let folders = parsed.dir ? parsed.dir.split("/") : [];
8878
8934
  folders.push(parsed.name);
@@ -8880,7 +8936,7 @@ var TemplateData = class _TemplateData {
8880
8936
  }
8881
8937
  async getAllGlobalData() {
8882
8938
  let globalData = {};
8883
- let files = import_eleventy_utils6.TemplatePath.addLeadingDotSlashArray(await this.getGlobalDataFiles());
8939
+ let files = import_eleventy_utils7.TemplatePath.addLeadingDotSlashArray(await this.getGlobalDataFiles());
8884
8940
  this.config.events.emit("buildawesome.globaldatafiles", files);
8885
8941
  let dataFileConflicts = {};
8886
8942
  for (let file of Object.values(files)) {
@@ -8892,7 +8948,7 @@ var TemplateData = class _TemplateData {
8892
8948
  `merging global data from ${file} with an already existing global data file (${dataFileConflicts[objectPathTargetString]}). Overriding existing keys.`
8893
8949
  );
8894
8950
  let oldData = lodashGet2(globalData, objectPathTarget);
8895
- data = (0, import_eleventy_utils6.Merge)(oldData, data);
8951
+ data = (0, import_eleventy_utils7.Merge)(oldData, data);
8896
8952
  }
8897
8953
  dataFileConflicts[objectPathTargetString] = file;
8898
8954
  debug2(`Found global data file ${file} and adding as: ${objectPathTarget}`);
@@ -8943,11 +8999,19 @@ var TemplateData = class _TemplateData {
8943
8999
  let rawImports = this.getRawImports();
8944
9000
  let configApiGlobalData = await this.getInitialGlobalData();
8945
9001
  let globalJson = await this.getAllGlobalData();
8946
- let mergedGlobalData = (0, import_eleventy_utils6.Merge)(
9002
+ let mergedGlobalData = (0, import_eleventy_utils7.Merge)(
8947
9003
  ResolveConfigurationData.normalize(globalJson),
8948
9004
  ResolveConfigurationData.normalize(configApiGlobalData)
8949
9005
  );
8950
- return Object.assign({}, mergedGlobalData, rawImports);
9006
+ let globalData = Object.assign({}, mergedGlobalData, rawImports);
9007
+ if (this.config.freezeGlobalData) {
9008
+ for (let [key, value] of Object.entries(globalData)) {
9009
+ if ((0, import_eleventy_utils7.isPlainObject)(value)) {
9010
+ globalData[key] = DeepFreeze((0, import_eleventy_utils7.DeepCopy)({}, value));
9011
+ }
9012
+ }
9013
+ }
9014
+ return globalData;
8951
9015
  }
8952
9016
  // Available after `getGlobalData()`
8953
9017
  getGlobalDataFilesByKey() {
@@ -8961,7 +9025,11 @@ var TemplateData = class _TemplateData {
8961
9025
  }
8962
9026
  /* Template and Directory data files */
8963
9027
  async combineLocalData(localDataPaths) {
8964
- let localData = {};
9028
+ return (0, import_eleventy_utils7.Merge)({}, ...await this.getLocalDataSources(localDataPaths));
9029
+ }
9030
+ // One entry per data file (least to most specific), unmerged so `override:` keys reach the data cascade
9031
+ async getLocalDataSources(localDataPaths) {
9032
+ let sources = [];
8965
9033
  if (!Array.isArray(localDataPaths)) {
8966
9034
  localDataPaths = [localDataPaths];
8967
9035
  }
@@ -8970,12 +9038,12 @@ var TemplateData = class _TemplateData {
8970
9038
  });
8971
9039
  this.config.events.emit("buildawesome.datafiles", localDataPaths);
8972
9040
  if (!localDataPaths.length) {
8973
- return localData;
9041
+ return sources;
8974
9042
  }
8975
9043
  let dataSource = {};
8976
9044
  for (let path11 of localDataPaths) {
8977
9045
  let dataForPath = await this.getDataValue(path11);
8978
- if (!(0, import_eleventy_utils6.isPlainObject)(dataForPath)) {
9046
+ if (!(0, import_eleventy_utils7.isPlainObject)(dataForPath)) {
8979
9047
  debug2(
8980
9048
  "Warning: Template and Directory data files expect an object to be returned, instead `%o` returned `%o`",
8981
9049
  path11,
@@ -8996,21 +9064,30 @@ var TemplateData = class _TemplateData {
8996
9064
  }
8997
9065
  dataSource[key] = path11;
8998
9066
  }
8999
- (0, import_eleventy_utils6.Merge)(localData, ResolveConfigurationData.normalize(cleanedDataForPath));
9067
+ sources.push(ResolveConfigurationData.normalize(cleanedDataForPath));
9000
9068
  }
9001
9069
  }
9002
- return localData;
9070
+ return sources;
9003
9071
  }
9004
- async getTemplateDirectoryData(templatePath) {
9072
+ async #getTemplateDirectoryEntry(templatePath) {
9005
9073
  if (!this.#templateDirectoryData[templatePath]) {
9006
9074
  let existsCache = this.templateConfig.existsCache;
9007
9075
  let localDataPaths = (await this.getLocalDataPaths(templatePath)).map((path11) => existsCache.resolve(path11)).filter(Boolean);
9008
- let importedData = await this.combineLocalData(localDataPaths);
9076
+ let sources = await this.getLocalDataSources(localDataPaths);
9009
9077
  this.config.uses?.addDataFiles(templatePath, localDataPaths);
9010
- this.#templateDirectoryData[templatePath] = importedData;
9078
+ this.#templateDirectoryData[templatePath] = {
9079
+ sources,
9080
+ data: (0, import_eleventy_utils7.Merge)({}, ...sources)
9081
+ };
9011
9082
  }
9012
9083
  return this.#templateDirectoryData[templatePath];
9013
9084
  }
9085
+ async getTemplateDirectoryData(templatePath) {
9086
+ return (await this.#getTemplateDirectoryEntry(templatePath)).data;
9087
+ }
9088
+ async getTemplateDirectoryDataSources(templatePath) {
9089
+ return (await this.#getTemplateDirectoryEntry(templatePath)).sources;
9090
+ }
9014
9091
  getUserDataExtensions() {
9015
9092
  if (!this.config.dataExtensions) {
9016
9093
  return [];
@@ -9060,7 +9137,7 @@ var TemplateData = class _TemplateData {
9060
9137
  }
9061
9138
  }
9062
9139
  async getDataValue(path11) {
9063
- let extension = import_eleventy_utils6.TemplatePath.getExtension(path11).toLowerCase();
9140
+ let extension = import_eleventy_utils7.TemplatePath.getExtension(path11).toLowerCase();
9064
9141
  if (this.#eligibleJavaScriptExtensions.includes(extension)) {
9065
9142
  if (!this.exists(path11)) {
9066
9143
  return {};
@@ -9121,22 +9198,22 @@ var TemplateData = class _TemplateData {
9121
9198
  }
9122
9199
  let paths = [];
9123
9200
  let inputDir = this.inputDir;
9124
- for (let dir of import_eleventy_utils6.TemplatePath.getAllDirs(parsedDir)) {
9201
+ for (let dir of import_eleventy_utils7.TemplatePath.getAllDirs(parsedDir)) {
9125
9202
  if (!inputDir || dir.startsWith(inputDir) && dir !== inputDir) {
9126
- this.#pushDataFilePaths(paths, dir, "directory", import_eleventy_utils6.TemplatePath.getLastPathSegment(dir));
9203
+ this.#pushDataFilePaths(paths, dir, "directory", import_eleventy_utils7.TemplatePath.getLastPathSegment(dir));
9127
9204
  }
9128
9205
  }
9129
9206
  if (inputDir) {
9130
- let rootDir = import_eleventy_utils6.TemplatePath.getDirFromFilePath(
9131
- import_eleventy_utils6.TemplatePath.addLeadingDotSlash(
9132
- import_eleventy_utils6.TemplatePath.join(inputDir, import_eleventy_utils6.TemplatePath.getLastPathSegment(inputDir))
9207
+ let rootDir = import_eleventy_utils7.TemplatePath.getDirFromFilePath(
9208
+ import_eleventy_utils7.TemplatePath.addLeadingDotSlash(
9209
+ import_eleventy_utils7.TemplatePath.join(inputDir, import_eleventy_utils7.TemplatePath.getLastPathSegment(inputDir))
9133
9210
  )
9134
9211
  );
9135
9212
  this.#pushDataFilePaths(
9136
9213
  paths,
9137
9214
  rootDir,
9138
9215
  "directory",
9139
- import_eleventy_utils6.TemplatePath.getLastPathSegment(inputDir)
9216
+ import_eleventy_utils7.TemplatePath.getLastPathSegment(inputDir)
9140
9217
  );
9141
9218
  }
9142
9219
  this.#directoryDataPaths.set(parsedDir, paths);
@@ -9145,7 +9222,7 @@ var TemplateData = class _TemplateData {
9145
9222
  /* Like cleanupData() but does not mutate */
9146
9223
  static getCleanedTagsImmutable(data, tagsKey = _TemplateData.DEFAULT_TAGS_KEY, options = {}) {
9147
9224
  let tags = [];
9148
- if (tagsKey && (0, import_eleventy_utils6.isPlainObject)(data) && data[tagsKey]) {
9225
+ if (tagsKey && (0, import_eleventy_utils7.isPlainObject)(data) && data[tagsKey]) {
9149
9226
  let value = data[tagsKey];
9150
9227
  if (typeof value === "string") {
9151
9228
  tags = value.split(",");
@@ -9161,7 +9238,7 @@ var TemplateData = class _TemplateData {
9161
9238
  return tags;
9162
9239
  }
9163
9240
  static cleanupData(data, tagsKey = _TemplateData.DEFAULT_TAGS_KEY, options = {}) {
9164
- if (tagsKey && (0, import_eleventy_utils6.isPlainObject)(data) && tagsKey in data) {
9241
+ if (tagsKey && (0, import_eleventy_utils7.isPlainObject)(data) && tagsKey in data) {
9165
9242
  data[tagsKey] = this.getCleanedTagsImmutable(data, tagsKey, options);
9166
9243
  }
9167
9244
  return data;
@@ -9199,13 +9276,13 @@ var TemplateData = class _TemplateData {
9199
9276
  var TemplateData_default = TemplateData;
9200
9277
 
9201
9278
  // ../../src/TemplateWriter.js
9202
- var import_eleventy_utils25 = __toESM(require_eleventy_utils(), 1);
9279
+ var import_eleventy_utils26 = __toESM(require_eleventy_utils(), 1);
9203
9280
 
9204
9281
  // ../../src/Template.js
9205
9282
  var import_node_path9 = __toESM(require_path(), 1);
9206
9283
  init_shim_consume_fs();
9207
9284
  var import_lodash_custom8 = __toESM(require_lodash_custom(), 1);
9208
- var import_eleventy_utils21 = __toESM(require_eleventy_utils(), 1);
9285
+ var import_eleventy_utils22 = __toESM(require_eleventy_utils(), 1);
9209
9286
  init_DebugLogUtil();
9210
9287
 
9211
9288
  // ../../src/Util/spawn.core.js
@@ -9273,7 +9350,7 @@ var getUpdatedTimestamp = MemoizeFunction_default(async function(filePath) {
9273
9350
  init_shim_consume_fs();
9274
9351
  var import_gray_matter = __toESM(require_gray_matter(), 1);
9275
9352
  var import_lodash_custom4 = __toESM(require_lodash_custom(), 1);
9276
- var import_eleventy_utils9 = __toESM(require_eleventy_utils(), 1);
9353
+ var import_eleventy_utils10 = __toESM(require_eleventy_utils(), 1);
9277
9354
 
9278
9355
  // ../../src/Util/RetrieveGlobals.client.js
9279
9356
  async function RetrieveGlobals(code, filePath) {
@@ -9901,7 +9978,7 @@ var ErrorUtil = class _ErrorUtil {
9901
9978
  };
9902
9979
 
9903
9980
  // ../../src/Util/TemplateQuery.js
9904
- var import_eleventy_utils8 = __toESM(require_eleventy_utils(), 1);
9981
+ var import_eleventy_utils9 = __toESM(require_eleventy_utils(), 1);
9905
9982
 
9906
9983
  // ../../src/Util/GlobMatcher.client.js
9907
9984
  function isGlobMatch() {
@@ -10012,8 +10089,8 @@ var TemplateQueryRegistry = class _TemplateQueryRegistry {
10012
10089
  if (target.startsWith("/")) {
10013
10090
  return directories.getInputPath(target.slice(1));
10014
10091
  }
10015
- let dir = import_eleventy_utils8.TemplatePath.getDirFromFilePath(fromInputPath);
10016
- return import_eleventy_utils8.TemplatePath.addLeadingDotSlash(import_eleventy_utils8.TemplatePath.join(dir, target));
10092
+ let dir = import_eleventy_utils9.TemplatePath.getDirFromFilePath(fromInputPath);
10093
+ return import_eleventy_utils9.TemplatePath.addLeadingDotSlash(import_eleventy_utils9.TemplatePath.join(dir, target));
10017
10094
  }
10018
10095
  #createResults(query, ops = []) {
10019
10096
  let results = new QueryResults();
@@ -10264,7 +10341,7 @@ var TemplateContent = class _TemplateContent {
10264
10341
  }
10265
10342
  getFrontMatterParsingOptions() {
10266
10343
  if (!this.#frontMatterOptions) {
10267
- this.#frontMatterOptions = (0, import_eleventy_utils9.DeepCopy)(
10344
+ this.#frontMatterOptions = (0, import_eleventy_utils10.DeepCopy)(
10268
10345
  {
10269
10346
  // Set a project-wide default.
10270
10347
  // language: "yaml",
@@ -10365,8 +10442,8 @@ var TemplateContent = class _TemplateContent {
10365
10442
  compile: /* @__PURE__ */ new Map()
10366
10443
  };
10367
10444
  templateConfig.eventBus.on("buildawesome.resourcemodified", (path11) => {
10368
- caches2.input.delete(import_eleventy_utils9.TemplatePath.absolutePath(path11));
10369
- caches2.compile.get(import_eleventy_utils9.TemplatePath.addLeadingDotSlash(path11))?.clear();
10445
+ caches2.input.delete(import_eleventy_utils10.TemplatePath.absolutePath(path11));
10446
+ caches2.compile.get(import_eleventy_utils10.TemplatePath.addLeadingDotSlash(path11))?.clear();
10370
10447
  });
10371
10448
  templateConfig.eventBus.on("buildawesome.compilecachereset", () => {
10372
10449
  caches2.compile = /* @__PURE__ */ new Map();
@@ -10397,7 +10474,7 @@ var TemplateContent = class _TemplateContent {
10397
10474
  let content;
10398
10475
  if (this.config.useTemplateCache) {
10399
10476
  content = _TemplateContent.getCaches(this.eleventyConfig).input.get(
10400
- import_eleventy_utils9.TemplatePath.absolutePath(this.inputPath)
10477
+ import_eleventy_utils10.TemplatePath.absolutePath(this.inputPath)
10401
10478
  );
10402
10479
  }
10403
10480
  if (!content && content !== "") {
@@ -10405,7 +10482,7 @@ var TemplateContent = class _TemplateContent {
10405
10482
  content = contentBuffer.toString("utf8");
10406
10483
  if (this.config.useTemplateCache) {
10407
10484
  _TemplateContent.getCaches(this.eleventyConfig).input.set(
10408
- import_eleventy_utils9.TemplatePath.absolutePath(this.inputPath),
10485
+ import_eleventy_utils10.TemplatePath.absolutePath(this.inputPath),
10409
10486
  content
10410
10487
  );
10411
10488
  }
@@ -10719,7 +10796,7 @@ var TemplateContent_default = TemplateContent;
10719
10796
 
10720
10797
  // ../../src/TemplatePermalink.js
10721
10798
  var import_node_path3 = __toESM(require_path(), 1);
10722
- var import_eleventy_utils10 = __toESM(require_eleventy_utils(), 1);
10799
+ var import_eleventy_utils11 = __toESM(require_eleventy_utils(), 1);
10723
10800
  var TemplatePermalink = class _TemplatePermalink {
10724
10801
  #dynamicPermalinkEnabled;
10725
10802
  // `link` with template syntax should have already been rendered in Template.js
@@ -10750,7 +10827,7 @@ ${link.toString()}` : "";
10750
10827
  }
10751
10828
  // Backwards compatibility: `permalink: { build }` is an alias for `permalink`.
10752
10829
  static resolveBuildAlias(link) {
10753
- if ((0, import_eleventy_utils10.isPlainObject)(link) && "build" in link) {
10830
+ if ((0, import_eleventy_utils11.isPlainObject)(link) && "build" in link) {
10754
10831
  return link.build;
10755
10832
  }
10756
10833
  return link;
@@ -10770,7 +10847,7 @@ ${link.toString()}` : "";
10770
10847
  }
10771
10848
  let cleanLink = this._addDefaultLinkFilename(this.buildLink);
10772
10849
  let parsed = import_node_path3.default.parse(cleanLink);
10773
- return import_eleventy_utils10.TemplatePath.join(parsed.dir, this.extraPaginationSubdir, parsed.base);
10850
+ return import_eleventy_utils11.TemplatePath.join(parsed.dir, this.extraPaginationSubdir, parsed.base);
10774
10851
  }
10775
10852
  // Used in url transforms feature
10776
10853
  static getUrlStem(original) {
@@ -10821,7 +10898,7 @@ ${link.toString()}` : "";
10821
10898
  if (uri === false) {
10822
10899
  return false;
10823
10900
  }
10824
- return import_eleventy_utils10.TemplatePath.addLeadingDotSlash(import_eleventy_utils10.TemplatePath.normalize(outputDir + "/" + uri));
10901
+ return import_eleventy_utils11.TemplatePath.addLeadingDotSlash(import_eleventy_utils11.TemplatePath.normalize(outputDir + "/" + uri));
10825
10902
  }
10826
10903
  toPathFromRoot() {
10827
10904
  if (!this.buildLink) {
@@ -10831,7 +10908,7 @@ ${link.toString()}` : "";
10831
10908
  if (uri === false) {
10832
10909
  return false;
10833
10910
  }
10834
- return import_eleventy_utils10.TemplatePath.addLeadingDotSlash(import_eleventy_utils10.TemplatePath.normalize(uri));
10911
+ return import_eleventy_utils11.TemplatePath.addLeadingDotSlash(import_eleventy_utils11.TemplatePath.normalize(uri));
10835
10912
  }
10836
10913
  static _hasDuplicateFolder(dir, base) {
10837
10914
  let folders = dir.split("/");
@@ -10854,10 +10931,10 @@ ${link.toString()}` : "";
10854
10931
  var TemplatePermalink_default = TemplatePermalink;
10855
10932
 
10856
10933
  // ../../src/TemplateLayout.js
10857
- var import_eleventy_utils13 = __toESM(require_eleventy_utils(), 1);
10934
+ var import_eleventy_utils14 = __toESM(require_eleventy_utils(), 1);
10858
10935
 
10859
10936
  // ../../src/TemplateLayoutPathResolver.js
10860
- var import_eleventy_utils11 = __toESM(require_eleventy_utils(), 1);
10937
+ var import_eleventy_utils12 = __toESM(require_eleventy_utils(), 1);
10861
10938
  var TemplateLayoutPathResolver = class {
10862
10939
  constructor(path11, extensionMap, templateConfig) {
10863
10940
  if (!templateConfig) {
@@ -10865,7 +10942,7 @@ var TemplateLayoutPathResolver = class {
10865
10942
  }
10866
10943
  this.templateConfig = templateConfig;
10867
10944
  this.originalPath = path11;
10868
- this.originalDisplayPath = import_eleventy_utils11.TemplatePath.join(this.layoutsDir, this.originalPath) + ` (via \`layout: ${this.originalPath}\`)`;
10945
+ this.originalDisplayPath = import_eleventy_utils12.TemplatePath.join(this.layoutsDir, this.originalPath) + ` (via \`layout: ${this.originalPath}\`)`;
10869
10946
  this.path = path11;
10870
10947
  this.aliases = {};
10871
10948
  this.extensionMap = extensionMap;
@@ -10967,13 +11044,13 @@ var TemplateLayoutPathResolver = class {
10967
11044
  }
10968
11045
  }
10969
11046
  getNormalizedLayoutKey() {
10970
- return import_eleventy_utils11.TemplatePath.stripLeadingSubPath(this.fullPath, this.layoutsDir);
11047
+ return import_eleventy_utils12.TemplatePath.stripLeadingSubPath(this.fullPath, this.layoutsDir);
10971
11048
  }
10972
11049
  };
10973
11050
  var TemplateLayoutPathResolver_default = TemplateLayoutPathResolver;
10974
11051
 
10975
11052
  // ../../src/LayoutCache.js
10976
- var import_eleventy_utils12 = __toESM(require_eleventy_utils(), 1);
11053
+ var import_eleventy_utils13 = __toESM(require_eleventy_utils(), 1);
10977
11054
  var LayoutCache = class {
10978
11055
  constructor() {
10979
11056
  this.cache = {};
@@ -11009,7 +11086,7 @@ var LayoutCache = class {
11009
11086
  for (let key of keys) {
11010
11087
  this.cache[key] = layoutTemplate;
11011
11088
  }
11012
- let fullPath = import_eleventy_utils12.TemplatePath.stripLeadingDotSlash(layoutTemplate.inputPath);
11089
+ let fullPath = import_eleventy_utils13.TemplatePath.stripLeadingDotSlash(layoutTemplate.inputPath);
11013
11090
  this.cacheByInputPath[fullPath] = layoutTemplate;
11014
11091
  }
11015
11092
  has(key) {
@@ -11022,7 +11099,7 @@ var LayoutCache = class {
11022
11099
  return this.cache[key];
11023
11100
  }
11024
11101
  remove(layoutFilePath) {
11025
- layoutFilePath = import_eleventy_utils12.TemplatePath.stripLeadingDotSlash(layoutFilePath);
11102
+ layoutFilePath = import_eleventy_utils13.TemplatePath.stripLeadingDotSlash(layoutFilePath);
11026
11103
  if (!this.cacheByInputPath[layoutFilePath]) {
11027
11104
  return;
11028
11105
  }
@@ -11099,7 +11176,7 @@ var TemplateLayout = class _TemplateLayout extends TemplateContent_default {
11099
11176
  return /* @__PURE__ */ new Set([this.dataKeyLayoutPath, this.getFullKey(), this.key]);
11100
11177
  }
11101
11178
  static resolveFullKey(key, inputDir) {
11102
- return import_eleventy_utils13.TemplatePath.join(inputDir, key);
11179
+ return import_eleventy_utils14.TemplatePath.join(inputDir, key);
11103
11180
  }
11104
11181
  static getTemplate(key, eleventyConfig, extensionMap) {
11105
11182
  let config = eleventyConfig.getConfig();
@@ -11170,7 +11247,7 @@ var TemplateLayout = class _TemplateLayout extends TemplateContent_default {
11170
11247
  for (let j = map.length - 1; j >= 0; j--) {
11171
11248
  dataToMerge.push(map[j].frontMatterData);
11172
11249
  }
11173
- let data = (0, import_eleventy_utils13.Merge)({}, ...dataToMerge);
11250
+ let data = (0, import_eleventy_utils14.Merge)({}, ...dataToMerge);
11174
11251
  delete data[this.config.keys.layout];
11175
11252
  delete data[this.config.keys.engineOverride];
11176
11253
  delete data[`override:${this.config.keys.engineOverride}`];
@@ -11271,15 +11348,15 @@ var TemplateLayout_default = TemplateLayout;
11271
11348
 
11272
11349
  // ../../src/TemplateFileSlug.js
11273
11350
  var import_node_path4 = __toESM(require_path(), 1);
11274
- var import_eleventy_utils14 = __toESM(require_eleventy_utils(), 1);
11351
+ var import_eleventy_utils15 = __toESM(require_eleventy_utils(), 1);
11275
11352
  var TemplateFileSlug = class {
11276
11353
  constructor(inputPath, extensionMap, eleventyConfig) {
11277
11354
  let inputDir = eleventyConfig.directories.input;
11278
11355
  if (inputDir) {
11279
- inputPath = import_eleventy_utils14.TemplatePath.stripLeadingSubPath(inputPath, inputDir);
11356
+ inputPath = import_eleventy_utils15.TemplatePath.stripLeadingSubPath(inputPath, inputDir);
11280
11357
  }
11281
11358
  this.inputPath = inputPath;
11282
- this.cleanInputPath = import_eleventy_utils14.TemplatePath.stripLeadingDotSlash(inputPath);
11359
+ this.cleanInputPath = import_eleventy_utils15.TemplatePath.stripLeadingDotSlash(inputPath);
11283
11360
  let dirs = this.cleanInputPath.split("/");
11284
11361
  this.dirs = dirs;
11285
11362
  this.dirs.pop();
@@ -11288,7 +11365,7 @@ var TemplateFileSlug = class {
11288
11365
  }
11289
11366
  // `page.filePathStem` see https://v3.11ty.dev/docs/data-eleventy-supplied/#page-variable
11290
11367
  getFullPathWithoutExtension() {
11291
- return "/" + import_eleventy_utils14.TemplatePath.join(...this.dirs, this._getRawSlug());
11368
+ return "/" + import_eleventy_utils15.TemplatePath.join(...this.dirs, this._getRawSlug());
11292
11369
  }
11293
11370
  _getRawSlug() {
11294
11371
  let slug = this.filenameNoExt;
@@ -11646,6 +11723,13 @@ var ComputedData = class {
11646
11723
  restore();
11647
11724
  }
11648
11725
  }
11726
+ // A shallow copy for template engines that copy all of their data (e.g. a Nunjucks context), which isn’t an early read
11727
+ getUnguardedCopy(data) {
11728
+ if (!this.#guards.get(data)?.size) {
11729
+ return data;
11730
+ }
11731
+ return withoutTracking(() => ({ ...data }));
11732
+ }
11649
11733
  async processRemainingData(data) {
11650
11734
  await this.setupData(data);
11651
11735
  }
@@ -11799,7 +11883,7 @@ var ComputedData = class {
11799
11883
  throw new InterruptedRead(path11);
11800
11884
  }
11801
11885
  }
11802
- let value = target[prop];
11886
+ let value = path11 === context.key ? withoutTracking(() => target[prop]) : target[prop];
11803
11887
  if (context.signals.hasPendingChild(path11, context.key)) {
11804
11888
  return this.#getTrackingProxy(
11805
11889
  value && typeof value === "object" ? value : {},
@@ -11807,6 +11891,9 @@ var ComputedData = class {
11807
11891
  path11
11808
11892
  );
11809
11893
  }
11894
+ if (value && typeof value === "object" && context.key.startsWith(path11 + ".")) {
11895
+ return this.#getTrackingProxy(value, context, path11);
11896
+ }
11810
11897
  return value;
11811
11898
  };
11812
11899
  let proxy = new Proxy(
@@ -11841,14 +11928,17 @@ var ComputedData = class {
11841
11928
  };
11842
11929
 
11843
11930
  // ../../src/Plugins/Pagination.js
11844
- var import_eleventy_utils17 = __toESM(require_eleventy_utils(), 1);
11845
- var import_lodash_custom7 = __toESM(require_lodash_custom(), 1);
11846
11931
  var import_eleventy_utils18 = __toESM(require_eleventy_utils(), 1);
11932
+ var import_lodash_custom7 = __toESM(require_lodash_custom(), 1);
11933
+ var import_eleventy_utils19 = __toESM(require_eleventy_utils(), 1);
11847
11934
  init_BaseError();
11848
11935
 
11849
11936
  // ../../src/Util/Objects/ProxyWrap.js
11850
- var import_eleventy_utils15 = __toESM(require_eleventy_utils(), 1);
11937
+ var import_eleventy_utils16 = __toESM(require_eleventy_utils(), 1);
11851
11938
  var ProxySymbol = /* @__PURE__ */ Symbol.for("11ty.ProxySymbol");
11939
+ function isFrozen(value) {
11940
+ return withoutTracking(() => Object.isFrozen(value));
11941
+ }
11852
11942
  var FallbackHandler = class {
11853
11943
  constructor(fallback) {
11854
11944
  this.fallback = fallback;
@@ -11870,7 +11960,7 @@ var FallbackHandler = class {
11870
11960
  }
11871
11961
  ownKeys(target) {
11872
11962
  let s = /* @__PURE__ */ new Set();
11873
- if ((0, import_eleventy_utils15.isPlainObject)(this.fallback)) {
11963
+ if ((0, import_eleventy_utils16.isPlainObject)(this.fallback)) {
11874
11964
  for (let k of Reflect.ownKeys(this.fallback)) {
11875
11965
  s.add(k);
11876
11966
  }
@@ -11891,8 +11981,8 @@ var FallbackHandler = class {
11891
11981
  if (Reflect.get(target, ProxySymbol)) {
11892
11982
  return value;
11893
11983
  }
11894
- if ((0, import_eleventy_utils15.isPlainObject)(value) && Reflect.has(this.fallback, prop)) {
11895
- if (Object.isFrozen(value)) {
11984
+ if ((0, import_eleventy_utils16.isPlainObject)(value) && Reflect.has(this.fallback, prop)) {
11985
+ if (isFrozen(value)) {
11896
11986
  return value;
11897
11987
  }
11898
11988
  let ret = wrapObject(value, Reflect.get(this.fallback, prop));
@@ -11902,8 +11992,8 @@ var FallbackHandler = class {
11902
11992
  }
11903
11993
  if ((typeof this.fallback === "object" || typeof this.fallback === "function") && Reflect.has(this.fallback, prop)) {
11904
11994
  let fallbackValue = Reflect.get(this.fallback, prop);
11905
- if ((0, import_eleventy_utils15.isPlainObject)(fallbackValue)) {
11906
- if (Object.isFrozen(fallbackValue)) {
11995
+ if ((0, import_eleventy_utils16.isPlainObject)(fallbackValue)) {
11996
+ if (isFrozen(fallbackValue)) {
11907
11997
  return fallbackValue;
11908
11998
  }
11909
11999
  let emptyObject = {};
@@ -11919,13 +12009,13 @@ var FallbackHandler = class {
11919
12009
  }
11920
12010
  };
11921
12011
  function wrapObject(target, fallback) {
11922
- if (Object.isFrozen(target)) {
12012
+ if (isFrozen(target)) {
11923
12013
  return target;
11924
12014
  }
11925
12015
  return new Proxy(target, new FallbackHandler(fallback));
11926
12016
  }
11927
12017
  function ProxyWrap(target, fallback) {
11928
- if (!(0, import_eleventy_utils15.isPlainObject)(target) || !(0, import_eleventy_utils15.isPlainObject)(fallback)) {
12018
+ if (!(0, import_eleventy_utils16.isPlainObject)(target) || !(0, import_eleventy_utils16.isPlainObject)(fallback)) {
11929
12019
  throw new Error("ProxyWrap expects objects for both the target and fallback");
11930
12020
  }
11931
12021
  return wrapObject(target, fallback);
@@ -11936,7 +12026,7 @@ var import_node_path7 = __toESM(require_path(), 1);
11936
12026
 
11937
12027
  // ../../src/Util/PathNormalizer.js
11938
12028
  var import_node_path6 = __toESM(require_path(), 1);
11939
- var import_eleventy_utils16 = __toESM(require_eleventy_utils(), 1);
12029
+ var import_eleventy_utils17 = __toESM(require_eleventy_utils(), 1);
11940
12030
 
11941
12031
  // ../../src/Adapters/Packages/url.core.js
11942
12032
  var import_node_path5 = __toESM(require_path());
@@ -12000,8 +12090,8 @@ var PathNormalizer = class {
12000
12090
  if (normalized.startsWith("file://")) {
12001
12091
  normalized = fileURLToPath(normalized);
12002
12092
  }
12003
- normalized = import_eleventy_utils16.TemplatePath.stripLeadingDotSlash(
12004
- this.normalizeSeperator(import_eleventy_utils16.TemplatePath.relativePath(normalized))
12093
+ normalized = import_eleventy_utils17.TemplatePath.stripLeadingDotSlash(
12094
+ this.normalizeSeperator(import_eleventy_utils17.TemplatePath.relativePath(normalized))
12005
12095
  );
12006
12096
  this.#fullNormalizationCache.set(inputPath, normalized);
12007
12097
  return normalized;
@@ -12098,7 +12188,7 @@ var Pagination = class _Pagination {
12098
12188
  // An Array or Object is the data set itself instead of a key, Issue #4420
12099
12189
  _getDataSet() {
12100
12190
  let key = this._getDataKey();
12101
- if (Array.isArray(key) || (0, import_eleventy_utils17.isPlainObject)(key)) {
12191
+ if (Array.isArray(key) || (0, import_eleventy_utils18.isPlainObject)(key)) {
12102
12192
  return key;
12103
12193
  }
12104
12194
  return this._get(this.data, key);
@@ -12127,7 +12217,7 @@ var Pagination = class _Pagination {
12127
12217
  if (Array.isArray(this.fullDataSet)) {
12128
12218
  keys = this.fullDataSet;
12129
12219
  this.paginationTargetType = "array";
12130
- } else if ((0, import_eleventy_utils17.isPlainObject)(this.fullDataSet)) {
12220
+ } else if ((0, import_eleventy_utils18.isPlainObject)(this.fullDataSet)) {
12131
12221
  this.paginationTargetType = "object";
12132
12222
  if (this.shouldResolveDataToObjectValues()) {
12133
12223
  keys = Object.values(this.fullDataSet);
@@ -12240,7 +12330,7 @@ var Pagination = class _Pagination {
12240
12330
  delete this.data.collections;
12241
12331
  }
12242
12332
  let parentData = withoutTracking(
12243
- () => (0, import_eleventy_utils18.DeepCopy)(
12333
+ () => (0, import_eleventy_utils19.DeepCopy)(
12244
12334
  {
12245
12335
  pagination: {
12246
12336
  data: this.data.pagination.data,
@@ -12543,7 +12633,7 @@ function fromISOtoDateUTC(dateValue, inputPath, timeZone) {
12543
12633
  }
12544
12634
 
12545
12635
  // ../../src/Util/TransformsUtil.js
12546
- var import_eleventy_utils19 = __toESM(require_eleventy_utils(), 1);
12636
+ var import_eleventy_utils20 = __toESM(require_eleventy_utils(), 1);
12547
12637
  init_BaseError();
12548
12638
  init_DebugLogUtil();
12549
12639
  var debug9 = createDebug4("Transforms");
@@ -12563,7 +12653,7 @@ var TransformsUtil = class {
12563
12653
  static async runAll(content, pageData, transforms = {}, options = {}) {
12564
12654
  let { baseHrefOverride, logger } = options;
12565
12655
  let { inputPath, outputPath, url } = pageData;
12566
- if (!(0, import_eleventy_utils19.isPlainObject)(transforms)) {
12656
+ if (!(0, import_eleventy_utils20.isPlainObject)(transforms)) {
12567
12657
  throw new Error("Object of transforms expected.");
12568
12658
  }
12569
12659
  let transformsArray = this.changeTransformsToArray(transforms);
@@ -12699,7 +12789,7 @@ function getDirectoryFromUrl(url) {
12699
12789
  }
12700
12790
 
12701
12791
  // ../../src/Data/GlobalDataReads.js
12702
- var import_eleventy_utils20 = __toESM(require_eleventy_utils(), 1);
12792
+ var import_eleventy_utils21 = __toESM(require_eleventy_utils(), 1);
12703
12793
  var TrackedSymbol = /* @__PURE__ */ Symbol.for("11ty.GlobalDataReads");
12704
12794
  function isTracked(value) {
12705
12795
  return Boolean(value?.[TrackedSymbol]);
@@ -12713,7 +12803,7 @@ function trackGlobalDataReads(data, filesByKey, onRead) {
12713
12803
  if (isTracked(value)) {
12714
12804
  continue;
12715
12805
  }
12716
- if (!(0, import_eleventy_utils20.isPlainObject)(value) && !Array.isArray(value)) {
12806
+ if (!(0, import_eleventy_utils21.isPlainObject)(value) && !Array.isArray(value)) {
12717
12807
  onRead(files);
12718
12808
  continue;
12719
12809
  }
@@ -12965,12 +13055,12 @@ var Template = class _Template extends TemplateContent_default {
12965
13055
  this.extraOutputSubdirectory = dir + "/";
12966
13056
  }
12967
13057
  getTemplateSubfolder() {
12968
- let dir = import_eleventy_utils21.TemplatePath.absolutePath(this.parsed.dir);
12969
- let inputDir = import_eleventy_utils21.TemplatePath.absolutePath(this.inputDir);
13058
+ let dir = import_eleventy_utils22.TemplatePath.absolutePath(this.parsed.dir);
13059
+ let inputDir = import_eleventy_utils22.TemplatePath.absolutePath(this.inputDir);
12970
13060
  if (inputDir === "/" && dir.startsWith("/")) {
12971
13061
  return dir;
12972
13062
  }
12973
- return import_eleventy_utils21.TemplatePath.stripLeadingSubPath(dir, inputDir);
13063
+ return import_eleventy_utils22.TemplatePath.stripLeadingSubPath(dir, inputDir);
12974
13064
  }
12975
13065
  templateUsesLayouts(pageData) {
12976
13066
  if (this.hasTemplateRender()) {
@@ -13003,7 +13093,7 @@ var Template = class _Template extends TemplateContent_default {
13003
13093
  let isDynamicPermalinkEnabled = this.config.dynamicPermalinks && data.dynamicPermalink !== false;
13004
13094
  if (typeof permalink === "boolean") {
13005
13095
  permalinkValue = permalink;
13006
- } else if ((0, import_eleventy_utils21.isPlainObject)(permalink)) {
13096
+ } else if ((0, import_eleventy_utils22.isPlainObject)(permalink)) {
13007
13097
  if (Object.keys(permalink).length > 0) {
13008
13098
  throw new Error(
13009
13099
  `Permalink objects are not supported (other than \`permalink.build\`). Use a string or \`false\` instead in ${this.inputPath}.`
@@ -13042,23 +13132,35 @@ var Template = class _Template extends TemplateContent_default {
13042
13132
  let subfolder = this.getTemplateSubfolder();
13043
13133
  let fileExtension = this.engine.defaultTemplateFileExtension;
13044
13134
  let collapseMatchingFolder = this.config.permalinkCollapseMatchingFolder;
13045
- if (!collapseMatchingFolder && !this.eleventyConfig.userConfig.checkErrorReporting("collapsedMatchingFolder", "allow") && fileExtension === "html" && this.baseFile !== "index" && TemplatePermalink_default._hasDuplicateFolder(subfolder, this.baseFile)) {
13046
- this.#warnOnce(
13047
- `collapse-matching-folder:${this.inputPath}`,
13048
- `${this.inputPath} now writes to \`${subfolder}/${this.baseFile}/index.html\` instead of \`${subfolder}/index.html\` (changed in v4: file names that match their parent folder are no longer collapsed). Use \`$config.setPermalinkCollapseMatchingFolder(true)\` to restore the old behavior, or \`$config.configureErrorReporting({ collapsedMatchingFolder: "allow" })\` to silence this warning.`
13135
+ let generate = (collapse) => {
13136
+ let p2 = TemplatePermalink_default.generate(
13137
+ subfolder,
13138
+ this.baseFile,
13139
+ this.extraOutputSubdirectory,
13140
+ fileExtension,
13141
+ isDynamicPermalinkEnabled,
13142
+ collapse
13049
13143
  );
13144
+ p2.setUrlTransforms(this.config.urlTransforms);
13145
+ return p2;
13146
+ };
13147
+ let p = generate(collapseMatchingFolder);
13148
+ if (!collapseMatchingFolder && !this.eleventyConfig.userConfig.checkErrorReporting("collapsedMatchingFolder", "allow")) {
13149
+ this.#warnCollapsedMatchingFolder(p.toHref(), generate(true).toHref());
13050
13150
  }
13051
- let p = TemplatePermalink_default.generate(
13052
- subfolder,
13053
- this.baseFile,
13054
- this.extraOutputSubdirectory,
13055
- fileExtension,
13056
- isDynamicPermalinkEnabled,
13057
- collapseMatchingFolder
13058
- );
13059
- p.setUrlTransforms(this.config.urlTransforms);
13060
13151
  return p;
13061
13152
  }
13153
+ #warnCollapsedMatchingFolder(href, v3Href) {
13154
+ if (href === v3Href) {
13155
+ return;
13156
+ }
13157
+ let indexFile = `index${this.parsed.base.slice(this.baseFile.length)}`;
13158
+ this.#warnOnce(
13159
+ `collapse-matching-folder:${this.inputPath}`,
13160
+ `${this.inputPath} now outputs to \`${href}\` (v3 output it to \`${v3Href}\`: file names that match their parent folder are no longer collapsed). To keep \`${v3Href}\`, rename it to \`${indexFile}\` or set a \`permalink\`. Or use \`$config.setPermalinkCollapseMatchingFolder(true)\` to restore the v3 behavior, or \`$config.configureErrorReporting({ collapsedMatchingFolder: "allow" })\` to silence this warning.`,
13161
+ { force: true }
13162
+ );
13163
+ }
13062
13164
  usePermalinkRoot(data) {
13063
13165
  return Boolean(data?.[this.config.keys.permalinkRoot]);
13064
13166
  }
@@ -13114,15 +13216,17 @@ var Template = class _Template extends TemplateContent_default {
13114
13216
  }
13115
13217
  async #getCascadeSources() {
13116
13218
  let localData = {};
13219
+ let localDataSources = [];
13117
13220
  let globalData = {};
13118
13221
  if (this.templateData) {
13119
13222
  localData = await this.templateData.getTemplateDirectoryData(this.inputPath);
13223
+ localDataSources = await this.templateData.getTemplateDirectoryDataSources(this.inputPath);
13120
13224
  globalData = await this.templateData.getGlobalData();
13121
13225
  }
13122
13226
  let { data: frontMatterData } = await this.getFrontMatterData();
13123
13227
  let key = this.config.keys.layout;
13124
13228
  let layoutKey = frontMatterData[key] || localData[key] || globalData[key];
13125
- return { localData, globalData, frontMatterData, layoutKey };
13229
+ return { localData, localDataSources, globalData, frontMatterData, layoutKey };
13126
13230
  }
13127
13231
  async #getLayoutData(layoutKey) {
13128
13232
  if (!layoutKey) {
@@ -13131,19 +13235,31 @@ var Template = class _Template extends TemplateContent_default {
13131
13235
  return this.getLayout(layoutKey).getData();
13132
13236
  }
13133
13237
  async #getData() {
13134
- let { localData, globalData, frontMatterData, layoutKey } = await this.#getCascadeSources();
13238
+ let { localData, localDataSources, globalData, frontMatterData, layoutKey } = await this.#getCascadeSources();
13135
13239
  let mergedLayoutData = {};
13136
13240
  let tr = await this.getTemplateRender();
13137
13241
  if (tr.engine.useLayouts()) {
13138
13242
  mergedLayoutData = await this.#getLayoutData(layoutKey);
13139
13243
  }
13140
13244
  try {
13141
- let mergedData = (0, import_eleventy_utils21.Merge)({}, globalData, mergedLayoutData, localData, frontMatterData);
13245
+ if (this.config.freezeReservedData) {
13246
+ let reservedGlobalKeys = ["eleventy", "buildawesome", this.config.keys.package];
13247
+ for (let data of [mergedLayoutData, localData, frontMatterData]) {
13248
+ ReservedData_default.checkGlobalOverrides(data, reservedGlobalKeys);
13249
+ }
13250
+ }
13251
+ let mergedData = (0, import_eleventy_utils22.Merge)(
13252
+ {},
13253
+ globalData,
13254
+ mergedLayoutData,
13255
+ ...localDataSources,
13256
+ frontMatterData
13257
+ );
13142
13258
  if (this.config.freezeReservedData) {
13143
13259
  ReservedData_default.checkSubset(mergedData);
13144
13260
  }
13145
13261
  let pageData = await this.getPageData(mergedData);
13146
- (0, import_eleventy_utils21.Merge)(mergedData, { page: pageData });
13262
+ (0, import_eleventy_utils22.Merge)(mergedData, { page: pageData });
13147
13263
  return mergedData;
13148
13264
  } catch (e) {
13149
13265
  if (!ReservedData_default.isReservedDataError(e) && ReservedData_default.isFrozenError(e)) {
@@ -13184,7 +13300,7 @@ var Template = class _Template extends TemplateContent_default {
13184
13300
  templateSyntax: this.templateRender.getEnginesList(this.getEngineOverride(data))
13185
13301
  };
13186
13302
  let computedData = ResolveConfigurationData.getValue(data, this.config.keys.computed);
13187
- if (!(0, import_eleventy_utils21.isPlainObject)(computedData) || !("date" in computedData)) {
13303
+ if (!(0, import_eleventy_utils22.isPlainObject)(computedData) || !("date" in computedData)) {
13188
13304
  let newDate = await this.getMappedDate(data?.date, page);
13189
13305
  if (newDate) {
13190
13306
  page.date = newDate;
@@ -13227,7 +13343,7 @@ var Template = class _Template extends TemplateContent_default {
13227
13343
  return this.#cacheRenderedPromise;
13228
13344
  }
13229
13345
  setLinters(linters) {
13230
- if (!(0, import_eleventy_utils21.isPlainObject)(linters)) {
13346
+ if (!(0, import_eleventy_utils22.isPlainObject)(linters)) {
13231
13347
  throw new Error("Object expected in setLinters");
13232
13348
  }
13233
13349
  this.linters = [];
@@ -13256,7 +13372,7 @@ var Template = class _Template extends TemplateContent_default {
13256
13372
  }
13257
13373
  }
13258
13374
  setTransforms(transforms) {
13259
- if (!(0, import_eleventy_utils21.isPlainObject)(transforms)) {
13375
+ if (!(0, import_eleventy_utils22.isPlainObject)(transforms)) {
13260
13376
  throw new Error("Object expected in setTransforms");
13261
13377
  }
13262
13378
  this.transforms = transforms;
@@ -13276,7 +13392,7 @@ var Template = class _Template extends TemplateContent_default {
13276
13392
  if (Array.isArray(entry)) {
13277
13393
  return Promise.all(entry.map((child) => this.#renderComputedUnit(child, data)));
13278
13394
  }
13279
- if ((0, import_eleventy_utils21.isPlainObject)(entry)) {
13395
+ if ((0, import_eleventy_utils22.isPlainObject)(entry)) {
13280
13396
  let rendered = {};
13281
13397
  for (let key in entry) {
13282
13398
  rendered[key] = await this.#renderComputedUnit(entry[key], data);
@@ -13292,13 +13408,13 @@ var Template = class _Template extends TemplateContent_default {
13292
13408
  computedData.addTemplateString(
13293
13409
  parentKey,
13294
13410
  async function(innerData) {
13295
- return this.tmpl.#renderComputedUnit(obj, innerData);
13411
+ return this.tmpl.#renderComputedUnit(obj, computedData.getUnguardedCopy(innerData));
13296
13412
  },
13297
13413
  declaredDependencies,
13298
13414
  async (innerData) => this.parseForSymbols(obj, await this.getComputedDataEngine(innerData)),
13299
13415
  this
13300
13416
  );
13301
- } else if ((0, import_eleventy_utils21.isPlainObject)(obj)) {
13417
+ } else if ((0, import_eleventy_utils22.isPlainObject)(obj)) {
13302
13418
  for (let key in obj) {
13303
13419
  let childKey = parentKey ? `${parentKey}.${key}` : key;
13304
13420
  this._addComputedEntry(computedData, obj[key], childKey, declaredDependencies);
@@ -13309,7 +13425,7 @@ var Template = class _Template extends TemplateContent_default {
13309
13425
  }
13310
13426
  #createComputedData(data) {
13311
13427
  let computedData = ResolveConfigurationData.getValue(data, this.config.keys.computed);
13312
- if (!(0, import_eleventy_utils21.isPlainObject)(computedData)) {
13428
+ if (!(0, import_eleventy_utils22.isPlainObject)(computedData)) {
13313
13429
  return;
13314
13430
  }
13315
13431
  let cd = new ComputedData(this.config, {
@@ -13319,15 +13435,16 @@ var Template = class _Template extends TemplateContent_default {
13319
13435
  let outputLocations = /* @__PURE__ */ new WeakMap();
13320
13436
  let getOutputLocations = (data2) => {
13321
13437
  if (!outputLocations.has(data2)) {
13322
- outputLocations.set(data2, this.getOutputLocations(data2));
13438
+ outputLocations.set(data2, this.getOutputLocations(cd.getUnguardedCopy(data2)));
13323
13439
  }
13324
13440
  return outputLocations.get(data2);
13325
13441
  };
13326
- cd.addTemplateString("page.url", async (data2) => (await getOutputLocations(data2)).href, [
13327
- "permalink",
13328
- "dynamicPermalink",
13329
- this.config.keys.permalinkRoot
13330
- ]);
13442
+ cd.addTemplateString(
13443
+ "page.url",
13444
+ async (data2) => (await getOutputLocations(data2)).href,
13445
+ ["permalink", "dynamicPermalink", this.config.keys.permalinkRoot],
13446
+ () => []
13447
+ );
13331
13448
  cd.addTemplateString(
13332
13449
  "page.outputPath",
13333
13450
  async (data2) => (await getOutputLocations(data2)).path,
@@ -13347,7 +13464,7 @@ var Template = class _Template extends TemplateContent_default {
13347
13464
  return cd;
13348
13465
  }
13349
13466
  // One warning per path (not per page), per logger (Eleventy instance)
13350
- #warnOnce(id, message) {
13467
+ #warnOnce(id, message, { force = false } = {}) {
13351
13468
  if (!warnedIds.has(this.logger)) {
13352
13469
  warnedIds.set(this.logger, /* @__PURE__ */ new Set());
13353
13470
  }
@@ -13356,7 +13473,11 @@ var Template = class _Template extends TemplateContent_default {
13356
13473
  return;
13357
13474
  }
13358
13475
  warned.add(id);
13359
- this.logger.warn(message);
13476
+ if (force) {
13477
+ this.logger.forceWarn(message);
13478
+ } else {
13479
+ this.logger.warn(message);
13480
+ }
13360
13481
  }
13361
13482
  // e.g. ./articles/first.md › populatedCategories › collections (deferred) or ./index.md › title (not yet run)
13362
13483
  #warnEarlyRead(path11) {
@@ -13429,10 +13550,10 @@ var Template = class _Template extends TemplateContent_default {
13429
13550
  }
13430
13551
  let layoutKey = data[key];
13431
13552
  if (layoutKey !== mergedLayoutKey) {
13432
- let { localData, globalData, frontMatterData } = await this.#getCascadeSources();
13553
+ let { localDataSources, globalData, frontMatterData } = await this.#getCascadeSources();
13433
13554
  let previousLayoutData = await this.#getLayoutData(mergedLayoutKey);
13434
13555
  let layoutData = await this.#getLayoutData(layoutKey);
13435
- let merged = (0, import_eleventy_utils21.Merge)({}, globalData, layoutData, localData, frontMatterData);
13556
+ let merged = (0, import_eleventy_utils22.Merge)({}, globalData, layoutData, ...localDataSources, frontMatterData);
13436
13557
  let computedKeys = this.computedData.computedKeys;
13437
13558
  for (let name of /* @__PURE__ */ new Set([...Object.keys(previousLayoutData), ...Object.keys(layoutData)])) {
13438
13559
  if (!computedKeys.has(name)) {
@@ -13522,7 +13643,8 @@ var Template = class _Template extends TemplateContent_default {
13522
13643
  }
13523
13644
  this.#warnOnce(
13524
13645
  `${key} \u203A ${layoutKey}`,
13525
- `Warning: computed data set \`${key}\` to \`${layoutKey}\` after the rest of computed data resolved (likely because it reads \`collections\`), so that layout\u2019s front matter data was not applied: ${this.inputPath} \u203A ${key}. You can work around this issue by computing \`${key}\` without reading \`collections\`, or by setting it outside of computed data (e.g. front matter or a directory data file).`
13646
+ `Warning: computed data set \`${key}\` to \`${layoutKey}\` after the rest of computed data resolved (likely because it reads \`collections\`), so that layout\u2019s front matter data was not applied: ${this.inputPath} \u203A ${key}. You can work around this issue by computing \`${key}\` without reading \`collections\`, or by setting it outside of computed data (e.g. front matter or a directory data file).`,
13647
+ { force: true }
13526
13648
  );
13527
13649
  }
13528
13650
  // Rendered content without the premature use check, `undefined` until rendered
@@ -13609,6 +13731,11 @@ var Template = class _Template extends TemplateContent_default {
13609
13731
  }
13610
13732
  }
13611
13733
  async _write({ url, outputPath, data, rawInput }, finalContent) {
13734
+ if (!this.usePermalinkRoot(data) && !this.eleventyConfig.directories.isFileInOutputFolder(outputPath)) {
13735
+ throw new Error(
13736
+ `Output path \`${outputPath}\` for ${this.inputPath} is outside of the output directory. Check your \`permalink\` value.`
13737
+ );
13738
+ }
13612
13739
  let lang = {
13613
13740
  start: "Writing",
13614
13741
  finished: "written"
@@ -13870,10 +13997,10 @@ var Template = class _Template extends TemplateContent_default {
13870
13997
  var Template_default = Template;
13871
13998
 
13872
13999
  // ../../src/TemplateMap.js
13873
- var import_eleventy_utils24 = __toESM(require_eleventy_utils(), 1);
14000
+ var import_eleventy_utils25 = __toESM(require_eleventy_utils(), 1);
13874
14001
 
13875
14002
  // ../../src/TemplateCollection.js
13876
- var import_eleventy_utils22 = __toESM(require_eleventy_utils(), 1);
14003
+ var import_eleventy_utils23 = __toESM(require_eleventy_utils(), 1);
13877
14004
 
13878
14005
  // ../../src/Util/Objects/Sortable.js
13879
14006
  var Sortable = class _Sortable {
@@ -14036,7 +14163,7 @@ var TemplateCollection = class extends Sortable_default {
14036
14163
  if (typeof globs === "string") {
14037
14164
  globs = [globs];
14038
14165
  }
14039
- globs = globs.map((glob) => import_eleventy_utils22.TemplatePath.addLeadingDotSlash(glob));
14166
+ globs = globs.map((glob) => import_eleventy_utils23.TemplatePath.addLeadingDotSlash(glob));
14040
14167
  return globs;
14041
14168
  }
14042
14169
  getFilteredByGlob(globs) {
@@ -14089,7 +14216,7 @@ var DuplicatePermalinkOutputError = class extends BaseError {
14089
14216
  };
14090
14217
 
14091
14218
  // ../../src/GlobalDependencyMap.js
14092
- var import_eleventy_utils23 = __toESM(require_eleventy_utils(), 1);
14219
+ var import_eleventy_utils24 = __toESM(require_eleventy_utils(), 1);
14093
14220
  init_DebugLogUtil();
14094
14221
 
14095
14222
  // ../../src/Util/JavaScriptDependencies.core.js
@@ -14531,7 +14658,7 @@ var GlobalDependencyMap = class _GlobalDependencyMap {
14531
14658
  overallOrder = this.filterOutCollections(overallOrder);
14532
14659
  let relevantLookup = {};
14533
14660
  for (let inputPath of templatePaths) {
14534
- inputPath = import_eleventy_utils23.TemplatePath.stripLeadingDotSlash(inputPath);
14661
+ inputPath = import_eleventy_utils24.TemplatePath.stripLeadingDotSlash(inputPath);
14535
14662
  let deps = this.getDependencies(inputPath, false);
14536
14663
  if (Array.isArray(deps)) {
14537
14664
  let paths = this.filterOutCollections(deps);
@@ -14729,7 +14856,7 @@ var TemplateMap = class {
14729
14856
  #getAbsoluteInputPath(inputPath) {
14730
14857
  let absoluteInputPath = this.absoluteInputPaths.get(inputPath);
14731
14858
  if (!absoluteInputPath) {
14732
- absoluteInputPath = import_eleventy_utils24.TemplatePath.absolutePath(inputPath);
14859
+ absoluteInputPath = import_eleventy_utils25.TemplatePath.absolutePath(inputPath);
14733
14860
  this.absoluteInputPaths.set(inputPath, absoluteInputPath);
14734
14861
  }
14735
14862
  return absoluteInputPath;
@@ -14909,7 +15036,7 @@ To downgrade this to a warning, use \`$config.configureErrorReporting({ tagCaseC
14909
15036
  if (GlobalDependencyMap_default.isCollection(entry)) {
14910
15037
  return entry;
14911
15038
  }
14912
- let inputPath = import_eleventy_utils24.TemplatePath.addLeadingDotSlash(entry);
15039
+ let inputPath = import_eleventy_utils25.TemplatePath.addLeadingDotSlash(entry);
14913
15040
  if (!this.hasMapEntryForInputPath(inputPath)) {
14914
15041
  return false;
14915
15042
  }
@@ -15151,7 +15278,7 @@ To downgrade this to a warning, use \`$config.configureErrorReporting({ tagCaseC
15151
15278
  continue;
15152
15279
  }
15153
15280
  for (let item of this.collectionsData[collectionName]) {
15154
- if (!(0, import_eleventy_utils24.isPlainObject)(item) || !("inputPath" in item)) {
15281
+ if (!(0, import_eleventy_utils25.isPlainObject)(item) || !("inputPath" in item)) {
15155
15282
  continue;
15156
15283
  }
15157
15284
  let entry = this.getMapEntryForInputPath(item.inputPath);
@@ -15278,7 +15405,7 @@ ${list}`;
15278
15405
  this.#onEachPage((page) => {
15279
15406
  if (page.outputPath === false || page.url === false || page.data.eleventyAllowMissingExtension || EXTENSIONLESS_URL_ALLOWLIST.some((url) => page.url.endsWith(url))) {
15280
15407
  } else {
15281
- if (import_eleventy_utils24.TemplatePath.getExtension(page.outputPath) === "") {
15408
+ if (import_eleventy_utils25.TemplatePath.getExtension(page.outputPath) === "") {
15282
15409
  let e = new Error(`The template at '${page.inputPath}' attempted to write to '${page.outputPath}'${page.data.permalink ? ` (via \`permalink\` value: '${page.data.permalink}')` : ""}, which is a target on the file system that does not include a file extension.
15283
15410
 
15284
15411
  You *probably* want to add a file extension to your permalink so that hosts will know how to correctly serve this file to web browsers. Without a file extension, this file may not be reliably deployed without additional hosting configuration (it won\u2019t have a mime type) and may also cause local development issues if you later attempt to write to a subdirectory of the same name.
@@ -15438,7 +15565,7 @@ var TemplateWriter = class {
15438
15565
  return this.#eleventyFiles?.passthroughGlobs;
15439
15566
  }
15440
15567
  getPathsWithVirtualTemplates(paths) {
15441
- if (this.config.virtualTemplates && (0, import_eleventy_utils25.isPlainObject)(this.config.virtualTemplates)) {
15568
+ if (this.config.virtualTemplates && (0, import_eleventy_utils26.isPlainObject)(this.config.virtualTemplates)) {
15442
15569
  let virtualTemplates = Object.keys(this.config.virtualTemplates).filter((path11) => {
15443
15570
  return this.dirs.isTemplateFile(this.dirs.getInputPath(path11));
15444
15571
  }).map((path11) => {
@@ -15548,7 +15675,7 @@ var TemplateWriter = class {
15548
15675
  tmpl.setRenderableOverride(false);
15549
15676
  }
15550
15677
  }
15551
- let secondOrderRelevantArray = this.config.uses.getTemplatesRelevantToTemplateList(Object.keys(secondOrderRelevantLookup)).map((entry) => import_eleventy_utils25.TemplatePath.addLeadingDotSlash(entry));
15678
+ let secondOrderRelevantArray = this.config.uses.getTemplatesRelevantToTemplateList(Object.keys(secondOrderRelevantLookup)).map((entry) => import_eleventy_utils26.TemplatePath.addLeadingDotSlash(entry));
15552
15679
  let secondOrderTemplates = Object.fromEntries(
15553
15680
  Object.entries(secondOrderRelevantArray).map(([index, value]) => [value, true])
15554
15681
  );
@@ -15767,7 +15894,7 @@ var TemplateWriter = class {
15767
15894
  var TemplateWriter_default = TemplateWriter;
15768
15895
 
15769
15896
  // ../../src/ExtensionMap.js
15770
- var import_eleventy_utils26 = __toESM(require_eleventy_utils(), 1);
15897
+ var import_eleventy_utils27 = __toESM(require_eleventy_utils(), 1);
15771
15898
  var import_TypeScriptFeatureTest2 = __toESM(require_TypeScriptFeatureTest_core(), 1);
15772
15899
  var ExtensionMap = class {
15773
15900
  #engineManager;
@@ -15895,7 +16022,7 @@ var ExtensionMap = class {
15895
16022
  extensions.add(key);
15896
16023
  }
15897
16024
  }
15898
- let dir = import_eleventy_utils26.TemplatePath.convertToRecursiveGlobSync(inputDir);
16025
+ let dir = import_eleventy_utils27.TemplatePath.convertToRecursiveGlobSync(inputDir);
15899
16026
  if (extensions.size === 1) {
15900
16027
  return [`${dir}/*.${Array.from(extensions)[0]}`];
15901
16028
  } else if (extensions.size > 1) {
@@ -16132,7 +16259,7 @@ var ErrorHandler = class _ErrorHandler {
16132
16259
 
16133
16260
  // ../../src/TemplateConfig.js
16134
16261
  var import_node_events2 = __toESM(require_events(), 1);
16135
- var import_eleventy_utils29 = __toESM(require_eleventy_utils(), 1);
16262
+ var import_eleventy_utils30 = __toESM(require_eleventy_utils(), 1);
16136
16263
 
16137
16264
  // ../../src/defaultConfigExtended.client.js
16138
16265
  function defaultConfigExtended_client_default(config) {
@@ -16232,7 +16359,7 @@ init_Require();
16232
16359
  init_BaseError();
16233
16360
 
16234
16361
  // ../../src/UserConfig.js
16235
- var import_eleventy_utils27 = __toESM(require_eleventy_utils(), 1);
16362
+ var import_eleventy_utils28 = __toESM(require_eleventy_utils(), 1);
16236
16363
  init_DebugLogUtil();
16237
16364
 
16238
16365
  // ../../src/Util/ResolvePlugin.client.js
@@ -16509,6 +16636,11 @@ var ConsoleLogger = class {
16509
16636
  forceLog(msg) {
16510
16637
  this.message(msg, void 0, void 0, true);
16511
16638
  }
16639
+ // Breaks through quiet mode (but not `overrideLogger(false)`), for warnings that a site’s behavior changed.
16640
+ /** @param {string} msg */
16641
+ forceWarn(msg) {
16642
+ this.message(msg, "warn", this.#colorFallbacks.warn, true);
16643
+ }
16512
16644
  /** @param {string} msg */
16513
16645
  info(msg) {
16514
16646
  this.message(msg, "log", this.#colorFallbacks.info);
@@ -16920,6 +17052,7 @@ var UserConfig = class {
16920
17052
  this.frontMatterParsingOptions = {};
16921
17053
  this.virtualTemplates = {};
16922
17054
  this.freezeReservedData = true;
17055
+ this.freezeGlobalData = true;
16923
17056
  this.customDateParsingCallbacks = /* @__PURE__ */ new Set();
16924
17057
  this.dateTimeZone = void 0;
16925
17058
  this.errorReporting = {};
@@ -17098,7 +17231,13 @@ var UserConfig = class {
17098
17231
  /** @this {any} */
17099
17232
  async function(...args) {
17100
17233
  let cb = args.pop();
17101
- let ret = await callback.call(this, ...args);
17234
+ let ret;
17235
+ try {
17236
+ ret = await callback.call(this, ...args);
17237
+ } catch (e) {
17238
+ cb(e);
17239
+ return;
17240
+ }
17102
17241
  cb(null, ret);
17103
17242
  }
17104
17243
  );
@@ -17300,7 +17439,7 @@ var UserConfig = class {
17300
17439
  return this.#executedPluginNames.has(pluginName) || this.plugins.some((entry) => this._getPluginName(entry.plugin) === pluginName);
17301
17440
  }
17302
17441
  addNunjucksLoader(options) {
17303
- if (!(0, import_eleventy_utils27.isPlainObject)(options)) {
17442
+ if (!(0, import_eleventy_utils28.isPlainObject)(options)) {
17304
17443
  throw new Error("addNunjucksLoader expects an object literal argument.");
17305
17444
  }
17306
17445
  this.nunjucks.loaders.push(options);
@@ -17379,7 +17518,7 @@ var UserConfig = class {
17379
17518
  "Invalid `mode` option for `addPassthroughCopy`. Received: '" + copyOptions.mode + "'"
17380
17519
  );
17381
17520
  }
17382
- if ((0, import_eleventy_utils27.isPlainObject)(fileOrDir)) {
17521
+ if ((0, import_eleventy_utils28.isPlainObject)(fileOrDir)) {
17383
17522
  throw new Error(
17384
17523
  "mode: 'html-relative' does not yet support passthrough copy objects (input -> output mapping). Use a string glob or an Array of string globs."
17385
17524
  );
@@ -17403,7 +17542,7 @@ var UserConfig = class {
17403
17542
  }
17404
17543
  // Default options for every `addPassthroughCopy()` call (per-call options win)
17405
17544
  setPassthroughCopyOptions(copyOptions = {}) {
17406
- if (!(0, import_eleventy_utils27.isPlainObject)(copyOptions)) {
17545
+ if (!(0, import_eleventy_utils28.isPlainObject)(copyOptions)) {
17407
17546
  throw new Error("`setPassthroughCopyOptions` expects an object of options.");
17408
17547
  }
17409
17548
  if (copyOptions.mode) {
@@ -17487,7 +17626,7 @@ var UserConfig = class {
17487
17626
  if (override) {
17488
17627
  this.serverOptions = options;
17489
17628
  } else {
17490
- this.serverOptions = (0, import_eleventy_utils27.DeepCopy)(this.serverOptions, options);
17629
+ this.serverOptions = (0, import_eleventy_utils28.DeepCopy)(this.serverOptions, options);
17491
17630
  }
17492
17631
  }
17493
17632
  setChokidarConfig(options = {}) {
@@ -17498,7 +17637,7 @@ var UserConfig = class {
17498
17637
  }
17499
17638
  // 3.0 change: this does a top level merge instead of reset.
17500
17639
  setFrontMatterParsingOptions(options = {}) {
17501
- (0, import_eleventy_utils27.DeepCopy)(this.frontMatterParsingOptions, options);
17640
+ (0, import_eleventy_utils28.DeepCopy)(this.frontMatterParsingOptions, options);
17502
17641
  }
17503
17642
  /* Internal method for CLI --quiet */
17504
17643
  _setQuietModeOverride(quietMode) {
@@ -17628,8 +17767,8 @@ var UserConfig = class {
17628
17767
  this.dataFileNames = { ...this.dataFileNames, ...normalized };
17629
17768
  }
17630
17769
  addTemplate(virtualInputPath, content, data) {
17631
- virtualInputPath = import_eleventy_utils27.TemplatePath.stripLeadingDotSlash(
17632
- import_eleventy_utils27.TemplatePath.standardizeFilePath(virtualInputPath)
17770
+ virtualInputPath = import_eleventy_utils28.TemplatePath.stripLeadingDotSlash(
17771
+ import_eleventy_utils28.TemplatePath.standardizeFilePath(virtualInputPath)
17633
17772
  );
17634
17773
  if (this.virtualTemplates[virtualInputPath]) {
17635
17774
  throw new Error(
@@ -17686,6 +17825,10 @@ var UserConfig = class {
17686
17825
  setFreezeReservedData(bool) {
17687
17826
  this.freezeReservedData = !!bool;
17688
17827
  }
17828
+ // Global data is frozen and shared across templates, opt out to give each template its own mutable copy.
17829
+ setFreezeGlobalData(bool) {
17830
+ this.freezeGlobalData = !!bool;
17831
+ }
17689
17832
  addDateParsing(callback) {
17690
17833
  if (typeof callback === "function") {
17691
17834
  this.customDateParsingCallbacks.add(callback);
@@ -17701,8 +17844,8 @@ var UserConfig = class {
17701
17844
  addGlobalData(name, data) {
17702
17845
  name = this.getNamespacedName(name);
17703
17846
  if (this.globalData[name]) {
17704
- if ((0, import_eleventy_utils27.isPlainObject)(this.globalData[name]) && (0, import_eleventy_utils27.isPlainObject)(data)) {
17705
- (0, import_eleventy_utils27.DeepCopy)(this.globalData[name], data);
17847
+ if ((0, import_eleventy_utils28.isPlainObject)(this.globalData[name]) && (0, import_eleventy_utils28.isPlainObject)(data)) {
17848
+ (0, import_eleventy_utils28.DeepCopy)(this.globalData[name], data);
17706
17849
  } else {
17707
17850
  debug17("Warning: overwriting a previous value set with addGlobalData(%o)", name);
17708
17851
  this.globalData[name] = data;
@@ -17754,6 +17897,7 @@ var UserConfig = class {
17754
17897
  * @param {boolean} [options.allowMissingExtensions] - Alias for `missingExtensions`
17755
17898
  * @param {"error"|"allow"} [options.caseCollisions]
17756
17899
  * @param {"error"|"warn"|"allow"} [options.tagCaseCollisions]
17900
+ * @param {"error"|"warn"|"allow"} [options.passthroughCaseMismatch]
17757
17901
  * @param {"end"|"immediate"} [options.logErrors] - CLI builds log errors after all other output by default
17758
17902
  */
17759
17903
  configureErrorReporting(options = {}) {
@@ -17893,6 +18037,7 @@ var UserConfig = class {
17893
18037
  virtualTemplates: this.virtualTemplates,
17894
18038
  // `directories` and `directoryAssignments` are merged manually prior to plugin processing
17895
18039
  freezeReservedData: this.freezeReservedData,
18040
+ freezeGlobalData: this.freezeGlobalData,
17896
18041
  customDateParsing: this.customDateParsingCallbacks,
17897
18042
  dateTimeZone: this.dateTimeZone,
17898
18043
  errorReporting: this.errorReporting,
@@ -17951,7 +18096,7 @@ var UserConfig = class {
17951
18096
  // ../../src/Util/ExistsCache.js
17952
18097
  init_shim_consume_fs();
17953
18098
  var import_node_path10 = __toESM(require_path(), 1);
17954
- var import_eleventy_utils28 = __toESM(require_eleventy_utils(), 1);
18099
+ var import_eleventy_utils29 = __toESM(require_eleventy_utils(), 1);
17955
18100
  var ExistsCache = class _ExistsCache {
17956
18101
  #exists = /* @__PURE__ */ new Map();
17957
18102
  #dirs = /* @__PURE__ */ new Map();
@@ -17974,12 +18119,12 @@ var ExistsCache = class _ExistsCache {
17974
18119
  return this.#exists.has(path11);
17975
18120
  }
17976
18121
  set(filePath, isExist) {
17977
- this.#exists.set(import_eleventy_utils28.TemplatePath.addLeadingDotSlash(filePath), Boolean(isExist));
18122
+ this.#exists.set(import_eleventy_utils29.TemplatePath.addLeadingDotSlash(filePath), Boolean(isExist));
17978
18123
  this.#deleteListings(filePath);
17979
18124
  }
17980
18125
  // Looked up again next time, e.g. a file added or deleted while watching
17981
18126
  delete(filePath) {
17982
- for (let key of [filePath, import_eleventy_utils28.TemplatePath.addLeadingDotSlash(filePath)]) {
18127
+ for (let key of [filePath, import_eleventy_utils29.TemplatePath.addLeadingDotSlash(filePath)]) {
17983
18128
  this.#exists.delete(key);
17984
18129
  this.#dirs.delete(key);
17985
18130
  }
@@ -18002,7 +18147,7 @@ var ExistsCache = class _ExistsCache {
18002
18147
  if (import_node_path10.default.isAbsolute(dir)) {
18003
18148
  dir = import_node_path10.default.relative(process.cwd(), dir) || ".";
18004
18149
  }
18005
- return import_eleventy_utils28.TemplatePath.standardizeFilePath(dir).replace(/\/$/, "") || ".";
18150
+ return import_eleventy_utils29.TemplatePath.standardizeFilePath(dir).replace(/\/$/, "") || ".";
18006
18151
  }
18007
18152
  // Seeded by directory walks that already happened (e.g. tinyglobby via FileSystemSearch)
18008
18153
  addListing(dir, entries) {
@@ -18049,7 +18194,7 @@ var ExistsCache = class _ExistsCache {
18049
18194
  if (!caseSensitive && matches?.length > 1) {
18050
18195
  if (!this.allowCaseCollisions) {
18051
18196
  throw new Error(
18052
- `File names that differ only by case can\u2019t be used, because case-insensitive file systems (macOS, Windows) keep only one: ${matches.map((entry) => JSON.stringify(import_eleventy_utils28.TemplatePath.join(dir, entry))).join(" and ")}. Use \`$config.configureErrorReporting({ allowCaseCollisions: true })\` to allow this on case-sensitive file systems (Linux).`
18197
+ `File names that differ only by case can\u2019t be used, because case-insensitive file systems (macOS, Windows) keep only one: ${matches.map((entry) => JSON.stringify(import_eleventy_utils29.TemplatePath.join(dir, entry))).join(" and ")}. Use \`$config.configureErrorReporting({ allowCaseCollisions: true })\` to allow this on case-sensitive file systems (Linux).`
18053
18198
  );
18054
18199
  }
18055
18200
  if (!listing.names.has(name)) {
@@ -18357,7 +18502,7 @@ var TemplateConfig = class {
18357
18502
  getLocalProjectConfigFiles() {
18358
18503
  let paths = this.projectConfigPaths;
18359
18504
  if (paths?.length > 0) {
18360
- return import_eleventy_utils29.TemplatePath.addLeadingDotSlashArray(paths.filter((path11) => Boolean(path11)));
18505
+ return import_eleventy_utils30.TemplatePath.addLeadingDotSlashArray(paths.filter((path11) => Boolean(path11)));
18361
18506
  }
18362
18507
  return [];
18363
18508
  }
@@ -18406,6 +18551,7 @@ var TemplateConfig = class {
18406
18551
  }
18407
18552
  this.config = await this.mergeConfig();
18408
18553
  this.hasConfigMerged = true;
18554
+ this.#existsCache.reset();
18409
18555
  }
18410
18556
  /**
18411
18557
  * Force a reload of the configuration object.
@@ -18579,8 +18725,8 @@ var TemplateConfig = class {
18579
18725
  */
18580
18726
  async mergeConfig() {
18581
18727
  let { localConfig, exportedConfig } = await this.requireLocalConfigFile();
18582
- if ((0, import_eleventy_utils29.isPlainObject)(exportedConfig)) {
18583
- localConfig = (0, import_eleventy_utils29.Merge)(localConfig || {}, exportedConfig);
18728
+ if ((0, import_eleventy_utils30.isPlainObject)(exportedConfig)) {
18729
+ localConfig = (0, import_eleventy_utils30.Merge)(localConfig || {}, exportedConfig);
18584
18730
  }
18585
18731
  if (this.directories) {
18586
18732
  if (this.userConfig.directoriesRelativeTo === ".") {
@@ -18617,7 +18763,7 @@ var TemplateConfig = class {
18617
18763
  if (this.userConfig?.markdownTemplateEngine !== void 0) {
18618
18764
  localConfig.markdownTemplateEngine = this.userConfig?.markdownTemplateEngine;
18619
18765
  }
18620
- let mergedConfig = (0, import_eleventy_utils29.Merge)({}, this.rootConfig, localConfig);
18766
+ let mergedConfig = (0, import_eleventy_utils30.Merge)({}, this.rootConfig, localConfig);
18621
18767
  mergedConfig.templateFormats = Object.freeze(this.templateFormats.getTemplateFormats());
18622
18768
  if (this.overrides.pathPrefix) {
18623
18769
  mergedConfig.pathPrefix = this.overrides.pathPrefix;
@@ -18644,7 +18790,7 @@ var TemplateConfig = class {
18644
18790
  );
18645
18791
  }
18646
18792
  debug19("Configuration overrides: %o", this.overrides);
18647
- (0, import_eleventy_utils29.Merge)(mergedConfig, eleventyConfigApiMergingObject, this.overrides);
18793
+ (0, import_eleventy_utils30.Merge)(mergedConfig, eleventyConfigApiMergingObject, this.overrides);
18648
18794
  debug19("Current configuration: %o", mergedConfig);
18649
18795
  let tagsKey = mergedConfig.keys?.tags;
18650
18796
  if (typeof tagsKey === "string" && tagsKey.includes(".")) {
@@ -18712,15 +18858,13 @@ function Pluralize_default(count, singleWord, pluralWord) {
18712
18858
  // ../../src/Util/ProjectDirectories.js
18713
18859
  init_shim_consume_fs();
18714
18860
  var import_node_path12 = __toESM(require_path(), 1);
18715
- var import_eleventy_utils30 = __toESM(require_eleventy_utils(), 1);
18861
+ var import_eleventy_utils31 = __toESM(require_eleventy_utils(), 1);
18716
18862
 
18717
18863
  // ../../src/Util/DirContains.js
18718
18864
  var import_node_path11 = __toESM(require_path(), 1);
18719
18865
  function DirContains_default(parentFolder, subFolder) {
18720
- if (import_node_path11.default.resolve(subFolder).startsWith(import_node_path11.default.resolve(parentFolder))) {
18721
- return true;
18722
- }
18723
- return false;
18866
+ let relative = import_node_path11.default.relative(import_node_path11.default.resolve(parentFolder), import_node_path11.default.resolve(subFolder));
18867
+ return relative !== ".." && !relative.startsWith(`..${import_node_path11.default.sep}`) && !import_node_path11.default.isAbsolute(relative);
18724
18868
  }
18725
18869
 
18726
18870
  // ../../src/Util/ProjectDirectories.js
@@ -18744,12 +18888,12 @@ var ProjectDirectories = class _ProjectDirectories {
18744
18888
  inputFile = void 0;
18745
18889
  inputGlob = void 0;
18746
18890
  static relativeToProjectRoot(fileOrDir) {
18747
- return this.normalizePath(import_eleventy_utils30.TemplatePath.relativePath(fileOrDir));
18891
+ return this.normalizePath(import_eleventy_utils31.TemplatePath.relativePath(fileOrDir));
18748
18892
  }
18749
18893
  // Add leading dot slash
18750
18894
  // Use forward slashes
18751
18895
  static normalizePath(fileOrDir) {
18752
- return import_eleventy_utils30.TemplatePath.standardizeFilePath(fileOrDir);
18896
+ return import_eleventy_utils31.TemplatePath.standardizeFilePath(fileOrDir);
18753
18897
  }
18754
18898
  // Must be a directory
18755
18899
  // Always include a trailing slash
@@ -18819,7 +18963,7 @@ var ProjectDirectories = class _ProjectDirectories {
18819
18963
  #resolve(name) {
18820
18964
  let dir = this.#raw[name] ?? _ProjectDirectories.defaults[name];
18821
18965
  let base = this.isRelativeToProjectRoot(name) ? "" : this.input;
18822
- this.#dirs[name] = _ProjectDirectories.normalizeDirectory(import_eleventy_utils30.TemplatePath.join(base, dir || ""));
18966
+ this.#dirs[name] = _ProjectDirectories.normalizeDirectory(import_eleventy_utils31.TemplatePath.join(base, dir || ""));
18823
18967
  }
18824
18968
  /* Relative to project root, must exist */
18825
18969
  #setInputRaw(dirOrFile, inputDir = void 0) {
@@ -18855,7 +18999,7 @@ var ProjectDirectories = class _ProjectDirectories {
18855
18999
  this.#dirs.input = _ProjectDirectories.normalizeDirectory(inputDir);
18856
19000
  } else {
18857
19001
  this.#dirs.input = _ProjectDirectories.normalizeDirectory(
18858
- import_eleventy_utils30.TemplatePath.getDirFromFilePath(dirOrFile)
19002
+ import_eleventy_utils31.TemplatePath.getDirFromFilePath(dirOrFile)
18859
19003
  // works with globs
18860
19004
  );
18861
19005
  }
@@ -18930,7 +19074,7 @@ var ProjectDirectories = class _ProjectDirectories {
18930
19074
  let rootRelative = _ProjectDirectories.normalizeDirectory(raw);
18931
19075
  if (rootRelative !== dir && !existsCache.exists(dir) && existsCache.isDirectory(rootRelative)) {
18932
19076
  let suggestion = _ProjectDirectories.addTrailingSlash(
18933
- import_eleventy_utils30.TemplatePath.standardizeFilePath(import_node_path12.default.relative(this.input, rootRelative))
19077
+ import_eleventy_utils31.TemplatePath.standardizeFilePath(import_node_path12.default.relative(this.input, rootRelative))
18934
19078
  );
18935
19079
  throw new Error(
18936
19080
  `The \`${name}\` directory is relative to the input directory: "${raw}" resolves to "${dir}", which doesn\u2019t exist. Did you mean "${suggestion}" (resolves to "${rootRelative}")?`
@@ -18965,33 +19109,33 @@ var ProjectDirectories = class _ProjectDirectories {
18965
19109
  }
18966
19110
  // for a hypothetical template file
18967
19111
  getInputPath(filePathRelativeToInputDir) {
18968
- return import_eleventy_utils30.TemplatePath.addLeadingDotSlash(
18969
- import_eleventy_utils30.TemplatePath.join(this.input, import_eleventy_utils30.TemplatePath.standardizeFilePath(filePathRelativeToInputDir))
19112
+ return import_eleventy_utils31.TemplatePath.addLeadingDotSlash(
19113
+ import_eleventy_utils31.TemplatePath.join(this.input, import_eleventy_utils31.TemplatePath.standardizeFilePath(filePathRelativeToInputDir))
18970
19114
  );
18971
19115
  }
18972
19116
  // Inverse of getInputPath
18973
19117
  // Removes input dir from path
18974
19118
  getInputPathRelativeToInputDirectory(filePathRelativeToInputDir) {
18975
19119
  if (!DirContains_default(this.input, filePathRelativeToInputDir)) {
18976
- return import_eleventy_utils30.TemplatePath.standardizeFilePath(
19120
+ return import_eleventy_utils31.TemplatePath.standardizeFilePath(
18977
19121
  import_node_path12.default.relative(this.input, filePathRelativeToInputDir)
18978
19122
  );
18979
19123
  }
18980
- let inputDir = import_eleventy_utils30.TemplatePath.addLeadingDotSlash(import_eleventy_utils30.TemplatePath.join(this.input));
18981
- return import_eleventy_utils30.TemplatePath.stripLeadingSubPath(filePathRelativeToInputDir, inputDir);
19124
+ let inputDir = import_eleventy_utils31.TemplatePath.addLeadingDotSlash(import_eleventy_utils31.TemplatePath.join(this.input));
19125
+ return import_eleventy_utils31.TemplatePath.stripLeadingSubPath(filePathRelativeToInputDir, inputDir);
18982
19126
  }
18983
19127
  // Removes output dir from path
18984
19128
  getOutputPathRelativeToOutputDirectory(filePathRelativeToRootDir) {
18985
- let filePath = import_eleventy_utils30.TemplatePath.addLeadingDotSlash(filePathRelativeToRootDir);
18986
- let outputDir = import_eleventy_utils30.TemplatePath.addLeadingDotSlash(import_eleventy_utils30.TemplatePath.join(this.output));
18987
- return "/" + import_eleventy_utils30.TemplatePath.stripLeadingSubPath(filePath, outputDir);
19129
+ let filePath = import_eleventy_utils31.TemplatePath.addLeadingDotSlash(filePathRelativeToRootDir);
19130
+ let outputDir = import_eleventy_utils31.TemplatePath.addLeadingDotSlash(import_eleventy_utils31.TemplatePath.join(this.output));
19131
+ return "/" + import_eleventy_utils31.TemplatePath.stripLeadingSubPath(filePath, outputDir);
18988
19132
  }
18989
19133
  // for a hypothetical Eleventy layout file
18990
19134
  getLayoutPath(filePathRelativeToLayoutDir) {
18991
- return import_eleventy_utils30.TemplatePath.addLeadingDotSlash(
18992
- import_eleventy_utils30.TemplatePath.join(
19135
+ return import_eleventy_utils31.TemplatePath.addLeadingDotSlash(
19136
+ import_eleventy_utils31.TemplatePath.join(
18993
19137
  this.layouts || this.includes,
18994
- import_eleventy_utils30.TemplatePath.standardizeFilePath(filePathRelativeToLayoutDir)
19138
+ import_eleventy_utils31.TemplatePath.standardizeFilePath(filePathRelativeToLayoutDir)
18995
19139
  )
18996
19140
  );
18997
19141
  }
@@ -19002,12 +19146,12 @@ var ProjectDirectories = class _ProjectDirectories {
19002
19146
  );
19003
19147
  }
19004
19148
  getProjectPath(filePath) {
19005
- return import_eleventy_utils30.TemplatePath.addLeadingDotSlash(
19006
- import_eleventy_utils30.TemplatePath.join(".", import_eleventy_utils30.TemplatePath.standardizeFilePath(filePath))
19149
+ return import_eleventy_utils31.TemplatePath.addLeadingDotSlash(
19150
+ import_eleventy_utils31.TemplatePath.join(".", import_eleventy_utils31.TemplatePath.standardizeFilePath(filePath))
19007
19151
  );
19008
19152
  }
19009
19153
  isFileInProjectFolder(filePath) {
19010
- return DirContains_default(import_eleventy_utils30.TemplatePath.getWorkingDir(), filePath);
19154
+ return DirContains_default(import_eleventy_utils31.TemplatePath.getWorkingDir(), filePath);
19011
19155
  }
19012
19156
  isFileInOutputFolder(filePath) {
19013
19157
  return DirContains_default(this.output, filePath);
@@ -19101,7 +19245,7 @@ var CoreMinimal = class _CoreMinimal {
19101
19245
  let output;
19102
19246
  let options;
19103
19247
  let eleventyConfig;
19104
- if ((0, import_eleventy_utils31.isPlainObject)(args[0])) {
19248
+ if ((0, import_eleventy_utils32.isPlainObject)(args[0])) {
19105
19249
  options = args[0] || {};
19106
19250
  input = options.input;
19107
19251
  output = options.output;
@@ -19386,9 +19530,9 @@ Verbose Output: ${this.verboseMode}`;
19386
19530
  runMode: this.runMode
19387
19531
  };
19388
19532
  if (this.#activeConfigurationPath) {
19389
- values.config = import_eleventy_utils31.TemplatePath.absolutePath(this.#activeConfigurationPath);
19533
+ values.config = import_eleventy_utils32.TemplatePath.absolutePath(this.#activeConfigurationPath);
19390
19534
  }
19391
- values.root = import_eleventy_utils31.TemplatePath.getWorkingDir();
19535
+ values.root = import_eleventy_utils32.TemplatePath.getWorkingDir();
19392
19536
  values.source = this.source;
19393
19537
  Object.defineProperty(values, "isServerless", {
19394
19538
  enumerable: false,
@@ -19527,7 +19671,7 @@ Verbose Output: ${this.verboseMode}`;
19527
19671
  } else {
19528
19672
  throw new Error("Invalid argument for setIncrementalFiles, needs string or Array");
19529
19673
  }
19530
- let normalized = files.map((p) => import_eleventy_utils31.TemplatePath.addLeadingDotSlash(p));
19674
+ let normalized = files.map((p) => import_eleventy_utils32.TemplatePath.addLeadingDotSlash(p));
19531
19675
  this.programmaticApiIncrementalFile = normalized;
19532
19676
  this.watchQueue?.setActiveQueue(normalized);
19533
19677
  }
@@ -19633,7 +19777,7 @@ Verbose Output: ${this.verboseMode}`;
19633
19777
  return false;
19634
19778
  }
19635
19779
  let node = uses.normalizeNode(path11);
19636
- return GlobalDependencyMap_default.isLayoutNode(uses.map, node) || GlobalDependencyMap_default.isDataFileNode(uses.map, node) || !isEligibleJavaScriptFileExtension(import_eleventy_utils31.TemplatePath.getExtension(path11)) || this.isJavaScriptDependencyOfTemplatesOnly(path11);
19780
+ return GlobalDependencyMap_default.isLayoutNode(uses.map, node) || GlobalDependencyMap_default.isDataFileNode(uses.map, node) || !isEligibleJavaScriptFileExtension(import_eleventy_utils32.TemplatePath.getExtension(path11)) || this.isJavaScriptDependencyOfTemplatesOnly(path11);
19637
19781
  }
19638
19782
  // A JavaScript module also used by data or configuration files needs a full build (unknown here)
19639
19783
  isJavaScriptDependencyOfTemplatesOnly() {
@@ -19783,7 +19927,7 @@ Open an issue: https://github.com/11ty/buildawesome/issues/new`);
19783
19927
  ret.push(
19784
19928
  `in ${chalk_client_default.bold(time.toFixed(2))} ${Pluralize_default(time.toFixed(2), "second", "seconds")}`
19785
19929
  );
19786
- let cfgStr = this.#activeConfigurationPath ? `, ${import_eleventy_utils31.TemplatePath.stripLeadingDotSlash(this.#activeConfigurationPath)}` : " no config file";
19930
+ let cfgStr = this.#activeConfigurationPath ? `, ${import_eleventy_utils32.TemplatePath.stripLeadingDotSlash(this.#activeConfigurationPath)}` : " no config file";
19787
19931
  if (time >= 1 && writeCount > 1) {
19788
19932
  ret.push(
19789
19933
  chalk_client_default.gray(`(${(time * 1e3 / writeCount).toFixed(1)}ms each, v${pkg2.version}${cfgStr})`)