Commit Graph

134 Commits

Author SHA1 Message Date
6d61cd8b76 Bump to 0.2.61 (#2113) 2020-04-29 11:22:35 -05:00
826538922f Copy more doc comments to JS/TS files, unescape comments (#2070)
* Copy more doc comments to JS/TS files, unescape comments

* Move unescape code to macro-support
2020-04-13 13:51:32 -05:00
2b128288c7 Add ability to rename enums (js_name = new_name) (#2071)
* Add ability to rename enums (js_name = new_name)

* Add a test
2020-04-13 09:14:41 -05:00
b9f78aba57 try to fix js_name error when both getter and setter used (#2074)
* try to fix js_name error when both `getter` and `setter` used

* add tests
2020-04-10 11:57:36 -05:00
a19c8a3fe0 Bump to 0.2.60 (#2051)
* Bump to 0.2.60

* Try to fix CI

* Fix CI syntax
2020-03-25 16:33:36 -05:00
db8d3e4412 Bump to 0.2.59 (#2026)
Wow this is a big release!
2020-03-03 10:55:51 -06:00
7ffb5ed70c Add skip_typescript attribute to prevent .d.ts emit (#2016)
* Add skip_typescript attribute to prevent .d.ts emit

* Add guide page for typescript attribute
2020-03-03 09:34:28 -06:00
3f4acc453b Dramatically improving the build time of web-sys (#2012)
* 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>
2020-03-02 17:39:36 -06:00
381660c49b Run rustfmt and keep it running on CI (#2023)
Thought we did this awhile back, but looks like we forgot to do so!
2020-03-02 11:44:14 -06:00
99c59a771e [WIP] Add support for unstable WebIDL (#1997)
* 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
2020-02-26 16:30:11 -06:00
ec1b9453c9 Allow web-sys to emit correct typescript declarations from webidl (#1998)
* Update to emit typescript names

* Update to use NamedAnyref

* Update incoming / outgoing

* Remove added space

* Remove comment

* Add basic typescript tests for web-sys
2020-02-19 09:14:32 -06:00
2902ceb26f Bump to 0.2.58 (#1946) 2020-01-07 13:48:25 -06:00
56e4d7de1d Bump to 0.2.57 (#1943) 2020-01-06 13:17:28 -06:00
580daab1d3 Release 0.2.56 (#1922) 2019-12-20 10:31:17 -06:00
df34cf843e Allow for js property inspection (#1876)
* 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
2019-11-26 12:39:57 -06:00
db9d603c8f Bump to 0.2.55 (#1864) 2019-11-19 11:04:37 -06:00
3573164b52 Bump to 0.2.54 (#1854) 2019-11-07 12:59:01 -06:00
c7c169ae72 Bump to 0.2.53 (#1840) 2019-10-29 09:37:37 -05:00
513285f73d Run rustfmt 2019-10-28 20:15:05 -07:00
a20dd26dde Bump to 0.2.52 (#1833) 2019-10-24 16:08:45 -05:00
6d1dc813c4 Bump to 0.2.51 (#1797)
This notably brings in async/await support for current beta/nightly
users. Yay!
2019-09-26 14:07:28 -05:00
88618116ac Add support for #[wasm_bindgen] on async fn (#1754)
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>`.
2019-09-06 13:47:16 -05:00
c2daa4f63c Bump to 0.2.50 2019-08-19 04:21:27 -07:00
c1d4fddeac Bump to 0.2.49 2019-08-14 08:32:02 -07:00
45b43905b4 Upgrade to syn/quote 1.0
Fresh off the presses let's start the update!
2019-08-13 10:37:08 -07:00
a48a0aeb93 Merge pull request #1654 from fitzgen/no-import-shims
Skip generating JS import shims when unnecessary
2019-07-15 10:13:11 -07:00
bce892b625 Add #[wasm_bindgen(assert_no_shim)] on imported functions for testing
This should not be used outside of wasm-bindgen's test suite.
2019-07-12 12:34:29 -07:00
4f86653e0d Fix parsing of final on Nightly Rust
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!
2019-07-12 10:05:11 -07:00
e596ef596c Bump to 0.2.48 2019-07-11 15:02:39 -07:00
d71ab78fc6 Bump to 0.2.47 2019-06-19 11:14:37 -07:00
00d47c1958 Remove unnecessary Result return 2019-06-16 22:24:27 -03:00
8fc0a38402 Bump to 0.2.46 2019-06-14 11:44:58 -07:00
39b5f1845d Fix a warning 2019-05-28 07:03:42 -07:00
9b04fe9e45 Merge pull request #1545 from infinity0/master
Work around rust-lang/rust#58516
2019-05-21 08:58:59 -05:00
81fb2d97d3 Work around rust-lang/rust#58516 2019-05-20 20:18:24 -07:00
137bbdf2e3 Bump to 0.2.45 2019-05-20 09:44:03 -07:00
773c6ff430 Bump to 0.2.44 2019-05-16 07:47:23 -07:00
578d59ebc0 Merge pull request #1440 from c410-f3r/getters
Getters/Setters for fields
2019-04-30 12:07:34 -05:00
470eea9fb0 Getters/Setters for fields 2019-04-30 10:26:03 -03:00
f2429be07f Bump to 0.2.43 2019-04-29 08:28:41 -07:00
3a7d384dc8 Generate bindings for indexed struct properties
This allows to export fields of tuple-like structs as indexed JS properties.
2019-04-17 12:56:14 +01:00
ff1addbbaa Run cargo fmt 2019-04-16 10:52:27 -07:00
00c4dd9b6f Merge branch 'master' into add-wasm-bindgen-skip-attr 2019-04-14 23:43:21 +03:00
cb880bdbff Add customisable is_type_of 2019-04-12 17:23:42 +01:00
df6e15e3ab Bump to 0.2.42 2019-04-11 07:39:45 -07:00
02394724ea Bump to 0.2.41 2019-04-10 10:53:32 -07:00
f48fdec21e Fix imported usage of wasm_bindgen macro
Make sure it refers to `__wasm_bindgen_class_marker` via an absolute
path!

Closes #1422
2019-04-04 09:56:16 -07:00
1dcf468c9d add wasm_bindgen(skip) attr to disable getters and setters exposure of pub fields 2019-03-30 05:09:02 +02:00
a6fe0cefa8 Migrate all crates to the 2018 edition
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.
2019-03-26 08:10:53 -07:00
6803c619bb Bump to 0.2.40 2019-03-21 17:08:48 -07:00