-
-
Notifications
You must be signed in to change notification settings - Fork 364
Description
Problem
When browsing a package on npmx.dev, there's no way to see which other packages depend on it. This is critical information for:
- Package maintainers assessing impact of breaking changes
- Users evaluating how widely adopted a package is
- Contributors deciding whether to submit PRs to a package
npmjs.com shows this under "Dependents" (e.g., searching depends:react shows 50k+ packages). npmx.dev has no equivalent feature.
Why it matters
A package with 10k dependents is a critical ecosystem dependency; breaking changes need careful review. A package with 3 dependents is lower risk. This distinction affects decision-making but is invisible in npmx.dev today.
Current behavior
The package detail page (src/routes/package/+page.svelte) displays README, versions, dependencies, downloads, and vulnerabilities. There is no section showing reverse dependencies.
Proposed behavior
Add a "Dependents" section below the dependencies list:
- Show count of packages that depend on this package
- Display top 10-20 dependents by download volume as a scrollable list
- Link each dependent to its npmx.dev package page
- Include a "View all dependents" link to a filtered search results page
- Cache the count (updates weekly, similar to download stats) since computing this on-demand would be expensive
Example
When viewing lodash, show:
Dependents (156,234 packages)
1. react - 50.2M weekly downloads
2. @babel/core - 28.1M weekly downloads
3. webpack - 22.3M weekly downloads
...
[View all 156,234 dependents]
Implementation notes
- npm registry API provides a dependents endpoint (similar to how downloads are fetched)
- The UI should follow existing patterns in
src/components/PackageCard.sveltefor displaying package lists - Consider lazy-loading the dependents list to avoid slowing page load
- The count should appear prominently in the package header (next to "Downloads") for quick scanning
Related
Related to #1984 (which addresses vulnerability surfacing) — this feature helps contextualize the risk level of any vulnerabilities found.
Contributed by Klement Gunndu