Parses and compiles JSX code to JavaScript AST or code, providing a fork of jsx-recast using acorn-jsx for parsing, estraverse/estraverse-fb for traversal, and escodegen for code generation. Current version is 0.1.4. It supports attaching comments to AST in an esprima-compatible way, respects /** @jsx */ annotations, and enables source maps for JSX elements. Differentiators include native AST tools (acorn, estraverse, escodegen) and compatibility with older JavaScript toolchains. Suitable for use as a browserify transform or standalone transformer for JSX to JS.
npm install jsx-transpilerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates parsing JSX to AST, transforming to JavaScript AST, and compiling to JavaScript code with source map.
Consider using @babel/core + @babel/preset-react or esbuild/swc for modern JSX compilation.
Use CommonJS require() or use a bundler like webpack with CommonJS compatibility.
Always call transform() to convert to standard JavaScript AST before passing to escodegen or other ESTree-based tools.
Run 'npm install jsx-transpiler' in your project directory.
Ensure the JavaScript code is valid JSX and that the options object is passed correctly. The package expects JSX source code as a string.
Use 'const { compile } = require('jsx-transpiler')'.