Closed tandrewnichols closed 6 years ago
Hi, this bug comes from `gulp4 -> vinyl-fs -> to-through: https://github.com/gulpjs/to-through/blob/master/index.js#L39
I don't understand streams well enough to know what that comment means. Are you saying it's a bug in to-through? Or just highlighting something that changed that's affecting this lib?
To add to the weirdness . . .
const noop = through.obj((file, enc, cb) => cb(null, file));
return merge(
gulp.src([/*list of 8 files */]).pipe(noop),
gulp.src([/*list of 32 files */]).pipe(noop)
).pipe(debug({ title: 'Files:' })) // Outputs "Files: 15"
which I don't understand cause that's basically exactly what gulp-debug does, but using gulp-debug after each .src() makes the last debug correctly see 40 files.
Ok, returning a through
function makes it work correctly (as opposed to using through directly. So ignore that second item. The initial issue still exists, however.
Fixed, v1.2.1
.
The finish
event will emit before data
event in "to-through".
But "merge2" should not listen finish
, because it is a writeable stream event.
Fantastic! I'll give it a try!
For example, this doesn't work.
But this does.
I noticed this when I switched from the alpha version of gulp 4 to the one installed via
gulp@next
(which is 4.0.0).