simple babel。旨在深入理解babel的词法分析,替换等核心功能。
目前支持支持语法解析,语法转换以及代码生成
- VariableDeclaration
- ClassDeclaration
- FunctionDeclaration
- ExpressionStatement
- BlockStatement
- LabeledStatement
- SwitchStatement
- BreakStatement
- ContinueStatement
- EmptyStatement
- ThrowStatement
- ReturnStatement
- IfStatement
- ForStatement
- ForInStatement
- ForOfStatement
- WhileStatement
- DoWhileStatement
- TryStatement
- DebuggerStatement
- thisExpression
- SequenceExpression
- AssignmentExpression
- UpdateExpression
- UnaryExpression
- MemberExpression
- LogicalExpression
- BinaryExpression
- CallExpression
- FunctionExpression
- VariableDeclarator
- ObjectExpression
- ArrayExpression
- ConditionalExpression
- NewExpression
- ArrowFunctionExpression
- Property
- Literal
- Identifier
- AssignmentPattern
- arrowFunctionExpression
- block-bind
- class
- default-parameters
- modules
- property-method
- spread
- templateLiteral
- forOf
npm install
npm run test
Compile the file a.js
and output it to stdout
$ ./bin/babel ./example/a.js
Compile the file a.js
and output it to a.compiled.js
$ ./bin/babel ./example/a.js -o ./example/a.compiled.js
Compile the file and output it to dist directory
$ ./bin/babel ./example/a.js -d dist
Compile the directory and output it to dist directory
$ ./bin/babel ./example -d dist