Commit Graph

1166 Commits

Author SHA1 Message Date
Alex Crichton
2e5cc810c8 Migrate tests for global functions to wasm 2018-07-20 17:45:00 -07:00
Alex Crichton
5f87ed4cef Port WebAssembly tests to wasm 2018-07-20 17:09:50 -07:00
Alex Crichton
9f7eea1e75 Port WeakSet tests to wasm 2018-07-20 17:07:00 -07:00
Alex Crichton
1d1df09e60 Port WeakMap tests to wasm 2018-07-20 17:01:26 -07:00
Alex Crichton
b667cafb63 Port TypedArray tests to wasm 2018-07-20 16:31:29 -07:00
Alex Crichton
df3530a9c2 Port Symbol and SetIterator tests to wasm 2018-07-20 16:19:10 -07:00
Alex Crichton
54abca7344 Port Set tests to wasm 2018-07-20 15:44:15 -07:00
Alex Crichton
ad86c52b02 Port Proxy tests to wasm 2018-07-20 15:35:15 -07:00
Alex Crichton
01ff04d85c Port Object tests to wasm 2018-07-20 15:23:56 -07:00
Alex Crichton
fb6041cf3b Port Number tests to wasm 2018-07-20 14:35:44 -07:00
Alex Crichton
627ddcb192 Port Math tests to wasm 2018-07-20 14:21:29 -07:00
Alex Crichton
230f923fdb Port MapIterator tests to wasm 2018-07-20 13:57:18 -07:00
Alex Crichton
2c9a606c3d Port Map tests to wasm 2018-07-20 13:46:22 -07:00
Alex Crichton
f3e34d854d Port JsString tests to wasm 2018-07-20 13:35:46 -07:00
Alex Crichton
d76f619298 Port Intl tests to wasm 2018-07-20 13:00:44 -07:00
Alex Crichton
067de51e57 Port Generator tests to wasm 2018-07-20 12:56:32 -07:00
Alex Crichton
f3d4a20ec7 Change Function::apply to catch the result
We don't know whether it'll throw or not!
2018-07-20 12:44:21 -07:00
Alex Crichton
75215134a5 Migrate Function tests to wasm 2018-07-20 12:43:07 -07:00
Alex Crichton
347c1daad9 Tweak instructions in js-sys/src/lib.rs 2018-07-20 12:27:03 -07:00
Alex Crichton
20e9267775 Port Error tests to wasm 2018-07-20 12:21:41 -07:00
Alex Crichton
cc8e7edd83 Revert "Explicitly ignore "Exposed" attributes"
This reverts commit 81150492a5.
2018-07-20 12:15:25 -07:00
Alex Crichton
13cee9e264 Fix closures example 2018-07-20 12:09:30 -07:00
Alex Crichton
601b138296 Port Date tests to wasm 2018-07-20 12:07:41 -07:00
Alex Crichton
81150492a5 Explicitly ignore "Exposed" attributes
It looks like these are primarily targeted at informing whether functionality is
either on web workers, windows, or both. For now we'll generate the same
bindings regardless, and users will need to be proactive about what they're
using. In that case there shouldn't be any need for us to process these, so
avoid warning about them!
2018-07-20 12:07:39 -07:00
Alex Crichton
efd6b2abac Migrate Array tests to wasm-bindgen-test 2018-07-20 11:48:57 -07:00
Alex Crichton
f8d336d711
Add a test harness to directly execute wasm tests (#524)
* Add a test harness to directly execute wasm tests

This commits adds a few new crates and infrastructure to enable comands like:

    cargo test --target wasm32-unknown-unknown

The intention here is to make it as low-friction as possible to write wasm tests
and also have them execute in a reasonable amount of time. Eventually this is
also hopefully enough support to do things like headless testing!

For now though this is defintely MVP status rather than fully fleshed out.
There's some more information at `crates/test/README.md` about how it works and
how to use it, but for now this is mainly intended to play around with locally
in this repository for our own tests.

* Port a numbe of `js-sys` tests to the new test framework

This commit ports a number of existing tests for the `js-sys` crate over to the
new test framework created in the previous commit, showing off how they can be
executed as well as drastictlly simplifying the tests themselves! This is
intended to be a proof of concept for now which we can refine over time. This
should also show off that it's possible to incrementally move over to the new
test framework.
2018-07-20 13:47:49 -05:00
Alex Macleod
722a87f324 Verbose npm ci output (#527)
Temporarily increase the output of npm ci to see what's happening regarding #517
2018-07-20 13:32:57 -05:00
Alex Crichton
9753f9150b
Allow renaming exported functions into JS (#525)
Support the `js_name` attribute on exports as well as imports to allow exporting
types as camelCase instead of snake_case, for example.

Closes #221
2018-07-20 12:01:28 -05:00
Alex Crichton
61ef250dca
Add more documentation for --no-modules (#526)
Closes #211
2018-07-20 12:00:51 -05:00
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