@dbs-portal/core-module-registry
Version:
Core module registry system for automatic module discovery and registration
96 lines • 2.65 kB
TypeScript
/**
* Browser-compatible glob utilities
*
* Provides glob pattern matching that works in browser environments
* while maintaining compatibility with the glob library API.
*/
export interface GlobOptions {
cwd?: string;
onlyDirectories?: boolean;
onlyFiles?: boolean;
ignore?: string[];
dot?: boolean;
absolute?: boolean;
}
export interface GlobResult {
found: string[];
errors: Error[];
}
declare class BrowserGlob {
private fileCache;
private directoryCache;
/**
* Main glob function - browser compatible
*/
glob(pattern: string | string[], options?: GlobOptions): Promise<string[]>;
/**
* Synchronous glob (limited functionality in browser)
*/
globSync(pattern: string | string[], options?: GlobOptions): string[];
/**
* Match a single pattern
*/
private matchPattern;
/**
* Match a single pattern synchronously
*/
private matchPatternSync;
/**
* Filter files by glob pattern
*/
private filterByPattern;
/**
* Convert glob pattern to regex
*/
private globToRegex;
/**
* Get all cached files for a directory
*/
private getAllCachedFiles;
/**
* Apply additional filters
*/
private applyFilters;
/**
* Check if path is a directory
*/
private isDirectory;
/**
* Check if file is a dot file
*/
private isDotFile;
/**
* Check if file matches ignore patterns
*/
private matchesIgnorePattern;
/**
* Make path relative to cwd
*/
private makeRelative;
/**
* Pre-load file list for a directory (for browser usage)
*/
preloadDirectory(path: string, files: string[]): void;
/**
* Pre-load file content (for browser usage)
*/
preloadFile(path: string): void;
/**
* Set mock directory structure (for testing)
*/
setMockStructure(structure: Record<string, string[]>): void;
/**
* Clear all cached data
*/
clearCache(): void;
}
declare const browserGlob: BrowserGlob;
export declare const glob: (pattern: string | string[], options?: GlobOptions) => Promise<string[]>;
export declare const globSync: (pattern: string | string[], options?: GlobOptions) => string[];
export declare const preloadDirectory: (path: string, files: string[]) => void;
export declare const preloadFile: (path: string) => void;
export declare const setMockStructure: (structure: Record<string, string[]>) => void;
export declare const clearCache: () => void;
export default browserGlob;
export { BrowserGlob };
//# sourceMappingURL=browser-glob.d.ts.map