Commit Graph

1287 Commits

Author SHA1 Message Date
Richard Dodd (dodj)
801d62ae68 Add some notes about viewing bindings output. (#521)
* Add some notes about viewing bindings output.

I found this helpful when debugging, so I thought others might too.

* Fix formatting

* Another formatting fix
2018-07-20 10:41:31 -05:00
Richard Dodd (dodj)
ff1eb345e0 Link to docs in README. (#522) 2018-07-20 10:41:07 -05:00
T. Nagasawa
bec1c95b5c bindings for to_locale_XXX_case (#523) 2018-07-20 09:03:29 -05:00
Nick Fitzgerald
cec12ae2d8
Merge pull request #520 from cdisselkoen/typo-fixes
Fix a few typos in guide
2018-07-19 17:36:15 -07:00
Craig Disselkoen
ad5bc8fc8d Fix a few typos in guide 2018-07-19 16:41:35 -07:00
Nick Fitzgerald
87596fba28
Merge pull request #516 from jrakow/iso-changelog
use iso8601 dates in changelog
2018-07-19 13:20:44 -07:00
Julius Rakow
c591d7a106
use iso8601 dates in changelog 2018-07-19 22:18:34 +02:00
Alex Crichton
512e280409 Update documentation step to build for js-sys 2018-07-19 13:04:29 -07:00
Alex Crichton
2d70a51370 Publication cleanup 2018-07-19 13:03:52 -07:00
Alex Crichton
aa348f963f
Bump to 0.2.12 (#515)
* Bump to 0.2.12

* Update all version numbers and deps
* Update all listed authors to `["The wasm-bindgen Developers"]`
* Update `repository` links to specific paths for each crate
* Update `homepage` links to the online book
* Update all links away from `alexcrichton/wasm-bindgen`
* Add `#[doc]` directives for HTML URLs

* Update more version requirements

* Fill out CHANGELOG
2018-07-19 14:57:04 -05:00
Alex Crichton
cbeb301371
Add support for optional slice types (#507)
* Shard the `convert.rs` module into sub-modules

Hopefully this'll make the organization a little nicer over time!

* Start adding support for optional types

This commit starts adding support for optional types to wasm-bindgen as
arguments/return values to functions. The strategy here is to add two new
traits, `OptionIntoWasmAbi` and `OptionFromWasmAbi`. These two traits are used
as a blanket impl to implement `IntoWasmAbi` and `FromWasmAbi` for `Option<T>`.

Some consequences of this design:

* It should be possible to ensure `Option<SomeForeignType>` implements to/from
  wasm traits. This is because the option-based traits can be implemented for
  foreign types.
* A specialized implementation is possible for all types, so there's no need for
  `Option<T>` to introduce unnecessary overhead.
* Two new traits is a bit unforutnate but I can't currently think of an
  alternative design that works for the above two constraints, although it
  doesn't mean one doesn't exist!
* The error messages for "can't use this type here" is actually halfway decent
  because it says these new traits need to be implemented, which provides a good
  place to document and talk about what's going on here!
* Nested references like `Option<&T>` can't implement `FromWasmAbi`. This means
  that you can't define a function in Rust which takes `Option<&str>`. It may be
  possible to do this one day but it'll likely require more trait trickery than
  I'm capable of right now.

* Add support for optional slices

This commit adds support for optional slice types, things like strings and
arrays. The null representation of these has a pointer value of 0, which should
never happen in normal Rust. Otherwise the various plumbing is done throughout
the tooling to enable these types in all locations.

* Fix `takeObject` on global sentinels

These don't have a reference count as they're always expected to work, so avoid
actually dropping a reference on them.

* Remove some no longer needed bindings

* Add support for optional anyref types

This commit adds support for optional imported class types. Each type imported
with `#[wasm_bindgen]` automatically implements the relevant traits and now
supports `Option<Foo>` in various argument/return positions.

* Fix building without the `std` feature

* Actually fix the build...

* Add support for optional types to WebIDL

Closes #502
2018-07-19 14:44:23 -05:00
Alex Crichton
6eef5f7b52
Move the js module to a js_sys crate (#512)
* Move the `js` module to a `js_sys` crate

* Update js-sys tests to pass again

* Update binding_to_unimplemented_apis_doesnt_break_everything

Remove its dependency on the `js` module

* Update metadata for js-sys

* Fix the `closures` example
2018-07-19 14:30:58 -05:00
Nick Fitzgerald
3e2d1e6519
Merge pull request #511 from alexcrichton/tweak-types
Add support for more slice types in WebIDL
2018-07-19 11:08:09 -07:00
Alex Crichton
4eaa1a5639 Add support for more slice types in WebIDL
Add support for the primitive type arrays, and additionally switch `ByteString`
to `String` instead of `Vec<u8>` according to the online documentation.
2018-07-19 08:46:45 -07:00
Jonathan Kingston
4013fd90a7 Implementing Element in web-sys (#508) 2018-07-19 10:46:26 -05:00
dependabot[bot]
e99c6b7c61 Bump webpack-cli from 3.0.8 to 3.1.0
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.0.8 to 3.1.0.
- [Release notes](https://github.com/webpack/webpack-cli/releases)
- [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack/webpack-cli/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-19 14:34:45 +00:00
Alex Crichton
a949482e3a
Remove usage of #[wasm_custom_section] (#509)
This has been stabilized on nightly as `#[link_section]`, so no need for an
unstable attribute any more. Yay!
2018-07-19 08:57:18 -05:00
Alex Crichton
9b6804a01b
Translate ByteString in WebIDL to [u8] (#505)
In arguments take `&[u8]` and in return value return `Vec<u8>`. Should help fill
out a few more APIs on `Header` and `Response`!
2018-07-18 17:59:24 -05:00
data-pup
32fa5724dd Set.prototype.forEach and Array.prototype.forEach (#504)
* Array.prototype.forEach binding.

* Set.prototype.forEach binding.
2018-07-18 13:32:07 -05:00
data-pup
f0dcdc249c Map.prototype.forEach binding. (#501) 2018-07-18 10:30:52 -05:00
Sendil Kumar N
bc474aceba Expose math.random, string.endswith, string.normalize, string.repeat, escape() JSBindings (#499)
* add math.random

* add ends with

replace length with variable

* add normalize

* add repeat

* add escape
2018-07-18 09:56:15 -05:00
Ben Merritt
478e3fcedf Add basic support for [NoInterfaceObject] attribute (#497) 2018-07-18 00:23:17 -05:00
Craig Disselkoen
a05d930a38 Bindings for TypedArray subclasses (#486)
* Bindings for TypedArray subclasses

* Fill with Rust values rather than JsValues
2018-07-17 18:24:56 -05:00
Alex Crichton
bf64f74cab
Fix symbol conflicts defined in two crates (#496)
Not a lot of attention has been paid to dealing with conflicts of symbols
between crates and different `#[wasm_bindgen]` blocks. This commit starts to fix
this issue by unblocking #486 which first ran into this. Currently there's a bug
where if two independent crates bind the same JS API they'll generate the same
symbol which causes conflicts for things like LTO or linking in general.

This commit starts to add a "salt" to all symbols generated by `wasm-bindgen`
(these are all transparent to the user) to ensure that each crate's invocations
are kept apart from one another and using the correct bindings.
2018-07-17 18:24:48 -05:00
Alex Crichton
9218c40613
Move __wbindgen_global_argument_ptr around (#494)
Make sure it's in the same module as our "link hack" to ensure it's always
linked in.

Closes #492
2018-07-17 16:56:22 -05:00
data-pup
c26caf6354 String - padEnd, padStart (#493) 2018-07-17 16:56:16 -05:00
data-pup
5f2f30dba1 String - lastIndexOf (#490) 2018-07-17 12:12:36 -05:00
Richard Dodd (dodj)
9d27b44a4a Fix extra-traits feature (#491) 2018-07-17 10:28:44 -05:00
dependabot[bot]
6753285899 Bump webpack from 4.16.0 to 4.16.1
Bumps [webpack](https://github.com/webpack/webpack) from 4.16.0 to 4.16.1.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v4.16.0...v4.16.1)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-07-17 15:08:39 +00:00
Alex Crichton
ed05c7b945
Fix compile on latest nightly (#489) 2018-07-17 09:11:30 -05:00
Nick Fitzgerald
1baf8f3ead
Merge pull request #485 from alexcrichton/fix-llvm
Work around #483
2018-07-16 14:37:43 -07:00
Alex Crichton
e1e80a9b7e Work around #483
This commit adds a hack to the `wasm-bindgen` CLI tool to work around #483 which
is present on nightly Rust with the recent LLVM upgrade. Hopefully this'll carry
us forward until the [upstream bug][1] is fixed.

Closes #483

[1]: https://bugs.llvm.org/show_bug.cgi?id=38184
2018-07-16 13:44:41 -07:00
Sendil Kumar N
1d3e8f442d
Merge pull request #482 from derekdreery/patch-1
fix link
2018-07-15 20:54:26 +02:00
Richard Dodd (dodj)
07d16ec892
fix link 2018-07-15 18:33:28 +00:00
Stephan Wolski
4cc069bd01 Clean up Some Clippy Warnings (#478)
* clippy: it is more idiomatic to loop over references to containers instead of using explicit iteration methods

* clippy: useless use of `format!`

* clippy: if/else is an expression

* clippy: use of  followed by a function call

* clippy: large size difference between variants

* clippy: redundant closure

* Revert "clippy: large size difference between variants"

This reverts commit 7e2e660dd4.

* Revert "clippy: it is more idiomatic to loop over references to containers instead of using explicit iteration methods"

This reverts commit 5c4804f790.
2018-07-15 11:43:55 -05:00
Tomohide Takao
babc2134e1 Remove target_args from Array.find_index() (#479) 2018-07-14 23:10:27 -05:00
R. Andrew Ohana
89e8a4561e use npm ci in ci (#481) 2018-07-14 22:45:58 -05:00
R. Andrew Ohana
16cbca74e2 deal with yet another locale/platform issue (#480)
This test fails on my system. As previously decided, until we can
figure out a better solution for this issue, for now we just check
to make sure the output is a non-empty string.
2018-07-14 22:45:49 -05:00
R. Andrew Ohana
0b78b345e1
Merge pull request #476 from jrakow/const-signed-unsiged
split const integers into signed and unsigned
2018-07-14 17:22:15 -07:00
Nick Fitzgerald
c6c5afca00
Merge pull request #475 from dorayakikun/master
Bindings for Aate.prototype.findIndex(), toLocaleString()
2018-07-14 14:02:30 -07:00
Julius Rakow
51b9eb81e8
split const integers into signed and unsigned 2018-07-14 22:48:37 +02:00
Nick Fitzgerald
1e32e91877
Merge pull request #460 from ohanar/webidl_partial_mixins
webidl: add support for partial interfaces and mixins
2018-07-14 13:46:54 -07:00
Alex Crichton
d7a05129ac
Improve documentation around link_this_library (#471)
I've started noticing this in non-LTO builds and initially tried to remove it. I
was unsuccessful but decided to better document my adventures to hopefully
improve future onlookers!
2018-07-14 11:04:47 -05:00
Julius Rakow
e49e02cc88 web-sys: only try to build webidl files (#474) 2018-07-14 11:04:20 -05:00
Tomohide Takao
7a7bc6d22e Bindings for Array.prototype.toLocaleString() 2018-07-14 19:45:22 +09:00
Tomohide Takao
f5035c3841 Bindings for Array.prototype.findIndex() 2018-07-14 19:33:48 +09:00
R. Andrew Ohana
80384d8da9 address my comments for #470 2018-07-13 22:36:51 -07:00
R. Andrew Ohana
0c908bb951 Merge remote-tracking branch 'origin/master' into webidl_partial_mixins 2018-07-13 22:32:16 -07:00
R. Andrew Ohana
d5fee8d5d1 webidl: move first pass logic to new module
I also updated it so that it is modeled in the same
extensible way as the WebidlParse trait.
2018-07-13 21:46:36 -07:00
R. Andrew Ohana
696678b8cc
Merge pull request #470 from jrakow/webidl-const
Support WebIDL constants
2018-07-13 21:12:46 -07:00