terser 5.41.0 → 5.42.0

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/lib/parse.js CHANGED
@@ -183,7 +183,6 @@ ALL_RESERVED_WORDS = makePredicate(ALL_RESERVED_WORDS);
183
183
 
184
184
  var OPERATOR_CHARS = makePredicate(characters("+-*&%=<>!?|~^"));
185
185
 
186
- var RE_NUM_LITERAL = /[0-9a-f]/i;
187
186
  var RE_HEX_NUMBER = /^0x[0-9a-f]+$/i;
188
187
  var RE_OCT_NUMBER = /^0[0-7]+$/;
189
188
  var RE_ES6_OCT_NUMBER = /^0o[0-7]+$/i;
@@ -548,15 +547,16 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
548
547
  return after_e;
549
548
  case (after_e = false, 46): // .
550
549
  return (!has_dot && !has_x && !has_e) ? (has_dot = true) : false;
551
- }
552
-
553
- if (ch === "n") {
550
+ case 110: // n
554
551
  is_big_int = true;
555
-
556
552
  return true;
557
553
  }
558
554
 
559
- return RE_NUM_LITERAL.test(ch);
555
+ return (
556
+ code >= 48 && code <= 57 // 0-9
557
+ || code >= 97 && code <= 102 // a-f
558
+ || code >= 65 && code <= 70 // A-F
559
+ );
560
560
  });
561
561
  if (prefix) num = prefix + num;
562
562
 
@@ -573,7 +573,7 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
573
573
  }
574
574
  num = num.replace(/_/g, "");
575
575
  }
576
- if (num.endsWith("n")) {
576
+ if (is_big_int) {
577
577
  const without_n = num.slice(0, -1);
578
578
  const allow_e = RE_HEX_NUMBER.test(without_n);
579
579
  const valid = parse_js_number(without_n, allow_e);
@@ -748,7 +748,24 @@ function tokenizer($TEXT, filename, html5_comments, shebang) {
748
748
  return next_token;
749
749
  });
750
750
 
751
- var read_name = with_eof_error("Unterminated identifier name", function() {
751
+ var read_name = function () {
752
+ let start = S.pos, end = start - 1, ch = "c";
753
+
754
+ while (
755
+ (ch = S.text.charAt(++end))
756
+ && (ch >= "a" && ch <= "z" || ch >= "A" && ch <= "Z")
757
+ );
758
+
759
+ if (end > start + 1 && ch && ch !== "\\" && !is_identifier_char(ch)) {
760
+ S.pos += end - start;
761
+ S.col += end - start;
762
+ return S.text.slice(start, S.pos);
763
+ }
764
+
765
+ return read_name_hard();
766
+ };
767
+
768
+ var read_name_hard = with_eof_error("Unterminated identifier name", function() {
752
769
  var name = [], ch, escaped = false;
753
770
  var read_escaped_identifier_char = function() {
754
771
  escaped = true;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "homepage": "https://terser.org",
5
5
  "author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
6
6
  "license": "BSD-2-Clause",
7
- "version": "5.41.0",
7
+ "version": "5.42.0",
8
8
  "engines": {
9
9
  "node": ">=10"
10
10
  },