import type { Binding, NodePath } from '@babel/traverse'; import * as t from '@babel/types'; import { type ProcessorContext } from './attribute-processor.js'; import { VARIABLES } from './config.js'; export type Values = T[keyof T]; export declare const isComponent: (tagName: string) => boolean; export declare const getProgramFromPath: (path: NodePath) => t.Program; export declare const getPathFilename: (path: NodePath) => string; export declare const getPathSourceCode: (path: NodePath) => string; /** * Contains utility methods for retrieving and manipulating node paths in Babel ASTs. */ export declare class Ensure { static findProgramPathFromNodePath(path: NodePath): NodePath; static getProgramPathFromFile(filePath: string): NodePath | undefined; static import(importSource: (value: string) => boolean, importName: (value: string) => boolean, createImport: () => t.ImportDeclaration, program: t.Program, path: NodePath): void; static getNodePath(node: T, path: NodePath): NodePath | undefined; static getClosestStatementPath(path: NodePath): NodePath; static getClosestBinding(path: NodePath, name: string): Binding | undefined; /** * Finds the closest arrow function expression with an expression body * starting from the given path. * Returns the NodePath of the arrow function expression if found, otherwise undefined. */ static getArrowExpressionPath(path: NodePath): NodePath | undefined; /** * Hoists the expression to a variable declaration in the closest scope. * * If the path is inside an arrow function with an expression body, it converts * the arrow function body to a block statement and inserts the variable declaration * before the return statement. * * If the path is not inside such an arrow function, it inserts the variable declaration * before the closest statement and replaces the target node with the new variable identifier. */ static replaceAndHoistAsVariable(path: NodePath, variableName: string, expression: t.Expression, expandArrow?: boolean): t.Identifier; static hoistAsTopLevelVariable(path: NodePath, variableName: string, expression: t.Expression): t.Identifier; static componentTagDeclaration(path: NodePath, tagName: string, variableName: string, createDeclaration: () => t.VariableDeclarator): t.Identifier; static componentLiteral(tagName: string, variableName: string, path: NodePath, program: t.Program, isClass?: boolean): t.Identifier; } interface ImportConfig { source: string; name: string; local: string; } export declare class EnsureImport { protected static ensureImport(config: ImportConfig, program: t.Program, path: NodePath): void; static html(program: t.Program, path: NodePath): void; static htmlStatic(program: t.Program, path: NodePath): void; static svg(program: t.Program, path: NodePath): void; static svgStatic(program: t.Program, path: NodePath): void; static mathml(program: t.Program, path: NodePath): void; static mathmlStatic(program: t.Program, path: NodePath): void; static unsafeStatic(program: t.Program, path: NodePath): void; static createRef(program: t.Program, path: NodePath): void; static styleMap(program: t.Program, path: NodePath): void; static classMap(program: t.Program, path: NodePath): void; static rest(program: t.Program, path: NodePath): void; static literalMap(program: t.Program, path: NodePath): void; static taggedTemplateUtil(program: t.Program, path: NodePath): void; static booleanPart(program: t.Program, path: NodePath): void; static attributePart(program: t.Program, path: NodePath): void; static propertyPart(program: t.Program, path: NodePath): void; static elementPart(program: t.Program, path: NodePath): void; static eventPart(program: t.Program, path: NodePath): void; static childPart(program: t.Program, path: NodePath): void; } export type ValidJSXElement = t.JSXElement & { openingElement: t.JSXOpeningElement & { name: t.JSXIdentifier | t.JSXMemberExpression; }; }; export declare const isValidJSXElement: (path: NodePath) => path is NodePath; export declare const isValidOpeningElement: (path: NodePath) => path is NodePath; export declare const getJSXElementName: (node: t.JSXElement) => string; export declare const isJSXCustomElementComponent: (path: NodePath) => boolean; export declare const isJSXFunctionElementComponent: (path: NodePath) => boolean; export declare const isJSXElementPath: (path: NodePath) => path is NodePath; export declare const isJSXFragmentPath: (path: NodePath) => path is NodePath; /** * Determines if a JSX element will result in a static template. * This function traverses the JSX tree to check if any custom element components * are present, which would make the template static. * * @param path - The NodePath of the JSX element to analyze * @returns true if the template will be static, false otherwise */ export declare const isJSXElementStatic: (path: NodePath) => boolean; export declare const ensureImports: (context: ProcessorContext) => void; export type TemplateType = Values>; export declare const getTemplateType: (path: NodePath) => TemplateType; export declare const getTemplateTag: (tagName: string) => Values>; export declare const normalizeText: (text: string) => string; export {}; //# sourceMappingURL=compiler-utils.d.ts.map