Commit Graph

547 Commits

Author SHA1 Message Date
b8895b3a95 Add JsValue::{from_serde, into_serde}
These functions are activated with the `serde-serialization` feature of the
`wasm-bindgen` crate. When activated they will allow passing any arbitrary value
into JS that implements the `Serialize` trait and receiving any value from JS
using the `Deserialize` trait. The interchange between JS and Rust is JSON.

Closes #96
2018-04-26 20:45:22 -07:00
acb5eac96a Bump to 0.2.6 2018-04-26 19:14:09 -07:00
b7bbcf5ea9 Fix compat with current nightly 2018-04-26 19:12:56 -07:00
6d5ebaf5ac Update parity-wasm and wasmi 2018-04-26 18:42:49 -07:00
7937d02bcb Merge pull request #161 from rustwasm/versions
Add support for version specifications
2018-04-26 00:23:31 -05:00
412bebca72 Add support for version specifications
This commit adds a `#[wasm_bindgen(version = "...")]` attribute support. This
information is eventually written into a `__wasm_pack_unstable` section.
Currently this is a strawman for the proposal in ashleygwilliams/wasm-pack#101
2018-04-25 22:23:02 -07:00
d9a71b43db Assert empty JS heap/stack in tests
Turns out there was a bug when passing a vector of `JsValue` instances back to
JS all objects were leaked rather than correctly removed from the global slab.
2018-04-25 22:15:28 -07:00
faed98b843 Correct how slices are iterated over
This commit fixes how the `getArrayJsValueFromWasm` function is defined to
correctly iterate over the slice by looking at the values rather than the
indices.

Closes #169
2018-04-25 21:58:49 -07:00
b2ecf56cb6 Merge pull request #165 from jryans/spans-feature
Add `spans` feature to control `proc-macro2`
2018-04-25 15:23:23 -05:00
11e274b477 Add spans feature to control proc-macro2
Using `proc-macro2`'s `nightly` feature is a good default for most use cases.
However, it causes a build error if used together with crates such as
`cssparser` that also use `proc-macro2` from a build script.

This change adds a default enabled feature `spans` that users can disable if
they need to work around this conflict.

Fixes #160.
2018-04-25 14:42:21 -05:00
7aaf7801be Merge pull request #164 from rustwasm/failure
Migrate to the `failure` crate
2018-04-25 14:00:12 -05:00
5f59d95130 Migrate to the failure crate
Currently errors are reported via Rust panics but there's lots more errors being
added over time so this commit starts the movement towards the `failure` crate
to more idiomatically report errors as well as provide better error messages
over time.
2018-04-25 11:57:17 -07:00
2b9c48d5f9 Favor if let instead of is_some + unwrap 2018-04-23 11:25:30 -07:00
8ae6fe19a3 Merge pull request #153 from FreeMasen/master
include fetch arg for wasm2es6js
2018-04-23 13:23:24 -05:00
6a6be7ef88 update comment to be more descriptive 2018-04-23 11:32:57 -05:00
da2057610f Merge pull request #156 from jsheard/jsheard-patch-1
Fix Typescript definition of constructor arguments
2018-04-23 09:15:47 -05:00
79a49b2a56 update fetch to take a string parameter 2018-04-23 09:04:30 -05:00
cbccd2028d include fetch arg for wasm2es6js 2018-04-23 08:41:02 -05:00
0caa6d2ec4 Fix Typescript definition of constructor arguments 2018-04-22 10:57:00 +01:00
65acc3b692 Tighten up codegen with JsStatic a bit
This requires some `unsafe` as we have knowledge that LLVM doesn't, but
shouldn't be too harmful.
2018-04-21 13:52:28 -07:00
4436c0eae6 Avoid invoking a function pointer with JsStatic
The previous codegen wasn't enough to convince LLVM that the function pointer
was a constant value and could be aggressively inlined, so this updates the
`JsStatic` internals slightly to guarantee to LLVM that the function pointer is
constant and no dynamic dispatch is needed after all
2018-04-21 13:14:33 -07:00
947386ee57 Add an example of a minimal wasm module 2018-04-20 22:38:22 -07:00
4100dc9c53 Recommend installation from crates.io, not git 2018-04-20 19:07:56 -07:00
88b3b96f60 Add a link to blog post in README 2018-04-20 11:34:34 -07:00
7108206835 Implement readonly struct fields
Add support for `#[wasm_bindgen(readonly)]` which indicates that an exported
struct field is readonly and attempting to set it in JS will throw an exception.

