Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Parse in reverse. AST goes in, code comes out.
import { print } from 'esrap';
const { code, map } = print({
type: 'Program',
body: [
{
type: 'ExpressionStatement',
expression: {
callee: {
type: 'Identifier',
name: 'alert'
},
arguments: [
{
type: 'Literal',
value: 'hello world!'
}
]
}
}
]
});
console.log(code); // alert('hello world!');
If the nodes of the input AST have loc
properties (e.g. the AST was generated with acorn
with the locations
option set), sourcemap mappings will be created.
You can pass information that will be added to the resulting sourcemap (note that the AST is assumed to come from a single file):
const { code, map } = print(ast, {
sourceMapSource: 'input.js',
sourceMapContent: fs.readFileSync('input.js', 'utf-8')
});
esrap
can also print TypeScript nodes, assuming they match the ESTree-like @typescript-eslint/types
.
Because it's ginormous.
This repo uses pnpm. Once it's installed, do pnpm install
to install dependencies, and pnpm test
to run the tests.
FAQs
Parse in reverse
We found that esrap demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.