diff options
Diffstat (limited to 'node_modules/pretty-error')
32 files changed, 0 insertions, 3259 deletions
diff --git a/node_modules/pretty-error/.npmignore b/node_modules/pretty-error/.npmignore deleted file mode 100644 index b35bd4bf1..000000000 --- a/node_modules/pretty-error/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -*.bat -.htaccess - -/xeno -/node_modules - -docs --p - -npm-debug.log -!*.gitkeep
\ No newline at end of file diff --git a/node_modules/pretty-error/.travis.yml b/node_modules/pretty-error/.travis.yml deleted file mode 100644 index 5f6aa3f2a..000000000 --- a/node_modules/pretty-error/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js - -node_js: - - 0.10 - -sudo: false
\ No newline at end of file diff --git a/node_modules/pretty-error/LICENSE b/node_modules/pretty-error/LICENSE deleted file mode 100644 index 0641f709b..000000000 --- a/node_modules/pretty-error/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 Aria Minaei - -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. diff --git a/node_modules/pretty-error/README.md b/node_modules/pretty-error/README.md deleted file mode 100644 index ef259caad..000000000 --- a/node_modules/pretty-error/README.md +++ /dev/null @@ -1,322 +0,0 @@ -# pretty-error - -[](https://david-dm.org/AriaMinaei/pretty-error) -[](https://travis-ci.org/AriaMinaei/pretty-error) [](https://npmjs.org/package/pretty-error) - -A small tool to see node.js errors with less clutter: - - - -... which is more readable compared to node's unformatted errors: - - - -## Installation - -Install with npm: - - $ npm install pretty-error - -## Usage and Examples - -To see an error rendered with colors, you can do this: - -```javascript -var PrettyError = require('pretty-error'); -var pe = new PrettyError(); - -var renderedError = pe.render(new Error('Some error message')); -console.log(renderedError); -``` - -Of course, you can render caught exceptions too: - -```javascript -try { - doSomethingThatThrowsAnError(); -} catch (error) { - console.log(pe.render(error)); -} -``` - -But if you want pretty-error to render all errors, there is a shortcut for it: - -```javascript -require('pretty-error').start(); -``` - -... which is essentially equal to: - -```javascript -var PrettyError = require('pretty-error'); - -// instantiate PrettyError, which can then be used to render error objects -var pe = new PrettyError(); -pe.start(); -``` - -You can also preload pretty-error into your code using node's [`--require`](https://nodejs.org/api/cli.html#cli_r_require_module) argument: - -``` -$ node --require pretty-error/start your-module.js -``` - -## How it Works - -PrettyError turns error objects into something similar to an html document, and then uses [RenderKid](https://github.com/AriaMinaei/renderkid) to render the document using simple html/css-like commands. This allows PrettyError to be themed using simple css-like declarations. - -## Theming - -PrettyError's default theme is a bunch of simple css-like rules. [Here](https://github.com/AriaMinaei/pretty-error/blob/master/src/defaultStyle.coffee) is the source of the default theme. - -Since the default theme is all css, you can customize it to fit your taste. Let's do a minimal one: - -```javascript -// the start() shortcut returns an instance of PrettyError ... -pe = require('pretty-error').start(); - -// ... which we can then use to customize like this: -pe.appendStyle({ - // this is a simple selector to the element that says 'Error' - 'pretty-error > header > title > kind': { - // which we can hide: - display: 'none' - }, - - // the 'colon' after 'Error': - 'pretty-error > header > colon': { - // we hide that too: - display: 'none' - }, - - // our error message - 'pretty-error > header > message': { - // let's change its color: - color: 'bright-white', - - // we can use black, red, green, yellow, blue, magenta, cyan, white, - // grey, bright-red, bright-green, bright-yellow, bright-blue, - // bright-magenta, bright-cyan, and bright-white - - // we can also change the background color: - background: 'cyan', - - // it understands paddings too! - padding: '0 1' // top/bottom left/right - }, - - // each trace item ... - 'pretty-error > trace > item': { - // ... can have a margin ... - marginLeft: 2, - - // ... and a bullet character! - bullet: '"<grey>o</grey>"' - - // Notes on bullets: - // - // The string inside the quotation mark gets used as the character - // to show for the bullet point. - // - // You can set its color/background color using tags. - // - // This example sets the background color to white, and the text color - // to cyan, the character will be a hyphen with a space character - // on each side: - // example: '"<bg-white><cyan> - </cyan></bg-white>"' - // - // Note that we should use a margin of 3, since the bullet will be - // 3 characters long. - }, - - 'pretty-error > trace > item > header > pointer > file': { - color: 'bright-cyan' - }, - - 'pretty-error > trace > item > header > pointer > colon': { - color: 'cyan' - }, - - 'pretty-error > trace > item > header > pointer > line': { - color: 'bright-cyan' - }, - - 'pretty-error > trace > item > header > what': { - color: 'bright-white' - }, - - 'pretty-error > trace > item > footer > addr': { - display: 'none' - } -}); -``` - -This is how our minimal theme will look like:  - -Read [RenderKid](https://github.com/AriaMinaei/renderkid)'s docs to learn about all the css rules that are supported. - -## Customization - -There are a few methods to help you customize the contents of your error logs. - -Let's instantiate first: - -```javascript -PrettyError = require('pretty-error'); -pe = new PrettyError(); - -// or: -pe = require('pretty-error').start(); -``` - -#### Shortening paths - -You might want to substitute long paths with shorter, more readable aliases: - -```javascript -pe.alias('E:/open-source/theatrejs/lib', '(Theare.js)'); -``` - -#### Skipping packages - -You might want to skip trace lines that belong to specific packages (chai, when, socket.io): - -```javascript -pe.skipPackage('chai', 'when', 'socket.io'); -``` - -#### Skipping node files - -```javascript -// this will skip node.js, path.js, event.js, etc. -pe.skipNodeFiles(); -``` - -#### Skipping paths - -```javascript -pe.skipPath('/home/dir/someFile.js'); -``` - -#### Skipping by callback - -You can customize which trace lines get logged and which won't: -```javascript -pe.skip(function(traceLine, lineNumber){ - // if we know which package this trace line comes from, and it isn't - // our 'demo' package ... - if (typeof traceLine.packageName !== 'undefined' && traceLine.packageName !== 'demo') { - // then skip this line - return true; - } - - // You can console.log(traceLine) to see all of it's properties. - // Don't expect all these properties to be present, and don't assume - // that our traceLine is always an object. -}); -``` - -#### Modifying each trace line's contents - -```javascript -pe.filter(function(traceLine, lineNumber){ - // the 'what' clause is something like: - // 'DynamicTimeline.module.exports.DynamicTimeline._verifyProp' - if (typeof traceLine.what !== 'undefined'){ - - // we can shorten it with a regex: - traceLine.what = traceLine.what.replace( - /(.*\.module\.exports\.)(.*)/, '$2' - ); - } -}); -``` - -## Disabling colors -```javascript -pe.withoutColors(); // Errors will be rendered without coloring -``` - -## Integrating with frameworks - -PrettyError is very simple to set up, so it should be easy to use within other frameworks. - -### Integrating with [express](https://github.com/visionmedia/express) - -Most frameworks such as express, catch errors automatically and provide a mechanism to handle those errors. Here is an example of how you can use PrettyError to log unhandled errors in express: - -```javascript -// this is app.js - -var express = require('express'); -var PrettyError = require('pretty-error'); - -var app = express(); - -app.get('/', function(req, res) { - // this will throw an error: - var a = b; -}); - -var server = app.listen(3000, function(){ - console.log('Server started \n'); -}); - - -// we can now instantiaite Prettyerror: -pe = new PrettyError(); - -// and use it for our app's error handler: -app.use(function(err, req, res, next){ - console.log(pe.render(err)); - next(); -}); - -// we can optionally configure prettyError to simplify the stack trace: - -pe.skipNodeFiles(); // this will skip events.js and http.js and similar core node files -pe.skipPackage('express'); // this will skip all the trace lines about express` core and sub-modules -``` - -## Troubleshooting - -`PrettyError.start()` modifies the stack traces of all errors thrown anywhere in your code, so it could potentially break packages that rely on node's original stack traces. I've only encountered this problem once, and it was with BlueBird when `Promise.longStackTraces()` was on. - -In order to avoid this problem, it's better to not use `PrettyError.start()` and instead, manually catch errors and render them with PrettyError: - -```javascript -var PrettyError = require('pretty-error'); -var pe = new PrettyError(); - -// To render exceptions thrown in non-promies code: -process.on('uncaughtException', function(error){ - console.log(pe.render(error)); -}); - -// To render unhandled rejections created in BlueBird: -process.on('unhandledRejection', function(reason){ - console.log("Unhandled rejection"); - console.log(pe.render(reason)); -}); - -// While PrettyError.start() works out of the box with when.js` unhandled rejections, -// now that wer'e manually rendering errors, we have to instead use npmjs.org/packages/pretty-monitor -// to handle when.js rejections. - -``` - -The only drawback with this approach is that exceptions thrown in the first tick are not prettified. To fix that, you can delay your application's startup for one tick: - -```javascript -// (continued form above) - -throw new Error(); // not prettified -process.nextTick(function(){ - throw new Error(); // prettified -}); - -``` - -## License - -MIT diff --git a/node_modules/pretty-error/index.d.ts b/node_modules/pretty-error/index.d.ts deleted file mode 100644 index a2f4446ba..000000000 --- a/node_modules/pretty-error/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -declare module 'pretty-error' { - - namespace PrettyError { - function start(): any; - function stop(): any; - - class ParsedError { - constructor( error:Error ); - } - - interface ConfigObject { - skipPackages?:boolean | string[], - skipPaths?:boolean | string[], - skip?:boolean | PrettyError.Callback | PrettyError.Callback[], - maxItems?:number, - skipNodeFiles?:boolean | any // assuming this is optional - filters?:boolean | PrettyError.Callback | PrettyError.Callback[], - parsedErrorFilters?:boolean | PrettyError.Callback | PrettyError.Callback[], - aliases?:boolean | Object - } - - interface Callback { - traceLine:Object | any, - lineNumber:number - } - } - - class PrettyError { - constructor(); - - start():PrettyError; - stop():any; - config( configObject:PrettyError.ConfigObject ):PrettyError; - withoutColors():PrettyError; - withColors():PrettyError; - skipPackage( ... packages:string[] ):PrettyError; - unskipPackage( ... packages:string[] ):PrettyError; - unskipAllPackages():PrettyError; - skipPath( ... paths:string[] ):PrettyError; - unskipPath( ... paths:string[] ):PrettyError; - unskipAllPaths():PrettyError; - skip( callbacks:PrettyError.Callback ):PrettyError; - unskip( callbacks:PrettyError.Callback ):PrettyError; - unskipAll():PrettyError; - skipNodeFiles():any; - unskipNodeFiles():any; - filter( callbacks:PrettyError.Callback ):PrettyError; - removeFilter( callbacks:PrettyError.Callback ):PrettyError; - removeAllFilters():PrettyError; - filterParsedError( callbacks:PrettyError.Callback ):PrettyError; - removeParsedErrorFilter( callbacks:PrettyError.Callback ):PrettyError; - removeAllParsedErrorFilters():PrettyError; - setMaxItems( maxItems:number ):PrettyError; - alias( stringOrRx:string, alias:string ):PrettyError; - removeAlias( stringOrRx:string ):PrettyError; - removeAllAliases():PrettyError; - appendStyle( toAppend:Object ):PrettyError; - render( e:PrettyError.ParsedError, logIt?:boolean, useColors?:boolean ):string; - getObject( e:Object ):Object; - } - - export = PrettyError; - -} diff --git a/node_modules/pretty-error/lib/ParsedError.js b/node_modules/pretty-error/lib/ParsedError.js deleted file mode 100644 index d5bb57536..000000000 --- a/node_modules/pretty-error/lib/ParsedError.js +++ /dev/null @@ -1,246 +0,0 @@ -// 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]; - } - } - if (typeof this._stack === 'string') { - this._parseStack(); - } else { - this._message = (this.error.message != null) && String(this.error.message) || ''; - } - } - }; - - 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 { - 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+/, ''); - } - this._message = 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(); -} diff --git a/node_modules/pretty-error/lib/PrettyError.js b/node_modules/pretty-error/lib/PrettyError.js deleted file mode 100644 index de5cbbca7..000000000 --- a/node_modules/pretty-error/lib/PrettyError.js +++ /dev/null @@ -1,504 +0,0 @@ -// Generated by CoffeeScript 1.8.0 -var ParsedError, PrettyError, RenderKid, array, defaultStyle, instance, nodePaths, object, prop, _fn, _i, _len, _ref, _ref1, - __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; - -defaultStyle = require('./defaultStyle'); - -ParsedError = require('./ParsedError'); - -nodePaths = require('./nodePaths'); - -RenderKid = require('renderkid'); - -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, _ref1; - 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 (object.isBareObject(c.aliases)) { - _ref1 = c.aliases; - for (path in _ref1) { - alias = _ref1[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]; - array.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]; - array.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]; - array.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]; - array.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]; - array.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) { - array.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) { - object.appendOnto(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, _ref1; - 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; - _ref1 = e.trace; - for (i = _i = 0, _len = _ref1.length; _i < _len; i = ++_i) { - item = _ref1[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, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6; - if (typeof item === 'object') { - if (_ref1 = item.modName, __indexOf.call(this._packagesToSkip, _ref1) >= 0) { - return true; - } - if (_ref2 = item.path, __indexOf.call(this._pathsToSkip, _ref2) >= 0) { - return true; - } - _ref3 = item.packages; - for (_i = 0, _len = _ref3.length; _i < _len; _i++) { - modName = _ref3[_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]; - item.shortenedAddr = item.shortenedAddr.replace(pair.stringOrRx, pair.alias); - } - } - } - _ref5 = this._skipCallbacks; - for (_k = 0, _len2 = _ref5.length; _k < _len2; _k++) { - cb = _ref5[_k]; - if (cb(item, itemNumber) === true) { - return true; - } - } - _ref6 = this._filterCallbacks; - for (_l = 0, _len3 = _ref6.length; _l < _len3; _l++) { - cb = _ref6[_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]; - cb(error); - } - }; - - return PrettyError; - -})(); - -_ref1 = ['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 = _ref1.length; _i < _len; _i++) { - prop = _ref1[_i]; - _fn(); -} diff --git a/node_modules/pretty-error/lib/defaultStyle.js b/node_modules/pretty-error/lib/defaultStyle.js deleted file mode 100644 index 5ae296c31..000000000 --- a/node_modules/pretty-error/lib/defaultStyle.js +++ /dev/null @@ -1,64 +0,0 @@ -// 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' - } - }; -}; diff --git a/node_modules/pretty-error/lib/nodePaths.js b/node_modules/pretty-error/lib/nodePaths.js deleted file mode 100644 index ac61fee08..000000000 --- a/node_modules/pretty-error/lib/nodePaths.js +++ /dev/null @@ -1,2 +0,0 @@ -// 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']; diff --git a/node_modules/pretty-error/node_modules/utila/.npmignore b/node_modules/pretty-error/node_modules/utila/.npmignore deleted file mode 100644 index 6792bfff6..000000000 --- a/node_modules/pretty-error/node_modules/utila/.npmignore +++ /dev/null @@ -1,10 +0,0 @@ -*.bat -.htaccess - -src - -npm-debug.log -!*.gitkeep - -node_modules -xeno
\ No newline at end of file diff --git a/node_modules/pretty-error/node_modules/utila/LICENSE b/node_modules/pretty-error/node_modules/utila/LICENSE deleted file mode 100644 index 68160a068..000000000 --- a/node_modules/pretty-error/node_modules/utila/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Aria Minaei - -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. diff --git a/node_modules/pretty-error/node_modules/utila/README.md b/node_modules/pretty-error/node_modules/utila/README.md deleted file mode 100644 index 583bc6868..000000000 --- a/node_modules/pretty-error/node_modules/utila/README.md +++ /dev/null @@ -1,7 +0,0 @@ -notareplacementforunderscore - -# Installation - -**npm**: `npm install utila` - -**bower**: available via bower as in `bower install utila`, but you should run `npm install` before you can use it.
\ No newline at end of file diff --git a/node_modules/pretty-error/node_modules/utila/lib/Emitter.js b/node_modules/pretty-error/node_modules/utila/lib/Emitter.js deleted file mode 100644 index 3a67ed190..000000000 --- a/node_modules/pretty-error/node_modules/utila/lib/Emitter.js +++ /dev/null @@ -1,137 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -var Emitter, array; - -array = require('./array'); - -module.exports = Emitter = (function() { - function Emitter() { - this._listeners = {}; - this._listenersForAnyEvent = []; - this._disabledEmitters = {}; - } - - Emitter.prototype.on = function(eventName, listener) { - if (this._listeners[eventName] == null) { - this._listeners[eventName] = []; - } - this._listeners[eventName].push(listener); - return this; - }; - - Emitter.prototype.once = function(eventName, listener) { - var cb, ran, - _this = this; - ran = false; - cb = function() { - if (ran) { - return; - } - ran = true; - listener(); - return setTimeout(function() { - return _this.removeEvent(eventName, cb); - }, 0); - }; - this.on(eventName, cb); - return this; - }; - - Emitter.prototype.onAnyEvent = function(listener) { - this._listenersForAnyEvent.push(listener); - return this; - }; - - Emitter.prototype.removeEvent = function(eventName, listener) { - if (this._listeners[eventName] == null) { - return this; - } - array.pluckOneItem(this._listeners[eventName], listener); - return this; - }; - - Emitter.prototype.removeListeners = function(eventName) { - if (this._listeners[eventName] == null) { - return this; - } - this._listeners[eventName].length = 0; - return this; - }; - - Emitter.prototype.removeAllListeners = function() { - var listeners, name, _ref; - _ref = this._listeners; - for (name in _ref) { - listeners = _ref[name]; - listeners.length = 0; - } - return this; - }; - - Emitter.prototype._emit = function(eventName, data) { - var listener, _i, _j, _len, _len1, _ref, _ref1; - _ref = this._listenersForAnyEvent; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - listener = _ref[_i]; - listener.call(this, data, eventName); - } - if (this._listeners[eventName] == null) { - return; - } - _ref1 = this._listeners[eventName]; - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - listener = _ref1[_j]; - listener.call(this, data); - } - }; - - Emitter.prototype._throttleEmitterMethod = function(fnName, time) { - var lastCallArgs, originalFn, pend, pending, runIt, timer, - _this = this; - if (time == null) { - time = 1000; - } - originalFn = this[fnName]; - if (typeof originalFn !== 'function') { - throw Error("this class does not have a method called '" + fnName + "'"); - } - lastCallArgs = null; - pending = false; - timer = null; - this[fnName] = function() { - lastCallArgs = arguments; - return pend(); - }; - pend = function() { - if (pending) { - clearTimeout(timer); - } - timer = setTimeout(runIt, time); - return pending = true; - }; - return runIt = function() { - pending = false; - return originalFn.apply(_this, lastCallArgs); - }; - }; - - Emitter.prototype._disableEmitter = function(fnName) { - if (this._disabledEmitters[fnName] != null) { - throw Error("" + fnName + " is already a disabled emitter"); - } - this._disabledEmitters[fnName] = this[fnName]; - return this[fnName] = function() {}; - }; - - Emitter.prototype._enableEmitter = function(fnName) { - var fn; - fn = this._disabledEmitters[fnName]; - if (fn == null) { - throw Error("" + fnName + " is not a disabled emitter"); - } - this[fnName] = fn; - return delete this._disabledEmitters[fnName]; - }; - - return Emitter; - -})(); diff --git a/node_modules/pretty-error/node_modules/utila/lib/_common.js b/node_modules/pretty-error/node_modules/utila/lib/_common.js deleted file mode 100644 index b5eb5036e..000000000 --- a/node_modules/pretty-error/node_modules/utila/lib/_common.js +++ /dev/null @@ -1,111 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -var common; - -module.exports = common = { - /* - Checks to see if o is an object, and it isn't an instance - of some class. - */ - - isBareObject: function(o) { - if ((o != null) && o.constructor === Object) { - return true; - } - return false; - }, - /* - Returns type of an object, including: - undefined, null, string, number, array, - arguments, element, textnode, whitespace, and object - */ - - typeOf: function(item) { - var _ref; - if (item === null) { - return 'null'; - } - if (typeof item !== 'object') { - return typeof item; - } - if (Array.isArray(item)) { - return 'array'; - } - if (item.nodeName) { - if (item.nodeType === 1) { - return 'element'; - } - if (item.nodeType === 3) { - return (_ref = /\S/.test(item.nodeValue)) != null ? _ref : { - 'textnode': 'whitespace' - }; - } - } else if (typeof item.length === 'number') { - if (item.callee) { - return 'arguments'; - } - } - return typeof item; - }, - clone: function(item, includePrototype) { - if (includePrototype == null) { - includePrototype = false; - } - switch (common.typeOf(item)) { - case 'array': - return common._cloneArray(item, includePrototype); - case 'object': - return common._cloneObject(item, includePrototype); - default: - return item; - } - }, - /* - Deep clone of an object. - From MooTools - */ - - _cloneObject: function(o, includePrototype) { - var clone, key; - if (includePrototype == null) { - includePrototype = false; - } - if (common.isBareObject(o)) { - clone = {}; - for (key in o) { - clone[key] = common.clone(o[key], includePrototype); - } - return clone; - } else { - if (!includePrototype) { - return o; - } - if (o instanceof Function) { - return o; - } - clone = Object.create(o.constructor.prototype); - for (key in o) { - if (o.hasOwnProperty(key)) { - clone[key] = common.clone(o[key], includePrototype); - } - } - return clone; - } - }, - /* - Deep clone of an array. - From MooTools - */ - - _cloneArray: function(a, includePrototype) { - var clone, i; - if (includePrototype == null) { - includePrototype = false; - } - i = a.length; - clone = new Array(i); - while (i--) { - clone[i] = common.clone(a[i], includePrototype); - } - return clone; - } -}; diff --git a/node_modules/pretty-error/node_modules/utila/lib/array.js b/node_modules/pretty-error/node_modules/utila/lib/array.js deleted file mode 100644 index 3873d3ef2..000000000 --- a/node_modules/pretty-error/node_modules/utila/lib/array.js +++ /dev/null @@ -1,165 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -var array; - -module.exports = array = { - /* - Tries to turn anything into an array. - */ - - from: function(r) { - return Array.prototype.slice.call(r); - }, - /* - Clone of an array. Properties will be shallow copies. - */ - - simpleClone: function(a) { - return a.slice(0); - }, - shallowEqual: function(a1, a2) { - var i, val, _i, _len; - if (!(Array.isArray(a1) && Array.isArray(a2) && a1.length === a2.length)) { - return false; - } - for (i = _i = 0, _len = a1.length; _i < _len; i = ++_i) { - val = a1[i]; - if (a2[i] !== val) { - return false; - } - } - return true; - }, - pluck: function(a, i) { - var index, value, _i, _len; - if (a.length < 1) { - return a; - } - for (index = _i = 0, _len = a.length; _i < _len; index = ++_i) { - value = a[index]; - if (index > i) { - a[index - 1] = a[index]; - } - } - a.length = a.length - 1; - return a; - }, - pluckItem: function(a, item) { - 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 (value === item) { - 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; - }, - 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; - }, - pluckMultiple: function(array, indexesToRemove) { - var i, removedSoFar, _i, _len; - if (array.length < 1) { - return array; - } - removedSoFar = 0; - indexesToRemove.sort(); - for (_i = 0, _len = indexesToRemove.length; _i < _len; _i++) { - i = indexesToRemove[_i]; - this.pluck(array, i - removedSoFar); - removedSoFar++; - } - return array; - }, - injectByCallback: function(a, toInject, shouldInject) { - var i, len, val, valA, valB, _i, _len; - valA = null; - valB = null; - len = a.length; - if (len < 1) { - a.push(toInject); - return a; - } - for (i = _i = 0, _len = a.length; _i < _len; i = ++_i) { - val = a[i]; - valA = valB; - valB = val; - if (shouldInject(valA, valB, toInject)) { - return a.splice(i, 0, toInject); - } - } - a.push(toInject); - return a; - }, - injectInIndex: function(a, index, toInject) { - var i, len, toPut, toPutNext; - len = a.length; - i = index; - if (len < 1) { - a.push(toInject); - return a; - } - toPut = toInject; - toPutNext = null; - for(; i <= len; i++){ - - toPutNext = a[i]; - - a[i] = toPut; - - toPut = toPutNext; - - }; - return null; - } -}; diff --git a/node_modules/pretty-error/node_modules/utila/lib/classic.js b/node_modules/pretty-error/node_modules/utila/lib/classic.js deleted file mode 100644 index a77bd328c..000000000 --- a/node_modules/pretty-error/node_modules/utila/lib/classic.js +++ /dev/null @@ -1,86 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -var classic, - __slice = [].slice; - -module.exports = classic = {}; - -classic.implement = function() { - var classProto, classReference, desc, member, mixin, mixins, _i, _j, _len; - mixins = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), classReference = arguments[_i++]; - for (_j = 0, _len = mixins.length; _j < _len; _j++) { - mixin = mixins[_j]; - classProto = classReference.prototype; - for (member in mixin.prototype) { - if (!Object.getOwnPropertyDescriptor(classProto, member)) { - desc = Object.getOwnPropertyDescriptor(mixin.prototype, member); - Object.defineProperty(classProto, member, desc); - } - } - } - return classReference; -}; - -classic.mix = function() { - var classProto, classReference, desc, member, mixin, mixins, _i, _j, _len; - mixins = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), classReference = arguments[_i++]; - classProto = classReference.prototype; - classReference.__mixinCloners = []; - classReference.__applyClonersFor = function(instance, args) { - var cloner, _j, _len, _ref; - if (args == null) { - args = null; - } - _ref = classReference.__mixinCloners; - for (_j = 0, _len = _ref.length; _j < _len; _j++) { - cloner = _ref[_j]; - cloner.apply(instance, args); - } - }; - classReference.__mixinInitializers = []; - classReference.__initMixinsFor = function(instance, args) { - var initializer, _j, _len, _ref; - if (args == null) { - args = null; - } - _ref = classReference.__mixinInitializers; - for (_j = 0, _len = _ref.length; _j < _len; _j++) { - initializer = _ref[_j]; - initializer.apply(instance, args); - } - }; - classReference.__mixinQuitters = []; - classReference.__applyQuittersFor = function(instance, args) { - var quitter, _j, _len, _ref; - if (args == null) { - args = null; - } - _ref = classReference.__mixinQuitters; - for (_j = 0, _len = _ref.length; _j < _len; _j++) { - quitter = _ref[_j]; - quitter.apply(instance, args); - } - }; - for (_j = 0, _len = mixins.length; _j < _len; _j++) { - mixin = mixins[_j]; - if (!(mixin.constructor instanceof Function)) { - throw Error("Mixin should be a function"); - } - for (member in mixin.prototype) { - if (member.substr(0, 11) === '__initMixin') { - classReference.__mixinInitializers.push(mixin.prototype[member]); - continue; - } else if (member.substr(0, 11) === '__clonerFor') { - classReference.__mixinCloners.push(mixin.prototype[member]); - continue; - } else if (member.substr(0, 12) === '__quitterFor') { - classReference.__mixinQuitters.push(mixin.prototype[member]); - continue; - } - if (!Object.getOwnPropertyDescriptor(classProto, member)) { - desc = Object.getOwnPropertyDescriptor(mixin.prototype, member); - Object.defineProperty(classProto, member, desc); - } - } - } - return classReference; -}; diff --git a/node_modules/pretty-error/node_modules/utila/lib/object.js b/node_modules/pretty-error/node_modules/utila/lib/object.js deleted file mode 100644 index 47e2c1684..000000000 --- a/node_modules/pretty-error/node_modules/utila/lib/object.js +++ /dev/null @@ -1,158 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -var object, _common, - __hasProp = {}.hasOwnProperty; - -_common = require('./_common'); - -module.exports = object = { - isBareObject: _common.isBareObject.bind(_common), - /* - if object is an instance of a class - */ - - isInstance: function(what) { - return !this.isBareObject(what); - }, - /* - Alias to _common.typeOf - */ - - typeOf: _common.typeOf.bind(_common), - /* - Alias to _common.clone - */ - - clone: _common.clone.bind(_common), - /* - Empties an object of its properties. - */ - - empty: function(o) { - var prop; - for (prop in o) { - if (o.hasOwnProperty(prop)) { - delete o[prop]; - } - } - return o; - }, - /* - Empties an object. Doesn't check for hasOwnProperty, so it's a tiny - bit faster. Use it for plain objects. - */ - - fastEmpty: function(o) { - var property; - for (property in o) { - delete o[property]; - } - return o; - }, - /* - Overrides values fomr `newValues` on `base`, as long as they - already exist in base. - */ - - overrideOnto: function(base, newValues) { - var key, newVal, oldVal; - if (!this.isBareObject(newValues) || !this.isBareObject(base)) { - return base; - } - for (key in base) { - oldVal = base[key]; - newVal = newValues[key]; - if (newVal === void 0) { - continue; - } - if (typeof newVal !== 'object' || this.isInstance(newVal)) { - base[key] = this.clone(newVal); - } else { - if (typeof oldVal !== 'object' || this.isInstance(oldVal)) { - base[key] = this.clone(newVal); - } else { - this.overrideOnto(oldVal, newVal); - } - } - } - return base; - }, - /* - Takes a clone of 'base' and runs #overrideOnto on it - */ - - override: function(base, newValues) { - return this.overrideOnto(this.clone(base), newValues); - }, - append: function(base, toAppend) { - return this.appendOnto(this.clone(base), toAppend); - }, - appendOnto: function(base, toAppend) { - var key, newVal, oldVal; - if (!this.isBareObject(toAppend) || !this.isBareObject(base)) { - return base; - } - for (key in toAppend) { - if (!__hasProp.call(toAppend, key)) continue; - newVal = toAppend[key]; - if (newVal === void 0) { - continue; - } - if (typeof newVal !== 'object' || this.isInstance(newVal)) { - base[key] = newVal; - } else { - oldVal = base[key]; - if (typeof oldVal !== 'object' || this.isInstance(oldVal)) { - base[key] = this.clone(newVal); - } else { - this.appendOnto(oldVal, newVal); - } - } - } - return base; - }, - groupProps: function(obj, groups) { - var def, defs, grouped, key, name, shouldAdd, val, _i, _len; - grouped = {}; - for (name in groups) { - defs = groups[name]; - grouped[name] = {}; - } - grouped['rest'] = {}; - top: //; - for (key in obj) { - val = obj[key]; - shouldAdd = false; - for (name in groups) { - defs = groups[name]; - if (!Array.isArray(defs)) { - defs = [defs]; - } - for (_i = 0, _len = defs.length; _i < _len; _i++) { - def = defs[_i]; - if (typeof def === 'string') { - if (key === def) { - shouldAdd = true; - } - } else if (def instanceof RegExp) { - if (def.test(key)) { - shouldAdd = true; - } - } else if (def instanceof Function) { - if (def(key)) { - shouldAdd = true; - } - } else { - throw Error('Group definitions must either\ - be strings, regexes, or functions.'); - } - if (shouldAdd) { - grouped[name][key] = val; - continue top; - } - } - } - grouped['rest'][key] = val; - } - return grouped; - } -}; diff --git a/node_modules/pretty-error/node_modules/utila/lib/string.js b/node_modules/pretty-error/node_modules/utila/lib/string.js deleted file mode 100644 index e574c2cb4..000000000 --- a/node_modules/pretty-error/node_modules/utila/lib/string.js +++ /dev/null @@ -1,14 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -module.exports = { - pad: function(n, width, z) { - if (z == null) { - z = '0'; - } - n = n + ''; - if (n.length >= width) { - return n; - } else { - return new Array(width - n.length + 1).join(z) + n; - } - } -}; diff --git a/node_modules/pretty-error/node_modules/utila/lib/utila.js b/node_modules/pretty-error/node_modules/utila/lib/utila.js deleted file mode 100644 index 21c550e0a..000000000 --- a/node_modules/pretty-error/node_modules/utila/lib/utila.js +++ /dev/null @@ -1,10 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -var utila; - -module.exports = utila = { - array: require('./array'), - classic: require('./classic'), - object: require('./object'), - string: require('./string'), - Emitter: require('./Emitter') -}; diff --git a/node_modules/pretty-error/node_modules/utila/package.json b/node_modules/pretty-error/node_modules/utila/package.json deleted file mode 100644 index 3d2aab16d..000000000 --- a/node_modules/pretty-error/node_modules/utila/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "utila", - "version": "0.4.0", - "description": "notareplacementforunderscore", - "main": "lib/utila.js", - "devDependencies": { - "coffee-script": "~1.6.3", - "little-popo": "~0.1" - }, - "scripts": { - "prepublish": "coffee --bare --compile --output ./lib ./src" - }, - "repository": { - "type": "git", - "url": "https://github.com/AriaMinaei/utila.git" - }, - "keywords": [ - "utilities" - ], - "author": "Aria Minaei", - "license": "MIT", - "bugs": { - "url": "https://github.com/AriaMinaei/utila/issues" - } -} diff --git a/node_modules/pretty-error/node_modules/utila/test/_prepare.coffee b/node_modules/pretty-error/node_modules/utila/test/_prepare.coffee deleted file mode 100644 index b602a464e..000000000 --- a/node_modules/pretty-error/node_modules/utila/test/_prepare.coffee +++ /dev/null @@ -1,5 +0,0 @@ -path = require 'path' - -pathToLib = path.resolve __dirname, '../lib' - -require('little-popo')(pathToLib)
\ No newline at end of file diff --git a/node_modules/pretty-error/node_modules/utila/test/array.coffee b/node_modules/pretty-error/node_modules/utila/test/array.coffee deleted file mode 100644 index a244861be..000000000 --- a/node_modules/pretty-error/node_modules/utila/test/array.coffee +++ /dev/null @@ -1,143 +0,0 @@ -require './_prepare' - -array = mod 'array' - -test 'from', -> - - array.from([1]).should.be.an.instanceOf Array - array.from([1])[0].should.equal 1 - -# test 'clone', -> - -# a = [0, 1, 2] - -# b = array.clone a - -# b[0].should.equal 0 -# b[1].should.equal 1 - -# b[0] = 3 - -# a[0].should.equal 0 - -test 'pluck', -> - - a = [0, 1, 2, 3] - - after = array.pluck a, 1 - - after.length.should.equal 3 - - after[0].should.equal 0 - after[1].should.equal 2 - after[2].should.equal 3 - after.should.equal a - -test 'pluckMultiple', -> - - a = [0, 1, 2, 3, 4, 5, 6] - - array.pluckMultiple a, [0, 4, 2, 6] - - a.length.should.equal 3 - a[0].should.equal 1 - a[1].should.equal 3 - a[2].should.equal 5 - -test 'pluckItem', -> - - a = [0, 1, 2, 3, 2, 4, 2] - - array.pluckItem a, 2 - - a[0].should.equal 0 - a[1].should.equal 1 - a[2].should.equal 3 - a[3].should.equal 4 - - array.pluckItem([1], 2).length.should.equal 1 - - -test 'pluckOneItem', -> - - a = [0, 1, 2, 3, 2, 4, 2] - - array.pluckOneItem a, 2 - - a[0].should.equal 0 - a[1].should.equal 1 - a[2].should.equal 3 - a[3].should.equal 2 - a[4].should.equal 4 - a[5].should.equal 2 - - a = [1, 2] - - array.pluckOneItem a, 1 - - a.length.should.equal 1 - a[0].should.equal 2 - - array.pluckOneItem([], 1).length.should.equal 0 - - array.pluckOneItem([1], 2).length.should.equal 1 - -test 'plcukByCallback', -> - - a = [0, 1, 2, 3] - - array.pluckByCallback a, (val, i) -> - - return yes if val is 2 - - return no - - a[0].should.equal 0 - a[1].should.equal 1 - a[2].should.equal 3 - -test 'injectByCallback', -> - - shouldInject = (valA, valB, toInject) -> - - unless valA? - - return yes if toInject <= valB - - return no - - unless valB? - - return yes if valA <= toInject - - return no - - return yes if valA <= toInject <= valB - - return no - - a = [0.5, 1, 2.5, 2.5, 2.75, 2.75, 3] - - array.injectByCallback a, 0, shouldInject - - a[0].should.equal 0 - a[1].should.equal 0.5 - a[7].should.equal 3 - - a = [0.5, 1, 2.5, 2.5, 2.75, 2.75, 3] - - array.injectByCallback a, 2.7, shouldInject - - a[0].should.equal 0.5 - a[4].should.equal 2.7 - a[5].should.equal 2.75 - a[7].should.equal 3 - - a = [0.5, 1, 2.5, 2.5, 2.75, 2.75, 3] - - array.injectByCallback a, 3.2, shouldInject - - a[0].should.equal 0.5 - a[4].should.equal 2.75 - a[6].should.equal 3 - a[7].should.equal 3.2
\ No newline at end of file diff --git a/node_modules/pretty-error/node_modules/utila/test/object.coffee b/node_modules/pretty-error/node_modules/utila/test/object.coffee deleted file mode 100644 index e36140c8d..000000000 --- a/node_modules/pretty-error/node_modules/utila/test/object.coffee +++ /dev/null @@ -1,233 +0,0 @@ -require './_prepare' - -object = mod 'object' - -test 'isBareObject', -> - - object.isBareObject('a').should.equal false - - object.isBareObject({'a': 'a'}).should.equal true - -test 'typeOf', -> - - object.typeOf('s').should.equal 'string' - object.typeOf(0).should.equal 'number' - object.typeOf(false).should.equal 'boolean' - object.typeOf({}).should.equal 'object' - object.typeOf(arguments).should.equal 'arguments' - object.typeOf([]).should.equal 'array' - -test 'empty', -> - - o = - - a: 1 - b: 2 - - - object.empty o - - o.should.not.have.property 'a' - o.should.not.have.property 'b' - -test 'fastEmpty', -> - - o = - a: 1 - b: 2 - - - object.fastEmpty o - - o.should.not.have.property 'a' - o.should.not.have.property 'b' - -test 'clone', -> - - object.clone([1])[0].should.equal 1 - object.clone({a:1}).a.should.equal 1 - - o = {a: 1} - - object.clone(o).should.not.equal o - -test 'clone [include prototype]', -> - - class C - - constructor: (@a) -> - - sayA: -> @a + 'a' - - a = new C 'a' - - a.sayA().should.equal 'aa' - - b = object.clone a, yes - - b.should.not.equal a - - b.constructor.should.equal C - - b.a.should.equal 'a' - - b.a = 'a2' - - b.sayA().should.equal 'a2a' - -test 'clone [without prototype]', -> - - class C - - constructor: (@a) -> - - sayA: -> @a + 'a' - - a = new C 'a' - - a.sayA().should.equal 'aa' - - b = object.clone a, no - - b.should.equal a - -test 'overrideOnto [basic]', -> - - onto = - a: 'a' - b: - c: 'c' - d: - e: 'e' - - what = - a: 'a2' - b: - c: 'c2' - d: - f: 'f2' - - object.overrideOnto onto, what - - onto.a.should.equal 'a2' - onto.b.should.have.property 'c' - onto.b.c.should.equal 'c2' - onto.b.d.should.not.have.property 'f' - onto.b.d.e.should.equal 'e' - -test 'override', -> - - onto = - - a: 'a' - - b: - - c: 'c' - - d: - - e: 'e' - - what = - - a: 'a2' - - b: - - c: 'c2' - - d: - - f: 'f2' - - - onto2 = object.override onto, what - - onto2.a.should.equal 'a2' - onto2.b.should.have.property 'c' - onto2.b.c.should.equal 'c2' - onto2.b.d.should.not.have.property 'f' - onto2.b.d.e.should.equal 'e' - - onto.should.not.equal onto2 - -do -> - - what = - - a: 'a2' - - c: -> - - z: 'z' - - y: - - a: 'a' - - onto = - - a: 'a' - - b: 'b' - - test 'appendOnto [basic]', -> - - object.appendOnto onto, what - - onto.a.should.equal 'a2' - onto.b.should.equal 'b' - onto.z.should.equal 'z' - - test "appendOnto [shallow copies instances]", -> - - onto.c.should.be.instanceof Function - onto.c.should.equal what.c - - - test "appendOnto [clones objects]", -> - - onto.should.have.property 'y' - onto.y.a.should.equal 'a' - onto.y.should.not.equal what.y - -test 'groupProps', -> - - obj = - - a1: '1' - a2: '2' - - b1: '1' - b2: '2' - - c1: '1' - c2: '2' - - rest1: '1' - rest2: '2' - - groups = object.groupProps obj, - - a: ['a1', 'a2'] - - b: [/^b[0-9]+$/] - - c: (key) -> key[0] is 'c' - - groups.a.should.have.property 'a1' - groups.a.a1.should.equal '1' - - groups.a.should.have.property 'a2' - - groups.b.should.have.property 'b1' - groups.b.should.have.property 'b2' - - groups.c.should.have.property 'c1' - groups.c.should.have.property 'c2' - - groups.rest.should.have.property 'rest1' - groups.rest.should.have.property 'rest1' - - groups.rest.should.not.have.property 'c1'
\ No newline at end of file diff --git a/node_modules/pretty-error/package.json b/node_modules/pretty-error/package.json deleted file mode 100644 index 7905aa900..000000000 --- a/node_modules/pretty-error/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "pretty-error", - "version": "2.1.1", - "description": "See nodejs errors with less clutter", - "main": "./lib/PrettyError.js", - "typings": "index.d.ts", - "scripts": { - "test": "mocha \"test/**/*.coffee\"", - "test:watch": "mocha \"test/**/*.coffee\" --watch", - - "compile": "coffee --bare --compile --output ./lib ./src", - "compile:watch": "jitter src lib -b", - - "watch": "npm run compile:watch & npm run test:watch", - "winwatch": "start/b npm run compile:watch & npm run test:watch", - - "prepublish": "npm run compile" - }, - "dependencies": { - "utila": "~0.4", - "renderkid": "^2.0.1" - }, - "devDependencies": { - "coffee-script": "~1.8.0", - "chai": "~1.9.2", - "mocha": "~2.0.1", - "jitter": "^1.3.0" - }, - "author": "Aria Minaei", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/AriaMinaei/pretty-error.git" - }, - "bugs": { - "url": "https://github.com/AriaMinaei/pretty-error/issues" - }, - "keywords": [ - "pretty", - "error", - "exception", - "debug", - "error-handling", - "readable", - "colorful", - "prettify", - "format", - "human" - ] -} diff --git a/node_modules/pretty-error/src/ParsedError.coffee b/node_modules/pretty-error/src/ParsedError.coffee deleted file mode 100644 index cced61dd5..000000000 --- a/node_modules/pretty-error/src/ParsedError.coffee +++ /dev/null @@ -1,226 +0,0 @@ -sysPath = require 'path' - -module.exports = class ParsedError - constructor: (@error) -> - do @_parse - - _parse: -> - @_trace = [] - @_kind = 'Error' - @_wrapper = '' - - @_wrapper = String @error.wrapper if @error.wrapper? - - unless typeof @error is 'object' - @_message = String @error - else - @_stack = @error.stack - - if @error.kind? - @_kind = String @error.kind - else if typeof @_stack is 'string' - if m = @_stack.match /^([a-zA-Z0-9\_\$]+):\ / - @_kind = m[1] - - if typeof @_stack is 'string' - @_parseStack() - else - @_message = @error.message? and String(@error.message) or '' - - return - - _parseStack: -> - messageLines = [] - reachedTrace = no - - for line in @_stack.split '\n' - continue if line.trim() is '' - if reachedTrace - @_trace.push @_parseTraceItem line - else - if line.match /^\s*at\s.+/ - reachedTrace = yes - @_trace.push @_parseTraceItem line - else - messageLines.push line - - message = messageLines.join '\n' - if message.substr(0, @_kind.length) is @_kind - message = - message - .substr(@_kind.length, message.length) - .replace(/^\:\s+/, '') - - @_message = message - - return - - _parseTraceItem: (text) -> - text = text.trim() - - return if text is '' - return text unless text.match /^at\ / - - # remove the 'at ' part - text = text.replace /^at /, '' - - return if text in ['Error (<anonymous>)', 'Error (<anonymous>:null:null)'] - - original = text - - # the part that comes before the address - what = null - - # address, including path to module and line/col - addr = null - - # path to module - path = null - - # module dir - dir = null - - # module basename - file = null - - # line number (if using a compiler, the line number of the module - # in that compiler will be used) - line = null - - # column, same as above - col = null - - # if using a compiler, this will translate to the line number of - # the js equivalent of that module - jsLine = null - - # like above - jsCol = null - - # path that doesn't include `node_module` dirs - shortenedPath = null - - # like above - shortenedAddr = null - - packageName = '[current]' - - # pick out the address - if m = text.match /\(([^\)]+)\)$/ - addr = m[1].trim() - - if addr? - what = text.substr 0, text.length - addr.length - 2 - what = what.trim() - - # might not have a 'what' clause - unless addr? - addr = text.trim() - - addr = @_fixPath addr - remaining = addr - - # remove the <js> clause if the file is a compiled one - if m = remaining.match /\,\ <js>:(\d+):(\d+)$/ - jsLine = m[1] - jsCol = m[2] - remaining = remaining.substr 0, remaining.length - m[0].length - - # the line/col part - if m = remaining.match /:(\d+):(\d+)$/ - line = m[1] - col = m[2] - remaining = remaining.substr 0, remaining.length - m[0].length - path = remaining - - # file and dir - if path? - file = sysPath.basename path - dir = sysPath.dirname path - - if dir is '.' then dir = '' - - path = @_fixPath path - file = @_fixPath file - dir = @_fixPath dir - - if dir? - d = dir.replace /[\\]{1,2}/g, '/' - if m = d.match /// - node_modules/([^/]+)(?!.*node_modules.*) - /// - - packageName = m[1] - - unless jsLine? - jsLine = line - jsCol = col - - if path? - r = @_rectifyPath path - shortenedPath = r.path - shortenedAddr = shortenedPath + addr.substr(path.length, addr.length) - packages = r.packages - - 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 || [] - - _getMessage: -> @_message - _getKind: -> @_kind - _getWrapper: -> @_wrapper - _getStack: -> @_stack - _getArguments: -> @error.arguments - _getType: -> @error.type - _getTrace: -> @_trace - _fixPath: (path) -> path.replace(///[\\]{1,2}///g, '/') - - _rectifyPath: (path, nameForCurrentPackage) -> - path = String path - remaining = path - - return path: path, packages: [] unless m = path.match /^(.+?)\/node_modules\/(.+)$/ - - parts = [] - packages = [] - - if typeof nameForCurrentPackage is '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 - - path: parts.join "/" - packages: packages - -for prop in ['message', 'kind', 'arguments', 'type', 'stack', 'trace', 'wrapper'] then do -> - methodName = '_get' + prop[0].toUpperCase() + prop.substr(1, prop.length) - - Object.defineProperty ParsedError::, prop, - get: -> this[methodName]()
\ No newline at end of file diff --git a/node_modules/pretty-error/src/PrettyError.coffee b/node_modules/pretty-error/src/PrettyError.coffee deleted file mode 100644 index dc44943af..000000000 --- a/node_modules/pretty-error/src/PrettyError.coffee +++ /dev/null @@ -1,312 +0,0 @@ -{object, array} = require 'utila' -defaultStyle = require './defaultStyle' -ParsedError = require './ParsedError' -nodePaths = require './nodePaths' -RenderKid = require 'renderkid' - -instance = null - -module.exports = class PrettyError - self = @ - - @_filters: - 'module.exports': (item) -> - return unless item.what? - item.what = item.what.replace /\.module\.exports\./g, ' - ' - return - - @_getDefaultStyle: -> - defaultStyle() - - @start: -> - unless instance? - instance = new self - instance.start() - - instance - - @stop: -> - instance?.stop() - - constructor: -> - @_useColors = yes - @_maxItems = 50 - @_packagesToSkip = [] - @_pathsToSkip = [] - @_skipCallbacks = [] - @_filterCallbacks = [] - @_parsedErrorFilters = [] - @_aliases = [] - @_renderer = new RenderKid - @_style = self._getDefaultStyle() - @_renderer.style @_style - - start: -> - @_oldPrepareStackTrace = Error.prepareStackTrace - - prepeare = @_oldPrepareStackTrace or (exc, frames) -> - result = exc.toString() - frames = frames.map (frame) -> " at #{frame.toString()}" - result + "\n" + frames.join "\n" - - # https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - Error.prepareStackTrace = (exc, trace) => - stack = prepeare.apply(null, arguments) - @render {stack, message: exc.toString().replace /^.*: /, ''}, no - - @ - - stop: -> - Error.prepareStackTrace = @_oldPrepareStackTrace - @_oldPrepareStackTrace = null - - config: (c) -> - if c.skipPackages? - if c.skipPackages is no - @unskipAllPackages() - else - @skipPackage.apply @, c.skipPackages - - if c.skipPaths? - if c.skipPaths is no - @unskipAllPaths() - else - @skipPath.apply @, c.skipPaths - - if c.skip? - if c.skip is no - @unskipAll() - else - @skip.apply @, c.skip - - if c.maxItems? - @setMaxItems c.maxItems - - if c.skipNodeFiles is yes - @skipNodeFiles() - else if c.skipNodeFiles is no - @unskipNodeFiles() - - if c.filters? - if c.filters is no - @removeAllFilters() - else - @filter.apply @, c.filters - - if c.parsedErrorFilters? - if c.parsedErrorFilters is no - @removeAllParsedErrorFilters() - else - @filterParsedError.apply @, c.parsedErrorFilters - - if c.aliases? - if object.isBareObject c.aliases - @alias path, alias for path, alias of c.aliases - else if c.aliases is no - @removeAllAliases() - - @ - - withoutColors: -> - @_useColors = false - @ - - withColors: -> - @_useColors = true - @ - - skipPackage: (packages...) -> - @_packagesToSkip.push String pkg for pkg in packages - @ - - unskipPackage: (packages...) -> - array.pluckOneItem(@_packagesToSkip, pkg) for pkg in packages - @ - - unskipAllPackages: -> - @_packagesToSkip.length = 0 - @ - - skipPath: (paths...) -> - @_pathsToSkip.push path for path in paths - @ - - unskipPath: (paths...) -> - array.pluckOneItem(@_pathsToSkip, path) for path in paths - @ - - unskipAllPaths: -> - @_pathsToSkip.length = 0 - @ - - skip: (callbacks...) -> - @_skipCallbacks.push cb for cb in callbacks - @ - - unskip: (callbacks...) -> - array.pluckOneItem(@_skipCallbacks, cb) for cb in callbacks - @ - - unskipAll: -> - @_skipCallbacks.length = 0 - @ - - skipNodeFiles: -> - @skipPath.apply @, nodePaths - - unskipNodeFiles: -> - @unskipPath.apply @, nodePaths - - filter: (callbacks...) -> - @_filterCallbacks.push cb for cb in callbacks - @ - - removeFilter: (callbacks...) -> - array.pluckOneItem(@_filterCallbacks, cb) for cb in callbacks - @ - - removeAllFilters: -> - @_filterCallbacks.length = 0 - @ - - filterParsedError: (callbacks...) -> - @_parsedErrorFilters.push cb for cb in callbacks - @ - - removeParsedErrorFilter: (callbacks...) -> - array.pluckOneItem(@_parsedErrorFilters, cb) for cb in callbacks - @ - - removeAllParsedErrorFilters: -> - @_parsedErrorFilters.length = 0 - @ - - setMaxItems: (maxItems = 50) -> - if maxItems is 0 then maxItems = 50 - @_maxItems = maxItems|0 - @ - - alias: (stringOrRx, alias) -> - @_aliases.push {stringOrRx, alias} - @ - - removeAlias: (stringOrRx) -> - array.pluckByCallback @_aliases, (pair) -> - pair.stringOrRx is stringOrRx - - @ - - removeAllAliases: -> - @_aliases.length = 0 - @ - - _getStyle: -> - @_style - - appendStyle: (toAppend) -> - object.appendOnto @_style, toAppend - @_renderer.style toAppend - @ - - _getRenderer: -> - @_renderer - - render: (e, logIt = no, useColors = @_useColors) -> - obj = @getObject e - rendered = @_renderer.render(obj, useColors) - console.error rendered if logIt is yes - rendered - - getObject: (e) -> - unless e instanceof ParsedError - e = new ParsedError e - - @_applyParsedErrorFiltersOn e - - header = - title: do -> - ret = {} - - # some errors are thrown to display other errors. - # we call them wrappers here. - if e.wrapper isnt '' - ret.wrapper = "#{e.wrapper}" - - ret.kind = e.kind - ret - - colon: ':' - - message: String(e.message).trim() - - traceItems = [] - count = -1 - - for item, i in e.trace - continue unless item? - continue if @_skipOrFilter(item, i) is yes - - count++ - - break if count > @_maxItems - - if typeof item is 'string' - traceItems.push item: custom: item - continue - - traceItems.push do -> - markupItem = item: - header: - pointer: do -> - return '' unless item.file? - - file: item.file - colon: ':' - line: item.line - - footer: do -> - foooter = addr: item.shortenedAddr - if item.extra? then foooter.extra = item.extra - foooter - - markupItem.item.header.what = item.what if typeof item.what is 'string' and item.what.trim().length > 0 - markupItem - - - obj = 'pretty-error': - header: header - - if traceItems.length > 0 - obj['pretty-error'].trace = traceItems - - obj - - _skipOrFilter: (item, itemNumber) -> - if typeof item is 'object' - return yes if item.modName in @_packagesToSkip - return yes if item.path in @_pathsToSkip - - for modName in item.packages - return yes if modName in @_packagesToSkip - - if typeof item.shortenedAddr is 'string' - for pair in @_aliases - item.shortenedAddr = item.shortenedAddr.replace pair.stringOrRx, pair.alias - - for cb in @_skipCallbacks - return yes if cb(item, itemNumber) is yes - - for cb in @_filterCallbacks - cb(item, itemNumber) - - return no - - _applyParsedErrorFiltersOn: (error) -> - for cb in @_parsedErrorFilters - cb error - - return - -for prop in ['renderer', 'style'] then do -> - methodName = '_get' + prop[0].toUpperCase() + prop.substr(1, prop.length) - PrettyError::__defineGetter__ prop, -> do @[methodName] diff --git a/node_modules/pretty-error/src/defaultStyle.coffee b/node_modules/pretty-error/src/defaultStyle.coffee deleted file mode 100644 index 95cd2ac28..000000000 --- a/node_modules/pretty-error/src/defaultStyle.coffee +++ /dev/null @@ -1,59 +0,0 @@ -module.exports = -> - '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' diff --git a/node_modules/pretty-error/src/nodePaths.coffee b/node_modules/pretty-error/src/nodePaths.coffee deleted file mode 100644 index 32ed832ae..000000000 --- a/node_modules/pretty-error/src/nodePaths.coffee +++ /dev/null @@ -1,52 +0,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' -]
\ No newline at end of file diff --git a/node_modules/pretty-error/start.js b/node_modules/pretty-error/start.js deleted file mode 100644 index 92f110998..000000000 --- a/node_modules/pretty-error/start.js +++ /dev/null @@ -1 +0,0 @@ -require('./lib/PrettyError').start()
\ No newline at end of file diff --git a/node_modules/pretty-error/test/ParsedError.coffee b/node_modules/pretty-error/test/ParsedError.coffee deleted file mode 100644 index 516d34e98..000000000 --- a/node_modules/pretty-error/test/ParsedError.coffee +++ /dev/null @@ -1,82 +0,0 @@ -chai = require 'chai' -ParsedError = require '../src/ParsedError' - -chai.should() - -error = (what) -> - if typeof what is 'string' - return error -> throw Error what - - else if what instanceof Function - try - do what - return null - catch e - return e - - else - throw Error "bad argument for error" - -describe "ParsedError", -> - describe "constructor()", -> - it "should accept Error() instances", -> - (-> new ParsedError error -> throw Error "some message").should.not.throw() - - it "should accept ReferenceError() and other derivatives of Error()", -> - (-> new ParsedError error -> throw ReferenceError "some message").should.not.throw() - - it "should accept non errors", -> - (-> e = new ParsedError 'some string').should.not.throw() - - describe "message", -> - it "should return the original error message", -> - e = new ParsedError error 'a' - e.message.should.equal 'a' - - describe "kind", -> - it "should return 'Error' for normal error", -> - e = new ParsedError error 'a' - e.kind.should.equal 'Error' - - it "should recognize 'ReferenceError'", -> - e = new ParsedError error -> a.b = c - e.kind.should.equal 'ReferenceError' - - describe "type", -> - it.skip "should return original error type", -> - e = new ParsedError error -> a.b = c - e.type.should.be.equal 'not_defined' - - describe "arguments", -> - it.skip "should return original error arguments", -> - e = new ParsedError error -> a.b = c - e.arguments.should.be.eql ['a'] - - describe "stack", -> - it "should return original error stack", -> - e = new ParsedError error -> a.b = c - e.stack.should.be.equal e.error.stack - - describe "trace", -> - it "should include correct information about each trace item", -> - e = new ParsedError error -> a.b = c - e.trace.should.have.length.above 2 - - item = e.trace[0] - item.should.include.keys 'original', - 'what', 'path', 'addr', - 'file', 'dir', 'col', - 'line', 'jsCol', 'jsLine' - 'packageName', 'shortenedPath', 'shortenedAddr' - - item.path.should.equal module.filename.replace(/[\\]+/g, '/') - - item.line.should.be.a 'number' - item.col.should.be.a 'number' - - describe "_rectifyPath()", -> - it "should work", -> - ParsedError::_rectifyPath('F:/a/node_modules/b/node_modules/d/node_modules/e/f.js').path.should.equal '[a]/[b]/[d]/[e]/f.js' - - it "should return path when `node_modules` is not present", -> - ParsedError::_rectifyPath('a/b/c').path.should.equal 'a/b/c' diff --git a/node_modules/pretty-error/test/PrettyError.coffee b/node_modules/pretty-error/test/PrettyError.coffee deleted file mode 100644 index 1b7a715b6..000000000 --- a/node_modules/pretty-error/test/PrettyError.coffee +++ /dev/null @@ -1,109 +0,0 @@ -chai = require 'chai' -PrettyError = require '../src/PrettyError' -defaultStyle = require '../src/defaultStyle' - -chai.should() - -isFormatted = (exc) -> - exc.stack.indexOf(' \u001b[0m\u001b[97m\u001b[41m') is 0 - -error = (what) -> - if typeof what is 'string' - return error -> throw Error what - - else if what instanceof Function - try - do what - catch e - return e - - throw Error "bad argument for error" - -describe "PrettyError", -> - describe "constructor()", -> - it "should work", -> - new PrettyError - - describe "getObject", -> - it "should return a string", -> - p = new PrettyError - p.getObject(error "hello").should.be.an 'object' - - describe "style", -> - it "should, by default, return the contents in `default-style`", -> - p = new PrettyError - p.style.should.eql defaultStyle() - - it "should return different contents after appending some styles", -> - p = new PrettyError - p.appendStyle 'some selector': 'display': 'block' - p.style.should.not.eql defaultStyle() - - describe "render()", -> - it "should work", -> - p = new PrettyError - p.skipNodeFiles() - p.appendStyle 'pretty-error': marginLeft: 4 - - e = error -> "a".should.equal "b" - console.log p.render e, no - - e2 = error -> Array.split(Object) - console.log p.render e2, no - - e3 = "Plain error message" - console.log p.render e3, no - - e4 = - message: "Custom error message" - kind: "Custom Error" - - console.log p.render e4, no - - e5 = - message: "Error with custom stack" - stack: ['line one', 'line two'] - wrapper: 'UnhandledRejection' - - console.log p.render e5, no - - e6 = error -> PrettyError.someNonExistingFuncion() - console.log p.render e6, no - - it.skip "should render without colors if pe._useColors is false", -> - p = new PrettyError - p.withoutColors() - p.skipNodeFiles() - p.appendStyle 'pretty-error': marginLeft: 4 - - e = error -> "a".should.equal "b" - console.log p.render e, no - - describe "start()", -> - prepareStackTrace = null - - beforeEach -> - {prepareStackTrace} = Error - Error.prepareStackTrace = null - - afterEach -> - Error.prepareStackTrace = prepareStackTrace - - it "throws unformatted error when not started", -> - try - throw new Error "foo bar" - catch exc - - isFormatted(exc).should.be.eql false - - it "throws formatted the error", -> - PrettyError.start() - - try - throw new Error "foo bar" - catch exc - - isFormatted(exc).should.be.eql true - exc.stack.split(/\n/g).length.should.be.above 2 - - PrettyError.stop() diff --git a/node_modules/pretty-error/test/mocha.opts b/node_modules/pretty-error/test/mocha.opts deleted file mode 100644 index 63fb383cb..000000000 --- a/node_modules/pretty-error/test/mocha.opts +++ /dev/null @@ -1,5 +0,0 @@ ---compilers coffee:coffee-script/register ---recursive ---reporter spec ---ui bdd ---timeout 20000 |