Skip to content

Commit

Permalink
stream: do not use _stream_* anymore
Browse files Browse the repository at this point in the history
Remove all leftover usage of _stream_* and keep all of them as legacy.
We do not deprecate the old modules to avoid disrupition and ease
maintainance.

PR-URL: #36684
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
mcollina authored and danielleadams committed Jan 12, 2021
1 parent 67dd48e commit b996e3b
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 40 deletions.
5 changes: 2 additions & 3 deletions lib/_stream_duplex.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

// TODO(mcollina): deprecate this file
// Keep this file as an alias for the full stream module.

const Duplex = require('internal/streams/duplex');
module.exports = Duplex;
module.exports = require('stream').Duplex;
5 changes: 2 additions & 3 deletions lib/_stream_passthrough.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

// TODO(mcollina): deprecate this file
// Keep this file as an alias for the full stream module.

const PassThrough = require('internal/streams/passthrough');
module.exports = PassThrough;
module.exports = require('stream').PassThrough;
5 changes: 2 additions & 3 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

// TODO(mcollina): deprecate this file
// Keep this file as an alias for the full stream module.

const Readable = require('internal/streams/readable');
module.exports = Readable;
module.exports = require('stream').Readable;
5 changes: 2 additions & 3 deletions lib/_stream_transform.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

// TODO(mcollina): deprecate this file
// Keep this file as an alias for the full stream module.

const Transform = require('internal/streams/transform');
module.exports = Transform;
module.exports = require('stream').Transform;
5 changes: 2 additions & 3 deletions lib/_stream_writable.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

// TODO(mcollina): deprecate this file
// Keep this file as an alias for the full stream module.

const Writable = require('internal/streams/writable');
module.exports = Writable;
module.exports = require('stream').Writable;
14 changes: 14 additions & 0 deletions test/parallel/test-stream-aliases-legacy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict';

require('../common');

const assert = require('assert');
const stream = require('stream');

// Verify that all individual aliases are left in place.

assert.strictEqual(stream.Readable, require('_stream_readable'));
assert.strictEqual(stream.Writable, require('_stream_writable'));
assert.strictEqual(stream.Duplex, require('_stream_duplex'));
assert.strictEqual(stream.Transform, require('_stream_transform'));
assert.strictEqual(stream.PassThrough, require('_stream_passthrough'));
3 changes: 1 addition & 2 deletions test/parallel/test-stream-pipe-after-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const Readable = require('_stream_readable');
const Writable = require('_stream_writable');
const { Readable, Writable } = require('stream');

class TestReadable extends Readable {
constructor(opt) {
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stream-pipe-needDrain.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

const common = require('../common');
const assert = require('assert');
const Readable = require('_stream_readable');
const Writable = require('_stream_writable');
const { Readable, Writable } = require('stream');

// Pipe should pause temporarily if writable needs drain.
{
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stream2-base64-single-char-read-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

'use strict';
require('../common');
const R = require('_stream_readable');
const W = require('_stream_writable');
const { Readable: R, Writable: W } = require('stream');
const assert = require('assert');

const src = new R({ encoding: 'base64' });
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stream2-basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
'use strict';

const common = require('../common');
const R = require('_stream_readable');
const W = require('_stream_writable');
const { Readable: R, Writable: W } = require('stream');
const assert = require('assert');

const EE = require('events').EventEmitter;
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stream2-compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

'use strict';
require('../common');
const R = require('_stream_readable');
const W = require('_stream_writable');
const { Readable: R, Writable: W } = require('stream');
const assert = require('assert');

let ondataCalled = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-decode-partial.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
require('../common');
const Readable = require('_stream_readable');
const { Readable } = require('stream');
const assert = require('assert');

let buf = '';
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stream2-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
'use strict';

const common = require('../common');
const Readable = require('_stream_readable');
const Writable = require('_stream_writable');
const { Readable, Writable } = require('stream');
const assert = require('assert');

function toArray(callback) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-readable-from-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
'use strict';
require('../common');
const assert = require('assert');
const fromList = require('_stream_readable')._fromList;
const fromList = require('stream').Readable._fromList;
const BufferList = require('internal/streams/buffer_list');
const util = require('util');

Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-readable-non-empty-end.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const Readable = require('_stream_readable');
const { Readable } = require('stream');

let len = 0;
const chunks = new Array(10);
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-readable-wrap-destroy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';
const common = require('../common');

const Readable = require('_stream_readable');
const { Readable } = require('stream');
const EE = require('events').EventEmitter;

const oldStream = new EE();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-readable-wrap-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'use strict';
const common = require('../common');

const Readable = require('_stream_readable');
const { Readable } = require('stream');
const EE = require('events').EventEmitter;

const oldStream = new EE();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-readable-wrap-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const common = require('../common');
const assert = require('assert');

const Readable = require('_stream_readable');
const { Readable } = require('stream');
const EE = require('events').EventEmitter;

class LegacyStream extends EE {
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stream2-readable-wrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const Readable = require('_stream_readable');
const Writable = require('_stream_writable');
const { Readable, Writable } = require('stream');
const EE = require('events').EventEmitter;

function runTest(highWaterMark, objectMode, produce) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-stream2-set-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const R = require('_stream_readable');
const { Readable: R } = require('stream');

class TestReader extends R {
constructor(n, opts) {
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stream2-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
'use strict';
const common = require('../common');
const assert = require('assert');
const PassThrough = require('_stream_passthrough');
const Transform = require('_stream_transform');
const { PassThrough, Transform } = require('stream');

{
// Verify writable side consumption
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stream2-writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
'use strict';

const common = require('../common');
const W = require('_stream_writable');
const D = require('_stream_duplex');
const { Writable: W, Duplex: D } = require('stream');
const assert = require('assert');

class TestWriter extends W {
Expand Down

0 comments on commit b996e3b

Please sign in to comment.