import { RepositoryConfig, AnalysisResult } from './types.js'; /** * Base class for all analyzers */ declare abstract class BaseAnalyzer { protected config: RepositoryConfig; protected basePath: string; constructor(config: RepositoryConfig); /** * Run the analysis */ abstract analyze(): Promise>; /** * Get the analyzer name */ abstract getName(): string; /** * Resolve path relative to repository root */ protected resolvePath(relativePath: string): string; /** * Get setting value with fallback */ protected getSetting(key: string, defaultValue?: string): string; /** * Get list-like setting value (comma/newline separated). * Example: "useMyQuery, useMyMutation" -> ["useMyQuery", "useMyMutation"] */ protected getListSetting(key: string, defaultValue?: string[]): string[]; /** * Resolve effective GraphQL hook patterns by combining: * - a preset selected by `settings.graphqlHookPreset` (default: "auto") * - user-defined patterns from `settings.graphqlHookPatterns` * * Presets are meant to improve out-of-the-box support for common "production variants" * (Relay/urql/custom wrappers) while keeping false positives low. */ protected getGraphQLHookPatterns(): string[]; /** * Log analysis progress (silent by default, set REPOMAP_VERBOSE=1 to enable) */ protected log(_message: string): void; /** * Log warning (always shown) */ protected warn(message: string): void; /** * Log error (always shown) */ protected error(message: string, error?: Error): void; } /** * Analyzer for Next.js/React pages using @swc/core for fast parsing */ declare class PagesAnalyzer extends BaseAnalyzer { private codegenMap; private tsResolver; private coverage; constructor(config: RepositoryConfig); getName(): string; analyze(): Promise>; /** * Load GraphQL Code Generator mapping from __generated__ files * Dynamically searches for codegen output files */ private loadCodegenMapping; /** * Analyze a single page file using SWC */ private analyzePageFile; /** * Find page files from multiple possible locations */ private findPageFiles; /** * Find routes from SPA (react-router-dom) based projects */ private findSPARoutes; /** * Resolve import path to absolute file path */ private resolveImportPath; /** * Detect the pages root directory from a file path */ private detectPagesRoot; private filePathToRoutePath; private extractRouteParams; /** * Find the name of the default export (function/class declaration) * Returns null if the default export is anonymous or an expression */ private findDefaultExportName; /** * Find page component name from AST */ private findPageComponent; /** * Check if an import source is from the project (not an external package) */ private isProjectImport; /** * Find the main component used in the page's JSX * This is more accurate than using the default export name like "Page" */ private findMainJsxComponent; /** * Extract imports from AST */ private extractImports; /** * Extract layout from page */ private extractLayout; /** * Extract authentication requirements */ private extractAuthRequirement; /** * Extract roles from content */ private extractRolesFromContent; /** * Extract permissions from content */ private extractPermissions; /** * Extract data fetching operations using unified GraphQL context extraction * Uses shared utilities for consistent operation name resolution */ private extractDataFetching; /** * Analyze Apollo client direct calls: client.query({ query: MyQuery }) */ private analyzeClientDirectCall; /** * Extract Document imports from AST * Tracks imports like: import { GetUserDocument } from '__generated__/graphql' */ private extractDocumentImports; /** * Extract variable assignments that reference Documents or gql() calls * Tracks: const doc = GetUserDocument * Tracks: const Query = gql(`query GetFollowPage { ... }`) */ private extractVariableAssignments; /** * Extract operation name from gql() function call */ private extractOperationNameFromGqlCall; /** * Analyze a GraphQL hook call expression * Supports: useQuery, useMutation, useLazyQuery, useSuspenseQuery, etc. */ private analyzeGraphQLHookCall; /** * Extract type generic from hook call - useQuery */ private extractTypeGeneric; /** * Extract operation name from function argument * Supports: Identifier, MemberExpression, variable references, graphql() calls */ private extractOperationFromArgument; /** * Extract variables from hook call options */ private extractVariablesFromCall; /** * Extract SSR data fetching (getServerSideProps) */ private extractSSRDataFetching; /** * Extract SSR queries from a node (getServerSideProps body) */ private extractSSRQueriesFromNode; /** * Extract operation name from client.query({ query: ... }) call */ private extractQueryFromClientCall; /** * Extract navigation info */ private extractNavigation; /** * Extract linked pages from Link components */ private extractLinkedPages; /** * Extract steps from wizard/stepper patterns */ private extractSteps; /** * Traverse AST nodes recursively */ private traverseNode; /** * Get callee name from call expression */ private getCalleeName; /** * Get JSX tag name */ private getJsxTagName; /** * Get JSX attribute value */ private getJsxAttribute; } /** * Analyzer for GraphQL operations * Uses @swc/core for fast parsing */ declare class GraphQLAnalyzer extends BaseAnalyzer { private coverage; constructor(config: RepositoryConfig); getName(): string; analyze(): Promise>; /** * Deduplicate operations by name, keeping the first occurrence */ private deduplicateOperations; /** * Analyze GraphQL Code Generator output files * Supports multiple codegen patterns: client preset, near-operation-file, etc. */ private analyzeCodegenGenerated; /** * Extract type string from AST type node */ private extractTypeFromAst; /** * Extract fields from AST selection set */ private extractFieldsFromAst; /** * Extract fragment references from AST */ private extractFragmentReferencesFromAst; /** * Infer return type from AST definition */ private inferReturnTypeFromAst; private analyzeGraphQLFiles; private analyzeInlineGraphQL; /** * Analyze a parsed module for GraphQL operations */ private analyzeModuleForGraphQL; /** * Traverse AST nodes with variable context tracking */ private traverseNodeWithContext; /** * Get tag name from tagged template expression */ private getTagName; /** * Get callee name from call expression */ private getCalleeName; /** * Extract content from template literal */ private extractTemplateContent; /** * Extract GraphQL content from expression (handles various patterns) */ private extractGraphQLFromExpression; private extractOperationsFromDocument; private extractOperation; private extractFields; private extractVariables; private typeNodeToString; private extractFragmentReferences; private inferReturnType; private findOperationUsage; /** * Find operation usage using AST analysis for accurate type generic extraction */ private findUsageWithAST; /** * Traverse AST nodes for usage analysis */ private traverseNodeForUsage; /** * Get callee name for usage tracking */ private getCalleeNameForUsage; /** * Extract type generic from hook call */ private extractTypeGenericFromCall; /** * Extract first argument name from call */ private extractFirstArgName; } /** * Analyzer for data flow patterns using @swc/core for fast parsing */ declare class DataFlowAnalyzer extends BaseAnalyzer { private componentCache; private coverage; constructor(config: RepositoryConfig); getName(): string; analyze(): Promise>; private analyzeComponents; private analyzeComponentFile; private extractImports; private isComponentName; private extractComponentInfo; /** * Extract hooks used in component using AST-based analysis * Uses parseSync for accurate detection instead of regex */ private extractHooksUsed; /** * Extract Document imports from AST for operation name resolution */ private extractDocumentImportsFromAst; /** * Extract variable -> operation name mapping from gql() calls * e.g., const Query = gql(`query GetFollowPage { ... }`) -> { Query: "GetFollowPage" } */ private extractVariableOperationMap; /** * Extract operation name from gql() function call */ private extractOperationNameFromGqlCall; /** * Traverse AST to find hook calls */ private traverseForHooks; /** * Analyze a hook call expression */ private analyzeHookCall; /** * Check if a hook call has GraphQL-related arguments * This verifies the hook is actually used for GraphQL, not just has a similar name */ private hasGraphQLArgument; /** * Get callee name from call expression node */ private getCalleeNameFromNode; /** * Extract operation name from hook call arguments and type generics */ private extractOperationNameFromCall; /** * Extract context name from useContext call */ private extractContextName; /** * Fallback regex-based hook extraction */ private extractHooksWithRegex; private extractStateManagement; private buildDependencyGraph; private analyzeDataFlows; private analyzeContextFlows; private analyzeApolloFlows; private analyzePropDrilling; } export { BaseAnalyzer as B, DataFlowAnalyzer as D, GraphQLAnalyzer as G, PagesAnalyzer as P };