wasmerio / cargo-wasmer

A cargo sub-command for publishing Rust crates to the WebAssembly Package Manager.
Apache License 2.0
24 stars 2 forks source link

Allow one `Cargo.toml` file to generate a WAPM package with multiple modules #10

Open Michael-F-Bryan opened 1 year ago

Michael-F-Bryan commented 1 year ago

When constructing a wapm_toml::Manifest, we call determine_target() which takes a cargo_metadata::Package (i.e. a parsed Cargo.toml) and returns a reference to the one cargo_metadata::Target in that Package. From there, we construct a wapm_toml::Manifest with a single wapm_toml::Module that corresponds to that Target (i.e. a WASI executable or WebAssembly library).

WAPM packages support multiple modules, so it'd be nice if our "autodiscovery" can generate a wapm_toml::Manifest containing multiple wapm_toml::Modules, where we have one Module per Target (e.g. if your crate contains a library and a binary, the WAPM package would make both available).