From 46f06235d24a766195bce2402c982d28a79c5500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20Wa=CC=88rting?= Date: Tue, 7 Sep 2021 16:51:17 +0200 Subject: [PATCH] using v4 --- package.json | 2 +- streams.cjs | 2 +- test.js | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index fde1adc..9b104a2 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,6 @@ } ], "dependencies": { - "web-streams-polyfill": "^3.0.3" + "web-streams-polyfill": "^4.0.0-beta.1" } } diff --git a/streams.cjs b/streams.cjs index 56b7388..e5776a2 100644 --- a/streams.cjs +++ b/streams.cjs @@ -7,7 +7,7 @@ if (!globalThis.ReadableStream) { Object.assign(globalThis, require('stream/web')) } catch (error) { // TODO: Remove when only supporting node >= 16.5.0 - Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js')) + require('web-streams-polyfill/polyfill') } } diff --git a/test.js b/test.js index 0a9688b..9a27ab1 100644 --- a/test.js +++ b/test.js @@ -388,9 +388,7 @@ test('returns a readable stream', t => { t.true(typeof stream.getReader === 'function'); }); -test('checking instanceof blob#stream', async t => { - // eslint-disable-next-line node/no-unsupported-features/es-syntax - const {ReadableStream} = await import('stream/web').catch(_ => import('web-streams-polyfill/dist/ponyfill.es2018.js')); +test('checking instanceof blob#stream', t => { const stream = new File([], '').stream(); - t.true(stream instanceof ReadableStream); + t.true(stream instanceof globalThis.ReadableStream); });