gulp: gulp 5 seems to break existing streaming plugins

What were you expecting to happen?

After upgrading from gulp 4.x to gulp 5, I was expecting my built-in plugin to “streamify” async functions so they can be put in the gulp pipeline without having to write bespoke plugins for everything to work as before.

What actually happened?

Tests around streamify hang. Breaking into the code, I see that the original transform creation is called, the transform is passed back, and the body of the transform is never executed.

Please give us a sample of your gulpfile

See example at https://github.com/fluffynuts/gulp-streamify - streamify.spec.ts has the calls to gulp, so you can npm test to see the failures.

Whilst I’ve pulled this out into its own repo to make it easier to use to repro the issue, this plugin is not published, and may never be, as it’s consumed internally on another project.

I’ve included the original function as-is, using through2, and an “updated” one based on the docs at https://github.com/gulpjs/gulp/tree/master/docs/writing-a-plugin - both don’t work.

Please provide the following information:

  • OS & version: Windows 11 23h2 (22631.3155)
  • node version (run node -v): 18.18.2
  • npm version (run npm -v): 9.8.1
  • gulp version (run gulp -v): 5.0.0

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Most upvoted comments

In working on the glob-stream bug: https://github.com/gulpjs/glob-stream/issues/127 I realized that the fundamental issue here might be that the “Sandbox” module is probably producing a path outside the cwd so nothing is globbed. That issue will be fixed by https://github.com/gulpjs/glob-stream/pull/131.

I tried to debug merge2, so far have not figured out what’s the edge condition. I will continue to try to find a minimum way to reproduce it.

gulp-typescript is too big for me to debug, but it’s much widely used.

ok, whilst I try to figure out what I have to do to “sink correctly”, please take note that:

  1. this worked 100% fine in gulp 3 and 4 (and works again when I downgrade from 5 to 4). This is quite a breaking change which will likely cause many plugins to fail, and it would appear to be a change in behavior from the expectation from node streams? Or was the prior behavior buggy?
  2. I’ve followed the example as per https://github.com/gulpjs/gulp/tree/master/docs/writing-a-plugin as well, so if I’m missing something from there, then, at the very least, the documentation could likely be improved.