Releases: bytecodealliance/cargo-component
v0.11.0
Compatibility
- Wasmtime: 17.0.0+
- WASI: 0.2.0
- Warg (registry support): 0.4.0
What's Changed
- Update wit-bindgen and wasm-tools. by @sunfishcode in #266
- Synchronize artifact componentization. by @peterhuene in #270
- Bump version to 0.11.0. by @peterhuene in #271
Full Changelog: v0.10.1...v0.11.0
v0.10.1
Bug fixes
This patch release contains a single fix to prevent bindings being generated for cargo projects that are not meant to be components.
Bindings generation now only occurs based on either:
- The presence of a
[package.metadata.component]
section inCargo.toml
(the default forcargo component new
projects). - The presence of a
wit
directory in the project.
Compatibility
- Wasmtime: 17.0.0+
- WASI: 0.2.0
- Warg (registry support): 0.4.0
What's Changed
- Prevent bindings generation for normal cargo projects. by @peterhuene in #260
- Bump
cargo-component
version to 0.10.1. by @peterhuene in #261
Full Changelog: v0.10.0...v0.10.1
v0.10.0
New features
The biggest change included in this release is the support for the latest Warg registry protocol (including registry auth tokens) and also moved the keyring management out of cargo-component
and into the warg-credentials
crate.
Bug fixes
The code generated by cargo component new --target
now properly works with the latest generated bindings when the target world contains exports with resources; it now generates a scaffolding type to implement a resource and sets the trait-associated type when generating interface implementations.
Compatibility
- Wasmtime: 17.0.0+
- WASI: 0.2.0
- Warg (registry support): 0.4.0
What's Changed
- Fix panic in bindings generation for component dependencies. by @peterhuene in #253
- Fix
new --target
option for exports with resources. by @peterhuene in #254 - rely on warg-credentials for keyring management by @macovedj in #251
- Bump version to 0.10.0. by @peterhuene in #256
Full Changelog: v0.9.1...v0.10.0
v0.9.1
Issues fixed
This release contains a fix introduced in wit-bindgen
0.21.0 to eliminate trailing whitespace that was causing the automatic formatting of the generated bindings to fail.
Users that applied the workaround of setting package.metadata.component.bindings.format
to false
in Cargo.toml
are encouraged to remove the setting after upgrading to 0.9.1; if formatting continues to fail, please let us know by filing an issue.
Users may wish to update the version of the wit-bindgen-rt
dependency in Cargo.toml
to 0.21.0
, but that should not be required.
Upgrading from previous versions
If upgrading from a version of cargo-component
older than 0.9.0
, please see the release notes for the 0.9.0 release that details several breaking changes.
Compatibility
- Wasmtime: 17.0.0+
- WASI: 0.2.0
- Warg (registry support): 0.3.0
What's Changed
- Update to wit-bindgen 0.21. by @sunfishcode in #247
- Bump
cargo-component
to 0.9.1. by @peterhuene in #249
Full Changelog: v0.9.0...v0.9.1
v0.9.0
⚠️ Breaking Changes ⚠️
There are a few breaking changes in this release that impact existing cargo-component
projects.
The reintroduction of the export!
macro
The latest generated bindings has reintroduced the export!
macro; an invocation of this macro is required for the core module built from the Rust sources to export the required items.
Building your project without an export!
invocation may result in this error message:
error: module does not export required function `<name>`
To fix this, add the following to your src/lib.rs
:
bindings::export!(Component with_types_in bindings);
Where Component
is the name of the type implementing the generated bindings traits.
Changes to dependencies
To further reduce the chances of a wit-bindgen
change breaking cargo-component
, a new crate named wit-bindgen-rt
was introduced which contains only the runtime functions necessary for bindings to work.
Please replace the following in Cargo.toml
:
wit-bindgen = { version = "<version>", default-features = false, features = ["realloc"]}
with:
bitflags = "2.4.2"
wit-bindgen-rt = "0.20.0"
Changes to [package.metadata.component.bindings]
in Cargo.toml
With the reintroduction of the export!
macro, the implementor
and resources
settings that were used to customize the implementing type names in user code have been removed.
Remove these two settings if previously used.
For replacing the implementor
setting, pass the implementing type name (e.g. MyImplementingType
) to the export!
macro:
bindings::export!(MyImplementingType with_types_in bindings);
For replacing the resources
setting, use the trait-associated type to specify the implementing resource type:
struct MyResource;
impl bindings::exports::example::Guest for Component {
type MyResource = MyResource;
// ...
}
With the implementing types now expressed directly in Rust source, this should hopefully improve compiler diagnostics when there is a mismatch.
Automatic Source Formatting of Generated Bindings
This release of cargo-component
includes a feature to automatically format the source code of the generated bindings.
However, rustfmt
may fail on overly complex generated source. We've opened an issue to help with that.
You may observe a failure to format the source code of the form:
warning: rustfmt has failed to format.
thread 'main' panicked at .../wit-bindgen-rust-0.20.0/src/lib.rs:1107:13:
assertion failed: status.success()
To work around this issue, disable the source formatting of the generated bindings with:
[package.metadata.component.bindings]
format = false
Highlights
cargo-component
now componentizes based off the presence of bindings type information in the core module rather than expecting that[package.metadata.component]
section exists inCargo.toml
, an often confusing waycargo-component
worked previously.- The
run
,bench
, andtest
commands now print out what is being run like the corresponding commands incargo
. - Added
aarch64-unknown-linux-gnu
binary artifact, which should now work withcargo-binstall
(thanks to @nacardin).
Compatibility
- Wasmtime: 17.0.0+
- WASI: 0.2.0
- Warg (registry support): 0.3.0
What's Changed
- Update dependencies to latest. by @peterhuene in #237
- Various improvements to
cargo-component
. by @peterhuene in #240 - Support building aarch64-unknown-linux-gnu binary by @nacardin in #232
- Bump dependencies to latest. by @peterhuene in #243
- Remove status section from the README. by @peterhuene in #244
New Contributors
Full Changelog: v0.8.0...v0.9.0
v0.8.0
Compatibility
- Wasmtime: 17.0.0+
- WASI: 0.2.0
- Warg (registry support): 0.3.0
What's Changed
- Add support for
std_feature
by @sunfishcode in #231 - Implement unlocked-dep imports for component dependencies. by @peterhuene in #230
- Update to wit-component 0.21 and wit-parser 0.14. by @sunfishcode in #233
- Bump version to 0.8.0. by @peterhuene in #234
Full Changelog: v0.7.1...v0.8.0
v0.7.1
Compatibility
- Wasmtime: 17.0.0+
- WASI: 0.2.0 (stable preview 2! 🎉)
- Warg (registry support): 0.2.0
What's Changed
- Update the README. by @peterhuene in #218
- Update CI to setup wasmtime via release artifacts. by @peterhuene in #219
- Add a
package.metadata.component.proxy
setting. by @peterhuene in #221 - Add missing GH token for installing Wasmtime. by @peterhuene in #222
- Use
workspace_default_packages
now that it is implemented. by @peterhuene in #220 - tests fix by @macovedj in #223
- Bump for 0.7.1 release. by @peterhuene in #228
Full Changelog: v0.7.0...v0.7.1
v0.7.0
⚠️ Breaking changes ⚠️
There are two breaking changes in this release.
1. cargo-component-bindings
removed
This breaking change requires manual intervention for existing cargo-component
projects to get those projects to build with this release.
cargo-component-bindings
has been removed as a dependency; bindings are now directly generated into a src/bindings.rs
submodule by cargo-component
with no macro involved.
Existing cargo-component
projects can be fixed with the following steps:
-
Install the latest
cargo-component
.With the removal of the
upgrade
subcommand (see below), the latest version ofcargo-component
can be installed with eithercargo install cargo-component
orcargo binstall cargo-component
(requirescargo-binstall
). -
Edit
Cargo.toml
:Replace the existing
cargo-component-bindings
dependency with:wit-bindgen = { version = "0.16.0", default-features = false, features = ["realloc"] }
This makes the
wit-bindgen
runtime functions / types available to the generated code (but does not make thewit-bindgen::generate!
macro available). -
Edit
src/main.rs
orsrc/lib.rs
:Depending on the whether the project is a command (
src/main.rs
) or a library (src/lib.rs
), edit the file to replace thecargo_component_bindings::generate!
macro invocation with:mod bindings;
2. cargo component update
subcommand removed.
With the removal of the cargo-component-bindings
crate, the subcommand became a less-functional wrapper around cargo install
.
To update cargo-component
in the future, use cargo install cargo-component
or cargo binstall cargo-component
(requires cargo-binstall
).
Compatibility
- Wasmtime: 17.0.0
- WASI: 0.2.0 (stable preview 2! 🎉)
- Warg (registry support): 0.2.0
What's Changed
- Update crate dependencies. by @peterhuene in #208
- Check workspace with all targets in vscode, emacs configs by @tomasol in #205
- Use current package with
add
,publish
when in a workspace by @tomasol in #206 - Rename
--reactor
to--lib
fornew
subcommand. by @peterhuene in #211 - Remove
cargo_component_bindings
crate. by @peterhuene in #212 - Spawn
cargo add
in thenew
command by @tomasol in #209 - Update the adapter to Wasmtime 17.0 and WASI Preview 2. by @sunfishcode in #213
- Update dependencies to latest. by @peterhuene in #214
- Bump cargo-component to 0.7.0. by @peterhuene in #215
New Contributors
Full Changelog: v0.6.0...v0.7.0
v0.6.0
Compatibility
- Wasmtime: 16.0.0
- Warg (registry support): 0.2.0
Highlight
Thanks to @eduardomourar for contributing a run
, test
, and bench
subcommand to cargo-component
.
What's Changed
- Update README Rust-analyzer setting by @vwkd in #197
- feat: support run, test and bench cargo commands by @eduardomourar in #143
New Contributors
Full Changelog: v0.5.0...v0.6.0
v0.5.0
⚠️ Breaking changes ⚠️
- WIT files now require semicolons at the end of most lines.
Compatibility
- Wasmtime: 15.0.0
- Warg (registry support): 0.2.0
What's Changed
- Update README installation instructions. by @peterhuene in #169
- Update wasm-tools dependencies by @alexcrichton in #176
- Add
upgrade
subcommand by @jeffparsons in #175 - Better error message when deserializing
RegistryPackage
by @rylev in #180 - Suppress dead code warnings in bindings. by @peterhuene in #182
- Ensure CI runs on release branches. by @peterhuene in #184
- Add semicolons to WIT. by @peterhuene in #185
- Merge release-0.4.0 to main. by @peterhuene in #186
- Update crate dependencies. by @peterhuene in #190
- Fix bindings version warning and upgrade command. by @peterhuene in #187
- Update README instructions by @nated0g in #193
- Bump version to 0.5.0 by @peterhuene in #195
New Contributors
Full Changelog: v0.4.0...v0.5.0