diff options
Diffstat (limited to 'node_modules/vinyl')
-rw-r--r-- | node_modules/vinyl/index.js | 2 | ||||
-rw-r--r-- | node_modules/vinyl/lib/inspect-stream.js | 6 | ||||
-rw-r--r-- | node_modules/vinyl/lib/is-stream.js | 15 | ||||
-rw-r--r-- | node_modules/vinyl/node_modules/clone/.npmignore | 4 | ||||
-rw-r--r-- | node_modules/vinyl/node_modules/clone/LICENSE | 18 | ||||
-rw-r--r-- | node_modules/vinyl/node_modules/clone/README.md | 178 | ||||
-rw-r--r-- | node_modules/vinyl/node_modules/clone/clone.iml | 10 | ||||
-rw-r--r-- | node_modules/vinyl/node_modules/clone/clone.js | 251 | ||||
-rw-r--r-- | node_modules/vinyl/node_modules/clone/package.json | 56 | ||||
-rw-r--r-- | node_modules/vinyl/package.json | 5 |
10 files changed, 535 insertions, 10 deletions
diff --git a/node_modules/vinyl/index.js b/node_modules/vinyl/index.js index db5dc2a64..beaba3b32 100644 --- a/node_modules/vinyl/index.js +++ b/node_modules/vinyl/index.js @@ -4,13 +4,13 @@ var path = require('path'); var isBuffer = require('buffer').Buffer.isBuffer; var clone = require('clone'); -var isStream = require('is-stream'); var cloneable = require('cloneable-readable'); var replaceExt = require('replace-ext'); var cloneStats = require('clone-stats'); var cloneBuffer = require('clone-buffer'); var removeTrailingSep = require('remove-trailing-separator'); +var isStream = require('./lib/is-stream'); var normalize = require('./lib/normalize'); var inspectStream = require('./lib/inspect-stream'); diff --git a/node_modules/vinyl/lib/inspect-stream.js b/node_modules/vinyl/lib/inspect-stream.js index 314009d1e..9faaa0a40 100644 --- a/node_modules/vinyl/lib/inspect-stream.js +++ b/node_modules/vinyl/lib/inspect-stream.js @@ -1,12 +1,6 @@ 'use strict'; -var isStream = require('is-stream'); - function inspectStream(stream) { - if (!isStream(stream)) { - return; - } - var streamType = stream.constructor.name; // Avoid StreamStream if (streamType === 'Stream') { diff --git a/node_modules/vinyl/lib/is-stream.js b/node_modules/vinyl/lib/is-stream.js new file mode 100644 index 000000000..04882b497 --- /dev/null +++ b/node_modules/vinyl/lib/is-stream.js @@ -0,0 +1,15 @@ +'use strict'; + +function isStream(stream) { + if (!stream) { + return false; + } + + if (typeof stream.pipe !== 'function') { + return false; + } + + return true; +} + +module.exports = isStream; diff --git a/node_modules/vinyl/node_modules/clone/.npmignore b/node_modules/vinyl/node_modules/clone/.npmignore new file mode 100644 index 000000000..2ff84f0ae --- /dev/null +++ b/node_modules/vinyl/node_modules/clone/.npmignore @@ -0,0 +1,4 @@ +/node_modules/ +/test.js +/.travis.yml +*.html diff --git a/node_modules/vinyl/node_modules/clone/LICENSE b/node_modules/vinyl/node_modules/clone/LICENSE new file mode 100644 index 000000000..cc3c87bc3 --- /dev/null +++ b/node_modules/vinyl/node_modules/clone/LICENSE @@ -0,0 +1,18 @@ +Copyright © 2011-2015 Paul Vorbach <paul@vorba.ch> + +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, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/vinyl/node_modules/clone/README.md b/node_modules/vinyl/node_modules/clone/README.md new file mode 100644 index 000000000..c21ba167d --- /dev/null +++ b/node_modules/vinyl/node_modules/clone/README.md @@ -0,0 +1,178 @@ +# clone + +[](http://travis-ci.org/pvorb/clone) [](http://npm-stat.com/charts.html?package=clone) + +offers foolproof _deep cloning_ of objects, arrays, numbers, strings, maps, +sets, promises, etc. in JavaScript. + + +## Installation + + npm install clone + +(It also works with browserify, ender or standalone. You may want to use the +option `noParse` in browserify to reduce the resulting file size, since usually +`Buffer`s are not needed in browsers.) + + +## Example + +~~~ javascript +var clone = require('clone'); + +var a, b; + +a = { foo: { bar: 'baz' } }; // initial value of a + +b = clone(a); // clone a -> b +a.foo.bar = 'foo'; // change a + +console.log(a); // show a +console.log(b); // show b +~~~ + +This will print: + +~~~ javascript +{ foo: { bar: 'foo' } } +{ foo: { bar: 'baz' } } +~~~ + +**clone** masters cloning simple objects (even with custom prototype), arrays, +Date objects, and RegExp objects. Everything is cloned recursively, so that you +can clone dates in arrays in objects, for example. + + +## API + +`clone(val, circular, depth)` + + * `val` -- the value that you want to clone, any type allowed + * `circular` -- boolean + + Call `clone` with `circular` set to `false` if you are certain that `obj` + contains no circular references. This will give better performance if + needed. There is no error if `undefined` or `null` is passed as `obj`. + * `depth` -- depth to which the object is to be cloned (optional, + defaults to infinity) + * `prototype` -- sets the prototype to be used when cloning an object. + (optional, defaults to parent prototype). + * `includeNonEnumerable` -- set to `true` if the non-enumerable properties + should be cloned as well. Non-enumerable properties on the prototype chain + will be ignored. (optional, defaults to `false`) + +`clone.clonePrototype(obj)` + + * `obj` -- the object that you want to clone + +Does a prototype clone as +[described by Oran Looney](http://oranlooney.com/functional-javascript/). + + +## Circular References + +~~~ javascript +var a, b; + +a = { hello: 'world' }; + +a.myself = a; +b = clone(a); + +console.log(b); +~~~ + +This will print: + +~~~ javascript +{ hello: "world", myself: [Circular] } +~~~ + +So, `b.myself` points to `b`, not `a`. Neat! + + +## Test + + npm test + + +## Changelog + +### v2.1.1 + +#### 2017-03-09 + + - Fix build badge in README + - Add support for cloning Maps and Sets on Internet Explorer + +### v2.1.0 + +#### 2016-11-22 + + - Add support for cloning Errors + - Exclude non-enumerable symbol-named object properties from cloning + - Add option to include non-enumerable own properties of objects + +### v2.0.0 + +#### 2016-09-28 + + - Add support for cloning ES6 Maps, Sets, Promises, and Symbols + +### v1.0.2 + +#### 2015-03-25 + + - Fix call on getRegExpFlags + - Refactor utilities + - Refactor test suite + +### v1.0.1 + +#### 2015-03-04 + + - Fix nodeunit version + - Directly call getRegExpFlags + +### v1.0.0 + +#### 2015-02-10 + + - Improve browser support + - Improve browser testability + - Move helper methods to private namespace + +## Caveat + +Some special objects like a socket or `process.stdout`/`stderr` are known to not +be cloneable. If you find other objects that cannot be cloned, please [open an +issue](https://github.com/pvorb/clone/issues/new). + + +## Bugs and Issues + +If you encounter any bugs or issues, feel free to [open an issue at +github](https://github.com/pvorb/clone/issues) or send me an email to +<paul@vorba.ch>. I also always like to hear from you, if you’re using my code. + +## License + +Copyright © 2011-2016 [Paul Vorbach](https://paul.vorba.ch/) and +[contributors](https://github.com/pvorb/clone/graphs/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, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/vinyl/node_modules/clone/clone.iml b/node_modules/vinyl/node_modules/clone/clone.iml new file mode 100644 index 000000000..30de8aee9 --- /dev/null +++ b/node_modules/vinyl/node_modules/clone/clone.iml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="WEB_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$" /> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="library" name="clone node_modules" level="project" /> + </component> +</module>
\ No newline at end of file diff --git a/node_modules/vinyl/node_modules/clone/clone.js b/node_modules/vinyl/node_modules/clone/clone.js new file mode 100644 index 000000000..80d0c765f --- /dev/null +++ b/node_modules/vinyl/node_modules/clone/clone.js @@ -0,0 +1,251 @@ +var clone = (function() { +'use strict'; + +function _instanceof(obj, type) { + return type != null && obj instanceof type; +} + +var nativeMap; +try { + nativeMap = Map; +} catch(_) { + // maybe a reference error because no `Map`. Give it a dummy value that no + // value will ever be an instanceof. + nativeMap = function() {}; +} + +var nativeSet; +try { + nativeSet = Set; +} catch(_) { + nativeSet = function() {}; +} + +var nativePromise; +try { + nativePromise = Promise; +} catch(_) { + nativePromise = function() {}; +} + +/** + * Clones (copies) an Object using deep copying. + * + * This function supports circular references by default, but if you are certain + * there are no circular references in your object, you can save some CPU time + * by calling clone(obj, false). + * + * Caution: if `circular` is false and `parent` contains circular references, + * your program may enter an infinite loop and crash. + * + * @param `parent` - the object to be cloned + * @param `circular` - set to true if the object to be cloned may contain + * circular references. (optional - true by default) + * @param `depth` - set to a number if the object is only to be cloned to + * a particular depth. (optional - defaults to Infinity) + * @param `prototype` - sets the prototype to be used when cloning an object. + * (optional - defaults to parent prototype). + * @param `includeNonEnumerable` - set to true if the non-enumerable properties + * should be cloned as well. Non-enumerable properties on the prototype + * chain will be ignored. (optional - false by default) +*/ +function clone(parent, circular, depth, prototype, includeNonEnumerable) { + if (typeof circular === 'object') { + depth = circular.depth; + prototype = circular.prototype; + includeNonEnumerable = circular.includeNonEnumerable; + circular = circular.circular; + } + // maintain two arrays for circular references, where corresponding parents + // and children have the same index + var allParents = []; + var allChildren = []; + + var useBuffer = typeof Buffer != 'undefined'; + + if (typeof circular == 'undefined') + circular = true; + + if (typeof depth == 'undefined') + depth = Infinity; + + // recurse this function so we don't reset allParents and allChildren + function _clone(parent, depth) { + // cloning null always returns null + if (parent === null) + return null; + + if (depth === 0) + return parent; + + var child; + var proto; + if (typeof parent != 'object') { + return parent; + } + + if (_instanceof(parent, nativeMap)) { + child = new nativeMap(); + } else if (_instanceof(parent, nativeSet)) { + child = new nativeSet(); + } else if (_instanceof(parent, nativePromise)) { + child = new nativePromise(function (resolve, reject) { + parent.then(function(value) { + resolve(_clone(value, depth - 1)); + }, function(err) { + reject(_clone(err, depth - 1)); + }); + }); + } else if (clone.__isArray(parent)) { + child = []; + } else if (clone.__isRegExp(parent)) { + child = new RegExp(parent.source, __getRegExpFlags(parent)); + if (parent.lastIndex) child.lastIndex = parent.lastIndex; + } else if (clone.__isDate(parent)) { + child = new Date(parent.getTime()); + } else if (useBuffer && Buffer.isBuffer(parent)) { + child = new Buffer(parent.length); + parent.copy(child); + return child; + } else if (_instanceof(parent, Error)) { + child = Object.create(parent); + } else { + if (typeof prototype == 'undefined') { + proto = Object.getPrototypeOf(parent); + child = Object.create(proto); + } + else { + child = Object.create(prototype); + proto = prototype; + } + } + + if (circular) { + var index = allParents.indexOf(parent); + + if (index != -1) { + return allChildren[index]; + } + allParents.push(parent); + allChildren.push(child); + } + + if (_instanceof(parent, nativeMap)) { + parent.forEach(function(value, key) { + var keyChild = _clone(key, depth - 1); + var valueChild = _clone(value, depth - 1); + child.set(keyChild, valueChild); + }); + } + if (_instanceof(parent, nativeSet)) { + parent.forEach(function(value) { + var entryChild = _clone(value, depth - 1); + child.add(entryChild); + }); + } + + for (var i in parent) { + var attrs; + if (proto) { + attrs = Object.getOwnPropertyDescriptor(proto, i); + } + + if (attrs && attrs.set == null) { + continue; + } + child[i] = _clone(parent[i], depth - 1); + } + + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(parent); + for (var i = 0; i < symbols.length; i++) { + // Don't need to worry about cloning a symbol because it is a primitive, + // like a number or string. + var symbol = symbols[i]; + var descriptor = Object.getOwnPropertyDescriptor(parent, symbol); + if (descriptor && !descriptor.enumerable && !includeNonEnumerable) { + continue; + } + child[symbol] = _clone(parent[symbol], depth - 1); + if (!descriptor.enumerable) { + Object.defineProperty(child, symbol, { + enumerable: false + }); + } + } + } + + if (includeNonEnumerable) { + var allPropertyNames = Object.getOwnPropertyNames(parent); + for (var i = 0; i < allPropertyNames.length; i++) { + var propertyName = allPropertyNames[i]; + var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName); + if (descriptor && descriptor.enumerable) { + continue; + } + child[propertyName] = _clone(parent[propertyName], depth - 1); + Object.defineProperty(child, propertyName, { + enumerable: false + }); + } + } + + return child; + } + + return _clone(parent, depth); +} + +/** + * Simple flat clone using prototype, accepts only objects, usefull for property + * override on FLAT configuration object (no nested props). + * + * USE WITH CAUTION! This may not behave as you wish if you do not know how this + * works. + */ +clone.clonePrototype = function clonePrototype(parent) { + if (parent === null) + return null; + + var c = function () {}; + c.prototype = parent; + return new c(); +}; + +// private utility functions + +function __objToStr(o) { + return Object.prototype.toString.call(o); +} +clone.__objToStr = __objToStr; + +function __isDate(o) { + return typeof o === 'object' && __objToStr(o) === '[object Date]'; +} +clone.__isDate = __isDate; + +function __isArray(o) { + return typeof o === 'object' && __objToStr(o) === '[object Array]'; +} +clone.__isArray = __isArray; + +function __isRegExp(o) { + return typeof o === 'object' && __objToStr(o) === '[object RegExp]'; +} +clone.__isRegExp = __isRegExp; + +function __getRegExpFlags(re) { + var flags = ''; + if (re.global) flags += 'g'; + if (re.ignoreCase) flags += 'i'; + if (re.multiline) flags += 'm'; + return flags; +} +clone.__getRegExpFlags = __getRegExpFlags; + +return clone; +})(); + +if (typeof module === 'object' && module.exports) { + module.exports = clone; +} diff --git a/node_modules/vinyl/node_modules/clone/package.json b/node_modules/vinyl/node_modules/clone/package.json new file mode 100644 index 000000000..ce8d7e384 --- /dev/null +++ b/node_modules/vinyl/node_modules/clone/package.json @@ -0,0 +1,56 @@ +{ + "name": "clone", + "description": "deep cloning of objects and arrays", + "tags": [ + "clone", + "object", + "array", + "function", + "date" + ], + "version": "2.1.1", + "repository": { + "type": "git", + "url": "git://github.com/pvorb/node-clone.git" + }, + "bugs": { + "url": "https://github.com/pvorb/node-clone/issues" + }, + "main": "clone.js", + "author": "Paul Vorbach <paul@vorba.ch> (http://paul.vorba.ch/)", + "contributors": [ + "Blake Miner <miner.blake@gmail.com> (http://www.blakeminer.com/)", + "Tian You <axqd001@gmail.com> (http://blog.axqd.net/)", + "George Stagas <gstagas@gmail.com> (http://stagas.com/)", + "Tobiasz Cudnik <tobiasz.cudnik@gmail.com> (https://github.com/TobiaszCudnik)", + "Pavel Lang <langpavel@phpskelet.org> (https://github.com/langpavel)", + "Dan MacTough (http://yabfog.com/)", + "w1nk (https://github.com/w1nk)", + "Hugh Kennedy (http://twitter.com/hughskennedy)", + "Dustin Diaz (http://dustindiaz.com)", + "Ilya Shaisultanov (https://github.com/diversario)", + "Nathan MacInnes <nathan@macinn.es> (http://macinn.es/)", + "Benjamin E. Coe <ben@npmjs.com> (https://twitter.com/benjamincoe)", + "Nathan Zadoks (https://github.com/nathan7)", + "Róbert Oroszi <robert+gh@oroszi.net> (https://github.com/oroce)", + "Aurélio A. Heckert (http://softwarelivre.org/aurium)", + "Guy Ellis (http://www.guyellisrocks.com/)", + "fscherwi (https://fscherwi.github.io)", + "rictic (https://github.com/rictic)", + "Martin Jurča (https://github.com/jurca)", + "Misery Lee <miserylee@foxmail.com> (https://github.com/miserylee)", + "Clemens Wolff (https://github.com/c-w)" + ], + "license": "MIT", + "engines": { + "node": ">=0.8" + }, + "dependencies": {}, + "devDependencies": { + "nodeunit": "~0.9.0" + }, + "optionalDependencies": {}, + "scripts": { + "test": "nodeunit test.js" + } +} diff --git a/node_modules/vinyl/package.json b/node_modules/vinyl/package.json index dc94e7685..cd6f72e40 100644 --- a/node_modules/vinyl/package.json +++ b/node_modules/vinyl/package.json @@ -1,6 +1,6 @@ { "name": "vinyl", - "version": "2.0.2", + "version": "2.1.0", "description": "Virtual file format.", "author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)", "contributors": [ @@ -26,11 +26,10 @@ "coveralls": "npm run cover && istanbul-coveralls" }, "dependencies": { - "clone": "^1.0.0", + "clone": "^2.1.1", "clone-buffer": "^1.0.0", "clone-stats": "^1.0.0", "cloneable-readable": "^1.0.0", - "is-stream": "^1.1.0", "remove-trailing-separator": "^1.0.1", "replace-ext": "^1.0.0" }, |