MCPcopy
hub / github.com/BuilderIO/mitosis / updateOutput

Function updateOutput

packages/fiddle/src/components/Talk.tsx:451–517  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

449 },
450
451 async updateOutput() {
452 try {
453 state.pendingBuilderChange = null;
454 staticState.ignoreNextBuilderUpdate = true;
455
456 let json: MitosisComponent;
457
458 switch (state.inputType) {
459 case 'json':
460 json = JSON.parse(state.code);
461 if (state.jsonExample !== 'COMPLETE') {
462 json = generateValidJson(json) as any;
463 } else {
464 json = generateValidJson(json) as any;
465 }
466 break;
467 case 'jsx':
468 // const wrappedCode = `
469 // import RenderBlocks from './RenderBlocks';
470
471 // export default function RenderContent(props) {
472 // ${state.code}
473 // }`;
474 // console.log(wrappedCode);
475 json = parseJsx(state.code);
476 break;
477 }
478
479 let commonOptions: { typescript: boolean } = {
480 typescript: hasBothTsAndJsSupport(state.outputTab) && state.options.typescript === 'true',
481 };
482
483 state.output = {
484 react: componentToReact({
485 stylesType: 'style-tag',
486 stateType: 'useState',
487 plugins,
488 ...commonOptions,
489 })({ component: json }),
490
491 qwik: componentToQwik({ plugins, ...commonOptions })({ component: json }).trim(),
492
493 vue: componentToVue({
494 plugins,
495 api: 'composition',
496 ...commonOptions,
497 })({ component: json, path: '' }),
498
499 svelte: componentToSvelte({
500 stateType: 'variables',
501 plugins,
502 ...commonOptions,
503 })({ component: json }),
504
505 solid: componentToSolid({ plugins, ...commonOptions })({ component: json }),
506 };
507
508 const newBuilderData = componentToBuilder()({ component: json });

Callers

nothing calls this directly

Calls 9

generateValidJsonFunction · 0.85
parseJsxFunction · 0.85
hasBothTsAndJsSupportFunction · 0.85
componentToReactFunction · 0.85
componentToQwikFunction · 0.85
componentToVueFunction · 0.85
componentToSvelteFunction · 0.85
componentToSolidFunction · 0.85
componentToBuilderFunction · 0.85

Tested by

no test coverage detected