const { valid , coerce , clean , lt , gt , SemVer } = require ( "semver" ) ; /**
 * 版本号类
 */ export class Version { private _value : any ; public get value ( ) : any { return this . _value ; } public set value ( value ) { this . _value = value ; } constructor ( version ) { this . _value = new SemVer ( valid ( coerce ( clean ( version , { loose : true } ) ) ) || "0.0.0" ) ; } lessThan ( v ) { return lt ( this . value , v . value ) ; } greaterThan ( v ) { return gt ( this . value , v . value ) ; } toString ( ) { return this . value . raw ; } static from ( version ) { return new Version ( version ) ; } static sort ( versions ) { return versions . sort ( ( a , b ) => ( Version . from ( a ) . greaterThan ( Version . from ( b ) ) ? - 1 : 1 ) ) ; } }