forked from public/fvtt-cthulhu-eternal
Initial import with skill sheet working
This commit is contained in:
21
node_modules/plugin-error/LICENSE
generated
vendored
Normal file
21
node_modules/plugin-error/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Blaine Bublitz <blaine.bublitz@gmail.com>, Eric Schoffstall <yo@contra.io> and other contributors
|
||||
|
||||
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.
|
69
node_modules/plugin-error/README.md
generated
vendored
Normal file
69
node_modules/plugin-error/README.md
generated
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
<p align="center">
|
||||
<a href="http://gulpjs.com">
|
||||
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# plugin-error
|
||||
|
||||
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
|
||||
|
||||
Error handling for Vinyl plugins.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var PluginError = require('plugin-error');
|
||||
|
||||
var err = new PluginError('test', {
|
||||
message: 'something broke'
|
||||
});
|
||||
|
||||
var err = new PluginError({
|
||||
plugin: 'test',
|
||||
message: 'something broke'
|
||||
});
|
||||
|
||||
var err = new PluginError('test', 'something broke');
|
||||
|
||||
var err = new PluginError('test', 'something broke', { showStack: true });
|
||||
|
||||
var existingError = new Error('OMG');
|
||||
var err = new PluginError('test', existingError, { showStack: true });
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `new PluginError(pluginName, message[, options])`
|
||||
|
||||
Error constructor that takes:
|
||||
* `pluginName` - a `String` that should be the module name of your plugin
|
||||
* `message` - a `String` message or an existing `Error` object
|
||||
* `options` - an `Object` of your options
|
||||
|
||||
**Behavior:**
|
||||
|
||||
* By default the stack will not be shown. Set `options.showStack` to true if you think the stack is important for your error.
|
||||
* If you pass an error object as the message the stack will be pulled from that, otherwise one will be created.
|
||||
* If you pass in a custom stack string you need to include the message along with that.
|
||||
* Error properties will be included in `err.toString()`, but may be omitted by including `{ showProperties: false }` in the options.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
|
||||
[downloads-image]: http://img.shields.io/npm/dm/plugin-error.svg
|
||||
[npm-url]: https://www.npmjs.com/package/plugin-error
|
||||
[npm-image]: http://img.shields.io/npm/v/plugin-error.svg
|
||||
|
||||
[travis-url]: https://travis-ci.org/gulpjs/plugin-error
|
||||
[travis-image]: http://img.shields.io/travis/gulpjs/plugin-error.svg?label=travis-ci
|
||||
|
||||
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/plugin-error
|
||||
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/plugin-error.svg?label=appveyor
|
||||
|
||||
[coveralls-url]: https://coveralls.io/r/gulpjs/plugin-error
|
||||
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/plugin-error/master.svg
|
||||
|
||||
[gitter-url]: https://gitter.im/gulpjs/gulp
|
||||
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
|
114
node_modules/plugin-error/index.d.ts
generated
vendored
Normal file
114
node_modules/plugin-error/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
declare namespace PluginError {
|
||||
interface Constructor {
|
||||
/**
|
||||
* @param plugin Plugin name
|
||||
* @param error Base error
|
||||
* @param options Error options
|
||||
*/
|
||||
new <E extends Error>(plugin: string, error: E, options?: Options): PluginError<E>;
|
||||
|
||||
/**
|
||||
* @param plugin Plugin name
|
||||
* @param error Base error or error message
|
||||
* @param options Error options
|
||||
*/
|
||||
new <E extends Error = Error>(plugin: string, error: E | string, options: Options): PluginError<E | {[K in keyof E]: undefined}>;
|
||||
|
||||
/**
|
||||
* @param plugin Plugin name
|
||||
* @param error Base error, error message, or options with message
|
||||
*/
|
||||
new <E extends Error = Error>(plugin: string, error: E | string | (Options & {message: string})): PluginError<E | {[K in keyof E]: undefined}>;
|
||||
|
||||
/**
|
||||
* @param options Options with plugin name and message
|
||||
*/
|
||||
new(options: Options & {plugin: string, message: string}): PluginError;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
/**
|
||||
* Error name
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* Error message
|
||||
*/
|
||||
message?: any;
|
||||
|
||||
/**
|
||||
* File name where the error occurred
|
||||
*/
|
||||
fileName?: string;
|
||||
|
||||
|
||||
/**
|
||||
* Line number where the error occurred
|
||||
*/
|
||||
lineNumber?: number;
|
||||
|
||||
/**
|
||||
* Error properties will be included in err.toString(). Can be omitted by
|
||||
* setting this to false.
|
||||
*
|
||||
* Default: `true`
|
||||
*/
|
||||
showProperties?: boolean;
|
||||
|
||||
/**
|
||||
* By default the stack will not be shown. Set this to true if you think the
|
||||
* stack is important for your error.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
showStack?: boolean;
|
||||
|
||||
/**
|
||||
* Error stack to use for `err.toString()` if `showStack` is `true`.
|
||||
* By default it uses the `stack` of the original error if you used one, otherwise it captures a new stack.
|
||||
*/
|
||||
stack?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The `SimplePluginError` interface defines the properties available on all the the instances of `PluginError`.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
interface SimplePluginError extends Error {
|
||||
/**
|
||||
* Plugin name
|
||||
*/
|
||||
plugin: string;
|
||||
|
||||
/**
|
||||
* Boolean controlling if the stack will be shown in `err.toString()`.
|
||||
*/
|
||||
showStack: boolean;
|
||||
|
||||
/**
|
||||
* Boolean controlling if properties will be shown in `err.toString()`.
|
||||
*/
|
||||
showProperties: boolean;
|
||||
|
||||
/**
|
||||
* File name where the error occurred
|
||||
*/
|
||||
fileName?: string;
|
||||
|
||||
/**
|
||||
* Line number where the error occurred
|
||||
*/
|
||||
lineNumber?: number;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Abstraction for error handling for Vinyl plugins
|
||||
*/
|
||||
type PluginError<T = {}> = PluginError.SimplePluginError & T;
|
||||
|
||||
declare const PluginError: PluginError.Constructor;
|
||||
|
||||
export = PluginError;
|
190
node_modules/plugin-error/index.js
generated
vendored
Normal file
190
node_modules/plugin-error/index.js
generated
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
var util = require('util');
|
||||
var colors = require('ansi-colors');
|
||||
var extend = require('extend-shallow');
|
||||
var differ = require('arr-diff');
|
||||
var union = require('arr-union');
|
||||
|
||||
var nonEnum = ['message', 'name', 'stack'];
|
||||
var ignored = union(nonEnum, ['__safety', '_stack', 'plugin', 'showProperties', 'showStack']);
|
||||
var props = ['fileName', 'lineNumber', 'message', 'name', 'plugin', 'showProperties', 'showStack', 'stack'];
|
||||
|
||||
function PluginError(plugin, message, options) {
|
||||
if (!(this instanceof PluginError)) {
|
||||
throw new Error('Call PluginError using new');
|
||||
}
|
||||
|
||||
Error.call(this);
|
||||
var opts = setDefaults(plugin, message, options);
|
||||
var self = this;
|
||||
|
||||
// If opts has an error, get details from it
|
||||
if (typeof opts.error === 'object') {
|
||||
var keys = union(Object.keys(opts.error), nonEnum);
|
||||
|
||||
// These properties are not enumerable, so we have to add them explicitly.
|
||||
keys.forEach(function(prop) {
|
||||
self[prop] = opts.error[prop];
|
||||
});
|
||||
}
|
||||
|
||||
// Opts object can override
|
||||
props.forEach(function(prop) {
|
||||
if (prop in opts) {
|
||||
this[prop] = opts[prop];
|
||||
}
|
||||
}, this);
|
||||
|
||||
// Defaults
|
||||
if (!this.name) {
|
||||
this.name = 'Error';
|
||||
}
|
||||
if (!this.stack) {
|
||||
|
||||
/**
|
||||
* `Error.captureStackTrace` appends a stack property which
|
||||
* relies on the toString method of the object it is applied to.
|
||||
*
|
||||
* Since we are using our own toString method which controls when
|
||||
* to display the stack trace, if we don't go through this safety
|
||||
* object we'll get stack overflow problems.
|
||||
*/
|
||||
|
||||
var safety = {};
|
||||
safety.toString = function() {
|
||||
return this._messageWithDetails() + '\nStack:';
|
||||
}.bind(this);
|
||||
|
||||
Error.captureStackTrace(safety, arguments.callee || this.constructor);
|
||||
this.__safety = safety;
|
||||
}
|
||||
if (!this.plugin) {
|
||||
throw new Error('Missing plugin name');
|
||||
}
|
||||
if (!this.message) {
|
||||
throw new Error('Missing error message');
|
||||
}
|
||||
}
|
||||
|
||||
util.inherits(PluginError, Error);
|
||||
|
||||
/**
|
||||
* Output a formatted message with details
|
||||
*/
|
||||
|
||||
PluginError.prototype._messageWithDetails = function() {
|
||||
var msg = 'Message:\n ' + this.message;
|
||||
var details = this._messageDetails();
|
||||
if (details !== '') {
|
||||
msg += '\n' + details;
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Output actual message details
|
||||
*/
|
||||
|
||||
PluginError.prototype._messageDetails = function() {
|
||||
if (!this.showProperties) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var props = differ(Object.keys(this), ignored);
|
||||
var len = props.length;
|
||||
|
||||
if (len === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var res = '';
|
||||
var i = 0;
|
||||
while (len--) {
|
||||
var prop = props[i++];
|
||||
res += ' ';
|
||||
res += prop + ': ' + this[prop];
|
||||
res += '\n';
|
||||
}
|
||||
return 'Details:\n' + res;
|
||||
};
|
||||
|
||||
/**
|
||||
* Override the `toString` method
|
||||
*/
|
||||
|
||||
PluginError.prototype.toString = function() {
|
||||
var detailsWithStack = function(stack) {
|
||||
return this._messageWithDetails() + '\nStack:\n' + stack;
|
||||
}.bind(this);
|
||||
|
||||
var msg = '';
|
||||
if (this.showStack) {
|
||||
// If there is no wrapped error, use the stack captured in the PluginError ctor
|
||||
if (this.__safety) {
|
||||
msg = this.__safety.stack;
|
||||
|
||||
} else if (this._stack) {
|
||||
msg = detailsWithStack(this._stack);
|
||||
|
||||
} else {
|
||||
// Stack from wrapped error
|
||||
msg = detailsWithStack(this.stack);
|
||||
}
|
||||
return message(msg, this);
|
||||
}
|
||||
|
||||
msg = this._messageWithDetails();
|
||||
return message(msg, this);
|
||||
};
|
||||
|
||||
// Format the output message
|
||||
function message(msg, thisArg) {
|
||||
var sig = colors.red(thisArg.name);
|
||||
sig += ' in plugin ';
|
||||
sig += '"' + colors.cyan(thisArg.plugin) + '"';
|
||||
sig += '\n';
|
||||
sig += msg;
|
||||
return sig;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default options based on arguments.
|
||||
*/
|
||||
|
||||
function setDefaults(plugin, message, opts) {
|
||||
if (typeof plugin === 'object') {
|
||||
return defaults(plugin);
|
||||
}
|
||||
opts = opts || {};
|
||||
if (message instanceof Error) {
|
||||
opts.error = message;
|
||||
} else if (typeof message === 'object') {
|
||||
opts = message;
|
||||
} else {
|
||||
opts.message = message;
|
||||
}
|
||||
opts.plugin = plugin;
|
||||
return defaults(opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend default options with:
|
||||
*
|
||||
* - `showStack`: default=false
|
||||
* - `showProperties`: default=true
|
||||
*
|
||||
* @param {Object} `opts` Options to extend
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
function defaults(opts) {
|
||||
return extend({
|
||||
showStack: false,
|
||||
showProperties: true,
|
||||
}, opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Expose `PluginError`
|
||||
*/
|
||||
|
||||
module.exports = PluginError;
|
51
node_modules/plugin-error/package.json
generated
vendored
Normal file
51
node_modules/plugin-error/package.json
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"name": "plugin-error",
|
||||
"version": "1.0.1",
|
||||
"description": "Error handling for Vinyl plugins.",
|
||||
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)",
|
||||
"contributors": [
|
||||
"Jon Schlinkert <jon.schlinkert@sellside.com>",
|
||||
"Blaine Bublitz <blaine.bublitz@gmail.com>"
|
||||
],
|
||||
"repository": "gulpjs/plugin-error",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"index.d.ts",
|
||||
"index.js"
|
||||
],
|
||||
"scripts": {
|
||||
"lint": "eslint . && jscs index.js test/",
|
||||
"pretest": "npm run lint",
|
||||
"test": "mocha --async-only && npm run test-types",
|
||||
"test-types": "tsc -p test/types",
|
||||
"cover": "istanbul cover _mocha --report lcovonly",
|
||||
"coveralls": "npm run cover && istanbul-coveralls"
|
||||
},
|
||||
"dependencies": {
|
||||
"ansi-colors": "^1.0.1",
|
||||
"arr-diff": "^4.0.0",
|
||||
"arr-union": "^3.1.0",
|
||||
"extend-shallow": "^3.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^1.7.3",
|
||||
"eslint-config-gulp": "^2.0.0",
|
||||
"expect": "^1.20.2",
|
||||
"istanbul": "^0.4.3",
|
||||
"istanbul-coveralls": "^1.0.3",
|
||||
"jscs": "^2.3.5",
|
||||
"jscs-preset-gulp": "^1.0.0",
|
||||
"mocha": "^3.0.0",
|
||||
"typescript": "^2.6.2"
|
||||
},
|
||||
"keywords": [
|
||||
"error",
|
||||
"plugin",
|
||||
"gulp-util"
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user