* Pre-generating web-sys
* Fixing build errors
* Minor refactor for the unit tests
* Changing to generate #[wasm_bindgen} annotations
* Fixing code generation
* Adding in main bin to wasm-bindgen-webidl
* Fixing more problems
* Adding in support for unstable APIs
* Fixing bug with code generation
* More code generation fixes
* Improving the webidl program
* Removing unnecessary cfg from the generated code
* Splitting doc comments onto separate lines
* Improving the generation for unstable features
* Adding in support for string values in enums
* Now runs rustfmt on the mod.rs file
* Fixing codegen for constructors
* Fixing webidl-tests
* Fixing build errors
* Another fix for build errors
* Renaming typescript_name to typescript_type
* Adding in docs for typescript_type
* Adding in CI script to verify that web-sys is up to date
* Fixing CI script
* Fixing CI script
* Don't suppress git diff output
* Remove duplicate definitions of `Location`
Looks to be a preexisting bug in wasm-bindgen?
* Regenerate webidl
* Try to get the git diff command right
* Handle named constructors in WebIDL
* Remove stray rustfmt.toml
* Add back NamedConstructorBar definition in tests
* Run stable rustfmt over everything
* Don't run Cargo in a build script
Instead refactor things so webidl-tests can use the Rust-code-generation
as a library in a build script. Also fixes `cargo fmt` in the
repository.
* Fixup generated code
* Running web-sys checks on stable
* Improving the code generation a little
* Running rustfmt
Co-authored-by: Alex Crichton <alex@alexcrichton.com>
* Re-enable WebGPU WebIDL as experimental
* Add `web_sys_unstable_apis` attribute
* Add test for unstable WebIDL
* Include unstable WebIDL in docs.rs builds
* Add docs and doc comment for unstable APIs
* Add unstable API checks to CI
* Add support for #[wasm_bindgen(inspectable)]
This annotation generates a `toJSON` and `toString` implementation for
generated JavaScript classes which display all readable properties
available via the class or its getters
This is useful because wasm-bindgen classes currently serialize to
display one value named `ptr`, which does not model the properties of
the struct in Rust
This annotation addresses rustwasm/wasm-bindgen#1857
* Support console.log for inspectable attr in Nodejs
`#[wasm_bindgen(inspectable)]` now generates an implementation of
`[util.inspect.custom]` for the Node.js target only. This implementation
causes `console.log` and friends to yield the same class-style output,
but with all readable fields of the Rust struct displayed
* Reduce duplication in generated methods
Generated `toString` and `[util.inspect.custom]` methods now call
`toJSON` to reduce duplication
* Store module name in variable
This commit adds support to attach `#[wasm_bindgen]` on an `async fn`
which will change the return value into a `Promise` in JS. This in
theory has the exact same semantics as an `async` function in JS where
you call it with all the arguments, nothing happens and you get a
promise back, and then later the promise actually resolves.
This commit also adds a helper trait, `IntoJsResult`, to allow `async`
functions with multiple kinds of return values instead of requiring
everything to be `Result<JsValue, JsValue>`.
This fixes an issue also reported to upstream (rust-lang/rust#62628) to
ensure that we parse the `final` attribute as either `r#final` or
`final`, since now the compiler is giving us `r#final` and we were
previously only accepting `final`.
The parsing here was a bit wonky, but this setup ended up working!
Most of the CLI crates were already in the 2018 edition, and it turns
out that one of the macro crates was already in the 2018 edition so we
may as well move everything to the 2018 edition!
Always nice to remove those `extern crate` statements nowadays!
This commit also does a `cargo fmt --all` to make sure we're conforming
with style again.