Allow to output either raw or transformed AST, fix several transformation bugs with...
[jst.git] / CHANGELOG.md
1 ## 8.7.0 (2021-12-27)
2
3 ### New features
4
5 Support quoted export names.
6
7 Upgrade to Unicode 14.
8
9 Add support for Unicode 13 properties in regular expressions.
10
11 ### Bug fixes
12
13 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.
14
15 ## 8.6.0 (2021-11-18)
16
17 ### Bug fixes
18
19 Fix a bug where an object literal with multiple `__proto__` properties would incorrectly be accepted if a later property value held an assigment.
20
21 ### New features
22
23 Support class private fields with the `in` operator.
24
25 ## 8.5.0 (2021-09-06)
26
27 ### Bug fixes
28
29 Improve context-dependent tokenization in a number of corner cases.
30
31 Fix location tracking after a 0x2028 or 0x2029 character in a string literal (which before did not increase the line number).
32
33 Fix an issue where arrow function bodies in for loop context would inappropriately consume `in` operators.
34
35 Fix wrong end locations stored on SequenceExpression nodes.
36
37 Implement restriction that `for`/`of` loop LHS can't start with `let`.
38
39 ### New features
40
41 Add support for ES2022 class static blocks.
42
43 Allow multiple input files to be passed to the CLI tool.
44
45 ## 8.4.1 (2021-06-24)
46
47 ### Bug fixes
48
49 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.
50
51 ## 8.4.0 (2021-06-11)
52
53 ### New features
54
55 A new option, `allowSuperOutsideMethod`, can be used to suppress the error when `super` is used in the wrong context.
56
57 ## 8.3.0 (2021-05-31)
58
59 ### New features
60
61 Default `allowAwaitOutsideFunction` to true for ECMAScript 2022 an higher.
62
63 Add support for the `d` ([indices](https://github.com/tc39/proposal-regexp-match-indices)) regexp flag.
64
65 ## 8.2.4 (2021-05-04)
66
67 ### Bug fixes
68
69 Fix spec conformity in corner case 'for await (async of ...)'.
70
71 ## 8.2.3 (2021-05-04)
72
73 ### Bug fixes
74
75 Fix an issue where the library couldn't parse 'for (async of ...)'.
76
77 Fix a bug in UTF-16 decoding that would read characters incorrectly in some circumstances.
78
79 ## 8.2.2 (2021-04-29)
80
81 ### Bug fixes
82
83 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.
84
85 ## 8.2.1 (2021-04-24)
86
87 ### Bug fixes
88
89 Fix a regression introduced in 8.2.0 where static or async class methods with keyword names fail to parse.
90
91 ## 8.2.0 (2021-04-24)
92
93 ### New features
94
95 Add support for ES2022 class fields and private methods.
96
97 ## 8.1.1 (2021-04-12)
98
99 ### Various
100
101 Stop shipping source maps in the NPM package.
102
103 ## 8.1.0 (2021-03-09)
104
105 ### Bug fixes
106
107 Fix a spurious error in nested destructuring arrays.
108
109 ### New features
110
111 Expose `allowAwaitOutsideFunction` in CLI interface.
112
113 Make `allowImportExportAnywhere` also apply to `import.meta`.
114
115 ## 8.0.5 (2021-01-25)
116
117 ### Bug fixes
118
119 Adjust package.json to work with Node 12.16.0 and 13.0-13.6.
120
121 ## 8.0.4 (2020-10-05)
122
123 ### Bug fixes
124
125 Make `await x ** y` an error, following the spec.
126
127 Fix potentially exponential regular expression.
128
129 ## 8.0.3 (2020-10-02)
130
131 ### Bug fixes
132
133 Fix a wasteful loop during `Parser` creation when setting `ecmaVersion` to `"latest"`.
134
135 ## 8.0.2 (2020-09-30)
136
137 ### Bug fixes
138
139 Make the TypeScript types reflect the current allowed values for `ecmaVersion`.
140
141 Fix another regexp/division tokenizer issue.
142
143 ## 8.0.1 (2020-08-12)
144
145 ### Bug fixes
146
147 Provide the correct value in the `version` export.
148
149 ## 8.0.0 (2020-08-12)
150
151 ### Bug fixes
152
153 Disallow expressions like `(a = b) = c`.
154
155 Make non-octal escape sequences a syntax error in strict mode.
156
157 ### New features
158
159 The package can now be loaded directly as an ECMAScript module in node 13+.
160
161 Update to the set of Unicode properties from ES2021.
162
163 ### Breaking changes
164
165 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.
166
167 Some changes to method signatures that may be used by plugins.
168
169 ## 7.4.0 (2020-08-03)
170
171 ### New features
172
173 Add support for logical assignment operators.
174
175 Add support for numeric separators.
176
177 ## 7.3.1 (2020-06-11)
178
179 ### Bug fixes
180
181 Make the string in the `version` export match the actual library version.
182
183 ## 7.3.0 (2020-06-11)
184
185 ### Bug fixes
186
187 Fix a bug that caused parsing of object patterns with a property named `set` that had a default value to fail.
188
189 ### New features
190
191 Add support for optional chaining (`?.`).
192
193 ## 7.2.0 (2020-05-09)
194
195 ### Bug fixes
196
197 Fix precedence issue in parsing of async arrow functions.
198
199 ### New features
200
201 Add support for nullish coalescing.
202
203 Add support for `import.meta`.
204
205 Support `export * as ...` syntax.
206
207 Upgrade to Unicode 13.
208
209 ## 6.4.1 (2020-03-09)
210
211 ### Bug fixes
212
213 More carefully check for valid UTF16 surrogate pairs in regexp validator.
214
215 ## 7.1.1 (2020-03-01)
216
217 ### Bug fixes
218
219 Treat `\8` and `\9` as invalid escapes in template strings.
220
221 Allow unicode escapes in property names that are keywords.
222
223 Don't error on an exponential operator expression as argument to `await`.
224
225 More carefully check for valid UTF16 surrogate pairs in regexp validator.
226
227 ## 7.1.0 (2019-09-24)
228
229 ### Bug fixes
230
231 Disallow trailing object literal commas when ecmaVersion is less than 5.
232
233 ### New features
234
235 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.
236
237 ## 7.0.0 (2019-08-13)
238
239 ### Breaking changes
240
241 Changes the node format for dynamic imports to use the `ImportExpression` node type, as defined in [ESTree](https://github.com/estree/estree/blob/master/es2020.md#importexpression).
242
243 Makes 10 (ES2019) the default value for the `ecmaVersion` option.
244
245 ## 6.3.0 (2019-08-12)
246
247 ### New features
248
249 `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.
250
251 ## 6.2.1 (2019-07-21)
252
253 ### Bug fixes
254
255 Fix bug causing Acorn to treat some characters as identifier characters that shouldn't be treated as such.
256
257 Fix issue where setting the `allowReserved` option to `"never"` allowed reserved words in some circumstances.
258
259 ## 6.2.0 (2019-07-04)
260
261 ### Bug fixes
262
263 Improve valid assignment checking in `for`/`in` and `for`/`of` loops.
264
265 Disallow binding `let` in patterns.
266
267 ### New features
268
269 Support bigint syntax with `ecmaVersion` >= 11.
270
271 Support dynamic `import` syntax with `ecmaVersion` >= 11.
272
273 Upgrade to Unicode version 12.
274
275 ## 6.1.1 (2019-02-27)
276
277 ### Bug fixes
278
279 Fix bug that caused parsing default exports of with names to fail.
280
281 ## 6.1.0 (2019-02-08)
282
283 ### Bug fixes
284
285 Fix scope checking when redefining a `var` as a lexical binding.
286
287 ### New features
288
289 Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
290
291 ## 6.0.7 (2019-02-04)
292
293 ### Bug fixes
294
295 Check that exported bindings are defined.
296
297 Don't treat `\u180e` as a whitespace character.
298
299 Check for duplicate parameter names in methods.
300
301 Don't allow shorthand properties when they are generators or async methods.
302
303 Forbid binding `await` in async arrow function's parameter list.
304
305 ## 6.0.6 (2019-01-30)
306
307 ### Bug fixes
308
309 The content of class declarations and expressions is now always parsed in strict mode.
310
311 Don't allow `let` or `const` to bind the variable name `let`.
312
313 Treat class declarations as lexical.
314
315 Don't allow a generator function declaration as the sole body of an `if` or `else`.
316
317 Ignore `"use strict"` when after an empty statement.
318
319 Allow string line continuations with special line terminator characters.
320
321 Treat `for` bodies as part of the `for` scope when checking for conflicting bindings.
322
323 Fix bug with parsing `yield` in a `for` loop initializer.
324
325 Implement special cases around scope checking for functions.
326
327 ## 6.0.5 (2019-01-02)
328
329 ### Bug fixes
330
331 Fix TypeScript type for `Parser.extend` and add `allowAwaitOutsideFunction` to options type.
332
333 Don't treat `let` as a keyword when the next token is `{` on the next line.
334
335 Fix bug that broke checking for parentheses around an object pattern in a destructuring assignment when `preserveParens` was on.
336
337 ## 6.0.4 (2018-11-05)
338
339 ### Bug fixes
340
341 Further improvements to tokenizing regular expressions in corner cases.
342
343 ## 6.0.3 (2018-11-04)
344
345 ### Bug fixes
346
347 Fix bug in tokenizing an expression-less return followed by a function followed by a regular expression.
348
349 Remove stray symlink in the package tarball.
350
351 ## 6.0.2 (2018-09-26)
352
353 ### Bug fixes
354
355 Fix bug where default expressions could fail to parse inside an object destructuring assignment expression.
356
357 ## 6.0.1 (2018-09-14)
358
359 ### Bug fixes
360
361 Fix wrong value in `version` export.
362
363 ## 6.0.0 (2018-09-14)
364
365 ### Bug fixes
366
367 Better handle variable-redefinition checks for catch bindings and functions directly under if statements.
368
369 Forbid `new.target` in top-level arrow functions.
370
371 Fix issue with parsing a regexp after `yield` in some contexts.
372
373 ### New features
374
375 The package now comes with TypeScript definitions.
376
377 ### Breaking changes
378
379 The default value of the `ecmaVersion` option is now 9 (2018).
380
381 Plugins work differently, and will have to be rewritten to work with this version.
382
383 The loose parser and walker have been moved into separate packages (`acorn-loose` and `acorn-walk`).
384
385 ## 5.7.3 (2018-09-10)
386
387 ### Bug fixes
388
389 Fix failure to tokenize regexps after expressions like `x.of`.
390
391 Better error message for unterminated template literals.
392
393 ## 5.7.2 (2018-08-24)
394
395 ### Bug fixes
396
397 Properly handle `allowAwaitOutsideFunction` in for statements.
398
399 Treat function declarations at the top level of modules like let bindings.
400
401 Don't allow async function declarations as the only statement under a label.
402
403 ## 5.7.0 (2018-06-15)
404
405 ### New features
406
407 Upgraded to Unicode 11.
408
409 ## 5.6.0 (2018-05-31)
410
411 ### New features
412
413 Allow U+2028 and U+2029 in string when ECMAVersion >= 10.
414
415 Allow binding-less catch statements when ECMAVersion >= 10.
416
417 Add `allowAwaitOutsideFunction` option for parsing top-level `await`.
418
419 ## 5.5.3 (2018-03-08)
420
421 ### Bug fixes
422
423 A _second_ republish of the code in 5.5.1, this time with yarn, to hopefully get valid timestamps.
424
425 ## 5.5.2 (2018-03-08)
426
427 ### Bug fixes
428
429 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.
430
431 ## 5.5.1 (2018-03-06)
432
433 ### Bug fixes
434
435 Fix misleading error message for octal escapes in template strings.
436
437 ## 5.5.0 (2018-02-27)
438
439 ### New features
440
441 The identifier character categorization is now based on Unicode version 10.
442
443 Acorn will now validate the content of regular expressions, including new ES9 features.
444
445 ## 5.4.0 (2018-02-01)
446
447 ### Bug fixes
448
449 Disallow duplicate or escaped flags on regular expressions.
450
451 Disallow octal escapes in strings in strict mode.
452
453 ### New features
454
455 Add support for async iteration.
456
457 Add support for object spread and rest.
458
459 ## 5.3.0 (2017-12-28)
460
461 ### Bug fixes
462
463 Fix parsing of floating point literals with leading zeroes in loose mode.
464
465 Allow duplicate property names in object patterns.
466
467 Don't allow static class methods named `prototype`.
468
469 Disallow async functions directly under `if` or `else`.
470
471 Parse right-hand-side of `for`/`of` as an assignment expression.
472
473 Stricter parsing of `for`/`in`.
474
475 Don't allow unicode escapes in contextual keywords.
476
477 ### New features
478
479 Parsing class members was factored into smaller methods to allow plugins to hook into it.
480
481 ## 5.2.1 (2017-10-30)
482
483 ### Bug fixes
484
485 Fix a token context corruption bug.
486
487 ## 5.2.0 (2017-10-30)
488
489 ### Bug fixes
490
491 Fix token context tracking for `class` and `function` in property-name position.
492
493 Make sure `%*` isn't parsed as a valid operator.
494
495 Allow shorthand properties `get` and `set` to be followed by default values.
496
497 Disallow `super` when not in callee or object position.
498
499 ### New features
500
501 Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements.
502
503 ## 5.1.2 (2017-09-04)
504
505 ### Bug fixes
506
507 Disable parsing of legacy HTML-style comments in modules.
508
509 Fix parsing of async methods whose names are keywords.
510
511 ## 5.1.1 (2017-07-06)
512
513 ### Bug fixes
514
515 Fix problem with disambiguating regexp and division after a class.
516
517 ## 5.1.0 (2017-07-05)
518
519 ### Bug fixes
520
521 Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`.
522
523 Parse zero-prefixed numbers with non-octal digits as decimal.
524
525 Allow object/array patterns in rest parameters.
526
527 Don't error when `yield` is used as a property name.
528
529 Allow `async` as a shorthand object property.
530
531 ### New features
532
533 Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9.
534
535 ## 5.0.3 (2017-04-01)
536
537 ### Bug fixes
538
539 Fix spurious duplicate variable definition errors for named functions.
540
541 ## 5.0.2 (2017-03-30)
542
543 ### Bug fixes
544
545 A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
546
547 ## 5.0.0 (2017-03-28)
548
549 ### Bug fixes
550
551 Raise an error for duplicated lexical bindings.
552
553 Fix spurious error when an assignement expression occurred after a spread expression.
554
555 Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions.
556
557 Allow labels in front or `var` declarations, even in strict mode.
558
559 ### Breaking changes
560
561 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`.
562
563 ## 4.0.11 (2017-02-07)
564
565 ### Bug fixes
566
567 Allow all forms of member expressions to be parenthesized as lvalue.
568
569 ## 4.0.10 (2017-02-07)
570
571 ### Bug fixes
572
573 Don't expect semicolons after default-exported functions or classes, even when they are expressions.
574
575 Check for use of `'use strict'` directives in non-simple parameter functions, even when already in strict mode.
576
577 ## 4.0.9 (2017-02-06)
578
579 ### Bug fixes
580
581 Fix incorrect error raised for parenthesized simple assignment targets, so that `(x) = 1` parses again.
582
583 ## 4.0.8 (2017-02-03)
584
585 ### Bug fixes
586
587 Solve spurious parenthesized pattern errors by temporarily erring on the side of accepting programs that our delayed errors don't handle correctly yet.
588
589 ## 4.0.7 (2017-02-02)
590
591 ### Bug fixes
592
593 Accept invalidly rejected code like `(x).y = 2` again.
594
595 Don't raise an error when a function _inside_ strict code has a non-simple parameter list.
596
597 ## 4.0.6 (2017-02-02)
598
599 ### Bug fixes
600
601 Fix exponential behavior (manifesting itself as a complete hang for even relatively small source files) introduced by the new 'use strict' check.
602
603 ## 4.0.5 (2017-02-02)
604
605 ### Bug fixes
606
607 Disallow parenthesized pattern expressions.
608
609 Allow keywords as export names.
610
611 Don't allow the `async` keyword to be parenthesized.
612
613 Properly raise an error when a keyword contains a character escape.
614
615 Allow `"use strict"` to appear after other string literal expressions.
616
617 Disallow labeled declarations.
618
619 ## 4.0.4 (2016-12-19)
620
621 ### Bug fixes
622
623 Fix crash when `export` was followed by a keyword that can't be
624 exported.
625
626 ## 4.0.3 (2016-08-16)
627
628 ### Bug fixes
629
630 Allow regular function declarations inside single-statement `if` branches in loose mode. Forbid them entirely in strict mode.
631
632 Properly parse properties named `async` in ES2017 mode.
633
634 Fix bug where reserved words were broken in ES2017 mode.
635
636 ## 4.0.2 (2016-08-11)
637
638 ### Bug fixes
639
640 Don't ignore period or 'e' characters after octal numbers.
641
642 Fix broken parsing for call expressions in default parameter values of arrow functions.
643
644 ## 4.0.1 (2016-08-08)
645
646 ### Bug fixes
647
648 Fix false positives in duplicated export name errors.
649
650 ## 4.0.0 (2016-08-07)
651
652 ### Breaking changes
653
654 The default `ecmaVersion` option value is now 7.
655
656 A number of internal method signatures changed, so plugins might need to be updated.
657
658 ### Bug fixes
659
660 The parser now raises errors on duplicated export names.
661
662 `arguments` and `eval` can now be used in shorthand properties.
663
664 Duplicate parameter names in non-simple argument lists now always produce an error.
665
666 ### New features
667
668 The `ecmaVersion` option now also accepts year-style version numbers
669 (2015, etc).
670
671 Support for `async`/`await` syntax when `ecmaVersion` is >= 8.
672
673 Support for trailing commas in call expressions when `ecmaVersion` is >= 8.
674
675 ## 3.3.0 (2016-07-25)
676
677 ### Bug fixes
678
679 Fix bug in tokenizing of regexp operator after a function declaration.
680
681 Fix parser crash when parsing an array pattern with a hole.
682
683 ### New features
684
685 Implement check against complex argument lists in functions that enable strict mode in ES7.
686
687 ## 3.2.0 (2016-06-07)
688
689 ### Bug fixes
690
691 Improve handling of lack of unicode regexp support in host
692 environment.
693
694 Properly reject shorthand properties whose name is a keyword.
695
696 ### New features
697
698 Visitors created with `visit.make` now have their base as _prototype_, rather than copying properties into a fresh object.
699
700 ## 3.1.0 (2016-04-18)
701
702 ### Bug fixes
703
704 Properly tokenize the division operator directly after a function expression.
705
706 Allow trailing comma in destructuring arrays.
707
708 ## 3.0.4 (2016-02-25)
709
710 ### Fixes
711
712 Allow update expressions as left-hand-side of the ES7 exponential operator.
713
714 ## 3.0.2 (2016-02-10)
715
716 ### Fixes
717
718 Fix bug that accidentally made `undefined` a reserved word when parsing ES7.
719
720 ## 3.0.0 (2016-02-10)
721
722 ### Breaking changes
723
724 The default value of the `ecmaVersion` option is now 6 (used to be 5).
725
726 Support for comprehension syntax (which was dropped from the draft spec) has been removed.
727
728 ### Fixes
729
730 `let` and `yield` are now “contextual keywords”, meaning you can mostly use them as identifiers in ES5 non-strict code.
731
732 A parenthesized class or function expression after `export default` is now parsed correctly.
733
734 ### New features
735
736 When `ecmaVersion` is set to 7, Acorn will parse the exponentiation operator (`**`).
737
738 The identifier character ranges are now based on Unicode 8.0.0.
739
740 Plugins can now override the `raiseRecoverable` method to override the way non-critical errors are handled.
741
742 ## 2.7.0 (2016-01-04)
743
744 ### Fixes
745
746 Stop allowing rest parameters in setters.
747
748 Disallow `y` rexexp flag in ES5.
749
750 Disallow `\00` and `\000` escapes in strict mode.
751
752 Raise an error when an import name is a reserved word.
753
754 ## 2.6.2 (2015-11-10)
755
756 ### Fixes
757
758 Don't crash when no options object is passed.
759
760 ## 2.6.0 (2015-11-09)
761
762 ### Fixes
763
764 Add `await` as a reserved word in module sources.
765
766 Disallow `yield` in a parameter default value for a generator.
767
768 Forbid using a comma after a rest pattern in an array destructuring.
769
770 ### New features
771
772 Support parsing stdin in command-line tool.
773
774 ## 2.5.0 (2015-10-27)
775
776 ### Fixes
777
778 Fix tokenizer support in the command-line tool.
779
780 Stop allowing `new.target` outside of functions.
781
782 Remove legacy `guard` and `guardedHandler` properties from try nodes.
783
784 Stop allowing multiple `__proto__` properties on an object literal in strict mode.
785
786 Don't allow rest parameters to be non-identifier patterns.
787
788 Check for duplicate paramter names in arrow functions.