From a9137e5033ef76736371a4d68737206c9400144a Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Wed, 14 May 2025 19:31:47 +0100 Subject: [PATCH] lib: deprecate `_stream_*` modules --- doc/api/deprecations.md | 15 +++++++++++++++ lib/_stream_duplex.js | 5 +++-- lib/_stream_passthrough.js | 5 +++-- lib/_stream_readable.js | 5 +++-- lib/_stream_transform.js | 5 +++-- lib/_stream_wrap.js | 1 + lib/_stream_writable.js | 5 +++-- .../test-warn-stream-duplex-deprecation.js | 10 ++++++++++ .../test-warn-stream-passthrough-deprecation.js | 10 ++++++++++ .../test-warn-stream-readable-deprecation.js | 10 ++++++++++ .../test-warn-stream-transform-deprecation.js | 10 ++++++++++ ...ap.js => test-warn-stream-wrap-deprecation.js} | 0 .../test-warn-stream-writable-deprecation.js | 10 ++++++++++ 13 files changed, 81 insertions(+), 10 deletions(-) create mode 100644 test/parallel/test-warn-stream-duplex-deprecation.js create mode 100644 test/parallel/test-warn-stream-passthrough-deprecation.js create mode 100644 test/parallel/test-warn-stream-readable-deprecation.js create mode 100644 test/parallel/test-warn-stream-transform-deprecation.js rename test/parallel/{test-warn-stream-wrap.js => test-warn-stream-wrap-deprecation.js} (100%) create mode 100644 test/parallel/test-warn-stream-writable-deprecation.js diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 88f051904f8b7c..af92c4439de924 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -3918,6 +3918,21 @@ Type: Runtime The `node:_tls_common` and `node:_tls_wrap` modules are deprecated as they should be considered an internal nodejs implementation rather than a public facing API, use `node:tls` instead. +### DEP0193: `require('node:_stream_*')` + + + +Type: Runtime + +The `node:_stream_duplex`, `node:_stream_passthrough`, `node:_stream_readable`, `node:_stream_transform`, +`node:_stream_wrap` and `node:_stream_writable` modules are deprecated as they should be considered +an internal nodejs implementation rather than a public facing API, use `node:stream` instead. + [DEP0142]: #dep0142-repl_builtinlibs [NIST SP 800-38D]: https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf [RFC 6066]: https://tools.ietf.org/html/rfc6066#section-3 diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js index c32d589ae196fd..6b0cdb2d41403c 100644 --- a/lib/_stream_duplex.js +++ b/lib/_stream_duplex.js @@ -1,5 +1,6 @@ 'use strict'; -// Keep this file as an alias for the full stream module. - module.exports = require('stream').Duplex; + +process.emitWarning('The _stream_duplex module is deprecated.', + 'DeprecationWarning', 'DEP0193'); diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js index f1c775202805ef..cb3d0b8d7b2098 100644 --- a/lib/_stream_passthrough.js +++ b/lib/_stream_passthrough.js @@ -1,5 +1,6 @@ 'use strict'; -// Keep this file as an alias for the full stream module. - module.exports = require('stream').PassThrough; + +process.emitWarning('The _stream_passthrough module is deprecated.', + 'DeprecationWarning', 'DEP0193'); diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 4729e7fde3e393..38f1ab0a8ae4bb 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -1,5 +1,6 @@ 'use strict'; -// Keep this file as an alias for the full stream module. - module.exports = require('stream').Readable; + +process.emitWarning('The _stream_readable module is deprecated.', + 'DeprecationWarning', 'DEP0193'); diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js index 4901f296692d11..2570a7544917ac 100644 --- a/lib/_stream_transform.js +++ b/lib/_stream_transform.js @@ -1,5 +1,6 @@ 'use strict'; -// Keep this file as an alias for the full stream module. - module.exports = require('stream').Transform; + +process.emitWarning('The _stream_transform module is deprecated.', + 'DeprecationWarning', 'DEP0193'); diff --git a/lib/_stream_wrap.js b/lib/_stream_wrap.js index 904128a3824500..fc7a5ecdd7b961 100644 --- a/lib/_stream_wrap.js +++ b/lib/_stream_wrap.js @@ -1,5 +1,6 @@ 'use strict'; module.exports = require('internal/js_stream_socket'); + process.emitWarning('The _stream_wrap module is deprecated.', 'DeprecationWarning', 'DEP0125'); diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index d6f1974422d3f3..6b9d5e24fde601 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -1,5 +1,6 @@ 'use strict'; -// Keep this file as an alias for the full stream module. - module.exports = require('stream').Writable; + +process.emitWarning('The _stream_writable module is deprecated.', + 'DeprecationWarning', 'DEP0193'); diff --git a/test/parallel/test-warn-stream-duplex-deprecation.js b/test/parallel/test-warn-stream-duplex-deprecation.js new file mode 100644 index 00000000000000..bd6d885a3d0d1a --- /dev/null +++ b/test/parallel/test-warn-stream-duplex-deprecation.js @@ -0,0 +1,10 @@ +'use strict'; + +const common = require('../common'); + +// _stream_duplex is deprecated. + +common.expectWarning('DeprecationWarning', + 'The _stream_duplex module is deprecated.', 'DEP0193'); + +require('_stream_duplex'); diff --git a/test/parallel/test-warn-stream-passthrough-deprecation.js b/test/parallel/test-warn-stream-passthrough-deprecation.js new file mode 100644 index 00000000000000..397c93686b20c9 --- /dev/null +++ b/test/parallel/test-warn-stream-passthrough-deprecation.js @@ -0,0 +1,10 @@ +'use strict'; + +const common = require('../common'); + +// _stream_passthrough is deprecated. + +common.expectWarning('DeprecationWarning', + 'The _stream_passthrough module is deprecated.', 'DEP0193'); + +require('_stream_passthrough'); diff --git a/test/parallel/test-warn-stream-readable-deprecation.js b/test/parallel/test-warn-stream-readable-deprecation.js new file mode 100644 index 00000000000000..cb8b3a01a7d38a --- /dev/null +++ b/test/parallel/test-warn-stream-readable-deprecation.js @@ -0,0 +1,10 @@ +'use strict'; + +const common = require('../common'); + +// _stream_readable is deprecated. + +common.expectWarning('DeprecationWarning', + 'The _stream_readable module is deprecated.', 'DEP0193'); + +require('_stream_readable'); diff --git a/test/parallel/test-warn-stream-transform-deprecation.js b/test/parallel/test-warn-stream-transform-deprecation.js new file mode 100644 index 00000000000000..7872d9ebf0cf2d --- /dev/null +++ b/test/parallel/test-warn-stream-transform-deprecation.js @@ -0,0 +1,10 @@ +'use strict'; + +const common = require('../common'); + +// _stream_transform is deprecated. + +common.expectWarning('DeprecationWarning', + 'The _stream_transform module is deprecated.', 'DEP0193'); + +require('_stream_transform'); diff --git a/test/parallel/test-warn-stream-wrap.js b/test/parallel/test-warn-stream-wrap-deprecation.js similarity index 100% rename from test/parallel/test-warn-stream-wrap.js rename to test/parallel/test-warn-stream-wrap-deprecation.js diff --git a/test/parallel/test-warn-stream-writable-deprecation.js b/test/parallel/test-warn-stream-writable-deprecation.js new file mode 100644 index 00000000000000..a6e7e418f22f40 --- /dev/null +++ b/test/parallel/test-warn-stream-writable-deprecation.js @@ -0,0 +1,10 @@ +'use strict'; + +const common = require('../common'); + +// _stream_writable is deprecated. + +common.expectWarning('DeprecationWarning', + 'The _stream_writable module is deprecated.', 'DEP0193'); + +require('_stream_writable');