/** * Babel-based JSX/TSX parser implementation * * This parser uses @babel/parser for full TypeScript and JSX support. * It's more powerful than Acorn but also larger and slightly slower. * Use this when you need TypeScript support or are working with * webpack/other bundlers that don't strip TypeScript first. * * Performance: ~2-4ms per typical component (50-100 lines) * Bundle size: ~500KB (@babel/parser + @babel/types) * * @module @domscribe/transform/parsers/babel/babel-parser */ import { Node, JSXOpeningElement } from '@babel/types'; import { ParserInterface } from '../parser.interface.js'; import { ParseParams, SourceLocation } from '../types.js'; import { BabelParserOptions } from './types.js'; /** * BabelParser implementation for JSX/TSX parsing * * Supports both JavaScript and TypeScript syntax, making it suitable * for webpack and other bundlers that don't pre-strip TypeScript. */ export declare class BabelParser implements ParserInterface { /** * Babel parser plugins to enable */ private readonly plugins; private readonly options; /** * Create a new BabelParser instance * * @param options - Parser configuration * @param options.typescript - Enable TypeScript support (default: true) * @param options.jsx - Enable JSX support (default: true) * @param options.plugins - Additional Babel plugins to enable */ constructor(options?: BabelParserOptions); parse(source: string, params?: ParseParams): Node; findJSXOpeningElements(ast: Node): JSXOpeningElement[]; hasDataDsAttribute(element: JSXOpeningElement): boolean; getLocation(element: JSXOpeningElement): SourceLocation | undefined; getTagName(element: JSXOpeningElement): string; getInsertPosition(element: JSXOpeningElement): number; /** * Get the attribute name as a string * * @param attr - JSX attribute node * @returns Attribute name */ private getAttributeName; /** * Get JSX name as a string (handles identifiers, member expressions, and namespaces) * * @param name - JSX name node * @returns Name as a string */ private getJSXNameAsString; } /** * Create a BabelParser instance with default settings * * Factory function for consistency with other parsers. * * @param options - Parser configuration * @returns BabelParser instance */ export declare function createBabelParser(options?: ConstructorParameters[0]): BabelParser; //# sourceMappingURL=babel.parser.d.ts.map