This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+88 -40
View File
@@ -1,9 +1,9 @@
// Generated by CoffeeScript 1.8.0
var ParsedError, PrettyError, RenderKid, array, defaultStyle, instance, nodePaths, object, prop, _fn, _i, _len, _ref, _ref1,
var ParsedError, PrettyError, RenderKid, arrayUtils, defaultStyle, instance, isPlainObject, merge, nodePaths, prop, _fn, _i, _len, _ref,
__slice = [].slice,
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
_ref = require('utila'), object = _ref.object, array = _ref.array;
isPlainObject = require('lodash/isPlainObject');
defaultStyle = require('./defaultStyle');
@@ -13,6 +13,54 @@ nodePaths = require('./nodePaths');
RenderKid = require('renderkid');
merge = require('lodash/merge');
arrayUtils = {
pluckByCallback: function(a, cb) {
var index, removed, value, _i, _len;
if (a.length < 1) {
return a;
}
removed = 0;
for (index = _i = 0, _len = a.length; _i < _len; index = ++_i) {
value = a[index];
if (cb(value, index)) {
removed++;
continue;
}
if (removed !== 0) {
a[index - removed] = a[index];
}
}
if (removed > 0) {
a.length = a.length - removed;
}
return a;
},
pluckOneItem: function(a, item) {
var index, reached, value, _i, _len;
if (a.length < 1) {
return a;
}
reached = false;
for (index = _i = 0, _len = a.length; _i < _len; index = ++_i) {
value = a[index];
if (!reached) {
if (value === item) {
reached = true;
continue;
}
} else {
a[index - 1] = a[index];
}
}
if (reached) {
a.length = a.length - 1;
}
return a;
}
};
instance = null;
module.exports = PrettyError = (function() {
@@ -89,7 +137,7 @@ module.exports = PrettyError = (function() {
};
PrettyError.prototype.config = function(c) {
var alias, path, _ref1;
var alias, path, _ref;
if (c.skipPackages != null) {
if (c.skipPackages === false) {
this.unskipAllPackages();
@@ -134,10 +182,10 @@ module.exports = PrettyError = (function() {
}
}
if (c.aliases != null) {
if (object.isBareObject(c.aliases)) {
_ref1 = c.aliases;
for (path in _ref1) {
alias = _ref1[path];
if (isPlainObject(c.aliases)) {
_ref = c.aliases;
for (path in _ref) {
alias = _ref[path];
this.alias(path, alias);
}
} else if (c.aliases === false) {
@@ -172,7 +220,7 @@ module.exports = PrettyError = (function() {
packages = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = packages.length; _i < _len; _i++) {
pkg = packages[_i];
array.pluckOneItem(this._packagesToSkip, pkg);
arrayUtils.pluckOneItem(this._packagesToSkip, pkg);
}
return this;
};
@@ -197,7 +245,7 @@ module.exports = PrettyError = (function() {
paths = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = paths.length; _i < _len; _i++) {
path = paths[_i];
array.pluckOneItem(this._pathsToSkip, path);
arrayUtils.pluckOneItem(this._pathsToSkip, path);
}
return this;
};
@@ -222,7 +270,7 @@ module.exports = PrettyError = (function() {
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
cb = callbacks[_i];
array.pluckOneItem(this._skipCallbacks, cb);
arrayUtils.pluckOneItem(this._skipCallbacks, cb);
}
return this;
};
@@ -255,7 +303,7 @@ module.exports = PrettyError = (function() {
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
cb = callbacks[_i];
array.pluckOneItem(this._filterCallbacks, cb);
arrayUtils.pluckOneItem(this._filterCallbacks, cb);
}
return this;
};
@@ -280,7 +328,7 @@ module.exports = PrettyError = (function() {
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
cb = callbacks[_i];
array.pluckOneItem(this._parsedErrorFilters, cb);
arrayUtils.pluckOneItem(this._parsedErrorFilters, cb);
}
return this;
};
@@ -310,7 +358,7 @@ module.exports = PrettyError = (function() {
};
PrettyError.prototype.removeAlias = function(stringOrRx) {
array.pluckByCallback(this._aliases, function(pair) {
arrayUtils.pluckByCallback(this._aliases, function(pair) {
return pair.stringOrRx === stringOrRx;
});
return this;
@@ -326,7 +374,7 @@ module.exports = PrettyError = (function() {
};
PrettyError.prototype.appendStyle = function(toAppend) {
object.appendOnto(this._style, toAppend);
merge(this._style, toAppend);
this._renderer.style(toAppend);
return this;
};
@@ -352,7 +400,7 @@ module.exports = PrettyError = (function() {
};
PrettyError.prototype.getObject = function(e) {
var count, header, i, item, obj, traceItems, _i, _len, _ref1;
var count, header, i, item, obj, traceItems, _i, _len, _ref;
if (!(e instanceof ParsedError)) {
e = new ParsedError(e);
}
@@ -372,9 +420,9 @@ module.exports = PrettyError = (function() {
};
traceItems = [];
count = -1;
_ref1 = e.trace;
for (i = _i = 0, _len = _ref1.length; _i < _len; i = ++_i) {
item = _ref1[i];
_ref = e.trace;
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
item = _ref[i];
if (item == null) {
continue;
}
@@ -439,49 +487,49 @@ module.exports = PrettyError = (function() {
};
PrettyError.prototype._skipOrFilter = function(item, itemNumber) {
var cb, modName, pair, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6;
var cb, modName, pair, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
if (typeof item === 'object') {
if (_ref1 = item.modName, __indexOf.call(this._packagesToSkip, _ref1) >= 0) {
if (_ref = item.modName, __indexOf.call(this._packagesToSkip, _ref) >= 0) {
return true;
}
if (_ref2 = item.path, __indexOf.call(this._pathsToSkip, _ref2) >= 0) {
if (_ref1 = item.path, __indexOf.call(this._pathsToSkip, _ref1) >= 0) {
return true;
}
_ref3 = item.packages;
for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
modName = _ref3[_i];
_ref2 = item.packages;
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
modName = _ref2[_i];
if (__indexOf.call(this._packagesToSkip, modName) >= 0) {
return true;
}
}
if (typeof item.shortenedAddr === 'string') {
_ref4 = this._aliases;
for (_j = 0, _len1 = _ref4.length; _j < _len1; _j++) {
pair = _ref4[_j];
_ref3 = this._aliases;
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
pair = _ref3[_j];
item.shortenedAddr = item.shortenedAddr.replace(pair.stringOrRx, pair.alias);
}
}
}
_ref5 = this._skipCallbacks;
for (_k = 0, _len2 = _ref5.length; _k < _len2; _k++) {
cb = _ref5[_k];
_ref4 = this._skipCallbacks;
for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
cb = _ref4[_k];
if (cb(item, itemNumber) === true) {
return true;
}
}
_ref6 = this._filterCallbacks;
for (_l = 0, _len3 = _ref6.length; _l < _len3; _l++) {
cb = _ref6[_l];
_ref5 = this._filterCallbacks;
for (_l = 0, _len3 = _ref5.length; _l < _len3; _l++) {
cb = _ref5[_l];
cb(item, itemNumber);
}
return false;
};
PrettyError.prototype._applyParsedErrorFiltersOn = function(error) {
var cb, _i, _len, _ref1;
_ref1 = this._parsedErrorFilters;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
cb = _ref1[_i];
var cb, _i, _len, _ref;
_ref = this._parsedErrorFilters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
cb = _ref[_i];
cb(error);
}
};
@@ -490,7 +538,7 @@ module.exports = PrettyError = (function() {
})();
_ref1 = ['renderer', 'style'];
_ref = ['renderer', 'style'];
_fn = function() {
var methodName;
methodName = '_get' + prop[0].toUpperCase() + prop.substr(1, prop.length);
@@ -498,7 +546,7 @@ _fn = function() {
return this[methodName]();
});
};
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
prop = _ref1[_i];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
prop = _ref[_i];
_fn();
}