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

Split streams into more features #2491

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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 features/async-iterable-streams.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ spec: https://streams.spec.whatwg.org/#rs-asynciterator
group: streams
compat_features:
- api.ReadableStream.@@asyncIterator
- api.ReadableStream.values
1 change: 1 addition & 0 deletions features/async-iterable-streams.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ status:
firefox_android: "110"
compat_features:
- api.ReadableStream.@@asyncIterator
- api.ReadableStream.values
26 changes: 26 additions & 0 deletions features/readable-byte-streams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Readable byte streams
description: Readable byte streams allow you to efficiently read bytes from a stream into a buffer without incurring extra copies.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For most features, we try to mention the most likely "entry point" to that feature in the description and then frame the feature in that context—in other words, what would a developer literally do with this feature? That said, I don't know a lot about this feature, other than what I've skimmed from the MDN and web.dev articles—so I'm really leaning on your input here. What do you think of something along these lines?

Also, given our discussion so far, I figure we should mention BYOB here. We have an "also known as" convention for feature names that I've suggested here.

Suggested change
description: Readable byte streams allow you to efficiently read bytes from a stream into a buffer without incurring extra copies.
description: A `ReadableStream` constructed with `{ type: "bytes" }` reads bytes from a stream without making extra copies, improving efficiency for streams of large chunks. Also known as BYOB or bring your own buffer.

spec: https://streams.spec.whatwg.org/
caniuse: streams
group: streams
status:
compute_from:
- api.ReadableStreamBYOBReader
compat_features:
- api.ReadableByteStreamController
- api.ReadableByteStreamController.byobRequest
- api.ReadableByteStreamController.close
- api.ReadableByteStreamController.desiredSize
- api.ReadableByteStreamController.enqueue
- api.ReadableByteStreamController.error
- api.ReadableStreamBYOBReader
- api.ReadableStreamBYOBReader.ReadableStreamBYOBReader
- api.ReadableStreamBYOBReader.cancel
- api.ReadableStreamBYOBReader.closed
- api.ReadableStreamBYOBReader.read
- api.ReadableStreamBYOBReader.releaseLock
- api.ReadableStreamBYOBReader.releaseLock.reject_pending_read_request
- api.ReadableStreamBYOBRequest
- api.ReadableStreamBYOBRequest.respond
- api.ReadableStreamBYOBRequest.respondWithNewView
- api.ReadableStreamBYOBRequest.view
45 changes: 45 additions & 0 deletions features/readable-byte-streams.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Generated from: readable-byte-streams.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
chrome: "89"
chrome_android: "89"
edge: "89"
firefox: "102"
firefox_android: "102"
compat_features:
# ⬇️ Same status as overall feature ⬇️
# baseline: false
# support:
# chrome: "89"
# chrome_android: "89"
# edge: "89"
# firefox: "102"
# firefox_android: "102"
- api.ReadableByteStreamController
- api.ReadableByteStreamController.byobRequest
- api.ReadableByteStreamController.close
- api.ReadableByteStreamController.desiredSize
- api.ReadableByteStreamController.enqueue
- api.ReadableByteStreamController.error
- api.ReadableStreamBYOBReader
- api.ReadableStreamBYOBReader.ReadableStreamBYOBReader
- api.ReadableStreamBYOBReader.cancel
- api.ReadableStreamBYOBReader.closed
- api.ReadableStreamBYOBReader.read
- api.ReadableStreamBYOBReader.releaseLock
- api.ReadableStreamBYOBRequest
- api.ReadableStreamBYOBRequest.respond
- api.ReadableStreamBYOBRequest.respondWithNewView
- api.ReadableStreamBYOBRequest.view

# baseline: false
# support:
# chrome: "105"
# chrome_android: "105"
# edge: "105"
# firefox: "102"
# firefox_android: "102"
- api.ReadableStreamBYOBReader.releaseLock.reject_pending_read_request
6 changes: 6 additions & 0 deletions features/readablestream-from.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: ReadableStream.from()
description: The `ReadableStream.from()` static method wraps iterable and async iterable objects, such as arrays or async generator functions, as a readable stream.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"wraps … as" reads a little funny to me (though I see that MDN uses the same language). What do you think of this instead, which borrows a construction from the iterator-methods feature description?

Suggested change
description: The `ReadableStream.from()` static method wraps iterable and async iterable objects, such as arrays or async generator functions, as a readable stream.
description: The `ReadableStream.from()` static method converts an iterable or async iterable object, such as an array or async generator function, into a readable stream.

