UNPKG

@stacksjs/launchpad

Version:
97 lines 3.59 kB
import { aliases, packages } from 'ts-pkgx'; import { Path } from './path'; /** * Get the installation prefix */ export declare function install_prefix(): Path; /** * Resolves a package name to its canonical domain using ts-pkgx aliases */ 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 */ 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; /** * Main installation function with type-safe package specifications */ export declare function install(packages: PackageSpec | PackageSpec[], basePath?: string): Promise<string[]>; /** * Distribution configuration */ export declare const DISTRIBUTION_CONFIG: { baseUrl: 'https://dist.pkgx.dev'; // Future: unknown }; // Extract all package alias names from ts-pkgx export type PackageAlias = keyof typeof aliases // Extract all package domain names from ts-pkgx packages export type PackageDomain = keyof typeof packages // Union type of all valid package identifiers (aliases + domains) export type PackageName = PackageAlias | PackageDomain // Type for package with optional version (allowing string for flexibility) export type PackageSpec = string // Supported distribution formats export type SupportedFormat = 'tar.xz' | 'tar.gz' export type SupportedPlatform = 'darwin' | 'linux' | 'windows' export type SupportedArchitecture = 'x86_64' | 'aarch64' | 'armv7l'