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 I have the full picture. Let me write the
dom.rsmodule. - Assistant
Now wire up
lib.rsandCargo.toml: - Assistant
It compiles. Now let me write a scratch harness to inspect actual output across the feature matrix:
- Assistant
Mostly excellent output. The
v-slotscase leaked raw JSX into the output — that needs proper handling. Let me check how component children (default slot) behave first: - Assistant
Now I'll implement the slot-object interpretation pass. Let me check the SpanMapper API first:
- Assistant
Now the slot interpretation module:
- Assistant
Now wire the pass into
dom.rs: - Assistant
Now let me refactor to also handle the
v-slotsdirective form, extracting shared helpers: - Assistant
One issue: the dynamic slot name emitted
[_ctx.name]despite prefixing being off. Let me check that codegen path: - Assistant
Now run the full test suites for the touched crates:
- Assistant
pklisn't installed in this environment, so those 8 fixture-loader failures are environmental, not caused by my diff. Now doc tests and clippy: - Assistant
Now let me update the crate-level docs in
lib.rsto reflect the new backend module, and re-verify the full behavior matrix: - Assistant
All output shapes are correct. Now let me remove the scratch harness and add a proper integration test file instead:
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.