Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
ci(web): highlight Vinext bundle size changes (#42858)
Stephen Zhou28ed56174037
diff --git a/web/scripts/__tests__/bundle-analysis.spec.ts b/web/scripts/__tests__/bundle-analysis.spec.tsindex 35c4c80eb42..c2721922458 100644--- a/web/scripts/__tests__/bundle-analysis.spec.ts+++ b/web/scripts/__tests__/bundle-analysis.spec.ts@@ -159,7 +159,7 @@ it('keeps tiny gzip changes and attribution-only or entry-boundary changes in th}expect(shouldComment(base, merged)).toBe(false)const report = compare(base, merged)- expect(report).toContain('+0.49 KiB')+ expect(report).toContain('+500 B (+2.50%)')expect(report).toContain('New entry')expect(report).toContain('Removed entry')expect(report).toContain('example')diff --git a/web/scripts/bundle-analysis.ts b/web/scripts/bundle-analysis.tsindex 5e7df8b39fe..14464d24453 100644--- a/web/scripts/bundle-analysis.ts+++ b/web/scripts/bundle-analysis.ts@@ -178,7 +178,25 @@ export function shouldComment(a: Snapshot, b: Snapshot): boolean {))}-const delta = (a: number, b: number) => `${b > a ? '+' : b < a ? '−' : ''}${kib(Math.abs(b - a))}`+const delta = (a: number, b: number) => {+ if (a === b) return '⚪ No change'+ const change = b - a+ const sign = change > 0 ? '+' : '−'+ const magnitude = Math.abs(change)+ const amount = magnitude < 1024 ? `${magnitude} B` : kib(magnitude)+ const ratio = a === 0 ? null : (magnitude / a) * 100+ const percent =+ ratio === null ? 'from zero' : `${sign}${ratio < 0.01 ? '<0.01' : ratio.toFixed(2)}%`+ return `${change > 0 ? '🟠' : '🟢'} **${sign}${amount} (${percent})**`+}+const details = (summary: string, rows: string[]) => [+ '<details>',+ `<summary>${summary}</summary>`,+ '',+ ...rows,+ '',+ '</details>',+]const label = (s: string) =>`<code>${s.replaceAll('&', '&').replaceAll('<', '<').replaceAll('>', '>').replaceAll('|', '|').replaceAll('\n', ' ')}</code>`export function compare(a: Snapshot, b: Snapshot): string {@@ -186,15 +204,14 @@ export function compare(a: Snapshot, b: Snapshot): string {'<!-- dify-vinext-bundle-size -->','## Vinext bundle analysis','',- `Base: \`${a.commit}\` · Merge: \`${b.commit}\``,- `Vinext: ${a.vinext} → ${b.vinext}; Rolldown: ${a.rolldown} → ${b.rolldown}`,+ `**JS gzip:** ${delta(a.totals.js.gzip, b.totals.js.gzip)} · **CSS gzip:** ${delta(a.totals.css.gzip, b.totals.css.gzip)}`,'',- '| All client output | Base gzip | Merge gzip | Gzip Δ | Raw Δ |',- '| --- | ---: | ---: | ---: | ---: |',+ '| All client output | Base gzip → Merge gzip | Gzip change |',+ '| --- | ---: | ---: |',]for (const kind of ['js', 'css'] as const)lines.push(- `| ${kind.toUpperCase()} | ${kib(a.totals[kind].gzip)} | ${kib(b.totals[kind].gzip)} | ${delta(a.totals[kind].gzip, b.totals[kind].gzip)} | ${delta(a.totals[kind].raw, b.totals[kind].raw)} |`,+ `| ${kind.toUpperCase()} | ${kib(a.totals[kind].gzip)} → ${kib(b.totals[kind].gzip)} | ${delta(a.totals[kind].gzip, b.totals[kind].gzip)} |`,)const changed = [...new Set([...Object.keys(a.entries), ...Object.keys(b.entries)])].filter(@@ -208,37 +225,56 @@ export function compare(a: Snapshot, b: Snapshot): string {Math.abs((b.entries[y]?.gzip ?? 0) - (a.entries[y]?.gzip ?? 0)) -Math.abs((b.entries[x]?.gzip ?? 0) - (a.entries[x]?.gzip ?? 0)) || x.localeCompare(y),)+ const increased = changed.filter((k) => b.entries[k]!.gzip > a.entries[k]!.gzip).length+ const decreased = changed.filter((k) => b.entries[k]!.gzip < a.entries[k]!.gzip).length+ const rawOnly = changed.length - increased - decreasedlines.push('',- '### Entry static dependencies',+ `**Entry changes:** 🟠 ${increased} increased · 🟢 ${decreased} decreased${rawOnly ? ` · ⚪ ${rawOnly} raw-only changes` : ''} (gzip).`,'',- `Showing ${Math.min(20, changed.length)} of ${changed.length} changed entries, ordered by absolute gzip delta.`,+ '### Largest entry changes',+ '',+ `Top ${Math.min(5, changed.length)} by absolute gzip delta. Static dependencies overlap; do not sum entries.`,'',- '| Source entry | Base gzip | Merge gzip | Gzip Δ |',- '| --- | ---: | ---: | ---: |',)- if (!changed.length) lines.push('| No entry size changes | — | — | — |')- for (const k of changed.slice(0, 20))+ const entryTable = (keys: string[], full = false) => [+ `| Source entry | Base gzip → Merge gzip | Gzip change |${full ? ' Raw change |' : ''}`,+ `| --- | ---: | ---: |${full ? ' ---: |' : ''}`,+ ...keys.map(+ (k) =>+ `| ${label(full ? k : k.replace(/^(?:static|dynamic)-entry: /, ''))} | ${kib(a.entries[k]!.gzip)} → ${kib(b.entries[k]!.gzip)} | ${delta(a.entries[k]!.gzip, b.entries[k]!.gzip)} |${full ? ` ${delta(a.entries[k]!.raw, b.entries[k]!.raw)} |` : ''}`,+ ),+ ]+ if (changed.length) {+ lines.push(...entryTable(changed.slice(0, 5)), '')lines.push(- `| ${label(k)} | ${a.entries[k] ? kib(a.entries[k].gzip) : 'New'} | ${b.entries[k] ? kib(b.entries[k].gzip) : 'Removed'} | ${delta(a.entries[k]?.gzip ?? 0, b.entries[k]?.gzip ?? 0)} |`,+ ...details(+ `Top ${Math.min(20, changed.length)} of ${changed.length} changed entries (full paths and raw sizes)`,+ entryTable(changed.slice(0, 20), true),+ ),)+ } else {+ lines.push('No entry size changes.')+ }const topology = [...new Set([...Object.keys(a.entries), ...Object.keys(b.entries)])].filter((k) => !a.entries[k] || !b.entries[k]).sort()if (topology.length) {lines.push('',- '### Added or removed entries',+ '<details>',+ `<summary>🆕 / ➖ ${topology.length} added or removed entries</summary>`,'',- `Showing ${Math.min(20, topology.length)} of ${topology.length} entry-boundary changes. These are not size deltas from zero.`,+ `Showing ${Math.min(20, topology.length)} of ${topology.length}. Entry-boundary changes are not size deltas from zero.`,'','| Source entry | Change | Static dependencies (gzip) |','| --- | --- | ---: |',)for (const k of topology.slice(0, 20))lines.push(- `| ${label(k)} | ${b.entries[k] ? 'New entry' : 'Removed entry'} | ${kib((b.entries[k] ?? a.entries[k])!.gzip)} |`,+ `| ${label(k)} | ${b.entries[k] ? '🆕 New entry' : '➖ Removed entry'} | ${kib((b.entries[k] ?? a.entries[k])!.gzip)} |`,)+ lines.push('', '</details>')}const packages = [...new Set([...Object.keys(a.packages), ...Object.keys(b.packages)])].filter((k) => a.packages[k] !== b.packages[k])@@ -249,7 +285,10 @@ export function compare(a: Snapshot, b: Snapshot): string {)lines.push('',- '### Package module attribution',+ '<details>',+ `<summary>📦 ${packages.length} package attribution changes (uncompressed modules)</summary>`,+ '',+ `Showing ${Math.min(15, packages.length)} of ${packages.length}, ordered by absolute module-size delta.`,'','| Package | Base | Merge | Δ |','| --- | ---: | ---: | ---: |',@@ -260,6 +299,18 @@ export function compare(a: Snapshot, b: Snapshot): string {`| ${label(k)} | ${kib(a.packages[k] ?? 0)} | ${kib(b.packages[k] ?? 0)} | ${delta(a.packages[k] ?? 0, b.packages[k] ?? 0)} |`,)lines.push(+ '',+ '</details>',+ '',+ '<details>',+ '<summary>Measurement details and build revisions</summary>',+ '',+ `Base: \`${a.commit}\` · Merge: \`${b.commit}\``,+ `Vinext: ${a.vinext} → ${b.vinext}; Rolldown: ${a.rolldown} → ${b.rolldown}`,+ '',+ `Raw JS change: ${delta(a.totals.js.raw, b.totals.js.raw)} · Raw CSS change: ${delta(a.totals.css.raw, b.totals.css.raw)}`,+ '',+ '🟠 Increase · 🟢 Decrease · ⚪ Unchanged. Colors indicate direction, not a performance budget verdict. Percentages use the base size.','','Entries follow only static edges in the official Rolldown chunk graph, deduplicating shared files. Dynamic entries are measured when loaded; they are not page first-load metrics. Entry totals overlap and must not be summed.','Package attribution sums module sizes reported by Rolldown, not compressed emitted bytes. Gzip totals are measured per emitted file. This is Vinext output, not Next.js/Turbopack output.',@@ -267,6 +318,7 @@ export function compare(a: Snapshot, b: Snapshot): string {)if (a.vinext !== b.vinext || a.rolldown !== b.rolldown)lines.push('', 'Compiler versions differ; changes may include compiler effects.')+ lines.push('', '</details>')return `${lines.join('\n')}\n`}