diff --git a/bin/babylon-lightscript.js b/bin/babylon-lightscript.js new file mode 100755 index 0000000000..b74fdc7e0d --- /dev/null +++ b/bin/babylon-lightscript.js @@ -0,0 +1,16 @@ +#!/usr/bin/env node +/* eslint no-var: 0 */ + +var babylon = require(".."); +var fs = require("fs"); + +var filename = process.argv[2]; +if (!filename) { + console.error("no filename specified"); + process.exit(0); +} + +var file = fs.readFileSync(filename, "utf8"); +var ast = babylon.parse(file, { plugins: ["lightscript"] }); + +console.log(JSON.stringify(ast, null, " ")); diff --git a/package.json b/package.json index 1d191164b1..1d06650129 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "unicode-9.0.0": "~0.7.0" }, "bin": { - "babylon": "./bin/babylon.js" + "babylon": "./bin/babylon.js", + "babylon-lightscript": "./bin/babylon-lightscript.js" }, "scripts": { "build": "npm run clean && rollup -c",