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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- /*! Eleventy (Build Awesome) v4.0.0-alpha.8 (@11ty/client Bundle) */
1
+ /*! Eleventy (Build Awesome) v4.0.0-alpha.9 (@11ty/client Bundle) */
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1326,7 +1326,7 @@ var require_IsPlainObject = __commonJS({
1326
1326
  var require_Merge = __commonJS({
1327
1327
  "../../node_modules/@11ty/eleventy-utils/src/Merge.js"(exports, module) {
1328
1328
  "use strict";
1329
- var isPlainObject16 = require_IsPlainObject();
1329
+ var isPlainObject17 = require_IsPlainObject();
1330
1330
  var OVERRIDE_PREFIX = "override:";
1331
1331
  function cleanKey(key, prefix) {
1332
1332
  if (prefix && key.startsWith(prefix)) {
@@ -1336,18 +1336,18 @@ var require_Merge = __commonJS({
1336
1336
  }
1337
1337
  function getMergedItem(target, source, prefixes = {}) {
1338
1338
  let { override } = prefixes;
1339
- if (!target && isPlainObject16(source) && Object.isFrozen(source)) {
1339
+ if (!target && isPlainObject17(source) && Object.isFrozen(source)) {
1340
1340
  return source;
1341
1341
  }
1342
1342
  let sourcePlainObjectShortcut;
1343
- if (!target && isPlainObject16(source)) {
1343
+ if (!target && isPlainObject17(source)) {
1344
1344
  target = {};
1345
1345
  sourcePlainObjectShortcut = true;
1346
1346
  }
1347
1347
  if (Array.isArray(target) && Array.isArray(source)) {
1348
1348
  return target.concat(source);
1349
- } else if (isPlainObject16(target)) {
1350
- if (sourcePlainObjectShortcut || isPlainObject16(source)) {
1349
+ } else if (isPlainObject17(target)) {
1350
+ if (sourcePlainObjectShortcut || isPlainObject17(source)) {
1351
1351
  for (let key in source) {
1352
1352
  let overrideKey = cleanKey(key, override);
1353
1353
  target[overrideKey] = getMergedItem(target[key], source[key], prefixes);
@@ -1357,7 +1357,7 @@ var require_Merge = __commonJS({
1357
1357
  }
1358
1358
  return source;
1359
1359
  }
1360
- function DeepCopy4(targetObject, ...sources) {
1360
+ function DeepCopy5(targetObject, ...sources) {
1361
1361
  for (let source of sources) {
1362
1362
  if (!source) {
1363
1363
  continue;
@@ -1366,8 +1366,8 @@ var require_Merge = __commonJS({
1366
1366
  }
1367
1367
  return targetObject;
1368
1368
  }
1369
- function Merge6(target, ...sources) {
1370
- if (isPlainObject16(target)) {
1369
+ function Merge5(target, ...sources) {
1370
+ if (isPlainObject17(target)) {
1371
1371
  for (let key in target) {
1372
1372
  if (key.indexOf(OVERRIDE_PREFIX) === 0) {
1373
1373
  target[key.slice(OVERRIDE_PREFIX.length)] = target[key];
@@ -1385,8 +1385,8 @@ var require_Merge = __commonJS({
1385
1385
  }
1386
1386
  return target;
1387
1387
  }
1388
- module.exports = Merge6;
1389
- module.exports.DeepCopy = DeepCopy4;
1388
+ module.exports = Merge5;
1389
+ module.exports.DeepCopy = DeepCopy5;
1390
1390
  }
1391
1391
  });
1392
1392
 
@@ -1791,17 +1791,17 @@ var require_CreateHash = __commonJS({
1791
1791
  var require_eleventy_utils = __commonJS({
1792
1792
  "../../node_modules/@11ty/eleventy-utils/index.js"(exports, module) {
1793
1793
  var TemplatePath24 = require_TemplatePath();
1794
- var isPlainObject16 = require_IsPlainObject();
1795
- var Merge6 = require_Merge();
1794
+ var isPlainObject17 = require_IsPlainObject();
1795
+ var Merge5 = require_Merge();
1796
1796
  var DateCompare = require_DateCompare();
1797
- var { DeepCopy: DeepCopy4 } = Merge6;
1797
+ var { DeepCopy: DeepCopy5 } = Merge5;
1798
1798
  var { createHash, createHashHex, createHashSync, createHashHexSync } = require_CreateHash();
1799
1799
  var Buffer3 = require_Buffer();
1800
1800
  module.exports = {
1801
1801
  TemplatePath: TemplatePath24,
1802
- isPlainObject: isPlainObject16,
1803
- Merge: Merge6,
1804
- DeepCopy: DeepCopy4,
1802
+ isPlainObject: isPlainObject17,
1803
+ Merge: Merge5,
1804
+ DeepCopy: DeepCopy5,
1805
1805
  DateCompare,
1806
1806
  createHash,
1807
1807
  createHashHex,
@@ -1883,7 +1883,7 @@ var require_lodash_custom = __commonJS({
1883
1883
  var Map2 = getNative(root, "Map"), nativeCreate = getNative(Object, "create");
1884
1884
  var realNames = {};
1885
1885
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined2, symbolToString = symbolProto ? symbolProto.toString : undefined2;
1886
- function lodash11() {
1886
+ function lodash10() {
1887
1887
  }
1888
1888
  function Hash(entries) {
1889
1889
  var index = -1, length = entries == null ? 0 : entries.length;
@@ -2321,26 +2321,26 @@ var require_lodash_custom = __commonJS({
2321
2321
  function set(object, path9, value) {
2322
2322
  return object == null ? object : baseSet(object, path9, value);
2323
2323
  }
2324
- lodash11.chunk = chunk;
2325
- lodash11.memoize = memoize;
2326
- lodash11.set = set;
2327
- lodash11.eq = eq;
2328
- lodash11.get = get;
2329
- lodash11.isArray = isArray;
2330
- lodash11.isArrayLike = isArrayLike;
2331
- lodash11.isFunction = isFunction;
2332
- lodash11.isLength = isLength;
2333
- lodash11.isObject = isObject;
2334
- lodash11.isObjectLike = isObjectLike;
2335
- lodash11.isSymbol = isSymbol;
2336
- lodash11.toFinite = toFinite;
2337
- lodash11.toInteger = toInteger;
2338
- lodash11.toNumber = toNumber;
2339
- lodash11.toString = toString;
2340
- lodash11.VERSION = VERSION;
2324
+ lodash10.chunk = chunk;
2325
+ lodash10.memoize = memoize;
2326
+ lodash10.set = set;
2327
+ lodash10.eq = eq;
2328
+ lodash10.get = get;
2329
+ lodash10.isArray = isArray;
2330
+ lodash10.isArrayLike = isArrayLike;
2331
+ lodash10.isFunction = isFunction;
2332
+ lodash10.isLength = isLength;
2333
+ lodash10.isObject = isObject;
2334
+ lodash10.isObjectLike = isObjectLike;
2335
+ lodash10.isSymbol = isSymbol;
2336
+ lodash10.toFinite = toFinite;
2337
+ lodash10.toInteger = toInteger;
2338
+ lodash10.toNumber = toNumber;
2339
+ lodash10.toString = toString;
2340
+ lodash10.VERSION = VERSION;
2341
2341
  if (freeModule) {
2342
- (freeModule.exports = lodash11)._ = lodash11;
2343
- freeExports._ = lodash11;
2342
+ (freeModule.exports = lodash10)._ = lodash10;
2343
+ freeExports._ = lodash10;
2344
2344
  }
2345
2345
  }).call(exports);
2346
2346
  }
@@ -2661,7 +2661,7 @@ var init_DebugLogUtil = __esm({
2661
2661
  });
2662
2662
 
2663
2663
  // ../../src/Util/importer.client.js
2664
- function importer(relPath) {
2664
+ function importer() {
2665
2665
  throw new Error(
2666
2666
  "Dynamic import() is not supported in the `@11ty/client` bundle. Use the `@11ty/client/eleventy` bundle instead."
2667
2667
  );
@@ -3055,7 +3055,8 @@ var init_AsyncEventEmitter = __esm({
3055
3055
  "use strict";
3056
3056
  import_node_events = __toESM(require_events(), 1);
3057
3057
  AsyncEventEmitter = class extends import_node_events.EventEmitter {
3058
- #handlerMode = "parallel";
3058
+ // Breaking change v4.0.0-alpha.9, changed from "parallel". See #4293
3059
+ #handlerMode = "sequential";
3059
3060
  /* Order matters */
3060
3061
  #emitAliases = {
3061
3062
  "buildawesome.before": ["beforeBuild", "eleventy.before", "buildawesome.before"],
@@ -3338,7 +3339,7 @@ var init_package = __esm({
3338
3339
  "../../package.json"() {
3339
3340
  package_default = {
3340
3341
  name: "@11ty/eleventy",
3341
- version: "4.0.0-alpha.8",
3342
+ version: "4.0.0-alpha.9",
3342
3343
  description: "A simpler way to build awesome web sites.",
3343
3344
  publishConfig: {
3344
3345
  access: "public",
@@ -3404,7 +3405,7 @@ var init_package = __esm({
3404
3405
  "nano-staged": "nano-staged",
3405
3406
  prepare: "simple-git-hooks"
3406
3407
  },
3407
- author: "Zach Leatherman <zachleatherman@gmail.com> (https://zachleat.com/)",
3408
+ author: "Zach Leatherman (https://zachleat.com/)",
3408
3409
  repository: {
3409
3410
  type: "git",
3410
3411
  url: "git+https://github.com/11ty/buildawesome.git"
@@ -3444,22 +3445,22 @@ var init_package = __esm({
3444
3445
  "@iarna/toml": "^2.2.5",
3445
3446
  "@mdx-js/node-loader": "^3.1.1",
3446
3447
  "@stylistic/eslint-plugin": "^5.10.0",
3447
- "@types/node": "^25.9.3",
3448
- "@vue/server-renderer": "^3.5.38",
3448
+ "@types/node": "^26.1.0",
3449
+ "@vue/server-renderer": "^3.5.39",
3449
3450
  "@zachleat/noop": "^1.0.7",
3450
3451
  ava: "^8.0.1",
3451
3452
  c8: "^11.0.0",
3452
3453
  "cross-env": "^10.1.0",
3453
- eslint: "^10.5.0",
3454
+ eslint: "^10.6.0",
3454
3455
  "eslint-config-prettier": "^10.1.8",
3455
- globals: "^17.6.0",
3456
+ globals: "^17.7.0",
3456
3457
  "jsx-async-runtime": "^2.1.3",
3457
3458
  luxon: "^3.7.2",
3458
3459
  "markdown-it-abbr": "^2.0.0",
3459
3460
  "markdown-it-emoji": "^3.0.0",
3460
3461
  marked: "^18.0.5",
3461
3462
  "nano-staged": "^1.0.2",
3462
- prettier: "^3.8.4",
3463
+ prettier: "^3.9.4",
3463
3464
  pretty: "^2.0.0",
3464
3465
  react: "^19.2.7",
3465
3466
  "react-dom": "^19.2.7",
@@ -3467,7 +3468,7 @@ var init_package = __esm({
3467
3468
  "simple-git-hooks": "^2.13.1",
3468
3469
  tsx: "^4.22.4",
3469
3470
  typescript: "6.0.3",
3470
- vue: "^3.5.38",
3471
+ vue: "^3.5.39",
3471
3472
  zod: "^4.4.3",
3472
3473
  "zod-validation-error": "^5.0.0"
3473
3474
  },
@@ -3476,12 +3477,12 @@ var init_package = __esm({
3476
3477
  "@11ty/dependency-tree-esm": "^2.0.4",
3477
3478
  "@11ty/dependency-tree-typescript": "^1.0.0",
3478
3479
  "@11ty/eleventy-dev-server": "^3.0.0-alpha.10",
3479
- "@11ty/eleventy-plugin-bundle": "^3.0.7",
3480
+ "@11ty/eleventy-plugin-bundle": "^4.0.2",
3480
3481
  "@11ty/eleventy-utils": "^2.0.7",
3481
3482
  "@11ty/gray-matter": "^2.1.0",
3482
3483
  "@11ty/lodash-custom": "^4.17.21",
3483
3484
  "@11ty/node-version-check": "^1.0.1",
3484
- "@11ty/nunjucks": "^4.0.0-alpha.1",
3485
+ "@11ty/nunjucks": "^4.0.0-alpha.3",
3485
3486
  "@11ty/parse-date-strings": "^2.0.6",
3486
3487
  "@11ty/posthtml-urls": "^1.0.3",
3487
3488
  "@11ty/recursive-copy": "^5.0.2",
@@ -3493,7 +3494,7 @@ var init_package = __esm({
3493
3494
  "import-module-string": "^2.0.3",
3494
3495
  "iso-639-1": "^3.1.5",
3495
3496
  kleur: "^4.1.5",
3496
- liquidjs: "^10.27.0",
3497
+ liquidjs: "^10.27.1",
3497
3498
  "markdown-it": "^14.2.0",
3498
3499
  minimist: "^1.2.8",
3499
3500
  moo: "0.5.2",
@@ -3502,7 +3503,7 @@ var init_package = __esm({
3502
3503
  picomatch: "^4.0.4",
3503
3504
  posthtml: "^0.16.7",
3504
3505
  "posthtml-match-helper": "^2.0.3",
3505
- semver: "^7.8.4",
3506
+ semver: "^7.8.5",
3506
3507
  tinyglobby: "^0.2.17"
3507
3508
  }
3508
3509
  };
@@ -7231,7 +7232,7 @@ var init_Markdown_core = __esm({
7231
7232
  });
7232
7233
 
7233
7234
  // ../../src/Engines/TemplateEngine.js
7234
- var TemplateEngineConfigError, debug5, AMENDED_INSTANCES, TemplateEngine;
7235
+ var TemplateEngineConfigError, debug4, AMENDED_INSTANCES, TemplateEngine;
7235
7236
  var init_TemplateEngine = __esm({
7236
7237
  "../../src/Engines/TemplateEngine.js"() {
7237
7238
  "use strict";
@@ -7239,7 +7240,7 @@ var init_TemplateEngine = __esm({
7239
7240
  init_BaseError();
7240
7241
  TemplateEngineConfigError = class extends BaseError {
7241
7242
  };
7242
- debug5 = createDebug3("TemplateEngine");
7243
+ debug4 = createDebug3("TemplateEngine");
7243
7244
  AMENDED_INSTANCES = /* @__PURE__ */ new Set();
7244
7245
  TemplateEngine = class {
7245
7246
  #extensionMap;
@@ -7324,7 +7325,7 @@ var init_TemplateEngine = __esm({
7324
7325
  if (isOverrideViaSetLibrary) {
7325
7326
  AMENDED_INSTANCES.add(engineLib);
7326
7327
  }
7327
- debug5(
7328
+ debug4(
7328
7329
  "Running amendLibrary for %o (number of amendments: %o)",
7329
7330
  this.name,
7330
7331
  this.config.libraryAmendments[this.name]?.length
@@ -8395,7 +8396,7 @@ var Buffer2 = class {
8395
8396
  window.Buffer = globalThis.Buffer = Buffer2;
8396
8397
 
8397
8398
  // ../../src/CoreMinimal.js
8398
- var import_eleventy_utils30 = __toESM(require_eleventy_utils(), 1);
8399
+ var import_eleventy_utils31 = __toESM(require_eleventy_utils(), 1);
8399
8400
 
8400
8401
  // ../../src/Adapters/Packages/chalk.client.js
8401
8402
  function noop(arg) {
@@ -8410,7 +8411,7 @@ var chalk_client_default = {
8410
8411
  };
8411
8412
 
8412
8413
  // ../../src/Data/TemplateData.js
8413
- var import_node_path4 = __toESM(require_path(), 1);
8414
+ var import_node_path2 = __toESM(require_path(), 1);
8414
8415
  var import_lodash_custom3 = __toESM(require_lodash_custom(), 1);
8415
8416
  var import_eleventy_utils6 = __toESM(require_eleventy_utils(), 1);
8416
8417
 
@@ -8648,498 +8649,190 @@ function coerce2(version) {
8648
8649
  return s.split("-")[0];
8649
8650
  }
8650
8651
 
8651
- // ../../src/Util/ProjectDirectories.js
8652
- init_shim_consume_fs();
8653
- var import_node_path3 = __toESM(require_path(), 1);
8654
- var import_eleventy_utils5 = __toESM(require_eleventy_utils(), 1);
8655
-
8656
- // ../../src/Util/GlobMatcher.client.js
8657
- function isGlobMatch() {
8658
- throw new Error(
8659
- "Glob matching (e.g. getFilteredByGlob collection API method) is not supported in the `@11ty/client` bundle. Use the `@11ty/client/eleventy` bundle instead."
8660
- );
8661
- }
8662
- function isDynamicPattern(pattern) {
8663
- return false;
8664
- }
8652
+ // ../../src/Data/TemplateData.js
8653
+ var import_TypeScriptFeatureTest = __toESM(require_TypeScriptFeatureTest_core(), 1);
8665
8654
 
8666
- // ../../src/Util/DirContains.js
8667
- var import_node_path2 = __toESM(require_path(), 1);
8668
- function DirContains_default(parentFolder, subFolder) {
8669
- if (import_node_path2.default.resolve(subFolder).startsWith(import_node_path2.default.resolve(parentFolder))) {
8670
- return true;
8655
+ // ../../src/Data/ResolveConfigurationData.js
8656
+ var import_lodash_custom2 = __toESM(require_lodash_custom(), 1);
8657
+ var import_eleventy_utils5 = __toESM(require_eleventy_utils(), 1);
8658
+ var { get: lodashGet } = import_lodash_custom2.default;
8659
+ var ResolveConfigurationData = class _ResolveConfigurationData {
8660
+ static ELIGIBLE_PROPS = /* @__PURE__ */ new Set([
8661
+ // If these props are overridden by a user’s configuration, they will not be aliased (which is ok)
8662
+ "buildawesomeComputed",
8663
+ "buildawesomeDataSchema",
8664
+ "buildawesomeExcludeFromCollections",
8665
+ "buildawesomeImport"
8666
+ ]);
8667
+ static BUILDAWESOME_PREFIX = "buildawesome";
8668
+ static ELEVENTY_PREFIX = "eleventy";
8669
+ // buildawesomeDataSchema becomes eleventyDataSchema
8670
+ // eleventyDataSchema returned undefined
8671
+ static getAlternatePropertyName(propertyName) {
8672
+ if (typeof propertyName === "string" && this.ELIGIBLE_PROPS.has(propertyName)) {
8673
+ let prefixRemoved = propertyName.slice(_ResolveConfigurationData.BUILDAWESOME_PREFIX.length);
8674
+ return this.ELEVENTY_PREFIX + prefixRemoved;
8675
+ }
8671
8676
  }
8672
- return false;
8673
- }
8677
+ static getEligibleLocations(original) {
8678
+ let eligibleLocations = [original];
8679
+ let alternate = this.getAlternatePropertyName(original);
8680
+ if (alternate !== void 0 && alternate !== original) {
8681
+ eligibleLocations.push(alternate);
8682
+ }
8683
+ return eligibleLocations;
8684
+ }
8685
+ static getValue(data, location) {
8686
+ let eligible = this.getEligibleLocations(location);
8687
+ let merging;
8688
+ for (let loc of eligible) {
8689
+ let val = lodashGet(data, loc, void 0);
8690
+ if (val === void 0) {
8691
+ continue;
8692
+ }
8693
+ if ((0, import_eleventy_utils5.isPlainObject)(val)) {
8694
+ merging = (0, import_eleventy_utils5.DeepCopy)(merging || {}, val);
8695
+ } else if (Array.isArray(val)) {
8696
+ merging = (0, import_eleventy_utils5.DeepCopy)(merging || [], val);
8697
+ } else if (merging === void 0) {
8698
+ return val;
8699
+ }
8700
+ }
8701
+ return merging;
8702
+ }
8703
+ };
8674
8704
 
8675
- // ../../src/Util/ProjectDirectories.js
8676
- var ProjectDirectories = class _ProjectDirectories {
8677
- static defaults = {
8678
- input: "./",
8679
- data: "./_data/",
8680
- // Relative to input directory
8681
- includes: "./_includes/",
8682
- // Relative to input directory
8683
- layouts: "./_layouts/",
8684
- // Relative to input directory
8685
- output: "./_site/"
8686
- };
8687
- // no updates allowed, input/output set via CLI
8688
- #frozen = false;
8689
- #raw = {};
8690
- #dirs = {};
8691
- inputFile = void 0;
8692
- inputGlob = void 0;
8693
- static relativeToProjectRoot(fileOrDir) {
8694
- return this.normalizePath(import_eleventy_utils5.TemplatePath.relativePath(fileOrDir));
8705
+ // ../../src/Data/TemplateData.js
8706
+ init_DebugLogUtil();
8707
+ var { set: lodashSet2, get: lodashGet2 } = import_lodash_custom3.default;
8708
+ var debugWarn = createDebug3("Warnings");
8709
+ var debug3 = createDebug3("TemplateData");
8710
+ var TemplateDataParseError = class extends BaseError {
8711
+ };
8712
+ var TemplateData = class _TemplateData {
8713
+ // Would be nice if the priorities here matched (see also FilePathUtil used by config file paths)
8714
+ // (json not included) priority is reverse order
8715
+ #eligibleJavaScriptExtensions = [
8716
+ ...(0, import_TypeScriptFeatureTest.isTypeScriptSupported)() ? ["ts", "cts", "mts"] : [],
8717
+ "js",
8718
+ "cjs",
8719
+ "mjs"
8720
+ ];
8721
+ // in order of priority
8722
+ #globalDataOrderedExtensions = [
8723
+ "json",
8724
+ "mjs",
8725
+ "cjs",
8726
+ "js",
8727
+ ...(0, import_TypeScriptFeatureTest.isTypeScriptSupported)() ? ["mts", "cts", "ts"] : []
8728
+ ];
8729
+ #rawImports;
8730
+ #globalData;
8731
+ #templateDirectoryData = {};
8732
+ constructor(templateConfig) {
8733
+ if (!templateConfig || templateConfig.constructor.name !== "TemplateConfig") {
8734
+ throw new Error(
8735
+ "Internal error: Missing `templateConfig` or was not an instance of `TemplateConfig`."
8736
+ );
8737
+ }
8738
+ this.templateConfig = templateConfig;
8739
+ this.config = this.templateConfig.getConfig();
8740
+ this.benchmarks = {
8741
+ data: this.config.benchmarkManager.get("Data"),
8742
+ aggregate: this.config.benchmarkManager.get("Aggregate")
8743
+ };
8744
+ this.isEsm = false;
8745
+ this.initialGlobalData = new ConfigurationGlobalData(this.templateConfig);
8695
8746
  }
8696
- // Add leading dot slash
8697
- // Use forward slashes
8698
- static normalizePath(fileOrDir) {
8699
- return import_eleventy_utils5.TemplatePath.standardizeFilePath(fileOrDir);
8747
+ get dirs() {
8748
+ return this.templateConfig.directories;
8700
8749
  }
8701
- // Must be a directory
8702
- // Always include a trailing slash
8703
- static normalizeDirectory(dir) {
8704
- return this.addTrailingSlash(this.normalizePath(dir));
8750
+ get inputDir() {
8751
+ return this.dirs.input;
8705
8752
  }
8706
- normalizeDirectoryPathRelativeToInputDirectory(filePath) {
8707
- return _ProjectDirectories.normalizeDirectory(import_node_path3.default.join(this.input, filePath));
8753
+ // if this was set but `falsy` we would fallback to inputDir
8754
+ get dataDir() {
8755
+ return this.dirs.data;
8708
8756
  }
8709
- static addTrailingSlash(path9) {
8710
- if (path9.slice(-1) === "/") {
8711
- return path9;
8712
- }
8713
- return path9 + "/";
8757
+ get absoluteDataDir() {
8758
+ return import_eleventy_utils6.TemplatePath.absolutePath(this.dataDir);
8714
8759
  }
8715
- // If input/output are set via CLI, they take precedence over all other configuration values.
8716
- freeze() {
8717
- this.#frozen = true;
8760
+ // This was async in 2.0 and prior but doesn’t need to be any more.
8761
+ getInputDir() {
8762
+ return this.dirs.input;
8718
8763
  }
8719
- setViaConfigObject(configDirs = {}) {
8720
- let inputChanged = false;
8721
- if (configDirs.input && _ProjectDirectories.normalizeDirectory(configDirs.input) !== this.input) {
8722
- this.#setInputRaw(configDirs.input);
8723
- inputChanged = true;
8724
- }
8725
- if (configDirs.output !== void 0) {
8726
- if (_ProjectDirectories.normalizeDirectory(configDirs.output) !== this.output) {
8727
- this.setOutput(configDirs.output);
8728
- }
8764
+ getDataDir() {
8765
+ return this.dataDir;
8766
+ }
8767
+ exists(pathname) {
8768
+ return this.templateConfig.existsCache.exists(pathname);
8769
+ }
8770
+ setFileSystemSearch(fileSystemSearch) {
8771
+ this.fileSystemSearch = fileSystemSearch;
8772
+ }
8773
+ setProjectUsingEsm(isEsmProject) {
8774
+ this.isEsm = !!isEsmProject;
8775
+ }
8776
+ get extensionMap() {
8777
+ if (!this._extensionMap) {
8778
+ throw new Error("Internal error: missing `extensionMap` in TemplateData.");
8729
8779
  }
8730
- if (configDirs.data !== void 0) {
8731
- if (inputChanged || this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.data || "") !== this.data) {
8732
- this.setData(configDirs.data);
8733
- }
8780
+ return this._extensionMap;
8781
+ }
8782
+ set extensionMap(map) {
8783
+ this._extensionMap = map;
8784
+ }
8785
+ get environmentVariables() {
8786
+ return this._env;
8787
+ }
8788
+ set environmentVariables(env) {
8789
+ this._env = env;
8790
+ }
8791
+ /* Used by tests */
8792
+ _setConfig(config) {
8793
+ this.config = config;
8794
+ }
8795
+ getRawImports() {
8796
+ if (!this.config.keys.package) {
8797
+ debug3(
8798
+ "Opted-out of package.json assignment for global data with falsy value for `keys.package` configuration."
8799
+ );
8800
+ return;
8734
8801
  }
8735
- if (configDirs.includes !== void 0) {
8736
- if (inputChanged || this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.includes || "") !== this.includes) {
8737
- this.setIncludes(configDirs.includes);
8738
- }
8802
+ if (this.#rawImports) {
8803
+ return this.#rawImports;
8739
8804
  }
8740
- if (configDirs.layouts !== void 0) {
8741
- if (inputChanged || this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.layouts || "") !== this.layouts) {
8742
- this.setLayouts(configDirs.layouts);
8743
- }
8805
+ let projectPackageJsonPath = getWorkingProjectPackageJsonPath();
8806
+ let packageJson = {};
8807
+ if (projectPackageJsonPath) {
8808
+ packageJson = importJsonSync(projectPackageJsonPath);
8744
8809
  }
8745
- if (inputChanged) {
8746
- this.updateInputDependencies();
8810
+ this.#rawImports = {
8811
+ [this.config.keys.package]: packageJson
8812
+ };
8813
+ if (this.config.freezeReservedData) {
8814
+ DeepFreeze(this.#rawImports);
8747
8815
  }
8816
+ return this.#rawImports;
8748
8817
  }
8749
- updateInputDependencies() {
8750
- this.setData(this.#raw.data ?? _ProjectDirectories.defaults.data);
8751
- this.setIncludes(this.#raw.includes ?? _ProjectDirectories.defaults.includes);
8752
- if (this.#raw.layouts !== void 0) {
8753
- this.setLayouts(this.#raw.layouts ?? _ProjectDirectories.defaults.layouts);
8754
- }
8818
+ clearData() {
8819
+ this.#globalData = null;
8820
+ this.configApiGlobalData = null;
8821
+ this.#templateDirectoryData = {};
8755
8822
  }
8756
- /* Relative to project root, must exist */
8757
- #setInputRaw(dirOrFile, inputDir = void 0) {
8758
- if (this.#frozen && this.#raw.input !== void 0) {
8759
- return;
8760
- }
8761
- this.#raw.input = dirOrFile;
8762
- if (!dirOrFile) {
8763
- return;
8823
+ _getGlobalDataGlobByExtension(extension) {
8824
+ return TemplateGlob_default.normalizePath(this.dataDir, `/**/*.${extension}`);
8825
+ }
8826
+ // This is a backwards compatibility helper with the old `jsDataFileSuffix` configuration API
8827
+ getConfigurationDataFileSuffixes() {
8828
+ if (Array.isArray(this.config.dataFileSuffixes)) {
8829
+ return this.config.dataFileSuffixes;
8764
8830
  }
8765
- if (import_node_path3.default.isAbsolute(dirOrFile)) {
8766
- dirOrFile = import_node_path3.default.relative(".", dirOrFile);
8767
- }
8768
- let inputExists = existsSync(dirOrFile);
8769
- let inputExistsAndIsDirectory = inputExists && statSync(dirOrFile).isDirectory();
8770
- if (inputExistsAndIsDirectory) {
8771
- this.#dirs.input = _ProjectDirectories.normalizeDirectory(dirOrFile);
8772
- } else {
8773
- if (inputExists) {
8774
- this.inputFile = _ProjectDirectories.normalizePath(dirOrFile);
8775
- } else {
8776
- if (!isDynamicPattern(dirOrFile)) {
8777
- throw new Error(
8778
- `The "${dirOrFile}" \`input\` parameter (directory or file path) must exist on the file system (unless detected as a glob by the \`tinyglobby\` package)`
8779
- );
8780
- }
8781
- this.inputGlob = dirOrFile;
8782
- }
8783
- if (inputDir) {
8784
- if (!existsSync(inputDir)) {
8785
- throw new Error("Directory must exist (via inputDir option to Eleventy constructor).");
8786
- }
8787
- this.#dirs.input = _ProjectDirectories.normalizeDirectory(inputDir);
8788
- } else {
8789
- this.#dirs.input = _ProjectDirectories.normalizeDirectory(
8790
- import_eleventy_utils5.TemplatePath.getDirFromFilePath(dirOrFile)
8791
- // works with globs
8792
- );
8793
- }
8794
- }
8795
- }
8796
- setInput(dirOrFile, inputDir = void 0) {
8797
- this.#setInputRaw(dirOrFile, inputDir);
8798
- this.updateInputDependencies();
8799
- }
8800
- /* Relative to input dir */
8801
- setIncludes(dir) {
8802
- if (dir !== void 0) {
8803
- this.#raw.includes = dir;
8804
- this.#dirs.includes = _ProjectDirectories.normalizeDirectory(
8805
- import_eleventy_utils5.TemplatePath.join(this.input, dir || "")
8806
- );
8807
- }
8808
- }
8809
- /* Relative to input dir */
8810
- /* Optional */
8811
- setLayouts(dir) {
8812
- if (dir !== void 0) {
8813
- this.#raw.layouts = dir;
8814
- this.#dirs.layouts = _ProjectDirectories.normalizeDirectory(
8815
- import_eleventy_utils5.TemplatePath.join(this.input, dir || "")
8816
- );
8817
- }
8818
- }
8819
- /* Relative to input dir */
8820
- setData(dir) {
8821
- if (dir !== void 0) {
8822
- this.#raw.data = dir;
8823
- this.#dirs.data = _ProjectDirectories.normalizeDirectory(
8824
- import_eleventy_utils5.TemplatePath.join(this.input, dir || "")
8825
- );
8826
- }
8827
- }
8828
- /* Relative to project root */
8829
- setOutput(dir) {
8830
- if (this.#frozen && this.#raw.output !== void 0) {
8831
- return;
8832
- }
8833
- if (dir !== void 0) {
8834
- this.#raw.output = dir;
8835
- if (import_node_path3.default.isAbsolute(dir)) {
8836
- dir = import_node_path3.default.relative(".", dir);
8837
- }
8838
- this.#dirs.output = _ProjectDirectories.normalizeDirectory(dir || "");
8839
- }
8840
- }
8841
- get input() {
8842
- return this.#dirs.input || _ProjectDirectories.defaults.input;
8843
- }
8844
- get data() {
8845
- return this.#dirs.data || _ProjectDirectories.defaults.data;
8846
- }
8847
- get includes() {
8848
- return this.#dirs.includes || _ProjectDirectories.defaults.includes;
8849
- }
8850
- get layouts() {
8851
- return this.#dirs.layouts;
8852
- }
8853
- get output() {
8854
- return this.#dirs.output || _ProjectDirectories.defaults.output;
8855
- }
8856
- isTemplateFile(filePath) {
8857
- let inputPath = this.getInputPath(filePath);
8858
- if (this.layouts && inputPath.startsWith(this.layouts)) {
8859
- return false;
8860
- }
8861
- if (this.includes && this.includes !== this.input) {
8862
- if (inputPath.startsWith(this.includes)) {
8863
- return false;
8864
- }
8865
- }
8866
- return inputPath.startsWith(this.input);
8867
- }
8868
- // for a hypothetical template file
8869
- getInputPath(filePathRelativeToInputDir) {
8870
- return import_eleventy_utils5.TemplatePath.addLeadingDotSlash(
8871
- import_eleventy_utils5.TemplatePath.join(this.input, import_eleventy_utils5.TemplatePath.standardizeFilePath(filePathRelativeToInputDir))
8872
- );
8873
- }
8874
- // Inverse of getInputPath
8875
- // Removes input dir from path
8876
- getInputPathRelativeToInputDirectory(filePathRelativeToInputDir) {
8877
- let inputDir = import_eleventy_utils5.TemplatePath.addLeadingDotSlash(import_eleventy_utils5.TemplatePath.join(this.input));
8878
- return import_eleventy_utils5.TemplatePath.stripLeadingSubPath(filePathRelativeToInputDir, inputDir);
8879
- }
8880
- // Removes output dir from path
8881
- getOutputPathRelativeToOutputDirectory(filePathRelativeToRootDir) {
8882
- let filePath = import_eleventy_utils5.TemplatePath.addLeadingDotSlash(filePathRelativeToRootDir);
8883
- let outputDir = import_eleventy_utils5.TemplatePath.addLeadingDotSlash(import_eleventy_utils5.TemplatePath.join(this.output));
8884
- return "/" + import_eleventy_utils5.TemplatePath.stripLeadingSubPath(filePath, outputDir);
8885
- }
8886
- // for a hypothetical Eleventy layout file
8887
- getLayoutPath(filePathRelativeToLayoutDir) {
8888
- return import_eleventy_utils5.TemplatePath.addLeadingDotSlash(
8889
- import_eleventy_utils5.TemplatePath.join(
8890
- this.layouts || this.includes,
8891
- import_eleventy_utils5.TemplatePath.standardizeFilePath(filePathRelativeToLayoutDir)
8892
- )
8893
- );
8894
- }
8895
- // Removes layout dir from path
8896
- getLayoutPathRelativeToInputDirectory(filePathRelativeToLayoutDir) {
8897
- let layoutPath = this.getLayoutPath(filePathRelativeToLayoutDir);
8898
- let inputDir = import_eleventy_utils5.TemplatePath.addLeadingDotSlash(import_eleventy_utils5.TemplatePath.join(this.input));
8899
- return import_eleventy_utils5.TemplatePath.stripLeadingSubPath(layoutPath, inputDir);
8900
- }
8901
- getProjectPath(filePath) {
8902
- return import_eleventy_utils5.TemplatePath.addLeadingDotSlash(
8903
- import_eleventy_utils5.TemplatePath.join(".", import_eleventy_utils5.TemplatePath.standardizeFilePath(filePath))
8904
- );
8905
- }
8906
- isFileInProjectFolder(filePath) {
8907
- return DirContains_default(import_eleventy_utils5.TemplatePath.getWorkingDir(), filePath);
8908
- }
8909
- isFileInOutputFolder(filePath) {
8910
- return DirContains_default(this.output, filePath);
8911
- }
8912
- static getRelativeTo(targetPath, cwd) {
8913
- return import_node_path3.default.relative(cwd, import_node_path3.default.join(import_node_path3.default.resolve("."), targetPath));
8914
- }
8915
- // Access the data without being able to set the data.
8916
- getUserspaceInstance() {
8917
- let d = this;
8918
- return {
8919
- get input() {
8920
- return d.input;
8921
- },
8922
- get inputFile() {
8923
- return d.inputFile;
8924
- },
8925
- get inputGlob() {
8926
- return d.inputGlob;
8927
- },
8928
- get data() {
8929
- return d.data;
8930
- },
8931
- get includes() {
8932
- return d.includes;
8933
- },
8934
- get layouts() {
8935
- return d.layouts;
8936
- },
8937
- get output() {
8938
- return d.output;
8939
- }
8940
- };
8941
- }
8942
- toString() {
8943
- return {
8944
- input: this.input,
8945
- inputFile: this.inputFile,
8946
- inputGlob: this.inputGlob,
8947
- data: this.data,
8948
- includes: this.includes,
8949
- layouts: this.layouts,
8950
- output: this.output
8951
- };
8952
- }
8953
- };
8954
-
8955
- // ../../src/Data/TemplateData.js
8956
- var import_TypeScriptFeatureTest = __toESM(require_TypeScriptFeatureTest_core(), 1);
8957
-
8958
- // ../../src/Data/ResolveConfigurationData.js
8959
- var import_lodash_custom2 = __toESM(require_lodash_custom(), 1);
8960
- var { set: lodashSet2, get: lodashGet } = import_lodash_custom2.default;
8961
- var ResolveConfigurationData = class _ResolveConfigurationData {
8962
- static ELIGIBLE_PROPS = /* @__PURE__ */ new Set([
8963
- "buildawesomeComputed",
8964
- "buildawesomeDataSchema",
8965
- "buildawesomeExcludeFromCollections",
8966
- "buildawesomeImport"
8967
- ]);
8968
- static BUILDAWESOME_PREFIX = "buildawesome";
8969
- static ELEVENTY_PREFIX = "eleventy";
8970
- // buildawesomeDataSchema becomes eleventyDataSchema
8971
- // eleventyDataSchema returned undefined
8972
- static getAlternatePropertyName(propertyName) {
8973
- if (typeof propertyName === "string" && this.ELIGIBLE_PROPS.has(propertyName)) {
8974
- let prefixRemoved = propertyName.slice(_ResolveConfigurationData.BUILDAWESOME_PREFIX.length);
8975
- return this.ELEVENTY_PREFIX + prefixRemoved;
8976
- }
8977
- }
8978
- static getEligibleLocations(original) {
8979
- let eligibleLocations = [original];
8980
- let alternate = this.getAlternatePropertyName(original);
8981
- if (alternate !== void 0 && alternate !== original) {
8982
- eligibleLocations.push(alternate);
8983
- }
8984
- return eligibleLocations;
8985
- }
8986
- static resolve(data, location) {
8987
- let eligible = this.getEligibleLocations(location);
8988
- for (let loc of eligible) {
8989
- let val = lodashGet(data, loc, void 0);
8990
- if (val !== void 0) {
8991
- return {
8992
- location: loc,
8993
- value: val
8994
- };
8995
- }
8996
- }
8997
- return {
8998
- location: void 0
8999
- };
9000
- }
9001
- static getValue(data, location) {
9002
- let eligible = this.getEligibleLocations(location);
9003
- for (let loc of eligible) {
9004
- let val = lodashGet(data, loc, void 0);
9005
- if (val !== void 0) {
9006
- return val;
9007
- }
9008
- }
9009
- }
9010
- };
9011
-
9012
- // ../../src/Data/TemplateData.js
9013
- init_DebugLogUtil();
9014
- var { set: lodashSet3, get: lodashGet2 } = import_lodash_custom3.default;
9015
- var debugWarn = createDebug3("Warnings");
9016
- var debug3 = createDebug3("TemplateData");
9017
- var TemplateDataParseError = class extends BaseError {
9018
- };
9019
- var TemplateData = class _TemplateData {
9020
- // Would be nice if the priorities here matched (see also FilePathUtil used by config file paths)
9021
- // (json not included) priority is reverse order
9022
- #eligibleJavaScriptExtensions = [
9023
- ...(0, import_TypeScriptFeatureTest.isTypeScriptSupported)() ? ["ts", "cts", "mts"] : [],
9024
- "js",
9025
- "cjs",
9026
- "mjs"
9027
- ];
9028
- // in order of priority
9029
- #globalDataOrderedExtensions = [
9030
- "json",
9031
- "mjs",
9032
- "cjs",
9033
- "js",
9034
- ...(0, import_TypeScriptFeatureTest.isTypeScriptSupported)() ? ["mts", "cts", "ts"] : []
9035
- ];
9036
- #rawImports;
9037
- #globalData;
9038
- #templateDirectoryData = {};
9039
- constructor(templateConfig) {
9040
- if (!templateConfig || templateConfig.constructor.name !== "TemplateConfig") {
9041
- throw new Error(
9042
- "Internal error: Missing `templateConfig` or was not an instance of `TemplateConfig`."
9043
- );
9044
- }
9045
- this.templateConfig = templateConfig;
9046
- this.config = this.templateConfig.getConfig();
9047
- this.benchmarks = {
9048
- data: this.config.benchmarkManager.get("Data"),
9049
- aggregate: this.config.benchmarkManager.get("Aggregate")
9050
- };
9051
- this.isEsm = false;
9052
- this.initialGlobalData = new ConfigurationGlobalData(this.templateConfig);
9053
- }
9054
- get dirs() {
9055
- return this.templateConfig.directories;
9056
- }
9057
- get inputDir() {
9058
- return this.dirs.input;
9059
- }
9060
- // if this was set but `falsy` we would fallback to inputDir
9061
- get dataDir() {
9062
- return this.dirs.data;
9063
- }
9064
- get absoluteDataDir() {
9065
- return import_eleventy_utils6.TemplatePath.absolutePath(this.dataDir);
9066
- }
9067
- // This was async in 2.0 and prior but doesn’t need to be any more.
9068
- getInputDir() {
9069
- return this.dirs.input;
9070
- }
9071
- getDataDir() {
9072
- return this.dataDir;
9073
- }
9074
- exists(pathname) {
9075
- return this.templateConfig.existsCache.exists(pathname);
9076
- }
9077
- setFileSystemSearch(fileSystemSearch) {
9078
- this.fileSystemSearch = fileSystemSearch;
9079
- }
9080
- setProjectUsingEsm(isEsmProject) {
9081
- this.isEsm = !!isEsmProject;
9082
- }
9083
- get extensionMap() {
9084
- if (!this._extensionMap) {
9085
- throw new Error("Internal error: missing `extensionMap` in TemplateData.");
9086
- }
9087
- return this._extensionMap;
9088
- }
9089
- set extensionMap(map) {
9090
- this._extensionMap = map;
9091
- }
9092
- get environmentVariables() {
9093
- return this._env;
9094
- }
9095
- set environmentVariables(env) {
9096
- this._env = env;
9097
- }
9098
- /* Used by tests */
9099
- _setConfig(config) {
9100
- this.config = config;
9101
- }
9102
- getRawImports() {
9103
- if (!this.config.keys.package) {
9104
- debug3(
9105
- "Opted-out of package.json assignment for global data with falsy value for `keys.package` configuration."
9106
- );
9107
- return;
9108
- }
9109
- if (this.#rawImports) {
9110
- return this.#rawImports;
9111
- }
9112
- let projectPackageJsonPath = getWorkingProjectPackageJsonPath();
9113
- let packageJson = {};
9114
- if (projectPackageJsonPath) {
9115
- packageJson = importJsonSync(projectPackageJsonPath);
9116
- }
9117
- this.#rawImports = {
9118
- [this.config.keys.package]: packageJson
9119
- };
9120
- if (this.config.freezeReservedData) {
9121
- DeepFreeze(this.#rawImports);
9122
- }
9123
- return this.#rawImports;
9124
- }
9125
- clearData() {
9126
- this.#globalData = null;
9127
- this.configApiGlobalData = null;
9128
- this.#templateDirectoryData = {};
9129
- }
9130
- _getGlobalDataGlobByExtension(extension) {
9131
- return TemplateGlob_default.normalizePath(this.dataDir, `/**/*.${extension}`);
9132
- }
9133
- // This is a backwards compatibility helper with the old `jsDataFileSuffix` configuration API
9134
- getConfigurationDataFileSuffixes() {
9135
- if (Array.isArray(this.config.dataFileSuffixes)) {
9136
- return this.config.dataFileSuffixes;
9137
- }
9138
- if (this.config.jsDataFileSuffix) {
9139
- let suffixes = [];
9140
- suffixes.push(this.config.jsDataFileSuffix);
9141
- suffixes.push("");
9142
- return suffixes;
8831
+ if (this.config.jsDataFileSuffix) {
8832
+ let suffixes = [];
8833
+ suffixes.push(this.config.jsDataFileSuffix);
8834
+ suffixes.push("");
8835
+ return suffixes;
9143
8836
  }
9144
8837
  return [];
9145
8838
  }
@@ -9244,7 +8937,7 @@ var TemplateData = class _TemplateData {
9244
8937
  getObjectPathForDataFile(dataFilePath) {
9245
8938
  let absoluteDataFilePath = import_eleventy_utils6.TemplatePath.absolutePath(dataFilePath);
9246
8939
  let reducedPath = import_eleventy_utils6.TemplatePath.stripLeadingSubPath(absoluteDataFilePath, this.absoluteDataDir);
9247
- let parsed = import_node_path4.default.parse(reducedPath);
8940
+ let parsed = import_node_path2.default.parse(reducedPath);
9248
8941
  let folders = parsed.dir ? parsed.dir.split("/") : [];
9249
8942
  folders.push(parsed.name);
9250
8943
  return folders;
@@ -9257,7 +8950,7 @@ var TemplateData = class _TemplateData {
9257
8950
  for (let file of Object.values(files)) {
9258
8951
  let data = await this.getDataValue(file);
9259
8952
  let objectPathTarget = this.getObjectPathForDataFile(file);
9260
- let objectPathTargetString = objectPathTarget.join(import_node_path4.default.sep);
8953
+ let objectPathTargetString = objectPathTarget.join(import_node_path2.default.sep);
9261
8954
  if (dataFileConflicts[objectPathTargetString]) {
9262
8955
  debugWarn(
9263
8956
  `merging global data from ${file} with an already existing global data file (${dataFileConflicts[objectPathTargetString]}). Overriding existing keys.`
@@ -9267,7 +8960,7 @@ var TemplateData = class _TemplateData {
9267
8960
  }
9268
8961
  dataFileConflicts[objectPathTargetString] = file;
9269
8962
  debug3(`Found global data file ${file} and adding as: ${objectPathTarget}`);
9270
- lodashSet3(globalData, objectPathTarget, data);
8963
+ lodashSet2(globalData, objectPathTarget, data);
9271
8964
  if (this.config.freezeReservedData) {
9272
8965
  ReservedData_default.check(globalData, file);
9273
8966
  }
@@ -9460,7 +9153,7 @@ var TemplateData = class _TemplateData {
9460
9153
  }
9461
9154
  async getLocalDataPaths(templatePath) {
9462
9155
  let paths = [];
9463
- let parsed = import_node_path4.default.parse(templatePath);
9156
+ let parsed = import_node_path2.default.parse(templatePath);
9464
9157
  let inputDir = this.inputDir;
9465
9158
  let userExtensions = this.getUserDataExtensions();
9466
9159
  if (parsed.dir) {
@@ -9486,205 +9179,79 @@ var TemplateData = class _TemplateData {
9486
9179
  import_eleventy_utils6.TemplatePath.join(inputDir, import_eleventy_utils6.TemplatePath.getLastPathSegment(inputDir))
9487
9180
  );
9488
9181
  if (this.config.dataFileDirBaseNameOverride) {
9489
- let indexDataFile = import_eleventy_utils6.TemplatePath.getDirFromFilePath(lastInputDir) + "/" + this.config.dataFileDirBaseNameOverride;
9490
- this._addBaseToPaths(paths, indexDataFile, userExtensions, true);
9491
- } else if (lastInputDir !== "./") {
9492
- this._addBaseToPaths(paths, lastInputDir, userExtensions);
9493
- }
9494
- }
9495
- }
9496
- debug3("getLocalDataPaths(%o): %o", templatePath, paths);
9497
- return Unique(paths).reverse();
9498
- }
9499
- /* Like cleanupData() but does not mutate */
9500
- static getCleanedTagsImmutable(data, options = {}) {
9501
- let tags = [];
9502
- if ((0, import_eleventy_utils6.isPlainObject)(data) && data.tags) {
9503
- if (typeof data.tags === "string") {
9504
- tags = (data.tags || "").split(",");
9505
- } else if (Array.isArray(data.tags)) {
9506
- tags = data.tags;
9507
- } else if (data.tags) {
9508
- throw new Error(
9509
- `String or Array expected for \`tags\`${options.file ? ` in ${options.isVirtualTemplate ? "virtual " : ""}template: ${options.file}` : ""}. Received: ${inspect(data.tags)}`
9510
- );
9511
- }
9512
- return [...new Set(tags)].map((entry) => String(entry));
9513
- }
9514
- return tags;
9515
- }
9516
- static cleanupData(data, options = {}) {
9517
- if ((0, import_eleventy_utils6.isPlainObject)(data) && "tags" in data) {
9518
- data.tags = this.getCleanedTagsImmutable(data, options);
9519
- }
9520
- return data;
9521
- }
9522
- static getNormalizedExcludedCollections(data) {
9523
- let excludes = [];
9524
- let excludeValue = ResolveConfigurationData.getValue(
9525
- data,
9526
- "buildawesomeExcludeFromCollections"
9527
- );
9528
- if (excludeValue !== true) {
9529
- if (Array.isArray(excludeValue)) {
9530
- excludes = excludeValue;
9531
- } else if (typeof excludeValue === "string") {
9532
- excludes = (excludeValue || "").split(",");
9533
- }
9534
- }
9535
- return {
9536
- excludes,
9537
- excludeAll: excludeValue === true
9538
- };
9539
- }
9540
- static getIncludedCollectionNames(data) {
9541
- let tags = _TemplateData.getCleanedTagsImmutable(data);
9542
- let { excludes, excludeAll } = _TemplateData.getNormalizedExcludedCollections(data);
9543
- if (excludeAll) {
9544
- return [];
9545
- }
9546
- return ["all", ...tags].filter((tag) => !excludes.includes(tag));
9547
- }
9548
- static getIncludedTagNames(data) {
9549
- return this.getIncludedCollectionNames(data).filter((tagName) => tagName !== "all");
9550
- }
9551
- };
9552
- var TemplateData_default = TemplateData;
9553
-
9554
- // ../../src/TemplateWriter.js
9555
- var import_eleventy_utils25 = __toESM(require_eleventy_utils(), 1);
9556
-
9557
- // ../../src/Template.js
9558
- var import_node_path8 = __toESM(require_path(), 1);
9559
- init_shim_consume_fs();
9560
- var import_lodash_custom9 = __toESM(require_lodash_custom(), 1);
9561
- var import_eleventy_utils20 = __toESM(require_eleventy_utils(), 1);
9562
-
9563
- // ../../src/Util/ConsoleLogger.js
9564
- init_DebugLogUtil();
9565
- var debug4 = createDebug3("Logger");
9566
- var ConsoleLogger = class {
9567
- /** @type {boolean} */
9568
- #isVerbose = true;
9569
- /** @type {boolean} */
9570
- #isChalkEnabled = true;
9571
- /** @type {object|boolean|undefined} */
9572
- #logger;
9573
- /** @type {string} */
9574
- #logPrefix = "[11ty]";
9575
- /** @type {object} */
9576
- #colorFallbacks = {
9577
- info: "blue",
9578
- warn: "yellow",
9579
- error: "red"
9580
- };
9581
- isLoggingEnabled() {
9582
- if (!this.isVerbose || process.env.DEBUG) {
9583
- return true;
9584
- }
9585
- return this.#logger !== false;
9586
- }
9587
- setPrefix(prefix) {
9588
- this.#logPrefix = prefix;
9589
- }
9590
- get isVerbose() {
9591
- return this.#isVerbose;
9592
- }
9593
- set isVerbose(verbose) {
9594
- this.#isVerbose = !!verbose;
9595
- }
9596
- get isChalkEnabled() {
9597
- return this.#isChalkEnabled;
9598
- }
9599
- set isChalkEnabled(enabled2) {
9600
- this.#isChalkEnabled = !!enabled2;
9601
- }
9602
- overrideLogger(logger) {
9603
- this.#logger = logger;
9604
- }
9605
- get logger() {
9606
- if (this.#logger) {
9607
- return this.#logger;
9608
- }
9609
- if ("console" in globalThis) {
9610
- return globalThis.console;
9611
- }
9612
- throw new Error(
9613
- "Internal JavaScript runtime error: No logger instance found (is globalThis not supported?)."
9614
- );
9615
- }
9616
- /** @param {string} msg */
9617
- log(msg) {
9618
- this.message(msg);
9619
- }
9620
- /**
9621
- * @typedef LogOptions
9622
- * @property {string} message
9623
- * @property {string=} prefix
9624
- * @property {LogType=} type
9625
- * @property {string=} color
9626
- * @property {boolean=} force
9627
- * @param {LogOptions} options
9628
- */
9629
- logWithOptions({ message, type, prefix, color, force }) {
9630
- this.message(message, type, color, force, prefix);
9631
- }
9632
- /** @param {string} msg */
9633
- forceLog(msg) {
9634
- this.message(msg, void 0, void 0, true);
9635
- }
9636
- /** @param {string} msg */
9637
- info(msg) {
9638
- this.message(msg, "log", this.#colorFallbacks.info);
9639
- }
9640
- /** @param {string} msg */
9641
- warn(msg) {
9642
- this.message(msg, "warn", this.#colorFallbacks.warn);
9182
+ let indexDataFile = import_eleventy_utils6.TemplatePath.getDirFromFilePath(lastInputDir) + "/" + this.config.dataFileDirBaseNameOverride;
9183
+ this._addBaseToPaths(paths, indexDataFile, userExtensions, true);
9184
+ } else if (lastInputDir !== "./") {
9185
+ this._addBaseToPaths(paths, lastInputDir, userExtensions);
9186
+ }
9187
+ }
9188
+ }
9189
+ debug3("getLocalDataPaths(%o): %o", templatePath, paths);
9190
+ return Unique(paths).reverse();
9643
9191
  }
9644
- /** @param {string} msg */
9645
- error(msg) {
9646
- this.message(msg, "error", this.#colorFallbacks.error);
9192
+ /* Like cleanupData() but does not mutate */
9193
+ static getCleanedTagsImmutable(data, options = {}) {
9194
+ let tags = [];
9195
+ if ((0, import_eleventy_utils6.isPlainObject)(data) && data.tags) {
9196
+ if (typeof data.tags === "string") {
9197
+ tags = (data.tags || "").split(",");
9198
+ } else if (Array.isArray(data.tags)) {
9199
+ tags = data.tags;
9200
+ } else if (data.tags) {
9201
+ throw new Error(
9202
+ `String or Array expected for \`tags\`${options.file ? ` in ${options.isVirtualTemplate ? "virtual " : ""}template: ${options.file}` : ""}. Received: ${inspect(data.tags)}`
9203
+ );
9204
+ }
9205
+ return [...new Set(tags)].map((entry) => String(entry));
9206
+ }
9207
+ return tags;
9647
9208
  }
9648
- /** @param {string} message */
9649
- #dim(message) {
9650
- if ("dim" in chalk_client_default) {
9651
- return chalk_client_default.dim(message);
9209
+ static cleanupData(data, options = {}) {
9210
+ if ((0, import_eleventy_utils6.isPlainObject)(data) && "tags" in data) {
9211
+ data.tags = this.getCleanedTagsImmutable(data, options);
9652
9212
  }
9653
- return message;
9213
+ return data;
9654
9214
  }
9655
- /**
9656
- * Formats the message to log.
9657
- *
9658
- * @param {string} message - The raw message to log.
9659
- * @param {LogType} [type='log'] - The error level to log.
9660
- * @param {string|undefined} [chalkColor=undefined] - Color name or falsy to disable
9661
- * @param {boolean} [forceToConsole=false] - Enforce a log on console instead of specified target.
9662
- * @param {string|undefined} [prefix=undefined] - Dimmed string at the start of each line
9663
- */
9664
- message(message, type = "log", chalkColor = void 0, forceToConsole = false, prefix = void 0) {
9665
- if (!forceToConsole && (!this.isVerbose || process.env.DEBUG)) {
9666
- debug4(message);
9667
- } else if (this.#logger !== false) {
9668
- if (prefix === void 0) {
9669
- prefix = this.#logPrefix;
9670
- }
9671
- let prefixStr = prefix ? `${this.#dim(prefix)} ` : "";
9672
- message = `${prefixStr}${message.split("\n").join(`
9673
- ${prefixStr}`)}`;
9674
- if (chalkColor === void 0 && type) {
9675
- chalkColor = this.#colorFallbacks[type];
9676
- }
9677
- if (chalkColor && this.isChalkEnabled) {
9678
- this.logger[type](chalk_client_default[chalkColor](message));
9679
- } else {
9680
- this.logger[type](message);
9215
+ static getNormalizedExcludedCollections(data) {
9216
+ let excludes = [];
9217
+ let excludeValue = ResolveConfigurationData.getValue(
9218
+ data,
9219
+ "buildawesomeExcludeFromCollections"
9220
+ );
9221
+ if (excludeValue !== true) {
9222
+ if (Array.isArray(excludeValue)) {
9223
+ excludes = excludeValue;
9224
+ } else if (typeof excludeValue === "string") {
9225
+ excludes = (excludeValue || "").split(",");
9681
9226
  }
9682
9227
  }
9228
+ return {
9229
+ excludes,
9230
+ excludeAll: excludeValue === true
9231
+ };
9232
+ }
9233
+ static getIncludedCollectionNames(data) {
9234
+ let tags = _TemplateData.getCleanedTagsImmutable(data);
9235
+ let { excludes, excludeAll } = _TemplateData.getNormalizedExcludedCollections(data);
9236
+ if (excludeAll) {
9237
+ return [];
9238
+ }
9239
+ return ["all", ...tags].filter((tag) => !excludes.includes(tag));
9240
+ }
9241
+ static getIncludedTagNames(data) {
9242
+ return this.getIncludedCollectionNames(data).filter((tagName) => tagName !== "all");
9683
9243
  }
9684
9244
  };
9685
- var ConsoleLogger_default = ConsoleLogger;
9245
+ var TemplateData_default = TemplateData;
9246
+
9247
+ // ../../src/TemplateWriter.js
9248
+ var import_eleventy_utils25 = __toESM(require_eleventy_utils(), 1);
9686
9249
 
9687
9250
  // ../../src/Template.js
9251
+ var import_node_path6 = __toESM(require_path(), 1);
9252
+ init_shim_consume_fs();
9253
+ var import_lodash_custom9 = __toESM(require_lodash_custom(), 1);
9254
+ var import_eleventy_utils20 = __toESM(require_eleventy_utils(), 1);
9688
9255
  init_DebugLogUtil();
9689
9256
 
9690
9257
  // ../../src/Util/spawn.core.js
@@ -9786,7 +9353,7 @@ init_BaseError();
9786
9353
 
9787
9354
  // ../../src/Engines/TemplateEngineManager.js
9788
9355
  init_DebugLogUtil();
9789
- var debug6 = createDebug3("TemplateEngineManager");
9356
+ var debug5 = createDebug3("TemplateEngineManager");
9790
9357
  var TemplateEngineManager = class _TemplateEngineManager {
9791
9358
  #CustomEngine;
9792
9359
  constructor(eleventyConfig) {
@@ -9923,7 +9490,7 @@ var TemplateEngineManager = class _TemplateEngineManager {
9923
9490
  throw new Error(`Template Engine ${name} does not exist in getEngine()`);
9924
9491
  }
9925
9492
  if (!this.engineCache[name]) {
9926
- debug6("Engine cache miss %o (should only happen once per engine type)", name);
9493
+ debug5("Engine cache miss %o (should only happen once per engine type)", name);
9927
9494
  this.engineCache[name] = this.#getEngine(name, extensionMap);
9928
9495
  }
9929
9496
  return this.engineCache[name];
@@ -10215,8 +9782,8 @@ var ErrorUtil = class _ErrorUtil {
10215
9782
 
10216
9783
  // ../../src/TemplateContent.js
10217
9784
  init_EventBus();
10218
- var { set: lodashSet4 } = import_lodash_custom4.default;
10219
- var debug7 = createDebug3("TemplateContent");
9785
+ var { set: lodashSet3 } = import_lodash_custom4.default;
9786
+ var debug6 = createDebug3("TemplateContent");
10220
9787
  var TemplateContentFrontMatterError = class extends BaseError {
10221
9788
  };
10222
9789
  var TemplateContentCompileError = class extends BaseError {
@@ -10436,7 +10003,7 @@ var TemplateContent = class _TemplateContent {
10436
10003
  fm.content = fm.excerpt + fm.content.slice(excerptString.length);
10437
10004
  }
10438
10005
  let alias = options.excerpt_alias || "page.excerpt";
10439
- lodashSet4(fm.data, alias, fm.excerpt);
10006
+ lodashSet3(fm.data, alias, fm.excerpt);
10440
10007
  }
10441
10008
  return fm;
10442
10009
  } else {
@@ -10617,7 +10184,7 @@ var TemplateContent = class _TemplateContent {
10617
10184
  if (cacheable && key) {
10618
10185
  cache.delete(key);
10619
10186
  }
10620
- debug7(`Having trouble compiling template ${this.inputPath}: %O`, str);
10187
+ debug6(`Having trouble compiling template ${this.inputPath}: %O`, str);
10621
10188
  throw new TemplateContentCompileError(
10622
10189
  `Having trouble compiling template ${this.inputPath}`,
10623
10190
  e
@@ -10733,7 +10300,7 @@ var TemplateContent = class _TemplateContent {
10733
10300
  } else {
10734
10301
  let tr = await this.getTemplateRender();
10735
10302
  let engine = tr.getReadableEnginesList();
10736
- debug7(`Having trouble rendering ${engine} template ${this.inputPath}: %O`, str);
10303
+ debug6(`Having trouble rendering ${engine} template ${this.inputPath}: %O`, str);
10737
10304
  return Promise.reject(
10738
10305
  new TemplateContentRenderError(
10739
10306
  `Having trouble rendering ${engine} template ${this.inputPath}`,
@@ -10752,7 +10319,7 @@ var TemplateContent = class _TemplateContent {
10752
10319
  }
10753
10320
  let hasDependencies = this.engine.hasDependencies(incrementalFile);
10754
10321
  let isRelevant = this.engine.isFileRelevantTo(this.inputPath, incrementalFile);
10755
- debug7(
10322
+ debug6(
10756
10323
  "Test dependencies to see if %o is relevant to %o: %o",
10757
10324
  this.inputPath,
10758
10325
  incrementalFile,
@@ -10801,7 +10368,7 @@ EventBus_default.on("buildawesome.compilecachereset", () => {
10801
10368
  var TemplateContent_default = TemplateContent;
10802
10369
 
10803
10370
  // ../../src/TemplatePermalink.js
10804
- var import_node_path5 = __toESM(require_path(), 1);
10371
+ var import_node_path3 = __toESM(require_path(), 1);
10805
10372
  var import_eleventy_utils9 = __toESM(require_eleventy_utils(), 1);
10806
10373
  var TemplatePermalink = class _TemplatePermalink {
10807
10374
  #dynamicPermalinkEnabled;
@@ -10866,7 +10433,7 @@ ${buildLink.toString()}` : "";
10866
10433
  return false;
10867
10434
  }
10868
10435
  let cleanLink = this._addDefaultLinkFilename(this.buildLink);
10869
- let parsed = import_node_path5.default.parse(cleanLink);
10436
+ let parsed = import_node_path3.default.parse(cleanLink);
10870
10437
  return import_eleventy_utils9.TemplatePath.join(parsed.dir, this.extraPaginationSubdir, parsed.base);
10871
10438
  }
10872
10439
  // Used in url transforms feature
@@ -11339,7 +10906,7 @@ var TemplateLayout = class _TemplateLayout extends TemplateContent_default {
11339
10906
  var TemplateLayout_default = TemplateLayout;
11340
10907
 
11341
10908
  // ../../src/TemplateFileSlug.js
11342
- var import_node_path6 = __toESM(require_path(), 1);
10909
+ var import_node_path4 = __toESM(require_path(), 1);
11343
10910
  var import_eleventy_utils13 = __toESM(require_eleventy_utils(), 1);
11344
10911
  var TemplateFileSlug = class {
11345
10912
  constructor(inputPath, extensionMap, eleventyConfig) {
@@ -11352,7 +10919,7 @@ var TemplateFileSlug = class {
11352
10919
  let dirs = this.cleanInputPath.split("/");
11353
10920
  this.dirs = dirs;
11354
10921
  this.dirs.pop();
11355
- this.parsed = import_node_path6.default.parse(inputPath);
10922
+ this.parsed = import_node_path4.default.parse(inputPath);
11356
10923
  this.filenameNoExt = extensionMap.removeTemplateExtension(this.parsed.base);
11357
10924
  }
11358
10925
  // `page.filePathStem` see https://v3.11ty.dev/docs/data-eleventy-supplied/#page-variable
@@ -11443,8 +11010,8 @@ var ComputedDataQueue_default = ComputedDataQueue;
11443
11010
  // ../../src/Data/ComputedDataTemplateString.js
11444
11011
  var import_lodash_custom5 = __toESM(require_lodash_custom(), 1);
11445
11012
  init_DebugLogUtil();
11446
- var { set: lodashSet5 } = import_lodash_custom5.default;
11447
- var debug8 = createDebug3("ComputedDataTemplateString");
11013
+ var { set: lodashSet4 } = import_lodash_custom5.default;
11014
+ var debug7 = createDebug3("ComputedDataTemplateString");
11448
11015
  var ComputedDataTemplateString = class {
11449
11016
  constructor(computedKeys) {
11450
11017
  if (Array.isArray(computedKeys)) {
@@ -11458,7 +11025,7 @@ var ComputedDataTemplateString = class {
11458
11025
  getProxyData() {
11459
11026
  let proxyData = {};
11460
11027
  for (let key of this.computedKeys) {
11461
- lodashSet5(proxyData, key, this.prefix + key + this.suffix);
11028
+ lodashSet4(proxyData, key, this.prefix + key + this.suffix);
11462
11029
  }
11463
11030
  return proxyData;
11464
11031
  }
@@ -11479,7 +11046,7 @@ var ComputedDataTemplateString = class {
11479
11046
  try {
11480
11047
  output = await fn(proxyData);
11481
11048
  } catch (e) {
11482
- debug8("Computed Data first pass data resolution error: %o", e);
11049
+ debug7("Computed Data first pass data resolution error: %o", e);
11483
11050
  }
11484
11051
  if (typeof output === "string") {
11485
11052
  return this.findVarsInOutput(output);
@@ -11492,7 +11059,7 @@ var ComputedDataTemplateString_default = ComputedDataTemplateString;
11492
11059
  // ../../src/Data/ComputedDataProxy.js
11493
11060
  var import_lodash_custom6 = __toESM(require_lodash_custom(), 1);
11494
11061
  var import_eleventy_utils14 = __toESM(require_eleventy_utils(), 1);
11495
- var { set: lodashSet6, get: lodashGet3 } = import_lodash_custom6.default;
11062
+ var { set: lodashSet5, get: lodashGet3 } = import_lodash_custom6.default;
11496
11063
  var ComputedDataProxy = class {
11497
11064
  constructor(computedKeys) {
11498
11065
  if (Array.isArray(computedKeys)) {
@@ -11509,7 +11076,7 @@ var ComputedDataProxy = class {
11509
11076
  if (this.computedKeys) {
11510
11077
  for (let key of this.computedKeys) {
11511
11078
  if (lodashGet3(data, key, undefinedValue) === undefinedValue) {
11512
- lodashSet6(data, key, "");
11079
+ lodashSet5(data, key, "");
11513
11080
  }
11514
11081
  }
11515
11082
  }
@@ -11587,8 +11154,8 @@ var ComputedDataProxy = class {
11587
11154
  var ComputedDataProxy_default = ComputedDataProxy;
11588
11155
 
11589
11156
  // ../../src/Data/ComputedData.js
11590
- var { set: lodashSet7, get: lodashGet4 } = import_lodash_custom7.default;
11591
- var debug9 = createDebug3("ComputedData");
11157
+ var { set: lodashSet6, get: lodashGet4 } = import_lodash_custom7.default;
11158
+ var debug8 = createDebug3("ComputedData");
11592
11159
  var ComputedData = class {
11593
11160
  constructor(config) {
11594
11161
  this.computed = {};
@@ -11612,9 +11179,9 @@ var ComputedData = class {
11612
11179
  fns.tmpl = templateInstance;
11613
11180
  renderFn = renderFn.bind(fns);
11614
11181
  }
11615
- lodashSet7(this.computed, key, renderFn);
11182
+ lodashSet6(this.computed, key, renderFn);
11616
11183
  if (symbolParseFn) {
11617
- lodashSet7(this.symbolParseFunctions, key, symbolParseFn);
11184
+ lodashSet6(this.symbolParseFunctions, key, symbolParseFn);
11618
11185
  }
11619
11186
  }
11620
11187
  addTemplateString(key, renderFn, declaredDependencies = [], symbolParseFn, templateInstance) {
@@ -11639,7 +11206,7 @@ var ComputedData = class {
11639
11206
  let proxy = isTemplateString ? proxyByTemplateString : proxyByProxy;
11640
11207
  varsUsed = await proxy.findVarsUsed(computed, data);
11641
11208
  }
11642
- debug9("%o accesses %o variables", key, varsUsed);
11209
+ debug8("%o accesses %o variables", key, varsUsed);
11643
11210
  let filteredVarsUsed = varsUsed.filter((varUsed) => {
11644
11211
  return varUsed !== key && this.computedKeys.has(varUsed) || varUsed.startsWith("collections.");
11645
11212
  });
@@ -11648,14 +11215,14 @@ var ComputedData = class {
11648
11215
  }
11649
11216
  }
11650
11217
  async _setupDataEntry(data, order) {
11651
- debug9("Computed data order of execution: %o", order);
11218
+ debug8("Computed data order of execution: %o", order);
11652
11219
  for (let key of order) {
11653
11220
  let computed = lodashGet4(this.computed, key);
11654
11221
  if (typeof computed === "function") {
11655
11222
  let ret = await computed(data);
11656
- lodashSet7(data, key, ret);
11223
+ lodashSet6(data, key, ret);
11657
11224
  } else if (computed !== void 0) {
11658
- lodashSet7(data, key, computed);
11225
+ lodashSet6(data, key, computed);
11659
11226
  }
11660
11227
  }
11661
11228
  }
@@ -11762,7 +11329,7 @@ function ProxyWrap(target, fallback) {
11762
11329
  }
11763
11330
 
11764
11331
  // ../../src/Plugins/Pagination.js
11765
- var { set: lodashSet8, get: lodashGet5, chunk: lodashChunk } = import_lodash_custom8.default;
11332
+ var { set: lodashSet7, get: lodashGet5, chunk: lodashChunk } = import_lodash_custom8.default;
11766
11333
  var PaginationConfigError = class extends BaseError {
11767
11334
  };
11768
11335
  var PaginationError = class extends BaseError {
@@ -12007,7 +11574,7 @@ var Pagination = class _Pagination {
12007
11574
  };
12008
11575
  Object.assign(paginationData.pagination, this.getOverrideDataPages(items, pageNumber));
12009
11576
  if (this.alias) {
12010
- lodashSet8(paginationData, this.alias, this.getNormalizedItems(items[pageNumber]));
11577
+ lodashSet7(paginationData, this.alias, this.getNormalizedItems(items[pageNumber]));
12011
11578
  }
12012
11579
  let clonedData = ProxyWrap(paginationData, parentData);
12013
11580
  let {
@@ -12218,11 +11785,11 @@ var IsoDate = class _IsoDate {
12218
11785
 
12219
11786
  // ../../src/Util/DateParse.js
12220
11787
  init_DebugLogUtil();
12221
- var debug10 = createDebug3("DateTime");
11788
+ var debug9 = createDebug3("DateTime");
12222
11789
  function fromISOtoDateUTC(dateValue, inputPath) {
12223
11790
  try {
12224
11791
  let date = IsoDate.parse(dateValue);
12225
- debug10("@11ty/parse-date-strings parsed %o as %o", dateValue, date);
11792
+ debug9("@11ty/parse-date-strings parsed %o as %o", dateValue, date);
12226
11793
  return date;
12227
11794
  } catch (e) {
12228
11795
  throw new Error(
@@ -12236,7 +11803,7 @@ function fromISOtoDateUTC(dateValue, inputPath) {
12236
11803
  var import_eleventy_utils19 = __toESM(require_eleventy_utils(), 1);
12237
11804
  init_BaseError();
12238
11805
  init_DebugLogUtil();
12239
- var debug11 = createDebug3("Transforms");
11806
+ var debug10 = createDebug3("Transforms");
12240
11807
  var TransformError = class extends BaseError {
12241
11808
  };
12242
11809
  var TransformsUtil = class {
@@ -12258,7 +11825,7 @@ var TransformsUtil = class {
12258
11825
  }
12259
11826
  let transformsArray = this.changeTransformsToArray(transforms);
12260
11827
  for (let { callback, name } of transformsArray) {
12261
- debug11("Running %o transform on %o: %o", name, inputPath, outputPath);
11828
+ debug10("Running %o transform on %o: %o", name, inputPath, outputPath);
12262
11829
  try {
12263
11830
  let hadContentBefore = !!content;
12264
11831
  content = await callback.call(
@@ -12293,7 +11860,7 @@ var TransformsUtil = class {
12293
11860
  var TransformsUtil_default = TransformsUtil;
12294
11861
 
12295
11862
  // ../../src/Util/FileSystemUtilities.js
12296
- var import_node_path7 = __toESM(require_path(), 1);
11863
+ var import_node_path5 = __toESM(require_path(), 1);
12297
11864
  init_shim_consume_fs();
12298
11865
  var FileSystemUtilities = class {
12299
11866
  constructor(templateConfig) {
@@ -12308,7 +11875,7 @@ var FileSystemUtilities = class {
12308
11875
  return this.templateConfig.existsCache.exists(pathname);
12309
11876
  }
12310
11877
  createDirectoryForFileSync(filePath) {
12311
- let dir = import_node_path7.default.parse(filePath).dir;
11878
+ let dir = import_node_path5.default.parse(filePath).dir;
12312
11879
  if (!dir || this.exists(dir)) {
12313
11880
  return;
12314
11881
  }
@@ -12389,8 +11956,8 @@ function getDirectoryFromUrl(url) {
12389
11956
  }
12390
11957
 
12391
11958
  // ../../src/Template.js
12392
- var { set: lodashSet9, get: lodashGet6 } = import_lodash_custom9.default;
12393
- var debug12 = createDebug3("Template");
11959
+ var { set: lodashSet8, get: lodashGet6 } = import_lodash_custom9.default;
11960
+ var debug11 = createDebug3("Template");
12394
11961
  var Template = class _Template extends TemplateContent_default {
12395
11962
  #logger;
12396
11963
  #fsManager;
@@ -12398,12 +11965,11 @@ var Template = class _Template extends TemplateContent_default {
12398
11965
  #dataCache;
12399
11966
  #cacheRenderedPromise;
12400
11967
  #cacheRenderedTransformsAndLayoutsPromise;
12401
- #cacheRenderedDataLocationsTransformsAndLayoutsPromise;
12402
11968
  #preprocessors;
12403
11969
  #preprocessorCache;
12404
11970
  constructor(templatePath, templateData, extensionMap, config) {
12405
11971
  super(templatePath, config);
12406
- this.parsed = (0, import_node_path8.parse)(templatePath);
11972
+ this.parsed = (0, import_node_path6.parse)(templatePath);
12407
11973
  this.extraOutputSubdirectory = "";
12408
11974
  this.extensionMap = extensionMap;
12409
11975
  this.templateData = templateData;
@@ -12471,7 +12037,6 @@ var Template = class _Template extends TemplateContent_default {
12471
12037
  if (types.render) {
12472
12038
  this.#cacheRenderedPromise = void 0;
12473
12039
  this.#cacheRenderedTransformsAndLayoutsPromise = void 0;
12474
- this.#cacheRenderedDataLocationsTransformsAndLayoutsPromise = void 0;
12475
12040
  }
12476
12041
  }
12477
12042
  setOutputFormat(to) {
@@ -12547,7 +12112,7 @@ var Template = class _Template extends TemplateContent_default {
12547
12112
  for (let j = 0, k = keys.length; j < k; j++) {
12548
12113
  let key = keys[j];
12549
12114
  permalinkValue[key] = results[j];
12550
- debug12(
12115
+ debug11(
12551
12116
  "Rendering permalink.%o for %o: %s becomes %o",
12552
12117
  key,
12553
12118
  this.inputPath,
@@ -12558,7 +12123,7 @@ var Template = class _Template extends TemplateContent_default {
12558
12123
  }
12559
12124
  } else if (permalink) {
12560
12125
  permalinkValue = await super.renderPermalink(permalink, data);
12561
- debug12("Rendering permalink for %o: %s becomes %o", this.inputPath, permalink, permalinkValue);
12126
+ debug11("Rendering permalink for %o: %s becomes %o", this.inputPath, permalink, permalinkValue);
12562
12127
  }
12563
12128
  if (!permalink && isDynamicPermalinkEnabled) {
12564
12129
  let tr = await this.getTemplateRender();
@@ -12838,7 +12403,7 @@ var Template = class _Template extends TemplateContent_default {
12838
12403
  ReservedData_default.checkSubset(computedData2);
12839
12404
  }
12840
12405
  this._addComputedEntry(this.computedData, computedData2);
12841
- debug12("First round of computed data for %o", this.inputPath);
12406
+ debug11("First round of computed data for %o", this.inputPath);
12842
12407
  await this.computedData.setupData(data, function(entry) {
12843
12408
  return !this.isUsesStartsWith(entry, "collections.");
12844
12409
  });
@@ -12862,7 +12427,7 @@ var Template = class _Template extends TemplateContent_default {
12862
12427
  // Computed data consuming collections!
12863
12428
  async resolveRemainingComputedData(data) {
12864
12429
  if (this.computedData) {
12865
- debug12("Second round of computed data for %o", this.inputPath);
12430
+ debug11("Second round of computed data for %o", this.inputPath);
12866
12431
  return this.computedData.processRemainingData(data);
12867
12432
  }
12868
12433
  }
@@ -12926,7 +12491,7 @@ var Template = class _Template extends TemplateContent_default {
12926
12491
  async getTemplates(data) {
12927
12492
  let { skippedVia: skippedViaPreprocessorName, content: rawInput } = await this.runPreprocessors(data);
12928
12493
  if (skippedViaPreprocessorName) {
12929
- debug12(
12494
+ debug11(
12930
12495
  "Skipping %o, the %o preprocessor returned an explicit `false`",
12931
12496
  this.inputPath,
12932
12497
  skippedViaPreprocessorName
@@ -13012,7 +12577,7 @@ var Template = class _Template extends TemplateContent_default {
13012
12577
  this.fsManager.writeFileSync(outputPath, finalContent);
13013
12578
  templateBenchmark.after();
13014
12579
  this.writeCount++;
13015
- debug12(`${outputPath} ${lang.finished}.`);
12580
+ debug11(`${outputPath} ${lang.finished}.`);
13016
12581
  let ret = {
13017
12582
  inputPath: this.inputPath,
13018
12583
  outputPath,
@@ -13055,7 +12620,7 @@ var Template = class _Template extends TemplateContent_default {
13055
12620
  let filtered = {};
13056
12621
  for (let selector of selectors) {
13057
12622
  let value = lodashGet6(data, selector);
13058
- lodashSet9(filtered, selector, value);
12623
+ lodashSet8(filtered, selector, value);
13059
12624
  }
13060
12625
  return filtered;
13061
12626
  }
@@ -13081,11 +12646,11 @@ var Template = class _Template extends TemplateContent_default {
13081
12646
  continue;
13082
12647
  }
13083
12648
  if (!page.template.isRenderable()) {
13084
- debug12("Template not written %o from %o.", page.outputPath, page.template.inputPath);
12649
+ debug11("Template not written %o from %o.", page.outputPath, page.template.inputPath);
13085
12650
  continue;
13086
12651
  }
13087
12652
  if (!page.template.behavior.isWriteable()) {
13088
- debug12(
12653
+ debug11(
13089
12654
  "Template not written %o from %o (via permalink: false, permalink.build: false, or a permalink object without a build property).",
13090
12655
  page.outputPath,
13091
12656
  page.template.inputPath
@@ -13129,7 +12694,7 @@ var Template = class _Template extends TemplateContent_default {
13129
12694
  return /* @__PURE__ */ new Date();
13130
12695
  }
13131
12696
  let newDate = new Date(stat2[key]);
13132
- debug12(
12697
+ debug11(
13133
12698
  "Template date: using file\u2019s %o for %o of %o (from %o)",
13134
12699
  key,
13135
12700
  this.inputPath,
@@ -13147,18 +12712,18 @@ var Template = class _Template extends TemplateContent_default {
13147
12712
  dateValue
13148
12713
  );
13149
12714
  if (ret) {
13150
- debug12("getMappedDate: date value override via `addDateParsing` callback to %o", ret);
12715
+ debug11("getMappedDate: date value override via `addDateParsing` callback to %o", ret);
13151
12716
  dateValue = ret;
13152
12717
  }
13153
12718
  }
13154
12719
  if (dateValue) {
13155
- debug12("getMappedDate: using a date in the data for %o of %o", this.inputPath, dateValue);
12720
+ debug11("getMappedDate: using a date in the data for %o of %o", this.inputPath, dateValue);
13156
12721
  if (dateValue?.constructor?.name === "DateTime") {
13157
- debug12("getMappedDate: found DateTime instance: %o", dateValue);
12722
+ debug11("getMappedDate: found DateTime instance: %o", dateValue);
13158
12723
  return dateValue.toJSDate();
13159
12724
  }
13160
12725
  if (dateValue instanceof Date) {
13161
- debug12("getMappedDate: found Date instance (maybe from YAML): %o", dateValue);
12726
+ debug11("getMappedDate: found Date instance (maybe from YAML): %o", dateValue);
13162
12727
  return dateValue;
13163
12728
  }
13164
12729
  if (typeof dateValue !== "string") {
@@ -13170,7 +12735,7 @@ var Template = class _Template extends TemplateContent_default {
13170
12735
  if (dateValue.toLowerCase() === "git last modified") {
13171
12736
  let timestamp = await getUpdatedTimestamp(this.inputPath);
13172
12737
  if (timestamp) {
13173
- debug12(
12738
+ debug11(
13174
12739
  `getMappedDate: found git last modified timestamp for ${this.inputPath}: %o`,
13175
12740
  timestamp
13176
12741
  );
@@ -13184,7 +12749,7 @@ var Template = class _Template extends TemplateContent_default {
13184
12749
  if (dateValue.toLowerCase() === "git created") {
13185
12750
  let timestamp = await getCreatedTimestamp(this.inputPath);
13186
12751
  if (timestamp) {
13187
- debug12(
12752
+ debug11(
13188
12753
  `getMappedDate: found git created timestamp for ${this.inputPath}: %o`,
13189
12754
  timestamp
13190
12755
  );
@@ -13201,7 +12766,7 @@ var Template = class _Template extends TemplateContent_default {
13201
12766
  let filepathRegex = this.inputPath.match(/(\d{4}-\d{2}-\d{2})/);
13202
12767
  if (filepathRegex !== null) {
13203
12768
  let dateObj = fromISOtoDateUTC(filepathRegex[1], this.inputPath);
13204
- debug12(
12769
+ debug11(
13205
12770
  "getMappedDate: using filename regex time for %o of %o: %o",
13206
12771
  this.inputPath,
13207
12772
  filepathRegex[1],
@@ -13348,6 +12913,16 @@ var Sortable = class _Sortable {
13348
12913
  };
13349
12914
  var Sortable_default = Sortable;
13350
12915
 
12916
+ // ../../src/Util/GlobMatcher.client.js
12917
+ function isGlobMatch() {
12918
+ throw new Error(
12919
+ "Glob matching (e.g. getFilteredByGlob collection API method) is not supported in the `@11ty/client` bundle. Use the `@11ty/client/eleventy` bundle instead."
12920
+ );
12921
+ }
12922
+ function isDynamicPattern(pattern) {
12923
+ return false;
12924
+ }
12925
+
13351
12926
  // ../../src/TemplateCollection.js
13352
12927
  var TemplateCollection = class extends Sortable_default {
13353
12928
  constructor() {
@@ -13406,6 +12981,9 @@ var TemplateCollection = class extends Sortable_default {
13406
12981
  };
13407
12982
  var TemplateCollection_default = TemplateCollection;
13408
12983
 
12984
+ // ../../src/TemplateMap.js
12985
+ init_BaseError();
12986
+
13409
12987
  // ../../src/Errors/UsingCircularTemplateContentReferenceError.js
13410
12988
  init_BaseError();
13411
12989
  var UsingCircularTemplateContentReferenceError = class extends BaseError {
@@ -13432,11 +13010,11 @@ var JavaScriptDependencies = class {
13432
13010
  var JavaScriptDependencies_core_default = JavaScriptDependencies;
13433
13011
 
13434
13012
  // ../../src/Util/PathNormalizer.js
13435
- var import_node_path10 = __toESM(require_path(), 1);
13013
+ var import_node_path8 = __toESM(require_path(), 1);
13436
13014
  var import_eleventy_utils22 = __toESM(require_eleventy_utils(), 1);
13437
13015
 
13438
13016
  // ../../src/Adapters/Packages/url.core.js
13439
- var import_node_path9 = __toESM(require_path());
13017
+ var import_node_path7 = __toESM(require_path());
13440
13018
  function fileURLToPath(url) {
13441
13019
  if (typeof url === "string") {
13442
13020
  url = new URL(url);
@@ -13450,7 +13028,7 @@ function fileURLToPath(url) {
13450
13028
  if (/%2f/i.test(url.pathname)) {
13451
13029
  throw new Error("The file: URL path must not include encoded / characters");
13452
13030
  }
13453
- return import_node_path9.default.normalize(decodeURIComponent(url.pathname));
13031
+ return import_node_path7.default.normalize(decodeURIComponent(url.pathname));
13454
13032
  }
13455
13033
 
13456
13034
  // ../../src/Util/PathNormalizer.js
@@ -13460,8 +13038,8 @@ var PathNormalizer = class {
13460
13038
  return [];
13461
13039
  }
13462
13040
  let separator = "/";
13463
- if (inputPath.includes(import_node_path10.sep)) {
13464
- separator = import_node_path10.sep;
13041
+ if (inputPath.includes(import_node_path8.sep)) {
13042
+ separator = import_node_path8.sep;
13465
13043
  }
13466
13044
  return inputPath.split(separator).filter((entry) => entry !== ".");
13467
13045
  }
@@ -13481,7 +13059,7 @@ var PathNormalizer = class {
13481
13059
  if (!inputPath) {
13482
13060
  return inputPath;
13483
13061
  }
13484
- return inputPath.split(import_node_path10.sep).join("/");
13062
+ return inputPath.split(import_node_path8.sep).join("/");
13485
13063
  }
13486
13064
  static addTrailingSlashToDirectory(dir) {
13487
13065
  if (dir.endsWith("/")) {
@@ -13491,7 +13069,7 @@ var PathNormalizer = class {
13491
13069
  }
13492
13070
  // returns a path
13493
13071
  static getDirectoryFromFilePath(filePath) {
13494
- let parsed = (0, import_node_path10.parse)(filePath);
13072
+ let parsed = (0, import_node_path8.parse)(filePath);
13495
13073
  return this.addTrailingSlashToDirectory(parsed.dir);
13496
13074
  }
13497
13075
  static fullNormalization(inputPath) {
@@ -13510,7 +13088,7 @@ var PathNormalizer = class {
13510
13088
  // ../../src/Util/TemplateDepGraph.js
13511
13089
  var import_dependency_graph2 = __toESM(require_dep_graph(), 1);
13512
13090
  init_DebugLogUtil();
13513
- var debug13 = createDebug3("TemplateDepGraph");
13091
+ var debug12 = createDebug3("TemplateDepGraph");
13514
13092
  var COLLECTION_PREFIX = "__collection:";
13515
13093
  var TemplateDepGraph = class _TemplateDepGraph extends import_dependency_graph2.DepGraph {
13516
13094
  static STAGES = ["[basic]", "[userconfig]", "[keys]", "all"];
@@ -13538,7 +13116,7 @@ var TemplateDepGraph = class _TemplateDepGraph extends import_dependency_graph2.
13538
13116
  `Missing tag type for addTag. Expecting one of ${_TemplateDepGraph.STAGES.map((entry) => entry.slice(1, -1)).join(" or ")}. Received: ${type}`
13539
13117
  );
13540
13118
  }
13541
- debug13("collection type %o uses tag %o", tagName, type);
13119
+ debug12("collection type %o uses tag %o", tagName, type);
13542
13120
  this.uses(`${COLLECTION_PREFIX}[${type}]`, `${COLLECTION_PREFIX}${tagName}`);
13543
13121
  }
13544
13122
  addConfigCollectionName(collectionName) {
@@ -13573,7 +13151,7 @@ var TemplateDepGraph = class _TemplateDepGraph extends import_dependency_graph2.
13573
13151
  if (consumesAll) {
13574
13152
  publishesTo = publishesTo.filter((entry) => entry !== "all");
13575
13153
  }
13576
- debug13("%o consumes %o and publishes to %o", filePath, consumes, publishesTo);
13154
+ debug12("%o consumes %o and publishes to %o", filePath, consumes, publishesTo);
13577
13155
  for (let collectionName of publishesTo) {
13578
13156
  if (!consumesAll) {
13579
13157
  let tagType = "basic";
@@ -13626,7 +13204,7 @@ var TemplateDepGraph = class _TemplateDepGraph extends import_dependency_graph2.
13626
13204
  };
13627
13205
 
13628
13206
  // ../../src/GlobalDependencyMap.js
13629
- var debug14 = createDebug3("Dependencies");
13207
+ var debug13 = createDebug3("Dependencies");
13630
13208
  var GlobalDependencyMap = class _GlobalDependencyMap {
13631
13209
  // dependency-graph requires these keys to be alphabetic strings
13632
13210
  static LAYOUT_KEY = "layout";
@@ -13899,7 +13477,7 @@ var GlobalDependencyMap = class _GlobalDependencyMap {
13899
13477
  addNewNodeRelationships(from, consumes = [], publishes = []) {
13900
13478
  consumes = consumes.filter(Boolean);
13901
13479
  publishes = publishes.filter(Boolean);
13902
- debug14("%o consumes %o and publishes to %o", from, consumes, publishes);
13480
+ debug13("%o consumes %o and publishes to %o", from, consumes, publishes);
13903
13481
  from = this.normalizeNode(from);
13904
13482
  this.map.addTemplate(from, consumes, publishes);
13905
13483
  }
@@ -13971,7 +13549,7 @@ var GlobalDependencyMap_default = GlobalDependencyMap;
13971
13549
 
13972
13550
  // ../../src/TemplateMap.js
13973
13551
  init_DebugLogUtil();
13974
- var debug15 = createDebug3("TemplateMap");
13552
+ var debug14 = createDebug3("TemplateMap");
13975
13553
  var EXTENSIONLESS_URL_ALLOWLIST = [
13976
13554
  "/_redirects",
13977
13555
  // Netlify specific
@@ -13986,7 +13564,6 @@ var SPECIAL_COLLECTION_NAMES = {
13986
13564
  };
13987
13565
  var TemplateMap = class {
13988
13566
  #dependencyMapInitialized = false;
13989
- #templateData;
13990
13567
  constructor(eleventyConfig) {
13991
13568
  if (!eleventyConfig || eleventyConfig.constructor.name !== "TemplateConfig") {
13992
13569
  throw new Error("Missing or invalid `eleventyConfig` argument.");
@@ -14013,9 +13590,6 @@ var TemplateMap = class {
14013
13590
  }
14014
13591
  return this._config;
14015
13592
  }
14016
- setTemplateData(templateData) {
14017
- this.#templateData = templateData;
14018
- }
14019
13593
  async add(template) {
14020
13594
  if (!template) {
14021
13595
  return;
@@ -14162,7 +13736,7 @@ var TemplateMap = class {
14162
13736
  entry.data.collections = this.collectionsData;
14163
13737
  }
14164
13738
  let fullTemplateOrder = this.getTemplateOrder();
14165
- debug15(
13739
+ debug14(
14166
13740
  "Rendering templates in order (%o concurrency): %O",
14167
13741
  this.userConfig.getConcurrency(),
14168
13742
  fullTemplateOrder
@@ -14222,17 +13796,20 @@ var TemplateMap = class {
14222
13796
  continue;
14223
13797
  }
14224
13798
  for (let pageEntry of map._pages) {
14225
- let { location: dataSchemaLocation, value: dataSchema } = ResolveConfigurationData.resolve(
13799
+ let dataSchemaCallback = ResolveConfigurationData.getValue(
14226
13800
  pageEntry.data,
14227
13801
  this.config.keys.dataSchema
14228
13802
  );
14229
- if (dataSchema !== void 0 && typeof dataSchema === "function") {
13803
+ if (dataSchemaCallback !== void 0 && typeof dataSchemaCallback === "function") {
14230
13804
  try {
14231
- await dataSchema(pageEntry.data);
13805
+ await dataSchemaCallback(pageEntry.data);
14232
13806
  } catch (e) {
14233
- throw new Error(
14234
- `Error in the data schema for: ${map.inputPath} (via \`${dataSchemaLocation}\`)`,
14235
- { cause: e }
13807
+ let dataSchemaLocation = ResolveConfigurationData.getEligibleLocations(
13808
+ this.config.keys.dataSchema
13809
+ );
13810
+ throw new BaseError(
13811
+ `Error in the data schema for: ${map.inputPath} (via \`${dataSchemaLocation.join("` or `")}\`)`,
13812
+ e
14236
13813
  );
14237
13814
  }
14238
13815
  }
@@ -14290,7 +13867,7 @@ var TemplateMap = class {
14290
13867
  } else {
14291
13868
  result = this.collection.getFilteredByTag(tag);
14292
13869
  }
14293
- debug15(`Collection: collections.${tag || "all"} size: ${result?.length}`);
13870
+ debug14(`Collection: collections.${tag || "all"} size: ${result?.length}`);
14294
13871
  return result;
14295
13872
  }
14296
13873
  /* 3.0.0-alpha.1: setUserConfigCollections method removed (was only used for testing) */
@@ -14304,7 +13881,7 @@ var TemplateMap = class {
14304
13881
  async getUserConfigCollection(name) {
14305
13882
  let configCollections = this.userConfig.getCollections();
14306
13883
  let result = await configCollections[name](this.collection);
14307
- debug15(`Collection: collections.${name} size: ${result?.length}`);
13884
+ debug14(`Collection: collections.${name} size: ${result?.length}`);
14308
13885
  return result;
14309
13886
  }
14310
13887
  populateCollectionsWithContent() {
@@ -14426,167 +14003,68 @@ ${outputPaths[page.outputPath].map(function(inputPath, index) {
14426
14003
  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.
14427
14004
 
14428
14005
  Learn more: https://v3.11ty.dev/docs/permalinks/#trailing-slashes
14429
-
14430
- This is usually but not *always* an error so if you\u2019d like to disable this error message, add \`eleventyAllowMissingExtension: true\` somewhere in the data cascade for this template or use \`$config.configureErrorReporting({ allowMissingExtensions: true });\` to disable this feature globally.`);
14431
- e.skipOriginalStack = true;
14432
- throw e;
14433
- }
14434
- }
14435
- });
14436
- }
14437
- // TODO move these into TemplateMapTest.js
14438
- _testGetAllTags() {
14439
- let allTags = {};
14440
- for (let map of this.map) {
14441
- let tags = map.data.tags;
14442
- if (Array.isArray(tags)) {
14443
- for (let tag of tags) {
14444
- allTags[tag] = true;
14445
- }
14446
- }
14447
- }
14448
- return Object.keys(allTags);
14449
- }
14450
- async _testGetUserConfigCollectionsData() {
14451
- let collections = {};
14452
- let configCollections = this.userConfig.getCollections();
14453
- for (let name in configCollections) {
14454
- collections[name] = configCollections[name](this.collection);
14455
- debug15(`Collection: collections.${name} size: ${collections[name].length}`);
14456
- }
14457
- return collections;
14458
- }
14459
- async _testGetTaggedCollectionsData() {
14460
- let collections = {};
14461
- collections.all = this.collection.getAllSorted();
14462
- debug15(`Collection: collections.all size: ${collections.all.length}`);
14463
- let tags = this._testGetAllTags();
14464
- for (let tag of tags) {
14465
- collections[tag] = this.collection.getFilteredByTag(tag);
14466
- debug15(`Collection: collections.${tag} size: ${collections[tag].length}`);
14467
- }
14468
- return collections;
14469
- }
14470
- async _testGetAllCollectionsData() {
14471
- let collections = {};
14472
- let taggedCollections = await this._testGetTaggedCollectionsData();
14473
- Object.assign(collections, taggedCollections);
14474
- let userConfigCollections = await this._testGetUserConfigCollectionsData();
14475
- Object.assign(collections, userConfigCollections);
14476
- return collections;
14477
- }
14478
- async _testGetCollectionsData() {
14479
- if (!this.cached) {
14480
- await this.cache();
14481
- }
14482
- return this.collectionsData;
14483
- }
14484
- };
14485
- var TemplateMap_default = TemplateMap;
14486
-
14487
- // ../../src/TemplateWriter.js
14488
- init_BaseError();
14489
-
14490
- // ../../src/Errors/ErrorHandler.js
14491
- init_DebugLogUtil();
14492
- var debug16 = createDebug3("ErrorHandler");
14493
- var ErrorHandler = class _ErrorHandler {
14494
- #logger;
14495
- get logger() {
14496
- if (!this.#logger) {
14497
- throw new Error("Internal error: missing logger instance.");
14498
- }
14499
- return this.#logger;
14500
- }
14501
- set logger(logger) {
14502
- this.#logger = logger;
14503
- }
14504
- warn(e, msg) {
14505
- this.log(e, "warn", "yellow", void 0, [`${msg}:`]);
14506
- }
14507
- fatal(e, msg) {
14508
- this.error(e, msg);
14509
- process.exitCode = 1;
14510
- }
14511
- once(type, e, msg) {
14512
- if (e.__errorAlreadyLogged) {
14513
- return;
14514
- }
14515
- this[type || "error"](e, msg);
14516
- Object.defineProperty(e, "__errorAlreadyLogged", {
14517
- value: true
14518
- });
14519
- }
14520
- error(e, msg) {
14521
- this.log(e, "error", "red", true, [`${msg}:`]);
14522
- }
14523
- static getTotalErrorCount(e) {
14524
- let totalErrorCount = 0;
14525
- let errorCountRef = e;
14526
- while (errorCountRef) {
14527
- totalErrorCount++;
14528
- errorCountRef = errorCountRef.originalError;
14529
- }
14530
- return totalErrorCount;
14531
- }
14532
- //https://nodejs.org/api/process.html
14533
- log(e, type = "log", chalkColor = "", forceToConsole = false, messages = []) {
14534
- if (process.env.DEBUG) {
14535
- debug16("Full error object: %o", inspect(e));
14536
- }
14537
- let showStack = true;
14538
- if (e.skipOriginalStack) {
14539
- showStack = false;
14540
- }
14541
- let totalErrorCount = _ErrorHandler.getTotalErrorCount(e);
14542
- let ref = e;
14543
- let index = 1;
14544
- let debugs = [];
14545
- while (ref) {
14546
- let nextRef = ref.originalError;
14547
- if (nextRef?.cause) {
14548
- nextRef.originalError = nextRef.cause?.originalError ?? nextRef?.cause;
14549
- }
14550
- if (!nextRef && ErrorUtil.hasEmbeddedError(ref.message)) {
14551
- nextRef = ErrorUtil.deconvertErrorToObject(ref);
14552
- }
14553
- if (nextRef?.skipOriginalStack) {
14554
- showStack = false;
14555
- }
14556
- messages.push(
14557
- `${totalErrorCount > 1 ? `${index}. ` : ""}${(ErrorUtil.cleanMessage(ref.message) || "(No error message provided)").trim()}${ref.name !== "Error" ? ` (via ${ref.name})` : ""}`
14558
- );
14559
- if (process.env.DEBUG) {
14560
- debugs.push(`(${type} stack): ${ref.stack}`);
14561
- } else if (!nextRef) {
14562
- let stackStr = ref.stack || "";
14563
- if (e.removeDuplicateErrorStringFromOutput) {
14564
- stackStr = stackStr.replace(
14565
- `${ref.name}: ${ref.message}`,
14566
- "(Repeated output has been truncated\u2026)"
14567
- );
14006
+
14007
+ This is usually but not *always* an error so if you\u2019d like to disable this error message, add \`eleventyAllowMissingExtension: true\` somewhere in the data cascade for this template or use \`$config.configureErrorReporting({ allowMissingExtensions: true });\` to disable this feature globally.`);
14008
+ e.skipOriginalStack = true;
14009
+ throw e;
14568
14010
  }
14569
- if (showStack) {
14570
- messages.push("\nOriginal error stack trace: " + stackStr);
14011
+ }
14012
+ });
14013
+ }
14014
+ // TODO move these into TemplateMapTest.js
14015
+ _testGetAllTags() {
14016
+ let allTags = {};
14017
+ for (let map of this.map) {
14018
+ let tags = map.data.tags;
14019
+ if (Array.isArray(tags)) {
14020
+ for (let tag of tags) {
14021
+ allTags[tag] = true;
14571
14022
  }
14572
14023
  }
14573
- ref = nextRef;
14574
- index++;
14575
14024
  }
14576
- if (messages.length) {
14577
- this.logger.message(messages.join("\n"), type, chalkColor, forceToConsole);
14025
+ return Object.keys(allTags);
14026
+ }
14027
+ async _testGetUserConfigCollectionsData() {
14028
+ let collections = {};
14029
+ let configCollections = this.userConfig.getCollections();
14030
+ for (let name in configCollections) {
14031
+ collections[name] = configCollections[name](this.collection);
14032
+ debug14(`Collection: collections.${name} size: ${collections[name].length}`);
14578
14033
  }
14579
- if (debugs.length > 0) {
14580
- for (let msg of debugs) {
14581
- debug16(msg);
14582
- }
14034
+ return collections;
14035
+ }
14036
+ async _testGetTaggedCollectionsData() {
14037
+ let collections = {};
14038
+ collections.all = this.collection.getAllSorted();
14039
+ debug14(`Collection: collections.all size: ${collections.all.length}`);
14040
+ let tags = this._testGetAllTags();
14041
+ for (let tag of tags) {
14042
+ collections[tag] = this.collection.getFilteredByTag(tag);
14043
+ debug14(`Collection: collections.${tag} size: ${collections[tag].length}`);
14044
+ }
14045
+ return collections;
14046
+ }
14047
+ async _testGetAllCollectionsData() {
14048
+ let collections = {};
14049
+ let taggedCollections = await this._testGetTaggedCollectionsData();
14050
+ Object.assign(collections, taggedCollections);
14051
+ let userConfigCollections = await this._testGetUserConfigCollectionsData();
14052
+ Object.assign(collections, userConfigCollections);
14053
+ return collections;
14054
+ }
14055
+ async _testGetCollectionsData() {
14056
+ if (!this.cached) {
14057
+ await this.cache();
14583
14058
  }
14059
+ return this.collectionsData;
14584
14060
  }
14585
14061
  };
14062
+ var TemplateMap_default = TemplateMap;
14586
14063
 
14587
14064
  // ../../src/TemplateWriter.js
14065
+ init_BaseError();
14588
14066
  init_DebugLogUtil();
14589
- var debug17 = createDebug3("TemplateWriter");
14067
+ var debug15 = createDebug3("TemplateWriter");
14590
14068
  var TemplateWriterMissingConfigArgError = class extends BaseError {
14591
14069
  };
14592
14070
  var PassthroughCopyError = class extends BaseError {
@@ -14864,9 +14342,6 @@ var TemplateWriter = class {
14864
14342
  }
14865
14343
  async createTemplateMap(paths, to) {
14866
14344
  this.templateMap = new TemplateMap_default(this.templateConfig);
14867
- if (this.templateData) {
14868
- this.templateMap.setTemplateData(this.templateData);
14869
- }
14870
14345
  await this.#addToTemplateMap(paths, to);
14871
14346
  await this.templateMap.cache();
14872
14347
  return this.templateMap;
@@ -14891,7 +14366,7 @@ var TemplateWriter = class {
14891
14366
  async generateTemplates(paths, to = "fs") {
14892
14367
  let promises2 = [];
14893
14368
  await this.createTemplateMap(paths, to);
14894
- debug17("Template map created.");
14369
+ debug15("Template map created.");
14895
14370
  let usedTemplateContentTooEarlyMap = [];
14896
14371
  for (let mapEntry of this.templateMap.getMap()) {
14897
14372
  promises2.push(
@@ -15242,9 +14717,105 @@ var ExtensionMap = class {
15242
14717
  }
15243
14718
  };
15244
14719
 
14720
+ // ../../src/Errors/ErrorHandler.js
14721
+ init_DebugLogUtil();
14722
+ var debug16 = createDebug3("ErrorHandler");
14723
+ var ErrorHandler = class _ErrorHandler {
14724
+ #logger;
14725
+ get logger() {
14726
+ if (!this.#logger) {
14727
+ throw new Error("Internal error: missing logger instance.");
14728
+ }
14729
+ return this.#logger;
14730
+ }
14731
+ set logger(logger) {
14732
+ this.#logger = logger;
14733
+ }
14734
+ warn(e, msg) {
14735
+ this.log(e, "warn", "yellow", void 0, [`${msg}:`]);
14736
+ }
14737
+ fatal(e, msg) {
14738
+ this.error(e, msg);
14739
+ process.exitCode = 1;
14740
+ }
14741
+ once(type, e, msg) {
14742
+ if (e.__errorAlreadyLogged) {
14743
+ return;
14744
+ }
14745
+ this[type || "error"](e, msg);
14746
+ Object.defineProperty(e, "__errorAlreadyLogged", {
14747
+ value: true
14748
+ });
14749
+ }
14750
+ error(e, msg) {
14751
+ this.log(e, "error", "red", true, [`${msg}:`]);
14752
+ }
14753
+ static getTotalErrorCount(e) {
14754
+ let totalErrorCount = 0;
14755
+ let errorCountRef = e;
14756
+ while (errorCountRef) {
14757
+ totalErrorCount++;
14758
+ errorCountRef = errorCountRef.originalError;
14759
+ }
14760
+ return totalErrorCount;
14761
+ }
14762
+ //https://nodejs.org/api/process.html
14763
+ log(e, type = "log", chalkColor = "", forceToConsole = false, messages = []) {
14764
+ if (process.env.DEBUG) {
14765
+ debug16("Full error object: %o", inspect(e));
14766
+ }
14767
+ let showStack = true;
14768
+ if (e.skipOriginalStack) {
14769
+ showStack = false;
14770
+ }
14771
+ let totalErrorCount = _ErrorHandler.getTotalErrorCount(e);
14772
+ let ref = e;
14773
+ let index = 1;
14774
+ let debugs = [];
14775
+ while (ref) {
14776
+ let nextRef = ref.originalError;
14777
+ if (nextRef?.cause) {
14778
+ nextRef.originalError = nextRef.cause?.originalError ?? nextRef?.cause;
14779
+ }
14780
+ if (!nextRef && ErrorUtil.hasEmbeddedError(ref.message)) {
14781
+ nextRef = ErrorUtil.deconvertErrorToObject(ref);
14782
+ }
14783
+ if (nextRef?.skipOriginalStack) {
14784
+ showStack = false;
14785
+ }
14786
+ messages.push(
14787
+ `${totalErrorCount > 1 ? `${index}. ` : ""}${(ErrorUtil.cleanMessage(ref.message) || "(No error message provided)").trim()}${ref.name !== "Error" ? ` (via ${ref.name})` : ""}`
14788
+ );
14789
+ if (process.env.DEBUG) {
14790
+ debugs.push(`(${type} stack): ${ref.stack}`);
14791
+ } else if (!nextRef) {
14792
+ let stackStr = ref.stack || "";
14793
+ if (e.removeDuplicateErrorStringFromOutput) {
14794
+ stackStr = stackStr.replace(
14795
+ `${ref.name}: ${ref.message}`,
14796
+ "(Repeated output has been truncated\u2026)"
14797
+ );
14798
+ }
14799
+ if (showStack) {
14800
+ messages.push("\nOriginal error stack trace: " + stackStr);
14801
+ }
14802
+ }
14803
+ ref = nextRef;
14804
+ index++;
14805
+ }
14806
+ if (messages.length) {
14807
+ this.logger.message(messages.join("\n"), type, chalkColor, forceToConsole);
14808
+ }
14809
+ if (debugs.length > 0) {
14810
+ for (let msg of debugs) {
14811
+ debug16(msg);
14812
+ }
14813
+ }
14814
+ }
14815
+ };
14816
+
15245
14817
  // ../../src/TemplateConfig.js
15246
14818
  var import_eleventy_utils29 = __toESM(require_eleventy_utils(), 1);
15247
- var import_lodash_custom10 = __toESM(require_lodash_custom(), 1);
15248
14819
 
15249
14820
  // ../../src/defaultConfigExtended.client.js
15250
14821
  function defaultConfigExtended_client_default(config) {
@@ -15375,43 +14946,173 @@ var Compatibility = class _Compatibility {
15375
14946
  constructor(compatibleRange) {
15376
14947
  this.compatibleRange = _Compatibility.getCompatibilityValue(compatibleRange);
15377
14948
  }
15378
- static get projectPackageJson() {
15379
- if (!this.#projectPackageJson) {
15380
- this.#projectPackageJson = getWorkingProjectPackageJson();
15381
- }
15382
- return this.#projectPackageJson;
14949
+ static get projectPackageJson() {
14950
+ if (!this.#projectPackageJson) {
14951
+ this.#projectPackageJson = getWorkingProjectPackageJson();
14952
+ }
14953
+ return this.#projectPackageJson;
14954
+ }
14955
+ static normalizeIdentifier(identifier) {
14956
+ return identifier.replace(_Compatibility.NORMALIZE_PRERELEASE_REGEX, "-alpha");
14957
+ }
14958
+ static getCompatibilityValue(compatibleRange) {
14959
+ if (compatibleRange) {
14960
+ return compatibleRange;
14961
+ }
14962
+ if (this.projectPackageJson?.["11ty"]?.compatibility) {
14963
+ return this.projectPackageJson["11ty"].compatibility;
14964
+ }
14965
+ }
14966
+ isCompatible() {
14967
+ return _Compatibility.satisfies(pkg.version, this.compatibleRange);
14968
+ }
14969
+ static satisfies(version, compatibleRange) {
14970
+ return satisfies(
14971
+ _Compatibility.normalizeIdentifier(version),
14972
+ _Compatibility.normalizeIdentifier(compatibleRange),
14973
+ {
14974
+ includePrerelease: true
14975
+ }
14976
+ );
14977
+ }
14978
+ getErrorMessage() {
14979
+ return `We found Eleventy version '${pkg.version}' which does not meet the required version range: '${this.compatibleRange}'. Use \`npm install @11ty/eleventy\` to upgrade your local project to the latest Eleventy version (or \`npm install @11ty/eleventy -g\` to upgrade the globally installed version).`;
14980
+ }
14981
+ };
14982
+ var Compatibility_default = Compatibility;
14983
+
14984
+ // ../../src/UserConfig.js
14985
+ init_BaseError();
14986
+
14987
+ // ../../src/Util/ConsoleLogger.js
14988
+ init_DebugLogUtil();
14989
+ init_IsBuildAwesome();
14990
+ var debug17 = createDebug3("Logger");
14991
+ var ConsoleLogger = class {
14992
+ /** @type {boolean} */
14993
+ #isVerbose = true;
14994
+ /** @type {boolean} */
14995
+ #isChalkEnabled = true;
14996
+ /** @type {object|boolean|undefined} */
14997
+ #logger;
14998
+ /** @type {string} */
14999
+ #defaultLogPrefix = "[11ty]";
15000
+ /** @type {object} */
15001
+ #colorFallbacks = {
15002
+ info: "blue",
15003
+ warn: "yellow",
15004
+ error: "red"
15005
+ };
15006
+ constructor() {
15007
+ if (isUsingBuildAwesome()) {
15008
+ this.setPrefix(`[buildawesome]`);
15009
+ }
15010
+ }
15011
+ isLoggingEnabled() {
15012
+ if (!this.isVerbose || process.env.DEBUG) {
15013
+ return true;
15014
+ }
15015
+ return this.#logger !== false;
15016
+ }
15017
+ setPrefix(prefix) {
15018
+ this.#defaultLogPrefix = prefix;
15019
+ }
15020
+ get isVerbose() {
15021
+ return this.#isVerbose;
15022
+ }
15023
+ set isVerbose(verbose) {
15024
+ this.#isVerbose = !!verbose;
15025
+ }
15026
+ get isChalkEnabled() {
15027
+ return this.#isChalkEnabled;
15028
+ }
15029
+ set isChalkEnabled(enabled2) {
15030
+ this.#isChalkEnabled = !!enabled2;
15031
+ }
15032
+ overrideLogger(logger) {
15033
+ this.#logger = logger;
15034
+ }
15035
+ get logger() {
15036
+ if (this.#logger) {
15037
+ return this.#logger;
15038
+ }
15039
+ if ("console" in globalThis) {
15040
+ return globalThis.console;
15041
+ }
15042
+ throw new Error(
15043
+ "Internal JavaScript runtime error: No logger instance found (is globalThis not supported?)."
15044
+ );
15045
+ }
15046
+ /** @param {string} msg */
15047
+ log(msg) {
15048
+ this.message(msg);
15049
+ }
15050
+ /**
15051
+ * @typedef LogOptions
15052
+ * @property {string} message
15053
+ * @property {string=} prefix
15054
+ * @property {LogType=} type
15055
+ * @property {string=} color
15056
+ * @property {boolean=} force
15057
+ * @param {LogOptions} options
15058
+ */
15059
+ logWithOptions({ message, type, prefix, color, force }) {
15060
+ this.message(message, type, color, force, prefix);
15061
+ }
15062
+ /** @param {string} msg */
15063
+ forceLog(msg) {
15064
+ this.message(msg, void 0, void 0, true);
15383
15065
  }
15384
- static normalizeIdentifier(identifier) {
15385
- return identifier.replace(_Compatibility.NORMALIZE_PRERELEASE_REGEX, "-alpha");
15066
+ /** @param {string} msg */
15067
+ info(msg) {
15068
+ this.message(msg, "log", this.#colorFallbacks.info);
15386
15069
  }
15387
- static getCompatibilityValue(compatibleRange) {
15388
- if (compatibleRange) {
15389
- return compatibleRange;
15390
- }
15391
- if (this.projectPackageJson?.["11ty"]?.compatibility) {
15392
- return this.projectPackageJson["11ty"].compatibility;
15393
- }
15070
+ /** @param {string} msg */
15071
+ warn(msg) {
15072
+ this.message(msg, "warn", this.#colorFallbacks.warn);
15394
15073
  }
15395
- isCompatible() {
15396
- return _Compatibility.satisfies(pkg.version, this.compatibleRange);
15074
+ /** @param {string} msg */
15075
+ error(msg) {
15076
+ this.message(msg, "error", this.#colorFallbacks.error);
15397
15077
  }
15398
- static satisfies(version, compatibleRange) {
15399
- return satisfies(
15400
- _Compatibility.normalizeIdentifier(version),
15401
- _Compatibility.normalizeIdentifier(compatibleRange),
15402
- {
15403
- includePrerelease: true
15404
- }
15405
- );
15078
+ /** @param {string} message */
15079
+ #dim(message) {
15080
+ if ("dim" in chalk_client_default) {
15081
+ return chalk_client_default.dim(message);
15082
+ }
15083
+ return message;
15406
15084
  }
15407
- getErrorMessage() {
15408
- return `We found Eleventy version '${pkg.version}' which does not meet the required version range: '${this.compatibleRange}'. Use \`npm install @11ty/eleventy\` to upgrade your local project to the latest Eleventy version (or \`npm install @11ty/eleventy -g\` to upgrade the globally installed version).`;
15085
+ /**
15086
+ * Formats the message to log.
15087
+ *
15088
+ * @param {string} message - The raw message to log.
15089
+ * @param {LogType} [type='log'] - The error level to log.
15090
+ * @param {string|undefined} [chalkColor=undefined] - Color name or falsy to disable
15091
+ * @param {boolean} [forceToConsole=false] - Enforce a log on console instead of specified target.
15092
+ * @param {string|undefined} [prefix=undefined] - Dimmed string at the start of each line
15093
+ */
15094
+ message(message, type = "log", chalkColor = void 0, forceToConsole = false, prefix = void 0) {
15095
+ if (!forceToConsole && (!this.isVerbose || process.env.DEBUG)) {
15096
+ debug17(message);
15097
+ } else if (this.#logger !== false) {
15098
+ if (prefix === void 0) {
15099
+ prefix = this.#defaultLogPrefix;
15100
+ }
15101
+ let prefixStr = prefix ? `${this.#dim(prefix)} ` : "";
15102
+ message = `${prefixStr}${message.split("\n").join(`
15103
+ ${prefixStr}`)}`;
15104
+ if (chalkColor === void 0 && type) {
15105
+ chalkColor = this.#colorFallbacks[type];
15106
+ }
15107
+ if (chalkColor && this.isChalkEnabled) {
15108
+ this.logger[type](chalk_client_default[chalkColor](message));
15109
+ } else {
15110
+ this.logger[type](message);
15111
+ }
15112
+ }
15409
15113
  }
15410
15114
  };
15411
- var Compatibility_default = Compatibility;
15412
-
15413
- // ../../src/UserConfig.js
15414
- init_BaseError();
15115
+ var ConsoleLogger_default = ConsoleLogger;
15415
15116
 
15416
15117
  // ../../src/Benchmark/BenchmarkGroup.js
15417
15118
  init_DebugLogUtil();
@@ -16639,7 +16340,7 @@ var UserConfig = class {
16639
16340
  _normalizeTemplateFormats() {
16640
16341
  throw new Error("The internal _normalizeTemplateFormats() method was removed in Eleventy v3");
16641
16342
  }
16642
- configureTemplateHandling(options = {}) {
16343
+ configureTemplateHandling() {
16643
16344
  throw new Error("Internal configuration API method `configureTemplateHandling` was removed.");
16644
16345
  }
16645
16346
  setDataDeepMerge(deepMerge) {
@@ -16847,7 +16548,6 @@ function expandEligibleJavaScriptFilePaths(fileslug) {
16847
16548
  }
16848
16549
 
16849
16550
  // ../../src/TemplateConfig.js
16850
- var { set: lodashSet10, get: lodashGet7 } = import_lodash_custom10.default;
16851
16551
  var debug20 = createDebug3("TemplateConfig");
16852
16552
  var ConfigError = class extends BaseError {
16853
16553
  };
@@ -17185,108 +16885,401 @@ var TemplateConfig = class {
17185
16885
  this.directories.setViaConfigObject(localConfig.dir);
17186
16886
  }
17187
16887
  }
17188
- if (this.userConfig?.templateFormats) {
17189
- this.templateFormats.setViaConfig(this.userConfig.templateFormats);
17190
- } else if (localConfig?.templateFormats || this.rootConfig?.templateFormats) {
17191
- this.templateFormats.setViaConfig(
17192
- localConfig.templateFormats || this.rootConfig?.templateFormats
17193
- );
16888
+ if (this.userConfig?.templateFormats) {
16889
+ this.templateFormats.setViaConfig(this.userConfig.templateFormats);
16890
+ } else if (localConfig?.templateFormats || this.rootConfig?.templateFormats) {
16891
+ this.templateFormats.setViaConfig(
16892
+ localConfig.templateFormats || this.rootConfig?.templateFormats
16893
+ );
16894
+ }
16895
+ if (this.userConfig?.templateFormatsAdded) {
16896
+ this.templateFormats.addViaConfig(this.userConfig.templateFormatsAdded);
16897
+ }
16898
+ if (this.userConfig?.htmlTemplateEngine !== void 0) {
16899
+ localConfig.htmlTemplateEngine = this.userConfig?.htmlTemplateEngine;
16900
+ }
16901
+ if (this.userConfig?.markdownTemplateEngine !== void 0) {
16902
+ localConfig.markdownTemplateEngine = this.userConfig?.markdownTemplateEngine;
16903
+ }
16904
+ let mergedConfig = (0, import_eleventy_utils29.Merge)({}, this.rootConfig, localConfig);
16905
+ mergedConfig.templateFormats = Object.freeze(this.templateFormats.getTemplateFormats());
16906
+ if (this.overrides.pathPrefix) {
16907
+ mergedConfig.pathPrefix = this.overrides.pathPrefix;
16908
+ }
16909
+ if (!mergedConfig.pathPrefix) {
16910
+ mergedConfig.pathPrefix = this.rootConfig.pathPrefix;
16911
+ }
16912
+ if (this.directories) {
16913
+ mergedConfig.directories = this.directories.getUserspaceInstance();
16914
+ }
16915
+ await this.userConfig.events.emit("buildawesome.beforeconfig", this.userConfig);
16916
+ let pluginsBench = this.aggregateBenchmark.get("Processing plugins in config");
16917
+ pluginsBench.before();
16918
+ await this.processPlugins(mergedConfig);
16919
+ pluginsBench.after();
16920
+ if (this.userConfig?.templateFormatsAdded) {
16921
+ this.templateFormats.addViaConfig(this.userConfig.templateFormatsAdded);
16922
+ mergedConfig.templateFormats = Object.freeze(this.templateFormats.getTemplateFormats());
16923
+ }
16924
+ let eleventyConfigApiMergingObject = this.userConfig.getMergingConfigObject();
16925
+ if ("templateFormats" in eleventyConfigApiMergingObject) {
16926
+ throw new Error(
16927
+ "Internal error: templateFormats should not return from `getMergingConfigObject`"
16928
+ );
16929
+ }
16930
+ debug20("Configuration overrides: %o", this.overrides);
16931
+ (0, import_eleventy_utils29.Merge)(mergedConfig, eleventyConfigApiMergingObject, this.overrides);
16932
+ debug20("Current configuration: %o", mergedConfig);
16933
+ mergedConfig.uses = this.usesGraph;
16934
+ return mergedConfig;
16935
+ }
16936
+ /**
16937
+ * @type {GlobalDependencyMap}
16938
+ */
16939
+ get usesGraph() {
16940
+ if (!this.#usesGraph) {
16941
+ this.#usesGraph = new GlobalDependencyMap_default();
16942
+ this.#usesGraph.setIsEsm(this.isEsm);
16943
+ this.#usesGraph.setTemplateConfig(this);
16944
+ }
16945
+ return this.#usesGraph;
16946
+ }
16947
+ /**
16948
+ * @type {GlobalDependencyMap}
16949
+ */
16950
+ get uses() {
16951
+ if (!this.usesGraph) {
16952
+ throw new Error("The Eleventy Global Dependency Graph has not yet been initialized.");
16953
+ }
16954
+ return this.usesGraph;
16955
+ }
16956
+ /**
16957
+ * @type {ExistsCache}
16958
+ */
16959
+ get existsCache() {
16960
+ return this.#existsCache;
16961
+ }
16962
+ };
16963
+ var TemplateConfig_default = TemplateConfig;
16964
+
16965
+ // ../../src/CoreMinimal.js
16966
+ init_DebugLogUtil();
16967
+
16968
+ // ../../src/Util/FileSize.js
16969
+ function readableFileSize(bytes) {
16970
+ let entries = [
16971
+ [1e6, "mB"],
16972
+ [1e3, "kB"]
16973
+ ];
16974
+ for (let [compare, suffix] of entries) {
16975
+ if (Math.abs(bytes) >= compare) {
16976
+ return Math.round(bytes / compare) + suffix;
16977
+ }
16978
+ }
16979
+ return bytes + " bytes";
16980
+ }
16981
+
16982
+ // ../../src/Util/Pluralize.js
16983
+ function Pluralize_default(count, singleWord, pluralWord) {
16984
+ return count === 1 ? singleWord : pluralWord;
16985
+ }
16986
+
16987
+ // ../../src/Util/ProjectDirectories.js
16988
+ init_shim_consume_fs();
16989
+ var import_node_path10 = __toESM(require_path(), 1);
16990
+ var import_eleventy_utils30 = __toESM(require_eleventy_utils(), 1);
16991
+
16992
+ // ../../src/Util/DirContains.js
16993
+ var import_node_path9 = __toESM(require_path(), 1);
16994
+ function DirContains_default(parentFolder, subFolder) {
16995
+ if (import_node_path9.default.resolve(subFolder).startsWith(import_node_path9.default.resolve(parentFolder))) {
16996
+ return true;
16997
+ }
16998
+ return false;
16999
+ }
17000
+
17001
+ // ../../src/Util/ProjectDirectories.js
17002
+ var ProjectDirectories = class _ProjectDirectories {
17003
+ static defaults = {
17004
+ input: "./",
17005
+ data: "./_data/",
17006
+ // Relative to input directory
17007
+ includes: "./_includes/",
17008
+ // Relative to input directory
17009
+ layouts: "./_layouts/",
17010
+ // Relative to input directory
17011
+ output: "./_site/"
17012
+ };
17013
+ // no updates allowed, input/output set via CLI
17014
+ #frozen = false;
17015
+ #raw = {};
17016
+ #dirs = {};
17017
+ inputFile = void 0;
17018
+ inputGlob = void 0;
17019
+ static relativeToProjectRoot(fileOrDir) {
17020
+ return this.normalizePath(import_eleventy_utils30.TemplatePath.relativePath(fileOrDir));
17021
+ }
17022
+ // Add leading dot slash
17023
+ // Use forward slashes
17024
+ static normalizePath(fileOrDir) {
17025
+ return import_eleventy_utils30.TemplatePath.standardizeFilePath(fileOrDir);
17026
+ }
17027
+ // Must be a directory
17028
+ // Always include a trailing slash
17029
+ static normalizeDirectory(dir) {
17030
+ return this.addTrailingSlash(this.normalizePath(dir));
17031
+ }
17032
+ normalizeDirectoryPathRelativeToInputDirectory(filePath) {
17033
+ return _ProjectDirectories.normalizeDirectory(import_node_path10.default.join(this.input, filePath));
17034
+ }
17035
+ static addTrailingSlash(path9) {
17036
+ if (path9.slice(-1) === "/") {
17037
+ return path9;
17038
+ }
17039
+ return path9 + "/";
17040
+ }
17041
+ // If input/output are set via CLI, they take precedence over all other configuration values.
17042
+ freeze() {
17043
+ this.#frozen = true;
17044
+ }
17045
+ setViaConfigObject(configDirs = {}) {
17046
+ let inputChanged = false;
17047
+ if (configDirs.input && _ProjectDirectories.normalizeDirectory(configDirs.input) !== this.input) {
17048
+ this.#setInputRaw(configDirs.input);
17049
+ inputChanged = true;
17050
+ }
17051
+ if (configDirs.output !== void 0) {
17052
+ if (_ProjectDirectories.normalizeDirectory(configDirs.output) !== this.output) {
17053
+ this.setOutput(configDirs.output);
17054
+ }
17055
+ }
17056
+ if (configDirs.data !== void 0) {
17057
+ if (inputChanged || this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.data || "") !== this.data) {
17058
+ this.setData(configDirs.data);
17059
+ }
17060
+ }
17061
+ if (configDirs.includes !== void 0) {
17062
+ if (inputChanged || this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.includes || "") !== this.includes) {
17063
+ this.setIncludes(configDirs.includes);
17064
+ }
17065
+ }
17066
+ if (configDirs.layouts !== void 0) {
17067
+ if (inputChanged || this.normalizeDirectoryPathRelativeToInputDirectory(configDirs.layouts || "") !== this.layouts) {
17068
+ this.setLayouts(configDirs.layouts);
17069
+ }
17194
17070
  }
17195
- if (this.userConfig?.templateFormatsAdded) {
17196
- this.templateFormats.addViaConfig(this.userConfig.templateFormatsAdded);
17071
+ if (inputChanged) {
17072
+ this.updateInputDependencies();
17197
17073
  }
17198
- if (this.userConfig?.htmlTemplateEngine !== void 0) {
17199
- localConfig.htmlTemplateEngine = this.userConfig?.htmlTemplateEngine;
17074
+ }
17075
+ updateInputDependencies() {
17076
+ this.setData(this.#raw.data ?? _ProjectDirectories.defaults.data);
17077
+ this.setIncludes(this.#raw.includes ?? _ProjectDirectories.defaults.includes);
17078
+ if (this.#raw.layouts !== void 0) {
17079
+ this.setLayouts(this.#raw.layouts ?? _ProjectDirectories.defaults.layouts);
17200
17080
  }
17201
- if (this.userConfig?.markdownTemplateEngine !== void 0) {
17202
- localConfig.markdownTemplateEngine = this.userConfig?.markdownTemplateEngine;
17081
+ }
17082
+ /* Relative to project root, must exist */
17083
+ #setInputRaw(dirOrFile, inputDir = void 0) {
17084
+ if (this.#frozen && this.#raw.input !== void 0) {
17085
+ return;
17203
17086
  }
17204
- let mergedConfig = (0, import_eleventy_utils29.Merge)({}, this.rootConfig, localConfig);
17205
- mergedConfig.templateFormats = Object.freeze(this.templateFormats.getTemplateFormats());
17206
- if (this.overrides.pathPrefix) {
17207
- mergedConfig.pathPrefix = this.overrides.pathPrefix;
17087
+ this.#raw.input = dirOrFile;
17088
+ if (!dirOrFile) {
17089
+ return;
17208
17090
  }
17209
- if (!mergedConfig.pathPrefix) {
17210
- mergedConfig.pathPrefix = this.rootConfig.pathPrefix;
17091
+ if (import_node_path10.default.isAbsolute(dirOrFile)) {
17092
+ dirOrFile = import_node_path10.default.relative(".", dirOrFile);
17211
17093
  }
17212
- if (this.directories) {
17213
- mergedConfig.directories = this.directories.getUserspaceInstance();
17094
+ let inputExists = existsSync(dirOrFile);
17095
+ let inputExistsAndIsDirectory = inputExists && statSync(dirOrFile).isDirectory();
17096
+ if (inputExistsAndIsDirectory) {
17097
+ this.#dirs.input = _ProjectDirectories.normalizeDirectory(dirOrFile);
17098
+ } else {
17099
+ if (inputExists) {
17100
+ this.inputFile = _ProjectDirectories.normalizePath(dirOrFile);
17101
+ } else {
17102
+ if (!isDynamicPattern(dirOrFile)) {
17103
+ throw new Error(
17104
+ `The "${dirOrFile}" \`input\` parameter (directory or file path) must exist on the file system (unless detected as a glob by the \`tinyglobby\` package)`
17105
+ );
17106
+ }
17107
+ this.inputGlob = dirOrFile;
17108
+ }
17109
+ if (inputDir) {
17110
+ if (!existsSync(inputDir)) {
17111
+ throw new Error("Directory must exist (via inputDir option to Eleventy constructor).");
17112
+ }
17113
+ this.#dirs.input = _ProjectDirectories.normalizeDirectory(inputDir);
17114
+ } else {
17115
+ this.#dirs.input = _ProjectDirectories.normalizeDirectory(
17116
+ import_eleventy_utils30.TemplatePath.getDirFromFilePath(dirOrFile)
17117
+ // works with globs
17118
+ );
17119
+ }
17214
17120
  }
17215
- await this.userConfig.events.emit("buildawesome.beforeconfig", this.userConfig);
17216
- let pluginsBench = this.aggregateBenchmark.get("Processing plugins in config");
17217
- pluginsBench.before();
17218
- await this.processPlugins(mergedConfig);
17219
- pluginsBench.after();
17220
- if (this.userConfig?.templateFormatsAdded) {
17221
- this.templateFormats.addViaConfig(this.userConfig.templateFormatsAdded);
17222
- mergedConfig.templateFormats = Object.freeze(this.templateFormats.getTemplateFormats());
17121
+ }
17122
+ setInput(dirOrFile, inputDir = void 0) {
17123
+ this.#setInputRaw(dirOrFile, inputDir);
17124
+ this.updateInputDependencies();
17125
+ }
17126
+ /* Relative to input dir */
17127
+ setIncludes(dir) {
17128
+ if (dir !== void 0) {
17129
+ this.#raw.includes = dir;
17130
+ this.#dirs.includes = _ProjectDirectories.normalizeDirectory(
17131
+ import_eleventy_utils30.TemplatePath.join(this.input, dir || "")
17132
+ );
17223
17133
  }
17224
- let eleventyConfigApiMergingObject = this.userConfig.getMergingConfigObject();
17225
- if ("templateFormats" in eleventyConfigApiMergingObject) {
17226
- throw new Error(
17227
- "Internal error: templateFormats should not return from `getMergingConfigObject`"
17134
+ }
17135
+ /* Relative to input dir */
17136
+ /* Optional */
17137
+ setLayouts(dir) {
17138
+ if (dir !== void 0) {
17139
+ this.#raw.layouts = dir;
17140
+ this.#dirs.layouts = _ProjectDirectories.normalizeDirectory(
17141
+ import_eleventy_utils30.TemplatePath.join(this.input, dir || "")
17228
17142
  );
17229
17143
  }
17230
- debug20("Configuration overrides: %o", this.overrides);
17231
- (0, import_eleventy_utils29.Merge)(mergedConfig, eleventyConfigApiMergingObject, this.overrides);
17232
- debug20("Current configuration: %o", mergedConfig);
17233
- mergedConfig.uses = this.usesGraph;
17234
- return mergedConfig;
17235
17144
  }
17236
- /**
17237
- * @type {GlobalDependencyMap}
17238
- */
17239
- get usesGraph() {
17240
- if (!this.#usesGraph) {
17241
- this.#usesGraph = new GlobalDependencyMap_default();
17242
- this.#usesGraph.setIsEsm(this.isEsm);
17243
- this.#usesGraph.setTemplateConfig(this);
17145
+ /* Relative to input dir */
17146
+ setData(dir) {
17147
+ if (dir !== void 0) {
17148
+ this.#raw.data = dir;
17149
+ this.#dirs.data = _ProjectDirectories.normalizeDirectory(
17150
+ import_eleventy_utils30.TemplatePath.join(this.input, dir || "")
17151
+ );
17244
17152
  }
17245
- return this.#usesGraph;
17246
17153
  }
17247
- /**
17248
- * @type {GlobalDependencyMap}
17249
- */
17250
- get uses() {
17251
- if (!this.usesGraph) {
17252
- throw new Error("The Eleventy Global Dependency Graph has not yet been initialized.");
17154
+ /* Relative to project root */
17155
+ setOutput(dir) {
17156
+ if (this.#frozen && this.#raw.output !== void 0) {
17157
+ return;
17158
+ }
17159
+ if (dir !== void 0) {
17160
+ this.#raw.output = dir;
17161
+ if (import_node_path10.default.isAbsolute(dir)) {
17162
+ dir = import_node_path10.default.relative(".", dir);
17163
+ }
17164
+ this.#dirs.output = _ProjectDirectories.normalizeDirectory(dir || "");
17253
17165
  }
17254
- return this.usesGraph;
17255
17166
  }
17256
- /**
17257
- * @type {ExistsCache}
17258
- */
17259
- get existsCache() {
17260
- return this.#existsCache;
17167
+ get input() {
17168
+ return this.#dirs.input || _ProjectDirectories.defaults.input;
17261
17169
  }
17262
- };
17263
- var TemplateConfig_default = TemplateConfig;
17264
-
17265
- // ../../src/CoreMinimal.js
17266
- init_DebugLogUtil();
17267
-
17268
- // ../../src/Util/FileSize.js
17269
- function readableFileSize(bytes) {
17270
- let entries = [
17271
- [1e6, "mB"],
17272
- [1e3, "kB"]
17273
- ];
17274
- for (let [compare, suffix] of entries) {
17275
- if (Math.abs(bytes) >= compare) {
17276
- return Math.round(bytes / compare) + suffix;
17170
+ get data() {
17171
+ return this.#dirs.data || _ProjectDirectories.defaults.data;
17172
+ }
17173
+ get includes() {
17174
+ return this.#dirs.includes || _ProjectDirectories.defaults.includes;
17175
+ }
17176
+ get layouts() {
17177
+ return this.#dirs.layouts;
17178
+ }
17179
+ get output() {
17180
+ return this.#dirs.output || _ProjectDirectories.defaults.output;
17181
+ }
17182
+ isTemplateFile(filePath) {
17183
+ let inputPath = this.getInputPath(filePath);
17184
+ if (this.layouts && inputPath.startsWith(this.layouts)) {
17185
+ return false;
17186
+ }
17187
+ if (this.includes && this.includes !== this.input) {
17188
+ if (inputPath.startsWith(this.includes)) {
17189
+ return false;
17190
+ }
17277
17191
  }
17192
+ return inputPath.startsWith(this.input);
17278
17193
  }
17279
- return bytes + " bytes";
17280
- }
17281
-
17282
- // ../../src/Util/Pluralize.js
17283
- function Pluralize_default(count, singleWord, pluralWord) {
17284
- return count === 1 ? singleWord : pluralWord;
17285
- }
17194
+ // for a hypothetical template file
17195
+ getInputPath(filePathRelativeToInputDir) {
17196
+ return import_eleventy_utils30.TemplatePath.addLeadingDotSlash(
17197
+ import_eleventy_utils30.TemplatePath.join(this.input, import_eleventy_utils30.TemplatePath.standardizeFilePath(filePathRelativeToInputDir))
17198
+ );
17199
+ }
17200
+ // Inverse of getInputPath
17201
+ // Removes input dir from path
17202
+ getInputPathRelativeToInputDirectory(filePathRelativeToInputDir) {
17203
+ let inputDir = import_eleventy_utils30.TemplatePath.addLeadingDotSlash(import_eleventy_utils30.TemplatePath.join(this.input));
17204
+ return import_eleventy_utils30.TemplatePath.stripLeadingSubPath(filePathRelativeToInputDir, inputDir);
17205
+ }
17206
+ // Removes output dir from path
17207
+ getOutputPathRelativeToOutputDirectory(filePathRelativeToRootDir) {
17208
+ let filePath = import_eleventy_utils30.TemplatePath.addLeadingDotSlash(filePathRelativeToRootDir);
17209
+ let outputDir = import_eleventy_utils30.TemplatePath.addLeadingDotSlash(import_eleventy_utils30.TemplatePath.join(this.output));
17210
+ return "/" + import_eleventy_utils30.TemplatePath.stripLeadingSubPath(filePath, outputDir);
17211
+ }
17212
+ // for a hypothetical Eleventy layout file
17213
+ getLayoutPath(filePathRelativeToLayoutDir) {
17214
+ return import_eleventy_utils30.TemplatePath.addLeadingDotSlash(
17215
+ import_eleventy_utils30.TemplatePath.join(
17216
+ this.layouts || this.includes,
17217
+ import_eleventy_utils30.TemplatePath.standardizeFilePath(filePathRelativeToLayoutDir)
17218
+ )
17219
+ );
17220
+ }
17221
+ // Removes layout dir from path
17222
+ getLayoutPathRelativeToInputDirectory(filePathRelativeToLayoutDir) {
17223
+ let layoutPath = this.getLayoutPath(filePathRelativeToLayoutDir);
17224
+ let inputDir = import_eleventy_utils30.TemplatePath.addLeadingDotSlash(import_eleventy_utils30.TemplatePath.join(this.input));
17225
+ return import_eleventy_utils30.TemplatePath.stripLeadingSubPath(layoutPath, inputDir);
17226
+ }
17227
+ getProjectPath(filePath) {
17228
+ return import_eleventy_utils30.TemplatePath.addLeadingDotSlash(
17229
+ import_eleventy_utils30.TemplatePath.join(".", import_eleventy_utils30.TemplatePath.standardizeFilePath(filePath))
17230
+ );
17231
+ }
17232
+ isFileInProjectFolder(filePath) {
17233
+ return DirContains_default(import_eleventy_utils30.TemplatePath.getWorkingDir(), filePath);
17234
+ }
17235
+ isFileInOutputFolder(filePath) {
17236
+ return DirContains_default(this.output, filePath);
17237
+ }
17238
+ static getRelativeTo(targetPath, cwd) {
17239
+ return import_node_path10.default.relative(cwd, import_node_path10.default.join(import_node_path10.default.resolve("."), targetPath));
17240
+ }
17241
+ // Access the data without being able to set the data.
17242
+ getUserspaceInstance() {
17243
+ let d = this;
17244
+ return {
17245
+ get input() {
17246
+ return d.input;
17247
+ },
17248
+ get inputFile() {
17249
+ return d.inputFile;
17250
+ },
17251
+ get inputGlob() {
17252
+ return d.inputGlob;
17253
+ },
17254
+ get data() {
17255
+ return d.data;
17256
+ },
17257
+ get includes() {
17258
+ return d.includes;
17259
+ },
17260
+ get layouts() {
17261
+ return d.layouts;
17262
+ },
17263
+ get output() {
17264
+ return d.output;
17265
+ }
17266
+ };
17267
+ }
17268
+ toString() {
17269
+ return {
17270
+ input: this.input,
17271
+ inputFile: this.inputFile,
17272
+ inputGlob: this.inputGlob,
17273
+ data: this.data,
17274
+ includes: this.includes,
17275
+ layouts: this.layouts,
17276
+ output: this.output
17277
+ };
17278
+ }
17279
+ };
17286
17280
 
17287
17281
  // ../../src/CoreMinimal.js
17288
17282
  var import_EnvironmentVars = __toESM(require_EnvironmentVars(), 1);
17289
- init_IsBuildAwesome();
17290
17283
  var pkg2 = getCorePackageJson();
17291
17284
  var debug21 = createDebug3("Core");
17292
17285
  var CoreMinimal = class _CoreMinimal {
@@ -17329,7 +17322,7 @@ var CoreMinimal = class _CoreMinimal {
17329
17322
  let output;
17330
17323
  let options;
17331
17324
  let eleventyConfig;
17332
- if ((0, import_eleventy_utils30.isPlainObject)(args[0])) {
17325
+ if ((0, import_eleventy_utils31.isPlainObject)(args[0])) {
17333
17326
  options = args[0] || {};
17334
17327
  input = options.input;
17335
17328
  output = options.output;
@@ -17422,9 +17415,6 @@ var CoreMinimal = class _CoreMinimal {
17422
17415
  await this.eleventyConfig.setProjectConfigPath(this.configPath);
17423
17416
  }
17424
17417
  this.#activeConfigurationPath = this.configPath ?? this.eleventyConfig.getLocalProjectConfigFile();
17425
- if (isUsingBuildAwesome()) {
17426
- this.logger.setPrefix(`[buildawesome]`);
17427
- }
17428
17418
  this.eleventyConfig.setRunMode(this.runMode);
17429
17419
  this.eleventyConfig.setProjectUsingEsm(this.isEsm);
17430
17420
  this.eleventyConfig.setLogger(this.logger);
@@ -17612,9 +17602,9 @@ Verbose Output: ${this.verboseMode}`;
17612
17602
  runMode: this.runMode
17613
17603
  };
17614
17604
  if (this.#activeConfigurationPath) {
17615
- values.config = import_eleventy_utils30.TemplatePath.absolutePath(this.#activeConfigurationPath);
17605
+ values.config = import_eleventy_utils31.TemplatePath.absolutePath(this.#activeConfigurationPath);
17616
17606
  }
17617
- values.root = import_eleventy_utils30.TemplatePath.getWorkingDir();
17607
+ values.root = import_eleventy_utils31.TemplatePath.getWorkingDir();
17618
17608
  values.source = this.source;
17619
17609
  Object.defineProperty(values, "isServerless", {
17620
17610
  enumerable: false,
@@ -17729,7 +17719,7 @@ Verbose Output: ${this.verboseMode}`;
17729
17719
  } else {
17730
17720
  throw new Error("Invalid argument for setIncrementalFiles, needs string or Array");
17731
17721
  }
17732
- let normalized = files.map((p) => import_eleventy_utils30.TemplatePath.addLeadingDotSlash(p));
17722
+ let normalized = files.map((p) => import_eleventy_utils31.TemplatePath.addLeadingDotSlash(p));
17733
17723
  this.programmaticApiIncrementalFile = normalized;
17734
17724
  this.watchQueue?.setActiveQueue(normalized);
17735
17725
  }
@@ -17946,7 +17936,7 @@ Open an issue: https://github.com/11ty/buildawesome/issues/new`);
17946
17936
  ret.push(
17947
17937
  `in ${chalk_client_default.bold(time.toFixed(2))} ${Pluralize_default(time.toFixed(2), "second", "seconds")}`
17948
17938
  );
17949
- let cfgStr = this.#activeConfigurationPath ? `, ${import_eleventy_utils30.TemplatePath.stripLeadingDotSlash(this.#activeConfigurationPath)}` : " no config file";
17939
+ let cfgStr = this.#activeConfigurationPath ? `, ${import_eleventy_utils31.TemplatePath.stripLeadingDotSlash(this.#activeConfigurationPath)}` : " no config file";
17950
17940
  if (time >= 1 && writeCount > 1) {
17951
17941
  ret.push(
17952
17942
  chalk_client_default.gray(`(${(time * 1e3 / writeCount).toFixed(1)}ms each, v${pkg2.version}${cfgStr})`)