Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

iarna
Copy link
Contributor

@iarna iarna commented Oct 12, 2017

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.

lib/zlib.js Outdated
module.exports._SELECT_ZLIB = select

function select (version) {
return version >= 'v9' ? require('zlib') : require('minizlib')

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 :)

Copy link
Contributor Author

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

module.exports._SELECT_ZLIB = select

function select (version) {
return semver.gt(version, 'v9.0.0-0') ? require('zlib') : require('minizlib')
Copy link

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?

Copy link
Contributor

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.

@isaacs
Copy link
Owner

isaacs commented Nov 1, 2017

I think this is unnecessary now, because minizlib was updated to work with node 9?

@isaacs isaacs closed this Nov 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants