first commit
This commit is contained in:
247
app_vue/node_modules/pretty-error/lib/ParsedError.js
generated
vendored
Normal file
247
app_vue/node_modules/pretty-error/lib/ParsedError.js
generated
vendored
Normal file
@ -0,0 +1,247 @@
|
||||
// Generated by CoffeeScript 1.8.0
|
||||
var ParsedError, prop, sysPath, _fn, _i, _len, _ref;
|
||||
|
||||
sysPath = require('path');
|
||||
|
||||
module.exports = ParsedError = (function() {
|
||||
function ParsedError(error) {
|
||||
this.error = error;
|
||||
this._parse();
|
||||
}
|
||||
|
||||
ParsedError.prototype._parse = function() {
|
||||
var m;
|
||||
this._trace = [];
|
||||
this._kind = 'Error';
|
||||
this._wrapper = '';
|
||||
if (this.error.wrapper != null) {
|
||||
this._wrapper = String(this.error.wrapper);
|
||||
}
|
||||
if (typeof this.error !== 'object') {
|
||||
this._message = String(this.error);
|
||||
} else {
|
||||
this._stack = this.error.stack;
|
||||
if (this.error.kind != null) {
|
||||
this._kind = String(this.error.kind);
|
||||
} else if (typeof this._stack === 'string') {
|
||||
if (m = this._stack.match(/^([a-zA-Z0-9\_\$]+):\ /)) {
|
||||
this._kind = m[1];
|
||||
}
|
||||
}
|
||||
this._message = (this.error.message != null) && String(this.error.message) || '';
|
||||
if (typeof this._stack === 'string') {
|
||||
this._parseStack();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ParsedError.prototype._parseStack = function() {
|
||||
var line, message, messageLines, reachedTrace, _i, _len, _ref;
|
||||
messageLines = [];
|
||||
reachedTrace = false;
|
||||
_ref = this._stack.split('\n');
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
line = _ref[_i];
|
||||
if (line.trim() === '') {
|
||||
continue;
|
||||
}
|
||||
if (reachedTrace) {
|
||||
this._trace.push(this._parseTraceItem(line));
|
||||
} else {
|
||||
if (line.match(/^\s*at\s.+/)) {
|
||||
reachedTrace = true;
|
||||
this._trace.push(this._parseTraceItem(line));
|
||||
} else if (!this._message.split('\n'.indexOf(line))) {
|
||||
messageLines.push(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
message = messageLines.join('\n');
|
||||
if (message.substr(0, this._kind.length) === this._kind) {
|
||||
message = message.substr(this._kind.length, message.length).replace(/^\:\s+/, '');
|
||||
}
|
||||
if (message.length) {
|
||||
this._message = this._message.length ? [this._message, message].join('\n') : message;
|
||||
}
|
||||
};
|
||||
|
||||
ParsedError.prototype._parseTraceItem = function(text) {
|
||||
var addr, col, d, dir, file, jsCol, jsLine, line, m, original, packageName, packages, path, r, remaining, shortenedAddr, shortenedPath, what;
|
||||
text = text.trim();
|
||||
if (text === '') {
|
||||
return;
|
||||
}
|
||||
if (!text.match(/^at\ /)) {
|
||||
return text;
|
||||
}
|
||||
text = text.replace(/^at /, '');
|
||||
if (text === 'Error (<anonymous>)' || text === 'Error (<anonymous>:null:null)') {
|
||||
return;
|
||||
}
|
||||
original = text;
|
||||
what = null;
|
||||
addr = null;
|
||||
path = null;
|
||||
dir = null;
|
||||
file = null;
|
||||
line = null;
|
||||
col = null;
|
||||
jsLine = null;
|
||||
jsCol = null;
|
||||
shortenedPath = null;
|
||||
shortenedAddr = null;
|
||||
packageName = '[current]';
|
||||
if (m = text.match(/\(([^\)]+)\)$/)) {
|
||||
addr = m[1].trim();
|
||||
}
|
||||
if (addr != null) {
|
||||
what = text.substr(0, text.length - addr.length - 2);
|
||||
what = what.trim();
|
||||
}
|
||||
if (addr == null) {
|
||||
addr = text.trim();
|
||||
}
|
||||
addr = this._fixPath(addr);
|
||||
remaining = addr;
|
||||
if (m = remaining.match(/\,\ <js>:(\d+):(\d+)$/)) {
|
||||
jsLine = m[1];
|
||||
jsCol = m[2];
|
||||
remaining = remaining.substr(0, remaining.length - m[0].length);
|
||||
}
|
||||
if (m = remaining.match(/:(\d+):(\d+)$/)) {
|
||||
line = m[1];
|
||||
col = m[2];
|
||||
remaining = remaining.substr(0, remaining.length - m[0].length);
|
||||
path = remaining;
|
||||
}
|
||||
if (path != null) {
|
||||
file = sysPath.basename(path);
|
||||
dir = sysPath.dirname(path);
|
||||
if (dir === '.') {
|
||||
dir = '';
|
||||
}
|
||||
path = this._fixPath(path);
|
||||
file = this._fixPath(file);
|
||||
dir = this._fixPath(dir);
|
||||
}
|
||||
if (dir != null) {
|
||||
d = dir.replace(/[\\]{1,2}/g, '/');
|
||||
if (m = d.match(/node_modules\/([^\/]+)(?!.*node_modules.*)/)) {
|
||||
packageName = m[1];
|
||||
}
|
||||
}
|
||||
if (jsLine == null) {
|
||||
jsLine = line;
|
||||
jsCol = col;
|
||||
}
|
||||
if (path != null) {
|
||||
r = this._rectifyPath(path);
|
||||
shortenedPath = r.path;
|
||||
shortenedAddr = shortenedPath + addr.substr(path.length, addr.length);
|
||||
packages = r.packages;
|
||||
}
|
||||
return {
|
||||
original: original,
|
||||
what: what,
|
||||
addr: addr,
|
||||
path: path,
|
||||
dir: dir,
|
||||
file: file,
|
||||
line: parseInt(line),
|
||||
col: parseInt(col),
|
||||
jsLine: parseInt(jsLine),
|
||||
jsCol: parseInt(jsCol),
|
||||
packageName: packageName,
|
||||
shortenedPath: shortenedPath,
|
||||
shortenedAddr: shortenedAddr,
|
||||
packages: packages || []
|
||||
};
|
||||
};
|
||||
|
||||
ParsedError.prototype._getMessage = function() {
|
||||
return this._message;
|
||||
};
|
||||
|
||||
ParsedError.prototype._getKind = function() {
|
||||
return this._kind;
|
||||
};
|
||||
|
||||
ParsedError.prototype._getWrapper = function() {
|
||||
return this._wrapper;
|
||||
};
|
||||
|
||||
ParsedError.prototype._getStack = function() {
|
||||
return this._stack;
|
||||
};
|
||||
|
||||
ParsedError.prototype._getArguments = function() {
|
||||
return this.error["arguments"];
|
||||
};
|
||||
|
||||
ParsedError.prototype._getType = function() {
|
||||
return this.error.type;
|
||||
};
|
||||
|
||||
ParsedError.prototype._getTrace = function() {
|
||||
return this._trace;
|
||||
};
|
||||
|
||||
ParsedError.prototype._fixPath = function(path) {
|
||||
return path.replace(/[\\]{1,2}/g, '/');
|
||||
};
|
||||
|
||||
ParsedError.prototype._rectifyPath = function(path, nameForCurrentPackage) {
|
||||
var m, packages, parts, remaining, rest;
|
||||
path = String(path);
|
||||
remaining = path;
|
||||
if (!(m = path.match(/^(.+?)\/node_modules\/(.+)$/))) {
|
||||
return {
|
||||
path: path,
|
||||
packages: []
|
||||
};
|
||||
}
|
||||
parts = [];
|
||||
packages = [];
|
||||
if (typeof nameForCurrentPackage === 'string') {
|
||||
parts.push("[" + nameForCurrentPackage + "]");
|
||||
packages.push("[" + nameForCurrentPackage + "]");
|
||||
} else {
|
||||
parts.push("[" + (m[1].match(/([^\/]+)$/)[1]) + "]");
|
||||
packages.push(m[1].match(/([^\/]+)$/)[1]);
|
||||
}
|
||||
rest = m[2];
|
||||
while (m = rest.match(/([^\/]+)\/node_modules\/(.+)$/)) {
|
||||
parts.push("[" + m[1] + "]");
|
||||
packages.push(m[1]);
|
||||
rest = m[2];
|
||||
}
|
||||
if (m = rest.match(/([^\/]+)\/(.+)$/)) {
|
||||
parts.push("[" + m[1] + "]");
|
||||
packages.push(m[1]);
|
||||
rest = m[2];
|
||||
}
|
||||
parts.push(rest);
|
||||
return {
|
||||
path: parts.join("/"),
|
||||
packages: packages
|
||||
};
|
||||
};
|
||||
|
||||
return ParsedError;
|
||||
|
||||
})();
|
||||
|
||||
_ref = ['message', 'kind', 'arguments', 'type', 'stack', 'trace', 'wrapper'];
|
||||
_fn = function() {
|
||||
var methodName;
|
||||
methodName = '_get' + prop[0].toUpperCase() + prop.substr(1, prop.length);
|
||||
return Object.defineProperty(ParsedError.prototype, prop, {
|
||||
get: function() {
|
||||
return this[methodName]();
|
||||
}
|
||||
});
|
||||
};
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
prop = _ref[_i];
|
||||
_fn();
|
||||
}
|
552
app_vue/node_modules/pretty-error/lib/PrettyError.js
generated
vendored
Normal file
552
app_vue/node_modules/pretty-error/lib/PrettyError.js
generated
vendored
Normal file
@ -0,0 +1,552 @@
|
||||
// Generated by CoffeeScript 1.8.0
|
||||
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; };
|
||||
|
||||
isPlainObject = require('lodash/isPlainObject');
|
||||
|
||||
defaultStyle = require('./defaultStyle');
|
||||
|
||||
ParsedError = require('./ParsedError');
|
||||
|
||||
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() {
|
||||
var self;
|
||||
|
||||
self = PrettyError;
|
||||
|
||||
PrettyError._filters = {
|
||||
'module.exports': function(item) {
|
||||
if (item.what == null) {
|
||||
return;
|
||||
}
|
||||
item.what = item.what.replace(/\.module\.exports\./g, ' - ');
|
||||
}
|
||||
};
|
||||
|
||||
PrettyError._getDefaultStyle = function() {
|
||||
return defaultStyle();
|
||||
};
|
||||
|
||||
PrettyError.start = function() {
|
||||
if (instance == null) {
|
||||
instance = new self;
|
||||
instance.start();
|
||||
}
|
||||
return instance;
|
||||
};
|
||||
|
||||
PrettyError.stop = function() {
|
||||
return instance != null ? instance.stop() : void 0;
|
||||
};
|
||||
|
||||
function PrettyError() {
|
||||
this._useColors = true;
|
||||
this._maxItems = 50;
|
||||
this._packagesToSkip = [];
|
||||
this._pathsToSkip = [];
|
||||
this._skipCallbacks = [];
|
||||
this._filterCallbacks = [];
|
||||
this._parsedErrorFilters = [];
|
||||
this._aliases = [];
|
||||
this._renderer = new RenderKid;
|
||||
this._style = self._getDefaultStyle();
|
||||
this._renderer.style(this._style);
|
||||
}
|
||||
|
||||
PrettyError.prototype.start = function() {
|
||||
var prepeare;
|
||||
this._oldPrepareStackTrace = Error.prepareStackTrace;
|
||||
prepeare = this._oldPrepareStackTrace || function(exc, frames) {
|
||||
var result;
|
||||
result = exc.toString();
|
||||
frames = frames.map(function(frame) {
|
||||
return " at " + (frame.toString());
|
||||
});
|
||||
return result + "\n" + frames.join("\n");
|
||||
};
|
||||
Error.prepareStackTrace = (function(_this) {
|
||||
return function(exc, trace) {
|
||||
var stack;
|
||||
stack = prepeare.apply(null, arguments);
|
||||
return _this.render({
|
||||
stack: stack,
|
||||
message: exc.toString().replace(/^.*: /, '')
|
||||
}, false);
|
||||
};
|
||||
})(this);
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.stop = function() {
|
||||
Error.prepareStackTrace = this._oldPrepareStackTrace;
|
||||
return this._oldPrepareStackTrace = null;
|
||||
};
|
||||
|
||||
PrettyError.prototype.config = function(c) {
|
||||
var alias, path, _ref;
|
||||
if (c.skipPackages != null) {
|
||||
if (c.skipPackages === false) {
|
||||
this.unskipAllPackages();
|
||||
} else {
|
||||
this.skipPackage.apply(this, c.skipPackages);
|
||||
}
|
||||
}
|
||||
if (c.skipPaths != null) {
|
||||
if (c.skipPaths === false) {
|
||||
this.unskipAllPaths();
|
||||
} else {
|
||||
this.skipPath.apply(this, c.skipPaths);
|
||||
}
|
||||
}
|
||||
if (c.skip != null) {
|
||||
if (c.skip === false) {
|
||||
this.unskipAll();
|
||||
} else {
|
||||
this.skip.apply(this, c.skip);
|
||||
}
|
||||
}
|
||||
if (c.maxItems != null) {
|
||||
this.setMaxItems(c.maxItems);
|
||||
}
|
||||
if (c.skipNodeFiles === true) {
|
||||
this.skipNodeFiles();
|
||||
} else if (c.skipNodeFiles === false) {
|
||||
this.unskipNodeFiles();
|
||||
}
|
||||
if (c.filters != null) {
|
||||
if (c.filters === false) {
|
||||
this.removeAllFilters();
|
||||
} else {
|
||||
this.filter.apply(this, c.filters);
|
||||
}
|
||||
}
|
||||
if (c.parsedErrorFilters != null) {
|
||||
if (c.parsedErrorFilters === false) {
|
||||
this.removeAllParsedErrorFilters();
|
||||
} else {
|
||||
this.filterParsedError.apply(this, c.parsedErrorFilters);
|
||||
}
|
||||
}
|
||||
if (c.aliases != null) {
|
||||
if (isPlainObject(c.aliases)) {
|
||||
_ref = c.aliases;
|
||||
for (path in _ref) {
|
||||
alias = _ref[path];
|
||||
this.alias(path, alias);
|
||||
}
|
||||
} else if (c.aliases === false) {
|
||||
this.removeAllAliases();
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.withoutColors = function() {
|
||||
this._useColors = false;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.withColors = function() {
|
||||
this._useColors = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.skipPackage = function() {
|
||||
var packages, pkg, _i, _len;
|
||||
packages = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = packages.length; _i < _len; _i++) {
|
||||
pkg = packages[_i];
|
||||
this._packagesToSkip.push(String(pkg));
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.unskipPackage = function() {
|
||||
var packages, pkg, _i, _len;
|
||||
packages = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = packages.length; _i < _len; _i++) {
|
||||
pkg = packages[_i];
|
||||
arrayUtils.pluckOneItem(this._packagesToSkip, pkg);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.unskipAllPackages = function() {
|
||||
this._packagesToSkip.length = 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.skipPath = function() {
|
||||
var path, paths, _i, _len;
|
||||
paths = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = paths.length; _i < _len; _i++) {
|
||||
path = paths[_i];
|
||||
this._pathsToSkip.push(path);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.unskipPath = function() {
|
||||
var path, paths, _i, _len;
|
||||
paths = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = paths.length; _i < _len; _i++) {
|
||||
path = paths[_i];
|
||||
arrayUtils.pluckOneItem(this._pathsToSkip, path);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.unskipAllPaths = function() {
|
||||
this._pathsToSkip.length = 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.skip = function() {
|
||||
var callbacks, cb, _i, _len;
|
||||
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
|
||||
cb = callbacks[_i];
|
||||
this._skipCallbacks.push(cb);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.unskip = function() {
|
||||
var callbacks, cb, _i, _len;
|
||||
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
|
||||
cb = callbacks[_i];
|
||||
arrayUtils.pluckOneItem(this._skipCallbacks, cb);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.unskipAll = function() {
|
||||
this._skipCallbacks.length = 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.skipNodeFiles = function() {
|
||||
return this.skipPath.apply(this, nodePaths);
|
||||
};
|
||||
|
||||
PrettyError.prototype.unskipNodeFiles = function() {
|
||||
return this.unskipPath.apply(this, nodePaths);
|
||||
};
|
||||
|
||||
PrettyError.prototype.filter = function() {
|
||||
var callbacks, cb, _i, _len;
|
||||
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
|
||||
cb = callbacks[_i];
|
||||
this._filterCallbacks.push(cb);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.removeFilter = function() {
|
||||
var callbacks, cb, _i, _len;
|
||||
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
|
||||
cb = callbacks[_i];
|
||||
arrayUtils.pluckOneItem(this._filterCallbacks, cb);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.removeAllFilters = function() {
|
||||
this._filterCallbacks.length = 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.filterParsedError = function() {
|
||||
var callbacks, cb, _i, _len;
|
||||
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
|
||||
cb = callbacks[_i];
|
||||
this._parsedErrorFilters.push(cb);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.removeParsedErrorFilter = function() {
|
||||
var callbacks, cb, _i, _len;
|
||||
callbacks = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
||||
for (_i = 0, _len = callbacks.length; _i < _len; _i++) {
|
||||
cb = callbacks[_i];
|
||||
arrayUtils.pluckOneItem(this._parsedErrorFilters, cb);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.removeAllParsedErrorFilters = function() {
|
||||
this._parsedErrorFilters.length = 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.setMaxItems = function(maxItems) {
|
||||
if (maxItems == null) {
|
||||
maxItems = 50;
|
||||
}
|
||||
if (maxItems === 0) {
|
||||
maxItems = 50;
|
||||
}
|
||||
this._maxItems = maxItems | 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.alias = function(stringOrRx, alias) {
|
||||
this._aliases.push({
|
||||
stringOrRx: stringOrRx,
|
||||
alias: alias
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.removeAlias = function(stringOrRx) {
|
||||
arrayUtils.pluckByCallback(this._aliases, function(pair) {
|
||||
return pair.stringOrRx === stringOrRx;
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype.removeAllAliases = function() {
|
||||
this._aliases.length = 0;
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype._getStyle = function() {
|
||||
return this._style;
|
||||
};
|
||||
|
||||
PrettyError.prototype.appendStyle = function(toAppend) {
|
||||
merge(this._style, toAppend);
|
||||
this._renderer.style(toAppend);
|
||||
return this;
|
||||
};
|
||||
|
||||
PrettyError.prototype._getRenderer = function() {
|
||||
return this._renderer;
|
||||
};
|
||||
|
||||
PrettyError.prototype.render = function(e, logIt, useColors) {
|
||||
var obj, rendered;
|
||||
if (logIt == null) {
|
||||
logIt = false;
|
||||
}
|
||||
if (useColors == null) {
|
||||
useColors = this._useColors;
|
||||
}
|
||||
obj = this.getObject(e);
|
||||
rendered = this._renderer.render(obj, useColors);
|
||||
if (logIt === true) {
|
||||
console.error(rendered);
|
||||
}
|
||||
return rendered;
|
||||
};
|
||||
|
||||
PrettyError.prototype.getObject = function(e) {
|
||||
var count, header, i, item, obj, traceItems, _i, _len, _ref;
|
||||
if (!(e instanceof ParsedError)) {
|
||||
e = new ParsedError(e);
|
||||
}
|
||||
this._applyParsedErrorFiltersOn(e);
|
||||
header = {
|
||||
title: (function() {
|
||||
var ret;
|
||||
ret = {};
|
||||
if (e.wrapper !== '') {
|
||||
ret.wrapper = "" + e.wrapper;
|
||||
}
|
||||
ret.kind = e.kind;
|
||||
return ret;
|
||||
})(),
|
||||
colon: ':',
|
||||
message: String(e.message).trim()
|
||||
};
|
||||
traceItems = [];
|
||||
count = -1;
|
||||
_ref = e.trace;
|
||||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
||||
item = _ref[i];
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
if (this._skipOrFilter(item, i) === true) {
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
if (count > this._maxItems) {
|
||||
break;
|
||||
}
|
||||
if (typeof item === 'string') {
|
||||
traceItems.push({
|
||||
item: {
|
||||
custom: item
|
||||
}
|
||||
});
|
||||
continue;
|
||||
}
|
||||
traceItems.push((function() {
|
||||
var markupItem;
|
||||
markupItem = {
|
||||
item: {
|
||||
header: {
|
||||
pointer: (function() {
|
||||
if (item.file == null) {
|
||||
return '';
|
||||
}
|
||||
return {
|
||||
file: item.file,
|
||||
colon: ':',
|
||||
line: item.line
|
||||
};
|
||||
})()
|
||||
},
|
||||
footer: (function() {
|
||||
var foooter;
|
||||
foooter = {
|
||||
addr: item.shortenedAddr
|
||||
};
|
||||
if (item.extra != null) {
|
||||
foooter.extra = item.extra;
|
||||
}
|
||||
return foooter;
|
||||
})()
|
||||
}
|
||||
};
|
||||
if (typeof item.what === 'string' && item.what.trim().length > 0) {
|
||||
markupItem.item.header.what = item.what;
|
||||
}
|
||||
return markupItem;
|
||||
})());
|
||||
}
|
||||
obj = {
|
||||
'pretty-error': {
|
||||
header: header
|
||||
}
|
||||
};
|
||||
if (traceItems.length > 0) {
|
||||
obj['pretty-error'].trace = traceItems;
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
|
||||
PrettyError.prototype._skipOrFilter = function(item, itemNumber) {
|
||||
var cb, modName, pair, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
||||
if (typeof item === 'object') {
|
||||
if (_ref = item.modName, __indexOf.call(this._packagesToSkip, _ref) >= 0) {
|
||||
return true;
|
||||
}
|
||||
if (_ref1 = item.path, __indexOf.call(this._pathsToSkip, _ref1) >= 0) {
|
||||
return true;
|
||||
}
|
||||
_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') {
|
||||
_ref3 = this._aliases;
|
||||
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
|
||||
pair = _ref3[_j];
|
||||
item.shortenedAddr = item.shortenedAddr.replace(pair.stringOrRx, pair.alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
_ref4 = this._skipCallbacks;
|
||||
for (_k = 0, _len2 = _ref4.length; _k < _len2; _k++) {
|
||||
cb = _ref4[_k];
|
||||
if (cb(item, itemNumber) === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_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, _ref;
|
||||
_ref = this._parsedErrorFilters;
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
cb = _ref[_i];
|
||||
cb(error);
|
||||
}
|
||||
};
|
||||
|
||||
return PrettyError;
|
||||
|
||||
})();
|
||||
|
||||
_ref = ['renderer', 'style'];
|
||||
_fn = function() {
|
||||
var methodName;
|
||||
methodName = '_get' + prop[0].toUpperCase() + prop.substr(1, prop.length);
|
||||
return PrettyError.prototype.__defineGetter__(prop, function() {
|
||||
return this[methodName]();
|
||||
});
|
||||
};
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
prop = _ref[_i];
|
||||
_fn();
|
||||
}
|
64
app_vue/node_modules/pretty-error/lib/defaultStyle.js
generated
vendored
Normal file
64
app_vue/node_modules/pretty-error/lib/defaultStyle.js
generated
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
// Generated by CoffeeScript 1.8.0
|
||||
module.exports = function() {
|
||||
return {
|
||||
'pretty-error': {
|
||||
display: 'block',
|
||||
marginLeft: '2'
|
||||
},
|
||||
'pretty-error > header': {
|
||||
display: 'block'
|
||||
},
|
||||
'pretty-error > header > title > kind': {
|
||||
background: 'red',
|
||||
color: 'bright-white'
|
||||
},
|
||||
'pretty-error > header > title > wrapper': {
|
||||
marginRight: '1',
|
||||
color: 'grey'
|
||||
},
|
||||
'pretty-error > header > colon': {
|
||||
color: 'grey',
|
||||
marginRight: 1
|
||||
},
|
||||
'pretty-error > header > message': {
|
||||
color: 'bright-white'
|
||||
},
|
||||
'pretty-error > trace': {
|
||||
display: 'block',
|
||||
marginTop: 1
|
||||
},
|
||||
'pretty-error > trace > item': {
|
||||
display: 'block',
|
||||
marginBottom: 1,
|
||||
marginLeft: 2,
|
||||
bullet: '"<grey>-</grey>"'
|
||||
},
|
||||
'pretty-error > trace > item > header': {
|
||||
display: 'block'
|
||||
},
|
||||
'pretty-error > trace > item > header > pointer > file': {
|
||||
color: 'bright-yellow'
|
||||
},
|
||||
'pretty-error > trace > item > header > pointer > colon': {
|
||||
color: 'grey'
|
||||
},
|
||||
'pretty-error > trace > item > header > pointer > line': {
|
||||
color: 'bright-yellow',
|
||||
marginRight: 1
|
||||
},
|
||||
'pretty-error > trace > item > header > what': {
|
||||
color: 'white'
|
||||
},
|
||||
'pretty-error > trace > item > footer': {
|
||||
display: 'block'
|
||||
},
|
||||
'pretty-error > trace > item > footer > addr': {
|
||||
display: 'block',
|
||||
color: 'grey'
|
||||
},
|
||||
'pretty-error > trace > item > footer > extra': {
|
||||
display: 'block',
|
||||
color: 'grey'
|
||||
}
|
||||
};
|
||||
};
|
2
app_vue/node_modules/pretty-error/lib/nodePaths.js
generated
vendored
Normal file
2
app_vue/node_modules/pretty-error/lib/nodePaths.js
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
// Generated by CoffeeScript 1.8.0
|
||||
module.exports = ['_debugger.js', '_http_agent.js', '_http_client.js', '_http_common.js', '_http_incoming.js', '_http_outgoing.js', '_http_server.js', '_linklist.js', '_stream_duplex.js', '_stream_passthrough.js', '_stream_readable.js', '_stream_transform.js', '_stream_writable.js', '_tls_legacy.js', '_tls_wrap.js', 'assert.js', 'buffer.js', 'child_process.js', 'cluster.js', 'console.js', 'constants.js', 'crypto.js', 'dgram.js', 'dns.js', 'domain.js', 'events.js', 'freelist.js', 'fs.js', 'http.js', 'https.js', 'module.js', 'net.js', 'os.js', 'path.js', 'punycode.js', 'querystring.js', 'readline.js', 'repl.js', 'smalloc.js', 'stream.js', 'string_decoder.js', 'sys.js', 'timers.js', 'tls.js', 'tty.js', 'url.js', 'util.js', 'vm.js', 'zlib.js', 'node.js'];
|
Reference in New Issue
Block a user