fix: prefix stream/web import with node: (#122)
This commit is contained in:
@@ -18,6 +18,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- Run test WPT test against our impl [#109]
|
||||
- File name are now casted to string [#109]
|
||||
- Slicing in the middle of multiple parts added more bytes than what what it should have [#109]
|
||||
- Prefixed `stream/web` import with `node:` to allow easier static analysis detection of Node built-ins [#122]
|
||||
|
||||
## v3.1.2
|
||||
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ const POOL_SIZE = 65536;
|
||||
|
||||
if (!globalThis.ReadableStream) {
|
||||
try {
|
||||
Object.assign(globalThis, require('stream/web'))
|
||||
Object.assign(globalThis, require('node:stream/web'))
|
||||
} catch (error) {
|
||||
// TODO: Remove when only supporting node >= 16.5.0
|
||||
Object.assign(globalThis, require('web-streams-polyfill/dist/ponyfill.es2018.js'))
|
||||
|
||||
@@ -438,7 +438,7 @@ test('returns a readable stream', t => {
|
||||
|
||||
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'));
|
||||
const {ReadableStream} = await import('node:stream/web').catch(_ => import('web-streams-polyfill/dist/ponyfill.es2018.js'));
|
||||
const stream = new File([], '').stream();
|
||||
t.true(stream instanceof ReadableStream);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user