0.2.1 • Published 6 months ago

@rosmarinus/compiler-kit v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months 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);