/** * Version comparison utilities * * Handles various version formats commonly found in Minecraft plugins: * - Semantic versioning: 1.0.0, 2.1.3 * - Build variants: 1.0.0-SNAPSHOT, 2.8.2-beta * - Complex formats: 2.0.39 (1.21.8 BUILD #5) */ /** * Parsed version components */ export interface ParsedVersion { original: string; normalized: string; major: number; minor: number; patch: number; extra: number[]; prerelease?: string; build?: string; isValidSemver: boolean; } /** * Version comparison result */ export declare enum VersionCompareResult { /** First version is older */ Older = -1, /** Versions are equal */ Equal = 0, /** First version is newer */ Newer = 1 } /** * Clean a version string for comparison * Removes common prefixes and normalizes format */ export declare function cleanVersion(version: string): string; /** * Parse a version string into components */ export declare function parseVersion(version: string): ParsedVersion; /** * Compare two version strings * * @param version1 - First version * @param version2 - Second version * @returns -1 if v1 < v2, 0 if equal, 1 if v1 > v2 */ export declare function compareVersions(version1: string, version2: string): VersionCompareResult; /** * Check if version1 is newer than version2 */ export declare function isNewer(version1: string, version2: string): boolean; /** * Check if version1 is older than version2 */ export declare function isOlder(version1: string, version2: string): boolean; /** * Check if two versions are equal */ export declare function isEqual(version1: string, version2: string): boolean; /** * Check if a version satisfies a semver range */ export declare function satisfiesRange(version: string, range: string): boolean; /** * Get the latest version from an array */ export declare function getLatestVersion(versions: string[]): string | null; /** * Sort versions from oldest to newest */ export declare function sortVersions(versions: string[]): string[]; /** * Sort versions from newest to oldest */ export declare function sortVersionsDescending(versions: string[]): string[]; /** * Check if a version looks like a snapshot/dev build (true prerelease) */ export declare function isPrerelease(version: string): boolean; /** * Check if a suffix looks like a build number (not a true prerelease) * Build numbers like -b131, -build123, -rev42, -B42 should not affect version comparison */ export declare function isBuildNumber(suffix: string | undefined): boolean; /** * Format a version for display */ export declare function formatVersion(version: string): string; /** * Check if a Minecraft version is compatible with an API version * e.g., MC 1.21.1 is compatible with api-version 1.20 */ export declare function isMcVersionCompatible(mcVersion: string, apiVersion: string): boolean; //# sourceMappingURL=version.d.ts.map