@11ty/client 4.0.0-alpha.1 → 4.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/{eleventy.js → core-fs.js} +26583 -16308
- package/dist/{eleventy.core.js → core-minimal.js} +9132 -6389
- package/dist/formats/{eleventy-liquid.js → liquid.js} +1235 -996
- package/dist/formats/markdown.js +6014 -0
- package/dist/formats/{eleventy-nunjucks.js → nunjucks.js} +2496 -2579
- package/dist/plugins/plugin-i18n.js +2045 -0
- package/package.json +16 -15
- package/dist/formats/eleventy-markdown.js +0 -5815
- package/dist/plugins/eleventy-plugin-i18n.js +0 -16412
|
@@ -0,0 +1,2045 @@
|
|
|
1
|
+
/*! Eleventy (Build Awesome) v4.0.0-alpha.11 (i18n Plugin) */
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
15
|
+
var __esm = (fn, res, err) => function __init() {
|
|
16
|
+
if (err) throw err[0];
|
|
17
|
+
try {
|
|
18
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw err = [e], e;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
24
|
+
try {
|
|
25
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
throw mod = 0, e;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var __export = (target, all) => {
|
|
31
|
+
for (var name in all)
|
|
32
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
33
|
+
};
|
|
34
|
+
var __copyProps = (to, from, except, desc) => {
|
|
35
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
36
|
+
for (let key of __getOwnPropNames(from))
|
|
37
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
38
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
39
|
+
}
|
|
40
|
+
return to;
|
|
41
|
+
};
|
|
42
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
43
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
44
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
45
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
46
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
47
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
48
|
+
mod
|
|
49
|
+
));
|
|
50
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
51
|
+
|
|
52
|
+
// ../../node_modules/path/node_modules/util/support/isBufferBrowser.js
|
|
53
|
+
var require_isBufferBrowser = __commonJS({
|
|
54
|
+
"../../node_modules/path/node_modules/util/support/isBufferBrowser.js"(exports, module) {
|
|
55
|
+
module.exports = /* @__PURE__ */ __name(function isBuffer(arg) {
|
|
56
|
+
return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function";
|
|
57
|
+
}, "isBuffer");
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// ../../node_modules/path/node_modules/inherits/inherits_browser.js
|
|
62
|
+
var require_inherits_browser = __commonJS({
|
|
63
|
+
"../../node_modules/path/node_modules/inherits/inherits_browser.js"(exports, module) {
|
|
64
|
+
if (typeof Object.create === "function") {
|
|
65
|
+
module.exports = /* @__PURE__ */ __name(function inherits(ctor, superCtor) {
|
|
66
|
+
ctor.super_ = superCtor;
|
|
67
|
+
ctor.prototype = Object.create(superCtor.prototype, {
|
|
68
|
+
constructor: {
|
|
69
|
+
value: ctor,
|
|
70
|
+
enumerable: false,
|
|
71
|
+
writable: true,
|
|
72
|
+
configurable: true
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}, "inherits");
|
|
76
|
+
} else {
|
|
77
|
+
module.exports = /* @__PURE__ */ __name(function inherits(ctor, superCtor) {
|
|
78
|
+
ctor.super_ = superCtor;
|
|
79
|
+
var TempCtor = /* @__PURE__ */ __name(function() {
|
|
80
|
+
}, "TempCtor");
|
|
81
|
+
TempCtor.prototype = superCtor.prototype;
|
|
82
|
+
ctor.prototype = new TempCtor();
|
|
83
|
+
ctor.prototype.constructor = ctor;
|
|
84
|
+
}, "inherits");
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// ../../node_modules/path/node_modules/util/util.js
|
|
90
|
+
var require_util = __commonJS({
|
|
91
|
+
"../../node_modules/path/node_modules/util/util.js"(exports) {
|
|
92
|
+
var formatRegExp = /%[sdj%]/g;
|
|
93
|
+
exports.format = function(f) {
|
|
94
|
+
if (!isString(f)) {
|
|
95
|
+
var objects = [];
|
|
96
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
97
|
+
objects.push(inspect(arguments[i]));
|
|
98
|
+
}
|
|
99
|
+
return objects.join(" ");
|
|
100
|
+
}
|
|
101
|
+
var i = 1;
|
|
102
|
+
var args = arguments;
|
|
103
|
+
var len = args.length;
|
|
104
|
+
var str = String(f).replace(formatRegExp, function(x2) {
|
|
105
|
+
if (x2 === "%%") return "%";
|
|
106
|
+
if (i >= len) return x2;
|
|
107
|
+
switch (x2) {
|
|
108
|
+
case "%s":
|
|
109
|
+
return String(args[i++]);
|
|
110
|
+
case "%d":
|
|
111
|
+
return Number(args[i++]);
|
|
112
|
+
case "%j":
|
|
113
|
+
try {
|
|
114
|
+
return JSON.stringify(args[i++]);
|
|
115
|
+
} catch (_) {
|
|
116
|
+
return "[Circular]";
|
|
117
|
+
}
|
|
118
|
+
default:
|
|
119
|
+
return x2;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
for (var x = args[i]; i < len; x = args[++i]) {
|
|
123
|
+
if (isNull(x) || !isObject(x)) {
|
|
124
|
+
str += " " + x;
|
|
125
|
+
} else {
|
|
126
|
+
str += " " + inspect(x);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return str;
|
|
130
|
+
};
|
|
131
|
+
exports.deprecate = function(fn, msg) {
|
|
132
|
+
if (isUndefined(global.process)) {
|
|
133
|
+
return function() {
|
|
134
|
+
return exports.deprecate(fn, msg).apply(this, arguments);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
if (process.noDeprecation === true) {
|
|
138
|
+
return fn;
|
|
139
|
+
}
|
|
140
|
+
var warned = false;
|
|
141
|
+
function deprecated() {
|
|
142
|
+
if (!warned) {
|
|
143
|
+
if (process.throwDeprecation) {
|
|
144
|
+
throw new Error(msg);
|
|
145
|
+
} else if (process.traceDeprecation) {
|
|
146
|
+
console.trace(msg);
|
|
147
|
+
} else {
|
|
148
|
+
console.error(msg);
|
|
149
|
+
}
|
|
150
|
+
warned = true;
|
|
151
|
+
}
|
|
152
|
+
return fn.apply(this, arguments);
|
|
153
|
+
}
|
|
154
|
+
__name(deprecated, "deprecated");
|
|
155
|
+
return deprecated;
|
|
156
|
+
};
|
|
157
|
+
var debugs = {};
|
|
158
|
+
var debugEnviron;
|
|
159
|
+
exports.debuglog = function(set) {
|
|
160
|
+
if (isUndefined(debugEnviron))
|
|
161
|
+
debugEnviron = process.env.NODE_DEBUG || "";
|
|
162
|
+
set = set.toUpperCase();
|
|
163
|
+
if (!debugs[set]) {
|
|
164
|
+
if (new RegExp("\\b" + set + "\\b", "i").test(debugEnviron)) {
|
|
165
|
+
var pid = process.pid;
|
|
166
|
+
debugs[set] = function() {
|
|
167
|
+
var msg = exports.format.apply(exports, arguments);
|
|
168
|
+
console.error("%s %d: %s", set, pid, msg);
|
|
169
|
+
};
|
|
170
|
+
} else {
|
|
171
|
+
debugs[set] = function() {
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return debugs[set];
|
|
176
|
+
};
|
|
177
|
+
function inspect(obj, opts) {
|
|
178
|
+
var ctx = {
|
|
179
|
+
seen: [],
|
|
180
|
+
stylize: stylizeNoColor
|
|
181
|
+
};
|
|
182
|
+
if (arguments.length >= 3) ctx.depth = arguments[2];
|
|
183
|
+
if (arguments.length >= 4) ctx.colors = arguments[3];
|
|
184
|
+
if (isBoolean(opts)) {
|
|
185
|
+
ctx.showHidden = opts;
|
|
186
|
+
} else if (opts) {
|
|
187
|
+
exports._extend(ctx, opts);
|
|
188
|
+
}
|
|
189
|
+
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
|
190
|
+
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
|
191
|
+
if (isUndefined(ctx.colors)) ctx.colors = false;
|
|
192
|
+
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
|
193
|
+
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
|
194
|
+
return formatValue(ctx, obj, ctx.depth);
|
|
195
|
+
}
|
|
196
|
+
__name(inspect, "inspect");
|
|
197
|
+
exports.inspect = inspect;
|
|
198
|
+
inspect.colors = {
|
|
199
|
+
"bold": [1, 22],
|
|
200
|
+
"italic": [3, 23],
|
|
201
|
+
"underline": [4, 24],
|
|
202
|
+
"inverse": [7, 27],
|
|
203
|
+
"white": [37, 39],
|
|
204
|
+
"grey": [90, 39],
|
|
205
|
+
"black": [30, 39],
|
|
206
|
+
"blue": [34, 39],
|
|
207
|
+
"cyan": [36, 39],
|
|
208
|
+
"green": [32, 39],
|
|
209
|
+
"magenta": [35, 39],
|
|
210
|
+
"red": [31, 39],
|
|
211
|
+
"yellow": [33, 39]
|
|
212
|
+
};
|
|
213
|
+
inspect.styles = {
|
|
214
|
+
"special": "cyan",
|
|
215
|
+
"number": "yellow",
|
|
216
|
+
"boolean": "yellow",
|
|
217
|
+
"undefined": "grey",
|
|
218
|
+
"null": "bold",
|
|
219
|
+
"string": "green",
|
|
220
|
+
"date": "magenta",
|
|
221
|
+
// "name": intentionally not styling
|
|
222
|
+
"regexp": "red"
|
|
223
|
+
};
|
|
224
|
+
function stylizeWithColor(str, styleType) {
|
|
225
|
+
var style = inspect.styles[styleType];
|
|
226
|
+
if (style) {
|
|
227
|
+
return "\x1B[" + inspect.colors[style][0] + "m" + str + "\x1B[" + inspect.colors[style][1] + "m";
|
|
228
|
+
} else {
|
|
229
|
+
return str;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
__name(stylizeWithColor, "stylizeWithColor");
|
|
233
|
+
function stylizeNoColor(str, styleType) {
|
|
234
|
+
return str;
|
|
235
|
+
}
|
|
236
|
+
__name(stylizeNoColor, "stylizeNoColor");
|
|
237
|
+
function arrayToHash(array) {
|
|
238
|
+
var hash = {};
|
|
239
|
+
array.forEach(function(val, idx) {
|
|
240
|
+
hash[val] = true;
|
|
241
|
+
});
|
|
242
|
+
return hash;
|
|
243
|
+
}
|
|
244
|
+
__name(arrayToHash, "arrayToHash");
|
|
245
|
+
function formatValue(ctx, value, recurseTimes) {
|
|
246
|
+
if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
|
|
247
|
+
value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.
|
|
248
|
+
!(value.constructor && value.constructor.prototype === value)) {
|
|
249
|
+
var ret = value.inspect(recurseTimes, ctx);
|
|
250
|
+
if (!isString(ret)) {
|
|
251
|
+
ret = formatValue(ctx, ret, recurseTimes);
|
|
252
|
+
}
|
|
253
|
+
return ret;
|
|
254
|
+
}
|
|
255
|
+
var primitive = formatPrimitive(ctx, value);
|
|
256
|
+
if (primitive) {
|
|
257
|
+
return primitive;
|
|
258
|
+
}
|
|
259
|
+
var keys = Object.keys(value);
|
|
260
|
+
var visibleKeys = arrayToHash(keys);
|
|
261
|
+
if (ctx.showHidden) {
|
|
262
|
+
keys = Object.getOwnPropertyNames(value);
|
|
263
|
+
}
|
|
264
|
+
if (isError(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
|
|
265
|
+
return formatError(value);
|
|
266
|
+
}
|
|
267
|
+
if (keys.length === 0) {
|
|
268
|
+
if (isFunction(value)) {
|
|
269
|
+
var name = value.name ? ": " + value.name : "";
|
|
270
|
+
return ctx.stylize("[Function" + name + "]", "special");
|
|
271
|
+
}
|
|
272
|
+
if (isRegExp(value)) {
|
|
273
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
|
|
274
|
+
}
|
|
275
|
+
if (isDate(value)) {
|
|
276
|
+
return ctx.stylize(Date.prototype.toString.call(value), "date");
|
|
277
|
+
}
|
|
278
|
+
if (isError(value)) {
|
|
279
|
+
return formatError(value);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
var base = "", array = false, braces = ["{", "}"];
|
|
283
|
+
if (isArray(value)) {
|
|
284
|
+
array = true;
|
|
285
|
+
braces = ["[", "]"];
|
|
286
|
+
}
|
|
287
|
+
if (isFunction(value)) {
|
|
288
|
+
var n = value.name ? ": " + value.name : "";
|
|
289
|
+
base = " [Function" + n + "]";
|
|
290
|
+
}
|
|
291
|
+
if (isRegExp(value)) {
|
|
292
|
+
base = " " + RegExp.prototype.toString.call(value);
|
|
293
|
+
}
|
|
294
|
+
if (isDate(value)) {
|
|
295
|
+
base = " " + Date.prototype.toUTCString.call(value);
|
|
296
|
+
}
|
|
297
|
+
if (isError(value)) {
|
|
298
|
+
base = " " + formatError(value);
|
|
299
|
+
}
|
|
300
|
+
if (keys.length === 0 && (!array || value.length == 0)) {
|
|
301
|
+
return braces[0] + base + braces[1];
|
|
302
|
+
}
|
|
303
|
+
if (recurseTimes < 0) {
|
|
304
|
+
if (isRegExp(value)) {
|
|
305
|
+
return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
|
|
306
|
+
} else {
|
|
307
|
+
return ctx.stylize("[Object]", "special");
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
ctx.seen.push(value);
|
|
311
|
+
var output;
|
|
312
|
+
if (array) {
|
|
313
|
+
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
|
314
|
+
} else {
|
|
315
|
+
output = keys.map(function(key) {
|
|
316
|
+
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
ctx.seen.pop();
|
|
320
|
+
return reduceToSingleString(output, base, braces);
|
|
321
|
+
}
|
|
322
|
+
__name(formatValue, "formatValue");
|
|
323
|
+
function formatPrimitive(ctx, value) {
|
|
324
|
+
if (isUndefined(value))
|
|
325
|
+
return ctx.stylize("undefined", "undefined");
|
|
326
|
+
if (isString(value)) {
|
|
327
|
+
var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
|
|
328
|
+
return ctx.stylize(simple, "string");
|
|
329
|
+
}
|
|
330
|
+
if (isNumber(value))
|
|
331
|
+
return ctx.stylize("" + value, "number");
|
|
332
|
+
if (isBoolean(value))
|
|
333
|
+
return ctx.stylize("" + value, "boolean");
|
|
334
|
+
if (isNull(value))
|
|
335
|
+
return ctx.stylize("null", "null");
|
|
336
|
+
}
|
|
337
|
+
__name(formatPrimitive, "formatPrimitive");
|
|
338
|
+
function formatError(value) {
|
|
339
|
+
return "[" + Error.prototype.toString.call(value) + "]";
|
|
340
|
+
}
|
|
341
|
+
__name(formatError, "formatError");
|
|
342
|
+
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
|
343
|
+
var output = [];
|
|
344
|
+
for (var i = 0, l = value.length; i < l; ++i) {
|
|
345
|
+
if (hasOwnProperty(value, String(i))) {
|
|
346
|
+
output.push(formatProperty(
|
|
347
|
+
ctx,
|
|
348
|
+
value,
|
|
349
|
+
recurseTimes,
|
|
350
|
+
visibleKeys,
|
|
351
|
+
String(i),
|
|
352
|
+
true
|
|
353
|
+
));
|
|
354
|
+
} else {
|
|
355
|
+
output.push("");
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
keys.forEach(function(key) {
|
|
359
|
+
if (!key.match(/^\d+$/)) {
|
|
360
|
+
output.push(formatProperty(
|
|
361
|
+
ctx,
|
|
362
|
+
value,
|
|
363
|
+
recurseTimes,
|
|
364
|
+
visibleKeys,
|
|
365
|
+
key,
|
|
366
|
+
true
|
|
367
|
+
));
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
return output;
|
|
371
|
+
}
|
|
372
|
+
__name(formatArray, "formatArray");
|
|
373
|
+
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
374
|
+
var name, str, desc;
|
|
375
|
+
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
|
376
|
+
if (desc.get) {
|
|
377
|
+
if (desc.set) {
|
|
378
|
+
str = ctx.stylize("[Getter/Setter]", "special");
|
|
379
|
+
} else {
|
|
380
|
+
str = ctx.stylize("[Getter]", "special");
|
|
381
|
+
}
|
|
382
|
+
} else {
|
|
383
|
+
if (desc.set) {
|
|
384
|
+
str = ctx.stylize("[Setter]", "special");
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
if (!hasOwnProperty(visibleKeys, key)) {
|
|
388
|
+
name = "[" + key + "]";
|
|
389
|
+
}
|
|
390
|
+
if (!str) {
|
|
391
|
+
if (ctx.seen.indexOf(desc.value) < 0) {
|
|
392
|
+
if (isNull(recurseTimes)) {
|
|
393
|
+
str = formatValue(ctx, desc.value, null);
|
|
394
|
+
} else {
|
|
395
|
+
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
|
396
|
+
}
|
|
397
|
+
if (str.indexOf("\n") > -1) {
|
|
398
|
+
if (array) {
|
|
399
|
+
str = str.split("\n").map(function(line) {
|
|
400
|
+
return " " + line;
|
|
401
|
+
}).join("\n").substr(2);
|
|
402
|
+
} else {
|
|
403
|
+
str = "\n" + str.split("\n").map(function(line) {
|
|
404
|
+
return " " + line;
|
|
405
|
+
}).join("\n");
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
str = ctx.stylize("[Circular]", "special");
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (isUndefined(name)) {
|
|
413
|
+
if (array && key.match(/^\d+$/)) {
|
|
414
|
+
return str;
|
|
415
|
+
}
|
|
416
|
+
name = JSON.stringify("" + key);
|
|
417
|
+
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
|
418
|
+
name = name.substr(1, name.length - 2);
|
|
419
|
+
name = ctx.stylize(name, "name");
|
|
420
|
+
} else {
|
|
421
|
+
name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
|
422
|
+
name = ctx.stylize(name, "string");
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return name + ": " + str;
|
|
426
|
+
}
|
|
427
|
+
__name(formatProperty, "formatProperty");
|
|
428
|
+
function reduceToSingleString(output, base, braces) {
|
|
429
|
+
var numLinesEst = 0;
|
|
430
|
+
var length = output.reduce(function(prev, cur) {
|
|
431
|
+
numLinesEst++;
|
|
432
|
+
if (cur.indexOf("\n") >= 0) numLinesEst++;
|
|
433
|
+
return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
|
|
434
|
+
}, 0);
|
|
435
|
+
if (length > 60) {
|
|
436
|
+
return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n ") + " " + braces[1];
|
|
437
|
+
}
|
|
438
|
+
return braces[0] + base + " " + output.join(", ") + " " + braces[1];
|
|
439
|
+
}
|
|
440
|
+
__name(reduceToSingleString, "reduceToSingleString");
|
|
441
|
+
function isArray(ar) {
|
|
442
|
+
return Array.isArray(ar);
|
|
443
|
+
}
|
|
444
|
+
__name(isArray, "isArray");
|
|
445
|
+
exports.isArray = isArray;
|
|
446
|
+
function isBoolean(arg) {
|
|
447
|
+
return typeof arg === "boolean";
|
|
448
|
+
}
|
|
449
|
+
__name(isBoolean, "isBoolean");
|
|
450
|
+
exports.isBoolean = isBoolean;
|
|
451
|
+
function isNull(arg) {
|
|
452
|
+
return arg === null;
|
|
453
|
+
}
|
|
454
|
+
__name(isNull, "isNull");
|
|
455
|
+
exports.isNull = isNull;
|
|
456
|
+
function isNullOrUndefined(arg) {
|
|
457
|
+
return arg == null;
|
|
458
|
+
}
|
|
459
|
+
__name(isNullOrUndefined, "isNullOrUndefined");
|
|
460
|
+
exports.isNullOrUndefined = isNullOrUndefined;
|
|
461
|
+
function isNumber(arg) {
|
|
462
|
+
return typeof arg === "number";
|
|
463
|
+
}
|
|
464
|
+
__name(isNumber, "isNumber");
|
|
465
|
+
exports.isNumber = isNumber;
|
|
466
|
+
function isString(arg) {
|
|
467
|
+
return typeof arg === "string";
|
|
468
|
+
}
|
|
469
|
+
__name(isString, "isString");
|
|
470
|
+
exports.isString = isString;
|
|
471
|
+
function isSymbol(arg) {
|
|
472
|
+
return typeof arg === "symbol";
|
|
473
|
+
}
|
|
474
|
+
__name(isSymbol, "isSymbol");
|
|
475
|
+
exports.isSymbol = isSymbol;
|
|
476
|
+
function isUndefined(arg) {
|
|
477
|
+
return arg === void 0;
|
|
478
|
+
}
|
|
479
|
+
__name(isUndefined, "isUndefined");
|
|
480
|
+
exports.isUndefined = isUndefined;
|
|
481
|
+
function isRegExp(re) {
|
|
482
|
+
return isObject(re) && objectToString(re) === "[object RegExp]";
|
|
483
|
+
}
|
|
484
|
+
__name(isRegExp, "isRegExp");
|
|
485
|
+
exports.isRegExp = isRegExp;
|
|
486
|
+
function isObject(arg) {
|
|
487
|
+
return typeof arg === "object" && arg !== null;
|
|
488
|
+
}
|
|
489
|
+
__name(isObject, "isObject");
|
|
490
|
+
exports.isObject = isObject;
|
|
491
|
+
function isDate(d) {
|
|
492
|
+
return isObject(d) && objectToString(d) === "[object Date]";
|
|
493
|
+
}
|
|
494
|
+
__name(isDate, "isDate");
|
|
495
|
+
exports.isDate = isDate;
|
|
496
|
+
function isError(e) {
|
|
497
|
+
return isObject(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
|
|
498
|
+
}
|
|
499
|
+
__name(isError, "isError");
|
|
500
|
+
exports.isError = isError;
|
|
501
|
+
function isFunction(arg) {
|
|
502
|
+
return typeof arg === "function";
|
|
503
|
+
}
|
|
504
|
+
__name(isFunction, "isFunction");
|
|
505
|
+
exports.isFunction = isFunction;
|
|
506
|
+
function isPrimitive(arg) {
|
|
507
|
+
return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
|
|
508
|
+
typeof arg === "undefined";
|
|
509
|
+
}
|
|
510
|
+
__name(isPrimitive, "isPrimitive");
|
|
511
|
+
exports.isPrimitive = isPrimitive;
|
|
512
|
+
exports.isBuffer = require_isBufferBrowser();
|
|
513
|
+
function objectToString(o) {
|
|
514
|
+
return Object.prototype.toString.call(o);
|
|
515
|
+
}
|
|
516
|
+
__name(objectToString, "objectToString");
|
|
517
|
+
function pad(n) {
|
|
518
|
+
return n < 10 ? "0" + n.toString(10) : n.toString(10);
|
|
519
|
+
}
|
|
520
|
+
__name(pad, "pad");
|
|
521
|
+
var months = [
|
|
522
|
+
"Jan",
|
|
523
|
+
"Feb",
|
|
524
|
+
"Mar",
|
|
525
|
+
"Apr",
|
|
526
|
+
"May",
|
|
527
|
+
"Jun",
|
|
528
|
+
"Jul",
|
|
529
|
+
"Aug",
|
|
530
|
+
"Sep",
|
|
531
|
+
"Oct",
|
|
532
|
+
"Nov",
|
|
533
|
+
"Dec"
|
|
534
|
+
];
|
|
535
|
+
function timestamp() {
|
|
536
|
+
var d = /* @__PURE__ */ new Date();
|
|
537
|
+
var time = [
|
|
538
|
+
pad(d.getHours()),
|
|
539
|
+
pad(d.getMinutes()),
|
|
540
|
+
pad(d.getSeconds())
|
|
541
|
+
].join(":");
|
|
542
|
+
return [d.getDate(), months[d.getMonth()], time].join(" ");
|
|
543
|
+
}
|
|
544
|
+
__name(timestamp, "timestamp");
|
|
545
|
+
exports.log = function() {
|
|
546
|
+
console.log("%s - %s", timestamp(), exports.format.apply(exports, arguments));
|
|
547
|
+
};
|
|
548
|
+
exports.inherits = require_inherits_browser();
|
|
549
|
+
exports._extend = function(origin, add) {
|
|
550
|
+
if (!add || !isObject(add)) return origin;
|
|
551
|
+
var keys = Object.keys(add);
|
|
552
|
+
var i = keys.length;
|
|
553
|
+
while (i--) {
|
|
554
|
+
origin[keys[i]] = add[keys[i]];
|
|
555
|
+
}
|
|
556
|
+
return origin;
|
|
557
|
+
};
|
|
558
|
+
function hasOwnProperty(obj, prop) {
|
|
559
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
560
|
+
}
|
|
561
|
+
__name(hasOwnProperty, "hasOwnProperty");
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
// ../../node_modules/path/path.js
|
|
566
|
+
var require_path = __commonJS({
|
|
567
|
+
"../../node_modules/path/path.js"(exports, module) {
|
|
568
|
+
"use strict";
|
|
569
|
+
var isWindows = process.platform === "win32";
|
|
570
|
+
var util = require_util();
|
|
571
|
+
function normalizeArray(parts, allowAboveRoot) {
|
|
572
|
+
var res = [];
|
|
573
|
+
for (var i = 0; i < parts.length; i++) {
|
|
574
|
+
var p = parts[i];
|
|
575
|
+
if (!p || p === ".")
|
|
576
|
+
continue;
|
|
577
|
+
if (p === "..") {
|
|
578
|
+
if (res.length && res[res.length - 1] !== "..") {
|
|
579
|
+
res.pop();
|
|
580
|
+
} else if (allowAboveRoot) {
|
|
581
|
+
res.push("..");
|
|
582
|
+
}
|
|
583
|
+
} else {
|
|
584
|
+
res.push(p);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return res;
|
|
588
|
+
}
|
|
589
|
+
__name(normalizeArray, "normalizeArray");
|
|
590
|
+
function trimArray(arr) {
|
|
591
|
+
var lastIndex = arr.length - 1;
|
|
592
|
+
var start = 0;
|
|
593
|
+
for (; start <= lastIndex; start++) {
|
|
594
|
+
if (arr[start])
|
|
595
|
+
break;
|
|
596
|
+
}
|
|
597
|
+
var end = lastIndex;
|
|
598
|
+
for (; end >= 0; end--) {
|
|
599
|
+
if (arr[end])
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
if (start === 0 && end === lastIndex)
|
|
603
|
+
return arr;
|
|
604
|
+
if (start > end)
|
|
605
|
+
return [];
|
|
606
|
+
return arr.slice(start, end + 1);
|
|
607
|
+
}
|
|
608
|
+
__name(trimArray, "trimArray");
|
|
609
|
+
var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
|
610
|
+
var splitTailRe = /^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
|
|
611
|
+
var win32 = {};
|
|
612
|
+
function win32SplitPath(filename) {
|
|
613
|
+
var result = splitDeviceRe.exec(filename), device = (result[1] || "") + (result[2] || ""), tail = result[3] || "";
|
|
614
|
+
var result2 = splitTailRe.exec(tail), dir = result2[1], basename = result2[2], ext = result2[3];
|
|
615
|
+
return [device, dir, basename, ext];
|
|
616
|
+
}
|
|
617
|
+
__name(win32SplitPath, "win32SplitPath");
|
|
618
|
+
function win32StatPath(path) {
|
|
619
|
+
var result = splitDeviceRe.exec(path), device = result[1] || "", isUnc = !!device && device[1] !== ":";
|
|
620
|
+
return {
|
|
621
|
+
device,
|
|
622
|
+
isUnc,
|
|
623
|
+
isAbsolute: isUnc || !!result[2],
|
|
624
|
+
// UNC paths are always absolute
|
|
625
|
+
tail: result[3]
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
__name(win32StatPath, "win32StatPath");
|
|
629
|
+
function normalizeUNCRoot(device) {
|
|
630
|
+
return "\\\\" + device.replace(/^[\\\/]+/, "").replace(/[\\\/]+/g, "\\");
|
|
631
|
+
}
|
|
632
|
+
__name(normalizeUNCRoot, "normalizeUNCRoot");
|
|
633
|
+
win32.resolve = function() {
|
|
634
|
+
var resolvedDevice = "", resolvedTail = "", resolvedAbsolute = false;
|
|
635
|
+
for (var i = arguments.length - 1; i >= -1; i--) {
|
|
636
|
+
var path;
|
|
637
|
+
if (i >= 0) {
|
|
638
|
+
path = arguments[i];
|
|
639
|
+
} else if (!resolvedDevice) {
|
|
640
|
+
path = process.cwd();
|
|
641
|
+
} else {
|
|
642
|
+
path = process.env["=" + resolvedDevice];
|
|
643
|
+
if (!path || path.substr(0, 3).toLowerCase() !== resolvedDevice.toLowerCase() + "\\") {
|
|
644
|
+
path = resolvedDevice + "\\";
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (!util.isString(path)) {
|
|
648
|
+
throw new TypeError("Arguments to path.resolve must be strings");
|
|
649
|
+
} else if (!path) {
|
|
650
|
+
continue;
|
|
651
|
+
}
|
|
652
|
+
var result = win32StatPath(path), device = result.device, isUnc = result.isUnc, isAbsolute = result.isAbsolute, tail = result.tail;
|
|
653
|
+
if (device && resolvedDevice && device.toLowerCase() !== resolvedDevice.toLowerCase()) {
|
|
654
|
+
continue;
|
|
655
|
+
}
|
|
656
|
+
if (!resolvedDevice) {
|
|
657
|
+
resolvedDevice = device;
|
|
658
|
+
}
|
|
659
|
+
if (!resolvedAbsolute) {
|
|
660
|
+
resolvedTail = tail + "\\" + resolvedTail;
|
|
661
|
+
resolvedAbsolute = isAbsolute;
|
|
662
|
+
}
|
|
663
|
+
if (resolvedDevice && resolvedAbsolute) {
|
|
664
|
+
break;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (isUnc) {
|
|
668
|
+
resolvedDevice = normalizeUNCRoot(resolvedDevice);
|
|
669
|
+
}
|
|
670
|
+
resolvedTail = normalizeArray(
|
|
671
|
+
resolvedTail.split(/[\\\/]+/),
|
|
672
|
+
!resolvedAbsolute
|
|
673
|
+
).join("\\");
|
|
674
|
+
return resolvedDevice + (resolvedAbsolute ? "\\" : "") + resolvedTail || ".";
|
|
675
|
+
};
|
|
676
|
+
win32.normalize = function(path) {
|
|
677
|
+
var result = win32StatPath(path), device = result.device, isUnc = result.isUnc, isAbsolute = result.isAbsolute, tail = result.tail, trailingSlash = /[\\\/]$/.test(tail);
|
|
678
|
+
tail = normalizeArray(tail.split(/[\\\/]+/), !isAbsolute).join("\\");
|
|
679
|
+
if (!tail && !isAbsolute) {
|
|
680
|
+
tail = ".";
|
|
681
|
+
}
|
|
682
|
+
if (tail && trailingSlash) {
|
|
683
|
+
tail += "\\";
|
|
684
|
+
}
|
|
685
|
+
if (isUnc) {
|
|
686
|
+
device = normalizeUNCRoot(device);
|
|
687
|
+
}
|
|
688
|
+
return device + (isAbsolute ? "\\" : "") + tail;
|
|
689
|
+
};
|
|
690
|
+
win32.isAbsolute = function(path) {
|
|
691
|
+
return win32StatPath(path).isAbsolute;
|
|
692
|
+
};
|
|
693
|
+
win32.join = function() {
|
|
694
|
+
var paths = [];
|
|
695
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
696
|
+
var arg = arguments[i];
|
|
697
|
+
if (!util.isString(arg)) {
|
|
698
|
+
throw new TypeError("Arguments to path.join must be strings");
|
|
699
|
+
}
|
|
700
|
+
if (arg) {
|
|
701
|
+
paths.push(arg);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
var joined = paths.join("\\");
|
|
705
|
+
if (!/^[\\\/]{2}[^\\\/]/.test(paths[0])) {
|
|
706
|
+
joined = joined.replace(/^[\\\/]{2,}/, "\\");
|
|
707
|
+
}
|
|
708
|
+
return win32.normalize(joined);
|
|
709
|
+
};
|
|
710
|
+
win32.relative = function(from, to) {
|
|
711
|
+
from = win32.resolve(from);
|
|
712
|
+
to = win32.resolve(to);
|
|
713
|
+
var lowerFrom = from.toLowerCase();
|
|
714
|
+
var lowerTo = to.toLowerCase();
|
|
715
|
+
var toParts = trimArray(to.split("\\"));
|
|
716
|
+
var lowerFromParts = trimArray(lowerFrom.split("\\"));
|
|
717
|
+
var lowerToParts = trimArray(lowerTo.split("\\"));
|
|
718
|
+
var length = Math.min(lowerFromParts.length, lowerToParts.length);
|
|
719
|
+
var samePartsLength = length;
|
|
720
|
+
for (var i = 0; i < length; i++) {
|
|
721
|
+
if (lowerFromParts[i] !== lowerToParts[i]) {
|
|
722
|
+
samePartsLength = i;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
if (samePartsLength == 0) {
|
|
727
|
+
return to;
|
|
728
|
+
}
|
|
729
|
+
var outputParts = [];
|
|
730
|
+
for (var i = samePartsLength; i < lowerFromParts.length; i++) {
|
|
731
|
+
outputParts.push("..");
|
|
732
|
+
}
|
|
733
|
+
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
734
|
+
return outputParts.join("\\");
|
|
735
|
+
};
|
|
736
|
+
win32._makeLong = function(path) {
|
|
737
|
+
if (!util.isString(path))
|
|
738
|
+
return path;
|
|
739
|
+
if (!path) {
|
|
740
|
+
return "";
|
|
741
|
+
}
|
|
742
|
+
var resolvedPath = win32.resolve(path);
|
|
743
|
+
if (/^[a-zA-Z]\:\\/.test(resolvedPath)) {
|
|
744
|
+
return "\\\\?\\" + resolvedPath;
|
|
745
|
+
} else if (/^\\\\[^?.]/.test(resolvedPath)) {
|
|
746
|
+
return "\\\\?\\UNC\\" + resolvedPath.substring(2);
|
|
747
|
+
}
|
|
748
|
+
return path;
|
|
749
|
+
};
|
|
750
|
+
win32.dirname = function(path) {
|
|
751
|
+
var result = win32SplitPath(path), root = result[0], dir = result[1];
|
|
752
|
+
if (!root && !dir) {
|
|
753
|
+
return ".";
|
|
754
|
+
}
|
|
755
|
+
if (dir) {
|
|
756
|
+
dir = dir.substr(0, dir.length - 1);
|
|
757
|
+
}
|
|
758
|
+
return root + dir;
|
|
759
|
+
};
|
|
760
|
+
win32.basename = function(path, ext) {
|
|
761
|
+
var f = win32SplitPath(path)[2];
|
|
762
|
+
if (ext && f.substr(-1 * ext.length) === ext) {
|
|
763
|
+
f = f.substr(0, f.length - ext.length);
|
|
764
|
+
}
|
|
765
|
+
return f;
|
|
766
|
+
};
|
|
767
|
+
win32.extname = function(path) {
|
|
768
|
+
return win32SplitPath(path)[3];
|
|
769
|
+
};
|
|
770
|
+
win32.format = function(pathObject) {
|
|
771
|
+
if (!util.isObject(pathObject)) {
|
|
772
|
+
throw new TypeError(
|
|
773
|
+
"Parameter 'pathObject' must be an object, not " + typeof pathObject
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
var root = pathObject.root || "";
|
|
777
|
+
if (!util.isString(root)) {
|
|
778
|
+
throw new TypeError(
|
|
779
|
+
"'pathObject.root' must be a string or undefined, not " + typeof pathObject.root
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
var dir = pathObject.dir;
|
|
783
|
+
var base = pathObject.base || "";
|
|
784
|
+
if (!dir) {
|
|
785
|
+
return base;
|
|
786
|
+
}
|
|
787
|
+
if (dir[dir.length - 1] === win32.sep) {
|
|
788
|
+
return dir + base;
|
|
789
|
+
}
|
|
790
|
+
return dir + win32.sep + base;
|
|
791
|
+
};
|
|
792
|
+
win32.parse = function(pathString) {
|
|
793
|
+
if (!util.isString(pathString)) {
|
|
794
|
+
throw new TypeError(
|
|
795
|
+
"Parameter 'pathString' must be a string, not " + typeof pathString
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
var allParts = win32SplitPath(pathString);
|
|
799
|
+
if (!allParts || allParts.length !== 4) {
|
|
800
|
+
throw new TypeError("Invalid path '" + pathString + "'");
|
|
801
|
+
}
|
|
802
|
+
return {
|
|
803
|
+
root: allParts[0],
|
|
804
|
+
dir: allParts[0] + allParts[1].slice(0, -1),
|
|
805
|
+
base: allParts[2],
|
|
806
|
+
ext: allParts[3],
|
|
807
|
+
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
|
808
|
+
};
|
|
809
|
+
};
|
|
810
|
+
win32.sep = "\\";
|
|
811
|
+
win32.delimiter = ";";
|
|
812
|
+
var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
|
813
|
+
var posix = {};
|
|
814
|
+
function posixSplitPath(filename) {
|
|
815
|
+
return splitPathRe.exec(filename).slice(1);
|
|
816
|
+
}
|
|
817
|
+
__name(posixSplitPath, "posixSplitPath");
|
|
818
|
+
posix.resolve = function() {
|
|
819
|
+
var resolvedPath = "", resolvedAbsolute = false;
|
|
820
|
+
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
821
|
+
var path = i >= 0 ? arguments[i] : process.cwd();
|
|
822
|
+
if (!util.isString(path)) {
|
|
823
|
+
throw new TypeError("Arguments to path.resolve must be strings");
|
|
824
|
+
} else if (!path) {
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
resolvedPath = path + "/" + resolvedPath;
|
|
828
|
+
resolvedAbsolute = path[0] === "/";
|
|
829
|
+
}
|
|
830
|
+
resolvedPath = normalizeArray(
|
|
831
|
+
resolvedPath.split("/"),
|
|
832
|
+
!resolvedAbsolute
|
|
833
|
+
).join("/");
|
|
834
|
+
return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
|
|
835
|
+
};
|
|
836
|
+
posix.normalize = function(path) {
|
|
837
|
+
var isAbsolute = posix.isAbsolute(path), trailingSlash = path && path[path.length - 1] === "/";
|
|
838
|
+
path = normalizeArray(path.split("/"), !isAbsolute).join("/");
|
|
839
|
+
if (!path && !isAbsolute) {
|
|
840
|
+
path = ".";
|
|
841
|
+
}
|
|
842
|
+
if (path && trailingSlash) {
|
|
843
|
+
path += "/";
|
|
844
|
+
}
|
|
845
|
+
return (isAbsolute ? "/" : "") + path;
|
|
846
|
+
};
|
|
847
|
+
posix.isAbsolute = function(path) {
|
|
848
|
+
return path.charAt(0) === "/";
|
|
849
|
+
};
|
|
850
|
+
posix.join = function() {
|
|
851
|
+
var path = "";
|
|
852
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
853
|
+
var segment = arguments[i];
|
|
854
|
+
if (!util.isString(segment)) {
|
|
855
|
+
throw new TypeError("Arguments to path.join must be strings");
|
|
856
|
+
}
|
|
857
|
+
if (segment) {
|
|
858
|
+
if (!path) {
|
|
859
|
+
path += segment;
|
|
860
|
+
} else {
|
|
861
|
+
path += "/" + segment;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return posix.normalize(path);
|
|
866
|
+
};
|
|
867
|
+
posix.relative = function(from, to) {
|
|
868
|
+
from = posix.resolve(from).substr(1);
|
|
869
|
+
to = posix.resolve(to).substr(1);
|
|
870
|
+
var fromParts = trimArray(from.split("/"));
|
|
871
|
+
var toParts = trimArray(to.split("/"));
|
|
872
|
+
var length = Math.min(fromParts.length, toParts.length);
|
|
873
|
+
var samePartsLength = length;
|
|
874
|
+
for (var i = 0; i < length; i++) {
|
|
875
|
+
if (fromParts[i] !== toParts[i]) {
|
|
876
|
+
samePartsLength = i;
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
var outputParts = [];
|
|
881
|
+
for (var i = samePartsLength; i < fromParts.length; i++) {
|
|
882
|
+
outputParts.push("..");
|
|
883
|
+
}
|
|
884
|
+
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
|
885
|
+
return outputParts.join("/");
|
|
886
|
+
};
|
|
887
|
+
posix._makeLong = function(path) {
|
|
888
|
+
return path;
|
|
889
|
+
};
|
|
890
|
+
posix.dirname = function(path) {
|
|
891
|
+
var result = posixSplitPath(path), root = result[0], dir = result[1];
|
|
892
|
+
if (!root && !dir) {
|
|
893
|
+
return ".";
|
|
894
|
+
}
|
|
895
|
+
if (dir) {
|
|
896
|
+
dir = dir.substr(0, dir.length - 1);
|
|
897
|
+
}
|
|
898
|
+
return root + dir;
|
|
899
|
+
};
|
|
900
|
+
posix.basename = function(path, ext) {
|
|
901
|
+
var f = posixSplitPath(path)[2];
|
|
902
|
+
if (ext && f.substr(-1 * ext.length) === ext) {
|
|
903
|
+
f = f.substr(0, f.length - ext.length);
|
|
904
|
+
}
|
|
905
|
+
return f;
|
|
906
|
+
};
|
|
907
|
+
posix.extname = function(path) {
|
|
908
|
+
return posixSplitPath(path)[3];
|
|
909
|
+
};
|
|
910
|
+
posix.format = function(pathObject) {
|
|
911
|
+
if (!util.isObject(pathObject)) {
|
|
912
|
+
throw new TypeError(
|
|
913
|
+
"Parameter 'pathObject' must be an object, not " + typeof pathObject
|
|
914
|
+
);
|
|
915
|
+
}
|
|
916
|
+
var root = pathObject.root || "";
|
|
917
|
+
if (!util.isString(root)) {
|
|
918
|
+
throw new TypeError(
|
|
919
|
+
"'pathObject.root' must be a string or undefined, not " + typeof pathObject.root
|
|
920
|
+
);
|
|
921
|
+
}
|
|
922
|
+
var dir = pathObject.dir ? pathObject.dir + posix.sep : "";
|
|
923
|
+
var base = pathObject.base || "";
|
|
924
|
+
return dir + base;
|
|
925
|
+
};
|
|
926
|
+
posix.parse = function(pathString) {
|
|
927
|
+
if (!util.isString(pathString)) {
|
|
928
|
+
throw new TypeError(
|
|
929
|
+
"Parameter 'pathString' must be a string, not " + typeof pathString
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
var allParts = posixSplitPath(pathString);
|
|
933
|
+
if (!allParts || allParts.length !== 4) {
|
|
934
|
+
throw new TypeError("Invalid path '" + pathString + "'");
|
|
935
|
+
}
|
|
936
|
+
allParts[1] = allParts[1] || "";
|
|
937
|
+
allParts[2] = allParts[2] || "";
|
|
938
|
+
allParts[3] = allParts[3] || "";
|
|
939
|
+
return {
|
|
940
|
+
root: allParts[0],
|
|
941
|
+
dir: allParts[0] + allParts[1].slice(0, -1),
|
|
942
|
+
base: allParts[2],
|
|
943
|
+
ext: allParts[3],
|
|
944
|
+
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
posix.sep = "/";
|
|
948
|
+
posix.delimiter = ":";
|
|
949
|
+
if (isWindows)
|
|
950
|
+
module.exports = win32;
|
|
951
|
+
else
|
|
952
|
+
module.exports = posix;
|
|
953
|
+
module.exports.posix = posix;
|
|
954
|
+
module.exports.win32 = win32;
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
|
|
958
|
+
// ../../node_modules/@11ty/package-bundler/shims/shim-consume-fs.js
|
|
959
|
+
var shim_consume_fs_exports = {};
|
|
960
|
+
__export(shim_consume_fs_exports, {
|
|
961
|
+
closeSync: () => closeSync,
|
|
962
|
+
default: () => shim_consume_fs_default,
|
|
963
|
+
existsSync: () => existsSync,
|
|
964
|
+
fstatSync: () => fstatSync,
|
|
965
|
+
mkdir: () => mkdir,
|
|
966
|
+
mkdirSync: () => mkdirSync,
|
|
967
|
+
openSync: () => openSync,
|
|
968
|
+
promises: () => promises,
|
|
969
|
+
readFileSync: () => readFileSync,
|
|
970
|
+
readSync: () => readSync,
|
|
971
|
+
readdir: () => readdir,
|
|
972
|
+
readdirSync: () => readdirSync,
|
|
973
|
+
realpath: () => realpath,
|
|
974
|
+
realpathSync: () => realpathSync,
|
|
975
|
+
stat: () => stat,
|
|
976
|
+
statSync: () => statSync,
|
|
977
|
+
writeFileSync: () => writeFileSync
|
|
978
|
+
});
|
|
979
|
+
var GLOBAL_FS_NAME, fs, mkdir, existsSync, mkdirSync, readFileSync, statSync, writeFileSync, promises, readSync, fstatSync, closeSync, openSync, readdir, readdirSync, realpath, realpathSync, stat, shim_consume_fs_default;
|
|
980
|
+
var init_shim_consume_fs = __esm({
|
|
981
|
+
"../../node_modules/@11ty/package-bundler/shims/shim-consume-fs.js"() {
|
|
982
|
+
GLOBAL_FS_NAME = "eleventyFileSystem";
|
|
983
|
+
fs = typeof window !== "undefined" && window[GLOBAL_FS_NAME] || typeof globalThis !== "undefined" && globalThis[GLOBAL_FS_NAME];
|
|
984
|
+
if (!fs) {
|
|
985
|
+
let noopError = function() {
|
|
986
|
+
throw new Error("This function was not included in your Eleventy bundle. Make sure you load memfs.js before using the virtual file system.");
|
|
987
|
+
};
|
|
988
|
+
__name(noopError, "noopError");
|
|
989
|
+
fs = {
|
|
990
|
+
mkdir: noopError,
|
|
991
|
+
existsSync: /* @__PURE__ */ __name(() => false, "existsSync"),
|
|
992
|
+
mkdirSync: noopError,
|
|
993
|
+
readFileSync: noopError,
|
|
994
|
+
statSync: noopError,
|
|
995
|
+
writeFileSync: noopError,
|
|
996
|
+
promises: {},
|
|
997
|
+
// image-size
|
|
998
|
+
readSync: noopError,
|
|
999
|
+
fstatSync: noopError,
|
|
1000
|
+
closeSync: noopError,
|
|
1001
|
+
openSync: noopError,
|
|
1002
|
+
// tinyglobby
|
|
1003
|
+
readdir: noopError,
|
|
1004
|
+
readdirSync: noopError,
|
|
1005
|
+
realpath: noopError,
|
|
1006
|
+
realpathSync: noopError,
|
|
1007
|
+
stat: noopError
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
mkdir = fs.mkdir;
|
|
1011
|
+
existsSync = fs.existsSync;
|
|
1012
|
+
mkdirSync = fs.mkdirSync;
|
|
1013
|
+
readFileSync = fs.readFileSync;
|
|
1014
|
+
statSync = fs.statSync;
|
|
1015
|
+
writeFileSync = fs.writeFileSync;
|
|
1016
|
+
promises = fs.promises;
|
|
1017
|
+
readSync = fs.readSync;
|
|
1018
|
+
fstatSync = fs.fstatSync;
|
|
1019
|
+
closeSync = fs.closeSync;
|
|
1020
|
+
openSync = fs.openSync;
|
|
1021
|
+
readdir = fs.readdir;
|
|
1022
|
+
readdirSync = fs.readdirSync;
|
|
1023
|
+
realpath = fs.realpath;
|
|
1024
|
+
realpathSync = fs.realpathSync;
|
|
1025
|
+
stat = fs.stat;
|
|
1026
|
+
shim_consume_fs_default = fs;
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
|
|
1030
|
+
// ../../node_modules/@11ty/eleventy-utils/src/TemplatePath.js
|
|
1031
|
+
var require_TemplatePath = __commonJS({
|
|
1032
|
+
"../../node_modules/@11ty/eleventy-utils/src/TemplatePath.js"(exports, module) {
|
|
1033
|
+
var path = require_path();
|
|
1034
|
+
var fs2 = (init_shim_consume_fs(), __toCommonJS(shim_consume_fs_exports));
|
|
1035
|
+
function TemplatePath() {
|
|
1036
|
+
}
|
|
1037
|
+
__name(TemplatePath, "TemplatePath");
|
|
1038
|
+
TemplatePath.getWorkingDir = function() {
|
|
1039
|
+
return TemplatePath.normalize(path.resolve("."));
|
|
1040
|
+
};
|
|
1041
|
+
TemplatePath.getDir = function(path2) {
|
|
1042
|
+
if (TemplatePath.isDirectorySync(path2)) {
|
|
1043
|
+
return path2;
|
|
1044
|
+
}
|
|
1045
|
+
return TemplatePath.getDirFromFilePath(path2);
|
|
1046
|
+
};
|
|
1047
|
+
TemplatePath.getDirFromFilePath = function(filePath) {
|
|
1048
|
+
return path.parse(filePath).dir || ".";
|
|
1049
|
+
};
|
|
1050
|
+
TemplatePath.getLastPathSegment = function(path2) {
|
|
1051
|
+
if (!path2.includes("/")) {
|
|
1052
|
+
return path2;
|
|
1053
|
+
}
|
|
1054
|
+
path2 = path2.replace(/\/$/, "");
|
|
1055
|
+
return path2.slice(path2.lastIndexOf("/") + 1);
|
|
1056
|
+
};
|
|
1057
|
+
TemplatePath.getAllDirs = function(path2) {
|
|
1058
|
+
path2 = path2.replace(/\/$/, "");
|
|
1059
|
+
if (!path2.includes("/")) {
|
|
1060
|
+
return [path2];
|
|
1061
|
+
}
|
|
1062
|
+
return path2.split("/").map((segment, index, array) => array.slice(0, index + 1).join("/")).filter((path3) => path3 !== ".").reverse();
|
|
1063
|
+
};
|
|
1064
|
+
TemplatePath.normalize = function(thePath) {
|
|
1065
|
+
let filePath = path.normalize(thePath).split(path.sep).join("/");
|
|
1066
|
+
if (filePath !== "/" && filePath.endsWith("/")) {
|
|
1067
|
+
return filePath.slice(0, -1);
|
|
1068
|
+
}
|
|
1069
|
+
return filePath;
|
|
1070
|
+
};
|
|
1071
|
+
TemplatePath.join = function(...paths) {
|
|
1072
|
+
return TemplatePath.normalize(path.join(...paths));
|
|
1073
|
+
};
|
|
1074
|
+
TemplatePath.normalizeUrlPath = function(...urlPaths) {
|
|
1075
|
+
const urlPath = path.posix.join(...urlPaths);
|
|
1076
|
+
return urlPath.replace(/\/+$/, "/");
|
|
1077
|
+
};
|
|
1078
|
+
TemplatePath.absolutePath = function(...paths) {
|
|
1079
|
+
let i = 0;
|
|
1080
|
+
for (let p of paths) {
|
|
1081
|
+
if (path.isAbsolute(p) && i > 0) {
|
|
1082
|
+
throw new Error(
|
|
1083
|
+
`Only the first parameter to Template.absolutePath can be an absolute path. Received: ${p} from ${paths}`
|
|
1084
|
+
);
|
|
1085
|
+
}
|
|
1086
|
+
i++;
|
|
1087
|
+
}
|
|
1088
|
+
let j = 0;
|
|
1089
|
+
for (let p of paths) {
|
|
1090
|
+
if (j === 0 && path.isAbsolute(p)) {
|
|
1091
|
+
return TemplatePath.join(...paths);
|
|
1092
|
+
}
|
|
1093
|
+
j++;
|
|
1094
|
+
}
|
|
1095
|
+
return TemplatePath.join(TemplatePath.getWorkingDir(), ...paths);
|
|
1096
|
+
};
|
|
1097
|
+
TemplatePath.relativePath = function(absolutePath) {
|
|
1098
|
+
return TemplatePath.stripLeadingSubPath(
|
|
1099
|
+
absolutePath,
|
|
1100
|
+
TemplatePath.getWorkingDir()
|
|
1101
|
+
);
|
|
1102
|
+
};
|
|
1103
|
+
TemplatePath.addLeadingDotSlashArray = function(paths) {
|
|
1104
|
+
return paths.map((path2) => TemplatePath.addLeadingDotSlash(path2));
|
|
1105
|
+
};
|
|
1106
|
+
TemplatePath.addLeadingDotSlash = function(pathArg) {
|
|
1107
|
+
if (pathArg === "." || pathArg === "..") {
|
|
1108
|
+
return pathArg + "/";
|
|
1109
|
+
}
|
|
1110
|
+
if (path.isAbsolute(pathArg) || pathArg.startsWith("./") || pathArg.startsWith("../")) {
|
|
1111
|
+
return pathArg;
|
|
1112
|
+
}
|
|
1113
|
+
return "./" + pathArg;
|
|
1114
|
+
};
|
|
1115
|
+
TemplatePath.stripLeadingDotSlash = function(path2) {
|
|
1116
|
+
return typeof path2 === "string" ? path2.replace(/^\.\//, "") : path2;
|
|
1117
|
+
};
|
|
1118
|
+
function getSubPathRemainder(filePath, subPath) {
|
|
1119
|
+
if (filePath === subPath) {
|
|
1120
|
+
return "";
|
|
1121
|
+
}
|
|
1122
|
+
if (subPath === ".") {
|
|
1123
|
+
let isOutside = filePath === ".." || filePath.startsWith("../") || path.isAbsolute(filePath);
|
|
1124
|
+
return isOutside ? void 0 : filePath;
|
|
1125
|
+
}
|
|
1126
|
+
let prefix = subPath.endsWith("/") ? subPath : `${subPath}/`;
|
|
1127
|
+
return filePath.startsWith(prefix) ? filePath.slice(prefix.length) : void 0;
|
|
1128
|
+
}
|
|
1129
|
+
__name(getSubPathRemainder, "getSubPathRemainder");
|
|
1130
|
+
TemplatePath.startsWithSubPath = function(path2, subPath) {
|
|
1131
|
+
path2 = TemplatePath.normalize(path2);
|
|
1132
|
+
subPath = TemplatePath.normalize(subPath);
|
|
1133
|
+
return getSubPathRemainder(path2, subPath) !== void 0;
|
|
1134
|
+
};
|
|
1135
|
+
TemplatePath.stripLeadingSubPath = function(path2, subPath) {
|
|
1136
|
+
path2 = TemplatePath.normalize(path2);
|
|
1137
|
+
subPath = TemplatePath.normalize(subPath);
|
|
1138
|
+
if (subPath === ".") {
|
|
1139
|
+
return path2;
|
|
1140
|
+
}
|
|
1141
|
+
return getSubPathRemainder(path2, subPath) ?? path2;
|
|
1142
|
+
};
|
|
1143
|
+
TemplatePath.isDirectorySync = function(path2) {
|
|
1144
|
+
return fs2.existsSync(path2) && fs2.statSync(path2).isDirectory();
|
|
1145
|
+
};
|
|
1146
|
+
TemplatePath.isDirectory = async function(path2) {
|
|
1147
|
+
return new Promise((resolve) => {
|
|
1148
|
+
fs2.stat(path2, (err, stats) => {
|
|
1149
|
+
if (stats) {
|
|
1150
|
+
resolve(stats.isDirectory());
|
|
1151
|
+
}
|
|
1152
|
+
resolve(false);
|
|
1153
|
+
});
|
|
1154
|
+
});
|
|
1155
|
+
};
|
|
1156
|
+
TemplatePath.convertToRecursiveGlobSync = function(path2) {
|
|
1157
|
+
if (path2 === "") {
|
|
1158
|
+
return "./**";
|
|
1159
|
+
}
|
|
1160
|
+
path2 = TemplatePath.addLeadingDotSlash(path2);
|
|
1161
|
+
if (TemplatePath.isDirectorySync(path2)) {
|
|
1162
|
+
return path2 + (!path2.endsWith("/") ? "/" : "") + "**";
|
|
1163
|
+
}
|
|
1164
|
+
return path2;
|
|
1165
|
+
};
|
|
1166
|
+
TemplatePath.convertToRecursiveGlob = async function(path2) {
|
|
1167
|
+
if (path2 === "") {
|
|
1168
|
+
return "./**";
|
|
1169
|
+
}
|
|
1170
|
+
path2 = TemplatePath.addLeadingDotSlash(path2);
|
|
1171
|
+
if (await TemplatePath.isDirectory(path2)) {
|
|
1172
|
+
return path2 + (!path2.endsWith("/") ? "/" : "") + "**";
|
|
1173
|
+
}
|
|
1174
|
+
return path2;
|
|
1175
|
+
};
|
|
1176
|
+
TemplatePath.getExtension = function(thePath) {
|
|
1177
|
+
return path.extname(thePath).replace(/^\./, "");
|
|
1178
|
+
};
|
|
1179
|
+
TemplatePath.removeExtension = function(path2, extension = void 0) {
|
|
1180
|
+
if (extension === void 0) {
|
|
1181
|
+
return path2;
|
|
1182
|
+
}
|
|
1183
|
+
const pathExtension = TemplatePath.getExtension(path2);
|
|
1184
|
+
if (pathExtension !== "" && extension.endsWith(pathExtension)) {
|
|
1185
|
+
return path2.substring(0, path2.lastIndexOf(pathExtension) - 1);
|
|
1186
|
+
}
|
|
1187
|
+
return path2;
|
|
1188
|
+
};
|
|
1189
|
+
TemplatePath.normalizeOperatingSystemFilePath = function(filePath, sep = "/") {
|
|
1190
|
+
return filePath.split(sep).join(path.sep);
|
|
1191
|
+
};
|
|
1192
|
+
TemplatePath.standardizeFilePath = function(filePath, sep = "/") {
|
|
1193
|
+
return TemplatePath.addLeadingDotSlash(filePath.split(path.sep).join(sep));
|
|
1194
|
+
};
|
|
1195
|
+
module.exports = TemplatePath;
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
|
+
|
|
1199
|
+
// ../../node_modules/@11ty/eleventy-utils/src/IsPlainObject.js
|
|
1200
|
+
var require_IsPlainObject = __commonJS({
|
|
1201
|
+
"../../node_modules/@11ty/eleventy-utils/src/IsPlainObject.js"(exports, module) {
|
|
1202
|
+
module.exports = function(value) {
|
|
1203
|
+
if (value === null || typeof value !== "object" || value === Object.prototype) {
|
|
1204
|
+
return false;
|
|
1205
|
+
}
|
|
1206
|
+
let proto = Object.getPrototypeOf(value);
|
|
1207
|
+
return !proto || proto === Object.prototype;
|
|
1208
|
+
};
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
// ../../node_modules/@11ty/eleventy-utils/src/Merge.js
|
|
1213
|
+
var require_Merge = __commonJS({
|
|
1214
|
+
"../../node_modules/@11ty/eleventy-utils/src/Merge.js"(exports, module) {
|
|
1215
|
+
"use strict";
|
|
1216
|
+
var isPlainObject = require_IsPlainObject();
|
|
1217
|
+
var OVERRIDE_PREFIX = "override:";
|
|
1218
|
+
var UNSAFE_KEY = "__proto__";
|
|
1219
|
+
function cleanKey(key, prefix) {
|
|
1220
|
+
if (prefix && key.startsWith(prefix)) {
|
|
1221
|
+
return key.slice(prefix.length);
|
|
1222
|
+
}
|
|
1223
|
+
return key;
|
|
1224
|
+
}
|
|
1225
|
+
__name(cleanKey, "cleanKey");
|
|
1226
|
+
function getMergedItem(target, source, prefixes = {}) {
|
|
1227
|
+
let { override } = prefixes;
|
|
1228
|
+
let sourcePlainObjectShortcut = isPlainObject(source);
|
|
1229
|
+
let targetPlainObjectShortcut = false;
|
|
1230
|
+
if (!target) {
|
|
1231
|
+
if (Object.isFrozen(source)) {
|
|
1232
|
+
return source;
|
|
1233
|
+
}
|
|
1234
|
+
if (sourcePlainObjectShortcut) {
|
|
1235
|
+
targetPlainObjectShortcut = true;
|
|
1236
|
+
target = {};
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
if (Array.isArray(target) && Array.isArray(source)) {
|
|
1240
|
+
return target.concat(source);
|
|
1241
|
+
}
|
|
1242
|
+
if (targetPlainObjectShortcut || isPlainObject(target)) {
|
|
1243
|
+
if (sourcePlainObjectShortcut) {
|
|
1244
|
+
for (let key in source) {
|
|
1245
|
+
let overrideKey = cleanKey(key, override);
|
|
1246
|
+
if (overrideKey === UNSAFE_KEY) {
|
|
1247
|
+
continue;
|
|
1248
|
+
}
|
|
1249
|
+
let targetValue = Object.hasOwn(target, key) ? target[key] : void 0;
|
|
1250
|
+
target[overrideKey] = getMergedItem(targetValue, source[key], prefixes);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
return target;
|
|
1254
|
+
}
|
|
1255
|
+
return source;
|
|
1256
|
+
}
|
|
1257
|
+
__name(getMergedItem, "getMergedItem");
|
|
1258
|
+
function DeepCopy2(targetObject, ...sources) {
|
|
1259
|
+
for (let source of sources) {
|
|
1260
|
+
if (!source) {
|
|
1261
|
+
continue;
|
|
1262
|
+
}
|
|
1263
|
+
targetObject = getMergedItem(targetObject, source);
|
|
1264
|
+
}
|
|
1265
|
+
return targetObject;
|
|
1266
|
+
}
|
|
1267
|
+
__name(DeepCopy2, "DeepCopy");
|
|
1268
|
+
function Merge(target, ...sources) {
|
|
1269
|
+
if (isPlainObject(target)) {
|
|
1270
|
+
for (let key in target) {
|
|
1271
|
+
if (key.indexOf(OVERRIDE_PREFIX) === 0) {
|
|
1272
|
+
let cleanedKey = key.slice(OVERRIDE_PREFIX.length);
|
|
1273
|
+
if (cleanedKey !== UNSAFE_KEY) {
|
|
1274
|
+
target[cleanedKey] = target[key];
|
|
1275
|
+
}
|
|
1276
|
+
delete target[key];
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
for (let source of sources) {
|
|
1281
|
+
if (!source) {
|
|
1282
|
+
continue;
|
|
1283
|
+
}
|
|
1284
|
+
target = getMergedItem(target, source, {
|
|
1285
|
+
override: OVERRIDE_PREFIX
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
return target;
|
|
1289
|
+
}
|
|
1290
|
+
__name(Merge, "Merge");
|
|
1291
|
+
module.exports = Merge;
|
|
1292
|
+
module.exports.DeepCopy = DeepCopy2;
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
|
|
1296
|
+
// ../../node_modules/@11ty/eleventy-utils/src/DateCompare.js
|
|
1297
|
+
var require_DateCompare = __commonJS({
|
|
1298
|
+
"../../node_modules/@11ty/eleventy-utils/src/DateCompare.js"(exports, module) {
|
|
1299
|
+
var DateCompare = class {
|
|
1300
|
+
static {
|
|
1301
|
+
__name(this, "DateCompare");
|
|
1302
|
+
}
|
|
1303
|
+
static isTimestampWithinDuration(timestamp, duration, compareDate = Date.now()) {
|
|
1304
|
+
if (!duration || duration === "*" || duration === Infinity) {
|
|
1305
|
+
return true;
|
|
1306
|
+
}
|
|
1307
|
+
let expiration = timestamp + this.getDurationMs(duration);
|
|
1308
|
+
if (expiration > compareDate) {
|
|
1309
|
+
return true;
|
|
1310
|
+
}
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
static getDurationMs(duration = "0s") {
|
|
1314
|
+
let durationUnits = duration.slice(-1);
|
|
1315
|
+
let durationMultiplier;
|
|
1316
|
+
if (durationUnits === "s") {
|
|
1317
|
+
durationMultiplier = 1;
|
|
1318
|
+
} else if (durationUnits === "m") {
|
|
1319
|
+
durationMultiplier = 60;
|
|
1320
|
+
} else if (durationUnits === "h") {
|
|
1321
|
+
durationMultiplier = 60 * 60;
|
|
1322
|
+
} else if (durationUnits === "d") {
|
|
1323
|
+
durationMultiplier = 60 * 60 * 24;
|
|
1324
|
+
} else if (durationUnits === "w") {
|
|
1325
|
+
durationMultiplier = 60 * 60 * 24 * 7;
|
|
1326
|
+
} else if (durationUnits === "y") {
|
|
1327
|
+
durationMultiplier = 60 * 60 * 24 * 365;
|
|
1328
|
+
}
|
|
1329
|
+
let durationValue = parseInt(duration.slice(0, duration.length - 1), 10);
|
|
1330
|
+
return durationValue * durationMultiplier * 1e3;
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
module.exports = DateCompare;
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
|
|
1337
|
+
// ../../node_modules/@11ty/eleventy-utils/src/Url.js
|
|
1338
|
+
var require_Url = __commonJS({
|
|
1339
|
+
"../../node_modules/@11ty/eleventy-utils/src/Url.js"(exports, module) {
|
|
1340
|
+
function base64UrlSafe(hashString = "") {
|
|
1341
|
+
return hashString.replace(/[=\+\/]/g, function(match) {
|
|
1342
|
+
if (match === "=") {
|
|
1343
|
+
return "";
|
|
1344
|
+
}
|
|
1345
|
+
if (match === "+") {
|
|
1346
|
+
return "-";
|
|
1347
|
+
}
|
|
1348
|
+
return "_";
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
__name(base64UrlSafe, "base64UrlSafe");
|
|
1352
|
+
module.exports = { base64UrlSafe };
|
|
1353
|
+
}
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1356
|
+
// ../../node_modules/@11ty/eleventy-utils/src/lib-sha256.js
|
|
1357
|
+
var require_lib_sha256 = __commonJS({
|
|
1358
|
+
"../../node_modules/@11ty/eleventy-utils/src/lib-sha256.js"(exports, module) {
|
|
1359
|
+
module.exports = /* @__PURE__ */ __name(function sha256(data) {
|
|
1360
|
+
let h0 = 1779033703, h1 = 3144134277, h2 = 1013904242, h3 = 2773480762, h4 = 1359893119, h5 = 2600822924, h6 = 528734635, h7 = 1541459225, tsz = 0, bp = 0;
|
|
1361
|
+
const k = [
|
|
1362
|
+
1116352408,
|
|
1363
|
+
1899447441,
|
|
1364
|
+
3049323471,
|
|
1365
|
+
3921009573,
|
|
1366
|
+
961987163,
|
|
1367
|
+
1508970993,
|
|
1368
|
+
2453635748,
|
|
1369
|
+
2870763221,
|
|
1370
|
+
3624381080,
|
|
1371
|
+
310598401,
|
|
1372
|
+
607225278,
|
|
1373
|
+
1426881987,
|
|
1374
|
+
1925078388,
|
|
1375
|
+
2162078206,
|
|
1376
|
+
2614888103,
|
|
1377
|
+
3248222580,
|
|
1378
|
+
3835390401,
|
|
1379
|
+
4022224774,
|
|
1380
|
+
264347078,
|
|
1381
|
+
604807628,
|
|
1382
|
+
770255983,
|
|
1383
|
+
1249150122,
|
|
1384
|
+
1555081692,
|
|
1385
|
+
1996064986,
|
|
1386
|
+
2554220882,
|
|
1387
|
+
2821834349,
|
|
1388
|
+
2952996808,
|
|
1389
|
+
3210313671,
|
|
1390
|
+
3336571891,
|
|
1391
|
+
3584528711,
|
|
1392
|
+
113926993,
|
|
1393
|
+
338241895,
|
|
1394
|
+
666307205,
|
|
1395
|
+
773529912,
|
|
1396
|
+
1294757372,
|
|
1397
|
+
1396182291,
|
|
1398
|
+
1695183700,
|
|
1399
|
+
1986661051,
|
|
1400
|
+
2177026350,
|
|
1401
|
+
2456956037,
|
|
1402
|
+
2730485921,
|
|
1403
|
+
2820302411,
|
|
1404
|
+
3259730800,
|
|
1405
|
+
3345764771,
|
|
1406
|
+
3516065817,
|
|
1407
|
+
3600352804,
|
|
1408
|
+
4094571909,
|
|
1409
|
+
275423344,
|
|
1410
|
+
430227734,
|
|
1411
|
+
506948616,
|
|
1412
|
+
659060556,
|
|
1413
|
+
883997877,
|
|
1414
|
+
958139571,
|
|
1415
|
+
1322822218,
|
|
1416
|
+
1537002063,
|
|
1417
|
+
1747873779,
|
|
1418
|
+
1955562222,
|
|
1419
|
+
2024104815,
|
|
1420
|
+
2227730452,
|
|
1421
|
+
2361852424,
|
|
1422
|
+
2428436474,
|
|
1423
|
+
2756734187,
|
|
1424
|
+
3204031479,
|
|
1425
|
+
3329325298
|
|
1426
|
+
], rrot = /* @__PURE__ */ __name((x, n) => x >>> n | x << 32 - n, "rrot"), w = new Uint32Array(64), buf = new Uint8Array(64), process2 = /* @__PURE__ */ __name(() => {
|
|
1427
|
+
for (let j = 0, r = 0; j < 16; j++, r += 4) {
|
|
1428
|
+
w[j] = buf[r] << 24 | buf[r + 1] << 16 | buf[r + 2] << 8 | buf[r + 3];
|
|
1429
|
+
}
|
|
1430
|
+
for (let j = 16; j < 64; j++) {
|
|
1431
|
+
let s0 = rrot(w[j - 15], 7) ^ rrot(w[j - 15], 18) ^ w[j - 15] >>> 3;
|
|
1432
|
+
let s1 = rrot(w[j - 2], 17) ^ rrot(w[j - 2], 19) ^ w[j - 2] >>> 10;
|
|
1433
|
+
w[j] = w[j - 16] + s0 + w[j - 7] + s1 | 0;
|
|
1434
|
+
}
|
|
1435
|
+
let a = h0, b = h1, c = h2, d = h3, e = h4, f = h5, g = h6, h = h7;
|
|
1436
|
+
for (let j = 0; j < 64; j++) {
|
|
1437
|
+
let S1 = rrot(e, 6) ^ rrot(e, 11) ^ rrot(e, 25), ch = e & f ^ ~e & g, t1 = h + S1 + ch + k[j] + w[j] | 0, S0 = rrot(a, 2) ^ rrot(a, 13) ^ rrot(a, 22), maj = a & b ^ a & c ^ b & c, t2 = S0 + maj | 0;
|
|
1438
|
+
h = g;
|
|
1439
|
+
g = f;
|
|
1440
|
+
f = e;
|
|
1441
|
+
e = d + t1 | 0;
|
|
1442
|
+
d = c;
|
|
1443
|
+
c = b;
|
|
1444
|
+
b = a;
|
|
1445
|
+
a = t1 + t2 | 0;
|
|
1446
|
+
}
|
|
1447
|
+
h0 = h0 + a | 0;
|
|
1448
|
+
h1 = h1 + b | 0;
|
|
1449
|
+
h2 = h2 + c | 0;
|
|
1450
|
+
h3 = h3 + d | 0;
|
|
1451
|
+
h4 = h4 + e | 0;
|
|
1452
|
+
h5 = h5 + f | 0;
|
|
1453
|
+
h6 = h6 + g | 0;
|
|
1454
|
+
h7 = h7 + h | 0;
|
|
1455
|
+
bp = 0;
|
|
1456
|
+
}, "process"), add = /* @__PURE__ */ __name((data2) => {
|
|
1457
|
+
if (typeof data2 === "string") {
|
|
1458
|
+
data2 = typeof TextEncoder === "undefined" ? Buffer.from(data2) : new TextEncoder().encode(data2);
|
|
1459
|
+
}
|
|
1460
|
+
for (let i = 0; i < data2.length; i++) {
|
|
1461
|
+
buf[bp++] = data2[i];
|
|
1462
|
+
if (bp === 64) process2();
|
|
1463
|
+
}
|
|
1464
|
+
tsz += data2.length;
|
|
1465
|
+
}, "add"), digest = /* @__PURE__ */ __name(() => {
|
|
1466
|
+
buf[bp++] = 128;
|
|
1467
|
+
if (bp == 64) process2();
|
|
1468
|
+
if (bp + 8 > 64) {
|
|
1469
|
+
while (bp < 64) buf[bp++] = 0;
|
|
1470
|
+
process2();
|
|
1471
|
+
}
|
|
1472
|
+
while (bp < 58) buf[bp++] = 0;
|
|
1473
|
+
let L = tsz * 8;
|
|
1474
|
+
buf[bp++] = L / 1099511627776 & 255;
|
|
1475
|
+
buf[bp++] = L / 4294967296 & 255;
|
|
1476
|
+
buf[bp++] = L >>> 24;
|
|
1477
|
+
buf[bp++] = L >>> 16 & 255;
|
|
1478
|
+
buf[bp++] = L >>> 8 & 255;
|
|
1479
|
+
buf[bp++] = L & 255;
|
|
1480
|
+
process2();
|
|
1481
|
+
let reply = new Uint8Array(32);
|
|
1482
|
+
reply[0] = h0 >>> 24;
|
|
1483
|
+
reply[1] = h0 >>> 16 & 255;
|
|
1484
|
+
reply[2] = h0 >>> 8 & 255;
|
|
1485
|
+
reply[3] = h0 & 255;
|
|
1486
|
+
reply[4] = h1 >>> 24;
|
|
1487
|
+
reply[5] = h1 >>> 16 & 255;
|
|
1488
|
+
reply[6] = h1 >>> 8 & 255;
|
|
1489
|
+
reply[7] = h1 & 255;
|
|
1490
|
+
reply[8] = h2 >>> 24;
|
|
1491
|
+
reply[9] = h2 >>> 16 & 255;
|
|
1492
|
+
reply[10] = h2 >>> 8 & 255;
|
|
1493
|
+
reply[11] = h2 & 255;
|
|
1494
|
+
reply[12] = h3 >>> 24;
|
|
1495
|
+
reply[13] = h3 >>> 16 & 255;
|
|
1496
|
+
reply[14] = h3 >>> 8 & 255;
|
|
1497
|
+
reply[15] = h3 & 255;
|
|
1498
|
+
reply[16] = h4 >>> 24;
|
|
1499
|
+
reply[17] = h4 >>> 16 & 255;
|
|
1500
|
+
reply[18] = h4 >>> 8 & 255;
|
|
1501
|
+
reply[19] = h4 & 255;
|
|
1502
|
+
reply[20] = h5 >>> 24;
|
|
1503
|
+
reply[21] = h5 >>> 16 & 255;
|
|
1504
|
+
reply[22] = h5 >>> 8 & 255;
|
|
1505
|
+
reply[23] = h5 & 255;
|
|
1506
|
+
reply[24] = h6 >>> 24;
|
|
1507
|
+
reply[25] = h6 >>> 16 & 255;
|
|
1508
|
+
reply[26] = h6 >>> 8 & 255;
|
|
1509
|
+
reply[27] = h6 & 255;
|
|
1510
|
+
reply[28] = h7 >>> 24;
|
|
1511
|
+
reply[29] = h7 >>> 16 & 255;
|
|
1512
|
+
reply[30] = h7 >>> 8 & 255;
|
|
1513
|
+
reply[31] = h7 & 255;
|
|
1514
|
+
reply.hex = () => {
|
|
1515
|
+
let res = "";
|
|
1516
|
+
reply.forEach((x) => res += ("0" + x.toString(16)).slice(-2));
|
|
1517
|
+
return res;
|
|
1518
|
+
};
|
|
1519
|
+
return reply;
|
|
1520
|
+
}, "digest");
|
|
1521
|
+
if (data === void 0) return { add, digest };
|
|
1522
|
+
add(data);
|
|
1523
|
+
return digest();
|
|
1524
|
+
}, "sha256");
|
|
1525
|
+
}
|
|
1526
|
+
});
|
|
1527
|
+
|
|
1528
|
+
// ../../node_modules/@11ty/eleventy-utils/src/HashTypes.js
|
|
1529
|
+
var require_HashTypes = __commonJS({
|
|
1530
|
+
"../../node_modules/@11ty/eleventy-utils/src/HashTypes.js"(exports, module) {
|
|
1531
|
+
var { base64UrlSafe } = require_Url();
|
|
1532
|
+
var sha256 = require_lib_sha256();
|
|
1533
|
+
function hasNodeCryptoModule() {
|
|
1534
|
+
try {
|
|
1535
|
+
__require("node:crypto");
|
|
1536
|
+
return true;
|
|
1537
|
+
} catch (e) {
|
|
1538
|
+
return false;
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
__name(hasNodeCryptoModule, "hasNodeCryptoModule");
|
|
1542
|
+
var HAS_NODE_CRYPTO = hasNodeCryptoModule();
|
|
1543
|
+
var Hash = class {
|
|
1544
|
+
static {
|
|
1545
|
+
__name(this, "Hash");
|
|
1546
|
+
}
|
|
1547
|
+
static create() {
|
|
1548
|
+
if (typeof globalThis.crypto === "undefined") {
|
|
1549
|
+
if (HAS_NODE_CRYPTO) {
|
|
1550
|
+
return NodeCryptoHash;
|
|
1551
|
+
}
|
|
1552
|
+
return ScriptHash;
|
|
1553
|
+
}
|
|
1554
|
+
return WebCryptoHash;
|
|
1555
|
+
}
|
|
1556
|
+
// Does not use WebCrypto (as WebCrypto is async-only)
|
|
1557
|
+
static createSync() {
|
|
1558
|
+
if (HAS_NODE_CRYPTO) {
|
|
1559
|
+
return NodeCryptoHash;
|
|
1560
|
+
}
|
|
1561
|
+
return ScriptHash;
|
|
1562
|
+
}
|
|
1563
|
+
static toBase64(bytes) {
|
|
1564
|
+
let str = Array.from(bytes, (b) => String.fromCodePoint(b)).join("");
|
|
1565
|
+
return btoa(str);
|
|
1566
|
+
}
|
|
1567
|
+
// Thanks https://evanhahn.com/the-best-way-to-concatenate-uint8arrays/ (Public domain)
|
|
1568
|
+
static mergeUint8Array(...arrays) {
|
|
1569
|
+
let totalLength = arrays.reduce(
|
|
1570
|
+
(total, uint8array) => total + uint8array.byteLength,
|
|
1571
|
+
0
|
|
1572
|
+
);
|
|
1573
|
+
let result = new Uint8Array(totalLength);
|
|
1574
|
+
let offset = 0;
|
|
1575
|
+
arrays.forEach((uint8array) => {
|
|
1576
|
+
result.set(uint8array, offset);
|
|
1577
|
+
offset += uint8array.byteLength;
|
|
1578
|
+
});
|
|
1579
|
+
return result;
|
|
1580
|
+
}
|
|
1581
|
+
static bufferToBase64Url(hashBuffer) {
|
|
1582
|
+
return base64UrlSafe(this.toBase64(new Uint8Array(hashBuffer)));
|
|
1583
|
+
}
|
|
1584
|
+
static bufferToHex(hashBuffer) {
|
|
1585
|
+
return Array.from(new Uint8Array(hashBuffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
1586
|
+
}
|
|
1587
|
+
};
|
|
1588
|
+
var WebCryptoHash = class extends Hash {
|
|
1589
|
+
static {
|
|
1590
|
+
__name(this, "WebCryptoHash");
|
|
1591
|
+
}
|
|
1592
|
+
static async toHash(...content) {
|
|
1593
|
+
let encoder = new TextEncoder();
|
|
1594
|
+
let input = this.mergeUint8Array(...content.map((c) => {
|
|
1595
|
+
if (c instanceof Uint8Array) {
|
|
1596
|
+
return c;
|
|
1597
|
+
}
|
|
1598
|
+
return encoder.encode(c);
|
|
1599
|
+
}));
|
|
1600
|
+
return crypto.subtle.digest("SHA-256", input);
|
|
1601
|
+
}
|
|
1602
|
+
static async toBase64Url(...content) {
|
|
1603
|
+
return this.toHash(...content).then((hashBuffer) => {
|
|
1604
|
+
return this.bufferToBase64Url(hashBuffer);
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
static async toHex(...content) {
|
|
1608
|
+
return this.toHash(...content).then((hashBuffer) => {
|
|
1609
|
+
return this.bufferToHex(hashBuffer);
|
|
1610
|
+
});
|
|
1611
|
+
}
|
|
1612
|
+
static toBase64UrlSync() {
|
|
1613
|
+
throw new Error("Synchronous methods are not available in the Web Crypto API.");
|
|
1614
|
+
}
|
|
1615
|
+
static toHexSync() {
|
|
1616
|
+
throw new Error("Synchronous methods are not available in the Web Crypto API.");
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
var NodeCryptoHash = class extends Hash {
|
|
1620
|
+
static {
|
|
1621
|
+
__name(this, "NodeCryptoHash");
|
|
1622
|
+
}
|
|
1623
|
+
static toHash(...content) {
|
|
1624
|
+
const { createHash } = __require("node:crypto");
|
|
1625
|
+
let hash = createHash("sha256");
|
|
1626
|
+
for (let c of content) {
|
|
1627
|
+
hash.update(c);
|
|
1628
|
+
}
|
|
1629
|
+
return hash;
|
|
1630
|
+
}
|
|
1631
|
+
static toBase64Url(...content) {
|
|
1632
|
+
let base64 = this.toHash(...content).digest("base64");
|
|
1633
|
+
return base64UrlSafe(base64);
|
|
1634
|
+
}
|
|
1635
|
+
static toHex(...content) {
|
|
1636
|
+
return this.toHash(...content).digest("hex");
|
|
1637
|
+
}
|
|
1638
|
+
// aliases
|
|
1639
|
+
static toBase64UrlSync = this.toBase64Url;
|
|
1640
|
+
static toHexSync = this.toHex;
|
|
1641
|
+
};
|
|
1642
|
+
var ScriptHash = class extends Hash {
|
|
1643
|
+
static {
|
|
1644
|
+
__name(this, "ScriptHash");
|
|
1645
|
+
}
|
|
1646
|
+
static toHash(...content) {
|
|
1647
|
+
let hash = sha256();
|
|
1648
|
+
for (let c of content) {
|
|
1649
|
+
hash.add(c);
|
|
1650
|
+
}
|
|
1651
|
+
return hash.digest();
|
|
1652
|
+
}
|
|
1653
|
+
static toBase64Url(...content) {
|
|
1654
|
+
let hashBuffer = this.toHash(...content);
|
|
1655
|
+
return this.bufferToBase64Url(hashBuffer);
|
|
1656
|
+
}
|
|
1657
|
+
static toHex(...content) {
|
|
1658
|
+
let hashBuffer = this.toHash(...content);
|
|
1659
|
+
return this.bufferToHex(hashBuffer);
|
|
1660
|
+
}
|
|
1661
|
+
// aliases
|
|
1662
|
+
static toBase64UrlSync = this.toBase64Url;
|
|
1663
|
+
static toHexSync = this.toHex;
|
|
1664
|
+
};
|
|
1665
|
+
module.exports = { Hash, NodeCryptoHash, ScriptHash, WebCryptoHash };
|
|
1666
|
+
}
|
|
1667
|
+
});
|
|
1668
|
+
|
|
1669
|
+
// ../../node_modules/@11ty/eleventy-utils/src/CreateHash.js
|
|
1670
|
+
var require_CreateHash = __commonJS({
|
|
1671
|
+
"../../node_modules/@11ty/eleventy-utils/src/CreateHash.js"(exports, module) {
|
|
1672
|
+
var { Hash } = require_HashTypes();
|
|
1673
|
+
async function createHash(...content) {
|
|
1674
|
+
return Hash.create().toBase64Url(...content);
|
|
1675
|
+
}
|
|
1676
|
+
__name(createHash, "createHash");
|
|
1677
|
+
async function createHashHex(...content) {
|
|
1678
|
+
return Hash.create().toHex(...content);
|
|
1679
|
+
}
|
|
1680
|
+
__name(createHashHex, "createHashHex");
|
|
1681
|
+
function createHashSync(...content) {
|
|
1682
|
+
return Hash.createSync().toBase64Url(...content);
|
|
1683
|
+
}
|
|
1684
|
+
__name(createHashSync, "createHashSync");
|
|
1685
|
+
function createHashHexSync(...content) {
|
|
1686
|
+
return Hash.createSync().toHex(...content);
|
|
1687
|
+
}
|
|
1688
|
+
__name(createHashHexSync, "createHashHexSync");
|
|
1689
|
+
module.exports = {
|
|
1690
|
+
createHash,
|
|
1691
|
+
createHashSync,
|
|
1692
|
+
createHashHex,
|
|
1693
|
+
createHashHexSync
|
|
1694
|
+
};
|
|
1695
|
+
}
|
|
1696
|
+
});
|
|
1697
|
+
|
|
1698
|
+
// ../../node_modules/@11ty/eleventy-utils/src/Buffer.js
|
|
1699
|
+
var require_Buffer = __commonJS({
|
|
1700
|
+
"../../node_modules/@11ty/eleventy-utils/src/Buffer.js"(exports, module) {
|
|
1701
|
+
function isBuffer(inst) {
|
|
1702
|
+
if (typeof Buffer !== "undefined") {
|
|
1703
|
+
return Buffer.isBuffer(inst);
|
|
1704
|
+
}
|
|
1705
|
+
return inst instanceof Uint8Array;
|
|
1706
|
+
}
|
|
1707
|
+
__name(isBuffer, "isBuffer");
|
|
1708
|
+
module.exports = {
|
|
1709
|
+
isBuffer
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
});
|
|
1713
|
+
|
|
1714
|
+
// ../../node_modules/@11ty/eleventy-utils/index.js
|
|
1715
|
+
var require_eleventy_utils = __commonJS({
|
|
1716
|
+
"../../node_modules/@11ty/eleventy-utils/index.js"(exports, module) {
|
|
1717
|
+
var TemplatePath = require_TemplatePath();
|
|
1718
|
+
var isPlainObject = require_IsPlainObject();
|
|
1719
|
+
var Merge = require_Merge();
|
|
1720
|
+
var DateCompare = require_DateCompare();
|
|
1721
|
+
var { DeepCopy: DeepCopy2 } = Merge;
|
|
1722
|
+
var { createHash, createHashHex, createHashSync, createHashHexSync } = require_CreateHash();
|
|
1723
|
+
var Buffer2 = require_Buffer();
|
|
1724
|
+
module.exports = {
|
|
1725
|
+
TemplatePath,
|
|
1726
|
+
isPlainObject,
|
|
1727
|
+
Merge,
|
|
1728
|
+
DeepCopy: DeepCopy2,
|
|
1729
|
+
DateCompare,
|
|
1730
|
+
createHash,
|
|
1731
|
+
createHashHex,
|
|
1732
|
+
createHashSync,
|
|
1733
|
+
createHashHexSync,
|
|
1734
|
+
Buffer: Buffer2
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
|
|
1739
|
+
// ../../src/Plugins/I18nPlugin.js
|
|
1740
|
+
var import_eleventy_utils = __toESM(require_eleventy_utils(), 1);
|
|
1741
|
+
var WITHDRAWN_LANGUAGES = /* @__PURE__ */ new Set(["bh", "in", "iw", "ji", "jw", "mo", "sh"]);
|
|
1742
|
+
var UNCAPITALIZED_LABEL_LANGUAGES = /* @__PURE__ */ new Set(["ka", "nd", "sn", "zu"]);
|
|
1743
|
+
var LangUtils = class _LangUtils {
|
|
1744
|
+
static {
|
|
1745
|
+
__name(this, "LangUtils");
|
|
1746
|
+
}
|
|
1747
|
+
static getLanguageCodeFromInputPath(filepath, languages) {
|
|
1748
|
+
return (filepath || "").split("/").find((entry) => Comparator.isLangCode(entry, languages));
|
|
1749
|
+
}
|
|
1750
|
+
static getLanguageCodeFromUrl(url, languages) {
|
|
1751
|
+
let s = (url || "").split("/");
|
|
1752
|
+
return s.length > 0 && Comparator.isLangCode(s[1], languages) ? s[1] : "";
|
|
1753
|
+
}
|
|
1754
|
+
static swapLanguageCodeNoCheck(str, langCode, languages) {
|
|
1755
|
+
let found = false;
|
|
1756
|
+
return str.split("/").map((entry) => {
|
|
1757
|
+
if (!found && Comparator.isLangCode(entry, languages)) {
|
|
1758
|
+
found = true;
|
|
1759
|
+
return langCode;
|
|
1760
|
+
}
|
|
1761
|
+
return entry;
|
|
1762
|
+
}).join("/");
|
|
1763
|
+
}
|
|
1764
|
+
static swapLanguageCode(str, langCode, languages) {
|
|
1765
|
+
if (!Comparator.isLangCode(langCode, languages)) {
|
|
1766
|
+
return str;
|
|
1767
|
+
}
|
|
1768
|
+
return _LangUtils.swapLanguageCodeNoCheck(str, langCode, languages);
|
|
1769
|
+
}
|
|
1770
|
+
};
|
|
1771
|
+
var Comparator = class _Comparator {
|
|
1772
|
+
static {
|
|
1773
|
+
__name(this, "Comparator");
|
|
1774
|
+
}
|
|
1775
|
+
// Created lazily so importing core doesn’t require `Intl`.
|
|
1776
|
+
static #languageNames;
|
|
1777
|
+
static #scriptNames;
|
|
1778
|
+
static #regionNames;
|
|
1779
|
+
// https://en.wikipedia.org/wiki/IETF_language_tag#Relation_to_other_standards
|
|
1780
|
+
// Requires a ISO-639-1 language code at the start (2 characters before the first -)
|
|
1781
|
+
// An explicit `languages` list replaces detection entirely.
|
|
1782
|
+
static isLangCode(code, languages) {
|
|
1783
|
+
if (Array.isArray(languages)) {
|
|
1784
|
+
return languages.includes(code);
|
|
1785
|
+
}
|
|
1786
|
+
let [s] = (code || "").split("-");
|
|
1787
|
+
if (s.length !== 2 || s !== s.toLowerCase() || WITHDRAWN_LANGUAGES.has(s)) {
|
|
1788
|
+
return false;
|
|
1789
|
+
}
|
|
1790
|
+
let script;
|
|
1791
|
+
let region;
|
|
1792
|
+
try {
|
|
1793
|
+
({ script, region } = new Intl.Locale(code));
|
|
1794
|
+
} catch {
|
|
1795
|
+
return false;
|
|
1796
|
+
}
|
|
1797
|
+
_Comparator.#languageNames ??= new Intl.DisplayNames(["en"], {
|
|
1798
|
+
type: "language",
|
|
1799
|
+
fallback: "none"
|
|
1800
|
+
});
|
|
1801
|
+
if (!_Comparator.#languageNames.of(s)) {
|
|
1802
|
+
return false;
|
|
1803
|
+
}
|
|
1804
|
+
if (code.split("-").length !== 1 + Boolean(script) + Boolean(region)) {
|
|
1805
|
+
return false;
|
|
1806
|
+
}
|
|
1807
|
+
_Comparator.#scriptNames ??= new Intl.DisplayNames(["en"], { type: "script", fallback: "none" });
|
|
1808
|
+
if (script && !_Comparator.#scriptNames.of(script)) {
|
|
1809
|
+
return false;
|
|
1810
|
+
}
|
|
1811
|
+
_Comparator.#regionNames ??= new Intl.DisplayNames(["en"], { type: "region", fallback: "none" });
|
|
1812
|
+
if (region && !_Comparator.#regionNames.of(region)) {
|
|
1813
|
+
return false;
|
|
1814
|
+
}
|
|
1815
|
+
return true;
|
|
1816
|
+
}
|
|
1817
|
+
static urlHasLangCode(url, code, languages) {
|
|
1818
|
+
if (!_Comparator.isLangCode(code, languages)) {
|
|
1819
|
+
return false;
|
|
1820
|
+
}
|
|
1821
|
+
return url.split("/").some((entry) => entry === code);
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
function getNativeLanguageName(langCode) {
|
|
1825
|
+
let [code] = langCode.split("-");
|
|
1826
|
+
try {
|
|
1827
|
+
let name = new Intl.DisplayNames([code], { type: "language" }).of(code);
|
|
1828
|
+
if (UNCAPITALIZED_LABEL_LANGUAGES.has(code)) {
|
|
1829
|
+
return name;
|
|
1830
|
+
}
|
|
1831
|
+
let [first] = name;
|
|
1832
|
+
return first.toLocaleUpperCase(code) + name.slice(first.length);
|
|
1833
|
+
} catch {
|
|
1834
|
+
return code;
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
__name(getNativeLanguageName, "getNativeLanguageName");
|
|
1838
|
+
function normalizeInputPath(inputPath, extensionMap) {
|
|
1839
|
+
if (extensionMap) {
|
|
1840
|
+
return extensionMap.removeTemplateExtension(inputPath);
|
|
1841
|
+
}
|
|
1842
|
+
return inputPath;
|
|
1843
|
+
}
|
|
1844
|
+
__name(normalizeInputPath, "normalizeInputPath");
|
|
1845
|
+
function getLocaleUrlsMap(urlToInputPath, extensionMap, options = {}) {
|
|
1846
|
+
let filemap = {};
|
|
1847
|
+
for (let url in urlToInputPath) {
|
|
1848
|
+
let { inputPath: originalFilepath, groupNumber } = urlToInputPath[url];
|
|
1849
|
+
let filepath = normalizeInputPath(originalFilepath, extensionMap);
|
|
1850
|
+
let replaced = LangUtils.swapLanguageCodeNoCheck(filepath, "__11ty_i18n", options.languages);
|
|
1851
|
+
if (groupNumber === void 0) {
|
|
1852
|
+
let urlLangCode = LangUtils.getLanguageCodeFromUrl(url, options.languages);
|
|
1853
|
+
replaced += `_url:${urlLangCode ? url.slice(urlLangCode.length + 1) : url}`;
|
|
1854
|
+
} else {
|
|
1855
|
+
replaced += `_group:${groupNumber}`;
|
|
1856
|
+
}
|
|
1857
|
+
if (!filemap[replaced]) {
|
|
1858
|
+
filemap[replaced] = [];
|
|
1859
|
+
}
|
|
1860
|
+
let langCode = LangUtils.getLanguageCodeFromInputPath(originalFilepath, options.languages);
|
|
1861
|
+
if (!langCode) {
|
|
1862
|
+
langCode = LangUtils.getLanguageCodeFromUrl(url, options.languages);
|
|
1863
|
+
}
|
|
1864
|
+
if (!langCode) {
|
|
1865
|
+
langCode = options.defaultLanguage;
|
|
1866
|
+
}
|
|
1867
|
+
if (langCode) {
|
|
1868
|
+
filemap[replaced].push({
|
|
1869
|
+
url,
|
|
1870
|
+
lang: langCode,
|
|
1871
|
+
label: getNativeLanguageName(langCode)
|
|
1872
|
+
});
|
|
1873
|
+
} else {
|
|
1874
|
+
filemap[replaced].push({ url });
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
for (let key in filemap) {
|
|
1878
|
+
filemap[key].sort(function(a, b) {
|
|
1879
|
+
if (a.lang < b.lang) {
|
|
1880
|
+
return -1;
|
|
1881
|
+
}
|
|
1882
|
+
if (a.lang > b.lang) {
|
|
1883
|
+
return 1;
|
|
1884
|
+
}
|
|
1885
|
+
return 0;
|
|
1886
|
+
});
|
|
1887
|
+
}
|
|
1888
|
+
let urlMap = {};
|
|
1889
|
+
for (let filepath in filemap) {
|
|
1890
|
+
for (let entry of filemap[filepath]) {
|
|
1891
|
+
let url = entry.url;
|
|
1892
|
+
if (!urlMap[url]) {
|
|
1893
|
+
urlMap[url] = filemap[filepath].filter((entry2) => {
|
|
1894
|
+
if (entry2.lang) {
|
|
1895
|
+
return true;
|
|
1896
|
+
}
|
|
1897
|
+
return entry2.url !== url;
|
|
1898
|
+
});
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
return urlMap;
|
|
1903
|
+
}
|
|
1904
|
+
__name(getLocaleUrlsMap, "getLocaleUrlsMap");
|
|
1905
|
+
function I18nPlugin(eleventyConfig, opts = {}) {
|
|
1906
|
+
let options = (0, import_eleventy_utils.DeepCopy)(
|
|
1907
|
+
{
|
|
1908
|
+
defaultLanguage: "",
|
|
1909
|
+
languages: void 0,
|
|
1910
|
+
// e.g. ["en", "es"], skips language code detection
|
|
1911
|
+
filters: {
|
|
1912
|
+
url: "locale_url",
|
|
1913
|
+
links: "locale_links"
|
|
1914
|
+
},
|
|
1915
|
+
errorMode: "strict"
|
|
1916
|
+
// allow-fallback, never
|
|
1917
|
+
},
|
|
1918
|
+
opts
|
|
1919
|
+
);
|
|
1920
|
+
if (options.languages !== void 0 && !Array.isArray(options.languages)) {
|
|
1921
|
+
throw new Error(
|
|
1922
|
+
"The `languages` option in Eleventy\u2019s Internationalization (I18N) plugin must be an array of language codes."
|
|
1923
|
+
);
|
|
1924
|
+
}
|
|
1925
|
+
if (!options.defaultLanguage) {
|
|
1926
|
+
options.defaultLanguage = options.languages?.[0];
|
|
1927
|
+
}
|
|
1928
|
+
if (!options.defaultLanguage) {
|
|
1929
|
+
throw new Error(
|
|
1930
|
+
"You must specify a `defaultLanguage` (or `languages`) in Eleventy\u2019s Internationalization (I18N) plugin."
|
|
1931
|
+
);
|
|
1932
|
+
}
|
|
1933
|
+
if (options.languages) {
|
|
1934
|
+
options.languages = Array.from(/* @__PURE__ */ new Set([options.defaultLanguage, ...options.languages]));
|
|
1935
|
+
}
|
|
1936
|
+
let extensionMap;
|
|
1937
|
+
eleventyConfig.on("buildawesome.extensionmap", (map) => {
|
|
1938
|
+
extensionMap = map;
|
|
1939
|
+
});
|
|
1940
|
+
let bench = eleventyConfig.benchmarkManager.get("Aggregate");
|
|
1941
|
+
let contentMaps = {};
|
|
1942
|
+
eleventyConfig.on("buildawesome.contentmap", function({ urlToInputPath, inputPathToUrl }) {
|
|
1943
|
+
let b = bench.get("(i18n Plugin) Setting up content map.");
|
|
1944
|
+
b.before();
|
|
1945
|
+
contentMaps.inputPathToUrl = inputPathToUrl;
|
|
1946
|
+
contentMaps.urlToInputPath = urlToInputPath;
|
|
1947
|
+
contentMaps.localeUrlsMap = getLocaleUrlsMap(urlToInputPath, extensionMap, options);
|
|
1948
|
+
b.after();
|
|
1949
|
+
});
|
|
1950
|
+
eleventyConfig.addGlobalData("eleventyComputed.page.lang", () => {
|
|
1951
|
+
return (data) => {
|
|
1952
|
+
return LangUtils.getLanguageCodeFromUrl(data.page.url, options.languages) || options.defaultLanguage;
|
|
1953
|
+
};
|
|
1954
|
+
});
|
|
1955
|
+
eleventyConfig.addFilter(options.filters.url, function(originalUrl, langCodeOverride) {
|
|
1956
|
+
let url = originalUrl;
|
|
1957
|
+
let suffix = "";
|
|
1958
|
+
if (url.startsWith("/") && !url.startsWith("//")) {
|
|
1959
|
+
let parsed = new URL(url, "http://localhost/");
|
|
1960
|
+
url = decodeURI(parsed.pathname);
|
|
1961
|
+
suffix = parsed.search + parsed.hash;
|
|
1962
|
+
}
|
|
1963
|
+
let langCode = langCodeOverride || LangUtils.getLanguageCodeFromUrl(this.page?.url, options.languages) || options.defaultLanguage;
|
|
1964
|
+
if (contentMaps.localeUrlsMap[url] || !url.endsWith("/") && contentMaps.localeUrlsMap[`${url}/`]) {
|
|
1965
|
+
for (let existingUrlObj of contentMaps.localeUrlsMap[url] || contentMaps.localeUrlsMap[`${url}/`]) {
|
|
1966
|
+
if (Comparator.urlHasLangCode(existingUrlObj.url, langCode, options.languages)) {
|
|
1967
|
+
return existingUrlObj.url + suffix;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
let prependedLangCodeUrl = `/${langCode}${url}`;
|
|
1972
|
+
if (contentMaps.localeUrlsMap[prependedLangCodeUrl] || !prependedLangCodeUrl.endsWith("/") && contentMaps.localeUrlsMap[`${prependedLangCodeUrl}/`]) {
|
|
1973
|
+
return prependedLangCodeUrl + suffix;
|
|
1974
|
+
}
|
|
1975
|
+
if (contentMaps.urlToInputPath[url] || !url.endsWith("/") && contentMaps.urlToInputPath[`${url}/`]) {
|
|
1976
|
+
if (options.errorMode === "strict") {
|
|
1977
|
+
throw new Error(
|
|
1978
|
+
`Localized file for URL ${prependedLangCodeUrl} was not found in your project. A non-localized version does exist\u2014are you sure you meant to use the \`${options.filters.url}\` filter for this? You can bypass this error using the \`errorMode\` option in the I18N plugin (current value: "${options.errorMode}").`
|
|
1979
|
+
);
|
|
1980
|
+
}
|
|
1981
|
+
} else if (options.errorMode === "allow-fallback") {
|
|
1982
|
+
throw new Error(
|
|
1983
|
+
`Localized file for URL ${prependedLangCodeUrl} was not found in your project! You will need to add it if you want to link to it using the \`${options.filters.url}\` filter. You can bypass this error using the \`errorMode\` option in the I18N plugin (current value: "${options.errorMode}").`
|
|
1984
|
+
);
|
|
1985
|
+
}
|
|
1986
|
+
return originalUrl;
|
|
1987
|
+
});
|
|
1988
|
+
eleventyConfig.addFilter(options.filters.links, function(urlOverride) {
|
|
1989
|
+
let url = urlOverride || this.page?.url;
|
|
1990
|
+
return (contentMaps.localeUrlsMap[url] || []).filter((entry) => {
|
|
1991
|
+
return entry.url !== url;
|
|
1992
|
+
});
|
|
1993
|
+
});
|
|
1994
|
+
eleventyConfig.addFilter(
|
|
1995
|
+
"locale_page",
|
|
1996
|
+
// This is not exposed in `options` because it is an Eleventy internals filter (used in get*CollectionItem filters)
|
|
1997
|
+
function(pageOverride, languageCode) {
|
|
1998
|
+
if (!languageCode) {
|
|
1999
|
+
languageCode = options.defaultLanguage;
|
|
2000
|
+
}
|
|
2001
|
+
let page = pageOverride || this.page;
|
|
2002
|
+
let url;
|
|
2003
|
+
if (contentMaps.localeUrlsMap[page.url]) {
|
|
2004
|
+
for (let entry of contentMaps.localeUrlsMap[page.url]) {
|
|
2005
|
+
if (entry.lang === languageCode) {
|
|
2006
|
+
url = entry.url;
|
|
2007
|
+
}
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
let inputPath = LangUtils.swapLanguageCode(page.inputPath, languageCode, options.languages);
|
|
2011
|
+
if (!url || !Array.isArray(contentMaps.inputPathToUrl[inputPath]) || contentMaps.inputPathToUrl[inputPath].length === 0) {
|
|
2012
|
+
return page;
|
|
2013
|
+
}
|
|
2014
|
+
let result = {
|
|
2015
|
+
// // note that the permalink/slug may be different for the localized file!
|
|
2016
|
+
url,
|
|
2017
|
+
inputPath,
|
|
2018
|
+
filePathStem: LangUtils.swapLanguageCode(
|
|
2019
|
+
page.filePathStem,
|
|
2020
|
+
languageCode,
|
|
2021
|
+
options.languages
|
|
2022
|
+
),
|
|
2023
|
+
// outputPath is omitted here, not necessary for GetCollectionItem.js if url is provided
|
|
2024
|
+
__locale_page_resolved: true
|
|
2025
|
+
};
|
|
2026
|
+
return result;
|
|
2027
|
+
}
|
|
2028
|
+
);
|
|
2029
|
+
}
|
|
2030
|
+
__name(I18nPlugin, "I18nPlugin");
|
|
2031
|
+
Object.defineProperty(I18nPlugin, "eleventyPackage", {
|
|
2032
|
+
value: "@11ty/eleventy/i18n-plugin"
|
|
2033
|
+
});
|
|
2034
|
+
Object.defineProperty(I18nPlugin, "eleventyPluginOptions", {
|
|
2035
|
+
value: {
|
|
2036
|
+
unique: true
|
|
2037
|
+
}
|
|
2038
|
+
});
|
|
2039
|
+
Object.assign(I18nPlugin, {
|
|
2040
|
+
Comparator,
|
|
2041
|
+
LangUtils
|
|
2042
|
+
});
|
|
2043
|
+
export {
|
|
2044
|
+
I18nPlugin
|
|
2045
|
+
};
|