Update modules
This commit is contained in:
parent
1a0ff7ff15
commit
66f8546779
3
node_modules/es6-shim/CHANGELOG.md
generated
vendored
3
node_modules/es6-shim/CHANGELOG.md
generated
vendored
@ -1,5 +1,8 @@
|
|||||||
# es6-shim x.x.x (not yet released)
|
# es6-shim x.x.x (not yet released)
|
||||||
|
|
||||||
|
# es6-shim 0.20.2 (28 Oct 2014)
|
||||||
|
* Fix AMD (#299)
|
||||||
|
|
||||||
# es6-shim 0.20.1 (27 Oct 2014)
|
# es6-shim 0.20.1 (27 Oct 2014)
|
||||||
* Set#delete and Map#delete should return false unless a deletion occurred. (#298)
|
* Set#delete and Map#delete should return false unless a deletion occurred. (#298)
|
||||||
|
|
||||||
|
2
node_modules/es6-shim/bower.json
generated
vendored
2
node_modules/es6-shim/bower.json
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "es6-shim",
|
"name": "es6-shim",
|
||||||
"version": "0.20.1",
|
"version": "0.20.2",
|
||||||
"repo": "paulmillr/es6-shim",
|
"repo": "paulmillr/es6-shim",
|
||||||
"description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines",
|
"description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
2
node_modules/es6-shim/component.json
generated
vendored
2
node_modules/es6-shim/component.json
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "es6-shim",
|
"name": "es6-shim",
|
||||||
"version": "0.20.1",
|
"version": "0.20.2",
|
||||||
"repo": "paulmillr/es6-shim",
|
"repo": "paulmillr/es6-shim",
|
||||||
"description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines",
|
"description": "ECMAScript 6 (Harmony) compatibility shims for legacy JavaScript engines",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
2
node_modules/es6-shim/es6-sham.js
generated
vendored
2
node_modules/es6-shim/es6-sham.js
generated
vendored
@ -2,7 +2,7 @@
|
|||||||
* https://github.com/paulmillr/es6-shim
|
* https://github.com/paulmillr/es6-shim
|
||||||
* @license es6-shim Copyright 2013-2014 by Paul Miller (http://paulmillr.com)
|
* @license es6-shim Copyright 2013-2014 by Paul Miller (http://paulmillr.com)
|
||||||
* and contributors, MIT License
|
* and contributors, MIT License
|
||||||
* es6-sham: v0.20.1
|
* es6-sham: v0.20.2
|
||||||
* see https://github.com/paulmillr/es6-shim/blob/master/LICENSE
|
* see https://github.com/paulmillr/es6-shim/blob/master/LICENSE
|
||||||
* Details and documentation:
|
* Details and documentation:
|
||||||
* https://github.com/paulmillr/es6-shim/
|
* https://github.com/paulmillr/es6-shim/
|
||||||
|
2
node_modules/es6-shim/es6-sham.min.js
generated
vendored
2
node_modules/es6-shim/es6-sham.min.js
generated
vendored
@ -2,7 +2,7 @@
|
|||||||
* https://github.com/paulmillr/es6-shim
|
* https://github.com/paulmillr/es6-shim
|
||||||
* @license es6-shim Copyright 2013-2014 by Paul Miller (http://paulmillr.com)
|
* @license es6-shim Copyright 2013-2014 by Paul Miller (http://paulmillr.com)
|
||||||
* and contributors, MIT License
|
* and contributors, MIT License
|
||||||
* es6-sham: v0.20.1
|
* es6-sham: v0.20.2
|
||||||
* see https://github.com/paulmillr/es6-shim/blob/master/LICENSE
|
* see https://github.com/paulmillr/es6-shim/blob/master/LICENSE
|
||||||
* Details and documentation:
|
* Details and documentation:
|
||||||
* https://github.com/paulmillr/es6-shim/
|
* https://github.com/paulmillr/es6-shim/
|
||||||
|
94
node_modules/es6-shim/es6-shim.js
generated
vendored
94
node_modules/es6-shim/es6-shim.js
generated
vendored
@ -2,7 +2,7 @@
|
|||||||
* https://github.com/paulmillr/es6-shim
|
* https://github.com/paulmillr/es6-shim
|
||||||
* @license es6-shim Copyright 2013-2014 by Paul Miller (http://paulmillr.com)
|
* @license es6-shim Copyright 2013-2014 by Paul Miller (http://paulmillr.com)
|
||||||
* and contributors, MIT License
|
* and contributors, MIT License
|
||||||
* es6-shim: v0.20.1
|
* es6-shim: v0.20.2
|
||||||
* see https://github.com/paulmillr/es6-shim/blob/master/LICENSE
|
* see https://github.com/paulmillr/es6-shim/blob/master/LICENSE
|
||||||
* Details and documentation:
|
* Details and documentation:
|
||||||
* https://github.com/paulmillr/es6-shim/
|
* https://github.com/paulmillr/es6-shim/
|
||||||
@ -23,7 +23,7 @@
|
|||||||
// Browser globals (root is window)
|
// Browser globals (root is window)
|
||||||
root.returnExports = factory();
|
root.returnExports = factory();
|
||||||
}
|
}
|
||||||
}(this, function (undefined) {
|
}(this, function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var isCallableWithoutNew = function (func) {
|
var isCallableWithoutNew = function (func) {
|
||||||
@ -237,7 +237,7 @@
|
|||||||
|
|
||||||
IsIterable: function (o) {
|
IsIterable: function (o) {
|
||||||
return ES.TypeIsObject(o) &&
|
return ES.TypeIsObject(o) &&
|
||||||
(o[$iterator$] !== undefined || isArguments(o));
|
(typeof o[$iterator$] !== 'undefined' || isArguments(o));
|
||||||
},
|
},
|
||||||
|
|
||||||
GetIterator: function (o) {
|
GetIterator: function (o) {
|
||||||
@ -462,7 +462,7 @@
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
next = substitutions[nextKey];
|
next = substitutions[nextKey];
|
||||||
if (next === undefined) {
|
if (typeof next === 'undefined') {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nextSub = String(next);
|
nextSub = String(next);
|
||||||
@ -507,7 +507,7 @@
|
|||||||
throw new TypeError('Cannot call method "startsWith" with a regex');
|
throw new TypeError('Cannot call method "startsWith" with a regex');
|
||||||
}
|
}
|
||||||
searchStr = String(searchStr);
|
searchStr = String(searchStr);
|
||||||
var startArg = arguments.length > 1 ? arguments[1] : undefined;
|
var startArg = arguments.length > 1 ? arguments[1] : void 0;
|
||||||
var start = Math.max(ES.ToInteger(startArg), 0);
|
var start = Math.max(ES.ToInteger(startArg), 0);
|
||||||
return thisStr.slice(start, start + searchStr.length) === searchStr;
|
return thisStr.slice(start, start + searchStr.length) === searchStr;
|
||||||
},
|
},
|
||||||
@ -519,14 +519,14 @@
|
|||||||
}
|
}
|
||||||
searchStr = String(searchStr);
|
searchStr = String(searchStr);
|
||||||
var thisLen = thisStr.length;
|
var thisLen = thisStr.length;
|
||||||
var posArg = arguments.length > 1 ? arguments[1] : undefined;
|
var posArg = arguments.length > 1 ? arguments[1] : void 0;
|
||||||
var pos = posArg === undefined ? thisLen : ES.ToInteger(posArg);
|
var pos = typeof posArg === 'undefined' ? thisLen : ES.ToInteger(posArg);
|
||||||
var end = Math.min(Math.max(pos, 0), thisLen);
|
var end = Math.min(Math.max(pos, 0), thisLen);
|
||||||
return thisStr.slice(end - searchStr.length, end) === searchStr;
|
return thisStr.slice(end - searchStr.length, end) === searchStr;
|
||||||
},
|
},
|
||||||
|
|
||||||
contains: function (searchString) {
|
contains: function (searchString) {
|
||||||
var position = arguments.length > 1 ? arguments[1] : undefined;
|
var position = arguments.length > 1 ? arguments[1] : void 0;
|
||||||
// Somehow this trick makes method 100% compat with the spec.
|
// Somehow this trick makes method 100% compat with the spec.
|
||||||
return _indexOf.call(this, searchString, position) !== -1;
|
return _indexOf.call(this, searchString, position) !== -1;
|
||||||
},
|
},
|
||||||
@ -560,7 +560,7 @@
|
|||||||
var trimRegexp = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
|
var trimRegexp = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
|
||||||
defineProperties(String.prototype, {
|
defineProperties(String.prototype, {
|
||||||
trim: function () {
|
trim: function () {
|
||||||
if (this === undefined || this === null) {
|
if (typeof this === 'undefined' || this === null) {
|
||||||
throw new TypeError("can't convert " + this + ' to object');
|
throw new TypeError("can't convert " + this + ' to object');
|
||||||
}
|
}
|
||||||
return String(this).replace(trimRegexp, '');
|
return String(this).replace(trimRegexp, '');
|
||||||
@ -575,9 +575,9 @@
|
|||||||
};
|
};
|
||||||
StringIterator.prototype.next = function () {
|
StringIterator.prototype.next = function () {
|
||||||
var s = this._s, i = this._i;
|
var s = this._s, i = this._i;
|
||||||
if (s === undefined || i >= s.length) {
|
if (typeof s === 'undefined' || i >= s.length) {
|
||||||
this._s = undefined;
|
this._s = void 0;
|
||||||
return { value: undefined, done: true };
|
return { value: void 0, done: true };
|
||||||
}
|
}
|
||||||
var first = s.charCodeAt(i), second, len;
|
var first = s.charCodeAt(i), second, len;
|
||||||
if (first < 0xD800 || first > 0xDBFF || (i + 1) == s.length) {
|
if (first < 0xD800 || first > 0xDBFF || (i + 1) == s.length) {
|
||||||
@ -602,15 +602,15 @@
|
|||||||
|
|
||||||
var ArrayShims = {
|
var ArrayShims = {
|
||||||
from: function (iterable) {
|
from: function (iterable) {
|
||||||
var mapFn = arguments.length > 1 ? arguments[1] : undefined;
|
var mapFn = arguments.length > 1 ? arguments[1] : void 0;
|
||||||
|
|
||||||
var list = ES.ToObject(iterable, 'bad iterable');
|
var list = ES.ToObject(iterable, 'bad iterable');
|
||||||
if (mapFn !== undefined && !ES.IsCallable(mapFn)) {
|
if (typeof mapFn !== 'undefined' && !ES.IsCallable(mapFn)) {
|
||||||
throw new TypeError('Array.from: when provided, the second argument must be a function');
|
throw new TypeError('Array.from: when provided, the second argument must be a function');
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasThisArg = arguments.length > 2;
|
var hasThisArg = arguments.length > 2;
|
||||||
var thisArg = hasThisArg ? arguments[2] : undefined;
|
var thisArg = hasThisArg ? arguments[2] : void 0;
|
||||||
|
|
||||||
var usingIterator = ES.IsIterable(list);
|
var usingIterator = ES.IsIterable(list);
|
||||||
// does the spec really mean that Arrays should use ArrayIterator?
|
// does the spec really mean that Arrays should use ArrayIterator?
|
||||||
@ -688,7 +688,7 @@
|
|||||||
if (!(this instanceof ArrayIterator)) {
|
if (!(this instanceof ArrayIterator)) {
|
||||||
throw new TypeError('Not an ArrayIterator');
|
throw new TypeError('Not an ArrayIterator');
|
||||||
}
|
}
|
||||||
if (array !== undefined) {
|
if (typeof array !== 'undefined') {
|
||||||
var len = ES.ToLength(array.length);
|
var len = ES.ToLength(array.length);
|
||||||
for (; i < len; i++) {
|
for (; i < len; i++) {
|
||||||
var kind = this.kind;
|
var kind = this.kind;
|
||||||
@ -704,8 +704,8 @@
|
|||||||
return { value: retval, done: false };
|
return { value: retval, done: false };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.array = undefined;
|
this.array = void 0;
|
||||||
return { value: undefined, done: true };
|
return { value: void 0, done: true };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addIterator(ArrayIterator.prototype);
|
addIterator(ArrayIterator.prototype);
|
||||||
@ -719,7 +719,7 @@
|
|||||||
start = ES.ToInteger(start);
|
start = ES.ToInteger(start);
|
||||||
var to = target < 0 ? Math.max(len + target, 0) : Math.min(target, len);
|
var to = target < 0 ? Math.max(len + target, 0) : Math.min(target, len);
|
||||||
var from = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
var from = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
||||||
end = end === undefined ? len : ES.ToInteger(end);
|
end = typeof end === 'undefined' ? len : ES.ToInteger(end);
|
||||||
var fin = end < 0 ? Math.max(len + end, 0) : Math.min(end, len);
|
var fin = end < 0 ? Math.max(len + end, 0) : Math.min(end, len);
|
||||||
var count = Math.min(fin - from, len - to);
|
var count = Math.min(fin - from, len - to);
|
||||||
var direction = 1;
|
var direction = 1;
|
||||||
@ -742,12 +742,12 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
fill: function (value) {
|
fill: function (value) {
|
||||||
var start = arguments.length > 1 ? arguments[1] : undefined;
|
var start = arguments.length > 1 ? arguments[1] : void 0;
|
||||||
var end = arguments.length > 2 ? arguments[2] : undefined;
|
var end = arguments.length > 2 ? arguments[2] : void 0;
|
||||||
var O = ES.ToObject(this);
|
var O = ES.ToObject(this);
|
||||||
var len = ES.ToLength(O.length);
|
var len = ES.ToLength(O.length);
|
||||||
start = ES.ToInteger(start === undefined ? 0 : start);
|
start = ES.ToInteger(typeof start === 'undefined' ? 0 : start);
|
||||||
end = ES.ToInteger(end === undefined ? len : end);
|
end = ES.ToInteger(typeof end === 'undefined' ? len : end);
|
||||||
|
|
||||||
var relativeStart = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
var relativeStart = start < 0 ? Math.max(len + start, 0) : Math.min(start, len);
|
||||||
var relativeEnd = end < 0 ? len + end : end;
|
var relativeEnd = end < 0 ? len + end : end;
|
||||||
@ -769,7 +769,7 @@
|
|||||||
value = list[i];
|
value = list[i];
|
||||||
if (predicate.call(thisArg, value, i, list)) { return value; }
|
if (predicate.call(thisArg, value, i, list)) { return value; }
|
||||||
}
|
}
|
||||||
return undefined;
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
findIndex: function findIndex(predicate) {
|
findIndex: function findIndex(predicate) {
|
||||||
@ -863,7 +863,7 @@
|
|||||||
getPropertyDescriptor: function (subject, name) {
|
getPropertyDescriptor: function (subject, name) {
|
||||||
var pd = Object.getOwnPropertyDescriptor(subject, name);
|
var pd = Object.getOwnPropertyDescriptor(subject, name);
|
||||||
var proto = Object.getPrototypeOf(subject);
|
var proto = Object.getPrototypeOf(subject);
|
||||||
while (pd === undefined && proto !== null) {
|
while (typeof pd === 'undefined' && proto !== null) {
|
||||||
pd = Object.getOwnPropertyDescriptor(proto, name);
|
pd = Object.getOwnPropertyDescriptor(proto, name);
|
||||||
proto = Object.getPrototypeOf(proto);
|
proto = Object.getPrototypeOf(proto);
|
||||||
}
|
}
|
||||||
@ -1184,7 +1184,7 @@
|
|||||||
// check that instead of the [[PromiseStatus]] internal field.
|
// check that instead of the [[PromiseStatus]] internal field.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (promise._status === undefined) {
|
if (typeof promise._status === 'undefined') {
|
||||||
return false; // uninitialized
|
return false; // uninitialized
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -1318,7 +1318,7 @@
|
|||||||
// [[PromiseStatus]] field; it's a little more unique.
|
// [[PromiseStatus]] field; it's a little more unique.
|
||||||
throw new TypeError('bad promise');
|
throw new TypeError('bad promise');
|
||||||
}
|
}
|
||||||
if (promise._status !== undefined) {
|
if (typeof promise._status !== 'undefined') {
|
||||||
throw new TypeError('promise already initialized');
|
throw new TypeError('promise already initialized');
|
||||||
}
|
}
|
||||||
// see https://bugs.ecmascript.org/show_bug.cgi?id=2482
|
// see https://bugs.ecmascript.org/show_bug.cgi?id=2482
|
||||||
@ -1333,8 +1333,8 @@
|
|||||||
if (promise._status !== 'unresolved') { return; }
|
if (promise._status !== 'unresolved') { return; }
|
||||||
var reactions = promise._resolveReactions;
|
var reactions = promise._resolveReactions;
|
||||||
promise._result = resolution;
|
promise._result = resolution;
|
||||||
promise._resolveReactions = undefined;
|
promise._resolveReactions = void 0;
|
||||||
promise._rejectReactions = undefined;
|
promise._rejectReactions = void 0;
|
||||||
promise._status = 'has-resolution';
|
promise._status = 'has-resolution';
|
||||||
triggerPromiseReactions(reactions, resolution);
|
triggerPromiseReactions(reactions, resolution);
|
||||||
};
|
};
|
||||||
@ -1342,8 +1342,8 @@
|
|||||||
if (promise._status !== 'unresolved') { return; }
|
if (promise._status !== 'unresolved') { return; }
|
||||||
var reactions = promise._rejectReactions;
|
var reactions = promise._rejectReactions;
|
||||||
promise._result = reason;
|
promise._result = reason;
|
||||||
promise._resolveReactions = undefined;
|
promise._resolveReactions = void 0;
|
||||||
promise._rejectReactions = undefined;
|
promise._rejectReactions = void 0;
|
||||||
promise._status = 'has-rejection';
|
promise._status = 'has-rejection';
|
||||||
triggerPromiseReactions(reactions, reason);
|
triggerPromiseReactions(reactions, reason);
|
||||||
};
|
};
|
||||||
@ -1364,11 +1364,11 @@
|
|||||||
var prototype = constructor.prototype || Promise$prototype;
|
var prototype = constructor.prototype || Promise$prototype;
|
||||||
obj = obj || create(prototype);
|
obj = obj || create(prototype);
|
||||||
defineProperties(obj, {
|
defineProperties(obj, {
|
||||||
_status: undefined,
|
_status: void 0,
|
||||||
_result: undefined,
|
_result: void 0,
|
||||||
_resolveReactions: undefined,
|
_resolveReactions: void 0,
|
||||||
_rejectReactions: undefined,
|
_rejectReactions: void 0,
|
||||||
_promiseConstructor: undefined
|
_promiseConstructor: void 0
|
||||||
});
|
});
|
||||||
obj._promiseConstructor = constructor;
|
obj._promiseConstructor = constructor;
|
||||||
return obj;
|
return obj;
|
||||||
@ -1469,7 +1469,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
Promise.prototype['catch'] = function (onRejected) {
|
Promise.prototype['catch'] = function (onRejected) {
|
||||||
return this.then(undefined, onRejected);
|
return this.then(void 0, onRejected);
|
||||||
};
|
};
|
||||||
|
|
||||||
Promise.prototype.then = function (onFulfilled, onRejected) {
|
Promise.prototype.then = function (onFulfilled, onRejected) {
|
||||||
@ -1597,8 +1597,8 @@
|
|||||||
MapIterator.prototype = {
|
MapIterator.prototype = {
|
||||||
next: function () {
|
next: function () {
|
||||||
var i = this.i, kind = this.kind, head = this.head, result;
|
var i = this.i, kind = this.kind, head = this.head, result;
|
||||||
if (this.i === undefined) {
|
if (typeof this.i === 'undefined') {
|
||||||
return { value: undefined, done: true };
|
return { value: void 0, done: true };
|
||||||
}
|
}
|
||||||
while (i.isRemoved() && i !== head) {
|
while (i.isRemoved() && i !== head) {
|
||||||
// back up off of removed entries
|
// back up off of removed entries
|
||||||
@ -1620,8 +1620,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// once the iterator is done, it is done forever.
|
// once the iterator is done, it is done forever.
|
||||||
this.i = undefined;
|
this.i = void 0;
|
||||||
return { value: undefined, done: true };
|
return { value: void 0, done: true };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
addIterator(MapIterator.prototype);
|
addIterator(MapIterator.prototype);
|
||||||
@ -1644,7 +1644,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Optionally initialize map from iterable
|
// Optionally initialize map from iterable
|
||||||
if (iterable !== undefined && iterable !== null) {
|
if (typeof iterable !== 'undefined' && iterable !== null) {
|
||||||
var it = ES.GetIterator(iterable);
|
var it = ES.GetIterator(iterable);
|
||||||
var adder = map.set;
|
var adder = map.set;
|
||||||
if (!ES.IsCallable(adder)) { throw new TypeError('bad map'); }
|
if (!ES.IsCallable(adder)) { throw new TypeError('bad map'); }
|
||||||
@ -1688,7 +1688,11 @@
|
|||||||
if (fkey !== null) {
|
if (fkey !== null) {
|
||||||
// fast O(1) path
|
// fast O(1) path
|
||||||
var entry = this._storage[fkey];
|
var entry = this._storage[fkey];
|
||||||
return entry ? entry.value : undefined;
|
if (entry) {
|
||||||
|
return entry.value;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var head = this._head, i = head;
|
var head = this._head, i = head;
|
||||||
while ((i = i.next) !== head) {
|
while ((i = i.next) !== head) {
|
||||||
@ -1696,7 +1700,7 @@
|
|||||||
return i.value;
|
return i.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return;
|
||||||
},
|
},
|
||||||
|
|
||||||
has: function (key) {
|
has: function (key) {
|
||||||
@ -1825,7 +1829,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Optionally initialize map from iterable
|
// Optionally initialize map from iterable
|
||||||
if (iterable !== undefined && iterable !== null) {
|
if (typeof iterable !== 'undefined' && iterable !== null) {
|
||||||
var it = ES.GetIterator(iterable);
|
var it = ES.GetIterator(iterable);
|
||||||
var adder = set.add;
|
var adder = set.add;
|
||||||
if (!ES.IsCallable(adder)) { throw new TypeError('bad set'); }
|
if (!ES.IsCallable(adder)) { throw new TypeError('bad set'); }
|
||||||
|
2
node_modules/es6-shim/es6-shim.map
generated
vendored
2
node_modules/es6-shim/es6-shim.map
generated
vendored
File diff suppressed because one or more lines are too long
4
node_modules/es6-shim/es6-shim.min.js
generated
vendored
4
node_modules/es6-shim/es6-shim.min.js
generated
vendored
File diff suppressed because one or more lines are too long
16
node_modules/es6-shim/package.json
generated
vendored
16
node_modules/es6-shim/package.json
generated
vendored
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "es6-shim",
|
"name": "es6-shim",
|
||||||
"version": "0.20.1",
|
"version": "0.20.2",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Paul Miller",
|
"name": "Paul Miller",
|
||||||
"url": "http://paulmillr.com"
|
"url": "http://paulmillr.com"
|
||||||
@ -70,13 +70,13 @@
|
|||||||
"promises-es6-tests": "~0.5.0",
|
"promises-es6-tests": "~0.5.0",
|
||||||
"uglify-js": "~2.4.15"
|
"uglify-js": "~2.4.15"
|
||||||
},
|
},
|
||||||
"gitHead": "c70e0007f247e2db6c1bd967c1d7ed9809d2c8bf",
|
"gitHead": "f1a9e182eead8a2df3a441dc021881233988b9dd",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/paulmillr/es6-shim/issues"
|
"url": "https://github.com/paulmillr/es6-shim/issues"
|
||||||
},
|
},
|
||||||
"_id": "es6-shim@0.20.1",
|
"_id": "es6-shim@0.20.2",
|
||||||
"_shasum": "9f86fcece9b9c9af3133b3c9db795e44a20499a4",
|
"_shasum": "4f174a32d293adb34f6ad9b25b9aa56d7f9d1a76",
|
||||||
"_from": "es6-shim@",
|
"_from": "es6-shim@0.20.2",
|
||||||
"_npmVersion": "1.4.28",
|
"_npmVersion": "1.4.28",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "ljharb",
|
"name": "ljharb",
|
||||||
@ -93,9 +93,9 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dist": {
|
"dist": {
|
||||||
"shasum": "9f86fcece9b9c9af3133b3c9db795e44a20499a4",
|
"shasum": "4f174a32d293adb34f6ad9b25b9aa56d7f9d1a76",
|
||||||
"tarball": "http://registry.npmjs.org/es6-shim/-/es6-shim-0.20.1.tgz"
|
"tarball": "http://registry.npmjs.org/es6-shim/-/es6-shim-0.20.2.tgz"
|
||||||
},
|
},
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/es6-shim/-/es6-shim-0.20.1.tgz"
|
"_resolved": "https://registry.npmjs.org/es6-shim/-/es6-shim-0.20.2.tgz"
|
||||||
}
|
}
|
||||||
|
2
node_modules/grunt-cli/node_modules/findup-sync/node_modules/glob/package.json
generated
vendored
2
node_modules/grunt-cli/node_modules/findup-sync/node_modules/glob/package.json
generated
vendored
@ -36,7 +36,7 @@
|
|||||||
"homepage": "https://github.com/isaacs/node-glob",
|
"homepage": "https://github.com/isaacs/node-glob",
|
||||||
"_id": "glob@3.2.11",
|
"_id": "glob@3.2.11",
|
||||||
"_shasum": "4a973f635b9190f715d10987d5c00fd2815ebe3d",
|
"_shasum": "4a973f635b9190f715d10987d5c00fd2815ebe3d",
|
||||||
"_from": "glob@~3.2.9",
|
"_from": "glob@3.2.11",
|
||||||
"_npmVersion": "1.4.10",
|
"_npmVersion": "1.4.10",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "isaacs",
|
"name": "isaacs",
|
||||||
|
2
node_modules/grunt-cli/node_modules/nopt/package.json
generated
vendored
2
node_modules/grunt-cli/node_modules/nopt/package.json
generated
vendored
@ -32,5 +32,5 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/nopt",
|
"homepage": "https://github.com/isaacs/nopt",
|
||||||
"_id": "nopt@1.0.10",
|
"_id": "nopt@1.0.10",
|
||||||
"_from": "nopt@~1.0.10"
|
"_from": "nopt@1.0.10"
|
||||||
}
|
}
|
||||||
|
2
node_modules/grunt-cli/node_modules/resolve/package.json
generated
vendored
2
node_modules/grunt-cli/node_modules/resolve/package.json
generated
vendored
@ -32,5 +32,5 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/substack/node-resolve",
|
"homepage": "https://github.com/substack/node-resolve",
|
||||||
"_id": "resolve@0.3.1",
|
"_id": "resolve@0.3.1",
|
||||||
"_from": "resolve@~0.3.1"
|
"_from": "resolve@0.3.1"
|
||||||
}
|
}
|
||||||
|
2
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/abbrev/package.json
generated
vendored
2
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/abbrev/package.json
generated
vendored
@ -24,7 +24,7 @@
|
|||||||
"homepage": "https://github.com/isaacs/abbrev-js",
|
"homepage": "https://github.com/isaacs/abbrev-js",
|
||||||
"_id": "abbrev@1.0.5",
|
"_id": "abbrev@1.0.5",
|
||||||
"_shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03",
|
"_shasum": "5d8257bd9ebe435e698b2fa431afde4fe7b10b03",
|
||||||
"_from": "abbrev@>=1.0.0 <1.1.0",
|
"_from": "abbrev@1.0.x",
|
||||||
"_npmVersion": "1.4.7",
|
"_npmVersion": "1.4.7",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "isaacs",
|
"name": "isaacs",
|
||||||
|
3
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/.travis.yml
generated
vendored
Normal file
3
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "0.10"
|
19
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/LICENSE
generated
vendored
Normal file
19
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2010-2014 Caolan McMahon
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
1646
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/README.md
generated
vendored
Normal file
1646
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
11
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/component.json
generated
vendored
Normal file
11
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/component.json
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "async",
|
||||||
|
"repo": "caolan/async",
|
||||||
|
"description": "Higher-order functions and common patterns for asynchronous code",
|
||||||
|
"version": "0.1.23",
|
||||||
|
"keywords": [],
|
||||||
|
"dependencies": {},
|
||||||
|
"development": {},
|
||||||
|
"main": "lib/async.js",
|
||||||
|
"scripts": [ "lib/async.js" ]
|
||||||
|
}
|
1123
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/lib/async.js
generated
vendored
Executable file
1123
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/lib/async.js
generated
vendored
Executable file
File diff suppressed because it is too large
Load Diff
45
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/package.json
generated
vendored
Normal file
45
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/async/package.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -82,5 +82,5 @@
|
|||||||
"readme": "**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance,\nstandard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)\nparser written in ECMAScript (also popularly known as\n[JavaScript](http://en.wikipedia.org/wiki/JavaScript>JavaScript)).\nEsprima is created and maintained by [Ariya Hidayat](http://twitter.com/ariyahidayat),\nwith the help of [many contributors](https://github.com/ariya/esprima/contributors).\n\n### Features\n\n- Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm))\n- Sensible [syntax tree format](http://esprima.org/doc/index.html#ast) compatible with Mozilla\n[Parser AST](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)\n- Optional tracking of syntax node location (index-based and line-column)\n- Heavily tested (> 600 [unit tests](http://esprima.org/test/) with solid statement and branch coverage)\n- Experimental support for ES6/Harmony (module, class, destructuring, ...)\n\nEsprima serves as a **building block** for some JavaScript\nlanguage tools, from [code instrumentation](http://esprima.org/demo/functiontrace.html)\nto [editor autocompletion](http://esprima.org/demo/autocomplete.html).\n\nEsprima runs on many popular web browsers, as well as other ECMAScript platforms such as\n[Rhino](http://www.mozilla.org/rhino) and [Node.js](https://npmjs.org/package/esprima).\n\nFor more information, check the web site [esprima.org](http://esprima.org).\n",
|
"readme": "**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance,\nstandard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)\nparser written in ECMAScript (also popularly known as\n[JavaScript](http://en.wikipedia.org/wiki/JavaScript>JavaScript)).\nEsprima is created and maintained by [Ariya Hidayat](http://twitter.com/ariyahidayat),\nwith the help of [many contributors](https://github.com/ariya/esprima/contributors).\n\n### Features\n\n- Full support for ECMAScript 5.1 ([ECMA-262](http://www.ecma-international.org/publications/standards/Ecma-262.htm))\n- Sensible [syntax tree format](http://esprima.org/doc/index.html#ast) compatible with Mozilla\n[Parser AST](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)\n- Optional tracking of syntax node location (index-based and line-column)\n- Heavily tested (> 600 [unit tests](http://esprima.org/test/) with solid statement and branch coverage)\n- Experimental support for ES6/Harmony (module, class, destructuring, ...)\n\nEsprima serves as a **building block** for some JavaScript\nlanguage tools, from [code instrumentation](http://esprima.org/demo/functiontrace.html)\nto [editor autocompletion](http://esprima.org/demo/autocomplete.html).\n\nEsprima runs on many popular web browsers, as well as other ECMAScript platforms such as\n[Rhino](http://www.mozilla.org/rhino) and [Node.js](https://npmjs.org/package/esprima).\n\nFor more information, check the web site [esprima.org](http://esprima.org).\n",
|
||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"_id": "esprima@1.1.1",
|
"_id": "esprima@1.1.1",
|
||||||
"_from": "esprima@>=1.1.1 <1.2.0"
|
"_from": "esprima@~1.1.1"
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
"shasum": "867a3e8e58a9f84618afb6c2ddbcd916b7cbaf71",
|
"shasum": "867a3e8e58a9f84618afb6c2ddbcd916b7cbaf71",
|
||||||
"tarball": "http://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz"
|
"tarball": "http://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz"
|
||||||
},
|
},
|
||||||
"_from": "estraverse@>=1.5.0 <1.6.0",
|
"_from": "estraverse@~1.5.0",
|
||||||
"_npmVersion": "1.4.3",
|
"_npmVersion": "1.4.3",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "constellation",
|
"name": "constellation",
|
||||||
@ -54,5 +54,6 @@
|
|||||||
},
|
},
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_shasum": "867a3e8e58a9f84618afb6c2ddbcd916b7cbaf71",
|
"_shasum": "867a3e8e58a9f84618afb6c2ddbcd916b7cbaf71",
|
||||||
"_resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz"
|
"_resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz",
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
@ -45,5 +45,5 @@
|
|||||||
"url": "https://github.com/Constellation/esutils/issues"
|
"url": "https://github.com/Constellation/esutils/issues"
|
||||||
},
|
},
|
||||||
"_id": "esutils@1.0.0",
|
"_id": "esutils@1.0.0",
|
||||||
"_from": "esutils@>=1.0.0 <1.1.0"
|
"_from": "esutils@~1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@
|
|||||||
},
|
},
|
||||||
"_id": "source-map@0.1.40",
|
"_id": "source-map@0.1.40",
|
||||||
"_shasum": "7e0ee49ec0452aa9ac2b93ad5ae54ef33e82b37f",
|
"_shasum": "7e0ee49ec0452aa9ac2b93ad5ae54ef33e82b37f",
|
||||||
"_from": "source-map@>=0.1.33 <0.2.0",
|
"_from": "source-map@~0.1.33",
|
||||||
"_npmVersion": "1.4.9",
|
"_npmVersion": "1.4.9",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "nickfitzgerald",
|
"name": "nickfitzgerald",
|
||||||
@ -165,5 +165,6 @@
|
|||||||
"shasum": "7e0ee49ec0452aa9ac2b93ad5ae54ef33e82b37f",
|
"shasum": "7e0ee49ec0452aa9ac2b93ad5ae54ef33e82b37f",
|
||||||
"tarball": "http://registry.npmjs.org/source-map/-/source-map-0.1.40.tgz"
|
"tarball": "http://registry.npmjs.org/source-map/-/source-map-0.1.40.tgz"
|
||||||
},
|
},
|
||||||
"_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.40.tgz"
|
"_resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.40.tgz",
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
"shasum": "f024016f5a88e046fd12005055e939802e6c5f23",
|
"shasum": "f024016f5a88e046fd12005055e939802e6c5f23",
|
||||||
"tarball": "http://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz"
|
"tarball": "http://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz"
|
||||||
},
|
},
|
||||||
"_from": "escodegen@>=1.3.0 <1.4.0",
|
"_from": "escodegen@1.3.x",
|
||||||
"_npmVersion": "1.4.3",
|
"_npmVersion": "1.4.3",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "constellation",
|
"name": "constellation",
|
||||||
@ -73,5 +73,6 @@
|
|||||||
},
|
},
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_shasum": "f024016f5a88e046fd12005055e939802e6c5f23",
|
"_shasum": "f024016f5a88e046fd12005055e939802e6c5f23",
|
||||||
"_resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz"
|
"_resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz",
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
5
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/esprima/package.json
generated
vendored
5
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/esprima/package.json
generated
vendored
@ -83,7 +83,7 @@
|
|||||||
"shasum": "76a0fd66fcfe154fd292667dc264019750b1657b",
|
"shasum": "76a0fd66fcfe154fd292667dc264019750b1657b",
|
||||||
"tarball": "http://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz"
|
"tarball": "http://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz"
|
||||||
},
|
},
|
||||||
"_from": "esprima@>=1.2.0 <1.3.0",
|
"_from": "esprima@1.2.x",
|
||||||
"_npmVersion": "1.4.3",
|
"_npmVersion": "1.4.3",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "ariya",
|
"name": "ariya",
|
||||||
@ -91,5 +91,6 @@
|
|||||||
},
|
},
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_shasum": "76a0fd66fcfe154fd292667dc264019750b1657b",
|
"_shasum": "76a0fd66fcfe154fd292667dc264019750b1657b",
|
||||||
"_resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz"
|
"_resolved": "https://registry.npmjs.org/esprima/-/esprima-1.2.2.tgz",
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
@ -29,5 +29,5 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/inherits",
|
"homepage": "https://github.com/isaacs/inherits",
|
||||||
"_id": "inherits@2.0.1",
|
"_id": "inherits@2.0.1",
|
||||||
"_from": "inherits@>=2.0.0 <3.0.0"
|
"_from": "inherits@2"
|
||||||
}
|
}
|
||||||
|
@ -29,5 +29,5 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/node-lru-cache",
|
"homepage": "https://github.com/isaacs/node-lru-cache",
|
||||||
"_id": "lru-cache@2.5.0",
|
"_id": "lru-cache@2.5.0",
|
||||||
"_from": "lru-cache@>=2.0.0 <3.0.0"
|
"_from": "lru-cache@2"
|
||||||
}
|
}
|
||||||
|
@ -38,5 +38,5 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/sigmund",
|
"homepage": "https://github.com/isaacs/sigmund",
|
||||||
"_id": "sigmund@1.0.0",
|
"_id": "sigmund@1.0.0",
|
||||||
"_from": "sigmund@>=1.0.0 <1.1.0"
|
"_from": "sigmund@~1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
"homepage": "https://github.com/isaacs/minimatch",
|
"homepage": "https://github.com/isaacs/minimatch",
|
||||||
"_id": "minimatch@0.3.0",
|
"_id": "minimatch@0.3.0",
|
||||||
"_shasum": "275d8edaac4f1bb3326472089e7949c8394699dd",
|
"_shasum": "275d8edaac4f1bb3326472089e7949c8394699dd",
|
||||||
"_from": "minimatch@>=0.3.0 <0.4.0",
|
"_from": "minimatch@0.3",
|
||||||
"_npmVersion": "1.4.10",
|
"_npmVersion": "1.4.10",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "isaacs",
|
"name": "isaacs",
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
"homepage": "https://github.com/isaacs/node-glob",
|
"homepage": "https://github.com/isaacs/node-glob",
|
||||||
"_id": "glob@3.2.11",
|
"_id": "glob@3.2.11",
|
||||||
"_shasum": "4a973f635b9190f715d10987d5c00fd2815ebe3d",
|
"_shasum": "4a973f635b9190f715d10987d5c00fd2815ebe3d",
|
||||||
"_from": "glob@>=3.0.0 <4.0.0",
|
"_from": "glob@3.x",
|
||||||
"_npmVersion": "1.4.10",
|
"_npmVersion": "1.4.10",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "isaacs",
|
"name": "isaacs",
|
||||||
|
@ -29,5 +29,5 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/node-lru-cache",
|
"homepage": "https://github.com/isaacs/node-lru-cache",
|
||||||
"_id": "lru-cache@2.5.0",
|
"_id": "lru-cache@2.5.0",
|
||||||
"_from": "lru-cache@>=2.0.0 <3.0.0"
|
"_from": "lru-cache@2"
|
||||||
}
|
}
|
||||||
|
@ -38,5 +38,5 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/isaacs/sigmund",
|
"homepage": "https://github.com/isaacs/sigmund",
|
||||||
"_id": "sigmund@1.0.0",
|
"_id": "sigmund@1.0.0",
|
||||||
"_from": "sigmund@>=1.0.0 <1.1.0"
|
"_from": "sigmund@~1.0.0"
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
"homepage": "https://github.com/isaacs/minimatch",
|
"homepage": "https://github.com/isaacs/minimatch",
|
||||||
"_id": "minimatch@0.4.0",
|
"_id": "minimatch@0.4.0",
|
||||||
"_shasum": "bd2c7d060d2c8c8fd7cde7f1f2ed2d5b270fdb1b",
|
"_shasum": "bd2c7d060d2c8c8fd7cde7f1f2ed2d5b270fdb1b",
|
||||||
"_from": "minimatch@>=0.0.0 <1.0.0",
|
"_from": "minimatch@0.x",
|
||||||
"_npmVersion": "1.5.0-alpha-1",
|
"_npmVersion": "1.5.0-alpha-1",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "isaacs",
|
"name": "isaacs",
|
||||||
@ -53,5 +53,6 @@
|
|||||||
"tarball": "http://registry.npmjs.org/minimatch/-/minimatch-0.4.0.tgz"
|
"tarball": "http://registry.npmjs.org/minimatch/-/minimatch-0.4.0.tgz"
|
||||||
},
|
},
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.4.0.tgz"
|
"_resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.4.0.tgz",
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
2
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/fileset/package.json
generated
vendored
2
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/fileset/package.json
generated
vendored
@ -30,5 +30,5 @@
|
|||||||
"url": "https://github.com/mklabs/node-fileset/issues"
|
"url": "https://github.com/mklabs/node-fileset/issues"
|
||||||
},
|
},
|
||||||
"_id": "fileset@0.1.5",
|
"_id": "fileset@0.1.5",
|
||||||
"_from": "fileset@>=0.1.0 <0.2.0"
|
"_from": "fileset@0.1.x"
|
||||||
}
|
}
|
||||||
|
@ -42,5 +42,5 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/substack/node-optimist",
|
"homepage": "https://github.com/substack/node-optimist",
|
||||||
"_id": "optimist@0.3.7",
|
"_id": "optimist@0.3.7",
|
||||||
"_from": "optimist@>=0.3.0 <0.4.0"
|
"_from": "optimist@~0.3"
|
||||||
}
|
}
|
||||||
|
@ -39,5 +39,5 @@
|
|||||||
"readmeFilename": "README.md",
|
"readmeFilename": "README.md",
|
||||||
"homepage": "https://github.com/caolan/async",
|
"homepage": "https://github.com/caolan/async",
|
||||||
"_id": "async@0.2.10",
|
"_id": "async@0.2.10",
|
||||||
"_from": "async@>=0.2.6 <0.3.0"
|
"_from": "async@~0.2.6"
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@
|
|||||||
},
|
},
|
||||||
"_id": "source-map@0.1.40",
|
"_id": "source-map@0.1.40",
|
||||||
"_shasum": "7e0ee49ec0452aa9ac2b93ad5ae54ef33e82b37f",
|
"_shasum": "7e0ee49ec0452aa9ac2b93ad5ae54ef33e82b37f",
|
||||||
"_from": "source-map@>=0.1.7 <0.2.0",
|
"_from": "source-map@~0.1.7",
|
||||||
"_npmVersion": "1.4.9",
|
"_npmVersion": "1.4.9",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "nickfitzgerald",
|
"name": "nickfitzgerald",
|
||||||
|
@ -35,5 +35,5 @@
|
|||||||
"url": "https://github.com/mishoo/UglifyJS2/issues"
|
"url": "https://github.com/mishoo/UglifyJS2/issues"
|
||||||
},
|
},
|
||||||
"_id": "uglify-js@2.3.6",
|
"_id": "uglify-js@2.3.6",
|
||||||
"_from": "uglify-js@>=2.3.0 <2.4.0"
|
"_from": "uglify-js@~2.3"
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
"shasum": "9e9b130a93e389491322d975cf3ec1818c37ce34",
|
"shasum": "9e9b130a93e389491322d975cf3ec1818c37ce34",
|
||||||
"tarball": "http://registry.npmjs.org/handlebars/-/handlebars-1.3.0.tgz"
|
"tarball": "http://registry.npmjs.org/handlebars/-/handlebars-1.3.0.tgz"
|
||||||
},
|
},
|
||||||
"_from": "handlebars@>=1.3.0 <1.4.0",
|
"_from": "handlebars@1.3.x",
|
||||||
"_npmVersion": "1.3.11",
|
"_npmVersion": "1.3.11",
|
||||||
"_npmUser": {
|
"_npmUser": {
|
||||||
"name": "kpdecker",
|
"name": "kpdecker",
|
||||||
@ -82,5 +82,6 @@
|
|||||||
],
|
],
|
||||||
"directories": {},
|
"directories": {},
|
||||||
"_shasum": "9e9b130a93e389491322d975cf3ec1818c37ce34",
|
"_shasum": "9e9b130a93e389491322d975cf3ec1818c37ce34",
|
||||||
"_resolved": "https://registry.npmjs.org/handlebars/-/handlebars-1.3.0.tgz"
|
"_resolved": "https://registry.npmjs.org/handlebars/-/handlebars-1.3.0.tgz",
|
||||||
|
"readme": "ERROR: No README data found!"
|
||||||
}
|
}
|
||||||
|
12
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.editorconfig
generated
vendored
12
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.editorconfig
generated
vendored
@ -1,12 +0,0 @@
|
|||||||
# Cross-editor coding style settings.
|
|
||||||
# See http://editorconfig.org/ for details.
|
|
||||||
|
|
||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
charset = utf-8
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
end_of_line = lf
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
7
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.jshintignore
generated
vendored
7
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.jshintignore
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
.git/
|
|
||||||
doc/
|
|
||||||
node_modules/
|
|
||||||
tmp/
|
|
||||||
support/
|
|
||||||
demo/
|
|
||||||
dist/
|
|
82
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.jshintrc
generated
vendored
82
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.jshintrc
generated
vendored
@ -1,82 +0,0 @@
|
|||||||
{
|
|
||||||
// Enforcing Options /////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
"bitwise" : false, // Prohibit bitwise operators (&, |, ^, etc.).
|
|
||||||
// false - specific for js-yaml
|
|
||||||
|
|
||||||
"camelcase" : false, // Require variable names to be camelCase style or UPPER_CASE
|
|
||||||
"curly" : true, // Require {} for every new block or scope.
|
|
||||||
"eqeqeq" : true, // Require triple equals i.e. `===`.
|
|
||||||
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
|
|
||||||
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
|
|
||||||
"indent" : 2, // This option enforces specific tab width for your code
|
|
||||||
"latedef" : false, // Prohibit hariable use before definition.
|
|
||||||
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
|
|
||||||
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
|
|
||||||
"noempty" : true, // Prohibit use of empty blocks.
|
|
||||||
"nonew" : true, // Prohibit use of constructors for side-effects.
|
|
||||||
"plusplus" : false, // Prohibit use of `++` & `--`.
|
|
||||||
"quotmark" : false, // Enforces the consistency of quotation marks used throughout your code.
|
|
||||||
"regexp" : false, // Prohibit `.` and `[^...]` in regular expressions.
|
|
||||||
"undef" : true, // Require all non-global variables be declared before they are used.
|
|
||||||
"unused" : false, // This option warns when you define and never use your variables.
|
|
||||||
"strict" : true, // Require `use strict` pragma in every file.
|
|
||||||
"trailing" : true, // Prohibit trailing whitespaces.
|
|
||||||
"maxparams" : 5, // Enforce max number of formal parameters allowed per function
|
|
||||||
"maxdepth" : 5, // Enforce max depth of nested blocks
|
|
||||||
"maxstatements" : false, // Enforce max amount of statements per function
|
|
||||||
"maxcomplexity" : false, // Enforce cyclomatic complexity level
|
|
||||||
|
|
||||||
// Relaxing Options //////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
|
|
||||||
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
|
|
||||||
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
|
|
||||||
"eqnull" : false, // Tolerate use of `== null`.
|
|
||||||
//"es5" : true, // Allow ECMAScript 5 syntax.
|
|
||||||
"esnext" : false, // Allow ES.next specific features such as const and let
|
|
||||||
"evil" : false, // Tolerate use of `eval`.
|
|
||||||
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
|
|
||||||
"funcscope" : false, // Tolerate declaring variables inside of control structures while accessing them later
|
|
||||||
"globalstrict" : true, // Allow global "use strict" (also enables 'strict').
|
|
||||||
"iterator" : false, // Allow usage of __iterator__ property.
|
|
||||||
"lastsemic" : false, // Tolerate semicolon omited for the last statement.
|
|
||||||
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
|
|
||||||
"laxcomma" : true, // This option suppresses warnings about comma-first coding style
|
|
||||||
"loopfunc" : false, // Allow functions to be defined within loops.
|
|
||||||
"multistr" : false, // Tolerate multi-line strings.
|
|
||||||
"onecase" : false, // Tolerate swithes with only one case.
|
|
||||||
"proto" : false, // Allow usage of __proto__ property.
|
|
||||||
"regexdash" : false, // Tolerate unescaped last dash i.e. `[-...]`.
|
|
||||||
"scripturl" : true, // Tolerate script-targeted URLs.
|
|
||||||
"smarttabs" : false, // Allow mixed tabs and spaces when the latter are used for alignmnent only.
|
|
||||||
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
|
|
||||||
"sub" : true, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
|
|
||||||
"supernew" : true, // Tolerate `new function () { ... };` and `new Object;`.
|
|
||||||
|
|
||||||
// Environments //////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
"browser" : false, // Defines globals exposed by modern browsers
|
|
||||||
"couch" : false, // Defines globals exposed by CouchDB
|
|
||||||
"devel" : false, // Allow developments statements e.g. `console.log();`.
|
|
||||||
"dojo" : false, // Defines globals exposed by the Dojo Toolkit
|
|
||||||
"jquery" : false, // Defines globals exposed by the jQuery
|
|
||||||
"mootools" : false, // Defines globals exposed by the MooTools
|
|
||||||
"node" : true, // Defines globals exposed when running under Node.JS
|
|
||||||
"nonstandard" : false, // Defines non-standard but widely adopted globals such as escape and unescape
|
|
||||||
"prototypejs" : false, // Defines globals exposed by the Prototype
|
|
||||||
"rhino" : false, // Defines globals exposed when running under Rhino
|
|
||||||
"worker" : false, // Defines globals exposed when running Web Worker
|
|
||||||
"wsh" : false, // Defines globals exposed when running under WSH
|
|
||||||
|
|
||||||
// Legacy ////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
"nomen" : false, // Prohibit use of initial or trailing underbars in names.
|
|
||||||
"onevar" : false, // Allow only one `var` statement per function.
|
|
||||||
"passfail" : false, // Stop on first error.
|
|
||||||
"white" : false, // Check against strict whitespace and indentation rules.
|
|
||||||
|
|
||||||
// Other /////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
"maxerr" : 100 // Maximum error before stopping.
|
|
||||||
}
|
|
18
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.ndocrc
generated
vendored
18
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.ndocrc
generated
vendored
@ -1,18 +0,0 @@
|
|||||||
#
|
|
||||||
# Common nodeca config
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
--index "./README.md"
|
|
||||||
--package "./package.json"
|
|
||||||
--gh-ribbon "{package.homepage}"
|
|
||||||
--output "doc"
|
|
||||||
--render "html"
|
|
||||||
--link-format "{package.homepage}/blob/master/{file}#L{line}"
|
|
||||||
--broken-links "throw"
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Paths with sources
|
|
||||||
################################################################################
|
|
||||||
|
|
||||||
lib
|
|
11
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.npmignore
generated
vendored
11
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.npmignore
generated
vendored
@ -1,11 +0,0 @@
|
|||||||
/benchmark/
|
|
||||||
/demo/
|
|
||||||
/js-yaml.js
|
|
||||||
/js-yaml.min.js
|
|
||||||
/support/
|
|
||||||
/test/
|
|
||||||
/.*
|
|
||||||
/Makefile
|
|
||||||
|
|
||||||
!/lib/js-yaml.js
|
|
||||||
|
|
5
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.travis.yml
generated
vendored
5
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/.travis.yml
generated
vendored
@ -1,5 +0,0 @@
|
|||||||
language: node_js
|
|
||||||
node_js:
|
|
||||||
- '0.10'
|
|
||||||
before_script: "make dev-deps"
|
|
||||||
script: "make test"
|
|
7
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/HISTORY.md
generated
vendored
7
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/HISTORY.md
generated
vendored
@ -1,3 +1,10 @@
|
|||||||
|
3.2.3 / 2014-11-08
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Implemented dumping of objects with circular and cross references.
|
||||||
|
- Partially fixed aliasing of constructed objects. (see issue #141 for details)
|
||||||
|
|
||||||
|
|
||||||
3.2.2 / 2014-09-07
|
3.2.2 / 2014-09-07
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
111
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/Makefile
generated
vendored
111
node_modules/grunt-istanbul/node_modules/istanbul/node_modules/js-yaml/Makefile
generated
vendored
@ -1,111 +0,0 @@
|
|||||||
PATH := ./node_modules/.bin:${PATH}
|
|
||||||
|
|
||||||
NPM_PACKAGE := $(shell node -e 'process.stdout.write(require("./package.json").name)')
|
|
||||||
NPM_VERSION := $(shell node -e 'process.stdout.write(require("./package.json").version)')
|
|
||||||
|
|
||||||
TMP_PATH := /tmp/${NPM_PACKAGE}-$(shell date +%s)
|
|
||||||
|
|
||||||
REMOTE_NAME ?= origin
|
|
||||||
REMOTE_REPO ?= $(shell git config --get remote.${REMOTE_NAME}.url)
|
|
||||||
|
|
||||||
CURR_HEAD := $(firstword $(shell git show-ref --hash HEAD | cut -b -6) master)
|
|
||||||
GITHUB_PROJ := https://github.com/nodeca/${NPM_PACKAGE}
|
|
||||||
|
|
||||||
|
|
||||||
help:
|
|
||||||
echo "make help - Print this help"
|
|
||||||
echo "make lint - Lint sources with JSHint"
|
|
||||||
echo "make test - Lint sources and run all tests"
|
|
||||||
echo "make browserify - Build browserified version"
|
|
||||||
echo "make dev-deps - Install developer dependencies"
|
|
||||||
echo "make gh-pages - Build and push API docs into gh-pages branch"
|
|
||||||
echo "make publish - Set new version tag and publish npm package"
|
|
||||||
echo "make todo - Find and list all TODOs"
|
|
||||||
|
|
||||||
|
|
||||||
lint:
|
|
||||||
if test ! `which jshint` ; then \
|
|
||||||
echo "You need 'jshint' installed in order to run lint." >&2 ; \
|
|
||||||
echo " $ make dev-deps" >&2 ; \
|
|
||||||
exit 128 ; \
|
|
||||||
fi
|
|
||||||
jshint . --show-non-errors
|
|
||||||
|
|
||||||
|
|
||||||
test: lint
|
|
||||||
@if test ! `which mocha` ; then \
|
|
||||||
echo "You need 'mocha' installed in order to run tests." >&2 ; \
|
|
||||||
echo " $ make dev-deps" >&2 ; \
|
|
||||||
exit 128 ; \
|
|
||||||
fi
|
|
||||||
NODE_ENV=test mocha -R spec
|
|
||||||
|
|
||||||
|
|
||||||
dev-deps:
|
|
||||||
@if test ! `which npm` ; then \
|
|
||||||
echo "You need 'npm' installed." >&2 ; \
|
|
||||||
echo " See: http://npmjs.org/" >&2 ; \
|
|
||||||
exit 128 ; \
|
|
||||||
fi
|
|
||||||
npm install -g jshint
|
|
||||||
npm install
|
|
||||||
|
|
||||||
|
|
||||||
gh-pages:
|
|
||||||
@if test -z ${REMOTE_REPO} ; then \
|
|
||||||
echo 'Remote repo URL not found' >&2 ; \
|
|
||||||
exit 128 ; \
|
|
||||||
fi
|
|
||||||
mkdir ${TMP_PATH}
|
|
||||||
cp -r demo/* ${TMP_PATH}
|
|
||||||
touch ${TMP_PATH}/.nojekyll
|
|
||||||
cd ${TMP_PATH} && \
|
|
||||||
git init && \
|
|
||||||
git add . && \
|
|
||||||
git commit -q -m 'Updated browserified demo'
|
|
||||||
cd ${TMP_PATH} && \
|
|
||||||
git remote add remote ${REMOTE_REPO} && \
|
|
||||||
git push --force remote +master:gh-pages
|
|
||||||
rm -rf ${TMP_PATH}
|
|
||||||
|
|
||||||
|
|
||||||
publish:
|
|
||||||
@if test 0 -ne `git status --porcelain | wc -l` ; then \
|
|
||||||
echo "Unclean working tree. Commit or stash changes first." >&2 ; \
|
|
||||||
exit 128 ; \
|
|
||||||
fi
|
|
||||||
@if test 0 -ne `git fetch ; git status | grep '^# Your branch' | wc -l` ; then \
|
|
||||||
echo "Local/Remote history differs. Please push/pull changes." >&2 ; \
|
|
||||||
exit 128 ; \
|
|
||||||
fi
|
|
||||||
@if test 0 -ne `git tag -l ${NPM_VERSION} | wc -l` ; then \
|
|
||||||
echo "Tag ${NPM_VERSION} exists. Update package.json" >&2 ; \
|
|
||||||
exit 128 ; \
|
|
||||||
fi
|
|
||||||
git tag ${NPM_VERSION} && git push origin ${NPM_VERSION}
|
|
||||||
npm publish ${GITHUB_PROJ}/tarball/${NPM_VERSION}
|
|
||||||
|
|
||||||
|
|
||||||
browserify:
|
|
||||||
if test ! `which browserify` ; then npm install browserify ; fi
|
|
||||||
if test ! `which uglifyjs` ; then npm install uglify-js ; fi
|
|
||||||
rm -rf ./dist
|
|
||||||
mkdir dist
|
|
||||||
# Browserify
|
|
||||||
( echo -n "/* ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} */" ; \
|
|
||||||
browserify -r ./ -s jsyaml -x esprima \
|
|
||||||
) > dist/js-yaml.js
|
|
||||||
# Minify
|
|
||||||
uglifyjs dist/js-yaml.js -c -m \
|
|
||||||
--preamble "/* ${NPM_PACKAGE} ${NPM_VERSION} ${GITHUB_PROJ} */" \
|
|
||||||
> dist/js-yaml.min.js
|
|
||||||
# Update browser demo
|
|
||||||
cp dist/js-yaml.js demo/js/
|
|
||||||
|
|
||||||
|
|
||||||
todo:
|
|
||||||
grep 'TODO' -n -r ./lib 2>/dev/null || test true
|
|
||||||
|
|
||||||
|
|
||||||
.PHONY: publish lint test dev-deps gh-pages todo
|
|
||||||
.SILENT: help lint test todo
|
|
@ -1,125 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var path = require('path');
|
|
||||||
var fs = require('fs');
|
|
||||||
var util = require('util');
|
|
||||||
var Benchmark = require('benchmark');
|
|
||||||
var ansi = require('ansi');
|
|
||||||
var cursor = ansi(process.stdout);
|
|
||||||
|
|
||||||
|
|
||||||
var IMPLS_DIRECTORY = path.join(__dirname, 'implementations');
|
|
||||||
var IMPLS_PATHS = {};
|
|
||||||
var IMPLS = [];
|
|
||||||
|
|
||||||
|
|
||||||
fs.readdirSync(IMPLS_DIRECTORY).sort().forEach(function (name) {
|
|
||||||
var file = path.join(IMPLS_DIRECTORY, name),
|
|
||||||
code = require(file);
|
|
||||||
|
|
||||||
IMPLS_PATHS[name] = file;
|
|
||||||
IMPLS.push({
|
|
||||||
name: name,
|
|
||||||
run: code.load
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
var SAMPLES_DIRECTORY = path.join(__dirname, 'samples');
|
|
||||||
var SAMPLES = [];
|
|
||||||
|
|
||||||
|
|
||||||
fs.readdirSync(SAMPLES_DIRECTORY).sort().forEach(function (sample) {
|
|
||||||
var filepath = path.join(SAMPLES_DIRECTORY, sample),
|
|
||||||
extname = path.extname(filepath),
|
|
||||||
basename = path.basename(filepath, extname),
|
|
||||||
content = fs.readFileSync(filepath, 'utf8'),
|
|
||||||
title = util.format('%s (%d characters)', sample, content.length);
|
|
||||||
|
|
||||||
function onComplete() {
|
|
||||||
cursor.write('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
var suite = new Benchmark.Suite(title, {
|
|
||||||
|
|
||||||
onStart: function onStart() {
|
|
||||||
console.log('\nSample: %s', title);
|
|
||||||
},
|
|
||||||
|
|
||||||
onComplete: onComplete
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
IMPLS.forEach(function (impl) {
|
|
||||||
suite.add(impl.name, {
|
|
||||||
|
|
||||||
onCycle: function onCycle(event) {
|
|
||||||
cursor.horizontalAbsolute();
|
|
||||||
cursor.eraseLine();
|
|
||||||
cursor.write(' > ' + event.target);
|
|
||||||
},
|
|
||||||
|
|
||||||
onComplete: onComplete,
|
|
||||||
|
|
||||||
fn: function () { impl.run(content); }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
SAMPLES.push({
|
|
||||||
name: basename,
|
|
||||||
title: title,
|
|
||||||
content: content,
|
|
||||||
suite: suite
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
function select(patterns) {
|
|
||||||
var result = [];
|
|
||||||
|
|
||||||
if (!(patterns instanceof Array)) {
|
|
||||||
patterns = [ patterns ];
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkName(name) {
|
|
||||||
return patterns.length === 0 || patterns.some(function (regexp) {
|
|
||||||
return regexp.test(name);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SAMPLES.forEach(function (sample) {
|
|
||||||
if (checkName(sample.name)) {
|
|
||||||
result.push(sample);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function run(files) {
|
|
||||||
var selected = select(files);
|
|
||||||
|
|
||||||
if (selected.length > 0) {
|
|
||||||
console.log('Selected samples: (%d of %d)', selected.length, SAMPLES.length);
|
|
||||||
selected.forEach(function (sample) {
|
|
||||||
console.log(' > %s', sample.name);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("There isn't any sample matches any of these patterns: %s", util.inspect(files));
|
|
||||||
}
|
|
||||||
|
|
||||||
selected.forEach(function (sample) {
|
|
||||||
sample.suite.run();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
run(process.argv.slice(2).map(function (source) {
|
|
||||||
return new RegExp(source, 'i');
|
|
||||||
}));
|
|
@ -1,3 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = require('../../../');
|
|
@ -1,15 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var fs = require('fs');
|
|
||||||
var util = require('util');
|
|
||||||
var yaml = require('./lib/js-yaml.js');
|
|
||||||
|
|
||||||
|
|
||||||
require.extensions['.yml'] = require.extensions['.yaml'] =
|
|
||||||
util.deprecate(function (m, f) {
|
|
||||||
m.exports = yaml.safeLoad(fs.readFileSync(f, 'utf8'), { filename: f });
|
|
||||||
}, 'Direct yaml files load via require() is deprecated! Use safeLoad() instead.');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = yaml;
|
|
@ -1,39 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var loader = require('./js-yaml/loader');
|
|
||||||
var dumper = require('./js-yaml/dumper');
|
|
||||||
|
|
||||||
|
|
||||||
function deprecated(name) {
|
|
||||||
return function () {
|
|
||||||
throw new Error('Function ' + name + ' is deprecated and cannot be used.');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.Type = require('./js-yaml/type');
|
|
||||||
module.exports.Schema = require('./js-yaml/schema');
|
|
||||||
module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
|
|
||||||
module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
|
|
||||||
module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
|
|
||||||
module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
|
|
||||||
module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
|
|
||||||
module.exports.load = loader.load;
|
|
||||||
module.exports.loadAll = loader.loadAll;
|
|
||||||
module.exports.safeLoad = loader.safeLoad;
|
|
||||||
module.exports.safeLoadAll = loader.safeLoadAll;
|
|
||||||
module.exports.dump = dumper.dump;
|
|
||||||
module.exports.safeDump = dumper.safeDump;
|
|
||||||
module.exports.YAMLException = require('./js-yaml/exception');
|
|
||||||
|
|
||||||
// Deprecared schema names from JS-YAML 2.0.x
|
|
||||||
module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
|
|
||||||
module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
|
|
||||||
module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
|
|
||||||
|
|
||||||
// Deprecated functions from JS-YAML 1.x.x
|
|
||||||
module.exports.scan = deprecated('scan');
|
|
||||||
module.exports.parse = deprecated('parse');
|
|
||||||
module.exports.compose = deprecated('compose');
|
|
||||||
module.exports.addConstructor = deprecated('addConstructor');
|
|
@ -1,56 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
function isNothing(subject) {
|
|
||||||
return (undefined === subject) || (null === subject);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isObject(subject) {
|
|
||||||
return ('object' === typeof subject) && (null !== subject);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toArray(sequence) {
|
|
||||||
if (Array.isArray(sequence)) {
|
|
||||||
return sequence;
|
|
||||||
} else if (isNothing(sequence)) {
|
|
||||||
return [];
|
|
||||||
} else {
|
|
||||||
return [ sequence ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function extend(target, source) {
|
|
||||||
var index, length, key, sourceKeys;
|
|
||||||
|
|
||||||
if (source) {
|
|
||||||
sourceKeys = Object.keys(source);
|
|
||||||
|
|
||||||
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
||||||
key = sourceKeys[index];
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function repeat(string, count) {
|
|
||||||
var result = '', cycle;
|
|
||||||
|
|
||||||
for (cycle = 0; cycle < count; cycle += 1) {
|
|
||||||
result += string;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.isNothing = isNothing;
|
|
||||||
module.exports.isObject = isObject;
|
|
||||||
module.exports.toArray = toArray;
|
|
||||||
module.exports.repeat = repeat;
|
|
||||||
module.exports.extend = extend;
|
|
@ -1,477 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var common = require('./common');
|
|
||||||
var YAMLException = require('./exception');
|
|
||||||
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
|
|
||||||
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
|
|
||||||
|
|
||||||
|
|
||||||
var _toString = Object.prototype.toString;
|
|
||||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
|
|
||||||
|
|
||||||
var CHAR_TAB = 0x09; /* Tab */
|
|
||||||
var CHAR_LINE_FEED = 0x0A; /* LF */
|
|
||||||
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
|
|
||||||
var CHAR_SPACE = 0x20; /* Space */
|
|
||||||
var CHAR_EXCLAMATION = 0x21; /* ! */
|
|
||||||
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
|
|
||||||
var CHAR_SHARP = 0x23; /* # */
|
|
||||||
var CHAR_PERCENT = 0x25; /* % */
|
|
||||||
var CHAR_AMPERSAND = 0x26; /* & */
|
|
||||||
var CHAR_SINGLE_QUOTE = 0x27; /* ' */
|
|
||||||
var CHAR_ASTERISK = 0x2A; /* * */
|
|
||||||
var CHAR_COMMA = 0x2C; /* , */
|
|
||||||
var CHAR_MINUS = 0x2D; /* - */
|
|
||||||
var CHAR_COLON = 0x3A; /* : */
|
|
||||||
var CHAR_GREATER_THAN = 0x3E; /* > */
|
|
||||||
var CHAR_QUESTION = 0x3F; /* ? */
|
|
||||||
var CHAR_COMMERCIAL_AT = 0x40; /* @ */
|
|
||||||
var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
|
|
||||||
var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
|
|
||||||
var CHAR_GRAVE_ACCENT = 0x60; /* ` */
|
|
||||||
var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
|
|
||||||
var CHAR_VERTICAL_LINE = 0x7C; /* | */
|
|
||||||
var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
|
|
||||||
|
|
||||||
|
|
||||||
var ESCAPE_SEQUENCES = {};
|
|
||||||
|
|
||||||
ESCAPE_SEQUENCES[0x00] = '\\0';
|
|
||||||
ESCAPE_SEQUENCES[0x07] = '\\a';
|
|
||||||
ESCAPE_SEQUENCES[0x08] = '\\b';
|
|
||||||
ESCAPE_SEQUENCES[0x09] = '\\t';
|
|
||||||
ESCAPE_SEQUENCES[0x0A] = '\\n';
|
|
||||||
ESCAPE_SEQUENCES[0x0B] = '\\v';
|
|
||||||
ESCAPE_SEQUENCES[0x0C] = '\\f';
|
|
||||||
ESCAPE_SEQUENCES[0x0D] = '\\r';
|
|
||||||
ESCAPE_SEQUENCES[0x1B] = '\\e';
|
|
||||||
ESCAPE_SEQUENCES[0x22] = '\\"';
|
|
||||||
ESCAPE_SEQUENCES[0x5C] = '\\\\';
|
|
||||||
ESCAPE_SEQUENCES[0x85] = '\\N';
|
|
||||||
ESCAPE_SEQUENCES[0xA0] = '\\_';
|
|
||||||
ESCAPE_SEQUENCES[0x2028] = '\\L';
|
|
||||||
ESCAPE_SEQUENCES[0x2029] = '\\P';
|
|
||||||
|
|
||||||
|
|
||||||
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
||||||
'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
|
|
||||||
'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
function compileStyleMap(schema, map) {
|
|
||||||
var result, keys, index, length, tag, style, type;
|
|
||||||
|
|
||||||
if (null === map) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
result = {};
|
|
||||||
keys = Object.keys(map);
|
|
||||||
|
|
||||||
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
||||||
tag = keys[index];
|
|
||||||
style = String(map[tag]);
|
|
||||||
|
|
||||||
if ('!!' === tag.slice(0, 2)) {
|
|
||||||
tag = 'tag:yaml.org,2002:' + tag.slice(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
type = schema.compiledTypeMap[tag];
|
|
||||||
|
|
||||||
if (type && _hasOwnProperty.call(type.dumpStyleAliases, style)) {
|
|
||||||
style = type.dumpStyleAliases[style];
|
|
||||||
}
|
|
||||||
|
|
||||||
result[tag] = style;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function encodeHex(character) {
|
|
||||||
var string, handle, length;
|
|
||||||
|
|
||||||
string = character.toString(16).toUpperCase();
|
|
||||||
|
|
||||||
if (character <= 0xFF) {
|
|
||||||
handle = 'x';
|
|
||||||
length = 2;
|
|
||||||
} else if (character <= 0xFFFF) {
|
|
||||||
handle = 'u';
|
|
||||||
length = 4;
|
|
||||||
} else if (character <= 0xFFFFFFFF) {
|
|
||||||
handle = 'U';
|
|
||||||
length = 8;
|
|
||||||
} else {
|
|
||||||
throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
|
|
||||||
}
|
|
||||||
|
|
||||||
return '\\' + handle + common.repeat('0', length - string.length) + string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function State(options) {
|
|
||||||
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
|
|
||||||
this.indent = Math.max(1, (options['indent'] || 2));
|
|
||||||
this.skipInvalid = options['skipInvalid'] || false;
|
|
||||||
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
|
|
||||||
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
|
|
||||||
|
|
||||||
this.implicitTypes = this.schema.compiledImplicit;
|
|
||||||
this.explicitTypes = this.schema.compiledExplicit;
|
|
||||||
|
|
||||||
this.tag = null;
|
|
||||||
this.result = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function generateNextLine(state, level) {
|
|
||||||
return '\n' + common.repeat(' ', state.indent * level);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testImplicitResolving(state, str) {
|
|
||||||
var index, length, type;
|
|
||||||
|
|
||||||
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
||||||
type = state.implicitTypes[index];
|
|
||||||
|
|
||||||
if (type.loadResolver && type.loadResolver({ result: str })) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeScalar(state, object) {
|
|
||||||
var isQuoted, checkpoint, position, length, character, first;
|
|
||||||
|
|
||||||
state.dump = '';
|
|
||||||
isQuoted = false;
|
|
||||||
checkpoint = 0;
|
|
||||||
first = object.charCodeAt(0) || 0;
|
|
||||||
|
|
||||||
if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) {
|
|
||||||
// Ensure compatibility with YAML 1.0/1.1 loaders.
|
|
||||||
isQuoted = true;
|
|
||||||
} else if (0 === object.length) {
|
|
||||||
// Quote empty string
|
|
||||||
isQuoted = true;
|
|
||||||
} else if (CHAR_SPACE === first ||
|
|
||||||
CHAR_SPACE === object.charCodeAt(object.length - 1)) {
|
|
||||||
isQuoted = true;
|
|
||||||
} else if (CHAR_MINUS === first ||
|
|
||||||
CHAR_QUESTION === first) {
|
|
||||||
// Don't check second symbol for simplicity
|
|
||||||
isQuoted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (position = 0, length = object.length; position < length; position += 1) {
|
|
||||||
character = object.charCodeAt(position);
|
|
||||||
|
|
||||||
if (!isQuoted) {
|
|
||||||
if (CHAR_TAB === character ||
|
|
||||||
CHAR_LINE_FEED === character ||
|
|
||||||
CHAR_CARRIAGE_RETURN === character ||
|
|
||||||
CHAR_COMMA === character ||
|
|
||||||
CHAR_LEFT_SQUARE_BRACKET === character ||
|
|
||||||
CHAR_RIGHT_SQUARE_BRACKET === character ||
|
|
||||||
CHAR_LEFT_CURLY_BRACKET === character ||
|
|
||||||
CHAR_RIGHT_CURLY_BRACKET === character ||
|
|
||||||
CHAR_SHARP === character ||
|
|
||||||
CHAR_AMPERSAND === character ||
|
|
||||||
CHAR_ASTERISK === character ||
|
|
||||||
CHAR_EXCLAMATION === character ||
|
|
||||||
CHAR_VERTICAL_LINE === character ||
|
|
||||||
CHAR_GREATER_THAN === character ||
|
|
||||||
CHAR_SINGLE_QUOTE === character ||
|
|
||||||
CHAR_DOUBLE_QUOTE === character ||
|
|
||||||
CHAR_PERCENT === character ||
|
|
||||||
CHAR_COMMERCIAL_AT === character ||
|
|
||||||
CHAR_COLON === character ||
|
|
||||||
CHAR_GRAVE_ACCENT === character) {
|
|
||||||
isQuoted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ESCAPE_SEQUENCES[character] ||
|
|
||||||
!((0x00020 <= character && character <= 0x00007E) ||
|
|
||||||
(0x00085 === character) ||
|
|
||||||
(0x000A0 <= character && character <= 0x00D7FF) ||
|
|
||||||
(0x0E000 <= character && character <= 0x00FFFD) ||
|
|
||||||
(0x10000 <= character && character <= 0x10FFFF))) {
|
|
||||||
state.dump += object.slice(checkpoint, position);
|
|
||||||
state.dump += ESCAPE_SEQUENCES[character] || encodeHex(character);
|
|
||||||
checkpoint = position + 1;
|
|
||||||
isQuoted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkpoint < position) {
|
|
||||||
state.dump += object.slice(checkpoint, position);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isQuoted && testImplicitResolving(state, state.dump)) {
|
|
||||||
isQuoted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isQuoted) {
|
|
||||||
state.dump = '"' + state.dump + '"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeFlowSequence(state, level, object) {
|
|
||||||
var _result = '',
|
|
||||||
_tag = state.tag,
|
|
||||||
index,
|
|
||||||
length;
|
|
||||||
|
|
||||||
for (index = 0, length = object.length; index < length; index += 1) {
|
|
||||||
// Write only valid elements.
|
|
||||||
if (writeNode(state, level, object[index], false, false)) {
|
|
||||||
if (0 !== index) {
|
|
||||||
_result += ', ';
|
|
||||||
}
|
|
||||||
_result += state.dump;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
state.tag = _tag;
|
|
||||||
state.dump = '[' + _result + ']';
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeBlockSequence(state, level, object, compact) {
|
|
||||||
var _result = '',
|
|
||||||
_tag = state.tag,
|
|
||||||
index,
|
|
||||||
length;
|
|
||||||
|
|
||||||
for (index = 0, length = object.length; index < length; index += 1) {
|
|
||||||
// Write only valid elements.
|
|
||||||
if (writeNode(state, level + 1, object[index], true, true)) {
|
|
||||||
if (!compact || 0 !== index) {
|
|
||||||
_result += generateNextLine(state, level);
|
|
||||||
}
|
|
||||||
_result += '- ' + state.dump;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
state.tag = _tag;
|
|
||||||
state.dump = _result || '[]'; // Empty sequence if no valid values.
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeFlowMapping(state, level, object) {
|
|
||||||
var _result = '',
|
|
||||||
_tag = state.tag,
|
|
||||||
objectKeyList = Object.keys(object),
|
|
||||||
index,
|
|
||||||
length,
|
|
||||||
objectKey,
|
|
||||||
objectValue,
|
|
||||||
pairBuffer;
|
|
||||||
|
|
||||||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
||||||
pairBuffer = '';
|
|
||||||
|
|
||||||
if (0 !== index) {
|
|
||||||
pairBuffer += ', ';
|
|
||||||
}
|
|
||||||
|
|
||||||
objectKey = objectKeyList[index];
|
|
||||||
objectValue = object[objectKey];
|
|
||||||
|
|
||||||
if (!writeNode(state, level, objectKey, false, false)) {
|
|
||||||
continue; // Skip this pair because of invalid key;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.dump.length > 1024) {
|
|
||||||
pairBuffer += '? ';
|
|
||||||
}
|
|
||||||
|
|
||||||
pairBuffer += state.dump + ': ';
|
|
||||||
|
|
||||||
if (!writeNode(state, level, objectValue, false, false)) {
|
|
||||||
continue; // Skip this pair because of invalid value.
|
|
||||||
}
|
|
||||||
|
|
||||||
pairBuffer += state.dump;
|
|
||||||
|
|
||||||
// Both key and value are valid.
|
|
||||||
_result += pairBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
state.tag = _tag;
|
|
||||||
state.dump = '{' + _result + '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeBlockMapping(state, level, object, compact) {
|
|
||||||
var _result = '',
|
|
||||||
_tag = state.tag,
|
|
||||||
objectKeyList = Object.keys(object),
|
|
||||||
index,
|
|
||||||
length,
|
|
||||||
objectKey,
|
|
||||||
objectValue,
|
|
||||||
explicitPair,
|
|
||||||
pairBuffer;
|
|
||||||
|
|
||||||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
||||||
pairBuffer = '';
|
|
||||||
|
|
||||||
if (!compact || 0 !== index) {
|
|
||||||
pairBuffer += generateNextLine(state, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
objectKey = objectKeyList[index];
|
|
||||||
objectValue = object[objectKey];
|
|
||||||
|
|
||||||
if (!writeNode(state, level + 1, objectKey, true, true)) {
|
|
||||||
continue; // Skip this pair because of invalid key.
|
|
||||||
}
|
|
||||||
|
|
||||||
explicitPair = (null !== state.tag && '?' !== state.tag) ||
|
|
||||||
(state.dump && state.dump.length > 1024);
|
|
||||||
|
|
||||||
if (explicitPair) {
|
|
||||||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
||||||
pairBuffer += '?';
|
|
||||||
} else {
|
|
||||||
pairBuffer += '? ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pairBuffer += state.dump;
|
|
||||||
|
|
||||||
if (explicitPair) {
|
|
||||||
pairBuffer += generateNextLine(state, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
||||||
continue; // Skip this pair because of invalid value.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
||||||
pairBuffer += ':';
|
|
||||||
} else {
|
|
||||||
pairBuffer += ': ';
|
|
||||||
}
|
|
||||||
|
|
||||||
pairBuffer += state.dump;
|
|
||||||
|
|
||||||
// Both key and value are valid.
|
|
||||||
_result += pairBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
state.tag = _tag;
|
|
||||||
state.dump = _result || '{}'; // Empty mapping if no valid pairs.
|
|
||||||
}
|
|
||||||
|
|
||||||
function detectType(state, object, explicit) {
|
|
||||||
var _result, typeList, index, length, type, style;
|
|
||||||
|
|
||||||
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
||||||
|
|
||||||
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
||||||
type = typeList[index];
|
|
||||||
|
|
||||||
if ((type.dumpInstanceOf || type.dumpPredicate) &&
|
|
||||||
(!type.dumpInstanceOf || (('object' === typeof object) && (object instanceof type.dumpInstanceOf))) &&
|
|
||||||
(!type.dumpPredicate || type.dumpPredicate(object))) {
|
|
||||||
|
|
||||||
state.tag = explicit ? type.tag : '?';
|
|
||||||
|
|
||||||
if (type.dumpRepresenter) {
|
|
||||||
style = state.styleMap[type.tag] || type.dumpDefaultStyle;
|
|
||||||
|
|
||||||
if ('[object Function]' === _toString.call(type.dumpRepresenter)) {
|
|
||||||
_result = type.dumpRepresenter(object, style);
|
|
||||||
} else if (_hasOwnProperty.call(type.dumpRepresenter, style)) {
|
|
||||||
_result = type.dumpRepresenter[style](object, style);
|
|
||||||
} else {
|
|
||||||
throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
||||||
}
|
|
||||||
|
|
||||||
state.dump = _result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Serializes `object` and writes it to global `result`.
|
|
||||||
// Returns true on success, or false on invalid object.
|
|
||||||
//
|
|
||||||
function writeNode(state, level, object, block, compact) {
|
|
||||||
state.tag = null;
|
|
||||||
state.dump = object;
|
|
||||||
|
|
||||||
if (!detectType(state, object, false)) {
|
|
||||||
detectType(state, object, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var type = _toString.call(state.dump);
|
|
||||||
|
|
||||||
if (block) {
|
|
||||||
block = (0 > state.flowLevel || state.flowLevel > level);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((null !== state.tag && '?' !== state.tag) || (2 !== state.indent && level > 0)) {
|
|
||||||
compact = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('[object Object]' === type) {
|
|
||||||
if (block && (0 !== Object.keys(state.dump).length)) {
|
|
||||||
writeBlockMapping(state, level, state.dump, compact);
|
|
||||||
} else {
|
|
||||||
writeFlowMapping(state, level, state.dump);
|
|
||||||
}
|
|
||||||
} else if ('[object Array]' === type) {
|
|
||||||
if (block && (0 !== state.dump.length)) {
|
|
||||||
writeBlockSequence(state, level, state.dump, compact);
|
|
||||||
} else {
|
|
||||||
writeFlowSequence(state, level, state.dump);
|
|
||||||
}
|
|
||||||
} else if ('[object String]' === type) {
|
|
||||||
if ('?' !== state.tag) {
|
|
||||||
writeScalar(state, state.dump);
|
|
||||||
}
|
|
||||||
} else if (state.skipInvalid) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
throw new YAMLException('unacceptable kind of an object to dump ' + type);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== state.tag && '?' !== state.tag) {
|
|
||||||
state.dump = '!<' + state.tag + '> ' + state.dump;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function dump(input, options) {
|
|
||||||
options = options || {};
|
|
||||||
|
|
||||||
var state = new State(options);
|
|
||||||
|
|
||||||
if (writeNode(state, 0, input, true, true)) {
|
|
||||||
return state.dump + '\n';
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function safeDump(input, options) {
|
|
||||||
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.dump = dump;
|
|
||||||
module.exports.safeDump = safeDump;
|
|
@ -1,25 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
function YAMLException(reason, mark) {
|
|
||||||
this.name = 'YAMLException';
|
|
||||||
this.reason = reason;
|
|
||||||
this.mark = mark;
|
|
||||||
this.message = this.toString(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
YAMLException.prototype.toString = function toString(compact) {
|
|
||||||
var result;
|
|
||||||
|
|
||||||
result = 'JS-YAML: ' + (this.reason || '(unknown reason)');
|
|
||||||
|
|
||||||
if (!compact && this.mark) {
|
|
||||||
result += ' ' + this.mark.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = YAMLException;
|
|
File diff suppressed because it is too large
Load Diff
@ -1,78 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var common = require('./common');
|
|
||||||
|
|
||||||
|
|
||||||
function Mark(name, buffer, position, line, column) {
|
|
||||||
this.name = name;
|
|
||||||
this.buffer = buffer;
|
|
||||||
this.position = position;
|
|
||||||
this.line = line;
|
|
||||||
this.column = column;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
||||||
var head, start, tail, end, snippet;
|
|
||||||
|
|
||||||
if (!this.buffer) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
indent = indent || 4;
|
|
||||||
maxLength = maxLength || 75;
|
|
||||||
|
|
||||||
head = '';
|
|
||||||
start = this.position;
|
|
||||||
|
|
||||||
while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) {
|
|
||||||
start -= 1;
|
|
||||||
if (this.position - start > (maxLength / 2 - 1)) {
|
|
||||||
head = ' ... ';
|
|
||||||
start += 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tail = '';
|
|
||||||
end = this.position;
|
|
||||||
|
|
||||||
while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) {
|
|
||||||
end += 1;
|
|
||||||
if (end - this.position > (maxLength / 2 - 1)) {
|
|
||||||
tail = ' ... ';
|
|
||||||
end -= 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet = this.buffer.slice(start, end);
|
|
||||||
|
|
||||||
return common.repeat(' ', indent) + head + snippet + tail + '\n' +
|
|
||||||
common.repeat(' ', indent + this.position - start + head.length) + '^';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Mark.prototype.toString = function toString(compact) {
|
|
||||||
var snippet, where = '';
|
|
||||||
|
|
||||||
if (this.name) {
|
|
||||||
where += 'in "' + this.name + '" ';
|
|
||||||
}
|
|
||||||
|
|
||||||
where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
|
|
||||||
|
|
||||||
if (!compact) {
|
|
||||||
snippet = this.getSnippet();
|
|
||||||
|
|
||||||
if (snippet) {
|
|
||||||
where += ':\n' + snippet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return where;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = Mark;
|
|
@ -1,103 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var common = require('./common');
|
|
||||||
var YAMLException = require('./exception');
|
|
||||||
var Type = require('./type');
|
|
||||||
|
|
||||||
|
|
||||||
function compileList(schema, name, result) {
|
|
||||||
var exclude = [];
|
|
||||||
|
|
||||||
schema.include.forEach(function (includedSchema) {
|
|
||||||
result = compileList(includedSchema, name, result);
|
|
||||||
});
|
|
||||||
|
|
||||||
schema[name].forEach(function (currentType) {
|
|
||||||
result.forEach(function (previousType, previousIndex) {
|
|
||||||
if (previousType.tag === currentType.tag) {
|
|
||||||
exclude.push(previousIndex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
result.push(currentType);
|
|
||||||
});
|
|
||||||
|
|
||||||
return result.filter(function (type, index) {
|
|
||||||
return -1 === exclude.indexOf(index);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function compileMap(/* lists... */) {
|
|
||||||
var result = {}, index, length;
|
|
||||||
|
|
||||||
function collectType(type) {
|
|
||||||
result[type.tag] = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
||||||
arguments[index].forEach(collectType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function Schema(definition) {
|
|
||||||
this.include = definition.include || [];
|
|
||||||
this.implicit = definition.implicit || [];
|
|
||||||
this.explicit = definition.explicit || [];
|
|
||||||
|
|
||||||
this.implicit.forEach(function (type) {
|
|
||||||
if (type.loadKind && 'scalar' !== type.loadKind) {
|
|
||||||
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.compiledImplicit = compileList(this, 'implicit', []);
|
|
||||||
this.compiledExplicit = compileList(this, 'explicit', []);
|
|
||||||
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Schema.DEFAULT = null;
|
|
||||||
|
|
||||||
|
|
||||||
Schema.create = function createSchema() {
|
|
||||||
var schemas, types;
|
|
||||||
|
|
||||||
switch (arguments.length) {
|
|
||||||
case 1:
|
|
||||||
schemas = Schema.DEFAULT;
|
|
||||||
types = arguments[0];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
schemas = arguments[0];
|
|
||||||
types = arguments[1];
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new YAMLException('Wrong number of arguments for Schema.create function');
|
|
||||||
}
|
|
||||||
|
|
||||||
schemas = common.toArray(schemas);
|
|
||||||
types = common.toArray(types);
|
|
||||||
|
|
||||||
if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
|
|
||||||
throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!types.every(function (type) { return type instanceof Type; })) {
|
|
||||||
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Schema({
|
|
||||||
include: schemas,
|
|
||||||
explicit: types
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = Schema;
|
|
@ -1,18 +0,0 @@
|
|||||||
// Standard YAML's Core schema.
|
|
||||||
// http://www.yaml.org/spec/1.2/spec.html#id2804923
|
|
||||||
//
|
|
||||||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
|
||||||
// So, Core schema has no distinctions from JSON schema is JS-YAML.
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Schema({
|
|
||||||
include: [
|
|
||||||
require('./json')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,25 +0,0 @@
|
|||||||
// JS-YAML's default schema for `load` function.
|
|
||||||
// It is not described in the YAML specification.
|
|
||||||
//
|
|
||||||
// This schema is based on JS-YAML's default safe schema and includes
|
|
||||||
// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
|
|
||||||
//
|
|
||||||
// Also this schema is used as default base schema at `Schema.create` function.
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = Schema.DEFAULT = new Schema({
|
|
||||||
include: [
|
|
||||||
require('./default_safe')
|
|
||||||
],
|
|
||||||
explicit: [
|
|
||||||
require('../type/js/undefined'),
|
|
||||||
require('../type/js/regexp'),
|
|
||||||
require('../type/js/function')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,28 +0,0 @@
|
|||||||
// JS-YAML's default schema for `safeLoad` function.
|
|
||||||
// It is not described in the YAML specification.
|
|
||||||
//
|
|
||||||
// This schema is based on standard YAML's Core schema and includes most of
|
|
||||||
// extra types described at YAML tag repository. (http://yaml.org/type/)
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Schema({
|
|
||||||
include: [
|
|
||||||
require('./core')
|
|
||||||
],
|
|
||||||
implicit: [
|
|
||||||
require('../type/timestamp'),
|
|
||||||
require('../type/merge')
|
|
||||||
],
|
|
||||||
explicit: [
|
|
||||||
require('../type/binary'),
|
|
||||||
require('../type/omap'),
|
|
||||||
require('../type/pairs'),
|
|
||||||
require('../type/set')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,17 +0,0 @@
|
|||||||
// Standard YAML's Failsafe schema.
|
|
||||||
// http://www.yaml.org/spec/1.2/spec.html#id2802346
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Schema({
|
|
||||||
explicit: [
|
|
||||||
require('../type/str'),
|
|
||||||
require('../type/seq'),
|
|
||||||
require('../type/map')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,25 +0,0 @@
|
|||||||
// Standard YAML's JSON schema.
|
|
||||||
// http://www.yaml.org/spec/1.2/spec.html#id2803231
|
|
||||||
//
|
|
||||||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
|
||||||
// So, this schema is not such strict as defined in the YAML specification.
|
|
||||||
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Schema({
|
|
||||||
include: [
|
|
||||||
require('./failsafe')
|
|
||||||
],
|
|
||||||
implicit: [
|
|
||||||
require('../type/null'),
|
|
||||||
require('../type/bool'),
|
|
||||||
require('../type/int'),
|
|
||||||
require('../type/float')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,65 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var YAMLException = require('./exception');
|
|
||||||
|
|
||||||
|
|
||||||
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
||||||
'loadKind',
|
|
||||||
'loadResolver',
|
|
||||||
'dumpInstanceOf',
|
|
||||||
'dumpPredicate',
|
|
||||||
'dumpRepresenter',
|
|
||||||
'dumpDefaultStyle',
|
|
||||||
'dumpStyleAliases'
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
var YAML_NODE_KINDS = [
|
|
||||||
'scalar',
|
|
||||||
'sequence',
|
|
||||||
'mapping'
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
function compileStyleAliases(map) {
|
|
||||||
var result = {};
|
|
||||||
|
|
||||||
if (null !== map) {
|
|
||||||
Object.keys(map).forEach(function (style) {
|
|
||||||
map[style].forEach(function (alias) {
|
|
||||||
result[String(alias)] = style;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function Type(tag, options) {
|
|
||||||
options = options || {};
|
|
||||||
|
|
||||||
Object.keys(options).forEach(function (name) {
|
|
||||||
if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) {
|
|
||||||
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO: Add tag format check.
|
|
||||||
this.tag = tag;
|
|
||||||
this.loadKind = options['loadKind'] || null;
|
|
||||||
this.loadResolver = options['loadResolver'] || null;
|
|
||||||
this.dumpInstanceOf = options['dumpInstanceOf'] || null;
|
|
||||||
this.dumpPredicate = options['dumpPredicate'] || null;
|
|
||||||
this.dumpRepresenter = options['dumpRepresenter'] || null;
|
|
||||||
this.dumpDefaultStyle = options['dumpDefaultStyle'] || null;
|
|
||||||
this.dumpStyleAliases = compileStyleAliases(options['dumpStyleAliases'] || null);
|
|
||||||
|
|
||||||
if (-1 === YAML_NODE_KINDS.indexOf(this.loadKind)) {
|
|
||||||
throw new YAMLException('Unknown loadKind "' + this.loadKind + '" is specified for "' + tag + '" YAML type.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = Type;
|
|
@ -1,125 +0,0 @@
|
|||||||
// Modified from:
|
|
||||||
// https://raw.github.com/kanaka/noVNC/d890e8640f20fba3215ba7be8e0ff145aeb8c17c/include/base64.js
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// A trick for browserified version.
|
|
||||||
// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined
|
|
||||||
var NodeBuffer = require('buffer').Buffer;
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var BASE64_PADDING = '=';
|
|
||||||
|
|
||||||
var BASE64_BINTABLE = [
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
|
|
||||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1,
|
|
||||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
|
|
||||||
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
|
||||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
|
|
||||||
];
|
|
||||||
|
|
||||||
var BASE64_CHARTABLE =
|
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlBinary(state) {
|
|
||||||
var value, code, idx = 0, result = [], leftbits, leftdata,
|
|
||||||
object = state.result;
|
|
||||||
|
|
||||||
leftbits = 0; // number of bits decoded, but yet to be appended
|
|
||||||
leftdata = 0; // bits decoded, but yet to be appended
|
|
||||||
|
|
||||||
// Convert one by one.
|
|
||||||
for (idx = 0; idx < object.length; idx += 1) {
|
|
||||||
code = object.charCodeAt(idx);
|
|
||||||
value = BASE64_BINTABLE[code & 0x7F];
|
|
||||||
|
|
||||||
// Skip LF(NL) || CR
|
|
||||||
if (0x0A !== code && 0x0D !== code) {
|
|
||||||
// Fail on illegal characters
|
|
||||||
if (-1 === value) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect data into leftdata, update bitcount
|
|
||||||
leftdata = (leftdata << 6) | value;
|
|
||||||
leftbits += 6;
|
|
||||||
|
|
||||||
// If we have 8 or more bits, append 8 bits to the result
|
|
||||||
if (leftbits >= 8) {
|
|
||||||
leftbits -= 8;
|
|
||||||
|
|
||||||
// Append if not padding.
|
|
||||||
if (BASE64_PADDING !== object.charAt(idx)) {
|
|
||||||
result.push((leftdata >> leftbits) & 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
leftdata &= (1 << leftbits) - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are any bits left, the base64 string was corrupted
|
|
||||||
if (leftbits) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
// Wrap into Buffer for NodeJS and leave Array for browser
|
|
||||||
if (NodeBuffer) {
|
|
||||||
state.result = new NodeBuffer(result);
|
|
||||||
} else {
|
|
||||||
state.result = result;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function representYamlBinary(object /*, style*/) {
|
|
||||||
var result = '', index, length, rest;
|
|
||||||
|
|
||||||
// Convert every three bytes to 4 ASCII characters.
|
|
||||||
for (index = 0, length = object.length - 2; index < length; index += 3) {
|
|
||||||
result += BASE64_CHARTABLE[object[index + 0] >> 2];
|
|
||||||
result += BASE64_CHARTABLE[((object[index + 0] & 0x03) << 4) + (object[index + 1] >> 4)];
|
|
||||||
result += BASE64_CHARTABLE[((object[index + 1] & 0x0F) << 2) + (object[index + 2] >> 6)];
|
|
||||||
result += BASE64_CHARTABLE[object[index + 2] & 0x3F];
|
|
||||||
}
|
|
||||||
|
|
||||||
rest = object.length % 3;
|
|
||||||
|
|
||||||
// Convert the remaining 1 or 2 bytes, padding out to 4 characters.
|
|
||||||
if (0 !== rest) {
|
|
||||||
index = object.length - rest;
|
|
||||||
result += BASE64_CHARTABLE[object[index + 0] >> 2];
|
|
||||||
|
|
||||||
if (2 === rest) {
|
|
||||||
result += BASE64_CHARTABLE[((object[index + 0] & 0x03) << 4) + (object[index + 1] >> 4)];
|
|
||||||
result += BASE64_CHARTABLE[(object[index + 1] & 0x0F) << 2];
|
|
||||||
result += BASE64_PADDING;
|
|
||||||
} else {
|
|
||||||
result += BASE64_CHARTABLE[(object[index + 0] & 0x03) << 4];
|
|
||||||
result += BASE64_PADDING + BASE64_PADDING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isBinary(object) {
|
|
||||||
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:binary', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveYamlBinary,
|
|
||||||
dumpPredicate: isBinary,
|
|
||||||
dumpRepresenter: representYamlBinary
|
|
||||||
});
|
|
@ -1,67 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
var YAML_IMPLICIT_BOOLEAN_MAP = {
|
|
||||||
'true' : true,
|
|
||||||
'True' : true,
|
|
||||||
'TRUE' : true,
|
|
||||||
'false' : false,
|
|
||||||
'False' : false,
|
|
||||||
'FALSE' : false
|
|
||||||
};
|
|
||||||
|
|
||||||
/*var YAML_EXPLICIT_BOOLEAN_MAP = {
|
|
||||||
'true' : true,
|
|
||||||
'True' : true,
|
|
||||||
'TRUE' : true,
|
|
||||||
'false' : false,
|
|
||||||
'False' : false,
|
|
||||||
'FALSE' : false,
|
|
||||||
'y' : true,
|
|
||||||
'Y' : true,
|
|
||||||
'yes' : true,
|
|
||||||
'Yes' : true,
|
|
||||||
'YES' : true,
|
|
||||||
'n' : false,
|
|
||||||
'N' : false,
|
|
||||||
'no' : false,
|
|
||||||
'No' : false,
|
|
||||||
'NO' : false,
|
|
||||||
'on' : true,
|
|
||||||
'On' : true,
|
|
||||||
'ON' : true,
|
|
||||||
'off' : false,
|
|
||||||
'Off' : false,
|
|
||||||
'OFF' : false
|
|
||||||
};*/
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlBoolean(state) {
|
|
||||||
if (YAML_IMPLICIT_BOOLEAN_MAP.hasOwnProperty(state.result)) {
|
|
||||||
state.result = YAML_IMPLICIT_BOOLEAN_MAP[state.result];
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isBoolean(object) {
|
|
||||||
return '[object Boolean]' === Object.prototype.toString.call(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:bool', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveYamlBoolean,
|
|
||||||
dumpPredicate: isBoolean,
|
|
||||||
dumpRepresenter: {
|
|
||||||
lowercase: function (object) { return object ? 'true' : 'false'; },
|
|
||||||
uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
|
|
||||||
camelcase: function (object) { return object ? 'True' : 'False'; }
|
|
||||||
},
|
|
||||||
dumpDefaultStyle: 'lowercase'
|
|
||||||
});
|
|
@ -1,108 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
var YAML_FLOAT_PATTERN = new RegExp(
|
|
||||||
'^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
|
|
||||||
'|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
|
|
||||||
'|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
|
|
||||||
'|[-+]?\\.(?:inf|Inf|INF)' +
|
|
||||||
'|\\.(?:nan|NaN|NAN))$');
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlFloat(state) {
|
|
||||||
var value, sign, base, digits,
|
|
||||||
object = state.result;
|
|
||||||
|
|
||||||
if (!YAML_FLOAT_PATTERN.test(object)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = object.replace(/_/g, '').toLowerCase();
|
|
||||||
sign = '-' === value[0] ? -1 : 1;
|
|
||||||
digits = [];
|
|
||||||
|
|
||||||
if (0 <= '+-'.indexOf(value[0])) {
|
|
||||||
value = value.slice(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('.inf' === value) {
|
|
||||||
state.result = (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if ('.nan' === value) {
|
|
||||||
state.result = NaN;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (0 <= value.indexOf(':')) {
|
|
||||||
value.split(':').forEach(function (v) {
|
|
||||||
digits.unshift(parseFloat(v, 10));
|
|
||||||
});
|
|
||||||
|
|
||||||
value = 0.0;
|
|
||||||
base = 1;
|
|
||||||
|
|
||||||
digits.forEach(function (d) {
|
|
||||||
value += d * base;
|
|
||||||
base *= 60;
|
|
||||||
});
|
|
||||||
|
|
||||||
state.result = sign * value;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
state.result = sign * parseFloat(value, 10);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function representYamlFloat(object, style) {
|
|
||||||
if (isNaN(object)) {
|
|
||||||
switch (style) {
|
|
||||||
case 'lowercase':
|
|
||||||
return '.nan';
|
|
||||||
case 'uppercase':
|
|
||||||
return '.NAN';
|
|
||||||
case 'camelcase':
|
|
||||||
return '.NaN';
|
|
||||||
}
|
|
||||||
} else if (Number.POSITIVE_INFINITY === object) {
|
|
||||||
switch (style) {
|
|
||||||
case 'lowercase':
|
|
||||||
return '.inf';
|
|
||||||
case 'uppercase':
|
|
||||||
return '.INF';
|
|
||||||
case 'camelcase':
|
|
||||||
return '.Inf';
|
|
||||||
}
|
|
||||||
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
||||||
switch (style) {
|
|
||||||
case 'lowercase':
|
|
||||||
return '-.inf';
|
|
||||||
case 'uppercase':
|
|
||||||
return '-.INF';
|
|
||||||
case 'camelcase':
|
|
||||||
return '-.Inf';
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return object.toString(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isFloat(object) {
|
|
||||||
return ('[object Number]' === Object.prototype.toString.call(object)) &&
|
|
||||||
(0 !== object % 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:float', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveYamlFloat,
|
|
||||||
dumpPredicate: isFloat,
|
|
||||||
dumpRepresenter: representYamlFloat,
|
|
||||||
dumpDefaultStyle: 'lowercase'
|
|
||||||
});
|
|
@ -1,93 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
var YAML_INTEGER_PATTERN = new RegExp(
|
|
||||||
'^(?:[-+]?0b[0-1_]+' +
|
|
||||||
'|[-+]?0[0-7_]+' +
|
|
||||||
'|[-+]?(?:0|[1-9][0-9_]*)' +
|
|
||||||
'|[-+]?0x[0-9a-fA-F_]+' +
|
|
||||||
'|[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$');
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlInteger(state) {
|
|
||||||
var value, sign, base, digits,
|
|
||||||
object = state.result;
|
|
||||||
|
|
||||||
if (!YAML_INTEGER_PATTERN.test(object)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
value = object.replace(/_/g, '');
|
|
||||||
sign = '-' === value[0] ? -1 : 1;
|
|
||||||
digits = [];
|
|
||||||
|
|
||||||
if (0 <= '+-'.indexOf(value[0])) {
|
|
||||||
value = value.slice(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('0' === value) {
|
|
||||||
state.result = 0;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (/^0b/.test(value)) {
|
|
||||||
state.result = sign * parseInt(value.slice(2), 2);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (/^0x/.test(value)) {
|
|
||||||
state.result = sign * parseInt(value, 16);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if ('0' === value[0]) {
|
|
||||||
state.result = sign * parseInt(value, 8);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (0 <= value.indexOf(':')) {
|
|
||||||
value.split(':').forEach(function (v) {
|
|
||||||
digits.unshift(parseInt(v, 10));
|
|
||||||
});
|
|
||||||
|
|
||||||
value = 0;
|
|
||||||
base = 1;
|
|
||||||
|
|
||||||
digits.forEach(function (d) {
|
|
||||||
value += (d * base);
|
|
||||||
base *= 60;
|
|
||||||
});
|
|
||||||
|
|
||||||
state.result = sign * value;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
state.result = sign * parseInt(value, 10);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isInteger(object) {
|
|
||||||
return ('[object Number]' === Object.prototype.toString.call(object)) &&
|
|
||||||
(0 === object % 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:int', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveYamlInteger,
|
|
||||||
dumpPredicate: isInteger,
|
|
||||||
dumpRepresenter: {
|
|
||||||
binary: function (object) { return '0b' + object.toString(2); },
|
|
||||||
octal: function (object) { return '0' + object.toString(8); },
|
|
||||||
decimal: function (object) { return object.toString(10); },
|
|
||||||
hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
|
|
||||||
},
|
|
||||||
dumpDefaultStyle: 'decimal',
|
|
||||||
dumpStyleAliases: {
|
|
||||||
binary: [ 2, 'bin' ],
|
|
||||||
octal: [ 8, 'oct' ],
|
|
||||||
decimal: [ 10, 'dec' ],
|
|
||||||
hexadecimal: [ 16, 'hex' ]
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,71 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var esprima;
|
|
||||||
|
|
||||||
// Browserified version does not have esprima
|
|
||||||
//
|
|
||||||
// 1. For node.js just require module as deps
|
|
||||||
// 2. For browser try to require mudule via external AMD system.
|
|
||||||
// If not found - try to fallback to window.esprima. If not
|
|
||||||
// found too - then fail to parse.
|
|
||||||
//
|
|
||||||
try {
|
|
||||||
esprima = require('esprima');
|
|
||||||
} catch (_) {
|
|
||||||
/*global window */
|
|
||||||
if (window) { esprima = window.esprima; }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../../type');
|
|
||||||
|
|
||||||
|
|
||||||
function resolveJavascriptFunction(state) {
|
|
||||||
/*jslint evil:true*/
|
|
||||||
|
|
||||||
try {
|
|
||||||
var source = '(' + state.result + ')',
|
|
||||||
ast = esprima.parse(source, { range: true }),
|
|
||||||
params = [],
|
|
||||||
body;
|
|
||||||
|
|
||||||
if ('Program' !== ast.type ||
|
|
||||||
1 !== ast.body.length ||
|
|
||||||
'ExpressionStatement' !== ast.body[0].type ||
|
|
||||||
'FunctionExpression' !== ast.body[0].expression.type) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ast.body[0].expression.params.forEach(function (param) {
|
|
||||||
params.push(param.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
body = ast.body[0].expression.body.range;
|
|
||||||
|
|
||||||
// Esprima's ranges include the first '{' and the last '}' characters on
|
|
||||||
// function expressions. So cut them out.
|
|
||||||
state.result = new Function(params, source.slice(body[0]+1, body[1]-1));
|
|
||||||
return true;
|
|
||||||
} catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function representJavascriptFunction(object /*, style*/) {
|
|
||||||
return object.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isFunction(object) {
|
|
||||||
return '[object Function]' === Object.prototype.toString.call(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:js/function', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveJavascriptFunction,
|
|
||||||
dumpPredicate: isFunction,
|
|
||||||
dumpRepresenter: representJavascriptFunction
|
|
||||||
});
|
|
@ -1,56 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../../type');
|
|
||||||
|
|
||||||
|
|
||||||
function resolveJavascriptRegExp(state) {
|
|
||||||
var regexp = state.result,
|
|
||||||
tail = /\/([gim]*)$/.exec(state.result),
|
|
||||||
modifiers;
|
|
||||||
|
|
||||||
// `/foo/gim` - tail can be maximum 4 chars
|
|
||||||
if ('/' === regexp[0] && tail && 4 >= tail[0].length) {
|
|
||||||
regexp = regexp.slice(1, regexp.length - tail[0].length);
|
|
||||||
modifiers = tail[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
state.result = new RegExp(regexp, modifiers);
|
|
||||||
return true;
|
|
||||||
} catch (error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function representJavascriptRegExp(object /*, style*/) {
|
|
||||||
var result = '/' + object.source + '/';
|
|
||||||
|
|
||||||
if (object.global) {
|
|
||||||
result += 'g';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object.multiline) {
|
|
||||||
result += 'm';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object.ignoreCase) {
|
|
||||||
result += 'i';
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isRegExp(object) {
|
|
||||||
return '[object RegExp]' === Object.prototype.toString.call(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:js/regexp', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveJavascriptRegExp,
|
|
||||||
dumpPredicate: isRegExp,
|
|
||||||
dumpRepresenter: representJavascriptRegExp
|
|
||||||
});
|
|
@ -1,28 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../../type');
|
|
||||||
|
|
||||||
|
|
||||||
function resolveJavascriptUndefined(state) {
|
|
||||||
state.result = undefined;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function representJavascriptUndefined(/*object, explicit*/) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isUndefined(object) {
|
|
||||||
return 'undefined' === typeof object;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:js/undefined', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveJavascriptUndefined,
|
|
||||||
dumpPredicate: isUndefined,
|
|
||||||
dumpRepresenter: representJavascriptUndefined
|
|
||||||
});
|
|
@ -1,9 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:map', {
|
|
||||||
loadKind: 'mapping'
|
|
||||||
});
|
|
@ -1,15 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlMerge(state) {
|
|
||||||
return '<<' === state.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:merge', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveYamlMerge
|
|
||||||
});
|
|
@ -1,40 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
var YAML_NULL_MAP = {
|
|
||||||
'~' : true,
|
|
||||||
'null' : true,
|
|
||||||
'Null' : true,
|
|
||||||
'NULL' : true
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlNull(state) {
|
|
||||||
if (YAML_NULL_MAP.hasOwnProperty(state.result)) {
|
|
||||||
state.result = null;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isNull(object) {
|
|
||||||
return null === object;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:null', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveYamlNull,
|
|
||||||
dumpPredicate: isNull,
|
|
||||||
dumpRepresenter: {
|
|
||||||
canonical: function () { return '~'; },
|
|
||||||
lowercase: function () { return 'null'; },
|
|
||||||
uppercase: function () { return 'NULL'; },
|
|
||||||
camelcase: function () { return 'Null'; }
|
|
||||||
},
|
|
||||||
dumpDefaultStyle: 'lowercase'
|
|
||||||
});
|
|
@ -1,51 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
var _toString = Object.prototype.toString;
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlOmap(state) {
|
|
||||||
var objectKeys = [], index, length, pair, pairKey, pairHasKey,
|
|
||||||
object = state.result;
|
|
||||||
|
|
||||||
for (index = 0, length = object.length; index < length; index += 1) {
|
|
||||||
pair = object[index];
|
|
||||||
pairHasKey = false;
|
|
||||||
|
|
||||||
if ('[object Object]' !== _toString.call(pair)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (pairKey in pair) {
|
|
||||||
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
||||||
if (!pairHasKey) {
|
|
||||||
pairHasKey = true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pairHasKey) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-1 === objectKeys.indexOf(pairKey)) {
|
|
||||||
objectKeys.push(pairKey);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:omap', {
|
|
||||||
loadKind: 'sequence',
|
|
||||||
loadResolver: resolveYamlOmap
|
|
||||||
});
|
|
@ -1,40 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
var _toString = Object.prototype.toString;
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlPairs(state) {
|
|
||||||
var index, length, pair, keys, result,
|
|
||||||
object = state.result;
|
|
||||||
|
|
||||||
result = new Array(object.length);
|
|
||||||
|
|
||||||
for (index = 0, length = object.length; index < length; index += 1) {
|
|
||||||
pair = object[index];
|
|
||||||
|
|
||||||
if ('[object Object]' !== _toString.call(pair)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
keys = Object.keys(pair);
|
|
||||||
|
|
||||||
if (1 !== keys.length) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
result[index] = [ keys[0], pair[keys[0]] ];
|
|
||||||
}
|
|
||||||
|
|
||||||
state.result = result;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:pairs', {
|
|
||||||
loadKind: 'sequence',
|
|
||||||
loadResolver: resolveYamlPairs
|
|
||||||
});
|
|
@ -1,9 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:seq', {
|
|
||||||
loadKind: 'sequence'
|
|
||||||
});
|
|
@ -1,28 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlSet(state) {
|
|
||||||
var key, object = state.result;
|
|
||||||
|
|
||||||
for (key in object) {
|
|
||||||
if (_hasOwnProperty.call(object, key)) {
|
|
||||||
if (null !== object[key]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:set', {
|
|
||||||
loadKind: 'mapping',
|
|
||||||
loadResolver: resolveYamlSet
|
|
||||||
});
|
|
@ -1,9 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:str', {
|
|
||||||
loadKind: 'scalar'
|
|
||||||
});
|
|
@ -1,87 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
|
|
||||||
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
||||||
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
|
||||||
'-([0-9][0-9]?)' + // [2] month
|
|
||||||
'-([0-9][0-9]?)' + // [3] day
|
|
||||||
'(?:(?:[Tt]|[ \\t]+)' + // ...
|
|
||||||
'([0-9][0-9]?)' + // [4] hour
|
|
||||||
':([0-9][0-9])' + // [5] minute
|
|
||||||
':([0-9][0-9])' + // [6] second
|
|
||||||
'(?:\\.([0-9]*))?' + // [7] fraction
|
|
||||||
'(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
|
|
||||||
'(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute
|
|
||||||
|
|
||||||
|
|
||||||
function resolveYamlTimestamp(state) {
|
|
||||||
var match, year, month, day, hour, minute, second, fraction = 0,
|
|
||||||
delta = null, tz_hour, tz_minute, data;
|
|
||||||
|
|
||||||
match = YAML_TIMESTAMP_REGEXP.exec(state.result);
|
|
||||||
|
|
||||||
if (null === match) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// match: [1] year [2] month [3] day
|
|
||||||
|
|
||||||
year = +(match[1]);
|
|
||||||
month = +(match[2]) - 1; // JS month starts with 0
|
|
||||||
day = +(match[3]);
|
|
||||||
|
|
||||||
if (!match[4]) { // no hour
|
|
||||||
state.result = new Date(Date.UTC(year, month, day));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// match: [4] hour [5] minute [6] second [7] fraction
|
|
||||||
|
|
||||||
hour = +(match[4]);
|
|
||||||
minute = +(match[5]);
|
|
||||||
second = +(match[6]);
|
|
||||||
|
|
||||||
if (match[7]) {
|
|
||||||
fraction = match[7].slice(0, 3);
|
|
||||||
while (fraction.length < 3) { // milli-seconds
|
|
||||||
fraction += '0';
|
|
||||||
}
|
|
||||||
fraction = +fraction;
|
|
||||||
}
|
|
||||||
|
|
||||||
// match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
|
|
||||||
|
|
||||||
if (match[9]) {
|
|
||||||
tz_hour = +(match[10]);
|
|
||||||
tz_minute = +(match[11] || 0);
|
|
||||||
delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
|
|
||||||
if ('-' === match[9]) {
|
|
||||||
delta = -delta;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
||||||
|
|
||||||
if (delta) {
|
|
||||||
data.setTime(data.getTime() - delta);
|
|
||||||
}
|
|
||||||
|
|
||||||
state.result = data;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function representYamlTimestamp(object /*, style*/) {
|
|
||||||
return object.toISOString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:timestamp', {
|
|
||||||
loadKind: 'scalar',
|
|
||||||
loadResolver: resolveYamlTimestamp,
|
|
||||||
dumpInstanceOf: Date,
|
|
||||||
dumpRepresenter: representYamlTimestamp
|
|
||||||
});
|
|
@ -1,7 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var yaml = require('./lib/js-yaml.js');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = yaml;
|
|
@ -1,39 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var loader = require('./js-yaml/loader');
|
|
||||||
var dumper = require('./js-yaml/dumper');
|
|
||||||
|
|
||||||
|
|
||||||
function deprecated(name) {
|
|
||||||
return function () {
|
|
||||||
throw new Error('Function ' + name + ' is deprecated and cannot be used.');
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.Type = require('./js-yaml/type');
|
|
||||||
module.exports.Schema = require('./js-yaml/schema');
|
|
||||||
module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
|
|
||||||
module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
|
|
||||||
module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
|
|
||||||
module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
|
|
||||||
module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
|
|
||||||
module.exports.load = loader.load;
|
|
||||||
module.exports.loadAll = loader.loadAll;
|
|
||||||
module.exports.safeLoad = loader.safeLoad;
|
|
||||||
module.exports.safeLoadAll = loader.safeLoadAll;
|
|
||||||
module.exports.dump = dumper.dump;
|
|
||||||
module.exports.safeDump = dumper.safeDump;
|
|
||||||
module.exports.YAMLException = require('./js-yaml/exception');
|
|
||||||
|
|
||||||
// Deprecared schema names from JS-YAML 2.0.x
|
|
||||||
module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
|
|
||||||
module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
|
|
||||||
module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
|
|
||||||
|
|
||||||
// Deprecated functions from JS-YAML 1.x.x
|
|
||||||
module.exports.scan = deprecated('scan');
|
|
||||||
module.exports.parse = deprecated('parse');
|
|
||||||
module.exports.compose = deprecated('compose');
|
|
||||||
module.exports.addConstructor = deprecated('addConstructor');
|
|
@ -1,62 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
function isNothing(subject) {
|
|
||||||
return (undefined === subject) || (null === subject);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isObject(subject) {
|
|
||||||
return ('object' === typeof subject) && (null !== subject);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toArray(sequence) {
|
|
||||||
if (Array.isArray(sequence)) {
|
|
||||||
return sequence;
|
|
||||||
} else if (isNothing(sequence)) {
|
|
||||||
return [];
|
|
||||||
} else {
|
|
||||||
return [ sequence ];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function extend(target, source) {
|
|
||||||
var index, length, key, sourceKeys;
|
|
||||||
|
|
||||||
if (source) {
|
|
||||||
sourceKeys = Object.keys(source);
|
|
||||||
|
|
||||||
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
|
|
||||||
key = sourceKeys[index];
|
|
||||||
target[key] = source[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return target;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function repeat(string, count) {
|
|
||||||
var result = '', cycle;
|
|
||||||
|
|
||||||
for (cycle = 0; cycle < count; cycle += 1) {
|
|
||||||
result += string;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function isNegativeZero(number) {
|
|
||||||
return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.isNothing = isNothing;
|
|
||||||
module.exports.isObject = isObject;
|
|
||||||
module.exports.toArray = toArray;
|
|
||||||
module.exports.repeat = repeat;
|
|
||||||
module.exports.isNegativeZero = isNegativeZero;
|
|
||||||
module.exports.extend = extend;
|
|
@ -1,477 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var common = require('./common');
|
|
||||||
var YAMLException = require('./exception');
|
|
||||||
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
|
|
||||||
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
|
|
||||||
|
|
||||||
|
|
||||||
var _toString = Object.prototype.toString;
|
|
||||||
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
||||||
|
|
||||||
|
|
||||||
var CHAR_TAB = 0x09; /* Tab */
|
|
||||||
var CHAR_LINE_FEED = 0x0A; /* LF */
|
|
||||||
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
|
|
||||||
var CHAR_SPACE = 0x20; /* Space */
|
|
||||||
var CHAR_EXCLAMATION = 0x21; /* ! */
|
|
||||||
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
|
|
||||||
var CHAR_SHARP = 0x23; /* # */
|
|
||||||
var CHAR_PERCENT = 0x25; /* % */
|
|
||||||
var CHAR_AMPERSAND = 0x26; /* & */
|
|
||||||
var CHAR_SINGLE_QUOTE = 0x27; /* ' */
|
|
||||||
var CHAR_ASTERISK = 0x2A; /* * */
|
|
||||||
var CHAR_COMMA = 0x2C; /* , */
|
|
||||||
var CHAR_MINUS = 0x2D; /* - */
|
|
||||||
var CHAR_COLON = 0x3A; /* : */
|
|
||||||
var CHAR_GREATER_THAN = 0x3E; /* > */
|
|
||||||
var CHAR_QUESTION = 0x3F; /* ? */
|
|
||||||
var CHAR_COMMERCIAL_AT = 0x40; /* @ */
|
|
||||||
var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
|
|
||||||
var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
|
|
||||||
var CHAR_GRAVE_ACCENT = 0x60; /* ` */
|
|
||||||
var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
|
|
||||||
var CHAR_VERTICAL_LINE = 0x7C; /* | */
|
|
||||||
var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
|
|
||||||
|
|
||||||
|
|
||||||
var ESCAPE_SEQUENCES = {};
|
|
||||||
|
|
||||||
ESCAPE_SEQUENCES[0x00] = '\\0';
|
|
||||||
ESCAPE_SEQUENCES[0x07] = '\\a';
|
|
||||||
ESCAPE_SEQUENCES[0x08] = '\\b';
|
|
||||||
ESCAPE_SEQUENCES[0x09] = '\\t';
|
|
||||||
ESCAPE_SEQUENCES[0x0A] = '\\n';
|
|
||||||
ESCAPE_SEQUENCES[0x0B] = '\\v';
|
|
||||||
ESCAPE_SEQUENCES[0x0C] = '\\f';
|
|
||||||
ESCAPE_SEQUENCES[0x0D] = '\\r';
|
|
||||||
ESCAPE_SEQUENCES[0x1B] = '\\e';
|
|
||||||
ESCAPE_SEQUENCES[0x22] = '\\"';
|
|
||||||
ESCAPE_SEQUENCES[0x5C] = '\\\\';
|
|
||||||
ESCAPE_SEQUENCES[0x85] = '\\N';
|
|
||||||
ESCAPE_SEQUENCES[0xA0] = '\\_';
|
|
||||||
ESCAPE_SEQUENCES[0x2028] = '\\L';
|
|
||||||
ESCAPE_SEQUENCES[0x2029] = '\\P';
|
|
||||||
|
|
||||||
|
|
||||||
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
||||||
'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
|
|
||||||
'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
|
|
||||||
];
|
|
||||||
|
|
||||||
|
|
||||||
function compileStyleMap(schema, map) {
|
|
||||||
var result, keys, index, length, tag, style, type;
|
|
||||||
|
|
||||||
if (null === map) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
result = {};
|
|
||||||
keys = Object.keys(map);
|
|
||||||
|
|
||||||
for (index = 0, length = keys.length; index < length; index += 1) {
|
|
||||||
tag = keys[index];
|
|
||||||
style = String(map[tag]);
|
|
||||||
|
|
||||||
if ('!!' === tag.slice(0, 2)) {
|
|
||||||
tag = 'tag:yaml.org,2002:' + tag.slice(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
type = schema.compiledTypeMap[tag];
|
|
||||||
|
|
||||||
if (type && _hasOwnProperty.call(type.styleAliases, style)) {
|
|
||||||
style = type.styleAliases[style];
|
|
||||||
}
|
|
||||||
|
|
||||||
result[tag] = style;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function encodeHex(character) {
|
|
||||||
var string, handle, length;
|
|
||||||
|
|
||||||
string = character.toString(16).toUpperCase();
|
|
||||||
|
|
||||||
if (character <= 0xFF) {
|
|
||||||
handle = 'x';
|
|
||||||
length = 2;
|
|
||||||
} else if (character <= 0xFFFF) {
|
|
||||||
handle = 'u';
|
|
||||||
length = 4;
|
|
||||||
} else if (character <= 0xFFFFFFFF) {
|
|
||||||
handle = 'U';
|
|
||||||
length = 8;
|
|
||||||
} else {
|
|
||||||
throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
|
|
||||||
}
|
|
||||||
|
|
||||||
return '\\' + handle + common.repeat('0', length - string.length) + string;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function State(options) {
|
|
||||||
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
|
|
||||||
this.indent = Math.max(1, (options['indent'] || 2));
|
|
||||||
this.skipInvalid = options['skipInvalid'] || false;
|
|
||||||
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
|
|
||||||
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
|
|
||||||
|
|
||||||
this.implicitTypes = this.schema.compiledImplicit;
|
|
||||||
this.explicitTypes = this.schema.compiledExplicit;
|
|
||||||
|
|
||||||
this.tag = null;
|
|
||||||
this.result = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function generateNextLine(state, level) {
|
|
||||||
return '\n' + common.repeat(' ', state.indent * level);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testImplicitResolving(state, str) {
|
|
||||||
var index, length, type;
|
|
||||||
|
|
||||||
for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
|
|
||||||
type = state.implicitTypes[index];
|
|
||||||
|
|
||||||
if (type.resolve(str)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeScalar(state, object) {
|
|
||||||
var isQuoted, checkpoint, position, length, character, first;
|
|
||||||
|
|
||||||
state.dump = '';
|
|
||||||
isQuoted = false;
|
|
||||||
checkpoint = 0;
|
|
||||||
first = object.charCodeAt(0) || 0;
|
|
||||||
|
|
||||||
if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) {
|
|
||||||
// Ensure compatibility with YAML 1.0/1.1 loaders.
|
|
||||||
isQuoted = true;
|
|
||||||
} else if (0 === object.length) {
|
|
||||||
// Quote empty string
|
|
||||||
isQuoted = true;
|
|
||||||
} else if (CHAR_SPACE === first ||
|
|
||||||
CHAR_SPACE === object.charCodeAt(object.length - 1)) {
|
|
||||||
isQuoted = true;
|
|
||||||
} else if (CHAR_MINUS === first ||
|
|
||||||
CHAR_QUESTION === first) {
|
|
||||||
// Don't check second symbol for simplicity
|
|
||||||
isQuoted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (position = 0, length = object.length; position < length; position += 1) {
|
|
||||||
character = object.charCodeAt(position);
|
|
||||||
|
|
||||||
if (!isQuoted) {
|
|
||||||
if (CHAR_TAB === character ||
|
|
||||||
CHAR_LINE_FEED === character ||
|
|
||||||
CHAR_CARRIAGE_RETURN === character ||
|
|
||||||
CHAR_COMMA === character ||
|
|
||||||
CHAR_LEFT_SQUARE_BRACKET === character ||
|
|
||||||
CHAR_RIGHT_SQUARE_BRACKET === character ||
|
|
||||||
CHAR_LEFT_CURLY_BRACKET === character ||
|
|
||||||
CHAR_RIGHT_CURLY_BRACKET === character ||
|
|
||||||
CHAR_SHARP === character ||
|
|
||||||
CHAR_AMPERSAND === character ||
|
|
||||||
CHAR_ASTERISK === character ||
|
|
||||||
CHAR_EXCLAMATION === character ||
|
|
||||||
CHAR_VERTICAL_LINE === character ||
|
|
||||||
CHAR_GREATER_THAN === character ||
|
|
||||||
CHAR_SINGLE_QUOTE === character ||
|
|
||||||
CHAR_DOUBLE_QUOTE === character ||
|
|
||||||
CHAR_PERCENT === character ||
|
|
||||||
CHAR_COMMERCIAL_AT === character ||
|
|
||||||
CHAR_COLON === character ||
|
|
||||||
CHAR_GRAVE_ACCENT === character) {
|
|
||||||
isQuoted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ESCAPE_SEQUENCES[character] ||
|
|
||||||
!((0x00020 <= character && character <= 0x00007E) ||
|
|
||||||
(0x00085 === character) ||
|
|
||||||
(0x000A0 <= character && character <= 0x00D7FF) ||
|
|
||||||
(0x0E000 <= character && character <= 0x00FFFD) ||
|
|
||||||
(0x10000 <= character && character <= 0x10FFFF))) {
|
|
||||||
state.dump += object.slice(checkpoint, position);
|
|
||||||
state.dump += ESCAPE_SEQUENCES[character] || encodeHex(character);
|
|
||||||
checkpoint = position + 1;
|
|
||||||
isQuoted = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (checkpoint < position) {
|
|
||||||
state.dump += object.slice(checkpoint, position);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isQuoted && testImplicitResolving(state, state.dump)) {
|
|
||||||
isQuoted = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isQuoted) {
|
|
||||||
state.dump = '"' + state.dump + '"';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeFlowSequence(state, level, object) {
|
|
||||||
var _result = '',
|
|
||||||
_tag = state.tag,
|
|
||||||
index,
|
|
||||||
length;
|
|
||||||
|
|
||||||
for (index = 0, length = object.length; index < length; index += 1) {
|
|
||||||
// Write only valid elements.
|
|
||||||
if (writeNode(state, level, object[index], false, false)) {
|
|
||||||
if (0 !== index) {
|
|
||||||
_result += ', ';
|
|
||||||
}
|
|
||||||
_result += state.dump;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
state.tag = _tag;
|
|
||||||
state.dump = '[' + _result + ']';
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeBlockSequence(state, level, object, compact) {
|
|
||||||
var _result = '',
|
|
||||||
_tag = state.tag,
|
|
||||||
index,
|
|
||||||
length;
|
|
||||||
|
|
||||||
for (index = 0, length = object.length; index < length; index += 1) {
|
|
||||||
// Write only valid elements.
|
|
||||||
if (writeNode(state, level + 1, object[index], true, true)) {
|
|
||||||
if (!compact || 0 !== index) {
|
|
||||||
_result += generateNextLine(state, level);
|
|
||||||
}
|
|
||||||
_result += '- ' + state.dump;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
state.tag = _tag;
|
|
||||||
state.dump = _result || '[]'; // Empty sequence if no valid values.
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeFlowMapping(state, level, object) {
|
|
||||||
var _result = '',
|
|
||||||
_tag = state.tag,
|
|
||||||
objectKeyList = Object.keys(object),
|
|
||||||
index,
|
|
||||||
length,
|
|
||||||
objectKey,
|
|
||||||
objectValue,
|
|
||||||
pairBuffer;
|
|
||||||
|
|
||||||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
||||||
pairBuffer = '';
|
|
||||||
|
|
||||||
if (0 !== index) {
|
|
||||||
pairBuffer += ', ';
|
|
||||||
}
|
|
||||||
|
|
||||||
objectKey = objectKeyList[index];
|
|
||||||
objectValue = object[objectKey];
|
|
||||||
|
|
||||||
if (!writeNode(state, level, objectKey, false, false)) {
|
|
||||||
continue; // Skip this pair because of invalid key;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.dump.length > 1024) {
|
|
||||||
pairBuffer += '? ';
|
|
||||||
}
|
|
||||||
|
|
||||||
pairBuffer += state.dump + ': ';
|
|
||||||
|
|
||||||
if (!writeNode(state, level, objectValue, false, false)) {
|
|
||||||
continue; // Skip this pair because of invalid value.
|
|
||||||
}
|
|
||||||
|
|
||||||
pairBuffer += state.dump;
|
|
||||||
|
|
||||||
// Both key and value are valid.
|
|
||||||
_result += pairBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
state.tag = _tag;
|
|
||||||
state.dump = '{' + _result + '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeBlockMapping(state, level, object, compact) {
|
|
||||||
var _result = '',
|
|
||||||
_tag = state.tag,
|
|
||||||
objectKeyList = Object.keys(object),
|
|
||||||
index,
|
|
||||||
length,
|
|
||||||
objectKey,
|
|
||||||
objectValue,
|
|
||||||
explicitPair,
|
|
||||||
pairBuffer;
|
|
||||||
|
|
||||||
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
||||||
pairBuffer = '';
|
|
||||||
|
|
||||||
if (!compact || 0 !== index) {
|
|
||||||
pairBuffer += generateNextLine(state, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
objectKey = objectKeyList[index];
|
|
||||||
objectValue = object[objectKey];
|
|
||||||
|
|
||||||
if (!writeNode(state, level + 1, objectKey, true, true)) {
|
|
||||||
continue; // Skip this pair because of invalid key.
|
|
||||||
}
|
|
||||||
|
|
||||||
explicitPair = (null !== state.tag && '?' !== state.tag) ||
|
|
||||||
(state.dump && state.dump.length > 1024);
|
|
||||||
|
|
||||||
if (explicitPair) {
|
|
||||||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
||||||
pairBuffer += '?';
|
|
||||||
} else {
|
|
||||||
pairBuffer += '? ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pairBuffer += state.dump;
|
|
||||||
|
|
||||||
if (explicitPair) {
|
|
||||||
pairBuffer += generateNextLine(state, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
|
|
||||||
continue; // Skip this pair because of invalid value.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
|
|
||||||
pairBuffer += ':';
|
|
||||||
} else {
|
|
||||||
pairBuffer += ': ';
|
|
||||||
}
|
|
||||||
|
|
||||||
pairBuffer += state.dump;
|
|
||||||
|
|
||||||
// Both key and value are valid.
|
|
||||||
_result += pairBuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
state.tag = _tag;
|
|
||||||
state.dump = _result || '{}'; // Empty mapping if no valid pairs.
|
|
||||||
}
|
|
||||||
|
|
||||||
function detectType(state, object, explicit) {
|
|
||||||
var _result, typeList, index, length, type, style;
|
|
||||||
|
|
||||||
typeList = explicit ? state.explicitTypes : state.implicitTypes;
|
|
||||||
|
|
||||||
for (index = 0, length = typeList.length; index < length; index += 1) {
|
|
||||||
type = typeList[index];
|
|
||||||
|
|
||||||
if ((type.instanceOf || type.predicate) &&
|
|
||||||
(!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) &&
|
|
||||||
(!type.predicate || type.predicate(object))) {
|
|
||||||
|
|
||||||
state.tag = explicit ? type.tag : '?';
|
|
||||||
|
|
||||||
if (type.represent) {
|
|
||||||
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
||||||
|
|
||||||
if ('[object Function]' === _toString.call(type.represent)) {
|
|
||||||
_result = type.represent(object, style);
|
|
||||||
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
||||||
_result = type.represent[style](object, style);
|
|
||||||
} else {
|
|
||||||
throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
|
|
||||||
}
|
|
||||||
|
|
||||||
state.dump = _result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Serializes `object` and writes it to global `result`.
|
|
||||||
// Returns true on success, or false on invalid object.
|
|
||||||
//
|
|
||||||
function writeNode(state, level, object, block, compact) {
|
|
||||||
state.tag = null;
|
|
||||||
state.dump = object;
|
|
||||||
|
|
||||||
if (!detectType(state, object, false)) {
|
|
||||||
detectType(state, object, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var type = _toString.call(state.dump);
|
|
||||||
|
|
||||||
if (block) {
|
|
||||||
block = (0 > state.flowLevel || state.flowLevel > level);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((null !== state.tag && '?' !== state.tag) || (2 !== state.indent && level > 0)) {
|
|
||||||
compact = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('[object Object]' === type) {
|
|
||||||
if (block && (0 !== Object.keys(state.dump).length)) {
|
|
||||||
writeBlockMapping(state, level, state.dump, compact);
|
|
||||||
} else {
|
|
||||||
writeFlowMapping(state, level, state.dump);
|
|
||||||
}
|
|
||||||
} else if ('[object Array]' === type) {
|
|
||||||
if (block && (0 !== state.dump.length)) {
|
|
||||||
writeBlockSequence(state, level, state.dump, compact);
|
|
||||||
} else {
|
|
||||||
writeFlowSequence(state, level, state.dump);
|
|
||||||
}
|
|
||||||
} else if ('[object String]' === type) {
|
|
||||||
if ('?' !== state.tag) {
|
|
||||||
writeScalar(state, state.dump);
|
|
||||||
}
|
|
||||||
} else if (state.skipInvalid) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
throw new YAMLException('unacceptable kind of an object to dump ' + type);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null !== state.tag && '?' !== state.tag) {
|
|
||||||
state.dump = '!<' + state.tag + '> ' + state.dump;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function dump(input, options) {
|
|
||||||
options = options || {};
|
|
||||||
|
|
||||||
var state = new State(options);
|
|
||||||
|
|
||||||
if (writeNode(state, 0, input, true, true)) {
|
|
||||||
return state.dump + '\n';
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function safeDump(input, options) {
|
|
||||||
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
module.exports.dump = dump;
|
|
||||||
module.exports.safeDump = safeDump;
|
|
@ -1,25 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
function YAMLException(reason, mark) {
|
|
||||||
this.name = 'YAMLException';
|
|
||||||
this.reason = reason;
|
|
||||||
this.mark = mark;
|
|
||||||
this.message = this.toString(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
YAMLException.prototype.toString = function toString(compact) {
|
|
||||||
var result;
|
|
||||||
|
|
||||||
result = 'JS-YAML: ' + (this.reason || '(unknown reason)');
|
|
||||||
|
|
||||||
if (!compact && this.mark) {
|
|
||||||
result += ' ' + this.mark.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = YAMLException;
|
|
File diff suppressed because it is too large
Load Diff
@ -1,78 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var common = require('./common');
|
|
||||||
|
|
||||||
|
|
||||||
function Mark(name, buffer, position, line, column) {
|
|
||||||
this.name = name;
|
|
||||||
this.buffer = buffer;
|
|
||||||
this.position = position;
|
|
||||||
this.line = line;
|
|
||||||
this.column = column;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
||||||
var head, start, tail, end, snippet;
|
|
||||||
|
|
||||||
if (!this.buffer) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
indent = indent || 4;
|
|
||||||
maxLength = maxLength || 75;
|
|
||||||
|
|
||||||
head = '';
|
|
||||||
start = this.position;
|
|
||||||
|
|
||||||
while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) {
|
|
||||||
start -= 1;
|
|
||||||
if (this.position - start > (maxLength / 2 - 1)) {
|
|
||||||
head = ' ... ';
|
|
||||||
start += 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tail = '';
|
|
||||||
end = this.position;
|
|
||||||
|
|
||||||
while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) {
|
|
||||||
end += 1;
|
|
||||||
if (end - this.position > (maxLength / 2 - 1)) {
|
|
||||||
tail = ' ... ';
|
|
||||||
end -= 5;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet = this.buffer.slice(start, end);
|
|
||||||
|
|
||||||
return common.repeat(' ', indent) + head + snippet + tail + '\n' +
|
|
||||||
common.repeat(' ', indent + this.position - start + head.length) + '^';
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Mark.prototype.toString = function toString(compact) {
|
|
||||||
var snippet, where = '';
|
|
||||||
|
|
||||||
if (this.name) {
|
|
||||||
where += 'in "' + this.name + '" ';
|
|
||||||
}
|
|
||||||
|
|
||||||
where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
|
|
||||||
|
|
||||||
if (!compact) {
|
|
||||||
snippet = this.getSnippet();
|
|
||||||
|
|
||||||
if (snippet) {
|
|
||||||
where += ':\n' + snippet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return where;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = Mark;
|
|
@ -1,103 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var common = require('./common');
|
|
||||||
var YAMLException = require('./exception');
|
|
||||||
var Type = require('./type');
|
|
||||||
|
|
||||||
|
|
||||||
function compileList(schema, name, result) {
|
|
||||||
var exclude = [];
|
|
||||||
|
|
||||||
schema.include.forEach(function (includedSchema) {
|
|
||||||
result = compileList(includedSchema, name, result);
|
|
||||||
});
|
|
||||||
|
|
||||||
schema[name].forEach(function (currentType) {
|
|
||||||
result.forEach(function (previousType, previousIndex) {
|
|
||||||
if (previousType.tag === currentType.tag) {
|
|
||||||
exclude.push(previousIndex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
result.push(currentType);
|
|
||||||
});
|
|
||||||
|
|
||||||
return result.filter(function (type, index) {
|
|
||||||
return -1 === exclude.indexOf(index);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function compileMap(/* lists... */) {
|
|
||||||
var result = {}, index, length;
|
|
||||||
|
|
||||||
function collectType(type) {
|
|
||||||
result[type.tag] = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (index = 0, length = arguments.length; index < length; index += 1) {
|
|
||||||
arguments[index].forEach(collectType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function Schema(definition) {
|
|
||||||
this.include = definition.include || [];
|
|
||||||
this.implicit = definition.implicit || [];
|
|
||||||
this.explicit = definition.explicit || [];
|
|
||||||
|
|
||||||
this.implicit.forEach(function (type) {
|
|
||||||
if (type.loadKind && 'scalar' !== type.loadKind) {
|
|
||||||
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
this.compiledImplicit = compileList(this, 'implicit', []);
|
|
||||||
this.compiledExplicit = compileList(this, 'explicit', []);
|
|
||||||
this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Schema.DEFAULT = null;
|
|
||||||
|
|
||||||
|
|
||||||
Schema.create = function createSchema() {
|
|
||||||
var schemas, types;
|
|
||||||
|
|
||||||
switch (arguments.length) {
|
|
||||||
case 1:
|
|
||||||
schemas = Schema.DEFAULT;
|
|
||||||
types = arguments[0];
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
schemas = arguments[0];
|
|
||||||
types = arguments[1];
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw new YAMLException('Wrong number of arguments for Schema.create function');
|
|
||||||
}
|
|
||||||
|
|
||||||
schemas = common.toArray(schemas);
|
|
||||||
types = common.toArray(types);
|
|
||||||
|
|
||||||
if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
|
|
||||||
throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!types.every(function (type) { return type instanceof Type; })) {
|
|
||||||
throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Schema({
|
|
||||||
include: schemas,
|
|
||||||
explicit: types
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = Schema;
|
|
@ -1,18 +0,0 @@
|
|||||||
// Standard YAML's Core schema.
|
|
||||||
// http://www.yaml.org/spec/1.2/spec.html#id2804923
|
|
||||||
//
|
|
||||||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
|
||||||
// So, Core schema has no distinctions from JSON schema is JS-YAML.
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Schema({
|
|
||||||
include: [
|
|
||||||
require('./json')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,25 +0,0 @@
|
|||||||
// JS-YAML's default schema for `load` function.
|
|
||||||
// It is not described in the YAML specification.
|
|
||||||
//
|
|
||||||
// This schema is based on JS-YAML's default safe schema and includes
|
|
||||||
// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
|
|
||||||
//
|
|
||||||
// Also this schema is used as default base schema at `Schema.create` function.
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = Schema.DEFAULT = new Schema({
|
|
||||||
include: [
|
|
||||||
require('./default_safe')
|
|
||||||
],
|
|
||||||
explicit: [
|
|
||||||
require('../type/js/undefined'),
|
|
||||||
require('../type/js/regexp'),
|
|
||||||
require('../type/js/function')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,28 +0,0 @@
|
|||||||
// JS-YAML's default schema for `safeLoad` function.
|
|
||||||
// It is not described in the YAML specification.
|
|
||||||
//
|
|
||||||
// This schema is based on standard YAML's Core schema and includes most of
|
|
||||||
// extra types described at YAML tag repository. (http://yaml.org/type/)
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Schema({
|
|
||||||
include: [
|
|
||||||
require('./core')
|
|
||||||
],
|
|
||||||
implicit: [
|
|
||||||
require('../type/timestamp'),
|
|
||||||
require('../type/merge')
|
|
||||||
],
|
|
||||||
explicit: [
|
|
||||||
require('../type/binary'),
|
|
||||||
require('../type/omap'),
|
|
||||||
require('../type/pairs'),
|
|
||||||
require('../type/set')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,17 +0,0 @@
|
|||||||
// Standard YAML's Failsafe schema.
|
|
||||||
// http://www.yaml.org/spec/1.2/spec.html#id2802346
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Schema({
|
|
||||||
explicit: [
|
|
||||||
require('../type/str'),
|
|
||||||
require('../type/seq'),
|
|
||||||
require('../type/map')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,25 +0,0 @@
|
|||||||
// Standard YAML's JSON schema.
|
|
||||||
// http://www.yaml.org/spec/1.2/spec.html#id2803231
|
|
||||||
//
|
|
||||||
// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
|
|
||||||
// So, this schema is not such strict as defined in the YAML specification.
|
|
||||||
// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
|
|
||||||
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
|
|
||||||
var Schema = require('../schema');
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = new Schema({
|
|
||||||
include: [
|
|
||||||
require('./failsafe')
|
|
||||||
],
|
|
||||||
implicit: [
|
|
||||||
require('../type/null'),
|
|
||||||
require('../type/bool'),
|
|
||||||
require('../type/int'),
|
|
||||||
require('../type/float')
|
|
||||||
]
|
|
||||||
});
|
|
@ -1,61 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var YAMLException = require('./exception');
|
|
||||||
|
|
||||||
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
||||||
'kind',
|
|
||||||
'resolve',
|
|
||||||
'construct',
|
|
||||||
'instanceOf',
|
|
||||||
'predicate',
|
|
||||||
'represent',
|
|
||||||
'defaultStyle',
|
|
||||||
'styleAliases'
|
|
||||||
];
|
|
||||||
|
|
||||||
var YAML_NODE_KINDS = [
|
|
||||||
'scalar',
|
|
||||||
'sequence',
|
|
||||||
'mapping'
|
|
||||||
];
|
|
||||||
|
|
||||||
function compileStyleAliases(map) {
|
|
||||||
var result = {};
|
|
||||||
|
|
||||||
if (null !== map) {
|
|
||||||
Object.keys(map).forEach(function (style) {
|
|
||||||
map[style].forEach(function (alias) {
|
|
||||||
result[String(alias)] = style;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Type(tag, options) {
|
|
||||||
options = options || {};
|
|
||||||
|
|
||||||
Object.keys(options).forEach(function (name) {
|
|
||||||
if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) {
|
|
||||||
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO: Add tag format check.
|
|
||||||
this.tag = tag;
|
|
||||||
this.kind = options['kind'] || null;
|
|
||||||
this.resolve = options['resolve'] || function () { return true; };
|
|
||||||
this.construct = options['construct'] || function (data) { return data; };
|
|
||||||
this.instanceOf = options['instanceOf'] || null;
|
|
||||||
this.predicate = options['predicate'] || null;
|
|
||||||
this.represent = options['represent'] || null;
|
|
||||||
this.defaultStyle = options['defaultStyle'] || null;
|
|
||||||
this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
|
|
||||||
|
|
||||||
if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) {
|
|
||||||
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Type;
|
|
@ -1,141 +0,0 @@
|
|||||||
// Modified from:
|
|
||||||
// https://raw.github.com/kanaka/noVNC/d890e8640f20fba3215ba7be8e0ff145aeb8c17c/include/base64.js
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// A trick for browserified version.
|
|
||||||
// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined
|
|
||||||
var NodeBuffer = require('buffer').Buffer;
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
var BASE64_PADDING = '=';
|
|
||||||
|
|
||||||
var BASE64_BINTABLE = [
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
|
|
||||||
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1,
|
|
||||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
||||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
|
|
||||||
-1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
|
||||||
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1
|
|
||||||
];
|
|
||||||
|
|
||||||
var BASE64_CHARTABLE =
|
|
||||||
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
|
||||||
|
|
||||||
function resolveYamlBinary(data) {
|
|
||||||
var code, idx = 0, len = data.length, leftbits;
|
|
||||||
|
|
||||||
leftbits = 0; // number of bits decoded, but yet to be appended
|
|
||||||
|
|
||||||
// Convert one by one.
|
|
||||||
for (idx = 0; idx < len; idx += 1) {
|
|
||||||
code = data.charCodeAt(idx);
|
|
||||||
|
|
||||||
// Skip LF(NL) || CR
|
|
||||||
if (0x0A === code || 0x0D === code) { continue; }
|
|
||||||
|
|
||||||
// Fail on illegal characters
|
|
||||||
if (-1 === BASE64_BINTABLE[code & 0x7F]) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update bitcount
|
|
||||||
leftbits += 6;
|
|
||||||
|
|
||||||
// If we have 8 or more bits, append 8 bits to the result
|
|
||||||
if (leftbits >= 8) {
|
|
||||||
leftbits -= 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there are any bits left, the base64 string was corrupted
|
|
||||||
if (leftbits) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function constructYamlBinary(data) {
|
|
||||||
var value, code, idx = 0, len = data.length, result = [], leftbits, leftdata;
|
|
||||||
|
|
||||||
leftbits = 0; // number of bits decoded, but yet to be appended
|
|
||||||
leftdata = 0; // bits decoded, but yet to be appended
|
|
||||||
|
|
||||||
// Convert one by one.
|
|
||||||
for (idx = 0; idx < len; idx += 1) {
|
|
||||||
code = data.charCodeAt(idx);
|
|
||||||
value = BASE64_BINTABLE[code & 0x7F];
|
|
||||||
|
|
||||||
// Skip LF(NL) || CR
|
|
||||||
if (0x0A === code || 0x0D === code) { continue; }
|
|
||||||
|
|
||||||
// Collect data into leftdata, update bitcount
|
|
||||||
leftdata = (leftdata << 6) | value;
|
|
||||||
leftbits += 6;
|
|
||||||
|
|
||||||
// If we have 8 or more bits, append 8 bits to the result
|
|
||||||
if (leftbits >= 8) {
|
|
||||||
leftbits -= 8;
|
|
||||||
|
|
||||||
// Append if not padding.
|
|
||||||
if (BASE64_PADDING !== data.charAt(idx)) {
|
|
||||||
result.push((leftdata >> leftbits) & 0xFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
leftdata &= (1 << leftbits) - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wrap into Buffer for NodeJS and leave Array for browser
|
|
||||||
if (NodeBuffer) {
|
|
||||||
return new NodeBuffer(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function representYamlBinary(object /*, style*/) {
|
|
||||||
var result = '', index, length, rest;
|
|
||||||
|
|
||||||
// Convert every three bytes to 4 ASCII characters.
|
|
||||||
for (index = 0, length = object.length - 2; index < length; index += 3) {
|
|
||||||
result += BASE64_CHARTABLE[object[index + 0] >> 2];
|
|
||||||
result += BASE64_CHARTABLE[((object[index + 0] & 0x03) << 4) + (object[index + 1] >> 4)];
|
|
||||||
result += BASE64_CHARTABLE[((object[index + 1] & 0x0F) << 2) + (object[index + 2] >> 6)];
|
|
||||||
result += BASE64_CHARTABLE[object[index + 2] & 0x3F];
|
|
||||||
}
|
|
||||||
|
|
||||||
rest = object.length % 3;
|
|
||||||
|
|
||||||
// Convert the remaining 1 or 2 bytes, padding out to 4 characters.
|
|
||||||
if (0 !== rest) {
|
|
||||||
index = object.length - rest;
|
|
||||||
result += BASE64_CHARTABLE[object[index + 0] >> 2];
|
|
||||||
|
|
||||||
if (2 === rest) {
|
|
||||||
result += BASE64_CHARTABLE[((object[index + 0] & 0x03) << 4) + (object[index + 1] >> 4)];
|
|
||||||
result += BASE64_CHARTABLE[(object[index + 1] & 0x0F) << 2];
|
|
||||||
result += BASE64_PADDING;
|
|
||||||
} else {
|
|
||||||
result += BASE64_CHARTABLE[(object[index + 0] & 0x03) << 4];
|
|
||||||
result += BASE64_PADDING + BASE64_PADDING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isBinary(object) {
|
|
||||||
return NodeBuffer && NodeBuffer.isBuffer(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:binary', {
|
|
||||||
kind: 'scalar',
|
|
||||||
resolve: resolveYamlBinary,
|
|
||||||
construct: constructYamlBinary,
|
|
||||||
predicate: isBinary,
|
|
||||||
represent: representYamlBinary
|
|
||||||
});
|
|
@ -1,33 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
function resolveYamlBoolean(data) {
|
|
||||||
var max = data.length;
|
|
||||||
|
|
||||||
return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
|
|
||||||
(max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function constructYamlBoolean(data) {
|
|
||||||
return data === 'true' ||
|
|
||||||
data === 'True' ||
|
|
||||||
data === 'TRUE';
|
|
||||||
}
|
|
||||||
|
|
||||||
function isBoolean(object) {
|
|
||||||
return '[object Boolean]' === Object.prototype.toString.call(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:bool', {
|
|
||||||
kind: 'scalar',
|
|
||||||
resolve: resolveYamlBoolean,
|
|
||||||
construct: constructYamlBoolean,
|
|
||||||
predicate: isBoolean,
|
|
||||||
represent: {
|
|
||||||
lowercase: function (object) { return object ? 'true' : 'false'; },
|
|
||||||
uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
|
|
||||||
camelcase: function (object) { return object ? 'True' : 'False'; }
|
|
||||||
},
|
|
||||||
defaultStyle: 'lowercase'
|
|
||||||
});
|
|
@ -1,106 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var common = require('../common');
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
var YAML_FLOAT_PATTERN = new RegExp(
|
|
||||||
'^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
|
|
||||||
'|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
|
|
||||||
'|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
|
|
||||||
'|[-+]?\\.(?:inf|Inf|INF)' +
|
|
||||||
'|\\.(?:nan|NaN|NAN))$');
|
|
||||||
|
|
||||||
function resolveYamlFloat(data) {
|
|
||||||
var value, sign, base, digits;
|
|
||||||
|
|
||||||
if (!YAML_FLOAT_PATTERN.test(data)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function constructYamlFloat(data) {
|
|
||||||
var value, sign, base, digits;
|
|
||||||
|
|
||||||
value = data.replace(/_/g, '').toLowerCase();
|
|
||||||
sign = '-' === value[0] ? -1 : 1;
|
|
||||||
digits = [];
|
|
||||||
|
|
||||||
if (0 <= '+-'.indexOf(value[0])) {
|
|
||||||
value = value.slice(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('.inf' === value) {
|
|
||||||
return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
||||||
|
|
||||||
} else if ('.nan' === value) {
|
|
||||||
return NaN;
|
|
||||||
|
|
||||||
} else if (0 <= value.indexOf(':')) {
|
|
||||||
value.split(':').forEach(function (v) {
|
|
||||||
digits.unshift(parseFloat(v, 10));
|
|
||||||
});
|
|
||||||
|
|
||||||
value = 0.0;
|
|
||||||
base = 1;
|
|
||||||
|
|
||||||
digits.forEach(function (d) {
|
|
||||||
value += d * base;
|
|
||||||
base *= 60;
|
|
||||||
});
|
|
||||||
|
|
||||||
return sign * value;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return sign * parseFloat(value, 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function representYamlFloat(object, style) {
|
|
||||||
if (isNaN(object)) {
|
|
||||||
switch (style) {
|
|
||||||
case 'lowercase':
|
|
||||||
return '.nan';
|
|
||||||
case 'uppercase':
|
|
||||||
return '.NAN';
|
|
||||||
case 'camelcase':
|
|
||||||
return '.NaN';
|
|
||||||
}
|
|
||||||
} else if (Number.POSITIVE_INFINITY === object) {
|
|
||||||
switch (style) {
|
|
||||||
case 'lowercase':
|
|
||||||
return '.inf';
|
|
||||||
case 'uppercase':
|
|
||||||
return '.INF';
|
|
||||||
case 'camelcase':
|
|
||||||
return '.Inf';
|
|
||||||
}
|
|
||||||
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
||||||
switch (style) {
|
|
||||||
case 'lowercase':
|
|
||||||
return '-.inf';
|
|
||||||
case 'uppercase':
|
|
||||||
return '-.INF';
|
|
||||||
case 'camelcase':
|
|
||||||
return '-.Inf';
|
|
||||||
}
|
|
||||||
} else if (common.isNegativeZero(object)) {
|
|
||||||
return '-0.0';
|
|
||||||
} else {
|
|
||||||
return object.toString(10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function isFloat(object) {
|
|
||||||
return ('[object Number]' === Object.prototype.toString.call(object)) &&
|
|
||||||
(0 !== object % 1 || common.isNegativeZero(object));
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:float', {
|
|
||||||
kind: 'scalar',
|
|
||||||
resolve: resolveYamlFloat,
|
|
||||||
construct: constructYamlFloat,
|
|
||||||
predicate: isFloat,
|
|
||||||
represent: representYamlFloat,
|
|
||||||
defaultStyle: 'lowercase'
|
|
||||||
});
|
|
@ -1,179 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var common = require('../common');
|
|
||||||
var Type = require('../type');
|
|
||||||
|
|
||||||
function isHexCode(c) {
|
|
||||||
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
|
|
||||||
((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
|
|
||||||
((0x61/* a */ <= c) && (c <= 0x66/* f */));
|
|
||||||
}
|
|
||||||
|
|
||||||
function isOctCode(c) {
|
|
||||||
return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
|
|
||||||
}
|
|
||||||
|
|
||||||
function isDecCode(c) {
|
|
||||||
return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
|
|
||||||
}
|
|
||||||
|
|
||||||
function resolveYamlInteger(data) {
|
|
||||||
var max = data.length,
|
|
||||||
index = 0,
|
|
||||||
hasDigits = false,
|
|
||||||
ch;
|
|
||||||
|
|
||||||
if (!max) { return false; }
|
|
||||||
|
|
||||||
ch = data[index];
|
|
||||||
|
|
||||||
// sign
|
|
||||||
if (ch === '-' || ch === '+') {
|
|
||||||
ch = data[++index];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch === '0') {
|
|
||||||
// 0
|
|
||||||
if (index+1 === max) { return true; }
|
|
||||||
ch = data[++index];
|
|
||||||
|
|
||||||
// base 2, base 8, base 16
|
|
||||||
|
|
||||||
if (ch === 'b') {
|
|
||||||
// base 2
|
|
||||||
index++;
|
|
||||||
|
|
||||||
for (; index < max; index++) {
|
|
||||||
ch = data[index];
|
|
||||||
if (ch === '_') { continue; }
|
|
||||||
if (ch !== '0' && ch !== '1') {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
hasDigits = true;
|
|
||||||
}
|
|
||||||
return hasDigits;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ch === 'x') {
|
|
||||||
// base 16
|
|
||||||
index++;
|
|
||||||
|
|
||||||
for (; index < max; index++) {
|
|
||||||
ch = data[index];
|
|
||||||
if (ch === '_') { continue; }
|
|
||||||
if (!isHexCode(data.charCodeAt(index))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
hasDigits = true;
|
|
||||||
}
|
|
||||||
return hasDigits;
|
|
||||||
}
|
|
||||||
|
|
||||||
// base 8
|
|
||||||
for (; index < max; index++) {
|
|
||||||
ch = data[index];
|
|
||||||
if (ch === '_') { continue; }
|
|
||||||
if (!isOctCode(data.charCodeAt(index))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
hasDigits = true;
|
|
||||||
}
|
|
||||||
return hasDigits;
|
|
||||||
}
|
|
||||||
|
|
||||||
// base 10 (except 0) or base 60
|
|
||||||
|
|
||||||
for (; index < max; index++) {
|
|
||||||
ch = data[index];
|
|
||||||
if (ch === '_') { continue; }
|
|
||||||
if (ch === ':') { break; }
|
|
||||||
if (!isDecCode(data.charCodeAt(index))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
hasDigits = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasDigits) { return false; }
|
|
||||||
|
|
||||||
// if !base60 - done;
|
|
||||||
if (ch !== ':') { return true; }
|
|
||||||
|
|
||||||
// base60 almost not used, no needs to optimize
|
|
||||||
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
||||||
}
|
|
||||||
|
|
||||||
function constructYamlInteger(data) {
|
|
||||||
var value = data, sign = 1, ch, base, digits = [];
|
|
||||||
|
|
||||||
if (value.indexOf('_') !== -1) {
|
|
||||||
value = value.replace(/_/g, '');
|
|
||||||
}
|
|
||||||
|
|
||||||
ch = value[0];
|
|
||||||
|
|
||||||
if (ch === '-' || ch === '+') {
|
|
||||||
if (ch === '-') { sign = -1; }
|
|
||||||
value = value.slice(1);
|
|
||||||
ch = value[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ('0' === value) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch === '0') {
|
|
||||||
if (value[1] === 'b') {
|
|
||||||
return sign * parseInt(value.slice(2), 2);
|
|
||||||
}
|
|
||||||
if (value[1] === 'x') {
|
|
||||||
return sign * parseInt(value, 16);
|
|
||||||
}
|
|
||||||
return sign * parseInt(value, 8);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value.indexOf(':') !== -1) {
|
|
||||||
value.split(':').forEach(function (v) {
|
|
||||||
digits.unshift(parseInt(v, 10));
|
|
||||||
});
|
|
||||||
|
|
||||||
value = 0;
|
|
||||||
base = 1;
|
|
||||||
|
|
||||||
digits.forEach(function (d) {
|
|
||||||
value += (d * base);
|
|
||||||
base *= 60;
|
|
||||||
});
|
|
||||||
|
|
||||||
return sign * value;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return sign * parseInt(value, 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isInteger(object) {
|
|
||||||
return ('[object Number]' === Object.prototype.toString.call(object)) &&
|
|
||||||
(0 === object % 1 && !common.isNegativeZero(object));
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:int', {
|
|
||||||
kind: 'scalar',
|
|
||||||
resolve: resolveYamlInteger,
|
|
||||||
construct: constructYamlInteger,
|
|
||||||
predicate: isInteger,
|
|
||||||
represent: {
|
|
||||||
binary: function (object) { return '0b' + object.toString(2); },
|
|
||||||
octal: function (object) { return '0' + object.toString(8); },
|
|
||||||
decimal: function (object) { return object.toString(10); },
|
|
||||||
hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
|
|
||||||
},
|
|
||||||
defaultStyle: 'decimal',
|
|
||||||
styleAliases: {
|
|
||||||
binary: [ 2, 'bin' ],
|
|
||||||
octal: [ 8, 'oct' ],
|
|
||||||
decimal: [ 10, 'dec' ],
|
|
||||||
hexadecimal: [ 16, 'hex' ]
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,81 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var esprima;
|
|
||||||
|
|
||||||
// Browserified version does not have esprima
|
|
||||||
//
|
|
||||||
// 1. For node.js just require module as deps
|
|
||||||
// 2. For browser try to require mudule via external AMD system.
|
|
||||||
// If not found - try to fallback to window.esprima. If not
|
|
||||||
// found too - then fail to parse.
|
|
||||||
//
|
|
||||||
try {
|
|
||||||
esprima = require('esprima');
|
|
||||||
} catch (_) {
|
|
||||||
/*global window */
|
|
||||||
if (typeof window !== 'undefined') { esprima = window.esprima; }
|
|
||||||
}
|
|
||||||
|
|
||||||
var Type = require('../../type');
|
|
||||||
|
|
||||||
function resolveJavascriptFunction(data) {
|
|
||||||
try {
|
|
||||||
var source = '(' + data + ')',
|
|
||||||
ast = esprima.parse(source, { range: true }),
|
|
||||||
params = [],
|
|
||||||
body;
|
|
||||||
|
|
||||||
if ('Program' !== ast.type ||
|
|
||||||
1 !== ast.body.length ||
|
|
||||||
'ExpressionStatement' !== ast.body[0].type ||
|
|
||||||
'FunctionExpression' !== ast.body[0].expression.type) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (err) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function constructJavascriptFunction(data) {
|
|
||||||
/*jslint evil:true*/
|
|
||||||
|
|
||||||
var source = '(' + data + ')',
|
|
||||||
ast = esprima.parse(source, { range: true }),
|
|
||||||
params = [],
|
|
||||||
body;
|
|
||||||
|
|
||||||
if ('Program' !== ast.type ||
|
|
||||||
1 !== ast.body.length ||
|
|
||||||
'ExpressionStatement' !== ast.body[0].type ||
|
|
||||||
'FunctionExpression' !== ast.body[0].expression.type) {
|
|
||||||
throw new Error('Failed to resolve function');
|
|
||||||
}
|
|
||||||
|
|
||||||
ast.body[0].expression.params.forEach(function (param) {
|
|
||||||
params.push(param.name);
|
|
||||||
});
|
|
||||||
|
|
||||||
body = ast.body[0].expression.body.range;
|
|
||||||
|
|
||||||
// Esprima's ranges include the first '{' and the last '}' characters on
|
|
||||||
// function expressions. So cut them out.
|
|
||||||
return new Function(params, source.slice(body[0]+1, body[1]-1));
|
|
||||||
}
|
|
||||||
|
|
||||||
function representJavascriptFunction(object /*, style*/) {
|
|
||||||
return object.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
function isFunction(object) {
|
|
||||||
return '[object Function]' === Object.prototype.toString.call(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:js/function', {
|
|
||||||
kind: 'scalar',
|
|
||||||
resolve: resolveJavascriptFunction,
|
|
||||||
construct: constructJavascriptFunction,
|
|
||||||
predicate: isFunction,
|
|
||||||
represent: representJavascriptFunction
|
|
||||||
});
|
|
@ -1,76 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var Type = require('../../type');
|
|
||||||
|
|
||||||
function resolveJavascriptRegExp(data) {
|
|
||||||
var regexp = data,
|
|
||||||
tail = /\/([gim]*)$/.exec(data),
|
|
||||||
modifiers = '';
|
|
||||||
|
|
||||||
// if regexp starts with '/' it can have modifiers and must be properly closed
|
|
||||||
// `/foo/gim` - modifiers tail can be maximum 3 chars
|
|
||||||
if ('/' === regexp[0]) {
|
|
||||||
if (tail) {
|
|
||||||
modifiers = tail[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modifiers.length > 3) { return false; }
|
|
||||||
// if expression starts with /, is should be properly terminated
|
|
||||||
if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; }
|
|
||||||
|
|
||||||
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
var dummy = new RegExp(regexp, modifiers);
|
|
||||||
return true;
|
|
||||||
} catch (error) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function constructJavascriptRegExp(data) {
|
|
||||||
var regexp = data,
|
|
||||||
tail = /\/([gim]*)$/.exec(data),
|
|
||||||
modifiers = '';
|
|
||||||
|
|
||||||
// `/foo/gim` - tail can be maximum 4 chars
|
|
||||||
if ('/' === regexp[0]) {
|
|
||||||
if (tail) {
|
|
||||||
modifiers = tail[1];
|
|
||||||
}
|
|
||||||
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new RegExp(regexp, modifiers);
|
|
||||||
}
|
|
||||||
|
|
||||||
function representJavascriptRegExp(object /*, style*/) {
|
|
||||||
var result = '/' + object.source + '/';
|
|
||||||
|
|
||||||
if (object.global) {
|
|
||||||
result += 'g';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object.multiline) {
|
|
||||||
result += 'm';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (object.ignoreCase) {
|
|
||||||
result += 'i';
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isRegExp(object) {
|
|
||||||
return '[object RegExp]' === Object.prototype.toString.call(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:js/regexp', {
|
|
||||||
kind: 'scalar',
|
|
||||||
resolve: resolveJavascriptRegExp,
|
|
||||||
construct: constructJavascriptRegExp,
|
|
||||||
predicate: isRegExp,
|
|
||||||
represent: representJavascriptRegExp
|
|
||||||
});
|
|
@ -1,27 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var Type = require('../../type');
|
|
||||||
|
|
||||||
function resolveJavascriptUndefined() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function constructJavascriptUndefined() {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function representJavascriptUndefined() {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
function isUndefined(object) {
|
|
||||||
return 'undefined' === typeof object;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = new Type('tag:yaml.org,2002:js/undefined', {
|
|
||||||
kind: 'scalar',
|
|
||||||
resolve: resolveJavascriptUndefined,
|
|
||||||
construct: constructJavascriptUndefined,
|
|
||||||
predicate: isUndefined,
|
|
||||||
represent: representJavascriptUndefined
|
|
||||||
});
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user