@11ty/client 4.0.0-alpha.5 → 4.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eleventy.core.js +225 -128
- package/dist/eleventy.js +3653 -3304
- package/dist/formats/eleventy-liquid.js +24 -16
- package/dist/formats/eleventy-markdown.js +8 -2
- package/dist/formats/eleventy-nunjucks.js +197 -277
- package/dist/plugins/eleventy-plugin-i18n.js +1 -1
- package/package.json +2 -2
package/dist/eleventy.core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Eleventy v4.0.0-alpha.
|
|
1
|
+
/*! Eleventy v4.0.0-alpha.7 (@11ty/client Bundle) */
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -42,6 +42,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
42
42
|
// src/shims/process.cjs
|
|
43
43
|
var require_process = __commonJS({
|
|
44
44
|
"src/shims/process.cjs"(exports, module) {
|
|
45
|
+
"use strict";
|
|
45
46
|
var process3 = module.exports = {};
|
|
46
47
|
var cachedSetTimeout;
|
|
47
48
|
var cachedClearTimeout;
|
|
@@ -2841,6 +2842,9 @@ var init_EventBus = __esm({
|
|
|
2841
2842
|
});
|
|
2842
2843
|
|
|
2843
2844
|
// ../../src/Util/Require.js
|
|
2845
|
+
function isCommonJSTypeScript(filePath, type) {
|
|
2846
|
+
return type === "cjs" && filePath.endsWith(".ts") || filePath.endsWith(".cts");
|
|
2847
|
+
}
|
|
2844
2848
|
function getImportErrorMessage(filePath, type) {
|
|
2845
2849
|
return `There was a problem importing '${import_node_path.default.relative(".", filePath)}' via ${type}`;
|
|
2846
2850
|
}
|
|
@@ -2886,6 +2890,9 @@ async function dynamicImportAbsolutePath(absolutePath, options = {}) {
|
|
|
2886
2890
|
);
|
|
2887
2891
|
}
|
|
2888
2892
|
}
|
|
2893
|
+
if (isCommonJSTypeScript(absolutePath, type)) {
|
|
2894
|
+
return requireCommonJsTypeScript(absolutePath);
|
|
2895
|
+
}
|
|
2889
2896
|
let urlPath;
|
|
2890
2897
|
try {
|
|
2891
2898
|
let u = new URL(`file:${absolutePath}`);
|
|
@@ -2985,7 +2992,7 @@ var init_package = __esm({
|
|
|
2985
2992
|
"../../package.json"() {
|
|
2986
2993
|
package_default = {
|
|
2987
2994
|
name: "@11ty/eleventy",
|
|
2988
|
-
version: "4.0.0-alpha.
|
|
2995
|
+
version: "4.0.0-alpha.7",
|
|
2989
2996
|
description: "A simpler static site generator.",
|
|
2990
2997
|
publishConfig: {
|
|
2991
2998
|
access: "public",
|
|
@@ -3082,86 +3089,86 @@ var init_package = __esm({
|
|
|
3082
3089
|
},
|
|
3083
3090
|
devDependencies: {
|
|
3084
3091
|
"@11ty/eleventy-img": "^6.0.4",
|
|
3085
|
-
"@11ty/eleventy-plugin-rss": "^
|
|
3092
|
+
"@11ty/eleventy-plugin-rss": "^3.0.0",
|
|
3086
3093
|
"@11ty/eleventy-plugin-syntaxhighlight": "^5.0.2",
|
|
3087
3094
|
"@11ty/eleventy-plugin-webc": "^0.12.0-beta.7",
|
|
3088
|
-
"@eslint/js": "^
|
|
3095
|
+
"@eslint/js": "^10.0.1",
|
|
3089
3096
|
"@iarna/toml": "^2.2.5",
|
|
3090
3097
|
"@mdx-js/node-loader": "^3.1.1",
|
|
3091
3098
|
"@stylistic/eslint-plugin-js": "^4.4.1",
|
|
3092
|
-
"@types/node": "^
|
|
3093
|
-
"@vue/server-renderer": "^3.5.
|
|
3094
|
-
"@zachleat/noop": "^1.0.
|
|
3099
|
+
"@types/node": "^25.5.0",
|
|
3100
|
+
"@vue/server-renderer": "^3.5.30",
|
|
3101
|
+
"@zachleat/noop": "^1.0.7",
|
|
3095
3102
|
ava: "^6.4.1",
|
|
3096
|
-
c8: "^
|
|
3103
|
+
c8: "^11.0.0",
|
|
3097
3104
|
"cross-env": "^10.1.0",
|
|
3098
|
-
eslint: "^
|
|
3105
|
+
eslint: "^10.1.0",
|
|
3099
3106
|
"eslint-config-prettier": "^10.1.8",
|
|
3100
|
-
globals: "^
|
|
3101
|
-
"jsx-async-runtime": "^
|
|
3107
|
+
globals: "^17.4.0",
|
|
3108
|
+
"jsx-async-runtime": "^2.0.3",
|
|
3102
3109
|
luxon: "^3.7.2",
|
|
3103
3110
|
"markdown-it-abbr": "^2.0.0",
|
|
3104
3111
|
"markdown-it-emoji": "^3.0.0",
|
|
3105
|
-
marked: "^
|
|
3106
|
-
"nano-staged": "^0.
|
|
3107
|
-
prettier: "^3.
|
|
3112
|
+
marked: "^17.0.5",
|
|
3113
|
+
"nano-staged": "^0.9.0",
|
|
3114
|
+
prettier: "^3.8.1",
|
|
3108
3115
|
pretty: "^2.0.0",
|
|
3109
|
-
react: "^19.2.
|
|
3110
|
-
"react-dom": "^19.2.
|
|
3111
|
-
|
|
3112
|
-
sass: "^1.94.2",
|
|
3116
|
+
react: "^19.2.4",
|
|
3117
|
+
"react-dom": "^19.2.4",
|
|
3118
|
+
sass: "^1.98.0",
|
|
3113
3119
|
"simple-git-hooks": "^2.13.1",
|
|
3114
|
-
tsx: "^4.
|
|
3120
|
+
tsx: "^4.21.0",
|
|
3115
3121
|
typescript: "^5.9.3",
|
|
3116
|
-
vue: "^3.5.
|
|
3117
|
-
zod: "^3.
|
|
3118
|
-
"zod-validation-error": "^
|
|
3122
|
+
vue: "^3.5.30",
|
|
3123
|
+
zod: "^4.3.6",
|
|
3124
|
+
"zod-validation-error": "^5.0.0"
|
|
3119
3125
|
},
|
|
3120
3126
|
dependencies: {
|
|
3121
|
-
"@11ty/dependency-tree": "^4.0.
|
|
3122
|
-
"@11ty/dependency-tree-esm": "^2.0.
|
|
3123
|
-
"@11ty/
|
|
3127
|
+
"@11ty/dependency-tree": "^4.0.2",
|
|
3128
|
+
"@11ty/dependency-tree-esm": "^2.0.4",
|
|
3129
|
+
"@11ty/dependency-tree-typescript": "^1.0.0",
|
|
3130
|
+
"@11ty/eleventy-dev-server": "^3.0.0-alpha.6",
|
|
3124
3131
|
"@11ty/eleventy-plugin-bundle": "^3.0.7",
|
|
3125
3132
|
"@11ty/eleventy-utils": "^2.0.7",
|
|
3126
3133
|
"@11ty/gray-matter": "^2.0.1",
|
|
3127
3134
|
"@11ty/lodash-custom": "^4.17.21",
|
|
3135
|
+
"@11ty/node-version-check": "^1.0.1",
|
|
3136
|
+
"@11ty/nunjucks": "^4.0.0-alpha.1",
|
|
3128
3137
|
"@11ty/parse-date-strings": "^2.0.6",
|
|
3129
3138
|
"@11ty/posthtml-urls": "^1.0.2",
|
|
3130
|
-
"@11ty/recursive-copy": "^
|
|
3139
|
+
"@11ty/recursive-copy": "^5.0.2",
|
|
3131
3140
|
"@sindresorhus/slugify": "^3.0.0",
|
|
3132
3141
|
"bcp-47-normalize": "^2.3.0",
|
|
3133
3142
|
chokidar: "^5.0.0",
|
|
3134
3143
|
debug: "^4.4.3",
|
|
3135
3144
|
"dependency-graph": "^1.0.0",
|
|
3136
|
-
entities: "^
|
|
3145
|
+
entities: "^8.0.0",
|
|
3137
3146
|
"import-module-string": "^2.0.3",
|
|
3138
3147
|
"iso-639-1": "^3.1.5",
|
|
3139
3148
|
kleur: "^4.1.5",
|
|
3140
|
-
liquidjs: "^10.
|
|
3141
|
-
"markdown-it": "^14.1.
|
|
3149
|
+
liquidjs: "^10.25.0",
|
|
3150
|
+
"markdown-it": "^14.1.1",
|
|
3142
3151
|
minimist: "^1.2.8",
|
|
3143
|
-
moo: "
|
|
3152
|
+
moo: "0.5.2",
|
|
3144
3153
|
"node-retrieve-globals": "^6.0.1",
|
|
3145
|
-
nunjucks: "^3.2.4",
|
|
3146
3154
|
picomatch: "^4.0.3",
|
|
3147
|
-
"please-upgrade-node": "^3.2.0",
|
|
3148
3155
|
posthtml: "^0.16.7",
|
|
3149
3156
|
"posthtml-match-helper": "^2.0.3",
|
|
3150
|
-
semver: "^7.7.
|
|
3157
|
+
semver: "^7.7.4",
|
|
3151
3158
|
tinyglobby: "^0.2.15"
|
|
3152
3159
|
},
|
|
3153
3160
|
overrides: {
|
|
3154
|
-
|
|
3155
|
-
chokidar: "$chokidar",
|
|
3156
|
-
fdir: "6.4.6",
|
|
3157
|
-
"posthtml-parser": "^0.12"
|
|
3161
|
+
fdir: "6.4.6"
|
|
3158
3162
|
}
|
|
3159
3163
|
};
|
|
3160
3164
|
}
|
|
3161
3165
|
});
|
|
3162
3166
|
|
|
3163
3167
|
// ../../src/Util/RequireUtils.core.js
|
|
3164
|
-
function clearRequireCache(
|
|
3168
|
+
function clearRequireCache() {
|
|
3169
|
+
}
|
|
3170
|
+
function requireCommonJsTypeScript() {
|
|
3171
|
+
throw new Error("TypeScript is not supported in this bundle of Eleventy.");
|
|
3165
3172
|
}
|
|
3166
3173
|
function importJsonSync(path9) {
|
|
3167
3174
|
let rawInput = loadContents(path9);
|
|
@@ -3177,6 +3184,15 @@ var init_RequireUtils_core = __esm({
|
|
|
3177
3184
|
}
|
|
3178
3185
|
});
|
|
3179
3186
|
|
|
3187
|
+
// ../../src/Util/FeatureTests.core.cjs
|
|
3188
|
+
var require_FeatureTests_core = __commonJS({
|
|
3189
|
+
"../../src/Util/FeatureTests.core.cjs"(exports, module) {
|
|
3190
|
+
module.exports.isTypeScriptSupported = function() {
|
|
3191
|
+
return false;
|
|
3192
|
+
};
|
|
3193
|
+
}
|
|
3194
|
+
});
|
|
3195
|
+
|
|
3180
3196
|
// ../../node_modules/kind-of/index.js
|
|
3181
3197
|
var require_kind_of = __commonJS({
|
|
3182
3198
|
"../../node_modules/kind-of/index.js"(exports, module) {
|
|
@@ -7029,6 +7045,22 @@ var init_JavaScript = __esm({
|
|
|
7029
7045
|
}
|
|
7030
7046
|
return new mod();
|
|
7031
7047
|
} else {
|
|
7048
|
+
if (mod.toString().trimStart().startsWith("class ")) {
|
|
7049
|
+
let modInstance = new mod();
|
|
7050
|
+
if (Object.hasOwn(modInstance, "data") || Object.hasOwn(modInstance, "render")) {
|
|
7051
|
+
if (!Object.hasOwn(modInstance, "render")) {
|
|
7052
|
+
mod.prototype.render = noop2;
|
|
7053
|
+
}
|
|
7054
|
+
if (!Object.hasOwn(modInstance, "data") && !mod.data && originalModData) {
|
|
7055
|
+
mod.prototype.data = originalModData;
|
|
7056
|
+
}
|
|
7057
|
+
return modInstance;
|
|
7058
|
+
} else {
|
|
7059
|
+
throw new Error(
|
|
7060
|
+
"Invalid class signature for an 11ty.js template: needs a render or data instance property."
|
|
7061
|
+
);
|
|
7062
|
+
}
|
|
7063
|
+
}
|
|
7032
7064
|
return {
|
|
7033
7065
|
...originalModData ? { data: originalModData } : void 0,
|
|
7034
7066
|
render: mod
|
|
@@ -7835,6 +7867,98 @@ init_EleventyBaseError();
|
|
|
7835
7867
|
|
|
7836
7868
|
// ../../src/Data/TemplateDataInitialGlobalData.js
|
|
7837
7869
|
var import_lodash_custom = __toESM(require_lodash_custom(), 1);
|
|
7870
|
+
|
|
7871
|
+
// ../../src/Util/ReservedData.js
|
|
7872
|
+
var EleventyReservedDataError = class extends TypeError {
|
|
7873
|
+
};
|
|
7874
|
+
var ReservedData = class _ReservedData {
|
|
7875
|
+
static fullProperties = [
|
|
7876
|
+
"pkg",
|
|
7877
|
+
// Object.freeze’d upstream
|
|
7878
|
+
"eleventy",
|
|
7879
|
+
// Object.freeze’d upstream
|
|
7880
|
+
// "page" is only frozen for specific subproperties below
|
|
7881
|
+
"content",
|
|
7882
|
+
"collections"
|
|
7883
|
+
];
|
|
7884
|
+
static properties = [
|
|
7885
|
+
// "page" is only frozen for specific subproperties below
|
|
7886
|
+
"content",
|
|
7887
|
+
"collections"
|
|
7888
|
+
];
|
|
7889
|
+
static pageProperties = [
|
|
7890
|
+
"date",
|
|
7891
|
+
"inputPath",
|
|
7892
|
+
"fileSlug",
|
|
7893
|
+
"filePathStem",
|
|
7894
|
+
"outputFileExtension",
|
|
7895
|
+
"templateSyntax",
|
|
7896
|
+
"url",
|
|
7897
|
+
"outputPath"
|
|
7898
|
+
// not yet `excerpt` or `lang` set via front matter and computed data
|
|
7899
|
+
];
|
|
7900
|
+
// Check in the data cascade for reserved data properties.
|
|
7901
|
+
static getReservedKeys(data, globalProperties = this.fullProperties) {
|
|
7902
|
+
if (!data) {
|
|
7903
|
+
return [];
|
|
7904
|
+
}
|
|
7905
|
+
let keys = globalProperties.filter((key) => {
|
|
7906
|
+
return key in data;
|
|
7907
|
+
});
|
|
7908
|
+
if ("page" in data) {
|
|
7909
|
+
if (typeof data.page === "object") {
|
|
7910
|
+
for (let key of this.pageProperties) {
|
|
7911
|
+
if (key in data.page) {
|
|
7912
|
+
keys.push(`page.${key}`);
|
|
7913
|
+
}
|
|
7914
|
+
}
|
|
7915
|
+
} else {
|
|
7916
|
+
keys.push("page");
|
|
7917
|
+
}
|
|
7918
|
+
}
|
|
7919
|
+
return keys;
|
|
7920
|
+
}
|
|
7921
|
+
static #check(data, sourceLocation, propertiesList) {
|
|
7922
|
+
let reservedNames = _ReservedData.getReservedKeys(data, propertiesList);
|
|
7923
|
+
if (reservedNames.length === 0) {
|
|
7924
|
+
return;
|
|
7925
|
+
}
|
|
7926
|
+
throw this.getError({
|
|
7927
|
+
reservedNames,
|
|
7928
|
+
sourceLocation
|
|
7929
|
+
});
|
|
7930
|
+
}
|
|
7931
|
+
// check for frozen objects too
|
|
7932
|
+
static check(data, sourceLocation) {
|
|
7933
|
+
this.#check(data, sourceLocation, this.fullProperties);
|
|
7934
|
+
}
|
|
7935
|
+
static checkSubset(data, sourceLocation) {
|
|
7936
|
+
this.#check(data, sourceLocation, this.properties);
|
|
7937
|
+
}
|
|
7938
|
+
static getError(options = {}) {
|
|
7939
|
+
let { reservedNames, cause, sourceLocation } = options || {};
|
|
7940
|
+
if (cause) {
|
|
7941
|
+
reservedNames ??= cause.reservedNames;
|
|
7942
|
+
}
|
|
7943
|
+
let e = new EleventyReservedDataError(
|
|
7944
|
+
`You attempted to set one of Eleventy\u2019s reserved data property names${reservedNames ? `: ${reservedNames.join(", ")}` : ""}${sourceLocation ? ` (source: ${sourceLocation})` : ""}. You can opt-out of this behavior with \`eleventyConfig.setFreezeReservedData(false)\` or rename/remove the property in your data cascade that conflicts with Eleventy\u2019s reserved property names (e.g. \`eleventy\`, \`pkg\`, and others). Learn more: https://v3.11ty.dev/docs/data-eleventy-supplied/`,
|
|
7945
|
+
{ cause }
|
|
7946
|
+
);
|
|
7947
|
+
if (reservedNames) {
|
|
7948
|
+
e.reservedNames = reservedNames;
|
|
7949
|
+
}
|
|
7950
|
+
return e;
|
|
7951
|
+
}
|
|
7952
|
+
static isFrozenError(e) {
|
|
7953
|
+
return e instanceof TypeError && e.message.startsWith("Cannot add property") && e.message.endsWith("not extensible");
|
|
7954
|
+
}
|
|
7955
|
+
static isReservedDataError(e) {
|
|
7956
|
+
return e instanceof EleventyReservedDataError;
|
|
7957
|
+
}
|
|
7958
|
+
};
|
|
7959
|
+
var ReservedData_default = ReservedData;
|
|
7960
|
+
|
|
7961
|
+
// ../../src/Data/TemplateDataInitialGlobalData.js
|
|
7838
7962
|
init_EleventyBaseError();
|
|
7839
7963
|
var { set: lodashSet } = import_lodash_custom.default;
|
|
7840
7964
|
var TemplateDataConfigError = class extends EleventyBaseError_default {
|
|
@@ -7859,6 +7983,9 @@ var TemplateDataInitialGlobalData = class {
|
|
|
7859
7983
|
lodashSet(globalData, key, returnValue);
|
|
7860
7984
|
}
|
|
7861
7985
|
}
|
|
7986
|
+
if (this.config.freezeReservedData) {
|
|
7987
|
+
ReservedData_default.check(globalData, this.templateConfig.getActiveConfigPath());
|
|
7988
|
+
}
|
|
7862
7989
|
return globalData;
|
|
7863
7990
|
}
|
|
7864
7991
|
};
|
|
@@ -7924,6 +8051,7 @@ function coerce(version) {
|
|
|
7924
8051
|
}
|
|
7925
8052
|
|
|
7926
8053
|
// ../../src/Data/TemplateData.js
|
|
8054
|
+
var import_FeatureTests = __toESM(require_FeatureTests_core(), 1);
|
|
7927
8055
|
var { set: lodashSet2, get: lodashGet } = import_lodash_custom2.default;
|
|
7928
8056
|
var debugWarn = debug_default("Eleventy:Warnings");
|
|
7929
8057
|
var debug3 = debug_default("Eleventy:TemplateData");
|
|
@@ -8046,10 +8174,20 @@ var TemplateData = class _TemplateData {
|
|
|
8046
8174
|
globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.mjs`);
|
|
8047
8175
|
globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.cjs`);
|
|
8048
8176
|
globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.js`);
|
|
8177
|
+
if ((0, import_FeatureTests.isTypeScriptSupported)()) {
|
|
8178
|
+
globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.mts`);
|
|
8179
|
+
globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.cts`);
|
|
8180
|
+
globSuffixesWithLeadingDot.add(`${suffix.slice(1)}.ts`);
|
|
8181
|
+
}
|
|
8049
8182
|
} else {
|
|
8050
8183
|
globSuffixesWithoutLeadingDot.add(`${suffix || ""}.mjs`);
|
|
8051
8184
|
globSuffixesWithoutLeadingDot.add(`${suffix || ""}.cjs`);
|
|
8052
8185
|
globSuffixesWithoutLeadingDot.add(`${suffix || ""}.js`);
|
|
8186
|
+
if ((0, import_FeatureTests.isTypeScriptSupported)()) {
|
|
8187
|
+
globSuffixesWithoutLeadingDot.add(`${suffix || ""}.mts`);
|
|
8188
|
+
globSuffixesWithoutLeadingDot.add(`${suffix || ""}.cts`);
|
|
8189
|
+
globSuffixesWithoutLeadingDot.add(`${suffix || ""}.ts`);
|
|
8190
|
+
}
|
|
8053
8191
|
}
|
|
8054
8192
|
}
|
|
8055
8193
|
}
|
|
@@ -8149,6 +8287,9 @@ var TemplateData = class _TemplateData {
|
|
|
8149
8287
|
dataFileConflicts[objectPathTargetString] = files[j];
|
|
8150
8288
|
debug3(`Found global data file ${files[j]} and adding as: ${objectPathTarget}`);
|
|
8151
8289
|
lodashSet2(globalData, objectPathTarget, data);
|
|
8290
|
+
if (this.config.freezeReservedData) {
|
|
8291
|
+
ReservedData_default.check(globalData, files[j]);
|
|
8292
|
+
}
|
|
8152
8293
|
}
|
|
8153
8294
|
return globalData;
|
|
8154
8295
|
}
|
|
@@ -9870,7 +10011,8 @@ var TemplateLayoutPathResolver = class {
|
|
|
9870
10011
|
return true;
|
|
9871
10012
|
}
|
|
9872
10013
|
let fullPath = this.templateConfig.directories.getLayoutPath(layoutPath);
|
|
9873
|
-
|
|
10014
|
+
let existsCache = this.templateConfig.existsCache;
|
|
10015
|
+
if (existsCache.exists(fullPath) && !existsCache.isDirectory(fullPath)) {
|
|
9874
10016
|
return true;
|
|
9875
10017
|
}
|
|
9876
10018
|
return false;
|
|
@@ -9996,12 +10138,12 @@ var debugDev3 = debug_default("Dev:Eleventy:TemplateLayout");
|
|
|
9996
10138
|
var CdataWrapper = class _CdataWrapper {
|
|
9997
10139
|
static PREFIX = "<![CDATA[STARTRAW";
|
|
9998
10140
|
static POSTFIX = "ENDRAW]]>";
|
|
9999
|
-
constructor(
|
|
10000
|
-
this.isEligible = _CdataWrapper.isEligible(
|
|
10141
|
+
constructor(pageTemplateSyntax = "", layoutTemplateSyntax = "") {
|
|
10142
|
+
this.isEligible = _CdataWrapper.isEligible(pageTemplateSyntax, layoutTemplateSyntax);
|
|
10001
10143
|
}
|
|
10002
|
-
// Markdown only
|
|
10003
|
-
static isEligible(templateSyntax) {
|
|
10004
|
-
return templateSyntax.split(",").includes("md");
|
|
10144
|
+
// Markdown in Markdown layout only
|
|
10145
|
+
static isEligible(templateSyntax, layoutTemplateSyntax) {
|
|
10146
|
+
return templateSyntax.split(",").includes("md") && layoutTemplateSyntax.split(",").includes("md");
|
|
10005
10147
|
}
|
|
10006
10148
|
wrap(content) {
|
|
10007
10149
|
if (this.isEligible) {
|
|
@@ -10173,14 +10315,18 @@ var TemplateLayout = class _TemplateLayout extends TemplateContent_default {
|
|
|
10173
10315
|
// Trouble: layouts may need data variables present downstream/upstream
|
|
10174
10316
|
// This is called from Template->renderPageEntry
|
|
10175
10317
|
async renderPageEntry(pageEntry) {
|
|
10318
|
+
let pageTemplateSyntax = pageEntry.template?.getEngineNames(
|
|
10319
|
+
pageEntry.data[this.config.keys.engineOverride]
|
|
10320
|
+
);
|
|
10176
10321
|
let templateContent = pageEntry.templateContent;
|
|
10177
10322
|
let compiledFunctions = await this.getCompiledLayoutFunctions();
|
|
10178
10323
|
for (let { render, template } of compiledFunctions) {
|
|
10179
|
-
let
|
|
10180
|
-
let cdata = new CdataWrapper(
|
|
10324
|
+
let layoutTemplateSyntax = template.getEngineNames();
|
|
10325
|
+
let cdata = new CdataWrapper(pageTemplateSyntax, layoutTemplateSyntax);
|
|
10181
10326
|
let data = {
|
|
10182
|
-
|
|
10183
|
-
|
|
10327
|
+
...pageEntry.data,
|
|
10328
|
+
// This should come *after* data, so `content` have override `content` props set in data cascade
|
|
10329
|
+
content: cdata.wrap(templateContent)
|
|
10184
10330
|
};
|
|
10185
10331
|
templateContent = cdata.unwrap(await render(data));
|
|
10186
10332
|
}
|
|
@@ -10542,7 +10688,7 @@ init_EleventyBaseError();
|
|
|
10542
10688
|
init_debug();
|
|
10543
10689
|
var import_eleventy_utils14 = __toESM(require_eleventy_utils(), 1);
|
|
10544
10690
|
var debug10 = debug_default("Dev:Eleventy:Proxy");
|
|
10545
|
-
var ProxySymbol = Symbol.for("11ty.ProxySymbol");
|
|
10691
|
+
var ProxySymbol = /* @__PURE__ */ Symbol.for("11ty.ProxySymbol");
|
|
10546
10692
|
function wrapObject(target, fallback) {
|
|
10547
10693
|
if (Object.isFrozen(target)) {
|
|
10548
10694
|
return target;
|
|
@@ -11103,66 +11249,6 @@ function fromISOtoDateUTC(dateValue, inputPath) {
|
|
|
11103
11249
|
}
|
|
11104
11250
|
}
|
|
11105
11251
|
|
|
11106
|
-
// ../../src/Util/ReservedData.js
|
|
11107
|
-
var EleventyReservedDataError = class extends TypeError {
|
|
11108
|
-
};
|
|
11109
|
-
var ReservedData = class _ReservedData {
|
|
11110
|
-
static properties = [
|
|
11111
|
-
// "pkg", // Object.freeze’d upstream
|
|
11112
|
-
// "eleventy", // Object.freeze’d upstream
|
|
11113
|
-
// "page" is only frozen for specific subproperties below
|
|
11114
|
-
"content",
|
|
11115
|
-
"collections"
|
|
11116
|
-
];
|
|
11117
|
-
static pageProperties = [
|
|
11118
|
-
"date",
|
|
11119
|
-
"inputPath",
|
|
11120
|
-
"fileSlug",
|
|
11121
|
-
"filePathStem",
|
|
11122
|
-
"outputFileExtension",
|
|
11123
|
-
"templateSyntax",
|
|
11124
|
-
"url",
|
|
11125
|
-
"outputPath"
|
|
11126
|
-
// not yet `excerpt` or `lang` set via front matter and computed data
|
|
11127
|
-
];
|
|
11128
|
-
// Check in the data cascade for reserved data properties.
|
|
11129
|
-
static getReservedKeys(data) {
|
|
11130
|
-
if (!data) {
|
|
11131
|
-
return [];
|
|
11132
|
-
}
|
|
11133
|
-
let keys = this.properties.filter((key) => {
|
|
11134
|
-
return key in data;
|
|
11135
|
-
});
|
|
11136
|
-
if ("page" in data) {
|
|
11137
|
-
if (typeof data.page === "object") {
|
|
11138
|
-
for (let key of this.pageProperties) {
|
|
11139
|
-
if (key in data.page) {
|
|
11140
|
-
keys.push(`page.${key}`);
|
|
11141
|
-
}
|
|
11142
|
-
}
|
|
11143
|
-
} else {
|
|
11144
|
-
keys.push("page");
|
|
11145
|
-
}
|
|
11146
|
-
}
|
|
11147
|
-
return keys;
|
|
11148
|
-
}
|
|
11149
|
-
static check(data) {
|
|
11150
|
-
let reserved = _ReservedData.getReservedKeys(data);
|
|
11151
|
-
if (reserved.length === 0) {
|
|
11152
|
-
return;
|
|
11153
|
-
}
|
|
11154
|
-
let error = new EleventyReservedDataError(
|
|
11155
|
-
`Cannot override reserved Eleventy properties: ${reserved.join(", ")}`
|
|
11156
|
-
);
|
|
11157
|
-
error.reservedNames = reserved;
|
|
11158
|
-
throw error;
|
|
11159
|
-
}
|
|
11160
|
-
static isReservedDataError(e) {
|
|
11161
|
-
return e instanceof EleventyReservedDataError;
|
|
11162
|
-
}
|
|
11163
|
-
};
|
|
11164
|
-
var ReservedData_default = ReservedData;
|
|
11165
|
-
|
|
11166
11252
|
// ../../src/Util/TransformsUtil.js
|
|
11167
11253
|
init_EleventyBaseError();
|
|
11168
11254
|
var import_eleventy_utils18 = __toESM(require_eleventy_utils(), 1);
|
|
@@ -11676,7 +11762,7 @@ var Template = class _Template extends TemplateContent_default {
|
|
|
11676
11762
|
let globalData = {};
|
|
11677
11763
|
if (this.templateData) {
|
|
11678
11764
|
localData = await this.templateData.getTemplateDirectoryData(this.inputPath);
|
|
11679
|
-
globalData = await this.templateData.getGlobalData(
|
|
11765
|
+
globalData = await this.templateData.getGlobalData();
|
|
11680
11766
|
debugDev4("%o getData getTemplateDirectoryData and getGlobalData", this.inputPath);
|
|
11681
11767
|
}
|
|
11682
11768
|
let { data: frontMatterData } = await this.getFrontMatterData();
|
|
@@ -11693,17 +11779,14 @@ var Template = class _Template extends TemplateContent_default {
|
|
|
11693
11779
|
try {
|
|
11694
11780
|
let mergedData = (0, import_eleventy_utils20.Merge)({}, globalData, mergedLayoutData, localData, frontMatterData);
|
|
11695
11781
|
if (this.config.freezeReservedData) {
|
|
11696
|
-
ReservedData_default.
|
|
11782
|
+
ReservedData_default.checkSubset(mergedData);
|
|
11697
11783
|
}
|
|
11698
11784
|
await this.addPage(mergedData);
|
|
11699
11785
|
debugDev4("%o getData mergedData", this.inputPath);
|
|
11700
11786
|
return mergedData;
|
|
11701
11787
|
} catch (e) {
|
|
11702
|
-
if (ReservedData_default.isReservedDataError(e)
|
|
11703
|
-
throw
|
|
11704
|
-
`You attempted to set one of Eleventy\u2019s reserved data property names${e.reservedNames ? `: ${e.reservedNames.join(", ")}` : ""}. You can opt-out of this behavior with \`eleventyConfig.setFreezeReservedData(false)\` or rename/remove the property in your data cascade that conflicts with Eleventy\u2019s reserved property names (e.g. \`eleventy\`, \`pkg\`, and others). Learn more: https://v3.11ty.dev/docs/data-eleventy-supplied/`,
|
|
11705
|
-
e
|
|
11706
|
-
);
|
|
11788
|
+
if (!ReservedData_default.isReservedDataError(e) && ReservedData_default.isFrozenError(e)) {
|
|
11789
|
+
throw ReservedData_default.getError({ cause: e });
|
|
11707
11790
|
}
|
|
11708
11791
|
throw e;
|
|
11709
11792
|
}
|
|
@@ -11854,7 +11937,7 @@ var Template = class _Template extends TemplateContent_default {
|
|
|
11854
11937
|
this
|
|
11855
11938
|
);
|
|
11856
11939
|
if (this.config.freezeReservedData) {
|
|
11857
|
-
ReservedData_default.
|
|
11940
|
+
ReservedData_default.checkSubset(data[this.config.keys.computed]);
|
|
11858
11941
|
}
|
|
11859
11942
|
this._addComputedEntry(this.computedData, data[this.config.keys.computed]);
|
|
11860
11943
|
debug13("First round of computed data for %o", this.inputPath);
|
|
@@ -13956,6 +14039,7 @@ var TemplateWriter_default = TemplateWriter;
|
|
|
13956
14039
|
|
|
13957
14040
|
// ../../src/EleventyExtensionMap.js
|
|
13958
14041
|
var import_eleventy_utils25 = __toESM(require_eleventy_utils(), 1);
|
|
14042
|
+
var import_FeatureTests2 = __toESM(require_FeatureTests_core(), 1);
|
|
13959
14043
|
var EleventyExtensionMap = class {
|
|
13960
14044
|
#engineManager;
|
|
13961
14045
|
constructor(config) {
|
|
@@ -14165,6 +14249,11 @@ var EleventyExtensionMap = class {
|
|
|
14165
14249
|
"11ty.cjs": { key: "11ty.js", extension: "11ty.cjs" },
|
|
14166
14250
|
"11ty.mjs": { key: "11ty.js", extension: "11ty.mjs" }
|
|
14167
14251
|
};
|
|
14252
|
+
if ((0, import_FeatureTests2.isTypeScriptSupported)()) {
|
|
14253
|
+
this._extensionToKeyMap["11ty.ts"] = { key: "11ty.js", extension: "11ty.ts" };
|
|
14254
|
+
this._extensionToKeyMap["11ty.cts"] = { key: "11ty.js", extension: "11ty.cts" };
|
|
14255
|
+
this._extensionToKeyMap["11ty.mts"] = { key: "11ty.js", extension: "11ty.mts" };
|
|
14256
|
+
}
|
|
14168
14257
|
if ("extensionMap" in this.config) {
|
|
14169
14258
|
for (let entry of this.config.extensionMap) {
|
|
14170
14259
|
this._extensionToKeyMap[entry.extension] = entry;
|
|
@@ -14180,7 +14269,6 @@ var EleventyExtensionMap = class {
|
|
|
14180
14269
|
var EleventyExtensionMap_default = EleventyExtensionMap;
|
|
14181
14270
|
|
|
14182
14271
|
// ../../src/TemplateConfig.js
|
|
14183
|
-
init_shim_consume_fs();
|
|
14184
14272
|
var import_eleventy_utils28 = __toESM(require_eleventy_utils(), 1);
|
|
14185
14273
|
init_debug();
|
|
14186
14274
|
|
|
@@ -14395,7 +14483,6 @@ var Benchmark = class {
|
|
|
14395
14483
|
return this.timeSpent;
|
|
14396
14484
|
}
|
|
14397
14485
|
};
|
|
14398
|
-
var Benchmark_default = Benchmark;
|
|
14399
14486
|
|
|
14400
14487
|
// ../../src/Benchmark/BenchmarkGroup.js
|
|
14401
14488
|
var debugBenchmark = debug_default("Eleventy:Benchmark");
|
|
@@ -14418,7 +14505,7 @@ var BenchmarkGroup = class {
|
|
|
14418
14505
|
}
|
|
14419
14506
|
// TODO use addAsync everywhere instead
|
|
14420
14507
|
add(type, callback) {
|
|
14421
|
-
let benchmark = this.benchmarks[type] = new
|
|
14508
|
+
let benchmark = this.benchmarks[type] = new Benchmark();
|
|
14422
14509
|
let fn = function(...args) {
|
|
14423
14510
|
benchmark.before();
|
|
14424
14511
|
let ret = callback.call(this, ...args);
|
|
@@ -14463,7 +14550,7 @@ var BenchmarkGroup = class {
|
|
|
14463
14550
|
}
|
|
14464
14551
|
get(type) {
|
|
14465
14552
|
if (!this.benchmarks[type]) {
|
|
14466
|
-
this.benchmarks[type] = new
|
|
14553
|
+
this.benchmarks[type] = new Benchmark();
|
|
14467
14554
|
}
|
|
14468
14555
|
return this.benchmarks[type];
|
|
14469
14556
|
}
|
|
@@ -15264,7 +15351,7 @@ var UserConfig = class {
|
|
|
15264
15351
|
if (Array.isArray(fileExtension)) {
|
|
15265
15352
|
extensions = fileExtension;
|
|
15266
15353
|
} else {
|
|
15267
|
-
extensions =
|
|
15354
|
+
extensions = (fileExtension || "").split(",");
|
|
15268
15355
|
}
|
|
15269
15356
|
for (let extension of extensions) {
|
|
15270
15357
|
if (this.extensionConflictMap[extension]) {
|
|
@@ -15753,6 +15840,7 @@ var ProjectTemplateFormats = class _ProjectTemplateFormats {
|
|
|
15753
15840
|
var ProjectTemplateFormats_default = ProjectTemplateFormats;
|
|
15754
15841
|
|
|
15755
15842
|
// ../../src/TemplateConfig.js
|
|
15843
|
+
var import_FeatureTests3 = __toESM(require_FeatureTests_core(), 1);
|
|
15756
15844
|
var debug21 = debug_default("Eleventy:TemplateConfig");
|
|
15757
15845
|
var debugDev5 = debug_default("Dev:Eleventy:TemplateConfig");
|
|
15758
15846
|
var EleventyConfigError = class extends EleventyBaseError_default {
|
|
@@ -15785,6 +15873,11 @@ var TemplateConfig = class {
|
|
|
15785
15873
|
"eleventy.config.mjs",
|
|
15786
15874
|
"eleventy.config.cjs"
|
|
15787
15875
|
];
|
|
15876
|
+
if ((0, import_FeatureTests3.isTypeScriptSupported)()) {
|
|
15877
|
+
this.projectConfigPaths.push("eleventy.config.ts");
|
|
15878
|
+
this.projectConfigPaths.push("eleventy.config.mts");
|
|
15879
|
+
this.projectConfigPaths.push("eleventy.config.cts");
|
|
15880
|
+
}
|
|
15788
15881
|
}
|
|
15789
15882
|
if (customRootConfig) {
|
|
15790
15883
|
this.customRootConfig = customRootConfig;
|
|
@@ -16970,7 +17063,11 @@ Verbose Output: ${this.verboseMode}`;
|
|
|
16970
17063
|
} else if (this.loader == "cjs") {
|
|
16971
17064
|
this.#isEsm = false;
|
|
16972
17065
|
} else if (this.loader == "auto") {
|
|
16973
|
-
|
|
17066
|
+
if (typeof Deno !== "undefined") {
|
|
17067
|
+
this.#isEsm = this.projectPackageJson?.type !== "commonjs";
|
|
17068
|
+
} else {
|
|
17069
|
+
this.#isEsm = this.projectPackageJson?.type === "module";
|
|
17070
|
+
}
|
|
16974
17071
|
} else {
|
|
16975
17072
|
throw new Error("The 'loader' option must be one of 'esm', 'cjs', or 'auto'");
|
|
16976
17073
|
}
|
|
@@ -17132,13 +17229,13 @@ Open an issue: https://github.com/11ty/eleventy/issues/new`);
|
|
|
17132
17229
|
ret.push(
|
|
17133
17230
|
`in ${chalk_client_default.bold(time.toFixed(2))} ${Pluralize_default(time.toFixed(2), "second", "seconds")}`
|
|
17134
17231
|
);
|
|
17232
|
+
let cfgStr = this.#activeConfigurationPath ? `, ${import_eleventy_utils30.TemplatePath.stripLeadingDotSlash(this.#activeConfigurationPath)}` : " no config file";
|
|
17135
17233
|
if (time >= 1 && writeCount > 1) {
|
|
17136
|
-
ret.push(
|
|
17234
|
+
ret.push(
|
|
17235
|
+
chalk_client_default.gray(`(${(time * 1e3 / writeCount).toFixed(1)}ms each, v${pkg2.version}${cfgStr})`)
|
|
17236
|
+
);
|
|
17137
17237
|
} else {
|
|
17138
|
-
ret.push(`(v${_MinimalCore.getVersion()})`);
|
|
17139
|
-
}
|
|
17140
|
-
if (!this.#activeConfigurationPath) {
|
|
17141
|
-
ret.push("(no config file)");
|
|
17238
|
+
ret.push(chalk_client_default.gray(`(v${_MinimalCore.getVersion()}${cfgStr})`));
|
|
17142
17239
|
}
|
|
17143
17240
|
return ret.join(" ");
|
|
17144
17241
|
}
|