This commit is contained in:
Yamozha
2021-04-02 02:24:13 +03:00
parent c23950b545
commit 7256d79e2c
31493 changed files with 3036630 additions and 0 deletions

21
node_modules/plugin-error/LICENSE generated vendored Normal file
View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015, Jon Schlinkert.
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.

88
node_modules/plugin-error/README.md generated vendored Normal file
View File

@ -0,0 +1,88 @@
# plugin-error [![NPM version](https://badge.fury.io/js/plugin-error.svg)](http://badge.fury.io/js/plugin-error) [![Build Status](https://travis-ci.org/jonschlinkert/plugin-error.svg)](https://travis-ci.org/jonschlinkert/plugin-error)
> Error handling for vinyl plugins. Just an abstraction of what's in gulp-util with minor changes.
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i plugin-error --save
```
## Usage
```js
var PluginError = require('plugin-error');
```
### new PluginError(pluginName, message[, options]);
**Params**
* `pluginName` should be the module name of your plugin
* `message` **{String|Object}**: may be a string or an existing error object
* `options` **{Object}**
**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.
**Examples**
All of the following are acceptable forms of instantiation:
```javascript
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});
```
## Related projects
* [assemble](http://assemble.io): Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… [more](http://assemble.io)
* [gulp-util](https://github.com/wearefractal/gulp-util#readme): Utility functions for gulp plugins
* [gulp](http://gulpjs.com): The streaming build system
* [generate](https://github.com/generate/generate): Project generator, for node.js.
* [verb](https://github.com/assemble/verb): Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API… [more](https://github.com/assemble/verb)
## Running tests
Install dev dependencies:
```sh
$ npm i -d && npm test
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/plugin-error/issues/new)
## Author
**Jon Schlinkert**
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
## License
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
***
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 31, 2015._

185
node_modules/plugin-error/index.js generated vendored Normal file
View File

@ -0,0 +1,185 @@
/*!
* plugin-error <https://github.com/jonschlinkert/plugin-error>
*
* Copyright (c) 2015, Jon Schlinkert.
* Licensed under the MIT License.
*/
var util = require('util');
var red = require('ansi-red');
var cyan = require('ansi-cyan');
var extend = require('extend-shallow');
var differ = require('arr-diff');
var union = require('arr-union');
/**
* Based on gulp-util PluginError (MIT Licensed)
* See: https://github.com/wearefractal/gulp-util
*/
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 = '', 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 = red(thisArg.name);
sig += ' in plugin ';
sig += '"' + 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;

43
node_modules/plugin-error/package.json generated vendored Normal file
View File

@ -0,0 +1,43 @@
{
"name": "plugin-error",
"description": "Error handling for vinyl plugins. Just an abstraction of what's in gulp-util with minor changes.",
"version": "0.1.2",
"homepage": "https://github.com/jonschlinkert/plugin-error",
"author": {
"name": "Jon Schlinkert",
"url": "https://github.com/jonschlinkert"
},
"repository": {
"type": "git",
"url": "git://github.com/jonschlinkert/plugin-error.git"
},
"bugs": {
"url": "https://github.com/jonschlinkert/plugin-error/issues"
},
"license": "MIT",
"files": [
"index.js"
],
"main": "index.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"test": "mocha"
},
"dependencies": {
"ansi-cyan": "^0.1.1",
"ansi-red": "^0.1.1",
"arr-diff": "^1.0.1",
"arr-union": "^2.0.1",
"extend-shallow": "^1.1.2"
},
"devDependencies": {
"mocha": "*",
"should": "*"
},
"keywords": [
"error",
"plugin"
]
}