/** * .scampiignore parser with gitignore-compatible syntax * * Supports: * - Comments (#) * - Blank lines (ignored) * - Directory patterns (ending with /) * - Wildcard patterns (*, **, ?) * - Negation patterns (!) * - Character classes ([abc], [a-z]) */ /** * Container for ignore patterns with matching logic */ export declare class IgnoreFilter { private patterns; /** * Add patterns from a string (file contents) */ add(content: string): this; /** * Add a single pattern */ addPattern(pattern: string): this; /** * Add multiple patterns */ addPatterns(patterns: readonly string[]): this; /** * Check if a path should be ignored * @param relativePath - Path relative to the ignore file root (use forward slashes) * @param isDirectory - Whether the path is a directory */ ignores(relativePath: string, isDirectory?: boolean): boolean; /** * Filter an array of paths, returning only non-ignored ones * @param paths - Array of relative paths * @param isDirectoryFn - Function to determine if a path is a directory */ filter(paths: string[], isDirectoryFn?: (p: string) => boolean): string[]; /** * Parse a single line from an ignore file */ private parseLine; /** * Convert a gitignore pattern to a regular expression */ private patternToRegex; /** * Escape special characters inside a character class */ private escapeRegexClass; /** * Check if a path matches a pattern */ private matchPattern; /** * Get the number of patterns loaded */ get patternCount(): number; } /** * Load ignore patterns from a directory * * Looks for .scampiignore in the specified directory and merges * with default ignore patterns. * * @param directory - Directory to look for .scampiignore * @returns IgnoreFilter instance with loaded patterns * * @example * ```ts * const filter = await loadIgnorePatterns('/path/to/project'); * * // Check if a file should be ignored * if (filter.ignores('node_modules/package.json')) { * console.log('File is ignored'); * } * * // Filter an array of paths * const filtered = filter.filter(['src/index.ts', 'node_modules/pkg/index.js']); * ``` */ export declare function loadIgnorePatterns(directory: string): Promise; /** * Synchronous version of loadIgnorePatterns */ export declare function loadIgnorePatternsSync(directory: string): IgnoreFilter; /** * Check if a path should be ignored based on patterns * * Convenience function for one-off checks. For multiple checks, * use loadIgnorePatterns() and the IgnoreFilter methods directly. * * @param relativePath - Path relative to project root * @param patterns - Array of gitignore-style patterns * @param isDirectory - Whether the path is a directory * @returns true if the path should be ignored * * @example * ```ts * const patterns = ['node_modules', '*.log', '!important.log']; * * shouldIgnorePath('node_modules/pkg', patterns, true); // true * shouldIgnorePath('src/index.ts', patterns, false); // false * shouldIgnorePath('debug.log', patterns, false); // true * shouldIgnorePath('important.log', patterns, false); // false (negated) * ``` */ export declare function shouldIgnorePath(relativePath: string, patterns: readonly string[], isDirectory?: boolean): boolean; /** * Create an IgnoreFilter from an array of patterns * * @param patterns - Array of gitignore-style patterns * @returns IgnoreFilter instance */ export declare function createIgnoreFilter(patterns: readonly string[]): IgnoreFilter; /** * Default patterns used when no .scampiignore is found * Exported for reference and customization */ export declare const DEFAULT_IGNORE_PATTERNS: readonly string[]; //# sourceMappingURL=ignore.d.ts.map