feat: custom registries for targets in cargo-component new
This commit adds support for using custom registries with targets when performing cargo component new. Users can specify a registry URI like oci://ghcr.io along with a registry namespace prefix like bytecodealliance and get easy access to packages (e.g. docs:adder) that are provided therein.
NOTE This PR relies on a related one in wasm-pkg-tools Until that PR is merged, the Cargo.toml in use here can't be updated to remove the pointer to my fork.
An example invocation:
cargo component new \
--lib \
--target docs:adder \
--registry oci://ghcr.io \
--registry-ns-prefix bytecodealliance \
adder
While this invocation seems long, it is much shorter than configuring other tooling, and serves as a decent option for quickstarts IMO.
The one thing left to solve in this issue is how to enable cargo component to pull from namespace registry overrides from via it's own config (or alternatively, create a wkg.toml )
It looks like adding wkg.toml into the created repository (i.e. adding the file to the output of cargo component new) is the most reasonable way forward, and just works with the upstream projects involved with minimal strain on the user's side.
Given that currently wkg.toml only currently supports file path based overrides, I think the most reasonable path forward here is to add support there for namespace package overrides.
@macovedj @calvinrp not sure if we need an upstream release of wasm-pkg-tools here, but at the very least the new functionality is in upstream there!
[EDIT] this bit is still a bit thorny:
The one thing left to solve in this issue is how to enable cargo component to pull from namespace registry overrides from via it's own config (or alternatively, create a wkg.toml )
Going to put this back into draft for now... Adding namespace registry overrides to wkg.toml needs to land.