diff --git a/Cargo.lock b/Cargo.lock index a2ab0da..002240b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4421,7 +4421,7 @@ dependencies = [ [[package]] name = "wasm-pkg-client" -version = "0.7.2" +version = "0.7.3" dependencies = [ "anyhow", "async-trait", @@ -4454,7 +4454,7 @@ dependencies = [ [[package]] name = "wasm-pkg-common" -version = "0.7.2" +version = "0.7.3" dependencies = [ "anyhow", "bytes 1.7.2", @@ -4474,7 +4474,7 @@ dependencies = [ [[package]] name = "wasm-pkg-core" -version = "0.7.2" +version = "0.7.3" dependencies = [ "anyhow", "futures-util", @@ -4922,7 +4922,7 @@ dependencies = [ [[package]] name = "wkg" -version = "0.7.2" +version = "0.7.3" dependencies = [ "anyhow", "base64 0.22.1", diff --git a/Cargo.toml b/Cargo.toml index 1724261..384f52c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ resolver = "2" [workspace.package] edition = "2021" -version = "0.7.2" +version = "0.7.3" authors = ["The Wasmtime Project Developers"] license = "Apache-2.0 WITH LLVM-exception" @@ -36,9 +36,9 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features = "fmt", "env-filter", ] } -wasm-pkg-common = { version = "0.7.2", path = "crates/wasm-pkg-common" } -wasm-pkg-client = { version = "0.7.2", path = "crates/wasm-pkg-client" } +wasm-pkg-common = { version = "0.7.3", path = "crates/wasm-pkg-common" } +wasm-pkg-client = { version = "0.7.3", path = "crates/wasm-pkg-client" } wasm-metadata = "0.217" wit-component = "0.217" wit-parser = "0.217" -wasm-pkg-core = { version = "0.7.2", path = "crates/wasm-pkg-core" } +wasm-pkg-core = { version = "0.7.3", path = "crates/wasm-pkg-core" } diff --git a/crates/wasm-pkg-client/src/lib.rs b/crates/wasm-pkg-client/src/lib.rs index efd7cff..90df6ef 100644 --- a/crates/wasm-pkg-client/src/lib.rs +++ b/crates/wasm-pkg-client/src/lib.rs @@ -215,18 +215,30 @@ impl Client { let should_fetch_meta = registry_config.default_backend() != Some("local"); let maybe_metadata = self .config - .namespace_registry(package.namespace()) - .and_then(|meta| { - // If the overriden registry matches the registry we are trying to resolve, we - // should use the metadata, otherwise we'll need to fetch the metadata from the - // registry - match (meta, is_override) { - (RegistryMapping::Custom(custom), true) if custom.registry == registry => { - Some(custom.metadata.clone()) - } - (RegistryMapping::Custom(custom), false) => Some(custom.metadata.clone()), - _ => None, - } + .package_registry_override(package) + .and_then(|mapping| match mapping { + RegistryMapping::Custom(custom) => Some(custom.metadata.clone()), + _ => None, + }) + .or_else(|| { + self.config + .namespace_registry(package.namespace()) + .and_then(|meta| { + // If the overriden registry matches the registry we are trying to resolve, we + // should use the metadata, otherwise we'll need to fetch the metadata from the + // registry + match (meta, is_override) { + (RegistryMapping::Custom(custom), true) + if custom.registry == registry => + { + Some(custom.metadata.clone()) + } + (RegistryMapping::Custom(custom), false) => { + Some(custom.metadata.clone()) + } + _ => None, + } + }) }); let registry_meta = if let Some(meta) = maybe_metadata {