NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #4263 most downloaded on npm
A JavaScript parser
Last release 8 years ago
no release in 18 months
Ships fairly regularly
a new release about every 2 weeks
Some releases are documented
notes for 30 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
132 releases · first in 2015
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Summary: perf fix, flow bugfix, add support for https://github.com/facebook/jsx/issues/84, https://github.com/facebook/jsx/pull/93
Summary: perf fix, flow bugfix, add support for https://github.com/facebook/jsx/issues/84, https://github.com/facebook/jsx/pull/93
JSXFragment: <></>interface JSXFragment <: Expression {
type: "JSXFragment";
openingFragment: JSXOpeningFragment;
children: [ JSXText | JSXExpressionContainer | JSXSpreadChild | JSXElement | JSXFragment ];
closingFragment: JSXClosingFragment;
}
interface JSXOpeningFragment <: Node {
type: "JSXOpeningFragment";
}
interface JSXClosingFragment <: Node {
type: "JSXClosingFragment";
}
Add tests for ?? with other LogicalExpressions (Lucas Azzola)
Implement nullish coalescing operator in parser (#761) (Lucas Azzola)
add pipelineOperator plugin + 2 fixes for numeric separators
v7.0.0-beta.27
pipelineOperator plugin + 2 fixes for numeric separatorsFix flow errors (#735) (Nicolò Ribaudo)
add throwExpressions
Made sure the the AST Nodes in Flow/TS are separated (all TS specific nodes have a TS appended before like TSTypeAnnotation instead of just TypeAnnota
TS appended before like TSTypeAnnotation instead of just TypeAnnotation so that tools can differentiate if they need to.Update babel-eslint to the latest version 🚀 (#719) [skip ci] (greenkeeper[bot])
Main feature is support for private methods
Main feature is support for private methods
get_harcoded_tests function, use get_tests (Nicolò Ribaudo)```diff interface PrivateName <: Expression, Pattern { type: "PrivateName";
let child: Element<any> = <img src={url} key="img" />;
AST change
interface PrivateName <: Expression, Pattern {
type: "PrivateName";
- name: Identifier;
+ id: Identifier;
}
Apply location data fix to decorators plugin (#699) (James Henry)
v7.0.0-beta.21
Fix some issues with the typescript plugin
Fix some issues with the typescript plugin
Fix #656 (#659) NullLiteralTypeAnnotation (Naveen jain)
- #649 just updates the babel version that babylon is compiled with (perf)?
`js declare opaque type ID = number; opaque type opaque = number; opaque type not_transparent = opaque; `
declare opaque type ID = number;
opaque type opaque = number;
opaque type not_transparent = opaque;
New optionalCatchBinding plugin
try {
throw 0;
} catch {
do();
}
class A {
static #a = 1;
}
add ability to not add tokens array for performance
typescriptbigInttokens array for performanceAdd support for parsing Decorators Stage 2 (decorators2)
decorators2)Fix comment attachment for call expressions (#575) (aardito2)
Fix parsing issues with classPrivateProperties
optionalChainingclassPrivatePropertiesAdded importMeta plugin, fixes for numericSeparator
importMeta plugin, fixes for numericSeparator## v7.0.0-beta.11 (2017-05-27) Added numericSeparator #### :rocket: New Feature * Other * #541 NumberLiteralSeparator: Stage 1 feature plugin. Closes
Added numericSeparator
## v7.0.0-beta.10 (2017-05-22) #### :bug: Bug Fix * Other * #478 Fixed disappearing comments following a trailing comma. (@aardito2) #### Committers:
## v7.0.0-beta.9 (2017-05-22) #### :rocket: New Feature * #224 Add support for declare export + fixes. (@danez) #### :bug: Bug Fix * #433 Fix number p
flowParseObjectTypeMethodish.. (@xiemaisi)Add support for flow type spread (#418) (Conrad Buck)
Remove babylon plugin for template revision since it's stage-4 (#426) (Henry Zhu)
Add support for invalid escapes in tagged templates (#274) (Kevin Gibbons)
Throw error if new.target is used outside of a function (#402) (Brian Ng)
ranges option [skip ci] (Henry Zhu)Don't consume async when checking for async func decl (#377) (Brian Ng)
ranges option [skip ci](Henry Zhu)[7.0] Change RestProperty/SpreadProperty to RestElement/SpreadElement
estree: correctly change literals in all cases (#368) (Daniel Tschinder)
Fix negative number literal typeannotations (#366) (Daniel Tschinder)
Reintroduce Variance node (#333) (Daniel Tschinder)
String.fromCodePoint shim (#279) (Mathias Bynens)Flow opaque type alias backport (#644) (@jbrown215)
Fix comment attachment for call expressions (#575) (aardito2)
Fix location info on FunctionTypeParam nodes (#565) (#571) (Michal Srb)
Fixed disappearing comments following a trailing comma on the last property of an object literal or the last argument of a call expression (#478) (aar
flowParseObjectTypeMethodish. (#526) (Max Schaefer)Fix typo in flow spread operator error (Brian Ng)
Cherry-pick #418 to 6.x (#476) (Sebastian McKenzie)
Revert "Fix export default async function to be FunctionDeclaration"
Need to modify Babel for this AST node change, so moving to 7.0.
react-native broke with this so we reverted.
> _ESTree_ compatibility as plugin (#277) (Daniel Tschinder)
_ESTree_ compatibility as plugin (#277) (Daniel Tschinder)
We finally introduce a new compatibility layer for ESTree. To put babylon into ESTree-compatible mode the new plugin estree can be enabled. In this mode the parser will output an AST that is compliant to the specs of ESTree
We highly recommend everyone who uses babylon outside of babel to use this plugin. This will make it much easier for users to switch between different ESTree-compatible parsers. We so far tested several projects with different parsers and exchanged their parser to babylon and in nearly all cases it worked out of the box. Some other estree-compatible parsers include acorn, esprima, espree, flow-parser, etc.
To enable estree mode simply add the plugin in the config:
{
"plugins": [ "estree" ]
}
If you want to migrate your project from non-ESTree mode to ESTree, have a look at our Readme, where all deviations are mentioned.
Add a parseExpression public method (#213) (jeromew)
Babylon exports a new function to parse a single expression
import { parseExpression } from 'babylon';
const ast = parseExpression('x || y && z', options);
The returned AST will only consist of the expression. The options are the same as for parse()
Add startLine option (#346) (Raphael Mu)
A new option was added to babylon allowing to change the intial linenumber for the first line which is usually 1.
Changing this for example to 100 will make line 1 of the input source to be marked as line 100, line 2 as 101, line 3 as 102, ...
Function predicate declaration (#103) (Panagiotis Vekris)
Added support for function predicates which flow introduced in version 0.33.0
declare function is_number(x: mixed): boolean %checks(typeof x === "number");
Allow imports in declare module (#315) (Daniel Tschinder)
Added support for imports within module declarations which flow introduced in version 0.37.0
declare module "C" {
import type { DT } from "D";
declare export type CT = { D: DT };
}
Forbid semicolons after decorators in classes (#352) (Kevin Gibbons)
This example now correctly throws an error when there is a semicolon after the decorator:
class A {
@a;
foo(){}
}
Keywords are not allowed as local specifier (#307) (Daniel Tschinder)
Using keywords in imports is not allowed anymore:
import { default } from "foo";
import { a as debugger } from "foo";
Do not allow overwriting of primitive types (#314) (Daniel Tschinder)
In flow it is now forbidden to overwrite the primitive types "any", "mixed", "empty", "bool", "boolean", "number", "string", "void" and "null" with your own type declaration.
Disallow import type { type a } from … (#305) (Daniel Tschinder)
The following code now correctly throws an error
import type { type a } from "foo";
Don't parse class properties without initializers when classProperties is disabled and Flow is enabled (#300) (Andrew Levine)
Ensure that you enable the classProperties plugin in order to enable correct parsing of class properties. Prior to this version it was possible to parse them by enabling the flow plugin but this was not intended the behavior.
If you enable the flow plugin you can only define the type of the class properties, but not initialize them.
Fix export default async function to be FunctionDeclaration (#324) (Daniel Tschinder)
Parsing the following code now returns a FunctionDeclaration AST node instead of FunctionExpression.
export default async function bar() {};
Improve error message on attempt to destructure named import (#288) (Brian Ng)
Fix negative number literal typeannotations (#366) (Daniel Tschinder)
Ensure takeDecorators is called on exported class (#358) (Brian Ng)
ESTree: correctly change literals in all cases (#368) (Daniel Tschinder)
Correctly convert RestProperty to Assignable (#339) (Daniel Tschinder)
Fix #321 by allowing question marks in type params (#338) (Daniel Tschinder)
Fix #336 by correctly setting arrow-param (#337) (Daniel Tschinder)
Fix parse error when destructuring set with default value (#317) (Brian Ng)
Fix ObjectTypeCallProperty static (#298) (Dan Harper)
Fix generator-method-with-computed-name spec (#360) (Alex Rattray)
Fix flow type-parameter-declaration test with unintended semantic (#361) (Alex Rattray)
Cleanup and splitup parser functions (#295) (Daniel Tschinder)
chore(package): update flow-bin to version 0.38.0 (#313) (greenkeeper[bot])
Call inner function instead of 1:1 copy to plugin (#294) (Daniel Tschinder)
Update eslint-config-babel to the latest version 🚀 (#299) (greenkeeper[bot])
Update eslint-config-babel to the latest version 🚀 (#293) (greenkeeper[bot])
devDeps: remove eslint-plugin-babel (#292) (Kai Cataldo)
Correct indent eslint rule config (#276) (Daniel Tschinder)
Fail tests that have expected.json and throws-option (#285) (Daniel Tschinder)
Update contributing with more test info skip ci (Brian Ng)
Update API documentation (#330) (Timothy Gu)
Added keywords to package.json (#323) (Dmytro)
AST spec: fix casing of RegExpLiteral (#318) (Mathias Bynens)
Add support for Flow shorthand import type (#267) (Jeff Morrison)
Add support for Flow shorthand import type (#267) (Jeff Morrison)
This change implements flows new shorthand import syntax and where previously you had to write this code:
import {someValue} from "blah";
import type {someType} from "blah";
import typeof {someOtherValue} from "blah";
you can now write it like this:
import {
someValue,
type someType,
typeof someOtherValue,
} from "blah";
For more information look at this pull request.
flow: allow leading pipes in all positions (#256) (Vladimir Kurchatkin)
This change now allows a leading pipe everywhere types can be used:
var f = (x): | 1 | 2 => 1;
Throw error when exporting non-declaration (#241) (Kai Cataldo)
Previously babylon parsed the following exports, although they are not valid:
export typeof foo;
export new Foo();
export function() {};
export for (;;);
export while(foo);
Don't set inType flag when parsing property names (#266) (Vladimir Kurchatkin)
This fixes parsing of this case:
const map = {
[age <= 17] : 'Too young'
};
Fix source location for JSXEmptyExpression nodes (fixes #248) (#249) (James Long)
The following case produced an invalid AST
<div>{/* foo */}</div>
Use fromCodePoint to convert high value unicode entities (#243) (Ryan Duffy)
When high value unicode entities (e.g. 💩) were used in the input source code they are now correctly encoded in the resulting AST.
Rename folder to avoid Windows-illegal characters (#281) (Ryan Plant)
Allow this.state.clone() when parsing decorators (#262) (Alex Rattray)
User external-helpers (#254) (Daniel Tschinder)
Add watch script for dev (#234) (Kai Cataldo)
Freeze current plugins list for "*" option, and remove from README.md (#245) (Andrew Levine)
Prepare tests for multiple fixture runners. (#240) (Daniel Tschinder)
Add some test coverage for decorators stage-0 plugin (#250) (Andrew Levine)
Refactor tokenizer types file (#263) (Sven SAULEAU)
Update eslint-config-babel to the latest version 🚀 (#273) (greenkeeper[bot])
chore(package): update rollup to version 0.41.0 (#272) (greenkeeper[bot])
chore(package): update flow-bin to version 0.37.0 (#255) (greenkeeper[bot])
Allow "plugins": ["*"] (#229) (Daniel Tschinder)
Allow "plugins": ["*"] (#229) (Daniel Tschinder)
{
"plugins": ["*"] // jsx, flow, functionBind, etc
}
Will include all parser plugins instead of specifying each one individually. Useful for tools like babel-eslint, jscodeshift, and ast-explorer.
Throw error for reserved words enum and await (#195) (Kai Cataldo)
Throw error for reserved words enum and await (#195) (Kai Cataldo)
11.6.2.2 Future Reserved Words
Babylon will throw for more reserved words such as enum or await (in strict mode).
class enum {} // throws
class await {} // throws in strict mode (module)
Optional names for function types and object type indexers (#197) (Gabe Levi)
So where you used to have to write
type A = (x: string, y: boolean) => number;
type B = (z: string) => number;
type C = { [key: string]: number };
you can now write (with flow 0.34.0)
type A = (string, boolean) => number;
type B = string => number;
type C = { [string]: number };
Parse flow nested array type annotations like number[][] (#219) (Bernhard Häussner)
Supports these form now of specifying array types:
var a: number[][][][];
var b: string[][];
Correctly eat semicolon at the end of DelcareModuleExports (#223) (Daniel Tschinder)
declare module "foo" { declare module.exports: number }
declare module "foo" { declare module.exports: number; } // also allowed now
Use rollup for bundling to speed up startup time (#190) (@drewml)
const babylon = require('babylon');
const ast = babylon.parse('var foo = "lol";');
With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph.
Without bundling
With bundling
const babylon = require('babylon');
const ast = babylon.parse('var foo = "lol";');
With that test case, there was a ~95ms savings by removing the need for node to build/traverse the dependency graph.
Without bundling
With bundling
Your coding agent can read these notes before it upgrades. Set up the MCP server →