acorn-jsx

Alternative, faster React.js JSX parser

Latest version: 5.3.2 registry icon
Maintenance score
0
Safety score
0
Popularity score
75
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
5.3.2 0 0 0 0 0
5.3.1 0 0 0 0 0
5.3.0 0 0 0 0 0
5.2.0 0 0 0 0 0
5.1.0 0 0 0 0 0
5.0.2 0 0 0 0 0
5.0.1 0 0 0 0 0
5.0.0 0 0 0 0 0
4.1.1 0 0 0 0 0
4.1.0 0 0 0 0 0
4.0.1 0 0 0 0 0
4.0.0 0 0 0 0 0
3.0.1 0 0 0 0 0
3.0.0 0 0 0 0 0
2.0.1 0 0 0 0 0
2.0.0 0 0 0 0 0
1.0.3 0 0 0 0 0
1.0.2 0 0 0 0 0
1.0.1 0 0 0 0 0
1.0.0 0 0 0 0 0
0.11.1-4 0 0 0 0 0
0.11.1-3 0 0 0 0 0
0.11.1-2 0 0 0 0 0
0.11.1-1 0 0 0 0 0
0.9.1-8 0 0 0 0 0
0.9.1-7 0 0 0 0 0
0.9.1-6 0 0 0 0 0
0.9.1-5 0 0 0 0 0
0.9.1-4 0 0 0 0 0
0.9.1-3 0 0 0 0 0
0.9.1-2 0 0 0 0 0
0.9.1-1 0 0 0 0 0
0.7.1-3 0 0 0 0 0
0.7.1-2 0 0 0 0 0
0.6.1-3 0 0 0 0 0
0.6.1-2 0 0 0 0 0
0.6.1-1 0 0 0 0 0
0.6.1 0 0 0 0 0

Stability
Latest release:

5.3.2 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

MIT   -   MIT License

Not a wildcard

Not proprietary

OSI Compliant



Acorn-JSX

Build Status NPM version

This is plugin for Acorn - a tiny, fast JavaScript parser, written completely in JavaScript.

It was created as an experimental alternative, faster React.js JSX parser. Later, it replaced the official parser and these days is used by many prominent development tools.

Transpiler

Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out Babel and Buble transpilers which use acorn-jsx under the hood.

Usage

Requiring this module provides you with an Acorn plugin that you can use like this:

var acorn = require("acorn");
var jsx = require("acorn-jsx");
acorn.Parser.extend(jsx()).parse("my(<jsx/>, 'code');");

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 acorn-jsx@3.0. If you still want to opt-in to support of such constructions, you can pass the following option:

acorn.Parser.extend(jsx({ allowNamespacedObjects: true }))

Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely:

acorn.Parser.extend(jsx({ allowNamespaces: false }))

Note that by default allowNamespaces is enabled for spec compliancy.

License

This plugin is issued under the MIT license.