summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatteo Collina <hello@matteocollina.com>2020-12-24 16:25:53 +0100
committerBeth Griggs <bgriggs@redhat.com>2021-01-28 17:56:03 +0000
commit9ff73fcdbefcb5d87bfb1d291cebd0f1f425bc60 (patch)
tree864f74f1e363cce74b21c8399c0f62c6e68d13c8
parent25a3204fe29a8470f5a90a6bf424059757a09363 (diff)
downloadnode-new-9ff73fcdbefcb5d87bfb1d291cebd0f1f425bc60.tar.gz
stream,zlib: do not use _stream_* anymore
PR-URL: https://github.com/nodejs/node/pull/36618 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
-rw-r--r--lib/internal/streams/pipeline.js2
-rw-r--r--lib/zlib.js3
-rw-r--r--test/parallel/test-zlib-no-stream.js14
3 files changed, 16 insertions, 3 deletions
diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js
index 297606dfb8..fe229bbd17 100644
--- a/lib/internal/streams/pipeline.js
+++ b/lib/internal/streams/pipeline.js
@@ -213,7 +213,7 @@ function pipeline(...streams) {
}
} else {
if (!PassThrough) {
- PassThrough = require('_stream_passthrough');
+ PassThrough = require('internal/streams/passthrough');
}
// If the last argument to pipeline is not a stream
diff --git a/lib/zlib.js b/lib/zlib.js
index 05e0594f19..18722c4f5a 100644
--- a/lib/zlib.js
+++ b/lib/zlib.js
@@ -47,7 +47,7 @@ const {
},
hideStackFrames
} = require('internal/errors');
-const Transform = require('_stream_transform');
+const { Transform, finished } = require('stream');
const {
deprecate
} = require('internal/util');
@@ -57,7 +57,6 @@ const {
} = require('internal/util/types');
const binding = internalBinding('zlib');
const assert = require('internal/assert');
-const finished = require('internal/streams/end-of-stream');
const {
Buffer,
kMaxLength
diff --git a/test/parallel/test-zlib-no-stream.js b/test/parallel/test-zlib-no-stream.js
new file mode 100644
index 0000000000..68da269ab8
--- /dev/null
+++ b/test/parallel/test-zlib-no-stream.js
@@ -0,0 +1,14 @@
+/* eslint-disable node-core/required-modules */
+/* eslint-disable node-core/require-common-first */
+
+'use strict';
+
+// We are not loading common because it will load the stream module,
+// defeating the purpose of this test.
+
+const { gzipSync } = require('zlib');
+
+// Avoid regressions such as https://github.com/nodejs/node/issues/36615
+
+// This must not throw
+gzipSync('fooobar');