/** * Low-level AST helpers shared by every extractor. * * These operate purely on semantics (return types, call expressions, JSX * presence) — never on file paths or folder names — so the tool works in * poorly organized repos. */ import { Node, type ArrowFunction, type FunctionDeclaration, type FunctionExpression, type SourceFile, type Type } from 'ts-morph'; import type { ExportType, ParamInfo, SourceLocation } from '../core/types'; export type FunctionLike = FunctionDeclaration | FunctionExpression | ArrowFunction; export declare function makeId(relPath: string, name: string): string; export declare function isPascalCase(name: string): boolean; /** `useFoo`, but not just `use`. */ export declare function isHookName(name: string): boolean; export declare function location(node: Node, relPath: string): SourceLocation; export declare function getLeadingJsDoc(node: Node): string | undefined; /** Determine how a declaration is exported. */ export declare function getExportType(node: Node): ExportType; /** True if the function's body contains JSX anywhere. */ export declare function returnsJSX(fn: FunctionLike): boolean; /** Extract parameter info from a function-like node. */ export declare function getParams(fn: FunctionLike): ParamInfo[]; export declare function getReturnType(fn: FunctionLike): string; /** Render a type to a readable string, guarding against huge/circular types. */ export declare function safeType(type: Type): string; /** Collect names of JSX tags rendered inside a node (component references). */ export declare function getRenderedComponents(node: Node): string[]; /** Collect names of every call expression callee (for hook/util detection). */ export declare function getCalledIdentifiers(node: Node): string[]; export declare function getName(node: Node): string | undefined; /** The initializer of `const Foo = ` unwrapped past memo()/forwardRef(). */ export declare function unwrapHocCalls(node: Node): { inner: Node; hoc: string[]; }; /** All exported declarations in a file with name + node, including re-exports. */ export declare function getExportedDeclarations(file: SourceFile): Array<{ name: string; node: Node; }>;