feat(rolldown): add rule-based build scan with CI gating

未关闭
#624 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
32/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

Start in @vitejs/devtools-rolldown by tracing how recorded @rolldown/debug sessions reach the existing panels and diagnostics/messages surfaces, then map which proposed checks have sufficient data. Review the existing CLI entry points and the bundleAnalyzerPlugin report flow for reusable reporting patterns. Done means checks support severity, ignore patterns, and thresholds; findings appear in the UI and static report; and the CLI prints a summary and exits non-zero for error-level findings.

由索引模型根据 Issue 内容生成。

描述

Clear and concise description of the problem

DevTools for Rolldown already surfaces the data needed to investigate a build: duplicate packages, plugin hook costs, module and chunk graphs, assets, and session comparison. What it does not have is a way to encode what is wrong and enforce it. Every review is manual — open the UI, check the Packages → Duplicated tab, scan plugin timings, compare sessions — and nothing can fail CI.

Rsdoctor has this as a dedicated layer over compiler data ("build scan"): rules with severity and ignore/threshold config, built-in checks (duplicate packages, cross-chunk packages, loader/plugin time thresholds, ECMA target, default imports, mixed initial/async modules, side-effects-only tree shaking, CJS require, ESM resolved to CJS), custom rules, and findings in both the CLI and the report: https://rsdoctor.rs/guide/rules/rules.md

Today the equivalent information exists in the DevTools panels, but it is only consumable by a human looking at it.

Suggested solution

Add a checks layer to @vitejs/devtools-rolldown, evaluated over the recorded @rolldown/debug session data:

  • Built-in checks for the classes above where the data exists: duplicate package versions, cross-chunk duplicates, plugin hook time budgets, modules present in both initial and async chunks, etc.
  • A checks config with off | warn | error, ignore patterns and thresholds, in the shape users already know from linter configs.
  • Findings in the DevTools UI and the static report, reusing the existing diagnostics/messages surfaces.
  • vite-devtools check (or a flag on vite-devtools build) that prints a summary and exits non-zero when error-level findings exist, so CI can gate on it.

The session data is already recorded for the existing panels, so the checks can be pure functions over a session. bundleAnalyzerPlugin's JSON could feed the same checks for non-Vite users later.

Alternative

Expose a stable read API for recorded build sessions and let a community plugin implement the rules. A rule engine outside core would still need a CLI entry point to be usable in CI.

Additional context
Validations
主要语言
TypeScript
星标
1.2k
派生
97
平均合并
2 天 19 小时
30 天内合并 PR
14

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vitejs/devtools 的其他 Issue

查看 vitejs/devtools 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。