diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
commit | abd94a7f5a50f43c797a11b53549ae48fff667c3 (patch) | |
tree | ab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/gulp-sourcemaps | |
parent | a0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff) | |
download | wallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz |
add node_modules to address #4364
Diffstat (limited to 'node_modules/gulp-sourcemaps')
14 files changed, 1516 insertions, 0 deletions
diff --git a/node_modules/gulp-sourcemaps/LICENSE.md b/node_modules/gulp-sourcemaps/LICENSE.md new file mode 100644 index 000000000..cbe833577 --- /dev/null +++ b/node_modules/gulp-sourcemaps/LICENSE.md @@ -0,0 +1,13 @@ +Copyright (c) 2014, Florian Reiterer + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/gulp-sourcemaps/README.md b/node_modules/gulp-sourcemaps/README.md new file mode 100644 index 000000000..8fb2fd0b9 --- /dev/null +++ b/node_modules/gulp-sourcemaps/README.md @@ -0,0 +1,252 @@ +## gulp-sourcemaps [![NPM version][npm-image]][npm-url] [![build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] + +### Usage + +#### Write inline source maps +Inline source maps are embedded in the source file. + +Example: +```javascript +var gulp = require('gulp'); +var plugin1 = require('gulp-plugin1'); +var plugin2 = require('gulp-plugin2'); +var sourcemaps = require('gulp-sourcemaps'); + +gulp.task('javascript', function() { + gulp.src('src/**/*.js') + .pipe(sourcemaps.init()) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write()) + .pipe(gulp.dest('dist')); +}); +``` + +All plugins between `sourcemaps.init()` and `sourcemaps.write()` need to have support for `gulp-sourcemaps`. You can find a list of such plugins in the [wiki](https://github.com/floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support). + + +#### Write external source map files + +To write external source map files, pass a path relative to the destination to `sourcemaps.write()`. + +Example: +```javascript +var gulp = require('gulp'); +var plugin1 = require('gulp-plugin1'); +var plugin2 = require('gulp-plugin2'); +var sourcemaps = require('gulp-sourcemaps'); + +gulp.task('javascript', function() { + gulp.src('src/**/*.js') + .pipe(sourcemaps.init()) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write('../maps')) + .pipe(gulp.dest('dist')); +}); +``` + +#### Load existing source maps + +To load existing source maps, pass the option `loadMaps: true` to `sourcemaps.init()`. + +Example: +```javascript +var gulp = require('gulp'); +var plugin1 = require('gulp-plugin1'); +var plugin2 = require('gulp-plugin2'); +var sourcemaps = require('gulp-sourcemaps'); + +gulp.task('javascript', function() { + gulp.src('src/**/*.js') + .pipe(sourcemaps.init({loadMaps: true})) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write()) + .pipe(gulp.dest('dist')); +}); +``` + +#### Handle source files from different directories + +Use the `base` option on `gulp.src` to make sure all files are relative to a common base directory. + +Example: +```javascript +var gulp = require('gulp'); +var plugin1 = require('gulp-plugin1'); +var plugin2 = require('gulp-plugin2'); +var sourcemaps = require('gulp-sourcemaps'); + +gulp.task('javascript', function() { +gulp.src(['src/test.js', 'src/testdir/test2.js'], { base: 'src' }) + .pipe(sourcemaps.init()) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write('../maps')) + .pipe(gulp.dest('dist')); +}); +``` + + + +### Init Options + +- `loadMaps` + Set to true to load existing maps for source files. Supports the following: + - inline source maps + - source map files referenced by a `sourceMappingURL=` comment + - source map files with the same name (plus .map) in the same directory + +- `debug` + Set this to `true` to output debug messages (e.g. about missing source content). + +### Write Options + +- `addComment` + + By default a comment containing / referencing the source map is added. Set this to `false` to disable the comment (e.g. if you want to load the source maps by header). + + Example: + ```javascript + gulp.task('javascript', function() { + var stream = gulp.src('src/**/*.js') + .pipe(sourcemaps.init()) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write('../maps', {addComment: false})) + .pipe(gulp.dest('dist')); + }); + ``` + +- `includeContent` + + By default the source maps include the source code. Pass `false` to use the original files. + + Including the content is the recommended way, because it "just works". When setting this to `false` you have to host the source files and set the correct `sourceRoot`. + +- `sourceRoot` + + Set the path where the source files are hosted (use this when `includeContent` is set to `false`). This is an URL (or subpath) relative to the source map, not a local file system path. If you have sources in different subpaths, an absolute path (from the domain root) pointing to the source file root is recommended, or define it with a function. + + Example: + ```javascript + gulp.task('javascript', function() { + var stream = gulp.src('src/**/*.js') + .pipe(sourcemaps.init()) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write({includeContent: false, sourceRoot: '/src'})) + .pipe(gulp.dest('dist')); + }); + ``` + + Example (using a function): + ```javascript + gulp.task('javascript', function() { + var stream = gulp.src('src/**/*.js') + .pipe(sourcemaps.init()) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write({ + includeContent: false, + sourceRoot: function(file) { + return '/src'; + } + })) + .pipe(gulp.dest('dist')); + }); + ``` + +- `sourceMappingURLPrefix` + + Specify a prefix to be prepended onto the source map URL when writing external source maps. Relative paths will have their leading dots stripped. + + Example: + ```javascript + gulp.task('javascript', function() { + var stream = gulp.src('src/**/*.js') + .pipe(sourcemaps.init()) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write('../maps', { + sourceMappingURLPrefix: 'https://asset-host.example.com/assets' + })) + .pipe(gulp.dest('public/scripts')); + }); + ``` + + This will result in a source mapping URL comment like `sourceMappingURL=https://asset-host.example.com/assets/maps/helloworld.js.map`. + +- `sourceMappingURL` + + If you need full control over the source map URL you can pass a function to this option. The output of the function must be the full URL to the source map (in function of the output file). + + Example: + ```javascript + gulp.task('javascript', function() { + var stream = gulp.src('src/**/*.js') + .pipe(sourcemaps.init()) + .pipe(plugin1()) + .pipe(plugin2()) + .pipe(sourcemaps.write('../maps', { + sourceMappingURL: function(file) { + return 'https://asset-host.example.com/' + file.relative + '.map'; + } + })) + .pipe(gulp.dest('public/scripts')); + }); + ``` + + This will result in a source mapping URL comment like `sourceMappingURL=https://asset-host.example.com/helloworld.js.map`. + +- `debug` + + Set this to `true` to output debug messages (e.g. about missing source content). + +### Plugin developers only: How to add source map support to plugins + +- Generate a source map for the transformation the plugin is applying +- **Important**: Make sure the paths in the generated source map (`file` and `sources`) are relative to `file.base` (e.g. use `file.relative`). +- Apply this source map to the vinyl `file`. E.g. by using [vinyl-sourcemaps-apply](https://github.com/floridoo/vinyl-sourcemaps-apply). + This combines the source map of this plugin with the source maps coming from plugins further up the chain. +- Add your plugin to the [wiki page](https://github.com/floridoo/gulp-sourcemaps/wiki/Plugins-with-gulp-sourcemaps-support) + +#### Example: + +```javascript +var through = require('through2'); +var applySourceMap = require('vinyl-sourcemaps-apply'); +var myTransform = require('myTransform'); + +module.exports = function(options) { + + function transform(file, encoding, callback) { + // generate source maps if plugin source-map present + if (file.sourceMap) { + options.makeSourceMaps = true; + } + + // do normal plugin logic + var result = myTransform(file.contents, options); + file.contents = new Buffer(result.code); + + // apply source map to the chain + if (file.sourceMap) { + applySourceMap(file, result.map); + } + + this.push(file); + callback(); + } + + return through.obj(transform); +}; +``` + +[npm-image]: https://img.shields.io/npm/v/gulp-sourcemaps.svg +[npm-url]: https://www.npmjs.com/package/gulp-sourcemaps +[travis-image]: https://img.shields.io/travis/floridoo/gulp-sourcemaps.svg +[travis-url]: https://travis-ci.org/floridoo/gulp-sourcemaps +[coveralls-image]: https://img.shields.io/coveralls/floridoo/gulp-sourcemaps.svg +[coveralls-url]: https://coveralls.io/r/floridoo/gulp-sourcemaps?branch=master diff --git a/node_modules/gulp-sourcemaps/index.js b/node_modules/gulp-sourcemaps/index.js new file mode 100644 index 000000000..be952cd06 --- /dev/null +++ b/node_modules/gulp-sourcemaps/index.js @@ -0,0 +1,269 @@ +'use strict'; +var through = require('through2'); +var fs = require('graceful-fs'); +var path = require('path'); +var File = require('vinyl'); +var convert = require('convert-source-map'); +var stripBom = require('strip-bom'); + +var PLUGIN_NAME = 'gulp-sourcemap'; +var urlRegex = /^(https?|webpack(-[^:]+)?):\/\//; + +/** + * Initialize source mapping chain + */ +module.exports.init = function init(options) { + function sourceMapInit(file, encoding, callback) { + /*jshint validthis:true */ + + // pass through if file is null or already has a source map + if (file.isNull() || file.sourceMap) { + this.push(file); + return callback(); + } + + if (file.isStream()) { + return callback(new Error(PLUGIN_NAME + '-init: Streaming not supported')); + } + + var fileContent = file.contents.toString(); + var sourceMap; + + if (options && options.loadMaps) { + var sourcePath = ''; //root path for the sources in the map + + // Try to read inline source map + sourceMap = convert.fromSource(fileContent); + if (sourceMap) { + sourceMap = sourceMap.toObject(); + // sources in map are relative to the source file + sourcePath = path.dirname(file.path); + fileContent = convert.removeComments(fileContent); + } else { + // look for source map comment referencing a source map file + var mapComment = convert.mapFileCommentRegex.exec(fileContent); + + var mapFile; + if (mapComment) { + mapFile = path.resolve(path.dirname(file.path), mapComment[1] || mapComment[2]); + fileContent = convert.removeMapFileComments(fileContent); + // if no comment try map file with same name as source file + } else { + mapFile = file.path + '.map'; + } + + // sources in external map are relative to map file + sourcePath = path.dirname(mapFile); + + try { + sourceMap = JSON.parse(stripBom(fs.readFileSync(mapFile, 'utf8'))); + } catch(e) {} + } + + // fix source paths and sourceContent for imported source map + if (sourceMap) { + sourceMap.sourcesContent = sourceMap.sourcesContent || []; + sourceMap.sources.forEach(function(source, i) { + if (source.match(urlRegex)) { + sourceMap.sourcesContent[i] = sourceMap.sourcesContent[i] || null; + return; + } + var absPath = path.resolve(sourcePath, source); + sourceMap.sources[i] = unixStylePath(path.relative(file.base, absPath)); + + if (!sourceMap.sourcesContent[i]) { + var sourceContent = null; + if (sourceMap.sourceRoot) { + if (sourceMap.sourceRoot.match(urlRegex)) { + sourceMap.sourcesContent[i] = null; + return; + } + absPath = path.resolve(sourcePath, sourceMap.sourceRoot, source); + } + + // if current file: use content + if (absPath === file.path) { + sourceContent = fileContent; + + // else load content from file + } else { + try { + if (options.debug) + console.log(PLUGIN_NAME + '-init: No source content for "' + source + '". Loading from file.'); + sourceContent = stripBom(fs.readFileSync(absPath, 'utf8')); + } catch (e) { + if (options.debug) + console.warn(PLUGIN_NAME + '-init: source file not found: ' + absPath); + } + } + sourceMap.sourcesContent[i] = sourceContent; + } + }); + + // remove source map comment from source + file.contents = new Buffer(fileContent, 'utf8'); + } + } + + if (!sourceMap) { + // Make an empty source map + sourceMap = { + version : 3, + names: [], + mappings: '', + sources: [unixStylePath(file.relative)], + sourcesContent: [fileContent] + }; + } + + sourceMap.file = unixStylePath(file.relative); + file.sourceMap = sourceMap; + + this.push(file); + callback(); + } + + return through.obj(sourceMapInit); +}; + +/** + * Write the source map + * + * @param options options to change the way the source map is written + * + */ +module.exports.write = function write(destPath, options) { + if (options === undefined && Object.prototype.toString.call(destPath) === '[object Object]') { + options = destPath; + destPath = undefined; + } + options = options || {}; + + // set defaults for options if unset + if (options.includeContent === undefined) + options.includeContent = true; + if (options.addComment === undefined) + options.addComment = true; + + function sourceMapWrite(file, encoding, callback) { + /*jshint validthis:true */ + + if (file.isNull() || !file.sourceMap) { + this.push(file); + return callback(); + } + + if (file.isStream()) { + return callback(new Error(PLUGIN_NAME + '-write: Streaming not supported')); + } + + var sourceMap = file.sourceMap; + // fix paths if Windows style paths + sourceMap.file = unixStylePath(file.relative); + sourceMap.sources = sourceMap.sources.map(function(filePath) { + return unixStylePath(filePath); + }); + + if (typeof options.sourceRoot === 'function') { + sourceMap.sourceRoot = options.sourceRoot(file); + } else { + sourceMap.sourceRoot = options.sourceRoot; + } + + if (options.includeContent) { + sourceMap.sourcesContent = sourceMap.sourcesContent || []; + + // load missing source content + for (var i = 0; i < file.sourceMap.sources.length; i++) { + if (!sourceMap.sourcesContent[i]) { + var sourcePath = path.resolve(sourceMap.sourceRoot || file.base, sourceMap.sources[i]); + try { + if (options.debug) + console.log(PLUGIN_NAME + '-write: No source content for "' + sourceMap.sources[i] + '". Loading from file.'); + sourceMap.sourcesContent[i] = stripBom(fs.readFileSync(sourcePath, 'utf8')); + } catch (e) { + if (options.debug) + console.warn(PLUGIN_NAME + '-write: source file not found: ' + sourcePath); + } + } + } + if (sourceMap.sourceRoot === undefined) { + sourceMap.sourceRoot = '/source/'; + } else if (sourceMap.sourceRoot === null) { + sourceMap.sourceRoot = undefined; + } + } else { + delete sourceMap.sourcesContent; + } + + var extension = file.relative.split('.').pop(); + var commentFormatter; + + switch (extension) { + case 'css': + commentFormatter = function(url) { return "\n/*# sourceMappingURL=" + url + " */\n"; }; + break; + case 'js': + commentFormatter = function(url) { return "\n//# sourceMappingURL=" + url + "\n"; }; + break; + default: + commentFormatter = function(url) { return ""; }; + } + + var comment, sourceMappingURLPrefix; + if (!destPath) { + // encode source map into comment + var base64Map = new Buffer(JSON.stringify(sourceMap)).toString('base64'); + comment = commentFormatter('data:application/json;base64,' + base64Map); + } else { + var sourceMapPath = path.join(file.base, destPath, file.relative) + '.map'; + // add new source map file to stream + var sourceMapFile = new File({ + cwd: file.cwd, + base: file.base, + path: sourceMapPath, + contents: new Buffer(JSON.stringify(sourceMap)), + stat: { + isFile: function () { return true; }, + isDirectory: function () { return false; }, + isBlockDevice: function () { return false; }, + isCharacterDevice: function () { return false; }, + isSymbolicLink: function () { return false; }, + isFIFO: function () { return false; }, + isSocket: function () { return false; } + } + }); + this.push(sourceMapFile); + + var sourceMapPathRelative = path.relative(path.dirname(file.path), sourceMapPath); + + if (options.sourceMappingURLPrefix) { + var prefix = ''; + if (typeof options.sourceMappingURLPrefix === 'function') { + prefix = options.sourceMappingURLPrefix(file); + } else { + prefix = options.sourceMappingURLPrefix; + } + sourceMapPathRelative = prefix+path.join('/', sourceMapPathRelative); + } + comment = commentFormatter(unixStylePath(sourceMapPathRelative)); + + if (options.sourceMappingURL && typeof options.sourceMappingURL === 'function') { + comment = commentFormatter(options.sourceMappingURL(file)); + } + } + + // append source map comment + if (options.addComment) + file.contents = Buffer.concat([file.contents, new Buffer(comment)]); + + this.push(file); + callback(); + } + + return through.obj(sourceMapWrite); +}; + +function unixStylePath(filePath) { + return filePath.split(path.sep).join('/'); +} diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/CHANGELOG.md b/node_modules/gulp-sourcemaps/node_modules/vinyl/CHANGELOG.md new file mode 100644 index 000000000..9bf67df45 --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/CHANGELOG.md @@ -0,0 +1,163 @@ +## Change Log + +### v1.1.1 (2016/01/18 23:23 +00:00) +- [3990e00](https://github.com/gulpjs/vinyl/commit/3990e007b004c809a53670c00566afb157fa56b6) 1.1.1 +- [2d3e984](https://github.com/gulpjs/vinyl/commit/2d3e98447a42285b593e1b261984b87b171e7313) chore: add NPM script for changelog (@T1st3) +- [f70c395](https://github.com/gulpjs/vinyl/commit/f70c395085fc3952cf72c061c851f5b0d4676030) docs: add CHANGELOG.md (@T1st3) +- [#74](https://github.com/gulpjs/vinyl/pull/74) Fix isVinyl for falsy values (@erikkemperman) +- [3e8b132](https://github.com/gulpjs/vinyl/commit/3e8b132cd87bf5ab536ff7a4c6d660e33f5990b4) Fix isVinyl for falsy values (@erikkemperman) +- [#73](https://github.com/gulpjs/vinyl/pull/73) Readme: use SVG images. (@d10) +- [193e3d2](https://github.com/gulpjs/vinyl/commit/193e3d25f68c97593e011981e49db2c3e7a47d91) Readme: use SVG images. (@d10) +- [#67](https://github.com/gulpjs/vinyl/pull/67) Set Travis to sudo:false and add node 0.12/4.x (@pdehaan) +- [c33d85a](https://github.com/gulpjs/vinyl/commit/c33d85ab1d63fbcd272f7fb91d666006dab76d99) Set Travis to sudo:false and add node 0.12/4.x (@pdehaan) + +### v1.1.0 (2015/10/23 06:33 +00:00) +- [51052ad](https://github.com/gulpjs/vinyl/commit/51052add24bb1c771bf5912809b47d4d53288c48) 1.1.0 +- [#64](https://github.com/gulpjs/vinyl/pull/64) File.stem for basename without suffix (@soslan) +- [e505375](https://github.com/gulpjs/vinyl/commit/e5053756a49ea8800cd5da12fc0eefce859ccf61) Following JSCS rules in File.stem (@soslan) +- [d45f478](https://github.com/gulpjs/vinyl/commit/d45f478c7af3f2e956e57ce6d7550d64e3b7dbfb) Following JSCS rules (@soslan) +- [#66](https://github.com/gulpjs/vinyl/pull/66) Replace JSHint with ESLint (@pdehaan) +- [c5549f7](https://github.com/gulpjs/vinyl/commit/c5549f7002ae580fa9a7f7df490d6e3911af2285) Bump to eslint-config-gulp@2 (@pdehaan) +- [f6a5512](https://github.com/gulpjs/vinyl/commit/f6a55125e7230621ecae1f395da202140baaee1d) Replace JSHint with ESLint (@pdehaan) +- [#65](https://github.com/gulpjs/vinyl/pull/65) Add JSCS to repo (@pdehaan) +- [f9a0101](https://github.com/gulpjs/vinyl/commit/f9a0101d013356056293d21356d4cb443613b0be) Comments should start with uppercase letters (per JSCS) (@pdehaan) +- [6506478](https://github.com/gulpjs/vinyl/commit/650647833e3cea8d005a3ab1810ecd285418fa1e) Add JSCS to repo (@pdehaan) +- [ae3778c](https://github.com/gulpjs/vinyl/commit/ae3778c536a898fe47bbb37e5932b300123b28b8) Documentation for File.stem (@soslan) +- [e2246af](https://github.com/gulpjs/vinyl/commit/e2246af8aad6df348557f9d1df5001c30ff83774) add stem property to File (@soslan) +- [#63](https://github.com/gulpjs/vinyl/pull/63) Fix broken badge URLs in README.md (@tatsuyafw) +- [032ae7c](https://github.com/gulpjs/vinyl/commit/032ae7c5c59b72dc58041a14449d8d66af053023) Use reference links (@tatsuyafw) +- [652bc3b](https://github.com/gulpjs/vinyl/commit/652bc3bd3cc7a6af5d21d8d759a01cee3ce46acf) Fix some broken links in README.md (@tatsuyafw) + +### v1.0.0 (2015/09/25 22:40 +00:00) +- [dbe943d](https://github.com/gulpjs/vinyl/commit/dbe943dad575b04995f38a35bd27962f54dc8217) 1.0.0 (@contra) +- [0b64336](https://github.com/gulpjs/vinyl/commit/0b643367289db0cfefc6c628eff2be4ee019405c) correct url (@contra) +- [#60](https://github.com/gulpjs/vinyl/pull/60) remove <br> from README.md (@bobintornado) +- [d9ae5ea](https://github.com/gulpjs/vinyl/commit/d9ae5eab010fd15094c8a0260a25d1244f17df79) remove <br> from README.md (@bobintornado) + +### v0.5.3 (2015/09/03 00:20 +00:00) +- [6f19648](https://github.com/gulpjs/vinyl/commit/6f19648bd67040bfd0dc755ad031e1e5e0b58429) 0.5.3 (@contra) +- [0fe8da7](https://github.com/gulpjs/vinyl/commit/0fe8da757a862bb956d88dec03ab6f99ca895f7f) add isVinyl function (@contra) + +### v0.5.1 (2015/08/04 21:26 +00:00) +- [81692ec](https://github.com/gulpjs/vinyl/commit/81692ece22eb3b927dba74fedb54a2acb65a36eb) 0.5.1 (@contra) +- [#58](https://github.com/gulpjs/vinyl/pull/58) use Buffer.isBuffer instead of instanceof (@whyrusleeping) +- [7293a71](https://github.com/gulpjs/vinyl/commit/7293a71b9daf177d9b9f600f3acf00a73b95107c) condense isBuffer module to a one liner (@whyrusleeping) +- [e7208e2](https://github.com/gulpjs/vinyl/commit/e7208e2c27029405c7c9cf9c9a3263cdf1e0dfb8) also remove old comment (@whyrusleeping) +- [b4ac64b](https://github.com/gulpjs/vinyl/commit/b4ac64b85ce28093f576db4f006264438f546cb8) use Buffer.isBuffer instead of instanceof (@whyrusleeping) +- [#54](https://github.com/gulpjs/vinyl/pull/54) Fix file clone options (@danielhusar) +- [4b42095](https://github.com/gulpjs/vinyl/commit/4b42095d8e0cb4351a503da67752da15e6b59570) Fix file clone options (@danielhusar) +- [04f681e](https://github.com/gulpjs/vinyl/commit/04f681e4af8ffb99ea3a0a3eab1cc79793887560) closes #50 and #51 (@contra) + +### v0.5.0 (2015/06/03 23:44 +00:00) +- [8fea984](https://github.com/gulpjs/vinyl/commit/8fea9843e6b2aca820ccfee394927ca073f88a05) 0.5.0 (@contra) +- [#52](https://github.com/gulpjs/vinyl/pull/52) Add explicit newlines to readme (@jeremyruppel) +- [027142c](https://github.com/gulpjs/vinyl/commit/027142cf62a3f0a68f4659a612ee782b24c00198) Add explicit newlines to readme (@jeremyruppel) +- [#46](https://github.com/gulpjs/vinyl/pull/46) Add dirname, basename and extname getters (@jeremyruppel) +- [e09817f](https://github.com/gulpjs/vinyl/commit/e09817f15e4ddfc28e1b3452bbca5e2ba1fc2f19) Add dirname, basename and extname accessors (@jeremyruppel) +- [#49](https://github.com/gulpjs/vinyl/pull/49) update license attribute (@pgilad) +- [e5b2670](https://github.com/gulpjs/vinyl/commit/e5b2670af205ca0fb6f589a396b89ab2845a91ac) update license attribut (@pgilad) +- [55f90e3](https://github.com/gulpjs/vinyl/commit/55f90e3763af84c7eb599bd6403dbe14f63d5513) dep updates (@contra) +- [#48](https://github.com/gulpjs/vinyl/pull/48) Update docs for `path` and `history` (@jmm) +- [231f32a](https://github.com/gulpjs/vinyl/commit/231f32a375aa9147d0a41ffd1ace773c45e66ee5) Document `path`. (@jmm) +- [93df183](https://github.com/gulpjs/vinyl/commit/93df18374b62de32c76862baf73e92f33b04882a) Document `options.history`. (@jmm) +- [2ed6a01](https://github.com/gulpjs/vinyl/commit/2ed6a012c03a78b46f9d41034969898a15fdfe15) Correct `options.path` default value docs. (@jmm) +- [edf1ecb](https://github.com/gulpjs/vinyl/commit/edf1ecb0698f355e137f9361a9a9a2581ca485e5) Document `history`. (@jmm) +- [#45](https://github.com/gulpjs/vinyl/pull/45) Update dependencies and devDependencies (@shinnn) +- [f1f9dfb](https://github.com/gulpjs/vinyl/commit/f1f9dfbb1346b608226e5847161bf48e0caa2c1e) update test script (@shinnn) +- [0737ef4](https://github.com/gulpjs/vinyl/commit/0737ef489f9cfffa2494b06edaab9a032f00eb7e) update dependencies and devDependencies (@shinnn) +- [#43](https://github.com/gulpjs/vinyl/pull/43) Document `file.clone()` arguments (@pascalduez) +- [3c5e95d](https://github.com/gulpjs/vinyl/commit/3c5e95d5f482ea9f28dd2d78b83166723cd121bb) Document `file.clone()` arguments (@pascalduez) + +### v0.4.6 (2014/12/03 06:15 +00:00) +- [8255a5f](https://github.com/gulpjs/vinyl/commit/8255a5f1de7fecb1cd5e7ba7ac1ec997395f6be1) 0.4.6 (@contra) +- [37dafeb](https://github.com/gulpjs/vinyl/commit/37dafeb8cb0b33424e77fe67a094517925be2bef) dep update (@contra) + +### v0.4.5 (2014/11/13 23:23 +00:00) +- [a7a8c68](https://github.com/gulpjs/vinyl/commit/a7a8c68a1df914b1f486a54a97b68e9186699d33) 0.4.5 (@contra) +- [ec094b4](https://github.com/gulpjs/vinyl/commit/ec094b43e36512894142baacef26dfffc5827114) reduce size by switching off lodash (@contra) + +### v0.4.4 (2014/11/13 22:59 +00:00) +- [61834c9](https://github.com/gulpjs/vinyl/commit/61834c9429f2e6883a18f377bc5893031ea1c94f) 0.4.4 (@contra) +- [fd887b3](https://github.com/gulpjs/vinyl/commit/fd887b3d21ed47c2b4cf40b0c0ed7b2df9048b09) ignore some files for size reasons (@contra) +- [#37](https://github.com/gulpjs/vinyl/pull/37) Don't package coverage into NPM (@Dapperbot) +- [9b811b8](https://github.com/gulpjs/vinyl/commit/9b811b86529e2b4b0cc20936a6697b3d9df503a2) Don't package coverage into NPM (@lotyrin) + +### v0.4.3 (2014/09/01 18:17 +00:00) +- [6eae432](https://github.com/gulpjs/vinyl/commit/6eae432519b007c313a8df83b093adfb97a2944c) 0.4.3 (@contra) +- [d220c85](https://github.com/gulpjs/vinyl/commit/d220c857259f0070ab38c7b50d90f184a919e472) fix funky history passing, closes #35 (@contra) + +### v0.4.2 (2014/08/29 15:58 +00:00) +- [f33d6d5](https://github.com/gulpjs/vinyl/commit/f33d6d5c1b9d1f83e238521651114beb90a01019) 0.4.2 (@contra) +- [cd0d042](https://github.com/gulpjs/vinyl/commit/cd0d04272297363f27f8456818dbf675618939c3) remove native clone (@contra) +- [e4d8b99](https://github.com/gulpjs/vinyl/commit/e4d8b99c21a50700afd17173e1f3a2076e6fe860) minor speed enhancements (@contra) +- [2353e39](https://github.com/gulpjs/vinyl/commit/2353e3996ac67629da92c2af906bdfdbc6978065) minor speed ups (@contra) + +### v0.4.1 (2014/08/29 14:34 +00:00) +- [0014b9b](https://github.com/gulpjs/vinyl/commit/0014b9bf4166fb5cbe94c439201752cda7991a70) 0.4.1 (@contra) +- [0142513](https://github.com/gulpjs/vinyl/commit/0142513b0727ad6a018b0944fea2bb4966d8bbfa) fix history cloning bug (@contra) + +### v0.4.0 (2014/08/29 07:07 +00:00) +- [80d3f61](https://github.com/gulpjs/vinyl/commit/80d3f61445b347fc1c34f462f0ab800644e90e04) 0.4.0 (@contra) +- [#33](https://github.com/gulpjs/vinyl/pull/33) Clone stream (@popomore) +- [d37b57b](https://github.com/gulpjs/vinyl/commit/d37b57bba0aa1fba18d9fecec3513ac4e61b27cd) coverage 100% :sparkles: (@popomore) +- [b5a62f0](https://github.com/gulpjs/vinyl/commit/b5a62f0ede71bdeae957e8653e6ccbdca998879c) fix testcase and delete duplicate testcase (@popomore) +- [fb1b15d](https://github.com/gulpjs/vinyl/commit/fb1b15da472647743eb4e829b99f64d6d9f751fa) Adding more test (@nfroidure) +- [acea889](https://github.com/gulpjs/vinyl/commit/acea8894e9d983d8037641b4ff6f08b666056979) Fixing the clone method (@nfroidure) +- [#32](https://github.com/gulpjs/vinyl/pull/32) improve clone (@popomore) +- [037e830](https://github.com/gulpjs/vinyl/commit/037e8300b75fdddf9c3e003fd205da7ec13b9157) object should multiline (@popomore) +- [7724121](https://github.com/gulpjs/vinyl/commit/7724121194a4ac94fb23a0048ff926d00a784ecc) pass jshint (@popomore) +- [f76a921](https://github.com/gulpjs/vinyl/commit/f76a9211b8b495d81074884d8ea6454a20bba349) use node-v8-clone for performance, fallback to lodash #29 (@popomore) +- [7638f07](https://github.com/gulpjs/vinyl/commit/7638f072bf33a427ec8324a0fb463f73cb9fc8f2) option to not clone buffer #16 (@popomore) +- [6bfd73c](https://github.com/gulpjs/vinyl/commit/6bfd73cc459907a06ce9affc373599ffb8130c08) copy all attributes deeply #29 (@popomore) +- [b34f813](https://github.com/gulpjs/vinyl/commit/b34f8135d47e0a2ba3be6f769729ba66931b3234) add testcase for clone history (@popomore) +- [a913edf](https://github.com/gulpjs/vinyl/commit/a913edf1dd91c5bdcfc9ff3149a94eae131006aa) fix mixed quote and unused variable (@popomore) + +### v0.3.3 (2014/08/28 13:50 +00:00) +- [c801d3d](https://github.com/gulpjs/vinyl/commit/c801d3dc354383cf2656338d63908ec2983e3612) 0.3.3 (@contra) +- [f13970e](https://github.com/gulpjs/vinyl/commit/f13970e3cc5d1d730f94316daeee5b5c0e6c00f3) fix jshint on tests (@contra) +- [6186101](https://github.com/gulpjs/vinyl/commit/61861017bc22a786a026730cf5c55d23c657abea) closes #31 (@contra) +- [#24](https://github.com/gulpjs/vinyl/pull/24) path get/set for recording path change (@popomore) +- [6eab1c4](https://github.com/gulpjs/vinyl/commit/6eab1c4f1376aec901d8869d3d410953f1c93e9f) done (@contra) + +### v0.3.2 (2014/07/30 23:22 +00:00) +- [44ef836](https://github.com/gulpjs/vinyl/commit/44ef8369e1a0a7ba01da4608d01166c5a5d8cbe1) 0.3.2 (@contra) +- [ae28ff2](https://github.com/gulpjs/vinyl/commit/ae28ff200c034e9a40babb38886cdc7ef97a0f25) oops, thats what i get for coding from a car (@contra) + +### v0.3.1 (2014/07/30 22:35 +00:00) +- [03b7578](https://github.com/gulpjs/vinyl/commit/03b75789e58b43bdaef9ca166e4062b8ccfdefb9) 0.3.1 (@contra) +- [64850ff](https://github.com/gulpjs/vinyl/commit/64850ffdf4d31b35ac1160d0d495644cadd52914) fix deep deps, closes #28 (@contra) + +### v0.3.0 (2014/07/19 04:57 +00:00) +- [dcb77f3](https://github.com/gulpjs/vinyl/commit/dcb77f3246d1011a430c20f883eb89c520206ca6) 0.3.0 (@contra) +- [#27](https://github.com/gulpjs/vinyl/pull/27) Clone custom properties (@vweevers) +- [95710de](https://github.com/gulpjs/vinyl/commit/95710de62f4c1234a244a6818b5e39d92ea7b9a8) fix relative path test for windows (@vweevers) +- [e493187](https://github.com/gulpjs/vinyl/commit/e493187b3f2fd1485077f09e73e669407ac077d3) clone custom properties (@laurelnaiad) +- [e50ceac](https://github.com/gulpjs/vinyl/commit/e50ceacfc3daa825e111976ba4192cb93c80bfe2) throw when set path is null (@popomore) +- [7c71bf3](https://github.com/gulpjs/vinyl/commit/7c71bf3d806a98730a0ce5edd56c0b8f1f42e8f0) remove initialize of this.path (@popomore) +- [d95023f](https://github.com/gulpjs/vinyl/commit/d95023f6604a990d38e4f5b332c7916ceb012366) delete this._path :tongue: (@popomore) +- [f3f9be0](https://github.com/gulpjs/vinyl/commit/f3f9be0f3d76b4125353cd936731f70015d44284) path get/set for recording path change #19 (@popomore) +- [#21](https://github.com/gulpjs/vinyl/pull/21) LICENSE: Remove executable mode (@felixrabe) +- [#22](https://github.com/gulpjs/vinyl/pull/22) Travis: Dump node 0.9 - travis-ci/travis-ci#2251 (@felixrabe) +- [70a2193](https://github.com/gulpjs/vinyl/commit/70a219346c00e0db6be1a0aa55c183e7d5b80ad1) Travis: Dump node 0.9 - travis-ci/travis-ci#2251 (@felixrabe) +- [460eed5](https://github.com/gulpjs/vinyl/commit/460eed58de9cb04d44e35b6bebbfbaea9146015f) LICENSE: Remove executable mode (@felixrabe) +- [#18](https://github.com/gulpjs/vinyl/pull/18) fix typo (@vvakame) +- [1783e7f](https://github.com/gulpjs/vinyl/commit/1783e7f031ecfb118ee9b43971a72be264caa144) fix typo (@vvakame) +- [#11](https://github.com/gulpjs/vinyl/pull/11) Correct README about pipe's end option. (@shuhei) +- [1824ec9](https://github.com/gulpjs/vinyl/commit/1824ec9cefd276557b7338dfdbd54922599f020a) Correct README about pipe's end option. (@shuhei) +- [f49b9c3](https://github.com/gulpjs/vinyl/commit/f49b9c325229754229726ed530c579e4ac23252b) remove dead line (@contra) +- [1ca8e46](https://github.com/gulpjs/vinyl/commit/1ca8e463259c2a395d5d41b528b04a89a953f6b7) dep update, new coveralls stuff (@contra) +- [f00767b](https://github.com/gulpjs/vinyl/commit/f00767bf8b61ca8a7b25f3ebd3dde297fa2dafd7) bump (@contra) +- [#8](https://github.com/gulpjs/vinyl/pull/8) Correct File.clone() treatment of File.stats (@hughsk) +- [bc3acf7](https://github.com/gulpjs/vinyl/commit/bc3acf7b1ed712d70e7d8cb4f6e5248124743ec7) Add test for new File.clone() functionality (@hughsk) +- [dd668fb](https://github.com/gulpjs/vinyl/commit/dd668fb5aaed02cfb0f63a58f027c937dd7e0467) Use clone-stats module to clone fs.Stats instances. (@hughsk) +- [b6244c5](https://github.com/gulpjs/vinyl/commit/b6244c52d3bf9bd87bd6b926f0486f407627f7e0) Correct File.clone() treatment of File.stats (@hughsk) +- [796ba8b](https://github.com/gulpjs/vinyl/commit/796ba8b5ddd658fed3393c7d0a0d7bea7befa1b1) 0.2.1 - fixes #2 (@contra) +- [bffa6a4](https://github.com/gulpjs/vinyl/commit/bffa6a4e323e18e084b5b1444b4537aa3fb3e109) vinyl-fs movement? (@contra) +- [cfaa0a0](https://github.com/gulpjs/vinyl/commit/cfaa0a02b7794e493f600d1d36b288294a278e6c) fix isDirectory tests (@contra) +- [05d1f1b](https://github.com/gulpjs/vinyl/commit/05d1f1b741960cce8e8d2702d326ebb0187935ad) add isDirectory (@contra) +- [76580e5](https://github.com/gulpjs/vinyl/commit/76580e573870885580ac00dd9175e562d008cb81) bump to 0.1.0 (@contra) +- [f7a15c4](https://github.com/gulpjs/vinyl/commit/f7a15c41ac5e82de930e161f6b109ae3336d337b) readme 0.9+ (@contra) +- [fc7f192](https://github.com/gulpjs/vinyl/commit/fc7f1925b2a18466f19db062ad28df02f1db823b) drop 0.8 support (@contra) +- [c004b6c](https://github.com/gulpjs/vinyl/commit/c004b6c857d03a292e8ecd5020ad0420d82dbf1e) target 0.8+ (@contra) +- [edf20bd](https://github.com/gulpjs/vinyl/commit/edf20bd8563fca6e8a568b9d08fb728f6705573c) add small example (@contra) +- [d8c63fe](https://github.com/gulpjs/vinyl/commit/d8c63fe0fd16cf13db2d9a6452c979ec12779428) 0.0.1 (@contra)
\ No newline at end of file diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/LICENSE b/node_modules/gulp-sourcemaps/node_modules/vinyl/LICENSE new file mode 100644 index 000000000..4f482f9ba --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 Fractal <contact@wearefractal.com> + +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/gulp-sourcemaps/node_modules/vinyl/README.md b/node_modules/gulp-sourcemaps/node_modules/vinyl/README.md new file mode 100644 index 000000000..d4d2c6136 --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/README.md @@ -0,0 +1,265 @@ +# vinyl [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url] + +## Information +<table><tr><td>Package</td><td>vinyl</td></tr><tr><td>Description</td><td>A virtual file format</td></tr><tr><td>Node Version</td><td>>= 0.9</td></tr></table> + +## What is this? +Read this for more info about how this plays into the grand scheme of things [https://medium.com/@eschoff/3828e8126466](https://medium.com/@eschoff/3828e8126466) + +## File + +```javascript +var File = require('vinyl'); + +var coffeeFile = new File({ + cwd: "/", + base: "/test/", + path: "/test/file.coffee", + contents: new Buffer("test = 123") +}); +``` + +### isVinyl +When checking if an object is a vinyl file, you should not use instanceof. Use the isVinyl function instead. + +```js +var File = require('vinyl'); + +var dummy = new File({stuff}); +var notAFile = {}; + +File.isVinyl(dummy); // true +File.isVinyl(notAFile); // false +``` + +### isCustomProp +Vinyl checks if a property is not managed internally, such as `sourceMap`. This is than used in `constructor(options)` when setting, and `clone()` when copying properties. + +```js +var File = require('vinyl'); + +File.isCustomProp('sourceMap'); // true +File.isCustomProp('path'); // false -> internal getter/setter +``` + +Read more in [Extending Vinyl](#extending-vinyl). + +### constructor(options) +#### options.cwd +Type: `String`<br><br>Default: `process.cwd()` + +#### options.base +Used for relative pathing. Typically where a glob starts. + +Type: `String`<br><br>Default: `options.cwd` + +#### options.path +Full path to the file. + +Type: `String`<br><br>Default: `undefined` + +#### options.history +Path history. Has no effect if `options.path` is passed. + +Type: `Array`<br><br>Default: `options.path ? [options.path] : []` + +#### options.stat +The result of an fs.stat call. See [fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) for more information. + +Type: `fs.Stats`<br><br>Default: `null` + +#### options.contents +File contents. + +Type: `Buffer, Stream, or null`<br><br>Default: `null` + +#### options.{custom} +Any other option properties will just be assigned to the new File object. + +```js +var File = require('vinyl'); + +var file = new File({foo: 'bar'}); +file.foo === 'bar'; // true +``` + +### isBuffer() +Returns true if file.contents is a Buffer. + +### isStream() +Returns true if file.contents is a Stream. + +### isNull() +Returns true if file.contents is null. + +### clone([opt]) +Returns a new File object with all attributes cloned.<br>By default custom attributes are deep-cloned. + +If opt or opt.deep is false, custom attributes will not be deep-cloned. + +If opt.contents is false, it will copy file.contents Buffer's reference. + +### pipe(stream[, opt]) +If file.contents is a Buffer, it will write it to the stream. + +If file.contents is a Stream, it will pipe it to the stream. + +If file.contents is null, it will do nothing. + +If opt.end is false, the destination stream will not be ended (same as node core). + +Returns the stream. + +### inspect() +Returns a pretty String interpretation of the File. Useful for console.log. + +### contents +The [Stream](https://nodejs.org/api/stream.html#stream_stream) or [Buffer](https://nodejs.org/api/buffer.html#buffer_class_buffer) of the file as it was passed in via options, or as the result of modification. + +For example: + +```js +if (file.isBuffer()) { + console.log(file.contents.toString()); // logs out the string of contents +} +``` + +### path +Absolute pathname string or `undefined`. Setting to a different value pushes the old value to `history`. + +### history +Array of `path` values the file object has had, from `history[0]` (original) through `history[history.length - 1]` (current). `history` and its elements should normally be treated as read-only and only altered indirectly by setting `path`. + +### relative +Returns path.relative for the file base and file path. + +Example: + +```javascript +var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/file.coffee" +}); + +console.log(file.relative); // file.coffee +``` + +### dirname +Gets and sets path.dirname for the file path. + +Example: + +```javascript +var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/file.coffee" +}); + +console.log(file.dirname); // /test + +file.dirname = '/specs'; + +console.log(file.dirname); // /specs +console.log(file.path); // /specs/file.coffee +``` + +### basename +Gets and sets path.basename for the file path. + +Example: + +```javascript +var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/file.coffee" +}); + +console.log(file.basename); // file.coffee + +file.basename = 'file.js'; + +console.log(file.basename); // file.js +console.log(file.path); // /test/file.js +``` + +### stem +Gets and sets stem (filename without suffix) for the file path. + +Example: + +```javascript +var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/file.coffee" +}); + +console.log(file.stem); // file + +file.stem = 'foo'; + +console.log(file.stem); // foo +console.log(file.path); // /test/foo.coffee +``` + +### extname +Gets and sets path.extname for the file path. + +Example: + +```javascript +var file = new File({ + cwd: "/", + base: "/test/", + path: "/test/file.coffee" +}); + +console.log(file.extname); // .coffee + +file.extname = '.js'; + +console.log(file.extname); // .js +console.log(file.path); // /test/file.js +``` + +## Extending Vinyl +When extending Vinyl into your own class with extra features, you need to think about a few things. + +When you have your own properties that are managed internally, you need to extend the static `isCustomProp` method to return `false` when one of these properties is queried. + +```js +const File = require('vinyl'); + +const builtInProps = ['foo', '_foo']; + +class SuperFile extends File { + constructor(options) { + super(options); + this._foo = 'example internal read-only value'; + } + + get foo() { + return this._foo; + } + + static isCustomProp(name) { + return super.isCustomProp(name) && builtInProps.indexOf(name) === -1; + } +} +``` + +This makes properties `foo` and `_foo` ignored when cloning, and when passed in options to `constructor(options)` so they don't get assigned to the new object. + +Same goes for `clone()`. If you have your own internal stuff that needs special handling during cloning, you should extend it to do so. + +[npm-url]: https://npmjs.org/package/vinyl +[npm-image]: https://badge.fury.io/js/vinyl.svg +[travis-url]: https://travis-ci.org/gulpjs/vinyl +[travis-image]: https://travis-ci.org/gulpjs/vinyl.svg?branch=master +[coveralls-url]: https://coveralls.io/github/gulpjs/vinyl +[coveralls-image]: https://coveralls.io/repos/github/gulpjs/vinyl/badge.svg +[depstat-url]: https://david-dm.org/gulpjs/vinyl +[depstat-image]: https://david-dm.org/gulpjs/vinyl.svg diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/index.js b/node_modules/gulp-sourcemaps/node_modules/vinyl/index.js new file mode 100644 index 000000000..5a1fe551d --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/index.js @@ -0,0 +1,270 @@ +var path = require('path'); +var clone = require('clone'); +var cloneStats = require('clone-stats'); +var cloneBuffer = require('./lib/cloneBuffer'); +var isBuffer = require('./lib/isBuffer'); +var isStream = require('./lib/isStream'); +var isNull = require('./lib/isNull'); +var inspectStream = require('./lib/inspectStream'); +var Stream = require('stream'); +var replaceExt = require('replace-ext'); + +var builtInFields = [ + '_contents', 'contents', 'stat', 'history', 'path', 'base', 'cwd', +]; + +function File(file) { + var self = this; + + if (!file) { + file = {}; + } + + // Record path change + var history = file.path ? [file.path] : file.history; + this.history = history || []; + + this.cwd = file.cwd || process.cwd(); + this.base = file.base || this.cwd; + + // Stat = files stats object + this.stat = file.stat || null; + + // Contents = stream, buffer, or null if not read + this.contents = file.contents || null; + + this._isVinyl = true; + + // Set custom properties + Object.keys(file).forEach(function(key) { + if (self.constructor.isCustomProp(key)) { + self[key] = file[key]; + } + }); +} + +File.prototype.isBuffer = function() { + return isBuffer(this.contents); +}; + +File.prototype.isStream = function() { + return isStream(this.contents); +}; + +File.prototype.isNull = function() { + return isNull(this.contents); +}; + +// TODO: Should this be moved to vinyl-fs? +File.prototype.isDirectory = function() { + return this.isNull() && this.stat && this.stat.isDirectory(); +}; + +File.prototype.clone = function(opt) { + var self = this; + + if (typeof opt === 'boolean') { + opt = { + deep: opt, + contents: true, + }; + } else if (!opt) { + opt = { + deep: true, + contents: true, + }; + } else { + opt.deep = opt.deep === true; + opt.contents = opt.contents !== false; + } + + // Clone our file contents + var contents; + if (this.isStream()) { + contents = this.contents.pipe(new Stream.PassThrough()); + this.contents = this.contents.pipe(new Stream.PassThrough()); + } else if (this.isBuffer()) { + contents = opt.contents ? cloneBuffer(this.contents) : this.contents; + } + + var file = new this.constructor({ + cwd: this.cwd, + base: this.base, + stat: (this.stat ? cloneStats(this.stat) : null), + history: this.history.slice(), + contents: contents, + }); + + // Clone our custom properties + Object.keys(this).forEach(function(key) { + if (self.constructor.isCustomProp(key)) { + file[key] = opt.deep ? clone(self[key], true) : self[key]; + } + }); + return file; +}; + +File.prototype.pipe = function(stream, opt) { + if (!opt) { + opt = {}; + } + if (typeof opt.end === 'undefined') { + opt.end = true; + } + + if (this.isStream()) { + return this.contents.pipe(stream, opt); + } + if (this.isBuffer()) { + if (opt.end) { + stream.end(this.contents); + } else { + stream.write(this.contents); + } + return stream; + } + + // Check if isNull + if (opt.end) { + stream.end(); + } + return stream; +}; + +File.prototype.inspect = function() { + var inspect = []; + + // Use relative path if possible + var filePath = (this.base && this.path) ? this.relative : this.path; + + if (filePath) { + inspect.push('"' + filePath + '"'); + } + + if (this.isBuffer()) { + inspect.push(this.contents.inspect()); + } + + if (this.isStream()) { + inspect.push(inspectStream(this.contents)); + } + + return '<File ' + inspect.join(' ') + '>'; +}; + +File.isCustomProp = function(key) { + return builtInFields.indexOf(key) === -1; +}; + +File.isVinyl = function(file) { + return (file && file._isVinyl === true) || false; +}; + +// Virtual attributes +// Or stuff with extra logic +Object.defineProperty(File.prototype, 'contents', { + get: function() { + return this._contents; + }, + set: function(val) { + if (!isBuffer(val) && !isStream(val) && !isNull(val)) { + throw new Error('File.contents can only be a Buffer, a Stream, or null.'); + } + this._contents = val; + }, +}); + +// TODO: Should this be moved to vinyl-fs? +Object.defineProperty(File.prototype, 'relative', { + get: function() { + if (!this.base) { + throw new Error('No base specified! Can not get relative.'); + } + if (!this.path) { + throw new Error('No path specified! Can not get relative.'); + } + return path.relative(this.base, this.path); + }, + set: function() { + throw new Error('File.relative is generated from the base and path attributes. Do not modify it.'); + }, +}); + +Object.defineProperty(File.prototype, 'dirname', { + get: function() { + if (!this.path) { + throw new Error('No path specified! Can not get dirname.'); + } + return path.dirname(this.path); + }, + set: function(dirname) { + if (!this.path) { + throw new Error('No path specified! Can not set dirname.'); + } + this.path = path.join(dirname, path.basename(this.path)); + }, +}); + +Object.defineProperty(File.prototype, 'basename', { + get: function() { + if (!this.path) { + throw new Error('No path specified! Can not get basename.'); + } + return path.basename(this.path); + }, + set: function(basename) { + if (!this.path) { + throw new Error('No path specified! Can not set basename.'); + } + this.path = path.join(path.dirname(this.path), basename); + }, +}); + +// Property for getting/setting stem of the filename. +Object.defineProperty(File.prototype, 'stem', { + get: function() { + if (!this.path) { + throw new Error('No path specified! Can not get stem.'); + } + return path.basename(this.path, this.extname); + }, + set: function(stem) { + if (!this.path) { + throw new Error('No path specified! Can not set stem.'); + } + this.path = path.join(path.dirname(this.path), stem + this.extname); + }, +}); + +Object.defineProperty(File.prototype, 'extname', { + get: function() { + if (!this.path) { + throw new Error('No path specified! Can not get extname.'); + } + return path.extname(this.path); + }, + set: function(extname) { + if (!this.path) { + throw new Error('No path specified! Can not set extname.'); + } + this.path = replaceExt(this.path, extname); + }, +}); + +Object.defineProperty(File.prototype, 'path', { + get: function() { + return this.history[this.history.length - 1]; + }, + set: function(path) { + if (typeof path !== 'string') { + throw new Error('path should be string'); + } + + // Record history only when path changed + if (path && path !== this.path) { + this.history.push(path); + } + }, +}); + +module.exports = File; diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/cloneBuffer.js b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/cloneBuffer.js new file mode 100644 index 000000000..89f09eda1 --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/cloneBuffer.js @@ -0,0 +1,7 @@ +var Buffer = require('buffer').Buffer; + +module.exports = function(buf) { + var out = new Buffer(buf.length); + buf.copy(out); + return out; +}; diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/inspectStream.js b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/inspectStream.js new file mode 100644 index 000000000..942f23d8c --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/inspectStream.js @@ -0,0 +1,15 @@ +var isStream = require('./isStream'); + +module.exports = function(stream) { + if (!isStream(stream)) { + return; + } + + var streamType = stream.constructor.name; + // Avoid StreamStream + if (streamType === 'Stream') { + streamType = ''; + } + + return '<' + streamType + 'Stream>'; +}; diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isBuffer.js b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isBuffer.js new file mode 100644 index 000000000..8a767d174 --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isBuffer.js @@ -0,0 +1 @@ +module.exports = require('buffer').Buffer.isBuffer; diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isNull.js b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isNull.js new file mode 100644 index 000000000..7f22c63ae --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isNull.js @@ -0,0 +1,3 @@ +module.exports = function(v) { + return v === null; +}; diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isStream.js b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isStream.js new file mode 100644 index 000000000..6b54e123b --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/lib/isStream.js @@ -0,0 +1,5 @@ +var Stream = require('stream').Stream; + +module.exports = function(o) { + return !!o && o instanceof Stream; +}; diff --git a/node_modules/gulp-sourcemaps/node_modules/vinyl/package.json b/node_modules/gulp-sourcemaps/node_modules/vinyl/package.json new file mode 100644 index 000000000..5e9de9789 --- /dev/null +++ b/node_modules/gulp-sourcemaps/node_modules/vinyl/package.json @@ -0,0 +1,122 @@ +{ + "_args": [ + [ + { + "raw": "vinyl@^1.0.0", + "scope": null, + "escapedName": "vinyl", + "name": "vinyl", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp-sourcemaps" + ] + ], + "_from": "vinyl@>=1.0.0 <2.0.0", + "_id": "vinyl@1.2.0", + "_inCache": true, + "_location": "/gulp-sourcemaps/vinyl", + "_nodeVersion": "0.10.41", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/vinyl-1.2.0.tgz_1469745377040_0.31818721699528396" + }, + "_npmUser": { + "name": "phated", + "email": "blaine.bublitz@gmail.com" + }, + "_npmVersion": "2.15.2", + "_phantomChildren": {}, + "_requested": { + "raw": "vinyl@^1.0.0", + "scope": null, + "escapedName": "vinyl", + "name": "vinyl", + "rawSpec": "^1.0.0", + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/gulp-sourcemaps" + ], + "_resolved": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz", + "_shasum": "5c88036cf565e5df05558bfc911f8656df218884", + "_shrinkwrap": null, + "_spec": "vinyl@^1.0.0", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp-sourcemaps", + "author": { + "name": "Fractal", + "email": "contact@wearefractal.com", + "url": "http://wearefractal.com/" + }, + "bugs": { + "url": "https://github.com/gulpjs/vinyl/issues" + }, + "dependencies": { + "clone": "^1.0.0", + "clone-stats": "^0.0.1", + "replace-ext": "0.0.1" + }, + "description": "A virtual file format", + "devDependencies": { + "buffer-equal": "0.0.1", + "eslint": "^1.7.3", + "eslint-config-gulp": "^2.0.0", + "event-stream": "^3.1.0", + "github-changes": "^1.0.1", + "istanbul": "^0.3.0", + "istanbul-coveralls": "^1.0.1", + "jscs": "^2.3.5", + "jscs-preset-gulp": "^1.0.0", + "lodash.templatesettings": "^3.1.0", + "mocha": "^2.0.0", + "rimraf": "^2.2.5", + "should": "^7.0.0" + }, + "directories": {}, + "dist": { + "shasum": "5c88036cf565e5df05558bfc911f8656df218884", + "tarball": "https://registry.npmjs.org/vinyl/-/vinyl-1.2.0.tgz" + }, + "engines": { + "node": ">= 0.9" + }, + "files": [ + "index.js", + "lib" + ], + "gitHead": "ba3670add1f2f52827e3807b8783159f30ba4606", + "homepage": "http://github.com/gulpjs/vinyl", + "license": "MIT", + "main": "./index.js", + "maintainers": [ + { + "name": "contra", + "email": "contra@wearefractal.com" + }, + { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + { + "name": "phated", + "email": "blaine.bublitz@gmail.com" + } + ], + "name": "vinyl", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/gulpjs/vinyl.git" + }, + "scripts": { + "changelog": "github-changes -o gulpjs -r vinyl -b master -f ./CHANGELOG.md --order-semver --use-commit-body", + "coveralls": "istanbul cover _mocha && istanbul-coveralls", + "lint": "eslint . && jscs *.js lib/ test/", + "pretest": "npm run lint", + "test": "mocha" + }, + "version": "1.2.0" +} diff --git a/node_modules/gulp-sourcemaps/package.json b/node_modules/gulp-sourcemaps/package.json new file mode 100644 index 000000000..a22bc2583 --- /dev/null +++ b/node_modules/gulp-sourcemaps/package.json @@ -0,0 +1,111 @@ +{ + "_args": [ + [ + { + "raw": "gulp-sourcemaps@^1.5.2", + "scope": null, + "escapedName": "gulp-sourcemaps", + "name": "gulp-sourcemaps", + "rawSpec": "^1.5.2", + "spec": ">=1.5.2 <2.0.0", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/vinyl-fs" + ] + ], + "_from": "gulp-sourcemaps@>=1.5.2 <2.0.0", + "_id": "gulp-sourcemaps@1.6.0", + "_inCache": true, + "_location": "/gulp-sourcemaps", + "_nodeVersion": "4.1.1", + "_npmUser": { + "name": "floridoo", + "email": "florian.reiterer@gmail.com" + }, + "_npmVersion": "3.3.4", + "_phantomChildren": { + "clone": "1.0.2", + "clone-stats": "0.0.1", + "replace-ext": "0.0.1" + }, + "_requested": { + "raw": "gulp-sourcemaps@^1.5.2", + "scope": null, + "escapedName": "gulp-sourcemaps", + "name": "gulp-sourcemaps", + "rawSpec": "^1.5.2", + "spec": ">=1.5.2 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/vinyl-fs" + ], + "_resolved": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz", + "_shasum": "b86ff349d801ceb56e1d9e7dc7bbcb4b7dee600c", + "_shrinkwrap": null, + "_spec": "gulp-sourcemaps@^1.5.2", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/vinyl-fs", + "author": { + "name": "Florian Reiterer", + "email": "me@florianreiterer.com" + }, + "bugs": { + "url": "https://github.com/floridoo/gulp-sourcemaps/issues" + }, + "dependencies": { + "convert-source-map": "^1.1.1", + "graceful-fs": "^4.1.2", + "strip-bom": "^2.0.0", + "through2": "^2.0.0", + "vinyl": "^1.0.0" + }, + "description": "Source map support for Gulp.js", + "devDependencies": { + "coveralls": "^2.11.4", + "faucet": "0.0.1", + "istanbul": "^0.3.21", + "jshint": "^2.8.0", + "tape": "^4.2.0" + }, + "directories": {}, + "dist": { + "shasum": "b86ff349d801ceb56e1d9e7dc7bbcb4b7dee600c", + "tarball": "https://registry.npmjs.org/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz" + }, + "files": [ + "index.js", + "package.json", + "README.md", + "LICENSE.md" + ], + "gitHead": "cddce0d57e462b89b7d7f7c1d1864ad2784d17ef", + "homepage": "http://github.com/floridoo/gulp-sourcemaps", + "keywords": [ + "gulpplugin", + "gulp", + "source maps", + "sourcemaps" + ], + "license": "ISC", + "main": "index.js", + "maintainers": [ + { + "name": "floridoo", + "email": "florian.reiterer@gmail.com" + } + ], + "name": "gulp-sourcemaps", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/floridoo/gulp-sourcemaps.git" + }, + "scripts": { + "cover": "istanbul cover --dir reports/coverage tape \"test/*.js\"", + "coveralls": "istanbul cover tape \"test/*.js\" --report lcovonly && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", + "tap": "tape test/*.js", + "test": "jshint *.js test/*.js && faucet test/*.js" + }, + "version": "1.6.0" +} |