{"library":"recma-stringify","title":"recma JavaScript Stringifier Plugin","description":"The `recma-stringify` package is a `unified` plugin designed to serialize JavaScript Abstract Syntax Trees (ASTs) back into JavaScript code. It operates within the `recma` ecosystem, which focuses on transforming JavaScript ASTs, similar to how `remark` handles Markdown and `rehype` handles HTML. Currently at version `1.0.0`, it is part of an active project with a stable release cadence that generally aligns with Node.js LTS versions, with major releases dropping support for unmaintained Node.js environments. Its primary differentiator is its seamless integration into the `unified` processing pipeline, abstracting the underlying `estree-util-to-js` utility. This allows developers to easily incorporate JavaScript code generation into broader content processing workflows, such as compiling MDX. It does not parse JavaScript itself; for that, it's typically paired with `recma-parse` or used via the overarching `recma` core package.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install recma-stringify"],"cli":null},"imports":["import recmaStringify from 'recma-stringify'","import type { Options } from 'recma-stringify'","import { unified } from 'unified'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import recmaJsx from 'recma-jsx'\nimport recmaStringify from 'recma-stringify'\nimport rehypeParse from 'rehype-parse'\nimport rehypeRecma from 'rehype-recma'\nimport {unified} from 'unified'\n\nasync function processHtmlToJsx() {\n  const file = await unified()\n    .use(rehypeParse, {fragment: true}) // Parse HTML fragment\n    .use(rehypeRecma) // Convert HTML AST (hast) to JS AST (esast)\n    .use(recmaJsx) // Transform JS AST for JSX elements\n    .use(recmaStringify) // Serialize the JS AST back to code\n    .process('<p>Hi!<h1>Hello!') // Process the input string\n\n  console.log(String(file))\n}\n\nprocessHtmlToJsx().catch(console.error)\n","lang":"typescript","description":"Demonstrates processing an HTML fragment through rehype, converting it to a recma (JS) AST, applying JSX transformations, and then stringifying it to output JSX code. This shows the typical `unified` pipeline usage.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}