meriyah 4.1.5-dev.20210526 → 4.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,3 +1,31 @@
1
+ ## [4.2.1](https://github.com/meriyah/meriyah/compare/v4.2.0...v4.2.1) (2022-03-31)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **lexer:** fix wrong error when using regex flag s together with m or y ([d757c6b](https://github.com/meriyah/meriyah/commit/d757c6b20ae4f6f4e55a77179726db36cf2bd50b)), closes [#202](https://github.com/meriyah/meriyah/issues/202)
7
+ * **parser:** allow regular expression in JSXExpressionContainer ([a5fcb80](https://github.com/meriyah/meriyah/commit/a5fcb8072084f2961e11e9db24f7b8ac0ecd04a6)), closes [#204](https://github.com/meriyah/meriyah/issues/204)
8
+ * **parser:** allow top level await in expressions ([37c6361](https://github.com/meriyah/meriyah/commit/37c63613771e5bc6e23b7da2d92e992c60dafc5a)), closes [#212](https://github.com/meriyah/meriyah/issues/212)
9
+ * **parser:** fix wrong starting loc for any non-trival expression in return statement ([7063af5](https://github.com/meriyah/meriyah/commit/7063af55b2c5d6d370fdf6480b87b70387c707fe)), closes [#207](https://github.com/meriyah/meriyah/issues/207)
10
+ * **parser:** super call should be allowed in private method ([6de707a](https://github.com/meriyah/meriyah/commit/6de707a0efb3053767deaa36b1ed6979b0d3f873)), closes [#203](https://github.com/meriyah/meriyah/issues/203)
11
+
12
+
13
+
14
+ # [4.2.0](https://github.com/meriyah/meriyah/compare/v4.1.5...v4.2.0) (2021-07-11)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **parser:** keep InGlobal flag in parenthesized ([023ee0e](https://github.com/meriyah/meriyah/commit/023ee0e36fc28e75d0448739b8343ec801ac887f))
20
+ * **parser:** rejects "await 2**2" ([9a75bf6](https://github.com/meriyah/meriyah/commit/9a75bf67c9a6d22d28accc782665ed614a5a66c1)), closes [#187](https://github.com/meriyah/meriyah/issues/187)
21
+
22
+
23
+ ### Features
24
+
25
+ * **parser:** support top-level await ([7b2a5bd](https://github.com/meriyah/meriyah/commit/7b2a5bd5832cfa4c98dac4219f22901c6eb28196)), closes [#186](https://github.com/meriyah/meriyah/issues/186)
26
+
27
+
28
+
1
29
  ## [4.1.5](https://github.com/meriyah/meriyah/compare/v4.1.4...v4.1.5) (2021-03-05)
2
30
 
3
31
 
package/README.md CHANGED
@@ -21,8 +21,9 @@
21
21
  * Support TC39 proposals via option
22
22
  * Support for additional ECMAScript features for Web Browsers
23
23
  * JSX support via option
24
+ * Does **not** support TypeScript or Flow
24
25
  * Optionally track syntactic node locations
25
- * Emits an ESTree-compatible abstract syntax tree.
26
+ * Emits an ESTree-compatible abstract syntax tree
26
27
  * No backtracking
27
28
  * Low memory usage
28
29
  * Very well tested (~99 000 unit tests with full code coverage)
@@ -1,4 +1,4 @@
1
- define(['exports'], function (exports) { 'use strict';
1
+ define(['exports'], (function (exports) { 'use strict';
2
2
 
3
3
  const errorMessages = {
4
4
  [0]: 'Unexpected token',
@@ -96,7 +96,6 @@ define(['exports'], function (exports) { 'use strict';
96
96
  [89]: 'Illegal return statement',
97
97
  [90]: 'The left hand side of the for-header binding declaration is not destructible',
98
98
  [91]: 'new.target only allowed within functions',
99
- [92]: "'Unexpected token: 'escaped keyword'",
100
99
  [93]: "'#' not followed by identifier",
101
100
  [99]: 'Invalid keyword',
102
101
  [98]: "Can not use 'let' as a class name",
@@ -111,7 +110,6 @@ define(['exports'], function (exports) { 'use strict';
111
110
  [104]: "Only '*' or '{...}' can be imported after default",
112
111
  [105]: 'Trailing decorator may be followed by method',
113
112
  [106]: "Decorators can't be used with a constructor",
114
- [107]: "'%0' may not be used as an identifier in this context",
115
113
  [108]: 'HTML comments are only allowed with web compatibility (Annex B)',
116
114
  [109]: "The identifier 'let' must not be in expression position in strict mode",
117
115
  [110]: 'Cannot assign to `eval` and `arguments` in strict mode',
@@ -876,9 +874,9 @@ define(['exports'], function (exports) { 'use strict';
876
874
  mask |= 8;
877
875
  break;
878
876
  case 115:
879
- if (mask & 12)
877
+ if (mask & 32)
880
878
  report(parser, 34, 's');
881
- mask |= 12;
879
+ mask |= 32;
882
880
  break;
883
881
  default:
884
882
  report(parser, 33);
@@ -1791,7 +1789,7 @@ define(['exports'], function (exports) { 'use strict';
1791
1789
  }
1792
1790
  else if (ch === 61) {
1793
1791
  advanceChar(parser);
1794
- return 8456000;
1792
+ return 8456256;
1795
1793
  }
1796
1794
  if (ch === 33) {
1797
1795
  const index = parser.index + 1;
@@ -1974,7 +1972,7 @@ define(['exports'], function (exports) { 'use strict';
1974
1972
  const ch = parser.currentChar;
1975
1973
  if (ch === 61) {
1976
1974
  advanceChar(parser);
1977
- return 8456001;
1975
+ return 8456257;
1978
1976
  }
1979
1977
  if (ch !== 62)
1980
1978
  return 8456259;
@@ -4966,7 +4964,7 @@ define(['exports'], function (exports) { 'use strict';
4966
4964
  nextToken(parser, context | 32768);
4967
4965
  const argument = parser.flags & 1 || parser.token & 1048576
4968
4966
  ? null
4969
- : parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.line, parser.column);
4967
+ : parseExpressions(parser, context, 0, 1, parser.tokenPos, parser.linePos, parser.colPos);
4970
4968
  matchOrInsertSemicolon(parser, context | 32768);
4971
4969
  return finishNode(parser, context, start, line, column, {
4972
4970
  type: 'ReturnStatement',
@@ -5995,7 +5993,7 @@ define(['exports'], function (exports) { 'use strict';
5995
5993
  function parseAwaitExpression(parser, context, inNew, inGroup, start, line, column) {
5996
5994
  if (inGroup)
5997
5995
  parser.destructible |= 128;
5998
- if (context & 4194304) {
5996
+ if (context & 4194304 || (context & 2048 && context & 8192)) {
5999
5997
  if (inNew)
6000
5998
  report(parser, 0);
6001
5999
  if (context & 8388608) {
@@ -6003,6 +6001,8 @@ define(['exports'], function (exports) { 'use strict';
6003
6001
  }
6004
6002
  nextToken(parser, context | 32768);
6005
6003
  const argument = parseLeftHandSideExpression(parser, context, 0, 0, 1, parser.tokenPos, parser.linePos, parser.colPos);
6004
+ if (parser.token === 8457273)
6005
+ report(parser, 31);
6006
6006
  parser.assignable = 2;
6007
6007
  return finishNode(parser, context, start, line, column, {
6008
6008
  type: 'AwaitExpression',
@@ -6010,7 +6010,7 @@ define(['exports'], function (exports) { 'use strict';
6010
6010
  });
6011
6011
  }
6012
6012
  if (context & 2048)
6013
- report(parser, 107, 'Await');
6013
+ report(parser, 95);
6014
6014
  return parseIdentifierOrArrow(parser, context, start, line, column);
6015
6015
  }
6016
6016
  function parseFunctionBody(parser, context, scope, origin, firstRestricted, scopeError) {
@@ -6080,7 +6080,7 @@ define(['exports'], function (exports) { 'use strict';
6080
6080
  if ((context & 524288) < 1)
6081
6081
  report(parser, 26);
6082
6082
  if (context & 16384)
6083
- report(parser, 143);
6083
+ report(parser, 27);
6084
6084
  parser.assignable = 2;
6085
6085
  break;
6086
6086
  }
@@ -6089,7 +6089,7 @@ define(['exports'], function (exports) { 'use strict';
6089
6089
  if ((context & 262144) < 1)
6090
6090
  report(parser, 27);
6091
6091
  if (context & 16384)
6092
- report(parser, 143);
6092
+ report(parser, 27);
6093
6093
  parser.assignable = 1;
6094
6094
  break;
6095
6095
  }
@@ -6120,10 +6120,10 @@ define(['exports'], function (exports) { 'use strict';
6120
6120
  expr = parseUpdateExpression(parser, context, expr, start, line, column);
6121
6121
  }
6122
6122
  else if ((parser.token & 67108864) === 67108864) {
6123
- context = (context | 134217728 | 8192) ^ (134217728 | 8192);
6123
+ context = (context | 134217728) ^ 134217728;
6124
6124
  switch (parser.token) {
6125
6125
  case 67108877: {
6126
- nextToken(parser, context | 1073741824);
6126
+ nextToken(parser, (context | 1073741824 | 8192) ^ 8192);
6127
6127
  parser.assignable = 1;
6128
6128
  const property = parsePropertyOrPrivatePropertyName(parser, context);
6129
6129
  expr = finishNode(parser, context, start, line, column, {
@@ -6179,7 +6179,7 @@ define(['exports'], function (exports) { 'use strict';
6179
6179
  break;
6180
6180
  }
6181
6181
  case 67108991: {
6182
- nextToken(parser, context);
6182
+ nextToken(parser, (context | 1073741824 | 8192) ^ 8192);
6183
6183
  parser.flags |= 2048;
6184
6184
  parser.assignable = 2;
6185
6185
  expr = parseOptionalChain(parser, context, expr, start, line, column);
@@ -7615,7 +7615,7 @@ define(['exports'], function (exports) { 'use strict';
7615
7615
  const { tokenPos: piStart, linePos: plStart, colPos: pcStart } = parser;
7616
7616
  nextToken(parser, context | 32768 | 1073741824);
7617
7617
  const scope = context & 64 ? addChildScope(createScope(), 1024) : void 0;
7618
- context = (context | 134217728 | 8192) ^ (8192 | 134217728);
7618
+ context = (context | 134217728) ^ 134217728;
7619
7619
  if (consumeOpt(parser, context, 16)) {
7620
7620
  return parseParenthesizedArrow(parser, context, scope, [], canAssign, 0, start, line, column);
7621
7621
  }
@@ -8343,12 +8343,10 @@ define(['exports'], function (exports) { 'use strict';
8343
8343
  }
8344
8344
  else if (context & 1 && parser.token === 131) {
8345
8345
  kind |= 4096;
8346
- key = parsePrivateIdentifier(parser, context, tokenPos, linePos, colPos);
8347
- context = context | 16384;
8346
+ key = parsePrivateIdentifier(parser, context | 16384, tokenPos, linePos, colPos);
8348
8347
  }
8349
8348
  else if (context & 1 && (parser.token & 1073741824) === 1073741824) {
8350
8349
  kind |= 128;
8351
- context = context | 16384;
8352
8350
  }
8353
8351
  else if (token === 122) {
8354
8352
  key = parseIdentifier(parser, context, 0);
@@ -8714,7 +8712,7 @@ define(['exports'], function (exports) { 'use strict';
8714
8712
  });
8715
8713
  }
8716
8714
  function parseJSXExpressionContainer(parser, context, inJSXChild, isAttr, start, line, column) {
8717
- nextToken(parser, context);
8715
+ nextToken(parser, context | 32768);
8718
8716
  const { tokenPos, linePos, colPos } = parser;
8719
8717
  if (parser.token === 14)
8720
8718
  return parseJSXSpreadChild(parser, context, tokenPos, linePos, colPos);
@@ -8768,7 +8766,7 @@ define(['exports'], function (exports) { 'use strict';
8768
8766
  __proto__: null
8769
8767
  });
8770
8768
 
8771
- var version$1 = "4.1.5-dev.20210526";
8769
+ var version$1 = "4.2.1";
8772
8770
 
8773
8771
  const version = version$1;
8774
8772
  function parseScript(source, options) {
@@ -8789,4 +8787,4 @@ define(['exports'], function (exports) { 'use strict';
8789
8787
 
8790
8788
  Object.defineProperty(exports, '__esModule', { value: true });
8791
8789
 
8792
- });
8790
+ }));