Created
April 25, 2015 09:10
-
-
Save michiel/87b83655fbbdd57f519d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var escodegen = require('escodegen'); | |
var parse = require("esprima").parse; | |
var fs = require("fs"); | |
var src = fs.readFileSync( | |
"test.js", | |
"utf-8" | |
); | |
var ast = parse(src); | |
console.log(JSON.stringify(ast, null, ' ')); | |
var output = escodegen.generate(ast, { | |
sourceMap : true, | |
sourceMapWithCode : true | |
}); | |
console.log(output.code); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment