({
output,
options,
}: {
output: string;
options: any;
})
| 1 | type Transpiler = import('@builder.io/mitosis').Transpiler<string>; |
| 2 | |
| 3 | export const generateCode = async ({ |
| 4 | output, |
| 5 | options, |
| 6 | }: { |
| 7 | output: string; |
| 8 | options: any; |
| 9 | }): Promise<Transpiler> => { |
| 10 | const mitosisCore = await import('@builder.io/mitosis'); |
| 11 | |
| 12 | const { |
| 13 | compileAwayBuilderComponents, |
| 14 | mapStyles, |
| 15 | componentToLiquid, |
| 16 | componentToAlpine, |
| 17 | componentToHtml, |
| 18 | componentToCustomElement, |
| 19 | componentToPreact, |
| 20 | componentToLit, |
| 21 | componentToRsc, |
| 22 | componentToQwik, |
| 23 | componentToReact, |
| 24 | componentToStencil, |
| 25 | componentToMarko, |
| 26 | componentToSwift, |
| 27 | componentToReactNative, |
| 28 | componentToTemplate, |
| 29 | componentToSolid, |
| 30 | componentToAngular, |
| 31 | componentToSvelte, |
| 32 | componentToMitosis, |
| 33 | componentToBuilder, |
| 34 | componentToVue, |
| 35 | } = mitosisCore; |
| 36 | |
| 37 | const plugins = [ |
| 38 | compileAwayBuilderComponents(), |
| 39 | mapStyles({ |
| 40 | map: (styles) => ({ |
| 41 | ...styles, |
| 42 | boxSizing: undefined, |
| 43 | flexShrink: undefined, |
| 44 | alignItems: styles.alignItems === 'stretch' ? undefined : styles.alignItems, |
| 45 | }), |
| 46 | }), |
| 47 | ]; |
| 48 | const allOptions = { plugins, ...options }; |
| 49 | switch (output) { |
| 50 | case 'liquid': |
| 51 | return componentToLiquid(allOptions); |
| 52 | case 'alpine': |
| 53 | return componentToAlpine(allOptions); |
| 54 | case 'html': |
| 55 | return componentToHtml(allOptions); |
| 56 | case 'webcomponents': |
| 57 | return componentToCustomElement(allOptions); |
| 58 | case 'preact': |
| 59 | return componentToPreact(allOptions); |
| 60 | case 'lit': |
nothing calls this directly
no test coverage detected