Skip to content

feat(client): sort bundle module trees by size - #2101

Merged
yifancong merged 1 commit into
web-infra-dev:mainfrom
dvd233:codex/feat-bundle-tree-size-sort
Oct 16, 2026
Merged

yifancong merged 1 commit into
web-infra-dev:mainfrom
dvd233:codex/feat-bundle-tree-size-sort

Conversation

@dvd233

@dvd233 dvd233 commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Motivation

Fixes #2049.

The Bundle Size module tree shows file and folder sizes, but it does not let users rank siblings by those sizes when investigating large bundles.

Changes

  • Add optional Bundled size and Source size descending orders, while retaining the existing order by default and when selecting Original order.
  • Sort every level of the tree using the existing file/folder size semantics. Equal sizes retain their original order; zero bundled size does not fall back to source size.
  • Preserve node keys, title callbacks and expansion when switching order. Cache size aggregation separately from sorting.
  • Add nine unit cases and three browser cases using a real generated report, covering nested folder totals, metric changes, restoring the original order, navigation and filtering.

Validation on Windows with Node 22.23.2:

  • Full baseline build and updated client build with type checking passed.
  • pnpm --filter @rsdoctor/client run test: 78 passed.
  • rs check --type-check: lint, type and format checks passed.
  • rs test run module-tree-sort in e2e: 3 passed in Chrome; all three fail on the baseline UI because the sorting control is absent.

The browser fixture normalizes emitted absolute source-map paths to obtain real bundled sizes on Windows. No production source-map behavior is changed.

Screenshots from the same generated report (the metrics files exchange positions when changing the selected size):

Bundled size Source size
Bundled size order Source size order

Copilot AI balanced review requested due to automatic review settings October 14, 2026 12:40

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CLAassistant

CLAassistant commented Oct 14, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T12:45:25.640941Z 3fef3d2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@yifancong

Copy link
Copy Markdown
Contributor

Thank you for your code contribution. You need to sign the license/cla above.
@dvd233

@yifancong
yifancong merged commit df7f3f0 into web-infra-dev:main Oct 16, 2026
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.

[Feature]: Support sorting Bundle Size file tree

4 participants