Skip to content

feat: add dependency size chart to timeline#2979

Open
43081j wants to merge 11 commits into
mainfrom
jg/timeline-dep-sizes
Open

feat: add dependency size chart to timeline#2979
43081j wants to merge 11 commits into
mainfrom
jg/timeline-dep-sizes

Conversation

@43081j

@43081j 43081j commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🔗 Linked issue

N/A

🧭 Context

The timeline charts currently show the overall package size, but showing the segmented dependency sizes would be useful too.

📚 Description

Does what it says on the tin! Shows a nice new 3rd chart that has the segmented install size (i.e. each significant dependency is a segment in the bar).

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

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

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

Request Review

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

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.

@socket-security

socket-security Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedvue-data-ui@​3.22.3901009796100

View full report

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

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

Files with missing lines Patch % Lines
app/components/Package/TimelineChart.vue 38.67% 42 Missing and 23 partials ⚠️
app/utils/charts.ts 63.63% 9 Missing and 11 partials ⚠️

📢 Thoughts on this report? Let us know!

@43081j 43081j changed the title Add dependency size chart to timeline feat: add dependency size chart to timeline Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

e18e dependency analysis

No dependency warnings found.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 229dcdc0-f9c8-4fa4-9343-0ec3a41affbf

📥 Commits

Reviewing files that changed from the base of the PR and between 65fd762 and 01d0759.

📒 Files selected for processing (1)
  • app/components/Package/TimelineChart.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/components/Package/TimelineChart.vue

📝 Walkthrough

Summary by CodeRabbit

  • New Features
    • Added a “Dependency Size” metric to package timeline charts with stacked breakdown (top dependencies, Other, and self size).
    • Improved accessibility with metric-aware export filenames and enhanced stack chart alt-text/copy.
    • Updated annotator controls to use dynamically generated icons.
  • Bug Fixes
    • Improved metric tab switching with throttled animations and more dependable zoom-reset behaviour (including reduced-motion support).
  • Backend/API
    • Extended the timeline size endpoint to include self size and per-dependency sizes (limited to 30), with a cache version bump.
  • Tests / Chores
    • Added unit tests for stack chart alt-text/copy and expanded i18n strings; updated the chart UI library version.

Walkthrough

Adds a dependencySize timeline stackbar view backed by dependency breakdown data, with client cache updates, chart utility support, alt-text handling, and matching translation, schema, and dependency updates.

Changes

Dependency size timeline stackbar feature

Layer / File(s) Summary
Server dependency breakdown response and caching
server/api/registry/timeline/sizes/[...pkg].get.ts
Returns selfSize and dependency breakdown data for each timeline version, limits dependency entries to 30, and bumps the cache key to v2.
Client-side timeline size cache typing
app/pages/package-timeline/[[org]]/[packageName].vue
Types sizeCache with TimelineSizeCacheValue and stores selfSize plus dependencies in cached size entries.
Chart utility types and stackbar configuration
app/utils/charts.ts
Adds dependency breakdown types, expands chart metric/config types for dependencySize, and introduces stackbar total and percentage helpers.
Stackbar alt-text generation and annotator helpers
app/utils/charts.ts, test/unit/app/utils/charts.spec.ts
Adds stackbar alt-text copy helpers and annotator slot icon/style helpers, with unit tests covering stackbar alt-text output and copy forwarding.
TimelineChart.vue stackbar rendering and data computation
app/components/Package/TimelineChart.vue
Computes dependency segments and stackbar datasets/config, adds the dependencySize tab, and renders VueUiStackbar with custom tooltip and overlay logic.
Translations, schema, and dependency updates
i18n/locales/en.json, i18n/schema.json, nuxt.config.ts, package.json
Adds translation keys and schema fields for the new stackbar copy, pre-bundles vue-ui-stackbar, and bumps vue-data-ui.

Possibly related PRs

  • npmx-dev/npmx.dev#2663: Extends the same timeline chart and chart utility code paths with the dependencySize stackbar view.
  • npmx-dev/npmx.dev#2918: Also changes TimelineChart.vue animation and transition handling during chart interactions.
  • npmx-dev/npmx.dev#2728: Modifies TimelineChart.vue data and tooltip/export behaviour in a closely related area.

Suggested reviewers: ghostdevv, gameroman, serhalp

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarises the main change: adding a dependency size chart to the timeline.
Description check ✅ Passed The description matches the changeset and explains the new segmented dependency size chart.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jg/timeline-dep-sizes

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.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/components/Package/TimelineChart.vue`:
- Around line 139-145: The watcher on orderedConvertedData in TimelineChart.vue
checks chartRef.value for resetZoom before awaiting nextTick, but chartRef can
change during the await. Re-check chartRef.value and confirm resetZoom exists
after nextTick, then call it only on the current ref; use the existing watch
callback and chartRef symbol to keep the guard aligned with the latest component
instance.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c6839898-b73c-47a4-955f-bcdd623bba6a

📥 Commits

Reviewing files that changed from the base of the PR and between 492c907 and 137f2bb.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • app/components/Package/TimelineChart.vue
  • app/pages/package-timeline/[[org]]/[packageName].vue
  • app/utils/charts.ts
  • i18n/locales/en.json
  • i18n/schema.json
  • nuxt.config.ts
  • package.json
  • server/api/registry/timeline/sizes/[...pkg].get.ts
  • test/unit/app/utils/charts.spec.ts

Comment thread app/components/Package/TimelineChart.vue
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

@graphieros graphieros left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

;)

@gameroman gameroman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love it!

The animation when toggling "stable only" is a bit weird/laggy though

@graphieros

Copy link
Copy Markdown
Member

Love it!

The animation when toggling "stable only" is a bit weird/laggy though

I used the same ease-out function as for the transitions in the line charts. Maybe they can be slightly faster for bars, as bars are... heavy by definition.

Comment on lines +232 to +236
const reference = data.at(-1)
if (!reference) return []

const topNames = reference.dependencies.slice(0, DEP_SEGMENT_COUNT).map(dep => dep.name)
const topNameSet = new Set(topNames)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What does reference do?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the last version in the data is taken as reference to pick which dependencies are part of the segmentation throughout the timeline

@graphieros

Copy link
Copy Markdown
Member

The animation when toggling "stable only" is a bit weird/laggy though
@gameroman wdyt now ?

@gameroman

Copy link
Copy Markdown
Member

The animation when toggling "stable only" is a bit weird/laggy though

@gameroman wdyt now ?

Still feels kinda off. Maybe we can try without animation at all?

@graphieros

Copy link
Copy Markdown
Member

Still feels kinda off. Maybe we can try without animation at all?

I'd prefer to keep the transition as it is now, users will often toggle legend items, and transitions are nice in this case

@graphieros graphieros added the needs review This PR is waiting for a review from a maintainer label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review This PR is waiting for a review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants