mirror of
https://github.com/harttle/liquidjs.git
synced 2026-10-05 01:55:12 -07:00
chore(release): 7.2.2 [skip ci]
## [7.2.2](https://github.com/harttle/liquidjs/compare/v7.2.1...v7.2.2) (2019-02-23)
### Bug Fixes
* filters break when argument contains [()|, fixes [#89](https://github.com/harttle/liquidjs/issues/89) ([e977669](https://github.com/harttle/liquidjs/commit/e977669))
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
## [7.2.2](https://github.com/harttle/liquidjs/compare/v7.2.1...v7.2.2) (2019-02-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* filters break when argument contains [()|, fixes [#89](https://github.com/harttle/liquidjs/issues/89) ([e977669](https://github.com/harttle/liquidjs/commit/e977669))
|
||||||
|
|
||||||
## [7.2.1](https://github.com/harttle/liquidjs/compare/v7.2.0...v7.2.1) (2019-02-22)
|
## [7.2.1](https://github.com/harttle/liquidjs/compare/v7.2.0...v7.2.1) (2019-02-22)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export default function (): Promise<{}>;
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export default function (): Promise<{}>;
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export default function (): Promise<{}>;
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export {};
|
||||||
Vendored
+128
-115
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* [email protected].1, https://github.com/harttle/liquidjs
|
* [email protected].2, https://github.com/harttle/liquidjs
|
||||||
* (c) 2016-2019 harttle
|
* (c) 2016-2019 harttle
|
||||||
* Released under the MIT License.
|
* Released under the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -208,76 +208,6 @@ function padStart(str, length, ch) {
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// quote related
|
|
||||||
var singleQuoted = /'[^']*'/;
|
|
||||||
var doubleQuoted = /"[^"]*"/;
|
|
||||||
var quoted = new RegExp(singleQuoted.source + "|" + doubleQuoted.source);
|
|
||||||
var quoteBalanced = new RegExp("(?:" + quoted.source + "|[^'\"])*");
|
|
||||||
// basic types
|
|
||||||
var integer = /-?\d+/;
|
|
||||||
var number = /[+-]?(?:\d+\.?\d*|\.?\d+)/;
|
|
||||||
var bool = /true|false/;
|
|
||||||
// property access
|
|
||||||
var identifier = /[\w-]+[?]?/;
|
|
||||||
var subscript = new RegExp("\\[(?:" + quoted.source + "|[\\w-\\.]+)\\]");
|
|
||||||
var literal = new RegExp("(?:" + quoted.source + "|" + bool.source + "|" + number.source + ")");
|
|
||||||
var variable = new RegExp(identifier.source + "(?:\\." + identifier.source + "|" + subscript.source + ")*");
|
|
||||||
// range related
|
|
||||||
var rangeLimit = new RegExp("(?:" + variable.source + "|" + number.source + ")");
|
|
||||||
var range$1 = new RegExp("\\(" + rangeLimit.source + "\\.\\." + rangeLimit.source + "\\)");
|
|
||||||
var rangeCapture = new RegExp("\\((" + rangeLimit.source + ")\\.\\.(" + rangeLimit.source + ")\\)");
|
|
||||||
var value = new RegExp("(?:" + variable.source + "|" + literal.source + "|" + range$1.source + ")");
|
|
||||||
// hash related
|
|
||||||
var hash = new RegExp("(?:" + identifier.source + ")\\s*:\\s*(?:" + value.source + ")");
|
|
||||||
var hashCapture = new RegExp("(" + identifier.source + ")\\s*:\\s*(" + value.source + ")", 'g');
|
|
||||||
// full match
|
|
||||||
var tagLine = new RegExp("^\\s*(" + identifier.source + ")\\s*([\\s\\S]*?)\\s*$");
|
|
||||||
var literalLine = new RegExp("^" + literal.source + "$", 'i');
|
|
||||||
var variableLine = new RegExp("^" + variable.source + "$");
|
|
||||||
var numberLine = new RegExp("^" + number.source + "$");
|
|
||||||
var boolLine = new RegExp("^" + bool.source + "$", 'i');
|
|
||||||
var quotedLine = new RegExp("^" + quoted.source + "$");
|
|
||||||
var rangeLine = new RegExp("^" + rangeCapture.source + "$");
|
|
||||||
var integerLine = new RegExp("^" + integer.source + "$");
|
|
||||||
// filter related
|
|
||||||
var valueDeclaration = new RegExp("(?:" + identifier.source + "\\s*:\\s*)?" + value.source);
|
|
||||||
var valueList = new RegExp(valueDeclaration.source + "(\\s*,\\s*" + valueDeclaration.source + ")*");
|
|
||||||
var filter = new RegExp(identifier.source + "(?:\\s*:\\s*" + valueList.source + ")?", 'g');
|
|
||||||
var filterCapture = new RegExp("(" + identifier.source + ")(?:\\s*:\\s*(" + valueList.source + "))?");
|
|
||||||
var filterLine = new RegExp("^" + filterCapture.source + "$");
|
|
||||||
var operators = [
|
|
||||||
/\s+or\s+/,
|
|
||||||
/\s+and\s+/,
|
|
||||||
/==|!=|<=|>=|<|>|\s+contains\s+/
|
|
||||||
];
|
|
||||||
function isInteger(str) {
|
|
||||||
return integerLine.test(str);
|
|
||||||
}
|
|
||||||
function isLiteral(str) {
|
|
||||||
return literalLine.test(str);
|
|
||||||
}
|
|
||||||
function isVariable(str) {
|
|
||||||
return variableLine.test(str);
|
|
||||||
}
|
|
||||||
function matchValue(str) {
|
|
||||||
return value.exec(str);
|
|
||||||
}
|
|
||||||
function parseLiteral(str) {
|
|
||||||
var res = str.match(numberLine);
|
|
||||||
if (res) {
|
|
||||||
return Number(str);
|
|
||||||
}
|
|
||||||
res = str.match(boolLine);
|
|
||||||
if (res) {
|
|
||||||
return str.toLowerCase() === 'true';
|
|
||||||
}
|
|
||||||
res = str.match(quotedLine);
|
|
||||||
if (res) {
|
|
||||||
return str.slice(1, -1);
|
|
||||||
}
|
|
||||||
throw new TypeError("cannot parse '" + str + "' as literal");
|
|
||||||
}
|
|
||||||
|
|
||||||
var LiquidError = /** @class */ (function (_super) {
|
var LiquidError = /** @class */ (function (_super) {
|
||||||
__extends(LiquidError, _super);
|
__extends(LiquidError, _super);
|
||||||
function LiquidError(err, token) {
|
function LiquidError(err, token) {
|
||||||
@@ -437,7 +367,7 @@ var Scope = /** @class */ (function () {
|
|||||||
var _this = this;
|
var _this = this;
|
||||||
var paths = this.propertyAccessSeq(path$$1);
|
var paths = this.propertyAccessSeq(path$$1);
|
||||||
var scope = this.findContextFor(paths[0]) || last(this.contexts);
|
var scope = this.findContextFor(paths[0]) || last(this.contexts);
|
||||||
return paths.reduce(function (value$$1, key) { return _this.readProperty(value$$1, key); }, scope);
|
return paths.reduce(function (value, key) { return _this.readProperty(value, key); }, scope);
|
||||||
};
|
};
|
||||||
Scope.prototype.set = function (path$$1, v) {
|
Scope.prototype.set = function (path$$1, v) {
|
||||||
var paths = this.propertyAccessSeq(path$$1);
|
var paths = this.propertyAccessSeq(path$$1);
|
||||||
@@ -473,11 +403,11 @@ var Scope = /** @class */ (function () {
|
|||||||
}
|
}
|
||||||
return this.contexts.splice(i, 1)[0];
|
return this.contexts.splice(i, 1)[0];
|
||||||
};
|
};
|
||||||
Scope.prototype.findContextFor = function (key, filter$$1) {
|
Scope.prototype.findContextFor = function (key, filter) {
|
||||||
if (filter$$1 === void 0) { filter$$1 = function () { return true; }; }
|
if (filter === void 0) { filter = function () { return true; }; }
|
||||||
for (var i = this.contexts.length - 1; i >= 0; i--) {
|
for (var i = this.contexts.length - 1; i >= 0; i--) {
|
||||||
var candidate = this.contexts[i];
|
var candidate = this.contexts[i];
|
||||||
if (!filter$$1(candidate))
|
if (!filter(candidate))
|
||||||
continue;
|
continue;
|
||||||
if (key in candidate) {
|
if (key in candidate) {
|
||||||
return candidate;
|
return candidate;
|
||||||
@@ -532,7 +462,7 @@ var Scope = /** @class */ (function () {
|
|||||||
j = matchRightBracket(str, i + 1);
|
j = matchRightBracket(str, i + 1);
|
||||||
assert(j !== -1, "unbalanced []: " + str);
|
assert(j !== -1, "unbalanced []: " + str);
|
||||||
name = str.slice(i + 1, j);
|
name = str.slice(i + 1, j);
|
||||||
if (!isInteger(name)) { // foo[bar] vs. foo[1]
|
if (!/^[+-]?\d+$/.test(name)) { // foo[bar] vs. foo[1]
|
||||||
name = String(this.get(name));
|
name = String(this.get(name));
|
||||||
}
|
}
|
||||||
push();
|
push();
|
||||||
@@ -726,6 +656,37 @@ var DelimitedToken = /** @class */ (function (_super) {
|
|||||||
return DelimitedToken;
|
return DelimitedToken;
|
||||||
}(Token));
|
}(Token));
|
||||||
|
|
||||||
|
// quote related
|
||||||
|
var singleQuoted = /'[^']*'/;
|
||||||
|
var doubleQuoted = /"[^"]*"/;
|
||||||
|
var quoted = new RegExp(singleQuoted.source + "|" + doubleQuoted.source);
|
||||||
|
var quoteBalanced = new RegExp("(?:" + quoted.source + "|[^'\"])*");
|
||||||
|
// basic types
|
||||||
|
var number = /[+-]?(?:\d+\.?\d*|\.?\d+)/;
|
||||||
|
var bool = /true|false/;
|
||||||
|
// property access
|
||||||
|
var identifier = /[\w-]+[?]?/;
|
||||||
|
var subscript = new RegExp("\\[(?:" + quoted.source + "|[\\w-\\.]+)\\]");
|
||||||
|
var literal = new RegExp("(?:" + quoted.source + "|" + bool.source + "|" + number.source + ")");
|
||||||
|
var variable = new RegExp(identifier.source + "(?:\\." + identifier.source + "|" + subscript.source + ")*");
|
||||||
|
// range related
|
||||||
|
var rangeLimit = new RegExp("(?:" + variable.source + "|" + number.source + ")");
|
||||||
|
var range$1 = new RegExp("\\(" + rangeLimit.source + "\\.\\." + rangeLimit.source + "\\)");
|
||||||
|
var rangeCapture = new RegExp("\\((" + rangeLimit.source + ")\\.\\.(" + rangeLimit.source + ")\\)");
|
||||||
|
var value = new RegExp("(?:" + variable.source + "|" + literal.source + "|" + range$1.source + ")");
|
||||||
|
// hash related
|
||||||
|
var hash = new RegExp("(?:" + identifier.source + ")\\s*:\\s*(?:" + value.source + ")");
|
||||||
|
var hashCapture = new RegExp("(" + identifier.source + ")\\s*:\\s*(" + value.source + ")", 'g');
|
||||||
|
// full match
|
||||||
|
var tagLine = new RegExp("^\\s*(" + identifier.source + ")\\s*([\\s\\S]*?)\\s*$");
|
||||||
|
var quotedLine = new RegExp("^" + quoted.source + "$");
|
||||||
|
var rangeLine = new RegExp("^" + rangeCapture.source + "$");
|
||||||
|
var operators = [
|
||||||
|
/\s+or\s+/,
|
||||||
|
/\s+and\s+/,
|
||||||
|
/==|!=|<=|>=|<|>|\s+contains\s+/
|
||||||
|
];
|
||||||
|
|
||||||
var TagToken = /** @class */ (function (_super) {
|
var TagToken = /** @class */ (function (_super) {
|
||||||
__extends(TagToken, _super);
|
__extends(TagToken, _super);
|
||||||
function TagToken(raw, value$$1, input, line, pos, file) {
|
function TagToken(raw, value$$1, input, line, pos, file) {
|
||||||
@@ -918,16 +879,18 @@ function evalExp(exp, scope) {
|
|||||||
return evalValue(exp, scope);
|
return evalValue(exp, scope);
|
||||||
}
|
}
|
||||||
function evalValue(str, scope) {
|
function evalValue(str, scope) {
|
||||||
str = str && str.trim();
|
|
||||||
if (!str)
|
if (!str)
|
||||||
return undefined;
|
return null;
|
||||||
if (isLiteral(str)) {
|
str = str.trim();
|
||||||
return parseLiteral(str);
|
if (str === 'true')
|
||||||
}
|
return true;
|
||||||
if (isVariable(str)) {
|
if (str === 'false')
|
||||||
|
return false;
|
||||||
|
if (!isNaN(Number(str)))
|
||||||
|
return Number(str);
|
||||||
|
if ((str[0] === '"' || str[0] === "'") && str[0] === last(str))
|
||||||
|
return str.slice(1, -1);
|
||||||
return scope.get(str);
|
return scope.get(str);
|
||||||
}
|
|
||||||
throw new TypeError("cannot eval '" + str + "' as value");
|
|
||||||
}
|
}
|
||||||
function isTruthy(val) {
|
function isTruthy(val) {
|
||||||
return !isFalsy(val);
|
return !isFalsy(val);
|
||||||
@@ -1005,39 +968,21 @@ var Tag = /** @class */ (function (_super) {
|
|||||||
return Tag;
|
return Tag;
|
||||||
}(Template));
|
}(Template));
|
||||||
|
|
||||||
var valueRE = new RegExp("" + value.source, 'g');
|
|
||||||
var Filter = /** @class */ (function () {
|
var Filter = /** @class */ (function () {
|
||||||
function Filter(str, strictFilters) {
|
function Filter(name, args, strictFilters) {
|
||||||
if (strictFilters === void 0) { strictFilters = false; }
|
|
||||||
var match = filterLine.exec(str);
|
|
||||||
assert(match, 'illegal filter: ' + str);
|
|
||||||
var name = match[1];
|
|
||||||
var argList = match[2] || '';
|
|
||||||
var impl = Filter.impls[name];
|
var impl = Filter.impls[name];
|
||||||
if (!impl && strictFilters)
|
if (!impl && strictFilters)
|
||||||
throw new TypeError("undefined filter: " + name);
|
throw new TypeError("undefined filter: " + name);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.impl = impl || (function (x) { return x; });
|
this.impl = impl || (function (x) { return x; });
|
||||||
this.args = this.parseArgs(argList);
|
this.args = args;
|
||||||
}
|
}
|
||||||
Filter.prototype.parseArgs = function (argList) {
|
Filter.prototype.render = function (value, scope) {
|
||||||
var match;
|
|
||||||
var args = [];
|
|
||||||
while ((match = valueRE.exec(argList.trim()))) {
|
|
||||||
var v = match[0];
|
|
||||||
var re = new RegExp(v + "\\s*:", 'g');
|
|
||||||
var keyMatch = re.exec(match.input);
|
|
||||||
var currentMatchIsKey = keyMatch && keyMatch.index === match.index;
|
|
||||||
currentMatchIsKey ? args.push("'" + v + "'") : args.push(v);
|
|
||||||
}
|
|
||||||
return args;
|
|
||||||
};
|
|
||||||
Filter.prototype.render = function (value$$1, scope) {
|
|
||||||
var args = this.args.map(function (arg) { return evalValue(arg, scope); });
|
var args = this.args.map(function (arg) { return evalValue(arg, scope); });
|
||||||
return this.impl.apply(null, [value$$1].concat(args));
|
return this.impl.apply(null, [value].concat(args));
|
||||||
};
|
};
|
||||||
Filter.register = function (name, filter$$1) {
|
Filter.register = function (name, filter) {
|
||||||
Filter.impls[name] = filter$$1;
|
Filter.impls[name] = filter;
|
||||||
};
|
};
|
||||||
Filter.clear = function () {
|
Filter.clear = function () {
|
||||||
Filter.impls = {};
|
Filter.impls = {};
|
||||||
@@ -1088,19 +1033,87 @@ var ParseStream = /** @class */ (function () {
|
|||||||
return ParseStream;
|
return ParseStream;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
var ParseState$1;
|
||||||
|
(function (ParseState) {
|
||||||
|
ParseState[ParseState["INIT"] = 0] = "INIT";
|
||||||
|
ParseState[ParseState["FILTER_NAME"] = 1] = "FILTER_NAME";
|
||||||
|
ParseState[ParseState["FILTER_ARG"] = 2] = "FILTER_ARG";
|
||||||
|
})(ParseState$1 || (ParseState$1 = {}));
|
||||||
var default_1 = /** @class */ (function () {
|
var default_1 = /** @class */ (function () {
|
||||||
|
/**
|
||||||
|
* @param str value string, like: "i have a dream | truncate: 3
|
||||||
|
*/
|
||||||
function default_1(str, strictFilters) {
|
function default_1(str, strictFilters) {
|
||||||
this.filters = [];
|
this.filters = [];
|
||||||
var match = matchValue(str);
|
var buffer = '';
|
||||||
assert(match, "illegal value string: " + str);
|
var quoted = '';
|
||||||
this.initial = match[0];
|
var state = ParseState$1.INIT;
|
||||||
str = str.substr(match.index + match[0].length);
|
var sealed = false;
|
||||||
while ((match = filter.exec(str))) {
|
var filterName = '';
|
||||||
this.filters.push(new Filter(match[0].trim(), strictFilters));
|
var filterArgs = [];
|
||||||
|
for (var i = 0; i < str.length; i++) {
|
||||||
|
if (quoted) {
|
||||||
|
if (str[i] === quoted) {
|
||||||
|
quoted = '';
|
||||||
|
sealed = true;
|
||||||
|
}
|
||||||
|
buffer += str[i];
|
||||||
|
}
|
||||||
|
else if (/\s/.test(str[i])) {
|
||||||
|
if (!buffer)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
sealed = true;
|
||||||
|
}
|
||||||
|
else if (str[i] === '|') {
|
||||||
|
if (state === ParseState$1.INIT) {
|
||||||
|
this.initial = buffer;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (state === ParseState$1.FILTER_NAME)
|
||||||
|
filterName = buffer;
|
||||||
|
else
|
||||||
|
filterArgs.push(buffer);
|
||||||
|
this.filters.push(new Filter(filterName, filterArgs, strictFilters));
|
||||||
|
filterName = '';
|
||||||
|
filterArgs = [];
|
||||||
|
}
|
||||||
|
state = ParseState$1.FILTER_NAME;
|
||||||
|
buffer = '';
|
||||||
|
sealed = false;
|
||||||
|
}
|
||||||
|
else if (state === ParseState$1.FILTER_NAME && str[i] === ':') {
|
||||||
|
filterName = buffer;
|
||||||
|
state = ParseState$1.FILTER_ARG;
|
||||||
|
buffer = '';
|
||||||
|
sealed = false;
|
||||||
|
}
|
||||||
|
else if (state === ParseState$1.FILTER_ARG && str[i] === ',') {
|
||||||
|
filterArgs.push(buffer);
|
||||||
|
buffer = '';
|
||||||
|
sealed = false;
|
||||||
|
}
|
||||||
|
else if (sealed)
|
||||||
|
continue;
|
||||||
|
else {
|
||||||
|
if ((str[i] === '"' || str[i] === "'") && !quoted)
|
||||||
|
quoted = str[i];
|
||||||
|
buffer += str[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (buffer) {
|
||||||
|
if (state === ParseState$1.INIT)
|
||||||
|
this.initial = buffer;
|
||||||
|
else if (state === ParseState$1.FILTER_NAME)
|
||||||
|
this.filters.push(new Filter(buffer, [], strictFilters));
|
||||||
|
else {
|
||||||
|
filterArgs.push(buffer);
|
||||||
|
this.filters.push(new Filter(filterName, filterArgs, strictFilters));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default_1.prototype.value = function (scope) {
|
default_1.prototype.value = function (scope) {
|
||||||
return this.filters.reduce(function (prev, filter$$1) { return filter$$1.render(prev, scope); }, evalExp(this.initial, scope));
|
return this.filters.reduce(function (prev, filter) { return filter.render(prev, scope); }, evalExp(this.initial, scope));
|
||||||
};
|
};
|
||||||
return default_1;
|
return default_1;
|
||||||
}());
|
}());
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+128
-115
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* [email protected].1, https://github.com/harttle/liquidjs
|
* [email protected].2, https://github.com/harttle/liquidjs
|
||||||
* (c) 2016-2019 harttle
|
* (c) 2016-2019 harttle
|
||||||
* Released under the MIT License.
|
* Released under the MIT License.
|
||||||
*/
|
*/
|
||||||
@@ -196,76 +196,6 @@
|
|||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// quote related
|
|
||||||
var singleQuoted = /'[^']*'/;
|
|
||||||
var doubleQuoted = /"[^"]*"/;
|
|
||||||
var quoted = new RegExp(singleQuoted.source + "|" + doubleQuoted.source);
|
|
||||||
var quoteBalanced = new RegExp("(?:" + quoted.source + "|[^'\"])*");
|
|
||||||
// basic types
|
|
||||||
var integer = /-?\d+/;
|
|
||||||
var number = /[+-]?(?:\d+\.?\d*|\.?\d+)/;
|
|
||||||
var bool = /true|false/;
|
|
||||||
// property access
|
|
||||||
var identifier = /[\w-]+[?]?/;
|
|
||||||
var subscript = new RegExp("\\[(?:" + quoted.source + "|[\\w-\\.]+)\\]");
|
|
||||||
var literal = new RegExp("(?:" + quoted.source + "|" + bool.source + "|" + number.source + ")");
|
|
||||||
var variable = new RegExp(identifier.source + "(?:\\." + identifier.source + "|" + subscript.source + ")*");
|
|
||||||
// range related
|
|
||||||
var rangeLimit = new RegExp("(?:" + variable.source + "|" + number.source + ")");
|
|
||||||
var range$1 = new RegExp("\\(" + rangeLimit.source + "\\.\\." + rangeLimit.source + "\\)");
|
|
||||||
var rangeCapture = new RegExp("\\((" + rangeLimit.source + ")\\.\\.(" + rangeLimit.source + ")\\)");
|
|
||||||
var value = new RegExp("(?:" + variable.source + "|" + literal.source + "|" + range$1.source + ")");
|
|
||||||
// hash related
|
|
||||||
var hash = new RegExp("(?:" + identifier.source + ")\\s*:\\s*(?:" + value.source + ")");
|
|
||||||
var hashCapture = new RegExp("(" + identifier.source + ")\\s*:\\s*(" + value.source + ")", 'g');
|
|
||||||
// full match
|
|
||||||
var tagLine = new RegExp("^\\s*(" + identifier.source + ")\\s*([\\s\\S]*?)\\s*$");
|
|
||||||
var literalLine = new RegExp("^" + literal.source + "$", 'i');
|
|
||||||
var variableLine = new RegExp("^" + variable.source + "$");
|
|
||||||
var numberLine = new RegExp("^" + number.source + "$");
|
|
||||||
var boolLine = new RegExp("^" + bool.source + "$", 'i');
|
|
||||||
var quotedLine = new RegExp("^" + quoted.source + "$");
|
|
||||||
var rangeLine = new RegExp("^" + rangeCapture.source + "$");
|
|
||||||
var integerLine = new RegExp("^" + integer.source + "$");
|
|
||||||
// filter related
|
|
||||||
var valueDeclaration = new RegExp("(?:" + identifier.source + "\\s*:\\s*)?" + value.source);
|
|
||||||
var valueList = new RegExp(valueDeclaration.source + "(\\s*,\\s*" + valueDeclaration.source + ")*");
|
|
||||||
var filter = new RegExp(identifier.source + "(?:\\s*:\\s*" + valueList.source + ")?", 'g');
|
|
||||||
var filterCapture = new RegExp("(" + identifier.source + ")(?:\\s*:\\s*(" + valueList.source + "))?");
|
|
||||||
var filterLine = new RegExp("^" + filterCapture.source + "$");
|
|
||||||
var operators = [
|
|
||||||
/\s+or\s+/,
|
|
||||||
/\s+and\s+/,
|
|
||||||
/==|!=|<=|>=|<|>|\s+contains\s+/
|
|
||||||
];
|
|
||||||
function isInteger(str) {
|
|
||||||
return integerLine.test(str);
|
|
||||||
}
|
|
||||||
function isLiteral(str) {
|
|
||||||
return literalLine.test(str);
|
|
||||||
}
|
|
||||||
function isVariable(str) {
|
|
||||||
return variableLine.test(str);
|
|
||||||
}
|
|
||||||
function matchValue(str) {
|
|
||||||
return value.exec(str);
|
|
||||||
}
|
|
||||||
function parseLiteral(str) {
|
|
||||||
var res = str.match(numberLine);
|
|
||||||
if (res) {
|
|
||||||
return Number(str);
|
|
||||||
}
|
|
||||||
res = str.match(boolLine);
|
|
||||||
if (res) {
|
|
||||||
return str.toLowerCase() === 'true';
|
|
||||||
}
|
|
||||||
res = str.match(quotedLine);
|
|
||||||
if (res) {
|
|
||||||
return str.slice(1, -1);
|
|
||||||
}
|
|
||||||
throw new TypeError("cannot parse '" + str + "' as literal");
|
|
||||||
}
|
|
||||||
|
|
||||||
var LiquidError = /** @class */ (function (_super) {
|
var LiquidError = /** @class */ (function (_super) {
|
||||||
__extends(LiquidError, _super);
|
__extends(LiquidError, _super);
|
||||||
function LiquidError(err, token) {
|
function LiquidError(err, token) {
|
||||||
@@ -425,7 +355,7 @@
|
|||||||
var _this = this;
|
var _this = this;
|
||||||
var paths = this.propertyAccessSeq(path);
|
var paths = this.propertyAccessSeq(path);
|
||||||
var scope = this.findContextFor(paths[0]) || last(this.contexts);
|
var scope = this.findContextFor(paths[0]) || last(this.contexts);
|
||||||
return paths.reduce(function (value$$1, key) { return _this.readProperty(value$$1, key); }, scope);
|
return paths.reduce(function (value, key) { return _this.readProperty(value, key); }, scope);
|
||||||
};
|
};
|
||||||
Scope.prototype.set = function (path, v) {
|
Scope.prototype.set = function (path, v) {
|
||||||
var paths = this.propertyAccessSeq(path);
|
var paths = this.propertyAccessSeq(path);
|
||||||
@@ -461,11 +391,11 @@
|
|||||||
}
|
}
|
||||||
return this.contexts.splice(i, 1)[0];
|
return this.contexts.splice(i, 1)[0];
|
||||||
};
|
};
|
||||||
Scope.prototype.findContextFor = function (key, filter$$1) {
|
Scope.prototype.findContextFor = function (key, filter) {
|
||||||
if (filter$$1 === void 0) { filter$$1 = function () { return true; }; }
|
if (filter === void 0) { filter = function () { return true; }; }
|
||||||
for (var i = this.contexts.length - 1; i >= 0; i--) {
|
for (var i = this.contexts.length - 1; i >= 0; i--) {
|
||||||
var candidate = this.contexts[i];
|
var candidate = this.contexts[i];
|
||||||
if (!filter$$1(candidate))
|
if (!filter(candidate))
|
||||||
continue;
|
continue;
|
||||||
if (key in candidate) {
|
if (key in candidate) {
|
||||||
return candidate;
|
return candidate;
|
||||||
@@ -520,7 +450,7 @@
|
|||||||
j = matchRightBracket(str, i + 1);
|
j = matchRightBracket(str, i + 1);
|
||||||
assert(j !== -1, "unbalanced []: " + str);
|
assert(j !== -1, "unbalanced []: " + str);
|
||||||
name = str.slice(i + 1, j);
|
name = str.slice(i + 1, j);
|
||||||
if (!isInteger(name)) { // foo[bar] vs. foo[1]
|
if (!/^[+-]?\d+$/.test(name)) { // foo[bar] vs. foo[1]
|
||||||
name = String(this.get(name));
|
name = String(this.get(name));
|
||||||
}
|
}
|
||||||
push();
|
push();
|
||||||
@@ -751,6 +681,37 @@
|
|||||||
return DelimitedToken;
|
return DelimitedToken;
|
||||||
}(Token));
|
}(Token));
|
||||||
|
|
||||||
|
// quote related
|
||||||
|
var singleQuoted = /'[^']*'/;
|
||||||
|
var doubleQuoted = /"[^"]*"/;
|
||||||
|
var quoted = new RegExp(singleQuoted.source + "|" + doubleQuoted.source);
|
||||||
|
var quoteBalanced = new RegExp("(?:" + quoted.source + "|[^'\"])*");
|
||||||
|
// basic types
|
||||||
|
var number = /[+-]?(?:\d+\.?\d*|\.?\d+)/;
|
||||||
|
var bool = /true|false/;
|
||||||
|
// property access
|
||||||
|
var identifier = /[\w-]+[?]?/;
|
||||||
|
var subscript = new RegExp("\\[(?:" + quoted.source + "|[\\w-\\.]+)\\]");
|
||||||
|
var literal = new RegExp("(?:" + quoted.source + "|" + bool.source + "|" + number.source + ")");
|
||||||
|
var variable = new RegExp(identifier.source + "(?:\\." + identifier.source + "|" + subscript.source + ")*");
|
||||||
|
// range related
|
||||||
|
var rangeLimit = new RegExp("(?:" + variable.source + "|" + number.source + ")");
|
||||||
|
var range$1 = new RegExp("\\(" + rangeLimit.source + "\\.\\." + rangeLimit.source + "\\)");
|
||||||
|
var rangeCapture = new RegExp("\\((" + rangeLimit.source + ")\\.\\.(" + rangeLimit.source + ")\\)");
|
||||||
|
var value = new RegExp("(?:" + variable.source + "|" + literal.source + "|" + range$1.source + ")");
|
||||||
|
// hash related
|
||||||
|
var hash = new RegExp("(?:" + identifier.source + ")\\s*:\\s*(?:" + value.source + ")");
|
||||||
|
var hashCapture = new RegExp("(" + identifier.source + ")\\s*:\\s*(" + value.source + ")", 'g');
|
||||||
|
// full match
|
||||||
|
var tagLine = new RegExp("^\\s*(" + identifier.source + ")\\s*([\\s\\S]*?)\\s*$");
|
||||||
|
var quotedLine = new RegExp("^" + quoted.source + "$");
|
||||||
|
var rangeLine = new RegExp("^" + rangeCapture.source + "$");
|
||||||
|
var operators = [
|
||||||
|
/\s+or\s+/,
|
||||||
|
/\s+and\s+/,
|
||||||
|
/==|!=|<=|>=|<|>|\s+contains\s+/
|
||||||
|
];
|
||||||
|
|
||||||
var TagToken = /** @class */ (function (_super) {
|
var TagToken = /** @class */ (function (_super) {
|
||||||
__extends(TagToken, _super);
|
__extends(TagToken, _super);
|
||||||
function TagToken(raw, value$$1, input, line, pos, file) {
|
function TagToken(raw, value$$1, input, line, pos, file) {
|
||||||
@@ -943,17 +904,19 @@
|
|||||||
return evalValue(exp, scope);
|
return evalValue(exp, scope);
|
||||||
}
|
}
|
||||||
function evalValue(str, scope) {
|
function evalValue(str, scope) {
|
||||||
str = str && str.trim();
|
|
||||||
if (!str)
|
if (!str)
|
||||||
return undefined;
|
return null;
|
||||||
if (isLiteral(str)) {
|
str = str.trim();
|
||||||
return parseLiteral(str);
|
if (str === 'true')
|
||||||
}
|
return true;
|
||||||
if (isVariable(str)) {
|
if (str === 'false')
|
||||||
|
return false;
|
||||||
|
if (!isNaN(Number(str)))
|
||||||
|
return Number(str);
|
||||||
|
if ((str[0] === '"' || str[0] === "'") && str[0] === last(str))
|
||||||
|
return str.slice(1, -1);
|
||||||
return scope.get(str);
|
return scope.get(str);
|
||||||
}
|
}
|
||||||
throw new TypeError("cannot eval '" + str + "' as value");
|
|
||||||
}
|
|
||||||
function isTruthy(val) {
|
function isTruthy(val) {
|
||||||
return !isFalsy(val);
|
return !isFalsy(val);
|
||||||
}
|
}
|
||||||
@@ -1030,39 +993,21 @@
|
|||||||
return Tag;
|
return Tag;
|
||||||
}(Template));
|
}(Template));
|
||||||
|
|
||||||
var valueRE = new RegExp("" + value.source, 'g');
|
|
||||||
var Filter = /** @class */ (function () {
|
var Filter = /** @class */ (function () {
|
||||||
function Filter(str, strictFilters) {
|
function Filter(name, args, strictFilters) {
|
||||||
if (strictFilters === void 0) { strictFilters = false; }
|
|
||||||
var match = filterLine.exec(str);
|
|
||||||
assert(match, 'illegal filter: ' + str);
|
|
||||||
var name = match[1];
|
|
||||||
var argList = match[2] || '';
|
|
||||||
var impl = Filter.impls[name];
|
var impl = Filter.impls[name];
|
||||||
if (!impl && strictFilters)
|
if (!impl && strictFilters)
|
||||||
throw new TypeError("undefined filter: " + name);
|
throw new TypeError("undefined filter: " + name);
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.impl = impl || (function (x) { return x; });
|
this.impl = impl || (function (x) { return x; });
|
||||||
this.args = this.parseArgs(argList);
|
this.args = args;
|
||||||
}
|
}
|
||||||
Filter.prototype.parseArgs = function (argList) {
|
Filter.prototype.render = function (value, scope) {
|
||||||
var match;
|
|
||||||
var args = [];
|
|
||||||
while ((match = valueRE.exec(argList.trim()))) {
|
|
||||||
var v = match[0];
|
|
||||||
var re = new RegExp(v + "\\s*:", 'g');
|
|
||||||
var keyMatch = re.exec(match.input);
|
|
||||||
var currentMatchIsKey = keyMatch && keyMatch.index === match.index;
|
|
||||||
currentMatchIsKey ? args.push("'" + v + "'") : args.push(v);
|
|
||||||
}
|
|
||||||
return args;
|
|
||||||
};
|
|
||||||
Filter.prototype.render = function (value$$1, scope) {
|
|
||||||
var args = this.args.map(function (arg) { return evalValue(arg, scope); });
|
var args = this.args.map(function (arg) { return evalValue(arg, scope); });
|
||||||
return this.impl.apply(null, [value$$1].concat(args));
|
return this.impl.apply(null, [value].concat(args));
|
||||||
};
|
};
|
||||||
Filter.register = function (name, filter$$1) {
|
Filter.register = function (name, filter) {
|
||||||
Filter.impls[name] = filter$$1;
|
Filter.impls[name] = filter;
|
||||||
};
|
};
|
||||||
Filter.clear = function () {
|
Filter.clear = function () {
|
||||||
Filter.impls = {};
|
Filter.impls = {};
|
||||||
@@ -1113,19 +1058,87 @@
|
|||||||
return ParseStream;
|
return ParseStream;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
var ParseState$1;
|
||||||
|
(function (ParseState) {
|
||||||
|
ParseState[ParseState["INIT"] = 0] = "INIT";
|
||||||
|
ParseState[ParseState["FILTER_NAME"] = 1] = "FILTER_NAME";
|
||||||
|
ParseState[ParseState["FILTER_ARG"] = 2] = "FILTER_ARG";
|
||||||
|
})(ParseState$1 || (ParseState$1 = {}));
|
||||||
var default_1 = /** @class */ (function () {
|
var default_1 = /** @class */ (function () {
|
||||||
|
/**
|
||||||
|
* @param str value string, like: "i have a dream | truncate: 3
|
||||||
|
*/
|
||||||
function default_1(str, strictFilters) {
|
function default_1(str, strictFilters) {
|
||||||
this.filters = [];
|
this.filters = [];
|
||||||
var match = matchValue(str);
|
var buffer = '';
|
||||||
assert(match, "illegal value string: " + str);
|
var quoted = '';
|
||||||
this.initial = match[0];
|
var state = ParseState$1.INIT;
|
||||||
str = str.substr(match.index + match[0].length);
|
var sealed = false;
|
||||||
while ((match = filter.exec(str))) {
|
var filterName = '';
|
||||||
this.filters.push(new Filter(match[0].trim(), strictFilters));
|
var filterArgs = [];
|
||||||
|
for (var i = 0; i < str.length; i++) {
|
||||||
|
if (quoted) {
|
||||||
|
if (str[i] === quoted) {
|
||||||
|
quoted = '';
|
||||||
|
sealed = true;
|
||||||
|
}
|
||||||
|
buffer += str[i];
|
||||||
|
}
|
||||||
|
else if (/\s/.test(str[i])) {
|
||||||
|
if (!buffer)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
sealed = true;
|
||||||
|
}
|
||||||
|
else if (str[i] === '|') {
|
||||||
|
if (state === ParseState$1.INIT) {
|
||||||
|
this.initial = buffer;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (state === ParseState$1.FILTER_NAME)
|
||||||
|
filterName = buffer;
|
||||||
|
else
|
||||||
|
filterArgs.push(buffer);
|
||||||
|
this.filters.push(new Filter(filterName, filterArgs, strictFilters));
|
||||||
|
filterName = '';
|
||||||
|
filterArgs = [];
|
||||||
|
}
|
||||||
|
state = ParseState$1.FILTER_NAME;
|
||||||
|
buffer = '';
|
||||||
|
sealed = false;
|
||||||
|
}
|
||||||
|
else if (state === ParseState$1.FILTER_NAME && str[i] === ':') {
|
||||||
|
filterName = buffer;
|
||||||
|
state = ParseState$1.FILTER_ARG;
|
||||||
|
buffer = '';
|
||||||
|
sealed = false;
|
||||||
|
}
|
||||||
|
else if (state === ParseState$1.FILTER_ARG && str[i] === ',') {
|
||||||
|
filterArgs.push(buffer);
|
||||||
|
buffer = '';
|
||||||
|
sealed = false;
|
||||||
|
}
|
||||||
|
else if (sealed)
|
||||||
|
continue;
|
||||||
|
else {
|
||||||
|
if ((str[i] === '"' || str[i] === "'") && !quoted)
|
||||||
|
quoted = str[i];
|
||||||
|
buffer += str[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (buffer) {
|
||||||
|
if (state === ParseState$1.INIT)
|
||||||
|
this.initial = buffer;
|
||||||
|
else if (state === ParseState$1.FILTER_NAME)
|
||||||
|
this.filters.push(new Filter(buffer, [], strictFilters));
|
||||||
|
else {
|
||||||
|
filterArgs.push(buffer);
|
||||||
|
this.filters.push(new Filter(filterName, filterArgs, strictFilters));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default_1.prototype.value = function (scope) {
|
default_1.prototype.value = function (scope) {
|
||||||
return this.filters.reduce(function (prev, filter$$1) { return filter$$1.render(prev, scope); }, evalExp(this.initial, scope));
|
return this.filters.reduce(function (prev, filter) { return filter.render(prev, scope); }, evalExp(this.initial, scope));
|
||||||
};
|
};
|
||||||
return default_1;
|
return default_1;
|
||||||
}());
|
}());
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+43
@@ -0,0 +1,43 @@
|
|||||||
|
declare const _default: ({
|
||||||
|
output: {
|
||||||
|
file: string;
|
||||||
|
name: string;
|
||||||
|
format: string;
|
||||||
|
sourcemap: boolean;
|
||||||
|
banner: string;
|
||||||
|
}[];
|
||||||
|
external: string[];
|
||||||
|
plugins: import("rollup").Plugin[];
|
||||||
|
treeshake: {
|
||||||
|
propertyReadSideEffects: boolean;
|
||||||
|
};
|
||||||
|
input: string;
|
||||||
|
} | {
|
||||||
|
output: {
|
||||||
|
file: string;
|
||||||
|
name: string;
|
||||||
|
format: string;
|
||||||
|
sourcemap: boolean;
|
||||||
|
banner: string;
|
||||||
|
}[];
|
||||||
|
plugins: any[];
|
||||||
|
treeshake: {
|
||||||
|
propertyReadSideEffects: boolean;
|
||||||
|
};
|
||||||
|
input: string;
|
||||||
|
external?: undefined;
|
||||||
|
} | {
|
||||||
|
output: {
|
||||||
|
file: string;
|
||||||
|
name: string;
|
||||||
|
format: string;
|
||||||
|
sourcemap: boolean;
|
||||||
|
}[];
|
||||||
|
plugins: any[];
|
||||||
|
treeshake: {
|
||||||
|
propertyReadSideEffects: boolean;
|
||||||
|
};
|
||||||
|
input: string;
|
||||||
|
external?: undefined;
|
||||||
|
})[];
|
||||||
|
export default _default;
|
||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
declare const _default: {
|
||||||
|
'join': (v: any[], arg: string) => string;
|
||||||
|
'last': <T>(v: T[]) => T;
|
||||||
|
'first': <T>(v: T[]) => T;
|
||||||
|
'map': <T1, T2>(arr: {
|
||||||
|
[key: string]: T1;
|
||||||
|
}[], arg: string) => T1[];
|
||||||
|
'reverse': (v: any[]) => any[];
|
||||||
|
'sort': <T>(v: T[], arg: (lhs: T, rhs: T) => number) => T[];
|
||||||
|
'size': (v: string | any[]) => number;
|
||||||
|
'concat': <T1, T2>(v: T1[], arg: T2 | T2[]) => (T1 | T2)[];
|
||||||
|
'slice': <T>(v: T[], begin: number, length: number) => T[];
|
||||||
|
'uniq': <T>(arr: T[]) => T[];
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
declare const _default: {
|
||||||
|
'date': (v: string | Date, arg: string) => string | Date;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
declare function escape(str: string): string;
|
||||||
|
declare const _default: {
|
||||||
|
'escape': typeof escape;
|
||||||
|
'escape_once': (str: string) => string;
|
||||||
|
'newline_to_br': (v: string) => string;
|
||||||
|
'strip_html': (v: string) => string;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+32
@@ -0,0 +1,32 @@
|
|||||||
|
declare const _default: {
|
||||||
|
'join': (v: any[], arg: string) => string;
|
||||||
|
'last': <T>(v: T[]) => T;
|
||||||
|
'first': <T>(v: T[]) => T;
|
||||||
|
'map': <T1, T2>(arr: {
|
||||||
|
[key: string]: T1;
|
||||||
|
}[], arg: string) => T1[];
|
||||||
|
'reverse': (v: any[]) => any[];
|
||||||
|
'sort': <T>(v: T[], arg: (lhs: T, rhs: T) => number) => T[];
|
||||||
|
'size': (v: string | any[]) => number;
|
||||||
|
'concat': <T1, T2>(v: T1[], arg: T2 | T2[]) => (T1 | T2)[];
|
||||||
|
'slice': <T>(v: T[], begin: number, length: number) => T[];
|
||||||
|
'uniq': <T>(arr: T[]) => T[];
|
||||||
|
'default': <T1, T2>(v: T1, arg: T2) => T1 | T2;
|
||||||
|
'date': (v: string | Date, arg: string) => string | Date;
|
||||||
|
'url_decode': (x: string) => string;
|
||||||
|
'url_encode': (x: string) => string;
|
||||||
|
'abs': (v: number) => number;
|
||||||
|
'ceil': (v: number) => number;
|
||||||
|
'divided_by': (v: number, arg: number) => number;
|
||||||
|
'floor': (v: number) => number;
|
||||||
|
'minus': (l: number, r: number) => string;
|
||||||
|
'modulo': (l: number, r: number) => string;
|
||||||
|
'round': (v: number, arg?: number) => number;
|
||||||
|
'plus': (l: number, r: number) => string;
|
||||||
|
'times': (v: number, arg: number) => number;
|
||||||
|
'escape': (str: string) => string;
|
||||||
|
'escape_once': (str: string) => string;
|
||||||
|
'newline_to_br': (v: string) => string;
|
||||||
|
'strip_html': (v: string) => string;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
declare const _default: {
|
||||||
|
'abs': (v: number) => number;
|
||||||
|
'ceil': (v: number) => number;
|
||||||
|
'divided_by': (v: number, arg: number) => number;
|
||||||
|
'floor': (v: number) => number;
|
||||||
|
'minus': (l: number, r: number) => string;
|
||||||
|
'modulo': (l: number, r: number) => string;
|
||||||
|
'round': (v: number, arg?: number) => number;
|
||||||
|
'plus': (l: number, r: number) => string;
|
||||||
|
'times': (v: number, arg: number) => number;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
declare const _default: {
|
||||||
|
'default': <T1, T2>(v: T1, arg: T2) => T1 | T2;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
import { FilterImpl } from 'src/template/filter/filter-impl';
|
||||||
|
declare const _default: {
|
||||||
|
[key: string]: FilterImpl;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
declare const _default: {
|
||||||
|
'url_decode': (x: string) => string;
|
||||||
|
'url_encode': (x: string) => string;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
declare const _default: {
|
||||||
|
render: () => Promise<never>;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
declare const _default: {
|
||||||
|
render: () => Promise<never>;
|
||||||
|
};
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const tags: {
|
||||||
|
[key: string]: ITagImplOptions;
|
||||||
|
};
|
||||||
|
export default tags;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import ITagImplOptions from 'src/template/tag/itag-impl-options';
|
||||||
|
declare const _default: ITagImplOptions;
|
||||||
|
export default _default;
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import IFS from './ifs';
|
||||||
|
declare const _default: IFS;
|
||||||
|
export default _default;
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
export default interface IFS {
|
||||||
|
exists: (filepath: string) => Promise<boolean>;
|
||||||
|
readFile: (filepath: string) => Promise<string>;
|
||||||
|
resolve: (root: string, file: string, ext: string) => string;
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import IFS from './ifs';
|
||||||
|
declare const fs: IFS;
|
||||||
|
export default fs;
|
||||||
Vendored
+53
@@ -0,0 +1,53 @@
|
|||||||
|
export interface LiquidOptions {
|
||||||
|
/** `root` is a directory or an array of directories to resolve layouts and includes, as well as the filename passed in when calling `.renderFile()`. If an array, the files are looked up in the order they occur in the array. Defaults to `["."]` */
|
||||||
|
root?: string | string[];
|
||||||
|
/** `extname` is used to lookup the template file when filepath doesn't include an extension name. Eg: setting to `".html"` will allow including file by basename. Defaults to `""`. */
|
||||||
|
extname?: string;
|
||||||
|
/** `cache` indicates whether or not to cache resolved templates. Defaults to `false`. */
|
||||||
|
cache?: boolean;
|
||||||
|
/** `dynamicPartials`: if set, treat `<filepath>` parameter in `{%include filepath %}`, `{%layout filepath%}` as a variable, otherwise as a literal value. Defaults to `true`. */
|
||||||
|
dynamicPartials?: boolean;
|
||||||
|
/** `strict_filters` is used to enable strict filter existence. If set to `false`, undefined filters will be rendered as empty string. Otherwise, undefined filters will cause an exception. Defaults to `false`. */
|
||||||
|
strict_filters?: boolean;
|
||||||
|
/** `strict_variables` is used to enable strict variable derivation. If set to `false`, undefined variables will be rendered as empty string. Otherwise, undefined variables will cause an exception. Defaults to `false`. */
|
||||||
|
strict_variables?: boolean;
|
||||||
|
/** `trim_tag_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of tags (`{% %}`) until `\n` (inclusive). Defaults to `false`. */
|
||||||
|
trim_tag_right?: boolean;
|
||||||
|
/** `trim_tag_left` is similar to `trim_tag_right`, whereas the `\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */
|
||||||
|
trim_tag_left?: boolean;
|
||||||
|
/** ``trim_output_right` is used to strip blank characters (including ` `, `\t`, and `\r`) from the right of values (`{{ }}`) until `\n` (inclusive). Defaults to `false`. */
|
||||||
|
trim_output_right?: boolean;
|
||||||
|
/** `trim_output_left` is similar to `trim_output_right`, whereas the `\n` is exclusive. Defaults to `false`. See Whitespace Control for details. */
|
||||||
|
trim_output_left?: boolean;
|
||||||
|
/** `tag_delimiter_left` and `tag_delimiter_right` are used to override the delimiter for liquid tags **/
|
||||||
|
tag_delimiter_left?: string;
|
||||||
|
tag_delimiter_right?: string;
|
||||||
|
/** `output_delimiter_left` and `output_delimiter_right` are used to override the delimiter for liquid outputs **/
|
||||||
|
output_delimiter_left?: string;
|
||||||
|
output_delimiter_right?: string;
|
||||||
|
/** `greedy` is used to specify whether `trim_left`/`trim_right` is greedy. When set to `true`, all consecutive blank characters including `\n` will be trimed regardless of line breaks. Defaults to `true`. */
|
||||||
|
greedy?: boolean;
|
||||||
|
}
|
||||||
|
interface NormalizedOptions extends LiquidOptions {
|
||||||
|
root?: string[];
|
||||||
|
}
|
||||||
|
export interface NormalizedFullOptions extends NormalizedOptions {
|
||||||
|
root: string[];
|
||||||
|
extname: string;
|
||||||
|
cache: boolean;
|
||||||
|
dynamicPartials: boolean;
|
||||||
|
strict_filters: boolean;
|
||||||
|
strict_variables: boolean;
|
||||||
|
trim_tag_right: boolean;
|
||||||
|
trim_tag_left: boolean;
|
||||||
|
trim_output_right: boolean;
|
||||||
|
trim_output_left: boolean;
|
||||||
|
tag_delimiter_left: string;
|
||||||
|
tag_delimiter_right: string;
|
||||||
|
output_delimiter_left: string;
|
||||||
|
output_delimiter_right: string;
|
||||||
|
greedy: boolean;
|
||||||
|
}
|
||||||
|
export declare function normalize(options?: LiquidOptions): NormalizedOptions;
|
||||||
|
export declare function applyDefault(options?: NormalizedOptions): NormalizedFullOptions;
|
||||||
|
export {};
|
||||||
Vendored
+33
@@ -0,0 +1,33 @@
|
|||||||
|
import Scope from './scope/scope';
|
||||||
|
import * as Types from './types';
|
||||||
|
import ITemplate from './template/itemplate';
|
||||||
|
import Render from './render/render';
|
||||||
|
import Parser from './parser/parser';
|
||||||
|
import ITagImplOptions from './template/tag/itag-impl-options';
|
||||||
|
import { isTruthy, isFalsy, evalExp, evalValue } from './render/syntax';
|
||||||
|
import { LiquidOptions, NormalizedFullOptions } from './liquid-options';
|
||||||
|
import { FilterImpl } from './template/filter/filter-impl';
|
||||||
|
export default class Liquid {
|
||||||
|
options: NormalizedFullOptions;
|
||||||
|
renderer: Render;
|
||||||
|
parser: Parser;
|
||||||
|
private cache;
|
||||||
|
private tokenizer;
|
||||||
|
constructor(opts?: LiquidOptions);
|
||||||
|
parse(html: string, filepath?: string): ITemplate[];
|
||||||
|
render(tpl: Array<ITemplate>, ctx?: object, opts?: LiquidOptions): Promise<string>;
|
||||||
|
parseAndRender(html: string, ctx?: object, opts?: LiquidOptions): Promise<string>;
|
||||||
|
getTemplate(file: string, opts?: LiquidOptions): Promise<any>;
|
||||||
|
renderFile(file: string, ctx?: object, opts?: LiquidOptions): Promise<string>;
|
||||||
|
evalValue(str: string, scope: Scope): any;
|
||||||
|
registerFilter(name: string, filter: FilterImpl): void;
|
||||||
|
registerTag(name: string, tag: ITagImplOptions): void;
|
||||||
|
plugin(plugin: (this: Liquid, L: typeof Liquid) => void): void;
|
||||||
|
express(): (this: any, filePath: string, ctx: object, cb: (err: Error | null, html?: string | undefined) => void) => void;
|
||||||
|
static default: typeof Liquid;
|
||||||
|
static isTruthy: typeof isTruthy;
|
||||||
|
static isFalsy: typeof isFalsy;
|
||||||
|
static evalExp: typeof evalExp;
|
||||||
|
static evalValue: typeof evalValue;
|
||||||
|
static Types: typeof Types;
|
||||||
|
}
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
import Token from './token';
|
||||||
|
export default class DelimitedToken extends Token {
|
||||||
|
trimLeft: boolean;
|
||||||
|
trimRight: boolean;
|
||||||
|
constructor(raw: string, value: string, input: string, line: number, pos: number, file?: string);
|
||||||
|
}
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
import Token from './token';
|
||||||
|
export default class HTMLToken extends Token {
|
||||||
|
constructor(str: string, input: string, line: number, col: number, file?: string);
|
||||||
|
}
|
||||||
Vendored
+21
@@ -0,0 +1,21 @@
|
|||||||
|
export declare const quoted: RegExp;
|
||||||
|
export declare const quoteBalanced: RegExp;
|
||||||
|
export declare const number: RegExp;
|
||||||
|
export declare const bool: RegExp;
|
||||||
|
export declare const identifier: RegExp;
|
||||||
|
export declare const subscript: RegExp;
|
||||||
|
export declare const literal: RegExp;
|
||||||
|
export declare const variable: RegExp;
|
||||||
|
export declare const rangeLimit: RegExp;
|
||||||
|
export declare const range: RegExp;
|
||||||
|
export declare const rangeCapture: RegExp;
|
||||||
|
export declare const value: RegExp;
|
||||||
|
export declare const hash: RegExp;
|
||||||
|
export declare const hashCapture: RegExp;
|
||||||
|
export declare const tagLine: RegExp;
|
||||||
|
export declare const numberLine: RegExp;
|
||||||
|
export declare const boolLine: RegExp;
|
||||||
|
export declare const quotedLine: RegExp;
|
||||||
|
export declare const rangeLine: RegExp;
|
||||||
|
export declare const operators: RegExp[];
|
||||||
|
export declare function isRange(str: string): boolean;
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
import DelimitedToken from './delimited-token';
|
||||||
|
export default class OutputToken extends DelimitedToken {
|
||||||
|
constructor(raw: string, value: string, input: string, line: number, pos: number, file?: string);
|
||||||
|
}
|
||||||
Vendored
+15
@@ -0,0 +1,15 @@
|
|||||||
|
import Token from 'src/parser/token';
|
||||||
|
import ITemplate from 'src/template/itemplate';
|
||||||
|
declare type ParseToken = ((token: Token, remainTokens: Array<Token>) => ITemplate);
|
||||||
|
export default class ParseStream {
|
||||||
|
private tokens;
|
||||||
|
private handlers;
|
||||||
|
private stopRequested;
|
||||||
|
private parseToken;
|
||||||
|
constructor(tokens: Array<Token>, parseToken: ParseToken);
|
||||||
|
on<T extends ITemplate | Token | undefined>(name: string, cb: (arg: T) => void): ParseStream;
|
||||||
|
trigger<T extends Token | ITemplate>(event: string, arg?: T): boolean;
|
||||||
|
start(): this;
|
||||||
|
stop(): this;
|
||||||
|
}
|
||||||
|
export {};
|
||||||
Vendored
+14
@@ -0,0 +1,14 @@
|
|||||||
|
import Liquid from 'src/liquid';
|
||||||
|
import ParseStream from './parse-stream';
|
||||||
|
import Token from './token';
|
||||||
|
import Tag from 'src/template/tag/tag';
|
||||||
|
import Output from 'src/template/output';
|
||||||
|
import HTML from 'src/template/html';
|
||||||
|
import ITemplate from 'src/template/itemplate';
|
||||||
|
export default class Parser {
|
||||||
|
liquid: Liquid;
|
||||||
|
constructor(liquid: Liquid);
|
||||||
|
parse(tokens: Array<Token>): ITemplate[];
|
||||||
|
parseToken(token: Token, remainTokens: Array<Token>): Tag | Output | HTML;
|
||||||
|
parseStream(tokens: Array<Token>): ParseStream;
|
||||||
|
}
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
import DelimitedToken from './delimited-token';
|
||||||
|
export default class TagToken extends DelimitedToken {
|
||||||
|
name: string;
|
||||||
|
args: string;
|
||||||
|
constructor(raw: string, value: string, input: string, line: number, pos: number, file?: string);
|
||||||
|
}
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
export default class Token {
|
||||||
|
type: string;
|
||||||
|
line: number;
|
||||||
|
col: number;
|
||||||
|
raw: string;
|
||||||
|
input: string;
|
||||||
|
file?: string;
|
||||||
|
value: string;
|
||||||
|
constructor(raw: string, input: string, line: number, col: number, file?: string);
|
||||||
|
}
|
||||||
Vendored
+7
@@ -0,0 +1,7 @@
|
|||||||
|
import Token from './token';
|
||||||
|
import { NormalizedFullOptions } from '../liquid-options';
|
||||||
|
export default class Tokenizer {
|
||||||
|
options: NormalizedFullOptions;
|
||||||
|
constructor(options?: NormalizedFullOptions);
|
||||||
|
tokenize(input: string, file?: string): Token[];
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
import Token from 'src/parser/token';
|
||||||
|
import { NormalizedFullOptions } from 'src/liquid-options';
|
||||||
|
export default function whiteSpaceCtrl(tokens: Token[], options: NormalizedFullOptions): void;
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
import ITemplate from 'src/template/itemplate';
|
||||||
|
export default class Render {
|
||||||
|
renderTemplates(templates: ITemplate[], scope: Scope): Promise<string>;
|
||||||
|
}
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
export declare function evalExp(exp: string, scope: Scope): any;
|
||||||
|
export declare function evalValue(str: string, scope: Scope): any;
|
||||||
|
export declare function isTruthy(val: any): boolean;
|
||||||
|
export declare function isFalsy(val: any): boolean;
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
declare enum BlockMode {
|
||||||
|
OUTPUT = 0,
|
||||||
|
STORE = 1
|
||||||
|
}
|
||||||
|
export default BlockMode;
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
export default interface IContext {
|
||||||
|
[key: string]: any;
|
||||||
|
liquid_method_missing?: (key: string) => any;
|
||||||
|
}
|
||||||
Vendored
+22
@@ -0,0 +1,22 @@
|
|||||||
|
import { NormalizedFullOptions } from '../liquid-options';
|
||||||
|
import BlockMode from './block-mode';
|
||||||
|
import IContext from './icontext';
|
||||||
|
export default class Scope {
|
||||||
|
opts: NormalizedFullOptions;
|
||||||
|
contexts: Array<IContext>;
|
||||||
|
blocks: object;
|
||||||
|
groups: {
|
||||||
|
[key: string]: number;
|
||||||
|
};
|
||||||
|
blockMode: BlockMode;
|
||||||
|
constructor(ctx?: object, opts?: NormalizedFullOptions);
|
||||||
|
getAll(): IContext;
|
||||||
|
get(path: string): any;
|
||||||
|
set(path: string, v: any): void;
|
||||||
|
unshift(ctx: object): number;
|
||||||
|
push(ctx: object): number;
|
||||||
|
pop(ctx?: object): object | undefined;
|
||||||
|
findContextFor(key: string, filter?: ((conttext: object) => boolean)): IContext | null;
|
||||||
|
private readProperty;
|
||||||
|
propertyAccessSeq(str: string): string[];
|
||||||
|
}
|
||||||
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
export declare class CaptureScope {
|
||||||
|
}
|
||||||
|
export declare class AssignScope {
|
||||||
|
}
|
||||||
|
export declare class IncrementScope {
|
||||||
|
}
|
||||||
|
export declare class DecrementScope {
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
export declare type FilterImpl = (value: any, ...args: any[]) => any;
|
||||||
Vendored
+12
@@ -0,0 +1,12 @@
|
|||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
import { FilterImpl } from './filter-impl';
|
||||||
|
export default class Filter {
|
||||||
|
name: string;
|
||||||
|
impl: FilterImpl;
|
||||||
|
args: string[];
|
||||||
|
private static impls;
|
||||||
|
constructor(name: string, args: string[], strictFilters: boolean);
|
||||||
|
render(value: any, scope: Scope): any;
|
||||||
|
static register(name: string, filter: FilterImpl): void;
|
||||||
|
static clear(): void;
|
||||||
|
}
|
||||||
Vendored
+8
@@ -0,0 +1,8 @@
|
|||||||
|
import Template from 'src/template/template';
|
||||||
|
import ITemplate from 'src/template/itemplate';
|
||||||
|
import HTMLToken from 'src/parser/html-token';
|
||||||
|
export default class extends Template<HTMLToken> implements ITemplate {
|
||||||
|
str: string;
|
||||||
|
constructor(token: HTMLToken);
|
||||||
|
render(): Promise<string>;
|
||||||
|
}
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
import Token from 'src/parser/token';
|
||||||
|
export default interface ITemplate {
|
||||||
|
token: Token;
|
||||||
|
render(scope: Scope): Promise<string>;
|
||||||
|
}
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
import Value from './value';
|
||||||
|
import Template from 'src/template/template';
|
||||||
|
import ITemplate from 'src/template/itemplate';
|
||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
import OutputToken from 'src/parser/output-token';
|
||||||
|
export default class Output extends Template<OutputToken> implements ITemplate {
|
||||||
|
value: Value;
|
||||||
|
constructor(token: OutputToken, strictFilters: boolean);
|
||||||
|
render(scope: Scope): Promise<string>;
|
||||||
|
}
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
/**
|
||||||
|
* Key-Value Pairs Representing Tag Arguments
|
||||||
|
* Example:
|
||||||
|
* For the markup `{% include 'head.html' foo='bar' %}`,
|
||||||
|
* hash['foo'] === 'bar'
|
||||||
|
*/
|
||||||
|
export default class Hash {
|
||||||
|
[key: string]: any;
|
||||||
|
constructor(markup: string, scope: Scope);
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
import TagToken from 'src/parser/tag-token';
|
||||||
|
import Token from 'src/parser/token';
|
||||||
|
import Hash from 'src/template/tag/hash';
|
||||||
|
import ITagImpl from './itag-impl';
|
||||||
|
export default interface ITagImplOptions {
|
||||||
|
parse?: (this: ITagImpl, token: TagToken, remainingTokens: Array<Token>) => void;
|
||||||
|
render?: (this: ITagImpl, scope: Scope, hash: Hash) => any | Promise<any>;
|
||||||
|
}
|
||||||
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
import Liquid from 'src/liquid';
|
||||||
|
import ITagImplOptions from './itag-impl-options';
|
||||||
|
export default interface ITagImpl extends ITagImplOptions {
|
||||||
|
liquid: Liquid;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
Vendored
+18
@@ -0,0 +1,18 @@
|
|||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
import ITagImplOptions from './itag-impl-options';
|
||||||
|
import Liquid from 'src/liquid';
|
||||||
|
import Template from 'src/template/template';
|
||||||
|
import ITemplate from 'src/template/itemplate';
|
||||||
|
import TagToken from 'src/parser/tag-token';
|
||||||
|
import Token from 'src/parser/token';
|
||||||
|
export default class Tag extends Template<TagToken> implements ITemplate {
|
||||||
|
name: string;
|
||||||
|
private impl;
|
||||||
|
static impls: {
|
||||||
|
[key: string]: ITagImplOptions;
|
||||||
|
};
|
||||||
|
constructor(token: TagToken, tokens: Token[], liquid: Liquid);
|
||||||
|
render(scope: Scope): Promise<string>;
|
||||||
|
static register(name: string, tag: ITagImplOptions): void;
|
||||||
|
static clear(): void;
|
||||||
|
}
|
||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
export default abstract class Template<T> {
|
||||||
|
token: T;
|
||||||
|
constructor(token: T);
|
||||||
|
}
|
||||||
Vendored
+11
@@ -0,0 +1,11 @@
|
|||||||
|
import Filter from './filter/filter';
|
||||||
|
import Scope from 'src/scope/scope';
|
||||||
|
export default class {
|
||||||
|
initial: any;
|
||||||
|
filters: Array<Filter>;
|
||||||
|
/**
|
||||||
|
* @param str value string, like: "i have a dream | truncate: 3
|
||||||
|
*/
|
||||||
|
constructor(str: string, strictFilters: boolean);
|
||||||
|
value(scope: Scope): any;
|
||||||
|
}
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
export { AssignScope, CaptureScope, IncrementScope, DecrementScope } from './scope/scopes';
|
||||||
|
export { ParseError, TokenizationError, RenderBreakError, AssertionError } from './util/error';
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export default function (predicate: any, message?: string): void;
|
||||||
Vendored
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import Token from 'src/parser/token';
|
||||||
|
import ITemplate from 'src/template/itemplate';
|
||||||
|
declare abstract class LiquidError extends Error {
|
||||||
|
private token;
|
||||||
|
private originalError;
|
||||||
|
constructor(err: Error, token: Token);
|
||||||
|
protected update(): void;
|
||||||
|
}
|
||||||
|
export declare class TokenizationError extends LiquidError {
|
||||||
|
constructor(message: string, token: Token);
|
||||||
|
}
|
||||||
|
export declare class ParseError extends LiquidError {
|
||||||
|
constructor(err: Error, token: Token);
|
||||||
|
}
|
||||||
|
export declare class RenderError extends LiquidError {
|
||||||
|
constructor(err: Error, tpl: ITemplate);
|
||||||
|
}
|
||||||
|
export declare class RenderBreakError extends Error {
|
||||||
|
resolvedHTML: string;
|
||||||
|
constructor(message: string);
|
||||||
|
}
|
||||||
|
export declare class AssertionError extends Error {
|
||||||
|
constructor(message: string);
|
||||||
|
}
|
||||||
|
export {};
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export declare function mapSeries<T1, T2>(iterable: T1[], iteratee: (item: T1, idx: number, iterable: T1[]) => Promise<T2> | T2): Promise<T2[]>;
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
export default function (d: Date, format: string): string;
|
||||||
Vendored
+21
@@ -0,0 +1,21 @@
|
|||||||
|
export declare function isString(value: any): boolean;
|
||||||
|
export declare function isFunction(value: any): boolean;
|
||||||
|
export declare function promisify<T1, T2>(fn: (arg1: T1, cb: (err: Error | null, result: T2) => void) => void): (arg1: T1) => Promise<T2>;
|
||||||
|
export declare function promisify<T1, T2, T3>(fn: (arg1: T1, arg2: T2, cb: (err: Error | null, result: T3) => void) => void): (arg1: T1, arg2: T2) => Promise<T3>;
|
||||||
|
export declare function stringify(value: any): string;
|
||||||
|
export declare function create<T1 extends object, T2 extends T1 = T1>(proto: T1): T2;
|
||||||
|
export declare function isNil(value: any): boolean;
|
||||||
|
export declare function isArray(value: any): boolean;
|
||||||
|
export declare function isError(value: any): boolean;
|
||||||
|
export declare function forOwn<T>(object: {
|
||||||
|
[key: string]: T;
|
||||||
|
} | undefined, iteratee: ((val: T, key: string, obj: {
|
||||||
|
[key: string]: T;
|
||||||
|
}) => boolean | void)): {
|
||||||
|
[key: string]: T;
|
||||||
|
};
|
||||||
|
export declare function last<T>(arr: T[]): T;
|
||||||
|
export declare function last(arr: string): string;
|
||||||
|
export declare function isObject(value: any): boolean;
|
||||||
|
export declare function range(start: number, stop?: number, step?: number): number[];
|
||||||
|
export declare function padStart(str: any, length: number, ch?: string): any;
|
||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liquidjs",
|
"name": "liquidjs",
|
||||||
"version": "7.2.1",
|
"version": "7.2.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liquidjs",
|
"name": "liquidjs",
|
||||||
"version": "7.2.1",
|
"version": "7.2.2",
|
||||||
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
|
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
|
||||||
"main": "dist/liquid.common.js",
|
"main": "dist/liquid.common.js",
|
||||||
"types": "dist/liquid.d.ts",
|
"types": "dist/liquid.d.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user