Commit Graph

144 Commits

Author SHA1 Message Date
Alex Crichton
9c330529f2
Fix codegen for descriptors of async fn returns (#1782)
They erroneously reported returning the original return type, not the
promise! Let's also add a bunch of positive tests while we're at it.

Closes #1781
2019-09-20 16:06:27 -05:00
Alex Crichton
3c887c40b7
Default all async support to std::future (#1741)
This commit defaults all crates in-tree to use `std::future` by default
and none of them support the crates.io `futures` 0.1 crate any more.
This is a breaking change for `wasm-bindgen-futures` and
`wasm-bindgen-test` so they've both received a major version bump to
reflect the new defaults. Historical versions of these crates should
continue to work if necessary, but they won't receive any more
maintenance after this is merged.

The movement here liberally uses `async`/`await` to remove the need for
using any combinators on the `Future` trait. As a result many of the
crates now rely on a much more recent version of the compiler,
especially to run tests.

The `wasm-bindgen-futures` crate was updated to remove all of its
futures-related dependencies and purely use `std::future`, hopefully
improving its compatibility by not having any version compat
considerations over time. The implementations of the executors here are
relatively simple and only delve slightly into the `RawWaker` business
since there are no other stable APIs in `std::task` for wrapping these.

This commit also adds support for:

    #[wasm_bindgen_test]
    async fn foo() {
        // ...
    }

where previously you needed to pass `(async)` now that's inferred
because it's an `async fn`.

Closes #1558
Closes #1695
2019-09-05 11:18:36 -05:00
Alex Crichton
c2daa4f63c Bump to 0.2.50 2019-08-19 04:21:27 -07:00
Alex Crichton
c1d4fddeac Bump to 0.2.49 2019-08-14 08:32:02 -07:00
Pauan
ca15a59ace Changing from uluru to HashMap 2019-07-18 21:51:29 +02:00
Pauan
8572255e73 Making uluru optional 2019-07-18 21:51:29 +02:00
Pauan
f28cfc26fe Fixing some things for the cache 2019-07-18 21:51:28 +02:00
Pauan
86a8842f24 Changing IntoWasmAbi to use interning 2019-07-18 21:51:28 +02:00
Pauan
6767371ca7 Initial interning implementation 2019-07-18 21:51:28 +02:00
Alex Crichton
e596ef596c Bump to 0.2.48 2019-07-11 15:02:39 -07:00
Alex Crichton
d71ab78fc6 Bump to 0.2.47 2019-06-19 11:14:37 -07:00
Alex Crichton
8fc0a38402 Bump to 0.2.46 2019-06-14 11:44:58 -07:00
ibaryshnikov
6825da384f added websockets example 2019-06-01 15:40:32 +03:00
Alex Crichton
137bbdf2e3 Bump to 0.2.45 2019-05-20 09:44:03 -07:00
Alex Crichton
773c6ff430 Bump to 0.2.44 2019-05-16 07:47:23 -07:00
Alex Crichton
4cc730fc41 Migrate to trybuild from compiletest
This migrates our UI tests to the recently published `trybuild` crate
which should hopefully be a bit more robust than `compiletest` over
time!
2019-05-15 14:47:22 -07:00
Alex Crichton
e4fd0fccb5 Add a page of microbenchmarks for wasm-bindgen
This commit starts to add a page of microbenchmarks for wasm-bindgen
which we can hopefully track and compare over time. Right now it's
primarily focused on data collection, making it easy to collect data
across a number of benchmarks for comparison. It doesn't currently do
much in the way of actually comparing the results for you (aka drawing
pretty graphs), so let's left for a future step.

It's hoped though that we can use this to track performance improvements
as well as ensuring that they work over time!
2019-05-03 12:30:11 -07:00
Alex Crichton
f2429be07f Bump to 0.2.43 2019-04-29 08:28:41 -07:00
Alex Crichton
df6e15e3ab Bump to 0.2.42 2019-04-11 07:39:45 -07:00
Alex Crichton
02394724ea Bump to 0.2.41 2019-04-10 10:53:32 -07:00
Alex Crichton
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
Alex Crichton
faf49c7d56 Reorganize the import_js example 2019-03-25 13:49:29 -07:00
Alex Crichton
6803c619bb Bump to 0.2.40 2019-03-21 17:08:48 -07:00
Alex Crichton
7b6731fd3b Move links annotation to wasm-bindgen-shared
This commit moves our `links` annotation in the `wasm-bindgen` crate to
the `wasm-bindgen-shared` crate. The `links` annotation is used to
ensure that there's only one version of `wasm-bindgen` in a crate graph
because if there are multiple versions then a CLI surely cannot actually
process the wasm binary (as the multiple versions likely have different
formats in their custom sections).

Discovered in #1373 it looks like the usage in `wasm-bindgen` isn't
quite sufficient to cause this deduplication. It turns out that
`wasm-bindgen-shared`, a very core dependency, is actually the most
critical to be deduplicated since its the one that defines the format of
the custom section. In #1373 a case came up where `wasm-bindgen` was
deduplciated but there were two versions of `wasm-bindgen-shared` in the
crate graph, meaning that a `[patch]` for only `wasm-bindgen` wasn't
sufficient, but rather `web-sys` and/or `js-sys` also needed a `[patch]`
annotation to ensure everyone used the right dependencies.

This commit won't actually fix #1373 to the point where it "just works",
but what it does do is present a better error message than an internal
panic of `wasm-bindgen`. The hope is that by moving the `links`
annotation we can catch more errors of this crate graph duplication,
leading to more `[patch]` annotations locally.

Closes #1373
2019-03-21 08:35:27 -07:00
Alex Crichton
228f58dca3 Bump to 0.2.39 2019-03-13 11:02:27 -07:00
Alex Crichton
96f4c8aa63 Add a "nightly only" warning to documentation
Official documentation is now available at
https://rustwasm.github.io/docs/wasm-bindgen/, so let's leave this git
repository's documentation purely for our own previewing purposes.
2019-03-07 07:48:26 -08:00
Alex Crichton
9f6c2a6125
Merge pull request #1314 from alexcrichton/typescript-tests
Start testing TypeScript output on CI
2019-03-05 17:20:00 -06:00
Alex Crichton
235bc7c889 Start testing TypeScript output on CI
This commit starts to add some simple tests for our TypeScript output of
the wasm-bindgen CLI, currently just running `tsc` to make sure syntax
looks good and types are emitted as expected. This'll hopefully be able
to get expanded over time with bug reports as they come in as well as
ensure that we don't regress anything in egregious manners!

Closes #922
2019-03-05 08:57:52 -08:00
Alex Crichton
b762948456 Implement the local JS snippets RFC
This commit is an implementation of [RFC 6] which enables crates to
inline local JS snippets into the final output artifact of
`wasm-bindgen`. This is accompanied with a few minor breaking changes
which are intended to be relatively minor in practice:

* The `module` attribute disallows paths starting with `./` and `../`.
  It requires paths starting with `/` to actually exist on the filesystem.
* The `--browser` flag no longer emits bundler-compatible code, but
  rather emits an ES module that can be natively loaded into a browser.

Otherwise be sure to check out [the RFC][RFC 6] for more details, and
otherwise this should implement at least the MVP version of the RFC!
Notably at this time JS snippets with `--nodejs` or `--no-modules` are
not supported and will unconditionally generate an error.

[RFC 6]: https://github.com/rustwasm/rfcs/pull/6

Closes #1311
2019-03-05 08:00:47 -08:00
Alex Crichton
a659f27c07 Bump to 0.2.38 2019-03-04 09:11:23 -08:00
Nick Fitzgerald
43a05d682d Do run doctests for wasm-bindgen
We just `no_run` things, but make sure that they still compile.
2019-03-01 13:18:48 -08:00
Alex Crichton
b71f3374c5 Tweak introductory and deployment documentation.
This commit rejiggers some documentation of `wasm-bindgen` in a few
significant ways:

* The main landing page now has text and links to the Game of Life
  tutorial and `wasm-pack`.
* The "whirlwind tour" was deleted as it wasn't really serving any
  purpose that the Game of Life plus the later references weren't already
  serving.
* The "no modules" example was renamed to "without a bundler"
* A dedicated section on "Deployment" was added which replaces the
  previous "No ES Modules" page. This is hopefully more descriptive and
  also prominently mentions the various options for deployment.
2019-02-22 07:50:32 -08:00
Alex Crichton
e9f423d57e Bump to 0.2.37 2019-02-15 08:16:24 -08:00
Nick Fitzgerald
802cfedcbd Bump to 0.2.36 2019-02-12 13:19:02 -08:00
Nick Fitzgerald
d9cf9b3735 Bump to version 0.2.35 2019-02-12 11:36:19 -08:00
Nick Fitzgerald
078257943d Bump to 0.2.34 2019-02-11 18:58:54 -08:00
Alex Crichton
78c4075e40 Bump to 0.2.33 2019-01-18 15:32:17 -08:00
Nick Fitzgerald
31fdede9fc Bump to 0.2.32 2019-01-16 13:11:13 -08:00
Alex Crichton
ff3986aeb9 Exclude the typescript crate from the workspace
This'll help get `cargo build --all` and similar commands working. While
not critical at all, I execute it from time to time and it's a bummer
when it doesn't work!
2019-01-11 10:29:37 -08:00
Alex Crichton
b04f60cf2b Bump to 0.2.31 2019-01-09 09:17:50 -08:00
Alex Crichton
fbf000a508 Bump to 0.2.30 2019-01-07 07:47:07 -08:00
Nick Fitzgerald
77ddf5ebcd examples: Add a requestAnimationFrame loop example 2018-12-10 12:50:19 -08:00
Alex Crichton
63e3ba722d Bump to 0.2.29 2018-12-04 06:04:47 -08:00
Alex Crichton
c8a352189b Assert all attributes are used by default
This commit implements a system that will assert that all
`#[wasm_bindgen]` attributes are actually used during compilation. This
should help ensure that we don't sneak in stray attributes that don't
actually end up having any meaning, and hopefully make it a bit easier
to learn `#[wasm_bindgen]`!
2018-11-28 11:42:48 -08:00
Alex Crichton
22ca15f81e Bump to 0.2.28 2018-11-12 09:28:01 -08:00
Alex Crichton
56400c3738 Don't use path dependencies in examples
This commit updates all examples to not use `path` dependencies but
rather use versioned dependencies like would typically be found in the
wild. This should hopefully make the examples more copy-pastable and
less alien to onlookers!

The development of the examples remains the same where they continue to
use the `wasm-bindgen`, `js-sys`, `web-sys`, etc from in-tree. The
workspace-level `[patch]` section ensures that they use the in-tree
versions instead of the crates.io versions.
2018-11-07 11:27:43 -08:00
Alex Crichton
6dfbb4be89 Bump to 0.2.27 2018-10-29 14:30:33 -07:00
Alex Crichton
9a3ef7b747
Merge pull request #961 from jonathanKingston/todo-mvc
Todo mvc
2018-10-29 13:24:59 -07:00
Alex Crichton
7fad2bf0c8 Bump to 0.2.26 2018-10-29 12:56:37 -07:00
Jonathan Kingston
b322f46303 Adding in TODO MVC example using web-sys 2018-10-23 14:15:42 +01:00