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

Fix require() of readable-stream to allow usage of node-core stream #56

Merged
merged 3 commits into from Jun 14, 2018

Conversation

heri16
Copy link
Contributor

@heri16 heri16 commented Jun 11, 2018

No description provided.

bl.js Outdated
@@ -1,4 +1,4 @@
var DuplexStream = require('readable-stream/duplex')
var DuplexStream = require('stream').Duplex || require('readable-stream').Duplex
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately no. It should be require('readable-stream').Duplex if you want to change this.
This is not really a fallback, but a dependency in the true sense.

@heri16
Copy link
Contributor Author

heri16 commented Jun 12, 2018

Is there a reason for pinning to userland? Were there changes to the Streams API since the oldest nodejs LTS version till current?

Readable-streams library reads whether process.env.READABLE_STREAM has been disabled. Is it safe to set this flag?

@heri16
Copy link
Contributor Author

heri16 commented Jun 12, 2018

I have revised the code to get Duplex from main readable.js .

https://github.com/nodejs/readable-stream/blob/b3cf9b1f46eaa1865930ae03b96d7a4a570746f0/readable.js#L7

This allows the application code to give precedence to core-land stream rather than userland stream.

@heri16 heri16 changed the title Fix incorrect fallback pattern of readable-stream Fix require() of readable-stream to allow usage of node-core stream Jun 12, 2018
@mcollina
Copy link
Collaborator

There is no need for this. Duplex will always be present in readable-stream.
The reason why this is more stable is that bl inherits from Duplex. If we depended from the one in core, this module would need maintainance/work because of any semver-major changes that land there. By depending on readable-stream, this module became very stable.

@heri16
Copy link
Contributor Author

heri16 commented Jun 12, 2018

Agreed. Enough to just have var DuplexStream = require('readable-stream').Duplex

Instead of the current var DuplexStream = require('readable-stream/duplex')

bl.js Outdated
@@ -1,4 +1,4 @@
var DuplexStream = require('readable-stream/duplex')
var DuplexStream = require('readable-stream').Duplex || require('stream').Duplex
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove require('stream').Duplex?

@heri16
Copy link
Contributor Author

heri16 commented Jun 13, 2018

Yes. Will do so once I get to my laptop

@heri16
Copy link
Contributor Author

heri16 commented Jun 14, 2018

Updated with much thanks.

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.

None yet

2 participants