meriyah 6.1.1 → 6.1.2
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 +10 -0
- package/README.md +2 -2
- package/dist/meriyah.cjs +39 -32
- package/dist/meriyah.min.mjs +1 -1
- package/dist/meriyah.mjs +39 -32
- package/dist/meriyah.umd.js +39 -32
- package/dist/meriyah.umd.min.js +1 -1
- package/dist/types/parser.d.ts +2 -2
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [6.1.2](https://github.com/meriyah/meriyah/compare/v6.1.1...v6.1.2) (2025-06-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **parser:** fix column of escaped identifier ([#469](https://github.com/meriyah/meriyah/issues/469)) ([98d3983](https://github.com/meriyah/meriyah/commit/98d398314f03c3c850368bee1ce697b88f070c79))
|
|
7
|
+
* **parser:** fix location of `import.meta` ([#461](https://github.com/meriyah/meriyah/issues/461)) ([6a05b0e](https://github.com/meriyah/meriyah/commit/6a05b0e0183f357ced7b26207a2a2f22ca287e80))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
1
11
|
## [6.1.1](https://github.com/meriyah/meriyah/compare/v6.1.0...v6.1.1) (2025-06-17)
|
|
2
12
|
|
|
3
13
|
|
package/README.md
CHANGED
|
@@ -147,9 +147,9 @@ declare function onInsertedSemicolon(position: number): void;
|
|
|
147
147
|
## Example usage
|
|
148
148
|
|
|
149
149
|
```js
|
|
150
|
-
import {
|
|
150
|
+
import { parse } from './meriyah';
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
parse('({x: [y] = 0} = 1)');
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
This will return when serialized in json:
|
package/dist/meriyah.cjs
CHANGED
|
@@ -180,6 +180,11 @@ const errorMessages = {
|
|
|
180
180
|
[177]: 'cannot use "await" in static blocks',
|
|
181
181
|
};
|
|
182
182
|
class ParseError extends SyntaxError {
|
|
183
|
+
start;
|
|
184
|
+
end;
|
|
185
|
+
range;
|
|
186
|
+
loc;
|
|
187
|
+
description;
|
|
183
188
|
constructor(start, end, type, ...params) {
|
|
184
189
|
const description = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
|
|
185
190
|
const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
|
|
@@ -1630,6 +1635,7 @@ function scanIdentifierUnicodeEscape(parser) {
|
|
|
1630
1635
|
report(parser, 5);
|
|
1631
1636
|
}
|
|
1632
1637
|
parser.currentChar = parser.source.charCodeAt((parser.index += 2));
|
|
1638
|
+
parser.column += 2;
|
|
1633
1639
|
return scanUnicodeEscape(parser);
|
|
1634
1640
|
}
|
|
1635
1641
|
function scanUnicodeEscape(parser) {
|
|
@@ -1661,6 +1667,7 @@ function scanUnicodeEscape(parser) {
|
|
|
1661
1667
|
report(parser, 7);
|
|
1662
1668
|
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
1663
1669
|
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
1670
|
+
parser.column += 4;
|
|
1664
1671
|
return codePoint;
|
|
1665
1672
|
}
|
|
1666
1673
|
|
|
@@ -4713,31 +4720,33 @@ function classifyIdentifier(parser, context, t) {
|
|
|
4713
4720
|
}
|
|
4714
4721
|
|
|
4715
4722
|
class Parser {
|
|
4723
|
+
source;
|
|
4724
|
+
options;
|
|
4725
|
+
lastOnToken = null;
|
|
4726
|
+
token = 1048576;
|
|
4727
|
+
flags = 0;
|
|
4728
|
+
index = 0;
|
|
4729
|
+
line = 1;
|
|
4730
|
+
column = 0;
|
|
4731
|
+
startIndex = 0;
|
|
4732
|
+
end = 0;
|
|
4733
|
+
tokenIndex = 0;
|
|
4734
|
+
startColumn = 0;
|
|
4735
|
+
tokenColumn = 0;
|
|
4736
|
+
tokenLine = 1;
|
|
4737
|
+
startLine = 1;
|
|
4738
|
+
tokenValue = '';
|
|
4739
|
+
tokenRaw = '';
|
|
4740
|
+
tokenRegExp = void 0;
|
|
4741
|
+
currentChar = 0;
|
|
4742
|
+
exportedNames = {};
|
|
4743
|
+
exportedBindings = {};
|
|
4744
|
+
assignable = 1;
|
|
4745
|
+
destructible = 0;
|
|
4746
|
+
leadingDecorators = { decorators: [] };
|
|
4716
4747
|
constructor(source, options = {}) {
|
|
4717
4748
|
this.source = source;
|
|
4718
4749
|
this.options = options;
|
|
4719
|
-
this.lastOnToken = null;
|
|
4720
|
-
this.token = 1048576;
|
|
4721
|
-
this.flags = 0;
|
|
4722
|
-
this.index = 0;
|
|
4723
|
-
this.line = 1;
|
|
4724
|
-
this.column = 0;
|
|
4725
|
-
this.startIndex = 0;
|
|
4726
|
-
this.end = 0;
|
|
4727
|
-
this.tokenIndex = 0;
|
|
4728
|
-
this.startColumn = 0;
|
|
4729
|
-
this.tokenColumn = 0;
|
|
4730
|
-
this.tokenLine = 1;
|
|
4731
|
-
this.startLine = 1;
|
|
4732
|
-
this.tokenValue = '';
|
|
4733
|
-
this.tokenRaw = '';
|
|
4734
|
-
this.tokenRegExp = void 0;
|
|
4735
|
-
this.currentChar = 0;
|
|
4736
|
-
this.exportedNames = {};
|
|
4737
|
-
this.exportedBindings = {};
|
|
4738
|
-
this.assignable = 1;
|
|
4739
|
-
this.destructible = 0;
|
|
4740
|
-
this.leadingDecorators = { decorators: [] };
|
|
4741
4750
|
this.end = source.length;
|
|
4742
4751
|
this.currentChar = source.charCodeAt(0);
|
|
4743
4752
|
}
|
|
@@ -4989,7 +4998,7 @@ function parseStatementListItem(parser, context, scope, privateScope, origin, la
|
|
|
4989
4998
|
case 67174411:
|
|
4990
4999
|
return parseImportCallDeclaration(parser, context, privateScope, start);
|
|
4991
5000
|
case 67108877:
|
|
4992
|
-
return parseImportMetaDeclaration(parser, context);
|
|
5001
|
+
return parseImportMetaDeclaration(parser, context, start);
|
|
4993
5002
|
default:
|
|
4994
5003
|
report(parser, 103, 'import');
|
|
4995
5004
|
}
|
|
@@ -5724,7 +5733,7 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
5724
5733
|
case 67174411:
|
|
5725
5734
|
return parseImportCallDeclaration(parser, context, undefined, start);
|
|
5726
5735
|
case 67108877:
|
|
5727
|
-
return parseImportMetaDeclaration(parser, context);
|
|
5736
|
+
return parseImportMetaDeclaration(parser, context, start);
|
|
5728
5737
|
default:
|
|
5729
5738
|
report(parser, 30, KeywordDescTable[parser.getToken() & 255]);
|
|
5730
5739
|
}
|
|
@@ -5797,12 +5806,11 @@ function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers)
|
|
|
5797
5806
|
consume(parser, context, 1074790415);
|
|
5798
5807
|
return specifiers;
|
|
5799
5808
|
}
|
|
5800
|
-
function parseImportMetaDeclaration(parser, context) {
|
|
5801
|
-
const start = parser.tokenStart;
|
|
5809
|
+
function parseImportMetaDeclaration(parser, context, start) {
|
|
5802
5810
|
let expr = parseImportMetaExpression(parser, context, parser.finishNode({
|
|
5803
5811
|
type: 'Identifier',
|
|
5804
5812
|
name: 'import',
|
|
5805
|
-
}, start));
|
|
5813
|
+
}, start), start);
|
|
5806
5814
|
expr = parseMemberOrUpdateExpression(parser, context, undefined, expr, 0, 0, start);
|
|
5807
5815
|
expr = parseAssignmentExpression(parser, context, undefined, 0, 0, start, expr);
|
|
5808
5816
|
if (parser.getToken() === 18) {
|
|
@@ -6603,7 +6611,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6603
6611
|
function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start) {
|
|
6604
6612
|
let expr = parseIdentifier(parser, context);
|
|
6605
6613
|
if (parser.getToken() === 67108877) {
|
|
6606
|
-
return parseImportMetaExpression(parser, context, expr);
|
|
6614
|
+
return parseImportMetaExpression(parser, context, expr, start);
|
|
6607
6615
|
}
|
|
6608
6616
|
if (inNew)
|
|
6609
6617
|
report(parser, 142);
|
|
@@ -6611,10 +6619,9 @@ function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, i
|
|
|
6611
6619
|
parser.assignable = 2;
|
|
6612
6620
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6613
6621
|
}
|
|
6614
|
-
function parseImportMetaExpression(parser, context, meta) {
|
|
6622
|
+
function parseImportMetaExpression(parser, context, meta, start) {
|
|
6615
6623
|
if ((context & 512) === 0)
|
|
6616
6624
|
report(parser, 169);
|
|
6617
|
-
const { tokenStart } = parser;
|
|
6618
6625
|
nextToken(parser, context);
|
|
6619
6626
|
const token = parser.getToken();
|
|
6620
6627
|
if (token !== 209030 && parser.tokenValue !== 'meta') {
|
|
@@ -6628,7 +6635,7 @@ function parseImportMetaExpression(parser, context, meta) {
|
|
|
6628
6635
|
type: 'MetaProperty',
|
|
6629
6636
|
meta,
|
|
6630
6637
|
property: parseIdentifier(parser, context),
|
|
6631
|
-
},
|
|
6638
|
+
}, start);
|
|
6632
6639
|
}
|
|
6633
6640
|
function parseImportExpression(parser, context, privateScope, inGroup, start) {
|
|
6634
6641
|
consume(parser, context | 8192, 67174411);
|
|
@@ -9240,7 +9247,7 @@ function parseJSXIdentifier(parser, context) {
|
|
|
9240
9247
|
}, start);
|
|
9241
9248
|
}
|
|
9242
9249
|
|
|
9243
|
-
var version$1 = "6.1.
|
|
9250
|
+
var version$1 = "6.1.2";
|
|
9244
9251
|
|
|
9245
9252
|
const version = version$1;
|
|
9246
9253
|
function parseScript(source, options) {
|