Commit Graph

207 Commits

Author SHA1 Message Date
Kirguir
eeebec0765 Add ability to run tests on remote webdriver. (#1744)
* Add ability run tests on remote webdriver

* Add parsing `webdriver.json` for configure browser capabilities

* Add docs for configuring of browser capabilities

* Remove webdriver dependency
2019-09-19 09:00:51 -05:00
Alex Crichton
88618116ac
Add support for #[wasm_bindgen] on async fn (#1754)
This commit adds support to attach `#[wasm_bindgen]` on an `async fn`
which will change the return value into a `Promise` in JS. This in
theory has the exact same semantics as an `async` function in JS where
you call it with all the arguments, nothing happens and you get a
promise back, and then later the promise actually resolves.

This commit also adds a helper trait, `IntoJsResult`, to allow `async`
functions with multiple kinds of return values instead of requiring
everything to be `Result<JsValue, JsValue>`.
2019-09-06 13:47:16 -05:00
Alex Crichton
84898c1d53
Touch up documentation about futures (#1753) 2019-09-05 11:49:04 -05:00
nasso
e39e8501db Update browser support for BigInt (#1728)
* Update browser support for `BigInt`

`BigInt` is supported in Firefox as of Firefox 68!
Also replaced Firefox with Safari as a second example of an unsupported browser.

* Add link to "BigInt" on "Can I use..."
2019-08-20 19:16:46 -05:00
Naja Melan
e41bd688d0
remove warning about caching 2019-06-25 08:15:35 +00:00
Naja Melan
5bb6c6c577
Simplify instructions for CI testing of wasm code
After discussion on #1611, this replaces the complicated setup with the automated install of wasm-pack.

I have added a note on caching, which I think would be useful to users, since the installer is really stuborn about not wanting to be automated. eg. `yes | installer` won't work. You have to remove all wasm-pack binaries before running it in order for it to be automated.
2019-06-23 15:12:46 +00:00
Alex Crichton
b7b92cffe2 Update mdbook install 2019-06-19 13:49:57 -07:00
Volker Mische
5c79298dc9
guide: fix typo in rust-type-conversions.md 2019-06-12 14:14:57 +02:00
ibaryshnikov
cbedf0bba0 added websockets example to the guide 2019-06-01 16:17:50 +03:00
noelyoo
f3ec734310 docs: update docs link 2019-05-26 16:43:00 +09:00
Nick Fitzgerald
2a896dbeb3 Also mention that serde-wasm-bindgen supports more types than JSON does 2019-05-23 14:14:21 -07:00
Nick Fitzgerald
90f1866ddd Add note to the guide about serde-wasm-bindgen 2019-05-22 09:39:08 -07:00
lzubiaur
c043a952a2 Fix closure example compilation errors 2019-05-20 16:40:22 +09:00
Delet0r
cb691100f1
corretected unit of UTF-16 from byte to bit 2019-05-08 15:03:34 +02:00
Alex Crichton
3031c15bf6 Rewrite docs for getters/setters 2019-04-30 10:06:38 -07:00
Caio
470eea9fb0 Getters/Setters for fields 2019-04-30 10:26:03 -03:00
Dimitrii Nemkov
735b1a1aa8
guide: fixed typo in js-objects-in.rust.md 2019-04-21 09:44:24 +05:00
alexlapa
8b6dabcb5c add wasm_bindgen(skip) to reference 2019-04-14 23:49:24 +03:00
Alex Crichton
16745edf3f
Merge pull request #1416 from alexcrichton/js-string-valid-utf16
Add warnings about UTF-16 vs UTF-8 strings
2019-04-05 10:12:32 -05:00
Alex Crichton
44738e049a Add warnings about UTF-16 vs UTF-8 strings
This commit aims to address #1348 via a number of strategies:

* Documentation is updated to warn about UTF-16 vs UTF-8 problems
  between JS and Rust. Notably documenting that `as_string` and handling
  of arguments is lossy when there are lone surrogates.

* A `JsString::is_valid_utf16` method was added to test whether
  `as_string` is lossless or not.

The intention is that most default behavior of `wasm-bindgen` will
remain, but where necessary bindings will use `JsString` instead of
`str`/`String` and will manually check for `is_valid_utf16` as
necessary. It's also hypothesized that this is relatively rare and not
too performance critical, so an optimized intrinsic for `is_valid_utf16`
is not yet provided.

Closes #1348
2019-04-05 08:11:50 -07:00
Caio
a9ad9a96db Update CONTRIBUTING to inform about code formatting 2019-04-05 09:41:00 -03:00
Alex Crichton
05fbbb2b92
Merge pull request #1358 from stevebob/book-linkcheck-pr
Installing and running the linkcheck mdbook backend
2019-03-27 08:04:49 -04:00
Alex Crichton
c5d2b2d1fb
Merge pull request #1359 from konstin/reexporting_in_2018
Allow reexporting proc macro output in the 2018 edition
2019-03-26 10:08:46 -05:00
Alex Crichton
faf49c7d56 Reorganize the import_js example 2019-03-25 13:49:29 -07:00
Alex Crichton
80899abf84
Merge pull request #1378 from alexcrichton/doc-tweaks
Clarify some introductory docs
2019-03-21 16:54:45 -05:00
Alex Crichton
995be7c027 Replace target flags with --target
This commit deprecates the `--web`, `--no-modules`, and `--nodejs` flags
in favor of one `--target` flag. The motivation for this commit is to be
consistent between `wasm-bindgen` and `wasm-pack` so documentation for
one is applicable for the other (so we don't have to document everywhere
what the translation is between flags). Additionally this should make it
a bit easier to add new targets (if necessary) in the future as it won't
add to the proliferation of flags.

For now the old flags (like `--web`) continue to be accepted, but
they'll be removed during the next set of breaking changes for
`wasm-bindgen`.
2019-03-21 14:00:33 -07:00
Nick Fitzgerald
1e98f6b0dd Use wasm-pack build --target web for without-a-bundler example 2019-03-21 13:55:25 -07:00
Alex Crichton
e39b5c1121 Clarify some introductory docs
* Note that after the game of life tutorial there's also wasm-pack tutorials
* Ensure that the hello world example is clear that webpack isn't
  required inline in addition to the text on other pages.
2019-03-21 08:44:53 -07:00
konstin
42c1cdd8bf
Merge branch 'master' into reexporting_in_2018 2019-03-18 21:38:18 +01:00
konstin
69bbf597af Allow reexporting proc macro output in the 2018 edition
Trying to use a proc macro from a 2018 edition crate in a 2018 edition crate that reexports wasm bindgen's output failed before this commit with "could not find `wasm_bindgen` in `{{root}}`".

This commit was made with 

rg " ::wasm_bindgen::" --files-with-matches | xargs sed -i 's/::wasm_bindgen::/wasm_bindgen::/g'
2019-03-18 10:43:48 +01:00
Stephen Sherratt
47f3247a0e Installing and running the linkcheck mdbook backend 2019-03-16 17:42:15 +00:00
Alex Crichton
0d592fffb0 Add a raw_module attribute to #[wasm_bindgen]
This allows subverting the checks and resolution performed by the
`module` attribute added as part of [RFC 6] and has been discussed in #1343.

Closes #1343

[RFC 6]: https://github.com/rustwasm/rfcs/pull/6
2019-03-15 08:08:09 -07:00
Alex Crichton
8db85dddde Update a few links here and there with doc restructuring 2019-03-08 05:58:22 -08:00
Alex Crichton
a7e7f8b5e1
Merge pull request #1328 from alexcrichton/switch-to-web
Switch the `--browser` argument to `--web`
2019-03-07 15:25:26 -06:00
Nick Fitzgerald
fcafd03dcd
Update guide/src/contributing/index.md
Co-Authored-By: alexcrichton <alex@alexcrichton.com>
2019-03-07 15:17:17 -06:00
Alex Crichton
cd3781cb73 Switch the --browser argument to --web
This commit reverts part of the implementation of [RFC 6]. That RFC
specified that the `--browser` flag was going to be repurposed for the
new "natively loadable as ES module output", but unfortunately the
breakage is far broader than initially expected. It turns out that
`wasm-pack` passes `--browser` by default which means that a change to
break `--browser` would break all historical versions of `wasm-pack`
which is a bit much for now.

To solve this the `--browser` flag is going back to what it represents
on the current released version of `wasm-bindgen` (optimize away some
node.js checks in a few places for bundler-style output) and a new
`--web` flag is being introduced as the new deployment strategy.

[RFC 6]: https://github.com/rustwasm/rfcs/pull/6

Closes #1318
2019-03-07 08:26:36 -08:00
Alex Crichton
96f4c8aa63 Add a "nightly only" warning to documentation
Official documentation is now available at
https://rustwasm.github.io/docs/wasm-bindgen/, so let's leave this git
repository's documentation purely for our own previewing purposes.
2019-03-07 07:48:26 -08:00
Alex Crichton
b762948456 Implement the local JS snippets RFC
This commit is an implementation of [RFC 6] which enables crates to
inline local JS snippets into the final output artifact of
`wasm-bindgen`. This is accompanied with a few minor breaking changes
which are intended to be relatively minor in practice:

* The `module` attribute disallows paths starting with `./` and `../`.
  It requires paths starting with `/` to actually exist on the filesystem.
* The `--browser` flag no longer emits bundler-compatible code, but
  rather emits an ES module that can be natively loaded into a browser.

Otherwise be sure to check out [the RFC][RFC 6] for more details, and
otherwise this should implement at least the MVP version of the RFC!
Notably at this time JS snippets with `--nodejs` or `--no-modules` are
not supported and will unconditionally generate an error.

[RFC 6]: https://github.com/rustwasm/rfcs/pull/6

Closes #1311
2019-03-05 08:00:47 -08:00
Tyler Anton
c40f4d05b5 Fix typo in Js Objects in Rust 2019-02-24 17:13:24 -08:00
limira
de3c852c21
[guide] Minor fix 2019-02-23 15:06:16 +07:00
Alex Crichton
b71f3374c5 Tweak introductory and deployment documentation.
This commit rejiggers some documentation of `wasm-bindgen` in a few
significant ways:

* The main landing page now has text and links to the Game of Life
  tutorial and `wasm-pack`.
* The "whirlwind tour" was deleted as it wasn't really serving any
  purpose that the Game of Life plus the later references weren't already
  serving.
* The "no modules" example was renamed to "without a bundler"
* A dedicated section on "Deployment" was added which replaces the
  previous "No ES Modules" page. This is hopefully more descriptive and
  also prominently mentions the various options for deployment.
2019-02-22 07:50:32 -08:00
Camille TJHOA
eda7541e45 Fix missing link on todomvc example 2019-02-17 16:19:23 +00:00
Stephen Sherratt
f774d52ed5 Fix broken links 2019-02-10 14:54:18 +00:00
Carlos Diaz-Padron
11db255e47
Fix version number in travis instruction 2019-01-31 18:00:49 -08:00
Ivo Georgiev
b3e97a7e45
browser-support: warn about the performance hit of using the polyfill~ 2019-01-28 20:55:11 +01:00
Alex Crichton
32c611d16d Convert all examples to using wasm-pack
This commit migrates all our examples to using `wasm-pack build` to
compile their code and run `wasm-bindgen`. This should make it a bit
easier to understand the examples as there's less to follow during the
build step.

Webpack projects are all using `@wasm-tool/wasm-pack-plugin` as well so
the build step is simple `npm run serve`. Other examples which retain
`build.sh` are just using `wasm-pack build` now
2019-01-17 08:37:32 -08:00
Andrew Mackenzie
4139fc10f7
Remove separators that cause numbering jumps
I have removed the "--------------------" separators as they cause a section number to be skipped and hence incorrect section numbering in the left panel TOC.

Take a look at https://rustwasm.github.io/wasm-bindgen/web-sys/index.html left panel, towards the bottom, and you will see that it's jumps from section 3, to 5, to 7 to 9 - which I am assuming is NOT what you wanted.
2019-01-01 17:38:45 +01:00
Khải
af06c6fc3d
Fix typo 2018-12-22 16:15:12 +07:00
Alex Crichton
4054ce8a2c More fixes for iterating example 2018-12-13 10:40:07 -08:00
Roberto Vidal
08680276ae Fixes outdated links 2018-12-13 15:25:15 +01:00