diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-03-27 21:01:33 +0100 |
commit | cc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch) | |
tree | 92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/gulp-util/lib | |
parent | 3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff) |
remove node_modules
Diffstat (limited to 'node_modules/gulp-util/lib')
-rw-r--r-- | node_modules/gulp-util/lib/PluginError.js | 130 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/buffer.js | 15 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/combine.js | 11 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/env.js | 4 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/isBuffer.js | 7 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/isNull.js | 3 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/isStream.js | 5 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/log.js | 14 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/noop.js | 5 | ||||
-rw-r--r-- | node_modules/gulp-util/lib/template.js | 23 |
10 files changed, 0 insertions, 217 deletions
diff --git a/node_modules/gulp-util/lib/PluginError.js b/node_modules/gulp-util/lib/PluginError.js deleted file mode 100644 index d60159ab1..000000000 --- a/node_modules/gulp-util/lib/PluginError.js +++ /dev/null @@ -1,130 +0,0 @@ -var util = require('util'); -var arrayDiffer = require('array-differ'); -var arrayUniq = require('array-uniq'); -var chalk = require('chalk'); -var objectAssign = require('object-assign'); - -var nonEnumberableProperties = ['name', 'message', 'stack']; -var propertiesNotToDisplay = nonEnumberableProperties.concat(['plugin', 'showStack', 'showProperties', '__safety', '_stack']); - -// wow what a clusterfuck -var parseOptions = function(plugin, message, opt) { - opt = opt || {}; - if (typeof plugin === 'object') { - opt = plugin; - } else { - if (message instanceof Error) { - opt.error = message; - } else if (typeof message === 'object') { - opt = message; - } else { - opt.message = message; - } - opt.plugin = plugin; - } - - return objectAssign({ - showStack: false, - showProperties: true - }, opt); -}; - -function PluginError(plugin, message, opt) { - if (!(this instanceof PluginError)) throw new Error('Call PluginError using new'); - - Error.call(this); - - var options = parseOptions(plugin, message, opt); - var self = this; - - // if options has an error, grab details from it - if (options.error) { - // These properties are not enumerable, so we have to add them explicitly. - arrayUniq(Object.keys(options.error).concat(nonEnumberableProperties)) - .forEach(function(prop) { - self[prop] = options.error[prop]; - }); - } - - var properties = ['name', 'message', 'fileName', 'lineNumber', 'stack', 'showStack', 'showProperties', 'plugin']; - - // options object can override - properties.forEach(function(prop) { - if (prop in options) this[prop] = options[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, then we'll get stack overflow problems. - var 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); - -PluginError.prototype._messageWithDetails = function() { - var messageWithDetails = 'Message:\n ' + this.message; - var details = this._messageDetails(); - - if (details !== '') { - messageWithDetails += '\n' + details; - } - - return messageWithDetails; -}; - -PluginError.prototype._messageDetails = function() { - if (!this.showProperties) { - return ''; - } - - var properties = arrayDiffer(Object.keys(this), propertiesNotToDisplay); - - if (properties.length === 0) { - return ''; - } - - var self = this; - properties = properties.map(function stringifyProperty(prop) { - return ' ' + prop + ': ' + self[prop]; - }); - - return 'Details:\n' + properties.join('\n'); -}; - -PluginError.prototype.toString = function () { - var sig = chalk.red(this.name) + ' in plugin \'' + chalk.cyan(this.plugin) + '\''; - var detailsWithStack = function(stack) { - return this._messageWithDetails() + '\nStack:\n' + stack; - }.bind(this); - - var msg; - if (this.showStack) { - if (this.__safety) { // There is no wrapped error, use the stack captured in the PluginError ctor - msg = this.__safety.stack; - } else if (this._stack) { - msg = detailsWithStack(this._stack); - } else { // Stack from wrapped error - msg = detailsWithStack(this.stack); - } - } else { - msg = this._messageWithDetails(); - } - - return sig + '\n' + msg; -}; - -module.exports = PluginError; diff --git a/node_modules/gulp-util/lib/buffer.js b/node_modules/gulp-util/lib/buffer.js deleted file mode 100644 index 26c940db1..000000000 --- a/node_modules/gulp-util/lib/buffer.js +++ /dev/null @@ -1,15 +0,0 @@ -var through = require('through2'); - -module.exports = function(fn) { - var buf = []; - var end = function(cb) { - this.push(buf); - cb(); - if(fn) fn(null, buf); - }; - var push = function(data, enc, cb) { - buf.push(data); - cb(); - }; - return through.obj(push, end); -}; diff --git a/node_modules/gulp-util/lib/combine.js b/node_modules/gulp-util/lib/combine.js deleted file mode 100644 index f20712d20..000000000 --- a/node_modules/gulp-util/lib/combine.js +++ /dev/null @@ -1,11 +0,0 @@ -var pipeline = require('multipipe'); - -module.exports = function(){ - var args = arguments; - if (args.length === 1 && Array.isArray(args[0])) { - args = args[0]; - } - return function(){ - return pipeline.apply(pipeline, args); - }; -}; diff --git a/node_modules/gulp-util/lib/env.js b/node_modules/gulp-util/lib/env.js deleted file mode 100644 index ee17c0e30..000000000 --- a/node_modules/gulp-util/lib/env.js +++ /dev/null @@ -1,4 +0,0 @@ -var parseArgs = require('minimist'); -var argv = parseArgs(process.argv.slice(2)); - -module.exports = argv; diff --git a/node_modules/gulp-util/lib/isBuffer.js b/node_modules/gulp-util/lib/isBuffer.js deleted file mode 100644 index 7c52f78c9..000000000 --- a/node_modules/gulp-util/lib/isBuffer.js +++ /dev/null @@ -1,7 +0,0 @@ -var buf = require('buffer'); -var Buffer = buf.Buffer; - -// could use Buffer.isBuffer but this is the same exact thing... -module.exports = function(o) { - return typeof o === 'object' && o instanceof Buffer; -}; diff --git a/node_modules/gulp-util/lib/isNull.js b/node_modules/gulp-util/lib/isNull.js deleted file mode 100644 index 7f22c63ae..000000000 --- a/node_modules/gulp-util/lib/isNull.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function(v) { - return v === null; -}; diff --git a/node_modules/gulp-util/lib/isStream.js b/node_modules/gulp-util/lib/isStream.js deleted file mode 100644 index 6b54e123b..000000000 --- a/node_modules/gulp-util/lib/isStream.js +++ /dev/null @@ -1,5 +0,0 @@ -var Stream = require('stream').Stream; - -module.exports = function(o) { - return !!o && o instanceof Stream; -}; diff --git a/node_modules/gulp-util/lib/log.js b/node_modules/gulp-util/lib/log.js deleted file mode 100644 index bb843beef..000000000 --- a/node_modules/gulp-util/lib/log.js +++ /dev/null @@ -1,14 +0,0 @@ -var hasGulplog = require('has-gulplog'); - -module.exports = function(){ - if(hasGulplog()){ - // specifically deferring loading here to keep from registering it globally - var gulplog = require('gulplog'); - gulplog.info.apply(gulplog, arguments); - } else { - // specifically defering loading because it might not be used - var fancylog = require('fancy-log'); - fancylog.apply(null, arguments); - } - return this; -}; diff --git a/node_modules/gulp-util/lib/noop.js b/node_modules/gulp-util/lib/noop.js deleted file mode 100644 index 7862cb161..000000000 --- a/node_modules/gulp-util/lib/noop.js +++ /dev/null @@ -1,5 +0,0 @@ -var through = require('through2'); - -module.exports = function () { - return through.obj(); -}; diff --git a/node_modules/gulp-util/lib/template.js b/node_modules/gulp-util/lib/template.js deleted file mode 100644 index eef3bb376..000000000 --- a/node_modules/gulp-util/lib/template.js +++ /dev/null @@ -1,23 +0,0 @@ -var template = require('lodash.template'); -var reEscape = require('lodash._reescape'); -var reEvaluate = require('lodash._reevaluate'); -var reInterpolate = require('lodash._reinterpolate'); - -var forcedSettings = { - escape: reEscape, - evaluate: reEvaluate, - interpolate: reInterpolate -}; - -module.exports = function(tmpl, data) { - var fn = template(tmpl, forcedSettings); - - var wrapped = function(o) { - if (typeof o === 'undefined' || typeof o.file === 'undefined') { - throw new Error('Failed to provide the current file as "file" to the template'); - } - return fn(o); - }; - - return (data ? wrapped(data) : wrapped); -}; |