Commit Graph

2110 Commits

Author SHA1 Message Date
02b7021053 Leverage new rustc wasm features
This commit leverages two new attributes in the Rust compiler,
`#[wasm_custom_section]` and `#[wasm_import_module]`. These two attributes allow
removing a lot of hacks found in wasm-bindgen and also allows removing the
requirement of `wasm-opt` to remove the unused data sections.

This does require two new nightly features but we already required the
`proc_macro` nightly feature and these will hopefully be stabilized before that
feature!
2018-03-24 10:36:19 -07:00
dc03e6c84a Shuffle around travis builds a bit 2018-03-22 21:18:03 -07:00
dd83e54b67 Fix build script of wasm-in-wasm 2018-03-22 21:15:21 -07:00
5eff7c58f9 Tweak intro text 2018-03-22 19:14:37 -07:00
a4ed4331dd Debug mode is no longer buggy
Tweak instructions in README
2018-03-22 19:10:00 -07:00
a8799c049f Add a --lib argument to cargo new
The defaults will be changing soon!
2018-03-22 19:08:53 -07:00
d258ea4e2a The schema has definitely changed now 2018-03-22 19:07:20 -07:00
9d5b4ce2fb Add another example to travis 2018-03-22 19:06:23 -07:00
7ebc428646 Implement a js_name customization
This'll allow binding multiple signatures of a JS function as well as otherwise
changing the name of the JS function you're calling from the Rust function that
you're defining.

