Description
This is intended to be a tracking issue to pull together a number of requests from a few different locations.
The basic problem is that browsers will ship features before fully stabilized. Often these features are behind flags or some other gating mechanism, but once the gates are all unlocked some pages are able to use these features, and Rust/wasm often want to use the features as well!
Currently we are not adding these unstable WebIDL definitions to web-sys because they are almost guaranteed to change. This means that we'd have to ship breaking changes which we would prefer not to do. We do, however, want to make it easier to consume these WebIDL files!
Split across a number of PRs, there's two possible solutions I think we have right now for supporting this:
- First we can use
--cfg
flags to support everything inweb-sys
itself. The general idea is thatweb-sys
would grow all the unstable WebIDL files, but you'd have to compile withRUSTFLAGS=--cfg=web_sys_unstable
to actually get anything to show up. This sort of "explicit opt in" would be required by everyone building a crate.
- The pro of this approach is that it centralizes all the WebIDL into this repository, taking the maintenance burden away from users
- The cons of this approach is that it's difficult to build for users and it puts more maintenance burden ehre.
- An alternative to putting these WebIDL annotations in
web-sys
itself would be to encourage users to publish their own crates synthesized from WebIDL. The general idea here is that this repository would publish a stable crate (or tool) which can be used to synthesize a crate from WebIDL. That way users could publish their ownwebxr-sys
(for example) and it would not be maintained in this repository. Once the specification stabilizes we'd move the WebIDL intoweb-sys
itself.
- The pro of this approach is that it doesn't have much maintenance burden on us in this repository. It also allows anyone to build their own crate with raw WebIDL in the same manner web-sys is built. This approach is also pretty easy for users to consume, they'd basically just depend on a crate.
- The cons of this approach are pretty bad though. This involves a relatively significant amount of infrastructure which doesn't exists, so would be difficult to start out. For example these new crates probably want to depend on
web-sys
for basic types to start, whichweb-sys
itself doesn't do at all (cross-crate dependencies). Additionally it puts the maintenance burden on users.
I'm still somewhat tempted to go with (1) myself, but we've had enough proposals running around here for awhile that I wanted to get this all written down myself!