aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/mozart-registry/src/resolver.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-22 18:34:48 +0900
committernsfisis <nsfisis@gmail.com>2026-02-22 18:34:48 +0900
commitff0d51089d8c5abc9ecbdeeaf3d6aa152f137e97 (patch)
treeea13f7d87945b7f0b2218a0d6ef6237ad76c9cd7 /crates/mozart-registry/src/resolver.rs
parent84d137a19feb1f79f5bd711faff63a6bbe651cbf (diff)
downloadphp-mozart-ff0d51089d8c5abc9ecbdeeaf3d6aa152f137e97.tar.gz
php-mozart-ff0d51089d8c5abc9ecbdeeaf3d6aa152f137e97.tar.zst
php-mozart-ff0d51089d8c5abc9ecbdeeaf3d6aa152f137e97.zip
fix(platform): inject composer pseudo packages into resolver
composer-runtime-api, composer-plugin-api, and composer are Composer pseudo packages that don't exist on Packagist. The resolver was trying to fetch them remotely (HTTP 404) because PackageName::is_platform() didn't recognize them and detect_platform() didn't inject them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-registry/src/resolver.rs')
-rw-r--r--crates/mozart-registry/src/resolver.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/mozart-registry/src/resolver.rs b/crates/mozart-registry/src/resolver.rs
index e3554be..66864f7 100644
--- a/crates/mozart-registry/src/resolver.rs
+++ b/crates/mozart-registry/src/resolver.rs
@@ -107,15 +107,9 @@ impl PackageName {
PackageName(Self::ROOT.to_string())
}
- /// Returns true if this is a platform package (php, ext-*, lib-*).
+ /// Returns true if this is a platform package (php, ext-*, lib-*, composer pseudo packages).
pub fn is_platform(&self) -> bool {
- self.0 == "php"
- || self.0.starts_with("ext-")
- || self.0.starts_with("lib-")
- || self.0 == "php-64bit"
- || self.0 == "php-ipv6"
- || self.0 == "php-zts"
- || self.0 == "php-debug"
+ mozart_core::platform::is_platform_package(&self.0)
}
/// Returns true if this is the virtual root package.
@@ -711,6 +705,9 @@ mod tests {
assert!(PackageName("php".to_string()).is_platform());
assert!(PackageName("ext-json".to_string()).is_platform());
assert!(PackageName("lib-curl".to_string()).is_platform());
+ assert!(PackageName("composer".to_string()).is_platform());
+ assert!(PackageName("composer-plugin-api".to_string()).is_platform());
+ assert!(PackageName("composer-runtime-api".to_string()).is_platform());
assert!(!PackageName("monolog/monolog".to_string()).is_platform());
assert!(!PackageName("vendor/package".to_string()).is_platform());
}