(
component: DesignComponent,
{ lang = 'jsx' }: SerializeOptions,
{ transformComponent }: TransformOptions = {}
)
| 402 | } |
| 403 | |
| 404 | export function serializeComponent( |
| 405 | component: DesignComponent, |
| 406 | { lang = 'jsx' }: SerializeOptions, |
| 407 | { transformComponent }: TransformOptions = {} |
| 408 | ) { |
| 409 | if (typeof transformComponent === 'function') { |
| 410 | const result = transformComponent({ component }) |
| 411 | if (typeof result === 'string') { |
| 412 | return result |
| 413 | } |
| 414 | |
| 415 | return stringifyComponent(result, { lang }) |
| 416 | } |
| 417 | |
| 418 | return '' |
| 419 | } |
| 420 | |
| 421 | export function mergeAttributes(code: string, attrs: Record<string, string>): string { |
| 422 | if (!code || !Object.keys(attrs).length) return code |
no test coverage detected