You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@svgr/hast-util-to-babel-ast

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@svgr/hast-util-to-babel-ast

Transform HAST to Babel AST (JSX)


Version published
Weekly downloads
6.5M
decreased by-16.8%
Maintainers
1
Install size
2.83 MB
Created
Weekly downloads
 

Package description

What is @svgr/hast-util-to-babel-ast?

@svgr/hast-util-to-babel-ast is a utility package that converts HAST (Hypertext Abstract Syntax Tree) to Babel AST (Abstract Syntax Tree). This is particularly useful in the context of transforming SVG files into React components, as it allows for the manipulation and transformation of SVG content using Babel's powerful tooling.

What are @svgr/hast-util-to-babel-ast's main functionalities?

Convert HAST to Babel AST

This feature allows you to convert a HAST node into a Babel AST node. The code sample demonstrates how to import the `toBabelAst` function, create a simple HAST node representing an SVG element, and convert it to a Babel AST node.

const { toBabelAst } = require('@svgr/hast-util-to-babel-ast');
const hastNode = { type: 'element', tagName: 'svg', properties: {}, children: [] };
const babelAst = toBabelAst(hastNode);
console.log(babelAst);

Other packages similar to @svgr/hast-util-to-babel-ast

Readme

Source

@svgr/hast-util-to-babel-ast

Build Status Version MIT License

Transforms HAST into Babel AST.

Install

npm install --save-dev @svgr/hast-util-to-babel-ast

Usage

import { parse } from 'svg-parser'
import hastToBabelAst from '@svgr/hast-util-to-babel-ast'

const hastTree = parse(`<svg></svg>`)

const babelTree = hastToBabelAst(hastTree)

License

MIT

Keywords

FAQs

Package last updated on 09 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc