Commit f22e230
Guy Bedford
gen-host-js: instance ESM output by default (#406)
* gen-host-js: instance ESM output by default
Outputs a direct ES module from the JS host generator by default
that can be directly imported in JS environments.
For the custom instantiation API that was the previous output, a new
`--instantiation` flag is provided.
Instance-level customization flags are also added including:
* `--compat`: Enables compatibility mode, based on the assumption
that a new --tla-compat flag will be added in a future PR.
* `--nodejs-compat`: Handle Node.js instantiation when no fetch global
is present
The above flags are only compatible with instance output and will throw
otherwise.
This PR also parallelizes the core Wasm instantiations, and converts the
instantiation API from `instantiateCore(path, imports)` to
`compileCore(path)` to enable this parallelization.
In addition a new `--map` is added with support for custom import
specifier mappings that can apply to both output modes.1 parent 0234aa2 commit f22e230
24 files changed
Lines changed: 504 additions & 221 deletions
File tree
- crates
- gen-host-js
- src
- tests
- wit-bindgen-demo
- src
- src/bin
- tests/runtime
- flavorful
- invalid
- lists
- many_arguments
- numbers
- records
- smoke
- strings
- variants
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
0 commit comments