From b388539d577cc2689b559b15c8efe0cd9a15dae7 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 25 Aug 2025 08:27:27 +0000
Subject: [PATCH 1/2] Initial plan
From e0e19a16b1997bdecb82c0c7505019b6a73096b1 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 25 Aug 2025 08:36:35 +0000
Subject: [PATCH 2/2] Implement bundle size difference chart to show changes
between versions
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
---
apps/dashboard/src/App.tsx | 73 ++++++++++++++++++++++++++++++--------
1 file changed, 59 insertions(+), 14 deletions(-)
diff --git a/apps/dashboard/src/App.tsx b/apps/dashboard/src/App.tsx
index 7a2d754..2d9b486 100644
--- a/apps/dashboard/src/App.tsx
+++ b/apps/dashboard/src/App.tsx
@@ -1,5 +1,5 @@
import { useState } from 'react'
-import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts'
+import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, Cell } from 'recharts'
import { BarChart3, Clock, Package, FileText } from 'lucide-react'
import './App.css'
import rolldownStats from '../../../rolldown-version-stats.json'
@@ -15,10 +15,31 @@ const buildTimeData = rolldownStats.map(stat => ({
value: stat.buildTime
}))
-const bundleSizeData = rolldownStats.map(stat => ({
- name: `v${stat.version}`,
- value: stat.totalSize // Use actual bytes instead of KB
-}))
+// Calculate bundle size differences between consecutive versions
+const bundleSizeDiffData = rolldownStats.map((stat, index) => {
+ if (index === 0) {
+ // For the first version, show 0 difference or could show absolute value
+ return {
+ name: `v${stat.version}`,
+ value: 0,
+ previousSize: null,
+ currentSize: stat.totalSize,
+ isBaseline: true
+ }
+ }
+
+ const prevSize = rolldownStats[index - 1].totalSize
+ const currentSize = stat.totalSize
+ const diff = currentSize - prevSize
+
+ return {
+ name: `v${stat.version}`,
+ value: diff,
+ previousSize: prevSize,
+ currentSize: currentSize,
+ isBaseline: false
+ }
+})
// Calculate file type breakdown from all versions
const fileTypeStats = rolldownStats.reduce((acc, stat) => {
@@ -42,17 +63,25 @@ const fileTypeData = Object.entries(fileTypeStats).map(([type, size]) => ({
function App() {
const [selectedMetric, setSelectedMetric] = useState('buildTime')
- // Custom tooltip formatter for bundle size
- const customTooltipFormatter = (value: any, name: string) => {
- if (selectedMetric === 'bundleSize') {
- return [formatNumberWithCommas(value), name]
+ // Custom tooltip formatter for bundle size differences
+ const bundleSizeDiffTooltipFormatter = (value: any, name: string, props: any) => {
+ const data = props.payload
+ if (!data) return [value, name]
+
+ if (data.isBaseline) {
+ return [`${formatNumberWithCommas(data.currentSize)} bytes (baseline)`, 'Bundle Size']
}
- return [value, name]
+
+ const sign = value >= 0 ? '+' : ''
+ const changeText = `${sign}${formatNumberWithCommas(value)} bytes`
+ const fromTo = `(${formatNumberWithCommas(data.previousSize)} → ${formatNumberWithCommas(data.currentSize)})`
+
+ return [`${changeText} ${fromTo}`, 'Size Change']
}
const metrics = [
{ id: 'buildTime', name: 'Build Time', icon: Clock, data: buildTimeData, color: '#8884d8' },
- { id: 'bundleSize', name: 'Bundle Size', icon: Package, data: bundleSizeData, color: '#82ca9d' },
+ { id: 'bundleSize', name: 'Bundle Size', icon: Package, data: bundleSizeDiffData, color: '#82ca9d' },
{ id: 'fileTypes', name: 'File Types', icon: FileText, data: fileTypeData, color: '#ffc658' },
]
@@ -102,17 +131,33 @@ function App() {
{formatNumberWithCommas(bundleSizeData[bundleSizeData.length - 1]?.value || 0)} bytes
+{formatNumberWithCommas(rolldownStats[rolldownStats.length - 1]?.totalSize || 0)} bytes
v{rolldownStats[rolldownStats.length - 1]?.version}