UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

122 lines (121 loc) 3.41 kB
import ts from "typescript"; import { ErrorHandler } from "../utils/errorHandler"; /** * Filter configuration options */ interface FilterConfig { enableCommonFilter: boolean; enableFrameworkSpecificFilters: boolean; enableCustomFilters: boolean; enableNodeSizeFilters: boolean; minFunctionSize: number; maxFunctionSize: number; excludeTestFiles: boolean; excludeNodeModules: boolean; customExcludePatterns: string[]; customIncludePatterns: string[]; } /** * Filter result with reasoning */ interface FilterResult { shouldInclude: boolean; reason: string; confidence: number; appliedFilters: string[]; } /** * Extended filter class for determining which functions to include in analysis * Wraps the common FunctionFilter class and adds analyzer-specific extensions */ export declare class FunctionFilter { private commonFilter; private errorHandler; private config; constructor(errorHandler?: ErrorHandler, config?: Partial<FilterConfig>); /** * Enhanced function inclusion check with detailed filtering * @param node The function AST node * @param functionName The name of the function * @param filePath Optional file path for context * @returns boolean indicating whether the function should be included */ shouldIncludeFunction(node: ts.Node, functionName: string, filePath?: string): boolean; /** * Detailed function inclusion check with reasoning * @param node The function AST node * @param functionName The name of the function * @param filePath Optional file path for context * @returns Detailed filter result */ shouldIncludeFunctionDetailed(node: ts.Node, functionName: string, filePath?: string): FilterResult; /** * Applies basic validation filters */ private applyValidationFilters; /** * Applies file-level filters */ private applyFileFilters; /** * Applies common filter logic with error handling */ private applyCommonFilter; /** * Applies framework-specific filters */ private applyFrameworkFilters; /** * Applies node size filters */ private applyNodeSizeFilters; /** * Applies custom user-defined filters */ private applyCustomFilters; /** * Checks if file is a test file */ private isTestFile; /** * Checks if file is in node_modules */ private isNodeModulesFile; /** * Checks if function is a Next.js API route function */ private isNextJSApiFunction; /** * Checks if function is a Next.js page function */ private isNextJSPageFunction; /** * Checks if function is a test framework function */ private isTestFrameworkFunction; /** * Checks if function is a Storybook function */ private isStorybookFunction; /** * Matches a string against a pattern (supports wildcards) */ private matchesPattern; /** * Updates filter configuration */ updateConfig(newConfig: Partial<FilterConfig>): void; /** * Gets current filter configuration */ getConfig(): FilterConfig; /** * Gets filter statistics */ getFilterStats(): { totalFiltersApplied: number; filtersByType: Record<string, number>; averageConfidence: number; }; } export {};