hughsk/vinyl-source-stream — pull request #12 by phestermcs (2014-12-22 16:38:16+00:00)
Title: Populate cwd and base properties of created Vinyl object, just like gulp.src() does.

Since cwd and base are not populated, downstream transforms that rely on them will not work. For example: [gulp-sourcemaps (index.js)](https://github.com/floridoo/gulp-sourcemaps/blob/master/index.js#L218-223)

It appears the first version attempted to populate cwd and base, but then [puma](https://github.com/hughsk/vinyl-source-stream/commits/master/index.js?author=pluma) saw it was not being done correctly, and then completely removed setting them stating they weren't necessary; not true as shown above in gulp-sourcemaps.

There is an open [PR](https://github.com/hughsk/vinyl-source-stream/pull/8) that attempts to populate just base, but it's logic may use [__dirname](http://nodejs.org/docs/latest/api/globals.html#globals_dirname) which is completely wrong as __dirname is based on the source location of the currently executing code!

I looked at exactly how gulp-src() creates vinyl objects, and made changes so vinyl-source-stream can match that behavior, including an optional 'opts' object argument which can contain cwd, base, and cwdbase properties, having the same effect as those options have when passed to gulp.src().