Skip to content

refactor(fileSize): optimize asset sorting and display logic#6709

Merged
chenjiahan merged 5 commits intomainfrom
refactor_file_size_1205
Dec 5, 2025
Merged

refactor(fileSize): optimize asset sorting and display logic#6709
chenjiahan merged 5 commits intomainfrom
refactor_file_size_1205

Conversation

@chenjiahan
Copy link
Member

Summary

  • Add FormattedAsset type for better type safety
  • Extract total size calculation into separate function
  • Improve filename normalization and formatting
  • Optimize asset sorting and display logic

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 5, 2025 00:29
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@netlify
Copy link

netlify bot commented Dec 5, 2025

Deploy Preview for rsbuild ready!

Name Link
🔨 Latest commit b96e33d
🔍 Latest deploy log https://app.netlify.com/projects/rsbuild/deploys/69323632f3353600071d60d6
😎 Deploy Preview https://deploy-preview-6709--rsbuild.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 62 (🔴 down 2 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 60 (no change from production)
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the fileSize plugin to improve type safety and code organization. The main improvements include introducing a FormattedAsset type for better type definitions, extracting utility functions (calcTotalSize, pickAssetInfo) for better modularity, and renaming normalizeFileName to normalizeFilename for consistency.

Key Changes:

  • Added FormattedAsset type to formalize the structure of formatted asset data
  • Extracted total size calculation logic into a reusable calcTotalSize function
  • Renamed exported function normalizeFileName to normalizeFilename for naming consistency
  • Optimized asset sorting by moving it inside the getAssets function
  • Pre-computed filename labels and lengths in formatAsset for better performance

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

chenjiahan and others added 3 commits December 5, 2025 09:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chenjiahan chenjiahan merged commit e2e25ee into main Dec 5, 2025
11 checks passed
@chenjiahan chenjiahan deleted the refactor_file_size_1205 branch December 5, 2025 01:42
@chenjiahan chenjiahan mentioned this pull request Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant