Commit Graph

45 Commits

Author SHA1 Message Date
312f5d6dca chore: upgrade @wasm-tool/wasm-pack-plugin to 1.0.1 2019-08-27 18:20:24 +01: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
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
8fc0a38402 Bump to 0.2.46 2019-06-14 11:44:58 -07:00
546f65e2f3 chore: bump again 2019-05-29 17:37:37 +01:00
f63238ee24 chore: update wasm-pack-plugin to 0.4.1 2019-05-29 17:09:26 +01:00
f3ec734310 docs: update docs link 2019-05-26 16:43:00 +09: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
f2429be07f Bump to 0.2.43 2019-04-29 08:28:41 -07: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
6803c619bb Bump to 0.2.40 2019-03-21 17:08:48 -07:00
228f58dca3 Bump to 0.2.39 2019-03-13 11:02:27 -07:00
a659f27c07 Bump to 0.2.38 2019-03-04 09:11:23 -08:00
5e7187a95f chore: update pinned Webpack versions 2019-02-15 19:26:08 +01:00
e9f423d57e Bump to 0.2.37 2019-02-15 08:16:24 -08:00
802cfedcbd Bump to 0.2.36 2019-02-12 13:19:02 -08:00
d9cf9b3735 Bump to version 0.2.35 2019-02-12 11:36:19 -08:00
078257943d Bump to 0.2.34 2019-02-11 18:58:54 -08:00
78c4075e40 Bump to 0.2.33 2019-01-18 15:32:17 -08:00
32c611d16d Convert all examples to using wasm-pack
This commit migrates all our examples to using `wasm-pack build` to
compile their code and run `wasm-bindgen`. This should make it a bit
easier to understand the examples as there's less to follow during the
build step.

Webpack projects are all using `@wasm-tool/wasm-pack-plugin` as well so
the build step is simple `npm run serve`. Other examples which retain
`build.sh` are just using `wasm-pack build` now
2019-01-17 08:37:32 -08:00
31fdede9fc Bump to 0.2.32 2019-01-16 13:11:13 -08:00
b04f60cf2b Bump to 0.2.31 2019-01-09 09:17:50 -08:00
fbf000a508 Bump to 0.2.30 2019-01-07 07:47:07 -08:00
55f199ee77 [examples] paint - port to rust 2018 2018-12-12 08:12:51 +01:00
63e3ba722d Bump to 0.2.29 2018-12-04 06:04:47 -08:00
a2aa28e4d3 Add a #[wasm_bindgen(start)] attribute
This commit adds a new attribute to `#[wasm_bindgen]`: `start`. The
`start` attribute can be used to indicate that a function should be
executed when the module is loaded, configuring the `start` function of
the wasm executable. While this doesn't necessarily literally configure
the `start` section, it does its best!

Only one crate in a crate graph may indicate `#[wasm_bindgen(start)]`,
so it's not recommended to be used in libraries but only end-user
applications. Currently this still must be used with the `crate-type =
["cdylib"]` annotation in `Cargo.toml`.

The implementation here is somewhat tricky because of the circular
dependency between our generated JS and the wasm file that we emit. This
circular dependency makes running initialization routines (like the
`start` shim) particularly fraught with complications because one may
need to run before the other but bundlers may not necessarily respect
it. Workarounds have been implemented for various emission strategies,
for example calling the start function directly after exports are wired
up with `--no-modules` and otherwise working around what appears to be
a Webpack bug with initializers running in a different order than we'd
like. In any case, this in theory doesn't show up to the end user!

Closes #74
2018-11-28 22:11:15 -08:00
48f4adfa8c Run rustfmt over everything 2018-11-27 12:07:59 -08:00
22ca15f81e Bump to 0.2.28 2018-11-12 09:28:01 -08:00
5b76a6291e Implement Deref for all imported JS types
This commit implements the first half of [RFC #5] where the `Deref`
trait is implemented for all imported types. The target of `Deref` is
either the first entry of the list of `extends` attribute or `JsValue`.

All examples using `.as_ref()` with various `web-sys` types have been
updated to the more ergonomic deref casts now. Additionally the
`web-sys` generation of the `extends` array has been fixed slightly to
explicitly list implementatoins in the hierarchy order to ensure the
correct target for `Deref` is chosen.

[RFC #5]: https://github.com/rustwasm/rfcs/blob/master/text/005-structural-and-deref.md
2018-11-08 11:01:34 -08:00
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
cfa4aa0e3e Promote CI jobs to using stable Rust
Everything should be stable now so let's test it!
2018-10-28 13:28:02 -07:00
959deeea5d Fix unimportant typo 2018-10-06 21:09:18 +02:00
991e61931e Switch Closure::new to wrap in paint example
Show off stable usage!
2018-10-03 09:53:55 -07:00
717cfa303d Fix polyfill of TextEncoder and TextDecoder
This commit does a few things, including:

* Fixing the generated JS of `wasm-bindgen` to allow polyfills to work.
  (a minor tweak of the generated JS)

* All examples are updated to include a Webpack-specific polyfill for
  these two types to get examples working in Edge.

* A new page has been added to the guide about supported browsers. This
  mentions known caveats like IE 11 requiring `wasm2js` as well as
  documenting some `TextEncoder` and `TextDecoder` workarounds for Edge.

Closes #895
2018-09-30 10:16:20 -07:00
bc36b6f84b Add catch(console.error) to all examples
Some examples have been failing to load in some browsers, and this
ensures that whenever the promise to load Rust code fails we log any
errors happening instead of accidentally failing silently.

This helped debug a bit in #897
2018-09-28 13:55:07 -07:00
052b41b84c update to "webpack-cli": "^3.1.1" 2018-09-25 18:50:27 -07:00
e353c1cf6f Build examples and deploy to gh-pages
Rejigger Travis slightly to take advantage of build stages to build the
`gh-pages` branch amongst a set of builders, and then when they're all
done we synchronize and deploy the site. For now use S3 as a backing
store for data between jobs.
2018-09-20 20:55:02 -07:00
3efe51eb8b Reorganize and rewrite examples
This commit is a large-ish scale reorganization of our examples. The
main goal here is to have a dedicated section of the guide for example,
and all examples will be listed there. Each example's `README` is now
just boilerplate pointing at the guide along with a blurb about how to
run it.

Some examples like `math` and `smorgasboard` have been deleted as they
didn't really serve much purpose, and others like `closures` have been
rewritten with `web-sys` instead of hand-bound bindings.

Overall it's hoped that this puts us in a good and consistent state for
our examples, with all of them being described in the guide, excerpts
are in the guide, and they're all relatively idiomatically using
`web-sys`.
2018-09-20 16:45:30 -07:00
f24828a16b Add a top-level web_sys::window function
Returns `Option<Window>` and can be used as a convenience to get a handle to the
global `window` object.
2018-09-17 17:36:53 -07:00
b9cc8e1270 Use Cell instead of RefCell 2018-09-13 03:38:22 +03:00
62b04e44c4 Add paint example 2018-09-13 02:10:36 +03:00