import type { CustomElementDeclaration, JavaScriptModule, Package } from 'custom-elements-manifest'; import { ComponentData } from './component-meta.types'; export type { ComponentData }; export interface ReExportedPrimitive { primitiveName: string; primitiveClass: string; reExportModule: string; reExportPath: string; } /** * Parses the Custom Elements Manifest and extracts component data */ export declare class CemParser { /** * Loads and parses the CEM file */ static loadManifest(cemPath?: string): Promise; /** * Extracts modules that contain web components */ static getComponentModules(manifest: Package): JavaScriptModule[]; /** * Extracts component data from a JavaScriptModule declaration */ static extractComponentData(mod: JavaScriptModule, declaration: CustomElementDeclaration): ComponentData; /** * Checks if a component inherits from a specific base class */ private static inheritsMembersFrom; /** * Checks if a component is a form control by looking for properties inherited from GdsFormControlElement */ private static isFormControl; /** * Checks if a component is an icon by looking for properties inherited from GdsIcon */ private static isIconComponent; /** * Checks if a component supports routing by looking for an 'href' property */ private static isLinkComponent; /** * Checks if a component is a checkbox by checking the tag name * Checkboxes need special handling to work with boolean checked state instead of string values */ private static isCheckboxComponent; /** * Extracts properties */ private static extractProperties; /** * Extracts events */ private static extractEvents; /** * Extracts slot information */ private static extractSlots; /** * Extracts public methods */ private static extractMethods; /** * Extracts subcomponent information from custom @subcomponent JSDoc tags */ private static extractSubcomponents; /** * Maps CEM event types to TypeScript types */ private static mapEventType; /** * Finds primitives that are re-exported by component modules. * * Primitives (like GdsOption, GdsMenuHeading) are internal implementation details * but some are re-exported by specific components for public use. For example: * - GdsOption is re-exported by GdsDropdown * - GdsMenuHeading is re-exported by GdsContextMenu * * This method identifies these re-exports and returns the component file path * (not the primitive path) so imports point to the re-exporting component. * * Design choices: * - Only considers *.component.ts files, not index.ts files, to ensure imports * point to the actual component file (e.g., dropdown.component.js not index.js) * because index.ts paths are not tree-shakable * - First occurrence wins when a primitive is re-exported by multiple components */ static findReExportedPrimitives(manifest: Package): ReExportedPrimitive[]; /** * Parses all components from the manifest */ static parseAllComponents(manifestPath?: string): Promise<{ components: ComponentData[]; reExportedPrimitives: ReExportedPrimitive[]; }>; /** * Parses a single component by tag name */ static parseComponent(tagName: string, manifestPath?: string): Promise; }