swiftwasm / WebAPIKit

Access the DOM and other Web APIs from Swift! (Very much a WIP)
MIT License
61 stars 8 forks source link

Add `webcodecs` IDL spec and generated code #16

Closed MaxDesiatov closed 2 years ago

MaxDesiatov commented 2 years ago

This is a requirement for webgl2, which I'm going to add in a future PR.

MaxDesiatov commented 2 years ago

@j-f1 I needed a manual change in 6781702 to fix the absence of BitrateMode, not sure if this a bug in IDL, or the parser, or our generator?

j-f1 commented 2 years ago

I recommend temporarily changing parse-all.js to output JSON.stringify(parsedFiles), and then running node parse-all.js > specs.json. You’ll be able to search for "name": "BitrateMode" in the resulting file, and then use VS Code’s “Go to Parent Fold” command to find that the BitrateMode type is defined in the mediastream-recording spec.

MaxDesiatov commented 2 years ago

Marking this as draft until https://github.com/swiftwasm/DOMKit/pull/19 is resolved.

j-f1 commented 2 years ago

Heads up that a few types have been disabled because they depend on specs not included in the initial PR, so feel free to remove any of these that work now:

https://github.com/swiftwasm/WebAPIKit/blob/45f476a7ca582d8ebf5623c4493aa4194b416bb2/Sources/WebIDLToSwift/IDLBuilder.swift#L19-L22

https://github.com/swiftwasm/WebAPIKit/blob/45f476a7ca582d8ebf5623c4493aa4194b416bb2/Sources/WebIDLToSwift/IDLBuilder.swift#L96-L99

MaxDesiatov commented 2 years ago

Checked that list, only CanvasImageSource can be auto-generated cleanly. OffscreenRenderingContext needs full WebGL2 spec to work in a related enum.