From 3517f9dab3ffda7515c7dd6f3d7d7e5a7f50a2b0 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Fri, 15 Dec 2023 13:10:20 +0100 Subject: [PATCH] fixup old nodes Signed-off-by: Matteo Collina --- build/replacements.mjs | 4 ++-- lib/internal/streams/add-abort-signal.js | 2 +- lib/internal/streams/end-of-stream.js | 4 ++-- lib/internal/streams/pipeline.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/replacements.mjs b/build/replacements.mjs index 41d50de37..218f422be 100644 --- a/build/replacements.mjs +++ b/build/replacements.mjs @@ -276,8 +276,8 @@ const duplexFromTestWebStreamNeutralizeWritable = [ ] const polyfillAddAbortListener = [ - 'require\\(\'events\'\\).addAbortListener', - 'require(\'../../ours/util\').addAbortListener' + 'addAbortListener \\?\\?= require\\(\'events\'\\)\\.addAbortListener', + 'addAbortListener = addAbortListener || require(\'../../ours/util\').addAbortListener' ] const abortSignalAny = [ diff --git a/lib/internal/streams/add-abort-signal.js b/lib/internal/streams/add-abort-signal.js index ffaa732a4..3475b6e04 100644 --- a/lib/internal/streams/add-abort-signal.js +++ b/lib/internal/streams/add-abort-signal.js @@ -44,7 +44,7 @@ module.exports.addAbortSignalNoValidate = function (signal, stream) { if (signal.aborted) { onAbort() } else { - addAbortListener ??= require('../../ours/util').addAbortListener + addAbortListener = addAbortListener || require('../../ours/util').addAbortListener const disposable = addAbortListener(signal, onAbort) eos(stream, disposable[SymbolDispose]) } diff --git a/lib/internal/streams/end-of-stream.js b/lib/internal/streams/end-of-stream.js index aa7fff34e..29feb936b 100644 --- a/lib/internal/streams/end-of-stream.js +++ b/lib/internal/streams/end-of-stream.js @@ -213,7 +213,7 @@ function eos(stream, options, callback) { if (options.signal.aborted) { process.nextTick(abort) } else { - addAbortListener ??= require('../../ours/util').addAbortListener + addAbortListener = addAbortListener || require('../../ours/util').addAbortListener const disposable = addAbortListener(options.signal, abort) const originalCallback = callback callback = once((...args) => { @@ -240,7 +240,7 @@ function eosWeb(stream, options, callback) { if (options.signal.aborted) { process.nextTick(abort) } else { - addAbortListener ??= require('../../ours/util').addAbortListener + addAbortListener = addAbortListener || require('../../ours/util').addAbortListener const disposable = addAbortListener(options.signal, abort) const originalCallback = callback callback = once((...args) => { diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js index 138d3686f..a2bab8800 100644 --- a/lib/internal/streams/pipeline.js +++ b/lib/internal/streams/pipeline.js @@ -186,7 +186,7 @@ function pipelineImpl(streams, callback, opts) { function abort() { finishImpl(new AbortError()) } - addAbortListener ??= require('../../ours/util').addAbortListener + addAbortListener = addAbortListener || require('../../ours/util').addAbortListener let disposable if (outerSignal) { disposable = addAbortListener(outerSignal, abort)