-
-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fallback to zlib from minizlib on Node 9 #144
Conversation
lib/zlib.js
Outdated
module.exports._SELECT_ZLIB = select | ||
|
||
function select (version) { | ||
return version >= 'v9' ? require('zlib') : require('minizlib') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> 'v9.0.0' >= 'v9'
true
> 'v9.1.0' >= 'v9'
true
> 'v10.0.0' >= 'v9'
false
… just saying :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The price I pay for being maximally lazy XD
f2a079f
to
6096831
Compare
module.exports._SELECT_ZLIB = select | ||
|
||
function select (version) { | ||
return semver.gt(version, 'v9.0.0-0') ? require('zlib') : require('minizlib') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably could have also done something like parseInt(version.slice(1), 10) >= 9
to avoid having to pull in semver
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering how widely-used semver
is, I fully expect this to just be a deduped dep, and I'd much rather have semver-awareness here. I don't think this will actually have much of an effect on the dependency tree, in the end.
I think this is unnecessary now, because minizlib was updated to work with node 9? |
Does what it says, gives us an escape valve if minizlib can't be made to work w/ Node 9.
I've tested this with my own build of the
v9.x
branch of Node as of 7e382c1540.