Commit Graph

3117 Commits

Author SHA1 Message Date
Sharad Chand
ffdb8a6a32 Simplified the preamble 2018-04-12 10:31:13 +05:45
Alex Crichton
b9b8756cd0 Demangle Rust symbols by default 2018-04-11 11:43:18 -07:00
Sharad Chand
aa6487b6f1 panic when modules used 2018-04-11 14:22:20 +05:45
Sharad Chand
8c935d5d94 Change flag to --no-modules 2018-04-11 13:59:58 +05:45
Alex Crichton
d1a4bffb3a Looks like opt-level=s may be better
With opt-level=z not enough functions were inlined to eliminate more code!
2018-04-10 07:41:40 -07:00
Alex Crichton
db15a898cb
Merge pull request #117 from markandrus/fix-require-from-different-directory
Call fs.readFileSync with __dirname
2018-04-10 08:58:55 -05:00
Mark Andrus Roberts
0aef97215c Call fs.readFileSync with __dirname
Node's fs APIs resolve relative paths relative to the current working directory:

https://nodejs.org/api/fs.html#fs_file_paths

This creates a problem if you try to require the wasm-bindgen-generated
JavaScript from a different directory. For example, if you have

  build/foo.js
  build/foo_bg.js
  build/foo_bg.wasm

and another script, script/index.js, that requires build/foo.js. We can instead
use __dirname to get the correct path to the file.
2018-04-09 17:38:22 -07:00
Alex Crichton
656d69816d Move all tests to the same suite
Nowadays the compile times are mitigated with incremental compilation and
otherwise it's much more ergonomic to run only one test if they're all in the
same suite.
2018-04-09 15:32:06 -07:00
Alex Crichton
60ac57331b Bump to 0.2.1 2018-04-09 15:18:39 -07:00
Alex Crichton
a558fa49a0 Fix closures example build script 2018-04-09 15:02:20 -07:00
Alex Crichton
6b49af8234 Build releases with nightly on CI 2018-04-09 14:42:47 -07:00
Alex Crichton
071f3637fa Build closures example on Travis 2018-04-09 14:41:24 -07:00
Alex Crichton
aaff0be441 Fix closure tests 2018-04-09 14:40:01 -07:00
Alex Crichton
ee93122c5b
Merge pull request #101 from rustwasm/closures
Initial support for closures
2018-04-09 16:36:01 -05:00
Alex Crichton
a3e5485b86 Add examples/documentation for closures 2018-04-09 14:34:21 -07:00
Alex Crichton
176060cc8a Aggressively optimize for size in release mode 2018-04-09 14:34:21 -07:00
Alex Crichton
66bdd92fa2 More aggressively gc module
As soon as we've removed unneeded exports immediately run a gc pass to ensure
that we don't bind functions in JS that don't actually end up getting needed.
2018-04-09 14:34:21 -07:00
Alex Crichton
f7f0d578e7 Support long-lived closures
Docs coming soon!
2018-04-09 14:34:21 -07:00
Alex Crichton
28d6c1bc12 Support stack closures with up to 7 arguments 2018-04-09 14:34:21 -07:00
Alex Crichton
c0cad447c1 Initial support for closures
This commit starts wasm-bindgen down the path of supporting closures. We
discussed this at the recent Rust All-Hands but I ended up needing to pretty
significantly scale back the ambitions of what closures are supported. This
commit is just the initial support and provides only a small amount of support
but will hopefully provide a good basis for future implementations.

Specifically this commit adds support for passing `&Fn(...)` to an *imported
function*, but nothing elese. The `&Fn` type can have any lifetime and the JS
object is invalidated as soon as the import returns. The arguments and return
value of `Fn` must currently implement the `WasmAbi` trait, aka they can't
require any conversions like strings/types/etc.

