Demo for query storing
Change-Id: I947bcac841992c3f6cfd01ab337c265b0d01cb70
diff --git a/node_modules/vinyl-fs/LICENSE b/node_modules/vinyl-fs/LICENSE
new file mode 100644
index 0000000..6355a4b
--- /dev/null
+++ b/node_modules/vinyl-fs/LICENSE
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2013-2017 Blaine Bublitz <blaine.bublitz@gmail.com>, Eric Schoffstall <yo@contra.io> and other contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/node_modules/vinyl-fs/README.md b/node_modules/vinyl-fs/README.md
new file mode 100644
index 0000000..786ad1b
--- /dev/null
+++ b/node_modules/vinyl-fs/README.md
@@ -0,0 +1,341 @@
+<p align="center">
+ <a href="http://gulpjs.com">
+ <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
+ </a>
+</p>
+
+# vinyl-fs
+
+[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
+
+[Vinyl][vinyl] adapter for the file system.
+
+## What is Vinyl?
+
+[Vinyl][vinyl] is a very simple metadata object that describes a file. When you think of a file, two attributes come to mind: `path` and `contents`. These are the main attributes on a [Vinyl][vinyl] object. A file does not necessarily represent something on your computer’s file system. You have files on S3, FTP, Dropbox, Box, CloudThingly.io and other services. [Vinyl][vinyl] can be used to describe files from all of these sources.
+
+## What is a Vinyl Adapter?
+
+While Vinyl provides a clean way to describe a file, we now need a way to access these files. Each file source needs what we call a "Vinyl adapter". A Vinyl adapter simply exposes a `src(globs)` and a `dest(folder)` method. Each return a stream. The `src` stream produces Vinyl objects, and the `dest` stream consumes Vinyl objects. Vinyl adapters can expose extra methods that might be specific to their input/output medium, such as the `symlink` method `vinyl-fs` provides.
+
+## Usage
+
+```javascript
+var map = require('map-stream');
+var vfs = require('vinyl-fs');
+
+var log = function(file, cb) {
+ console.log(file.path);
+ cb(null, file);
+};
+
+vfs.src(['./js/**/*.js', '!./js/vendor/*.js'])
+ .pipe(map(log))
+ .pipe(vfs.dest('./output'));
+```
+
+## API
+
+### `src(globs[, options])`
+
+Takes a glob string or an array of glob strings as the first argument and an options object as the second.
+Returns a stream of [vinyl] `File` objects.
+
+__Note: UTF-8 BOM will be removed from all UTF-8 files read with `.src` unless disabled in the options.__
+
+#### Globs
+
+Globs are executed in order, so negations should follow positive globs.
+
+For example:
+
+```js
+fs.src(['!b*', '*'])
+```
+
+would not exclude any files, but the following would exclude all files starting with "b":
+
+```js
+fs.src(['*', '!b*'])
+```
+
+#### Options
+
+- Values passed to the options must be of the expected type, otherwise they will be ignored.
+- All options can be passed a function instead of a value. The function will be called with the [vinyl] `File` object as its only argument and must return a value of the expected type for that option.
+
+##### `options.buffer`
+
+Whether or not you want to buffer the file contents into memory. Setting to `false` will make `file.contents` a paused Stream.
+
+Type: `Boolean`
+
+Default: `true`
+
+##### `options.read`
+
+Whether or not you want the file to be read at all. Useful for stuff like removing files. Setting to `false` will make `file.contents = null` and will disable writing the file to disk via `.dest()`.
+
+Type: `Boolean`
+
+Default: `true`
+
+##### `options.since`
+
+Only streams files that have been modified since the time specified.
+
+Type: `Date` or `Number`
+
+Default: `undefined`
+
+##### `options.removeBOM`
+
+Causes the BOM to be removed on UTF-8 encoded files. Set to `false` if you need the BOM for some reason.
+
+Type: `Boolean`
+
+Default: `true`
+
+##### `options.sourcemaps`
+
+Enables sourcemap support on files passed through the stream. Will load inline sourcemaps and resolve sourcemap links from files.
+
+Type: `Boolean`
+
+Default: `false`
+
+##### `options.resolveSymlinks`
+
+Whether or not to recursively resolve symlinks to their targets. Set to `false` to preserve them as symlinks and make `file.symlink` equal the original symlink's target path.
+
+Type: `Boolean`
+
+Default: `true`
+
+##### `options.dot`
+
+Whether or not you want globs to match on dot files (e.g. `.gitignore`).
+
+__Note: This option is not resolved from a function because it is passed verbatim to node-glob.__
+
+Type: `Boolean`
+
+Default: `false`
+
+##### other
+
+Any glob-related options are documented in [glob-stream] and [node-glob] and are forwarded verbatim.
+
+### `dest(folder[, options])`
+
+Takes a folder path string or a function as the first argument and an options object as the second. If given a function, it will be called with each [vinyl] `File` object and must return a folder path.
+Returns a stream that accepts [vinyl] `File` objects, writes them to disk at the folder/cwd specified, and passes them downstream so you can keep piping these around.
+
+Once the file is written to disk, an attempt is made to determine if the `stat.mode`, `stat.mtime` and `stat.atime` of the [vinyl] `File` object differ from the file on the filesystem.
+If they differ and the running process owns the file, the corresponding filesystem metadata is updated.
+If they don't differ or the process doesn't own the file, the attempt is skipped silently.
+__This functionality is disabled on Windows operating systems or any other OS that doesn't support `process.getuid` or `process.geteuid` in node. This is due to Windows having very unexpected results through usage of `fs.fchmod` and `fs.futimes`.__
+
+__Note: The `fs.futimes()` method internally converts `stat.mtime` and `stat.atime` timestamps to seconds; this division by `1000` may cause some loss of precision in 32-bit Node.js.__
+
+If the file has a `symlink` attribute specifying a target path, then a symlink will be created.
+
+__Note: The file will be modified after being written to this stream.__
+ - `cwd`, `base`, and `path` will be overwritten to match the folder.
+ - `stat` will be updated to match the file on the filesystem.
+ - `contents` will have it's position reset to the beginning if it is a stream.
+
+#### Options
+
+- Values passed to the options must be of the expected type, otherwise they will be ignored.
+- All options can be passed a function instead of a value. The function will be called with the [vinyl] `File` object as its only argument and must return a value of the expected type for that option.
+
+##### `options.cwd`
+
+The working directory the folder is relative to.
+
+Type: `String`
+
+Default: `process.cwd()`
+
+##### `options.mode`
+
+The mode the files should be created with. This option is only resolved if the [vinyl] `File` is not symbolic.
+
+Type: `Number`
+
+Default: The `mode` of the input file (`file.stat.mode`) if any, or the process mode if the input file has no `mode` property.
+
+##### `options.dirMode`
+
+The mode directories should be created with.
+
+Type: `Number`
+
+Default: The process `mode`.
+
+##### `options.overwrite`
+
+Whether or not existing files with the same path should be overwritten.
+
+Type: `Boolean`
+
+Default: `true` (always overwrite existing files)
+
+##### `options.append`
+
+Whether or not new data should be appended after existing file contents (if any).
+
+Type: `Boolean`
+
+Default: `false` (always replace existing contents, if any)
+
+##### `options.sourcemaps`
+
+Enables sourcemap support on files passed through the stream. Will write inline soucemaps if specified as `true`.
+Specifying a `String` path will write external sourcemaps at the given path.
+
+Examples:
+
+```js
+// Write as inline comments
+vfs.dest('./', { sourcemaps: true });
+
+// Write as files in the same folder
+vfs.dest('./', { sourcemaps: '.' });
+```
+
+Type: `Boolean` or `String`
+
+Default: `undefined` (do not write sourcemaps)
+
+##### `options.relativeSymlinks`
+
+When creating a symlink, whether or not the created symlink should be relative. If `false`, the symlink will be absolute.
+
+__Note: This option will be ignored if a `junction` is being created, as they must be absolute.__
+
+Type: `Boolean`
+
+Default: `false`
+
+##### `options.useJunctions`
+
+When creating a symlink, whether or not a directory symlink should be created as a `junction`.
+This option is only relevant on Windows and ignored elsewhere. Please refer to the [Symbolic Links on Windows][symbolic-caveats] section below.
+
+Type: `Boolean`
+
+Default: `true`
+
+### `symlink(folder[, options])`
+
+Takes a folder path string or a function as the first argument and an options object as the second. If given a function, it will be called with each [vinyl] `File` object and must return a folder path.
+Returns a stream that accepts [vinyl] `File` objects, creates a symbolic link (i.e. symlink) at the folder/cwd specified, and passes them downstream so you can keep piping these around.
+
+__Note: The file will be modified after being written to this stream.__
+ - `cwd`, `base`, and `path` will be overwritten to match the folder.
+ - `stat` will be updated to match the symlink on the filesystem.
+ - `contents` will be set to `null`.
+ - `symlink` will be added or replaced to be the original path.
+
+__Note: On Windows, directory links are created using Junctions by default. Use the `useJunctions` option to disable this behavior.__
+
+#### Options
+
+- Values passed to the options must be of the expected type, otherwise they will be ignored.
+- All options can be passed a function instead of a value. The function will be called with the [vinyl] `File` object as its only argument and must return a value of the expected type for that option.
+
+##### `options.cwd`
+
+The working directory the folder is relative to.
+
+Type: `String`
+
+Default: `process.cwd()`
+
+##### `options.dirMode`
+
+The mode directories should be created with.
+
+Type: `Number`
+
+Default: The process mode.
+
+##### `options.overwrite`
+
+Whether or not existing files with the same path should be overwritten.
+
+Type: `Boolean`
+
+Default: `true` (always overwrite existing files)
+
+##### `options.relativeSymlinks`
+
+Whether or not the created symlinks should be relative. If `false`, the symlink will be absolute.
+
+__Note: This option will be ignored if a `junction` is being created, as they must be absolute.__
+
+Type: `Boolean`
+
+Default: `false`
+
+##### `options.useJunctions`
+
+When creating a symlink, whether or not a directory symlink should be created as a `junction`.
+This option is only relevant on Windows and ignored elsewhere. Please refer to the [Symbolic Links on Windows][symbolic-caveats] section below.
+
+Type: `Boolean`
+
+Default: `true`
+
+#### Symbolic Links on Windows
+
+When creating symbolic links on Windows, we pass a `type` argument to Node's
+`fs` module which specifies the kind of target we link to (one of `'file'`,
+`'dir'` or `'junction'`). Specifically, this will be `'file'` when the target
+is a regular file, `'junction'` if the target is a directory, or `'dir'` if
+the target is a directory and the user overrides the `useJunctions` option
+default.
+
+However, if the user tries to make a "dangling" link (pointing to a non-existent
+target) we won't be able to determine automatically which type we should use.
+In these cases, `vinyl-fs` will behave slightly differently depending on
+whether the dangling link is being created via `symlink()` or via `dest()`.
+
+For dangling links created via `symlink()`, the incoming vinyl represents the
+target and so we will look to its stats to guess the desired type. In
+particular, if `isDirectory()` returns false then we'll create a `'file'` type
+link, otherwise we will create a `'junction'` or a `'dir'` type link depending
+on the value of the `useJunctions` option.
+
+For dangling links created via `dest()`, the incoming vinyl represents the link -
+typically read off disk via `src()` with the `resolveSymlinks` option set to
+false. In this case, we won't be able to make any reasonable guess as to the
+type of link and we default to using `'file'`, which may cause unexpected behavior
+if you are creating a "dangling" link to a directory. It is advised to avoid this
+scenario.
+
+
+[symbolic-caveats]: #symbolic-links-on-windows
+[glob-stream]: https://github.com/gulpjs/glob-stream
+[node-glob]: https://github.com/isaacs/node-glob
+[gaze]: https://github.com/shama/gaze
+[glob-watcher]: https://github.com/wearefractal/glob-watcher
+[vinyl]: https://github.com/wearefractal/vinyl
+
+[downloads-image]: http://img.shields.io/npm/dm/vinyl-fs.svg
+[npm-url]: https://www.npmjs.com/package/vinyl-fs
+[npm-image]: http://img.shields.io/npm/v/vinyl-fs.svg
+
+[travis-url]: https://travis-ci.org/gulpjs/vinyl-fs
+[travis-image]: http://img.shields.io/travis/gulpjs/vinyl-fs.svg?label=travis-ci
+
+[appveyor-url]: https://ci.appveyor.com/project/gulpjs/vinyl-fs
+[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/vinyl-fs.svg?label=appveyor
+
+[coveralls-url]: https://coveralls.io/r/gulpjs/vinyl-fs
+[coveralls-image]: http://img.shields.io/coveralls/gulpjs/vinyl-fs/master.svg
+
+[gitter-url]: https://gitter.im/gulpjs/gulp
+[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
diff --git a/node_modules/vinyl-fs/index.js b/node_modules/vinyl-fs/index.js
new file mode 100644
index 0000000..acdeac2
--- /dev/null
+++ b/node_modules/vinyl-fs/index.js
@@ -0,0 +1,7 @@
+'use strict';
+
+module.exports = {
+ src: require('./lib/src'),
+ dest: require('./lib/dest'),
+ symlink: require('./lib/symlink'),
+};
diff --git a/node_modules/vinyl-fs/lib/constants.js b/node_modules/vinyl-fs/lib/constants.js
new file mode 100644
index 0000000..f0c2825
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/constants.js
@@ -0,0 +1,6 @@
+'use strict';
+
+module.exports = {
+ MASK_MODE: parseInt('7777', 8),
+ DEFAULT_FILE_MODE: parseInt('0666', 8),
+};
diff --git a/node_modules/vinyl-fs/lib/dest/index.js b/node_modules/vinyl-fs/lib/dest/index.js
new file mode 100644
index 0000000..f45dd61
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/index.js
@@ -0,0 +1,45 @@
+'use strict';
+
+var lead = require('lead');
+var pumpify = require('pumpify');
+var mkdirpStream = require('fs-mkdirp-stream');
+var createResolver = require('resolve-options');
+
+var config = require('./options');
+var prepare = require('./prepare');
+var sourcemap = require('./sourcemap');
+var writeContents = require('./write-contents');
+
+var folderConfig = {
+ outFolder: {
+ type: 'string',
+ },
+};
+
+function dest(outFolder, opt) {
+ if (!outFolder) {
+ throw new Error('Invalid dest() folder argument.' +
+ ' Please specify a non-empty string or a function.');
+ }
+
+ var optResolver = createResolver(config, opt);
+ var folderResolver = createResolver(folderConfig, { outFolder: outFolder });
+
+ function dirpath(file, callback) {
+ var dirMode = optResolver.resolve('dirMode', file);
+
+ callback(null, file.dirname, dirMode);
+ }
+
+ var saveStream = pumpify.obj(
+ prepare(folderResolver, optResolver),
+ sourcemap(optResolver),
+ mkdirpStream.obj(dirpath),
+ writeContents(optResolver)
+ );
+
+ // Sink the output stream to start flowing
+ return lead(saveStream);
+}
+
+module.exports = dest;
diff --git a/node_modules/vinyl-fs/lib/dest/options.js b/node_modules/vinyl-fs/lib/dest/options.js
new file mode 100644
index 0000000..d8c6d76
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/options.js
@@ -0,0 +1,41 @@
+'use strict';
+
+var config = {
+ cwd: {
+ type: 'string',
+ default: process.cwd,
+ },
+ mode: {
+ type: 'number',
+ default: function(file) {
+ return file.stat ? file.stat.mode : null;
+ },
+ },
+ dirMode: {
+ type: 'number',
+ },
+ overwrite: {
+ type: 'boolean',
+ default: true,
+ },
+ append: {
+ type: 'boolean',
+ default: false,
+ },
+ sourcemaps: {
+ type: ['string', 'boolean'],
+ default: false,
+ },
+ // Symlink options
+ relativeSymlinks: {
+ type: 'boolean',
+ default: false,
+ },
+ // This option is ignored on non-Windows platforms
+ useJunctions: {
+ type: 'boolean',
+ default: true,
+ },
+};
+
+module.exports = config;
diff --git a/node_modules/vinyl-fs/lib/dest/prepare.js b/node_modules/vinyl-fs/lib/dest/prepare.js
new file mode 100644
index 0000000..b3ea3d4
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/prepare.js
@@ -0,0 +1,48 @@
+'use strict';
+
+var path = require('path');
+
+var fs = require('graceful-fs');
+var Vinyl = require('vinyl');
+var through = require('through2');
+
+function prepareWrite(folderResolver, optResolver) {
+ if (!folderResolver) {
+ throw new Error('Invalid output folder');
+ }
+
+ function normalize(file, enc, cb) {
+ if (!Vinyl.isVinyl(file)) {
+ return cb(new Error('Received a non-Vinyl object in `dest()`'));
+ }
+
+ // TODO: Remove this after people upgrade vinyl/transition from gulp-util
+ if (typeof file.isSymbolic !== 'function') {
+ file = new Vinyl(file);
+ }
+
+ var outFolderPath = folderResolver.resolve('outFolder', file);
+ if (!outFolderPath) {
+ return cb(new Error('Invalid output folder'));
+ }
+ var cwd = path.resolve(optResolver.resolve('cwd', file));
+ var basePath = path.resolve(cwd, outFolderPath);
+ var writePath = path.resolve(basePath, file.relative);
+
+ // Wire up new properties
+ file.cwd = cwd;
+ file.base = basePath;
+ file.path = writePath;
+ if (!file.isSymbolic()) {
+ var mode = optResolver.resolve('mode', file);
+ file.stat = (file.stat || new fs.Stats());
+ file.stat.mode = mode;
+ }
+
+ cb(null, file);
+ }
+
+ return through.obj(normalize);
+}
+
+module.exports = prepareWrite;
diff --git a/node_modules/vinyl-fs/lib/dest/sourcemap.js b/node_modules/vinyl-fs/lib/dest/sourcemap.js
new file mode 100644
index 0000000..c6a8961
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/sourcemap.js
@@ -0,0 +1,38 @@
+'use strict';
+
+var through = require('through2');
+var sourcemap = require('vinyl-sourcemap');
+
+function sourcemapStream(optResolver) {
+
+ function saveSourcemap(file, enc, callback) {
+ var self = this;
+
+ var srcMap = optResolver.resolve('sourcemaps', file);
+
+ if (!srcMap) {
+ return callback(null, file);
+ }
+
+ var srcMapLocation = (typeof srcMap === 'string' ? srcMap : undefined);
+
+ sourcemap.write(file, srcMapLocation, onWrite);
+
+ function onWrite(sourcemapErr, updatedFile, sourcemapFile) {
+ if (sourcemapErr) {
+ return callback(sourcemapErr);
+ }
+
+ self.push(updatedFile);
+ if (sourcemapFile) {
+ self.push(sourcemapFile);
+ }
+
+ callback();
+ }
+ }
+
+ return through.obj(saveSourcemap);
+}
+
+module.exports = sourcemapStream;
diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/index.js b/node_modules/vinyl-fs/lib/dest/write-contents/index.js
new file mode 100644
index 0000000..202a95f
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/write-contents/index.js
@@ -0,0 +1,59 @@
+'use strict';
+
+var through = require('through2');
+
+var writeDir = require('./write-dir');
+var writeStream = require('./write-stream');
+var writeBuffer = require('./write-buffer');
+var writeSymbolicLink = require('./write-symbolic-link');
+
+var fo = require('../../file-operations');
+
+function writeContents(optResolver) {
+
+ function writeFile(file, enc, callback) {
+ // Write it as a symlink
+ if (file.isSymbolic()) {
+ return writeSymbolicLink(file, optResolver, onWritten);
+ }
+
+ // If directory then mkdirp it
+ if (file.isDirectory()) {
+ return writeDir(file, optResolver, onWritten);
+ }
+
+ // Stream it to disk yo
+ if (file.isStream()) {
+ return writeStream(file, optResolver, onWritten);
+ }
+
+ // Write it like normal
+ if (file.isBuffer()) {
+ return writeBuffer(file, optResolver, onWritten);
+ }
+
+ // If no contents then do nothing
+ if (file.isNull()) {
+ return onWritten();
+ }
+
+ // This is invoked by the various writeXxx modules when they've finished
+ // writing the contents.
+ function onWritten(writeErr) {
+ var flags = fo.getFlags({
+ overwrite: optResolver.resolve('overwrite', file),
+ append: optResolver.resolve('append', file),
+ });
+ if (fo.isFatalOverwriteError(writeErr, flags)) {
+ return callback(writeErr);
+ }
+
+ callback(null, file);
+ }
+
+ }
+
+ return through.obj(writeFile);
+}
+
+module.exports = writeContents;
diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js b/node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js
new file mode 100644
index 0000000..794869e
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js
@@ -0,0 +1,31 @@
+'use strict';
+
+var fo = require('../../file-operations');
+
+function writeBuffer(file, optResolver, onWritten) {
+ var flags = fo.getFlags({
+ overwrite: optResolver.resolve('overwrite', file),
+ append: optResolver.resolve('append', file),
+ });
+ var opt = {
+ mode: file.stat.mode,
+ flags: flags,
+ };
+
+ fo.writeFile(file.path, file.contents, opt, onWriteFile);
+
+ function onWriteFile(writeErr, fd) {
+ if (writeErr) {
+ return fo.closeFd(writeErr, fd, onWritten);
+ }
+
+ fo.updateMetadata(fd, file, onUpdate);
+
+ function onUpdate(updateErr) {
+ fo.closeFd(updateErr, fd, onWritten);
+ }
+ }
+
+}
+
+module.exports = writeBuffer;
diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js b/node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js
new file mode 100644
index 0000000..d182728
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js
@@ -0,0 +1,51 @@
+'use strict';
+
+var fs = require('graceful-fs');
+
+var mkdirp = require('fs-mkdirp-stream/mkdirp');
+
+var fo = require('../../file-operations');
+
+function writeDir(file, optResolver, onWritten) {
+ mkdirp(file.path, file.stat.mode, onMkdirp);
+
+ function onMkdirp(mkdirpErr) {
+ if (mkdirpErr) {
+ return onWritten(mkdirpErr);
+ }
+
+ fs.open(file.path, 'r', onOpen);
+ }
+
+ function onOpen(openErr, fd) {
+ // If we don't have access, just move along
+ if (isInaccessible(openErr)) {
+ return fo.closeFd(null, fd, onWritten);
+ }
+
+ if (openErr) {
+ return fo.closeFd(openErr, fd, onWritten);
+ }
+
+ fo.updateMetadata(fd, file, onUpdate);
+
+ function onUpdate(updateErr) {
+ fo.closeFd(updateErr, fd, onWritten);
+ }
+ }
+
+}
+
+function isInaccessible(err) {
+ if (!err) {
+ return false;
+ }
+
+ if (err.code === 'EACCES') {
+ return true;
+ }
+
+ return false;
+}
+
+module.exports = writeDir;
diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js b/node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js
new file mode 100644
index 0000000..2a48304
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js
@@ -0,0 +1,62 @@
+'use strict';
+
+var fo = require('../../file-operations');
+var readStream = require('../../src/read-contents/read-stream');
+
+function writeStream(file, optResolver, onWritten) {
+ var flags = fo.getFlags({
+ overwrite: optResolver.resolve('overwrite', file),
+ append: optResolver.resolve('append', file),
+ });
+ var opt = {
+ mode: file.stat.mode,
+ // TODO: need to test this
+ flags: flags,
+ };
+
+ // TODO: is this the best API?
+ var outStream = fo.createWriteStream(file.path, opt, onFlush);
+
+ file.contents.once('error', onComplete);
+ outStream.once('error', onComplete);
+ outStream.once('finish', onComplete);
+
+ // TODO: should this use a clone?
+ file.contents.pipe(outStream);
+
+ function onComplete(streamErr) {
+ // Cleanup event handlers before closing
+ file.contents.removeListener('error', onComplete);
+ outStream.removeListener('error', onComplete);
+ outStream.removeListener('finish', onComplete);
+
+ // Need to guarantee the fd is closed before forwarding the error
+ outStream.once('close', onClose);
+ outStream.end();
+
+ function onClose(closeErr) {
+ onWritten(streamErr || closeErr);
+ }
+ }
+
+ // Cleanup
+ function onFlush(fd, callback) {
+ // TODO: removing this before readStream because it replaces the stream
+ file.contents.removeListener('error', onComplete);
+
+ // TODO: this is doing sync stuff & the callback seems unnecessary
+ // TODO: Replace the contents stream or use a clone?
+ readStream(file, complete);
+
+ function complete() {
+ if (typeof fd !== 'number') {
+ return callback();
+ }
+
+ fo.updateMetadata(fd, file, callback);
+ }
+ }
+
+}
+
+module.exports = writeStream;
diff --git a/node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js b/node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js
new file mode 100644
index 0000000..411a8bd
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js
@@ -0,0 +1,77 @@
+'use strict';
+
+var os = require('os');
+var path = require('path');
+
+var fo = require('../../file-operations');
+
+var isWindows = (os.platform() === 'win32');
+
+function writeSymbolicLink(file, optResolver, onWritten) {
+ if (!file.symlink) {
+ return onWritten(new Error('Missing symlink property on symbolic vinyl'));
+ }
+
+ var isRelative = optResolver.resolve('relativeSymlinks', file);
+ var flags = fo.getFlags({
+ overwrite: optResolver.resolve('overwrite', file),
+ append: optResolver.resolve('append', file),
+ });
+
+ if (!isWindows) {
+ // On non-Windows, just use 'file'
+ return createLinkWithType('file');
+ }
+
+ fo.reflectStat(file.symlink, file, onReflect);
+
+ function onReflect(statErr) {
+ if (statErr && statErr.code !== 'ENOENT') {
+ return onWritten(statErr);
+ }
+
+ // This option provides a way to create a Junction instead of a
+ // Directory symlink on Windows. This comes with the following caveats:
+ // * NTFS Junctions cannot be relative.
+ // * NTFS Junctions MUST be directories.
+ // * NTFS Junctions must be on the same file system.
+ // * Most products CANNOT detect a directory is a Junction:
+ // This has the side effect of possibly having a whole directory
+ // deleted when a product is deleting the Junction directory.
+ // For example, JetBrains product lines will delete the entire contents
+ // of the TARGET directory because the product does not realize it's
+ // a symlink as the JVM and Node return false for isSymlink.
+
+ // This function is Windows only, so we don't need to check again
+ var useJunctions = optResolver.resolve('useJunctions', file);
+
+ var dirType = useJunctions ? 'junction' : 'dir';
+ // Dangling links are always 'file'
+ var type = !statErr && file.isDirectory() ? dirType : 'file';
+
+ createLinkWithType(type);
+ }
+
+ function createLinkWithType(type) {
+ // This is done after prepare() to use the adjusted file.base property
+ if (isRelative && type !== 'junction') {
+ file.symlink = path.relative(file.base, file.symlink);
+ }
+
+ var opts = {
+ flags: flags,
+ type: type,
+ };
+ fo.symlink(file.symlink, file.path, opts, onSymlink);
+
+ function onSymlink(symlinkErr) {
+ if (symlinkErr) {
+ return onWritten(symlinkErr);
+ }
+
+ fo.reflectLinkStat(file.path, file, onWritten);
+ }
+ }
+}
+
+module.exports = writeSymbolicLink;
diff --git a/node_modules/vinyl-fs/lib/file-operations.js b/node_modules/vinyl-fs/lib/file-operations.js
new file mode 100644
index 0000000..b0aa31b
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/file-operations.js
@@ -0,0 +1,496 @@
+'use strict';
+
+var util = require('util');
+
+var fs = require('graceful-fs');
+var assign = require('object.assign');
+var date = require('value-or-function').date;
+var Writable = require('readable-stream').Writable;
+
+var constants = require('./constants');
+
+var APPEND_MODE_REGEXP = /a/;
+
+function closeFd(propagatedErr, fd, callback) {
+ if (typeof fd !== 'number') {
+ return callback(propagatedErr);
+ }
+
+ fs.close(fd, onClosed);
+
+ function onClosed(closeErr) {
+ if (propagatedErr || closeErr) {
+ return callback(propagatedErr || closeErr);
+ }
+
+ callback();
+ }
+}
+
+function isValidUnixId(id) {
+ if (typeof id !== 'number') {
+ return false;
+ }
+
+ if (id < 0) {
+ return false;
+ }
+
+ return true;
+}
+
+function getFlags(options) {
+ var flags = !options.append ? 'w' : 'a';
+ if (!options.overwrite) {
+ flags += 'x';
+ }
+ return flags;
+}
+
+function isFatalOverwriteError(err, flags) {
+ if (!err) {
+ return false;
+ }
+
+ if (err.code === 'EEXIST' && flags[1] === 'x') {
+ // Handle scenario for file overwrite failures.
+ return false;
+ }
+
+ // Otherwise, this is a fatal error
+ return true;
+}
+
+function isFatalUnlinkError(err) {
+ if (!err || err.code === 'ENOENT') {
+ return false;
+ }
+
+ return true;
+}
+
+function getModeDiff(fsMode, vinylMode) {
+ var modeDiff = 0;
+
+ if (typeof vinylMode === 'number') {
+ modeDiff = (vinylMode ^ fsMode) & constants.MASK_MODE;
+ }
+
+ return modeDiff;
+}
+
+function getTimesDiff(fsStat, vinylStat) {
+
+ var mtime = date(vinylStat.mtime) || 0;
+ if (!mtime) {
+ return;
+ }
+
+ var atime = date(vinylStat.atime) || 0;
+ if (+mtime === +fsStat.mtime &&
+ +atime === +fsStat.atime) {
+ return;
+ }
+
+ if (!atime) {
+ atime = date(fsStat.atime) || undefined;
+ }
+
+ var timesDiff = {
+ mtime: vinylStat.mtime,
+ atime: atime,
+ };
+
+ return timesDiff;
+}
+
+function getOwnerDiff(fsStat, vinylStat) {
+ if (!isValidUnixId(vinylStat.uid) &&
+ !isValidUnixId(vinylStat.gid)) {
+ return;
+ }
+
+ if ((!isValidUnixId(fsStat.uid) && !isValidUnixId(vinylStat.uid)) ||
+ (!isValidUnixId(fsStat.gid) && !isValidUnixId(vinylStat.gid))) {
+ return;
+ }
+
+ var uid = fsStat.uid; // Default to current uid.
+ if (isValidUnixId(vinylStat.uid)) {
+ uid = vinylStat.uid;
+ }
+
+ var gid = fsStat.gid; // Default to current gid.
+ if (isValidUnixId(vinylStat.gid)) {
+ gid = vinylStat.gid;
+ }
+
+ if (uid === fsStat.uid &&
+ gid === fsStat.gid) {
+ return;
+ }
+
+ var ownerDiff = {
+ uid: uid,
+ gid: gid,
+ };
+
+ return ownerDiff;
+}
+
+function isOwner(fsStat) {
+ var hasGetuid = (typeof process.getuid === 'function');
+ var hasGeteuid = (typeof process.geteuid === 'function');
+
+ // If we don't have either, assume we don't have permissions.
+ // This should only happen on Windows.
+ // Windows basically noops fchmod and errors on futimes called on directories.
+ if (!hasGeteuid && !hasGetuid) {
+ return false;
+ }
+
+ var uid;
+ if (hasGeteuid) {
+ uid = process.geteuid();
+ } else {
+ uid = process.getuid();
+ }
+
+ if (fsStat.uid !== uid && uid !== 0) {
+ return false;
+ }
+
+ return true;
+}
+
+function reflectStat(path, file, callback) {
+ // Set file.stat to the reflect current state on disk
+ fs.stat(path, onStat);
+
+ function onStat(statErr, stat) {
+ if (statErr) {
+ return callback(statErr);
+ }
+
+ file.stat = stat;
+ callback();
+ }
+}
+
+function reflectLinkStat(path, file, callback) {
+ // Set file.stat to the reflect current state on disk
+ fs.lstat(path, onLstat);
+
+ function onLstat(lstatErr, stat) {
+ if (lstatErr) {
+ return callback(lstatErr);
+ }
+
+ file.stat = stat;
+ callback();
+ }
+}
+
+function updateMetadata(fd, file, callback) {
+
+ fs.fstat(fd, onStat);
+
+ function onStat(statErr, stat) {
+ if (statErr) {
+ return callback(statErr);
+ }
+
+ // Check if mode needs to be updated
+ var modeDiff = getModeDiff(stat.mode, file.stat.mode);
+
+ // Check if atime/mtime need to be updated
+ var timesDiff = getTimesDiff(stat, file.stat);
+
+ // Check if uid/gid need to be updated
+ var ownerDiff = getOwnerDiff(stat, file.stat);
+
+ // Set file.stat to the reflect current state on disk
+ assign(file.stat, stat);
+
+ // Nothing to do
+ if (!modeDiff && !timesDiff && !ownerDiff) {
+ return callback();
+ }
+
+ // Check access, `futimes`, `fchmod` & `fchown` only work if we own
+ // the file, or if we are effectively root (`fchown` only when root).
+ if (!isOwner(stat)) {
+ return callback();
+ }
+
+ if (modeDiff) {
+ return mode();
+ }
+ if (timesDiff) {
+ return times();
+ }
+ owner();
+
+ function mode() {
+ var mode = stat.mode ^ modeDiff;
+
+ fs.fchmod(fd, mode, onFchmod);
+
+ function onFchmod(fchmodErr) {
+ if (!fchmodErr) {
+ file.stat.mode = mode;
+ }
+ if (timesDiff) {
+ return times(fchmodErr);
+ }
+ if (ownerDiff) {
+ return owner(fchmodErr);
+ }
+ callback(fchmodErr);
+ }
+ }
+
+ function times(propagatedErr) {
+ fs.futimes(fd, timesDiff.atime, timesDiff.mtime, onFutimes);
+
+ function onFutimes(futimesErr) {
+ if (!futimesErr) {
+ file.stat.atime = timesDiff.atime;
+ file.stat.mtime = timesDiff.mtime;
+ }
+ if (ownerDiff) {
+ return owner(propagatedErr || futimesErr);
+ }
+ callback(propagatedErr || futimesErr);
+ }
+ }
+
+ function owner(propagatedErr) {
+ fs.fchown(fd, ownerDiff.uid, ownerDiff.gid, onFchown);
+
+ function onFchown(fchownErr) {
+ if (!fchownErr) {
+ file.stat.uid = ownerDiff.uid;
+ file.stat.gid = ownerDiff.gid;
+ }
+ callback(propagatedErr || fchownErr);
+ }
+ }
+ }
+}
+
+function symlink(srcPath, destPath, opts, callback) {
+ // Because fs.symlink does not allow atomic overwrite option with flags, we
+ // delete and recreate if the link already exists and overwrite is true.
+ if (opts.flags === 'w') {
+ // TODO What happens when we call unlink with windows junctions?
+ fs.unlink(destPath, onUnlink);
+ } else {
+ fs.symlink(srcPath, destPath, opts.type, onSymlink);
+ }
+
+ function onUnlink(unlinkErr) {
+ if (isFatalUnlinkError(unlinkErr)) {
+ return callback(unlinkErr);
+ }
+ fs.symlink(srcPath, destPath, opts.type, onSymlink);
+ }
+
+ function onSymlink(symlinkErr) {
+ if (isFatalOverwriteError(symlinkErr, opts.flags)) {
+ return callback(symlinkErr);
+ }
+ callback();
+ }
+}
+
+/*
+ Custom writeFile implementation because we need access to the
+ file descriptor after the write is complete.
+ Most of the implementation taken from node core.
+ */
+function writeFile(filepath, data, options, callback) {
+ if (typeof options === 'function') {
+ callback = options;
+ options = {};
+ }
+
+ if (!Buffer.isBuffer(data)) {
+ return callback(new TypeError('Data must be a Buffer'));
+ }
+
+ if (!options) {
+ options = {};
+ }
+
+ // Default the same as node
+ var mode = options.mode || constants.DEFAULT_FILE_MODE;
+ var flags = options.flags || 'w';
+ var position = APPEND_MODE_REGEXP.test(flags) ? null : 0;
+
+ fs.open(filepath, flags, mode, onOpen);
+
+ function onOpen(openErr, fd) {
+ if (openErr) {
+ return onComplete(openErr);
+ }
+
+ fs.write(fd, data, 0, data.length, position, onComplete);
+
+ function onComplete(writeErr) {
+ callback(writeErr, fd);
+ }
+ }
+}
+
+function createWriteStream(path, options, flush) {
+ return new WriteStream(path, options, flush);
+}
+
+// Taken from node core and altered to receive a flush function and simplified
+// To be used for cleanup (like updating times/mode/etc)
+function WriteStream(path, options, flush) {
+ // Not exposed so we can avoid the case where someone doesn't use `new`
+
+ if (typeof options === 'function') {
+ flush = options;
+ options = null;
+ }
+
+ options = options || {};
+
+ Writable.call(this, options);
+
+ this.flush = flush;
+ this.path = path;
+
+ this.mode = options.mode || constants.DEFAULT_FILE_MODE;
+ this.flags = options.flags || 'w';
+
+ // Used by node's `fs.WriteStream`
+ this.fd = null;
+ this.start = null;
+
+ this.open();
+
+ // Dispose on finish.
+ this.once('finish', this.close);
+}
+
+util.inherits(WriteStream, Writable);
+
+WriteStream.prototype.open = function() {
+ var self = this;
+
+ fs.open(this.path, this.flags, this.mode, onOpen);
+
+ function onOpen(openErr, fd) {
+ if (openErr) {
+ self.destroy();
+ self.emit('error', openErr);
+ return;
+ }
+
+ self.fd = fd;
+ self.emit('open', fd);
+ }
+};
+
+// Use our `end` method since it is patched for flush
+WriteStream.prototype.destroySoon = WriteStream.prototype.end;
+
+WriteStream.prototype._destroy = function(err, cb) {
+ this.close(function(err2) {
+ cb(err || err2);
+ });
+};
+
+WriteStream.prototype.close = function(cb) {
+ var that = this;
+
+ if (cb) {
+ this.once('close', cb);
+ }
+
+ if (this.closed || typeof this.fd !== 'number') {
+ if (typeof this.fd !== 'number') {
+ this.once('open', closeOnOpen);
+ return;
+ }
+
+ return process.nextTick(function() {
+ that.emit('close');
+ });
+ }
+
+ this.closed = true;
+
+ fs.close(this.fd, function(er) {
+ if (er) {
+ that.emit('error', er);
+ } else {
+ that.emit('close');
+ }
+ });
+
+ this.fd = null;
+};
+
+WriteStream.prototype._final = function(callback) {
+ if (typeof this.flush !== 'function') {
+ return callback();
+ }
+
+ this.flush(this.fd, callback);
+};
+
+function closeOnOpen() {
+ this.close();
+}
+
+WriteStream.prototype._write = function(data, encoding, callback) {
+ var self = this;
+
+ // This is from node core but I have no idea how to get code coverage on it
+ if (!Buffer.isBuffer(data)) {
+ return this.emit('error', new Error('Invalid data'));
+ }
+
+ if (typeof this.fd !== 'number') {
+ return this.once('open', onOpen);
+ }
+
+ fs.write(this.fd, data, 0, data.length, null, onWrite);
+
+ function onOpen() {
+ self._write(data, encoding, callback);
+ }
+
+ function onWrite(writeErr) {
+ if (writeErr) {
+ self.destroy();
+ callback(writeErr);
+ return;
+ }
+
+ callback();
+ }
+};
+
+module.exports = {
+ closeFd: closeFd,
+ isValidUnixId: isValidUnixId,
+ getFlags: getFlags,
+ isFatalOverwriteError: isFatalOverwriteError,
+ isFatalUnlinkError: isFatalUnlinkError,
+ getModeDiff: getModeDiff,
+ getTimesDiff: getTimesDiff,
+ getOwnerDiff: getOwnerDiff,
+ isOwner: isOwner,
+ reflectStat: reflectStat,
+ reflectLinkStat: reflectLinkStat,
+ updateMetadata: updateMetadata,
+ symlink: symlink,
+ writeFile: writeFile,
+ createWriteStream: createWriteStream,
+};
diff --git a/node_modules/vinyl-fs/lib/src/index.js b/node_modules/vinyl-fs/lib/src/index.js
new file mode 100644
index 0000000..6f531ce
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/index.js
@@ -0,0 +1,38 @@
+'use strict';
+
+var gs = require('glob-stream');
+var pumpify = require('pumpify');
+var toThrough = require('to-through');
+var isValidGlob = require('is-valid-glob');
+var createResolver = require('resolve-options');
+
+var config = require('./options');
+var prepare = require('./prepare');
+var wrapVinyl = require('./wrap-vinyl');
+var sourcemap = require('./sourcemap');
+var readContents = require('./read-contents');
+var resolveSymlinks = require('./resolve-symlinks');
+
+function src(glob, opt) {
+ var optResolver = createResolver(config, opt);
+
+ if (!isValidGlob(glob)) {
+ throw new Error('Invalid glob argument: ' + glob);
+ }
+
+ var streams = [
+ gs(glob, opt),
+ wrapVinyl(optResolver),
+ resolveSymlinks(optResolver),
+ prepare(optResolver),
+ readContents(optResolver),
+ sourcemap(optResolver),
+ ];
+
+ var outputStream = pumpify.obj(streams);
+
+ return toThrough(outputStream);
+}
+
+
+module.exports = src;
diff --git a/node_modules/vinyl-fs/lib/src/options.js b/node_modules/vinyl-fs/lib/src/options.js
new file mode 100644
index 0000000..2d9861c
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/options.js
@@ -0,0 +1,29 @@
+'use strict';
+
+var config = {
+ buffer: {
+ type: 'boolean',
+ default: true,
+ },
+ read: {
+ type: 'boolean',
+ default: true,
+ },
+ since: {
+ type: 'date',
+ },
+ removeBOM: {
+ type: 'boolean',
+ default: true,
+ },
+ sourcemaps: {
+ type: 'boolean',
+ default: false,
+ },
+ resolveSymlinks: {
+ type: 'boolean',
+ default: true,
+ },
+};
+
+module.exports = config;
diff --git a/node_modules/vinyl-fs/lib/src/prepare.js b/node_modules/vinyl-fs/lib/src/prepare.js
new file mode 100644
index 0000000..5fa18df
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/prepare.js
@@ -0,0 +1,22 @@
+'use strict';
+
+var through = require('through2');
+
+function prepareRead(optResolver) {
+
+ function normalize(file, enc, callback) {
+
+ var since = optResolver.resolve('since', file);
+
+ // Skip this file if since option is set and current file is too old
+ if (file.stat && file.stat.mtime <= since) {
+ return callback();
+ }
+
+ return callback(null, file);
+ }
+
+ return through.obj(normalize);
+}
+
+module.exports = prepareRead;
diff --git a/node_modules/vinyl-fs/lib/src/read-contents/index.js b/node_modules/vinyl-fs/lib/src/read-contents/index.js
new file mode 100644
index 0000000..5c3117d
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/read-contents/index.js
@@ -0,0 +1,52 @@
+'use strict';
+
+var through = require('through2');
+
+var readDir = require('./read-dir');
+var readStream = require('./read-stream');
+var readBuffer = require('./read-buffer');
+var readSymbolicLink = require('./read-symbolic-link');
+
+function readContents(optResolver) {
+
+ function readFile(file, enc, callback) {
+
+ // Skip reading contents if read option says so
+ var read = optResolver.resolve('read', file);
+ if (!read) {
+ return callback(null, file);
+ }
+
+ // Don't fail to read a directory
+ if (file.isDirectory()) {
+ return readDir(file, optResolver, onRead);
+ }
+
+ // Process symbolic links included with `resolveSymlinks` option
+ if (file.stat && file.stat.isSymbolicLink()) {
+ return readSymbolicLink(file, optResolver, onRead);
+ }
+
+ // Read and pass full contents
+ var buffer = optResolver.resolve('buffer', file);
+ if (buffer) {
+ return readBuffer(file, optResolver, onRead);
+ }
+
+ // Don't buffer anything - just pass streams
+ return readStream(file, optResolver, onRead);
+
+ // This is invoked by the various readXxx modules when they've finished
+ // reading the contents.
+ function onRead(readErr) {
+ if (readErr) {
+ return callback(readErr);
+ }
+ return callback(null, file);
+ }
+ }
+
+ return through.obj(readFile);
+}
+
+module.exports = readContents;
diff --git a/node_modules/vinyl-fs/lib/src/read-contents/read-buffer.js b/node_modules/vinyl-fs/lib/src/read-contents/read-buffer.js
new file mode 100644
index 0000000..c710833
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/read-contents/read-buffer.js
@@ -0,0 +1,25 @@
+'use strict';
+
+var fs = require('graceful-fs');
+var removeBomBuffer = require('remove-bom-buffer');
+
+function bufferFile(file, optResolver, onRead) {
+ fs.readFile(file.path, onReadFile);
+
+ function onReadFile(readErr, data) {
+ if (readErr) {
+ return onRead(readErr);
+ }
+
+ var removeBOM = optResolver.resolve('removeBOM', file);
+ if (removeBOM) {
+ file.contents = removeBomBuffer(data);
+ } else {
+ file.contents = data;
+ }
+
+ onRead();
+ }
+}
+
+module.exports = bufferFile;
diff --git a/node_modules/vinyl-fs/lib/src/read-contents/read-dir.js b/node_modules/vinyl-fs/lib/src/read-contents/read-dir.js
new file mode 100644
index 0000000..be7262b
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/read-contents/read-dir.js
@@ -0,0 +1,8 @@
+'use strict';
+
+function readDir(file, optResolver, onRead) {
+ // Do nothing for now
+ onRead();
+}
+
+module.exports = readDir;
diff --git a/node_modules/vinyl-fs/lib/src/read-contents/read-stream.js b/node_modules/vinyl-fs/lib/src/read-contents/read-stream.js
new file mode 100644
index 0000000..baa6e47
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/read-contents/read-stream.js
@@ -0,0 +1,31 @@
+'use strict';
+
+var fs = require('graceful-fs');
+var removeBomStream = require('remove-bom-stream');
+var lazystream = require('lazystream');
+var createResolver = require('resolve-options');
+
+function streamFile(file, optResolver, onRead) {
+ if (typeof optResolver === 'function') {
+ onRead = optResolver;
+ optResolver = createResolver();
+ }
+
+ var filePath = file.path;
+
+ var removeBOM = optResolver.resolve('removeBOM', file);
+
+ file.contents = new lazystream.Readable(function() {
+ var contents = fs.createReadStream(filePath);
+
+ if (removeBOM) {
+ return contents.pipe(removeBomStream());
+ }
+
+ return contents;
+ });
+
+ onRead();
+}
+
+module.exports = streamFile;
diff --git a/node_modules/vinyl-fs/lib/src/read-contents/read-symbolic-link.js b/node_modules/vinyl-fs/lib/src/read-contents/read-symbolic-link.js
new file mode 100644
index 0000000..47e24cd
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/read-contents/read-symbolic-link.js
@@ -0,0 +1,20 @@
+'use strict';
+
+var fs = require('graceful-fs');
+
+function readLink(file, optResolver, onRead) {
+ fs.readlink(file.path, onReadlink);
+
+ function onReadlink(readErr, target) {
+ if (readErr) {
+ return onRead(readErr);
+ }
+
+ // Store the link target path
+ file.symlink = target;
+
+ onRead();
+ }
+}
+
+module.exports = readLink;
diff --git a/node_modules/vinyl-fs/lib/src/resolve-symlinks.js b/node_modules/vinyl-fs/lib/src/resolve-symlinks.js
new file mode 100644
index 0000000..d77f912
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/resolve-symlinks.js
@@ -0,0 +1,36 @@
+'use strict';
+
+var through = require('through2');
+var fo = require('../file-operations');
+
+function resolveSymlinks(optResolver) {
+
+ // A stat property is exposed on file objects as a (wanted) side effect
+ function resolveFile(file, enc, callback) {
+
+ fo.reflectLinkStat(file.path, file, onReflect);
+
+ function onReflect(statErr) {
+ if (statErr) {
+ return callback(statErr);
+ }
+
+ if (!file.stat.isSymbolicLink()) {
+ return callback(null, file);
+ }
+
+ var resolveSymlinks = optResolver.resolve('resolveSymlinks', file);
+
+ if (!resolveSymlinks) {
+ return callback(null, file);
+ }
+
+ // Get target's stats
+ fo.reflectStat(file.path, file, onReflect);
+ }
+ }
+
+ return through.obj(resolveFile);
+}
+
+module.exports = resolveSymlinks;
diff --git a/node_modules/vinyl-fs/lib/src/sourcemap.js b/node_modules/vinyl-fs/lib/src/sourcemap.js
new file mode 100644
index 0000000..e03971f
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/sourcemap.js
@@ -0,0 +1,29 @@
+'use strict';
+
+var through = require('through2');
+var sourcemap = require('vinyl-sourcemap');
+
+function sourcemapStream(optResolver) {
+
+ function addSourcemap(file, enc, callback) {
+ var srcMap = optResolver.resolve('sourcemaps', file);
+
+ if (!srcMap) {
+ return callback(null, file);
+ }
+
+ sourcemap.add(file, onAdd);
+
+ function onAdd(sourcemapErr, updatedFile) {
+ if (sourcemapErr) {
+ return callback(sourcemapErr);
+ }
+
+ callback(null, updatedFile);
+ }
+ }
+
+ return through.obj(addSourcemap);
+}
+
+module.exports = sourcemapStream;
diff --git a/node_modules/vinyl-fs/lib/src/wrap-vinyl.js b/node_modules/vinyl-fs/lib/src/wrap-vinyl.js
new file mode 100644
index 0000000..883c557
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/src/wrap-vinyl.js
@@ -0,0 +1,18 @@
+'use strict';
+
+var File = require('vinyl');
+var through = require('through2');
+
+function wrapVinyl() {
+
+ function wrapFile(globFile, enc, callback) {
+
+ var file = new File(globFile);
+
+ callback(null, file);
+ }
+
+ return through.obj(wrapFile);
+}
+
+module.exports = wrapVinyl;
diff --git a/node_modules/vinyl-fs/lib/symlink/index.js b/node_modules/vinyl-fs/lib/symlink/index.js
new file mode 100644
index 0000000..6e835da
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/symlink/index.js
@@ -0,0 +1,43 @@
+'use strict';
+
+var pumpify = require('pumpify');
+var lead = require('lead');
+var mkdirpStream = require('fs-mkdirp-stream');
+var createResolver = require('resolve-options');
+
+var config = require('./options');
+var prepare = require('./prepare');
+var linkFile = require('./link-file');
+
+var folderConfig = {
+ outFolder: {
+ type: 'string',
+ },
+};
+
+function symlink(outFolder, opt) {
+ if (!outFolder) {
+ throw new Error('Invalid symlink() folder argument.' +
+ ' Please specify a non-empty string or a function.');
+ }
+
+ var optResolver = createResolver(config, opt);
+ var folderResolver = createResolver(folderConfig, { outFolder: outFolder });
+
+ function dirpath(file, callback) {
+ var dirMode = optResolver.resolve('dirMode', file);
+
+ callback(null, file.dirname, dirMode);
+ }
+
+ var stream = pumpify.obj(
+ prepare(folderResolver, optResolver),
+ mkdirpStream.obj(dirpath),
+ linkFile(optResolver)
+ );
+
+ // Sink the stream to start flowing
+ return lead(stream);
+}
+
+module.exports = symlink;
diff --git a/node_modules/vinyl-fs/lib/symlink/link-file.js b/node_modules/vinyl-fs/lib/symlink/link-file.js
new file mode 100644
index 0000000..e1caf97
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/symlink/link-file.js
@@ -0,0 +1,89 @@
+'use strict';
+
+var os = require('os');
+var path = require('path');
+
+var through = require('through2');
+
+var fo = require('../file-operations');
+
+var isWindows = (os.platform() === 'win32');
+
+function linkStream(optResolver) {
+
+ function linkFile(file, enc, callback) {
+ var isRelative = optResolver.resolve('relativeSymlinks', file);
+ var flags = fo.getFlags({
+ overwrite: optResolver.resolve('overwrite', file),
+ append: false,
+ });
+
+ if (!isWindows) {
+ // On non-Windows, just use 'file'
+ return createLinkWithType('file');
+ }
+
+ fo.reflectStat(file.symlink, file, onReflectTarget);
+
+ function onReflectTarget(statErr) {
+ if (statErr && statErr.code !== 'ENOENT') {
+ return callback(statErr);
+ }
+ // If target doesn't exist, the vinyl will still carry the target stats.
+ // Let's use those to determine which kind of dangling link to create.
+
+ // This option provides a way to create a Junction instead of a
+ // Directory symlink on Windows. This comes with the following caveats:
+ // * NTFS Junctions cannot be relative.
+ // * NTFS Junctions MUST be directories.
+ // * NTFS Junctions must be on the same file system.
+ // * Most products CANNOT detect a directory is a Junction:
+ // This has the side effect of possibly having a whole directory
+ // deleted when a product is deleting the Junction directory.
+ // For example, JetBrains product lines will delete the entire contents
+ // of the TARGET directory because the product does not realize it's
+ // a symlink as the JVM and Node return false for isSymlink.
+
+ // This function is Windows only, so we don't need to check again
+ var useJunctions = optResolver.resolve('useJunctions', file);
+
+ var dirType = useJunctions ? 'junction' : 'dir';
+ var type = !statErr && file.isDirectory() ? dirType : 'file';
+
+ createLinkWithType(type);
+ }
+
+ function createLinkWithType(type) {
+ // This is done after prepare() to use the adjusted file.base property
+ if (isRelative && type !== 'junction') {
+ file.symlink = path.relative(file.base, file.symlink);
+ }
+
+ var opts = {
+ flags: flags,
+ type: type,
+ };
+ fo.symlink(file.symlink, file.path, opts, onSymlink);
+ }
+
+ function onSymlink(symlinkErr) {
+ if (symlinkErr) {
+ return callback(symlinkErr);
+ }
+
+ fo.reflectLinkStat(file.path, file, onReflectLink);
+ }
+
+ function onReflectLink(reflectErr) {
+ if (reflectErr) {
+ return callback(reflectErr);
+ }
+
+ callback(null, file);
+ }
+ }
+
+ return through.obj(linkFile);
+}
+
+module.exports = linkStream;
diff --git a/node_modules/vinyl-fs/lib/symlink/options.js b/node_modules/vinyl-fs/lib/symlink/options.js
new file mode 100644
index 0000000..fd9e1c7
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/symlink/options.js
@@ -0,0 +1,26 @@
+'use strict';
+
+var config = {
+ cwd: {
+ type: 'string',
+ default: process.cwd,
+ },
+ dirMode: {
+ type: 'number',
+ },
+ overwrite: {
+ type: 'boolean',
+ default: true,
+ },
+ relativeSymlinks: {
+ type: 'boolean',
+ default: false,
+ },
+ // This option is ignored on non-Windows platforms
+ useJunctions: {
+ type: 'boolean',
+ default: true,
+ },
+};
+
+module.exports = config;
diff --git a/node_modules/vinyl-fs/lib/symlink/prepare.js b/node_modules/vinyl-fs/lib/symlink/prepare.js
new file mode 100644
index 0000000..dd2ec1a
--- /dev/null
+++ b/node_modules/vinyl-fs/lib/symlink/prepare.js
@@ -0,0 +1,51 @@
+'use strict';
+
+var path = require('path');
+
+var fs = require('graceful-fs');
+var Vinyl = require('vinyl');
+var through = require('through2');
+
+function prepareSymlink(folderResolver, optResolver) {
+ if (!folderResolver) {
+ throw new Error('Invalid output folder');
+ }
+
+ function normalize(file, enc, cb) {
+ if (!Vinyl.isVinyl(file)) {
+ return cb(new Error('Received a non-Vinyl object in `symlink()`'));
+ }
+
+ // TODO: Remove this after people upgrade vinyl/transition from gulp-util
+ if (typeof file.isSymbolic !== 'function') {
+ file = new Vinyl(file);
+ }
+
+ var cwd = path.resolve(optResolver.resolve('cwd', file));
+
+ var outFolderPath = folderResolver.resolve('outFolder', file);
+ if (!outFolderPath) {
+ return cb(new Error('Invalid output folder'));
+ }
+ var basePath = path.resolve(cwd, outFolderPath);
+ var writePath = path.resolve(basePath, file.relative);
+
+ // Wire up new properties
+ // Note: keep the target stats for now, we may need them in link-file
+ file.stat = (file.stat || new fs.Stats());
+ file.cwd = cwd;
+ file.base = basePath;
+ // This is the path we are linking *TO*
+ file.symlink = file.path;
+ file.path = writePath;
+ // We have to set contents to null for a link
+ // Otherwise `isSymbolic()` returns false
+ file.contents = null;
+
+ cb(null, file);
+ }
+
+ return through.obj(normalize);
+}
+
+module.exports = prepareSymlink;
diff --git a/node_modules/vinyl-fs/package.json b/node_modules/vinyl-fs/package.json
new file mode 100644
index 0000000..90ceb27
--- /dev/null
+++ b/node_modules/vinyl-fs/package.json
@@ -0,0 +1,110 @@
+{
+ "_from": "vinyl-fs@^3.0.3",
+ "_id": "vinyl-fs@3.0.3",
+ "_inBundle": false,
+ "_integrity": "sha512-vIu34EkyNyJxmP0jscNzWBSygh7VWhqun6RmqVfXePrOwi9lhvRs//dOaGOTRUQr4tx7/zd26Tk5WeSVZitgng==",
+ "_location": "/vinyl-fs",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "vinyl-fs@^3.0.3",
+ "name": "vinyl-fs",
+ "escapedName": "vinyl-fs",
+ "rawSpec": "^3.0.3",
+ "saveSpec": null,
+ "fetchSpec": "^3.0.3"
+ },
+ "_requiredBy": [
+ "#DEV:/"
+ ],
+ "_resolved": "https://registry.npmjs.org/vinyl-fs/-/vinyl-fs-3.0.3.tgz",
+ "_shasum": "c85849405f67428feabbbd5c5dbdd64f47d31bc7",
+ "_spec": "vinyl-fs@^3.0.3",
+ "_where": "C:\\Users\\marcr\\Desktop\\KorAp\\Git\\Kalamar",
+ "author": {
+ "name": "Gulp Team",
+ "email": "team@gulpjs.com",
+ "url": "http://gulpjs.com/"
+ },
+ "bugs": {
+ "url": "https://github.com/gulpjs/vinyl-fs/issues"
+ },
+ "bundleDependencies": false,
+ "contributors": [
+ {
+ "name": "Eric Schoffstall",
+ "email": "yo@contra.io"
+ },
+ {
+ "name": "Blaine Bublitz",
+ "email": "blaine.bublitz@gmail.com"
+ }
+ ],
+ "dependencies": {
+ "fs-mkdirp-stream": "^1.0.0",
+ "glob-stream": "^6.1.0",
+ "graceful-fs": "^4.0.0",
+ "is-valid-glob": "^1.0.0",
+ "lazystream": "^1.0.0",
+ "lead": "^1.0.0",
+ "object.assign": "^4.0.4",
+ "pumpify": "^1.3.5",
+ "readable-stream": "^2.3.3",
+ "remove-bom-buffer": "^3.0.0",
+ "remove-bom-stream": "^1.2.0",
+ "resolve-options": "^1.1.0",
+ "through2": "^2.0.0",
+ "to-through": "^2.0.0",
+ "value-or-function": "^3.0.0",
+ "vinyl": "^2.0.0",
+ "vinyl-sourcemap": "^1.1.0"
+ },
+ "deprecated": false,
+ "description": "Vinyl adapter for the file system.",
+ "devDependencies": {
+ "eslint": "^1.10.3",
+ "eslint-config-gulp": "^2.0.0",
+ "expect": "^1.19.0",
+ "istanbul": "^0.4.3",
+ "istanbul-coveralls": "^1.0.3",
+ "jscs": "^2.4.0",
+ "jscs-preset-gulp": "^1.0.0",
+ "mississippi": "^1.2.0",
+ "mocha": "^3.5.0",
+ "rimraf": "^2.6.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ },
+ "files": [
+ "LICENSE",
+ "index.js",
+ "lib"
+ ],
+ "homepage": "https://github.com/gulpjs/vinyl-fs#readme",
+ "keywords": [
+ "gulp",
+ "vinyl-adapter",
+ "vinyl",
+ "file",
+ "file system",
+ "fs",
+ "streams"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "name": "vinyl-fs",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/gulpjs/vinyl-fs.git"
+ },
+ "scripts": {
+ "cover": "istanbul cover _mocha --report lcovonly",
+ "coveralls": "npm run cover && istanbul-coveralls",
+ "lint": "eslint . && jscs index.js lib/ test/",
+ "pretest": "npm run lint",
+ "test": "mocha --async-only"
+ },
+ "version": "3.0.3"
+}