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

Rename emit-provider subcommand to emit-plugin #819

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions crates/cli/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub enum Command {
Build(BuildCommandOpts),
/// Emits the plugin binary that is required to run dynamically
/// linked WebAssembly modules.
EmitProvider(EmitProviderCommandOpts),
EmitPlugin(EmitPluginCommandOpts),
/// Initializes a plugin binary.
#[command(arg_required_else_help = true)]
InitPlugin(InitPluginCommandOpts),
Expand All @@ -64,7 +64,7 @@ pub struct CompileCommandOpts {

#[arg(short)]
/// Creates a smaller module that requires a dynamically linked QuickJS
/// plugin Wasm module to execute (see `emit-provider` command).
/// plugin Wasm module to execute (see `emit-plugin` command).
pub dynamic: bool,

#[structopt(long)]
Expand Down Expand Up @@ -107,7 +107,7 @@ pub struct BuildCommandOpts {
}

#[derive(Debug, Parser)]
pub struct EmitProviderCommandOpts {
pub struct EmitPluginCommandOpts {
#[structopt(short, long)]
/// Output path for the plugin binary (default is stdout).
pub out: Option<PathBuf>,
Expand Down Expand Up @@ -196,7 +196,7 @@ option_group! {
#[derive(Clone, Debug)]
pub enum CodegenOption {
/// Creates a smaller module that requires a dynamically linked QuickJS
/// plugin Wasm module to execute (see `emit-provider` command).
/// plugin Wasm module to execute (see `emit-plugin` command).
Dynamic(bool),
/// Optional path to WIT file describing exported functions. Only
/// supports function exports with no arguments and no return values.
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mod plugins;
mod wit;

use crate::codegen::WitOptions;
use crate::commands::{Cli, Command, EmitProviderCommandOpts};
use crate::commands::{Cli, Command, EmitPluginCommandOpts};
use anyhow::Result;
use clap::Parser;
use codegen::{CodeGenBuilder, CodeGenType};
Expand All @@ -24,7 +24,7 @@ fn main() -> Result<()> {
let args = Cli::parse();

match &args.command {
Command::EmitProvider(opts) => emit_plugin(opts),
Command::EmitPlugin(opts) => emit_plugin(opts),
Command::Compile(opts) => {
eprintln!(
r#"
Expand Down Expand Up @@ -99,7 +99,7 @@ fn main() -> Result<()> {
}
}

fn emit_plugin(opts: &EmitProviderCommandOpts) -> Result<()> {
fn emit_plugin(opts: &EmitPluginCommandOpts) -> Result<()> {
let mut file: Box<dyn Write> = match opts.out.as_ref() {
Some(path) => Box::new(File::create(path)?),
_ => Box::new(std::io::stdout()),
Expand Down
4 changes: 2 additions & 2 deletions docs/docs-using-dynamic-linking.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ bytecode representation.
The `plugin.wasm` module is available as an asset on the Javy
release you are using.

It can also be obtained by running `javy emit-provider -o
It can also be obtained by running `javy emit-plugin -o
<path>` to write the module into `<path>`.

#### Creating and running a dynamically linked module througy the CLI
Expand All @@ -34,7 +34,7 @@ Run:
```
$ echo 'console.log("hello world!");' > my_code.js
$ javy build -C dynamic -o my_code.wasm my_code.js
$ javy emit-provider -o plugin.wasm
$ javy emit-plugin -o plugin.wasm
$ wasmtime run --preload javy_quickjs_provider_v3=plugin.wasm my_code.wasm
hello world!
```
2 changes: 1 addition & 1 deletion docs/docs-using-nodejs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ javy build -C dynamic -o embedded.wasm embedded.js
```
2. Next emit the Javy plugin
```shell
javy emit-provider -o plugin.wasm
javy emit-plugin -o plugin.wasm
```
3. Then we can run `host.mjs`
```shell
Expand Down
Loading