ISSUE DESCRIPTION Compile JSX and TSX components to Vue VDOM output Provide the public…
- User
ISSUE DESCRIPTION
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
I’ll inspect the workspace and existing JSX/compiler APIs first, then identify the missing public DOM layer and its surrounding lowering/codegen infrastructure. I’ll implement the smallest integration consistent with existing conventions, run focused tests/build checks, and review the resulting diff.
- Assistant
The repository already has a mature DOM transform/codegen pipeline, while JSX lowering produces the same shared
RootNodeIR. I’ll bridge those layers rather than duplicate JSX VDOM logic: expose a root-level DOM compile helper, then add the requesteddom.rsAPI that lowers once, applies DOM transforms/codegen per root, maps compiler diagnostics back to JSX diagnostics, and suppresses render code when fatal diagnostics exist. - Assistant
The bridge compiles successfully. I found and corrected the analysis metadata type mismatch (Croquis bindings are intentionally consumed by the transform layer rather than copied into core codegen options). I’ll now run the existing JSX test suite and a small temporary executable-style check through an existing test target mechanism, then tighten fatal-diagnostic behavior if needed.
- Assistant
Focused tests pass and both affected crates type-check. I also ensured fatal transform diagnostics invalidate the entire component list rather than returning partial render artifacts. I’ll format the changed Rust files, perform one final check/diff review, and then submit.
- Assistant
Implemented JSX/TSX-to-Vue VDOM compilation.
Changes:
- Added public
compile_to_domAPI invize_atelier_jsx::dom. - Added
DomCompileOptions,DomComponent, andDomOutput. - Reused the shared JSX lowering layer and DOM transform/codegen pipeline.
- Added root-level compilation support to
vize_atelier_dom. - Preserved component names, output modes, preambles, diagnostics, spreads, directives, slots, patch flags, model transforms, and other existing DOM compiler behavior.
- Fatal diagnostics prevent malformed or partial render output.
- Re-exported the new public API from
vize_atelier_jsx.
Verification:
cargo check -p vize_atelier_jsxpassed.cargo check -p vize_atelier_dompassed.- Existing
vize_atelier_jsxunit and integration tests passed. cargo fmtandgit diff --checkpassed.
Checklist:
- Added public
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.