Skip to content

stream: deprecate piping to emitters without prependListener - #68009

Open
mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:stream-deprecate-prependlistener-fallback
Open

mcollina wants to merge 1 commit into
nodejs:mainfrom
mcollina:stream-deprecate-prependlistener-fallback

Conversation

@mcollina

@mcollina mcollina commented Dec 4, 2026

Copy link
Copy Markdown
Member

Rebase of #62435 onto current main. That
PR is stalled and scheduled for automatic closure, so this carries the change
forward.

The prependListener method has been available on EventEmitter since Node.js
v6.0.0 (April 2016). The internal fallback code in legacy.js that manually
manipulates the _events object is only needed to support versions before
that.

This adds a runtime deprecation (DEP0216) that fires when piping to an
EventEmitter that lacks the prependListener method, so users have time to
migrate before the fallback code is removed in a future version.

Supersedes #62435

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams
  • @nodejs/userland-migrations

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to Node.js streams. labels Dec 4, 2026
The prependListener method has been available on EventEmitter since
Node.js v6.0.0 (April 2016). The internal fallback code in legacy.js
that manually manipulates the `_events` object is only needed to
support versions before that.

This adds a runtime deprecation that fires when piping to an
EventEmitter that lacks the prependListener method, so that users have
time to migrate before the fallback code is removed in a future version.

Signed-off-by: Karan Mangtani <karan.mangtani@lrn.com>
@mcollina
mcollina force-pushed the stream-deprecate-prependlistener-fallback branch from 86f308d to e12a7e3 Compare December 4, 2026 09:30
@mcollina mcollina added the semver-major PRs that contain breaking changes and should be released in the next major version. label Dec 4, 2026
@codecov

codecov Bot commented Dec 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.57%. Comparing base (9cf1a9c) to head (e12a7e3).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #68009      +/-   ##
==========================================
- Coverage   90.58%   90.57%   -0.02%     
==========================================
  Files         802      802              
  Lines      286955   287051      +96     
  Branches    55417    55432      +15     
==========================================
+ Hits       259945   259986      +41     
- Misses      17107    17156      +49     
- Partials     9903     9909       +6     
Files with missing lines Coverage Δ
lib/internal/streams/legacy.js 97.08% <100.00%> (+0.25%) ⬆️

... and 42 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version. stream Issues and PRs related to Node.js streams.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants