0.2.2 • Published 1 year ago

@rosmarinus/compiler-kit v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@rosmarinus/compiler-kit

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);