UNPKG

ts-pkgx

Version:

A library & CLI for managing packages

107 lines 3.31 kB
import type { Dependency, DependencyResolutionResult, DependencyResolverOptions } from './dependency-resolver'; export type { Dependency, DependencyResolutionResult, DependencyResolverOptions }; /** * Main API function for Launchpad to resolve dependencies from a file * * @param filePath Path to dependency file (deps.yaml, pkgx.yaml, etc.) * @param options Resolution options * @returns Promise with install information * * @example * ```typescript * import { resolveDependencies } from 'ts-pkgx/launchpad' * * const result = await resolveDependencies('./deps.yaml', { * targetOs: 'darwin', * includeOsSpecific: true * }) * * console.log(`Installing ${result.totalCount} packages...`) * console.log(result.launchpadCommand) * * // Install each package * for (const pkg of result.packages) { * await launchpad.install(pkg.name, pkg.version) * } * ``` */ export declare function resolveDependencies(filePath: string, options?: LaunchpadResolverOptions): Promise<LaunchpadInstallResult>; /** * Resolve dependencies from a YAML string directly * * @param yamlContent YAML content as string * @param options Resolution options * @returns Promise with install information * * @example * ```typescript * const yamlContent = ` * global: true * dependencies: * bun.sh: ^1.2.16 * gnu.org/grep: ^3.12.0 * ` * * const result = await resolveDependenciesFromYaml(yamlContent) * console.log(result.packages) // Array of resolved packages * ``` */ export declare function resolveDependenciesFromYaml(yamlContent: string, options?: LaunchpadResolverOptions): Promise<LaunchpadInstallResult>; /** * Resolve transitive dependencies for a single package * * @param packageName Package domain name (e.g., 'bun.sh', 'gnu.org/grep') * @param options Resolution options * @returns Promise with all transitive dependencies * * @example * ```typescript * const deps = await resolvePackageDependencies('gnu.org/grep') * console.log(deps) // ['pcre.org/v2@10.44.0', 'zlib.net@1.3.1', ...] * ``` */ export declare function resolvePackageDependencies(packageName: string, options?: LaunchpadResolverOptions): Promise<LaunchpadPackage[]>; /** * Get install command for a list of packages * * @param packages Array of package names (should be direct deps only) * @param format Command format ('pkgx' or 'launchpad') * @returns Install command string * * @note Both pkgx and launchpad auto-resolve transitive dependencies */ export declare function getInstallCommand(packages: string[], format?: 'pkgx' | 'launchpad'): string; /** * Simplified package info for Launchpad */ export declare interface LaunchpadPackage { name: string version: string constraint: string isOsSpecific: boolean os?: 'linux' | 'darwin' | 'windows' } /** * Result returned by Launchpad API */ export declare interface LaunchpadInstallResult { packages: LaunchpadPackage[] directCount: number totalCount: number conflicts: Array<{ package: string versions: string[] resolved: string }> pkgxCommand: string launchpadCommand: string } /** * Options for Launchpad dependency resolution */ export declare interface LaunchpadResolverOptions { targetOs?: 'linux' | 'darwin' | 'windows' includeOsSpecific?: boolean maxDepth?: number verbose?: boolean }