/** * Platform-Agnostic Module Loader * * Provides a unified interface for loading platform-specific modules * (Node.js vs Browser) with automatic fallbacks and error handling. */ /** * Path utilities interface */ export interface PlatformPath { resolve(...paths: string[]): string; join(...paths: string[]): string; dirname(path: string): string; basename(path: string, ext?: string): string; extname(path: string): string; relative(from: string, to: string): string; isAbsolute(path: string): boolean; normalize(path: string): string; sep: string; delimiter: string; } /** * File system utilities interface */ export interface PlatformFs { readFile(path: string, encoding?: string): Promise; writeFile(path: string, data: string, encoding?: string): Promise; access(path: string): Promise; stat(path: string): Promise; readdir(path: string): Promise; mkdir(path: string, options?: any): Promise; exists(path: string): Promise; } /** * Glob utilities interface */ export interface PlatformGlob { glob(pattern: string | string[], options?: any): Promise; globSync(pattern: string | string[], options?: any): string[]; } /** * Load platform-specific path utilities */ export declare function loadPath(): Promise; /** * Load platform-specific file system utilities */ export declare function loadFs(): Promise; /** * Load platform-specific glob utilities */ export declare function loadGlob(): Promise; /** * Get cached path utilities */ export declare const getPath: () => Promise; /** * Get cached file system utilities */ export declare const getFs: () => Promise; /** * Get cached glob utilities */ export declare const getGlob: () => Promise; /** * Clear module cache (useful for testing) */ export declare const clearModuleCache: () => void; /** * Initialize all platform modules */ export declare function initializePlatformModules(): Promise<{ path: PlatformPath; fs: PlatformFs; glob: PlatformGlob; }>; /** * Preload browser modules with mock data (for browser usage) */ export declare function preloadBrowserModules(mockData: { files?: Record; directories?: Record; structure?: Record; }): Promise; /** * Get platform-specific module information */ export declare function getPlatformInfo(): { platform: string; canReadFiles: boolean; canScanDirectories: boolean; canUseGlob: boolean; requiresPreloading: boolean; features: { fileSystem: boolean; glob: boolean; dynamicImport: boolean; fetch: boolean; }; }; /** * Create platform-specific error with helpful context */ export declare function createPlatformError(operation: string, originalError: Error, suggestions?: string[]): Error; declare const _default: { getPath: () => Promise; getFs: () => Promise; getGlob: () => Promise; initializePlatformModules: typeof initializePlatformModules; preloadBrowserModules: typeof preloadBrowserModules; getPlatformInfo: typeof getPlatformInfo; createPlatformError: typeof createPlatformError; clearModuleCache: () => void; }; export default _default; //# sourceMappingURL=platform-modules.d.ts.map