-
Notifications
You must be signed in to change notification settings - Fork 28
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
Use PassThrough stream instead of through2 #11
Conversation
We don’t need to use through2 in this case. We can use just a bare PassThrough stream. I introduced readable-stream module for more compatibility.
What are the benefits of readable-stream over through2? Curious before I make this change. |
|
Merged and published as I usually default to user land modules, but in this case, it seems like a good idea to go core. |
Not a huge deal, but this increases tap-dev-tool's compressed bundle size from 117kb to 143kb. Most likely because a lot of modules are using |
@mattdesl is that something that we should addressed? I've always just used through2 as a default when creating streams. |
The simplest way to reduce package size is just using the built-in var PassThrough = require('stream').PassThrough; However, the problem is, the Streams version differs depending on the Node version. For example the latest io.js includes Stream3 but node v0.10 includes Streams2. This would causes some unexpected behaviors especially in node v0.8 which includes Streams1. That is why I introduced readable-stream.
|
Yes, and most modules still use through2 v0.6.x which depends on the outdated readable-stream, though v2.0.0 has been released. If all the module authors upgrade through2 to v2.0.0 which depends on the latest readable-stream, npm will de-duplicate them well, because tap-out depends on the latest readable-stream. |
I don't think it's a huge problem in my case since the tool is typically only used during development. |
Cool. |
We don’t need to use through2 in this case. We can use just a bare PassThrough stream directly.
I introduced readable-stream module for more compatibility, instead of using the built-in
stream
. (ref: Why I don't use Node's core 'stream' module)