From 9ff73fcdbefcb5d87bfb1d291cebd0f1f425bc60 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Thu, 24 Dec 2020 16:25:53 +0100 Subject: [PATCH] stream,zlib: do not use _stream_* anymore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/36618 Reviewed-By: Robert Nagy Reviewed-By: Rich Trott Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Benjamin Gruenbaum Reviewed-By: Michaƫl Zasso --- lib/internal/streams/pipeline.js | 2 +- lib/zlib.js | 3 +-- test/parallel/test-zlib-no-stream.js | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 test/parallel/test-zlib-no-stream.js diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js index 297606dfb84749..fe229bbd17ad57 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 05e0594f1981ae..18722c4f5ade7b 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 00000000000000..68da269ab8f57e --- /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');