Skip to content

Commit f0b0108

Browse files
fix(client): Fixes source resolution package overrides
If someone passes metadata for an override, we needed to use that instead Signed-off-by: Taylor Thomas <taylor@cosmonic.com>
1 parent 02f892c commit f0b0108

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resolver = "2"
44

55
[workspace.package]
66
edition = "2021"
7-
version = "0.7.2"
7+
version = "0.7.3"
88
authors = ["The Wasmtime Project Developers"]
99
license = "Apache-2.0 WITH LLVM-exception"
1010

@@ -36,9 +36,9 @@ tracing-subscriber = { version = "0.3.18", default-features = false, features =
3636
"fmt",
3737
"env-filter",
3838
] }
39-
wasm-pkg-common = { version = "0.7.2", path = "crates/wasm-pkg-common" }
40-
wasm-pkg-client = { version = "0.7.2", path = "crates/wasm-pkg-client" }
39+
wasm-pkg-common = { version = "0.7.3", path = "crates/wasm-pkg-common" }
40+
wasm-pkg-client = { version = "0.7.3", path = "crates/wasm-pkg-client" }
4141
wasm-metadata = "0.217"
4242
wit-component = "0.217"
4343
wit-parser = "0.217"
44-
wasm-pkg-core = { version = "0.7.2", path = "crates/wasm-pkg-core" }
44+
wasm-pkg-core = { version = "0.7.3", path = "crates/wasm-pkg-core" }

crates/wasm-pkg-client/src/lib.rs

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -215,18 +215,30 @@ impl Client {
215215
let should_fetch_meta = registry_config.default_backend() != Some("local");
216216
let maybe_metadata = self
217217
.config
218-
.namespace_registry(package.namespace())
219-
.and_then(|meta| {
220-
// If the overriden registry matches the registry we are trying to resolve, we
221-
// should use the metadata, otherwise we'll need to fetch the metadata from the
222-
// registry
223-
match (meta, is_override) {
224-
(RegistryMapping::Custom(custom), true) if custom.registry == registry => {
225-
Some(custom.metadata.clone())
226-
}
227-
(RegistryMapping::Custom(custom), false) => Some(custom.metadata.clone()),
228-
_ => None,
229-
}
218+
.package_registry_override(package)
219+
.and_then(|mapping| match mapping {
220+
RegistryMapping::Custom(custom) => Some(custom.metadata.clone()),
221+
_ => None,
222+
})
223+
.or_else(|| {
224+
self.config
225+
.namespace_registry(package.namespace())
226+
.and_then(|meta| {
227+
// If the overriden registry matches the registry we are trying to resolve, we
228+
// should use the metadata, otherwise we'll need to fetch the metadata from the
229+
// registry
230+
match (meta, is_override) {
231+
(RegistryMapping::Custom(custom), true)
232+
if custom.registry == registry =>
233+
{
234+
Some(custom.metadata.clone())
235+
}
236+
(RegistryMapping::Custom(custom), false) => {
237+
Some(custom.metadata.clone())
238+
}
239+
_ => None,
240+
}
241+
})
230242
});
231243

232244
let registry_meta = if let Some(meta) = maybe_metadata {

0 commit comments

Comments
 (0)