Skip to content

Commit

Permalink
Allow using --codegen and update README (#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffcharles authored Aug 27, 2024
1 parent 9641533 commit 5e61628
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ $ echo '{ "n": 2, "bar": "baz" }' | wasmtime index.wasm
If you have a lot of JavaScript and you want to reduce compile times, try using the `--no-source-compression` flag. It will skip compressing the JavaScript source code when generating the Wasm module but will result in the Wasm module being larger.

```bash
javy build index.js -o destination/index.wasm --no-source-compression
javy build index.js -o destination/index.wasm -C source-compression=n
```

### Exporting functions
Expand Down Expand Up @@ -176,7 +176,7 @@ world index-world {

In the terminal:
```bash
$ javy build index.js --wit index.wit -n index-world -o index.wasm
$ javy build index.js -C wit=index.wit -C wit-world=index-world -o index.wasm
$ wasmtime run --invoke foo index.wasm
Hello world!
Hello from foo!
Expand Down Expand Up @@ -206,7 +206,7 @@ world index {

In the terminal:
```bash
$ javy build index.js --wit index.wit -n index -o index.wasm
$ javy build index.js -C wit=index.wit -C wit-world=index -o index.wasm
$ wasmtime run --invoke foo-bar index.wasm
In foo-bar
```
Expand All @@ -233,7 +233,7 @@ world index {

In the terminal:
```bash
$ javy build index.js --wit index.wit -n index -o index.wasm
$ javy build index.js -C wit=index.wit -C wit-world=index -o index.wasm
$ wasmtime run --invoke default index.wasm
In default
```
Expand Down Expand Up @@ -271,7 +271,7 @@ The `javy_quickjs_provider.wasm` module is available as an asset on the Javy rel

```
$ echo 'console.log("hello world!");' > my_code.js
$ javy build -d -o my_code.wasm my_code.js
$ javy build -C dynamic -o my_code.wasm my_code.js
$ javy emit-provider -o provider.wasm
$ wasmtime run --preload javy_quickjs_provider_v2=provider.wasm my_code.wasm
hello world!
Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub struct BuildCommandOpts {

#[arg(
short = 'C',
long = "codegen",
long_help = "Available codegen options:
-C dynamic[=y|n] -- Creates a smaller module that requires a dynamically linked QuickJS provider Wasm module to execute (see `emit-provider` command).
-C wit=path -- Optional path to WIT file describing exported functions. Only supports function exports with no arguments and no return values.
Expand Down

0 comments on commit 5e61628

Please sign in to comment.