@builder.io/mitosis
Version:
Write components once, run everywhere. Compiles to Vue, React, Solid, and Liquid. Import code from Figma and Builder.io
39 lines (38 loc) • 1.74 kB
TypeScript
import { MitosisComponent, MitosisState } from '../../types/mitosis-component';
import { BuilderContent, BuilderElement } from '@builder.io/sdk';
import { MitosisNode } from '../../types/mitosis-node';
type InternalOptions = {
skipMapper?: boolean;
};
export declare const symbolBlocksAsChildren = false;
type BuilderToMitosisOptions = {
context?: {
[key: string]: any;
};
includeBuilderExtras?: boolean;
preserveTextBlocks?: boolean;
includeSpecialBindings?: boolean;
includeMeta?: boolean;
/**
* When `true`, invalid bindings will be escaped as strings with special comments.
* This can then be used to have LLMs such as Claude attempt to repair the broken code.
* Defaults to `false`.
*/
escapeInvalidCode?: boolean;
};
export declare const builderElementToMitosisNode: (block: BuilderElement, options: BuilderToMitosisOptions, _internalOptions?: InternalOptions) => MitosisNode;
export declare const getMetaFromBlock: (block: BuilderElement, options: BuilderToMitosisOptions) => {};
/**
* Take Builder custom jsCode and extract the contents of the useStore hook
* and return it as a JS object along with the inputted code with the hook
* code extracted
*/
export declare function extractStateHook(code: string): {
code: string;
state: MitosisState;
};
export declare function convertExportDefaultToReturn(code: string): string;
export declare const createBuilderElement: (options?: Partial<BuilderElement>) => BuilderElement;
export declare const isBuilderElement: (el: unknown) => el is BuilderElement;
export declare const builderContentToMitosisComponent: (builderContent: BuilderContent, options?: BuilderToMitosisOptions) => MitosisComponent;
export {};