Fix a regression that caused Acorn to no longer run on Node versions <8.10.
Support ES2025 duplicate capture group names in regular expressions.
Include VariableDeclarator
in the AnyNode
type so that walker objects can refer to it without getting a type error.
Properly raise a parse error for invalid for
/of
statements using async
as binding name.
Properly recognize "use strict" when preceded by a string with an escaped newline.
Mark the Parser
constructor as protected, not private, so plugins can extend it without type errors.
Fix a bug where some invalid delete
expressions were let through when the operand was parenthesized and preserveParens
was enabled.
Properly normalize line endings in raw strings of invalid template tokens.
Properly track line numbers for escaped newlines in strings.
Fix a bug that broke line number accounting after a template literal with invalid escape sequences.
Add Function
and Class
to the AggregateType
type, so that they can be used in walkers without raising a type error.
Make sure onToken
get an import
keyword token when parsing import.meta
.
Fix a bug where .loc.start
could be undefined for new.target
meta
nodes.
Fix a bug that caused regular expressions after colon tokens to not be properly tokenized in some circumstances.
Fix a regression where onToken
would receive 'name' tokens for 'new' keyword tokens.
Fix an issue where tokenizing (without parsing) an object literal with a property named class
or function
could, in some circumstance, put the tokenizer into an invalid state.
Fix an issue where a slash after a call to a propery named the same as some keywords would be tokenized as a regular expression.
Upgrade to Unicode 15.1.
Use a set of new, much more precise, TypeScript types.
Add a checkPrivateFields
option that disables strict checking of private property use.
Forbid dynamic import after new
, even when part of a member expression.
Add Unicode properties for ES2023.
Add support for the v
flag to regular expressions.
Fix a bug that caused allowHashBang
to be set to false when not provided, even with ecmaVersion >= 14
.
Fix an exception when passing no option object to parse
or new Parser
.
Fix incorrect parse error on if (0) let\n[astral identifier char]
.
Make type for Comment
compatible with estree types.
Allow parentheses around spread args in destructuring object assignment.
Fix an issue where the tree contained directive
properties in when parsing with a language version that doesn't support them.
Support hashbang comments by default in ECMAScript 2023 and later.
Stop handling "use strict"
directives in ECMAScript versions before 5.
Fix an issue where duplicate quoted export names in export *
syntax were incorrectly checked.
Add missing type for tokTypes
.
Support quoted export names.
Upgrade to Unicode 14.
Add support for Unicode 13 properties in regular expressions.
Use a loop to find line breaks, because the existing regexp search would overrun the end of the searched range and waste a lot of time in minified code.
Fix a bug where an object literal with multiple __proto__
properties would incorrectly be accepted if a later property value held an assigment.
Support class private fields with the in
operator.
Improve context-dependent tokenization in a number of corner cases.
Fix location tracking after a 0x2028 or 0x2029 character in a string literal (which before did not increase the line number).
Fix an issue where arrow function bodies in for loop context would inappropriately consume in
operators.
Fix wrong end locations stored on SequenceExpression nodes.
Implement restriction that for
/of
loop LHS can't start with let
.
Add support for ES2022 class static blocks.
Allow multiple input files to be passed to the CLI tool.
Fix a bug where allowAwaitOutsideFunction
would allow await
in class field initializers, and setting ecmaVersion
to 13 or higher would allow top-level await in non-module sources.
A new option, allowSuperOutsideMethod
, can be used to suppress the error when super
is used in the wrong context.
Default allowAwaitOutsideFunction
to true for ECMAScript 2022 an higher.
Add support for the d
(indices) regexp flag.
Fix spec conformity in corner case 'for await (async of ...)'.
Fix an issue where the library couldn't parse 'for (async of ...)'.
Fix a bug in UTF-16 decoding that would read characters incorrectly in some circumstances.
Fix a bug where a class field initialized to an async arrow function wouldn't allow await inside it. Same issue existed for generator arrow functions with yield.
Fix a regression introduced in 8.2.0 where static or async class methods with keyword names fail to parse.
Add support for ES2022 class fields and private methods.
Stop shipping source maps in the NPM package.
Fix a spurious error in nested destructuring arrays.
Expose allowAwaitOutsideFunction
in CLI interface.
Make allowImportExportAnywhere
also apply to import.meta
.
Adjust package.json to work with Node 12.16.0 and 13.0-13.6.
Make await x ** y
an error, following the spec.
Fix potentially exponential regular expression.
Fix a wasteful loop during Parser
creation when setting ecmaVersion
to "latest"
.
Make the TypeScript types reflect the current allowed values for ecmaVersion
.
Fix another regexp/division tokenizer issue.
Provide the correct value in the version
export.
Disallow expressions like (a = b) = c
.
Make non-octal escape sequences a syntax error in strict mode.
The package can now be loaded directly as an ECMAScript module in node 13+.
Update to the set of Unicode properties from ES2021.
The ecmaVersion
option is now required. For the moment, omitting it will still work with a warning, but that will change in a future release.
Some changes to method signatures that may be used by plugins.
Add support for logical assignment operators.
Add support for numeric separators.
Make the string in the version
export match the actual library version.
Fix a bug that caused parsing of object patterns with a property named set
that had a default value to fail.
Add support for optional chaining (?.
).
Fix precedence issue in parsing of async arrow functions.
Add support for nullish coalescing.
Add support for import.meta
.
Support export * as ...
syntax.
Upgrade to Unicode 13.
More carefully check for valid UTF16 surrogate pairs in regexp validator.
Treat \8
and \9
as invalid escapes in template strings.
Allow unicode escapes in property names that are keywords.
Don't error on an exponential operator expression as argument to await
.
More carefully check for valid UTF16 surrogate pairs in regexp validator.
Disallow trailing object literal commas when ecmaVersion is less than 5.
Add a static acorn
property to the Parser
class that contains the entire module interface, to allow plugins to access the instance of the library that they are acting on.
Changes the node format for dynamic imports to use the ImportExpression
node type, as defined in ESTree.
Makes 10 (ES2019) the default value for the ecmaVersion
option.
sourceType: "module"
can now be used even when ecmaVersion
is less than 6, to parse module-style code that otherwise conforms to an older standard.
Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such.
Fix issue where setting the allowReserved
option to "never"
allowed reserved words in some circumstances.
Improve valid assignment checking in for
/in
and for
/of
loops.
Disallow binding let
in patterns.
Support bigint syntax with ecmaVersion
>= 11.
Support dynamic import
syntax with ecmaVersion
>= 11.
Upgrade to Unicode version 12.
Fix bug that caused parsing default exports of with names to fail.
Fix scope checking when redefining a var
as a lexical binding.
Split up parseSubscripts
to use an internal parseSubscript
method to make it easier to extend with plugins.
Check that exported bindings are defined.
Don't treat \u180e
as a whitespace character.
Check for duplicate parameter names in methods.
Don't allow shorthand properties when they are generators or async methods.
Forbid binding await
in async arrow function's parameter list.
The content of class declarations and expressions is now always parsed in strict mode.
Don't allow let
or const
to bind the variable name let
.
Treat class declarations as lexical.
Don't allow a generator function declaration as the sole body of an if
or else
.
Ignore "use strict"
when after an empty statement.
Allow string line continuations with special line terminator characters.
Treat for
bodies as part of the for
scope when checking for conflicting bindings.
Fix bug with parsing yield
in a for
loop initializer.
Implement special cases around scope checking for functions.
Fix TypeScript type for Parser.extend
and add allowAwaitOutsideFunction
to options type.
Don't treat let
as a keyword when the next token is {
on the next line.
Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when preserveParens
was on.
Further improvements to tokenizing regular expressions in corner cases.
Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
Remove stray symlink in the package tarball.
Fix bug where default expressions could fail to parse inside an object destructuring assignment expression.
Fix wrong value in version
export.
Better handle variable-redefinition checks for catch bindings and functions directly under if statements.
Forbid new.target
in top-level arrow functions.
Fix issue with parsing a regexp after yield
in some contexts.
The package now comes with TypeScript definitions.
The default value of the ecmaVersion
option is now 9 (2018).
Plugins work differently, and will have to be rewritten to work with this version.
The loose parser and walker have been moved into separate packages (acorn-loose
and acorn-walk
).
Fix failure to tokenize regexps after expressions like x.of
.
Better error message for unterminated template literals.
Properly handle allowAwaitOutsideFunction
in for statements.
Treat function declarations at the top level of modules like let bindings.
Don't allow async function declarations as the only statement under a label.
Upgraded to Unicode 11.
Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
Allow binding-less catch statements when ECMAVersion >= 10.
Add allowAwaitOutsideFunction
option for parsing top-level await
.
A second republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
A republish of the code in 5.5.1 in an attempt to solve an issue with the file timestamps in the npm package being 0.
Fix misleading error message for octal escapes in template strings.
The identifier character categorization is now based on Unicode version 10.
Acorn will now validate the content of regular expressions, including new ES9 features.
Disallow duplicate or escaped flags on regular expressions.
Disallow octal escapes in strings in strict mode.
Add support for async iteration.
Add support for object spread and rest.
Fix parsing of floating point literals with leading zeroes in loose mode.
Allow duplicate property names in object patterns.
Don't allow static class methods named prototype
.
Disallow async functions directly under if
or else
.
Parse right-hand-side of for
/of
as an assignment expression.
Stricter parsing of for
/in
.
Don't allow unicode escapes in contextual keywords.
Parsing class members was factored into smaller methods to allow plugins to hook into it.
Fix a token context corruption bug.
Fix token context tracking for class
and function
in property-name position.
Make sure %*
isn't parsed as a valid operator.
Allow shorthand properties get
and set
to be followed by default values.
Disallow super
when not in callee or object position.
Support directive
property on directive expression statements.
Disable parsing of legacy HTML-style comments in modules.
Fix parsing of async methods whose names are keywords.
Fix problem with disambiguating regexp and division after a class.
Fix tokenizing of regexps in an object-desctructuring for
/of
loop and after yield
.
Parse zero-prefixed numbers with non-octal digits as decimal.
Allow object/array patterns in rest parameters.
Don't error when yield
is used as a property name.
Allow async
as a shorthand object property.
Implement the template literal revision proposal for ES9.
Fix spurious duplicate variable definition errors for named functions.
A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
Raise an error for duplicated lexical bindings.
Fix spurious error when an assignement expression occurred after a spread expression.
Accept regular expressions after of
(in for
/of
), yield
(in a generator), and braced arrow functions.
Allow labels in front or var
declarations, even in strict mode.
Parse declarations following export default
as declaration nodes, not expressions. This means that class and function declarations nodes can now have null
as their id
.
Allow all forms of member expressions to be parenthesized as lvalue.
Don't expect semicolons after default-exported functions or classes, even when they are expressions.
Check for use of 'use strict'
directives in non-simple parameter functions, even when already in strict mode.
Fix incorrect error raised for parenthesized simple assignment targets, so that (x) = 1
parses again.
Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet.
Accept invalidly rejected code like (x).y = 2
again.
Don't raise an error when a function inside strict code has a non-simple parameter list.
Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check.
Disallow parenthesized pattern expressions.
Allow keywords as export names.
Don't allow the async
keyword to be parenthesized.
Properly raise an error when a keyword contains a character escape.
Allow "use strict"
to appear after other string literal expressions.
Disallow labeled declarations.
Fix crash when export
was followed by a keyword that can't be
exported.
Allow regular function declarations inside single-statement if
branches in loose mode. Forbid them entirely in strict mode.
Properly parse properties named async
in ES2017 mode.
Fix bug where reserved words were broken in ES2017 mode.
Don't ignore period or 'e' characters after octal numbers.
Fix broken parsing for call expressions in default parameter values of arrow functions.
Fix false positives in duplicated export name errors.
The default ecmaVersion
option value is now 7.
A number of internal method signatures changed, so plugins might need to be updated.
The parser now raises errors on duplicated export names.
arguments
and eval
can now be used in shorthand properties.
Duplicate parameter names in non-simple argument lists now always produce an error.
The ecmaVersion
option now also accepts year-style version numbers
(2015, etc).
Support for async
/await
syntax when ecmaVersion
is >= 8.
Support for trailing commas in call expressions when ecmaVersion
is >= 8.
Fix bug in tokenizing of regexp operator after a function declaration.
Fix parser crash when parsing an array pattern with a hole.
Implement check against complex argument lists in functions that enable strict mode in ES7.
Improve handling of lack of unicode regexp support in host environment.
Properly reject shorthand properties whose name is a keyword.
Visitors created with visit.make
now have their base as prototype, rather than copying properties into a fresh object.
Properly tokenize the division operator directly after a function expression.
Allow trailing comma in destructuring arrays.
Allow update expressions as left-hand-side of the ES7 exponential operator.
Fix bug that accidentally made undefined
a reserved word when parsing ES7.
The default value of the ecmaVersion
option is now 6 (used to be 5).
Support for comprehension syntax (which was dropped from the draft spec) has been removed.
let
and yield
are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code.
A parenthesized class or function expression after export default
is now parsed correctly.
When ecmaVersion
is set to 7, Acorn will parse the exponentiation operator (**
).
The identifier character ranges are now based on Unicode 8.0.0.
Plugins can now override the raiseRecoverable
method to override the way non-critical errors are handled.
Stop allowing rest parameters in setters.
Disallow y
rexexp flag in ES5.
Disallow \00
and \000
escapes in strict mode.
Raise an error when an import name is a reserved word.
Don't crash when no options object is passed.
Add await
as a reserved word in module sources.
Disallow yield
in a parameter default value for a generator.
Forbid using a comma after a rest pattern in an array destructuring.
Support parsing stdin in command-line tool.
Fix tokenizer support in the command-line tool.
Stop allowing new.target
outside of functions.
Remove legacy guard
and guardedHandler
properties from try nodes.
Stop allowing multiple __proto__
properties on an object literal in strict mode.
Don't allow rest parameters to be non-identifier patterns.
Check for duplicate paramter names in arrow functions.