Commit Graph

80 Commits

Author SHA1 Message Date
8f8da49dab wip 2018-02-05 14:24:25 -08:00
ec1c263480 Tweak path to rollup for Windows 2018-02-02 08:51:45 -08:00
baa144d141 Add a word of warning to wasm2es6js 2018-02-02 08:17:04 -08:00
9ac713d4eb Reword intro in README
Not really an exclusive polyfill but moreso nice features too!
2018-02-02 08:14:05 -08:00
83a2b314b2 Disable test for lib/doctest, there are none! 2018-02-02 08:10:48 -08:00
322f52001e No need to specify port to parcel 2018-01-30 08:06:05 -08:00
b75c0354b7 Be a bit more tslint friendly in generated code 2018-01-30 07:58:44 -08:00
235bc2957e Tweak typescript option 2018-01-30 07:47:49 -08:00
1487288050 Expose typescript option in wasm2es6js 2018-01-30 07:45:36 -08:00
89c8621426 Flag free() as returning void 2018-01-30 07:37:25 -08:00
5098f97e7d Link to tests in README 2018-01-29 21:54:52 -08:00
dac2f2d170 Fix highlighting in README 2018-01-29 21:53:33 -08:00
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
f27e4a9e94 Update parity-wasm dependency 2018-01-25 13:32:27 -08:00
b38c273ee5 Add an --output-js flag
This'll output just vanilla JS rather than TypeScript!

Closes #8
2018-01-24 19:15:34 -08:00
25faad9390 Merge pull request #7 from johannhof/patch-1
Really fix bindings link in README.md
2018-01-20 12:45:39 -06:00
a84f87040d Really fix bindings link in README.md 2018-01-20 19:20:01 +01:00
d8a123306d Merge pull request #6 from johannhof/patch-1
Fix bindings link in README.md
2018-01-20 11:54:15 -06:00
04a3e596a5 Fix bindings link in README.md 2018-01-20 18:47:44 +01:00
9f939d9625 Merge pull request #4 from rillian/typo
Fix typos in the README.
2018-01-15 15:24:44 -08:00
5b37523d87 Fix typos in the README. 2018-01-15 15:12:38 -08:00
b8292a617a Try to fix Travis 2018-01-08 14:57:00 -08:00
28a25ef8b9 Update to released syn/quote verisons 2018-01-08 10:42:01 -08:00
5c0f9613f6 Update for syn master 2018-01-02 12:30:47 -08:00
b2ce19bd3c Update to master quote 2017-12-31 15:53:29 -08:00
0b81185c99 Expose primitive information about JsObject
Adds bindings for wbindgen to fill in via JS bindings to read the various
primitive properties of a JS value.
2017-12-31 15:45:47 -08:00
996c296de8 Disable incremental for tests
Seems buggy?
2017-12-31 14:48:56 -08:00
4151461ab9 Expose construction of a JsObject as a string
Start fleshing out the `JsObject` API!
2017-12-31 14:44:44 -08:00
8ba64bab68 Update to syn master 2017-12-31 14:40:57 -08:00
e03ef1c2a4 Enable wasm-bindgen -h
Closes #3
2017-12-27 07:50:43 -08:00
c0e2cb3ac8 Merge pull request #2 from fschutt/master
Remove synom
2017-12-27 09:18:42 -06:00
33679a2b02 Removed synom due to regression in c5ab8c6b9f 2017-12-27 10:27:58 +01:00
bef908a9b1 Add an option to "uglify" imports
This commit adds an option to "uglify" the wasm module's imports/exports so
those which are controlled by bindgen are renamed to a shorter (probably one
letter) names. This'll hopefully help cut down on both the wasm size slightly
and also the generated JS as the glue we're talking to wasm over won't require
such large names all the time.
2017-12-24 15:32:40 -08:00
240d3cd1a1 Rename __wasmPtr field to ptr
May as well have it be a bit shorter so minifiers can be a little smaller.
2017-12-24 09:41:57 -08:00
97be6d35ce Add get_mut to WasmRefCell 2017-12-21 12:28:30 -08:00
44a9555313 Extract null check throw to a separate function
Slightly smaller callsite!
2017-12-21 12:25:13 -08:00
6aacff6a80 Further optimize non-debug output
Remove a bunch of exception throws in favor of type casts in TypeScript and
remove some type assertions as well that TypeScript should uphold.
2017-12-20 13:24:18 -08:00
5d697c196f Only expose assertions in debug mode 2017-12-20 12:56:57 -08:00
f1d425b943 Hook up debug to the CLI 2017-12-20 12:50:10 -08:00
b548239e02 Don't generate code for dead imports 2017-12-20 11:34:53 -08:00
5e80b082a9 Allow imports to return JS objects 2017-12-20 10:44:08 -08:00
294c5e147b Support passing booleans back and forth 2017-12-20 10:22:18 -08:00
730ef1926e Enable the --declaration tsc argument 2017-12-20 08:25:45 -08:00
8d7e6f3cdd Ok, let's actually expose memory
May as well have it typed!
2017-12-20 08:22:30 -08:00
2fbd784002 Disable tslint automatically
This is generated code, no need to lint it
2017-12-20 08:21:19 -08:00
97957d98f1 Fix noUnusedParameters warning 2017-12-20 08:17:20 -08:00
5fe842e9bd Allow extra exports not part of wasm-bindgen
Currently throw them all in an interface under `extra` in the main exports
interface. May change in the future...
2017-12-20 08:11:06 -08:00
a12a8f414c Support imports outside of wasm_bindgen! 2017-12-20 07:58:41 -08:00
66ae545bff Add support for raw pointers in Rust 2017-12-20 07:35:14 -08:00
737bd8c965 Add objects to the top of the README 2017-12-19 20:00:52 -08:00