npm.io
0.2.2 • Published 2 years ago

@rosmarinus/compiler-kit

Licence
MIT
Version
0.2.2
Deps
13
Size
10.1 MB
Vulns
0
Weekly
0

@rosmarinus/compiler-kit

npm package build status Start new PR in StackBlitz Codeflow

This is a compiler utils in babel and htmlparser2.

Installation

npm install @rosmarinus/compiler-kit

Usage

ES
import { esCompiler } from '@rosmarinus/compiler-kit';
const ast = esCompiler.parse('const a = 1;');

esCompiler.walker(ast, {
  // babel traverse
});

const codeGen = esCompiler.builder(ast);
HTML
import { htmlCompiler } from '@rosmarinus/compiler-kit';
const ast = htmlCompiler.parse('<div>hello world</div>');

htmlCompiler.walker(ast, {
  // htmlparser2 traverse
});

const codeGen = htmlCompiler.builder(ast);

Keywords