@designos/compiler-cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1277,6 +1277,7 @@ async function compileProject(project, registry, options) {
1277
1277
  }
1278
1278
 
1279
1279
  // src/run.ts
1280
+ import { bladeTarget } from "@designos/compiler-blade";
1280
1281
  var HELP = `DesignOS compiler CLI
1281
1282
 
1282
1283
  Usage:
@@ -1469,20 +1470,25 @@ async function runCli(args, output = console, cwd = process.cwd()) {
1469
1470
  const projectConfig = JSON.parse(configText);
1470
1471
  const project = await loadCompilerProject(projectConfig, projectRoot, projectRootReal);
1471
1472
  const registry = createMitosisCompiler();
1473
+ registry.register(bladeTarget);
1472
1474
  if (!registry.names().includes(parsed.target)) {
1473
1475
  throw new Error(`Unknown compiler target ${JSON.stringify(parsed.target)}. Registered targets: ${registry.names().join(", ")}`);
1474
1476
  }
1475
1477
  const target = parsed.target;
1476
- const validation = validateCompilerProject(project);
1478
+ const targetProject = target === "blade" ? {
1479
+ ...project,
1480
+ components: project.components.map((component) => ({ ...component, outputDirectory: "components" }))
1481
+ } : project;
1482
+ const validation = validateCompilerProject(targetProject);
1477
1483
  printDiagnostics(output, validation);
1478
1484
  if (validation.some((diagnostic) => diagnostic.severity === "error")) return 1;
1479
- const result = await compileProject(project, registry, { target, targetOptions: parsed.targetOptions });
1485
+ const result = await compileProject(targetProject, registry, { target, targetOptions: parsed.targetOptions });
1480
1486
  printDiagnostics(output, result.diagnostics);
1481
1487
  if (result.diagnostics.some((diagnostic) => diagnostic.severity === "error")) return 1;
1482
- const manifests = Object.fromEntries(project.components.map(({ manifest }) => [manifest.type, manifest]));
1488
+ const manifests = Object.fromEntries(targetProject.components.map(({ manifest }) => [manifest.type, manifest]));
1483
1489
  const manifestRegistryFile = {
1484
1490
  kind: "registry",
1485
- path: "manifests.json",
1491
+ path: target === "blade" ? "registry.json" : "manifests.json",
1486
1492
  contents: `${JSON.stringify(manifests, null, 2)}
