Registry / serialization / esprima-fb

esprima-fb

JSON →
library15001.1001.0-dev-harmony-fbjsnpmunverified

A Facebook-specific fork of the Esprima JavaScript parser, version 15001.1001.0-dev-harmony-fb, that adds full support for JSX syntax extensions on top of ECMAScript 5.1 and experimental ES6/Harmony features. Unlike standard Esprima, this fork enables parsing JSX as used by React and JSXDOM. It maintains compatibility with Mozilla Parser AST format and includes syntax location tracking. Its versioning scheme maps to upstream Esprima harmony branches with Facebook modifications. No longer actively maintained; replaced by modern parsers like Babel.

npm install esprima-fb
INSTALL
IMPORT
SIG · ESPRIMA-FB
E
esprima-fb
serializationjavascriptv15001.1001.0-dev-harmony-fb
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parse
import { parse } from 'esprima-fb';
const esprima = require('esprima-fb'); esprima.parse(code);
ESM import is preferred; CommonJS require works but returns the module object.
tokenize
import { tokenize } from 'esprima-fb';
const tokenize = require('esprima-fb').tokenize;
tokenize is a named export; using .property on require is also valid but less idiomatic.
Syntax
import { Syntax } from 'esprima-fb';
import Syntax from 'esprima-fb';
Syntax is an object with node type constants; default import is incorrect.

Parses JSX code into an AST using esprima-fb with location tracking.

import { parse } from 'esprima-fb'; const code = `const element = <div className="foo">Hello</div>;`; const ast = parse(code, { jsx: true, loc: true }); console.log(JSON.stringify(ast, null, 2));
Debug
Known issues
deprecatedEsprima-FB is no longer maintained; use Babel parser or acorn-jsx instead.
fix
Migrate to @babel/parser or acorn with acorn-jsx plugin.
affects: *
breakingJSX parsing in esprima-fb requires explicitly setting { jsx: true } option; not default.
fix
Always pass { jsx: true } to parse() when parsing JSX code.
affects: *
breakingThe AST format may differ from official ESTree spec; incompatible with some tools.
fix
Use a modern parser that follows the latest ESTree specification.
affects: *
Errors
Common errors & fixes
SyntaxError: Unexpected token <
JSX parsing not enabled; missing { jsx: true } option.
fix
Add { jsx: true } as second argument to parse().
Cannot find module 'esprima-fb'
Package not installed or removed from npm.
fix
Install the package: npm install esprima-fb --save
Upgrade
Version history
15001.1001.0-dev-harmony-fblatest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
esprima-fb — npm install esprima-fb · libregistry