Skip to content

Support multiple cached versions of the same package#49

Open
voiys wants to merge 4 commits into
vercel-labs:mainfrom
voiys:feat/multi-version-package-index
Open

Support multiple cached versions of the same package#49
voiys wants to merge 4 commits into
vercel-labs:mainfrom
voiys:feat/multi-version-package-index

Conversation

@voiys

@voiys voiys commented Apr 13, 2026

Copy link
Copy Markdown

Summary

Fixes #48

  • Support multiple cached versions of the same package in sources.json instead of collapsing entries to name + registry
  • Make opensrc path use exact version-aware cache lookup while preserving current bare-spec resolution behavior
  • Make opensrc remove zod@x.y.z remove only that exact cached version
  • Keep opensrc remove zod behavior as “remove all cached versions of that package”
  • Sort opensrc list output by package name and version for easier multi-version inspection
  • Preserve shared versioned checkouts until the last package or repo reference is gone

Example

opensrc path zod@3.25.76
opensrc path zod@4.3.6
opensrc list
opensrc remove zod@3.25.76
opensrc list

With this change, both versions can coexist cleanly in the cache and index, and removing one version does not remove the other.

Notes

  • This does not add migration-specific semantics (from / to)
  • This does not change bare monorepo-root ambiguity for commands like opensrc path zod
  • It only makes multi-version caching/indexing/listing/removal behave correctly once exact versions are resolved

Testing

cargo test --manifest-path packages/opensrc/cli/Cargo.toml -- --test-threads=1
cargo fmt --manifest-path packages/opensrc/cli/Cargo.toml
cargo clippy --manifest-path packages/opensrc/cli/Cargo.toml -- -D warnings

Added coverage for:

  • preserving multiple versions in the index
  • replacing only the same exact version entry
  • exact-version lookup
  • exact-version removal
  • all-version removal
  • preserving shared monorepo version directories
  • preserving version directories still referenced by repo cache entries
  • deleting shared version directories only after the last reference is gone

@vercel

vercel Bot commented Apr 13, 2026

Copy link
Copy Markdown

@voiys is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

voiys added 3 commits April 30, 2026 13:27
…ckage-index

# Conflicts:
#	packages/opensrc/cli/src/commands/remove.rs
#	packages/opensrc/cli/src/core/cache.rs
#	packages/opensrc/cli/src/core/fetcher.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support listing/removing multiple cached versions of the same package

1 participant