Skip to content

Architecture

High-level flow:

mermaid
flowchart LR
  A[Source file or string] --> B[Babel parse JSX/TS]
  B --> C[React parser]
  C --> D[IR Component]
  D --> E[Vue SFC codegen]
  E --> F[.vue text or file]

Layout

AreaPathRole
CLIsrc/index.tscac CLI; calls convert()
Entry APIsrc/convert.tsconvert, convertCode; wires parser → codegen
Parsersrc/parser/react.ts, src/parser/index.tsBabel AST → Component IR
IRsrc/ir/types.ts, src/ir/index.tsFramework-agnostic component + template model
Codegensrc/codegen/vue.ts, src/codegen/index.tsIR → Vue SFC string
Teststest/convert.test.mjs, test/fixtures/*Regression tests

For a detailed list of what react.ts and vue.ts implement today (hooks, JSX patterns, template emission), see Compiler features.

Intermediate representation

The IR (src/ir/types.ts) describes:

  • Component metadata: name, props, setup (ordered parts), declaredNames, template.
  • SetupPart variants: state, ref, memo, effect, subcomponent, verbatim text blocks.
  • TemplateNode tree: elements, components, fragments, text, expressions, conditionals, lists.

This layer is meant to stay framework-agnostic so additional parsers or emitters can be added later without rewriting the entire pipeline.

Playground

The Nuxt app under website/ imports convertCode from src/convert.ts via the server route website/server/api/convert.post.ts. That keeps the same conversion logic as the CLI and npm API.

Build

  • Library bundle: tsup (tsup.config.ts), ESM output in dist/.
  • Docs: VitePress in docs/ (separate docs/package.json).

Questions? parsajiravand@gmail.com · MIT License · BRANDING.md for name / fork policy · https://cross-framework.netlify.app/ · https://cross-framework-doc.netlify.app/