diff options
Diffstat (limited to 'node_modules/vinyl-fs/lib/src')
7 files changed, 0 insertions, 218 deletions
diff --git a/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js b/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js deleted file mode 100644 index 894dd9cea..000000000 --- a/node_modules/vinyl-fs/lib/src/getContents/bufferFile.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); -var stripBom = require('strip-bom'); - -function bufferFile(file, opt, cb) { - fs.readFile(file.path, function(err, data) { - if (err) { - return cb(err); - } - - if (opt.stripBOM) { - file.contents = stripBom(data); - } else { - file.contents = data; - } - - cb(null, file); - }); -} - -module.exports = bufferFile; diff --git a/node_modules/vinyl-fs/lib/src/getContents/index.js b/node_modules/vinyl-fs/lib/src/getContents/index.js deleted file mode 100644 index c1c8c159d..000000000 --- a/node_modules/vinyl-fs/lib/src/getContents/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; - -var through2 = require('through2'); -var readDir = require('./readDir'); -var readSymbolicLink = require('./readSymbolicLink'); -var bufferFile = require('./bufferFile'); -var streamFile = require('./streamFile'); - -function getContents(opt) { - return through2.obj(opt, function(file, enc, cb) { - // Don't fail to read a directory - if (file.isDirectory()) { - return readDir(file, opt, cb); - } - - // Process symbolic links included with `followSymlinks` option - if (file.stat && file.stat.isSymbolicLink()) { - return readSymbolicLink(file, opt, cb); - } - - // Read and pass full contents - if (opt.buffer !== false) { - return bufferFile(file, opt, cb); - } - - // Don't buffer anything - just pass streams - return streamFile(file, opt, cb); - }); -} - -module.exports = getContents; diff --git a/node_modules/vinyl-fs/lib/src/getContents/readDir.js b/node_modules/vinyl-fs/lib/src/getContents/readDir.js deleted file mode 100644 index a800d4738..000000000 --- a/node_modules/vinyl-fs/lib/src/getContents/readDir.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict'; - -function readDir(file, opt, cb) { - // Do nothing for now - cb(null, file); -} - -module.exports = readDir; diff --git a/node_modules/vinyl-fs/lib/src/getContents/readSymbolicLink.js b/node_modules/vinyl-fs/lib/src/getContents/readSymbolicLink.js deleted file mode 100644 index 794077a62..000000000 --- a/node_modules/vinyl-fs/lib/src/getContents/readSymbolicLink.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); - -function readLink(file, opt, cb) { - fs.readlink(file.path, function(err, target) { - if (err) { - return cb(err); - } - - // Store the link target path - file.symlink = target; - - return cb(null, file); - }); -} - -module.exports = readLink; diff --git a/node_modules/vinyl-fs/lib/src/getContents/streamFile.js b/node_modules/vinyl-fs/lib/src/getContents/streamFile.js deleted file mode 100644 index 43dc12635..000000000 --- a/node_modules/vinyl-fs/lib/src/getContents/streamFile.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; - -var fs = require('graceful-fs'); -var stripBom = require('strip-bom-stream'); -var lazystream = require('lazystream'); - -function streamFile(file, opt, cb) { - if (typeof opt === 'function') { - cb = opt; - opt = {}; - } - - var filePath = file.path; - - file.contents = new lazystream.Readable(function() { - return fs.createReadStream(filePath); - }); - - if (opt.stripBOM) { - file.contents = file.contents.pipe(stripBom()); - } - - cb(null, file); -} - -module.exports = streamFile; diff --git a/node_modules/vinyl-fs/lib/src/index.js b/node_modules/vinyl-fs/lib/src/index.js deleted file mode 100644 index 06cbe754d..000000000 --- a/node_modules/vinyl-fs/lib/src/index.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; - -var assign = require('object-assign'); -var through2 = require('through2'); -var gs = require('glob-stream'); -var duplexify = require('duplexify'); -var merge = require('merge-stream'); -var sourcemaps = require('gulp-sourcemaps'); -var filterSince = require('../filterSince'); -var isValidGlob = require('is-valid-glob'); - -var getContents = require('./getContents'); -var wrapWithVinylFile = require('./wrapWithVinylFile'); - -function src(glob, opt) { - var options = assign({ - read: true, - buffer: true, - stripBOM: true, - sourcemaps: false, - passthrough: false, - followSymlinks: true, - }, opt); - - // Don't pass `read` option on to through2 - var read = options.read !== false; - options.read = undefined; - - var inputPass; - - if (!isValidGlob(glob)) { - throw new Error('Invalid glob argument: ' + glob); - } - - var globStream = gs.create(glob, options); - - var outputStream = globStream - .pipe(wrapWithVinylFile(options)); - - if (options.since != null) { - outputStream = outputStream - .pipe(filterSince(options.since)); - } - - if (read) { - outputStream = outputStream - .pipe(getContents(options)); - } - - if (options.passthrough === true) { - inputPass = through2.obj(options); - outputStream = duplexify.obj(inputPass, merge(outputStream, inputPass)); - } - if (options.sourcemaps === true) { - outputStream = outputStream - .pipe(sourcemaps.init({ loadMaps: true })); - } - globStream.on('error', outputStream.emit.bind(outputStream, 'error')); - return outputStream; -} - -module.exports = src; diff --git a/node_modules/vinyl-fs/lib/src/wrapWithVinylFile.js b/node_modules/vinyl-fs/lib/src/wrapWithVinylFile.js deleted file mode 100644 index 5e6290e59..000000000 --- a/node_modules/vinyl-fs/lib/src/wrapWithVinylFile.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; - -var through2 = require('through2'); -var fs = require('graceful-fs'); -var File = require('vinyl'); - -function wrapWithVinylFile(options) { - - // A stat property is exposed on file objects as a (wanted) side effect - function resolveFile(globFile, enc, cb) { - fs.lstat(globFile.path, function(err, stat) { - if (err) { - return cb(err); - } - - globFile.stat = stat; - - if (!stat.isSymbolicLink() || !options.followSymlinks) { - var vinylFile = new File(globFile); - if (globFile.originalSymlinkPath) { - // If we reach here, it means there is at least one - // symlink on the path and we need to rewrite the path - // to its original value. - // Updated file stats will tell getContents() to actually read it. - vinylFile.path = globFile.originalSymlinkPath; - } - return cb(null, vinylFile); - } - - fs.realpath(globFile.path, function(err, filePath) { - if (err) { - return cb(err); - } - - if (!globFile.originalSymlinkPath) { - // Store the original symlink path before the recursive call - // to later rewrite it back. - globFile.originalSymlinkPath = globFile.path; - } - globFile.path = filePath; - - // Recurse to get real file stat - resolveFile(globFile, enc, cb); - }); - }); - } - - return through2.obj(options, resolveFile); -} - -module.exports = wrapWithVinylFile; |