import { aliases } from './packages/aliases';
import type { FetchProjectsOptions, PackageFetchOptions, PkgxPackage, ProjectFolder } from './types';
export declare function savePackageAsTypeScript(outputDir: string, domainName: string, packageInfo: PkgxPackage): string;
/**
 * Removes generated .ts files from the output directory that were not part of the
 * current fetch run. Prevents stale generated files from accumulating.
 */
export declare function cleanStaleOutputFiles(outputDir: string, savedPackages: string[]): string[];
/**
 * Checks if a cached package exists and is still valid
 * @param packageName Name of the package to check
 * @param options Cache options
 * @returns The cached package data if valid, null otherwise
 */
export declare function getValidCachedPackage(packageName: string, options?: PackageFetchOptions): { packageInfo: PkgxPackage, filePath: string } | null;
/**
 * Saves package data to the cache
 * @param packageName Name of the package
 * @param packageInfo Package data to cache
 * @param options Cache options
 * @returns Path to the cached file
 */
export declare function saveToCacheAndOutput(packageName: string, packageInfo: PkgxPackage, options?: PackageFetchOptions): { cachePath: string, outputPath: string };
/**
 * Ensures all browser resources are properly closed
 */
export declare function cleanupBrowserResources(): Promise<void>;
/**
 * Fetches project folder names from the pkgxdev pantry repository using GitHub API
 * @param options Optional configuration
 * @returns Promise resolving to an array of project folders
 */
export declare function fetchPkgxProjects(options?: FetchProjectsOptions): Promise<ProjectFolder[]>;
/**
 * Fetches package information from pkgx.dev using ts-web-scraper
 * @param packageName The name of the package to fetch
 * @param options Optional configuration
 * @returns Promise resolving to package information with original name and full domain name
 */
export declare function fetchPantryPackage(packageName: string, options?: PackageFetchOptions): Promise<{ packageInfo: PkgxPackage, originalName: string, fullDomainName: string }>;
/**
 * Sets up process exit handlers to ensure proper cleanup
 */
export declare function setupCleanupHandlers(): void;
// Start a periodic cleanup task
export declare function startPeriodicCleanup(): void;
/**
 * Fetches and saves all packages using the local pantry as source of truth
 */
export declare function fetchAndSaveAllPackages(options?: PackageFetchOptions): Promise<string[]>;
/**
 * Fetch and save a single package with improved handling for problematic packages
 * @param packageName The name of the package to fetch
 * @param outputDir Directory to save package data
 * @param timeout Timeout in milliseconds
 * @param saveAsJson Whether to save as JSON (true) or TypeScript (false)
 * @param retryNumber Current retry attempt number
 * @param maxRetries Maximum number of retry attempts
 * @param debug Whether to enable debug mode
 * @param options Additional options
 * @returns Promise with result information
 */
export declare function fetchAndSavePackage(packageName: string, outputDir: string, timeout: number, saveAsJson?: boolean, retryNumber?: number, maxRetries?: number, debug?: boolean, options?: PackageFetchOptions): Promise<{ success: boolean, fullDomainName?: string, aliases?: string[], filePath?: string }>;
/**
 * Check if a package has meaningful data and should be saved
 */
/**
 * Scans the local pantry directory and extracts all available packages
 * @param pantryDir Path to the pantry directory (default: 'src/pantry')
 * @returns Array of package names found in the pantry
 */
export declare function scanPantryPackages(pantryDir?: string): Promise<string[]>;
/**
 * Reads package.yml file and extracts basic package information
 * @param packageName The package name (e.g., 'github.com/user/repo')
 * @param pantryDir Path to the pantry directory
 * @returns Basic package information from package.yml
 */
export declare function readPantryPackageInfo(packageName: string, pantryDir?: string): Promise<Partial<PkgxPackage> | null>;
/**
 * Combines pantry package data with additional metadata from pkgx.dev
 * @param packageName The package name (e.g., 'github.com/user/repo')
 * @param options Fetch options including pantry directory
 * @returns Complete package information
 */
export declare function fetchPantryPackageWithMetadata(packageName: string, options?: PackageFetchOptions): Promise<{ packageInfo: PkgxPackage, originalName: string, fullDomainName: string } | null>;
// Lazy import of utils functions to avoid module loading issues
// Legacy browser references - keeping for backwards compatibility but not used
declare type Browser = any;
