{"library":"recma-build-jsx","title":"recma-build-jsx","description":"This package, `recma-build-jsx`, is a plugin within the unified ecosystem, specifically designed for `recma` (a sub-project focused on JavaScript Abstract Syntax Trees). Its primary function is to transform JSX syntax (e.g., `<x />`) found in a JavaScript AST into standard JavaScript function calls, such as `React.createElement('x', {})` or `_jsx('x', {})`, making the JSX evaluable in a runtime environment. Currently at version 1.0.0, the `recma` collective maintains compatibility with actively supported Node.js versions, with new major releases typically dropping support for unmaintained Node.js runtimes. This plugin is essential when processing JavaScript code containing JSX as part of a larger transformation pipeline, often alongside other `recma` plugins like `recma-parse` (for parsing), `recma-jsx` (for enabling JSX parsing), and `recma-stringify` (for serializing back to code). It differentiates itself by integrating seamlessly into the `unified` processing flow, abstracting lower-level utilities like `estree-util-build-jsx` for a higher-level declarative API.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install recma-build-jsx"],"cli":null},"imports":["import recmaBuildJsx from 'recma-build-jsx'","import { unified } from 'unified'","import recmaJsx from 'recma-jsx'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import recmaBuildJsx from 'recma-build-jsx';\nimport recmaJsx from 'recma-jsx';\nimport recmaParse from 'recma-parse';\nimport recmaStringify from 'recma-stringify';\nimport { unified } from 'unified';\n\nasync function transformJsx() {\n  const file = await unified()\n    .use(recmaParse)\n    .use(recmaJsx) // Enables JSX parsing\n    .use(recmaBuildJsx) // Transforms JSX into JS calls\n    .use(recmaStringify) // Converts AST back to string\n    .process('console.log(<em>Hello, world!</em>)');\n\n  console.log(String(file));\n}\n\ntransformJsx();\n// Expected output in Node.js 16+ (top-level await):\n// console.log(React.createElement(\"em\", null, \"Hello, world!\"));","lang":"typescript","description":"Demonstrates a basic unified pipeline using recma-build-jsx to transform JSX into React.createElement calls, parsing and stringifying the code.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}