@duhongwei/parser
A es6 module parser
Last updated 25 days ago by duhongwei .
ISC · Original npm · Tarball · package.json
$ cnpm install @duhongwei/parser 
SYNC missed versions from official npm registry.

@duhongwei/parser

A es6 module parser

Build Status Coverage Status

examples

const parser=require('@duhongwei/parser')
let es6Parser=new parser.Es6('import a from "a.js";let a=1;export {a};')
let {importInfo,exportInfo,code}=es6Parser.parse()
//importInfo [{type:'js',file:'a.js',tokens:[{from:'default',to:'a'}] }]
//exportInfo [{from:'a',to:'a'}]
//code let a=1;

//dynamic Import,simply repalce 'import' with a function name
es6Parser=new parser.Es6('import("a.js")',{dynamicImportReplacer: `load`,dynamicImportKeyConvert: (key) => {return `views/${key}`}})
let {importInfo}=parser.parse()
//importInfo [{type:'djs',file:'a.js',tokens:null}]
//code load("views/a.js")

it can also parse cmd module.

welcome to my blog https://www.duhongwei.site

Current Tags

  • 2.2.0                                ...           latest (25 days ago)

5 Versions

  • 2.2.0                                ...           25 days ago
  • 2.1.0                                ...           9 months ago
  • 2.0.2                                ...           9 months ago
  • 2.0.0                                ...           9 months ago
  • 1.0.1                                ...           a year ago
Maintainers (1)
Downloads
Today 5
This Week 5
This Month 5
Last Day 0
Last Week 0
Last Month 22
Dependencies (3)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |