← 返回
未分类 中文

Rollup Config Validator

Validate Rollup config files (rollup.config.js/mjs/ts) for output format conflicts, plugin ordering issues, deprecated options, and best practices. Use when...
验证 Rollup 配置文件 (rollup.config.js/mjs/ts),检查输出格式冲突、插件排序问题、废弃选项及最佳实践。适用于...
charlie-morrison charlie-morrison 来源
未分类 clawhub v1.0.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 400
下载
💾 1
安装
1
版本
#latest

概述

Rollup Config Validator

Validate Rollup config files (exported JSON or parsed config objects) for output format conflicts, external/bundle mismatches, plugin ordering issues, deprecated options, treeshake settings, and best practices. Supports text, JSON, and summary output formats with CI-friendly exit codes.

Commands

# Full validation (all 22+ rules)
python3 scripts/rollup_config_validator.py validate rollup.config.json

# Quick syntax-only check (structure rules only)
python3 scripts/rollup_config_validator.py check rollup.config.json

# Explain config in human-readable form
python3 scripts/rollup_config_validator.py explain rollup.config.json

# Suggest improvements
python3 scripts/rollup_config_validator.py suggest rollup.config.json

# JSON output (CI-friendly)
python3 scripts/rollup_config_validator.py validate rollup.config.json --format json

# Summary only (pass/fail + counts)
python3 scripts/rollup_config_validator.py validate rollup.config.json --format summary

# Strict mode (warnings become errors)
python3 scripts/rollup_config_validator.py validate rollup.config.json --strict

Input Format

Since Rollup configs are typically JavaScript, this tool validates JSON representations of Rollup config objects. Export your config as JSON or use a wrapper:

# Extract config as JSON from rollup.config.js
node -e "const c = require('./rollup.config.js'); console.log(JSON.stringify(c, null, 2))" > rollup.config.json
python3 scripts/rollup_config_validator.py validate rollup.config.json

Or validate directly from a JSON config file.

Rules (22+)

#CategorySeverityRule
-----------------------------
S1StructureErrorFile not found or unreadable
S2StructureErrorEmpty config or no content
S3StructureWarningUnknown top-level config keys
S4StructureErrorInvalid JSON syntax
S5StructureErrorMissing input entry point
O1OutputErrorMissing output configuration
O2OutputWarningMissing output.format (defaults to 'es')
O3OutputWarningoutput.file and output.dir both specified
O4OutputWarningformat: 'iife' or 'umd' without output.name
O5OutputWarningMultiple outputs with same format and no distinct file/dir
O6OutputWarningoutput.sourcemap: true without sourcemapExcludeSources consideration
E1ExternalWarningBare module in external should match import pattern
E2ExternalWarningRegex pattern in external (fragile)
E3ExternalWarningNode built-in not in external (path, fs, etc.)
P1PluginsWarningPlugin ordering: resolve before commonjs
P2PluginsWarningcommonjs plugin without @rollup/plugin-node-resolve
P3PluginsWarningjson plugin missing (importing .json files)
P4PluginsWarningDeprecated plugin (rollup-plugin- → @rollup/plugin-)
T1TreeshakeWarningtreeshake: false disables dead code elimination
T2TreeshakeWarningmoduleSideEffects: false may break libraries
B1Best PracticesWarningMissing preserveEntrySignatures for library builds
B2Best PracticesWarningLarge number of manual chunks without shared dependencies
B3Best PracticesWarningwatch mode config without clearScreen setting

Output Formats

  • text (default): Human-readable with severity icons
  • json: Machine-parseable JSON array of findings
  • summary: Pass/fail with error/warning counts

Exit Codes

  • 0: No errors (warnings only or clean)
  • 1: One or more errors found
  • 2: File not found or invalid input

Requirements

  • Python 3.8+
  • No external dependencies (pure stdlib)

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-05-07 04:43 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 81 📥 182,959
ai-agent

Slack Messaging

charlie-morrison
Slack 消息—通过 CLI 和 API 发送消息、管理频道、上传文件、添加反应并自动化团队通知。
★ 0 📥 552
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 686 📥 330,849