UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

74 lines (73 loc) 2.53 kB
import ts from "typescript"; import { ComponentRelation } from "../../../types"; /** * Utility functions for identifying and processing components for SEO analysis */ export declare class ComponentUtils { /** * Identifies if a component is a page component for SEO analysis */ static isPageComponent(component: ComponentRelation): boolean; /** * Identifies if a component is an App Router special file */ static isAppRouterSpecialFile(component: ComponentRelation): { isSpecialFile: boolean; fileType: "layout" | "loading" | "error" | "not-found" | "global-error" | "template" | null; routeSegment: string; }; /** * Identifies if a component is in a route group */ static getRouteGroupInfo(component: ComponentRelation): { isInRouteGroup: boolean; routeGroupName: string | null; routeGroupPath: string | null; }; /** * Identifies if a component is a parallel route */ static getParallelRouteInfo(component: ComponentRelation): { isParallelRoute: boolean; slotName: string | null; parentRoute: string | null; isDefaultSlot: boolean; }; /** * Checks if a component has metadata that could conflict with parent layouts */ static hasMetadataConflicts(component: ComponentRelation): { hasConflicts: boolean; conflictingFields: string[]; }; /** * Determines the nesting level of a layout in the App Router hierarchy */ static getLayoutNestingLevel(component: ComponentRelation): number; /** * Gets the parent layout path for a given component */ static getParentLayoutPath(component: ComponentRelation): string | null; private static isUIComponentPath; private static matchesPagePattern; /** * Gets a source file from component content */ static getSourceFile(component: ComponentRelation): ts.SourceFile | null; /** * Checks if a filename matches page component patterns */ static isPageFilename(filePath: string): boolean; /** * Extracts metadata object from a page component's source file */ static extractMetadataObject(sourceFile: ts.SourceFile): ts.ObjectLiteralExpression | null; /** * Checks if a node is a generateMetadata function */ static isGenerateMetadataFunction(node: ts.Node): boolean; /** * Extracts page name from file path */ static extractPageName(filePath: string): string; }