You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Improve ergonomics of Rust examples, re-enable use of published packages #255
This issue arguably shouldn't go here, but currently UX issues in upstream tooling is making the Rust
The goal is to revert this reverted functionality -- we want to be able to use published WIT packages but there are a few issues stopping us:
cargo-component does not configure/patch where wkg looks for deps (the target kind) when configured in Cargo.toml (i.e. we should be able to specify that docs is a known package w/ a known registry)
cargo-component currently does not properly resolve targets w/ multiple worlds even ifwkg is configured (via it's global config file)
wkg should be able to use local fconfig
There are at least a few ways to solve this issue:
Update cargo-component to perform the patching of registries for namespaces before using wasm-pkg-tools functionality
Update wkg to prefer local config files and include one in the tutorial code
Update the guide to get users to configure wkg global config before attempting usage.
A somewhat hidden requirement/sidequest to this issue is that we need more cargo-component/wasm-pkg-tools maintainers. The current functionality is fantastic for these tools, but the UX needs to be polished just a bit.
There are other options here, but this is the most... tooling-aligned option (i.e. what currently works).
Some other options:
Fix/Improve cargo component so that it use the --registry option (unlike publish, cargo component new does not use the --registry option
The ideal solution is almost certainly updating cargo component to take a registry option (and use it) like ghcr.io/bytecodealliance (it should be able to expand this into a registry + namespacePrefix, worst case two separate flags)
Note that cargo component publish and cargo component add already take and use the --registry flag
Activity
vados-cosmonic commentedon May 12, 2025
So after discussing this with @macovedj , it looks like to make this work we'll need to:
$HOME/.config/.wasm-pkg/config.tomlto ensurecargo componentcan find thedocsnamespace via includedwkgcodecargo component newlike specified in his commentThere are other options here, but this is the most... tooling-aligned option (i.e. what currently works).
Some other options:
cargo componentso that it use the--registryoption (unlikepublish,cargo component newdoes not use the--registryoptionThe ideal solution is almost certainly updating
cargo componentto take a registry option (and use it) likeghcr.io/bytecodealliance(it should be able to expand this into a registry + namespacePrefix, worst case two separate flags)Note that
cargo component publishandcargo component addalready take and use the--registryflagvados-cosmonic commentedon May 12, 2025
hey @kate-goldenring any opinion on which direction to go in here
vados-cosmonic commentedon May 12, 2025
To add to this, after some discussion we're thinking this could probably go on the Language support page, and be linked to from every language.
Something like "To run cargo component new, you'll need to have your global wkg configuration in place. See xxxxx to set it up" (maybe in an alert?).
If we go with this approach we can skip fixing
cargo componentat present and re-add the WIT-only component driven workflow