
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.
babel-plugin-ast-literal
Advanced tools
Babel plugin which processes expr and stmt tagged template strings into
Babylon (Babel JS parser) AST nodes:
let exportReactComponentNode = stmt`
export function ${name}(props) {
return React.createElement(
${component},
{...props, className: styles.${className}}
);
}
`; // {type: 'ExportNamedDeclaration', ...}
let jsxNode = expr`<div a="${some}" />` // {type: 'JSXElement', ...}
This is mostly useful for code generation.
+ It handles more cases, like:
stmt`import Lib from "${lib}"`
which can't be handled by babel-template (it can only fill identifiers).
+ It inlines AST Node generation in code instead of doing a pass over AST Node template as babel-template does. This should be faster.
- It is somewhat hacky but it works!
It allows to specify template right in place rather than defining template and then applying it.
I wrote it when babel-template wasn't a thing (previous versions were even
targeting Babel 5).
Install from npm:
% npm install babel-plugin-ast-literal
Add to you Babel config (probably .babelrc):
{
"plugins": ["ast-literal"]
}
Enjoy!
FAQs
AST literals via ES2015 tagged template strings
The npm package babel-plugin-ast-literal receives a total of 7 weekly downloads. As such, babel-plugin-ast-literal popularity was classified as not popular.
We found that babel-plugin-ast-literal 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
/Security News
Another wave of Shai-Hulud campaign has hit npm with more than 500 packages and 700+ versions affected.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.