Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prefix stream/web import with node: #122

Merged
merged 1 commit into from
Oct 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion streams.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,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);
});