1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| flowchart LR subgraph WRITE["① 你编写"] P["Plugin(插件)<br/>export function apply(ctx)<br/>或 Service 类<br/>注册工具 / 服务 / 钩子"] B["Bundle(组合包)<br/>npm 包<br/>package.json: dsh.bundle<br/>→ cordis.patch.yml(patch 层)<br/>patch 行按包名引用插件"] end subgraph ASSEMBLE["② 用户装配"] PF["Profile(配置档)<br/>$DSH_HOME/profiles/NAME/<br/>dsh.profile.bundles = [base, web-app, ...]<br/>+ 自己的 cordis.patch.yml(热更新)"] CFG["生效配置树<br/>空根 + 逐层 applyEntryPatches<br/>(后层按行胜出)"] end subgraph RUN["③ 启动运行"] L["Cordis Loader<br/>按每一行挂载"] I["插件实例 Fiber<br/>依赖注入 → apply(ctx)<br/>effect 自动清理"] end B -- "dsh plugin --profile NAME add ./pkg<br/>(pnpm 安装 + 追加进 bundles 列表)" --> PF PF -- "dsh --profile NAME<br/>按 bundles 顺序取各包 patch 层" --> CFG B -- "patch 层(insert 行 / 按 id 覆盖行)" --> CFG P -- "行 name 引用模块(包名 / 相对路径 / 绝对路径)" --> CFG CFG -- "每行 = {id, name, config, inject, disabled}" --> L L -- "inject 依赖就绪 → 执行 apply" --> I
|