vox-rn-codegen API Reference (generated)
vox-rn-codegen
Section titled “vox-rn-codegen”Crate: vox-rn-codegen · Version: 0.6.0 · Target: Library (lib.rs)
React Native + Expo TypeScript codegen extracted from vox-codegen.
Crate Overview
Section titled “Crate Overview”React Native + Expo lowering for the BuildTarget::Mobile target.
Single source of truth
Section titled “Single source of truth”This crate is one of two lowerings for Vox components. The web lowering
(under vox_codegen::codegen_ts::reactive + component) consumes the same
HirModule and produces React DOM + Tailwind output; this crate consumes the
same HirModule and produces React Native + StyleSheet output. The HIR is the
shared source of truth — there is no separate “RN HIR”.
Future split-brain protection: the vox-cli-tests harness asserts that for
every Vox source under test, BOTH lowerings produce output that
tsc --noEmit accepts. Any divergence in supported VUV vocabulary fails CI.
What’s emitted
Section titled “What’s emitted”For a Vox module, [generate_rn] produces a self-contained set of files:
App.tsx— Expo Router root layout (when components are present).<Component>.tsx— one file percomponent Name() { ... }. RN-flavored.vox-client.ts— reused unchanged from the existing emit; HTTP layer is identical between web and mobile.mobile.ts— reused unchanged (adapter contract viatarget="rn").vox-app-contract.json,openapi.json,schemas.ts,types.ts— reused.app.json,babel.config.js,metro.config.js,eas.json— Expo scaffold artifacts (one-shot, not overwritten).
What’s NOT yet emitted (will produce a clear codegen diagnostic, not silent stub)
Section titled “What’s NOT yet emitted (will produce a clear codegen diagnostic, not silent stub)”@routes→ expo-router file tree (see follow-on in Phase 1A.4).- Boolean
@formfields →<Switch>(currently emits a TODO marker; users can hand-edit until the upstream HIR exposes switch metadata). - State machines are emitted unchanged (TypeScript-only; no React DOM coupling).
Workspace Dependencies
Section titled “Workspace Dependencies”| Dependency | Kind |
|---|---|
vox-codegen | Normal |
vox-compiler | Normal |
vox-codegen | Development |
vox-compiler | Development |
Public API Surface
Section titled “Public API Surface”Modules
Section titled “Modules”| Module | Description |
|---|---|
component | — |
form | — |
mobile_utils | — |
routes | — |
scaffold | — |
Structs
Section titled “Structs”| Struct | Description |
|---|---|
RnCodegenOutput | Output of the RN lowering. Same shape as the web emitter’s CodegenOutput for symmetry. |
Functions
Section titled “Functions”| Function | Description |
|---|---|
generate_rn | Generate React Native + Expo TypeScript files from a Vox module. The caller is responsible for writing files. Returns Err on hard failures (e.g. unsupported features); use the diagnostics field for non-fatal warnings. |