diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js index 9e46d02ddcb..c32d589ae19 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -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; diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js index dbf8646e009..f1c77520280 100644 --- a/lib/_stream_passthrough.js +++ b/lib/_stream_passthrough.js @@ -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; diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index c31dde30645..4729e7fde3e 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -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; diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js index 50150638d9d..4901f296692 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -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; diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index e328a9434c8..d6f1974422d 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -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; diff --git a/test/parallel/test-stream-aliases-legacy.js b/test/parallel/test-stream-aliases-legacy.js new file mode 100644 index 00000000000..2c87f0ad0fa --- /dev/null +++ b/test/parallel/test-stream-aliases-legacy.js @@ -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')); diff --git a/test/parallel/test-stream-pipe-after-end.js b/test/parallel/test-stream-pipe-after-end.js index 2eb714b2ca7..045d27e0855 100644 --- a/test/parallel/test-stream-pipe-after-end.js +++ b/test/parallel/test-stream-pipe-after-end.js @@ -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) { diff --git a/test/parallel/test-stream-pipe-needDrain.js b/test/parallel/test-stream-pipe-needDrain.js index 0836c81da22..7faf45417a5 100644 --- a/test/parallel/test-stream-pipe-needDrain.js +++ b/test/parallel/test-stream-pipe-needDrain.js @@ -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. { diff --git a/test/parallel/test-stream2-base64-single-char-read-end.js b/test/parallel/test-stream2-base64-single-char-read-end.js index 10259e28045..2e1eb15f9fd 100644 --- a/test/parallel/test-stream2-base64-single-char-read-end.js +++ b/test/parallel/test-stream2-base64-single-char-read-end.js @@ -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' }); diff --git a/test/parallel/test-stream2-basic.js b/test/parallel/test-stream2-basic.js index 7121f7bda75..862e4541762 100644 --- a/test/parallel/test-stream2-basic.js +++ b/test/parallel/test-stream2-basic.js @@ -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; diff --git a/test/parallel/test-stream2-compatibility.js b/test/parallel/test-stream2-compatibility.js index bd0314ec1a9..d760db8b322 100644 --- a/test/parallel/test-stream2-compatibility.js +++ b/test/parallel/test-stream2-compatibility.js @@ -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; diff --git a/test/parallel/test-stream2-decode-partial.js b/test/parallel/test-stream2-decode-partial.js index 9b1baf7fd67..9d9ae21bfec 100644 --- a/test/parallel/test-stream2-decode-partial.js +++ b/test/parallel/test-stream2-decode-partial.js @@ -1,6 +1,6 @@ 'use strict'; require('../common'); -const Readable = require('_stream_readable'); +const { Readable } = require('stream'); const assert = require('assert'); let buf = ''; diff --git a/test/parallel/test-stream2-objects.js b/test/parallel/test-stream2-objects.js index f58ea4a32a1..a6723daca6c 100644 --- a/test/parallel/test-stream2-objects.js +++ b/test/parallel/test-stream2-objects.js @@ -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) { diff --git a/test/parallel/test-stream2-readable-from-list.js b/test/parallel/test-stream2-readable-from-list.js index 6564a01691f..d5d113304e4 100644 --- a/test/parallel/test-stream2-readable-from-list.js +++ b/test/parallel/test-stream2-readable-from-list.js @@ -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'); diff --git a/test/parallel/test-stream2-readable-non-empty-end.js b/test/parallel/test-stream2-readable-non-empty-end.js index ba289fb9127..417f2c3b0e9 100644 --- a/test/parallel/test-stream2-readable-non-empty-end.js +++ b/test/parallel/test-stream2-readable-non-empty-end.js @@ -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); diff --git a/test/parallel/test-stream2-readable-wrap-destroy.js b/test/parallel/test-stream2-readable-wrap-destroy.js index b0f4714c741..e310ae09e6f 100644 --- a/test/parallel/test-stream2-readable-wrap-destroy.js +++ b/test/parallel/test-stream2-readable-wrap-destroy.js @@ -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(); diff --git a/test/parallel/test-stream2-readable-wrap-empty.js b/test/parallel/test-stream2-readable-wrap-empty.js index 1489717f3e4..3dbbdaa9b5a 100644 --- a/test/parallel/test-stream2-readable-wrap-empty.js +++ b/test/parallel/test-stream2-readable-wrap-empty.js @@ -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(); diff --git a/test/parallel/test-stream2-readable-wrap-error.js b/test/parallel/test-stream2-readable-wrap-error.js index a05ae8179b0..2d2c26e2cad 100644 --- a/test/parallel/test-stream2-readable-wrap-error.js +++ b/test/parallel/test-stream2-readable-wrap-error.js @@ -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 { diff --git a/test/parallel/test-stream2-readable-wrap.js b/test/parallel/test-stream2-readable-wrap.js index 69f055fd7e5..eebe72bc0dd 100644 --- a/test/parallel/test-stream2-readable-wrap.js +++ b/test/parallel/test-stream2-readable-wrap.js @@ -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) { diff --git a/test/parallel/test-stream2-set-encoding.js b/test/parallel/test-stream2-set-encoding.js index 0095fa544db..2d35b161bf0 100644 --- a/test/parallel/test-stream2-set-encoding.js +++ b/test/parallel/test-stream2-set-encoding.js @@ -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) { diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index ad9e1a2237b..fe27c1c1b6d 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -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 diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js index 03835bb1bd0..3d16fb62df3 100644 --- a/test/parallel/test-stream2-writable.js +++ b/test/parallel/test-stream2-writable.js @@ -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 {