Replies: 1 comment
|
Strong proposal — and it's the exact gap behind a family of real crashes in this ecosystem. The current reality is: the loader has zero version-compat knowledge (I checked Three things I'd sharpen before locking the design, drawn from the failures your proposal would have caught: 1. Declaring a range is only useful if the loader checks the actual installed plugin, not just the bundle. The sharpest crash we've seen is 2. Pre-release matching is the sharp edge. Your open question #3 is the critical one.
3. The default-when-absent answer (your question #2) is also load-bearing: this ecosystem is pre-1.0 and the public API is explicitly pre-stable, so defaulting to I'm speaking as a plugin author who has shipped six |
Uh oh!
There was an error while loading. Please reload this page.
[Feature Request] 插件声明 DSH 版本兼容性范围,加载器自动校验并拒绝不兼容插件
Category: Ideas 💡
现状
DSH 目前采用 everything-is-a-plugin 架构,插件通过 Cordis 加载。但插件和 DSH 核心之间没有显式的版本约束机制:
建议方案
允许插件在
cordis.yml(或package.json)中显式声明兼容的 DSH 版本范围,加载器在进入 LOADING 阶段前用semver.satisfies()进行校验,不满足则拒绝加载并输出明确的错误日志。配置方式
方案 A(推荐):在
cordis.yml中声明方案 B(备选):在
package.json中声明{ "name": "my-awesome-plugin", "dsh": { "compatibleVersions": "^0.1.0" } }加载器行为
0.1.3-alpha.1)dshCompatibility范围semver.satisfies(currentDSHVersion, declaredRange)收益
dshCompatibility的旧插件默认视为兼容所有版本,零破坏性变更开放问题
cordis.yml还是package.json?我个人倾向cordis.yml,因为这是 Cordis 插件的元数据配置中心。*(全兼容)还是默认当前主版本?建议初期为*,后续 DSH 1.0 后可收紧。semver默认对 pre-release 版本匹配较严格(^0.1.0通常不匹配0.1.3-alpha.1)。是否需要加载器在比较时自动剥离 pre-release 标签?--strict-compat启动参数?默认 Warning 但允许加载,开启后直接拒绝?All reactions