var jsContentStr1 = fs.readFileSync(path.join(__dirname,"output","newGenEpos.js"),"utf-8"); let jsBodyArr1 = esprima.parseScript(jsContentStr1,{ range: true, tokens: true, comment: true }).body; let tree = esprima.parseScript(jsContentStr1,{ range: true, tokens: true, comment: true }); tree = escodegen.attachComments(tree, tree.comments, tree.tokens); escodegen.generate(tree.body[0],{comment:true})
标签:comment,escodegen,格式化,tree,tokens,esprima,true From: https://www.cnblogs.com/jt789/p/17011501.html