@rollup/wasm-node 4.13.2 → 4.14.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/dist/bin/rollup +2 -2
- package/dist/es/getLogFilter.js +2 -2
- package/dist/es/parseAst.js +2 -2
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/node-entry.js +175 -160
- package/dist/es/shared/parseAst.js +117 -99
- package/dist/es/shared/watch.js +2 -2
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +120 -98
- package/dist/shared/rollup.js +228 -213
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +14 -13
package/dist/shared/parseAst.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.14.1
|
|
4
|
+
Sun, 07 Apr 2024 07:35:08 GMT - commit 0b665c31833525c923c0fc20f43ebfca748c6670
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -992,6 +992,15 @@ function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation,
|
|
|
992
992
|
}
|
|
993
993
|
}
|
|
994
994
|
|
|
995
|
+
const BLANK = Object.freeze(Object.create(null));
|
|
996
|
+
const EMPTY_OBJECT = Object.freeze({});
|
|
997
|
+
const EMPTY_ARRAY = Object.freeze([]);
|
|
998
|
+
const EMPTY_SET = Object.freeze(new (class extends Set {
|
|
999
|
+
add() {
|
|
1000
|
+
throw new Error('Cannot add to empty set');
|
|
1001
|
+
}
|
|
1002
|
+
})());
|
|
1003
|
+
|
|
995
1004
|
const ArrowFunctionExpression = 'ArrowFunctionExpression';
|
|
996
1005
|
const BlockStatement = 'BlockStatement';
|
|
997
1006
|
const CallExpression = 'CallExpression';
|
|
@@ -1006,6 +1015,8 @@ const Property = 'Property';
|
|
|
1006
1015
|
const ReturnStatement = 'ReturnStatement';
|
|
1007
1016
|
const TemplateLiteral = 'TemplateLiteral';
|
|
1008
1017
|
|
|
1018
|
+
// This file is generated by scripts/generate-string-constant.js.
|
|
1019
|
+
// Do not edit this file directly.
|
|
1009
1020
|
const FIXED_STRINGS = [
|
|
1010
1021
|
'var',
|
|
1011
1022
|
'let',
|
|
@@ -1066,12 +1077,17 @@ const FIXED_STRINGS = [
|
|
|
1066
1077
|
'||=',
|
|
1067
1078
|
'??=',
|
|
1068
1079
|
'pure',
|
|
1069
|
-
'noSideEffects'
|
|
1080
|
+
'noSideEffects',
|
|
1081
|
+
'sourcemap',
|
|
1082
|
+
'using',
|
|
1083
|
+
'await using'
|
|
1070
1084
|
];
|
|
1071
1085
|
|
|
1072
1086
|
const ANNOTATION_KEY = '_rollupAnnotations';
|
|
1073
1087
|
const INVALID_ANNOTATION_KEY = '_rollupRemoved';
|
|
1074
1088
|
const convertAnnotations = (position, buffer) => {
|
|
1089
|
+
if (position === 0)
|
|
1090
|
+
return EMPTY_ARRAY;
|
|
1075
1091
|
const length = buffer[position++];
|
|
1076
1092
|
const list = [];
|
|
1077
1093
|
for (let index = 0; index < length; index++) {
|
|
@@ -1112,7 +1128,7 @@ const nodeConverters = [
|
|
|
1112
1128
|
function panicError(position, buffer, readString) {
|
|
1113
1129
|
const start = buffer[position++];
|
|
1114
1130
|
const end = buffer[position++];
|
|
1115
|
-
const message = convertString(position, buffer, readString);
|
|
1131
|
+
const message = convertString(buffer[position], buffer, readString);
|
|
1116
1132
|
return {
|
|
1117
1133
|
type: 'PanicError',
|
|
1118
1134
|
start,
|
|
@@ -1123,7 +1139,7 @@ const nodeConverters = [
|
|
|
1123
1139
|
function parseError(position, buffer, readString) {
|
|
1124
1140
|
const start = buffer[position++];
|
|
1125
1141
|
const end = buffer[position++];
|
|
1126
|
-
const message = convertString(position, buffer, readString);
|
|
1142
|
+
const message = convertString(buffer[position], buffer, readString);
|
|
1127
1143
|
return {
|
|
1128
1144
|
type: 'ParseError',
|
|
1129
1145
|
start,
|
|
@@ -1134,7 +1150,7 @@ const nodeConverters = [
|
|
|
1134
1150
|
function arrayExpression(position, buffer, readString) {
|
|
1135
1151
|
const start = buffer[position++];
|
|
1136
1152
|
const end = buffer[position++];
|
|
1137
|
-
const elements = convertNodeList(position, buffer, readString);
|
|
1153
|
+
const elements = convertNodeList(buffer[position], buffer, readString);
|
|
1138
1154
|
return {
|
|
1139
1155
|
type: 'ArrayExpression',
|
|
1140
1156
|
start,
|
|
@@ -1145,7 +1161,7 @@ const nodeConverters = [
|
|
|
1145
1161
|
function arrayPattern(position, buffer, readString) {
|
|
1146
1162
|
const start = buffer[position++];
|
|
1147
1163
|
const end = buffer[position++];
|
|
1148
|
-
const elements = convertNodeList(position, buffer, readString);
|
|
1164
|
+
const elements = convertNodeList(buffer[position], buffer, readString);
|
|
1149
1165
|
return {
|
|
1150
1166
|
type: 'ArrayPattern',
|
|
1151
1167
|
start,
|
|
@@ -1160,9 +1176,9 @@ const nodeConverters = [
|
|
|
1160
1176
|
const async = (flags & 1) === 1;
|
|
1161
1177
|
const expression = (flags & 2) === 2;
|
|
1162
1178
|
const generator = (flags & 4) === 4;
|
|
1179
|
+
const annotations = convertAnnotations(buffer[position++], buffer);
|
|
1163
1180
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
1164
|
-
const body = convertNode(buffer[position
|
|
1165
|
-
const annotations = convertAnnotations(position, buffer);
|
|
1181
|
+
const body = convertNode(buffer[position], buffer, readString);
|
|
1166
1182
|
return {
|
|
1167
1183
|
type: 'ArrowFunctionExpression',
|
|
1168
1184
|
start,
|
|
@@ -1180,8 +1196,8 @@ const nodeConverters = [
|
|
|
1180
1196
|
const start = buffer[position++];
|
|
1181
1197
|
const end = buffer[position++];
|
|
1182
1198
|
const operator = FIXED_STRINGS[buffer[position++]];
|
|
1183
|
-
const
|
|
1184
|
-
const
|
|
1199
|
+
const left = convertNode(buffer[position++], buffer, readString);
|
|
1200
|
+
const right = convertNode(buffer[position], buffer, readString);
|
|
1185
1201
|
return {
|
|
1186
1202
|
type: 'AssignmentExpression',
|
|
1187
1203
|
start,
|
|
@@ -1194,8 +1210,8 @@ const nodeConverters = [
|
|
|
1194
1210
|
function assignmentPattern(position, buffer, readString) {
|
|
1195
1211
|
const start = buffer[position++];
|
|
1196
1212
|
const end = buffer[position++];
|
|
1197
|
-
const
|
|
1198
|
-
const
|
|
1213
|
+
const left = convertNode(buffer[position++], buffer, readString);
|
|
1214
|
+
const right = convertNode(buffer[position], buffer, readString);
|
|
1199
1215
|
return {
|
|
1200
1216
|
type: 'AssignmentPattern',
|
|
1201
1217
|
start,
|
|
@@ -1207,7 +1223,7 @@ const nodeConverters = [
|
|
|
1207
1223
|
function awaitExpression(position, buffer, readString) {
|
|
1208
1224
|
const start = buffer[position++];
|
|
1209
1225
|
const end = buffer[position++];
|
|
1210
|
-
const argument = convertNode(position, buffer, readString);
|
|
1226
|
+
const argument = convertNode(buffer[position], buffer, readString);
|
|
1211
1227
|
return {
|
|
1212
1228
|
type: 'AwaitExpression',
|
|
1213
1229
|
start,
|
|
@@ -1219,8 +1235,8 @@ const nodeConverters = [
|
|
|
1219
1235
|
const start = buffer[position++];
|
|
1220
1236
|
const end = buffer[position++];
|
|
1221
1237
|
const operator = FIXED_STRINGS[buffer[position++]];
|
|
1222
|
-
const
|
|
1223
|
-
const
|
|
1238
|
+
const left = convertNode(buffer[position++], buffer, readString);
|
|
1239
|
+
const right = convertNode(buffer[position], buffer, readString);
|
|
1224
1240
|
return {
|
|
1225
1241
|
type: 'BinaryExpression',
|
|
1226
1242
|
start,
|
|
@@ -1233,7 +1249,7 @@ const nodeConverters = [
|
|
|
1233
1249
|
function blockStatement(position, buffer, readString) {
|
|
1234
1250
|
const start = buffer[position++];
|
|
1235
1251
|
const end = buffer[position++];
|
|
1236
|
-
const body = convertNodeList(position, buffer, readString);
|
|
1252
|
+
const body = convertNodeList(buffer[position], buffer, readString);
|
|
1237
1253
|
return {
|
|
1238
1254
|
type: 'BlockStatement',
|
|
1239
1255
|
start,
|
|
@@ -1258,9 +1274,9 @@ const nodeConverters = [
|
|
|
1258
1274
|
const end = buffer[position++];
|
|
1259
1275
|
const flags = buffer[position++];
|
|
1260
1276
|
const optional = (flags & 1) === 1;
|
|
1277
|
+
const annotations = convertAnnotations(buffer[position++], buffer);
|
|
1261
1278
|
const callee = convertNode(buffer[position++], buffer, readString);
|
|
1262
|
-
const callArguments = convertNodeList(buffer[position
|
|
1263
|
-
const annotations = convertAnnotations(position, buffer);
|
|
1279
|
+
const callArguments = convertNodeList(buffer[position], buffer, readString);
|
|
1264
1280
|
return {
|
|
1265
1281
|
type: 'CallExpression',
|
|
1266
1282
|
start,
|
|
@@ -1288,7 +1304,7 @@ const nodeConverters = [
|
|
|
1288
1304
|
function chainExpression(position, buffer, readString) {
|
|
1289
1305
|
const start = buffer[position++];
|
|
1290
1306
|
const end = buffer[position++];
|
|
1291
|
-
const expression = convertNode(position, buffer, readString);
|
|
1307
|
+
const expression = convertNode(buffer[position], buffer, readString);
|
|
1292
1308
|
return {
|
|
1293
1309
|
type: 'ChainExpression',
|
|
1294
1310
|
start,
|
|
@@ -1299,7 +1315,7 @@ const nodeConverters = [
|
|
|
1299
1315
|
function classBody(position, buffer, readString) {
|
|
1300
1316
|
const start = buffer[position++];
|
|
1301
1317
|
const end = buffer[position++];
|
|
1302
|
-
const body = convertNodeList(position, buffer, readString);
|
|
1318
|
+
const body = convertNodeList(buffer[position], buffer, readString);
|
|
1303
1319
|
return {
|
|
1304
1320
|
type: 'ClassBody',
|
|
1305
1321
|
start,
|
|
@@ -1344,9 +1360,9 @@ const nodeConverters = [
|
|
|
1344
1360
|
function conditionalExpression(position, buffer, readString) {
|
|
1345
1361
|
const start = buffer[position++];
|
|
1346
1362
|
const end = buffer[position++];
|
|
1363
|
+
const test = convertNode(buffer[position++], buffer, readString);
|
|
1347
1364
|
const consequent = convertNode(buffer[position++], buffer, readString);
|
|
1348
|
-
const alternate = convertNode(buffer[position
|
|
1349
|
-
const test = convertNode(position, buffer, readString);
|
|
1365
|
+
const alternate = convertNode(buffer[position], buffer, readString);
|
|
1350
1366
|
return {
|
|
1351
1367
|
type: 'ConditionalExpression',
|
|
1352
1368
|
start,
|
|
@@ -1380,8 +1396,8 @@ const nodeConverters = [
|
|
|
1380
1396
|
function directive(position, buffer, readString) {
|
|
1381
1397
|
const start = buffer[position++];
|
|
1382
1398
|
const end = buffer[position++];
|
|
1383
|
-
const
|
|
1384
|
-
const
|
|
1399
|
+
const directive = convertString(buffer[position++], buffer, readString);
|
|
1400
|
+
const expression = convertNode(buffer[position], buffer, readString);
|
|
1385
1401
|
return {
|
|
1386
1402
|
type: 'ExpressionStatement',
|
|
1387
1403
|
start,
|
|
@@ -1393,8 +1409,8 @@ const nodeConverters = [
|
|
|
1393
1409
|
function doWhileStatement(position, buffer, readString) {
|
|
1394
1410
|
const start = buffer[position++];
|
|
1395
1411
|
const end = buffer[position++];
|
|
1396
|
-
const
|
|
1397
|
-
const
|
|
1412
|
+
const body = convertNode(buffer[position++], buffer, readString);
|
|
1413
|
+
const test = convertNode(buffer[position], buffer, readString);
|
|
1398
1414
|
return {
|
|
1399
1415
|
type: 'DoWhileStatement',
|
|
1400
1416
|
start,
|
|
@@ -1431,7 +1447,7 @@ const nodeConverters = [
|
|
|
1431
1447
|
function exportDefaultDeclaration(position, buffer, readString) {
|
|
1432
1448
|
const start = buffer[position++];
|
|
1433
1449
|
const end = buffer[position++];
|
|
1434
|
-
const declaration = convertNode(position, buffer, readString);
|
|
1450
|
+
const declaration = convertNode(buffer[position], buffer, readString);
|
|
1435
1451
|
return {
|
|
1436
1452
|
type: 'ExportDefaultDeclaration',
|
|
1437
1453
|
start,
|
|
@@ -1442,12 +1458,12 @@ const nodeConverters = [
|
|
|
1442
1458
|
function exportNamedDeclaration(position, buffer, readString) {
|
|
1443
1459
|
const start = buffer[position++];
|
|
1444
1460
|
const end = buffer[position++];
|
|
1461
|
+
const specifiers = convertNodeList(buffer[position++], buffer, readString);
|
|
1445
1462
|
const sourcePosition = buffer[position++];
|
|
1446
1463
|
const source = sourcePosition === 0 ? null : convertNode(sourcePosition, buffer, readString);
|
|
1447
1464
|
const attributes = convertNodeList(buffer[position++], buffer, readString);
|
|
1448
|
-
const declarationPosition = buffer[position
|
|
1465
|
+
const declarationPosition = buffer[position];
|
|
1449
1466
|
const declaration = declarationPosition === 0 ? null : convertNode(declarationPosition, buffer, readString);
|
|
1450
|
-
const specifiers = convertNodeList(position, buffer, readString);
|
|
1451
1467
|
return {
|
|
1452
1468
|
type: 'ExportNamedDeclaration',
|
|
1453
1469
|
start,
|
|
@@ -1461,8 +1477,8 @@ const nodeConverters = [
|
|
|
1461
1477
|
function exportSpecifier(position, buffer, readString) {
|
|
1462
1478
|
const start = buffer[position++];
|
|
1463
1479
|
const end = buffer[position++];
|
|
1464
|
-
const
|
|
1465
|
-
const
|
|
1480
|
+
const local = convertNode(buffer[position++], buffer, readString);
|
|
1481
|
+
const exportedPosition = buffer[position];
|
|
1466
1482
|
return {
|
|
1467
1483
|
type: 'ExportSpecifier',
|
|
1468
1484
|
start,
|
|
@@ -1474,7 +1490,7 @@ const nodeConverters = [
|
|
|
1474
1490
|
function expressionStatement(position, buffer, readString) {
|
|
1475
1491
|
const start = buffer[position++];
|
|
1476
1492
|
const end = buffer[position++];
|
|
1477
|
-
const expression = convertNode(position, buffer, readString);
|
|
1493
|
+
const expression = convertNode(buffer[position], buffer, readString);
|
|
1478
1494
|
return {
|
|
1479
1495
|
type: 'ExpressionStatement',
|
|
1480
1496
|
start,
|
|
@@ -1485,9 +1501,9 @@ const nodeConverters = [
|
|
|
1485
1501
|
function forInStatement(position, buffer, readString) {
|
|
1486
1502
|
const start = buffer[position++];
|
|
1487
1503
|
const end = buffer[position++];
|
|
1504
|
+
const left = convertNode(buffer[position++], buffer, readString);
|
|
1488
1505
|
const right = convertNode(buffer[position++], buffer, readString);
|
|
1489
|
-
const body = convertNode(buffer[position
|
|
1490
|
-
const left = convertNode(position, buffer, readString);
|
|
1506
|
+
const body = convertNode(buffer[position], buffer, readString);
|
|
1491
1507
|
return {
|
|
1492
1508
|
type: 'ForInStatement',
|
|
1493
1509
|
start,
|
|
@@ -1502,9 +1518,9 @@ const nodeConverters = [
|
|
|
1502
1518
|
const end = buffer[position++];
|
|
1503
1519
|
const flags = buffer[position++];
|
|
1504
1520
|
const awaited = (flags & 1) === 1;
|
|
1521
|
+
const left = convertNode(buffer[position++], buffer, readString);
|
|
1505
1522
|
const right = convertNode(buffer[position++], buffer, readString);
|
|
1506
|
-
const body = convertNode(buffer[position
|
|
1507
|
-
const left = convertNode(position, buffer, readString);
|
|
1523
|
+
const body = convertNode(buffer[position], buffer, readString);
|
|
1508
1524
|
return {
|
|
1509
1525
|
type: 'ForOfStatement',
|
|
1510
1526
|
start,
|
|
@@ -1541,11 +1557,11 @@ const nodeConverters = [
|
|
|
1541
1557
|
const flags = buffer[position++];
|
|
1542
1558
|
const async = (flags & 1) === 1;
|
|
1543
1559
|
const generator = (flags & 2) === 2;
|
|
1560
|
+
const annotations = convertAnnotations(buffer[position++], buffer);
|
|
1544
1561
|
const idPosition = buffer[position++];
|
|
1545
1562
|
const id = idPosition === 0 ? null : convertNode(idPosition, buffer, readString);
|
|
1546
1563
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
1547
|
-
const body = convertNode(buffer[position
|
|
1548
|
-
const annotations = convertAnnotations(position, buffer);
|
|
1564
|
+
const body = convertNode(buffer[position], buffer, readString);
|
|
1549
1565
|
return {
|
|
1550
1566
|
type: 'FunctionDeclaration',
|
|
1551
1567
|
start,
|
|
@@ -1565,11 +1581,11 @@ const nodeConverters = [
|
|
|
1565
1581
|
const flags = buffer[position++];
|
|
1566
1582
|
const async = (flags & 1) === 1;
|
|
1567
1583
|
const generator = (flags & 2) === 2;
|
|
1584
|
+
const annotations = convertAnnotations(buffer[position++], buffer);
|
|
1568
1585
|
const idPosition = buffer[position++];
|
|
1569
1586
|
const id = idPosition === 0 ? null : convertNode(idPosition, buffer, readString);
|
|
1570
1587
|
const parameters = convertNodeList(buffer[position++], buffer, readString);
|
|
1571
|
-
const body = convertNode(buffer[position
|
|
1572
|
-
const annotations = convertAnnotations(position, buffer);
|
|
1588
|
+
const body = convertNode(buffer[position], buffer, readString);
|
|
1573
1589
|
return {
|
|
1574
1590
|
type: 'FunctionExpression',
|
|
1575
1591
|
start,
|
|
@@ -1586,7 +1602,7 @@ const nodeConverters = [
|
|
|
1586
1602
|
function identifier(position, buffer, readString) {
|
|
1587
1603
|
const start = buffer[position++];
|
|
1588
1604
|
const end = buffer[position++];
|
|
1589
|
-
const name = convertString(position, buffer, readString);
|
|
1605
|
+
const name = convertString(buffer[position], buffer, readString);
|
|
1590
1606
|
return {
|
|
1591
1607
|
type: 'Identifier',
|
|
1592
1608
|
start,
|
|
@@ -1597,10 +1613,10 @@ const nodeConverters = [
|
|
|
1597
1613
|
function ifStatement(position, buffer, readString) {
|
|
1598
1614
|
const start = buffer[position++];
|
|
1599
1615
|
const end = buffer[position++];
|
|
1616
|
+
const test = convertNode(buffer[position++], buffer, readString);
|
|
1600
1617
|
const consequent = convertNode(buffer[position++], buffer, readString);
|
|
1601
|
-
const alternatePosition = buffer[position
|
|
1618
|
+
const alternatePosition = buffer[position];
|
|
1602
1619
|
const alternate = alternatePosition === 0 ? null : convertNode(alternatePosition, buffer, readString);
|
|
1603
|
-
const test = convertNode(position, buffer, readString);
|
|
1604
1620
|
return {
|
|
1605
1621
|
type: 'IfStatement',
|
|
1606
1622
|
start,
|
|
@@ -1613,8 +1629,8 @@ const nodeConverters = [
|
|
|
1613
1629
|
function importAttribute(position, buffer, readString) {
|
|
1614
1630
|
const start = buffer[position++];
|
|
1615
1631
|
const end = buffer[position++];
|
|
1616
|
-
const
|
|
1617
|
-
const
|
|
1632
|
+
const key = convertNode(buffer[position++], buffer, readString);
|
|
1633
|
+
const value = convertNode(buffer[position], buffer, readString);
|
|
1618
1634
|
return {
|
|
1619
1635
|
type: 'ImportAttribute',
|
|
1620
1636
|
start,
|
|
@@ -1626,9 +1642,9 @@ const nodeConverters = [
|
|
|
1626
1642
|
function importDeclaration(position, buffer, readString) {
|
|
1627
1643
|
const start = buffer[position++];
|
|
1628
1644
|
const end = buffer[position++];
|
|
1645
|
+
const specifiers = convertNodeList(buffer[position++], buffer, readString);
|
|
1629
1646
|
const source = convertNode(buffer[position++], buffer, readString);
|
|
1630
|
-
const attributes = convertNodeList(buffer[position
|
|
1631
|
-
const specifiers = convertNodeList(position, buffer, readString);
|
|
1647
|
+
const attributes = convertNodeList(buffer[position], buffer, readString);
|
|
1632
1648
|
return {
|
|
1633
1649
|
type: 'ImportDeclaration',
|
|
1634
1650
|
start,
|
|
@@ -1641,7 +1657,7 @@ const nodeConverters = [
|
|
|
1641
1657
|
function importDefaultSpecifier(position, buffer, readString) {
|
|
1642
1658
|
const start = buffer[position++];
|
|
1643
1659
|
const end = buffer[position++];
|
|
1644
|
-
const local = convertNode(position, buffer, readString);
|
|
1660
|
+
const local = convertNode(buffer[position], buffer, readString);
|
|
1645
1661
|
return {
|
|
1646
1662
|
type: 'ImportDefaultSpecifier',
|
|
1647
1663
|
start,
|
|
@@ -1652,9 +1668,9 @@ const nodeConverters = [
|
|
|
1652
1668
|
function importExpression(position, buffer, readString) {
|
|
1653
1669
|
const start = buffer[position++];
|
|
1654
1670
|
const end = buffer[position++];
|
|
1655
|
-
const
|
|
1671
|
+
const source = convertNode(buffer[position++], buffer, readString);
|
|
1672
|
+
const optionsPosition = buffer[position];
|
|
1656
1673
|
const options = optionsPosition === 0 ? null : convertNode(optionsPosition, buffer, readString);
|
|
1657
|
-
const source = convertNode(position, buffer, readString);
|
|
1658
1674
|
return {
|
|
1659
1675
|
type: 'ImportExpression',
|
|
1660
1676
|
start,
|
|
@@ -1666,7 +1682,7 @@ const nodeConverters = [
|
|
|
1666
1682
|
function importNamespaceSpecifier(position, buffer, readString) {
|
|
1667
1683
|
const start = buffer[position++];
|
|
1668
1684
|
const end = buffer[position++];
|
|
1669
|
-
const local = convertNode(position, buffer, readString);
|
|
1685
|
+
const local = convertNode(buffer[position], buffer, readString);
|
|
1670
1686
|
return {
|
|
1671
1687
|
type: 'ImportNamespaceSpecifier',
|
|
1672
1688
|
start,
|
|
@@ -1690,8 +1706,8 @@ const nodeConverters = [
|
|
|
1690
1706
|
function labeledStatement(position, buffer, readString) {
|
|
1691
1707
|
const start = buffer[position++];
|
|
1692
1708
|
const end = buffer[position++];
|
|
1693
|
-
const
|
|
1694
|
-
const
|
|
1709
|
+
const label = convertNode(buffer[position++], buffer, readString);
|
|
1710
|
+
const body = convertNode(buffer[position], buffer, readString);
|
|
1695
1711
|
return {
|
|
1696
1712
|
type: 'LabeledStatement',
|
|
1697
1713
|
start,
|
|
@@ -1703,8 +1719,8 @@ const nodeConverters = [
|
|
|
1703
1719
|
function literalBigInt(position, buffer, readString) {
|
|
1704
1720
|
const start = buffer[position++];
|
|
1705
1721
|
const end = buffer[position++];
|
|
1706
|
-
const
|
|
1707
|
-
const
|
|
1722
|
+
const bigint = convertString(buffer[position++], buffer, readString);
|
|
1723
|
+
const raw = convertString(buffer[position], buffer, readString);
|
|
1708
1724
|
return {
|
|
1709
1725
|
type: 'Literal',
|
|
1710
1726
|
start,
|
|
@@ -1755,8 +1771,8 @@ const nodeConverters = [
|
|
|
1755
1771
|
function literalRegExp(position, buffer, readString) {
|
|
1756
1772
|
const start = buffer[position++];
|
|
1757
1773
|
const end = buffer[position++];
|
|
1758
|
-
const
|
|
1759
|
-
const
|
|
1774
|
+
const flags = convertString(buffer[position++], buffer, readString);
|
|
1775
|
+
const pattern = convertString(buffer[position], buffer, readString);
|
|
1760
1776
|
return {
|
|
1761
1777
|
type: 'Literal',
|
|
1762
1778
|
start,
|
|
@@ -1769,9 +1785,9 @@ const nodeConverters = [
|
|
|
1769
1785
|
function literalString(position, buffer, readString) {
|
|
1770
1786
|
const start = buffer[position++];
|
|
1771
1787
|
const end = buffer[position++];
|
|
1772
|
-
const
|
|
1788
|
+
const value = convertString(buffer[position++], buffer, readString);
|
|
1789
|
+
const rawPosition = buffer[position];
|
|
1773
1790
|
const raw = rawPosition === 0 ? undefined : convertString(rawPosition, buffer, readString);
|
|
1774
|
-
const value = convertString(position, buffer, readString);
|
|
1775
1791
|
return {
|
|
1776
1792
|
type: 'Literal',
|
|
1777
1793
|
start,
|
|
@@ -1784,8 +1800,8 @@ const nodeConverters = [
|
|
|
1784
1800
|
const start = buffer[position++];
|
|
1785
1801
|
const end = buffer[position++];
|
|
1786
1802
|
const operator = FIXED_STRINGS[buffer[position++]];
|
|
1787
|
-
const
|
|
1788
|
-
const
|
|
1803
|
+
const left = convertNode(buffer[position++], buffer, readString);
|
|
1804
|
+
const right = convertNode(buffer[position], buffer, readString);
|
|
1789
1805
|
return {
|
|
1790
1806
|
type: 'LogicalExpression',
|
|
1791
1807
|
start,
|
|
@@ -1801,8 +1817,8 @@ const nodeConverters = [
|
|
|
1801
1817
|
const flags = buffer[position++];
|
|
1802
1818
|
const computed = (flags & 1) === 1;
|
|
1803
1819
|
const optional = (flags & 2) === 2;
|
|
1804
|
-
const
|
|
1805
|
-
const
|
|
1820
|
+
const object = convertNode(buffer[position++], buffer, readString);
|
|
1821
|
+
const property = convertNode(buffer[position], buffer, readString);
|
|
1806
1822
|
return {
|
|
1807
1823
|
type: 'MemberExpression',
|
|
1808
1824
|
start,
|
|
@@ -1816,8 +1832,8 @@ const nodeConverters = [
|
|
|
1816
1832
|
function metaProperty(position, buffer, readString) {
|
|
1817
1833
|
const start = buffer[position++];
|
|
1818
1834
|
const end = buffer[position++];
|
|
1819
|
-
const
|
|
1820
|
-
const
|
|
1835
|
+
const meta = convertNode(buffer[position++], buffer, readString);
|
|
1836
|
+
const property = convertNode(buffer[position], buffer, readString);
|
|
1821
1837
|
return {
|
|
1822
1838
|
type: 'MetaProperty',
|
|
1823
1839
|
start,
|
|
@@ -1832,9 +1848,9 @@ const nodeConverters = [
|
|
|
1832
1848
|
const flags = buffer[position++];
|
|
1833
1849
|
const isStatic = (flags & 1) === 1;
|
|
1834
1850
|
const computed = (flags & 2) === 2;
|
|
1851
|
+
const key = convertNode(buffer[position++], buffer, readString);
|
|
1835
1852
|
const value = convertNode(buffer[position++], buffer, readString);
|
|
1836
|
-
const kind = FIXED_STRINGS[buffer[position
|
|
1837
|
-
const key = convertNode(position, buffer, readString);
|
|
1853
|
+
const kind = FIXED_STRINGS[buffer[position]];
|
|
1838
1854
|
return {
|
|
1839
1855
|
type: 'MethodDefinition',
|
|
1840
1856
|
start,
|
|
@@ -1849,9 +1865,9 @@ const nodeConverters = [
|
|
|
1849
1865
|
function newExpression(position, buffer, readString) {
|
|
1850
1866
|
const start = buffer[position++];
|
|
1851
1867
|
const end = buffer[position++];
|
|
1868
|
+
const annotations = convertAnnotations(buffer[position++], buffer);
|
|
1852
1869
|
const callee = convertNode(buffer[position++], buffer, readString);
|
|
1853
|
-
const callArguments = convertNodeList(buffer[position
|
|
1854
|
-
const annotations = convertAnnotations(position, buffer);
|
|
1870
|
+
const callArguments = convertNodeList(buffer[position], buffer, readString);
|
|
1855
1871
|
return {
|
|
1856
1872
|
type: 'NewExpression',
|
|
1857
1873
|
start,
|
|
@@ -1864,7 +1880,7 @@ const nodeConverters = [
|
|
|
1864
1880
|
function objectExpression(position, buffer, readString) {
|
|
1865
1881
|
const start = buffer[position++];
|
|
1866
1882
|
const end = buffer[position++];
|
|
1867
|
-
const properties = convertNodeList(position, buffer, readString);
|
|
1883
|
+
const properties = convertNodeList(buffer[position], buffer, readString);
|
|
1868
1884
|
return {
|
|
1869
1885
|
type: 'ObjectExpression',
|
|
1870
1886
|
start,
|
|
@@ -1875,7 +1891,7 @@ const nodeConverters = [
|
|
|
1875
1891
|
function objectPattern(position, buffer, readString) {
|
|
1876
1892
|
const start = buffer[position++];
|
|
1877
1893
|
const end = buffer[position++];
|
|
1878
|
-
const properties = convertNodeList(position, buffer, readString);
|
|
1894
|
+
const properties = convertNodeList(buffer[position], buffer, readString);
|
|
1879
1895
|
return {
|
|
1880
1896
|
type: 'ObjectPattern',
|
|
1881
1897
|
start,
|
|
@@ -1886,7 +1902,7 @@ const nodeConverters = [
|
|
|
1886
1902
|
function privateIdentifier(position, buffer, readString) {
|
|
1887
1903
|
const start = buffer[position++];
|
|
1888
1904
|
const end = buffer[position++];
|
|
1889
|
-
const name = convertString(position, buffer, readString);
|
|
1905
|
+
const name = convertString(buffer[position], buffer, readString);
|
|
1890
1906
|
return {
|
|
1891
1907
|
type: 'PrivateIdentifier',
|
|
1892
1908
|
start,
|
|
@@ -1897,8 +1913,8 @@ const nodeConverters = [
|
|
|
1897
1913
|
function program(position, buffer, readString) {
|
|
1898
1914
|
const start = buffer[position++];
|
|
1899
1915
|
const end = buffer[position++];
|
|
1900
|
-
const
|
|
1901
|
-
const
|
|
1916
|
+
const body = convertNodeList(buffer[position++], buffer, readString);
|
|
1917
|
+
const invalidAnnotations = convertAnnotations(buffer[position], buffer);
|
|
1902
1918
|
return {
|
|
1903
1919
|
type: 'Program',
|
|
1904
1920
|
start,
|
|
@@ -1936,9 +1952,9 @@ const nodeConverters = [
|
|
|
1936
1952
|
const flags = buffer[position++];
|
|
1937
1953
|
const isStatic = (flags & 1) === 1;
|
|
1938
1954
|
const computed = (flags & 2) === 2;
|
|
1939
|
-
const
|
|
1955
|
+
const key = convertNode(buffer[position++], buffer, readString);
|
|
1956
|
+
const valuePosition = buffer[position];
|
|
1940
1957
|
const value = valuePosition === 0 ? null : convertNode(valuePosition, buffer, readString);
|
|
1941
|
-
const key = convertNode(position, buffer, readString);
|
|
1942
1958
|
return {
|
|
1943
1959
|
type: 'PropertyDefinition',
|
|
1944
1960
|
start,
|
|
@@ -1952,7 +1968,7 @@ const nodeConverters = [
|
|
|
1952
1968
|
function restElement(position, buffer, readString) {
|
|
1953
1969
|
const start = buffer[position++];
|
|
1954
1970
|
const end = buffer[position++];
|
|
1955
|
-
const argument = convertNode(position, buffer, readString);
|
|
1971
|
+
const argument = convertNode(buffer[position], buffer, readString);
|
|
1956
1972
|
return {
|
|
1957
1973
|
type: 'RestElement',
|
|
1958
1974
|
start,
|
|
@@ -1975,7 +1991,7 @@ const nodeConverters = [
|
|
|
1975
1991
|
function sequenceExpression(position, buffer, readString) {
|
|
1976
1992
|
const start = buffer[position++];
|
|
1977
1993
|
const end = buffer[position++];
|
|
1978
|
-
const expressions = convertNodeList(position, buffer, readString);
|
|
1994
|
+
const expressions = convertNodeList(buffer[position], buffer, readString);
|
|
1979
1995
|
return {
|
|
1980
1996
|
type: 'SequenceExpression',
|
|
1981
1997
|
start,
|
|
@@ -1986,7 +2002,7 @@ const nodeConverters = [
|
|
|
1986
2002
|
function spreadElement(position, buffer, readString) {
|
|
1987
2003
|
const start = buffer[position++];
|
|
1988
2004
|
const end = buffer[position++];
|
|
1989
|
-
const argument = convertNode(position, buffer, readString);
|
|
2005
|
+
const argument = convertNode(buffer[position], buffer, readString);
|
|
1990
2006
|
return {
|
|
1991
2007
|
type: 'SpreadElement',
|
|
1992
2008
|
start,
|
|
@@ -1997,7 +2013,7 @@ const nodeConverters = [
|
|
|
1997
2013
|
function staticBlock(position, buffer, readString) {
|
|
1998
2014
|
const start = buffer[position++];
|
|
1999
2015
|
const end = buffer[position++];
|
|
2000
|
-
const body = convertNodeList(position, buffer, readString);
|
|
2016
|
+
const body = convertNodeList(buffer[position], buffer, readString);
|
|
2001
2017
|
return {
|
|
2002
2018
|
type: 'StaticBlock',
|
|
2003
2019
|
start,
|
|
@@ -2031,8 +2047,8 @@ const nodeConverters = [
|
|
|
2031
2047
|
function switchStatement(position, buffer, readString) {
|
|
2032
2048
|
const start = buffer[position++];
|
|
2033
2049
|
const end = buffer[position++];
|
|
2034
|
-
const
|
|
2035
|
-
const
|
|
2050
|
+
const discriminant = convertNode(buffer[position++], buffer, readString);
|
|
2051
|
+
const cases = convertNodeList(buffer[position], buffer, readString);
|
|
2036
2052
|
return {
|
|
2037
2053
|
type: 'SwitchStatement',
|
|
2038
2054
|
start,
|
|
@@ -2044,8 +2060,8 @@ const nodeConverters = [
|
|
|
2044
2060
|
function taggedTemplateExpression(position, buffer, readString) {
|
|
2045
2061
|
const start = buffer[position++];
|
|
2046
2062
|
const end = buffer[position++];
|
|
2047
|
-
const
|
|
2048
|
-
const
|
|
2063
|
+
const tag = convertNode(buffer[position++], buffer, readString);
|
|
2064
|
+
const quasi = convertNode(buffer[position], buffer, readString);
|
|
2049
2065
|
return {
|
|
2050
2066
|
type: 'TaggedTemplateExpression',
|
|
2051
2067
|
start,
|
|
@@ -2061,7 +2077,7 @@ const nodeConverters = [
|
|
|
2061
2077
|
const tail = (flags & 1) === 1;
|
|
2062
2078
|
const cookedPosition = buffer[position++];
|
|
2063
2079
|
const cooked = cookedPosition === 0 ? undefined : convertString(cookedPosition, buffer, readString);
|
|
2064
|
-
const raw = convertString(position, buffer, readString);
|
|
2080
|
+
const raw = convertString(buffer[position], buffer, readString);
|
|
2065
2081
|
return {
|
|
2066
2082
|
type: 'TemplateElement',
|
|
2067
2083
|
start,
|
|
@@ -2073,8 +2089,8 @@ const nodeConverters = [
|
|
|
2073
2089
|
function templateLiteral(position, buffer, readString) {
|
|
2074
2090
|
const start = buffer[position++];
|
|
2075
2091
|
const end = buffer[position++];
|
|
2076
|
-
const
|
|
2077
|
-
const
|
|
2092
|
+
const quasis = convertNodeList(buffer[position++], buffer, readString);
|
|
2093
|
+
const expressions = convertNodeList(buffer[position], buffer, readString);
|
|
2078
2094
|
return {
|
|
2079
2095
|
type: 'TemplateLiteral',
|
|
2080
2096
|
start,
|
|
@@ -2095,7 +2111,7 @@ const nodeConverters = [
|
|
|
2095
2111
|
function throwStatement(position, buffer, readString) {
|
|
2096
2112
|
const start = buffer[position++];
|
|
2097
2113
|
const end = buffer[position++];
|
|
2098
|
-
const argument = convertNode(position, buffer, readString);
|
|
2114
|
+
const argument = convertNode(buffer[position], buffer, readString);
|
|
2099
2115
|
return {
|
|
2100
2116
|
type: 'ThrowStatement',
|
|
2101
2117
|
start,
|
|
@@ -2106,11 +2122,11 @@ const nodeConverters = [
|
|
|
2106
2122
|
function tryStatement(position, buffer, readString) {
|
|
2107
2123
|
const start = buffer[position++];
|
|
2108
2124
|
const end = buffer[position++];
|
|
2125
|
+
const block = convertNode(buffer[position++], buffer, readString);
|
|
2109
2126
|
const handlerPosition = buffer[position++];
|
|
2110
2127
|
const handler = handlerPosition === 0 ? null : convertNode(handlerPosition, buffer, readString);
|
|
2111
|
-
const finalizerPosition = buffer[position
|
|
2128
|
+
const finalizerPosition = buffer[position];
|
|
2112
2129
|
const finalizer = finalizerPosition === 0 ? null : convertNode(finalizerPosition, buffer, readString);
|
|
2113
|
-
const block = convertNode(position, buffer, readString);
|
|
2114
2130
|
return {
|
|
2115
2131
|
type: 'TryStatement',
|
|
2116
2132
|
start,
|
|
@@ -2124,7 +2140,7 @@ const nodeConverters = [
|
|
|
2124
2140
|
const start = buffer[position++];
|
|
2125
2141
|
const end = buffer[position++];
|
|
2126
2142
|
const operator = FIXED_STRINGS[buffer[position++]];
|
|
2127
|
-
const argument = convertNode(position, buffer, readString);
|
|
2143
|
+
const argument = convertNode(buffer[position], buffer, readString);
|
|
2128
2144
|
return {
|
|
2129
2145
|
type: 'UnaryExpression',
|
|
2130
2146
|
start,
|
|
@@ -2140,7 +2156,7 @@ const nodeConverters = [
|
|
|
2140
2156
|
const flags = buffer[position++];
|
|
2141
2157
|
const prefix = (flags & 1) === 1;
|
|
2142
2158
|
const operator = FIXED_STRINGS[buffer[position++]];
|
|
2143
|
-
const argument = convertNode(position, buffer, readString);
|
|
2159
|
+
const argument = convertNode(buffer[position], buffer, readString);
|
|
2144
2160
|
return {
|
|
2145
2161
|
type: 'UpdateExpression',
|
|
2146
2162
|
start,
|
|
@@ -2154,7 +2170,7 @@ const nodeConverters = [
|
|
|
2154
2170
|
const start = buffer[position++];
|
|
2155
2171
|
const end = buffer[position++];
|
|
2156
2172
|
const kind = FIXED_STRINGS[buffer[position++]];
|
|
2157
|
-
const declarations = convertNodeList(position, buffer, readString);
|
|
2173
|
+
const declarations = convertNodeList(buffer[position], buffer, readString);
|
|
2158
2174
|
return {
|
|
2159
2175
|
type: 'VariableDeclaration',
|
|
2160
2176
|
start,
|
|
@@ -2166,9 +2182,9 @@ const nodeConverters = [
|
|
|
2166
2182
|
function variableDeclarator(position, buffer, readString) {
|
|
2167
2183
|
const start = buffer[position++];
|
|
2168
2184
|
const end = buffer[position++];
|
|
2169
|
-
const
|
|
2185
|
+
const id = convertNode(buffer[position++], buffer, readString);
|
|
2186
|
+
const initPosition = buffer[position];
|
|
2170
2187
|
const init = initPosition === 0 ? null : convertNode(initPosition, buffer, readString);
|
|
2171
|
-
const id = convertNode(position, buffer, readString);
|
|
2172
2188
|
return {
|
|
2173
2189
|
type: 'VariableDeclarator',
|
|
2174
2190
|
start,
|
|
@@ -2180,8 +2196,8 @@ const nodeConverters = [
|
|
|
2180
2196
|
function whileStatement(position, buffer, readString) {
|
|
2181
2197
|
const start = buffer[position++];
|
|
2182
2198
|
const end = buffer[position++];
|
|
2183
|
-
const
|
|
2184
|
-
const
|
|
2199
|
+
const test = convertNode(buffer[position++], buffer, readString);
|
|
2200
|
+
const body = convertNode(buffer[position], buffer, readString);
|
|
2185
2201
|
return {
|
|
2186
2202
|
type: 'WhileStatement',
|
|
2187
2203
|
start,
|
|
@@ -2217,6 +2233,8 @@ function convertNode(position, buffer, readString) {
|
|
|
2217
2233
|
return converter(position + 1, buffer, readString);
|
|
2218
2234
|
}
|
|
2219
2235
|
function convertNodeList(position, buffer, readString) {
|
|
2236
|
+
if (position === 0)
|
|
2237
|
+
return EMPTY_ARRAY;
|
|
2220
2238
|
const length = buffer[position++];
|
|
2221
2239
|
const list = [];
|
|
2222
2240
|
for (let index = 0; index < length; index++) {
|
|
@@ -2251,9 +2269,13 @@ const parseAstAsync = async (input, { allowReturnOutsideFunction = false, signal
|
|
|
2251
2269
|
|
|
2252
2270
|
exports.ANNOTATION_KEY = ANNOTATION_KEY;
|
|
2253
2271
|
exports.ArrowFunctionExpression = ArrowFunctionExpression;
|
|
2272
|
+
exports.BLANK = BLANK;
|
|
2254
2273
|
exports.BlockStatement = BlockStatement;
|
|
2255
2274
|
exports.CallExpression = CallExpression;
|
|
2256
2275
|
exports.CatchClause = CatchClause;
|
|
2276
|
+
exports.EMPTY_ARRAY = EMPTY_ARRAY;
|
|
2277
|
+
exports.EMPTY_OBJECT = EMPTY_OBJECT;
|
|
2278
|
+
exports.EMPTY_SET = EMPTY_SET;
|
|
2257
2279
|
exports.ExpressionStatement = ExpressionStatement;
|
|
2258
2280
|
exports.FIXED_STRINGS = FIXED_STRINGS;
|
|
2259
2281
|
exports.INVALID_ANNOTATION_KEY = INVALID_ANNOTATION_KEY;
|