@skeptools/skep-organization-project 0.0.16 → 0.0.18
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/.jsii +29 -4
- package/API.md +63 -1
- package/lib/skep-organization-project.js +1 -1
- package/node_modules/liquidjs/README.md +15 -10
- package/node_modules/liquidjs/dist/context/context.d.ts +6 -3
- package/node_modules/liquidjs/dist/drop/blank-drop.d.ts +1 -0
- package/node_modules/liquidjs/dist/drop/empty-drop.d.ts +1 -0
- package/node_modules/liquidjs/dist/index.d.ts +2 -2
- package/node_modules/liquidjs/dist/liquid-options.d.ts +2 -0
- package/node_modules/liquidjs/dist/liquid.browser.min.js +1 -1
- package/node_modules/liquidjs/dist/liquid.browser.min.js.map +1 -1
- package/node_modules/liquidjs/dist/liquid.browser.mjs +712 -45
- package/node_modules/liquidjs/dist/liquid.browser.umd.js +1573 -215
- package/node_modules/liquidjs/dist/liquid.browser.umd.js.map +1 -1
- package/node_modules/liquidjs/dist/liquid.d.ts +29 -1
- package/node_modules/liquidjs/dist/liquid.node.js +699 -45
- package/node_modules/liquidjs/dist/liquid.node.mjs +712 -45
- package/node_modules/liquidjs/dist/render/expression.d.ts +1 -1
- package/node_modules/liquidjs/dist/render/operator.d.ts +1 -0
- package/node_modules/liquidjs/dist/tags/assign.d.ts +5 -0
- package/node_modules/liquidjs/dist/tags/block.d.ts +2 -0
- package/node_modules/liquidjs/dist/tags/break.d.ts +1 -1
- package/node_modules/liquidjs/dist/tags/capture.d.ts +5 -1
- package/node_modules/liquidjs/dist/tags/case.d.ts +3 -0
- package/node_modules/liquidjs/dist/tags/continue.d.ts +1 -1
- package/node_modules/liquidjs/dist/tags/cycle.d.ts +2 -0
- package/node_modules/liquidjs/dist/tags/decrement.d.ts +3 -0
- package/node_modules/liquidjs/dist/tags/echo.d.ts +2 -0
- package/node_modules/liquidjs/dist/tags/for.d.ts +4 -0
- package/node_modules/liquidjs/dist/tags/if.d.ts +3 -0
- package/node_modules/liquidjs/dist/tags/include.d.ts +5 -1
- package/node_modules/liquidjs/dist/tags/increment.d.ts +3 -0
- package/node_modules/liquidjs/dist/tags/layout.d.ts +4 -0
- package/node_modules/liquidjs/dist/tags/liquid.d.ts +1 -0
- package/node_modules/liquidjs/dist/tags/render.d.ts +4 -0
- package/node_modules/liquidjs/dist/tags/tablerow.d.ts +4 -0
- package/node_modules/liquidjs/dist/tags/unless.d.ts +3 -0
- package/node_modules/liquidjs/dist/template/analysis.d.ts +85 -0
- package/node_modules/liquidjs/dist/template/analysis.spec.d.ts +1 -0
- package/node_modules/liquidjs/dist/template/hash.d.ts +2 -1
- package/node_modules/liquidjs/dist/template/index.d.ts +1 -0
- package/node_modules/liquidjs/dist/template/output.d.ts +2 -1
- package/node_modules/liquidjs/dist/template/template.d.ts +29 -0
- package/node_modules/liquidjs/dist/tokens/liquid-tag-token.d.ts +1 -1
- package/node_modules/liquidjs/dist/util/type-guards.d.ts +2 -1
- package/node_modules/liquidjs/dist/util/underscore.d.ts +3 -0
- package/node_modules/liquidjs/package.json +2 -1
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* liquidjs@10.
|
|
3
|
-
* (c) 2016-
|
|
2
|
+
* liquidjs@10.20.1, https://github.com/harttle/liquidjs
|
|
3
|
+
* (c) 2016-2025 harttle
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
@@ -240,6 +240,9 @@
|
|
|
240
240
|
// be compatible with IE 8
|
|
241
241
|
return toString$1.call(value) === '[object Array]';
|
|
242
242
|
}
|
|
243
|
+
function isArrayLike(value) {
|
|
244
|
+
return value && isNumber(value.length);
|
|
245
|
+
}
|
|
243
246
|
function isIterable(value) {
|
|
244
247
|
return isObject(value) && Symbol.iterator in value;
|
|
245
248
|
}
|
|
@@ -334,6 +337,47 @@
|
|
|
334
337
|
}
|
|
335
338
|
function escapeRegExp(text) {
|
|
336
339
|
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
|
340
|
+
}
|
|
341
|
+
/** Return an array containing unique elements from _array_. Works with nested arrays and objects. */
|
|
342
|
+
function strictUniq(array) {
|
|
343
|
+
var seen, array_1, array_1_1, element, key, e_1_1;
|
|
344
|
+
var e_1, _a;
|
|
345
|
+
return __generator(this, function (_b) {
|
|
346
|
+
switch (_b.label) {
|
|
347
|
+
case 0:
|
|
348
|
+
seen = new Set();
|
|
349
|
+
_b.label = 1;
|
|
350
|
+
case 1:
|
|
351
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
352
|
+
array_1 = __values(array), array_1_1 = array_1.next();
|
|
353
|
+
_b.label = 2;
|
|
354
|
+
case 2:
|
|
355
|
+
if (!!array_1_1.done) return [3 /*break*/, 5];
|
|
356
|
+
element = array_1_1.value;
|
|
357
|
+
key = JSON.stringify(element);
|
|
358
|
+
if (!!seen.has(key)) return [3 /*break*/, 4];
|
|
359
|
+
seen.add(key);
|
|
360
|
+
return [4 /*yield*/, element];
|
|
361
|
+
case 3:
|
|
362
|
+
_b.sent();
|
|
363
|
+
_b.label = 4;
|
|
364
|
+
case 4:
|
|
365
|
+
array_1_1 = array_1.next();
|
|
366
|
+
return [3 /*break*/, 2];
|
|
367
|
+
case 5: return [3 /*break*/, 8];
|
|
368
|
+
case 6:
|
|
369
|
+
e_1_1 = _b.sent();
|
|
370
|
+
e_1 = { error: e_1_1 };
|
|
371
|
+
return [3 /*break*/, 8];
|
|
372
|
+
case 7:
|
|
373
|
+
try {
|
|
374
|
+
if (array_1_1 && !array_1_1.done && (_a = array_1.return)) _a.call(array_1);
|
|
375
|
+
}
|
|
376
|
+
finally { if (e_1) throw e_1.error; }
|
|
377
|
+
return [7 /*endfinally*/];
|
|
378
|
+
case 8: return [2 /*return*/];
|
|
379
|
+
}
|
|
380
|
+
});
|
|
337
381
|
}
|
|
338
382
|
|
|
339
383
|
/**
|
|
@@ -569,6 +613,9 @@
|
|
|
569
613
|
EmptyDrop.prototype.valueOf = function () {
|
|
570
614
|
return '';
|
|
571
615
|
};
|
|
616
|
+
EmptyDrop.is = function (value) {
|
|
617
|
+
return value instanceof EmptyDrop;
|
|
618
|
+
};
|
|
572
619
|
return EmptyDrop;
|
|
573
620
|
}(Drop));
|
|
574
621
|
|
|
@@ -586,6 +633,9 @@
|
|
|
586
633
|
return /^\s*$/.test(value);
|
|
587
634
|
return _super.prototype.equals.call(this, value);
|
|
588
635
|
};
|
|
636
|
+
BlankDrop.is = function (value) {
|
|
637
|
+
return value instanceof BlankDrop;
|
|
638
|
+
};
|
|
589
639
|
return BlankDrop;
|
|
590
640
|
}(EmptyDrop));
|
|
591
641
|
|
|
@@ -919,7 +969,11 @@
|
|
|
919
969
|
|
|
920
970
|
// one minute in milliseconds
|
|
921
971
|
var OneMinute = 60000;
|
|
922
|
-
|
|
972
|
+
/**
|
|
973
|
+
* Need support both ISO8601 and RFC2822 as in major browsers & NodeJS
|
|
974
|
+
* RFC2822: https://datatracker.ietf.org/doc/html/rfc2822#section-3.3
|
|
975
|
+
*/
|
|
976
|
+
var TIMEZONE_PATTERN = /([zZ]|([+-])(\d{2}):?(\d{2}))$/;
|
|
923
977
|
var monthNames = [
|
|
924
978
|
'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
|
|
925
979
|
'September', 'October', 'November', 'December'
|
|
@@ -1036,7 +1090,7 @@
|
|
|
1036
1090
|
* Given that a template is expected to be parsed fewer times than rendered.
|
|
1037
1091
|
*/
|
|
1038
1092
|
LiquidDate.createDateFixedToTimezone = function (dateString, locale) {
|
|
1039
|
-
var m = dateString.match(
|
|
1093
|
+
var m = dateString.match(TIMEZONE_PATTERN);
|
|
1040
1094
|
// representing a UTC timestamp
|
|
1041
1095
|
if (m && m[1] === 'Z') {
|
|
1042
1096
|
return new LiquidDate(+new Date(dateString), locale, 0);
|
|
@@ -1373,9 +1427,15 @@
|
|
|
1373
1427
|
_this.name = _this.tokenizer.readTagName();
|
|
1374
1428
|
_this.tokenizer.assert(_this.name, 'illegal liquid tag syntax');
|
|
1375
1429
|
_this.tokenizer.skipBlank();
|
|
1376
|
-
_this.args = _this.tokenizer.remaining();
|
|
1377
1430
|
return _this;
|
|
1378
1431
|
}
|
|
1432
|
+
Object.defineProperty(LiquidTagToken.prototype, "args", {
|
|
1433
|
+
get: function () {
|
|
1434
|
+
return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]);
|
|
1435
|
+
},
|
|
1436
|
+
enumerable: false,
|
|
1437
|
+
configurable: true
|
|
1438
|
+
});
|
|
1379
1439
|
return LiquidTagToken;
|
|
1380
1440
|
}(DelimitedToken));
|
|
1381
1441
|
|
|
@@ -1486,7 +1546,7 @@
|
|
|
1486
1546
|
html = _b.sent();
|
|
1487
1547
|
// if not, it'll return an `html`, write to the emitter for it
|
|
1488
1548
|
html && emitter.write(html);
|
|
1489
|
-
if (
|
|
1549
|
+
if (ctx.breakCalled || ctx.continueCalled)
|
|
1490
1550
|
return [3 /*break*/, 7];
|
|
1491
1551
|
return [3 /*break*/, 6];
|
|
1492
1552
|
case 5:
|
|
@@ -1675,6 +1735,7 @@
|
|
|
1675
1735
|
return [4 /*yield*/, evalToken(token.rhs, ctx)];
|
|
1676
1736
|
case 2:
|
|
1677
1737
|
high = _a.sent();
|
|
1738
|
+
ctx.memoryLimit.use(high - low + 1);
|
|
1678
1739
|
return [2 /*return*/, range(+low, +high + 1)];
|
|
1679
1740
|
}
|
|
1680
1741
|
});
|
|
@@ -1806,6 +1867,9 @@
|
|
|
1806
1867
|
if (lhs.length !== rhs.length)
|
|
1807
1868
|
return false;
|
|
1808
1869
|
return !lhs.some(function (value, i) { return !equals(value, rhs[i]); });
|
|
1870
|
+
}
|
|
1871
|
+
function arrayIncludes(arr, item) {
|
|
1872
|
+
return arr.some(function (value) { return equals(value, item); });
|
|
1809
1873
|
}
|
|
1810
1874
|
|
|
1811
1875
|
var Node = /** @class */ (function () {
|
|
@@ -2779,10 +2843,10 @@
|
|
|
2779
2843
|
* hash['reversed'] === undefined
|
|
2780
2844
|
*/
|
|
2781
2845
|
var Hash = /** @class */ (function () {
|
|
2782
|
-
function Hash(
|
|
2846
|
+
function Hash(input, jekyllStyle) {
|
|
2783
2847
|
var e_1, _a;
|
|
2784
2848
|
this.hash = {};
|
|
2785
|
-
var tokenizer = new Tokenizer(
|
|
2849
|
+
var tokenizer = input instanceof Tokenizer ? input : new Tokenizer(input, {});
|
|
2786
2850
|
try {
|
|
2787
2851
|
for (var _b = __values(tokenizer.readHashes(jekyllStyle)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2788
2852
|
var hash = _c.value;
|
|
@@ -3025,6 +3089,16 @@
|
|
|
3025
3089
|
}
|
|
3026
3090
|
});
|
|
3027
3091
|
};
|
|
3092
|
+
Output.prototype.arguments = function () {
|
|
3093
|
+
return __generator(this, function (_a) {
|
|
3094
|
+
switch (_a.label) {
|
|
3095
|
+
case 0: return [4 /*yield*/, this.value];
|
|
3096
|
+
case 1:
|
|
3097
|
+
_a.sent();
|
|
3098
|
+
return [2 /*return*/];
|
|
3099
|
+
}
|
|
3100
|
+
});
|
|
3101
|
+
};
|
|
3028
3102
|
return Output;
|
|
3029
3103
|
}(TemplateImpl));
|
|
3030
3104
|
|
|
@@ -3044,177 +3118,849 @@
|
|
|
3044
3118
|
return HTML;
|
|
3045
3119
|
}(TemplateImpl));
|
|
3046
3120
|
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3121
|
+
/**
|
|
3122
|
+
* A variable's segments and location, which can be coerced to a string.
|
|
3123
|
+
*/
|
|
3124
|
+
var Variable = /** @class */ (function () {
|
|
3125
|
+
function Variable(segments, location) {
|
|
3126
|
+
this.segments = segments;
|
|
3127
|
+
this.location = location;
|
|
3128
|
+
}
|
|
3129
|
+
Variable.prototype.toString = function () {
|
|
3130
|
+
return segmentsString(this.segments, true);
|
|
3131
|
+
};
|
|
3132
|
+
/** Return this variable's segments as an array, possibly with nested arrays for nested paths. */
|
|
3133
|
+
Variable.prototype.toArray = function () {
|
|
3134
|
+
function _visit() {
|
|
3135
|
+
var _i, segments_1, segments_1_1, segment, e_1_1;
|
|
3136
|
+
var e_1, _a;
|
|
3137
|
+
var segments = [];
|
|
3138
|
+
for (_i = 0; _i < arguments.length; _i++) {
|
|
3139
|
+
segments[_i] = arguments[_i];
|
|
3140
|
+
}
|
|
3141
|
+
return __generator(this, function (_b) {
|
|
3142
|
+
switch (_b.label) {
|
|
3143
|
+
case 0:
|
|
3144
|
+
_b.trys.push([0, 7, 8, 9]);
|
|
3145
|
+
segments_1 = __values(segments), segments_1_1 = segments_1.next();
|
|
3146
|
+
_b.label = 1;
|
|
3147
|
+
case 1:
|
|
3148
|
+
if (!!segments_1_1.done) return [3 /*break*/, 6];
|
|
3149
|
+
segment = segments_1_1.value;
|
|
3150
|
+
if (!(segment instanceof Variable)) return [3 /*break*/, 3];
|
|
3151
|
+
return [4 /*yield*/, Array.from(_visit.apply(void 0, __spreadArray([], __read(segment.segments), false)))];
|
|
3152
|
+
case 2:
|
|
3153
|
+
_b.sent();
|
|
3154
|
+
return [3 /*break*/, 5];
|
|
3155
|
+
case 3: return [4 /*yield*/, segment];
|
|
3156
|
+
case 4:
|
|
3157
|
+
_b.sent();
|
|
3158
|
+
_b.label = 5;
|
|
3159
|
+
case 5:
|
|
3160
|
+
segments_1_1 = segments_1.next();
|
|
3161
|
+
return [3 /*break*/, 1];
|
|
3162
|
+
case 6: return [3 /*break*/, 9];
|
|
3163
|
+
case 7:
|
|
3164
|
+
e_1_1 = _b.sent();
|
|
3165
|
+
e_1 = { error: e_1_1 };
|
|
3166
|
+
return [3 /*break*/, 9];
|
|
3167
|
+
case 8:
|
|
3168
|
+
try {
|
|
3169
|
+
if (segments_1_1 && !segments_1_1.done && (_a = segments_1.return)) _a.call(segments_1);
|
|
3170
|
+
}
|
|
3171
|
+
finally { if (e_1) throw e_1.error; }
|
|
3172
|
+
return [7 /*endfinally*/];
|
|
3173
|
+
case 9: return [2 /*return*/];
|
|
3174
|
+
}
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
return Array.from(_visit.apply(void 0, __spreadArray([], __read(this.segments), false)));
|
|
3178
|
+
};
|
|
3179
|
+
return Variable;
|
|
3180
|
+
}());
|
|
3181
|
+
/**
|
|
3182
|
+
* Group variables by the string representation of their root segment.
|
|
3183
|
+
*/
|
|
3184
|
+
var VariableMap = /** @class */ (function () {
|
|
3185
|
+
function VariableMap() {
|
|
3186
|
+
this.map = new Map();
|
|
3187
|
+
}
|
|
3188
|
+
VariableMap.prototype.get = function (key) {
|
|
3189
|
+
var k = segmentsString([key.segments[0]]);
|
|
3190
|
+
if (!this.map.has(k)) {
|
|
3191
|
+
this.map.set(k, []);
|
|
3192
|
+
}
|
|
3193
|
+
return this.map.get(k);
|
|
3194
|
+
};
|
|
3195
|
+
VariableMap.prototype.has = function (key) {
|
|
3196
|
+
return this.map.has(segmentsString([key.segments[0]]));
|
|
3197
|
+
};
|
|
3198
|
+
VariableMap.prototype.push = function (variable) {
|
|
3199
|
+
this.get(variable).push(variable);
|
|
3200
|
+
};
|
|
3201
|
+
VariableMap.prototype.asObject = function () {
|
|
3202
|
+
return Object.fromEntries(this.map);
|
|
3203
|
+
};
|
|
3204
|
+
return VariableMap;
|
|
3205
|
+
}());
|
|
3206
|
+
var defaultStaticAnalysisOptions = {
|
|
3207
|
+
partials: true
|
|
3208
|
+
};
|
|
3209
|
+
function _analyze(templates, partials, sync) {
|
|
3210
|
+
function updateVariables(variable, scope) {
|
|
3211
|
+
var e_3, _a;
|
|
3212
|
+
variables.push(variable);
|
|
3213
|
+
var aliased = scope.alias(variable);
|
|
3214
|
+
if (aliased !== undefined) {
|
|
3215
|
+
var root = aliased.segments[0];
|
|
3216
|
+
// TODO: What if a a template renders a rendered template? Do we need scope.parent?
|
|
3217
|
+
if (isString(root) && !rootScope.has(root)) {
|
|
3218
|
+
globals.push(aliased);
|
|
3219
|
+
}
|
|
3061
3220
|
}
|
|
3062
3221
|
else {
|
|
3063
|
-
|
|
3222
|
+
var root = variable.segments[0];
|
|
3223
|
+
if (isString(root) && !scope.has(root)) {
|
|
3224
|
+
globals.push(variable);
|
|
3225
|
+
}
|
|
3226
|
+
}
|
|
3227
|
+
try {
|
|
3228
|
+
// Recurse for nested Variables
|
|
3229
|
+
for (var _b = __values(variable.segments), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3230
|
+
var segment = _c.value;
|
|
3231
|
+
if (segment instanceof Variable) {
|
|
3232
|
+
updateVariables(segment, scope);
|
|
3233
|
+
}
|
|
3234
|
+
}
|
|
3235
|
+
}
|
|
3236
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
3237
|
+
finally {
|
|
3238
|
+
try {
|
|
3239
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3240
|
+
}
|
|
3241
|
+
finally { if (e_3) throw e_3.error; }
|
|
3064
3242
|
}
|
|
3065
|
-
this.contains = this.options.fs.contains || (function () { return true; });
|
|
3066
3243
|
}
|
|
3067
|
-
|
|
3068
|
-
var
|
|
3069
|
-
var
|
|
3070
|
-
return __generator(this, function (
|
|
3071
|
-
switch (
|
|
3244
|
+
function visit(template, scope) {
|
|
3245
|
+
var _a, _b, arg, _c, _d, variable, _e, _f, ident, _g, row, col, partial, _h, _j, child, e_4_1, partialScopeNames, partialScope, _k, _l, name_1, _m, alias, argument, variables_1, _o, _p, child, e_5_1, _q, _r, child, e_6_1;
|
|
3246
|
+
var e_7, _s, e_8, _t, e_9, _u, e_4, _v, e_10, _w, e_5, _x, e_6, _y;
|
|
3247
|
+
return __generator(this, function (_z) {
|
|
3248
|
+
switch (_z.label) {
|
|
3072
3249
|
case 0:
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
e_1_1 = _e.sent();
|
|
3100
|
-
e_1 = { error: e_1_1 };
|
|
3101
|
-
return [3 /*break*/, 10];
|
|
3102
|
-
case 9:
|
|
3103
|
-
try {
|
|
3104
|
-
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
3250
|
+
if (template.arguments) {
|
|
3251
|
+
try {
|
|
3252
|
+
for (_a = __values(template.arguments()), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
3253
|
+
arg = _b.value;
|
|
3254
|
+
try {
|
|
3255
|
+
for (_c = (e_8 = void 0, __values(extractVariables(arg))), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
3256
|
+
variable = _d.value;
|
|
3257
|
+
updateVariables(variable, scope);
|
|
3258
|
+
}
|
|
3259
|
+
}
|
|
3260
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
3261
|
+
finally {
|
|
3262
|
+
try {
|
|
3263
|
+
if (_d && !_d.done && (_t = _c.return)) _t.call(_c);
|
|
3264
|
+
}
|
|
3265
|
+
finally { if (e_8) throw e_8.error; }
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
3270
|
+
finally {
|
|
3271
|
+
try {
|
|
3272
|
+
if (_b && !_b.done && (_s = _a.return)) _s.call(_a);
|
|
3273
|
+
}
|
|
3274
|
+
finally { if (e_7) throw e_7.error; }
|
|
3275
|
+
}
|
|
3105
3276
|
}
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3277
|
+
if (template.localScope) {
|
|
3278
|
+
try {
|
|
3279
|
+
for (_e = __values(template.localScope()), _f = _e.next(); !_f.done; _f = _e.next()) {
|
|
3280
|
+
ident = _f.value;
|
|
3281
|
+
scope.add(ident.content);
|
|
3282
|
+
scope.deleteAlias(ident.content);
|
|
3283
|
+
_g = __read(ident.getPosition(), 2), row = _g[0], col = _g[1];
|
|
3284
|
+
locals.push(new Variable([ident.content], { row: row, col: col, file: ident.file }));
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
3288
|
+
finally {
|
|
3289
|
+
try {
|
|
3290
|
+
if (_f && !_f.done && (_u = _e.return)) _u.call(_e);
|
|
3291
|
+
}
|
|
3292
|
+
finally { if (e_9) throw e_9.error; }
|
|
3293
|
+
}
|
|
3294
|
+
}
|
|
3295
|
+
if (!template.children) return [3 /*break*/, 30];
|
|
3296
|
+
if (!template.partialScope) return [3 /*break*/, 20];
|
|
3297
|
+
partial = template.partialScope();
|
|
3298
|
+
if (!(partial === undefined)) return [3 /*break*/, 10];
|
|
3299
|
+
_z.label = 1;
|
|
3122
3300
|
case 1:
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
_d.label = 2;
|
|
3301
|
+
_z.trys.push([1, 7, 8, 9]);
|
|
3302
|
+
return [4 /*yield*/, template.children(partials, sync)];
|
|
3126
3303
|
case 2:
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
if (!(!enforceRoot || this.contains(dir, referenced))) return [3 /*break*/, 4];
|
|
3130
|
-
// the relatively referenced file is within one of root dirs
|
|
3131
|
-
return [4 /*yield*/, referenced];
|
|
3304
|
+
_h = __values.apply(void 0, [(_z.sent())]), _j = _h.next();
|
|
3305
|
+
_z.label = 3;
|
|
3132
3306
|
case 3:
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
return [
|
|
3307
|
+
if (!!_j.done) return [3 /*break*/, 6];
|
|
3308
|
+
child = _j.value;
|
|
3309
|
+
return [4 /*yield*/, visit(child, scope)];
|
|
3136
3310
|
case 4:
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
case 5:
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
return [3 /*break*/, 8];
|
|
3311
|
+
_z.sent();
|
|
3312
|
+
_z.label = 5;
|
|
3313
|
+
case 5:
|
|
3314
|
+
_j = _h.next();
|
|
3315
|
+
return [3 /*break*/, 3];
|
|
3316
|
+
case 6: return [3 /*break*/, 9];
|
|
3144
3317
|
case 7:
|
|
3318
|
+
e_4_1 = _z.sent();
|
|
3319
|
+
e_4 = { error: e_4_1 };
|
|
3320
|
+
return [3 /*break*/, 9];
|
|
3321
|
+
case 8:
|
|
3145
3322
|
try {
|
|
3146
|
-
if (
|
|
3323
|
+
if (_j && !_j.done && (_v = _h.return)) _v.call(_h);
|
|
3147
3324
|
}
|
|
3148
|
-
finally { if (
|
|
3325
|
+
finally { if (e_4) throw e_4.error; }
|
|
3149
3326
|
return [7 /*endfinally*/];
|
|
3150
|
-
case
|
|
3151
|
-
_d.trys.push([8, 13, 14, 15]);
|
|
3152
|
-
dirs_2 = __values(dirs), dirs_2_1 = dirs_2.next();
|
|
3153
|
-
_d.label = 9;
|
|
3154
|
-
case 9:
|
|
3155
|
-
if (!!dirs_2_1.done) return [3 /*break*/, 12];
|
|
3156
|
-
dir = dirs_2_1.value;
|
|
3157
|
-
referenced = fs.resolve(dir, file, extname);
|
|
3158
|
-
if (!(!enforceRoot || this.contains(dir, referenced))) return [3 /*break*/, 11];
|
|
3159
|
-
return [4 /*yield*/, referenced];
|
|
3327
|
+
case 9: return [2 /*return*/];
|
|
3160
3328
|
case 10:
|
|
3161
|
-
|
|
3162
|
-
|
|
3329
|
+
if (seen.has(partial.name))
|
|
3330
|
+
return [2 /*return*/];
|
|
3331
|
+
partialScopeNames = new Set();
|
|
3332
|
+
partialScope = partial.isolated
|
|
3333
|
+
? new DummyScope(partialScopeNames)
|
|
3334
|
+
: scope.push(partialScopeNames);
|
|
3335
|
+
try {
|
|
3336
|
+
for (_k = __values(partial.scope), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
3337
|
+
name_1 = _l.value;
|
|
3338
|
+
if (isString(name_1)) {
|
|
3339
|
+
partialScopeNames.add(name_1);
|
|
3340
|
+
}
|
|
3341
|
+
else {
|
|
3342
|
+
_m = __read(name_1, 2), alias = _m[0], argument = _m[1];
|
|
3343
|
+
partialScopeNames.add(alias);
|
|
3344
|
+
variables_1 = Array.from(extractVariables(argument));
|
|
3345
|
+
if (variables_1.length) {
|
|
3346
|
+
partialScope.setAlias(alias, variables_1[0].segments);
|
|
3347
|
+
}
|
|
3348
|
+
}
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
3352
|
+
finally {
|
|
3353
|
+
try {
|
|
3354
|
+
if (_l && !_l.done && (_w = _k.return)) _w.call(_k);
|
|
3355
|
+
}
|
|
3356
|
+
finally { if (e_10) throw e_10.error; }
|
|
3357
|
+
}
|
|
3358
|
+
_z.label = 11;
|
|
3163
3359
|
case 11:
|
|
3164
|
-
|
|
3165
|
-
return [
|
|
3166
|
-
case 12:
|
|
3360
|
+
_z.trys.push([11, 17, 18, 19]);
|
|
3361
|
+
return [4 /*yield*/, template.children(partials, sync)];
|
|
3362
|
+
case 12:
|
|
3363
|
+
_o = __values.apply(void 0, [(_z.sent())]), _p = _o.next();
|
|
3364
|
+
_z.label = 13;
|
|
3167
3365
|
case 13:
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
return [
|
|
3366
|
+
if (!!_p.done) return [3 /*break*/, 16];
|
|
3367
|
+
child = _p.value;
|
|
3368
|
+
return [4 /*yield*/, visit(child, partialScope)];
|
|
3171
3369
|
case 14:
|
|
3370
|
+
_z.sent();
|
|
3371
|
+
seen.add(partial.name);
|
|
3372
|
+
_z.label = 15;
|
|
3373
|
+
case 15:
|
|
3374
|
+
_p = _o.next();
|
|
3375
|
+
return [3 /*break*/, 13];
|
|
3376
|
+
case 16: return [3 /*break*/, 19];
|
|
3377
|
+
case 17:
|
|
3378
|
+
e_5_1 = _z.sent();
|
|
3379
|
+
e_5 = { error: e_5_1 };
|
|
3380
|
+
return [3 /*break*/, 19];
|
|
3381
|
+
case 18:
|
|
3172
3382
|
try {
|
|
3173
|
-
if (
|
|
3383
|
+
if (_p && !_p.done && (_x = _o.return)) _x.call(_o);
|
|
3174
3384
|
}
|
|
3175
|
-
finally { if (
|
|
3385
|
+
finally { if (e_5) throw e_5.error; }
|
|
3176
3386
|
return [7 /*endfinally*/];
|
|
3177
|
-
case
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
case
|
|
3387
|
+
case 19:
|
|
3388
|
+
partialScope.pop();
|
|
3389
|
+
return [3 /*break*/, 30];
|
|
3390
|
+
case 20:
|
|
3391
|
+
if (template.blockScope) {
|
|
3392
|
+
scope.push(new Set(template.blockScope()));
|
|
3393
|
+
}
|
|
3394
|
+
_z.label = 21;
|
|
3395
|
+
case 21:
|
|
3396
|
+
_z.trys.push([21, 27, 28, 29]);
|
|
3397
|
+
return [4 /*yield*/, template.children(partials, sync)];
|
|
3398
|
+
case 22:
|
|
3399
|
+
_q = __values.apply(void 0, [(_z.sent())]), _r = _q.next();
|
|
3400
|
+
_z.label = 23;
|
|
3401
|
+
case 23:
|
|
3402
|
+
if (!!_r.done) return [3 /*break*/, 26];
|
|
3403
|
+
child = _r.value;
|
|
3404
|
+
return [4 /*yield*/, visit(child, scope)];
|
|
3405
|
+
case 24:
|
|
3406
|
+
_z.sent();
|
|
3407
|
+
_z.label = 25;
|
|
3408
|
+
case 25:
|
|
3409
|
+
_r = _q.next();
|
|
3410
|
+
return [3 /*break*/, 23];
|
|
3411
|
+
case 26: return [3 /*break*/, 29];
|
|
3412
|
+
case 27:
|
|
3413
|
+
e_6_1 = _z.sent();
|
|
3414
|
+
e_6 = { error: e_6_1 };
|
|
3415
|
+
return [3 /*break*/, 29];
|
|
3416
|
+
case 28:
|
|
3417
|
+
try {
|
|
3418
|
+
if (_r && !_r.done && (_y = _q.return)) _y.call(_q);
|
|
3419
|
+
}
|
|
3420
|
+
finally { if (e_6) throw e_6.error; }
|
|
3421
|
+
return [7 /*endfinally*/];
|
|
3422
|
+
case 29:
|
|
3423
|
+
if (template.blockScope) {
|
|
3424
|
+
scope.pop();
|
|
3425
|
+
}
|
|
3426
|
+
_z.label = 30;
|
|
3427
|
+
case 30: return [2 /*return*/];
|
|
3186
3428
|
}
|
|
3187
3429
|
});
|
|
3188
|
-
};
|
|
3189
|
-
Loader.prototype.dirname = function (path) {
|
|
3190
|
-
var fs = this.options.fs;
|
|
3191
|
-
assert(fs.dirname, '`fs.dirname` is required for relative reference');
|
|
3192
|
-
return fs.dirname(path);
|
|
3193
|
-
};
|
|
3194
|
-
Loader.prototype.lookupError = function (file, roots) {
|
|
3195
|
-
var err = new Error('ENOENT');
|
|
3196
|
-
err.message = "ENOENT: Failed to lookup \"".concat(file, "\" in \"").concat(roots, "\"");
|
|
3197
|
-
err.code = 'ENOENT';
|
|
3198
|
-
return err;
|
|
3199
|
-
};
|
|
3200
|
-
return Loader;
|
|
3201
|
-
}());
|
|
3202
|
-
|
|
3203
|
-
var Parser = /** @class */ (function () {
|
|
3204
|
-
function Parser(liquid) {
|
|
3205
|
-
this.liquid = liquid;
|
|
3206
|
-
this.cache = this.liquid.options.cache;
|
|
3207
|
-
this.fs = this.liquid.options.fs;
|
|
3208
|
-
this.parseFile = this.cache ? this._parseFileCached : this._parseFile;
|
|
3209
|
-
this.loader = new Loader(this.liquid.options);
|
|
3210
|
-
this.parseLimit = new Limiter('parse length', liquid.options.parseLimit);
|
|
3211
3430
|
}
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3431
|
+
var variables, globals, locals, rootScope, seen, templates_1, templates_1_1, template, e_2_1;
|
|
3432
|
+
var e_2, _a;
|
|
3433
|
+
return __generator(this, function (_b) {
|
|
3434
|
+
switch (_b.label) {
|
|
3435
|
+
case 0:
|
|
3436
|
+
variables = new VariableMap();
|
|
3437
|
+
globals = new VariableMap();
|
|
3438
|
+
locals = new VariableMap();
|
|
3439
|
+
rootScope = new DummyScope(new Set());
|
|
3440
|
+
seen = new Set();
|
|
3441
|
+
_b.label = 1;
|
|
3442
|
+
case 1:
|
|
3443
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
3444
|
+
templates_1 = __values(templates), templates_1_1 = templates_1.next();
|
|
3445
|
+
_b.label = 2;
|
|
3446
|
+
case 2:
|
|
3447
|
+
if (!!templates_1_1.done) return [3 /*break*/, 5];
|
|
3448
|
+
template = templates_1_1.value;
|
|
3449
|
+
return [4 /*yield*/, visit(template, rootScope)];
|
|
3450
|
+
case 3:
|
|
3451
|
+
_b.sent();
|
|
3452
|
+
_b.label = 4;
|
|
3453
|
+
case 4:
|
|
3454
|
+
templates_1_1 = templates_1.next();
|
|
3455
|
+
return [3 /*break*/, 2];
|
|
3456
|
+
case 5: return [3 /*break*/, 8];
|
|
3457
|
+
case 6:
|
|
3458
|
+
e_2_1 = _b.sent();
|
|
3459
|
+
e_2 = { error: e_2_1 };
|
|
3460
|
+
return [3 /*break*/, 8];
|
|
3461
|
+
case 7:
|
|
3462
|
+
try {
|
|
3463
|
+
if (templates_1_1 && !templates_1_1.done && (_a = templates_1.return)) _a.call(templates_1);
|
|
3464
|
+
}
|
|
3465
|
+
finally { if (e_2) throw e_2.error; }
|
|
3466
|
+
return [7 /*endfinally*/];
|
|
3467
|
+
case 8: return [2 /*return*/, {
|
|
3468
|
+
variables: variables.asObject(),
|
|
3469
|
+
globals: globals.asObject(),
|
|
3470
|
+
locals: locals.asObject()
|
|
3471
|
+
}];
|
|
3472
|
+
}
|
|
3473
|
+
});
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* Statically analyze a template and report variable usage.
|
|
3477
|
+
*/
|
|
3478
|
+
function analyze(template, options) {
|
|
3479
|
+
if (options === void 0) { options = {}; }
|
|
3480
|
+
var opts = __assign(__assign({}, defaultStaticAnalysisOptions), options);
|
|
3481
|
+
return toPromise(_analyze(template, opts.partials, false));
|
|
3482
|
+
}
|
|
3483
|
+
/**
|
|
3484
|
+
* Statically analyze a template and report variable usage.
|
|
3485
|
+
*/
|
|
3486
|
+
function analyzeSync(template, options) {
|
|
3487
|
+
if (options === void 0) { options = {}; }
|
|
3488
|
+
var opts = __assign(__assign({}, defaultStaticAnalysisOptions), options);
|
|
3489
|
+
return toValueSync(_analyze(template, opts.partials, true));
|
|
3490
|
+
}
|
|
3491
|
+
/**
|
|
3492
|
+
* A stack to manage scopes while traversing templates during static analysis.
|
|
3493
|
+
*/
|
|
3494
|
+
var DummyScope = /** @class */ (function () {
|
|
3495
|
+
function DummyScope(globals) {
|
|
3496
|
+
this.stack = [{ names: globals, aliases: new Map() }];
|
|
3497
|
+
}
|
|
3498
|
+
/** Return true if `name` is in scope. */
|
|
3499
|
+
DummyScope.prototype.has = function (name) {
|
|
3500
|
+
var e_11, _a;
|
|
3501
|
+
try {
|
|
3502
|
+
for (var _b = __values(this.stack), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3503
|
+
var scope = _c.value;
|
|
3504
|
+
if (scope.names.has(name)) {
|
|
3505
|
+
return true;
|
|
3506
|
+
}
|
|
3507
|
+
}
|
|
3508
|
+
}
|
|
3509
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
3510
|
+
finally {
|
|
3511
|
+
try {
|
|
3512
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3513
|
+
}
|
|
3514
|
+
finally { if (e_11) throw e_11.error; }
|
|
3515
|
+
}
|
|
3516
|
+
return false;
|
|
3517
|
+
};
|
|
3518
|
+
DummyScope.prototype.push = function (scope) {
|
|
3519
|
+
this.stack.push({ names: scope, aliases: new Map() });
|
|
3520
|
+
return this;
|
|
3521
|
+
};
|
|
3522
|
+
DummyScope.prototype.pop = function () {
|
|
3523
|
+
var _a;
|
|
3524
|
+
return (_a = this.stack.pop()) === null || _a === void 0 ? void 0 : _a.names;
|
|
3525
|
+
};
|
|
3526
|
+
// Add a name to the template scope.
|
|
3527
|
+
DummyScope.prototype.add = function (name) {
|
|
3528
|
+
this.stack[0].names.add(name);
|
|
3529
|
+
};
|
|
3530
|
+
/** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */
|
|
3531
|
+
DummyScope.prototype.alias = function (variable) {
|
|
3532
|
+
var root = variable.segments[0];
|
|
3533
|
+
if (!isString(root))
|
|
3534
|
+
return undefined;
|
|
3535
|
+
var alias = this.getAlias(root);
|
|
3536
|
+
if (alias === undefined)
|
|
3537
|
+
return undefined;
|
|
3538
|
+
return new Variable(__spreadArray(__spreadArray([], __read(alias), false), __read(variable.segments.slice(1)), false), variable.location);
|
|
3539
|
+
};
|
|
3540
|
+
// TODO: `from` could be a path with multiple segments, like `include.x`.
|
|
3541
|
+
DummyScope.prototype.setAlias = function (from, to) {
|
|
3542
|
+
this.stack[this.stack.length - 1].aliases.set(from, to);
|
|
3543
|
+
};
|
|
3544
|
+
DummyScope.prototype.deleteAlias = function (name) {
|
|
3545
|
+
this.stack[this.stack.length - 1].aliases.delete(name);
|
|
3546
|
+
};
|
|
3547
|
+
DummyScope.prototype.getAlias = function (name) {
|
|
3548
|
+
var e_12, _a;
|
|
3549
|
+
try {
|
|
3550
|
+
for (var _b = __values(this.stack), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3551
|
+
var scope = _c.value;
|
|
3552
|
+
if (scope.aliases.has(name)) {
|
|
3553
|
+
return scope.aliases.get(name);
|
|
3554
|
+
}
|
|
3555
|
+
// If a scope has defined `name`, then it masks aliases in parent scopes.
|
|
3556
|
+
if (scope.names.has(name)) {
|
|
3557
|
+
return undefined;
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
3562
|
+
finally {
|
|
3563
|
+
try {
|
|
3564
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3565
|
+
}
|
|
3566
|
+
finally { if (e_12) throw e_12.error; }
|
|
3567
|
+
}
|
|
3568
|
+
return undefined;
|
|
3569
|
+
};
|
|
3570
|
+
return DummyScope;
|
|
3571
|
+
}());
|
|
3572
|
+
function extractVariables(value) {
|
|
3573
|
+
return __generator(this, function (_a) {
|
|
3574
|
+
switch (_a.label) {
|
|
3575
|
+
case 0:
|
|
3576
|
+
if (!isValueToken(value)) return [3 /*break*/, 2];
|
|
3577
|
+
return [5 /*yield**/, __values(extractValueTokenVariables(value))];
|
|
3578
|
+
case 1:
|
|
3579
|
+
_a.sent();
|
|
3580
|
+
return [3 /*break*/, 4];
|
|
3581
|
+
case 2:
|
|
3582
|
+
if (!(value instanceof Value)) return [3 /*break*/, 4];
|
|
3583
|
+
return [5 /*yield**/, __values(extractFilteredValueVariables(value))];
|
|
3584
|
+
case 3:
|
|
3585
|
+
_a.sent();
|
|
3586
|
+
_a.label = 4;
|
|
3587
|
+
case 4: return [2 /*return*/];
|
|
3588
|
+
}
|
|
3589
|
+
});
|
|
3590
|
+
}
|
|
3591
|
+
function extractFilteredValueVariables(value) {
|
|
3592
|
+
var _a, _b, token, e_13_1, _c, _d, filter, _e, _f, arg, e_14_1, e_15_1;
|
|
3593
|
+
var e_13, _g, e_15, _h, e_14, _j;
|
|
3594
|
+
return __generator(this, function (_k) {
|
|
3595
|
+
switch (_k.label) {
|
|
3596
|
+
case 0:
|
|
3597
|
+
_k.trys.push([0, 5, 6, 7]);
|
|
3598
|
+
_a = __values(value.initial.postfix), _b = _a.next();
|
|
3599
|
+
_k.label = 1;
|
|
3600
|
+
case 1:
|
|
3601
|
+
if (!!_b.done) return [3 /*break*/, 4];
|
|
3602
|
+
token = _b.value;
|
|
3603
|
+
if (!isValueToken(token)) return [3 /*break*/, 3];
|
|
3604
|
+
return [5 /*yield**/, __values(extractValueTokenVariables(token))];
|
|
3605
|
+
case 2:
|
|
3606
|
+
_k.sent();
|
|
3607
|
+
_k.label = 3;
|
|
3608
|
+
case 3:
|
|
3609
|
+
_b = _a.next();
|
|
3610
|
+
return [3 /*break*/, 1];
|
|
3611
|
+
case 4: return [3 /*break*/, 7];
|
|
3612
|
+
case 5:
|
|
3613
|
+
e_13_1 = _k.sent();
|
|
3614
|
+
e_13 = { error: e_13_1 };
|
|
3615
|
+
return [3 /*break*/, 7];
|
|
3616
|
+
case 6:
|
|
3617
|
+
try {
|
|
3618
|
+
if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
|
|
3619
|
+
}
|
|
3620
|
+
finally { if (e_13) throw e_13.error; }
|
|
3621
|
+
return [7 /*endfinally*/];
|
|
3622
|
+
case 7:
|
|
3623
|
+
_k.trys.push([7, 20, 21, 22]);
|
|
3624
|
+
_c = __values(value.filters), _d = _c.next();
|
|
3625
|
+
_k.label = 8;
|
|
3626
|
+
case 8:
|
|
3627
|
+
if (!!_d.done) return [3 /*break*/, 19];
|
|
3628
|
+
filter = _d.value;
|
|
3629
|
+
_k.label = 9;
|
|
3630
|
+
case 9:
|
|
3631
|
+
_k.trys.push([9, 16, 17, 18]);
|
|
3632
|
+
_e = (e_14 = void 0, __values(filter.args)), _f = _e.next();
|
|
3633
|
+
_k.label = 10;
|
|
3634
|
+
case 10:
|
|
3635
|
+
if (!!_f.done) return [3 /*break*/, 15];
|
|
3636
|
+
arg = _f.value;
|
|
3637
|
+
if (!(isKeyValuePair(arg) && arg[1])) return [3 /*break*/, 12];
|
|
3638
|
+
return [5 /*yield**/, __values(extractValueTokenVariables(arg[1]))];
|
|
3639
|
+
case 11:
|
|
3640
|
+
_k.sent();
|
|
3641
|
+
return [3 /*break*/, 14];
|
|
3642
|
+
case 12:
|
|
3643
|
+
if (!isValueToken(arg)) return [3 /*break*/, 14];
|
|
3644
|
+
return [5 /*yield**/, __values(extractValueTokenVariables(arg))];
|
|
3645
|
+
case 13:
|
|
3646
|
+
_k.sent();
|
|
3647
|
+
_k.label = 14;
|
|
3648
|
+
case 14:
|
|
3649
|
+
_f = _e.next();
|
|
3650
|
+
return [3 /*break*/, 10];
|
|
3651
|
+
case 15: return [3 /*break*/, 18];
|
|
3652
|
+
case 16:
|
|
3653
|
+
e_14_1 = _k.sent();
|
|
3654
|
+
e_14 = { error: e_14_1 };
|
|
3655
|
+
return [3 /*break*/, 18];
|
|
3656
|
+
case 17:
|
|
3657
|
+
try {
|
|
3658
|
+
if (_f && !_f.done && (_j = _e.return)) _j.call(_e);
|
|
3659
|
+
}
|
|
3660
|
+
finally { if (e_14) throw e_14.error; }
|
|
3661
|
+
return [7 /*endfinally*/];
|
|
3662
|
+
case 18:
|
|
3663
|
+
_d = _c.next();
|
|
3664
|
+
return [3 /*break*/, 8];
|
|
3665
|
+
case 19: return [3 /*break*/, 22];
|
|
3666
|
+
case 20:
|
|
3667
|
+
e_15_1 = _k.sent();
|
|
3668
|
+
e_15 = { error: e_15_1 };
|
|
3669
|
+
return [3 /*break*/, 22];
|
|
3670
|
+
case 21:
|
|
3671
|
+
try {
|
|
3672
|
+
if (_d && !_d.done && (_h = _c.return)) _h.call(_c);
|
|
3673
|
+
}
|
|
3674
|
+
finally { if (e_15) throw e_15.error; }
|
|
3675
|
+
return [7 /*endfinally*/];
|
|
3676
|
+
case 22: return [2 /*return*/];
|
|
3677
|
+
}
|
|
3678
|
+
});
|
|
3679
|
+
}
|
|
3680
|
+
function extractValueTokenVariables(token) {
|
|
3681
|
+
return __generator(this, function (_a) {
|
|
3682
|
+
switch (_a.label) {
|
|
3683
|
+
case 0:
|
|
3684
|
+
if (!isRangeToken(token)) return [3 /*break*/, 3];
|
|
3685
|
+
return [5 /*yield**/, __values(extractValueTokenVariables(token.lhs))];
|
|
3686
|
+
case 1:
|
|
3687
|
+
_a.sent();
|
|
3688
|
+
return [5 /*yield**/, __values(extractValueTokenVariables(token.rhs))];
|
|
3689
|
+
case 2:
|
|
3690
|
+
_a.sent();
|
|
3691
|
+
return [3 /*break*/, 5];
|
|
3692
|
+
case 3:
|
|
3693
|
+
if (!isPropertyAccessToken(token)) return [3 /*break*/, 5];
|
|
3694
|
+
return [4 /*yield*/, extractPropertyAccessVariable(token)];
|
|
3695
|
+
case 4:
|
|
3696
|
+
_a.sent();
|
|
3697
|
+
_a.label = 5;
|
|
3698
|
+
case 5: return [2 /*return*/];
|
|
3699
|
+
}
|
|
3700
|
+
});
|
|
3701
|
+
}
|
|
3702
|
+
function extractPropertyAccessVariable(token) {
|
|
3703
|
+
var e_16, _a;
|
|
3704
|
+
var segments = [];
|
|
3705
|
+
// token is not guaranteed to have `file` set. We'll try to get it from a prop if not.
|
|
3706
|
+
var file = token.file;
|
|
3707
|
+
// Here we're flattening the first segment of a path if it is a nested path.
|
|
3708
|
+
var root = token.props[0];
|
|
3709
|
+
file = file || root.file;
|
|
3710
|
+
if (isQuotedToken(root) || isNumberToken(root) || isWordToken(root)) {
|
|
3711
|
+
segments.push(root.content);
|
|
3712
|
+
}
|
|
3713
|
+
else if (isPropertyAccessToken(root)) {
|
|
3714
|
+
// Flatten paths that start with a nested path.
|
|
3715
|
+
segments.push.apply(segments, __spreadArray([], __read(extractPropertyAccessVariable(root).segments), false));
|
|
3716
|
+
}
|
|
3717
|
+
try {
|
|
3718
|
+
for (var _b = __values(token.props.slice(1)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3719
|
+
var prop = _c.value;
|
|
3720
|
+
file = file || prop.file;
|
|
3721
|
+
if (isQuotedToken(prop) || isNumberToken(prop) || isWordToken(prop)) {
|
|
3722
|
+
segments.push(prop.content);
|
|
3723
|
+
}
|
|
3724
|
+
else if (isPropertyAccessToken(prop)) {
|
|
3725
|
+
segments.push(extractPropertyAccessVariable(prop));
|
|
3726
|
+
}
|
|
3727
|
+
}
|
|
3728
|
+
}
|
|
3729
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
3730
|
+
finally {
|
|
3731
|
+
try {
|
|
3732
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3733
|
+
}
|
|
3734
|
+
finally { if (e_16) throw e_16.error; }
|
|
3735
|
+
}
|
|
3736
|
+
var _d = __read(token.getPosition(), 2), row = _d[0], col = _d[1];
|
|
3737
|
+
return new Variable(segments, {
|
|
3738
|
+
row: row,
|
|
3739
|
+
col: col,
|
|
3740
|
+
file: file
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
// This is used to detect segments that can be represented with dot notation
|
|
3744
|
+
// when creating a string representation of VariableSegments.
|
|
3745
|
+
var RE_PROPERTY = /^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;
|
|
3746
|
+
/**
|
|
3747
|
+
* Return a string representation of segments using dot notation where possible.
|
|
3748
|
+
* @param segments - The property names and array indices that make up a path to a variable.
|
|
3749
|
+
* @param bracketedRoot - If false (the default), don't surround the root segment with square brackets.
|
|
3750
|
+
*/
|
|
3751
|
+
function segmentsString(segments, bracketedRoot) {
|
|
3752
|
+
var e_17, _a;
|
|
3753
|
+
if (bracketedRoot === void 0) { bracketedRoot = false; }
|
|
3754
|
+
var buf = [];
|
|
3755
|
+
var root = segments[0];
|
|
3756
|
+
if (isString(root)) {
|
|
3757
|
+
if (!bracketedRoot || root.match(RE_PROPERTY)) {
|
|
3758
|
+
buf.push("".concat(root));
|
|
3759
|
+
}
|
|
3760
|
+
else {
|
|
3761
|
+
buf.push("['".concat(root, "']"));
|
|
3762
|
+
}
|
|
3763
|
+
}
|
|
3764
|
+
try {
|
|
3765
|
+
for (var _b = __values(segments.slice(1)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3766
|
+
var segment = _c.value;
|
|
3767
|
+
if (segment instanceof Variable) {
|
|
3768
|
+
buf.push("[".concat(segmentsString(segment.segments), "]"));
|
|
3769
|
+
}
|
|
3770
|
+
else if (isString(segment)) {
|
|
3771
|
+
if (segment.match(RE_PROPERTY)) {
|
|
3772
|
+
buf.push(".".concat(segment));
|
|
3773
|
+
}
|
|
3774
|
+
else {
|
|
3775
|
+
buf.push("['".concat(segment, "']"));
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
else {
|
|
3779
|
+
buf.push("[".concat(segment, "]"));
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
3784
|
+
finally {
|
|
3785
|
+
try {
|
|
3786
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3787
|
+
}
|
|
3788
|
+
finally { if (e_17) throw e_17.error; }
|
|
3789
|
+
}
|
|
3790
|
+
return buf.join('');
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
var LookupType;
|
|
3794
|
+
(function (LookupType) {
|
|
3795
|
+
LookupType["Partials"] = "partials";
|
|
3796
|
+
LookupType["Layouts"] = "layouts";
|
|
3797
|
+
LookupType["Root"] = "root";
|
|
3798
|
+
})(LookupType || (LookupType = {}));
|
|
3799
|
+
var Loader = /** @class */ (function () {
|
|
3800
|
+
function Loader(options) {
|
|
3801
|
+
this.options = options;
|
|
3802
|
+
if (options.relativeReference) {
|
|
3803
|
+
var sep = options.fs.sep;
|
|
3804
|
+
assert(sep, '`fs.sep` is required for relative reference');
|
|
3805
|
+
var rRelativePath_1 = new RegExp(['.' + sep, '..' + sep, './', '../'].map(function (prefix) { return escapeRegex(prefix); }).join('|'));
|
|
3806
|
+
this.shouldLoadRelative = function (referencedFile) { return rRelativePath_1.test(referencedFile); };
|
|
3807
|
+
}
|
|
3808
|
+
else {
|
|
3809
|
+
this.shouldLoadRelative = function (_referencedFile) { return false; };
|
|
3810
|
+
}
|
|
3811
|
+
this.contains = this.options.fs.contains || (function () { return true; });
|
|
3812
|
+
}
|
|
3813
|
+
Loader.prototype.lookup = function (file, type, sync, currentFile) {
|
|
3814
|
+
var fs, dirs, _a, _b, filepath, _c, e_1_1;
|
|
3815
|
+
var e_1, _d;
|
|
3816
|
+
return __generator(this, function (_e) {
|
|
3817
|
+
switch (_e.label) {
|
|
3818
|
+
case 0:
|
|
3819
|
+
fs = this.options.fs;
|
|
3820
|
+
dirs = this.options[type];
|
|
3821
|
+
_e.label = 1;
|
|
3822
|
+
case 1:
|
|
3823
|
+
_e.trys.push([1, 8, 9, 10]);
|
|
3824
|
+
_a = __values(this.candidates(file, dirs, currentFile, type !== LookupType.Root)), _b = _a.next();
|
|
3825
|
+
_e.label = 2;
|
|
3826
|
+
case 2:
|
|
3827
|
+
if (!!_b.done) return [3 /*break*/, 7];
|
|
3828
|
+
filepath = _b.value;
|
|
3829
|
+
if (!sync) return [3 /*break*/, 3];
|
|
3830
|
+
_c = fs.existsSync(filepath);
|
|
3831
|
+
return [3 /*break*/, 5];
|
|
3832
|
+
case 3: return [4 /*yield*/, fs.exists(filepath)];
|
|
3833
|
+
case 4:
|
|
3834
|
+
_c = _e.sent();
|
|
3835
|
+
_e.label = 5;
|
|
3836
|
+
case 5:
|
|
3837
|
+
if (_c)
|
|
3838
|
+
return [2 /*return*/, filepath];
|
|
3839
|
+
_e.label = 6;
|
|
3840
|
+
case 6:
|
|
3841
|
+
_b = _a.next();
|
|
3842
|
+
return [3 /*break*/, 2];
|
|
3843
|
+
case 7: return [3 /*break*/, 10];
|
|
3844
|
+
case 8:
|
|
3845
|
+
e_1_1 = _e.sent();
|
|
3846
|
+
e_1 = { error: e_1_1 };
|
|
3847
|
+
return [3 /*break*/, 10];
|
|
3848
|
+
case 9:
|
|
3849
|
+
try {
|
|
3850
|
+
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
3851
|
+
}
|
|
3852
|
+
finally { if (e_1) throw e_1.error; }
|
|
3853
|
+
return [7 /*endfinally*/];
|
|
3854
|
+
case 10: throw this.lookupError(file, dirs);
|
|
3855
|
+
}
|
|
3856
|
+
});
|
|
3857
|
+
};
|
|
3858
|
+
Loader.prototype.candidates = function (file, dirs, currentFile, enforceRoot) {
|
|
3859
|
+
var _a, fs, extname, referenced, dirs_1, dirs_1_1, dir, e_2_1, dirs_2, dirs_2_1, dir, referenced, e_3_1, filepath;
|
|
3860
|
+
var e_2, _b, e_3, _c;
|
|
3861
|
+
return __generator(this, function (_d) {
|
|
3862
|
+
switch (_d.label) {
|
|
3863
|
+
case 0:
|
|
3864
|
+
_a = this.options, fs = _a.fs, extname = _a.extname;
|
|
3865
|
+
if (!(this.shouldLoadRelative(file) && currentFile)) return [3 /*break*/, 8];
|
|
3866
|
+
referenced = fs.resolve(this.dirname(currentFile), file, extname);
|
|
3867
|
+
_d.label = 1;
|
|
3868
|
+
case 1:
|
|
3869
|
+
_d.trys.push([1, 6, 7, 8]);
|
|
3870
|
+
dirs_1 = __values(dirs), dirs_1_1 = dirs_1.next();
|
|
3871
|
+
_d.label = 2;
|
|
3872
|
+
case 2:
|
|
3873
|
+
if (!!dirs_1_1.done) return [3 /*break*/, 5];
|
|
3874
|
+
dir = dirs_1_1.value;
|
|
3875
|
+
if (!(!enforceRoot || this.contains(dir, referenced))) return [3 /*break*/, 4];
|
|
3876
|
+
// the relatively referenced file is within one of root dirs
|
|
3877
|
+
return [4 /*yield*/, referenced];
|
|
3878
|
+
case 3:
|
|
3879
|
+
// the relatively referenced file is within one of root dirs
|
|
3880
|
+
_d.sent();
|
|
3881
|
+
return [3 /*break*/, 5];
|
|
3882
|
+
case 4:
|
|
3883
|
+
dirs_1_1 = dirs_1.next();
|
|
3884
|
+
return [3 /*break*/, 2];
|
|
3885
|
+
case 5: return [3 /*break*/, 8];
|
|
3886
|
+
case 6:
|
|
3887
|
+
e_2_1 = _d.sent();
|
|
3888
|
+
e_2 = { error: e_2_1 };
|
|
3889
|
+
return [3 /*break*/, 8];
|
|
3890
|
+
case 7:
|
|
3891
|
+
try {
|
|
3892
|
+
if (dirs_1_1 && !dirs_1_1.done && (_b = dirs_1.return)) _b.call(dirs_1);
|
|
3893
|
+
}
|
|
3894
|
+
finally { if (e_2) throw e_2.error; }
|
|
3895
|
+
return [7 /*endfinally*/];
|
|
3896
|
+
case 8:
|
|
3897
|
+
_d.trys.push([8, 13, 14, 15]);
|
|
3898
|
+
dirs_2 = __values(dirs), dirs_2_1 = dirs_2.next();
|
|
3899
|
+
_d.label = 9;
|
|
3900
|
+
case 9:
|
|
3901
|
+
if (!!dirs_2_1.done) return [3 /*break*/, 12];
|
|
3902
|
+
dir = dirs_2_1.value;
|
|
3903
|
+
referenced = fs.resolve(dir, file, extname);
|
|
3904
|
+
if (!(!enforceRoot || this.contains(dir, referenced))) return [3 /*break*/, 11];
|
|
3905
|
+
return [4 /*yield*/, referenced];
|
|
3906
|
+
case 10:
|
|
3907
|
+
_d.sent();
|
|
3908
|
+
_d.label = 11;
|
|
3909
|
+
case 11:
|
|
3910
|
+
dirs_2_1 = dirs_2.next();
|
|
3911
|
+
return [3 /*break*/, 9];
|
|
3912
|
+
case 12: return [3 /*break*/, 15];
|
|
3913
|
+
case 13:
|
|
3914
|
+
e_3_1 = _d.sent();
|
|
3915
|
+
e_3 = { error: e_3_1 };
|
|
3916
|
+
return [3 /*break*/, 15];
|
|
3917
|
+
case 14:
|
|
3918
|
+
try {
|
|
3919
|
+
if (dirs_2_1 && !dirs_2_1.done && (_c = dirs_2.return)) _c.call(dirs_2);
|
|
3920
|
+
}
|
|
3921
|
+
finally { if (e_3) throw e_3.error; }
|
|
3922
|
+
return [7 /*endfinally*/];
|
|
3923
|
+
case 15:
|
|
3924
|
+
if (!(fs.fallback !== undefined)) return [3 /*break*/, 17];
|
|
3925
|
+
filepath = fs.fallback(file);
|
|
3926
|
+
if (!(filepath !== undefined)) return [3 /*break*/, 17];
|
|
3927
|
+
return [4 /*yield*/, filepath];
|
|
3928
|
+
case 16:
|
|
3929
|
+
_d.sent();
|
|
3930
|
+
_d.label = 17;
|
|
3931
|
+
case 17: return [2 /*return*/];
|
|
3932
|
+
}
|
|
3933
|
+
});
|
|
3934
|
+
};
|
|
3935
|
+
Loader.prototype.dirname = function (path) {
|
|
3936
|
+
var fs = this.options.fs;
|
|
3937
|
+
assert(fs.dirname, '`fs.dirname` is required for relative reference');
|
|
3938
|
+
return fs.dirname(path);
|
|
3939
|
+
};
|
|
3940
|
+
Loader.prototype.lookupError = function (file, roots) {
|
|
3941
|
+
var err = new Error('ENOENT');
|
|
3942
|
+
err.message = "ENOENT: Failed to lookup \"".concat(file, "\" in \"").concat(roots, "\"");
|
|
3943
|
+
err.code = 'ENOENT';
|
|
3944
|
+
return err;
|
|
3945
|
+
};
|
|
3946
|
+
return Loader;
|
|
3947
|
+
}());
|
|
3948
|
+
|
|
3949
|
+
var Parser = /** @class */ (function () {
|
|
3950
|
+
function Parser(liquid) {
|
|
3951
|
+
this.liquid = liquid;
|
|
3952
|
+
this.cache = this.liquid.options.cache;
|
|
3953
|
+
this.fs = this.liquid.options.fs;
|
|
3954
|
+
this.parseFile = this.cache ? this._parseFileCached : this._parseFile;
|
|
3955
|
+
this.loader = new Loader(this.liquid.options);
|
|
3956
|
+
this.parseLimit = new Limiter('parse length', liquid.options.parseLimit);
|
|
3957
|
+
}
|
|
3958
|
+
Parser.prototype.parse = function (html, filepath) {
|
|
3959
|
+
html = String(html);
|
|
3960
|
+
this.parseLimit.use(html.length);
|
|
3961
|
+
var tokenizer = new Tokenizer(html, this.liquid.options.operators, filepath);
|
|
3962
|
+
var tokens = tokenizer.readTopLevelTokens(this.liquid.options);
|
|
3963
|
+
return this.parseTokens(tokens);
|
|
3218
3964
|
};
|
|
3219
3965
|
Parser.prototype.parseTokens = function (tokens) {
|
|
3220
3966
|
var token;
|
|
@@ -3368,6 +4114,10 @@
|
|
|
3368
4114
|
function isRangeToken(val) {
|
|
3369
4115
|
return getKind(val) === exports.TokenKind.Range;
|
|
3370
4116
|
}
|
|
4117
|
+
function isValueToken(val) {
|
|
4118
|
+
// valueTokenBitMask = TokenKind.Number | TokenKind.Literal | TokenKind.Quoted | TokenKind.PropertyAccess | TokenKind.Range
|
|
4119
|
+
return (getKind(val) & 1667) > 0;
|
|
4120
|
+
}
|
|
3371
4121
|
function getKind(val) {
|
|
3372
4122
|
return val ? val.kind : -1;
|
|
3373
4123
|
}
|
|
@@ -3384,7 +4134,8 @@
|
|
|
3384
4134
|
isNumberToken: isNumberToken,
|
|
3385
4135
|
isPropertyAccessToken: isPropertyAccessToken,
|
|
3386
4136
|
isWordToken: isWordToken,
|
|
3387
|
-
isRangeToken: isRangeToken
|
|
4137
|
+
isRangeToken: isRangeToken,
|
|
4138
|
+
isValueToken: isValueToken
|
|
3388
4139
|
});
|
|
3389
4140
|
|
|
3390
4141
|
var Context = /** @class */ (function () {
|
|
@@ -3400,6 +4151,8 @@
|
|
|
3400
4151
|
*/
|
|
3401
4152
|
this.scopes = [{}];
|
|
3402
4153
|
this.registers = {};
|
|
4154
|
+
this.breakCalled = false;
|
|
4155
|
+
this.continueCalled = false;
|
|
3403
4156
|
this.sync = !!renderOptions.sync;
|
|
3404
4157
|
this.opts = opts;
|
|
3405
4158
|
this.globals = (_c = renderOptions.globals) !== null && _c !== void 0 ? _c : opts.globals;
|
|
@@ -3447,9 +4200,11 @@
|
|
|
3447
4200
|
return __generator(this, function (_a) {
|
|
3448
4201
|
switch (_a.label) {
|
|
3449
4202
|
case 0:
|
|
3450
|
-
scope = this.findScope(paths[0])
|
|
4203
|
+
scope = this.findScope(paths[0]) // first prop should always be a string
|
|
4204
|
+
;
|
|
3451
4205
|
return [4 /*yield*/, this._getFromScope(scope, paths)];
|
|
3452
|
-
case 1:
|
|
4206
|
+
case 1: // first prop should always be a string
|
|
4207
|
+
return [2 /*return*/, _a.sent()];
|
|
3453
4208
|
}
|
|
3454
4209
|
});
|
|
3455
4210
|
};
|
|
@@ -3519,6 +4274,7 @@
|
|
|
3519
4274
|
}());
|
|
3520
4275
|
function readProperty(obj, key, ownPropertyOnly) {
|
|
3521
4276
|
obj = toLiquid(obj);
|
|
4277
|
+
key = toValue(key);
|
|
3522
4278
|
if (isNil(obj))
|
|
3523
4279
|
return obj;
|
|
3524
4280
|
if (isArray(obj) && key < 0)
|
|
@@ -3672,8 +4428,8 @@
|
|
|
3672
4428
|
this.context.memoryLimit.use(complexity);
|
|
3673
4429
|
return array.join(sep);
|
|
3674
4430
|
});
|
|
3675
|
-
var last$1 = argumentsToValue(function (v) { return
|
|
3676
|
-
var first = argumentsToValue(function (v) { return
|
|
4431
|
+
var last$1 = argumentsToValue(function (v) { return isArrayLike(v) ? last(v) : ''; });
|
|
4432
|
+
var first = argumentsToValue(function (v) { return isArrayLike(v) ? v[0] : ''; });
|
|
3677
4433
|
var reverse = argumentsToValue(function (v) {
|
|
3678
4434
|
var array = toArray(v);
|
|
3679
4435
|
this.context.memoryLimit.use(array.length);
|
|
@@ -3876,7 +4632,7 @@
|
|
|
3876
4632
|
return v.slice(begin, begin + length);
|
|
3877
4633
|
}
|
|
3878
4634
|
function where(arr, property, expected) {
|
|
3879
|
-
var values, token, arr_1, arr_1_1, item, _a, _b, e_4_1;
|
|
4635
|
+
var values, token, arr_1, arr_1_1, item, _a, _b, e_4_1, matcher;
|
|
3880
4636
|
var e_4, _c;
|
|
3881
4637
|
var _this = this;
|
|
3882
4638
|
return __generator(this, function (_d) {
|
|
@@ -3913,11 +4669,15 @@
|
|
|
3913
4669
|
}
|
|
3914
4670
|
finally { if (e_4) throw e_4.error; }
|
|
3915
4671
|
return [7 /*endfinally*/];
|
|
3916
|
-
case 8:
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
return equals(
|
|
3920
|
-
|
|
4672
|
+
case 8:
|
|
4673
|
+
matcher = this.context.opts.jekyllWhere
|
|
4674
|
+
? function (v) { return EmptyDrop.is(expected) ? equals(v, expected) : (isArray(v) ? arrayIncludes(v, expected) : equals(v, expected)); }
|
|
4675
|
+
: function (v) { return equals(v, expected); };
|
|
4676
|
+
return [2 /*return*/, arr.filter(function (_, i) {
|
|
4677
|
+
if (expected === undefined)
|
|
4678
|
+
return isTruthy(values[i], _this.context);
|
|
4679
|
+
return matcher(values[i]);
|
|
4680
|
+
})];
|
|
3921
4681
|
}
|
|
3922
4682
|
});
|
|
3923
4683
|
}
|
|
@@ -3970,7 +4730,7 @@
|
|
|
3970
4730
|
switch (_b.label) {
|
|
3971
4731
|
case 0:
|
|
3972
4732
|
map = new Map();
|
|
3973
|
-
arr =
|
|
4733
|
+
arr = toEnumerable(arr);
|
|
3974
4734
|
token = new Tokenizer(stringify(property)).readScopeValue();
|
|
3975
4735
|
this.context.memoryLimit.use(arr.length);
|
|
3976
4736
|
_b.label = 1;
|
|
@@ -4017,7 +4777,7 @@
|
|
|
4017
4777
|
case 0:
|
|
4018
4778
|
map = new Map();
|
|
4019
4779
|
keyTemplate = new Value(stringify(exp), this.liquid);
|
|
4020
|
-
arr =
|
|
4780
|
+
arr = toEnumerable(arr);
|
|
4021
4781
|
this.context.memoryLimit.use(arr.length);
|
|
4022
4782
|
_c.label = 1;
|
|
4023
4783
|
case 1:
|
|
@@ -4467,7 +5227,8 @@
|
|
|
4467
5227
|
__extends(default_1, _super);
|
|
4468
5228
|
function default_1(token, remainTokens, liquid) {
|
|
4469
5229
|
var _this = _super.call(this, token, remainTokens, liquid) || this;
|
|
4470
|
-
_this.
|
|
5230
|
+
_this.identifier = _this.tokenizer.readIdentifier();
|
|
5231
|
+
_this.key = _this.identifier.content;
|
|
4471
5232
|
_this.tokenizer.assert(_this.key, 'expected variable name');
|
|
4472
5233
|
_this.tokenizer.skipBlank();
|
|
4473
5234
|
_this.tokenizer.assert(_this.tokenizer.peek() === '=', 'expected "="');
|
|
@@ -4489,6 +5250,26 @@
|
|
|
4489
5250
|
}
|
|
4490
5251
|
});
|
|
4491
5252
|
};
|
|
5253
|
+
default_1.prototype.arguments = function () {
|
|
5254
|
+
return __generator(this, function (_a) {
|
|
5255
|
+
switch (_a.label) {
|
|
5256
|
+
case 0: return [4 /*yield*/, this.value];
|
|
5257
|
+
case 1:
|
|
5258
|
+
_a.sent();
|
|
5259
|
+
return [2 /*return*/];
|
|
5260
|
+
}
|
|
5261
|
+
});
|
|
5262
|
+
};
|
|
5263
|
+
default_1.prototype.localScope = function () {
|
|
5264
|
+
return __generator(this, function (_a) {
|
|
5265
|
+
switch (_a.label) {
|
|
5266
|
+
case 0: return [4 /*yield*/, this.identifier];
|
|
5267
|
+
case 1:
|
|
5268
|
+
_a.sent();
|
|
5269
|
+
return [2 /*return*/];
|
|
5270
|
+
}
|
|
5271
|
+
});
|
|
5272
|
+
};
|
|
4492
5273
|
return default_1;
|
|
4493
5274
|
}(Tag));
|
|
4494
5275
|
|
|
@@ -4505,7 +5286,7 @@
|
|
|
4505
5286
|
}
|
|
4506
5287
|
_this.variable = variable.content;
|
|
4507
5288
|
_this.collection = collection;
|
|
4508
|
-
_this.hash = new Hash(_this.tokenizer
|
|
5289
|
+
_this.hash = new Hash(_this.tokenizer, liquid.options.keyValueSeparator);
|
|
4509
5290
|
_this.templates = [];
|
|
4510
5291
|
_this.elseTemplates = [];
|
|
4511
5292
|
var p;
|
|
@@ -4563,14 +5344,12 @@
|
|
|
4563
5344
|
if (!!collection_1_1.done) return [3 /*break*/, 9];
|
|
4564
5345
|
item = collection_1_1.value;
|
|
4565
5346
|
scope[this.variable] = item;
|
|
5347
|
+
ctx.continueCalled = ctx.breakCalled = false;
|
|
4566
5348
|
return [4 /*yield*/, r.renderTemplates(this.templates, ctx, emitter)];
|
|
4567
5349
|
case 7:
|
|
4568
5350
|
_c.sent();
|
|
4569
|
-
if (
|
|
4570
|
-
emitter['break'] = false;
|
|
5351
|
+
if (ctx.breakCalled)
|
|
4571
5352
|
return [3 /*break*/, 9];
|
|
4572
|
-
}
|
|
4573
|
-
emitter['continue'] = false;
|
|
4574
5353
|
scope.forloop.next();
|
|
4575
5354
|
_c.label = 8;
|
|
4576
5355
|
case 8:
|
|
@@ -4588,11 +5367,64 @@
|
|
|
4588
5367
|
finally { if (e_1) throw e_1.error; }
|
|
4589
5368
|
return [7 /*endfinally*/];
|
|
4590
5369
|
case 12:
|
|
5370
|
+
ctx.continueCalled = ctx.breakCalled = false;
|
|
4591
5371
|
ctx.pop();
|
|
4592
5372
|
return [2 /*return*/];
|
|
4593
5373
|
}
|
|
4594
5374
|
});
|
|
4595
5375
|
};
|
|
5376
|
+
default_1.prototype.children = function () {
|
|
5377
|
+
var templates;
|
|
5378
|
+
return __generator(this, function (_a) {
|
|
5379
|
+
templates = this.templates.slice();
|
|
5380
|
+
if (this.elseTemplates) {
|
|
5381
|
+
templates.push.apply(templates, __spreadArray([], __read(this.elseTemplates), false));
|
|
5382
|
+
}
|
|
5383
|
+
return [2 /*return*/, templates];
|
|
5384
|
+
});
|
|
5385
|
+
};
|
|
5386
|
+
default_1.prototype.arguments = function () {
|
|
5387
|
+
var _a, _b, v, e_2_1;
|
|
5388
|
+
var e_2, _c;
|
|
5389
|
+
return __generator(this, function (_d) {
|
|
5390
|
+
switch (_d.label) {
|
|
5391
|
+
case 0: return [4 /*yield*/, this.collection];
|
|
5392
|
+
case 1:
|
|
5393
|
+
_d.sent();
|
|
5394
|
+
_d.label = 2;
|
|
5395
|
+
case 2:
|
|
5396
|
+
_d.trys.push([2, 7, 8, 9]);
|
|
5397
|
+
_a = __values(Object.values(this.hash.hash)), _b = _a.next();
|
|
5398
|
+
_d.label = 3;
|
|
5399
|
+
case 3:
|
|
5400
|
+
if (!!_b.done) return [3 /*break*/, 6];
|
|
5401
|
+
v = _b.value;
|
|
5402
|
+
if (!isValueToken(v)) return [3 /*break*/, 5];
|
|
5403
|
+
return [4 /*yield*/, v];
|
|
5404
|
+
case 4:
|
|
5405
|
+
_d.sent();
|
|
5406
|
+
_d.label = 5;
|
|
5407
|
+
case 5:
|
|
5408
|
+
_b = _a.next();
|
|
5409
|
+
return [3 /*break*/, 3];
|
|
5410
|
+
case 6: return [3 /*break*/, 9];
|
|
5411
|
+
case 7:
|
|
5412
|
+
e_2_1 = _d.sent();
|
|
5413
|
+
e_2 = { error: e_2_1 };
|
|
5414
|
+
return [3 /*break*/, 9];
|
|
5415
|
+
case 8:
|
|
5416
|
+
try {
|
|
5417
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
5418
|
+
}
|
|
5419
|
+
finally { if (e_2) throw e_2.error; }
|
|
5420
|
+
return [7 /*endfinally*/];
|
|
5421
|
+
case 9: return [2 /*return*/];
|
|
5422
|
+
}
|
|
5423
|
+
});
|
|
5424
|
+
};
|
|
5425
|
+
default_1.prototype.blockScope = function () {
|
|
5426
|
+
return [this.variable, 'forloop'];
|
|
5427
|
+
};
|
|
4596
5428
|
return default_1;
|
|
4597
5429
|
}(Tag));
|
|
4598
5430
|
function reversed(arr) {
|
|
@@ -4610,7 +5442,8 @@
|
|
|
4610
5442
|
function default_1(tagToken, remainTokens, liquid, parser) {
|
|
4611
5443
|
var _this = _super.call(this, tagToken, remainTokens, liquid) || this;
|
|
4612
5444
|
_this.templates = [];
|
|
4613
|
-
_this.
|
|
5445
|
+
_this.identifier = _this.readVariable();
|
|
5446
|
+
_this.variable = _this.identifier.content;
|
|
4614
5447
|
while (remainTokens.length) {
|
|
4615
5448
|
var token = remainTokens.shift();
|
|
4616
5449
|
if (isTagToken(token) && token.name === 'endcapture')
|
|
@@ -4619,6 +5452,15 @@
|
|
|
4619
5452
|
}
|
|
4620
5453
|
throw new Error("tag ".concat(tagToken.getText(), " not closed"));
|
|
4621
5454
|
}
|
|
5455
|
+
default_1.prototype.readVariable = function () {
|
|
5456
|
+
var ident = this.tokenizer.readIdentifier();
|
|
5457
|
+
if (ident.content)
|
|
5458
|
+
return ident;
|
|
5459
|
+
ident = this.tokenizer.readQuoted();
|
|
5460
|
+
if (ident)
|
|
5461
|
+
return ident;
|
|
5462
|
+
throw this.tokenizer.error('invalid capture name');
|
|
5463
|
+
};
|
|
4622
5464
|
default_1.prototype.render = function (ctx) {
|
|
4623
5465
|
var r, html;
|
|
4624
5466
|
return __generator(this, function (_a) {
|
|
@@ -4633,14 +5475,20 @@
|
|
|
4633
5475
|
}
|
|
4634
5476
|
});
|
|
4635
5477
|
};
|
|
4636
|
-
default_1.prototype.
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
5478
|
+
default_1.prototype.children = function () {
|
|
5479
|
+
return __generator(this, function (_a) {
|
|
5480
|
+
return [2 /*return*/, this.templates];
|
|
5481
|
+
});
|
|
5482
|
+
};
|
|
5483
|
+
default_1.prototype.localScope = function () {
|
|
5484
|
+
return __generator(this, function (_a) {
|
|
5485
|
+
switch (_a.label) {
|
|
5486
|
+
case 0: return [4 /*yield*/, this.identifier];
|
|
5487
|
+
case 1:
|
|
5488
|
+
_a.sent();
|
|
5489
|
+
return [2 /*return*/];
|
|
5490
|
+
}
|
|
5491
|
+
});
|
|
4644
5492
|
};
|
|
4645
5493
|
return default_1;
|
|
4646
5494
|
}(Tag));
|
|
@@ -4768,6 +5616,29 @@
|
|
|
4768
5616
|
}
|
|
4769
5617
|
});
|
|
4770
5618
|
};
|
|
5619
|
+
default_1.prototype.arguments = function () {
|
|
5620
|
+
return __generator(this, function (_a) {
|
|
5621
|
+
switch (_a.label) {
|
|
5622
|
+
case 0: return [4 /*yield*/, this.value];
|
|
5623
|
+
case 1:
|
|
5624
|
+
_a.sent();
|
|
5625
|
+
return [5 /*yield**/, __values(this.branches.flatMap(function (b) { return b.values; }))];
|
|
5626
|
+
case 2:
|
|
5627
|
+
_a.sent();
|
|
5628
|
+
return [2 /*return*/];
|
|
5629
|
+
}
|
|
5630
|
+
});
|
|
5631
|
+
};
|
|
5632
|
+
default_1.prototype.children = function () {
|
|
5633
|
+
var templates;
|
|
5634
|
+
return __generator(this, function (_a) {
|
|
5635
|
+
templates = this.branches.flatMap(function (b) { return b.templates; });
|
|
5636
|
+
if (this.elseTemplates) {
|
|
5637
|
+
templates.push.apply(templates, __spreadArray([], __read(this.elseTemplates), false));
|
|
5638
|
+
}
|
|
5639
|
+
return [2 /*return*/, templates];
|
|
5640
|
+
});
|
|
5641
|
+
};
|
|
4771
5642
|
return default_1;
|
|
4772
5643
|
}(Tag));
|
|
4773
5644
|
|
|
@@ -4825,7 +5696,7 @@
|
|
|
4825
5696
|
tokenizer.p = begin;
|
|
4826
5697
|
break;
|
|
4827
5698
|
}
|
|
4828
|
-
_this.hash = new Hash(tokenizer
|
|
5699
|
+
_this.hash = new Hash(tokenizer, liquid.options.keyValueSeparator);
|
|
4829
5700
|
return _this;
|
|
4830
5701
|
}
|
|
4831
5702
|
default_1.prototype.render = function (ctx, emitter) {
|
|
@@ -4882,26 +5753,112 @@
|
|
|
4882
5753
|
case 10:
|
|
4883
5754
|
collection_1_1 = collection_1.next();
|
|
4884
5755
|
return [3 /*break*/, 7];
|
|
4885
|
-
case 11: return [3 /*break*/, 14];
|
|
4886
|
-
case 12:
|
|
4887
|
-
e_1_1 = _k.sent();
|
|
4888
|
-
e_1 = { error: e_1_1 };
|
|
4889
|
-
return [3 /*break*/, 14];
|
|
4890
|
-
case 13:
|
|
5756
|
+
case 11: return [3 /*break*/, 14];
|
|
5757
|
+
case 12:
|
|
5758
|
+
e_1_1 = _k.sent();
|
|
5759
|
+
e_1 = { error: e_1_1 };
|
|
5760
|
+
return [3 /*break*/, 14];
|
|
5761
|
+
case 13:
|
|
5762
|
+
try {
|
|
5763
|
+
if (collection_1_1 && !collection_1_1.done && (_j = collection_1.return)) _j.call(collection_1);
|
|
5764
|
+
}
|
|
5765
|
+
finally { if (e_1) throw e_1.error; }
|
|
5766
|
+
return [7 /*endfinally*/];
|
|
5767
|
+
case 14: return [3 /*break*/, 18];
|
|
5768
|
+
case 15: return [4 /*yield*/, liquid._parsePartialFile(filepath, childCtx.sync, this['currentFile'])];
|
|
5769
|
+
case 16:
|
|
5770
|
+
templates = (_k.sent());
|
|
5771
|
+
return [4 /*yield*/, liquid.renderer.renderTemplates(templates, childCtx, emitter)];
|
|
5772
|
+
case 17:
|
|
5773
|
+
_k.sent();
|
|
5774
|
+
_k.label = 18;
|
|
5775
|
+
case 18: return [2 /*return*/];
|
|
5776
|
+
}
|
|
5777
|
+
});
|
|
5778
|
+
};
|
|
5779
|
+
default_1.prototype.children = function (partials, sync) {
|
|
5780
|
+
return __generator(this, function (_a) {
|
|
5781
|
+
switch (_a.label) {
|
|
5782
|
+
case 0:
|
|
5783
|
+
if (!(partials && isString(this['file']))) return [3 /*break*/, 2];
|
|
5784
|
+
return [4 /*yield*/, this.liquid._parsePartialFile(this['file'], sync, this['currentFile'])];
|
|
5785
|
+
case 1: return [2 /*return*/, (_a.sent())];
|
|
5786
|
+
case 2: return [2 /*return*/, []];
|
|
5787
|
+
}
|
|
5788
|
+
});
|
|
5789
|
+
};
|
|
5790
|
+
default_1.prototype.partialScope = function () {
|
|
5791
|
+
if (isString(this['file'])) {
|
|
5792
|
+
var names = Object.keys(this.hash.hash);
|
|
5793
|
+
if (this['with']) {
|
|
5794
|
+
var _a = this['with'], value = _a.value, alias = _a.alias;
|
|
5795
|
+
if (isString(alias)) {
|
|
5796
|
+
names.push([alias, value]);
|
|
5797
|
+
}
|
|
5798
|
+
else if (isString(this.file)) {
|
|
5799
|
+
names.push([this.file, value]);
|
|
5800
|
+
}
|
|
5801
|
+
}
|
|
5802
|
+
if (this['for']) {
|
|
5803
|
+
var _b = this['for'], value = _b.value, alias = _b.alias;
|
|
5804
|
+
if (isString(alias)) {
|
|
5805
|
+
names.push([alias, value]);
|
|
5806
|
+
}
|
|
5807
|
+
else if (isString(this.file)) {
|
|
5808
|
+
names.push([this.file, value]);
|
|
5809
|
+
}
|
|
5810
|
+
}
|
|
5811
|
+
return { name: this['file'], isolated: true, scope: names };
|
|
5812
|
+
}
|
|
5813
|
+
};
|
|
5814
|
+
default_1.prototype.arguments = function () {
|
|
5815
|
+
var _a, _b, v, e_2_1, value, value;
|
|
5816
|
+
var e_2, _c;
|
|
5817
|
+
return __generator(this, function (_d) {
|
|
5818
|
+
switch (_d.label) {
|
|
5819
|
+
case 0:
|
|
5820
|
+
_d.trys.push([0, 5, 6, 7]);
|
|
5821
|
+
_a = __values(Object.values(this.hash.hash)), _b = _a.next();
|
|
5822
|
+
_d.label = 1;
|
|
5823
|
+
case 1:
|
|
5824
|
+
if (!!_b.done) return [3 /*break*/, 4];
|
|
5825
|
+
v = _b.value;
|
|
5826
|
+
if (!isValueToken(v)) return [3 /*break*/, 3];
|
|
5827
|
+
return [4 /*yield*/, v];
|
|
5828
|
+
case 2:
|
|
5829
|
+
_d.sent();
|
|
5830
|
+
_d.label = 3;
|
|
5831
|
+
case 3:
|
|
5832
|
+
_b = _a.next();
|
|
5833
|
+
return [3 /*break*/, 1];
|
|
5834
|
+
case 4: return [3 /*break*/, 7];
|
|
5835
|
+
case 5:
|
|
5836
|
+
e_2_1 = _d.sent();
|
|
5837
|
+
e_2 = { error: e_2_1 };
|
|
5838
|
+
return [3 /*break*/, 7];
|
|
5839
|
+
case 6:
|
|
4891
5840
|
try {
|
|
4892
|
-
if (
|
|
5841
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
4893
5842
|
}
|
|
4894
|
-
finally { if (
|
|
5843
|
+
finally { if (e_2) throw e_2.error; }
|
|
4895
5844
|
return [7 /*endfinally*/];
|
|
4896
|
-
case
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
return [4 /*yield*/,
|
|
4901
|
-
case
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
case
|
|
5845
|
+
case 7:
|
|
5846
|
+
if (!this['with']) return [3 /*break*/, 9];
|
|
5847
|
+
value = this['with'].value;
|
|
5848
|
+
if (!isValueToken(value)) return [3 /*break*/, 9];
|
|
5849
|
+
return [4 /*yield*/, value];
|
|
5850
|
+
case 8:
|
|
5851
|
+
_d.sent();
|
|
5852
|
+
_d.label = 9;
|
|
5853
|
+
case 9:
|
|
5854
|
+
if (!this['for']) return [3 /*break*/, 11];
|
|
5855
|
+
value = this['for'].value;
|
|
5856
|
+
if (!isValueToken(value)) return [3 /*break*/, 11];
|
|
5857
|
+
return [4 /*yield*/, value];
|
|
5858
|
+
case 10:
|
|
5859
|
+
_d.sent();
|
|
5860
|
+
_d.label = 11;
|
|
5861
|
+
case 11: return [2 /*return*/];
|
|
4905
5862
|
}
|
|
4906
5863
|
});
|
|
4907
5864
|
};
|
|
@@ -4969,7 +5926,7 @@
|
|
|
4969
5926
|
}
|
|
4970
5927
|
else
|
|
4971
5928
|
tokenizer.p = begin;
|
|
4972
|
-
_this.hash = new Hash(tokenizer
|
|
5929
|
+
_this.hash = new Hash(tokenizer, liquid.options.jekyllInclude || liquid.options.keyValueSeparator);
|
|
4973
5930
|
return _this;
|
|
4974
5931
|
}
|
|
4975
5932
|
default_1.prototype.render = function (ctx, emitter) {
|
|
@@ -5009,6 +5966,53 @@
|
|
|
5009
5966
|
}
|
|
5010
5967
|
});
|
|
5011
5968
|
};
|
|
5969
|
+
default_1.prototype.children = function (partials, sync) {
|
|
5970
|
+
return __generator(this, function (_a) {
|
|
5971
|
+
switch (_a.label) {
|
|
5972
|
+
case 0:
|
|
5973
|
+
if (!(partials && isString(this['file']))) return [3 /*break*/, 2];
|
|
5974
|
+
return [4 /*yield*/, this.liquid._parsePartialFile(this['file'], sync, this['currentFile'])];
|
|
5975
|
+
case 1: return [2 /*return*/, (_a.sent())];
|
|
5976
|
+
case 2: return [2 /*return*/, []];
|
|
5977
|
+
}
|
|
5978
|
+
});
|
|
5979
|
+
};
|
|
5980
|
+
default_1.prototype.partialScope = function () {
|
|
5981
|
+
if (isString(this['file'])) {
|
|
5982
|
+
var names = void 0;
|
|
5983
|
+
if (this.liquid.options.jekyllInclude) {
|
|
5984
|
+
names = ['include'];
|
|
5985
|
+
}
|
|
5986
|
+
else {
|
|
5987
|
+
names = Object.keys(this.hash.hash);
|
|
5988
|
+
if (this.withVar) {
|
|
5989
|
+
names.push([this['file'], this.withVar]);
|
|
5990
|
+
}
|
|
5991
|
+
}
|
|
5992
|
+
return { name: this['file'], isolated: false, scope: names };
|
|
5993
|
+
}
|
|
5994
|
+
};
|
|
5995
|
+
default_1.prototype.arguments = function () {
|
|
5996
|
+
return __generator(this, function (_a) {
|
|
5997
|
+
switch (_a.label) {
|
|
5998
|
+
case 0: return [5 /*yield**/, __values(Object.values(this.hash.hash).filter(isValueToken))];
|
|
5999
|
+
case 1:
|
|
6000
|
+
_a.sent();
|
|
6001
|
+
if (!isValueToken(this['file'])) return [3 /*break*/, 3];
|
|
6002
|
+
return [4 /*yield*/, this['file']];
|
|
6003
|
+
case 2:
|
|
6004
|
+
_a.sent();
|
|
6005
|
+
_a.label = 3;
|
|
6006
|
+
case 3:
|
|
6007
|
+
if (!isValueToken(this.withVar)) return [3 /*break*/, 5];
|
|
6008
|
+
return [4 /*yield*/, this.withVar];
|
|
6009
|
+
case 4:
|
|
6010
|
+
_a.sent();
|
|
6011
|
+
_a.label = 5;
|
|
6012
|
+
case 5: return [2 /*return*/];
|
|
6013
|
+
}
|
|
6014
|
+
});
|
|
6015
|
+
};
|
|
5012
6016
|
return default_1;
|
|
5013
6017
|
}(Tag));
|
|
5014
6018
|
|
|
@@ -5016,7 +6020,8 @@
|
|
|
5016
6020
|
__extends(default_1, _super);
|
|
5017
6021
|
function default_1(token, remainTokens, liquid) {
|
|
5018
6022
|
var _this = _super.call(this, token, remainTokens, liquid) || this;
|
|
5019
|
-
_this.
|
|
6023
|
+
_this.identifier = _this.tokenizer.readIdentifier();
|
|
6024
|
+
_this.variable = _this.identifier.content;
|
|
5020
6025
|
return _this;
|
|
5021
6026
|
}
|
|
5022
6027
|
default_1.prototype.render = function (context, emitter) {
|
|
@@ -5026,6 +6031,16 @@
|
|
|
5026
6031
|
}
|
|
5027
6032
|
emitter.write(stringify(--scope[this.variable]));
|
|
5028
6033
|
};
|
|
6034
|
+
default_1.prototype.localScope = function () {
|
|
6035
|
+
return __generator(this, function (_a) {
|
|
6036
|
+
switch (_a.label) {
|
|
6037
|
+
case 0: return [4 /*yield*/, this.identifier];
|
|
6038
|
+
case 1:
|
|
6039
|
+
_a.sent();
|
|
6040
|
+
return [2 /*return*/];
|
|
6041
|
+
}
|
|
6042
|
+
});
|
|
6043
|
+
};
|
|
5029
6044
|
return default_1;
|
|
5030
6045
|
}(Tag));
|
|
5031
6046
|
|
|
@@ -5074,6 +6089,21 @@
|
|
|
5074
6089
|
}
|
|
5075
6090
|
});
|
|
5076
6091
|
};
|
|
6092
|
+
default_1.prototype.arguments = function () {
|
|
6093
|
+
return __generator(this, function (_a) {
|
|
6094
|
+
switch (_a.label) {
|
|
6095
|
+
case 0: return [5 /*yield**/, __values(this.candidates)];
|
|
6096
|
+
case 1:
|
|
6097
|
+
_a.sent();
|
|
6098
|
+
if (!this.group) return [3 /*break*/, 3];
|
|
6099
|
+
return [4 /*yield*/, this.group];
|
|
6100
|
+
case 2:
|
|
6101
|
+
_a.sent();
|
|
6102
|
+
_a.label = 3;
|
|
6103
|
+
case 3: return [2 /*return*/];
|
|
6104
|
+
}
|
|
6105
|
+
});
|
|
6106
|
+
};
|
|
5077
6107
|
return default_1;
|
|
5078
6108
|
}(Tag));
|
|
5079
6109
|
|
|
@@ -5085,13 +6115,13 @@
|
|
|
5085
6115
|
var p = [];
|
|
5086
6116
|
parser.parseStream(remainTokens)
|
|
5087
6117
|
.on('start', function () { return _this.branches.push({
|
|
5088
|
-
value: new Value(tagToken.
|
|
6118
|
+
value: new Value(tagToken.tokenizer.readFilteredValue(), _this.liquid),
|
|
5089
6119
|
templates: (p = [])
|
|
5090
6120
|
}); })
|
|
5091
6121
|
.on('tag:elsif', function (token) {
|
|
5092
6122
|
assert(!_this.elseTemplates, 'unexpected elsif after else');
|
|
5093
6123
|
_this.branches.push({
|
|
5094
|
-
value: new Value(token.
|
|
6124
|
+
value: new Value(token.tokenizer.readFilteredValue(), _this.liquid),
|
|
5095
6125
|
templates: (p = [])
|
|
5096
6126
|
});
|
|
5097
6127
|
})
|
|
@@ -5150,6 +6180,19 @@
|
|
|
5150
6180
|
}
|
|
5151
6181
|
});
|
|
5152
6182
|
};
|
|
6183
|
+
default_1.prototype.children = function () {
|
|
6184
|
+
var templates;
|
|
6185
|
+
return __generator(this, function (_a) {
|
|
6186
|
+
templates = this.branches.flatMap(function (b) { return b.templates; });
|
|
6187
|
+
if (this.elseTemplates) {
|
|
6188
|
+
templates.push.apply(templates, __spreadArray([], __read(this.elseTemplates), false));
|
|
6189
|
+
}
|
|
6190
|
+
return [2 /*return*/, templates];
|
|
6191
|
+
});
|
|
6192
|
+
};
|
|
6193
|
+
default_1.prototype.arguments = function () {
|
|
6194
|
+
return this.branches.map(function (b) { return b.value; });
|
|
6195
|
+
};
|
|
5153
6196
|
return default_1;
|
|
5154
6197
|
}(Tag));
|
|
5155
6198
|
|
|
@@ -5157,7 +6200,8 @@
|
|
|
5157
6200
|
__extends(default_1, _super);
|
|
5158
6201
|
function default_1(token, remainTokens, liquid) {
|
|
5159
6202
|
var _this = _super.call(this, token, remainTokens, liquid) || this;
|
|
5160
|
-
_this.
|
|
6203
|
+
_this.identifier = _this.tokenizer.readIdentifier();
|
|
6204
|
+
_this.variable = _this.identifier.content;
|
|
5161
6205
|
return _this;
|
|
5162
6206
|
}
|
|
5163
6207
|
default_1.prototype.render = function (context, emitter) {
|
|
@@ -5169,6 +6213,16 @@
|
|
|
5169
6213
|
scope[this.variable]++;
|
|
5170
6214
|
emitter.write(stringify(val));
|
|
5171
6215
|
};
|
|
6216
|
+
default_1.prototype.localScope = function () {
|
|
6217
|
+
return __generator(this, function (_a) {
|
|
6218
|
+
switch (_a.label) {
|
|
6219
|
+
case 0: return [4 /*yield*/, this.identifier];
|
|
6220
|
+
case 1:
|
|
6221
|
+
_a.sent();
|
|
6222
|
+
return [2 /*return*/];
|
|
6223
|
+
}
|
|
6224
|
+
});
|
|
6225
|
+
};
|
|
5172
6226
|
return default_1;
|
|
5173
6227
|
}(Tag));
|
|
5174
6228
|
|
|
@@ -5178,7 +6232,7 @@
|
|
|
5178
6232
|
var _this = _super.call(this, token, remainTokens, liquid) || this;
|
|
5179
6233
|
_this.file = parseFilePath(_this.tokenizer, _this.liquid, parser);
|
|
5180
6234
|
_this['currentFile'] = token.file;
|
|
5181
|
-
_this.args = new Hash(_this.tokenizer
|
|
6235
|
+
_this.args = new Hash(_this.tokenizer, liquid.options.keyValueSeparator);
|
|
5182
6236
|
_this.templates = parser.parseTokens(remainTokens);
|
|
5183
6237
|
return _this;
|
|
5184
6238
|
}
|
|
@@ -5226,6 +6280,70 @@
|
|
|
5226
6280
|
}
|
|
5227
6281
|
});
|
|
5228
6282
|
};
|
|
6283
|
+
default_1.prototype.children = function (partials) {
|
|
6284
|
+
var templates, _a, _b, _c, _d;
|
|
6285
|
+
return __generator(this, function (_e) {
|
|
6286
|
+
switch (_e.label) {
|
|
6287
|
+
case 0:
|
|
6288
|
+
templates = this.templates.slice();
|
|
6289
|
+
if (!(partials && isString(this.file))) return [3 /*break*/, 2];
|
|
6290
|
+
_b = (_a = templates.push).apply;
|
|
6291
|
+
_c = [templates];
|
|
6292
|
+
_d = [[]];
|
|
6293
|
+
return [4 /*yield*/, this.liquid._parsePartialFile(this.file, true, this['currentFile'])];
|
|
6294
|
+
case 1:
|
|
6295
|
+
_b.apply(_a, _c.concat([__spreadArray.apply(void 0, _d.concat([__read.apply(void 0, [(_e.sent())]), false]))]));
|
|
6296
|
+
_e.label = 2;
|
|
6297
|
+
case 2: return [2 /*return*/, templates];
|
|
6298
|
+
}
|
|
6299
|
+
});
|
|
6300
|
+
};
|
|
6301
|
+
default_1.prototype.arguments = function () {
|
|
6302
|
+
var _a, _b, v, e_1_1;
|
|
6303
|
+
var e_1, _c;
|
|
6304
|
+
return __generator(this, function (_d) {
|
|
6305
|
+
switch (_d.label) {
|
|
6306
|
+
case 0:
|
|
6307
|
+
_d.trys.push([0, 5, 6, 7]);
|
|
6308
|
+
_a = __values(Object.values(this.args.hash)), _b = _a.next();
|
|
6309
|
+
_d.label = 1;
|
|
6310
|
+
case 1:
|
|
6311
|
+
if (!!_b.done) return [3 /*break*/, 4];
|
|
6312
|
+
v = _b.value;
|
|
6313
|
+
if (!isValueToken(v)) return [3 /*break*/, 3];
|
|
6314
|
+
return [4 /*yield*/, v];
|
|
6315
|
+
case 2:
|
|
6316
|
+
_d.sent();
|
|
6317
|
+
_d.label = 3;
|
|
6318
|
+
case 3:
|
|
6319
|
+
_b = _a.next();
|
|
6320
|
+
return [3 /*break*/, 1];
|
|
6321
|
+
case 4: return [3 /*break*/, 7];
|
|
6322
|
+
case 5:
|
|
6323
|
+
e_1_1 = _d.sent();
|
|
6324
|
+
e_1 = { error: e_1_1 };
|
|
6325
|
+
return [3 /*break*/, 7];
|
|
6326
|
+
case 6:
|
|
6327
|
+
try {
|
|
6328
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
6329
|
+
}
|
|
6330
|
+
finally { if (e_1) throw e_1.error; }
|
|
6331
|
+
return [7 /*endfinally*/];
|
|
6332
|
+
case 7:
|
|
6333
|
+
if (!isValueToken(this.file)) return [3 /*break*/, 9];
|
|
6334
|
+
return [4 /*yield*/, this.file];
|
|
6335
|
+
case 8:
|
|
6336
|
+
_d.sent();
|
|
6337
|
+
_d.label = 9;
|
|
6338
|
+
case 9: return [2 /*return*/];
|
|
6339
|
+
}
|
|
6340
|
+
});
|
|
6341
|
+
};
|
|
6342
|
+
default_1.prototype.partialScope = function () {
|
|
6343
|
+
if (isString(this.file)) {
|
|
6344
|
+
return { name: this.file, isolated: false, scope: Object.keys(this.args.hash) };
|
|
6345
|
+
}
|
|
6346
|
+
};
|
|
5229
6347
|
return default_1;
|
|
5230
6348
|
}(Tag));
|
|
5231
6349
|
|
|
@@ -5283,6 +6401,14 @@
|
|
|
5283
6401
|
? function (superBlock, emitter) { return renderChild(new BlockDrop(function () { return renderCurrent(superBlock, emitter); }), emitter); }
|
|
5284
6402
|
: renderCurrent;
|
|
5285
6403
|
};
|
|
6404
|
+
default_1.prototype.children = function () {
|
|
6405
|
+
return __generator(this, function (_a) {
|
|
6406
|
+
return [2 /*return*/, this.templates];
|
|
6407
|
+
});
|
|
6408
|
+
};
|
|
6409
|
+
default_1.prototype.blockScope = function () {
|
|
6410
|
+
return ['block'];
|
|
6411
|
+
};
|
|
5286
6412
|
return default_1;
|
|
5287
6413
|
}(Tag));
|
|
5288
6414
|
|
|
@@ -5344,7 +6470,7 @@
|
|
|
5344
6470
|
}
|
|
5345
6471
|
_this.variable = variable.content;
|
|
5346
6472
|
_this.collection = collectionToken;
|
|
5347
|
-
_this.args = new Hash(_this.tokenizer
|
|
6473
|
+
_this.args = new Hash(_this.tokenizer, liquid.options.keyValueSeparator);
|
|
5348
6474
|
_this.templates = [];
|
|
5349
6475
|
var p;
|
|
5350
6476
|
var stream = parser.parseStream(remainTokens)
|
|
@@ -5404,6 +6530,53 @@
|
|
|
5404
6530
|
}
|
|
5405
6531
|
});
|
|
5406
6532
|
};
|
|
6533
|
+
default_1.prototype.children = function () {
|
|
6534
|
+
return __generator(this, function (_a) {
|
|
6535
|
+
return [2 /*return*/, this.templates];
|
|
6536
|
+
});
|
|
6537
|
+
};
|
|
6538
|
+
default_1.prototype.arguments = function () {
|
|
6539
|
+
var _a, _b, v, e_1_1;
|
|
6540
|
+
var e_1, _c;
|
|
6541
|
+
return __generator(this, function (_d) {
|
|
6542
|
+
switch (_d.label) {
|
|
6543
|
+
case 0: return [4 /*yield*/, this.collection];
|
|
6544
|
+
case 1:
|
|
6545
|
+
_d.sent();
|
|
6546
|
+
_d.label = 2;
|
|
6547
|
+
case 2:
|
|
6548
|
+
_d.trys.push([2, 7, 8, 9]);
|
|
6549
|
+
_a = __values(Object.values(this.args.hash)), _b = _a.next();
|
|
6550
|
+
_d.label = 3;
|
|
6551
|
+
case 3:
|
|
6552
|
+
if (!!_b.done) return [3 /*break*/, 6];
|
|
6553
|
+
v = _b.value;
|
|
6554
|
+
if (!isValueToken(v)) return [3 /*break*/, 5];
|
|
6555
|
+
return [4 /*yield*/, v];
|
|
6556
|
+
case 4:
|
|
6557
|
+
_d.sent();
|
|
6558
|
+
_d.label = 5;
|
|
6559
|
+
case 5:
|
|
6560
|
+
_b = _a.next();
|
|
6561
|
+
return [3 /*break*/, 3];
|
|
6562
|
+
case 6: return [3 /*break*/, 9];
|
|
6563
|
+
case 7:
|
|
6564
|
+
e_1_1 = _d.sent();
|
|
6565
|
+
e_1 = { error: e_1_1 };
|
|
6566
|
+
return [3 /*break*/, 9];
|
|
6567
|
+
case 8:
|
|
6568
|
+
try {
|
|
6569
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
6570
|
+
}
|
|
6571
|
+
finally { if (e_1) throw e_1.error; }
|
|
6572
|
+
return [7 /*endfinally*/];
|
|
6573
|
+
case 9: return [2 /*return*/];
|
|
6574
|
+
}
|
|
6575
|
+
});
|
|
6576
|
+
};
|
|
6577
|
+
default_1.prototype.blockScope = function () {
|
|
6578
|
+
return [this.variable, 'tablerowloop'];
|
|
6579
|
+
};
|
|
5407
6580
|
return default_1;
|
|
5408
6581
|
}(Tag));
|
|
5409
6582
|
|
|
@@ -5417,7 +6590,7 @@
|
|
|
5417
6590
|
var elseCount = 0;
|
|
5418
6591
|
parser.parseStream(remainTokens)
|
|
5419
6592
|
.on('start', function () { return _this.branches.push({
|
|
5420
|
-
value: new Value(tagToken.
|
|
6593
|
+
value: new Value(tagToken.tokenizer.readFilteredValue(), _this.liquid),
|
|
5421
6594
|
test: isFalsy,
|
|
5422
6595
|
templates: (p = [])
|
|
5423
6596
|
}); })
|
|
@@ -5427,7 +6600,7 @@
|
|
|
5427
6600
|
return;
|
|
5428
6601
|
}
|
|
5429
6602
|
_this.branches.push({
|
|
5430
|
-
value: new Value(token.
|
|
6603
|
+
value: new Value(token.tokenizer.readFilteredValue(), _this.liquid),
|
|
5431
6604
|
test: isTruthy,
|
|
5432
6605
|
templates: (p = [])
|
|
5433
6606
|
});
|
|
@@ -5490,6 +6663,19 @@
|
|
|
5490
6663
|
}
|
|
5491
6664
|
});
|
|
5492
6665
|
};
|
|
6666
|
+
default_1.prototype.children = function () {
|
|
6667
|
+
var children;
|
|
6668
|
+
return __generator(this, function (_a) {
|
|
6669
|
+
children = this.branches.flatMap(function (b) { return b.templates; });
|
|
6670
|
+
if (this.elseTemplates) {
|
|
6671
|
+
children.push.apply(children, __spreadArray([], __read(this.elseTemplates), false));
|
|
6672
|
+
}
|
|
6673
|
+
return [2 /*return*/, children];
|
|
6674
|
+
});
|
|
6675
|
+
};
|
|
6676
|
+
default_1.prototype.arguments = function () {
|
|
6677
|
+
return this.branches.map(function (b) { return b.value; });
|
|
6678
|
+
};
|
|
5493
6679
|
return default_1;
|
|
5494
6680
|
}(Tag));
|
|
5495
6681
|
|
|
@@ -5498,8 +6684,8 @@
|
|
|
5498
6684
|
function default_1() {
|
|
5499
6685
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
5500
6686
|
}
|
|
5501
|
-
default_1.prototype.render = function (ctx,
|
|
5502
|
-
|
|
6687
|
+
default_1.prototype.render = function (ctx, _emitter) {
|
|
6688
|
+
ctx.breakCalled = true;
|
|
5503
6689
|
};
|
|
5504
6690
|
return default_1;
|
|
5505
6691
|
}(Tag));
|
|
@@ -5509,8 +6695,8 @@
|
|
|
5509
6695
|
function default_1() {
|
|
5510
6696
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
5511
6697
|
}
|
|
5512
|
-
default_1.prototype.render = function (ctx,
|
|
5513
|
-
|
|
6698
|
+
default_1.prototype.render = function (ctx, _emitter) {
|
|
6699
|
+
ctx.continueCalled = true;
|
|
5514
6700
|
};
|
|
5515
6701
|
return default_1;
|
|
5516
6702
|
}(Tag));
|
|
@@ -5540,6 +6726,19 @@
|
|
|
5540
6726
|
}
|
|
5541
6727
|
});
|
|
5542
6728
|
};
|
|
6729
|
+
default_1.prototype.arguments = function () {
|
|
6730
|
+
return __generator(this, function (_a) {
|
|
6731
|
+
switch (_a.label) {
|
|
6732
|
+
case 0:
|
|
6733
|
+
if (!this.value) return [3 /*break*/, 2];
|
|
6734
|
+
return [4 /*yield*/, this.value];
|
|
6735
|
+
case 1:
|
|
6736
|
+
_a.sent();
|
|
6737
|
+
_a.label = 2;
|
|
6738
|
+
case 2: return [2 /*return*/];
|
|
6739
|
+
}
|
|
6740
|
+
});
|
|
6741
|
+
};
|
|
5543
6742
|
return default_1;
|
|
5544
6743
|
}(Tag));
|
|
5545
6744
|
|
|
@@ -5561,6 +6760,11 @@
|
|
|
5561
6760
|
}
|
|
5562
6761
|
});
|
|
5563
6762
|
};
|
|
6763
|
+
default_1.prototype.children = function () {
|
|
6764
|
+
return __generator(this, function (_a) {
|
|
6765
|
+
return [2 /*return*/, this.templates];
|
|
6766
|
+
});
|
|
6767
|
+
};
|
|
5564
6768
|
return default_1;
|
|
5565
6769
|
}(Tag));
|
|
5566
6770
|
|
|
@@ -5744,11 +6948,161 @@
|
|
|
5744
6948
|
self.renderFile(filePath, ctx).then(function (html) { return callback(null, html); }, callback);
|
|
5745
6949
|
};
|
|
5746
6950
|
};
|
|
6951
|
+
Liquid.prototype.analyze = function (template, options) {
|
|
6952
|
+
if (options === void 0) { options = {}; }
|
|
6953
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6954
|
+
return __generator(this, function (_a) {
|
|
6955
|
+
return [2 /*return*/, analyze(template, options)];
|
|
6956
|
+
});
|
|
6957
|
+
});
|
|
6958
|
+
};
|
|
6959
|
+
Liquid.prototype.analyzeSync = function (template, options) {
|
|
6960
|
+
if (options === void 0) { options = {}; }
|
|
6961
|
+
return analyzeSync(template, options);
|
|
6962
|
+
};
|
|
6963
|
+
Liquid.prototype.parseAndAnalyze = function (html, filename, options) {
|
|
6964
|
+
if (options === void 0) { options = {}; }
|
|
6965
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6966
|
+
return __generator(this, function (_a) {
|
|
6967
|
+
return [2 /*return*/, analyze(this.parse(html, filename), options)];
|
|
6968
|
+
});
|
|
6969
|
+
});
|
|
6970
|
+
};
|
|
6971
|
+
Liquid.prototype.parseAndAnalyzeSync = function (html, filename, options) {
|
|
6972
|
+
if (options === void 0) { options = {}; }
|
|
6973
|
+
return analyzeSync(this.parse(html, filename), options);
|
|
6974
|
+
};
|
|
6975
|
+
/** Return an array of all variables without their properties. */
|
|
6976
|
+
Liquid.prototype.variables = function (template, options) {
|
|
6977
|
+
if (options === void 0) { options = {}; }
|
|
6978
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6979
|
+
var analysis;
|
|
6980
|
+
return __generator(this, function (_a) {
|
|
6981
|
+
switch (_a.label) {
|
|
6982
|
+
case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)];
|
|
6983
|
+
case 1:
|
|
6984
|
+
analysis = _a.sent();
|
|
6985
|
+
return [2 /*return*/, Object.keys(analysis.variables)];
|
|
6986
|
+
}
|
|
6987
|
+
});
|
|
6988
|
+
});
|
|
6989
|
+
};
|
|
6990
|
+
/** Return an array of all variables without their properties. */
|
|
6991
|
+
Liquid.prototype.variablesSync = function (template, options) {
|
|
6992
|
+
if (options === void 0) { options = {}; }
|
|
6993
|
+
var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
6994
|
+
return Object.keys(analysis.variables);
|
|
6995
|
+
};
|
|
6996
|
+
/** Return an array of all variables including their properties/paths. */
|
|
6997
|
+
Liquid.prototype.fullVariables = function (template, options) {
|
|
6998
|
+
if (options === void 0) { options = {}; }
|
|
6999
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7000
|
+
var analysis;
|
|
7001
|
+
return __generator(this, function (_a) {
|
|
7002
|
+
switch (_a.label) {
|
|
7003
|
+
case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)];
|
|
7004
|
+
case 1:
|
|
7005
|
+
analysis = _a.sent();
|
|
7006
|
+
return [2 /*return*/, Array.from(new Set(Object.values(analysis.variables).flatMap(function (a) { return a.map(function (v) { return String(v); }); })))];
|
|
7007
|
+
}
|
|
7008
|
+
});
|
|
7009
|
+
});
|
|
7010
|
+
};
|
|
7011
|
+
/** Return an array of all variables including their properties/paths. */
|
|
7012
|
+
Liquid.prototype.fullVariablesSync = function (template, options) {
|
|
7013
|
+
if (options === void 0) { options = {}; }
|
|
7014
|
+
var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
7015
|
+
return Array.from(new Set(Object.values(analysis.variables).flatMap(function (a) { return a.map(function (v) { return String(v); }); })));
|
|
7016
|
+
};
|
|
7017
|
+
/** Return an array of all variables, each as an array of properties/segments. */
|
|
7018
|
+
Liquid.prototype.variableSegments = function (template, options) {
|
|
7019
|
+
if (options === void 0) { options = {}; }
|
|
7020
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7021
|
+
var analysis;
|
|
7022
|
+
return __generator(this, function (_a) {
|
|
7023
|
+
switch (_a.label) {
|
|
7024
|
+
case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)];
|
|
7025
|
+
case 1:
|
|
7026
|
+
analysis = _a.sent();
|
|
7027
|
+
return [2 /*return*/, Array.from(strictUniq(Object.values(analysis.variables).flatMap(function (a) { return a.map(function (v) { return v.toArray(); }); })))];
|
|
7028
|
+
}
|
|
7029
|
+
});
|
|
7030
|
+
});
|
|
7031
|
+
};
|
|
7032
|
+
/** Return an array of all variables, each as an array of properties/segments. */
|
|
7033
|
+
Liquid.prototype.variableSegmentsSync = function (template, options) {
|
|
7034
|
+
if (options === void 0) { options = {}; }
|
|
7035
|
+
var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
7036
|
+
return Array.from(strictUniq(Object.values(analysis.variables).flatMap(function (a) { return a.map(function (v) { return v.toArray(); }); })));
|
|
7037
|
+
};
|
|
7038
|
+
/** Return an array of all expected context variables without their properties. */
|
|
7039
|
+
Liquid.prototype.globalVariables = function (template, options) {
|
|
7040
|
+
if (options === void 0) { options = {}; }
|
|
7041
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7042
|
+
var analysis;
|
|
7043
|
+
return __generator(this, function (_a) {
|
|
7044
|
+
switch (_a.label) {
|
|
7045
|
+
case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)];
|
|
7046
|
+
case 1:
|
|
7047
|
+
analysis = _a.sent();
|
|
7048
|
+
return [2 /*return*/, Object.keys(analysis.globals)];
|
|
7049
|
+
}
|
|
7050
|
+
});
|
|
7051
|
+
});
|
|
7052
|
+
};
|
|
7053
|
+
/** Return an array of all expected context variables without their properties. */
|
|
7054
|
+
Liquid.prototype.globalVariablesSync = function (template, options) {
|
|
7055
|
+
if (options === void 0) { options = {}; }
|
|
7056
|
+
var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
7057
|
+
return Object.keys(analysis.globals);
|
|
7058
|
+
};
|
|
7059
|
+
/** Return an array of all expected context variables including their properties/paths. */
|
|
7060
|
+
Liquid.prototype.globalFullVariables = function (template, options) {
|
|
7061
|
+
if (options === void 0) { options = {}; }
|
|
7062
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7063
|
+
var analysis;
|
|
7064
|
+
return __generator(this, function (_a) {
|
|
7065
|
+
switch (_a.label) {
|
|
7066
|
+
case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)];
|
|
7067
|
+
case 1:
|
|
7068
|
+
analysis = _a.sent();
|
|
7069
|
+
return [2 /*return*/, Array.from(new Set(Object.values(analysis.globals).flatMap(function (a) { return a.map(function (v) { return String(v); }); })))];
|
|
7070
|
+
}
|
|
7071
|
+
});
|
|
7072
|
+
});
|
|
7073
|
+
};
|
|
7074
|
+
/** Return an array of all expected context variables including their properties/paths. */
|
|
7075
|
+
Liquid.prototype.globalFullVariablesSync = function (template, options) {
|
|
7076
|
+
if (options === void 0) { options = {}; }
|
|
7077
|
+
var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
7078
|
+
return Array.from(new Set(Object.values(analysis.globals).flatMap(function (a) { return a.map(function (v) { return String(v); }); })));
|
|
7079
|
+
};
|
|
7080
|
+
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
7081
|
+
Liquid.prototype.globalVariableSegments = function (template, options) {
|
|
7082
|
+
if (options === void 0) { options = {}; }
|
|
7083
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
7084
|
+
var analysis;
|
|
7085
|
+
return __generator(this, function (_a) {
|
|
7086
|
+
switch (_a.label) {
|
|
7087
|
+
case 0: return [4 /*yield*/, analyze(isString(template) ? this.parse(template) : template, options)];
|
|
7088
|
+
case 1:
|
|
7089
|
+
analysis = _a.sent();
|
|
7090
|
+
return [2 /*return*/, Array.from(strictUniq(Object.values(analysis.globals).flatMap(function (a) { return a.map(function (v) { return v.toArray(); }); })))];
|
|
7091
|
+
}
|
|
7092
|
+
});
|
|
7093
|
+
});
|
|
7094
|
+
};
|
|
7095
|
+
/** Return an array of all expected context variables, each as an array of properties/segments. */
|
|
7096
|
+
Liquid.prototype.globalVariableSegmentsSync = function (template, options) {
|
|
7097
|
+
if (options === void 0) { options = {}; }
|
|
7098
|
+
var analysis = analyzeSync(isString(template) ? this.parse(template) : template, options);
|
|
7099
|
+
return Array.from(strictUniq(Object.values(analysis.globals).flatMap(function (a) { return a.map(function (v) { return v.toArray(); }); })));
|
|
7100
|
+
};
|
|
5747
7101
|
return Liquid;
|
|
5748
7102
|
}());
|
|
5749
7103
|
|
|
5750
7104
|
/* istanbul ignore file */
|
|
5751
|
-
var version = '10.
|
|
7105
|
+
var version = '10.20.1';
|
|
5752
7106
|
|
|
5753
7107
|
exports.AssertionError = AssertionError;
|
|
5754
7108
|
exports.AssignTag = default_1;
|
|
@@ -5778,6 +7132,7 @@
|
|
|
5778
7132
|
exports.Output = Output;
|
|
5779
7133
|
exports.ParseError = ParseError;
|
|
5780
7134
|
exports.ParseStream = ParseStream;
|
|
7135
|
+
exports.Parser = Parser;
|
|
5781
7136
|
exports.RawTag = default_1$d;
|
|
5782
7137
|
exports.RenderError = RenderError;
|
|
5783
7138
|
exports.RenderTag = default_1$5;
|
|
@@ -5791,6 +7146,9 @@
|
|
|
5791
7146
|
exports.UndefinedVariableError = UndefinedVariableError;
|
|
5792
7147
|
exports.UnlessTag = default_1$f;
|
|
5793
7148
|
exports.Value = Value;
|
|
7149
|
+
exports.Variable = Variable;
|
|
7150
|
+
exports.analyze = analyze;
|
|
7151
|
+
exports.analyzeSync = analyzeSync;
|
|
5794
7152
|
exports.assert = assert;
|
|
5795
7153
|
exports.createTrie = createTrie;
|
|
5796
7154
|
exports.defaultOperators = defaultOperators;
|