@liip/esbuild-plugin-ast
v0.3.1
Published
Esbuild plugin to parse JavaScript AST
Downloads
364
Readme
esbuild-plugin-ast
A plugin to generate an AST representation of your .js
files. The plugin use Acorn to produce an estree
compliant AST
object. You can then apply transformations by providing a visitor
object.
Installation
npm i -D @liip/esbuild-plugin-ast
Usage
import { astParser } from '@liip/esbuild-plugin-ast';
...
await esbuild.context({
...
plugins: [astParser(options)],
...
});
...
Options
You can configure the way the plugin works by setting different options.
interface AstParserOptions {
dependencies?: string[];
visitor: ESTraverse.Visitor;
}
dependencies
An array of node module dependencies on which this plugin should also operate.
visitor
An ESTraverse.Visitor
object used to apply AST transformation. Check the Estraverse documentation form more information on the available API.