Last active
December 17, 2015 04:59
-
-
Save arv/5554809 to your computer and use it in GitHub Desktop.
Shows how you can build a smaller js binary to only parse (and print) some ES6 code.
This file contains 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
traceur --out out.js parser.js | |
# Traceur does not strip dead code. Use Uglify2. | |
uglifyjs src/runtime/runtime.js out.js -cm -o out.min.js |
This file contains 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
traceur parser.js |
This file contains 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
import {Parser} from './src/syntax/Parser.js'; | |
import {SourceFile} from './src/syntax/SourceFile.js'; | |
import {ErrorReporter} from './src/util/ErrorReporter.js'; | |
import {TreeWriter} from './src/outputgeneration/TreeWriter.js'; | |
var file = new SourceFile('name', '`abc`'); | |
var reporter = new ErrorReporter(); | |
var parser = new Parser(reporter, file); | |
var tree = parser.parseProgram(); | |
console.log(TreeWriter.write(tree)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment