@stacksjs/launchpad
Version:
Like Homebrew, but faster.
71 lines • 2.66 kB
TypeScript
import type { PackageAlias, PackageDomain, PackageName } from './types';
/**
* Resolves a package name to its canonical domain using ts-pkgx aliases
* with fallback support for common package names
*/
export declare function resolvePackageName(packageName: string): string;
/**
* Gets the latest version for a package
*/
export declare function getLatestVersion(packageName: string): string | null;
/**
* Gets all available versions for a package
*/
export declare function getAvailableVersions(packageName: string): string[];
/**
* Checks if a specific version exists for a package
*/
export declare function isVersionAvailable(packageName: string, version: string): boolean;
/**
* Resolves a version specification to an actual version
* @param packageName - The package name or alias
* @param versionSpec - Version specification (e.g., "latest", "^20", "20.1.0", etc.)
* @returns The resolved version or null if not found
*/
export declare function resolveVersion(packageName: string, versionSpec?: string): string | null;
/**
* Returns all available package aliases from ts-pkgx
*/
export declare function listAvailablePackages(): Array<{ name: PackageAlias, domain: string }>;
/**
* Checks if a package name is a known alias
*/
export declare function isPackageAlias(packageName: string): packageName is PackageAlias;
/**
* Type guard to check if a string is a valid package domain
*/
export declare function isPackageDomain(domain: string): domain is PackageDomain;
/**
* Type guard to check if a string is a valid package name (alias or domain)
*/
export declare function isValidPackageName(name: string): name is PackageName;
/**
* Type-safe function to get all available package aliases
*/
export declare function getAllPackageAliases(): PackageAlias[];
/**
* Type-safe function to get all available package domains
*/
export declare function getAllPackageDomains(): PackageDomain[];
/**
* Type-safe function to get all available package names (aliases + domains)
*/
export declare function getAllPackageNames(): PackageName[];
/**
* Parse a package specification into name and version
* Handles both standard format (package@version) and dependency format (domain^version)
*/
export declare function parsePackageSpec(spec: string): { name: string, version?: string };
/**
* Gets package information including description and available versions
*/
export declare function getPackageInfo(packageName: string): {
name: string
domain: string
description?: string
latestVersion?: string
totalVersions: number
programs?: readonly string[]
dependencies?: readonly string[]
companions?: readonly string[]
} | null;