mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-25 15:40:28 +08:00
Ignore 'v' and 'V' prefixes in plugin versions
This commit is contained in:
parent
775b888273
commit
367b17ad7f
@ -17,11 +17,15 @@ import kotlinx.serialization.builtins.serializer
|
||||
@Serializer(forClass = Semver::class)
|
||||
internal object SemverAsStringSerializerLoose : KSerializer<Semver> by String.serializer().map(
|
||||
serializer = { it.toString() },
|
||||
deserializer = { Semver(it, Semver.SemverType.LOOSE) }
|
||||
deserializer = {
|
||||
Semver(it.removePrefix("v").removePrefix("V"), Semver.SemverType.LOOSE)
|
||||
}
|
||||
)
|
||||
|
||||
@Serializer(forClass = Semver::class)
|
||||
internal object SemverAsStringSerializerIvy : KSerializer<Semver> by String.serializer().map(
|
||||
serializer = { it.toString() },
|
||||
deserializer = { Semver(it, Semver.SemverType.IVY) }
|
||||
deserializer = {
|
||||
Semver(it.removePrefix("v").removePrefix("V"), Semver.SemverType.IVY)
|
||||
}
|
||||
)
|
@ -14,7 +14,6 @@ import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.encodeToString
|
||||
import net.mamoe.mirai.console.internal.data.SemverAsStringSerializerIvy
|
||||
import net.mamoe.mirai.console.internal.data.map
|
||||
import net.mamoe.yamlkt.Yaml
|
||||
import net.mamoe.yamlkt.YamlDynamicSerializer
|
||||
@ -49,7 +48,7 @@ public interface PluginDescription {
|
||||
*
|
||||
* 语法参考: ([语义化版本 2.0.0](https://semver.org/lang/zh-CN/))
|
||||
*
|
||||
* @see Semver 语义化版本
|
||||
* @see Semver 语义化版本. 允许 [宽松][Semver.SemverType.LOOSE] 类型版本.
|
||||
*/
|
||||
public val version: Semver
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user