@stryke/fs
Version:
A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.
93 lines (92 loc) • 3.65 kB
text/typescript
import { CoerceOptions, Range, SemVer } from "semver";
//#region src/semver-fns.d.ts
type ReleaseType = "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease" | "release";
declare const RELEASE_TYPES: ReleaseType[];
/**
* Parse a semver string into a SemVer object
*
* @param semver - The semver string to parse
* @param loose - Whether to use loose parsing
* @returns The parsed SemVer object
*/
declare const parseVersion: (semver: string, loose?: boolean) => SemVer | null;
/**
* Coerce a version string into a valid SemVer string
*
* @param version - The version string or number or {@link SemVer} to coerce
* @param options - Options to use when coercing the version
* @returns The coerced SemVer string or null if invalid
*/
declare const coerceVersion: (version: string | number | SemVer | null | undefined, options?: CoerceOptions) => SemVer | null;
/**
* Type check for {@link SemVer}
*
* @param val - The value to check
* @returns Whether the value is a valid {@link SemVer}
*/
declare const isSemver: (val: any) => val is SemVer;
/**
* Type check for {@link Range}
*
* @param val - The value to check
* @returns Whether the value is a valid {@link Range}
*/
declare const isRange: (val: any) => val is Range;
/**
* Check if a {@link SemVer} string is valid
*
* @remarks
* If you're looking for type checking, please use the {@link isSemver} function.
*
* @param semver - The semver string to check
* @param loose - Whether to use loose parsing
* @returns Whether the semver string is valid
*/
declare const isValidSemver: (semver: any, loose?: boolean) => boolean;
/**
* Check if a {@link Range} string is valid
*
* @remarks
* If you're looking for type checking, please use the {@link isRange} function.
*
* @param range - The range string to check
* @param loose - Whether to use loose parsing
* @returns Whether the range string is valid
*/
declare const isValidRange: (range: any, loose?: boolean) => boolean;
/**
* Check if a {@link SemVer} or {@link Range} string is valid
*
* @param version - The semver string to check
* @param loose - Whether to use loose parsing
* @returns Whether the semver string is valid
*/
declare const isValidVersion: (version: string | SemVer | Range | null | undefined, loose?: boolean) => boolean;
/**
* Check if a semver string satisfies a range
*
* @param version - The semver string to check
* @param range - The range to check against
* @param loose - Whether to use loose parsing
* @returns Whether the semver string satisfies the range
*/
declare const satisfiesVersion: (version: string | SemVer | null | undefined, range: string | Range | null | undefined, loose?: boolean) => boolean;
/**
* Check if a string is a valid relative version keyword
*
* @param val - The string to check
* @returns Whether the string is a valid relative version keyword
*/
declare const isRelativeVersionKeyword: (val: string) => val is ReleaseType;
/**
* Derive a new semver version from the current version and a version specifier
*
* @param currentSemverVersion - The current semver version
* @param semverSpecifier - The semver specifier to use
* @param preid - The pre-release identifier to use
* @returns The derived new semver version
*/
declare const deriveNewSemverVersion: (currentSemverVersion: string, semverSpecifier: string, preid?: string) => string;
//#endregion
export { RELEASE_TYPES, ReleaseType, coerceVersion, deriveNewSemverVersion, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, parseVersion, satisfiesVersion };
//# sourceMappingURL=semver-fns.d.cts.map