It was created as an experimental alternative, faster React.js JSX parser.
According to benchmarks, Acorn-JSX is 2x faster than official Esprima-based parser when location tracking is turned on in both (call it "source maps enabled mode"). At the same time, it consumes all the ES6+JSX syntax that can be consumed by Esprima-FB (this is proved by official tests).
UPDATE [14-Apr-2015]: Facebook implementation started deprecation process in favor of Acorn + Acorn-JSX + Babel for parsing and transpiling JSX syntax.
acorn-jsx under the hood.
Requiring this module provides you with an Acorn plugin that you can use like this:
var acorn = ;var jsx = ;acornParser;
Note that official spec doesn't support mix of XML namespaces and object-style access in tag names (#27) like in
<namespace:Object.Property />, so it was deprecated in
firstname.lastname@example.org. If you still want to opt-in to support of such constructions, you can pass the following option:
Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely:
Note that by default
allowNamespaces is enabled for spec compliancy.
This plugin is issued under the MIT license.