Skip to content

2.0.0

Compare
Choose a tag to compare
@disnet disnet released this 02 Jul 20:18
· 233 commits to master since this release

Breaking Changes

The macro context API has changed. Before you could call ctx.next('expr') to expand until an expression was matched but now this has been separated out into the expand method. The expand method now also understands a lot more grammar productions:

  • Statement with alias stmt
  • AssignmentExpression with alias expr
  • Expression
  • BlockStatement
  • WhileStatement
  • IfStatement
  • ForStatement
  • SwitchStatement
  • BreakStatement
  • ContinueStatement
  • DebuggerStatement
  • WithStatement
  • TryStatement
  • ThrowStatement
  • ClassDeclaration
  • FunctionDeclaration
  • LabeledStatement
  • VariableDeclarationStatement
  • ReturnStatement
  • ExpressionStatement
  • YieldExpression
  • ClassExpression
  • ArrowExpression
  • NewExpression
  • ThisExpression
  • FunctionExpression
  • IdentifierExpression
  • LiteralNumericExpression
  • LiteralInfinityExpression
  • LiteralStringExpression
  • TemplateExpression
  • LiteralBooleanExpression
  • LiteralNullExpression
  • LiteralRegExpExpression
  • ObjectExpression
  • ArrayExpression
  • UnaryExpression
  • UpdateExpression
  • BinaryExpression
  • StaticMemberExpression
  • ComputedMemberExpression
  • AssignmentExpression
  • CompoundAssignmentExpression
  • ConditionalExpression

In addition, the macro context now has a reset method that resets the iterator. The interface is now:

TransformerContext = {
  name: () -> Syntax
  next: () -> {
    done: boolean,
    value: Syntax
  }
  expand: (string) -> {
    done: boolean,
    value: Syntax
  }
  reset: () -> undefined
}