Manuscript Documentation
v2026.12.0

@std/data/semver.ms#

Import each required symbol with import Name from "@std/data/semver.ms".

Version Type#

A parsed semantic version as defined by Semantic Versioning 2.0.0.

Manuscript
type Version {
    major Int
    minor Int
    patch Int
    prerelease List[String] = []
    build List[String] = []
}

Version.build#

Dot-separated build metadata identifiers in input order; ignored by compare.

Manuscript
build List[String] = []

Version.major#

Major version number; incremented for incompatible changes.

Manuscript
major Int

Version.minor#

Minor version number; incremented for compatible additions.

Manuscript
minor Int

Version.patch#

Patch version number; incremented for compatible fixes.

Manuscript
patch Int

Version.prerelease#

Dot-separated pre-release identifiers in input order; empty for a release version.

Manuscript
prerelease List[String] = []

Version.compare#

Compares two versions by SemVer precedence, returning -1, 0 or 1. Build metadata is ignored, and a pre-release sorts before its release (1.0.0-rc.1 before 1.0.0).

Manuscript
fn compare(other Version) Int

Version.to_string#

Formats a version as major.minor.patch[-prerelease][+build].

Manuscript
fn to_string() String

parse Function#

Parses strict Semantic Versioning 2.0.0 text. A leading v or surrounding space is rejected with kind EBADMSG, like any other malformed text. A numeric part too large for Int returns kind ERANGE.

Manuscript
fn parse(text String) Result[Version, Error] { ... }