From 4df5f8491320e5795718cf0222e80fa27e57c8ad Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 11 May 2026 02:05:34 +0900 Subject: refactor(package): rename traits and switch dep maps to IndexMap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rename Package/CompletePackage to PackageInterface/CompletePackageInterface to mirror Composer's interface names, and split each into its own module under crates/mozart-core/src/package/. Switch dependency-link and metadata maps from BTreeMap to indexmap::IndexMap so serialized JSON preserves the original key ordering rather than sorting alphabetically — matching PHP associative-array semantics. The --sort-packages behaviour in `require` is preserved via sort_unstable_keys. --- crates/mozart-core/src/installer/installed_repo.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'crates/mozart-core/src/installer') diff --git a/crates/mozart-core/src/installer/installed_repo.rs b/crates/mozart-core/src/installer/installed_repo.rs index 8361158..d7e4f83 100644 --- a/crates/mozart-core/src/installer/installed_repo.rs +++ b/crates/mozart-core/src/installer/installed_repo.rs @@ -17,7 +17,6 @@ //! or through a `provide` / `replace` link. use indexmap::IndexSet; -use std::collections::BTreeMap; /// One installed package, in the shape `findPackagesWithReplacersAndProviders` /// needs. Mirrors the fields of `Composer\Package\PackageInterface` that the @@ -33,9 +32,9 @@ pub struct InstalledCandidate { /// Original-case version, used in user-facing output. pub pretty_version: String, /// `provide` map: target package name → constraint string. - pub provides: BTreeMap, + pub provides: indexmap::IndexMap, /// `replace` map: target package name → constraint string. - pub replaces: BTreeMap, + pub replaces: indexmap::IndexMap, } #[derive(Debug, Clone, Default)] @@ -106,8 +105,8 @@ mod tests { pretty_name: name.to_string(), version: version.to_string(), pretty_version: version.to_string(), - provides: BTreeMap::new(), - replaces: BTreeMap::new(), + provides: indexmap::IndexMap::new(), + replaces: indexmap::IndexMap::new(), } } -- cgit v1.3.1