mirror of
https://github.com/halo-dev/docs.git
synced 2025-10-18 16:24:01 +00:00
fix: correct plugin dependency description (#478)
### What this Pr does? 修复插件依赖声明文档描述不正确的问题 ```release-note None ```
This commit is contained in:
@@ -32,7 +32,7 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
# 省略其他字段
|
||||
spec:
|
||||
pluginDependencies:
|
||||
- pluginB@1.0.0
|
||||
pluginB: 1.0.0
|
||||
```
|
||||
|
||||
- **版本范围依赖**:如果插件对版本有一定的要求,可以指定版本范围。通过 `>=`(大于等于)和 `<`(小于)等符号,可以表示插件版本的区间。例如,`pluginA` 依赖于版本在 1.0.0 到 2.0.0 之间(不包括 2.0.0):
|
||||
@@ -40,7 +40,7 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
```yaml
|
||||
spec:
|
||||
pluginDependencies:
|
||||
- pluginB@>=1.0.0 & <2.0.0
|
||||
pluginB: >=1.0.0 & <2.0.0
|
||||
```
|
||||
|
||||
- **可选依赖**:某些情况下,插件的依赖是可选的,即使依赖未被满足,插件仍然可以加载。通过在插件名称后加上 `?` 来声明可选依赖。例如,`pluginA` 可选依赖于 `pluginB` 的 1.0 版本:
|
||||
@@ -48,7 +48,7 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
```yaml
|
||||
spec:
|
||||
pluginDependencies:
|
||||
- pluginB?@1.0
|
||||
pluginB?: 1.0
|
||||
```
|
||||
|
||||
- **多个依赖声明**:一个插件可能依赖多个插件,所有依赖可以在同一列表中列出,使用逗号分隔。例如,`pluginA` 依赖于 `pluginB` 的 1.0.0 到 2.0.0 版本区间,以及 `pluginC` 的 0.0.1 到 0.1.0 版本区间:
|
||||
@@ -56,10 +56,12 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
```yaml
|
||||
spec:
|
||||
pluginDependencies:
|
||||
- pluginB@>=1.0.0 & <=2.0.0
|
||||
- pluginC@>=0.0.1 & <=0.1.0
|
||||
pluginB: >=1.0.0 & <=2.0.0
|
||||
pluginC: >=0.0.1 & <=0.1.0
|
||||
```
|
||||
|
||||
> **可选依赖** 功能需要在 Halo 2.20.11 及以上版本才可以使用。
|
||||
|
||||
### 依赖加载逻辑
|
||||
|
||||
在 Halo 插件系统中,插件的依赖关系会影响其加载顺序和运行时行为。具体来说,插件的加载只有在其所有强制依赖都得到满足时才会进行。
|
||||
@@ -76,7 +78,7 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
|
||||
### 依赖声明注意事项
|
||||
|
||||
- **版本管理**:在声明版本时,推荐使用明确的版本号或版本范围,避免使用过于宽松的版本要求(如 `pluginB@*`),以确保插件在不同环境中一致性地运行。
|
||||
- **版本管理**:在声明版本时,推荐使用明确的版本号或版本范围,避免使用过于宽松的版本要求(如 `pluginB: *`),以确保插件在不同环境中一致性地运行。
|
||||
- **依赖冲突**:多个插件可能依赖于不同版本的同一插件,这可能导致版本冲突。为避免这种情况,开发者应该尽量保持插件版本的兼容性,必要时在 `plugin.yaml` 文件中使用具体的版本号范围进行严格控制。
|
||||
- **插件间的依赖层级**:插件可能依赖于其他插件,而这些插件又可能依赖于其他插件。建议开发者清晰地管理依赖链,避免过于复杂的依赖层级。合理规划插件之间的依赖关系有助于减少维护难度和潜在的运行时问题。
|
||||
|
||||
|
@@ -32,7 +32,7 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
# 省略其他字段
|
||||
spec:
|
||||
pluginDependencies:
|
||||
- pluginB@1.0.0
|
||||
pluginB: 1.0.0
|
||||
```
|
||||
|
||||
- **版本范围依赖**:如果插件对版本有一定的要求,可以指定版本范围。通过 `>=`(大于等于)和 `<`(小于)等符号,可以表示插件版本的区间。例如,`pluginA` 依赖于版本在 1.0.0 到 2.0.0 之间(不包括 2.0.0):
|
||||
@@ -40,7 +40,7 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
```yaml
|
||||
spec:
|
||||
pluginDependencies:
|
||||
- pluginB@>=1.0.0 & <2.0.0
|
||||
pluginB: >=1.0.0 & <2.0.0
|
||||
```
|
||||
|
||||
- **可选依赖**:某些情况下,插件的依赖是可选的,即使依赖未被满足,插件仍然可以加载。通过在插件名称后加上 `?` 来声明可选依赖。例如,`pluginA` 可选依赖于 `pluginB` 的 1.0 版本:
|
||||
@@ -48,7 +48,7 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
```yaml
|
||||
spec:
|
||||
pluginDependencies:
|
||||
- pluginB?@1.0
|
||||
pluginB?: 1.0
|
||||
```
|
||||
|
||||
- **多个依赖声明**:一个插件可能依赖多个插件,所有依赖可以在同一列表中列出,使用逗号分隔。例如,`pluginA` 依赖于 `pluginB` 的 1.0.0 到 2.0.0 版本区间,以及 `pluginC` 的 0.0.1 到 0.1.0 版本区间:
|
||||
@@ -56,10 +56,12 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
```yaml
|
||||
spec:
|
||||
pluginDependencies:
|
||||
- pluginB@>=1.0.0 & <=2.0.0
|
||||
- pluginC@>=0.0.1 & <=0.1.0
|
||||
pluginB: >=1.0.0 & <=2.0.0
|
||||
pluginC: >=0.0.1 & <=0.1.0
|
||||
```
|
||||
|
||||
> **可选依赖** 功能需要在 Halo 2.20.11 及以上版本才可以使用。
|
||||
|
||||
### 依赖加载逻辑
|
||||
|
||||
在 Halo 插件系统中,插件的依赖关系会影响其加载顺序和运行时行为。具体来说,插件的加载只有在其所有强制依赖都得到满足时才会进行。
|
||||
@@ -76,7 +78,7 @@ Halo 插件系统支持在 `plugin.yaml` 文件中通过 `pluginDependencies`
|
||||
|
||||
### 依赖声明注意事项
|
||||
|
||||
- **版本管理**:在声明版本时,推荐使用明确的版本号或版本范围,避免使用过于宽松的版本要求(如 `pluginB@*`),以确保插件在不同环境中一致性地运行。
|
||||
- **版本管理**:在声明版本时,推荐使用明确的版本号或版本范围,避免使用过于宽松的版本要求(如 `pluginB: *`),以确保插件在不同环境中一致性地运行。
|
||||
- **依赖冲突**:多个插件可能依赖于不同版本的同一插件,这可能导致版本冲突。为避免这种情况,开发者应该尽量保持插件版本的兼容性,必要时在 `plugin.yaml` 文件中使用具体的版本号范围进行严格控制。
|
||||
- **插件间的依赖层级**:插件可能依赖于其他插件,而这些插件又可能依赖于其他插件。建议开发者清晰地管理依赖链,避免过于复杂的依赖层级。合理规划插件之间的依赖关系有助于减少维护难度和潜在的运行时问题。
|
||||
|
||||
|
Reference in New Issue
Block a user