Skip to content

feat: add dependents page for package reverse-dep lookup#2306

Open
thealxlabs wants to merge 2 commits intonpmx-dev:mainfrom
thealxlabs:feat/package-dependents-page
Open

feat: add dependents page for package reverse-dep lookup#2306
thealxlabs wants to merge 2 commits intonpmx-dev:mainfrom
thealxlabs:feat/package-dependents-page

Conversation

@thealxlabs
Copy link
Copy Markdown

Adds /package/<name>/dependents — a tab showing which packages list a given package as a dependency.

What changed

  • Server APIGET /api/registry/dependents/[...pkg] queries the npm search API using the dependencies: text filter and returns paginated results (cached 5 min)
  • Pageapp/pages/package/[[org]]/[name]/dependents.vue with loading, empty, error, and paginated result states
  • Header tab — "dependents" tab added to the package navigation bar
  • i18n — new keys for the tab label and page strings
  • README — dependents marked as implemented, removed from "Not yet supported" URL list

Test

Visit /package/nuxt/dependents or /package/vue/dependents — should show packages that depend on it with pagination.

Adds /package/<name>/dependents showing which packages list this one
as a dependency, using the npm search API's dependencies: text filter.

- New server API at /api/registry/dependents/[...pkg] (paginated, cached)
- New page at /package/[[org]]/[name]/dependents.vue
- Dependents tab added to the package navigation header
- i18n keys for the new page and nav label
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

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

Project Deployment Actions Updated (UTC)
npmx.dev Ready Ready Preview, Comment Mar 28, 2026 1:47pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs.npmx.dev Ignored Ignored Preview Mar 28, 2026 1:47pm
npmx-lunaria Ignored Ignored Mar 28, 2026 1:47pm

Request Review

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 28, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
npmx-lunaria Ignored Ignored Mar 28, 2026 1:44pm

Request Review

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 28, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
i18n/locales/en.json Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

📝 Walkthrough

Walkthrough

This pull request introduces a new "Dependents" feature that allows users to browse packages that depend on a given package. The implementation includes a new page component for viewing dependent packages with pagination support, an API route that queries npm registry for packages matching a dependency filter, navigation updates to the package header, and corresponding internationalisation translations. The feature is documented in the README as now supported.

Suggested reviewers

  • danielroe
🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Description check ✅ Passed The pull request description accurately describes the changeset, detailing the server API endpoint, new page component, header navigation tab, i18n additions, and README updates.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
app/components/Package/Header.vue 87.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
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: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 63a5831b-bd7b-47d6-96ae-3fa11e42147d

📥 Commits

Reviewing files that changed from the base of the PR and between e62baf4 and 0103b77.

📒 Files selected for processing (6)
  • README.md
  • app/components/Package/Header.vue
  • app/pages/package/[[org]]/[name]/dependents.vue
  • i18n/locales/en.json
  • i18n/schema.json
  • server/api/registry/dependents/[...pkg].get.ts

Comment on lines +172 to +176
{{ $t('common.previous') }}
</ButtonBase>
<span class="text-sm text-fg-muted font-mono"> {{ page + 1 }} / {{ totalPages }} </span>
<ButtonBase variant="secondary" :disabled="page >= totalPages - 1" @click="nextPage">
{{ $t('common.next') }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Pagination labels use non-existent i18n keys.

common.previous and common.next are not defined; this will render raw keys instead of labels.

🧩 Suggested key fix
-            {{ $t('common.previous') }}
+            {{ $t('filters.pagination.previous') }}
@@
-            {{ $t('common.next') }}
+            {{ $t('filters.pagination.next') }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{ $t('common.previous') }}
</ButtonBase>
<span class="text-sm text-fg-muted font-mono"> {{ page + 1 }} / {{ totalPages }} </span>
<ButtonBase variant="secondary" :disabled="page >= totalPages - 1" @click="nextPage">
{{ $t('common.next') }}
{{ $t('filters.pagination.previous') }}
</ButtonBase>
<span class="text-sm text-fg-muted font-mono"> {{ page + 1 }} / {{ totalPages }} </span>
<ButtonBase variant="secondary" :disabled="page >= totalPages - 1" `@click`="nextPage">
{{ $t('filters.pagination.next') }}

Comment on lines +19 to +20
const page = Number(query.page ?? 0)
const size = Math.min(Number(query.size ?? 20), 50)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Normalise and clamp page/size before both fetch params and cache key.

Negative/NaN/decimal values currently pass through, which can produce invalid offsets and cache-key fragmentation for equivalent effective queries.

🔧 Suggested normalisation
-    const page = Number(query.page ?? 0)
-    const size = Math.min(Number(query.size ?? 20), 50)
+    const rawPage = Number(query.page ?? 0)
+    const rawSize = Number(query.size ?? 20)
+    const page = Number.isFinite(rawPage) ? Math.max(0, Math.trunc(rawPage)) : 0
+    const size = Number.isFinite(rawSize) ? Math.min(50, Math.max(1, Math.trunc(rawSize))) : 20
@@
     getKey: event => {
       const pkg = getRouterParam(event, 'pkg') ?? ''
       const query = getQuery(event)
-      return `dependents:${pkg}:${query.page ?? 0}:${query.size ?? 20}`
+      const keyPage = Number.isFinite(Number(query.page)) ? Math.max(0, Math.trunc(Number(query.page))) : 0
+      const keySize = Number.isFinite(Number(query.size))
+        ? Math.min(50, Math.max(1, Math.trunc(Number(query.size))))
+        : 20
+      return `dependents:${pkg}:${keyPage}:${keySize}`
     },

Also applies to: 46-49

@graphieros graphieros added the automation This PR might have been created by an AI, which goes against our code of conduct. label Mar 29, 2026
Copy link
Copy Markdown
Contributor

@graphieros graphieros left a comment

Choose a reason for hiding this comment

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

While AI tools can be helpful for coding assistance, our project requires genuine human involvement. We've outlined this clearly in our contribution guidelines.

If you're genuinely interested in contributing to npmx.dev:

Engage with the community first (issues, discussions). A PR should be linked to an existing issue.
Understand the codebase and what we actually need
Submit thoughtful, individual PRs with your own descriptions
Follow up on feedback and participate in reviews
Use AI as a tool to assist you, not replace you
Mass-generated PRs like these won't be accepted. We welcome real contributions from developers who want to be part of our community.

Please acknowledge by answering this comment, in your own words.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation This PR might have been created by an AI, which goes against our code of conduct.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants