Commit Graph

58 Commits

Author SHA1 Message Date
Nick Fitzgerald
4d3f1c63a2 Point to the guide's contributing section instead of CONTRIBUTING.md 2018-06-19 12:05:52 -07:00
Nick Fitzgerald
1d9a7dfdee Make the README a landing page
All the details are moved into the guide, where they can be properly organized
and have a table of contents.
2018-06-19 12:05:52 -07:00
Nik Graf
005630929c
clarify js part in the readme 2018-06-13 19:13:02 +02:00
Anders Pitman
8ac5f2e6e6
Update README.md 2018-06-05 17:34:15 -07:00
Alex Crichton
d04f8c7119 No more need for chrome workarounds! 2018-05-07 07:36:38 -07:00
Alex Crichton
237fff0698 Map u64/i64 to BigInt in JS
This commit is an implementation of mapping u64/i64 to `BigInt` in JS through
the unstable BigInt APIs. The BigInt type will ship soon in Chrome and so this
commit builds out the necessary support for wasm-bindgen to use it!
2018-05-05 18:51:20 -07:00
Alex Crichton
89bd10f974 Emit *.d.ts file by default 2018-04-27 07:15:34 -07:00
Alex Crichton
88b3b96f60 Add a link to blog post in README 2018-04-20 11:34:34 -07:00
Alex Crichton
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
Danielle Pham
8f90fc4f95
GitHUb => GitHub 2018-04-17 17:34:17 -04:00
Alex Crichton
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
Alex Crichton
c64f178543 Support closures with "rich" arguments
This commit adds support for closures with arguments like strings and such. In
other words, closures passed to JS can now have the same suite of arguments as
all functions that can be exported from Rust, as one might expect!

At this time due to the way trait objects work closures still cannot use types
with references like `&str`, but bare values like `String` or `ImportedType`
should work just fine.

