mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-15 04:10:40 -07:00
6.0.1
This commit is contained in:
Vendored
+75
-75
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* [email protected].0, https://github.com/liquidjs
|
||||
* [email protected].1, https://github.com/liquidjs
|
||||
* (c) 2016-2018 harttle
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
@@ -7,8 +7,8 @@
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
var fs = _interopDefault(require('fs'));
|
||||
var path = _interopDefault(require('path'));
|
||||
var fs = _interopDefault(require('fs'));
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||
return typeof obj;
|
||||
@@ -736,15 +736,27 @@ function () {
|
||||
|
||||
var toStr = Object.prototype.toString;
|
||||
|
||||
/*
|
||||
* Checks if value is classified as a String primitive or object.
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is a string, else false.
|
||||
/*
|
||||
* Checks if value is classified as a String primitive or object.
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is a string, else false.
|
||||
*/
|
||||
function isString(value) {
|
||||
return toStr.call(value) === '[object String]';
|
||||
}
|
||||
|
||||
function promisify(fn) {
|
||||
return function () {
|
||||
var _arguments = arguments;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
fn.apply(undefined, Array.prototype.slice.call(_arguments).concat([function (err, result) {
|
||||
err ? reject(err) : resolve(result);
|
||||
}]));
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function stringify(value) {
|
||||
if (isNil(value)) {
|
||||
return String(value);
|
||||
@@ -755,8 +767,8 @@ function stringify(value) {
|
||||
if (typeof value.toLiquid === 'function') {
|
||||
return stringify(value.toLiquid());
|
||||
}
|
||||
if (isString(value)) {
|
||||
return value;
|
||||
if (isString(value) || value instanceof RegExp || value instanceof Date) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
var cache = [];
|
||||
@@ -784,13 +796,13 @@ function isArray(value) {
|
||||
return toStr.call(value) === '[object Array]';
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.
|
||||
* The iteratee is invoked with three arguments: (value, key, object).
|
||||
* Iteratee functions may exit iteration early by explicitly returning false.
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @return {Object} Returns object.
|
||||
/*
|
||||
* Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.
|
||||
* The iteratee is invoked with three arguments: (value, key, object).
|
||||
* Iteratee functions may exit iteration early by explicitly returning false.
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @return {Object} Returns object.
|
||||
*/
|
||||
function forOwn(object, iteratee) {
|
||||
object = object || {};
|
||||
@@ -802,16 +814,16 @@ function forOwn(object, iteratee) {
|
||||
return object;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assigns own enumerable string keyed properties of source objects to the destination object.
|
||||
* Source objects are applied from left to right.
|
||||
* Subsequent sources overwrite property assignments of previous sources.
|
||||
*
|
||||
* Note: This method mutates object and is loosely based on Object.assign.
|
||||
*
|
||||
* @param {Object} object The destination object.
|
||||
* @param {...Object} sources The source objects.
|
||||
* @return {Object} Returns object.
|
||||
/*
|
||||
* Assigns own enumerable string keyed properties of source objects to the destination object.
|
||||
* Source objects are applied from left to right.
|
||||
* Subsequent sources overwrite property assignments of previous sources.
|
||||
*
|
||||
* Note: This method mutates object and is loosely based on Object.assign.
|
||||
*
|
||||
* @param {Object} object The destination object.
|
||||
* @param {...Object} sources The source objects.
|
||||
* @return {Object} Returns object.
|
||||
*/
|
||||
function assign(object) {
|
||||
object = isObject(object) ? object : {};
|
||||
@@ -839,24 +851,24 @@ function uniq(arr) {
|
||||
return a;
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if value is the language type of Object.
|
||||
* (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is an object, else false.
|
||||
/*
|
||||
* Checks if value is the language type of Object.
|
||||
* (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is an object, else false.
|
||||
*/
|
||||
function isObject(value) {
|
||||
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
||||
return value !== null && (type === 'object' || type === 'function');
|
||||
}
|
||||
|
||||
/*
|
||||
* A function to create flexibly-numbered lists of integers,
|
||||
* handy for each and map loops. start, if omitted, defaults to 0; step defaults to 1.
|
||||
* Returns a list of integers from start (inclusive) to stop (exclusive),
|
||||
* incremented (or decremented) by step, exclusive.
|
||||
* Note that ranges that stop before they start are considered to be zero-length instead of
|
||||
* negative — if you'd like a negative range, use a negative step.
|
||||
/*
|
||||
* A function to create flexibly-numbered lists of integers,
|
||||
* handy for each and map loops. start, if omitted, defaults to 0; step defaults to 1.
|
||||
* Returns a list of integers from start (inclusive) to stop (exclusive),
|
||||
* incremented (or decremented) by step, exclusive.
|
||||
* Note that ranges that stop before they start are considered to be zero-length instead of
|
||||
* negative — if you'd like a negative range, use a negative step.
|
||||
*/
|
||||
function range(start, stop, step) {
|
||||
if (arguments.length === 1) {
|
||||
@@ -883,7 +895,7 @@ var integer = /-?\d+/;
|
||||
var number = /-?\d+\.?\d*|\.?\d+/;
|
||||
var bool = /true|false/;
|
||||
|
||||
// peoperty access
|
||||
// property access
|
||||
var identifier = /[\w-]+[?]?/;
|
||||
var subscript = new RegExp('\\[(?:' + quoted.source + '|[\\w-\\.]+)\\]');
|
||||
var literal = new RegExp('(?:' + quoted.source + '|' + bool.source + '|' + number.source + ')');
|
||||
@@ -1135,13 +1147,13 @@ var Scope = {
|
||||
return val;
|
||||
},
|
||||
|
||||
/*
|
||||
* Parse property access sequence from access string
|
||||
* @example
|
||||
* accessSeq("foo.bar") // ['foo', 'bar']
|
||||
* accessSeq("foo['bar']") // ['foo', 'bar']
|
||||
* accessSeq("foo['b]r']") // ['foo', 'b]r']
|
||||
* accessSeq("foo[bar.coo]") // ['foo', 'bar'], for bar.coo == 'bar'
|
||||
/*
|
||||
* Parse property access sequence from access string
|
||||
* @example
|
||||
* accessSeq("foo.bar") // ['foo', 'bar']
|
||||
* accessSeq("foo['bar']") // ['foo', 'bar']
|
||||
* accessSeq("foo['b]r']") // ['foo', 'b]r']
|
||||
* accessSeq("foo[bar.coo]") // ['foo', 'bar'], for bar.coo == 'bar'
|
||||
*/
|
||||
propertyAccessSeq: function propertyAccessSeq(str) {
|
||||
str = String(str);
|
||||
@@ -1169,7 +1181,7 @@ var Scope = {
|
||||
name = str.slice(i + 1, j);
|
||||
if (!isInteger(name)) {
|
||||
// foo[bar] vs. foo[1]
|
||||
name = this.get(name);
|
||||
name = String(this.get(name));
|
||||
}
|
||||
push();
|
||||
i = j + 1;
|
||||
@@ -1230,11 +1242,11 @@ function factory(ctx, opts) {
|
||||
return scope;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call functions in serial until someone resolved.
|
||||
* @param {Array} iterable the array to iterate with.
|
||||
* @param {Array} iteratee returns a new promise.
|
||||
* The iteratee is invoked with three arguments: (value, index, iterable).
|
||||
/*
|
||||
* Call functions in serial until someone resolved.
|
||||
* @param {Array} iterable the array to iterate with.
|
||||
* @param {Array} iteratee returns a new promise.
|
||||
* The iteratee is invoked with three arguments: (value, index, iterable).
|
||||
*/
|
||||
function anySeries(iterable, iteratee) {
|
||||
var ret = Promise.reject(new Error('init'));
|
||||
@@ -1246,11 +1258,11 @@ function anySeries(iterable, iteratee) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call functions in serial until someone rejected.
|
||||
* @param {Array} iterable the array to iterate with.
|
||||
* @param {Array} iteratee returns a new promise.
|
||||
* The iteratee is invoked with three arguments: (value, index, iterable).
|
||||
/*
|
||||
* Call functions in serial until someone rejected.
|
||||
* @param {Array} iterable the array to iterate with.
|
||||
* @param {Array} iteratee returns a new promise.
|
||||
* The iteratee is invoked with three arguments: (value, index, iterable).
|
||||
*/
|
||||
function mapSeries(iterable, iteratee) {
|
||||
var ret = Promise.resolve('init');
|
||||
@@ -1267,20 +1279,8 @@ function mapSeries(iterable, iteratee) {
|
||||
});
|
||||
}
|
||||
|
||||
function readFileAsync(filepath) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
fs.readFile(filepath, 'utf8', function (err, content) {
|
||||
err ? reject(err) : resolve(content);
|
||||
});
|
||||
});
|
||||
}
|
||||
function statFileAsync(path$$1) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
fs.stat(path$$1, function (err, stat) {
|
||||
return err ? reject(err) : resolve(stat);
|
||||
});
|
||||
});
|
||||
}
|
||||
var statFileAsync = promisify(fs.stat);
|
||||
var readFileAsync = promisify(fs.readFile);
|
||||
|
||||
var resolve = function () {
|
||||
var _ref = asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(filepath, root, options) {
|
||||
@@ -1351,7 +1351,7 @@ var read = function () {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
case 0:
|
||||
return _context3.abrupt('return', readFileAsync(filepath));
|
||||
return _context3.abrupt('return', readFileAsync(filepath, 'utf8'));
|
||||
|
||||
case 1:
|
||||
case 'end':
|
||||
@@ -2638,10 +2638,10 @@ function Increment (liquid, Liquid) {
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* blockMode:
|
||||
* * "store": store rendered html into blocks
|
||||
* * "output": output rendered html
|
||||
/*
|
||||
* blockMode:
|
||||
* * "store": store rendered html into blocks
|
||||
* * "output": output rendered html
|
||||
*/
|
||||
|
||||
function Layout (liquid, Liquid) {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+59
-59
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* liquidjs@6.0.0, https://github.com/liquidjs
|
||||
* liquidjs@6.0.1, https://github.com/liquidjs
|
||||
* (c) 2016-2018 harttle
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
@@ -735,10 +735,10 @@
|
||||
|
||||
var toStr = Object.prototype.toString;
|
||||
|
||||
/*
|
||||
* Checks if value is classified as a String primitive or object.
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is a string, else false.
|
||||
/*
|
||||
* Checks if value is classified as a String primitive or object.
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is a string, else false.
|
||||
*/
|
||||
function isString(value) {
|
||||
return toStr.call(value) === '[object String]';
|
||||
@@ -754,8 +754,8 @@
|
||||
if (typeof value.toLiquid === 'function') {
|
||||
return stringify(value.toLiquid());
|
||||
}
|
||||
if (isString(value)) {
|
||||
return value;
|
||||
if (isString(value) || value instanceof RegExp || value instanceof Date) {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
var cache = [];
|
||||
@@ -783,13 +783,13 @@
|
||||
return toStr.call(value) === '[object Array]';
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.
|
||||
* The iteratee is invoked with three arguments: (value, key, object).
|
||||
* Iteratee functions may exit iteration early by explicitly returning false.
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @return {Object} Returns object.
|
||||
/*
|
||||
* Iterates over own enumerable string keyed properties of an object and invokes iteratee for each property.
|
||||
* The iteratee is invoked with three arguments: (value, key, object).
|
||||
* Iteratee functions may exit iteration early by explicitly returning false.
|
||||
* @param {Object} object The object to iterate over.
|
||||
* @param {Function} iteratee The function invoked per iteration.
|
||||
* @return {Object} Returns object.
|
||||
*/
|
||||
function forOwn(object, iteratee) {
|
||||
object = object || {};
|
||||
@@ -801,16 +801,16 @@
|
||||
return object;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assigns own enumerable string keyed properties of source objects to the destination object.
|
||||
* Source objects are applied from left to right.
|
||||
* Subsequent sources overwrite property assignments of previous sources.
|
||||
*
|
||||
* Note: This method mutates object and is loosely based on Object.assign.
|
||||
*
|
||||
* @param {Object} object The destination object.
|
||||
* @param {...Object} sources The source objects.
|
||||
* @return {Object} Returns object.
|
||||
/*
|
||||
* Assigns own enumerable string keyed properties of source objects to the destination object.
|
||||
* Source objects are applied from left to right.
|
||||
* Subsequent sources overwrite property assignments of previous sources.
|
||||
*
|
||||
* Note: This method mutates object and is loosely based on Object.assign.
|
||||
*
|
||||
* @param {Object} object The destination object.
|
||||
* @param {...Object} sources The source objects.
|
||||
* @return {Object} Returns object.
|
||||
*/
|
||||
function assign(object) {
|
||||
object = isObject(object) ? object : {};
|
||||
@@ -825,24 +825,24 @@
|
||||
return arr[arr.length - 1];
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks if value is the language type of Object.
|
||||
* (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is an object, else false.
|
||||
/*
|
||||
* Checks if value is the language type of Object.
|
||||
* (e.g. arrays, functions, objects, regexes, new Number(0), and new String(''))
|
||||
* @param {any} value The value to check.
|
||||
* @return {Boolean} Returns true if value is an object, else false.
|
||||
*/
|
||||
function isObject(value) {
|
||||
var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
|
||||
return value !== null && (type === 'object' || type === 'function');
|
||||
}
|
||||
|
||||
/*
|
||||
* A function to create flexibly-numbered lists of integers,
|
||||
* handy for each and map loops. start, if omitted, defaults to 0; step defaults to 1.
|
||||
* Returns a list of integers from start (inclusive) to stop (exclusive),
|
||||
* incremented (or decremented) by step, exclusive.
|
||||
* Note that ranges that stop before they start are considered to be zero-length instead of
|
||||
* negative — if you'd like a negative range, use a negative step.
|
||||
/*
|
||||
* A function to create flexibly-numbered lists of integers,
|
||||
* handy for each and map loops. start, if omitted, defaults to 0; step defaults to 1.
|
||||
* Returns a list of integers from start (inclusive) to stop (exclusive),
|
||||
* incremented (or decremented) by step, exclusive.
|
||||
* Note that ranges that stop before they start are considered to be zero-length instead of
|
||||
* negative — if you'd like a negative range, use a negative step.
|
||||
*/
|
||||
function range(start, stop, step) {
|
||||
if (arguments.length === 1) {
|
||||
@@ -869,7 +869,7 @@
|
||||
var number = /-?\d+\.?\d*|\.?\d+/;
|
||||
var bool = /true|false/;
|
||||
|
||||
// peoperty access
|
||||
// property access
|
||||
var identifier = /[\w-]+[?]?/;
|
||||
var subscript = new RegExp('\\[(?:' + quoted.source + '|[\\w-\\.]+)\\]');
|
||||
var literal = new RegExp('(?:' + quoted.source + '|' + bool.source + '|' + number.source + ')');
|
||||
@@ -1121,13 +1121,13 @@
|
||||
return val;
|
||||
},
|
||||
|
||||
/*
|
||||
* Parse property access sequence from access string
|
||||
* @example
|
||||
* accessSeq("foo.bar") // ['foo', 'bar']
|
||||
* accessSeq("foo['bar']") // ['foo', 'bar']
|
||||
* accessSeq("foo['b]r']") // ['foo', 'b]r']
|
||||
* accessSeq("foo[bar.coo]") // ['foo', 'bar'], for bar.coo == 'bar'
|
||||
/*
|
||||
* Parse property access sequence from access string
|
||||
* @example
|
||||
* accessSeq("foo.bar") // ['foo', 'bar']
|
||||
* accessSeq("foo['bar']") // ['foo', 'bar']
|
||||
* accessSeq("foo['b]r']") // ['foo', 'b]r']
|
||||
* accessSeq("foo[bar.coo]") // ['foo', 'bar'], for bar.coo == 'bar'
|
||||
*/
|
||||
propertyAccessSeq: function propertyAccessSeq(str) {
|
||||
str = String(str);
|
||||
@@ -1155,7 +1155,7 @@
|
||||
name = str.slice(i + 1, j);
|
||||
if (!isInteger(name)) {
|
||||
// foo[bar] vs. foo[1]
|
||||
name = this.get(name);
|
||||
name = String(this.get(name));
|
||||
}
|
||||
push();
|
||||
i = j + 1;
|
||||
@@ -1977,18 +1977,18 @@
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* Call functions in serial until someone resolved.
|
||||
* @param {Array} iterable the array to iterate with.
|
||||
* @param {Array} iteratee returns a new promise.
|
||||
* The iteratee is invoked with three arguments: (value, index, iterable).
|
||||
/*
|
||||
* Call functions in serial until someone resolved.
|
||||
* @param {Array} iterable the array to iterate with.
|
||||
* @param {Array} iteratee returns a new promise.
|
||||
* The iteratee is invoked with three arguments: (value, index, iterable).
|
||||
*/
|
||||
|
||||
/*
|
||||
* Call functions in serial until someone rejected.
|
||||
* @param {Array} iterable the array to iterate with.
|
||||
* @param {Array} iteratee returns a new promise.
|
||||
* The iteratee is invoked with three arguments: (value, index, iterable).
|
||||
/*
|
||||
* Call functions in serial until someone rejected.
|
||||
* @param {Array} iterable the array to iterate with.
|
||||
* @param {Array} iteratee returns a new promise.
|
||||
* The iteratee is invoked with three arguments: (value, index, iterable).
|
||||
*/
|
||||
function mapSeries(iterable, iteratee) {
|
||||
var ret = Promise.resolve('init');
|
||||
@@ -2584,10 +2584,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* blockMode:
|
||||
* * "store": store rendered html into blocks
|
||||
* * "output": output rendered html
|
||||
/*
|
||||
* blockMode:
|
||||
* * "store": store rendered html into blocks
|
||||
* * "output": output rendered html
|
||||
*/
|
||||
|
||||
function Layout (liquid, Liquid) {
|
||||
|
||||
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
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "liquidjs",
|
||||
"version": "6.0.0",
|
||||
"version": "6.0.1",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "liquidjs",
|
||||
"version": "6.0.0",
|
||||
"version": "6.0.1",
|
||||
"description": "Liquid template engine by pure JavaScript: compatible to shopify, easy to extend.",
|
||||
"main": "dist/liquid.common.js",
|
||||
"module": "src/index.js",
|
||||
|
||||
Reference in New Issue
Block a user