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
This commit does a few things, including:
* Fixing the generated JS of `wasm-bindgen` to allow polyfills to work.
(a minor tweak of the generated JS)
* All examples are updated to include a Webpack-specific polyfill for
these two types to get examples working in Edge.
* A new page has been added to the guide about supported browsers. This
mentions known caveats like IE 11 requiring `wasm2js` as well as
documenting some `TextEncoder` and `TextDecoder` workarounds for Edge.
Closes#895
* Changed eslintrc to be JSON file (Most projects use JSON version)
* Added .eslintignore to ingore node_modules from subdirectories such as examples
* Ran eslint --fix examples to fix all examples
* Added npm script for running eslint against examples
* Added npm script for running eslint against generated *out* code
* Hooked npm scripts into travis ci to prevent examples from becoming inconsistent with future PR's
* tests: Add newlines between impl methods for Project
* WIP headless browser testing with geckodriver and selenium
* Get some more of headless testing working
* Extract `console.log` invocations and print them from the console
* Ship the error message from an exception from the browser back to the command
line
* Cleanup some "if headless" and `else` branches
* Fix killing `webpack-dev-server` in the background with `--watch-stdin`
* Fix path appending logic for Windows
* Always log logs/errors in headless mode
* Install Firefox on Travis
* Don't duplicate full test suite with `yarn`
No need to run that many tests, we should be able to get by with a smoke test
that it just works.
* headless tests: Move `run-headless.js` to its own file and `include_str!` it
* Run `rustfmt` on `tests/all/main.rs`
* guide: Add note about headless browser tests and configuration
* test: Log WASM_BINDGEN_FIREFOX_BIN_PATH in run-headless.js
* TEMP only run add_headless test in CI
* Add more logging to headless testing
* Allow headless tests to run for 60 seconds before timeout
* TEMP add logging to add_headless test
* Fix headless browser tests
* Another attempt to fix Travis
* More attempts at debugging
* Fix more merge conflicts
* Touch up an error message
* Fixup travis again
* Enable all travis tests again
* Test everything on AppVeyor
* Reorganize Travis configuration
* Add a `JOB` env var descriptor to all matrix entries. Not used anywhere but is
useful when viewing the whole build on Travis's web interface.
* Reorganize where builds are located, moving slow builds first and fast ones
last.
* Change checking the CLI builds from `cargo build` to `cargo check`
* Use YAML references to reduce some duplication
* Print some more timing statistics for each test
* Extract `Project` helper in tests to a module
This'll help make it a bit more extensible over time. At the same time the
methods are also slightly reorganized to read more clearly from top to bottom.
* Migrate all tests away from Webpack
Wepback can take a significant amount of time to execute and when it's
multiplied by hundreds of tests that adds up really quickly! After investigating
Node's `--experimental-modules` option it looks like it's suitable for our use
so this switches all tests to using JS files (moving away from TypeScript as
well) with `--experimental-modules` with Node.
Tests will be selectively re-enabled with webpack and node.js specific output
(that doesn't require `--experimental-modules`), coming in later commits.
* Restore the node test for node.js output
Ensures it's workable as-is
* Only generate typescript with webpack
* Only read wasm files for webpack
* Skip package.json/node_modules for now
* Only generate webpack config if needed
* Start a dedicated test module for typescript
Will hopefully verify the generated Typescript compiles OK.
* Remove unneeded `node` method
* Fixup some rebase conflicts
* Don't run asmjs example on travis
* Fixup generator tests
* Attempt to fix windows
* Comment windows fix
* More test fixes
* More exclusions
* More test fixes
* Relax eslint regex
Catch mjs modules as well
* Fix eslint
* Speed up travis on examples slightly
Building on the previous commit to invoke not invoke `npm install` this takes
the commit a step further (to hopefully fix some races) to use Webpack's native
bundled wasm support.
It turns out the circular dependencies between the wasm module and the module
using it wasn't quite working out so a number of imports had to be tweaked, but
otherwise it's a nice transition where we don't have to base64 encode anything
in tests any more!