Closes #151
2018-04-20 10:56:10 -07:00
3b4bf475be Bump to 0.2.5 0.2.5 2018-04-19 18:46:41 -07:00
c6f7d3dfd5 Fix methods returning Self
Rewrite any instance of `Self` to the name of the class

Closes #137
2018-04-19 18:43:37 -07:00
542b3a28eb Merge pull request #149 from rustwasm/struct-fields
Generate accessors for public struct fields
2018-04-19 19:33:01 -05:00
ce31859590 Generate accessors for public struct fields
Automatically infer public struct fields as "JS wants to access this" and
generate appropriate getters/setters for the field. At this time the field is
required to implement `Copy`, but we will probably want to relax that in the
future to at least encompass `JsValue` and maybe other `Clone` values as well.

Closes #121
2018-04-19 16:49:46 -07:00
f3c05e5339 Fix compat with stable 2018-04-19 14:28:30 -07:00
eb73e05b7a Deserialize less to match schema versions
Currently the entire `Program` is deserialized to match schema versions but this
is likely to fail when the schema changes. Instead just deserialize the
schema/version fields, compare those, and if successful go ahead and deserialize
everything.
2018-04-19 13:36:59 -07:00
0ade4b8cac Add a --no-modules-global flag
This can be used to configure the name of the global that's initialized so it's
not unconditionally `wasm_bindgen`.

Closes #145
2018-04-19 13:33:58 -07:00
212703671a No need to expose ptr in TypeScript
This was needed long ago but is no longer needed!

Closes #147
2018-04-19 13:28:50 -07:00
cecefc2aca Merge pull request #148 from rustwasm/no-std
Work with `#![no_std]` contexts
2018-04-19 15:26:29 -05:00
748184ae66 Work with #![no_std] contexts
This commit adds support for both `#![no_std]` in the wasm-bindgen runtime
support (disabled by default with an on-by-default `std` feature). This also
adds support to work and compile in the context of `#![no_std]` crates.

Closes #146
2018-04-19 13:24:30 -07:00
792a8e132e Fix unused variables in generated code
Also deny all warnings in tests to prevent this creeping back in.

Closes #141
2018-04-19 13:16:59 -07:00
574e54a89d Add an example of --no-modules in action 2018-04-19 07:21:09 -07:00
45e4983e8c Use self instead of window
That should hopefully get us more compatible with web workers!

Closes #144
2018-04-19 07:20:04 -07:00
055a8fb803 Bump to 0.2.4 0.2.4 2018-04-18 07:18:11 -07:00
7d5f2e4152 Enable the visit feature of syn 2018-04-18 07:16:14 -07:00
9035c6f9f5 Merge pull request #142 from quelledanielle/patch-2
WebAssemblyly => WebAssembly
2018-04-17 16:30:33 -07:00
a01c5ce9f1 WebAssemblyly => WebAssembly 2018-04-17 19:25:55 -04:00
685b6c2b04 Merge pull request #140 from quelledanielle/patch-1
GitHUb => GitHub
2018-04-17 16:35:30 -05:00
8f90fc4f95 GitHUb => GitHub 2018-04-17 17:34:17 -04:00
158b95c29b Add WebAssembly Studio links to examples/README
Should hopefully make it much easier to get off the ground running and
exploring!
2018-04-17 13:51:01 -07:00
c74230b4a9 Bump to 0.2.3 0.2.3 2018-04-17 13:07:43 -07:00
0884b3cca6 Merge pull request #139 from NikVolf/patch-1
parity-wasm should be ok with crates.io version
2018-04-17 14:32:02 -05:00
ebc03d19b5 Should be ok with crates.io version 2018-04-17 22:27:46 +03:00
1424c4987d Branch was merged quickly! 2018-04-17 11:51:55 -07:00
9a6a15f605 Fix compilation and support on 32-bit targets 2018-04-17 11:42:10 -07:00