diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-03 20:03:42 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-03 20:03:42 +0900 |
| commit | d3cdb9e3f73314e04061d4d18f654e7e80b0dc18 (patch) | |
| tree | 92dfda3903a7a7f1c631b18eaf544063e9b7f4f6 /crates/mozart-core/src | |
| parent | 756e0b9c18af8b2b5887ae1fb265a03187ca9c00 (diff) | |
| download | php-mozart-d3cdb9e3f73314e04061d4d18f654e7e80b0dc18.tar.gz php-mozart-d3cdb9e3f73314e04061d4d18f654e7e80b0dc18.tar.zst php-mozart-d3cdb9e3f73314e04061d4d18f654e7e80b0dc18.zip | |
feat(repository): support only/exclude/canonical repo filters
Composer's FilterRepository wraps a repository with three knobs:
`only` / `exclude` to drop packages by name, and `canonical: false` to
relax the repo's authoritative claim on its package names so
lower-priority repos can still answer. Mozart was ignoring all three,
so first-listed inline / composer-repo entries always shadowed later
repos and `only` / `exclude` lists were silently no-ops.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart-core/src')
| -rw-r--r-- | crates/mozart-core/src/package.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/crates/mozart-core/src/package.rs b/crates/mozart-core/src/package.rs index 8bda13d..0a5c0fb 100644 --- a/crates/mozart-core/src/package.rs +++ b/crates/mozart-core/src/package.rs @@ -549,6 +549,23 @@ pub struct RawRepository { /// `Composer\Repository\PackageRepository`'s schema. #[serde(default, skip_serializing_if = "Option::is_none")] pub package: Option<serde_json::Value>, + + /// `only: ["name", ...]` — restrict this repository to the listed package + /// names (glob `*` allowed). Mirrors `Composer\Repository\FilterRepository`. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub only: Option<Vec<String>>, + + /// `exclude: ["name", ...]` — drop the listed package names from this + /// repository. Mutually exclusive with `only` per `FilterRepository`. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub exclude: Option<Vec<String>>, + + /// `canonical: false` — packages from this repo enter the pool but do + /// not claim authoritative ownership of their names, so lower-priority + /// repositories can still answer for the same name. Mirrors + /// `FilterRepository::loadPackages`'s `namesFound = []` reset. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub canonical: Option<bool>, } /// Default root-package name when `composer.json` omits the `name` field. @@ -657,6 +674,9 @@ mod tests { repo_type: "vcs".to_string(), url: Some("https://github.com/acme/repo".to_string()), package: None, + only: None, + exclude: None, + canonical: None, }]; let mut psr4 = BTreeMap::new(); |
