Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using --codegen and update README #737

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading