Skip to content

fix: dependencies complex version link#1524

Open
alex-key wants to merge 3 commits intonpmx-dev:mainfrom
alex-key:fix-deps-version-union-links
Open

fix: dependencies complex version link#1524
alex-key wants to merge 3 commits intonpmx-dev:mainfrom
alex-key:fix-deps-version-union-links

Conversation

@alex-key
Copy link

Resolves #1120

  • Added simple parsing logic to check any dependency version for being complex expression and provide a valid url.
  • By complex expression I mean: Range version, Union Version, Comparator Set version or combination of the above
  • Logic for extracting url is as follows:
    ^1.0.0 -> ^1.0.0 Simple
    1.0.0 || 2.0.0 -> 2.0.0 Union
    >1.0.0 <=2.0.0 -> <=2.0.0 Comparator Set
    1.0.0 - 2.0.0 -> 2.0.0 Range
    1.0.0 - 2.0.0 || 3.0.0 - 4.0.0 -> 4.0.0 Union of Ranges
  • dependencies, peerDependencies and optionalDependencies could have complex version (while 99% cases it's peer), so all of them are handled
  • at first I added multiple clickable links for Union separated by a delimiter "||" (1.0.0 || 2.0.0), but I think people rarely need to click on a specific version for union, also it would add some incosistency, so I keep it as a one link, which points to the latest version from Union

Examples for reference:
Comparator Set (dependencies): https://npmx.dev/package/sass
Comparator Set (peer): https://npmx.dev/package/styled-components/v/3.5.0-0
Union (dependencies): https://npmx.dev/package/normalize-package-data/v/2.5.0, https://npmx.dev/package/loose-envify/v/1.4.0
Union (peer): https://npmx.dev/package/eslint-plugin-react

@vercel
Copy link

vercel bot commented Feb 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Feb 16, 2026 1:01am
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Feb 16, 2026 1:01am
npmx-lunaria Ignored Ignored Feb 16, 2026 1:01am

Request Review

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 8 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/components/Package/Dependencies.vue 50.00% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

This pull request adds a VersionLink interface and a LAST_VERSION_IN_RANGE_REGEXP constant, and implements buildVersionLink in app/utils/versions.ts to convert complex semver strings (including unions and ranges) into objects with href and title. The Package/Dependencies.vue component was updated to call buildVersionLink for dependencies, peerDependencies and optionalDependencies, replacing raw version strings with { name, version } objects, using version.href for routes and version.title for display and tooltips, and adjusting sorts, mappings and template bindings accordingly.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description clearly explains the changes made to handle complex dependency versions, including specific examples of version patterns and extraction logic.
Linked Issues check ✅ Passed The pull request successfully addresses issue #1120 by implementing parsing logic to handle complex version expressions and extract valid URLs instead of using union strings that result in 404 errors.
Out of Scope Changes check ✅ Passed All changes are directly related to resolving issue #1120 by adding version link parsing logic and applying it to dependency components. No out-of-scope modifications were introduced.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

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.

Dependency links with version union ("1.0 || 2.0") resolves to 404 page

1 participant