Socket
Socket
Sign inDemoInstall

vinyl-fs

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vinyl-fs - npm Package Compare versions

Comparing version 3.0.3 to 4.0.0

lib/codecs.js

1

lib/constants.js

@@ -6,2 +6,3 @@ 'use strict';

DEFAULT_FILE_MODE: parseInt('0666', 8),
DEFAULT_ENCODING: 'utf8',
};

12

lib/dest/index.js
'use strict';
var lead = require('lead');
var pumpify = require('pumpify');
var composer = require('stream-composer');
var mkdirpStream = require('fs-mkdirp-stream');

@@ -21,4 +21,6 @@ var createResolver = require('resolve-options');

if (!outFolder) {
throw new Error('Invalid dest() folder argument.' +
' Please specify a non-empty string or a function.');
throw new Error(
'Invalid dest() folder argument.' +
' Please specify a non-empty string or a function.'
);
}

@@ -35,6 +37,6 @@

var saveStream = pumpify.obj(
var saveStream = composer.pipeline(
prepare(folderResolver, optResolver),
sourcemap(optResolver),
mkdirpStream.obj(dirpath),
mkdirpStream(dirpath),
writeContents(optResolver)

@@ -41,0 +43,0 @@ );

'use strict';
var DEFAULT_ENCODING = require('../constants').DEFAULT_ENCODING;
var config = {

@@ -10,3 +12,3 @@ cwd: {

type: 'number',
default: function(file) {
default: function (file) {
return file.stat ? file.stat.mode : null;

@@ -26,2 +28,6 @@ },

},
encoding: {
type: ['string', 'boolean'],
default: DEFAULT_ENCODING,
},
sourcemaps: {

@@ -28,0 +34,0 @@ type: ['string', 'boolean'],

@@ -7,3 +7,3 @@ 'use strict';

var Vinyl = require('vinyl');
var through = require('through2');
var Transform = require('streamx').Transform;

@@ -15,3 +15,3 @@ function prepareWrite(folderResolver, optResolver) {

function normalize(file, enc, cb) {
function normalize(file, cb) {
if (!Vinyl.isVinyl(file)) {

@@ -40,3 +40,3 @@ return cb(new Error('Received a non-Vinyl object in `dest()`'));

var mode = optResolver.resolve('mode', file);
file.stat = (file.stat || new fs.Stats());
file.stat = file.stat || new fs.Stats();
file.stat.mode = mode;

@@ -48,5 +48,7 @@ }

return through.obj(normalize);
return new Transform({
transform: normalize,
});
}
module.exports = prepareWrite;
'use strict';
var through = require('through2');
var Transform = require('streamx').Transform;
var sourcemap = require('vinyl-sourcemap');
function sourcemapStream(optResolver) {
function saveSourcemap(file, enc, callback) {
function saveSourcemap(file, callback) {
var self = this;

@@ -17,3 +16,3 @@

var srcMapLocation = (typeof srcMap === 'string' ? srcMap : undefined);
var srcMapLocation = typeof srcMap === 'string' ? srcMap : undefined;

@@ -36,5 +35,7 @@ sourcemap.write(file, srcMapLocation, onWrite);

return through.obj(saveSourcemap);
return new Transform({
transform: saveSourcemap,
});
}
module.exports = sourcemapStream;
'use strict';
var through = require('through2');
var Transform = require('streamx').Transform;

@@ -13,4 +13,3 @@ var writeDir = require('./write-dir');

function writeContents(optResolver) {
function writeFile(file, enc, callback) {
function writeFile(file, callback) {
// Write it as a symlink

@@ -54,8 +53,9 @@ if (file.isSymbolic()) {

}
}
return through.obj(writeFile);
return new Transform({
transform: writeFile,
});
}
module.exports = writeContents;
'use strict';
var fo = require('../../file-operations');
var getCodec = require('../../codecs');
var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING;

@@ -10,2 +12,9 @@ function writeBuffer(file, optResolver, onWritten) {

});
var encoding = optResolver.resolve('encoding', file);
var codec = getCodec(encoding);
if (encoding && !codec) {
return onWritten(new Error('Unsupported encoding: ' + encoding));
}
var opt = {

@@ -16,4 +25,11 @@ mode: file.stat.mode,

fo.writeFile(file.path, file.contents, opt, onWriteFile);
var contents = file.contents;
if (encoding && codec.enc !== DEFAULT_ENCODING) {
contents = getCodec(DEFAULT_ENCODING).decode(contents);
contents = codec.encode(contents);
}
fo.writeFile(file.path, contents, opt, onWriteFile);
function onWriteFile(writeErr, fd) {

@@ -30,5 +46,4 @@ if (writeErr) {

}
}
module.exports = writeBuffer;

@@ -36,3 +36,2 @@ 'use strict';

}
}

@@ -39,0 +38,0 @@

'use strict';
var pipeline = require('streamx').pipeline;
var fo = require('../../file-operations');
var getCodec = require('../../codecs');
var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING;
var readStream = require('../../src/read-contents/read-stream');

@@ -11,2 +15,9 @@

});
var encoding = optResolver.resolve('encoding', file);
var codec = getCodec(encoding);
if (encoding && !codec) {
return onWritten(new Error('Unsupported encoding: ' + encoding));
}
var opt = {

@@ -21,33 +32,29 @@ mode: file.stat.mode,

file.contents.once('error', onComplete);
outStream.once('error', onComplete);
outStream.once('finish', onComplete);
// TODO: should this use a clone?
file.contents.pipe(outStream);
var streams = [file.contents];
function onComplete(streamErr) {
// Cleanup event handlers before closing
file.contents.removeListener('error', onComplete);
outStream.removeListener('error', onComplete);
outStream.removeListener('finish', onComplete);
if (encoding && encoding.enc !== DEFAULT_ENCODING) {
streams.push(getCodec(DEFAULT_ENCODING).decodeStream());
streams.push(codec.encodeStream());
}
// Need to guarantee the fd is closed before forwarding the error
outStream.once('close', onClose);
outStream.end();
streams.push(outStream);
function onClose(closeErr) {
onWritten(streamErr || closeErr);
}
}
pipeline(streams, onWritten);
// 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);
readStream(file, { resolve: resolve }, complete);
function resolve(key) {
if (key === 'encoding') {
return encoding;
}
if (key === 'removeBOM') {
return false;
}
throw new Error("Eek! stub resolver doesn't have " + key);
}
function complete() {

@@ -61,5 +68,4 @@ if (typeof fd !== 'number') {

}
}
module.exports = writeStream;

@@ -8,3 +8,3 @@ 'use strict';

var isWindows = (os.platform() === 'win32');
var isWindows = os.platform() === 'win32';

@@ -11,0 +11,0 @@ function writeSymbolicLink(file, optResolver, onWritten) {

'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 Writable = require('streamx').Writable;

@@ -83,3 +80,2 @@ var constants = require('./constants');

function getTimesDiff(fsStat, vinylStat) {
var mtime = date(vinylStat.mtime) || 0;

@@ -91,4 +87,3 @@ if (!mtime) {

var atime = date(vinylStat.atime) || 0;
if (+mtime === +fsStat.mtime &&
+atime === +fsStat.atime) {
if (+mtime === +fsStat.mtime && +atime === +fsStat.atime) {
return;

@@ -110,9 +105,10 @@ }

function getOwnerDiff(fsStat, vinylStat) {
if (!isValidUnixId(vinylStat.uid) &&
!isValidUnixId(vinylStat.gid)) {
if (!isValidUnixId(vinylStat.uid) && !isValidUnixId(vinylStat.gid)) {
return;
}
if ((!isValidUnixId(fsStat.uid) && !isValidUnixId(vinylStat.uid)) ||
(!isValidUnixId(fsStat.gid) && !isValidUnixId(vinylStat.gid))) {
if (
(!isValidUnixId(fsStat.uid) && !isValidUnixId(vinylStat.uid)) ||
(!isValidUnixId(fsStat.gid) && !isValidUnixId(vinylStat.gid))
) {
return;

@@ -131,4 +127,3 @@ }

if (uid === fsStat.uid &&
gid === fsStat.gid) {
if (uid === fsStat.uid && gid === fsStat.gid) {
return;

@@ -146,4 +141,4 @@ }

function isOwner(fsStat) {
var hasGetuid = (typeof process.getuid === 'function');
var hasGeteuid = (typeof process.geteuid === 'function');
var hasGetuid = typeof process.getuid === 'function';
var hasGeteuid = typeof process.geteuid === 'function';

@@ -171,2 +166,28 @@ // If we don't have either, assume we don't have permissions.

// Node 10 on Windows fails with EPERM if you stat a symlink to a directory so we recursively readlink before we reflect stats
// TODO: Remove this indirection when we drop Node 10 support
function findSymlinkHardpath(path, callback) {
fs.readlink(path, onReadlink);
function onReadlink(readlinkErr, resolvedPath) {
if (readlinkErr) {
return callback(readlinkErr);
}
fs.lstat(resolvedPath, onLstat);
function onLstat(lstatErr, stat) {
if (lstatErr) {
return callback(lstatErr);
}
if (stat.isSymbolicLink()) {
return findSymlinkHardpath(resolvedPath, callback);
}
callback(null, resolvedPath);
}
}
}
function reflectStat(path, file, callback) {

@@ -201,3 +222,2 @@ // Set file.stat to the reflect current state on disk

function updateMetadata(fd, file, callback) {
fs.fstat(fd, onStat);

@@ -220,3 +240,3 @@

// Set file.stat to the reflect current state on disk
assign(file.stat, stat);
Object.assign(file.stat, stat);

@@ -269,2 +289,9 @@ // Nothing to do

}
// If a filesystem doesn't implement futimes, we don't callback with the error.
// Instead we update the stats to match filesystem and clear the error.
if (futimesErr && futimesErr.code === 'ENOSYS') {
file.stat.atime = stat.atime;
file.stat.mtime = stat.mtime;
futimesErr = null;
}
if (ownerDiff) {

@@ -355,11 +382,7 @@ return owner(propagatedErr || futimesErr);

function createWriteStream(path, options, flush) {
return new WriteStream(path, options, flush);
function noopFlush(fd, cb) {
cb();
}
// 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`
function createWriteStream(path, options, flush) {
if (typeof options === 'function') {

@@ -371,121 +394,60 @@ flush = options;

options = options || {};
flush = flush || noopFlush;
Writable.call(this, options);
var mode = options.mode || constants.DEFAULT_FILE_MODE;
var flags = options.flags || 'w';
this.flush = flush;
this.path = path;
var fd = null;
this.mode = options.mode || constants.DEFAULT_FILE_MODE;
this.flags = options.flags || 'w';
return new Writable({
mapWritable: function (data) {
if (typeof data === 'string') {
return Buffer.from(data);
} else {
return data;
}
},
open: function (cb) {
fs.open(path, flags, mode, onOpen);
// Used by node's `fs.WriteStream`
this.fd = null;
this.start = null;
function onOpen(openErr, openedFd) {
if (openErr) {
cb(openErr);
return;
}
this.open();
fd = openedFd;
cb();
}
},
destroy: function (cb) {
if (fd) {
fs.close(fd, onClose);
} else {
onClose();
}
// Dispose on finish.
this.once('finish', this.close);
}
function onClose(closeErr) {
fd = null;
cb(closeErr);
}
},
write: function (data, cb) {
fs.write(fd, data, 0, data.length, null, onWrite);
util.inherits(WriteStream, Writable);
function onWrite(writeErr) {
if (writeErr) {
cb(writeErr);
return;
}
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);
cb();
}
},
final: function (cb) {
flush(fd, cb);
},
});
};
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 = {

@@ -501,2 +463,3 @@ closeFd: closeFd,

isOwner: isOwner,
findSymlinkHardpath: findSymlinkHardpath,
reflectStat: reflectStat,

@@ -503,0 +466,0 @@ reflectLinkStat: reflectLinkStat,

'use strict';
var gs = require('glob-stream');
var pumpify = require('pumpify');
var pipeline = require('streamx').pipeline;
var toThrough = require('to-through');
var isValidGlob = require('is-valid-glob');
var normalizePath = require('normalize-path');
var createResolver = require('resolve-options');

@@ -16,2 +17,6 @@

function normalize(glob) {
return normalizePath(glob, false);
}
function src(glob, opt) {

@@ -24,3 +29,9 @@ var optResolver = createResolver(config, opt);

var streams = [
if (!Array.isArray(glob)) {
glob = [glob];
}
glob = glob.map(normalize);
var outputStream = pipeline(
gs(glob, opt),

@@ -31,11 +42,8 @@ wrapVinyl(optResolver),

readContents(optResolver),
sourcemap(optResolver),
];
sourcemap(optResolver)
);
var outputStream = pumpify.obj(streams);
return toThrough(outputStream);
}
module.exports = src;
'use strict';
var DEFAULT_ENCODING = require('../constants').DEFAULT_ENCODING;
var config = {

@@ -19,2 +21,6 @@ buffer: {

},
encoding: {
type: ['string', 'boolean'],
default: DEFAULT_ENCODING,
},
sourcemaps: {

@@ -21,0 +27,0 @@ type: 'boolean',

'use strict';
var through = require('through2');
var Transform = require('streamx').Transform;
function prepareRead(optResolver) {
function normalize(file, enc, callback) {
function normalize(file, 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();
if (file.stat) {
// Skip this file if since option is set and current file is too old
if (Math.max(file.stat.mtime, file.stat.ctime) <= since) {
return callback();
}
}

@@ -19,5 +19,7 @@

return through.obj(normalize);
return new Transform({
transform: normalize,
});
}
module.exports = prepareRead;
'use strict';
var through = require('through2');
var Transform = require('streamx').Transform;

@@ -11,5 +11,3 @@ var readDir = require('./read-dir');

function readContents(optResolver) {
function readFile(file, enc, callback) {
function readFile(file, callback) {
// Skip reading contents if read option says so

@@ -46,9 +44,11 @@ var read = optResolver.resolve('read', file);

}
return callback(null, file);
callback(null, file);
}
}
return through.obj(readFile);
return new Transform({
transform: readFile,
});
}
module.exports = readContents;
'use strict';
var fs = require('graceful-fs');
var removeBomBuffer = require('remove-bom-buffer');
var getCodec = require('../../codecs');
var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING;
function bufferFile(file, optResolver, onRead) {
var encoding = optResolver.resolve('encoding', file);
var codec = getCodec(encoding);
if (encoding && !codec) {
return onRead(new Error('Unsupported encoding: ' + encoding));
}
fs.readFile(file.path, onReadFile);
function onReadFile(readErr, data) {
function onReadFile(readErr, contents) {
if (readErr) {

@@ -14,9 +22,13 @@ return onRead(readErr);

var removeBOM = optResolver.resolve('removeBOM', file);
if (removeBOM) {
file.contents = removeBomBuffer(data);
} else {
file.contents = data;
if (encoding) {
var removeBOM = codec.bomAware && optResolver.resolve('removeBOM', file);
if (removeBOM || codec.enc !== DEFAULT_ENCODING) {
contents = codec.decode(contents, { removeBOM: removeBOM });
contents = getCodec(DEFAULT_ENCODING).encode(contents);
}
}
file.contents = contents;
onRead();

@@ -23,0 +35,0 @@ }

'use strict';
var fs = require('graceful-fs');
var removeBomStream = require('remove-bom-stream');
var lazystream = require('lazystream');
var createResolver = require('resolve-options');
var Composer = require('stream-composer');
var getCodec = require('../../codecs');
var DEFAULT_ENCODING = require('../../constants').DEFAULT_ENCODING;
function streamFile(file, optResolver, onRead) {
if (typeof optResolver === 'function') {
onRead = optResolver;
optResolver = createResolver();
var encoding = optResolver.resolve('encoding', file);
var codec = getCodec(encoding);
if (encoding && !codec) {
return onRead(new Error('Unsupported encoding: ' + encoding));
}

@@ -16,12 +18,25 @@

var removeBOM = optResolver.resolve('removeBOM', file);
file.contents = new Composer({
open: function (cb) {
var contents = fs.createReadStream(filePath);
var streams = [contents];
file.contents = new lazystream.Readable(function() {
var contents = fs.createReadStream(filePath);
if (encoding) {
var removeBOM =
codec.bomAware && optResolver.resolve('removeBOM', file);
if (removeBOM) {
return contents.pipe(removeBomStream());
}
if (removeBOM || codec.enc !== DEFAULT_ENCODING) {
streams.push(codec.decodeStream({ removeBOM: removeBOM }));
streams.push(getCodec(DEFAULT_ENCODING).encodeStream());
}
}
return contents;
if (streams.length > 1) {
this.setPipeline(streams);
} else {
this.setReadable(contents);
}
cb();
},
});

@@ -28,0 +43,0 @@

'use strict';
var through = require('through2');
var Transform = require('streamx').Transform;
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) {
function resolveFile(file, callback) {
fo.reflectLinkStat(file.path, file, onReflect);

@@ -28,10 +26,20 @@

fo.findSymlinkHardpath(file.path, onSymlinkHardpath);
}
function onSymlinkHardpath(readlinkErr, path) {
if (readlinkErr) {
return callback(readlinkErr);
}
// Get target's stats
fo.reflectStat(file.path, file, onReflect);
fo.reflectStat(path, file, onReflect);
}
}
return through.obj(resolveFile);
return new Transform({
transform: resolveFile,
});
}
module.exports = resolveSymlinks;
'use strict';
var through = require('through2');
var Transform = require('streamx').Transform;
var sourcemap = require('vinyl-sourcemap');
function sourcemapStream(optResolver) {
function addSourcemap(file, enc, callback) {
function addSourcemap(file, callback) {
var srcMap = optResolver.resolve('sourcemaps', file);

@@ -26,5 +25,7 @@

return through.obj(addSourcemap);
return new Transform({
transform: addSourcemap,
});
}
module.exports = sourcemapStream;
'use strict';
var File = require('vinyl');
var through = require('through2');
var Transform = require('streamx').Transform;
function wrapVinyl() {
function wrapFile(globFile, enc, callback) {
function wrapFile(globFile, callback) {
var file = new File(globFile);

@@ -15,5 +13,7 @@

return through.obj(wrapFile);
return new Transform({
transform: wrapFile,
});
}
module.exports = wrapVinyl;
'use strict';
var pumpify = require('pumpify');
var lead = require('lead');
var composer = require('stream-composer');
var mkdirpStream = require('fs-mkdirp-stream');

@@ -20,4 +20,6 @@ var createResolver = require('resolve-options');

if (!outFolder) {
throw new Error('Invalid symlink() folder argument.' +
' Please specify a non-empty string or a function.');
throw new Error(
'Invalid symlink() folder argument.' +
' Please specify a non-empty string or a function.'
);
}

@@ -34,5 +36,5 @@

var stream = pumpify.obj(
var stream = composer.pipeline(
prepare(folderResolver, optResolver),
mkdirpStream.obj(dirpath),
mkdirpStream(dirpath),
linkFile(optResolver)

@@ -39,0 +41,0 @@ );

@@ -6,11 +6,10 @@ 'use strict';

var through = require('through2');
var Transform = require('streamx').Transform;
var fo = require('../file-operations');
var isWindows = (os.platform() === 'win32');
var isWindows = os.platform() === 'win32';
function linkStream(optResolver) {
function linkFile(file, enc, callback) {
function linkFile(file, callback) {
var isRelative = optResolver.resolve('relativeSymlinks', file);

@@ -87,5 +86,7 @@ var flags = fo.getFlags({

return through.obj(linkFile);
return new Transform({
transform: linkFile,
});
}
module.exports = linkStream;

@@ -7,3 +7,3 @@ 'use strict';

var Vinyl = require('vinyl');
var through = require('through2');
var Transform = require('streamx').Transform;

@@ -15,3 +15,3 @@ function prepareSymlink(folderResolver, optResolver) {

function normalize(file, enc, cb) {
function normalize(file, cb) {
if (!Vinyl.isVinyl(file)) {

@@ -37,7 +37,8 @@ return cb(new Error('Received a non-Vinyl object in `symlink()`'));

// Note: keep the target stats for now, we may need them in link-file
file.stat = (file.stat || new fs.Stats());
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;
// Use `file.symlink` if it was set in the pipeline
file.symlink = file.symlink || file.path;
file.path = writePath;

@@ -51,5 +52,7 @@ // We have to set contents to null for a link

return through.obj(normalize);
return new Transform({
transform: normalize,
});
}
module.exports = prepareSymlink;
{
"name": "vinyl-fs",
"version": "3.0.3",
"version": "4.0.0",
"description": "Vinyl adapter for the file system.",
"author": "Gulp Team <team@gulpjs.com> (http://gulpjs.com/)",
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
"contributors": [

@@ -13,3 +13,3 @@ "Eric Schoffstall <yo@contra.io>",

"engines": {
"node": ">= 0.10"
"node": ">=10.13.0"
},

@@ -23,39 +23,41 @@ "main": "index.js",

"scripts": {
"lint": "eslint . && jscs index.js lib/ test/",
"lint": "eslint .",
"pretest": "npm run lint",
"test": "mocha --async-only",
"cover": "istanbul cover _mocha --report lcovonly",
"coveralls": "npm run cover && istanbul-coveralls"
"test": "nyc mocha --async-only"
},
"dependencies": {
"fs-mkdirp-stream": "^1.0.0",
"glob-stream": "^6.1.0",
"graceful-fs": "^4.0.0",
"fs-mkdirp-stream": "^2.0.1",
"glob-stream": "^8.0.0",
"graceful-fs": "^4.2.11",
"iconv-lite": "^0.6.3",
"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"
"lead": "^4.0.0",
"normalize-path": "3.0.0",
"resolve-options": "^2.0.0",
"stream-composer": "^1.0.2",
"streamx": "^2.14.0",
"to-through": "^3.0.0",
"value-or-function": "^4.0.0",
"vinyl": "^3.0.0",
"vinyl-sourcemap": "^2.0.0"
},
"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"
"eslint": "^7.32.0",
"eslint-config-gulp": "^5.0.1",
"expect": "^27.5.1",
"mocha": "^8.4.0",
"nyc": "^15.1.0",
"readable-stream": "3.6.0",
"rimraf": "^3.0.2",
"sinon": "^15.0.2"
},
"nyc": {
"reporter": [
"lcov",
"text-summary"
]
},
"prettier": {
"singleQuote": true
},
"keywords": [

@@ -62,0 +64,0 @@ "gulp",

<p align="center">
<a href="http://gulpjs.com">
<a href="https://gulpjs.com">
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">

@@ -9,3 +9,3 @@ </a>

[![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]
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url]

@@ -28,3 +28,3 @@ [Vinyl][vinyl] adapter for the file system.

var log = function(file, cb) {
var log = function (file, cb) {
console.log(file.path);

@@ -34,3 +34,4 @@ cb(null, file);

vfs.src(['./js/**/*.js', '!./js/vendor/*.js'])
vfs
.src(['./js/**/*.js', '!./js/vendor/*.js'])
.pipe(map(log))

@@ -47,3 +48,3 @@ .pipe(vfs.dest('./output'));

__Note: UTF-8 BOM will be removed from all UTF-8 files read with `.src` unless disabled in the options.__
**Note: UTF-8 BOM will be removed from all UTF-8 files read with `.src` unless disabled in the options.**

@@ -57,3 +58,3 @@ #### Globs

```js
fs.src(['!b*', '*'])
fs.src(['!b*', '*']);
```

@@ -64,3 +65,3 @@

```js
fs.src(['*', '!b*'])
fs.src(['*', '!b*']);
```

@@ -105,5 +106,16 @@

##### `options.encoding`
Optionally transcode from the given encoding. The default is `'utf8'`. We use
[iconv-lite], please refer to its Wiki for a list of supported encodings. You
can set this to `false` to avoid any transcoding, and effectively just pass
around raw binary data.
Type: `String` or `Boolean`
Default: `'utf8'`
##### `options.sourcemaps`
Enables sourcemap support on files passed through the stream. Will load inline sourcemaps and resolve sourcemap links from files.
Enables sourcemap support on files passed through the stream. Will load inline sourcemaps and resolve sourcemap links from files.

@@ -126,3 +138,3 @@ Type: `Boolean`

__Note: This option is not resolved from a function because it is passed verbatim to node-glob.__
**Note: This option is not resolved from a function because it is passed verbatim to anymatch.**

@@ -135,3 +147,3 @@ Type: `Boolean`

Any glob-related options are documented in [glob-stream] and [node-glob] and are forwarded verbatim.
Any glob-related options are documented in [glob-stream] and [anymatch] and are forwarded verbatim.

@@ -146,13 +158,14 @@ ### `dest(folder[, options])`

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`.__
**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.__
**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.
**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

@@ -203,5 +216,16 @@

##### `options.encoding`
Optionally transcode to the given encoding. The default is `'utf8'`. We use
[iconv-lite], please refer to its Wiki for a list of supported encodings. You
can set this to `false` to avoid any transcoding, and effectively just pass
around raw binary data.
Type: `String` or `Boolean`
Default: `'utf8'`.
##### `options.sourcemaps`
Enables sourcemap support on files passed through the stream. Will write inline soucemaps if specified as `true`.
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.

@@ -227,3 +251,3 @@

__Note: This option will be ignored if a `junction` is being created, as they must be absolute.__
**Note: This option will be ignored if a `junction` is being created, as they must be absolute.**

@@ -248,10 +272,11 @@ Type: `Boolean`

__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: The file will be modified after being written to this stream.**
__Note: On Windows, directory links are created using Junctions by default. Use the `useJunctions` option to disable this behavior.__
- `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

@@ -290,3 +315,3 @@

__Note: This option will be ignored if a `junction` is being created, as they must be absolute.__
**Note: This option will be ignored if a `junction` is being created, as they must be absolute.**

@@ -333,24 +358,24 @@ Type: `Boolean`

## License
[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
MIT
[downloads-image]: http://img.shields.io/npm/dm/vinyl-fs.svg
<!-- prettier-ignore-start -->
[downloads-image]: https://img.shields.io/npm/dm/vinyl-fs.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/vinyl-fs
[npm-image]: http://img.shields.io/npm/v/vinyl-fs.svg
[npm-image]: https://img.shields.io/npm/v/vinyl-fs.svg?style=flat-square
[travis-url]: https://travis-ci.org/gulpjs/vinyl-fs
[travis-image]: http://img.shields.io/travis/gulpjs/vinyl-fs.svg?label=travis-ci
[ci-url]: https://github.com/gulpjs/vinyl-fs/actions?query=workflow:dev
[ci-image]: https://img.shields.io/github/actions/workflow/status/gulpjs/vinyl-fs/dev.yml??branch=master&style=flat-square
[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
[coveralls-image]: https://img.shields.io/coveralls/gulpjs/vinyl-fs.svg?style=flat-square
<!-- prettier-ignore-end -->
[gitter-url]: https://gitter.im/gulpjs/gulp
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
<!-- prettier-ignore-start -->
[symbolic-caveats]: #symbolic-links-on-windows
[glob-stream]: https://github.com/gulpjs/glob-stream
[anymatch]: https://github.com/micromatch/anymatch
[vinyl]: https://github.com/gulpjs/vinyl
[iconv-lite]: https://github.com/ashtuchkin/iconv-lite
<!-- prettier-ignore-end -->

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc