Compile JSX and TSX components to Vue VDOM output Provide the public JSX/TSX-to-VDOM…
- User
Compile JSX and TSX components to Vue VDOM output
Provide the public JSX/TSX-to-VDOM compilation API described in the Interface. It must support render and setup-returned render functions, fragments, components, attributes and spreads, class/style merging, DOM properties, directives, slots, patch flags, dynamic props, and Vue model forms. Invalid input must produce diagnostics rather than malformed render output.
Interface
Type: Function Name: compile_to_dom Path: crates/vize_atelier_jsx/src/dom.rs Input: bump: &Bump, source: &str, lang: JsxLang, options: DomCompileOptions Output: DomOutput Description: Compiles a JSX/TSX module into Vue VDOM render functions using the shared lowering layer and Vize DOM compiler infrastructure. This is the primary entry point for transforming JSX/TSX source into VDOM-compatible render code.
Type: Class Name: DomCompileOptions Path: crates/vize_atelier_jsx/src/dom.rs Public API: DomCompileOptions { hoist_static: bool, cache_handlers: bool, source_map: bool } — all fields default to false. Description: Options controlling JSX/TSX to VDOM compilation with defaults that produce
@vue/babel-plugin-jsx-shaped output (no static hoisting, no handler caching, no source map). Pass an instance tocompile_to_domto customize the compilation behavior.Type: Constant Name: DomComponent.code Path: crates/vize_atelier_jsx/src/dom.rs Value/Type: pub code: String Description: The generated render function code for a single compiled component. This field on
DomComponentcontains the complete VDOM render implementation produced by the codegen pass.Type: Constant Name: DomComponent.component_name Path: crates/vize_atelier_jsx/src/dom.rs Value/Type: pub component_name: Option Description: The resolved enclosing component-function name, if it could be determined from the source. This field on
DomComponentisNonefor anonymous renders.Type: Constant Name: DomComponent.mode Path: crates/vize_atelier_jsx/src/dom.rs Value/Type: pub mode: JsxOutputMode Description: The resolved output mode for the component, defaulting to
JsxOutputMode::Vdomunless overridden by a directive such as"use vue:vapor". This field onDomComponentallows consumers to route the component to the appropriate backend.Type: Constant Name: DomComponent.preamble Path: crates/vize_atelier_jsx/src/dom.rs Value/Type: pub preamble: String Description: The import/preamble section containing runtime helper imports (e.g.,
toDisplayStringfromvue) needed by the generated render code. This field onDomComponentshould be emitted once per module or component as a header.Type: Constant Name: DomOutput.components Path: crates/vize_atelier_jsx/src/dom.rs Value/Type: pub components: Vec Description: The compiled components in source order, one entry per outermost JSX render root. This field on
DomOutputholds the complete list of generated render artifacts returned bycompile_to_dom.Type: Constant Name: DomOutput.diagnostics Path: crates/vize_atelier_jsx/src/dom.rs Value/Type: pub diagnostics: Vec Description: Parse, lowering, and transform diagnostics produced during compilation. This field on
DomOutputshould be inspected before using the generated code; usehas_errors()to check for error-severity diagnostics.Type: Function Name: has_errors Path: crates/vize_atelier_jsx/src/dom.rs Input: (&self) Output: bool Description: Returns
trueif any error-severity diagnostic was produced during compilation. Call this onDomOutputbefore using the generated components to ensure compilation succeeded without errors. - Assistant
I'll explore the codebase to locate existing JSX/TSX infrastructure and what
compile_to_domneeds to implement. - Assistant
Implementing
compile_to_domand JSX pre-transforms, then validating with tests. - Assistant
Fixing compile errors in
jsx_transform.rs. - Assistant
Implemented the JSX/TSX-to-VDOM compilation API in
vize_atelier_jsx.New API (
crates/vize_atelier_jsx/src/dom.rs)compile_to_dom(bump, source, lang, options) -> DomOutput— main entry pointDomCompileOptions—hoist_static,cache_handlers,source_map(all default tofalse, matching@vue/babel-plugin-jsxdefaults)DomComponent—preamble,code,component_name,modeDomOutput—components,diagnostics, plushas_errors()
Pipeline
- Lower JSX/TSX via the existing
lower_sourcelayer - JSX transform (
jsx_transform.rs) — rewrites JSX-only shapes before DOM compile:v-slotsdirective handling- Object slot children (
{{ default: () => <p/> }}) →<template v-slot>nodes - Function slot children (
{() => expr})
- DOM transform + codegen via
vize_atelier_core(with Croquis binding metadata,prefix_identifiers: true) - Diagnostics — parse/lowering/transform errors map to
JsxDiagnostic; fatal transform errors skip codegen (no malformed output)
Supported features
- Render and setup-returned JSX roots
- Fragments, components, attributes/spreads
- Class/style merging (
_normalizeClass,_mergeProps) - Directives (
v-model,v-show,v-on, etc.) - Event props (
onClick={handler}) - Patch flags and dynamic props
- Vue model forms (
v-model→modelValue/onUpdate:modelValue) - Slots (object syntax and
v-slots) - Vapor mode roots are skipped (
"use vue:vapor")
Tests
Added
tests/dom.rswith 14 integration tests; all 88 tests in the crate pass.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →
- fable-5Compare side by side →