From f5126b1c3c482feea416e57ed6ce4dc29c019870 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Mon, 15 Dec 2025 15:29:23 -0600 Subject: [PATCH 01/11] package display impl clippy cleand up logging typos ./crates --write-changes --- crates/wasm-pkg-client/src/caching/file.rs | 2 +- crates/wasm-pkg-client/src/lib.rs | 5 ++- crates/wasm-pkg-client/src/release.rs | 2 +- crates/wasm-pkg-common/src/metadata.rs | 2 +- crates/wasm-pkg-core/src/lock.rs | 2 +- crates/wasm-pkg-core/src/resolver.rs | 32 ++++++++++++++++--- crates/wasm-pkg-core/src/wit.rs | 20 ++++++------ crates/wkg/src/oci.rs | 2 +- .../tests/fixtures/wasi-http/wit/types.wit | 24 +++++++------- 9 files changed, 57 insertions(+), 34 deletions(-) diff --git a/crates/wasm-pkg-client/src/caching/file.rs b/crates/wasm-pkg-client/src/caching/file.rs index 2a8d242..5fd2ac6 100644 --- a/crates/wasm-pkg-client/src/caching/file.rs +++ b/crates/wasm-pkg-client/src/caching/file.rs @@ -82,7 +82,7 @@ impl Cache for FileCache { Error::CacheError(anyhow::anyhow!("Unable to create file for cache {e}")) })?; let mut buf = - StreamReader::new(data.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))); + StreamReader::new(data.map_err(std::io::Error::other)); tokio::io::copy(&mut buf, &mut file) .await .map_err(|e| Error::CacheError(e.into())) diff --git a/crates/wasm-pkg-client/src/lib.rs b/crates/wasm-pkg-client/src/lib.rs index 90df6ef..35b88f0 100644 --- a/crates/wasm-pkg-client/src/lib.rs +++ b/crates/wasm-pkg-client/src/lib.rs @@ -168,8 +168,7 @@ impl Client { let (mut data, p, v) = tokio::task::spawn_blocking(|| resolve_package(data)) .await .map_err(|e| { - crate::Error::IoError(std::io::Error::new( - std::io::ErrorKind::Other, + crate::Error::IoError(std::io::Error::other( format!("Error when performing blocking IO: {e:?}"), )) })??; @@ -224,7 +223,7 @@ impl Client { self.config .namespace_registry(package.namespace()) .and_then(|meta| { - // If the overriden registry matches the registry we are trying to resolve, we + // If the overridden 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) { diff --git a/crates/wasm-pkg-client/src/release.rs b/crates/wasm-pkg-client/src/release.rs index 8e02537..239b974 100644 --- a/crates/wasm-pkg-client/src/release.rs +++ b/crates/wasm-pkg-client/src/release.rs @@ -26,7 +26,7 @@ impl Ord for VersionInfo { impl PartialOrd for VersionInfo { fn partial_cmp(&self, other: &Self) -> Option { - Some(self.version.cmp(&other.version)) + Some(self.cmp(other)) } } diff --git a/crates/wasm-pkg-common/src/metadata.rs b/crates/wasm-pkg-common/src/metadata.rs index 41fb8bf..ac5b9f5 100644 --- a/crates/wasm-pkg-common/src/metadata.rs +++ b/crates/wasm-pkg-common/src/metadata.rs @@ -63,7 +63,7 @@ impl RegistryMetadata { } /// Returns an iterator of protocols configured by the registry. - pub fn configured_protocols(&self) -> impl Iterator> { + pub fn configured_protocols(&self) -> impl Iterator> { let mut protos: BTreeSet = self.protocol_configs.keys().cloned().collect(); // Backward-compatibility aliases if self.oci_registry.is_some() || self.oci_namespace_prefix.is_some() { diff --git a/crates/wasm-pkg-core/src/lock.rs b/crates/wasm-pkg-core/src/lock.rs index 93a41b8..bd7efb9 100644 --- a/crates/wasm-pkg-core/src/lock.rs +++ b/crates/wasm-pkg-core/src/lock.rs @@ -364,7 +364,7 @@ impl AsRef for Locker { } } -// NOTE(thomastaylor312): These lock file primitives from here on down are mostly copyed wholesale +// NOTE(thomastaylor312): These lock file primitives from here on down are mostly copied wholesale // from the lock file implementation of cargo-component with some minor modifications to make them // work with tokio diff --git a/crates/wasm-pkg-core/src/resolver.rs b/crates/wasm-pkg-core/src/resolver.rs index 14facc5..1ab0db6 100644 --- a/crates/wasm-pkg-core/src/resolver.rs +++ b/crates/wasm-pkg-core/src/resolver.rs @@ -38,6 +38,28 @@ pub enum Dependency { Local(PathBuf), } +impl std::fmt::Display for Dependency { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Dependency::Package(RegistryPackage { + name, + version, + registry, + }) => { + let registry = registry.as_deref().unwrap_or("_"); + let name = name.as_ref().map(|n| n.to_string()); + + write!( + f, + "{{ registry = {registry} package = {}@{version} }}", + name.as_deref().unwrap_or("_:_"), + ) + } + Dependency::Local(path_buf) => write!(f, "{}", path_buf.display()), + } + } +} + impl FromStr for Dependency { type Err = anyhow::Error; @@ -126,9 +148,9 @@ impl RegistryResolution { ) .await?; - Ok(tokio_util::io::StreamReader::new(stream.map_err(|e| { - std::io::Error::new(std::io::ErrorKind::Other, e) - }))) + Ok(tokio_util::io::StreamReader::new( + stream.map_err(|e| std::io::Error::other(e)), + )) } } @@ -181,7 +203,7 @@ impl DependencyResolution { } /// Decodes the resolved dependency. - pub async fn decode(&self) -> Result { + pub async fn decode(&self) -> Result> { // If the dependency path is a directory, assume it contains wit to parse as a package. let bytes = match self { DependencyResolution::Local(LocalResolution { path, .. }) @@ -432,7 +454,7 @@ impl<'a> DependencyResolver<'a> { }); // This is a bit of a hack, but if there are multiple local dependencies that are - // nested and overriden, getting the packages from the local package treats _all_ + // nested and overridden, getting the packages from the local package treats _all_ // deps as registry deps. So if we're handling a local path and the dependencies // have a registry package already, override it. Otherwise follow normal overrides. // We should definitely fix this and change where we resolve these things diff --git a/crates/wasm-pkg-core/src/wit.rs b/crates/wasm-pkg-core/src/wit.rs index 3de4fd5..62871c2 100644 --- a/crates/wasm-pkg-core/src/wit.rs +++ b/crates/wasm-pkg-core/src/wit.rs @@ -174,16 +174,16 @@ pub async fn resolve_dependencies( let mut resolver = DependencyResolver::new_with_client(client, lock_file)?; // add deps from config first in case they're local deps and then add deps from the directory if let Some(overrides) = config.overrides.as_ref() { - for (pkg, ovride) in overrides.iter() { + for (pkg, ovr) in overrides.iter() { let pkg: PackageRef = pkg.parse().context("Unable to parse as a package ref")?; - let dep = match (ovride.path.as_ref(), ovride.version.as_ref()) { - (Some(path), None) => { - let path = tokio::fs::canonicalize(path).await?; - Dependency::Local(path) - } - (Some(path), Some(_)) => { - tracing::warn!("Ignoring version override for local package"); - let path = tokio::fs::canonicalize(path).await?; + let dep = match (ovr.path.as_ref(), ovr.version.as_ref()) { + (Some(path), v @ None | v @ Some(_)) => { + if v.is_some() { + tracing::warn!("Ignoring version override for local package"); + } + let path = tokio::fs::canonicalize(path) + .await + .with_context(|| format!("{}", path.display()))?; Dependency::Local(path) } (None, Some(version)) => Dependency::Package(RegistryPackage { @@ -196,9 +196,11 @@ pub async fn resolve_dependencies( continue; } }; + tracing::debug!(dependency = ?dep); resolver .add_dependency(&pkg, &dep) .await + .with_context(|| dep.clone()) .context("Unable to add dependency")?; } } diff --git a/crates/wkg/src/oci.rs b/crates/wkg/src/oci.rs index a851339..a40eeae 100644 --- a/crates/wkg/src/oci.rs +++ b/crates/wkg/src/oci.rs @@ -171,7 +171,7 @@ impl PushArgs { fn digest_from_manifest_url(url: &str) -> &str { url.split('/') - .last() + .next_back() .expect("url did not contain manifest sha256") } diff --git a/crates/wkg/tests/fixtures/wasi-http/wit/types.wit b/crates/wkg/tests/fixtures/wasi-http/wit/types.wit index 755ac6a..5a45ff1 100644 --- a/crates/wkg/tests/fixtures/wasi-http/wit/types.wit +++ b/crates/wkg/tests/fixtures/wasi-http/wit/types.wit @@ -205,7 +205,7 @@ interface types { /// list with the same key. entries: func() -> list>; - /// Make a deep copy of the Fields. Equivelant in behavior to calling the + /// Make a deep copy of the Fields. Equivalent in behavior to calling the /// `fields` constructor on the return value of `entries`. The resulting /// `fields` is mutable. clone: func() -> fields; @@ -310,7 +310,7 @@ interface types { /// `delete` operations will fail with `header-error.immutable`. /// /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to + /// `outgoing-request` is dropped, or its ownership is transferred to /// another component by e.g. `outgoing-handler.handle`. headers: func() -> headers; } @@ -426,7 +426,7 @@ interface types { finish: static func(this: incoming-body) -> future-trailers; } - /// Represents a future which may eventaully return trailers, or an error. + /// Represents a future which may eventually return trailers, or an error. /// /// In the case that the incoming HTTP Request or Response did not have any /// trailers, this future will resolve to the empty set of trailers once the @@ -434,11 +434,11 @@ interface types { resource future-trailers { /// Returns a pollable which becomes ready when either the trailers have - /// been received, or an error has occured. When this pollable is ready, + /// been received, or an error has occurred. When this pollable is ready, /// the `get` method will return `some`. subscribe: func() -> pollable; - /// Returns the contents of the trailers, or an error which occured, + /// Returns the contents of the trailers, or an error which occurred, /// once the future is ready. /// /// The outer `option` represents future readiness. Users can wait on this @@ -450,7 +450,7 @@ interface types { /// /// The inner `result` represents that either the HTTP Request or Response /// body, as well as any trailers, were received successfully, or that an - /// error occured receiving them. The optional `trailers` indicates whether + /// error occurred receiving them. The optional `trailers` indicates whether /// or not trailers were present in the body. /// /// When some `trailers` are returned by this method, the `trailers` @@ -483,7 +483,7 @@ interface types { /// `delete` operations will fail with `header-error.immutable`. /// /// This headers resource is a child: it must be dropped before the parent - /// `outgoing-request` is dropped, or its ownership is transfered to + /// `outgoing-request` is dropped, or its ownership is transferred to /// another component by e.g. `outgoing-handler.handle`. headers: func() -> headers; @@ -507,7 +507,7 @@ interface types { /// /// If the user code drops this resource, as opposed to calling the static /// method `finish`, the implementation should treat the body as incomplete, - /// and that an error has occured. The implementation should propogate this + /// and that an error has occurred. The implementation should propagate this /// error to the HTTP protocol by whatever means it has available, /// including: corrupting the body on the wire, aborting the associated /// Request, or sending a late status code for the Response. @@ -539,14 +539,14 @@ interface types { ) -> result<_, error-code>; } - /// Represents a future which may eventaully return an incoming HTTP + /// Represents a future which may eventually return an incoming HTTP /// Response, or an error. /// /// This resource is returned by the `wasi:http/outgoing-handler` interface to /// provide the HTTP Response corresponding to the sent Request. resource future-incoming-response { /// Returns a pollable which becomes ready when either the Response has - /// been received, or an error has occured. When this pollable is ready, + /// been received, or an error has occurred. When this pollable is ready, /// the `get` method will return `some`. subscribe: func() -> pollable; @@ -560,8 +560,8 @@ interface types { /// is `some`, and error on subsequent calls. /// /// The inner `result` represents that either the incoming HTTP Response - /// status and headers have recieved successfully, or that an error - /// occured. Errors may also occur while consuming the response body, + /// status and headers have received successfully, or that an error + /// occurred. Errors may also occur while consuming the response body, /// but those will be reported by the `incoming-body` and its /// `output-stream` child. get: func() -> option>>; From 3da07d8658abaefbc561a5662b4e01fd8442d85d Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Mon, 15 Dec 2025 18:18:07 -0600 Subject: [PATCH 02/11] added dependency log to resolver --- crates/wasm-pkg-common/src/config.rs | 42 ++++++++++++++++------------ crates/wasm-pkg-core/src/resolver.rs | 4 +-- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/crates/wasm-pkg-common/src/config.rs b/crates/wasm-pkg-common/src/config.rs index 96e83c6..16f33ec 100644 --- a/crates/wasm-pkg-common/src/config.rs +++ b/crates/wasm-pkg-common/src/config.rs @@ -181,27 +181,33 @@ impl Config { /// - The default registry /// - Hard-coded fallbacks for certain well-known namespaces pub fn resolve_registry(&self, package: &PackageRef) -> Option<&Registry> { - if let Some(RegistryMapping::Registry(reg)) = self.package_registry_overrides.get(package) { - Some(reg) - } else if let Some(RegistryMapping::Custom(custom)) = - self.package_registry_overrides.get(package) + if let Some(reg) = self + .package_registry_overrides + .get(package) + .map(|m| match m { + RegistryMapping::Registry(reg) => reg, + RegistryMapping::Custom(custom) => &custom.registry, + }) { - Some(&custom.registry) - } else if let Some(RegistryMapping::Registry(reg)) = - self.namespace_registries.get(package.namespace()) - { - Some(reg) - } else if let Some(RegistryMapping::Custom(custom)) = - self.namespace_registries.get(package.namespace()) + return Some(reg); + } + + if let Some(reg) = self + .namespace_registries + .get(package.namespace()) + .map(|m| match m { + RegistryMapping::Registry(reg) => reg, + RegistryMapping::Custom(custom) => &custom.registry, + }) { - Some(&custom.registry) - } else if let Some(reg) = self.default_registry.as_ref() { - Some(reg) - } else if let Some(reg) = self.fallback_namespace_registries.get(package.namespace()) { - Some(reg) - } else { - None + return Some(reg); } + + if let Some(reg) = self.default_registry.as_ref() { + return Some(reg); + } + + self.fallback_namespace_registries.get(package.namespace()) } /// Returns the default registry. diff --git a/crates/wasm-pkg-core/src/resolver.rs b/crates/wasm-pkg-core/src/resolver.rs index 5b70341..c8cfbca 100644 --- a/crates/wasm-pkg-core/src/resolver.rs +++ b/crates/wasm-pkg-core/src/resolver.rs @@ -51,7 +51,7 @@ impl std::fmt::Display for Dependency { write!( f, - "{{ registry = {registry} package = {}@{version} }}", + "{{registry=\"{registry}\" package=\"{}@{version}\"}}", name.as_deref().unwrap_or("_:_"), ) } @@ -435,7 +435,7 @@ impl<'a> DependencyResolver<'a> { if !force_override && (self.resolutions.contains_key(name) || self.dependencies.contains_key(name)) { - tracing::debug!(%name, "dependency already exists and override is not set, ignoring"); + tracing::debug!(%name, %dependency, "dependency already exists and override is not set, ignoring"); return Ok(()); } self.dependencies.insert( From a297f81da523d4431cc76742f4e48b2d902bed16 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Mon, 15 Dec 2025 18:18:50 -0600 Subject: [PATCH 03/11] use display formatting in dependency log --- crates/wasm-pkg-core/src/wit.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/wasm-pkg-core/src/wit.rs b/crates/wasm-pkg-core/src/wit.rs index be5e9ff..5bc106f 100644 --- a/crates/wasm-pkg-core/src/wit.rs +++ b/crates/wasm-pkg-core/src/wit.rs @@ -201,7 +201,8 @@ pub async fn resolve_dependencies( continue; } }; - tracing::debug!(dependency = ?dep); + + tracing::debug!(dependency = %dep); resolver .add_dependency(&pkg, &dep) .await From d7db348831bcf867eb1ec468bb1000277b029e1e Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Mon, 15 Dec 2025 18:23:28 -0600 Subject: [PATCH 04/11] added filecache logging --- crates/wasm-pkg-client/src/caching/file.rs | 6 ++++++ crates/wasm-pkg-common/src/config.rs | 20 ++++++++++++-------- crates/wkg/src/main.rs | 3 +++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/crates/wasm-pkg-client/src/caching/file.rs b/crates/wasm-pkg-client/src/caching/file.rs index 3b39105..7c65332 100644 --- a/crates/wasm-pkg-client/src/caching/file.rs +++ b/crates/wasm-pkg-client/src/caching/file.rs @@ -20,6 +20,12 @@ pub struct FileCache { root: PathBuf, } +impl std::fmt::Display for FileCache { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.root.display()) + } +} + impl FileCache { /// Creates a new file cache that stores data in the given directory. pub async fn new(root: impl AsRef) -> anyhow::Result { diff --git a/crates/wasm-pkg-common/src/config.rs b/crates/wasm-pkg-common/src/config.rs index 16f33ec..6be259e 100644 --- a/crates/wasm-pkg-common/src/config.rs +++ b/crates/wasm-pkg-common/src/config.rs @@ -42,6 +42,16 @@ pub enum RegistryMapping { Custom(CustomConfig), } +impl RegistryMapping { + /// returns the inner [`Registry`] object for both mapping variants + fn get_registry(&self) -> &Registry { + match self { + RegistryMapping::Registry(reg) => reg, + RegistryMapping::Custom(custom) => &(custom.registry), + } + } +} + /// Custom registry configuration #[derive(Debug, Clone, Serialize, Deserialize)] pub struct CustomConfig { @@ -184,10 +194,7 @@ impl Config { if let Some(reg) = self .package_registry_overrides .get(package) - .map(|m| match m { - RegistryMapping::Registry(reg) => reg, - RegistryMapping::Custom(custom) => &custom.registry, - }) + .map(RegistryMapping::get_registry) { return Some(reg); } @@ -195,10 +202,7 @@ impl Config { if let Some(reg) = self .namespace_registries .get(package.namespace()) - .map(|m| match m { - RegistryMapping::Registry(reg) => reg, - RegistryMapping::Custom(custom) => &custom.registry, - }) + .map(RegistryMapping::get_registry) { return Some(reg); } diff --git a/crates/wkg/src/main.rs b/crates/wkg/src/main.rs index b98fccc..b468782 100644 --- a/crates/wkg/src/main.rs +++ b/crates/wkg/src/main.rs @@ -66,6 +66,7 @@ impl Common { } else { FileCache::global_cache_path().context("unable to find cache directory")? }; + FileCache::new(dir).await } @@ -76,6 +77,8 @@ impl Common { let config = self.load_config().await?; let cache = self.load_cache().await?; let client = Client::new(config); + + tracing::debug!(filecache_dir = %cache); Ok(CachingClient::new(Some(client), cache)) } } From dc1fb19e4ed46ff656e79a1e8defbea02bece287 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Tue, 6 Jan 2026 16:43:46 -0600 Subject: [PATCH 05/11] Update crates/wasm-pkg-common/src/config.rs Co-authored-by: Lann --- crates/wasm-pkg-common/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasm-pkg-common/src/config.rs b/crates/wasm-pkg-common/src/config.rs index 6be259e..f9624a9 100644 --- a/crates/wasm-pkg-common/src/config.rs +++ b/crates/wasm-pkg-common/src/config.rs @@ -47,7 +47,7 @@ impl RegistryMapping { fn get_registry(&self) -> &Registry { match self { RegistryMapping::Registry(reg) => reg, - RegistryMapping::Custom(custom) => &(custom.registry), + RegistryMapping::Custom(custom) => &custom.registry, } } } From aab6136175cb283b0a7bc6d5e8e988ff635f0024 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Tue, 6 Jan 2026 16:43:51 -0600 Subject: [PATCH 06/11] Update crates/wasm-pkg-common/src/config.rs Co-authored-by: Lann --- crates/wasm-pkg-common/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasm-pkg-common/src/config.rs b/crates/wasm-pkg-common/src/config.rs index f9624a9..03adcd7 100644 --- a/crates/wasm-pkg-common/src/config.rs +++ b/crates/wasm-pkg-common/src/config.rs @@ -44,7 +44,7 @@ pub enum RegistryMapping { impl RegistryMapping { /// returns the inner [`Registry`] object for both mapping variants - fn get_registry(&self) -> &Registry { + fn registry(&self) -> &Registry { match self { RegistryMapping::Registry(reg) => reg, RegistryMapping::Custom(custom) => &custom.registry, From eab58957ad78b7d31ee79cec0d522ab6b47f7363 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Tue, 6 Jan 2026 16:44:18 -0600 Subject: [PATCH 07/11] Update crates/wasm-pkg-core/src/wit.rs Co-authored-by: Lann --- crates/wasm-pkg-core/src/wit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasm-pkg-core/src/wit.rs b/crates/wasm-pkg-core/src/wit.rs index 5bc106f..6190c45 100644 --- a/crates/wasm-pkg-core/src/wit.rs +++ b/crates/wasm-pkg-core/src/wit.rs @@ -182,7 +182,7 @@ pub async fn resolve_dependencies( for (pkg, ovr) in overrides.iter() { let pkg: PackageRef = pkg.parse().context("Unable to parse as a package ref")?; let dep = match (ovr.path.as_ref(), ovr.version.as_ref()) { - (Some(path), v @ None | v @ Some(_)) => { + (Some(path), v) => { if v.is_some() { tracing::warn!("Ignoring version override for local package"); } From ac1030f37e19452649193e05b52359012ea80595 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Tue, 6 Jan 2026 16:44:29 -0600 Subject: [PATCH 08/11] Update crates/wasm-pkg-core/src/wit.rs Co-authored-by: Lann --- crates/wasm-pkg-core/src/wit.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/wasm-pkg-core/src/wit.rs b/crates/wasm-pkg-core/src/wit.rs index 6190c45..600495a 100644 --- a/crates/wasm-pkg-core/src/wit.rs +++ b/crates/wasm-pkg-core/src/wit.rs @@ -206,8 +206,7 @@ pub async fn resolve_dependencies( resolver .add_dependency(&pkg, &dep) .await - .with_context(|| dep.clone()) - .context("Unable to add dependency")?; + .with_context(|| format!("unable to add dependency {dep}"))?; } } let (_name, packages) = get_packages(path)?; From 2010544a8b344079201e8d7e05828e419d4a9e30 Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Tue, 6 Jan 2026 16:44:38 -0600 Subject: [PATCH 09/11] Update crates/wasm-pkg-core/src/wit.rs Co-authored-by: Lann --- crates/wasm-pkg-core/src/wit.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasm-pkg-core/src/wit.rs b/crates/wasm-pkg-core/src/wit.rs index 600495a..4ca9903 100644 --- a/crates/wasm-pkg-core/src/wit.rs +++ b/crates/wasm-pkg-core/src/wit.rs @@ -188,7 +188,7 @@ pub async fn resolve_dependencies( } let path = tokio::fs::canonicalize(path) .await - .with_context(|| format!("{}", path.display()))?; + .with_context(|| format!("resolving local dependency {}", path.display()))?; Dependency::Local(path) } (None, Some(version)) => Dependency::Package(RegistryPackage { From a5110df955952ad79ac090c18a70154b38a0692e Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Tue, 6 Jan 2026 16:51:29 -0600 Subject: [PATCH 10/11] Update crates/wasm-pkg-common/src/config.rs --- crates/wasm-pkg-common/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasm-pkg-common/src/config.rs b/crates/wasm-pkg-common/src/config.rs index 03adcd7..7d1e65a 100644 --- a/crates/wasm-pkg-common/src/config.rs +++ b/crates/wasm-pkg-common/src/config.rs @@ -194,7 +194,7 @@ impl Config { if let Some(reg) = self .package_registry_overrides .get(package) - .map(RegistryMapping::get_registry) + .map(|pkg| pkg.registry()) { return Some(reg); } From c968e013bb02a4528789b4de0441d792b528fe0f Mon Sep 17 00:00:00 2001 From: Mikhail Katychev Date: Tue, 6 Jan 2026 17:58:14 -0600 Subject: [PATCH 11/11] updated to use if-let-else --- crates/wasm-pkg-common/src/config.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/crates/wasm-pkg-common/src/config.rs b/crates/wasm-pkg-common/src/config.rs index 7d1e65a..d38ad1a 100644 --- a/crates/wasm-pkg-common/src/config.rs +++ b/crates/wasm-pkg-common/src/config.rs @@ -191,27 +191,21 @@ impl Config { /// - The default registry /// - Hard-coded fallbacks for certain well-known namespaces pub fn resolve_registry(&self, package: &PackageRef) -> Option<&Registry> { + let namespace = package.namespace(); + // look in `self.package_registry_overrides ` + // then in `self.namespace_registries` if let Some(reg) = self .package_registry_overrides .get(package) + .or_else(|| self.namespace_registries.get(namespace)) .map(|pkg| pkg.registry()) { return Some(reg); - } - - if let Some(reg) = self - .namespace_registries - .get(package.namespace()) - .map(RegistryMapping::get_registry) - { - return Some(reg); - } - - if let Some(reg) = self.default_registry.as_ref() { + } else if let Some(reg) = self.default_registry.as_ref() { return Some(reg); } - self.fallback_namespace_registries.get(package.namespace()) + self.fallback_namespace_registries.get(namespace) } /// Returns the default registry.