Skip to content

Releases: bytecodealliance/cargo-component

v0.11.0

15 Apr 21:50
40320a9
Compare
Choose a tag to compare

Compatibility

  • Wasmtime: 17.0.0+
  • WASI: 0.2.0
  • Warg (registry support): 0.4.0

What's Changed

Full Changelog: v0.10.1...v0.11.0

v0.10.1

13 Mar 22:48
658dc2e
Compare
Choose a tag to compare

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 in Cargo.toml (the default for cargo 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

Full Changelog: v0.10.0...v0.10.1

v0.10.0

12 Mar 19:49
c606318
Compare
Choose a tag to compare

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

Full Changelog: v0.9.1...v0.10.0

v0.9.1

05 Mar 18:35
bad8c61
Compare
Choose a tag to compare

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

Full Changelog: v0.9.0...v0.9.1

v0.9.0

02 Mar 00:30
dc7cb41
Compare
Choose a tag to compare

⚠️ 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 in Cargo.toml, an often confusing way cargo-component worked previously.
  • The run, bench, and test commands now print out what is being run like the corresponding commands in cargo.
  • Added aarch64-unknown-linux-gnu binary artifact, which should now work with cargo-binstall (thanks to @nacardin).

Compatibility

  • Wasmtime: 17.0.0+
  • WASI: 0.2.0
  • Warg (registry support): 0.3.0

What's Changed

New Contributors

Full Changelog: v0.8.0...v0.9.0

v0.8.0

22 Feb 23:57
4d7c3ac
Compare
Choose a tag to compare

Compatibility

  • Wasmtime: 17.0.0+
  • WASI: 0.2.0
  • Warg (registry support): 0.3.0

What's Changed

Full Changelog: v0.7.1...v0.8.0

v0.7.1

06 Feb 00:10
8f5bae6
Compare
Choose a tag to compare

Compatibility

  • Wasmtime: 17.0.0+
  • WASI: 0.2.0 (stable preview 2! 🎉)
  • Warg (registry support): 0.2.0

What's Changed

Full Changelog: v0.7.0...v0.7.1

v0.7.0

26 Jan 01:06
1a07b61
Compare
Choose a tag to compare

⚠️ 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:

  1. Install the latest cargo-component.

    With the removal of the upgrade subcommand (see below), the latest version of cargo-component can be installed with either cargo install cargo-component or cargo binstall cargo-component (requires cargo-binstall).

  2. 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 the wit-bindgen::generate! macro available).

  3. Edit src/main.rs or src/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 the cargo_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

New Contributors

Full Changelog: v0.6.0...v0.7.0

v0.6.0

22 Dec 04:49
205c6ee
Compare
Choose a tag to compare

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

New Contributors

  • @vwkd made their first contribution in #197

Full Changelog: v0.5.0...v0.6.0

v0.5.0

21 Nov 19:24
3cc42eb
Compare
Choose a tag to compare

⚠️ 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

New Contributors

Full Changelog: v0.4.0...v0.5.0