zlib: convert classes to modern syntax and eol DEP0184 - #64849
Open
anonrig wants to merge 1 commit into
Open
Conversation
Collaborator
|
Review requested:
|
anonrig
force-pushed
the
zlib-class-syntax-eol-dep0184
branch
from
July 30, 2026 19:11
f7c3750 to
920a4fe
Compare
Convert ZlibBase, Zlib, and the remaining zlib/Brotli stream constructors to ES6 class syntax. Calling these constructors without `new` is no longer supported (DEP0184 End-of-Life); use `new` or the create* factory helpers instead. This is a semver-major change: code that relied on `zlib.Gzip()` (without `new`) will now throw TypeError. The createGzip/createDeflate helpers and all documented `new`-based usage remain unchanged. The wire behavior and public options are preserved. Refs: nodejs#55718 Refs: nodejs#54708 Assisted-by: Grok Signed-off-by: Yagiz Nizipli <yagiz@nizipli.com>
anonrig
force-pushed
the
zlib-class-syntax-eol-dep0184
branch
from
July 30, 2026 19:32
920a4fe to
cdbe481
Compare
| Instantiating classes without the `new` qualifier exported by the `node:zlib` module is deprecated. | ||
| It is recommended to use the `new` qualifier instead. This applies to all Zlib classes, such as `Deflate`, | ||
| `DeflateRaw`, `Gunzip`, `Inflate`, `InflateRaw`, `Unzip`, and `Zlib`. | ||
| Instantiating classes without the `new` qualifier exported by the `node:zlib` module is no longer |
Member
There was a problem hiding this comment.
can we have small before/after code example
AugustinMauroy
approved these changes
Jul 30, 2026
avivkeller
approved these changes
Jul 30, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #64849 +/- ##
=======================================
Coverage 90.15% 90.16%
=======================================
Files 746 746
Lines 242778 242722 -56
Branches 45747 45741 -6
=======================================
- Hits 218878 218846 -32
+ Misses 15378 15366 -12
+ Partials 8522 8510 -12
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Convert the remaining
node:zlibstream constructors (ZlibBase,Zlib, Deflate/Inflate/Gzip family, and Brotli) to ES6 class syntax, matching the earlier Zstd conversion.Calling these constructors without
newis End-of-Life for DEP0184. Usenewor thecreate*factory helpers instead.Why
DEP0184 has been a runtime deprecation since v24.0.0 (documentation-only since v22.9.0 / v20.18.0). Converting to class syntax both modernizes the implementation and hard-enforces the requirement for
new.Behavior change (semver-major)
zlib.Gzip()works with DEP0184 warningTypeErrornew zlib.Gzip()zlib.createGzip()Changes
lib/zlib.js: convert constructors toclass/extends; dropdeprecateInstantiation/ObjectSetPrototypeOfinheritance setupdoc/api/deprecations.md: mark DEP0184 as End-of-Lifenew, assert without-newthrows, update subclass example to class syntaxTest plan
python3 tools/test.pyall 65test/parallel/test-zlib*tests — all passnewand*SynchelpersnewthrowsTypeErrormake lint-js/make lint-mdRefs: #55718
Refs: #54708