Fallback to zlib from minizlib on Node 9#144
Closed
iarna wants to merge 1 commit intoisaacs:masterfrom
Closed
Conversation
addaleax
reviewed
Oct 12, 2017
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.
> 'v9.0.0' >= 'v9'
true
> 'v9.1.0' >= 'v9'
true
> 'v10.0.0' >= 'v9'
false… just saying :)
Contributor
Author
There was a problem hiding this comment.
The price I pay for being maximally lazy XD
2 tasks
f2a079f to
6096831
Compare
mscdex
reviewed
Oct 18, 2017
| 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.
Probably could have also done something like parseInt(version.slice(1), 10) >= 9 to avoid having to pull in semver?
Contributor
There was a problem hiding this comment.
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.
Owner
|
I think this is unnecessary now, because minizlib was updated to work with node 9? |
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.
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.xbranch of Node as of 7e382c1540.