@kuma-ui/compiler
Version:
🐻 Kuma UI is a utility-first, zero-runtime CSS-in-JS library that offers an outstanding developer experience and optimized performance.
22 lines (19 loc) • 1.07 kB
TypeScript
import { componentList } from '@kuma-ui/core/components/componentList';
import { JsxOpeningElement, JsxSelfClosingElement } from 'ts-morph';
/**
* Optimizes JSX elements by converting Kuma components to raw HTML elements
* during compilation, when possible.
*
* The transformation can only be applied when no runtime-affecting prefix
* utility props are present. This is because these would necessitate runtime
* processing and therefore an intermediary component.
*
* For example, a <Flex as='section'> component would be converted to a <section>
* based on the 'as' prop, or to the default HTML element for that component.
*
* @param {string} componentName - The name of the Kuma component.
* @param {JsxOpeningElement|JsxSelfClosingElement} jsxElement - The JSX element to optimize.
* @param {string|undefined} as - The HTML element to use as a replacement.
*/
declare const optimize: (componentName: (typeof componentList)[keyof typeof componentList], jsxElement: JsxOpeningElement | JsxSelfClosingElement, as?: string) => void;
export { optimize };