spec: https://streams.spec.whatwg.org/#rs-from
group: streams
compat_features:
- api.ReadableStream.from_static
10 changes: 10 additions & 0 deletions features/readablestream-from.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Generated from: readablestream-from.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
firefox: "117"
firefox_android: "117"
compat_features:
- api.ReadableStream.from_static
6 changes: 6 additions & 0 deletions features/readablestreambyobreader-read-min.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: "ReadableStreamBYOBReader.read(): min option"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure whether developers think of this as a distinct feature or an embellishment on the BYOB feature above. In other features, we've taken narrow options like this to be "later additions" to an existing feature. Searching Stack Overflow doesn't turn up much for me (though I'm not sure I'm using the right terminology). On the other hand, this is very new, so maybe it's an unsettled question in general.

Basically, how sad would you be if we stuffed this compat_features key back into readable-byte-streams?

(We're working on some ways to improve this in the data model—to make it easier to split and merge things—so this isn't to say it must always be this way, but this the ongoing negotiation we've had to do in some features.)

description: The `min` option for `ReadableStreamBYOBReader.read(view, options)` sets the minimum number of elements that must be available before the read request will fulfill.
spec: https://streams.spec.whatwg.org/#ref-for-dom-readablestreambyobreaderreadoptions-min%E2%91%A0
group: streams
compat_features:
- api.ReadableStreamBYOBReader.read.options_min_parameter
10 changes: 10 additions & 0 deletions features/readablestreambyobreader-read-min.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Generated from: readablestreambyobreader-read-min.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
firefox: "134"
firefox_android: "134"
compat_features:
- api.ReadableStreamBYOBReader.read.options_min_parameter
31 changes: 5 additions & 26 deletions features/streams.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,19 @@
name: Streams
description: The streams API creates, composes, and consumes continuously generated data.
spec: https://streams.spec.whatwg.org/
caniuse: streams
group: streams
# TODO: https://github.com/web-platform-dx/web-features/issues/1971
# Status changed: https://github.com/web-platform-dx/web-features/pull/2358
# Status changed: https://github.com/web-platform-dx/web-features/pull/2358, https://github.com/web-platform-dx/web-features/pull/2491
# 2024-12-19 — low → false — Regressed status to match Caniuse, which considers support beginning at BYOB shipping.
# 2025-01-30 — false → high — Split BYOB into a separate "readable-byte-streams" feature. Linked that one to Caniuse.
# References:
# - https://caniuse.com/streams
status:
compute_from:
- api.ReadableStreamBYOBReader
- api.ReadableStream
- api.TransformStream
- api.WritableStream
compat_features:
- api.ReadableByteStreamController
- api.ReadableByteStreamController.byobRequest
- api.ReadableByteStreamController.close
- api.ReadableByteStreamController.desiredSize
- api.ReadableByteStreamController.enqueue
- api.ReadableByteStreamController.error
- api.ReadableStream.from_static
- api.ReadableStream.transferable
- api.ReadableStream.values
- api.ReadableStreamBYOBReader
- api.ReadableStreamBYOBReader.ReadableStreamBYOBReader
- api.ReadableStreamBYOBReader.cancel
- api.ReadableStreamBYOBReader.closed
- api.ReadableStreamBYOBReader.read
- api.ReadableStreamBYOBReader.read.options_min_parameter
- api.ReadableStreamBYOBReader.releaseLock
- api.ReadableStreamBYOBReader.releaseLock.reject_pending_read_request
- api.ReadableStreamBYOBRequest
- api.ReadableStreamBYOBRequest.respond
- api.ReadableStreamBYOBRequest.respondWithNewView
- api.ReadableStreamBYOBRequest.view
- api.ReadableStreamDefaultController
- api.ReadableStreamDefaultController.close
- api.ReadableStreamDefaultController.desiredSize
Expand All @@ -52,15 +33,13 @@ compat_features:
- api.TransformStream
- api.TransformStream.TransformStream
- api.TransformStream.readable
- api.TransformStream.transferable
- api.TransformStream.writable
- api.TransformStreamDefaultController
- api.TransformStreamDefaultController.desiredSize
- api.TransformStreamDefaultController.enqueue
- api.TransformStreamDefaultController.error
- api.TransformStreamDefaultController.terminate
- api.WritableStream.close
- api.WritableStream.transferable
- api.WritableStreamDefaultController.signal
- api.WritableStreamDefaultWriter.WritableStreamDefaultWriter
- api.ByteLengthQueuingStrategy
Expand Down
79 changes: 9 additions & 70 deletions features/streams.yml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
baseline: high
baseline_low_date: 2022-06-28
baseline_high_date: 2024-12-28
support:
chrome: "89"
chrome_android: "89"
edge: "89"
chrome: "67"
chrome_android: "67"
edge: "79"
firefox: "102"
firefox_android: "102"
safari: "14.1"
safari_ios: "14.5"
compat_features:
# baseline: high
# baseline_low_date: 2019-01-29
Expand Down Expand Up @@ -185,6 +189,7 @@ compat_features:
# safari_ios: "10.3"
- api.ReadableStream.pipeThrough

# ⬇️ Same status as overall feature ⬇️
# baseline: high
# baseline_low_date: 2022-06-28
# baseline_high_date: 2024-12-28
Expand Down Expand Up @@ -253,69 +258,3 @@ compat_features:
# firefox: "100"
# firefox_android: "100"
- api.ReadableStreamDefaultReader.ReadableStreamDefaultReader

# baseline: false
# support:
# chrome: "87"
# chrome_android: "87"
# edge: "87"
# firefox: "103"
# firefox_android: "103"
- api.ReadableStream.transferable
- api.TransformStream.transferable
- api.WritableStream.transferable

# ⬇️ Same status as overall feature ⬇️
# baseline: false
# support:
# chrome: "89"
# chrome_android: "89"
# edge: "89"
# firefox: "102"
# firefox_android: "102"
- api.ReadableByteStreamController
- api.ReadableByteStreamController.byobRequest
- api.ReadableByteStreamController.close
- api.ReadableByteStreamController.desiredSize
- api.ReadableByteStreamController.enqueue
- api.ReadableByteStreamController.error
- api.ReadableStreamBYOBReader
- api.ReadableStreamBYOBReader.ReadableStreamBYOBReader
- api.ReadableStreamBYOBReader.cancel
- api.ReadableStreamBYOBReader.closed
- api.ReadableStreamBYOBReader.read
- api.ReadableStreamBYOBReader.releaseLock
- api.ReadableStreamBYOBRequest
- api.ReadableStreamBYOBRequest.respond
- api.ReadableStreamBYOBRequest.respondWithNewView
- api.ReadableStreamBYOBRequest.view

# baseline: false
# support:
# chrome: "105"
# chrome_android: "105"
# edge: "105"
# firefox: "102"
# firefox_android: "102"
- api.ReadableStreamBYOBReader.releaseLock.reject_pending_read_request

# baseline: false
# support:
# chrome: "124"
# chrome_android: "124"
# edge: "124"
# firefox: "110"
# firefox_android: "110"
- api.ReadableStream.values

# baseline: false
# support:
# firefox: "117"
# firefox_android: "117"
- api.ReadableStream.from_static

# baseline: false
# support:
# firefox: "134"
# firefox_android: "134"
- api.ReadableStreamBYOBReader.read.options_min_parameter
8 changes: 8 additions & 0 deletions features/transferable-streams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Transferable streams
description: Streams are transferable objects, which can be moved between contexts such as workers.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Between" implies two things and I think making it explicit is nice. Does this wording work for you?

Suggested change
description: Streams are transferable objects, which can be moved between contexts such as workers.
description: Streams are transferable objects, which can be moved between contexts such as windows and workers.

spec: https://streams.spec.whatwg.org/#rs-transfer
group: streams
compat_features:
- api.ReadableStream.transferable
- api.TransformStream.transferable
- api.WritableStream.transferable
15 changes: 15 additions & 0 deletions features/transferable-streams.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Generated from: transferable-streams.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support:
chrome: "87"
chrome_android: "87"
edge: "87"
firefox: "103"
firefox_android: "103"
compat_features:
- api.ReadableStream.transferable
- api.TransformStream.transferable
- api.WritableStream.transferable
6 changes: 6 additions & 0 deletions features/transformstream-transformer-cancel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: "TransformStream: transformer.cancel method"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To align with our naming conventions here:

Suggested change
name: "TransformStream: transformer.cancel method"
name: TransformStream transformer cancel() method

description: The `cancel` method of a `TransformStream` transformer cleans up resources when the readable side is cancelled or the writable side is aborted.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nits:

Suggested change
description: The `cancel` method of a `TransformStream` transformer cleans up resources when the readable side is cancelled or the writable side is aborted.
description: The `cancel()` method of a `TransformStream` transformer cleans up resources when the readable side cancels or the writable side aborts.

spec: https://streams.spec.whatwg.org/#dom-transformer-cancel
group: streams
compat_features:
- api.TransformStream.TransformStream.transformer_cancel
8 changes: 8 additions & 0 deletions features/transformstream-transformer-cancel.yml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Generated from: transformstream-transformer-cancel.yml
# Do not edit this file by hand. Edit the source file instead!

status:
baseline: false
support: {}
compat_features:
- api.TransformStream.TransformStream.transformer_cancel