UNPKG

@o3r/components

Version:

This module contains component-related features (Component replacement, CMS compatibility, helpers, pipes, debugging developer tools...) It comes with an integrated ng builder to help you generate components compatible with Otter features (CMS integration

81 lines 2.86 kB
import { logging } from '@angular-devkit/core'; import * as ts from 'typescript'; import type { ComponentStructure } from '@o3r/components'; /** Information extracted from a component file */ export interface ComponentInformation { /** Name of the component */ name: string; /** Name of the configuration used by the component */ configName?: string; /** Path to the configuration file used */ configPath?: string; /** Determine if the component uses the configuration dynamically */ isDynamicConfig: boolean; /** Name of the context used by the component */ contextName?: string; /** Path to the context file used */ contextPath?: string; /** Type of the component */ type: ComponentStructure; /** Selector of the component */ selector?: string; /** Determine if the component is activating a ruleset */ linkableToRuleset: boolean; /** List of localization keys used in the component */ localizationKeys?: string[]; } /** * Component class extractor. */ export declare class ComponentClassExtractor { source: ts.SourceFile; private readonly logger; filePath: string; /** List of interfaces that a configurable component can implement */ readonly CONFIGURABLE_INTERFACES: string[]; /** * Component class extractor constructor * @param source Typescript SourceFile node of the file * @param logger Logger * @param filePath Path to the file to extract the data from */ constructor(source: ts.SourceFile, logger: logging.LoggerApi, filePath: string); /** * Indicates if the given decorator is a component decorator. * @param decoratorNode The decorator node to test */ private isComponentDecorator; /** * Get the component type from the given decorator node. * @param decoratorNode The decorator node to get the component type from */ private getComponentType; /** * Get the component selector from the given decorator node. * @param decoratorNode The decorator node to get the component selector from */ private getComponentSelector; /** * Sanitize component type by removing extra quotes * Example: "'Page'" becomes 'Page' * @param type * @private */ private sanitizeComponentType; private getComponentStructure; /** * Extract component information of a given class node * @param classNode Typescript node of a class */ private getComponentInformation; /** * Get the file path of the given class from the import * @param className Name of the class to find in the imports */ private getFilePath; /** * Extract the component data of a typescript file */ extract(): ComponentInformation | undefined; } //# sourceMappingURL=component-class.extractor.d.ts.map