declare module 'extra-version' { /** * Given a version number MAJOR.MINOR.PATCH, increment the: * [more](https://github.com/nodef/extra-version/wiki/Version) * * 1. MAJOR version when you make incompatible API changes, * 2. MINOR version when you add functionality in a backwards compatible manner * 3. PATCH version when you make backwards compatible bug fixes. * * Additional labels for pre-release and build metadata are available as * extensions to the MAJOR.MINOR.PATCH format. * * A normal version number MUST take the form X.Y.Z where X, Y, and Z are * non-negative integers, and MUST NOT contain leading zeroes. X is the * major version, Y is the minor version, and Z is the patch version. Each * element MUST increase numerically. For instance: 1.9.0 -> 1.10.0 -> 1.11.0. * * Software using Semantic Versioning MUST declare a public API. This API * could be declared in the code itself or exist strictly in documentation. * However it is done, it SHOULD be precise and comprehensive. * * Once a versioned package has been released, the contents of that version * MUST NOT be modified. Any modifications MUST be released as a new version. * * Major version zero (0.y.z) is for initial development. Anything MAY change * at any time. The public API SHOULD NOT be considered stable. * * Version 1.0.0 defines the public API. The way in which the version number * is incremented after this release is dependent on this public API and how * it changes. * @see https://semver.org */ export class Version { /** * Major is updated on incompatible changes. * @example '1'.0.0, '1'.2.3-alpha.1 */ major: number; /** * Minor is updated on adding compatible functionality. * Minor is reset to 0 when major is updated. * @example 1.'0'.0, 1.'2'.3-alpha.1 */ minor: number; /** * Patch is updated on making compatible bug fixes. * Patch is reset to 0 when major or minor is updated. * @example 1.0.'0', 1.2.'3'-alpha.1 */ patch: number; /** * Pre-release indicates an unstable version, possibly incompatible. * Pre-releases are considered lower with respect to normal versions. * It consists of alphanumeric or hyphen, separated by dot. * @example 1.0.0-'alpha', 1.2.3-'alpha.1' */ prerelease: string[]; /** * Build metadata provides additonal build information. * Build metadata is non-unique and does not alter version ordering. * It consists of alphanumeric or hyphen, separated by dot. * @example 1.0.0-alpha+'20130313', 1.2.3-beta+'sha.5114f85'. */ buildmetadata: string[]; /** * Defines a semantic version. * @param major major number (0) * @param minor minor number (0) * @param patch patch number (0) * @param prerelease pre-release (null) * @param buildmetadata build metadata (null) */ constructor(major?: number, minor?: number, patch?: number, prerelease?: string[], buildmetadata?: string[]); /** * Converts version to string. */ toString(): string; } export type compareFn = (a: T, b: T) => number; export type mapFn = (v: T, i: number, x: Iterable) => U; export type nextFn = (v: T, d: T) => T; /** * Compares two versions. * [more](https://github.com/nodef/extra-version/wiki/compare) * * Pre-releases are considered lower with respect to normal versions. * Build metadata is non-unique and does not alter version ordering. * @param x a version * @param y another version * @param fc compare function (a, b) * @param fm map function (v, i, x) * @returns xy: +ve */ export function compare(x: Version, y: Version, fc?: compareFn, fm?: mapFn): number; /** * Converts value to version. * [more](https://github.com/nodef/extra-version/wiki/from) * @param v a value * @returns version, or null */ export function from(v: any): Version; /** * Checks if value is version. * [more](https://github.com/nodef/extra-version/wiki/is) * @param v value */ export function is(v: any): boolean; /** * Checks if two versions are equal. * [more](https://github.com/nodef/extra-version/wiki/isEqual) * * Pre-releases are considered lower with respect to normal versions. * Build metadata is non-unique and does not alter version ordering. * @param x an version * @param y another version * @param fc compare function (a, b) * @param fm map function (v, i, x) */ export function isEqual(x: Version, y: Version, fc?: compareFn, fm?: mapFn): boolean; /** * Checks if version is major 0, or pre-release. * [more](https://github.com/nodef/extra-version/wiki/isUnstable) * @param x a version */ export function isUnstable(x: Version): boolean; /** * Defines first major version. (1.0.0) * [more](https://github.com/nodef/extra-version/wiki/MAJOR) * Can be used as next major step. */ export const MAJOR: Version; /** * Defines first minor version. (0.1.0) * [more](https://github.com/nodef/extra-version/wiki/MINOR) * Can be used as next minor step. */ export const MINOR: Version; /** * Gives the next version. * [more](https://github.com/nodef/extra-version/wiki/next) * * Version step is for updating major, minor, patch, prerelease, or buildmetadata. * Next function is for controlling now each part of version is updated with step. * If a version part "xv" is to be reset, step part "sv" begins with '.'. * @param x a version * @param s version step (0.0.1) * @param fn next function (xv, sv) */ export function next(x: Version, s?: Version, fn?: nextFn): Version; /** * Converts string to version. * [more](https://github.com/nodef/extra-version/wiki/parse) * @param s a string * @param i start index (0) * @param lvl permissive level, 0-4/-1 (0 => none) * @returns [end index, version], or [-1, null] */ export function parse(s: string, i?: number, lvl?: number): [ number, Version ]; /** * Defines first patch version. (0.0.1) * [more](https://github.com/nodef/extra-version/wiki/PATCH) * Can be used as next patch step. */ export const PATCH: Version; /** * Regular expression to check a semver string. * [more](https://github.com/nodef/extra-version/wiki/RVERSION) * @see https://regex101.com/r/vkijKf/1/ */ export const RVERSION: RegExp; /** * Converts version to string. * [more](https://github.com/nodef/extra-version/wiki/stringify) * @param x a version */ export function stringify(x: any): string; export {}; }