UNPKG

magix-combine

Version:

合并Magix View的html,js,css成一个js文件,并检测html,js,css中可能存在的问题

27 lines 695 B
/* acorn lib */ let acorn = require('acorn'); let walker = require('acorn-walk'); module.exports = { parse(tmpl, comments, sourceFile) { return acorn.parse(tmpl, { sourceType: 'module', sourceFile, ecmaVersion: 'latest', onComment(block, text, start, end) { if (comments) { comments[start] = { text: text.trim() }; comments[end] = { text: text.trim() }; } } }); }, walk(ast, visitors) { walker.simple(ast, visitors, walker.base); } };