terser 5.2.0 → 5.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## v5.2.1
4
+
5
+ - The parse step now doesn't accept an `ecma` option, so that all ES code is accepted.
6
+ - Optional dotted chains now accept keywords, just like dotted expressions (`foo?.default`)
7
+
3
8
  ## v5.2.0
4
9
 
5
10
  - Optional chaining syntax is now supported.
package/README.md CHANGED
@@ -522,7 +522,7 @@ try {
522
522
 
523
523
  ## Minify options
524
524
 
525
- - `ecma` (default `undefined`) - pass `5`, `2015`, `2016`, etc to override `parse`,
525
+ - `ecma` (default `undefined`) - pass `5`, `2015`, `2016`, etc to override
526
526
  `compress` and `format`'s `ecma` options.
527
527
 
528
528
  - `parse` (default `{}`) — pass an object if you wish to specify some
@@ -660,10 +660,6 @@ If you happen to need the source map as a raw object, set `sourceMap.asObject` t
660
660
 
661
661
  - `bare_returns` (default `false`) -- support top level `return` statements
662
662
 
663
- - `ecma` (default: `2017`) -- specify one of `5`, `2015`, `2016` or `2017`. Note: this setting
664
- is not presently enforced except for ES8 optional trailing commas in function
665
- parameter lists and calls with `ecma` `2017`.
666
-
667
663
  - `html5_comments` (default `true`)
668
664
 
669
665
  - `shebang` (default `true`) -- support `#!command` as the first line
@@ -634,7 +634,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
634
634
  (type == "keyword" && KEYWORDS_BEFORE_EXPRESSION.has(value)) ||
635
635
  (type == "punc" && PUNC_BEFORE_EXPRESSION.has(value))) ||
636
636
  (type == "arrow");
637
- if (type == "punc" && value == ".") {
637
+ if (type == "punc" && (value == "." || value == "?.")) {
638
638
  prev_was_dot = true;
639
639
  } else if (!is_comment) {
640
640
  prev_was_dot = false;
@@ -1196,7 +1196,7 @@ function parse($TEXT, options) {
1196
1196
 
1197
1197
  options = defaults(options, {
1198
1198
  bare_returns : false,
1199
- ecma : 2017,
1199
+ ecma : null, // Legacy
1200
1200
  expression : false,
1201
1201
  filename : null,
1202
1202
  html5_comments : true,
@@ -1776,7 +1776,6 @@ function parse($TEXT, options) {
1776
1776
 
1777
1777
  if (!is("punc", ")")) {
1778
1778
  expect(",");
1779
- if (is("punc", ")") && options.ecma < 2017) unexpected();
1780
1779
  }
1781
1780
 
1782
1781
  if (param instanceof AST_Expansion) {
@@ -2021,7 +2020,6 @@ function parse($TEXT, options) {
2021
2020
  if (!is("punc", ")")) {
2022
2021
  expect(",");
2023
2022
  if (is("punc", ")")) {
2024
- if (options.ecma < 2017) unexpected();
2025
2023
  trailing_comma = prev();
2026
2024
  if (maybe_sequence) invalid_sequence = trailing_comma;
2027
2025
  }
@@ -2290,7 +2288,7 @@ function parse($TEXT, options) {
2290
2288
  var newexp = expr_atom(false), args;
2291
2289
  if (is("punc", "(")) {
2292
2290
  next();
2293
- args = expr_list(")", options.ecma >= 2017);
2291
+ args = expr_list(")", true);
2294
2292
  } else {
2295
2293
  args = [];
2296
2294
  }
@@ -3209,7 +3207,6 @@ function parse($TEXT, options) {
3209
3207
  }
3210
3208
  if (!is("punc", ")")) {
3211
3209
  expect(",");
3212
- if (is("punc", ")") && options.ecma < 2017) unexpected();
3213
3210
  }
3214
3211
  }
3215
3212
  next();