I'd like to soon expand this to `&mut FnMut` as well as `'static` closures that
can be passed around for a long time in JS, but for now I'm putting that off
until later. I'm not currently sure how to implement richer argument types, but
hopefully that can be figured out at some point!
2018-04-09 14:34:21 -07:00
Alex Crichton
9b46c8831d Fixup AppVeyor badge 2018-04-09 12:49:08 -07:00
Alex Crichton
ce00c12a4a
Merge pull request #112 from konstin/patch-1
Update readme links for the moved repository
2018-04-09 14:46:05 -05:00
konstin
30a8f86e76
Update readme links for the moved repository 2018-04-09 21:26:15 +02:00
Alex Crichton
a699455f03 Walk the prototype chain looking for descriptors
Looks like this breakage may occur in some scenarios so let's try to
future-proof ourselves!

Closes #109
2018-04-09 06:16:41 -07:00
Sharad Chand
ee1e3abd45 Am an idiot 2018-04-07 13:22:03 +05:45
Sharad Chand
b9192592a9 Updated docopts 2018-04-07 13:17:56 +05:45
Sharad Chand
e8f4b7ed86 Skip window assertions 2018-04-07 13:08:57 +05:45
Sharad Chand
0bd8713bd5 Dropped node support in umd -> amd 2018-04-07 13:06:36 +05:45
Sharad Chand
2b9af53030 wasm is compiled, mod in uncompiled 2018-04-06 12:59:07 +05:45
Sharad Chand
1a428d69da {global} not referenced 2018-04-05 20:30:58 +05:45
Sharad Chand
2877d0bdb6 UMD import added 2018-04-05 19:50:26 +05:45
Sharad Chand
3a83b02de0 Added umd switch 2018-04-04 20:06:53 +05:45
Alex Crichton
9723fdd69b
Merge pull request #100 from sendilkumarn/remove-coder-func
Reduce the JS file size and optimizing encoder and decoder functions
2018-04-04 08:46:36 -05:00
Sendil Kumar N
64d7c8d082
Update lib.rs 2018-04-04 11:27:27 +02:00
Sendil Kumar
9421edaab5 add missed out TextEncoder 2018-04-04 11:22:34 +02:00
Sendil Kumar
6d5afbb3d2 reduce the js file generated code
remove node test for browser test

update usages

revert test-support changes
2018-04-04 11:22:32 +02:00
Alex Crichton
07c5ff5a93 Update README version 2018-04-03 14:04:23 -07:00
Alex Crichton
0d1759abd5 Add description to backend crate 2018-04-03 14:02:04 -07:00
Alex Crichton
40e1ee4484
Merge pull request #99 from fitzgen/text-decoder-detection
Fix Text{En,De}coder feature detection
2018-04-03 15:33:34 -05:00
Alex Crichton
de3a7e3242 Remove nodejs-checking logic from math exports
Instead create a temporary vector which is used to later invoke the generic
`export` function
2018-04-03 13:29:26 -07:00
Alex Crichton
62e9f580d0 Use Context::export in write_classes
No need to doubly check for `nodejs`
2018-04-03 13:25:10 -07:00
Nick Fitzgerald
38c123a157 Fix feature detection of TextEncoder too
It took me an embarrassingly long time to debug this issue that "I already
fixed"...
2018-04-03 13:20:59 -07:00
Alex Crichton
23f6049619 Fixup various refactoring issues 2018-04-03 13:20:56 -07:00
Alex Crichton
7f614c3c3a Reduce node/browser duplication
Centralize the export of a function to one location to reduce duplication in
various other locations checking whether Node is being targeted or not.
2018-04-03 13:12:28 -07:00
Alex Crichton
cf9ef7b570 Disable incremental on CI for now
It seems... buggy!
2018-04-03 13:01:34 -07:00
Nick Fitzgerald
c4b52d0bf6 Properly feature detect TextDecoder 2018-04-03 12:58:54 -07:00
Alex Crichton
cc11505dc8 Remove an unused unsafe block 2018-04-03 12:53:24 -07:00
Alex Crichton
455e86ef6d Merge branch 'node-math' of https://github.com/ashleygwilliams/wasm-bindgen 2018-04-03 12:53:15 -07:00
Alex Crichton
1ff9ccf072 Tighten up getStringFromWasm a bit
no need for some extra locals here
2018-04-03 12:44:35 -07:00
Alex Crichton
978b5ada63 Tighten up passStringToWasm a bit
Only emit `throw` on debug mode primarily
2018-04-03 12:44:09 -07:00