-
Notifications
You must be signed in to change notification settings - Fork 30k
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
stream: move prefixed files into internal/streams. #11957
Conversation
cc @nodejs/streams @italoacasas |
Marking as semver major because this will break code that requires these files directly. |
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.
Changes LGTM with one nit.
We need to see how widely these files are required directly in the ecosystem. cc: @ChALkeR
node.gyp
Outdated
'lib/_stream_duplex.js', | ||
'lib/_stream_transform.js', | ||
'lib/_stream_passthrough.js', | ||
'lib/internal/streams/readable.js', |
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.
Can you keep these with the other lib/internal
files.
@cjihrig done. |
Unfortunately we need to keep stubs in Moving the actual code into 'use strict';
process.emitWarning('The {filename} module is deprecated. Please use ....',
'DeprecationWarning', 'DEP00XX');
module.exports = require('internal/{filename}.js'); (Where |
@jasnell how long do we need to keep stubs for? Is it a security attack? If a malicious user can stick a file on disk, I would say the system is already compromised. |
Yeah, it's not a significant risk but it's still non-zero. The stubs need to remain long enough to give users sufficient time to move away from using them, which depends entirely on how extensively they are used. A quick search on GitHub for "require('_stream_readable')" returns around 14k hits where people are doing things like |
We do need to at least deprecate them. We should get some data on the usage before deciding. |
This change make sense if we can get rid of the old files in 9 or 10. Is this the case? |
@Fishrock123 I do not know how to get that data. |
Assuming the ecosystem usage is not too high, it should be possible to remove the files by Node.js 10.0.0. |
@jasnell @Fishrock123 updated with a deprecation. |
doc/api/deprecations.md
Outdated
@@ -582,6 +582,19 @@ deprecated. | |||
*Note*: `OutgoingMessage.prototype._renderHeaders` was never documented as | |||
an officially supported API. | |||
|
|||
<a id="DEP0068"></a> | |||
### DEP0068: Usage of _stream_* |
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.
For now, make this `DEP00XX', we can update the number when it lands, that way there's no risk of conflict
doc/api/deprecations.md
Outdated
Using `require('_stream_readable')`, | ||
`require('_stream_writable')`, `require('_stream_duplex')` | ||
`require('_stream_transform')`, `require('_stream_passthrough')` | ||
is now deprecated. |
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.
Perhaps show the approved/proper way of getting these references.
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.
Generally LGTM with a couple of suggestions
I would really like to have someone else from @nodejs/streams check this. @jasnell updated. |
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.
i think it looks good, we didn't allow the prefixed access in readable streams the same was, (you needed to do lib/_stream_writable) so I don't see any problem at all
I will merge on Monday 27th if no one objects. |
@jasnell we need to include |
No, the original files are moved and still retain the copyright header. The stubs are new and do not require it. |
@mcollina do you have some time soon to rebase? |
He's on vacation for the next couple of weeks. |
Ping @mcollina |
Closed due to no progress over a long time. @mcollina please feel free to reopen when you get to it again. |
This simplifies the lib/ folder, and hides _stream_readable.js and
peers into lib/internal/streams. All the tests have been updated to
use the main stream module, rather than requiring from the internals.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
stream