
Research
npm Malware Targets Telegram Bot Developers with Persistent SSH Backdoors
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
@svgr/hast-util-to-babel-ast
Advanced tools
@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.
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);
hast-util-to-estree is a utility that converts HAST to ESTree, which is another form of Abstract Syntax Tree used primarily in the JavaScript ecosystem. While @svgr/hast-util-to-babel-ast focuses on Babel AST, hast-util-to-estree is more general-purpose and can be used in a wider range of JavaScript transformations.
rehype is a tool that transforms HTML with plugins. It can be used to parse HTML into HAST and then manipulate it. While it doesn't directly convert HAST to Babel AST, it can be used in conjunction with other tools to achieve similar results. rehype is more focused on HTML processing and manipulation.
Transforms HAST into Babel AST.
npm install --save-dev @svgr/hast-util-to-babel-ast
import { parse } from 'svg-parser'
import hastToBabelAst from '@svgr/hast-util-to-babel-ast'
const hastTree = parse(`<svg></svg>`)
const babelTree = hastToBabelAst(hastTree)
MIT
FAQs
Transform HAST to Babel AST (JSX)
The npm package @svgr/hast-util-to-babel-ast receives a total of 8,435,482 weekly downloads. As such, @svgr/hast-util-to-babel-ast popularity was classified as popular.
We found that @svgr/hast-util-to-babel-ast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
Security News
pip, PDM, pip-audit, and the packaging library are already adding support for Python’s new lock file format.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.