/** * @angular-modernizer/plugin-angular - Container and Presentational Components Orchestrator * * Orchestrator that converts Angular components with service dependencies * into presentational components using @Input/@Output decorators. * * Philosophy: "Thin Rule, Thick Orchestrator" * - The orchestrator contains all business logic * - The rule is a minimal protocol wrapper * - Complex AST manipulation happens here */ import type { TransformContext } from '@angular-modernizer/plugin-system'; import type { PublicApi } from '@angular-modernizer/api'; /** * Orchestrator for transforming components into presentational components. * * @remarks * This orchestrator handles the complex logic for: * - Detecting components with service dependencies * - Removing service dependencies from constructors * - Adding @Input properties for data * - Adding @Output EventEmitters for user interactions * - Converting service-calling methods to event-emitting methods * - Updating imports * * The orchestrator uses ts-morph for AST manipulation and ServicePatternRecognizer * for centralized service detection, following the existing pattern of other * transformation orchestrators. * * MIGRATION NOTE: Updated to use ServicePatternRecognizer instead of hardcoded suffixes. * - Replaced 120-line serviceSuffixes array with centralized service detection * - Uses confidence-based filtering for more accurate service identification * - Code reduction: ~120 lines removed * * @public */ export declare class ContainerPresentationalOrchestrator { /** * Run the container/presentational transformation on the given context. * * @param context - Transform context with source file and project access * * @public */ run(context: TransformContext): void; /** * Check if a class is an Angular component. * * @param classDecl - The class declaration to check * @returns true if the class has a @Component decorator * * @private */ private isAngularComponent; /** * Check if a component needs transformation. * * @param classDecl - The component class declaration * @param context - Transform context with ServicePatternRecognizer * @returns true if the component has service dependencies * * @private */ private needsTransformation; /** * Check if a component has service dependencies. * * @param classDecl - The component class declaration * @param context - Transform context with ServicePatternRecognizer * @returns true if the constructor has service parameters * * @private */ private hasServiceDependencies; /** * Check if a type name represents a service. * * Uses ServicePatternRecognizer for centralized service detection. * * @param typeName - The type name to check * @param context - Transform context with access to ServicePatternRecognizer * @returns true if the type matches service patterns * * @private */ private isServiceType; /** * Analyze and extract service dependencies from a component. * * @param classDecl - The component class declaration * @param context - Transform context with ServicePatternRecognizer * @returns Array of service dependencies * * @private */ private analyzeServiceDependencies; /** * Convert a component to presentational by removing services and adding @Input/@Output. * * @param classDecl - The component class declaration * @param context - Transform context * * @private */ private convertToPresentational; /** * Identify properties that should be converted to @Input. * * @param classDecl - The component class declaration * @param serviceDeps - Service dependencies * @returns Array of data properties * * @private */ private identifyDataProperties; /** * Identify methods that should be converted to event emitters. * * @param classDecl - The component class declaration * @param serviceDeps - Service dependencies * @returns Array of event emitters to create * * @private */ private identifyEventEmitters; /** * Check if a method name is a lifecycle hook. * * @param methodName - The method name to check * @returns true if it's a lifecycle hook * * @private */ private isLifecycleHook; /** * Generate an event name from a method name. * * @param methodName - The original method name * @returns Event name (e.g., 'deleteUser' -> 'userDelete') * * @private */ private generateEventName; /** * Infer the event type from a method. * * @param method - The method declaration * @returns Event type (default: 'void') * * @private */ private inferEventType; /** * Remove service dependencies from the constructor. * * @param classDecl - The component class declaration * @param serviceDeps - Service dependencies to remove * * @private */ private removeServiceDependencies; /** * Add @Input decorators to data properties. * * @param classDecl - The component class declaration * @param dataProperties - Properties to add @Input to * * @private */ private addInputDecorators; /** * Add @Output EventEmitter properties. * * @param classDecl - The component class declaration * @param eventEmitters - Event emitters to add * * @private */ private addOutputEventEmitters; /** * Convert methods to emit events instead of calling services. * * @param classDecl - The component class declaration * @param eventEmitters - Event emitters for methods * * @private */ private convertMethodsToEmitEvents; /** * Update imports to include Input/Output/EventEmitter and remove unused services. * * @param sourceFile - The source file * @param context - Transform context * * @private */ private updateImports; } //# sourceMappingURL=container-presentational-orchestrator.d.ts.map