/** * @file Version comparison operators aligned with `node:smol-versions`, the * C++-accelerated multi-ecosystem version helper shipped by the smol Node * binary. The same names + signatures also match the vendored `semver` JS * lib — both impls expose this surface, so we pick one at module load (`impl * = smol ?? semver`) and each export just forwards to it. * * - `compare(a, b)` — returns `-1 | 0 | 1`, or `undefined` on invalid input * - `eq(a, b)`, `neq(a, b)` — equality / inequality * - `lt(a, b)`, `lte(a, b)` — less-than / less-or-equal * - `gt(a, b)`, `gte(a, b)` — greater-than / greater-or-equal * - `sort(versions)` — ascending sort * - `rsort(versions)` — descending sort `compare()` swallows the smol/semver * "invalid version" throw into `undefined` for the caller's convenience; * all other ops surface whatever the underlying impl returns. The vendored * `semver` export has no `neq` helper, so when we fall back to it we route * `neq` through `!eq` to match smol's semantics. Snapshot safety: each * export is a thin forwarding function that resolves `getImpl()` at FIRST * CALL, not at module-eval. Binding the impl methods at module load * (`impl.eq.bind(impl)`) pinned the native-handle-bearing semver/npm-pack * bundle into the heap and aborted `node --build-snapshot`. */ /** * Compare two semantic version strings. * * @returns -1 if a < b, 0 if a === b, 1 if a > b, or undefined if invalid. */ export declare function compare(a: string, b: string): -1 | 0 | 1 | undefined; /** * Check if a equals b. */ export declare function eq(a: string, b: string): boolean; /** * Check if a is greater than b. */ export declare function gt(a: string, b: string): boolean; /** * Check if a is greater than or equal to b. */ export declare function gte(a: string, b: string): boolean; /** * Check if a is less than b. */ export declare function lt(a: string, b: string): boolean; /** * Check if a is less than or equal to b. */ export declare function lte(a: string, b: string): boolean; /** * Check if a does not equal b. The vendored `semver` export exposes no `neq` * helper, so on the fallback path we route through `!eq` to match smol's * semantics; smol-versions has a native `.neq` and uses it directly. */ export declare function neq(a: string, b: string): boolean; /** * Sort versions in descending order. */ export declare function rsort(versions: readonly string[]): string[]; /** * Sort versions in ascending order. The input is spread so callers can pass a * `readonly string[]` even when the impl mutates internally. */ export declare function sort(versions: readonly string[]): string[];