Elixir library providing ESTree JavaScript AST node structs and a JavaScript code generator.
Elixir-ESTree is an Elixir library that implements the ESTree specification for JavaScript abstract syntax trees. It provides structured representations of JavaScript and JSX AST nodes as Elixir structs, along with a code generator to convert these ASTs back into JavaScript source code. This enables programmatic JavaScript code generation and manipulation directly from Elixir applications.
Elixir developers who need to generate, manipulate, or analyze JavaScript code programmatically, such as those building code transformation tools, compilers, or JavaScript-related development utilities.
Developers choose Elixir-ESTree because it brings comprehensive JavaScript AST capabilities to the Elixir ecosystem with full ESTree specification compliance, JSX support, and an intuitive builder API that leverages Elixir's functional programming patterns for AST construction and manipulation.
The ESTree Nodes and JavaScript AST to JavaScript Code Generator in Elixir
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Implements all JavaScript AST nodes as Elixir structs per the official ESTree spec, ensuring accurate and standards-compliant representations for code generation.
Includes structs for JSX elements following the Facebook JSX AST specification, enabling generation of JSX code directly from Elixir, as shown in the README examples.
Provides helper functions like Builder.array_expression for easy programmatic construction of AST nodes, leveraging Elixir's functional patterns for clean code.
The Generator module converts AST structs back into valid JavaScript source code strings, demonstrated with examples for both JavaScript and JSX output.
The library focuses on AST representation and generation but lacks a JavaScript parser, requiring integration of external tools for parsing code into ASTs, which adds complexity.
As a niche Elixir library for JavaScript ASTs, it has fewer community contributions and integrations compared to popular JavaScript-native tools like Babel or Acorn.
For large-scale AST manipulations, the overhead of converting between Elixir structs and JavaScript code might impact performance relative to native JavaScript solutions.