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

stream: move legacy to lib/internal dir #8197

Closed
wants to merge 5 commits into from

Conversation

yorkie
Copy link
Contributor

@yorkie yorkie commented Aug 20, 2016

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

stream

Description of change

This won't fix anything problem or adds any new feature, it just makes the "lib/stream.js" clear to read in my opinion, I'm unsure if this makes any sense, if the feedback from anyone in @nodejs/collaborators is negative, feel free to close :-)

@nodejs-github-bot nodejs-github-bot added stream Issues and PRs related to the stream subsystem. build Issues and PRs related to build files or the CI. labels Aug 20, 2016
@seishun
Copy link
Contributor

seishun commented Aug 20, 2016

I don't feel qualified to judge the implementation, but +1 on the idea.

@@ -0,0 +1,91 @@
'use strict';
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this belongs in lib/internal/streams/ instead?

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 reason is? IMO the legacy stream class should not be internal class, it's exposed to user-land, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense, especially since everything in the file is exported. Nevermind! :)

@Fishrock123
Copy link
Contributor

I think it would be better to put it in an internal file and have _stream_legacy export it as deprecated.

@yorkie
Copy link
Contributor Author

yorkie commented Aug 21, 2016

@Fishrock123 what do you mean by "have _stream_legacy" export it as deprecated"? Could you explain more, thanks :-)

@yorkie
Copy link
Contributor Author

yorkie commented Aug 21, 2016

And I will try to put the legacy file to internal dir as @Fishrock123 and @brendanashworth expected.

@jasnell
Copy link
Member

jasnell commented Aug 21, 2016

@nodejs/streams ... please take a look at this. Would moving this to internal have a detrimental impact on the readable-streams module?

@mcollina
Copy link
Member

@yorkie we have 3 major versions of streams: 1, 2 and 3. "legacy" is version 1, and it is used by modules such as through, split, serial-port and the like. It comes from the 0.8 era. Since 0.10 we had streams 2, and streams 3. Streams 3 are fairly stable, with their own quirks.

I think we should deprecate streams 1 as semver-major, and maybe remove it in a year or two.

I'll leave the question about readable-stream to @calvinmetcalf

@rvagg rvagg force-pushed the master branch 2 times, most recently from c133999 to 83c7a88 Compare October 18, 2016 17:02
@mcollina
Copy link
Member

@calvinmetcalf ping?

@mcollina
Copy link
Member

@jasnell @yorkie no it would not. We can move to internal without issues: there is no difference for us the moment it's on another file.

@calvinmetcalf
Copy link
Contributor

I mean yes this would involve a bit of work to upgrade readable-stream, but it wouldn't be a big deal, honestly a drop in the bucket compared to other stuff so don't worry about it on my account.

@mcollina
Copy link
Member

@yorkie can you please rebase/update this PR on top of master, we can land this.

@yorkie
Copy link
Contributor Author

yorkie commented Jan 6, 2017

@mcollina does this PR necessary to land, current master seems not have the internal dir?

@mcollina
Copy link
Member

mcollina commented Jan 6, 2017

@yorkie
Copy link
Contributor Author

yorkie commented Jan 6, 2017

Rebased done @mcollina :)

@mcollina
Copy link
Member

mcollina commented Jan 6, 2017

@yorkie I've re-read this PR, and the majority idea is to move the legacy file into the internal folder. Can you do that as well?

@yorkie yorkie changed the title stream: move legacy to sep file stream: move legacy to lib/internal dir Jan 7, 2017
@yorkie
Copy link
Contributor Author

yorkie commented Jan 7, 2017

@mcollina Done and running a new CI: https://ci.nodejs.org/job/node-test-pull-request/5748 :)

@MylesBorins
Copy link
Contributor

MylesBorins commented Jan 7, 2017

citgm: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/510/

edit: now with windows :D 🎉

@yorkie
Copy link
Contributor Author

yorkie commented Jan 17, 2017

Ping, and any reviews? Thanks :)

lib/stream.js Outdated
@@ -1,11 +1,18 @@
'use strict';

module.exports = Stream;

const EE = require('events');
const util = require('util');
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused.

lib/stream.js Outdated
util.inherits(Stream, EE);
function Stream() {
EE.call(this);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What I meant previously is why can't we just move this into the new internal module and export it into this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it :)

lib/stream.js Outdated
var Stream = require('internal/streams/stream').Stream;

// wrap the old-style stream
require('internal/streams/legacy')(Stream);
Copy link
Member

@mcollina mcollina Jan 17, 2017

Choose a reason for hiding this comment

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

This is not clear to me. Basically the definition of Stream is divided into two files, whicn is not easy to understand in my opinion. If we also move the definition of Stream, I think internal/streams/stream should also include the 'legacy' bits.

How about we move all _stream prefixed files into internal/streams? That might be a better solution overall.
cc @nodejs/streams.

Copy link
Contributor

Choose a reason for hiding this comment

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

You couldn't just move those files because that would break someone trying to require() them? Unless you mean leave behind similarly-named files that simple re-export?

Also, I think the point of this PR was to separate the actual old Stream implementation from the other things, like the re-exporting of the various stream types.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, but then why split the definition of it in one file, and the legacy part in another?
Either we just move the legacy bits, we move the full definition, or we move all the streams parts.

I'm 👎 in having both internal/streams/stream and internal/streams/legacy, if we are not moving along readable, writable, etc.

}
util.inherits(Stream, EE);

exports.Stream = Stream;
Copy link
Contributor

@mscdex mscdex Jan 17, 2017

Choose a reason for hiding this comment

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

This whole file should be merged with lib/internal/streams/legacy.js

The legacy.js file should then just module.exports = Stream; and lib/stream.js should just require() that.

Copy link
Member

Choose a reason for hiding this comment

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

Just saw this, I think we agree.

@yorkie
Copy link
Contributor Author

yorkie commented Jan 17, 2017

Done :)

@mcollina
Copy link
Member

LGTM if CI and CITGM are green.

@italoacasas
Copy link
Contributor

Can we land this @mcollina ?

@mcollina
Copy link
Member

mcollina commented Feb 1, 2017

CITGM has some unrelated failures.

@mcollina
Copy link
Member

mcollina commented Feb 1, 2017

Landed as 1b30df1.

@mcollina mcollina closed this Feb 1, 2017
mcollina pushed a commit that referenced this pull request Feb 1, 2017
Improve readability of lib/stream.js by moving the legacy abstract
Stream into lib/internal/streams/legacy.js.

PR-URL: #8197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Feb 2, 2017
Improve readability of lib/stream.js by moving the legacy abstract
Stream into lib/internal/streams/legacy.js.

PR-URL: nodejs#8197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@yorkie yorkie deleted the refine/stream branch February 4, 2017 01:48
italoacasas pushed a commit to italoacasas/node that referenced this pull request Feb 14, 2017
Improve readability of lib/stream.js by moving the legacy abstract
Stream into lib/internal/streams/legacy.js.

PR-URL: nodejs#8197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@jasnell
Copy link
Member

jasnell commented Mar 7, 2017

Requires a backport PR to land on v4

jasnell pushed a commit that referenced this pull request Mar 7, 2017
Improve readability of lib/stream.js by moving the legacy abstract
Stream into lib/internal/streams/legacy.js.

PR-URL: #8197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
Improve readability of lib/stream.js by moving the legacy abstract
Stream into lib/internal/streams/legacy.js.

PR-URL: #8197
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.