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 holds the complete list of generated render artifacts returned by .
- Assistant
Now let me look at the remaining core pieces I need to touch for slot handling:
- Assistant
Now I have the full picture. Let me write the new
dom.rs: - Assistant
Now wire it into the crate:
- Assistant
It compiles. Let me create a scratch harness to inspect actual output:
- Assistant
The main gap is
v-slots. Let me implement it in the core codegen. First, examine the relevant spots: - Assistant
Now I'll make the core edits for
v-slotssupport. Firstdetect.rs: - Assistant
Now
generate.rs— spread the v-slots object into the generated slots object: - Assistant
Now the codegen element helpers — exclude
slotsfrom custom directives: - Assistant
Now the patch flag calculation —
slotsshouldn't force NEED_PATCH: - Assistant
Now the component paths in
inline.rsandblock.rs: - Assistant
I'll add a
module_scope_bindingscodegen option — JSX bindings live in module scope, unlike SFC$setup: - Assistant
Now gate the four
$setup.sites and the signature: - Assistant
Components resolve directly now. Let me run the affected test suites to check for regressions:
- Assistant
This failure looks unrelated (quirks-mode warning handling). Let me verify it's pre-existing by testing a pristine copy:
- Assistant
All 27 tests pass. Let me run clippy and the final checks:
- Assistant
Everything passes. Let me update the crate-level docs to reflect the new DOM entry point:
- Assistant
Done. The implementation is complete and verified. Summary of what was built:
New public API —
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.