Skip to content

rrjanbiah/react2solid

Repository files navigation

React to Solid Converter, ReactJS to SolidJS Converter, ReactJS to SolidJS Transpiler

ReactJS to SolidJS Converter aka Transpiler

SolidJS is the framework known for its performance (based on the js framework benchmark project). react2solid is an attempt to create a React to Solid code converter.

This project has 5 sub-projects or modules:

  1. Language agnostic React to Solid transformer rules and test cases
  2. ReactJS to SolidJS transpiler - JavaScript frontend
  3. React to Solid converter - CLI version, for batch conversion
  4. React.js to Solid.js transformer rules builder - Web UI
  5. Automatic ReactJS to SolidJS migration guide - from the transformer rules

Demo

ReactJS to SolidJS Converter & Utilities

Status

Started with swc, JMESPath and Rust in mind, but had to switch to the Babel, jq and SolidJS due to multiple challenges (such as 1, 2, 3). Now, an MVP is ready without CLI.

Architecture / Approach

  1. Idea is to avoid hardcoding of parser rules
  2. Create language agnostic transpiler rules using jq selectors and also keep test case scripts along with that
  3. Using Babel, get AST for the ReactJS code
  4. Apply jq selection on the AST
  5. Convert the AST to JavaScript/SolidJS
  6. For string transformer, it is merely string replace over the code (no AST conversion)

Acknowledgments

  • schwartzworld of Hacker News for suggesting SolidJS hackathon
  • @ryansolid for creating SolidJS and the awesome community (especially Discord)

Roadmap

  • v0.0.1
    • Basic folder structure and naming conventions for the transform rules
    • ReactJS to SolidJS transpiler - JavaScript frontend
    • Builder UI (partly)
    • Automatic migration guide generation
    • ReactJS to SolidJS libraries alternatives (MVP, not handled in code)
  • v0.0.2
    • Refactor for code duplication and TOML structure
  • v0.0.3
    • Rust-based converter. Switch to swc?

Contributing

  • Feel free to post any issues or suggestions
  • Submit your transform rules using the builder (TODO. Till then feel free to submit PR)

Support / Sponsor

Hire Me, Recommend Me for any remote/freelancer opportunity

Contact Email: rrjanbiah-at-Y!com

Twitter: @rrjanbiah (DM open)