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/dist/meriyah.mjs
CHANGED
|
@@ -178,6 +178,11 @@ const errorMessages = {
|
|
|
178
178
|
[177]: 'cannot use "await" in static blocks',
|
|
179
179
|
};
|
|
180
180
|
class ParseError extends SyntaxError {
|
|
181
|
+
start;
|
|
182
|
+
end;
|
|
183
|
+
range;
|
|
184
|
+
loc;
|
|
185
|
+
description;
|
|
181
186
|
constructor(start, end, type, ...params) {
|
|
182
187
|
const description = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
|
|
183
188
|
const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
|
|
@@ -1628,6 +1633,7 @@ function scanIdentifierUnicodeEscape(parser) {
|
|
|
1628
1633
|
report(parser, 5);
|
|
1629
1634
|
}
|
|
1630
1635
|
parser.currentChar = parser.source.charCodeAt((parser.index += 2));
|
|
1636
|
+
parser.column += 2;
|
|
1631
1637
|
return scanUnicodeEscape(parser);
|
|
1632
1638
|
}
|
|
1633
1639
|
function scanUnicodeEscape(parser) {
|
|
@@ -1659,6 +1665,7 @@ function scanUnicodeEscape(parser) {
|
|
|
1659
1665
|
report(parser, 7);
|
|
1660
1666
|
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
1661
1667
|
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
1668
|
+
parser.column += 4;
|
|
1662
1669
|
return codePoint;
|
|
1663
1670
|
}
|
|
1664
1671
|
|
|
@@ -4711,31 +4718,33 @@ function classifyIdentifier(parser, context, t) {
|
|
|
4711
4718
|
}
|
|
4712
4719
|
|
|
4713
4720
|
class Parser {
|
|
4721
|
+
source;
|
|
4722
|
+
options;
|
|
4723
|
+
lastOnToken = null;
|
|
4724
|
+
token = 1048576;
|
|
4725
|
+
flags = 0;
|
|
4726
|
+
index = 0;
|
|
4727
|
+
line = 1;
|
|
4728
|
+
column = 0;
|
|
4729
|
+
startIndex = 0;
|
|
4730
|
+
end = 0;
|
|
4731
|
+
tokenIndex = 0;
|
|
4732
|
+
startColumn = 0;
|
|
4733
|
+
tokenColumn = 0;
|
|
4734
|
+
tokenLine = 1;
|
|
4735
|
+
startLine = 1;
|
|
4736
|
+
tokenValue = '';
|
|
4737
|
+
tokenRaw = '';
|
|
4738
|
+
tokenRegExp = void 0;
|
|
4739
|
+
currentChar = 0;
|
|
4740
|
+
exportedNames = {};
|
|
4741
|
+
exportedBindings = {};
|
|
4742
|
+
assignable = 1;
|
|
4743
|
+
destructible = 0;
|
|
4744
|
+
leadingDecorators = { decorators: [] };
|
|
4714
4745
|
constructor(source, options = {}) {
|
|
4715
4746
|
this.source = source;
|
|
4716
4747
|
this.options = options;
|
|
4717
|
-
this.lastOnToken = null;
|
|
4718
|
-
this.token = 1048576;
|
|
4719
|
-
this.flags = 0;
|
|
4720
|
-
this.index = 0;
|
|
4721
|
-
this.line = 1;
|
|
4722
|
-
this.column = 0;
|
|
4723
|
-
this.startIndex = 0;
|
|
4724
|
-
this.end = 0;
|
|
4725
|
-
this.tokenIndex = 0;
|
|
4726
|
-
this.startColumn = 0;
|
|
4727
|
-
this.tokenColumn = 0;
|
|
4728
|
-
this.tokenLine = 1;
|
|
4729
|
-
this.startLine = 1;
|
|
4730
|
-
this.tokenValue = '';
|
|
4731
|
-
this.tokenRaw = '';
|
|
4732
|
-
this.tokenRegExp = void 0;
|
|
4733
|
-
this.currentChar = 0;
|
|
4734
|
-
this.exportedNames = {};
|
|
4735
|
-
this.exportedBindings = {};
|
|
4736
|
-
this.assignable = 1;
|
|
4737
|
-
this.destructible = 0;
|
|
4738
|
-
this.leadingDecorators = { decorators: [] };
|
|
4739
4748
|
this.end = source.length;
|
|
4740
4749
|
this.currentChar = source.charCodeAt(0);
|
|
4741
4750
|
}
|
|
@@ -4987,7 +4996,7 @@ function parseStatementListItem(parser, context, scope, privateScope, origin, la
|
|
|
4987
4996
|
case 67174411:
|
|
4988
4997
|
return parseImportCallDeclaration(parser, context, privateScope, start);
|
|
4989
4998
|
case 67108877:
|
|
4990
|
-
return parseImportMetaDeclaration(parser, context);
|
|
4999
|
+
return parseImportMetaDeclaration(parser, context, start);
|
|
4991
5000
|
default:
|
|
4992
5001
|
report(parser, 103, 'import');
|
|
4993
5002
|
}
|
|
@@ -5722,7 +5731,7 @@ function parseImportDeclaration(parser, context, scope) {
|
|
|
5722
5731
|
case 67174411:
|
|
5723
5732
|
return parseImportCallDeclaration(parser, context, undefined, start);
|
|
5724
5733
|
case 67108877:
|
|
5725
|
-
return parseImportMetaDeclaration(parser, context);
|
|
5734
|
+
return parseImportMetaDeclaration(parser, context, start);
|
|
5726
5735
|
default:
|
|
5727
5736
|
report(parser, 30, KeywordDescTable[parser.getToken() & 255]);
|
|
5728
5737
|
}
|
|
@@ -5795,12 +5804,11 @@ function parseImportSpecifierOrNamedImports(parser, context, scope, specifiers)
|
|
|
5795
5804
|
consume(parser, context, 1074790415);
|
|
5796
5805
|
return specifiers;
|
|
5797
5806
|
}
|
|
5798
|
-
function parseImportMetaDeclaration(parser, context) {
|
|
5799
|
-
const start = parser.tokenStart;
|
|
5807
|
+
function parseImportMetaDeclaration(parser, context, start) {
|
|
5800
5808
|
let expr = parseImportMetaExpression(parser, context, parser.finishNode({
|
|
5801
5809
|
type: 'Identifier',
|
|
5802
5810
|
name: 'import',
|
|
5803
|
-
}, start));
|
|
5811
|
+
}, start), start);
|
|
5804
5812
|
expr = parseMemberOrUpdateExpression(parser, context, undefined, expr, 0, 0, start);
|
|
5805
5813
|
expr = parseAssignmentExpression(parser, context, undefined, 0, 0, start, expr);
|
|
5806
5814
|
if (parser.getToken() === 18) {
|
|
@@ -6601,7 +6609,7 @@ function parsePrimaryExpression(parser, context, privateScope, kind, inNew, canA
|
|
|
6601
6609
|
function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start) {
|
|
6602
6610
|
let expr = parseIdentifier(parser, context);
|
|
6603
6611
|
if (parser.getToken() === 67108877) {
|
|
6604
|
-
return parseImportMetaExpression(parser, context, expr);
|
|
6612
|
+
return parseImportMetaExpression(parser, context, expr, start);
|
|
6605
6613
|
}
|
|
6606
6614
|
if (inNew)
|
|
6607
6615
|
report(parser, 142);
|
|
@@ -6609,10 +6617,9 @@ function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, i
|
|
|
6609
6617
|
parser.assignable = 2;
|
|
6610
6618
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6611
6619
|
}
|
|
6612
|
-
function parseImportMetaExpression(parser, context, meta) {
|
|
6620
|
+
function parseImportMetaExpression(parser, context, meta, start) {
|
|
6613
6621
|
if ((context & 512) === 0)
|
|
6614
6622
|
report(parser, 169);
|
|
6615
|
-
const { tokenStart } = parser;
|
|
6616
6623
|
nextToken(parser, context);
|
|
6617
6624
|
const token = parser.getToken();
|
|
6618
6625
|
if (token !== 209030 && parser.tokenValue !== 'meta') {
|
|
@@ -6626,7 +6633,7 @@ function parseImportMetaExpression(parser, context, meta) {
|
|
|
6626
6633
|
type: 'MetaProperty',
|
|
6627
6634
|
meta,
|
|
6628
6635
|
property: parseIdentifier(parser, context),
|
|
6629
|
-
},
|
|
6636
|
+
}, start);
|
|
6630
6637
|
}
|
|
6631
6638
|
function parseImportExpression(parser, context, privateScope, inGroup, start) {
|
|
6632
6639
|
consume(parser, context | 8192, 67174411);
|
|
@@ -9238,7 +9245,7 @@ function parseJSXIdentifier(parser, context) {
|
|
|
9238
9245
|
}, start);
|
|
9239
9246
|
}
|
|
9240
9247
|
|
|
9241
|
-
var version$1 = "6.1.
|
|
9248
|
+
var version$1 = "6.1.2";
|
|
9242
9249
|
|
|
9243
9250
|
const version = version$1;
|
|
9244
9251
|
function parseScript(source, options) {
|
package/dist/meriyah.umd.js
CHANGED
|
@@ -184,6 +184,11 @@
|
|
|
184
184
|
[177]: 'cannot use "await" in static blocks',
|
|
185
185
|
};
|
|
186
186
|
class ParseError extends SyntaxError {
|
|
187
|
+
start;
|
|
188
|
+
end;
|
|
189
|
+
range;
|
|
190
|
+
loc;
|
|
191
|
+
description;
|
|
187
192
|
constructor(start, end, type, ...params) {
|
|
188
193
|
const description = errorMessages[type].replace(/%(\d+)/g, (_, i) => params[i]);
|
|
189
194
|
const message = '[' + start.line + ':' + start.column + '-' + end.line + ':' + end.column + ']: ' + description;
|
|
@@ -1634,6 +1639,7 @@
|
|
|
1634
1639
|
report(parser, 5);
|
|
1635
1640
|
}
|
|
1636
1641
|
parser.currentChar = parser.source.charCodeAt((parser.index += 2));
|
|
1642
|
+
parser.column += 2;
|
|
1637
1643
|
return scanUnicodeEscape(parser);
|
|
1638
1644
|
}
|
|
1639
1645
|
function scanUnicodeEscape(parser) {
|
|
@@ -1665,6 +1671,7 @@
|
|
|
1665
1671
|
report(parser, 7);
|
|
1666
1672
|
codePoint = (toHex(char) << 12) | (toHex(char2) << 8) | (toHex(char3) << 4) | toHex(char4);
|
|
1667
1673
|
parser.currentChar = parser.source.charCodeAt((parser.index += 4));
|
|
1674
|
+
parser.column += 4;
|
|
1668
1675
|
return codePoint;
|
|
1669
1676
|
}
|
|
1670
1677
|
|
|
@@ -4717,31 +4724,33 @@
|
|
|
4717
4724
|
}
|
|
4718
4725
|
|
|
4719
4726
|
class Parser {
|
|
4727
|
+
source;
|
|
4728
|
+
options;
|
|
4729
|
+
lastOnToken = null;
|
|
4730
|
+
token = 1048576;
|
|
4731
|
+
flags = 0;
|
|
4732
|
+
index = 0;
|
|
4733
|
+
line = 1;
|
|
4734
|
+
column = 0;
|
|
4735
|
+
startIndex = 0;
|
|
4736
|
+
end = 0;
|
|
4737
|
+
tokenIndex = 0;
|
|
4738
|
+
startColumn = 0;
|
|
4739
|
+
tokenColumn = 0;
|
|
4740
|
+
tokenLine = 1;
|
|
4741
|
+
startLine = 1;
|
|
4742
|
+
tokenValue = '';
|
|
4743
|
+
tokenRaw = '';
|
|
4744
|
+
tokenRegExp = void 0;
|
|
4745
|
+
currentChar = 0;
|
|
4746
|
+
exportedNames = {};
|
|
4747
|
+
exportedBindings = {};
|
|
4748
|
+
assignable = 1;
|
|
4749
|
+
destructible = 0;
|
|
4750
|
+
leadingDecorators = { decorators: [] };
|
|
4720
4751
|
constructor(source, options = {}) {
|
|
4721
4752
|
this.source = source;
|
|
4722
4753
|
this.options = options;
|
|
4723
|
-
this.lastOnToken = null;
|
|
4724
|
-
this.token = 1048576;
|
|
4725
|
-
this.flags = 0;
|
|
4726
|
-
this.index = 0;
|
|
4727
|
-
this.line = 1;
|
|
4728
|
-
this.column = 0;
|
|
4729
|
-
this.startIndex = 0;
|
|
4730
|
-
this.end = 0;
|
|
4731
|
-
this.tokenIndex = 0;
|
|
4732
|
-
this.startColumn = 0;
|
|
4733
|
-
this.tokenColumn = 0;
|
|
4734
|
-
this.tokenLine = 1;
|
|
4735
|
-
this.startLine = 1;
|
|
4736
|
-
this.tokenValue = '';
|
|
4737
|
-
this.tokenRaw = '';
|
|
4738
|
-
this.tokenRegExp = void 0;
|
|
4739
|
-
this.currentChar = 0;
|
|
4740
|
-
this.exportedNames = {};
|
|
4741
|
-
this.exportedBindings = {};
|
|
4742
|
-
this.assignable = 1;
|
|
4743
|
-
this.destructible = 0;
|
|
4744
|
-
this.leadingDecorators = { decorators: [] };
|
|
4745
4754
|
this.end = source.length;
|
|
4746
4755
|
this.currentChar = source.charCodeAt(0);
|
|
4747
4756
|
}
|
|
@@ -4993,7 +5002,7 @@
|
|
|
4993
5002
|
case 67174411:
|
|
4994
5003
|
return parseImportCallDeclaration(parser, context, privateScope, start);
|
|
4995
5004
|
case 67108877:
|
|
4996
|
-
return parseImportMetaDeclaration(parser, context);
|
|
5005
|
+
return parseImportMetaDeclaration(parser, context, start);
|
|
4997
5006
|
default:
|
|
4998
5007
|
report(parser, 103, 'import');
|
|
4999
5008
|
}
|
|
@@ -5728,7 +5737,7 @@
|
|
|
5728
5737
|
case 67174411:
|
|
5729
5738
|
return parseImportCallDeclaration(parser, context, undefined, start);
|
|
5730
5739
|
case 67108877:
|
|
5731
|
-
return parseImportMetaDeclaration(parser, context);
|
|
5740
|
+
return parseImportMetaDeclaration(parser, context, start);
|
|
5732
5741
|
default:
|
|
5733
5742
|
report(parser, 30, KeywordDescTable[parser.getToken() & 255]);
|
|
5734
5743
|
}
|
|
@@ -5801,12 +5810,11 @@
|
|
|
5801
5810
|
consume(parser, context, 1074790415);
|
|
5802
5811
|
return specifiers;
|
|
5803
5812
|
}
|
|
5804
|
-
function parseImportMetaDeclaration(parser, context) {
|
|
5805
|
-
const start = parser.tokenStart;
|
|
5813
|
+
function parseImportMetaDeclaration(parser, context, start) {
|
|
5806
5814
|
let expr = parseImportMetaExpression(parser, context, parser.finishNode({
|
|
5807
5815
|
type: 'Identifier',
|
|
5808
5816
|
name: 'import',
|
|
5809
|
-
}, start));
|
|
5817
|
+
}, start), start);
|
|
5810
5818
|
expr = parseMemberOrUpdateExpression(parser, context, undefined, expr, 0, 0, start);
|
|
5811
5819
|
expr = parseAssignmentExpression(parser, context, undefined, 0, 0, start, expr);
|
|
5812
5820
|
if (parser.getToken() === 18) {
|
|
@@ -6607,7 +6615,7 @@
|
|
|
6607
6615
|
function parseImportCallOrMetaExpression(parser, context, privateScope, inNew, inGroup, start) {
|
|
6608
6616
|
let expr = parseIdentifier(parser, context);
|
|
6609
6617
|
if (parser.getToken() === 67108877) {
|
|
6610
|
-
return parseImportMetaExpression(parser, context, expr);
|
|
6618
|
+
return parseImportMetaExpression(parser, context, expr, start);
|
|
6611
6619
|
}
|
|
6612
6620
|
if (inNew)
|
|
6613
6621
|
report(parser, 142);
|
|
@@ -6615,10 +6623,9 @@
|
|
|
6615
6623
|
parser.assignable = 2;
|
|
6616
6624
|
return parseMemberOrUpdateExpression(parser, context, privateScope, expr, inGroup, 0, start);
|
|
6617
6625
|
}
|
|
6618
|
-
function parseImportMetaExpression(parser, context, meta) {
|
|
6626
|
+
function parseImportMetaExpression(parser, context, meta, start) {
|
|
6619
6627
|
if ((context & 512) === 0)
|
|
6620
6628
|
report(parser, 169);
|
|
6621
|
-
const { tokenStart } = parser;
|
|
6622
6629
|
nextToken(parser, context);
|
|
6623
6630
|
const token = parser.getToken();
|
|
6624
6631
|
if (token !== 209030 && parser.tokenValue !== 'meta') {
|
|
@@ -6632,7 +6639,7 @@
|
|
|
6632
6639
|
type: 'MetaProperty',
|
|
6633
6640
|
meta,
|
|
6634
6641
|
property: parseIdentifier(parser, context),
|
|
6635
|
-
},
|
|
6642
|
+
}, start);
|
|
6636
6643
|
}
|
|
6637
6644
|
function parseImportExpression(parser, context, privateScope, inGroup, start) {
|
|
6638
6645
|
consume(parser, context | 8192, 67174411);
|
|
@@ -9244,7 +9251,7 @@
|
|
|
9244
9251
|
}, start);
|
|
9245
9252
|
}
|
|
9246
9253
|
|
|
9247
|
-
var version$1 = "6.1.
|
|
9254
|
+
var version$1 = "6.1.2";
|
|
9248
9255
|
|
|
9249
9256
|
const version = version$1;
|
|
9250
9257
|
function parseScript(source, options) {
|