Closes #104
2018-04-16 07:51:51 -07:00
Alex Crichton
a8d6ca3d62 Add support for mutable stack closures
This commit adds support for passing `&mut FnMut(..)` to JS via imports. These
closures cannot be invoked recursively in JS (they invalidate themselves while
they're being invoked) and otherwise work the same as `&Fn(..)` closures.

Closes #123
2018-04-14 11:16:16 -07:00
Alex Crichton
5d52bf81c5 Document --no-modules in the README 2018-04-13 07:47:16 -07:00
Alex Crichton
a3e5485b86 Add examples/documentation for closures 2018-04-09 14:34:21 -07:00
Alex Crichton
9b46c8831d Fixup AppVeyor badge 2018-04-09 12:49:08 -07:00
konstin
30a8f86e76
Update readme links for the moved repository 2018-04-09 21:26:15 +02:00
Alex Crichton
07c5ff5a93 Update README version 2018-04-03 14:04:23 -07:00
Alex Crichton
bfde5e236c Add a CLI reference to the README 2018-04-03 07:58:42 -07:00
Noah Lemen
48040c85b5
fix "funtion" typo in readme
just noticed this while reading!
2018-03-28 19:20:19 -04:00
Alex Crichton
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
Alex Crichton
5eff7c58f9 Tweak intro text 2018-03-22 19:14:37 -07:00
Alex Crichton
a4ed4331dd Debug mode is no longer buggy
Tweak instructions in README
2018-03-22 19:10:00 -07:00
Alex Crichton
a8799c049f Add a --lib argument to cargo new
The defaults will be changing soon!
2018-03-22 19:08:53 -07:00
Danielle Pham
0a6b7ab7e7
Fix node.js link in README 2018-03-06 17:35:12 -05:00
Alex Crichton
69e5798377 Update README for publication to crates.io 2018-03-05 20:27:34 -08:00
Sendil Kumar
49a7b9fef5 Merge branch 'master' into fix-no-mangle 2018-03-05 23:26:22 +01:00
Sendil Kumar
0dd8a77757 fix: remove unwanted no_mangle and extern wherever applicable 2018-03-05 23:25:15 +01:00
Sendil Kumar
d5ac523fe2 feat: rename generated file to have bg instead of wasm 2018-03-05 22:25:14 +01:00
Sophie Alpert
67411f519c Add workaround for hello_world running in Chrome
Fixes #50.
2018-03-03 10:46:43 -08:00
Alex Crichton
4ebb3df330 Add a smorgasboard example 2018-03-02 20:19:39 -08:00
Alex Crichton
4aa6793b9e Rewrite the README using Webpack
Right now Webpack probably has the most mature support for loading wasm modules,
so let's show off how to do that! Additionally this commits hello world as an
example to the repository.
2018-03-02 20:12:00 -08:00
Ryan Levick
17ca87cabb Add to README that Vec<JsValue> cannot be passed to functions 2018-02-28 17:33:16 +01:00
Ryan Levick
37da9eba14 Address feedback on commit dab6ba1 2018-02-28 17:29:40 +01:00
Alex Crichton
90882bb06f Mention enums in the README 2018-02-26 15:32:07 -08:00
Alex Crichton
00115c6e7d No longer generates TypeScript by default
remove an errant comment from the README
2018-02-26 15:31:18 -08:00
Ryan Levick
89b0b8f20a Add section on node dependency in README 2018-02-23 14:52:45 +01:00
Alex Crichton
3c58aa7310 Support integer/float slices/vectors
Closes #5
2018-02-16 18:58:37 -08:00
Alex Crichton
29771b574c Migrate from a macro to an attribute
This commit migrates from `wasm_bindgen!`-the-macro to
`#[wasm_bindgen]`-the-attribute. The actual mechanics of the macro are
relatively simple in just generating some shims here and there, but wrapping
everything in one huge macro invocation can often seem intimidating as it gives
off this feeling of "oh dear anything can happen here!" Using an attribute
should curb expectations much more greatly of "oh there's just some extra stuff
happening behind the scenes".

The usage is otherwise relatively straightforward and close to what it was
before, but check out the DESIGN.md/README.md changes for more info!
2018-02-08 10:18:16 -08:00
Alex Crichton
e9d612a343 Implement optionally catching exceptions 2018-02-06 19:04:12 -08:00
Alex Crichton
e60aa6a990 Rename JsObject to JsValue
Let's reserve `JsObject` for something we actually know is an object
2018-02-06 15:04:46 -08:00
Alex Crichton
9ac713d4eb Reword intro in README
Not really an exclusive polyfill but moreso nice features too!
2018-02-02 08:14:05 -08:00
Alex Crichton
322f52001e No need to specify port to parcel 2018-01-30 08:06:05 -08:00
Alex Crichton
5098f97e7d Link to tests in README 2018-01-29 21:54:52 -08:00
Alex Crichton
dac2f2d170 Fix highlighting in README 2018-01-29 21:53:33 -08:00
Alex Crichton
c51a342cb3 Rewrite wasm-bindgen with ES6 modules in mind
This commit is a mostly-rewrite of the `wasm-bindgen` tool. After some recent
discussions it's clear that the previous model wasn't quite going to cut it, and
this iteration is one which primarily embraces ES6 modules and the idea that
this is a polyfill for host bindings.

The overall interface and functionality hasn't changed much but the underlying
technology has now changed significantly. Previously `wasm-bindgen` would emit a
JS file that acted as an ES6 module but had a bit of a wonky interface. It
exposed an async function for instantiation of the wasm module, but that's the
bundler's job, not ours!

Instead this iteration views each input and output as a discrete ES6 module. The
input wasm file is interpreted as "this *should* be an ES6 module with rich
types" and the output is "well here's some ES6 modules that fulfill that
contract". Notably the tool now replaces the original wasm ES6 module with a JS
ES6 module that has the "rich interface". Additionally a second ES6 module is
emitted (the actual wasm file) which imports and exports to the original ES6
module.

This strategy is hoped to be much more amenable to bundlers and controlling how
the wasm itself is instantiated. The emitted files files purely assume ES6
modules and should be able to work as-is once ES6 module integration for wasm is
completed.

Note that there aren't a ton of tools to pretend a wasm module is an ES6 module
at the moment but those should be coming soon! In the meantime a local
`wasm2es6js` hack was added to help make *something* work today. The README has
also been updated with instructions for interacting with this model.
2018-01-29 21:50:01 -08:00
Johann Hofmann
a84f87040d
Really fix bindings link in README.md 2018-01-20 19:20:01 +01:00
Johann Hofmann
04a3e596a5
Fix bindings link in README.md 2018-01-20 18:47:44 +01:00
Ralph Giles
5b37523d87 Fix typos in the README. 2018-01-15 15:12:38 -08:00
Alex Crichton
737bd8c965 Add objects to the top of the README 2017-12-19 20:00:52 -08:00