1487
1493
  `
1488
1494
  };
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/run.ts","../../compiler-core/src/mitosis.ts","../../compiler-core/src/source.ts","../../compiler-core/src/index.ts","../src/cli.ts"],"sourcesContent":["import { copyFile, lstat, mkdir, readFile, realpath, rename, rm, stat, writeFile } from \"node:fs/promises\";\nimport { randomUUID } from \"node:crypto\";\nimport { dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport {\n compileProject,\n createMitosisCompiler,\n parseMitosisSource,\n validateCompilerProject,\n} from \"@designos/compiler-core\";\nimport type { CompilerProject, CompilerSourceProject, CompilerTarget } from \"@designos/compiler-core\";\n\nexport interface CliOutput {\n log(message: string): void;\n error(message: string): void;\n}\n\ninterface CompileArguments {\n help?: false;\n target: string;\n config: string;\n outDir?: string;\n projectRoot?: string;\n targetOptions: Record<string, unknown>;\n}\n\nconst HELP = `DesignOS compiler CLI\n\nUsage:\n designos compile --target <target> [options]\n\nOptions:\n --target <target> Registered target name (for example react or vue)\n --config <file> Project JSON file (default: designos.project.json)\n --project-root <directory> Root for config asset paths (default: current directory)\n --out-dir <directory> Output directory inside dist (default: dist/designos/<target>)\n --target-option key=value Pass a target-specific option; repeatable, values parse as JSON\n --help Show this help\n`;\n\nfunction parseTargetOption(value: string): [string, unknown] {\n const separator = value.indexOf(\"=\");\n if (separator < 1) throw new Error(`Invalid --target-option ${JSON.stringify(value)}; expected key=value`);\n const key = value.slice(0, separator).trim();\n if (!key) throw new Error(\"--target-option key must not be empty\");\n const raw = value.slice(separator + 1);\n try {\n return [key, JSON.parse(raw) as unknown];\n } catch {\n return [key, raw];\n }\n}\n\nfunction parseArguments(args: string[]): CompileArguments | { help: true } {\n if (args.length === 0 || args[0] === \"--help\" || args[0] === \"help\") return { help: true };\n if (args[0] !== \"compile\") throw new Error(`Unknown command: ${args[0]}\\n\\n${HELP}`);\n\n const options: Omit<CompileArguments, \"target\"> & { target?: string } = {\n config: \"designos.project.json\",\n targetOptions: {},\n };\n\n for (let index = 1; index < args.length; index += 1) {\n const flag = args[index];\n if (flag === \"--help\") return { help: true };\n if (![\"--target\", \"--config\", \"--out-dir\", \"--project-root\", \"--target-option\"].includes(flag)) {\n throw new Error(`Unknown option: ${flag}\\n\\n${HELP}`);\n }\n const value = args[index + 1];\n if (!value || value.startsWith(\"--\")) throw new Error(`Missing value for ${flag}`);\n index += 1;\n\n if (flag === \"--target\") options.target = value;\n else if (flag === \"--config\") options.config = value;\n else if (flag === \"--out-dir\") options.outDir = value;\n else if (flag === \"--project-root\") options.projectRoot = value;\n else {\n const [key, targetValue] = parseTargetOption(value);\n options.targetOptions[key] = targetValue;\n }\n }\n\n if (!options.target) throw new Error(\"Missing required --target option\");\n return options as CompileArguments;\n}\n\nfunction isWithin(root: string, candidate: string): boolean {\n const pathFromRoot = relative(root, candidate);\n return pathFromRoot === \"\" || (pathFromRoot !== \"..\" && !pathFromRoot.startsWith(`..${sep}`) && !isAbsolute(pathFromRoot));\n}\n\nfunction isSafeRelativePath(value: string): boolean {\n return value.length > 0\n && !value.startsWith(\"/\")\n && !value.includes(\"\\\\\")\n && !/^[A-Za-z]:/.test(value)\n && value.split(\"/\").every((segment) => segment.length > 0 && segment !== \".\" && segment !== \"..\");\n}\n\nasync function ensureDirectoryWithoutSymlinks(root: string, relativeDirectory: string): Promise<string> {\n let current = root;\n for (const segment of relativeDirectory ? relativeDirectory.split(sep).filter(Boolean) : []) {\n current = join(current, segment);\n try {\n const entry = await lstat(current);\n if (entry.isSymbolicLink() || !entry.isDirectory()) {\n throw new Error(`Output path contains a non-directory or symbolic link: ${current}`);\n }\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code !== \"ENOENT\") throw cause;\n await mkdir(current);\n }\n }\n return current;\n}\n\nasync function prepareOutputRoot(projectRoot: string, outputArgument: string): Promise<string> {\n const distPath = resolve(projectRoot, \"dist\");\n const requestedOutput = resolve(projectRoot, outputArgument);\n if (requestedOutput === distPath || !isWithin(distPath, requestedOutput)) {\n throw new Error(\"--out-dir must be a dedicated subdirectory inside the project dist directory\");\n }\n\n await mkdir(distPath, { recursive: true });\n const rootRealPath = await realpath(projectRoot);\n const distRealPath = await realpath(distPath);\n if (!isWithin(rootRealPath, distRealPath)) throw new Error(\"The project dist directory resolves outside the project root\");\n\n const relativeOutput = relative(distPath, requestedOutput);\n if (!relativeOutput || relativeOutput === \"..\" || relativeOutput.startsWith(`..${sep}`) || isAbsolute(relativeOutput)) {\n throw new Error(\"--out-dir must resolve to a subdirectory inside dist\");\n }\n return ensureDirectoryWithoutSymlinks(distRealPath, relativeOutput);\n}\n\nasync function resolveProjectAsset(projectRoot: string, projectRootReal: string, source: string): Promise<string> {\n if (!isSafeRelativePath(source)) throw new Error(`Asset source is not a safe project-relative path: ${source}`);\n const candidate = resolve(projectRoot, source);\n if (!isWithin(projectRoot, candidate)) throw new Error(`Asset source escapes project root: ${source}`);\n const sourceRealPath = await realpath(candidate);\n if (!isWithin(projectRootReal, sourceRealPath)) throw new Error(`Asset source resolves outside project root: ${source}`);\n const info = await stat(sourceRealPath);\n if (!info.isFile()) throw new Error(`Asset source is not a file: ${source}`);\n return sourceRealPath;\n}\n\nasync function loadCompilerProject(config: unknown, projectRoot: string, projectRootReal: string): Promise<CompilerProject> {\n if (!config || typeof config !== \"object\") throw new Error(\"Compiler project config must be a JSON object\");\n const schemaVersion = (config as { schemaVersion?: unknown }).schemaVersion;\n if (schemaVersion === \"1\") return config as CompilerProject;\n if (schemaVersion !== \"2\") throw new Error(`Unsupported project schemaVersion ${JSON.stringify(schemaVersion)}; expected \\\"1\\\" (IR) or \\\"2\\\" (TSX source)`);\n\n const sourceProject = config as CompilerSourceProject;\n if (!Array.isArray(sourceProject.components)) throw new Error(\"Source project components must be an array\");\n const components = await Promise.all(sourceProject.components.map(async (entry, index) => {\n const prefix = `components[${index}]`;\n if (!entry || typeof entry.source !== \"string\" || typeof entry.manifest !== \"string\") {\n throw new Error(`${prefix} requires project-relative source and manifest paths`);\n }\n if (!entry.source.endsWith(\".lite.tsx\")) {\n throw new Error(`${prefix}.source must reference a .lite.tsx authoring file`);\n }\n const sourcePath = await resolveProjectAsset(projectRoot, projectRootReal, entry.source);\n const manifestPath = await resolveProjectAsset(projectRoot, projectRootReal, entry.manifest);\n let manifest: unknown;\n try {\n manifest = JSON.parse(await readFile(manifestPath, \"utf8\"));\n } catch (cause) {\n throw new Error(`Unable to read JSON manifest ${entry.manifest}: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });\n }\n const source = await readFile(sourcePath, \"utf8\");\n const implementation = parseMitosisSource(source, { filePath: entry.source, enableBlocksSlots: true });\n if (entry.exportName && implementation.name !== entry.exportName) {\n throw new Error(`${prefix}.exportName is ${JSON.stringify(entry.exportName)}, but Mitosis parsed ${JSON.stringify(implementation.name)} from ${entry.source}`);\n }\n if (!Array.isArray(entry.styles ?? []) || !Array.isArray(entry.assets ?? [])) {\n throw new Error(`${prefix}.styles and ${prefix}.assets must be arrays of project-relative file references`);\n }\n const sourceDirectory = dirname(entry.source).split(sep).join(\"/\");\n return {\n manifest: manifest as CompilerProject[\"components\"][number][\"manifest\"],\n implementation: { kind: \"mitosis\" as const, component: implementation },\n outputDirectory: entry.outputDirectory ?? (sourceDirectory === \".\" ? \"components\" : sourceDirectory),\n styles: entry.styles ?? [],\n assets: entry.assets ?? [],\n };\n }));\n return { schemaVersion: \"1\", components };\n}\n\nasync function writeArtifact(outputRoot: string, relativePath: string, contents: string | Uint8Array): Promise<void> {\n if (!isSafeRelativePath(relativePath)) throw new Error(`Unsafe generated output path: ${relativePath}`);\n const parts = relativePath.split(\"/\");\n const directory = parts.slice(0, -1).join(sep);\n const parent = await ensureDirectoryWithoutSymlinks(outputRoot, directory);\n const destination = join(parent, parts.at(-1)!);\n try {\n const existing = await lstat(destination);\n if (existing.isSymbolicLink() || !existing.isFile()) throw new Error(`Generated output is not a regular file: ${relativePath}`);\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code !== \"ENOENT\") throw cause;\n }\n\n const temporary = `${destination}.designos-${randomUUID()}.tmp`;\n try {\n const output = typeof contents === \"string\" && relativePath.endsWith(\".tsx\")\n ? `// @ts-nocheck -- generated Mitosis output; target prop types are not yet preserved.\\n${contents}`\n : contents;\n await writeFile(temporary, output);\n await rename(temporary, destination);\n } catch (cause) {\n await rm(temporary, { force: true });\n throw cause;\n }\n}\n\nfunction printDiagnostics(output: CliOutput, diagnostics: { severity: string; code: string; path?: string; message: string }[]): void {\n for (const diagnostic of diagnostics) {\n const formatted = `${diagnostic.severity.toUpperCase()} ${diagnostic.code}${diagnostic.path ? ` (${diagnostic.path})` : \"\"}: ${diagnostic.message}`;\n if (diagnostic.severity === \"error\") output.error(formatted);\n else output.log(formatted);\n }\n}\n\nexport async function runCli(args: string[], output: CliOutput = console, cwd = process.cwd()): Promise<number> {\n try {\n const parsed = parseArguments(args);\n if (\"help\" in parsed) {\n output.log(HELP);\n return 0;\n }\n\n const projectRoot = resolve(cwd, parsed.projectRoot ?? \".\");\n const projectRootReal = await realpath(projectRoot);\n const configPath = resolve(projectRoot, parsed.config);\n const configText = await readFile(configPath, \"utf8\");\n const projectConfig: unknown = JSON.parse(configText);\n const project = await loadCompilerProject(projectConfig, projectRoot, projectRootReal);\n const registry = createMitosisCompiler();\n\n if (!registry.names().includes(parsed.target as CompilerTarget)) {\n throw new Error(`Unknown compiler target ${JSON.stringify(parsed.target)}. Registered targets: ${registry.names().join(\", \")}`);\n }\n const target = parsed.target as CompilerTarget;\n const validation = validateCompilerProject(project);\n printDiagnostics(output, validation);\n if (validation.some((diagnostic) => diagnostic.severity === \"error\")) return 1;\n\n const result = await compileProject(project, registry, { target, targetOptions: parsed.targetOptions });\n printDiagnostics(output, result.diagnostics);\n if (result.diagnostics.some((diagnostic) => diagnostic.severity === \"error\")) return 1;\n\n const manifests = Object.fromEntries(project.components.map(({ manifest }) => [manifest.type, manifest]));\n const manifestRegistryFile = {\n kind: \"registry\" as const,\n path: \"manifests.json\",\n contents: `${JSON.stringify(manifests, null, 2)}\\n`,\n };\n const outputFiles = [...result.files, manifestRegistryFile];\n\n const outputArgument = parsed.outDir ?? `dist/designos/${target}`;\n const outputRoot = await prepareOutputRoot(projectRoot, outputArgument);\n const outputPaths = new Set<string>();\n for (const file of outputFiles) {\n const pathKey = file.path.toLowerCase();\n if (outputPaths.has(pathKey)) throw new Error(`Generated output path collision: ${file.path}`);\n outputPaths.add(pathKey);\n }\n for (const asset of result.assets) {\n const pathKey = asset.outputPath.toLowerCase();\n if (outputPaths.has(pathKey)) throw new Error(`Asset output collides with a generated file: ${asset.outputPath}`);\n outputPaths.add(pathKey);\n }\n for (const outputPath of outputPaths) {\n for (const otherPath of outputPaths) {\n if (outputPath !== otherPath && otherPath.startsWith(`${outputPath}/`)) {\n throw new Error(`Generated output path is both a file and a directory: ${outputPath}`);\n }\n }\n }\n\n const assetSources = new Map<string, string>();\n for (const asset of result.assets) {\n assetSources.set(asset.outputPath, await resolveProjectAsset(projectRoot, projectRootReal, asset.source));\n }\n for (const file of outputFiles) await writeArtifact(outputRoot, file.path, file.contents);\n for (const [outputPath, sourcePath] of assetSources) {\n let temporary = \"\";\n try {\n if (!isSafeRelativePath(outputPath)) throw new Error(`Unsafe asset output path: ${outputPath}`);\n const relativeParent = dirname(outputPath).split(sep).join(\"/\");\n const parent = await ensureDirectoryWithoutSymlinks(outputRoot, relativeParent === \".\" ? \"\" : relativeParent);\n const destination = join(parent, outputPath.split(\"/\").at(-1)!);\n try {\n const existing = await lstat(destination);\n if (existing.isSymbolicLink() || !existing.isFile()) throw new Error(`Asset output is not a regular file: ${outputPath}`);\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code !== \"ENOENT\") throw cause;\n }\n temporary = `${destination}.designos-${randomUUID()}.tmp`;\n await copyFile(sourcePath, temporary);\n await rename(temporary, destination);\n } catch (cause) {\n if (temporary) await rm(temporary, { force: true });\n throw cause;\n }\n }\n\n output.log(`Compiled ${project.components.length} components for ${target}; wrote ${outputFiles.length} generated files and ${result.assets.length} assets to ${relative(projectRoot, outputRoot)}.`);\n return 0;\n } catch (cause) {\n output.error(cause instanceof Error ? cause.message : String(cause));\n return 1;\n }\n}\n","import {\n componentToAlpine,\n componentToBuilder,\n componentToAngular,\n componentToCustomElement,\n componentToHtml,\n componentToLiquid,\n componentToLit,\n componentToMarko,\n componentToMitosis,\n componentToPreact,\n componentToQwik,\n componentToReact,\n componentToReactNative,\n componentToRsc,\n componentToSolid,\n componentToStencil,\n componentToSvelte,\n componentToSwift,\n componentToTaro,\n componentToTemplate,\n componentToVue,\n} from \"@builder.io/mitosis\";\nimport type { MitosisComponent } from \"@builder.io/mitosis/types\";\nimport { TargetRegistry } from \"./index\";\nimport type { ComponentIR, CompilerProjectRegistryEntry, Diagnostic, GeneratedFile, GenerationContext, GenerationResult, IRAttribute, IRNode } from \"./index\";\n\nexport const mitosisTargets = [\n \"alpine\", \"angular\", \"builder\", \"customElement\", \"html\", \"liquid\", \"lit\", \"marko\", \"mitosis\",\n \"preact\", \"qwik\", \"react\", \"reactNative\", \"rsc\", \"solid\", \"stencil\", \"svelte\",\n \"swift\", \"taro\", \"template\", \"vue\", \"webcomponent\",\n] as const;\nexport type MitosisTarget = (typeof mitosisTargets)[number];\nexport interface MitosisTargetCapability {\n generation: \"smoke-tested\";\n semanticParity: \"unverified\";\n sourceMaps: \"unverified\";\n diagnostics: \"partial\";\n}\nexport const mitosisTargetCapabilities: Readonly<Record<MitosisTarget, MitosisTargetCapability>> = Object.freeze(\n Object.fromEntries(mitosisTargets.map((target) => [target, Object.freeze({\n generation: \"smoke-tested\" as const,\n semanticParity: \"unverified\" as const,\n sourceMaps: \"unverified\" as const,\n diagnostics: \"partial\" as const,\n })])) as Record<MitosisTarget, MitosisTargetCapability>,\n);\ntype MNode = Record<string, any>;\ntype MComponent = Record<string, any>;\n\nconst propTypeTargets = new Set<MitosisTarget>([\"preact\", \"qwik\", \"react\", \"reactNative\", \"rsc\", \"solid\", \"taro\"]);\nconst stateTypeTargets = new Set<MitosisTarget>([\"angular\", \"preact\", \"react\", \"reactNative\", \"rsc\", \"taro\"]);\n\nfunction createComponentPropType(component: ComponentIR): { name: string; declaration: string } | undefined {\n if (!component.props.some((prop) => typeof prop.type === \"string\" && prop.type.trim())) return undefined;\n\n const importedNames = new Set(component.imports.flatMap((item) => item.names));\n const componentName = component.name.replace(/[^A-Za-z0-9_$]/g, \"_\");\n let name = `__DesignOS_${componentName}_Props`;\n while (importedNames.has(name)) name = `_${name}`;\n\n const properties = component.props.map((prop) => {\n const propertyName = /^[$A-Z_a-z][$\\w]*$/.test(prop.name) ? prop.name : JSON.stringify(prop.name);\n const optional = prop.optional || prop.defaultValue !== undefined ? \"?\" : \"\";\n const type = typeof prop.type === \"string\" && prop.type.trim() ? prop.type.trim() : \"any\";\n return ` ${propertyName}${optional}: ${type};`;\n });\n\n return { name, declaration: `type ${name} = {\\n${properties.join(\"\\n\")}\\n};` };\n}\n\nfunction toMitosisNode(node: IRNode): MNode {\n const base: MNode = { \"@type\": \"@builder.io/mitosis/node\", name: \"div\", meta: {}, scope: {}, properties: {}, bindings: {}, children: [] };\n if (node.kind === \"text\") {\n base.properties._text = node.value;\n } else if (node.kind === \"expression\") {\n base.bindings._text = { code: node.binding.code, type: \"single\", bindingType: \"expression\" };\n } else if (node.kind === \"slot\") {\n base.name = \"Slot\";\n if (node.name) base.properties.name = node.name;\n if (node.fallback) base.children = node.fallback.map((child) => toMitosisNode(child));\n } else if (node.kind === \"fragment\") {\n base.name = \"Fragment\";\n base.children = node.children.map((child) => toMitosisNode(child));\n } else if (node.kind === \"conditional\") {\n base.name = \"Show\";\n base.bindings.when = { code: node.condition.code, type: \"single\", bindingType: \"expression\" };\n base.children = node.then.map((child) => toMitosisNode(child));\n if (node.otherwise?.length) {\n base.meta.else = toMitosisNode({ kind: \"fragment\", children: node.otherwise });\n }\n } else if (node.kind === \"loop\") {\n base.name = \"For\";\n base.scope = { forName: node.itemName, indexName: node.indexName, collectionName: undefined };\n base.bindings.each = { code: node.collection.code, type: \"single\", bindingType: \"expression\" };\n base.children = node.children.map((child) => toMitosisNode(child));\n } else {\n base.name = node.kind === \"element\" ? node.tag : node.name;\n base.children = (node.children ?? []).map((child) => toMitosisNode(child));\n for (const attribute of node.attributes ?? []) applyAttribute(base, attribute);\n if (node.kind === \"component\" && node.slots) {\n const { default: defaultSlot, ...namedSlots } = node.slots;\n if (defaultSlot) base.children.push(...defaultSlot.map((child) => toMitosisNode(child)));\n if (Object.keys(namedSlots).length) {\n base.slots = Object.fromEntries(Object.entries(namedSlots).map(([name, children]) => [name, toMitosisSlotChildren(children)]));\n }\n }\n }\n return base;\n}\n\nfunction toMitosisSlotChildren(children: IRNode[]): MNode[] {\n const nodes = children.length === 1 && children[0].kind === \"fragment\" ? children[0].children : children;\n if (nodes.length === 1 && nodes[0].kind === \"text\") {\n const child = nodes[0];\n const node = toMitosisNode(child);\n node.properties._text = JSON.stringify(child.value);\n return [node];\n }\n return nodes.map((child) => toMitosisNode(child));\n}\n\nfunction applyAttribute(node: MNode, attribute: IRAttribute): void {\n if (!attribute.binding) {\n if (attribute.value !== undefined) node.properties[attribute.name] = attribute.value;\n return;\n }\n const binding = attribute.binding;\n const eventName = binding.eventName ?? attribute.name;\n const key = binding.kind === \"event\" && !eventName.startsWith(\"on\")\n ? `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`\n : attribute.name;\n node.bindings[key] = {\n code: binding.code,\n type: binding.kind === \"spread\" ? \"spread\" : \"single\",\n ...(binding.kind === \"spread\" ? { spreadType: \"normal\" } : { bindingType: binding.kind === \"event\" ? \"function\" : \"expression\" }),\n ...(binding.parameters ? { arguments: binding.parameters } : {}),\n };\n}\nexport function componentIRToMitosis(component: ComponentIR): MComponent {\n const imports = component.imports.map((item) => ({\n path: item.source,\n imports: Object.fromEntries(item.names.map((name) => [name, name])),\n ...(item.typeOnly ? { importKind: \"type\" } : {}),\n }));\n const propType = createComponentPropType(component);\n return {\n \"@type\": \"@builder.io/mitosis/component\",\n name: component.name,\n imports,\n exports: {},\n inputs: component.props.map((prop) => ({ name: prop.name, defaultValue: prop.defaultValue })),\n props: Object.fromEntries(component.props.map((prop) => [prop.name, { propertyType: \"normal\", optional: !!prop.optional || prop.defaultValue !== undefined }])),\n defaultProps: Object.fromEntries(component.props.filter((prop) => prop.defaultValue !== undefined).map((prop) => [prop.name, { type: \"property\", code: JSON.stringify(prop.defaultValue) }])),\n state: Object.fromEntries(component.state.map((item) => [item.name, {\n type: \"property\",\n code: item.initialValue,\n ...(typeof item.type === \"string\" && item.type.trim() ? { typeParameter: item.type.trim() } : {}),\n }])),\n meta: { ...(component.metadata ?? {}) },\n refs: {},\n context: { get: {}, set: {} },\n hooks: { onMount: [], onEvent: [] },\n children: component.root.kind === \"fragment\" ? component.root.children.map((node) => toMitosisNode(node)) : [toMitosisNode(component.root)],\n subComponents: [],\n ...(component.styles ? { style: component.styles } : {}),\n ...(propType ? { types: [propType.declaration], propsTypeRef: propType.name } : {}),\n };\n}\n\nfunction normalizeReactNativeFragmentLinks(component: MComponent): void {\n const visit = (node: MNode): void => {\n const href = node.properties?.href;\n if (typeof href === \"string\" && href.startsWith(\"#\")) {\n delete node.properties.href;\n node.bindings ??= {};\n node.bindings.href = {\n code: JSON.stringify(href),\n type: \"single\",\n bindingType: \"expression\",\n };\n }\n\n if (Array.isArray(node.children)) node.children.forEach(visit);\n if (node.slots && typeof node.slots === \"object\") {\n for (const children of Object.values(node.slots) as MNode[][]) children.forEach(visit);\n }\n };\n\n if (Array.isArray(component.children)) component.children.forEach(visit);\n}\n\nconst generators: Record<MitosisTarget, (component: MComponent, options: Record<string, unknown>) => unknown> = {\n alpine: (c, o) => componentToAlpine(o as any)({ component: c as any }),\n builder: (c, o) => componentToBuilder(o as any)({ component: c as any }),\n angular: (c, o) => componentToAngular(o as any)({ component: c as any }),\n customElement: (c, o) => componentToCustomElement(o as any)({ component: c as any }),\n html: (c, o) => componentToHtml(o as any)({ component: c as any }),\n liquid: (c, o) => componentToLiquid(o as any)({ component: c as any }),\n lit: (c, o) => componentToLit(o as any)({ component: c as any }),\n marko: (c, o) => componentToMarko(o as any)({ component: c as any }),\n mitosis: (c, o) => componentToMitosis(o as any)({ component: c as any }),\n preact: (c, o) => componentToPreact(o as any)({ component: c as any }),\n qwik: (c, o) => componentToQwik(o as any)({ component: c as any }),\n react: (c, o) => componentToReact(o as any)({ component: c as any }),\n reactNative: (c, o) => componentToReactNative(o as any)({ component: c as any }),\n rsc: (c, o) => componentToRsc(o as any)({ component: c as any }),\n solid: (c, o) => componentToSolid(o as any)({ component: c as any }),\n stencil: (c, o) => componentToStencil(o as any)({ component: c as any }),\n svelte: (c, o) => componentToSvelte(o as any)({ component: c as any }),\n swift: (c, o) => componentToSwift(o as any)({ component: c as any }),\n taro: (c, o) => componentToTaro(o as any)({ component: c as any }),\n template: (c, o) => componentToTemplate(o as any)({ component: c as any }),\n vue: (c, o) => componentToVue(o as any)({ component: c as any }),\n webcomponent: (c, o) => componentToCustomElement(o as any)({ component: c as any }),\n};\n\nconst siblingElseTargets = new Set<MitosisTarget>([\"alpine\", \"customElement\", \"html\", \"swift\", \"template\", \"webcomponent\"]);\nconst nativeSlotProjectionTargets = new Set<MitosisTarget>([\n \"alpine\", \"angular\", \"customElement\", \"html\", \"liquid\", \"lit\", \"marko\", \"qwik\", \"stencil\", \"svelte\", \"template\", \"vue\", \"webcomponent\",\n]);\nconst nativeSlotOutletTargets = new Set<MitosisTarget>([\"alpine\", \"customElement\", \"html\", \"liquid\", \"lit\", \"stencil\", \"template\", \"webcomponent\"]);\nconst eventlessTargets = new Set<MitosisTarget>([\"liquid\", \"template\"]);\nconst nativePropDefaultTargets = new Set<MitosisTarget>([\"angular\", \"preact\", \"react\", \"reactNative\", \"rsc\", \"stencil\", \"svelte\", \"taro\", \"vue\"]);\nconst expressionPropDefaultTargets = new Set<MitosisTarget>([\"alpine\", \"builder\", \"customElement\", \"html\", \"lit\", \"marko\", \"mitosis\", \"solid\", \"template\", \"webcomponent\"]);\nconst swiftTextTags = new Set([\"span\", \"p\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]);\n\nfunction swiftPrimitiveType(type: unknown): \"string\" | \"number\" | \"boolean\" | undefined {\n if (typeof type !== \"string\") return undefined;\n switch (type.trim().toLowerCase()) {\n case \"string\": return \"string\";\n case \"number\": return \"number\";\n case \"boolean\":\n case \"bool\": return \"boolean\";\n default: return undefined;\n }\n}\n\nfunction swiftDefaultLiteral(type: unknown, value: unknown): string | undefined {\n const normalizedType = swiftPrimitiveType(type);\n if (normalizedType === \"string\" && typeof value === \"string\") {\n if (/[\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]/.test(value)) return undefined;\n const escaped = value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\").replace(/\\t/g, \"\\\\t\");\n return `\"${escaped}\"`;\n }\n if (normalizedType === \"number\" && typeof value === \"number\" && Number.isFinite(value)) return String(value);\n if (normalizedType === \"boolean\" && typeof value === \"boolean\") return String(value);\n return undefined;\n}\n\nfunction applySwiftPropTypes(component: MComponent, props: ComponentIR[\"props\"]): void {\n for (const prop of props) {\n const type = swiftPrimitiveType(prop.type);\n if (type && component.props?.[prop.name]) component.props[prop.name].propertyType = type;\n }\n}\n\nfunction hasNamedComponentSlots(node: IRNode): boolean {\n if (node.kind === \"component\" && Object.keys(node.slots ?? {}).some((name) => name !== \"default\")) return true;\n if (node.kind === \"conditional\") return node.then.some(hasNamedComponentSlots) || (node.otherwise ?? []).some(hasNamedComponentSlots);\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some(hasNamedComponentSlots);\n if (node.kind === \"slot\") return (node.fallback ?? []).some(hasNamedComponentSlots);\n if (node.kind === \"element\") return (node.children ?? []).some(hasNamedComponentSlots);\n if (node.kind === \"component\") return (node.children ?? []).some(hasNamedComponentSlots)\n || Object.values(node.slots ?? {}).some((children) => children.some(hasNamedComponentSlots));\n return false;\n}\n\nfunction hasUnsupportedNamedComponentSlots(node: IRNode, target: MitosisTarget): boolean {\n if (target === \"swift\") return hasNamedComponentSlots(node);\n if (target === \"solid\" && node.kind === \"component\") {\n const hasUnsupportedSlot = Object.entries(node.slots ?? {}).some(([name, children]) => {\n if (name === \"default\") return false;\n return children.length !== 1 || (children[0]?.kind !== \"text\" && children[0]?.kind !== \"expression\");\n });\n if (hasUnsupportedSlot) return true;\n }\n if (node.kind === \"conditional\") return node.then.some((child) => hasUnsupportedNamedComponentSlots(child, target))\n || (node.otherwise ?? []).some((child) => hasUnsupportedNamedComponentSlots(child, target));\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some((child) => hasUnsupportedNamedComponentSlots(child, target));\n if (node.kind === \"slot\") return (node.fallback ?? []).some((child) => hasUnsupportedNamedComponentSlots(child, target));\n if (node.kind === \"element\") return (node.children ?? []).some((child) => hasUnsupportedNamedComponentSlots(child, target));\n if (node.kind === \"component\") return (node.children ?? []).some((child) => hasUnsupportedNamedComponentSlots(child, target))\n || Object.values(node.slots ?? {}).some((children) => children.some((child) => hasUnsupportedNamedComponentSlots(child, target)));\n return false;\n}\n\nfunction hasUnsupportedNamedSlotOutlet(node: IRNode, target: MitosisTarget): boolean {\n if (target === \"swift\" && node.kind === \"slot\") return true;\n if (node.kind === \"conditional\") return node.then.some((child) => hasUnsupportedNamedSlotOutlet(child, target))\n || (node.otherwise ?? []).some((child) => hasUnsupportedNamedSlotOutlet(child, target));\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some((child) => hasUnsupportedNamedSlotOutlet(child, target));\n if (node.kind === \"slot\") return (node.fallback ?? []).some((child) => hasUnsupportedNamedSlotOutlet(child, target));\n if (node.kind === \"element\") return (node.children ?? []).some((child) => hasUnsupportedNamedSlotOutlet(child, target));\n if (node.kind === \"component\") return (node.children ?? []).some((child) => hasUnsupportedNamedSlotOutlet(child, target))\n || Object.values(node.slots ?? {}).some((children) => children.some((child) => hasUnsupportedNamedSlotOutlet(child, target)));\n return false;\n}\n\nfunction hasConditionalElse(node: IRNode): boolean {\n if (node.kind === \"conditional\") {\n return !!node.otherwise?.length || node.then.some(hasConditionalElse) || (node.otherwise ?? []).some(hasConditionalElse);\n }\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some(hasConditionalElse);\n if (node.kind === \"slot\") return (node.fallback ?? []).some(hasConditionalElse);\n if (node.kind === \"element\") return (node.children ?? []).some(hasConditionalElse);\n if (node.kind === \"component\") return (node.children ?? []).some(hasConditionalElse)\n || Object.values(node.slots ?? {}).some((children) => children.some(hasConditionalElse));\n return false;\n}\n\nfunction hasEventHandlers(node: IRNode): boolean {\n if ((node.kind === \"element\" || node.kind === \"component\") && (node.attributes ?? []).some((attribute) => attribute.binding?.kind === \"event\")) return true;\n if (node.kind === \"conditional\") return node.then.some(hasEventHandlers) || (node.otherwise ?? []).some(hasEventHandlers);\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some(hasEventHandlers);\n if (node.kind === \"slot\") return (node.fallback ?? []).some(hasEventHandlers);\n if (node.kind === \"element\") return (node.children ?? []).some(hasEventHandlers);\n if (node.kind === \"component\") return (node.children ?? []).some(hasEventHandlers)\n || Object.values(node.slots ?? {}).some((children) => children.some(hasEventHandlers));\n return false;\n}\n\nfunction preservesPropDefault(target: MitosisTarget, name: string, value: unknown, propType?: unknown): boolean {\n if (nativePropDefaultTargets.has(target)) return true;\n if (target === \"qwik\") return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) && serializeDefaultValue(value) !== undefined;\n if (target === \"swift\") return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) && swiftDefaultLiteral(propType, value) !== undefined;\n if (target === \"liquid\") {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) return false;\n return typeof value === \"string\" || typeof value === \"boolean\" || (typeof value === \"number\" && Number.isFinite(value));\n }\n return expressionPropDefaultTargets.has(target)\n && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name)\n && serializeDefaultValue(value) !== undefined;\n}\n\nfunction serializeDefaultValue(value: unknown): string | undefined {\n try {\n const serialized = JSON.stringify(value);\n return typeof serialized === \"string\" ? serialized : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction applyExpressionPropDefaults(nodes: MNode[], props: ComponentIR[\"props\"]): void {\n const defaults = props.flatMap((prop) => {\n if (prop.defaultValue === undefined || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(prop.name)) return [];\n const serialized = serializeDefaultValue(prop.defaultValue);\n return serialized === undefined ? [] : [{ name: prop.name, serialized }];\n });\n if (defaults.length === 0) return;\n\n const visit = (node: MNode): void => {\n for (const binding of Object.values(node.bindings ?? {}) as Array<{ code?: unknown }>) {\n if (typeof binding.code !== \"string\") continue;\n let code = binding.code;\n for (const { name, serialized } of defaults) {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const access = `props.${name}`;\n const replacement = `(${access} === undefined ? ${serialized} : ${access})`;\n const dotReference = new RegExp(`\\\\bprops(?:\\\\?\\\\.|\\\\.)${escapedName}\\\\b`, \"g\");\n const bracketReference = new RegExp(`\\\\bprops\\\\s*\\\\[\\\\s*(['\\\"])${escapedName}\\\\1\\\\s*\\\\]`, \"g\");\n code = code.replace(dotReference, replacement).replace(bracketReference, replacement);\n }\n binding.code = code;\n }\n node.children?.forEach(visit);\n if (node.slots) Object.values(node.slots as Record<string, MNode[]>).forEach((children) => children.forEach(visit));\n const elseNode = node.meta?.else;\n if (elseNode && typeof elseNode === \"object\") visit(elseNode as MNode);\n };\n nodes.forEach(visit);\n}\n\ninterface QwikPropDefaultAlias {\n name: string;\n alias: string;\n serialized: string;\n}\n\nfunction applyQwikPropDefaults(component: MComponent, props: ComponentIR[\"props\"]): QwikPropDefaultAlias[] {\n const usedNames = new Set<string>([\n ...props.map((prop) => prop.name),\n ...Object.keys(component.state ?? {}),\n ]);\n const defaults = props.flatMap((prop) => {\n if (prop.defaultValue === undefined || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(prop.name)) return [];\n const serialized = serializeDefaultValue(prop.defaultValue);\n if (serialized === undefined) return [];\n let alias = `__designosDefault_${prop.name}`;\n let suffix = 1;\n while (usedNames.has(alias)) alias = `__designosDefault_${prop.name}_${suffix++}`;\n usedNames.add(alias);\n return [{ name: prop.name, alias, serialized }];\n });\n if (defaults.length === 0) return defaults;\n\n const rewrite = (source: string): string => defaults.reduce((code, { name, alias }) => {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const dotReference = new RegExp(`\\\\bprops(?:\\\\?\\\\.|\\\\.)${escapedName}\\\\b`, \"g\");\n const bracketReference = new RegExp(`\\\\bprops\\\\s*\\\\[\\\\s*(['\\\"])${escapedName}\\\\1\\\\s*\\\\]`, \"g\");\n return code.replace(dotReference, alias).replace(bracketReference, alias);\n }, source);\n\n const visit = (node: MNode): void => {\n for (const binding of Object.values(node.bindings ?? {}) as Array<{ code?: unknown }>) {\n if (typeof binding.code === \"string\") binding.code = rewrite(binding.code);\n }\n node.children?.forEach(visit);\n if (node.slots) Object.values(node.slots as Record<string, MNode[]>).forEach((children) => children.forEach(visit));\n const elseNode = node.meta?.else;\n if (elseNode && typeof elseNode === \"object\") visit(elseNode as MNode);\n };\n (component.children as MNode[]).forEach(visit);\n for (const state of Object.values(component.state ?? {}) as Array<{ code?: unknown }>) {\n if (typeof state.code === \"string\") state.code = rewrite(state.code);\n }\n return defaults;\n}\n\nfunction addQwikPropDefaults(output: string, defaults: QwikPropDefaultAlias[]): string | undefined {\n if (defaults.length === 0) return output;\n const signature = /(component\\$\\(\\s*\\(\\s*props(?:\\s*:\\s*[^)]*)?\\)\\s*=>\\s*\\{)/;\n if (!signature.test(output)) return undefined;\n const declarations = defaults\n .map(({ name, alias, serialized }) => ` const ${alias} = props.${name} === undefined ? ${serialized} : props.${name};`)\n .join(\"\\n\");\n return output.replace(signature, (match) => `${match}\\n${declarations}`);\n}\n\nfunction applySwiftPropDefaults(nodes: MNode[], props: ComponentIR[\"props\"]): void {\n const defaults = props.flatMap((prop) => {\n if (prop.defaultValue === undefined || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(prop.name)) return [];\n const literal = swiftDefaultLiteral(prop.type, prop.defaultValue);\n return literal === undefined ? [] : [{ name: prop.name, literal }];\n });\n if (defaults.length === 0) return;\n\n const visit = (node: MNode): void => {\n for (const binding of Object.values(node.bindings ?? {}) as Array<{ code?: unknown }>) {\n if (typeof binding.code !== \"string\") continue;\n let code = binding.code;\n for (const { name, literal } of defaults) {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const replacement = `(props.${name} ?? ${literal})`;\n const dotReference = new RegExp(`\\\\bprops(?:\\\\?\\\\.|\\\\.)${escapedName}\\\\b`, \"g\");\n const bracketReference = new RegExp(`\\\\bprops\\\\s*\\\\[\\\\s*(['\\\"])${escapedName}\\\\1\\\\s*\\\\]`, \"g\");\n code = code.replace(dotReference, replacement).replace(bracketReference, replacement);\n }\n binding.code = code;\n }\n node.children?.forEach(visit);\n if (node.slots) Object.values(node.slots as Record<string, MNode[]>).forEach((children) => children.forEach(visit));\n const elseNode = node.meta?.else;\n if (elseNode && typeof elseNode === \"object\") visit(elseNode as MNode);\n };\n nodes.forEach(visit);\n}\n\nfunction addSwiftPropDefaults(output: string, props: ComponentIR[\"props\"]): string {\n for (const prop of props) {\n if (prop.defaultValue === undefined || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(prop.name)) continue;\n const literal = swiftDefaultLiteral(prop.type, prop.defaultValue);\n if (literal === undefined) continue;\n const escapedName = prop.name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const declaration = new RegExp(`^([\\\\t ]*)let\\\\s+${escapedName}(\\\\s*:[^\\\\n]+)$`, \"m\");\n output = output.replace(declaration, (_match, indent: string, annotation: string) => `${indent}var ${prop.name}${annotation} = ${literal}`);\n }\n return output;\n}\n\nfunction addLiquidPropDefaults(output: string, component: ComponentIR): string {\n const assignments = component.props.flatMap((prop) => {\n if (prop.defaultValue === undefined || !preservesPropDefault(\"liquid\", prop.name, prop.defaultValue, prop.type)) return [];\n const literal = JSON.stringify(prop.defaultValue);\n if (typeof literal !== \"string\") return [];\n const allowFalse = prop.defaultValue === false ? \", allow_false: true\" : \"\";\n return [`{% assign ${prop.name} = ${prop.name} | default: ${literal}${allowFalse} %}`];\n });\n return assignments.length ? `${assignments.join(\"\\n\")}\\n${output}` : output;\n}\n\nfunction toLiquidCondition(code: string): string | undefined {\n const condition = code.replace(/\\b(?:props|state)\\./g, \"\").trim();\n const identifier = \"[A-Za-z_][A-Za-z0-9_]*(?:\\\\.[A-Za-z_][A-Za-z0-9_]*)*\";\n const literal = `(?:${identifier}|\\\\d+(?:\\\\.\\\\d+)?|'[^'\\\\\\\\]*'|\\\"[^\\\"\\\\\\\\]*\\\")`;\n if (new RegExp(`^${identifier}$`).test(condition)) return condition;\n if (new RegExp(`^${literal}\\\\s*(?:==|!=|>=|<=|>|<)\\\\s*${literal}$`).test(condition)) return condition;\n return undefined;\n}\n\nfunction hasUnsupportedLiquidElse(node: IRNode): boolean {\n if (node.kind === \"conditional\") {\n if (node.otherwise?.length && !toLiquidCondition(node.condition.code)) return true;\n return node.then.some(hasUnsupportedLiquidElse) || (node.otherwise ?? []).some(hasUnsupportedLiquidElse);\n }\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some(hasUnsupportedLiquidElse);\n if (node.kind === \"slot\") return (node.fallback ?? []).some(hasUnsupportedLiquidElse);\n if (node.kind === \"element\") return (node.children ?? []).some(hasUnsupportedLiquidElse);\n if (node.kind === \"component\") return (node.children ?? []).some(hasUnsupportedLiquidElse)\n || Object.values(node.slots ?? {}).some((children) => children.some(hasUnsupportedLiquidElse));\n return false;\n}\n\nfunction lowerElseBranches(nodes: MNode[]): MNode[] {\n const lowered: MNode[] = [];\n for (const sourceNode of nodes) {\n const node: MNode = {\n ...sourceNode,\n meta: { ...(sourceNode.meta ?? {}) },\n children: Array.isArray(sourceNode.children) ? lowerElseBranches(sourceNode.children) : sourceNode.children,\n ...(sourceNode.slots ? {\n slots: Object.fromEntries(Object.entries(sourceNode.slots).map(([name, children]) => [name, lowerElseBranches(children as MNode[])])),\n } : {}),\n };\n const elseNode = node.name === \"Show\" ? node.meta.else as MNode | undefined : undefined;\n const condition = node.bindings?.when?.code;\n if (!elseNode || typeof condition !== \"string\" || !condition.trim()) {\n lowered.push(node);\n continue;\n }\n\n delete node.meta.else;\n const elseChildren = elseNode.name === \"Fragment\" && Array.isArray(elseNode.children)\n ? elseNode.children as MNode[]\n : [elseNode];\n const alternate: MNode = {\n ...node,\n bindings: {\n ...node.bindings,\n when: { ...node.bindings.when, code: `!(${condition})` },\n },\n children: lowerElseBranches(elseChildren),\n };\n lowered.push(node, alternate);\n }\n return lowered;\n}\n\nfunction lowerLiquidElseBranches(nodes: MNode[], baseComponent: MComponent, options: Record<string, unknown>): MNode[] {\n const lowered: MNode[] = [];\n for (const sourceNode of nodes) {\n const node: MNode = {\n ...sourceNode,\n meta: { ...(sourceNode.meta ?? {}) },\n children: Array.isArray(sourceNode.children) ? lowerLiquidElseBranches(sourceNode.children, baseComponent, options) : sourceNode.children,\n ...(sourceNode.slots ? {\n slots: Object.fromEntries(Object.entries(sourceNode.slots).map(([name, children]) => [name, lowerLiquidElseBranches(children as MNode[], baseComponent, options)])),\n } : {}),\n };\n const elseNode = node.name === \"Show\" ? node.meta.else as MNode | undefined : undefined;\n const condition = node.bindings?.when?.code;\n const liquidCondition = typeof condition === \"string\" ? toLiquidCondition(condition) : undefined;\n if (!elseNode || !liquidCondition) {\n lowered.push(node);\n continue;\n }\n\n const elseChildren = elseNode.name === \"Fragment\" && Array.isArray(elseNode.children)\n ? lowerLiquidElseBranches(elseNode.children as MNode[], baseComponent, options)\n : lowerLiquidElseBranches([elseNode], baseComponent, options);\n const renderNodes = (children: MNode[]) => generators.liquid({ ...baseComponent, children, style: \"\" }, { ...options, prettier: false, reactive: false });\n lowered.push({\n \"@type\": \"@builder.io/mitosis/node\",\n name: \"div\",\n properties: { _text: `{% if ${liquidCondition} %}${renderNodes(node.children ?? [])}{% else %}${renderNodes(elseChildren)}{% endif %}` },\n bindings: {},\n meta: {},\n scope: {},\n children: [],\n });\n }\n return lowered;\n}\n\nfunction normalizeSwiftShowBranches(nodes: MNode[]): MNode[] {\n return nodes.map((sourceNode) => {\n const node: MNode = {\n ...sourceNode,\n meta: { ...(sourceNode.meta ?? {}) },\n children: Array.isArray(sourceNode.children) ? normalizeSwiftShowBranches(sourceNode.children) : sourceNode.children,\n ...(sourceNode.slots ? {\n slots: Object.fromEntries(Object.entries(sourceNode.slots).map(([name, children]) => [name, normalizeSwiftShowBranches(children as MNode[])])),\n } : {}),\n };\n if (node.name === \"Show\" && node.bindings?.when) {\n node.name = \"Group\";\n node.bindings.if = node.bindings.when;\n delete node.bindings.when;\n }\n if (typeof node.bindings?._text?.code === \"string\") {\n node.name = \"Text\";\n node.bindings.innerHTML = node.bindings._text;\n delete node.bindings._text;\n }\n if (swiftTextTags.has(String(node.name).toLowerCase()) && node.children?.length) {\n if (node.children.length === 1) {\n const child = node.children[0] as MNode;\n const textBinding = child.bindings?.innerHTML ?? child.bindings?._text;\n if (typeof textBinding?.code === \"string\") {\n node.name = \"Text\";\n node.bindings = { ...(node.bindings ?? {}), innerHTML: textBinding };\n node.children = [];\n } else if (typeof child.properties?._text === \"string\") {\n node.name = \"Text\";\n node.properties = { ...(node.properties ?? {}), _text: child.properties._text };\n node.children = [];\n }\n }\n if (node.children?.length) node.name = \"div\";\n }\n return node;\n });\n}\n\nfunction decodeSlotText(node: MNode): MNode {\n const encoded = node.properties?._text;\n if (typeof encoded === \"string\") {\n try {\n const decoded = JSON.parse(encoded);\n if (typeof decoded === \"string\" && JSON.stringify(decoded) === encoded) node.properties._text = decoded;\n } catch {\n // Non-JSON text is a raw text node or an expression preserved elsewhere.\n }\n }\n return node;\n}\n\nfunction isMitosisTextNode(node: MNode): boolean {\n return Object.hasOwn(node.properties ?? {}, \"_text\") || Object.hasOwn(node.bindings ?? {}, \"_text\");\n}\n\nfunction lowerNamedComponentSlots(nodes: MNode[], target: MitosisTarget): MNode[] {\n const result: MNode[] = [];\n for (const sourceNode of nodes) {\n const node: MNode = {\n ...sourceNode,\n properties: { ...(sourceNode.properties ?? {}) },\n bindings: { ...(sourceNode.bindings ?? {}) },\n children: Array.isArray(sourceNode.children) ? lowerNamedComponentSlots(sourceNode.children, target) : sourceNode.children,\n ...(sourceNode.slots ? {\n slots: Object.fromEntries(Object.entries(sourceNode.slots).map(([name, children]) => [name, lowerNamedComponentSlots(children as MNode[], target)])),\n } : {}),\n };\n\n if (target === \"builder\" && node.slots) {\n for (const slotChildren of Object.values(node.slots) as MNode[][]) slotChildren.forEach(decodeSlotText);\n } else if (target === \"solid\" && node.slots) {\n for (const [slotName, slotChildren] of Object.entries(node.slots) as [string, MNode[]][]) {\n if (slotChildren.length !== 1) continue;\n const slotChild = decodeSlotText(slotChildren[0]);\n if (Object.hasOwn(slotChild.bindings ?? {}, \"_text\")) node.bindings[slotName] = slotChild.bindings._text;\n else if (typeof slotChild.properties?._text === \"string\") node.properties[slotName] = slotChild.properties._text;\n }\n delete node.slots;\n } else if (target === \"reactNative\" && node.slots) {\n for (const slotChildren of Object.values(node.slots) as MNode[][]) {\n for (const child of slotChildren) {\n const decoded = decodeSlotText(child).properties?._text;\n if (typeof decoded === \"string\" && !Object.hasOwn(child.bindings ?? {}, \"_text\")) {\n child.bindings ??= {};\n child.bindings._text = { code: JSON.stringify(decoded), type: \"single\", bindingType: \"expression\" };\n delete child.properties._text;\n }\n }\n }\n } else if (nativeSlotProjectionTargets.has(target) && node.slots) {\n const projected: MNode[] = [];\n for (const [slotName, slotChildren] of Object.entries(node.slots) as [string, MNode[]][]) {\n const children = slotChildren.map(decodeSlotText);\n if (target === \"vue\" || target === \"svelte\") {\n projected.push({\n \"@type\": \"@builder.io/mitosis/node\",\n name: target === \"vue\" ? \"template\" : \"svelte:fragment\",\n properties: target === \"vue\" ? { [`v-slot:${slotName}`]: \"\" } : { slot: slotName },\n bindings: {},\n meta: {},\n scope: {},\n children,\n });\n continue;\n }\n if (target === \"marko\") {\n projected.push({\n \"@type\": \"@builder.io/mitosis/node\",\n name: `@${slotName}`,\n properties: {},\n bindings: {},\n meta: {},\n scope: {},\n children,\n });\n continue;\n }\n\n const slotAttribute = target === \"qwik\" ? \"q:slot\" : target === \"angular\" ? slotName : \"slot\";\n for (const child of children) {\n if (isMitosisTextNode(child)) {\n projected.push({\n \"@type\": \"@builder.io/mitosis/node\",\n name: \"span\",\n properties: { [slotAttribute]: slotName },\n bindings: {},\n meta: {},\n scope: {},\n children: [child],\n });\n } else {\n child.properties ??= {};\n child.properties[slotAttribute] = slotAttribute === slotName ? \"\" : slotName;\n projected.push(child);\n }\n }\n }\n node.children = [...(node.children ?? []), ...projected];\n delete node.slots;\n }\n\n if (node.name === \"Slot\" && target === \"marko\") {\n node.name = node.properties.name ? `@${node.properties.name}` : \"@renderBody\";\n delete node.properties.name;\n } else if (node.name === \"Slot\" && target === \"solid\") {\n const slotName = node.properties.name;\n const code = typeof slotName === \"string\" && slotName !== \"default\" ? `props.${slotName}` : \"props.children\";\n const valueNode: MNode = {\n \"@type\": \"@builder.io/mitosis/node\",\n name: \"div\",\n properties: {},\n bindings: { _text: { code, type: \"single\", bindingType: \"expression\" } },\n meta: {},\n scope: {},\n children: [],\n };\n if (node.children?.length) {\n node.name = \"Show\";\n node.properties = {};\n node.bindings = { when: { code, type: \"single\", bindingType: \"expression\" } };\n node.meta = { ...node.meta, else: { \"@type\": \"@builder.io/mitosis/node\", name: \"Fragment\", properties: {}, bindings: {}, meta: {}, scope: {}, children: node.children } };\n node.children = [valueNode];\n } else {\n node.name = valueNode.name;\n node.properties = valueNode.properties;\n node.bindings = valueNode.bindings;\n node.meta = valueNode.meta;\n node.children = [];\n }\n } else if (node.name === \"Slot\" && nativeSlotOutletTargets.has(target)) node.name = \"slot\";\n result.push(node);\n }\n return result;\n}\n\nfunction resultFiles(value: unknown, target: string, name: string): { path: string; contents: string; kind: \"component\" | \"style\" | \"metadata\" }[] {\n if (typeof value === \"string\") return [{ path: `${name}.${extensionFor(target)}`, contents: value, kind: \"component\" }];\n if (value && typeof value === \"object\") {\n const obj = value as Record<string, unknown>;\n if (typeof obj.code === \"string\") return [{ path: `${name}.${extensionFor(target)}`, contents: obj.code, kind: \"component\" }];\n if (Array.isArray(obj.files)) return obj.files.flatMap((f: any, i: number) => typeof f === \"string\" ? [{ path: `${name}${i ? `-${i}` : \"\"}.${extensionFor(target)}`, contents: f, kind: \"component\" as const }] : typeof f?.contents === \"string\" ? [{ path: f.path || `${name}${i ? `-${i}` : \"\"}.${extensionFor(target)}`, contents: f.contents, kind: f.kind === \"style\" ? \"style\" as const : \"component\" as const }] : []);\n }\n return [{ path: `${name}.${extensionFor(target)}`, contents: JSON.stringify(value, null, 2), kind: \"component\" }];\n}\nfunction extensionFor(target: string): string {\n const extensions: Record<string, string> = { builder: \"json\", webcomponent: \"js\", react: \"tsx\", preact: \"tsx\", reactNative: \"tsx\", solid: \"tsx\", angular: \"ts\", vue: \"vue\", svelte: \"svelte\", qwik: \"tsx\", stencil: \"tsx\", lit: \"ts\", html: \"html\", customElement: \"js\", liquid: \"liquid\", alpine: \"html\", marko: \"marko\", mitosis: \"lite.tsx\", swift: \"swift\", taro: \"tsx\", template: \"template\", rsc: \"tsx\" };\n return extensions[target] ?? \"txt\";\n}\nexport function generateWithMitosis(context: GenerationContext): GenerationResult {\n const target = context.target as MitosisTarget;\n if (!(target in generators)) throw new Error(`Unsupported Mitosis target: ${target}`);\n const component = componentIRToMitosis(context.component);\n component.children = lowerNamedComponentSlots(component.children, target);\n const qwikBaseline = target === \"qwik\" ? JSON.parse(JSON.stringify(component)) as MComponent : undefined;\n const qwikDefaults = target === \"qwik\" ? applyQwikPropDefaults(component, context.component.props) : [];\n if (target === \"swift\") {\n applySwiftPropTypes(component, context.component.props);\n applySwiftPropDefaults(component.children, context.component.props);\n }\n if (expressionPropDefaultTargets.has(target)) applyExpressionPropDefaults(component.children, context.component.props);\n if (target === \"liquid\") component.children = lowerLiquidElseBranches(component.children, component, context.options);\n if (target === \"reactNative\") normalizeReactNativeFragmentLinks(component);\n if (siblingElseTargets.has(target)) component.children = lowerElseBranches(component.children);\n if (target === \"swift\") component.children = normalizeSwiftShowBranches(component.children);\n let output = generators[target](component, context.options);\n let qwikDefaultsInjected = true;\n if (target === \"qwik\" && qwikDefaults.length > 0) {\n const outputWithDefaults = typeof output === \"string\" ? addQwikPropDefaults(output, qwikDefaults) : undefined;\n if (outputWithDefaults === undefined) {\n output = generators.qwik(qwikBaseline as MComponent, context.options);\n qwikDefaultsInjected = false;\n } else {\n output = outputWithDefaults;\n }\n }\n if (target === \"liquid\" && typeof output === \"string\") output = addLiquidPropDefaults(output, context.component);\n if (target === \"swift\" && typeof output === \"string\") output = addSwiftPropDefaults(output, context.component.props);\n const emitsPropTypes = context.options.typescript === true && propTypeTargets.has(target);\n const emitsStateTypes = context.options.typescript === true && stateTypeTargets.has(target);\n const diagnostics: Diagnostic[] = [\n {\n severity: \"warning\",\n code: \"MITOSIS_TARGET_SEMANTICS_UNVERIFIED\",\n message: `DesignOS has smoke-tested code generation for ${target}, but has not verified semantic parity for this target.`,\n path: `target.${target}`,\n },\n ...context.component.props\n .filter((prop) => prop.type !== undefined)\n .filter((prop) => target === \"swift\"\n ? !swiftPrimitiveType(prop.type)\n : !emitsPropTypes || typeof prop.type !== \"string\" || !prop.type.trim())\n .map((prop) => ({\n severity: \"warning\" as const,\n code: \"MITOSIS_PROP_TYPE_NOT_PRESERVED\",\n message: `The ${target} Mitosis output does not preserve the type annotation for prop \"${prop.name}\" with the current target options.`,\n path: `props.${prop.name}.type`,\n })),\n ...context.component.state\n .filter((state) => state.type !== undefined)\n .filter((state) => !emitsStateTypes || typeof state.type !== \"string\" || !state.type.trim())\n .map((state) => ({\n severity: \"warning\" as const,\n code: \"MITOSIS_STATE_TYPE_NOT_PRESERVED\",\n message: `The ${target} Mitosis output does not preserve the type annotation for state \"${state.name}\" with the current target options.`,\n path: `state.${state.name}.type`,\n })),\n ...context.component.props\n .filter((prop) => prop.defaultValue !== undefined)\n .filter((prop) => !preservesPropDefault(target, prop.name, prop.defaultValue, prop.type)\n || (target === \"qwik\" && !qwikDefaultsInjected))\n .map((prop) => ({\n severity: \"warning\" as const,\n code: \"MITOSIS_PROP_DEFAULT_NOT_PRESERVED\",\n message: `The ${target} Mitosis output does not preserve the default value for prop \"${prop.name}\".`,\n path: `props.${prop.name}.defaultValue`,\n })),\n ...(hasUnsupportedNamedComponentSlots(context.component.root, target) ? [{\n severity: \"warning\" as const,\n code: \"MITOSIS_NAMED_COMPONENT_SLOT_NOT_PRESERVED\",\n message: `The ${target} Mitosis output does not preserve named component slots for the current target.`,\n path: \"root.slots\",\n }] : []),\n ...(hasUnsupportedNamedSlotOutlet(context.component.root, target) ? [{\n severity: \"warning\" as const,\n code: \"MITOSIS_SLOT_OUTLET_NOT_PRESERVED\",\n message: \"The SwiftUI output does not connect a slot outlet to caller-provided content; only fallback markup may render.\",\n path: \"root.slot\",\n }] : []),\n ...(target === \"liquid\" && hasUnsupportedLiquidElse(context.component.root) ? [{\n severity: \"warning\" as const,\n code: \"MITOSIS_CONDITIONAL_ELSE_NOT_PRESERVED\",\n message: \"The Liquid target cannot safely lower this conditional else expression.\",\n path: \"root.otherwise\",\n }] : []),\n ...(eventlessTargets.has(target) && hasEventHandlers(context.component.root) ? [{\n severity: \"warning\" as const,\n code: \"MITOSIS_EVENT_HANDLER_NOT_PRESERVED\",\n message: `The ${target} target has no interactive event runtime and cannot preserve event handler bindings.`,\n path: \"root.events\",\n }] : []),\n ];\n return { target: context.target, files: resultFiles(output, target, context.component.name), diagnostics };\n}\n\nfunction mitosisNodeHasEventBindings(node: MNode): boolean {\n if (Object.entries(node.bindings ?? {}).some(([name, binding]: [string, any]) =>\n /^on[A-Z]/.test(name) && binding?.bindingType === \"function\",\n )) return true;\n if ((node.children ?? []).some((child: MNode) => mitosisNodeHasEventBindings(child))) return true;\n return Object.values(node.slots ?? {}).some((children: any) => Array.isArray(children) && children.some((child: MNode) => mitosisNodeHasEventBindings(child)));\n}\n\nfunction mitosisNodeHasNamedSlots(node: MNode): boolean {\n if (Object.keys(node.slots ?? {}).some((name) => name !== \"default\")) return true;\n if (typeof node.properties?.slot === \"string\" && node.properties.slot !== \"\" && node.properties.slot !== \"default\") return true;\n if ((node.children ?? []).some((child: MNode) => mitosisNodeHasNamedSlots(child))) return true;\n return Object.values(node.slots ?? {}).some((children: any) => Array.isArray(children) && children.some((child: MNode) => mitosisNodeHasNamedSlots(child)));\n}\n\nfunction mitosisNodeHasSlotOutlet(node: MNode): boolean {\n if (node.name === \"Slot\") return true;\n if ((node.children ?? []).some((child: MNode) => mitosisNodeHasSlotOutlet(child))) return true;\n return Object.values(node.slots ?? {}).some((children: any) => Array.isArray(children) && children.some((child: MNode) => mitosisNodeHasSlotOutlet(child)));\n}\n\n/** Generate directly from Mitosis parser output so hooks, context, refs, subcomponents,\n * target blocks and other upstream semantics are not narrowed through ComponentIR. */\nexport function generateMitosisSourceComponent(\n authoredComponent: MitosisComponent,\n target: MitosisTarget,\n options: Record<string, unknown> = {},\n): GenerationResult {\n if (!(target in generators)) throw new Error(`Unsupported Mitosis target: ${target}`);\n const component = structuredClone(authoredComponent) as MComponent;\n component.children = lowerNamedComponentSlots(component.children ?? [], target);\n if (target === \"liquid\") component.children = lowerLiquidElseBranches(component.children, component, options);\n if (target === \"reactNative\") normalizeReactNativeFragmentLinks(component);\n if (siblingElseTargets.has(target)) component.children = lowerElseBranches(component.children);\n if (target === \"swift\") component.children = normalizeSwiftShowBranches(component.children);\n\n const output = generators[target](component, options);\n const diagnostics: Diagnostic[] = [{\n severity: \"warning\",\n code: \"MITOSIS_TARGET_SEMANTICS_UNVERIFIED\",\n message: `DesignOS has not verified semantic parity for all Mitosis source features on ${target}; output is generated by the upstream Mitosis target emitter.`,\n path: `target.${target}`,\n }];\n if (eventlessTargets.has(target) && (component.hooks?.onEvent?.length || component.children.some((node: MNode) => mitosisNodeHasEventBindings(node)))) {\n diagnostics.push({\n severity: \"warning\",\n code: \"MITOSIS_EVENT_HANDLER_NOT_PRESERVED\",\n message: `The ${target} target has no interactive event runtime and cannot preserve event handler bindings.`,\n path: \"source.events\",\n });\n }\n if (target === \"swift\" && component.children.some((node: MNode) => mitosisNodeHasNamedSlots(node))) {\n diagnostics.push({\n severity: \"warning\",\n code: \"MITOSIS_NAMED_COMPONENT_SLOT_NOT_PRESERVED\",\n message: \"The Swift target adapter does not preserve named component slot composition.\",\n path: \"source.children.slots\",\n });\n }\n if (target === \"swift\" && component.children.some((node: MNode) => mitosisNodeHasSlotOutlet(node))) {\n diagnostics.push({\n severity: \"warning\",\n code: \"MITOSIS_SLOT_OUTLET_NOT_PRESERVED\",\n message: \"The Swift target output does not connect a Mitosis Slot outlet to caller-provided content; only fallback markup may render.\",\n path: \"source.children.slot\",\n });\n }\n return { target, files: resultFiles(output, target, component.name), diagnostics };\n}\n\nfunction generateProjectRegistry(target: \"react\" | \"vue\", entries: CompilerProjectRegistryEntry[]): GeneratedFile {\n const imports = entries.map((entry, index) => {\n const modulePath = target === \"vue\" ? entry.modulePath : entry.modulePath.replace(/\\.(?:tsx?|jsx?)$/, \"\");\n return `import DesignOSComponent${index} from ${JSON.stringify(`./${modulePath}`)};`;\n });\n const registrations = entries.map((entry, index) => ` ${JSON.stringify(entry.type)}: DesignOSComponent${index},`);\n return {\n path: \"components.ts\",\n kind: \"metadata\",\n contents: [\n ...imports,\n \"\",\n \"export const components = {\",\n ...registrations,\n \"};\",\n \"\",\n \"export default components;\",\n \"\",\n ].join(\"\\n\"),\n };\n}\n\nexport function createMitosisTarget(target: MitosisTarget) {\n return {\n name: target,\n generate: (context: GenerationContext) => generateWithMitosis(context),\n generateMitosis: (component: MitosisComponent, options: Record<string, unknown>) => generateMitosisSourceComponent(component, target, options),\n ...((target === \"react\" || target === \"vue\")\n ? { generateProjectRegistry: (entries: CompilerProjectRegistryEntry[]) => generateProjectRegistry(target, entries) }\n : {}),\n };\n}\nexport function createMitosisCompiler(): TargetRegistry {\n const registry = new TargetRegistry();\n for (const target of mitosisTargets) registry.register(createMitosisTarget(target));\n return registry;\n}\n","import { parseJsx } from \"@builder.io/mitosis\";\nimport type { MitosisComponent } from \"@builder.io/mitosis/types\";\n\nexport interface ParseMitosisSourceOptions {\n filePath?: string;\n /** Preserve JSX blocks nested in component props when the upstream parser supports them. */\n enableBlocksSlots?: boolean;\n}\n\ninterface DesignOSSourceProp {\n name: string;\n optional: boolean;\n defaultValue?: unknown;\n}\n\nfunction parseLiteral(value: string): unknown {\n try {\n return JSON.parse(value.trim().replace(/'/g, '\"'));\n } catch {\n return undefined;\n }\n}\n\nfunction findTypeDeclarationBody(source: string, propsTypeRef: string): string | undefined {\n const declaration = source.match(new RegExp(`(?:interface|type)\\\\s+${propsTypeRef}\\\\s*(?:=)?\\\\s*\\\\{`));\n if (!declaration || declaration.index === undefined) return undefined;\n const start = declaration.index + declaration[0].length - 1;\n let depth = 0;\n let quote: string | undefined;\n let escaped = false;\n for (let index = start; index < source.length; index += 1) {\n const character = source[index];\n if (quote) {\n if (escaped) escaped = false;\n else if (character === \"\\\\\") escaped = true;\n else if (character === quote) quote = undefined;\n continue;\n }\n if (character === \"'\" || character === '\"' || character === \"`\") {\n quote = character;\n continue;\n }\n if (character === \"{\") depth += 1;\n else if (character === \"}\" && --depth === 0) return source.slice(start + 1, index);\n }\n return undefined;\n}\n\nfunction splitTopLevelFields(body: string): string[] {\n const fields: string[] = [];\n let start = 0;\n let depth = 0;\n for (let index = 0; index < body.length; index += 1) {\n if (body[index] === \"{\" || body[index] === \"[\" || body[index] === \"<\") depth += 1;\n else if (body[index] === \"}\" || body[index] === \"]\" || body[index] === \">\") depth = Math.max(0, depth - 1);\n else if (body[index] === \";\" && depth === 0) {\n fields.push(body.slice(start, index));\n start = index + 1;\n }\n }\n fields.push(body.slice(start));\n return fields;\n}\n\nfunction extractDesignOSSourceProps(source: string, propsTypeRef: string | undefined): DesignOSSourceProp[] {\n if (!propsTypeRef) return [];\n const body = findTypeDeclarationBody(source, propsTypeRef);\n if (body === undefined) return [];\n const props = new Map<string, DesignOSSourceProp>();\n for (const field of splitTopLevelFields(body)) {\n const match = field.trim().match(/^([A-Za-z_$][\\w$]*)\\s*(\\?)?\\s*:\\s*([^\\n]+)$/);\n if (!match) continue;\n props.set(match[1], { name: match[1], optional: Boolean(match[2]) });\n }\n const destructured = source.match(/function\\s+\\w+\\s*\\(\\s*\\{([\\s\\S]*?)\\}\\s*(?::[^)]*)?\\)/);\n if (destructured) {\n for (const part of destructured[1].split(\",\")) {\n const match = part.trim().match(/^([A-Za-z_$][\\w$]*)\\s*=\\s*(.+)$/);\n if (!match || !props.has(match[1])) continue;\n const value = parseLiteral(match[2]);\n if (value !== undefined) props.get(match[1])!.defaultValue = value;\n }\n }\n return [...props.values()];\n}\n\n/**\n * Parse developer-authored TSX with the same Mitosis parser used by its compiler.\n * The returned Mitosis component is retained intact; it is not reverse-mapped\n * through DesignOS ComponentIR, which cannot represent every Mitosis feature.\n */\nexport function parseMitosisSource(source: string, options: ParseMitosisSourceOptions = {}): MitosisComponent {\n if (typeof source !== \"string\") throw new TypeError(\"Mitosis source must be a string\");\n\n try {\n const component = parseJsx(source, {\n typescript: true,\n enableBlocksSlots: options.enableBlocksSlots ?? true,\n ...(options.filePath ? { filePath: options.filePath } : {}),\n });\n const designosProps = extractDesignOSSourceProps(source, component.propsTypeRef);\n if (designosProps.length > 0) component.meta = { ...component.meta, designosProps: designosProps as any };\n return component;\n } catch (cause) {\n const message = cause instanceof Error ? cause.message : String(cause);\n throw new Error(`Unable to parse DesignOS TSX${options.filePath ? ` at ${options.filePath}` : \"\"}: ${message}`, { cause });\n }\n}\n","import type { ComponentManifest, PageNode } from \"@designos/core\";\nimport type { MitosisComponent } from \"@builder.io/mitosis/types\";\n\nexport type CompilerTarget = \"react\" | \"vue\" | \"angular\" | \"html\" | \"svelte\" | \"solid\" | \"alpine\" | \"builder\" | \"customElement\" | \"liquid\" | \"lit\" | \"marko\" | \"mitosis\" | \"preact\" | \"qwik\" | \"reactNative\" | \"rsc\" | \"stencil\" | \"swift\" | \"taro\" | \"template\" | \"webcomponent\";\n\nexport interface IRImport {\n source: string;\n names: string[];\n typeOnly?: boolean;\n}\n\nexport interface IRProp {\n name: string;\n type?: string;\n optional?: boolean;\n defaultValue?: unknown;\n}\n\nexport interface IRState {\n name: string;\n type?: string;\n initialValue: string;\n}\n\nexport interface IRBinding {\n code: string;\n kind: \"expression\" | \"event\" | \"spread\";\n eventName?: string;\n parameters?: string[];\n}\n\nexport interface IRAttribute {\n name: string;\n value?: string;\n binding?: IRBinding;\n}\n\nexport interface IRTextNode {\n kind: \"text\";\n value: string;\n}\n\nexport interface IRExpressionNode {\n kind: \"expression\";\n binding: IRBinding;\n}\n\nexport interface IRElementNode {\n kind: \"element\";\n tag: string;\n attributes?: IRAttribute[];\n children?: IRNode[];\n}\n\nexport interface IRComponentNode {\n kind: \"component\";\n name: string;\n attributes?: IRAttribute[];\n children?: IRNode[];\n slots?: Record<string, IRNode[]>;\n}\n\nexport interface IRFragmentNode {\n kind: \"fragment\";\n children: IRNode[];\n}\n\nexport interface IRConditionalNode {\n kind: \"conditional\";\n condition: IRBinding;\n then: IRNode[];\n otherwise?: IRNode[];\n}\n\nexport interface IRLoopNode {\n kind: \"loop\";\n collection: IRBinding;\n itemName: string;\n indexName?: string;\n children: IRNode[];\n}\n\nexport interface IRSlotNode {\n kind: \"slot\";\n name?: string;\n fallback?: IRNode[];\n}\n\nexport type IRNode = IRTextNode | IRExpressionNode | IRElementNode | IRComponentNode | IRFragmentNode | IRConditionalNode | IRLoopNode | IRSlotNode;\n\nexport interface ComponentIR {\n version: \"0.1\";\n name: string;\n imports: IRImport[];\n props: IRProp[];\n state: IRState[];\n root: IRNode;\n styles?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface ComponentSource {\n manifest: ComponentManifest;\n implementation: { kind: \"ir\"; component: ComponentIR }\n | { kind: \"mitosis\"; component: MitosisComponent }\n | { kind: \"runtime\"; module: string; exportName?: string };\n}\n\n/** A project-local file used by a component implementation. */\nexport interface ComponentAssetReference {\n /** Path relative to the DesignOS project root; absolute paths and traversal are not allowed. */\n source: string;\n /** Path relative to the generated target directory. Defaults to `source`. */\n outputPath?: string;\n}\n\n/** A component definition that can be compiled for a framework target. */\nexport type CompilerProjectComponent = Omit<ComponentSource, \"implementation\"> & {\n /** Project compilation accepts neutral DesignOS IR or a parsed Mitosis component. */\n implementation: { kind: \"ir\"; component: ComponentIR } | { kind: \"mitosis\"; component: MitosisComponent };\n /** Target-relative module directory; defaults to `components` and preserves relative import layout. */\n outputDirectory?: string;\n /** CSS/resources imported by the generated entry module; copied with the project assets. */\n styles?: ComponentAssetReference[];\n assets?: ComponentAssetReference[];\n};\n\n/** Framework-neutral component source catalog consumed by the future project compiler. */\nexport interface CompilerProject {\n schemaVersion: \"1\";\n components: CompilerProjectComponent[];\n}\n\n/** File-based DesignOS source project consumed by the CLI. */\nexport interface CompilerSourceProjectComponent {\n source: string;\n manifest: string;\n exportName?: string;\n outputDirectory?: string;\n styles?: ComponentAssetReference[];\n assets?: ComponentAssetReference[];\n}\n\nexport interface CompilerSourceProject {\n schemaVersion: \"2\";\n components: CompilerSourceProjectComponent[];\n}\n\nexport interface Diagnostic {\n severity: \"error\" | \"warning\" | \"info\";\n code: string;\n message: string;\n path?: string;\n}\n\nexport interface GeneratedFile {\n path: string;\n contents: string;\n kind: \"component\" | \"style\" | \"metadata\";\n}\n\nexport interface GenerationContext {\n target: CompilerTarget;\n component: ComponentIR;\n options: Record<string, unknown>;\n}\n\nexport interface GenerationResult {\n target: CompilerTarget;\n files: GeneratedFile[];\n diagnostics: Diagnostic[];\n}\n\nexport interface CompilerPlugin {\n name: string;\n order?: number;\n beforeNormalize?(component: ComponentIR): ComponentIR | void;\n afterNormalize?(component: ComponentIR): ComponentIR | void;\n beforeGenerate?(context: GenerationContext): void | Promise<void>;\n afterGenerate?(result: GenerationResult): GenerationResult | void | Promise<GenerationResult | void>;\n}\n\nexport interface CompilerProjectRegistryEntry {\n /** Framework-neutral serialized component type used by PageNode.type. */\n type: string;\n /** Generated module path relative to the target output directory. */\n modulePath: string;\n}\n\nexport interface CompilerTargetDefinition {\n name: CompilerTarget;\n generate(context: GenerationContext): GenerationResult;\n /** Optional lossless path for components parsed from the Mitosis TSX contract. */\n generateMitosis?(component: MitosisComponent, options: Record<string, unknown>): GenerationResult;\n /** Optional target-specific source file that maps PageNode types to generated framework modules. */\n generateProjectRegistry?(entries: CompilerProjectRegistryEntry[]): GeneratedFile;\n}\n\nexport class TargetRegistry {\n private readonly targets = new Map<CompilerTarget, CompilerTargetDefinition>();\n\n register(target: CompilerTargetDefinition): void {\n if (this.targets.has(target.name)) throw new Error(`Compiler target already registered: ${target.name}`);\n this.targets.set(target.name, target);\n }\n\n get(target: CompilerTarget): CompilerTargetDefinition {\n const definition = this.targets.get(target);\n if (!definition) throw new Error(`Compiler target not registered: ${target}`);\n return definition;\n }\n\n names(): CompilerTarget[] { return [...this.targets.keys()]; }\n}\n\nexport interface CompileOptions {\n target: CompilerTarget;\n targetOptions?: Record<string, unknown>;\n plugins?: CompilerPlugin[];\n}\n\nexport interface CompilerProjectAssetOutput {\n /** Source path relative to the project root. */\n source: string;\n /** Destination path relative to the compiler output directory. */\n outputPath: string;\n}\n\nexport interface CompileProjectResult {\n target: CompilerTarget;\n files: GeneratedFile[];\n assets: CompilerProjectAssetOutput[];\n diagnostics: Diagnostic[];\n}\n\nexport function normalizeComponent(component: ComponentIR): ComponentIR {\n return structuredClone(component);\n}\n\nexport function validateComponentIR(component: ComponentIR): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n if (!component || typeof component !== \"object\") {\n return [{ severity: \"error\", code: \"COMPONENT_IR_REQUIRED\", message: \"ComponentIR must be an object\", path: \"component\" }];\n }\n if (typeof component.name !== \"string\" || !component.name.trim()) diagnostics.push({ severity: \"error\", code: \"COMPONENT_NAME_REQUIRED\", message: \"ComponentIR.name is required\", path: \"name\" });\n if (!component.root || typeof component.root !== \"object\") diagnostics.push({ severity: \"error\", code: \"COMPONENT_ROOT_REQUIRED\", message: \"ComponentIR.root is required\", path: \"root\" });\n if (!Array.isArray(component.imports)) diagnostics.push({ severity: \"error\", code: \"COMPONENT_IMPORTS_INVALID\", message: \"ComponentIR.imports must be an array\", path: \"imports\" });\n if (!Array.isArray(component.state)) diagnostics.push({ severity: \"error\", code: \"COMPONENT_STATE_INVALID\", message: \"ComponentIR.state must be an array\", path: \"state\" });\n if (!Array.isArray(component.props)) {\n diagnostics.push({ severity: \"error\", code: \"COMPONENT_PROPS_INVALID\", message: \"ComponentIR.props must be an array\", path: \"props\" });\n return diagnostics;\n }\n const names = new Set<string>();\n for (const prop of component.props) {\n if (names.has(prop.name)) diagnostics.push({ severity: \"error\", code: \"DUPLICATE_PROP\", message: `Duplicate prop: ${prop.name}`, path: \"props\" });\n names.add(prop.name);\n }\n return diagnostics;\n}\n\nfunction serializedValue(value: unknown): string {\n if (value === undefined) return \"undefined\";\n return JSON.stringify(value, (_key, nested) => {\n if (!nested || typeof nested !== \"object\" || Array.isArray(nested)) return nested;\n return Object.fromEntries(Object.entries(nested).sort(([left], [right]) => left.localeCompare(right)));\n });\n}\n\n/**\n * Manifest defaults populate authored PageNodes; source defaults remain runtime\n * fallbacks. A mismatch is reported instead of silently rewriting either side.\n */\nexport function validateManifestImplementationContract(\n manifest: ComponentManifest,\n implementation: CompilerProjectComponent[\"implementation\"],\n path = \"component\",\n): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n const sourceProps = implementation.kind === \"ir\"\n ? new Map(implementation.component.props.map((prop) => [prop.name, prop]))\n : new Map(\n ((implementation.component.meta as { designosProps?: Array<{ name: string; optional: boolean; defaultValue?: unknown }> } | undefined)?.designosProps ?? [])\n .map((prop) => [prop.name, prop]),\n );\n const manifestFields = new Map(manifest.fields.map((field) => [field.name, field]));\n const supportsChildren = Boolean(\n manifest.capabilities?.canHaveChildren\n || manifest.slots?.some((slot) => slot.name === \"default\" || slot.name === \"children\"),\n );\n\n for (const prop of sourceProps.values()) {\n if (prop.name === \"children\" && supportsChildren) continue;\n if (!manifestFields.has(prop.name)) diagnostics.push({\n severity: \"warning\",\n code: \"COMPILER_PROJECT_SOURCE_PROP_NOT_IN_MANIFEST\",\n message: `Source prop \"${prop.name}\" is not editable through manifest \"${manifest.type}\".`,\n path: `${path}.implementation.component.props.${prop.name}`,\n });\n }\n\n for (const field of manifest.fields) {\n const prop = sourceProps.get(field.name);\n if (!prop) {\n if (field.required) diagnostics.push({\n severity: \"error\",\n code: \"COMPILER_PROJECT_REQUIRED_FIELD_NOT_IN_SOURCE\",\n message: `Required manifest field \"${field.name}\" is not declared by the source component.`,\n path: `${path}.manifest.fields.${field.name}`,\n });\n continue;\n }\n if (field.defaultValue !== undefined && prop.defaultValue !== undefined && serializedValue(field.defaultValue) !== serializedValue(prop.defaultValue)) diagnostics.push({\n severity: \"error\",\n code: \"COMPILER_PROJECT_DEFAULT_MISMATCH\",\n message: `Manifest default for \"${field.name}\" differs from the source runtime default; manifest defaults win for authored page data and source defaults remain runtime fallbacks.`,\n path: `${path}.manifest.fields.${field.name}.defaultValue`,\n });\n }\n\n return diagnostics;\n}\n\nfunction isSafeRelativePath(value: unknown): value is string {\n return typeof value === \"string\"\n && value.length > 0\n && !value.startsWith(\"/\")\n && !value.includes(\"\\\\\")\n && !/^[A-Za-z]:/.test(value)\n && value.split(\"/\").every((part) => part.length > 0 && part !== \".\" && part !== \"..\");\n}\n\nexport function validateCompilerProject(project: CompilerProject): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n if (!project || typeof project !== \"object\" || project.schemaVersion !== \"1\") {\n return [{ severity: \"error\", code: \"COMPILER_PROJECT_SCHEMA_VERSION_UNSUPPORTED\", message: \"CompilerProject.schemaVersion must be \\\"1\\\"\", path: \"schemaVersion\" }];\n }\n if (!Array.isArray(project.components)) {\n return [{ severity: \"error\", code: \"COMPILER_PROJECT_COMPONENTS_REQUIRED\", message: \"CompilerProject.components must be an array\", path: \"components\" }];\n }\n\n const componentTypes = new Set<string>();\n const componentNames = new Set<string>();\n const assetOutputs = new Map<string, string>();\n\n project.components.forEach((definition, index) => {\n const prefix = `components[${index}]`;\n const manifest = definition?.manifest;\n const implementation = definition?.implementation;\n const type = manifest?.type;\n\n if (typeof type !== \"string\" || !type.trim()) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_COMPONENT_TYPE_REQUIRED\", message: \"Component manifest type must be a non-empty string\", path: `${prefix}.manifest.type` });\n } else if (componentTypes.has(type)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_DUPLICATE_COMPONENT_TYPE\", message: `Duplicate component manifest type: ${type}`, path: `${prefix}.manifest.type` });\n } else {\n componentTypes.add(type);\n }\n\n if (!manifest || typeof manifest.displayName !== \"string\" || !manifest.displayName.trim() || !Array.isArray(manifest.fields)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_COMPONENT_MANIFEST_INVALID\", message: \"Component manifest requires a displayName and fields array\", path: `${prefix}.manifest` });\n }\n\n if (!implementation || (implementation.kind !== \"ir\" && implementation.kind !== \"mitosis\") || !implementation.component) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_IMPLEMENTATION_INVALID\", message: \"Project compilation requires a DesignOS IR or parsed Mitosis component implementation\", path: `${prefix}.implementation` });\n } else {\n const name: unknown = implementation.component.name;\n if (typeof name !== \"string\" || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_COMPONENT_NAME_INVALID\", message: `Component name must be a valid identifier for generated framework components: ${name}`, path: `${prefix}.implementation.component.name` });\n } else if (componentNames.has(name)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_DUPLICATE_COMPONENT_NAME\", message: `Duplicate component implementation name: ${name}`, path: `${prefix}.implementation.component.name` });\n } else {\n componentNames.add(name);\n }\n if (implementation.kind === \"ir\") {\n diagnostics.push(...validateComponentIR(implementation.component).map((diagnostic) => ({\n ...diagnostic,\n path: diagnostic.path ? `${prefix}.implementation.component.${diagnostic.path}` : `${prefix}.implementation.component`,\n })));\n } else if (implementation.component[\"@type\"] !== \"@builder.io/mitosis/component\") {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_MITOSIS_COMPONENT_INVALID\", message: \"Parsed Mitosis implementation has an invalid component discriminator\", path: `${prefix}.implementation.component.@type` });\n }\n if (manifest && Array.isArray(manifest.fields)) diagnostics.push(...validateManifestImplementationContract(manifest, implementation, prefix));\n }\n\n const outputDirectory = definition?.outputDirectory ?? \"components\";\n if (!isSafeRelativePath(outputDirectory)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_OUTPUT_DIRECTORY_INVALID\", message: \"outputDirectory must be a safe path relative to the target output directory\", path: `${prefix}.outputDirectory` });\n }\n\n for (const collection of [\"styles\", \"assets\"] as const) {\n const references = definition?.[collection];\n if (references !== undefined && !Array.isArray(references)) {\n diagnostics.push({ severity: \"error\", code: `COMPILER_PROJECT_${collection.toUpperCase()}_INVALID`, message: `${collection} must be an array`, path: `${prefix}.${collection}` });\n }\n for (const [assetIndex, asset] of (Array.isArray(references) ? references : []).entries()) {\n const assetPath = `${prefix}.${collection}[${assetIndex}]`;\n if (!isSafeRelativePath(asset.source)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_ASSET_SOURCE_PATH_INVALID\", message: \"Asset source must be a safe path relative to the project root\", path: `${assetPath}.source` });\n continue;\n }\n const outputPath = asset.outputPath ?? asset.source;\n if (!isSafeRelativePath(outputPath)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_ASSET_OUTPUT_PATH_INVALID\", message: \"Asset outputPath must be a safe path relative to the generated output directory\", path: `${assetPath}.outputPath` });\n continue;\n }\n const normalizedOutputPath = outputPath.toLowerCase();\n const existingSource = assetOutputs.get(normalizedOutputPath);\n if (existingSource && existingSource !== asset.source) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_ASSET_OUTPUT_COLLISION\", message: `Different assets target the same output path: ${outputPath}`, path: `${assetPath}.outputPath` });\n } else {\n assetOutputs.set(normalizedOutputPath, asset.source);\n }\n }\n }\n });\n\n return diagnostics;\n}\n\nexport async function compileComponent(\n component: ComponentIR,\n registry: TargetRegistry,\n options: CompileOptions,\n): Promise<GenerationResult> {\n const plugins = [...(options.plugins ?? [])].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n let normalized = normalizeComponent(component);\n for (const plugin of plugins) normalized = plugin.beforeNormalize?.(normalized) ?? normalized;\n for (const plugin of plugins) normalized = plugin.afterNormalize?.(normalized) ?? normalized;\n const diagnostics = validateComponentIR(normalized);\n if (diagnostics.some((diagnostic) => diagnostic.severity === \"error\")) {\n return { target: options.target, files: [], diagnostics };\n }\n const context: GenerationContext = { target: options.target, component: normalized, options: options.targetOptions ?? {} };\n for (const plugin of plugins) await plugin.beforeGenerate?.(context);\n let result = registry.get(options.target).generate(context);\n result = { ...result, diagnostics: [...diagnostics, ...result.diagnostics] };\n for (const plugin of plugins) result = (await plugin.afterGenerate?.(result)) ?? result;\n return result;\n}\n\nfunction relativeModulePath(fromFile: string, toFile: string): string {\n const fromDirectory = fromFile.split(\"/\").slice(0, -1);\n const toParts = toFile.split(\"/\");\n let shared = 0;\n while (shared < fromDirectory.length && shared < toParts.length && fromDirectory[shared] === toParts[shared]) shared++;\n const path = [\n ...Array.from({ length: fromDirectory.length - shared }, () => \"..\"),\n ...toParts.slice(shared),\n ].join(\"/\");\n return path.startsWith(\".\") ? path : `./${path}`;\n}\n\nfunction addStyleImports(contents: string, moduleOutputPath: string, styles: ComponentAssetReference[]): string {\n const statements = [...new Set(styles.map((style) =>\n `import ${JSON.stringify(relativeModulePath(moduleOutputPath, style.outputPath ?? style.source))};`,\n ))].filter((statement) => !contents.includes(statement));\n if (statements.length === 0) return contents;\n const firstLineEnd = contents.indexOf(\"\\n\");\n if (contents.startsWith(\"// @ts-nocheck\") && firstLineEnd >= 0) {\n return `${contents.slice(0, firstLineEnd + 1)}${statements.join(\"\\n\")}\\n${contents.slice(firstLineEnd + 1)}`;\n }\n return `${statements.join(\"\\n\")}\\n${contents}`;\n}\n\nexport async function compileProject(\n project: CompilerProject,\n registry: TargetRegistry,\n options: CompileOptions,\n): Promise<CompileProjectResult> {\n const diagnostics = validateCompilerProject(project);\n if (diagnostics.some((diagnostic) => diagnostic.severity === \"error\")) {\n return { target: options.target, files: [], assets: [], diagnostics };\n }\n\n const files: GeneratedFile[] = [];\n const assets = new Map<string, string>();\n const generatedPaths = new Set<string>();\n const registryEntries: CompilerProjectRegistryEntry[] = [];\n const targetDefinition = registry.get(options.target);\n\n for (const [index, definition] of project.components.entries()) {\n let result: GenerationResult;\n if (definition.implementation.kind === \"ir\") {\n result = await compileComponent(definition.implementation.component, registry, options);\n } else if (targetDefinition.generateMitosis) {\n result = targetDefinition.generateMitosis(definition.implementation.component, options.targetOptions ?? {});\n } else {\n result = {\n target: options.target,\n files: [],\n diagnostics: [{\n severity: \"error\",\n code: \"COMPILER_TARGET_MITOSIS_SOURCE_UNSUPPORTED\",\n message: `Target ${options.target} does not provide a Mitosis source generator.`,\n path: `components[${index}].implementation`,\n }],\n };\n }\n diagnostics.push(...result.diagnostics.map((diagnostic) => ({\n ...diagnostic,\n path: diagnostic.path ? `components[${index}].${diagnostic.path}` : `components[${index}]`,\n })));\n\n const componentName = definition.implementation.component.name;\n for (const file of result.files) {\n if (!isSafeRelativePath(file.path)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_GENERATED_PATH_INVALID\", message: `Target generated an unsafe relative file path: ${file.path}`, path: `components[${index}].output` });\n continue;\n }\n const outputPath = `${definition.outputDirectory ?? \"components\"}/${file.path}`;\n const normalizedPath = outputPath.toLowerCase();\n if (generatedPaths.has(normalizedPath)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_GENERATED_PATH_COLLISION\", message: `Multiple components generated the same output path: ${outputPath}`, path: `components[${index}].output` });\n continue;\n }\n generatedPaths.add(normalizedPath);\n const isEntryModule = file.kind === \"component\" && file.path.split(\"/\").pop()?.startsWith(`${componentName}.`);\n files.push({\n ...file,\n path: outputPath,\n contents: isEntryModule && definition.styles?.length\n ? addStyleImports(file.contents, outputPath, definition.styles)\n : file.contents,\n });\n }\n\n if (targetDefinition.generateProjectRegistry) {\n const entryFiles = result.files.filter((file) => file.kind === \"component\" && file.path.split(\"/\").pop()?.startsWith(`${componentName}.`));\n if (entryFiles.length !== 1) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_REGISTRY_ENTRY_AMBIGUOUS\", message: `Expected one generated entry module for ${componentName}; found ${entryFiles.length}`, path: `components[${index}].output` });\n } else {\n registryEntries.push({\n type: definition.manifest.type,\n modulePath: `${definition.outputDirectory ?? \"components\"}/${entryFiles[0].path}`,\n });\n }\n }\n\n for (const asset of [...(definition.styles ?? []), ...(definition.assets ?? [])]) {\n assets.set(asset.outputPath ?? asset.source, asset.source);\n }\n }\n\n if (targetDefinition.generateProjectRegistry) {\n const registryFile = targetDefinition.generateProjectRegistry(registryEntries);\n if (!isSafeRelativePath(registryFile.path)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_REGISTRY_PATH_INVALID\", message: `Target generated an unsafe registry path: ${registryFile.path}`, path: \"target.registry\" });\n } else if (generatedPaths.has(registryFile.path.toLowerCase())) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_REGISTRY_PATH_COLLISION\", message: `Registry output collides with a generated component file: ${registryFile.path}`, path: \"target.registry\" });\n } else {\n generatedPaths.add(registryFile.path.toLowerCase());\n files.push(registryFile);\n }\n } else {\n diagnostics.push({ severity: \"info\", code: \"COMPILER_PROJECT_REGISTRY_NOT_REGISTERED\", message: `Target ${options.target} has no verified project component registry emitter; generated files are emitted without components.ts.`, path: `target.${options.target}` });\n }\n\n for (const outputPath of assets.keys()) {\n if (generatedPaths.has(outputPath.toLowerCase())) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_ASSET_GENERATED_PATH_COLLISION\", message: `Asset output collides with a generated file: ${outputPath}`, path: \"assets\" });\n }\n }\n\n if (diagnostics.some((diagnostic) => diagnostic.severity === \"error\")) {\n return { target: options.target, files: [], assets: [], diagnostics };\n }\n\n return {\n target: options.target,\n files,\n assets: [...assets.entries()].map(([outputPath, source]) => ({ source, outputPath })),\n diagnostics,\n };\n}\n\nexport function pageNodeToComponentIR(node: PageNode): ComponentIR {\n return {\n version: \"0.1\",\n name: node.type,\n imports: [],\n props: Object.keys(node.props).map((name) => ({ name, defaultValue: node.props[name] })),\n state: [],\n root: { kind: \"component\", name: node.type, attributes: Object.keys(node.props).map((name) => ({ name, binding: { kind: \"expression\", code: `props.${name}` } })) },\n metadata: { sourceNodeId: node.id },\n };\n}\n\nexport { componentIRToMitosis, createMitosisCompiler, createMitosisTarget, generateMitosisSourceComponent, generateWithMitosis, mitosisTargets, mitosisTargetCapabilities } from \"./mitosis\";\nexport type { MitosisTarget, MitosisTargetCapability } from \"./mitosis\";\nexport { parseMitosisSource } from \"./source\";\nexport type { ParseMitosisSourceOptions } from \"./source\";\n","import { runCli } from \"./run\";\n\nvoid runCli(process.argv.slice(2)).then((exitCode) => {\n process.exitCode = exitCode;\n});\n"],"mappings":";;;AAAA,SAAS,UAAU,OAAO,OAAO,UAAU,UAAU,QAAQ,IAAI,MAAM,iBAAiB;AACxF,SAAS,kBAAkB;AAC3B,SAAS,SAAS,YAAY,MAAM,UAAU,SAAS,WAAW;;;ACFlE;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAC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AAa,WAAW,CAAC;AACnD,cAAM,SAAS,YAAY,SAAS;AACpC,cAAM,OAAO,WAAW,WAAW;AAAA,MACrC,SAAS,OAAO;AACd,YAAI,UAAW,OAAM,GAAG,WAAW,EAAE,OAAO,KAAK,CAAC;AAClD,cAAM;AAAA,MACR;AAAA,IACF;AAEA,WAAO,IAAI,YAAY,QAAQ,WAAW,MAAM,mBAAmB,MAAM,WAAW,YAAY,MAAM,wBAAwB,OAAO,OAAO,MAAM,cAAc,SAAS,aAAa,UAAU,CAAC,GAAG;AACpM,WAAO;AAAA,EACT,SAAS,OAAO;AACd,WAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AACnE,WAAO;AAAA,EACT;AACF;;;AIvTA,KAAK,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa;AACpD,UAAQ,WAAW;AACrB,CAAC;","names":["isSafeRelativePath"]}
1
+ {"version":3,"sources":["../src/run.ts","../../compiler-core/src/mitosis.ts","../../compiler-core/src/source.ts","../../compiler-core/src/index.ts","../src/cli.ts"],"sourcesContent":["import { copyFile, lstat, mkdir, readFile, realpath, rename, rm, stat, writeFile } from \"node:fs/promises\";\nimport { randomUUID } from \"node:crypto\";\nimport { dirname, isAbsolute, join, relative, resolve, sep } from \"node:path\";\nimport {\n compileProject,\n createMitosisCompiler,\n parseMitosisSource,\n validateCompilerProject,\n} from \"@designos/compiler-core\";\nimport { bladeTarget } from \"@designos/compiler-blade\";\nimport type { CompilerProject, CompilerSourceProject, CompilerTarget } from \"@designos/compiler-core\";\n\nexport interface CliOutput {\n log(message: string): void;\n error(message: string): void;\n}\n\ninterface CompileArguments {\n help?: false;\n target: string;\n config: string;\n outDir?: string;\n projectRoot?: string;\n targetOptions: Record<string, unknown>;\n}\n\nconst HELP = `DesignOS compiler CLI\n\nUsage:\n designos compile --target <target> [options]\n\nOptions:\n --target <target> Registered target name (for example react or vue)\n --config <file> Project JSON file (default: designos.project.json)\n --project-root <directory> Root for config asset paths (default: current directory)\n --out-dir <directory> Output directory inside dist (default: dist/designos/<target>)\n --target-option key=value Pass a target-specific option; repeatable, values parse as JSON\n --help Show this help\n`;\n\nfunction parseTargetOption(value: string): [string, unknown] {\n const separator = value.indexOf(\"=\");\n if (separator < 1) throw new Error(`Invalid --target-option ${JSON.stringify(value)}; expected key=value`);\n const key = value.slice(0, separator).trim();\n if (!key) throw new Error(\"--target-option key must not be empty\");\n const raw = value.slice(separator + 1);\n try {\n return [key, JSON.parse(raw) as unknown];\n } catch {\n return [key, raw];\n }\n}\n\nfunction parseArguments(args: string[]): CompileArguments | { help: true } {\n if (args.length === 0 || args[0] === \"--help\" || args[0] === \"help\") return { help: true };\n if (args[0] !== \"compile\") throw new Error(`Unknown command: ${args[0]}\\n\\n${HELP}`);\n\n const options: Omit<CompileArguments, \"target\"> & { target?: string } = {\n config: \"designos.project.json\",\n targetOptions: {},\n };\n\n for (let index = 1; index < args.length; index += 1) {\n const flag = args[index];\n if (flag === \"--help\") return { help: true };\n if (![\"--target\", \"--config\", \"--out-dir\", \"--project-root\", \"--target-option\"].includes(flag)) {\n throw new Error(`Unknown option: ${flag}\\n\\n${HELP}`);\n }\n const value = args[index + 1];\n if (!value || value.startsWith(\"--\")) throw new Error(`Missing value for ${flag}`);\n index += 1;\n\n if (flag === \"--target\") options.target = value;\n else if (flag === \"--config\") options.config = value;\n else if (flag === \"--out-dir\") options.outDir = value;\n else if (flag === \"--project-root\") options.projectRoot = value;\n else {\n const [key, targetValue] = parseTargetOption(value);\n options.targetOptions[key] = targetValue;\n }\n }\n\n if (!options.target) throw new Error(\"Missing required --target option\");\n return options as CompileArguments;\n}\n\nfunction isWithin(root: string, candidate: string): boolean {\n const pathFromRoot = relative(root, candidate);\n return pathFromRoot === \"\" || (pathFromRoot !== \"..\" && !pathFromRoot.startsWith(`..${sep}`) && !isAbsolute(pathFromRoot));\n}\n\nfunction isSafeRelativePath(value: string): boolean {\n return value.length > 0\n && !value.startsWith(\"/\")\n && !value.includes(\"\\\\\")\n && !/^[A-Za-z]:/.test(value)\n && value.split(\"/\").every((segment) => segment.length > 0 && segment !== \".\" && segment !== \"..\");\n}\n\nasync function ensureDirectoryWithoutSymlinks(root: string, relativeDirectory: string): Promise<string> {\n let current = root;\n for (const segment of relativeDirectory ? relativeDirectory.split(sep).filter(Boolean) : []) {\n current = join(current, segment);\n try {\n const entry = await lstat(current);\n if (entry.isSymbolicLink() || !entry.isDirectory()) {\n throw new Error(`Output path contains a non-directory or symbolic link: ${current}`);\n }\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code !== \"ENOENT\") throw cause;\n await mkdir(current);\n }\n }\n return current;\n}\n\nasync function prepareOutputRoot(projectRoot: string, outputArgument: string): Promise<string> {\n const distPath = resolve(projectRoot, \"dist\");\n const requestedOutput = resolve(projectRoot, outputArgument);\n if (requestedOutput === distPath || !isWithin(distPath, requestedOutput)) {\n throw new Error(\"--out-dir must be a dedicated subdirectory inside the project dist directory\");\n }\n\n await mkdir(distPath, { recursive: true });\n const rootRealPath = await realpath(projectRoot);\n const distRealPath = await realpath(distPath);\n if (!isWithin(rootRealPath, distRealPath)) throw new Error(\"The project dist directory resolves outside the project root\");\n\n const relativeOutput = relative(distPath, requestedOutput);\n if (!relativeOutput || relativeOutput === \"..\" || relativeOutput.startsWith(`..${sep}`) || isAbsolute(relativeOutput)) {\n throw new Error(\"--out-dir must resolve to a subdirectory inside dist\");\n }\n return ensureDirectoryWithoutSymlinks(distRealPath, relativeOutput);\n}\n\nasync function resolveProjectAsset(projectRoot: string, projectRootReal: string, source: string): Promise<string> {\n if (!isSafeRelativePath(source)) throw new Error(`Asset source is not a safe project-relative path: ${source}`);\n const candidate = resolve(projectRoot, source);\n if (!isWithin(projectRoot, candidate)) throw new Error(`Asset source escapes project root: ${source}`);\n const sourceRealPath = await realpath(candidate);\n if (!isWithin(projectRootReal, sourceRealPath)) throw new Error(`Asset source resolves outside project root: ${source}`);\n const info = await stat(sourceRealPath);\n if (!info.isFile()) throw new Error(`Asset source is not a file: ${source}`);\n return sourceRealPath;\n}\n\nasync function loadCompilerProject(config: unknown, projectRoot: string, projectRootReal: string): Promise<CompilerProject> {\n if (!config || typeof config !== \"object\") throw new Error(\"Compiler project config must be a JSON object\");\n const schemaVersion = (config as { schemaVersion?: unknown }).schemaVersion;\n if (schemaVersion === \"1\") return config as CompilerProject;\n if (schemaVersion !== \"2\") throw new Error(`Unsupported project schemaVersion ${JSON.stringify(schemaVersion)}; expected \\\"1\\\" (IR) or \\\"2\\\" (TSX source)`);\n\n const sourceProject = config as CompilerSourceProject;\n if (!Array.isArray(sourceProject.components)) throw new Error(\"Source project components must be an array\");\n const components = await Promise.all(sourceProject.components.map(async (entry, index) => {\n const prefix = `components[${index}]`;\n if (!entry || typeof entry.source !== \"string\" || typeof entry.manifest !== \"string\") {\n throw new Error(`${prefix} requires project-relative source and manifest paths`);\n }\n if (!entry.source.endsWith(\".lite.tsx\")) {\n throw new Error(`${prefix}.source must reference a .lite.tsx authoring file`);\n }\n const sourcePath = await resolveProjectAsset(projectRoot, projectRootReal, entry.source);\n const manifestPath = await resolveProjectAsset(projectRoot, projectRootReal, entry.manifest);\n let manifest: unknown;\n try {\n manifest = JSON.parse(await readFile(manifestPath, \"utf8\"));\n } catch (cause) {\n throw new Error(`Unable to read JSON manifest ${entry.manifest}: ${cause instanceof Error ? cause.message : String(cause)}`, { cause });\n }\n const source = await readFile(sourcePath, \"utf8\");\n const implementation = parseMitosisSource(source, { filePath: entry.source, enableBlocksSlots: true });\n if (entry.exportName && implementation.name !== entry.exportName) {\n throw new Error(`${prefix}.exportName is ${JSON.stringify(entry.exportName)}, but Mitosis parsed ${JSON.stringify(implementation.name)} from ${entry.source}`);\n }\n if (!Array.isArray(entry.styles ?? []) || !Array.isArray(entry.assets ?? [])) {\n throw new Error(`${prefix}.styles and ${prefix}.assets must be arrays of project-relative file references`);\n }\n const sourceDirectory = dirname(entry.source).split(sep).join(\"/\");\n return {\n manifest: manifest as CompilerProject[\"components\"][number][\"manifest\"],\n implementation: { kind: \"mitosis\" as const, component: implementation },\n outputDirectory: entry.outputDirectory ?? (sourceDirectory === \".\" ? \"components\" : sourceDirectory),\n styles: entry.styles ?? [],\n assets: entry.assets ?? [],\n };\n }));\n return { schemaVersion: \"1\", components };\n}\n\nasync function writeArtifact(outputRoot: string, relativePath: string, contents: string | Uint8Array): Promise<void> {\n if (!isSafeRelativePath(relativePath)) throw new Error(`Unsafe generated output path: ${relativePath}`);\n const parts = relativePath.split(\"/\");\n const directory = parts.slice(0, -1).join(sep);\n const parent = await ensureDirectoryWithoutSymlinks(outputRoot, directory);\n const destination = join(parent, parts.at(-1)!);\n try {\n const existing = await lstat(destination);\n if (existing.isSymbolicLink() || !existing.isFile()) throw new Error(`Generated output is not a regular file: ${relativePath}`);\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code !== \"ENOENT\") throw cause;\n }\n\n const temporary = `${destination}.designos-${randomUUID()}.tmp`;\n try {\n const output = typeof contents === \"string\" && relativePath.endsWith(\".tsx\")\n ? `// @ts-nocheck -- generated Mitosis output; target prop types are not yet preserved.\\n${contents}`\n : contents;\n await writeFile(temporary, output);\n await rename(temporary, destination);\n } catch (cause) {\n await rm(temporary, { force: true });\n throw cause;\n }\n}\n\nfunction printDiagnostics(output: CliOutput, diagnostics: { severity: string; code: string; path?: string; message: string }[]): void {\n for (const diagnostic of diagnostics) {\n const formatted = `${diagnostic.severity.toUpperCase()} ${diagnostic.code}${diagnostic.path ? ` (${diagnostic.path})` : \"\"}: ${diagnostic.message}`;\n if (diagnostic.severity === \"error\") output.error(formatted);\n else output.log(formatted);\n }\n}\n\nexport async function runCli(args: string[], output: CliOutput = console, cwd = process.cwd()): Promise<number> {\n try {\n const parsed = parseArguments(args);\n if (\"help\" in parsed) {\n output.log(HELP);\n return 0;\n }\n\n const projectRoot = resolve(cwd, parsed.projectRoot ?? \".\");\n const projectRootReal = await realpath(projectRoot);\n const configPath = resolve(projectRoot, parsed.config);\n const configText = await readFile(configPath, \"utf8\");\n const projectConfig: unknown = JSON.parse(configText);\n const project = await loadCompilerProject(projectConfig, projectRoot, projectRootReal);\n const registry = createMitosisCompiler();\n registry.register(bladeTarget);\n\n if (!registry.names().includes(parsed.target as CompilerTarget)) {\n throw new Error(`Unknown compiler target ${JSON.stringify(parsed.target)}. Registered targets: ${registry.names().join(\", \")}`);\n }\n const target = parsed.target as CompilerTarget;\n const targetProject = target === \"blade\"\n ? {\n ...project,\n components: project.components.map((component) => ({ ...component, outputDirectory: \"components\" })),\n }\n : project;\n const validation = validateCompilerProject(targetProject);\n printDiagnostics(output, validation);\n if (validation.some((diagnostic) => diagnostic.severity === \"error\")) return 1;\n\n const result = await compileProject(targetProject, registry, { target, targetOptions: parsed.targetOptions });\n printDiagnostics(output, result.diagnostics);\n if (result.diagnostics.some((diagnostic) => diagnostic.severity === \"error\")) return 1;\n\n const manifests = Object.fromEntries(targetProject.components.map(({ manifest }) => [manifest.type, manifest]));\n const manifestRegistryFile = {\n kind: \"registry\" as const,\n path: target === \"blade\" ? \"registry.json\" : \"manifests.json\",\n contents: `${JSON.stringify(manifests, null, 2)}\\n`,\n };\n const outputFiles = [...result.files, manifestRegistryFile];\n\n const outputArgument = parsed.outDir ?? `dist/designos/${target}`;\n const outputRoot = await prepareOutputRoot(projectRoot, outputArgument);\n const outputPaths = new Set<string>();\n for (const file of outputFiles) {\n const pathKey = file.path.toLowerCase();\n if (outputPaths.has(pathKey)) throw new Error(`Generated output path collision: ${file.path}`);\n outputPaths.add(pathKey);\n }\n for (const asset of result.assets) {\n const pathKey = asset.outputPath.toLowerCase();\n if (outputPaths.has(pathKey)) throw new Error(`Asset output collides with a generated file: ${asset.outputPath}`);\n outputPaths.add(pathKey);\n }\n for (const outputPath of outputPaths) {\n for (const otherPath of outputPaths) {\n if (outputPath !== otherPath && otherPath.startsWith(`${outputPath}/`)) {\n throw new Error(`Generated output path is both a file and a directory: ${outputPath}`);\n }\n }\n }\n\n const assetSources = new Map<string, string>();\n for (const asset of result.assets) {\n assetSources.set(asset.outputPath, await resolveProjectAsset(projectRoot, projectRootReal, asset.source));\n }\n for (const file of outputFiles) await writeArtifact(outputRoot, file.path, file.contents);\n for (const [outputPath, sourcePath] of assetSources) {\n let temporary = \"\";\n try {\n if (!isSafeRelativePath(outputPath)) throw new Error(`Unsafe asset output path: ${outputPath}`);\n const relativeParent = dirname(outputPath).split(sep).join(\"/\");\n const parent = await ensureDirectoryWithoutSymlinks(outputRoot, relativeParent === \".\" ? \"\" : relativeParent);\n const destination = join(parent, outputPath.split(\"/\").at(-1)!);\n try {\n const existing = await lstat(destination);\n if (existing.isSymbolicLink() || !existing.isFile()) throw new Error(`Asset output is not a regular file: ${outputPath}`);\n } catch (cause) {\n if ((cause as NodeJS.ErrnoException).code !== \"ENOENT\") throw cause;\n }\n temporary = `${destination}.designos-${randomUUID()}.tmp`;\n await copyFile(sourcePath, temporary);\n await rename(temporary, destination);\n } catch (cause) {\n if (temporary) await rm(temporary, { force: true });\n throw cause;\n }\n }\n\n output.log(`Compiled ${project.components.length} components for ${target}; wrote ${outputFiles.length} generated files and ${result.assets.length} assets to ${relative(projectRoot, outputRoot)}.`);\n return 0;\n } catch (cause) {\n output.error(cause instanceof Error ? cause.message : String(cause));\n return 1;\n }\n}\n","import {\n componentToAlpine,\n componentToBuilder,\n componentToAngular,\n componentToCustomElement,\n componentToHtml,\n componentToLiquid,\n componentToLit,\n componentToMarko,\n componentToMitosis,\n componentToPreact,\n componentToQwik,\n componentToReact,\n componentToReactNative,\n componentToRsc,\n componentToSolid,\n componentToStencil,\n componentToSvelte,\n componentToSwift,\n componentToTaro,\n componentToTemplate,\n componentToVue,\n} from \"@builder.io/mitosis\";\nimport type { MitosisComponent } from \"@builder.io/mitosis/types\";\nimport { TargetRegistry } from \"./index\";\nimport type { ComponentIR, CompilerProjectRegistryEntry, Diagnostic, GeneratedFile, GenerationContext, GenerationResult, IRAttribute, IRNode } from \"./index\";\n\nexport const mitosisTargets = [\n \"alpine\", \"angular\", \"builder\", \"customElement\", \"html\", \"liquid\", \"lit\", \"marko\", \"mitosis\",\n \"preact\", \"qwik\", \"react\", \"reactNative\", \"rsc\", \"solid\", \"stencil\", \"svelte\",\n \"swift\", \"taro\", \"template\", \"vue\", \"webcomponent\",\n] as const;\nexport type MitosisTarget = (typeof mitosisTargets)[number];\nexport interface MitosisTargetCapability {\n generation: \"smoke-tested\";\n semanticParity: \"unverified\";\n sourceMaps: \"unverified\";\n diagnostics: \"partial\";\n}\nexport const mitosisTargetCapabilities: Readonly<Record<MitosisTarget, MitosisTargetCapability>> = Object.freeze(\n Object.fromEntries(mitosisTargets.map((target) => [target, Object.freeze({\n generation: \"smoke-tested\" as const,\n semanticParity: \"unverified\" as const,\n sourceMaps: \"unverified\" as const,\n diagnostics: \"partial\" as const,\n })])) as Record<MitosisTarget, MitosisTargetCapability>,\n);\ntype MNode = Record<string, any>;\ntype MComponent = Record<string, any>;\n\nconst propTypeTargets = new Set<MitosisTarget>([\"preact\", \"qwik\", \"react\", \"reactNative\", \"rsc\", \"solid\", \"taro\"]);\nconst stateTypeTargets = new Set<MitosisTarget>([\"angular\", \"preact\", \"react\", \"reactNative\", \"rsc\", \"taro\"]);\n\nfunction createComponentPropType(component: ComponentIR): { name: string; declaration: string } | undefined {\n if (!component.props.some((prop) => typeof prop.type === \"string\" && prop.type.trim())) return undefined;\n\n const importedNames = new Set(component.imports.flatMap((item) => item.names));\n const componentName = component.name.replace(/[^A-Za-z0-9_$]/g, \"_\");\n let name = `__DesignOS_${componentName}_Props`;\n while (importedNames.has(name)) name = `_${name}`;\n\n const properties = component.props.map((prop) => {\n const propertyName = /^[$A-Z_a-z][$\\w]*$/.test(prop.name) ? prop.name : JSON.stringify(prop.name);\n const optional = prop.optional || prop.defaultValue !== undefined ? \"?\" : \"\";\n const type = typeof prop.type === \"string\" && prop.type.trim() ? prop.type.trim() : \"any\";\n return ` ${propertyName}${optional}: ${type};`;\n });\n\n return { name, declaration: `type ${name} = {\\n${properties.join(\"\\n\")}\\n};` };\n}\n\nfunction toMitosisNode(node: IRNode): MNode {\n const base: MNode = { \"@type\": \"@builder.io/mitosis/node\", name: \"div\", meta: {}, scope: {}, properties: {}, bindings: {}, children: [] };\n if (node.kind === \"text\") {\n base.properties._text = node.value;\n } else if (node.kind === \"expression\") {\n base.bindings._text = { code: node.binding.code, type: \"single\", bindingType: \"expression\" };\n } else if (node.kind === \"slot\") {\n base.name = \"Slot\";\n if (node.name) base.properties.name = node.name;\n if (node.fallback) base.children = node.fallback.map((child) => toMitosisNode(child));\n } else if (node.kind === \"fragment\") {\n base.name = \"Fragment\";\n base.children = node.children.map((child) => toMitosisNode(child));\n } else if (node.kind === \"conditional\") {\n base.name = \"Show\";\n base.bindings.when = { code: node.condition.code, type: \"single\", bindingType: \"expression\" };\n base.children = node.then.map((child) => toMitosisNode(child));\n if (node.otherwise?.length) {\n base.meta.else = toMitosisNode({ kind: \"fragment\", children: node.otherwise });\n }\n } else if (node.kind === \"loop\") {\n base.name = \"For\";\n base.scope = { forName: node.itemName, indexName: node.indexName, collectionName: undefined };\n base.bindings.each = { code: node.collection.code, type: \"single\", bindingType: \"expression\" };\n base.children = node.children.map((child) => toMitosisNode(child));\n } else {\n base.name = node.kind === \"element\" ? node.tag : node.name;\n base.children = (node.children ?? []).map((child) => toMitosisNode(child));\n for (const attribute of node.attributes ?? []) applyAttribute(base, attribute);\n if (node.kind === \"component\" && node.slots) {\n const { default: defaultSlot, ...namedSlots } = node.slots;\n if (defaultSlot) base.children.push(...defaultSlot.map((child) => toMitosisNode(child)));\n if (Object.keys(namedSlots).length) {\n base.slots = Object.fromEntries(Object.entries(namedSlots).map(([name, children]) => [name, toMitosisSlotChildren(children)]));\n }\n }\n }\n return base;\n}\n\nfunction toMitosisSlotChildren(children: IRNode[]): MNode[] {\n const nodes = children.length === 1 && children[0].kind === \"fragment\" ? children[0].children : children;\n if (nodes.length === 1 && nodes[0].kind === \"text\") {\n const child = nodes[0];\n const node = toMitosisNode(child);\n node.properties._text = JSON.stringify(child.value);\n return [node];\n }\n return nodes.map((child) => toMitosisNode(child));\n}\n\nfunction applyAttribute(node: MNode, attribute: IRAttribute): void {\n if (!attribute.binding) {\n if (attribute.value !== undefined) node.properties[attribute.name] = attribute.value;\n return;\n }\n const binding = attribute.binding;\n const eventName = binding.eventName ?? attribute.name;\n const key = binding.kind === \"event\" && !eventName.startsWith(\"on\")\n ? `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`\n : attribute.name;\n node.bindings[key] = {\n code: binding.code,\n type: binding.kind === \"spread\" ? \"spread\" : \"single\",\n ...(binding.kind === \"spread\" ? { spreadType: \"normal\" } : { bindingType: binding.kind === \"event\" ? \"function\" : \"expression\" }),\n ...(binding.parameters ? { arguments: binding.parameters } : {}),\n };\n}\nexport function componentIRToMitosis(component: ComponentIR): MComponent {\n const imports = component.imports.map((item) => ({\n path: item.source,\n imports: Object.fromEntries(item.names.map((name) => [name, name])),\n ...(item.typeOnly ? { importKind: \"type\" } : {}),\n }));\n const propType = createComponentPropType(component);\n return {\n \"@type\": \"@builder.io/mitosis/component\",\n name: component.name,\n imports,\n exports: {},\n inputs: component.props.map((prop) => ({ name: prop.name, defaultValue: prop.defaultValue })),\n props: Object.fromEntries(component.props.map((prop) => [prop.name, { propertyType: \"normal\", optional: !!prop.optional || prop.defaultValue !== undefined }])),\n defaultProps: Object.fromEntries(component.props.filter((prop) => prop.defaultValue !== undefined).map((prop) => [prop.name, { type: \"property\", code: JSON.stringify(prop.defaultValue) }])),\n state: Object.fromEntries(component.state.map((item) => [item.name, {\n type: \"property\",\n code: item.initialValue,\n ...(typeof item.type === \"string\" && item.type.trim() ? { typeParameter: item.type.trim() } : {}),\n }])),\n meta: { ...(component.metadata ?? {}) },\n refs: {},\n context: { get: {}, set: {} },\n hooks: { onMount: [], onEvent: [] },\n children: component.root.kind === \"fragment\" ? component.root.children.map((node) => toMitosisNode(node)) : [toMitosisNode(component.root)],\n subComponents: [],\n ...(component.styles ? { style: component.styles } : {}),\n ...(propType ? { types: [propType.declaration], propsTypeRef: propType.name } : {}),\n };\n}\n\nfunction normalizeReactNativeFragmentLinks(component: MComponent): void {\n const visit = (node: MNode): void => {\n const href = node.properties?.href;\n if (typeof href === \"string\" && href.startsWith(\"#\")) {\n delete node.properties.href;\n node.bindings ??= {};\n node.bindings.href = {\n code: JSON.stringify(href),\n type: \"single\",\n bindingType: \"expression\",\n };\n }\n\n if (Array.isArray(node.children)) node.children.forEach(visit);\n if (node.slots && typeof node.slots === \"object\") {\n for (const children of Object.values(node.slots) as MNode[][]) children.forEach(visit);\n }\n };\n\n if (Array.isArray(component.children)) component.children.forEach(visit);\n}\n\nconst generators: Record<MitosisTarget, (component: MComponent, options: Record<string, unknown>) => unknown> = {\n alpine: (c, o) => componentToAlpine(o as any)({ component: c as any }),\n builder: (c, o) => componentToBuilder(o as any)({ component: c as any }),\n angular: (c, o) => componentToAngular(o as any)({ component: c as any }),\n customElement: (c, o) => componentToCustomElement(o as any)({ component: c as any }),\n html: (c, o) => componentToHtml(o as any)({ component: c as any }),\n liquid: (c, o) => componentToLiquid(o as any)({ component: c as any }),\n lit: (c, o) => componentToLit(o as any)({ component: c as any }),\n marko: (c, o) => componentToMarko(o as any)({ component: c as any }),\n mitosis: (c, o) => componentToMitosis(o as any)({ component: c as any }),\n preact: (c, o) => componentToPreact(o as any)({ component: c as any }),\n qwik: (c, o) => componentToQwik(o as any)({ component: c as any }),\n react: (c, o) => componentToReact(o as any)({ component: c as any }),\n reactNative: (c, o) => componentToReactNative(o as any)({ component: c as any }),\n rsc: (c, o) => componentToRsc(o as any)({ component: c as any }),\n solid: (c, o) => componentToSolid(o as any)({ component: c as any }),\n stencil: (c, o) => componentToStencil(o as any)({ component: c as any }),\n svelte: (c, o) => componentToSvelte(o as any)({ component: c as any }),\n swift: (c, o) => componentToSwift(o as any)({ component: c as any }),\n taro: (c, o) => componentToTaro(o as any)({ component: c as any }),\n template: (c, o) => componentToTemplate(o as any)({ component: c as any }),\n vue: (c, o) => componentToVue(o as any)({ component: c as any }),\n webcomponent: (c, o) => componentToCustomElement(o as any)({ component: c as any }),\n};\n\nconst siblingElseTargets = new Set<MitosisTarget>([\"alpine\", \"customElement\", \"html\", \"swift\", \"template\", \"webcomponent\"]);\nconst nativeSlotProjectionTargets = new Set<MitosisTarget>([\n \"alpine\", \"angular\", \"customElement\", \"html\", \"liquid\", \"lit\", \"marko\", \"qwik\", \"stencil\", \"svelte\", \"template\", \"vue\", \"webcomponent\",\n]);\nconst nativeSlotOutletTargets = new Set<MitosisTarget>([\"alpine\", \"customElement\", \"html\", \"liquid\", \"lit\", \"stencil\", \"template\", \"webcomponent\"]);\nconst eventlessTargets = new Set<MitosisTarget>([\"liquid\", \"template\"]);\nconst nativePropDefaultTargets = new Set<MitosisTarget>([\"angular\", \"preact\", \"react\", \"reactNative\", \"rsc\", \"stencil\", \"svelte\", \"taro\", \"vue\"]);\nconst expressionPropDefaultTargets = new Set<MitosisTarget>([\"alpine\", \"builder\", \"customElement\", \"html\", \"lit\", \"marko\", \"mitosis\", \"solid\", \"template\", \"webcomponent\"]);\nconst swiftTextTags = new Set([\"span\", \"p\", \"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"]);\n\nfunction swiftPrimitiveType(type: unknown): \"string\" | \"number\" | \"boolean\" | undefined {\n if (typeof type !== \"string\") return undefined;\n switch (type.trim().toLowerCase()) {\n case \"string\": return \"string\";\n case \"number\": return \"number\";\n case \"boolean\":\n case \"bool\": return \"boolean\";\n default: return undefined;\n }\n}\n\nfunction swiftDefaultLiteral(type: unknown, value: unknown): string | undefined {\n const normalizedType = swiftPrimitiveType(type);\n if (normalizedType === \"string\" && typeof value === \"string\") {\n if (/[\\u0000-\\u0008\\u000b\\u000c\\u000e-\\u001f]/.test(value)) return undefined;\n const escaped = value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\").replace(/\\t/g, \"\\\\t\");\n return `\"${escaped}\"`;\n }\n if (normalizedType === \"number\" && typeof value === \"number\" && Number.isFinite(value)) return String(value);\n if (normalizedType === \"boolean\" && typeof value === \"boolean\") return String(value);\n return undefined;\n}\n\nfunction applySwiftPropTypes(component: MComponent, props: ComponentIR[\"props\"]): void {\n for (const prop of props) {\n const type = swiftPrimitiveType(prop.type);\n if (type && component.props?.[prop.name]) component.props[prop.name].propertyType = type;\n }\n}\n\nfunction hasNamedComponentSlots(node: IRNode): boolean {\n if (node.kind === \"component\" && Object.keys(node.slots ?? {}).some((name) => name !== \"default\")) return true;\n if (node.kind === \"conditional\") return node.then.some(hasNamedComponentSlots) || (node.otherwise ?? []).some(hasNamedComponentSlots);\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some(hasNamedComponentSlots);\n if (node.kind === \"slot\") return (node.fallback ?? []).some(hasNamedComponentSlots);\n if (node.kind === \"element\") return (node.children ?? []).some(hasNamedComponentSlots);\n if (node.kind === \"component\") return (node.children ?? []).some(hasNamedComponentSlots)\n || Object.values(node.slots ?? {}).some((children) => children.some(hasNamedComponentSlots));\n return false;\n}\n\nfunction hasUnsupportedNamedComponentSlots(node: IRNode, target: MitosisTarget): boolean {\n if (target === \"swift\") return hasNamedComponentSlots(node);\n if (target === \"solid\" && node.kind === \"component\") {\n const hasUnsupportedSlot = Object.entries(node.slots ?? {}).some(([name, children]) => {\n if (name === \"default\") return false;\n return children.length !== 1 || (children[0]?.kind !== \"text\" && children[0]?.kind !== \"expression\");\n });\n if (hasUnsupportedSlot) return true;\n }\n if (node.kind === \"conditional\") return node.then.some((child) => hasUnsupportedNamedComponentSlots(child, target))\n || (node.otherwise ?? []).some((child) => hasUnsupportedNamedComponentSlots(child, target));\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some((child) => hasUnsupportedNamedComponentSlots(child, target));\n if (node.kind === \"slot\") return (node.fallback ?? []).some((child) => hasUnsupportedNamedComponentSlots(child, target));\n if (node.kind === \"element\") return (node.children ?? []).some((child) => hasUnsupportedNamedComponentSlots(child, target));\n if (node.kind === \"component\") return (node.children ?? []).some((child) => hasUnsupportedNamedComponentSlots(child, target))\n || Object.values(node.slots ?? {}).some((children) => children.some((child) => hasUnsupportedNamedComponentSlots(child, target)));\n return false;\n}\n\nfunction hasUnsupportedNamedSlotOutlet(node: IRNode, target: MitosisTarget): boolean {\n if (target === \"swift\" && node.kind === \"slot\") return true;\n if (node.kind === \"conditional\") return node.then.some((child) => hasUnsupportedNamedSlotOutlet(child, target))\n || (node.otherwise ?? []).some((child) => hasUnsupportedNamedSlotOutlet(child, target));\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some((child) => hasUnsupportedNamedSlotOutlet(child, target));\n if (node.kind === \"slot\") return (node.fallback ?? []).some((child) => hasUnsupportedNamedSlotOutlet(child, target));\n if (node.kind === \"element\") return (node.children ?? []).some((child) => hasUnsupportedNamedSlotOutlet(child, target));\n if (node.kind === \"component\") return (node.children ?? []).some((child) => hasUnsupportedNamedSlotOutlet(child, target))\n || Object.values(node.slots ?? {}).some((children) => children.some((child) => hasUnsupportedNamedSlotOutlet(child, target)));\n return false;\n}\n\nfunction hasConditionalElse(node: IRNode): boolean {\n if (node.kind === \"conditional\") {\n return !!node.otherwise?.length || node.then.some(hasConditionalElse) || (node.otherwise ?? []).some(hasConditionalElse);\n }\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some(hasConditionalElse);\n if (node.kind === \"slot\") return (node.fallback ?? []).some(hasConditionalElse);\n if (node.kind === \"element\") return (node.children ?? []).some(hasConditionalElse);\n if (node.kind === \"component\") return (node.children ?? []).some(hasConditionalElse)\n || Object.values(node.slots ?? {}).some((children) => children.some(hasConditionalElse));\n return false;\n}\n\nfunction hasEventHandlers(node: IRNode): boolean {\n if ((node.kind === \"element\" || node.kind === \"component\") && (node.attributes ?? []).some((attribute) => attribute.binding?.kind === \"event\")) return true;\n if (node.kind === \"conditional\") return node.then.some(hasEventHandlers) || (node.otherwise ?? []).some(hasEventHandlers);\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some(hasEventHandlers);\n if (node.kind === \"slot\") return (node.fallback ?? []).some(hasEventHandlers);\n if (node.kind === \"element\") return (node.children ?? []).some(hasEventHandlers);\n if (node.kind === \"component\") return (node.children ?? []).some(hasEventHandlers)\n || Object.values(node.slots ?? {}).some((children) => children.some(hasEventHandlers));\n return false;\n}\n\nfunction preservesPropDefault(target: MitosisTarget, name: string, value: unknown, propType?: unknown): boolean {\n if (nativePropDefaultTargets.has(target)) return true;\n if (target === \"qwik\") return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) && serializeDefaultValue(value) !== undefined;\n if (target === \"swift\") return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) && swiftDefaultLiteral(propType, value) !== undefined;\n if (target === \"liquid\") {\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) return false;\n return typeof value === \"string\" || typeof value === \"boolean\" || (typeof value === \"number\" && Number.isFinite(value));\n }\n return expressionPropDefaultTargets.has(target)\n && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name)\n && serializeDefaultValue(value) !== undefined;\n}\n\nfunction serializeDefaultValue(value: unknown): string | undefined {\n try {\n const serialized = JSON.stringify(value);\n return typeof serialized === \"string\" ? serialized : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction applyExpressionPropDefaults(nodes: MNode[], props: ComponentIR[\"props\"]): void {\n const defaults = props.flatMap((prop) => {\n if (prop.defaultValue === undefined || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(prop.name)) return [];\n const serialized = serializeDefaultValue(prop.defaultValue);\n return serialized === undefined ? [] : [{ name: prop.name, serialized }];\n });\n if (defaults.length === 0) return;\n\n const visit = (node: MNode): void => {\n for (const binding of Object.values(node.bindings ?? {}) as Array<{ code?: unknown }>) {\n if (typeof binding.code !== \"string\") continue;\n let code = binding.code;\n for (const { name, serialized } of defaults) {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const access = `props.${name}`;\n const replacement = `(${access} === undefined ? ${serialized} : ${access})`;\n const dotReference = new RegExp(`\\\\bprops(?:\\\\?\\\\.|\\\\.)${escapedName}\\\\b`, \"g\");\n const bracketReference = new RegExp(`\\\\bprops\\\\s*\\\\[\\\\s*(['\\\"])${escapedName}\\\\1\\\\s*\\\\]`, \"g\");\n code = code.replace(dotReference, replacement).replace(bracketReference, replacement);\n }\n binding.code = code;\n }\n node.children?.forEach(visit);\n if (node.slots) Object.values(node.slots as Record<string, MNode[]>).forEach((children) => children.forEach(visit));\n const elseNode = node.meta?.else;\n if (elseNode && typeof elseNode === \"object\") visit(elseNode as MNode);\n };\n nodes.forEach(visit);\n}\n\ninterface QwikPropDefaultAlias {\n name: string;\n alias: string;\n serialized: string;\n}\n\nfunction applyQwikPropDefaults(component: MComponent, props: ComponentIR[\"props\"]): QwikPropDefaultAlias[] {\n const usedNames = new Set<string>([\n ...props.map((prop) => prop.name),\n ...Object.keys(component.state ?? {}),\n ]);\n const defaults = props.flatMap((prop) => {\n if (prop.defaultValue === undefined || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(prop.name)) return [];\n const serialized = serializeDefaultValue(prop.defaultValue);\n if (serialized === undefined) return [];\n let alias = `__designosDefault_${prop.name}`;\n let suffix = 1;\n while (usedNames.has(alias)) alias = `__designosDefault_${prop.name}_${suffix++}`;\n usedNames.add(alias);\n return [{ name: prop.name, alias, serialized }];\n });\n if (defaults.length === 0) return defaults;\n\n const rewrite = (source: string): string => defaults.reduce((code, { name, alias }) => {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const dotReference = new RegExp(`\\\\bprops(?:\\\\?\\\\.|\\\\.)${escapedName}\\\\b`, \"g\");\n const bracketReference = new RegExp(`\\\\bprops\\\\s*\\\\[\\\\s*(['\\\"])${escapedName}\\\\1\\\\s*\\\\]`, \"g\");\n return code.replace(dotReference, alias).replace(bracketReference, alias);\n }, source);\n\n const visit = (node: MNode): void => {\n for (const binding of Object.values(node.bindings ?? {}) as Array<{ code?: unknown }>) {\n if (typeof binding.code === \"string\") binding.code = rewrite(binding.code);\n }\n node.children?.forEach(visit);\n if (node.slots) Object.values(node.slots as Record<string, MNode[]>).forEach((children) => children.forEach(visit));\n const elseNode = node.meta?.else;\n if (elseNode && typeof elseNode === \"object\") visit(elseNode as MNode);\n };\n (component.children as MNode[]).forEach(visit);\n for (const state of Object.values(component.state ?? {}) as Array<{ code?: unknown }>) {\n if (typeof state.code === \"string\") state.code = rewrite(state.code);\n }\n return defaults;\n}\n\nfunction addQwikPropDefaults(output: string, defaults: QwikPropDefaultAlias[]): string | undefined {\n if (defaults.length === 0) return output;\n const signature = /(component\\$\\(\\s*\\(\\s*props(?:\\s*:\\s*[^)]*)?\\)\\s*=>\\s*\\{)/;\n if (!signature.test(output)) return undefined;\n const declarations = defaults\n .map(({ name, alias, serialized }) => ` const ${alias} = props.${name} === undefined ? ${serialized} : props.${name};`)\n .join(\"\\n\");\n return output.replace(signature, (match) => `${match}\\n${declarations}`);\n}\n\nfunction applySwiftPropDefaults(nodes: MNode[], props: ComponentIR[\"props\"]): void {\n const defaults = props.flatMap((prop) => {\n if (prop.defaultValue === undefined || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(prop.name)) return [];\n const literal = swiftDefaultLiteral(prop.type, prop.defaultValue);\n return literal === undefined ? [] : [{ name: prop.name, literal }];\n });\n if (defaults.length === 0) return;\n\n const visit = (node: MNode): void => {\n for (const binding of Object.values(node.bindings ?? {}) as Array<{ code?: unknown }>) {\n if (typeof binding.code !== \"string\") continue;\n let code = binding.code;\n for (const { name, literal } of defaults) {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const replacement = `(props.${name} ?? ${literal})`;\n const dotReference = new RegExp(`\\\\bprops(?:\\\\?\\\\.|\\\\.)${escapedName}\\\\b`, \"g\");\n const bracketReference = new RegExp(`\\\\bprops\\\\s*\\\\[\\\\s*(['\\\"])${escapedName}\\\\1\\\\s*\\\\]`, \"g\");\n code = code.replace(dotReference, replacement).replace(bracketReference, replacement);\n }\n binding.code = code;\n }\n node.children?.forEach(visit);\n if (node.slots) Object.values(node.slots as Record<string, MNode[]>).forEach((children) => children.forEach(visit));\n const elseNode = node.meta?.else;\n if (elseNode && typeof elseNode === \"object\") visit(elseNode as MNode);\n };\n nodes.forEach(visit);\n}\n\nfunction addSwiftPropDefaults(output: string, props: ComponentIR[\"props\"]): string {\n for (const prop of props) {\n if (prop.defaultValue === undefined || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(prop.name)) continue;\n const literal = swiftDefaultLiteral(prop.type, prop.defaultValue);\n if (literal === undefined) continue;\n const escapedName = prop.name.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const declaration = new RegExp(`^([\\\\t ]*)let\\\\s+${escapedName}(\\\\s*:[^\\\\n]+)$`, \"m\");\n output = output.replace(declaration, (_match, indent: string, annotation: string) => `${indent}var ${prop.name}${annotation} = ${literal}`);\n }\n return output;\n}\n\nfunction addLiquidPropDefaults(output: string, component: ComponentIR): string {\n const assignments = component.props.flatMap((prop) => {\n if (prop.defaultValue === undefined || !preservesPropDefault(\"liquid\", prop.name, prop.defaultValue, prop.type)) return [];\n const literal = JSON.stringify(prop.defaultValue);\n if (typeof literal !== \"string\") return [];\n const allowFalse = prop.defaultValue === false ? \", allow_false: true\" : \"\";\n return [`{% assign ${prop.name} = ${prop.name} | default: ${literal}${allowFalse} %}`];\n });\n return assignments.length ? `${assignments.join(\"\\n\")}\\n${output}` : output;\n}\n\nfunction toLiquidCondition(code: string): string | undefined {\n const condition = code.replace(/\\b(?:props|state)\\./g, \"\").trim();\n const identifier = \"[A-Za-z_][A-Za-z0-9_]*(?:\\\\.[A-Za-z_][A-Za-z0-9_]*)*\";\n const literal = `(?:${identifier}|\\\\d+(?:\\\\.\\\\d+)?|'[^'\\\\\\\\]*'|\\\"[^\\\"\\\\\\\\]*\\\")`;\n if (new RegExp(`^${identifier}$`).test(condition)) return condition;\n if (new RegExp(`^${literal}\\\\s*(?:==|!=|>=|<=|>|<)\\\\s*${literal}$`).test(condition)) return condition;\n return undefined;\n}\n\nfunction hasUnsupportedLiquidElse(node: IRNode): boolean {\n if (node.kind === \"conditional\") {\n if (node.otherwise?.length && !toLiquidCondition(node.condition.code)) return true;\n return node.then.some(hasUnsupportedLiquidElse) || (node.otherwise ?? []).some(hasUnsupportedLiquidElse);\n }\n if (node.kind === \"loop\" || node.kind === \"fragment\") return node.children.some(hasUnsupportedLiquidElse);\n if (node.kind === \"slot\") return (node.fallback ?? []).some(hasUnsupportedLiquidElse);\n if (node.kind === \"element\") return (node.children ?? []).some(hasUnsupportedLiquidElse);\n if (node.kind === \"component\") return (node.children ?? []).some(hasUnsupportedLiquidElse)\n || Object.values(node.slots ?? {}).some((children) => children.some(hasUnsupportedLiquidElse));\n return false;\n}\n\nfunction lowerElseBranches(nodes: MNode[]): MNode[] {\n const lowered: MNode[] = [];\n for (const sourceNode of nodes) {\n const node: MNode = {\n ...sourceNode,\n meta: { ...(sourceNode.meta ?? {}) },\n children: Array.isArray(sourceNode.children) ? lowerElseBranches(sourceNode.children) : sourceNode.children,\n ...(sourceNode.slots ? {\n slots: Object.fromEntries(Object.entries(sourceNode.slots).map(([name, children]) => [name, lowerElseBranches(children as MNode[])])),\n } : {}),\n };\n const elseNode = node.name === \"Show\" ? node.meta.else as MNode | undefined : undefined;\n const condition = node.bindings?.when?.code;\n if (!elseNode || typeof condition !== \"string\" || !condition.trim()) {\n lowered.push(node);\n continue;\n }\n\n delete node.meta.else;\n const elseChildren = elseNode.name === \"Fragment\" && Array.isArray(elseNode.children)\n ? elseNode.children as MNode[]\n : [elseNode];\n const alternate: MNode = {\n ...node,\n bindings: {\n ...node.bindings,\n when: { ...node.bindings.when, code: `!(${condition})` },\n },\n children: lowerElseBranches(elseChildren),\n };\n lowered.push(node, alternate);\n }\n return lowered;\n}\n\nfunction lowerLiquidElseBranches(nodes: MNode[], baseComponent: MComponent, options: Record<string, unknown>): MNode[] {\n const lowered: MNode[] = [];\n for (const sourceNode of nodes) {\n const node: MNode = {\n ...sourceNode,\n meta: { ...(sourceNode.meta ?? {}) },\n children: Array.isArray(sourceNode.children) ? lowerLiquidElseBranches(sourceNode.children, baseComponent, options) : sourceNode.children,\n ...(sourceNode.slots ? {\n slots: Object.fromEntries(Object.entries(sourceNode.slots).map(([name, children]) => [name, lowerLiquidElseBranches(children as MNode[], baseComponent, options)])),\n } : {}),\n };\n const elseNode = node.name === \"Show\" ? node.meta.else as MNode | undefined : undefined;\n const condition = node.bindings?.when?.code;\n const liquidCondition = typeof condition === \"string\" ? toLiquidCondition(condition) : undefined;\n if (!elseNode || !liquidCondition) {\n lowered.push(node);\n continue;\n }\n\n const elseChildren = elseNode.name === \"Fragment\" && Array.isArray(elseNode.children)\n ? lowerLiquidElseBranches(elseNode.children as MNode[], baseComponent, options)\n : lowerLiquidElseBranches([elseNode], baseComponent, options);\n const renderNodes = (children: MNode[]) => generators.liquid({ ...baseComponent, children, style: \"\" }, { ...options, prettier: false, reactive: false });\n lowered.push({\n \"@type\": \"@builder.io/mitosis/node\",\n name: \"div\",\n properties: { _text: `{% if ${liquidCondition} %}${renderNodes(node.children ?? [])}{% else %}${renderNodes(elseChildren)}{% endif %}` },\n bindings: {},\n meta: {},\n scope: {},\n children: [],\n });\n }\n return lowered;\n}\n\nfunction normalizeSwiftShowBranches(nodes: MNode[]): MNode[] {\n return nodes.map((sourceNode) => {\n const node: MNode = {\n ...sourceNode,\n meta: { ...(sourceNode.meta ?? {}) },\n children: Array.isArray(sourceNode.children) ? normalizeSwiftShowBranches(sourceNode.children) : sourceNode.children,\n ...(sourceNode.slots ? {\n slots: Object.fromEntries(Object.entries(sourceNode.slots).map(([name, children]) => [name, normalizeSwiftShowBranches(children as MNode[])])),\n } : {}),\n };\n if (node.name === \"Show\" && node.bindings?.when) {\n node.name = \"Group\";\n node.bindings.if = node.bindings.when;\n delete node.bindings.when;\n }\n if (typeof node.bindings?._text?.code === \"string\") {\n node.name = \"Text\";\n node.bindings.innerHTML = node.bindings._text;\n delete node.bindings._text;\n }\n if (swiftTextTags.has(String(node.name).toLowerCase()) && node.children?.length) {\n if (node.children.length === 1) {\n const child = node.children[0] as MNode;\n const textBinding = child.bindings?.innerHTML ?? child.bindings?._text;\n if (typeof textBinding?.code === \"string\") {\n node.name = \"Text\";\n node.bindings = { ...(node.bindings ?? {}), innerHTML: textBinding };\n node.children = [];\n } else if (typeof child.properties?._text === \"string\") {\n node.name = \"Text\";\n node.properties = { ...(node.properties ?? {}), _text: child.properties._text };\n node.children = [];\n }\n }\n if (node.children?.length) node.name = \"div\";\n }\n return node;\n });\n}\n\nfunction decodeSlotText(node: MNode): MNode {\n const encoded = node.properties?._text;\n if (typeof encoded === \"string\") {\n try {\n const decoded = JSON.parse(encoded);\n if (typeof decoded === \"string\" && JSON.stringify(decoded) === encoded) node.properties._text = decoded;\n } catch {\n // Non-JSON text is a raw text node or an expression preserved elsewhere.\n }\n }\n return node;\n}\n\nfunction isMitosisTextNode(node: MNode): boolean {\n return Object.hasOwn(node.properties ?? {}, \"_text\") || Object.hasOwn(node.bindings ?? {}, \"_text\");\n}\n\nfunction lowerNamedComponentSlots(nodes: MNode[], target: MitosisTarget): MNode[] {\n const result: MNode[] = [];\n for (const sourceNode of nodes) {\n const node: MNode = {\n ...sourceNode,\n properties: { ...(sourceNode.properties ?? {}) },\n bindings: { ...(sourceNode.bindings ?? {}) },\n children: Array.isArray(sourceNode.children) ? lowerNamedComponentSlots(sourceNode.children, target) : sourceNode.children,\n ...(sourceNode.slots ? {\n slots: Object.fromEntries(Object.entries(sourceNode.slots).map(([name, children]) => [name, lowerNamedComponentSlots(children as MNode[], target)])),\n } : {}),\n };\n\n if (target === \"builder\" && node.slots) {\n for (const slotChildren of Object.values(node.slots) as MNode[][]) slotChildren.forEach(decodeSlotText);\n } else if (target === \"solid\" && node.slots) {\n for (const [slotName, slotChildren] of Object.entries(node.slots) as [string, MNode[]][]) {\n if (slotChildren.length !== 1) continue;\n const slotChild = decodeSlotText(slotChildren[0]);\n if (Object.hasOwn(slotChild.bindings ?? {}, \"_text\")) node.bindings[slotName] = slotChild.bindings._text;\n else if (typeof slotChild.properties?._text === \"string\") node.properties[slotName] = slotChild.properties._text;\n }\n delete node.slots;\n } else if (target === \"reactNative\" && node.slots) {\n for (const slotChildren of Object.values(node.slots) as MNode[][]) {\n for (const child of slotChildren) {\n const decoded = decodeSlotText(child).properties?._text;\n if (typeof decoded === \"string\" && !Object.hasOwn(child.bindings ?? {}, \"_text\")) {\n child.bindings ??= {};\n child.bindings._text = { code: JSON.stringify(decoded), type: \"single\", bindingType: \"expression\" };\n delete child.properties._text;\n }\n }\n }\n } else if (nativeSlotProjectionTargets.has(target) && node.slots) {\n const projected: MNode[] = [];\n for (const [slotName, slotChildren] of Object.entries(node.slots) as [string, MNode[]][]) {\n const children = slotChildren.map(decodeSlotText);\n if (target === \"vue\" || target === \"svelte\") {\n projected.push({\n \"@type\": \"@builder.io/mitosis/node\",\n name: target === \"vue\" ? \"template\" : \"svelte:fragment\",\n properties: target === \"vue\" ? { [`v-slot:${slotName}`]: \"\" } : { slot: slotName },\n bindings: {},\n meta: {},\n scope: {},\n children,\n });\n continue;\n }\n if (target === \"marko\") {\n projected.push({\n \"@type\": \"@builder.io/mitosis/node\",\n name: `@${slotName}`,\n properties: {},\n bindings: {},\n meta: {},\n scope: {},\n children,\n });\n continue;\n }\n\n const slotAttribute = target === \"qwik\" ? \"q:slot\" : target === \"angular\" ? slotName : \"slot\";\n for (const child of children) {\n if (isMitosisTextNode(child)) {\n projected.push({\n \"@type\": \"@builder.io/mitosis/node\",\n name: \"span\",\n properties: { [slotAttribute]: slotName },\n bindings: {},\n meta: {},\n scope: {},\n children: [child],\n });\n } else {\n child.properties ??= {};\n child.properties[slotAttribute] = slotAttribute === slotName ? \"\" : slotName;\n projected.push(child);\n }\n }\n }\n node.children = [...(node.children ?? []), ...projected];\n delete node.slots;\n }\n\n if (node.name === \"Slot\" && target === \"marko\") {\n node.name = node.properties.name ? `@${node.properties.name}` : \"@renderBody\";\n delete node.properties.name;\n } else if (node.name === \"Slot\" && target === \"solid\") {\n const slotName = node.properties.name;\n const code = typeof slotName === \"string\" && slotName !== \"default\" ? `props.${slotName}` : \"props.children\";\n const valueNode: MNode = {\n \"@type\": \"@builder.io/mitosis/node\",\n name: \"div\",\n properties: {},\n bindings: { _text: { code, type: \"single\", bindingType: \"expression\" } },\n meta: {},\n scope: {},\n children: [],\n };\n if (node.children?.length) {\n node.name = \"Show\";\n node.properties = {};\n node.bindings = { when: { code, type: \"single\", bindingType: \"expression\" } };\n node.meta = { ...node.meta, else: { \"@type\": \"@builder.io/mitosis/node\", name: \"Fragment\", properties: {}, bindings: {}, meta: {}, scope: {}, children: node.children } };\n node.children = [valueNode];\n } else {\n node.name = valueNode.name;\n node.properties = valueNode.properties;\n node.bindings = valueNode.bindings;\n node.meta = valueNode.meta;\n node.children = [];\n }\n } else if (node.name === \"Slot\" && nativeSlotOutletTargets.has(target)) node.name = \"slot\";\n result.push(node);\n }\n return result;\n}\n\nfunction resultFiles(value: unknown, target: string, name: string): { path: string; contents: string; kind: \"component\" | \"style\" | \"metadata\" }[] {\n if (typeof value === \"string\") return [{ path: `${name}.${extensionFor(target)}`, contents: value, kind: \"component\" }];\n if (value && typeof value === \"object\") {\n const obj = value as Record<string, unknown>;\n if (typeof obj.code === \"string\") return [{ path: `${name}.${extensionFor(target)}`, contents: obj.code, kind: \"component\" }];\n if (Array.isArray(obj.files)) return obj.files.flatMap((f: any, i: number) => typeof f === \"string\" ? [{ path: `${name}${i ? `-${i}` : \"\"}.${extensionFor(target)}`, contents: f, kind: \"component\" as const }] : typeof f?.contents === \"string\" ? [{ path: f.path || `${name}${i ? `-${i}` : \"\"}.${extensionFor(target)}`, contents: f.contents, kind: f.kind === \"style\" ? \"style\" as const : \"component\" as const }] : []);\n }\n return [{ path: `${name}.${extensionFor(target)}`, contents: JSON.stringify(value, null, 2), kind: \"component\" }];\n}\nfunction extensionFor(target: string): string {\n const extensions: Record<string, string> = { builder: \"json\", webcomponent: \"js\", react: \"tsx\", preact: \"tsx\", reactNative: \"tsx\", solid: \"tsx\", angular: \"ts\", vue: \"vue\", svelte: \"svelte\", qwik: \"tsx\", stencil: \"tsx\", lit: \"ts\", html: \"html\", customElement: \"js\", liquid: \"liquid\", alpine: \"html\", marko: \"marko\", mitosis: \"lite.tsx\", swift: \"swift\", taro: \"tsx\", template: \"template\", rsc: \"tsx\" };\n return extensions[target] ?? \"txt\";\n}\nexport function generateWithMitosis(context: GenerationContext): GenerationResult {\n const target = context.target as MitosisTarget;\n if (!(target in generators)) throw new Error(`Unsupported Mitosis target: ${target}`);\n const component = componentIRToMitosis(context.component);\n component.children = lowerNamedComponentSlots(component.children, target);\n const qwikBaseline = target === \"qwik\" ? JSON.parse(JSON.stringify(component)) as MComponent : undefined;\n const qwikDefaults = target === \"qwik\" ? applyQwikPropDefaults(component, context.component.props) : [];\n if (target === \"swift\") {\n applySwiftPropTypes(component, context.component.props);\n applySwiftPropDefaults(component.children, context.component.props);\n }\n if (expressionPropDefaultTargets.has(target)) applyExpressionPropDefaults(component.children, context.component.props);\n if (target === \"liquid\") component.children = lowerLiquidElseBranches(component.children, component, context.options);\n if (target === \"reactNative\") normalizeReactNativeFragmentLinks(component);\n if (siblingElseTargets.has(target)) component.children = lowerElseBranches(component.children);\n if (target === \"swift\") component.children = normalizeSwiftShowBranches(component.children);\n let output = generators[target](component, context.options);\n let qwikDefaultsInjected = true;\n if (target === \"qwik\" && qwikDefaults.length > 0) {\n const outputWithDefaults = typeof output === \"string\" ? addQwikPropDefaults(output, qwikDefaults) : undefined;\n if (outputWithDefaults === undefined) {\n output = generators.qwik(qwikBaseline as MComponent, context.options);\n qwikDefaultsInjected = false;\n } else {\n output = outputWithDefaults;\n }\n }\n if (target === \"liquid\" && typeof output === \"string\") output = addLiquidPropDefaults(output, context.component);\n if (target === \"swift\" && typeof output === \"string\") output = addSwiftPropDefaults(output, context.component.props);\n const emitsPropTypes = context.options.typescript === true && propTypeTargets.has(target);\n const emitsStateTypes = context.options.typescript === true && stateTypeTargets.has(target);\n const diagnostics: Diagnostic[] = [\n {\n severity: \"warning\",\n code: \"MITOSIS_TARGET_SEMANTICS_UNVERIFIED\",\n message: `DesignOS has smoke-tested code generation for ${target}, but has not verified semantic parity for this target.`,\n path: `target.${target}`,\n },\n ...context.component.props\n .filter((prop) => prop.type !== undefined)\n .filter((prop) => target === \"swift\"\n ? !swiftPrimitiveType(prop.type)\n : !emitsPropTypes || typeof prop.type !== \"string\" || !prop.type.trim())\n .map((prop) => ({\n severity: \"warning\" as const,\n code: \"MITOSIS_PROP_TYPE_NOT_PRESERVED\",\n message: `The ${target} Mitosis output does not preserve the type annotation for prop \"${prop.name}\" with the current target options.`,\n path: `props.${prop.name}.type`,\n })),\n ...context.component.state\n .filter((state) => state.type !== undefined)\n .filter((state) => !emitsStateTypes || typeof state.type !== \"string\" || !state.type.trim())\n .map((state) => ({\n severity: \"warning\" as const,\n code: \"MITOSIS_STATE_TYPE_NOT_PRESERVED\",\n message: `The ${target} Mitosis output does not preserve the type annotation for state \"${state.name}\" with the current target options.`,\n path: `state.${state.name}.type`,\n })),\n ...context.component.props\n .filter((prop) => prop.defaultValue !== undefined)\n .filter((prop) => !preservesPropDefault(target, prop.name, prop.defaultValue, prop.type)\n || (target === \"qwik\" && !qwikDefaultsInjected))\n .map((prop) => ({\n severity: \"warning\" as const,\n code: \"MITOSIS_PROP_DEFAULT_NOT_PRESERVED\",\n message: `The ${target} Mitosis output does not preserve the default value for prop \"${prop.name}\".`,\n path: `props.${prop.name}.defaultValue`,\n })),\n ...(hasUnsupportedNamedComponentSlots(context.component.root, target) ? [{\n severity: \"warning\" as const,\n code: \"MITOSIS_NAMED_COMPONENT_SLOT_NOT_PRESERVED\",\n message: `The ${target} Mitosis output does not preserve named component slots for the current target.`,\n path: \"root.slots\",\n }] : []),\n ...(hasUnsupportedNamedSlotOutlet(context.component.root, target) ? [{\n severity: \"warning\" as const,\n code: \"MITOSIS_SLOT_OUTLET_NOT_PRESERVED\",\n message: \"The SwiftUI output does not connect a slot outlet to caller-provided content; only fallback markup may render.\",\n path: \"root.slot\",\n }] : []),\n ...(target === \"liquid\" && hasUnsupportedLiquidElse(context.component.root) ? [{\n severity: \"warning\" as const,\n code: \"MITOSIS_CONDITIONAL_ELSE_NOT_PRESERVED\",\n message: \"The Liquid target cannot safely lower this conditional else expression.\",\n path: \"root.otherwise\",\n }] : []),\n ...(eventlessTargets.has(target) && hasEventHandlers(context.component.root) ? [{\n severity: \"warning\" as const,\n code: \"MITOSIS_EVENT_HANDLER_NOT_PRESERVED\",\n message: `The ${target} target has no interactive event runtime and cannot preserve event handler bindings.`,\n path: \"root.events\",\n }] : []),\n ];\n return { target: context.target, files: resultFiles(output, target, context.component.name), diagnostics };\n}\n\nfunction mitosisNodeHasEventBindings(node: MNode): boolean {\n if (Object.entries(node.bindings ?? {}).some(([name, binding]: [string, any]) =>\n /^on[A-Z]/.test(name) && binding?.bindingType === \"function\",\n )) return true;\n if ((node.children ?? []).some((child: MNode) => mitosisNodeHasEventBindings(child))) return true;\n return Object.values(node.slots ?? {}).some((children: any) => Array.isArray(children) && children.some((child: MNode) => mitosisNodeHasEventBindings(child)));\n}\n\nfunction mitosisNodeHasNamedSlots(node: MNode): boolean {\n if (Object.keys(node.slots ?? {}).some((name) => name !== \"default\")) return true;\n if (typeof node.properties?.slot === \"string\" && node.properties.slot !== \"\" && node.properties.slot !== \"default\") return true;\n if ((node.children ?? []).some((child: MNode) => mitosisNodeHasNamedSlots(child))) return true;\n return Object.values(node.slots ?? {}).some((children: any) => Array.isArray(children) && children.some((child: MNode) => mitosisNodeHasNamedSlots(child)));\n}\n\nfunction mitosisNodeHasSlotOutlet(node: MNode): boolean {\n if (node.name === \"Slot\") return true;\n if ((node.children ?? []).some((child: MNode) => mitosisNodeHasSlotOutlet(child))) return true;\n return Object.values(node.slots ?? {}).some((children: any) => Array.isArray(children) && children.some((child: MNode) => mitosisNodeHasSlotOutlet(child)));\n}\n\n/** Generate directly from Mitosis parser output so hooks, context, refs, subcomponents,\n * target blocks and other upstream semantics are not narrowed through ComponentIR. */\nexport function generateMitosisSourceComponent(\n authoredComponent: MitosisComponent,\n target: MitosisTarget,\n options: Record<string, unknown> = {},\n): GenerationResult {\n if (!(target in generators)) throw new Error(`Unsupported Mitosis target: ${target}`);\n const component = structuredClone(authoredComponent) as MComponent;\n component.children = lowerNamedComponentSlots(component.children ?? [], target);\n if (target === \"liquid\") component.children = lowerLiquidElseBranches(component.children, component, options);\n if (target === \"reactNative\") normalizeReactNativeFragmentLinks(component);\n if (siblingElseTargets.has(target)) component.children = lowerElseBranches(component.children);\n if (target === \"swift\") component.children = normalizeSwiftShowBranches(component.children);\n\n const output = generators[target](component, options);\n const diagnostics: Diagnostic[] = [{\n severity: \"warning\",\n code: \"MITOSIS_TARGET_SEMANTICS_UNVERIFIED\",\n message: `DesignOS has not verified semantic parity for all Mitosis source features on ${target}; output is generated by the upstream Mitosis target emitter.`,\n path: `target.${target}`,\n }];\n if (eventlessTargets.has(target) && (component.hooks?.onEvent?.length || component.children.some((node: MNode) => mitosisNodeHasEventBindings(node)))) {\n diagnostics.push({\n severity: \"warning\",\n code: \"MITOSIS_EVENT_HANDLER_NOT_PRESERVED\",\n message: `The ${target} target has no interactive event runtime and cannot preserve event handler bindings.`,\n path: \"source.events\",\n });\n }\n if (target === \"swift\" && component.children.some((node: MNode) => mitosisNodeHasNamedSlots(node))) {\n diagnostics.push({\n severity: \"warning\",\n code: \"MITOSIS_NAMED_COMPONENT_SLOT_NOT_PRESERVED\",\n message: \"The Swift target adapter does not preserve named component slot composition.\",\n path: \"source.children.slots\",\n });\n }\n if (target === \"swift\" && component.children.some((node: MNode) => mitosisNodeHasSlotOutlet(node))) {\n diagnostics.push({\n severity: \"warning\",\n code: \"MITOSIS_SLOT_OUTLET_NOT_PRESERVED\",\n message: \"The Swift target output does not connect a Mitosis Slot outlet to caller-provided content; only fallback markup may render.\",\n path: \"source.children.slot\",\n });\n }\n return { target, files: resultFiles(output, target, component.name), diagnostics };\n}\n\nfunction generateProjectRegistry(target: \"react\" | \"vue\", entries: CompilerProjectRegistryEntry[]): GeneratedFile {\n const imports = entries.map((entry, index) => {\n const modulePath = target === \"vue\" ? entry.modulePath : entry.modulePath.replace(/\\.(?:tsx?|jsx?)$/, \"\");\n return `import DesignOSComponent${index} from ${JSON.stringify(`./${modulePath}`)};`;\n });\n const registrations = entries.map((entry, index) => ` ${JSON.stringify(entry.type)}: DesignOSComponent${index},`);\n return {\n path: \"components.ts\",\n kind: \"metadata\",\n contents: [\n ...imports,\n \"\",\n \"export const components = {\",\n ...registrations,\n \"};\",\n \"\",\n \"export default components;\",\n \"\",\n ].join(\"\\n\"),\n };\n}\n\nexport function createMitosisTarget(target: MitosisTarget) {\n return {\n name: target,\n generate: (context: GenerationContext) => generateWithMitosis(context),\n generateMitosis: (component: MitosisComponent, options: Record<string, unknown>) => generateMitosisSourceComponent(component, target, options),\n ...((target === \"react\" || target === \"vue\")\n ? { generateProjectRegistry: (entries: CompilerProjectRegistryEntry[]) => generateProjectRegistry(target, entries) }\n : {}),\n };\n}\nexport function createMitosisCompiler(): TargetRegistry {\n const registry = new TargetRegistry();\n for (const target of mitosisTargets) registry.register(createMitosisTarget(target));\n return registry;\n}\n","import { parseJsx } from \"@builder.io/mitosis\";\nimport type { MitosisComponent } from \"@builder.io/mitosis/types\";\n\nexport interface ParseMitosisSourceOptions {\n filePath?: string;\n /** Preserve JSX blocks nested in component props when the upstream parser supports them. */\n enableBlocksSlots?: boolean;\n}\n\ninterface DesignOSSourceProp {\n name: string;\n optional: boolean;\n defaultValue?: unknown;\n}\n\nfunction parseLiteral(value: string): unknown {\n try {\n return JSON.parse(value.trim().replace(/'/g, '\"'));\n } catch {\n return undefined;\n }\n}\n\nfunction findTypeDeclarationBody(source: string, propsTypeRef: string): string | undefined {\n const declaration = source.match(new RegExp(`(?:interface|type)\\\\s+${propsTypeRef}\\\\s*(?:=)?\\\\s*\\\\{`));\n if (!declaration || declaration.index === undefined) return undefined;\n const start = declaration.index + declaration[0].length - 1;\n let depth = 0;\n let quote: string | undefined;\n let escaped = false;\n for (let index = start; index < source.length; index += 1) {\n const character = source[index];\n if (quote) {\n if (escaped) escaped = false;\n else if (character === \"\\\\\") escaped = true;\n else if (character === quote) quote = undefined;\n continue;\n }\n if (character === \"'\" || character === '\"' || character === \"`\") {\n quote = character;\n continue;\n }\n if (character === \"{\") depth += 1;\n else if (character === \"}\" && --depth === 0) return source.slice(start + 1, index);\n }\n return undefined;\n}\n\nfunction splitTopLevelFields(body: string): string[] {\n const fields: string[] = [];\n let start = 0;\n let depth = 0;\n for (let index = 0; index < body.length; index += 1) {\n if (body[index] === \"{\" || body[index] === \"[\" || body[index] === \"<\") depth += 1;\n else if (body[index] === \"}\" || body[index] === \"]\" || body[index] === \">\") depth = Math.max(0, depth - 1);\n else if (body[index] === \";\" && depth === 0) {\n fields.push(body.slice(start, index));\n start = index + 1;\n }\n }\n fields.push(body.slice(start));\n return fields;\n}\n\nfunction extractDesignOSSourceProps(source: string, propsTypeRef: string | undefined): DesignOSSourceProp[] {\n if (!propsTypeRef) return [];\n const body = findTypeDeclarationBody(source, propsTypeRef);\n if (body === undefined) return [];\n const props = new Map<string, DesignOSSourceProp>();\n for (const field of splitTopLevelFields(body)) {\n const match = field.trim().match(/^([A-Za-z_$][\\w$]*)\\s*(\\?)?\\s*:\\s*([^\\n]+)$/);\n if (!match) continue;\n props.set(match[1], { name: match[1], optional: Boolean(match[2]) });\n }\n const destructured = source.match(/function\\s+\\w+\\s*\\(\\s*\\{([\\s\\S]*?)\\}\\s*(?::[^)]*)?\\)/);\n if (destructured) {\n for (const part of destructured[1].split(\",\")) {\n const match = part.trim().match(/^([A-Za-z_$][\\w$]*)\\s*=\\s*(.+)$/);\n if (!match || !props.has(match[1])) continue;\n const value = parseLiteral(match[2]);\n if (value !== undefined) props.get(match[1])!.defaultValue = value;\n }\n }\n return [...props.values()];\n}\n\n/**\n * Parse developer-authored TSX with the same Mitosis parser used by its compiler.\n * The returned Mitosis component is retained intact; it is not reverse-mapped\n * through DesignOS ComponentIR, which cannot represent every Mitosis feature.\n */\nexport function parseMitosisSource(source: string, options: ParseMitosisSourceOptions = {}): MitosisComponent {\n if (typeof source !== \"string\") throw new TypeError(\"Mitosis source must be a string\");\n\n try {\n const component = parseJsx(source, {\n typescript: true,\n enableBlocksSlots: options.enableBlocksSlots ?? true,\n ...(options.filePath ? { filePath: options.filePath } : {}),\n });\n const designosProps = extractDesignOSSourceProps(source, component.propsTypeRef);\n if (designosProps.length > 0) component.meta = { ...component.meta, designosProps: designosProps as any };\n return component;\n } catch (cause) {\n const message = cause instanceof Error ? cause.message : String(cause);\n throw new Error(`Unable to parse DesignOS TSX${options.filePath ? ` at ${options.filePath}` : \"\"}: ${message}`, { cause });\n }\n}\n","import type { ComponentManifest, PageNode } from \"@designos/core\";\nimport type { MitosisComponent } from \"@builder.io/mitosis/types\";\n\nexport type CompilerTarget = \"react\" | \"vue\" | \"blade\" | \"angular\" | \"html\" | \"svelte\" | \"solid\" | \"alpine\" | \"builder\" | \"customElement\" | \"liquid\" | \"lit\" | \"marko\" | \"mitosis\" | \"preact\" | \"qwik\" | \"reactNative\" | \"rsc\" | \"stencil\" | \"swift\" | \"taro\" | \"template\" | \"webcomponent\";\n\nexport interface IRImport {\n source: string;\n names: string[];\n typeOnly?: boolean;\n}\n\nexport interface IRProp {\n name: string;\n type?: string;\n optional?: boolean;\n defaultValue?: unknown;\n}\n\nexport interface IRState {\n name: string;\n type?: string;\n initialValue: string;\n}\n\nexport interface IRBinding {\n code: string;\n kind: \"expression\" | \"event\" | \"spread\";\n eventName?: string;\n parameters?: string[];\n}\n\nexport interface IRAttribute {\n name: string;\n value?: string;\n binding?: IRBinding;\n}\n\nexport interface IRTextNode {\n kind: \"text\";\n value: string;\n}\n\nexport interface IRExpressionNode {\n kind: \"expression\";\n binding: IRBinding;\n}\n\nexport interface IRElementNode {\n kind: \"element\";\n tag: string;\n attributes?: IRAttribute[];\n children?: IRNode[];\n}\n\nexport interface IRComponentNode {\n kind: \"component\";\n name: string;\n attributes?: IRAttribute[];\n children?: IRNode[];\n slots?: Record<string, IRNode[]>;\n}\n\nexport interface IRFragmentNode {\n kind: \"fragment\";\n children: IRNode[];\n}\n\nexport interface IRConditionalNode {\n kind: \"conditional\";\n condition: IRBinding;\n then: IRNode[];\n otherwise?: IRNode[];\n}\n\nexport interface IRLoopNode {\n kind: \"loop\";\n collection: IRBinding;\n itemName: string;\n indexName?: string;\n children: IRNode[];\n}\n\nexport interface IRSlotNode {\n kind: \"slot\";\n name?: string;\n fallback?: IRNode[];\n}\n\nexport type IRNode = IRTextNode | IRExpressionNode | IRElementNode | IRComponentNode | IRFragmentNode | IRConditionalNode | IRLoopNode | IRSlotNode;\n\nexport interface ComponentIR {\n version: \"0.1\";\n name: string;\n imports: IRImport[];\n props: IRProp[];\n state: IRState[];\n root: IRNode;\n styles?: string;\n metadata?: Record<string, unknown>;\n}\n\nexport interface ComponentSource {\n manifest: ComponentManifest;\n implementation: { kind: \"ir\"; component: ComponentIR }\n | { kind: \"mitosis\"; component: MitosisComponent }\n | { kind: \"runtime\"; module: string; exportName?: string };\n}\n\n/** A project-local file used by a component implementation. */\nexport interface ComponentAssetReference {\n /** Path relative to the DesignOS project root; absolute paths and traversal are not allowed. */\n source: string;\n /** Path relative to the generated target directory. Defaults to `source`. */\n outputPath?: string;\n}\n\n/** A component definition that can be compiled for a framework target. */\nexport type CompilerProjectComponent = Omit<ComponentSource, \"implementation\"> & {\n /** Project compilation accepts neutral DesignOS IR or a parsed Mitosis component. */\n implementation: { kind: \"ir\"; component: ComponentIR } | { kind: \"mitosis\"; component: MitosisComponent };\n /** Target-relative module directory; defaults to `components` and preserves relative import layout. */\n outputDirectory?: string;\n /** CSS/resources imported by the generated entry module; copied with the project assets. */\n styles?: ComponentAssetReference[];\n assets?: ComponentAssetReference[];\n};\n\n/** Framework-neutral component source catalog consumed by the future project compiler. */\nexport interface CompilerProject {\n schemaVersion: \"1\";\n components: CompilerProjectComponent[];\n}\n\n/** File-based DesignOS source project consumed by the CLI. */\nexport interface CompilerSourceProjectComponent {\n source: string;\n manifest: string;\n exportName?: string;\n outputDirectory?: string;\n styles?: ComponentAssetReference[];\n assets?: ComponentAssetReference[];\n}\n\nexport interface CompilerSourceProject {\n schemaVersion: \"2\";\n components: CompilerSourceProjectComponent[];\n}\n\nexport interface Diagnostic {\n severity: \"error\" | \"warning\" | \"info\";\n code: string;\n message: string;\n path?: string;\n}\n\nexport interface GeneratedFile {\n path: string;\n contents: string;\n kind: \"component\" | \"style\" | \"metadata\";\n}\n\nexport interface GenerationContext {\n target: CompilerTarget;\n component: ComponentIR;\n options: Record<string, unknown>;\n}\n\nexport interface GenerationResult {\n target: CompilerTarget;\n files: GeneratedFile[];\n diagnostics: Diagnostic[];\n}\n\nexport interface CompilerPlugin {\n name: string;\n order?: number;\n beforeNormalize?(component: ComponentIR): ComponentIR | void;\n afterNormalize?(component: ComponentIR): ComponentIR | void;\n beforeGenerate?(context: GenerationContext): void | Promise<void>;\n afterGenerate?(result: GenerationResult): GenerationResult | void | Promise<GenerationResult | void>;\n}\n\nexport interface CompilerProjectRegistryEntry {\n /** Framework-neutral serialized component type used by PageNode.type. */\n type: string;\n /** Generated module path relative to the target output directory. */\n modulePath: string;\n}\n\nexport interface CompilerTargetDefinition {\n name: CompilerTarget;\n generate(context: GenerationContext): GenerationResult;\n /** Optional lossless path for components parsed from the Mitosis TSX contract. */\n generateMitosis?(component: MitosisComponent, options: Record<string, unknown>): GenerationResult;\n /** Optional target-specific source file that maps PageNode types to generated framework modules. */\n generateProjectRegistry?(entries: CompilerProjectRegistryEntry[]): GeneratedFile;\n}\n\nexport class TargetRegistry {\n private readonly targets = new Map<CompilerTarget, CompilerTargetDefinition>();\n\n register(target: CompilerTargetDefinition): void {\n if (this.targets.has(target.name)) throw new Error(`Compiler target already registered: ${target.name}`);\n this.targets.set(target.name, target);\n }\n\n get(target: CompilerTarget): CompilerTargetDefinition {\n const definition = this.targets.get(target);\n if (!definition) throw new Error(`Compiler target not registered: ${target}`);\n return definition;\n }\n\n names(): CompilerTarget[] { return [...this.targets.keys()]; }\n}\n\nexport interface CompileOptions {\n target: CompilerTarget;\n targetOptions?: Record<string, unknown>;\n plugins?: CompilerPlugin[];\n}\n\nexport interface CompilerProjectAssetOutput {\n /** Source path relative to the project root. */\n source: string;\n /** Destination path relative to the compiler output directory. */\n outputPath: string;\n}\n\nexport interface CompileProjectResult {\n target: CompilerTarget;\n files: GeneratedFile[];\n assets: CompilerProjectAssetOutput[];\n diagnostics: Diagnostic[];\n}\n\nexport function normalizeComponent(component: ComponentIR): ComponentIR {\n return structuredClone(component);\n}\n\nexport function validateComponentIR(component: ComponentIR): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n if (!component || typeof component !== \"object\") {\n return [{ severity: \"error\", code: \"COMPONENT_IR_REQUIRED\", message: \"ComponentIR must be an object\", path: \"component\" }];\n }\n if (typeof component.name !== \"string\" || !component.name.trim()) diagnostics.push({ severity: \"error\", code: \"COMPONENT_NAME_REQUIRED\", message: \"ComponentIR.name is required\", path: \"name\" });\n if (!component.root || typeof component.root !== \"object\") diagnostics.push({ severity: \"error\", code: \"COMPONENT_ROOT_REQUIRED\", message: \"ComponentIR.root is required\", path: \"root\" });\n if (!Array.isArray(component.imports)) diagnostics.push({ severity: \"error\", code: \"COMPONENT_IMPORTS_INVALID\", message: \"ComponentIR.imports must be an array\", path: \"imports\" });\n if (!Array.isArray(component.state)) diagnostics.push({ severity: \"error\", code: \"COMPONENT_STATE_INVALID\", message: \"ComponentIR.state must be an array\", path: \"state\" });\n if (!Array.isArray(component.props)) {\n diagnostics.push({ severity: \"error\", code: \"COMPONENT_PROPS_INVALID\", message: \"ComponentIR.props must be an array\", path: \"props\" });\n return diagnostics;\n }\n const names = new Set<string>();\n for (const prop of component.props) {\n if (names.has(prop.name)) diagnostics.push({ severity: \"error\", code: \"DUPLICATE_PROP\", message: `Duplicate prop: ${prop.name}`, path: \"props\" });\n names.add(prop.name);\n }\n return diagnostics;\n}\n\nfunction serializedValue(value: unknown): string {\n if (value === undefined) return \"undefined\";\n return JSON.stringify(value, (_key, nested) => {\n if (!nested || typeof nested !== \"object\" || Array.isArray(nested)) return nested;\n return Object.fromEntries(Object.entries(nested).sort(([left], [right]) => left.localeCompare(right)));\n });\n}\n\n/**\n * Manifest defaults populate authored PageNodes; source defaults remain runtime\n * fallbacks. A mismatch is reported instead of silently rewriting either side.\n */\nexport function validateManifestImplementationContract(\n manifest: ComponentManifest,\n implementation: CompilerProjectComponent[\"implementation\"],\n path = \"component\",\n): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n const sourceProps = implementation.kind === \"ir\"\n ? new Map(implementation.component.props.map((prop) => [prop.name, prop]))\n : new Map(\n ((implementation.component.meta as { designosProps?: Array<{ name: string; optional: boolean; defaultValue?: unknown }> } | undefined)?.designosProps ?? [])\n .map((prop) => [prop.name, prop]),\n );\n const manifestFields = new Map(manifest.fields.map((field) => [field.name, field]));\n const supportsChildren = Boolean(\n manifest.capabilities?.canHaveChildren\n || manifest.slots?.some((slot) => slot.name === \"default\" || slot.name === \"children\"),\n );\n\n for (const prop of sourceProps.values()) {\n if (prop.name === \"children\" && supportsChildren) continue;\n if (!manifestFields.has(prop.name)) diagnostics.push({\n severity: \"warning\",\n code: \"COMPILER_PROJECT_SOURCE_PROP_NOT_IN_MANIFEST\",\n message: `Source prop \"${prop.name}\" is not editable through manifest \"${manifest.type}\".`,\n path: `${path}.implementation.component.props.${prop.name}`,\n });\n }\n\n for (const field of manifest.fields) {\n const prop = sourceProps.get(field.name);\n if (!prop) {\n if (field.required) diagnostics.push({\n severity: \"error\",\n code: \"COMPILER_PROJECT_REQUIRED_FIELD_NOT_IN_SOURCE\",\n message: `Required manifest field \"${field.name}\" is not declared by the source component.`,\n path: `${path}.manifest.fields.${field.name}`,\n });\n continue;\n }\n if (field.defaultValue !== undefined && prop.defaultValue !== undefined && serializedValue(field.defaultValue) !== serializedValue(prop.defaultValue)) diagnostics.push({\n severity: \"error\",\n code: \"COMPILER_PROJECT_DEFAULT_MISMATCH\",\n message: `Manifest default for \"${field.name}\" differs from the source runtime default; manifest defaults win for authored page data and source defaults remain runtime fallbacks.`,\n path: `${path}.manifest.fields.${field.name}.defaultValue`,\n });\n }\n\n return diagnostics;\n}\n\nfunction isSafeRelativePath(value: unknown): value is string {\n return typeof value === \"string\"\n && value.length > 0\n && !value.startsWith(\"/\")\n && !value.includes(\"\\\\\")\n && !/^[A-Za-z]:/.test(value)\n && value.split(\"/\").every((part) => part.length > 0 && part !== \".\" && part !== \"..\");\n}\n\nexport function validateCompilerProject(project: CompilerProject): Diagnostic[] {\n const diagnostics: Diagnostic[] = [];\n if (!project || typeof project !== \"object\" || project.schemaVersion !== \"1\") {\n return [{ severity: \"error\", code: \"COMPILER_PROJECT_SCHEMA_VERSION_UNSUPPORTED\", message: \"CompilerProject.schemaVersion must be \\\"1\\\"\", path: \"schemaVersion\" }];\n }\n if (!Array.isArray(project.components)) {\n return [{ severity: \"error\", code: \"COMPILER_PROJECT_COMPONENTS_REQUIRED\", message: \"CompilerProject.components must be an array\", path: \"components\" }];\n }\n\n const componentTypes = new Set<string>();\n const componentNames = new Set<string>();\n const assetOutputs = new Map<string, string>();\n\n project.components.forEach((definition, index) => {\n const prefix = `components[${index}]`;\n const manifest = definition?.manifest;\n const implementation = definition?.implementation;\n const type = manifest?.type;\n\n if (typeof type !== \"string\" || !type.trim()) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_COMPONENT_TYPE_REQUIRED\", message: \"Component manifest type must be a non-empty string\", path: `${prefix}.manifest.type` });\n } else if (componentTypes.has(type)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_DUPLICATE_COMPONENT_TYPE\", message: `Duplicate component manifest type: ${type}`, path: `${prefix}.manifest.type` });\n } else {\n componentTypes.add(type);\n }\n\n if (!manifest || typeof manifest.displayName !== \"string\" || !manifest.displayName.trim() || !Array.isArray(manifest.fields)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_COMPONENT_MANIFEST_INVALID\", message: \"Component manifest requires a displayName and fields array\", path: `${prefix}.manifest` });\n }\n\n if (!implementation || (implementation.kind !== \"ir\" && implementation.kind !== \"mitosis\") || !implementation.component) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_IMPLEMENTATION_INVALID\", message: \"Project compilation requires a DesignOS IR or parsed Mitosis component implementation\", path: `${prefix}.implementation` });\n } else {\n const name: unknown = implementation.component.name;\n if (typeof name !== \"string\" || !/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_COMPONENT_NAME_INVALID\", message: `Component name must be a valid identifier for generated framework components: ${name}`, path: `${prefix}.implementation.component.name` });\n } else if (componentNames.has(name)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_DUPLICATE_COMPONENT_NAME\", message: `Duplicate component implementation name: ${name}`, path: `${prefix}.implementation.component.name` });\n } else {\n componentNames.add(name);\n }\n if (implementation.kind === \"ir\") {\n diagnostics.push(...validateComponentIR(implementation.component).map((diagnostic) => ({\n ...diagnostic,\n path: diagnostic.path ? `${prefix}.implementation.component.${diagnostic.path}` : `${prefix}.implementation.component`,\n })));\n } else if (implementation.component[\"@type\"] !== \"@builder.io/mitosis/component\") {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_MITOSIS_COMPONENT_INVALID\", message: \"Parsed Mitosis implementation has an invalid component discriminator\", path: `${prefix}.implementation.component.@type` });\n }\n if (manifest && Array.isArray(manifest.fields)) diagnostics.push(...validateManifestImplementationContract(manifest, implementation, prefix));\n }\n\n const outputDirectory = definition?.outputDirectory ?? \"components\";\n if (!isSafeRelativePath(outputDirectory)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_OUTPUT_DIRECTORY_INVALID\", message: \"outputDirectory must be a safe path relative to the target output directory\", path: `${prefix}.outputDirectory` });\n }\n\n for (const collection of [\"styles\", \"assets\"] as const) {\n const references = definition?.[collection];\n if (references !== undefined && !Array.isArray(references)) {\n diagnostics.push({ severity: \"error\", code: `COMPILER_PROJECT_${collection.toUpperCase()}_INVALID`, message: `${collection} must be an array`, path: `${prefix}.${collection}` });\n }\n for (const [assetIndex, asset] of (Array.isArray(references) ? references : []).entries()) {\n const assetPath = `${prefix}.${collection}[${assetIndex}]`;\n if (!isSafeRelativePath(asset.source)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_ASSET_SOURCE_PATH_INVALID\", message: \"Asset source must be a safe path relative to the project root\", path: `${assetPath}.source` });\n continue;\n }\n const outputPath = asset.outputPath ?? asset.source;\n if (!isSafeRelativePath(outputPath)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_ASSET_OUTPUT_PATH_INVALID\", message: \"Asset outputPath must be a safe path relative to the generated output directory\", path: `${assetPath}.outputPath` });\n continue;\n }\n const normalizedOutputPath = outputPath.toLowerCase();\n const existingSource = assetOutputs.get(normalizedOutputPath);\n if (existingSource && existingSource !== asset.source) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_ASSET_OUTPUT_COLLISION\", message: `Different assets target the same output path: ${outputPath}`, path: `${assetPath}.outputPath` });\n } else {\n assetOutputs.set(normalizedOutputPath, asset.source);\n }\n }\n }\n });\n\n return diagnostics;\n}\n\nexport async function compileComponent(\n component: ComponentIR,\n registry: TargetRegistry,\n options: CompileOptions,\n): Promise<GenerationResult> {\n const plugins = [...(options.plugins ?? [])].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));\n let normalized = normalizeComponent(component);\n for (const plugin of plugins) normalized = plugin.beforeNormalize?.(normalized) ?? normalized;\n for (const plugin of plugins) normalized = plugin.afterNormalize?.(normalized) ?? normalized;\n const diagnostics = validateComponentIR(normalized);\n if (diagnostics.some((diagnostic) => diagnostic.severity === \"error\")) {\n return { target: options.target, files: [], diagnostics };\n }\n const context: GenerationContext = { target: options.target, component: normalized, options: options.targetOptions ?? {} };\n for (const plugin of plugins) await plugin.beforeGenerate?.(context);\n let result = registry.get(options.target).generate(context);\n result = { ...result, diagnostics: [...diagnostics, ...result.diagnostics] };\n for (const plugin of plugins) result = (await plugin.afterGenerate?.(result)) ?? result;\n return result;\n}\n\nfunction relativeModulePath(fromFile: string, toFile: string): string {\n const fromDirectory = fromFile.split(\"/\").slice(0, -1);\n const toParts = toFile.split(\"/\");\n let shared = 0;\n while (shared < fromDirectory.length && shared < toParts.length && fromDirectory[shared] === toParts[shared]) shared++;\n const path = [\n ...Array.from({ length: fromDirectory.length - shared }, () => \"..\"),\n ...toParts.slice(shared),\n ].join(\"/\");\n return path.startsWith(\".\") ? path : `./${path}`;\n}\n\nfunction addStyleImports(contents: string, moduleOutputPath: string, styles: ComponentAssetReference[]): string {\n const statements = [...new Set(styles.map((style) =>\n `import ${JSON.stringify(relativeModulePath(moduleOutputPath, style.outputPath ?? style.source))};`,\n ))].filter((statement) => !contents.includes(statement));\n if (statements.length === 0) return contents;\n const firstLineEnd = contents.indexOf(\"\\n\");\n if (contents.startsWith(\"// @ts-nocheck\") && firstLineEnd >= 0) {\n return `${contents.slice(0, firstLineEnd + 1)}${statements.join(\"\\n\")}\\n${contents.slice(firstLineEnd + 1)}`;\n }\n return `${statements.join(\"\\n\")}\\n${contents}`;\n}\n\nexport async function compileProject(\n project: CompilerProject,\n registry: TargetRegistry,\n options: CompileOptions,\n): Promise<CompileProjectResult> {\n const diagnostics = validateCompilerProject(project);\n if (diagnostics.some((diagnostic) => diagnostic.severity === \"error\")) {\n return { target: options.target, files: [], assets: [], diagnostics };\n }\n\n const files: GeneratedFile[] = [];\n const assets = new Map<string, string>();\n const generatedPaths = new Set<string>();\n const registryEntries: CompilerProjectRegistryEntry[] = [];\n const targetDefinition = registry.get(options.target);\n\n for (const [index, definition] of project.components.entries()) {\n let result: GenerationResult;\n if (definition.implementation.kind === \"ir\") {\n result = await compileComponent(definition.implementation.component, registry, options);\n } else if (targetDefinition.generateMitosis) {\n result = targetDefinition.generateMitosis(definition.implementation.component, options.targetOptions ?? {});\n } else {\n result = {\n target: options.target,\n files: [],\n diagnostics: [{\n severity: \"error\",\n code: \"COMPILER_TARGET_MITOSIS_SOURCE_UNSUPPORTED\",\n message: `Target ${options.target} does not provide a Mitosis source generator.`,\n path: `components[${index}].implementation`,\n }],\n };\n }\n diagnostics.push(...result.diagnostics.map((diagnostic) => ({\n ...diagnostic,\n path: diagnostic.path ? `components[${index}].${diagnostic.path}` : `components[${index}]`,\n })));\n\n const componentName = definition.implementation.component.name;\n for (const file of result.files) {\n if (!isSafeRelativePath(file.path)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_GENERATED_PATH_INVALID\", message: `Target generated an unsafe relative file path: ${file.path}`, path: `components[${index}].output` });\n continue;\n }\n const outputPath = `${definition.outputDirectory ?? \"components\"}/${file.path}`;\n const normalizedPath = outputPath.toLowerCase();\n if (generatedPaths.has(normalizedPath)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_GENERATED_PATH_COLLISION\", message: `Multiple components generated the same output path: ${outputPath}`, path: `components[${index}].output` });\n continue;\n }\n generatedPaths.add(normalizedPath);\n const isEntryModule = file.kind === \"component\" && file.path.split(\"/\").pop()?.startsWith(`${componentName}.`);\n files.push({\n ...file,\n path: outputPath,\n contents: isEntryModule && definition.styles?.length\n ? addStyleImports(file.contents, outputPath, definition.styles)\n : file.contents,\n });\n }\n\n if (targetDefinition.generateProjectRegistry) {\n const entryFiles = result.files.filter((file) => file.kind === \"component\" && file.path.split(\"/\").pop()?.startsWith(`${componentName}.`));\n if (entryFiles.length !== 1) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_REGISTRY_ENTRY_AMBIGUOUS\", message: `Expected one generated entry module for ${componentName}; found ${entryFiles.length}`, path: `components[${index}].output` });\n } else {\n registryEntries.push({\n type: definition.manifest.type,\n modulePath: `${definition.outputDirectory ?? \"components\"}/${entryFiles[0].path}`,\n });\n }\n }\n\n for (const asset of [...(definition.styles ?? []), ...(definition.assets ?? [])]) {\n assets.set(asset.outputPath ?? asset.source, asset.source);\n }\n }\n\n if (targetDefinition.generateProjectRegistry) {\n const registryFile = targetDefinition.generateProjectRegistry(registryEntries);\n if (!isSafeRelativePath(registryFile.path)) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_REGISTRY_PATH_INVALID\", message: `Target generated an unsafe registry path: ${registryFile.path}`, path: \"target.registry\" });\n } else if (generatedPaths.has(registryFile.path.toLowerCase())) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_REGISTRY_PATH_COLLISION\", message: `Registry output collides with a generated component file: ${registryFile.path}`, path: \"target.registry\" });\n } else {\n generatedPaths.add(registryFile.path.toLowerCase());\n files.push(registryFile);\n }\n } else {\n diagnostics.push({ severity: \"info\", code: \"COMPILER_PROJECT_REGISTRY_NOT_REGISTERED\", message: `Target ${options.target} has no verified project component registry emitter; generated files are emitted without components.ts.`, path: `target.${options.target}` });\n }\n\n for (const outputPath of assets.keys()) {\n if (generatedPaths.has(outputPath.toLowerCase())) {\n diagnostics.push({ severity: \"error\", code: \"COMPILER_PROJECT_ASSET_GENERATED_PATH_COLLISION\", message: `Asset output collides with a generated file: ${outputPath}`, path: \"assets\" });\n }\n }\n\n if (diagnostics.some((diagnostic) => diagnostic.severity === \"error\")) {\n return { target: options.target, files: [], assets: [], diagnostics };\n }\n\n return {\n target: options.target,\n files,\n assets: [...assets.entries()].map(([outputPath, source]) => ({ source, outputPath })),\n diagnostics,\n };\n}\n\nexport function pageNodeToComponentIR(node: PageNode): ComponentIR {\n return {\n version: \"0.1\",\n name: node.type,\n imports: [],\n props: Object.keys(node.props).map((name) => ({ name, defaultValue: node.props[name] })),\n state: [],\n root: { kind: \"component\", name: node.type, attributes: Object.keys(node.props).map((name) => ({ name, binding: { kind: \"expression\", code: `props.${name}` } })) },\n metadata: { sourceNodeId: node.id },\n };\n}\n\nexport { componentIRToMitosis, createMitosisCompiler, createMitosisTarget, generateMitosisSourceComponent, generateWithMitosis, mitosisTargets, mitosisTargetCapabilities } from \"./mitosis\";\nexport type { MitosisTarget, MitosisTargetCapability } from \"./mitosis\";\nexport { parseMitosisSource } from \"./source\";\nexport type { ParseMitosisSourceOptions } from \"./source\";\n","import { runCli } from \"./run\";\n\nvoid runCli(process.argv.slice(2)).then((exitCode) => {\n process.exitCode = exitCode;\n});\n"],"mappings":";;;AAAA,SAAS,UAAU,OAAO,OAAO,UAAU,UAAU,QAAQ,IAAI,MAAM,iBAAiB;AACxF,SAAS,kBAAkB;AAC3B,SAAS,SAAS,YAAY,MAAM,UAAU,SAAS,WAAW;;;ACFlE;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;OACK;ACtBP,SAAS,gBAAgB;AD2BlB,IAAM,iBAAiB;EAC5B;EAAU;EAAW;EAAW;EAAiB;EAAQ;EAAU;EAAO;EAAS;EACnF;EAAU;EAAQ;EAAS;EAAe;EAAO;EAAS;EAAW;EACrE;EAAS;EAAQ;EAAY;EAAO;AACtC;AAQO,IAAM,4BAAsF,OAAO;EACxG,OAAO,YAAY,eAAe,IAAI,CAAC,WAAW,CAAC,QAAQ,OAAO,OAAO;IACvE,YAAY;IACZ,gBAAgB;IAChB,YAAY;IACZ,aAAa;EACf,CAAC,CAAC,CAAC,CAAC;AACN;AAIA,IAAM,kBAAkB,oBAAI,IAAmB,CAAC,UAAU,QAAQ,SAAS,eAAe,OAAO,SAAS,MAAM,CAAC;AACjH,IAAM,mBAAmB,oBAAI,IAAmB,CAAC,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AG;AACpM,WAAO;AAAA,EACT,SAAS,OAAO;AACd,WAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AACnE,WAAO;AAAA,EACT;AACF;;;AI/TA,KAAK,OAAO,QAAQ,KAAK,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa;AACpD,UAAQ,WAAW;AACrB,CAAC;","names":["isSafeRelativePath"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@designos/compiler-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,6 +15,7 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@builder.io/mitosis": "0.14.1",
18
+ "@designos/compiler-blade": "0.1.0",
18
19
  "@designos/compiler-core": "0.1.0"
19
20
  },
20
21
  "devDependencies": {