babel-parser.js 333 B

12345678910111213141516
  1. #!/usr/bin/env node
  2. /* eslint no-var: 0 */
  3. var parser = require("..");
  4. var fs = require("fs");
  5. var filename = process.argv[2];
  6. if (!filename) {
  7. console.error("no filename specified");
  8. process.exit(0);
  9. }
  10. var file = fs.readFileSync(filename, "utf8");
  11. var ast = parser.parse(file);
  12. console.log(JSON.stringify(ast, null, " "));