Closes #72
2018-03-22 19:05:14 -07:00
a8045fbbe9 Use custom setter string in dom example
That way we can stick with idiomatic Rust!
2018-03-22 18:24:57 -07:00
30936a6b22 Allow specifying getter/setter properties
Should help with style clashes!
2018-03-22 18:21:41 -07:00
78e3537279 Add more docs to DESIGN about configuration attributes 2018-03-22 17:56:39 -07:00
4716752991 Add an example of namespaced APIs
By creating wasm modules from Rust!
2018-03-22 17:39:48 -07:00
8830f540a9 Add a structural bindgen attribute
This attribute indicates that methods are to be accessed in a structural method
rather than through their class. This should allow direct access to properties
embedded on objects rather than forcing all objects to have a class/prototype.
2018-03-22 17:37:27 -07:00
0e1fee5ddd Rename namespace to js_namespace
Along the way remove the namespace in Rust as this ended up causing too many
problems, alas! The `js_namespace` attribute now almost exclusively modifies the
JS bindings, hence the "js" in the name now.
2018-03-22 17:03:51 -07:00
fc81d8f6d3 Add From/Into JsValue for imported types 2018-03-21 12:37:10 -07:00
48b34604cb Add some #[allow] directives to generated code
No need to warn about JS/Rust conventions not lining up!
2018-03-21 10:23:03 -07:00
b00f8c5a28 Add an example of the performance API 2018-03-21 10:21:21 -07:00
758bb3c2c3 Add an example using Math 2018-03-21 10:03:40 -07:00
8b3ca9b85c Remove a stray println! 2018-03-21 10:00:07 -07:00
4a4f8b18b6 Rename static to namespace
This commit renames the `static` attribute to `namespace` and simultaneously
reduces and expands the scope. The `namespace` attribute can now be applied to
all imports in addition to functions, and it no longer recognizes full typed
paths but rather just a bare identifier. The `namespace` attribute will generate
a Rust namespace to invoke the item through if one doesn't already exist (aka
bindign a type).
2018-03-21 09:55:16 -07:00
dd054fa357 Add an example of DOM access 2018-03-21 08:26:00 -07:00
8e894fcfc5 Implement static imports
This allows importing static objects like `document`, `window`, or an arbitrary
JS object from a module
2018-03-21 08:09:59 -07:00
eebe23649a Compile in release mode with LTO on
Should help get some nice size savings!
2018-03-20 15:27:45 -07:00
91295f4d16 Fix wasm sizes on nightly
Looks like the recent changes to `Vec::with_capacity` meant that our previous
codegen to avoid panics no longer avoids panics. Let's pick up the `try_reserve`
unstable feature for now and hopefully it'll be stabilized before the other
pieces in the future.
2018-03-20 15:19:45 -07:00
5638126598 Add more math intrinsics to test
Just in case more crop up!
2018-03-19 14:23:54 -07:00
7e1b31ab2e Merge pull request #70 from Healthire/struct-into-js
Support passing custom types by value into JS imports
2018-03-15 19:29:08 -05:00
89a00bee29 Support passing custom types by value into JS imports 2018-03-16 00:09:18 +00:00
37146395c9 Bump wasm-bindgen-cli-support to 0.1.3 wasm-bindgen-cli-support-0.1.3 2018-03-14 10:50:46 -07:00
8b2f34b51a Zero out descriptor statics
This way postprocessing tools like `wasm-opt` can optimize out the data section
altogether, dropping lots of zeros
2018-03-14 10:50:12 -07:00
9825b7a7c9 Bump wasm-bindgen-cli-support to 0.1.2 wasm-bindgen-cli-support-0.1.2 2018-03-09 16:10:08 -08:00
6e75d4777c Fix handling *almost* aligned data globals
Looks like LLD implicitly pads data values with zeros at the end rather than
explicitly listing them, this means that we need to read out the last byte, even
if it's not 4-byte aligned, as it could still represent a wasm-bindgen-generated
32-bit value.
2018-03-09 16:09:07 -08:00
0627c8f252 Attempt to fix CI 2018-03-09 11:51:42 -08:00
d8e5930799 Add an example of console.log
Also clean up some other exampels
2018-03-09 10:25:48 -08:00
8b74c6c6ec Merge pull request #63 from fitzgen/literals
wasm-bindgen-macro: Formalize building literals with a trait
2018-03-07 19:26:09 -06:00
92436069bd wasm-bindgen-macro: Formalize building literals with a trait 2018-03-07 16:29:25 -08:00
c3b6191112 Merge pull request #62 from fitzgen/to-tokens
Implement quote::ToTokens for AST types
2018-03-07 17:05:13 -06:00
c2e9a4b71e Implement quote::ToTokens for AST types
They were already implemented, just without the formalization ;)
2018-03-07 14:49:40 -08:00
4c4d8dab26 Merge pull request #61 from fitzgen/test-for-dependency-types
Test for dependency types
2018-03-07 14:11:52 -06:00
12d7c93a40 Add a test for using a dependency's types in bindings 2018-03-07 11:57:51 -08:00
9e24dabe9c test-support: Add ability to add new local dependencies to Cargo.toml 2018-03-07 10:06:25 -08:00
1a9e031ed0 Bump wasm-bindgen-cli to 0.1.1 wasm-bindgen-cli-0.1.1 2018-03-07 08:52:19 -08:00
8296e7feee Bump wasm-bindgen-cli-support to 0.1.1 wasm-bindgen-cli-support-0.1.1 2018-03-07 08:51:40 -08:00
8254d9f516 Add an option to detect node at runtime
Sometimes builds are done once and used in both the browser and in node, so add
an option to do runtime detection if necessary
2018-03-07 08:50:56 -08:00
48c0f290f9 Merge pull request #58 from quelledanielle/fix-readme-link
Fix node.js link in README
2018-03-06 16:38:39 -06:00
0a6b7ab7e7 Fix node.js link in README 2018-03-06 17:35:12 -05:00
800376010d Bump wasm-bindgen-macro to 0.1.1 wasm-bindgen-macro-0.1.1 2018-03-06 13:50:45 -08:00
ac9f266005 Merge pull request #56 from fitzgen/disambiguate
Disambiguate generated wrappers
2018-03-06 15:50:21 -06:00
3ad3123882 Disambiguate generated wrappers 2018-03-06 13:45:44 -08:00
46f1b5680f Add the wasm category to wasm-bindgen-cli 2018-03-05 20:28:45 -08:00