@rollup/wasm-node 4.18.0 → 4.19.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/LICENSE.md +1 -1
- 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 +431 -397
- package/dist/es/shared/parseAst.js +491 -790
- package/dist/es/shared/watch.js +65 -52
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.d.ts +19 -3
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +65 -52
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +492 -791
- package/dist/shared/rollup.js +430 -396
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/dist/wasm-node/bindings_wasm.js +5 -5
- package/dist/wasm-node/bindings_wasm_bg.wasm +0 -0
- package/package.json +38 -33
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.19.0
|
|
4
|
+
Sat, 20 Jul 2024 05:45:44 GMT - commit 28546b5821efcb72c2eb05f422d986524647a0e3
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
|
|
|
31
31
|
|
|
32
32
|
const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
|
|
33
33
|
|
|
34
|
-
var version = "4.
|
|
34
|
+
var version = "4.19.0";
|
|
35
35
|
|
|
36
36
|
function ensureArray$1(items) {
|
|
37
37
|
if (Array.isArray(items)) {
|
|
@@ -1500,6 +1500,42 @@ for (let i = 0; i < chars.length; i++) {
|
|
|
1500
1500
|
intToChar[i] = c;
|
|
1501
1501
|
charToInt[c] = i;
|
|
1502
1502
|
}
|
|
1503
|
+
function decodeInteger(reader, relative) {
|
|
1504
|
+
let value = 0;
|
|
1505
|
+
let shift = 0;
|
|
1506
|
+
let integer = 0;
|
|
1507
|
+
do {
|
|
1508
|
+
const c = reader.next();
|
|
1509
|
+
integer = charToInt[c];
|
|
1510
|
+
value |= (integer & 31) << shift;
|
|
1511
|
+
shift += 5;
|
|
1512
|
+
} while (integer & 32);
|
|
1513
|
+
const shouldNegate = value & 1;
|
|
1514
|
+
value >>>= 1;
|
|
1515
|
+
if (shouldNegate) {
|
|
1516
|
+
value = -0x80000000 | -value;
|
|
1517
|
+
}
|
|
1518
|
+
return relative + value;
|
|
1519
|
+
}
|
|
1520
|
+
function encodeInteger(builder, num, relative) {
|
|
1521
|
+
let delta = num - relative;
|
|
1522
|
+
delta = delta < 0 ? (-delta << 1) | 1 : delta << 1;
|
|
1523
|
+
do {
|
|
1524
|
+
let clamped = delta & 0b011111;
|
|
1525
|
+
delta >>>= 5;
|
|
1526
|
+
if (delta > 0)
|
|
1527
|
+
clamped |= 0b100000;
|
|
1528
|
+
builder.write(intToChar[clamped]);
|
|
1529
|
+
} while (delta > 0);
|
|
1530
|
+
return num;
|
|
1531
|
+
}
|
|
1532
|
+
function hasMoreVlq(reader, max) {
|
|
1533
|
+
if (reader.pos >= max)
|
|
1534
|
+
return false;
|
|
1535
|
+
return reader.peek() !== comma;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
const bufLength = 1024 * 16;
|
|
1503
1539
|
// Provide a fallback for older environments.
|
|
1504
1540
|
const td = typeof TextDecoder !== 'undefined'
|
|
1505
1541
|
? /* #__PURE__ */ new TextDecoder()
|
|
@@ -1519,74 +1555,89 @@ const td = typeof TextDecoder !== 'undefined'
|
|
|
1519
1555
|
return out;
|
|
1520
1556
|
},
|
|
1521
1557
|
};
|
|
1558
|
+
class StringWriter {
|
|
1559
|
+
constructor() {
|
|
1560
|
+
this.pos = 0;
|
|
1561
|
+
this.out = '';
|
|
1562
|
+
this.buffer = new Uint8Array(bufLength);
|
|
1563
|
+
}
|
|
1564
|
+
write(v) {
|
|
1565
|
+
const { buffer } = this;
|
|
1566
|
+
buffer[this.pos++] = v;
|
|
1567
|
+
if (this.pos === bufLength) {
|
|
1568
|
+
this.out += td.decode(buffer);
|
|
1569
|
+
this.pos = 0;
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
flush() {
|
|
1573
|
+
const { buffer, out, pos } = this;
|
|
1574
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
class StringReader {
|
|
1578
|
+
constructor(buffer) {
|
|
1579
|
+
this.pos = 0;
|
|
1580
|
+
this.buffer = buffer;
|
|
1581
|
+
}
|
|
1582
|
+
next() {
|
|
1583
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
1584
|
+
}
|
|
1585
|
+
peek() {
|
|
1586
|
+
return this.buffer.charCodeAt(this.pos);
|
|
1587
|
+
}
|
|
1588
|
+
indexOf(char) {
|
|
1589
|
+
const { buffer, pos } = this;
|
|
1590
|
+
const idx = buffer.indexOf(char, pos);
|
|
1591
|
+
return idx === -1 ? buffer.length : idx;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1522
1595
|
function decode(mappings) {
|
|
1523
|
-
const
|
|
1596
|
+
const { length } = mappings;
|
|
1597
|
+
const reader = new StringReader(mappings);
|
|
1524
1598
|
const decoded = [];
|
|
1525
|
-
let
|
|
1599
|
+
let genColumn = 0;
|
|
1600
|
+
let sourcesIndex = 0;
|
|
1601
|
+
let sourceLine = 0;
|
|
1602
|
+
let sourceColumn = 0;
|
|
1603
|
+
let namesIndex = 0;
|
|
1526
1604
|
do {
|
|
1527
|
-
const semi = indexOf(
|
|
1605
|
+
const semi = reader.indexOf(';');
|
|
1528
1606
|
const line = [];
|
|
1529
1607
|
let sorted = true;
|
|
1530
1608
|
let lastCol = 0;
|
|
1531
|
-
|
|
1532
|
-
|
|
1609
|
+
genColumn = 0;
|
|
1610
|
+
while (reader.pos < semi) {
|
|
1533
1611
|
let seg;
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
if (col < lastCol)
|
|
1612
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
1613
|
+
if (genColumn < lastCol)
|
|
1537
1614
|
sorted = false;
|
|
1538
|
-
lastCol =
|
|
1539
|
-
if (hasMoreVlq(
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
if (hasMoreVlq(
|
|
1544
|
-
|
|
1545
|
-
seg = [
|
|
1615
|
+
lastCol = genColumn;
|
|
1616
|
+
if (hasMoreVlq(reader, semi)) {
|
|
1617
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
1618
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
1619
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
1620
|
+
if (hasMoreVlq(reader, semi)) {
|
|
1621
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
1622
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
|
|
1546
1623
|
}
|
|
1547
1624
|
else {
|
|
1548
|
-
seg = [
|
|
1625
|
+
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
|
|
1549
1626
|
}
|
|
1550
1627
|
}
|
|
1551
1628
|
else {
|
|
1552
|
-
seg = [
|
|
1629
|
+
seg = [genColumn];
|
|
1553
1630
|
}
|
|
1554
1631
|
line.push(seg);
|
|
1632
|
+
reader.pos++;
|
|
1555
1633
|
}
|
|
1556
1634
|
if (!sorted)
|
|
1557
1635
|
sort(line);
|
|
1558
1636
|
decoded.push(line);
|
|
1559
|
-
|
|
1560
|
-
} while (
|
|
1637
|
+
reader.pos = semi + 1;
|
|
1638
|
+
} while (reader.pos <= length);
|
|
1561
1639
|
return decoded;
|
|
1562
1640
|
}
|
|
1563
|
-
function indexOf(mappings, index) {
|
|
1564
|
-
const idx = mappings.indexOf(';', index);
|
|
1565
|
-
return idx === -1 ? mappings.length : idx;
|
|
1566
|
-
}
|
|
1567
|
-
function decodeInteger(mappings, pos, state, j) {
|
|
1568
|
-
let value = 0;
|
|
1569
|
-
let shift = 0;
|
|
1570
|
-
let integer = 0;
|
|
1571
|
-
do {
|
|
1572
|
-
const c = mappings.charCodeAt(pos++);
|
|
1573
|
-
integer = charToInt[c];
|
|
1574
|
-
value |= (integer & 31) << shift;
|
|
1575
|
-
shift += 5;
|
|
1576
|
-
} while (integer & 32);
|
|
1577
|
-
const shouldNegate = value & 1;
|
|
1578
|
-
value >>>= 1;
|
|
1579
|
-
if (shouldNegate) {
|
|
1580
|
-
value = -0x80000000 | -value;
|
|
1581
|
-
}
|
|
1582
|
-
state[j] += value;
|
|
1583
|
-
return pos;
|
|
1584
|
-
}
|
|
1585
|
-
function hasMoreVlq(mappings, i, length) {
|
|
1586
|
-
if (i >= length)
|
|
1587
|
-
return false;
|
|
1588
|
-
return mappings.charCodeAt(i) !== comma;
|
|
1589
|
-
}
|
|
1590
1641
|
function sort(line) {
|
|
1591
1642
|
line.sort(sortComparator);
|
|
1592
1643
|
}
|
|
@@ -1594,62 +1645,34 @@ function sortComparator(a, b) {
|
|
|
1594
1645
|
return a[0] - b[0];
|
|
1595
1646
|
}
|
|
1596
1647
|
function encode(decoded) {
|
|
1597
|
-
const
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
let pos = 0;
|
|
1603
|
-
let out = '';
|
|
1648
|
+
const writer = new StringWriter();
|
|
1649
|
+
let sourcesIndex = 0;
|
|
1650
|
+
let sourceLine = 0;
|
|
1651
|
+
let sourceColumn = 0;
|
|
1652
|
+
let namesIndex = 0;
|
|
1604
1653
|
for (let i = 0; i < decoded.length; i++) {
|
|
1605
1654
|
const line = decoded[i];
|
|
1606
|
-
if (i > 0)
|
|
1607
|
-
|
|
1608
|
-
out += td.decode(buf);
|
|
1609
|
-
pos = 0;
|
|
1610
|
-
}
|
|
1611
|
-
buf[pos++] = semicolon;
|
|
1612
|
-
}
|
|
1655
|
+
if (i > 0)
|
|
1656
|
+
writer.write(semicolon);
|
|
1613
1657
|
if (line.length === 0)
|
|
1614
1658
|
continue;
|
|
1615
|
-
|
|
1659
|
+
let genColumn = 0;
|
|
1616
1660
|
for (let j = 0; j < line.length; j++) {
|
|
1617
1661
|
const segment = line[j];
|
|
1618
|
-
// We can push up to 5 ints, each int can take at most 7 chars, and we
|
|
1619
|
-
// may push a comma.
|
|
1620
|
-
if (pos > subLength) {
|
|
1621
|
-
out += td.decode(sub);
|
|
1622
|
-
buf.copyWithin(0, subLength, pos);
|
|
1623
|
-
pos -= subLength;
|
|
1624
|
-
}
|
|
1625
1662
|
if (j > 0)
|
|
1626
|
-
|
|
1627
|
-
|
|
1663
|
+
writer.write(comma);
|
|
1664
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
1628
1665
|
if (segment.length === 1)
|
|
1629
1666
|
continue;
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1667
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
1668
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
1669
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
1633
1670
|
if (segment.length === 4)
|
|
1634
1671
|
continue;
|
|
1635
|
-
|
|
1672
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
1636
1673
|
}
|
|
1637
1674
|
}
|
|
1638
|
-
return
|
|
1639
|
-
}
|
|
1640
|
-
function encodeInteger(buf, pos, state, segment, j) {
|
|
1641
|
-
const next = segment[j];
|
|
1642
|
-
let num = next - state[j];
|
|
1643
|
-
state[j] = next;
|
|
1644
|
-
num = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
1645
|
-
do {
|
|
1646
|
-
let clamped = num & 0b011111;
|
|
1647
|
-
num >>>= 5;
|
|
1648
|
-
if (num > 0)
|
|
1649
|
-
clamped |= 0b100000;
|
|
1650
|
-
buf[pos++] = intToChar[clamped];
|
|
1651
|
-
} while (num > 0);
|
|
1652
|
-
return pos;
|
|
1675
|
+
return writer.flush();
|
|
1653
1676
|
}
|
|
1654
1677
|
|
|
1655
1678
|
class BitSet {
|
|
@@ -6132,11 +6155,12 @@ const childNodeKeys = {
|
|
|
6132
6155
|
CatchClause: ['param', 'body'],
|
|
6133
6156
|
ChainExpression: ['expression'],
|
|
6134
6157
|
ClassBody: ['body'],
|
|
6135
|
-
ClassDeclaration: ['id', 'superClass', 'body'],
|
|
6136
|
-
ClassExpression: ['id', 'superClass', 'body'],
|
|
6158
|
+
ClassDeclaration: ['decorators', 'id', 'superClass', 'body'],
|
|
6159
|
+
ClassExpression: ['decorators', 'id', 'superClass', 'body'],
|
|
6137
6160
|
ConditionalExpression: ['test', 'consequent', 'alternate'],
|
|
6138
6161
|
ContinueStatement: ['label'],
|
|
6139
6162
|
DebuggerStatement: [],
|
|
6163
|
+
Decorator: ['expression'],
|
|
6140
6164
|
DoWhileStatement: ['body', 'test'],
|
|
6141
6165
|
EmptyStatement: [],
|
|
6142
6166
|
ExportAllDeclaration: ['exported', 'source', 'attributes'],
|
|
@@ -6162,7 +6186,7 @@ const childNodeKeys = {
|
|
|
6162
6186
|
LogicalExpression: ['left', 'right'],
|
|
6163
6187
|
MemberExpression: ['object', 'property'],
|
|
6164
6188
|
MetaProperty: ['meta', 'property'],
|
|
6165
|
-
MethodDefinition: ['key', 'value'],
|
|
6189
|
+
MethodDefinition: ['decorators', 'key', 'value'],
|
|
6166
6190
|
NewExpression: ['callee', 'arguments'],
|
|
6167
6191
|
ObjectExpression: ['properties'],
|
|
6168
6192
|
ObjectPattern: ['properties'],
|
|
@@ -6171,7 +6195,7 @@ const childNodeKeys = {
|
|
|
6171
6195
|
PrivateIdentifier: [],
|
|
6172
6196
|
Program: ['body'],
|
|
6173
6197
|
Property: ['key', 'value'],
|
|
6174
|
-
PropertyDefinition: ['key', 'value'],
|
|
6198
|
+
PropertyDefinition: ['decorators', 'key', 'value'],
|
|
6175
6199
|
RestElement: ['argument'],
|
|
6176
6200
|
ReturnStatement: ['argument'],
|
|
6177
6201
|
SequenceExpression: ['expressions'],
|
|
@@ -6656,10 +6680,10 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
6656
6680
|
}
|
|
6657
6681
|
const key = path[0];
|
|
6658
6682
|
if (path.length === 1) {
|
|
6659
|
-
if (
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6683
|
+
if (key === UnknownInteger) {
|
|
6684
|
+
return this.deoptimizeIntegerProperties();
|
|
6685
|
+
}
|
|
6686
|
+
else if (typeof key !== 'string') {
|
|
6663
6687
|
return this.deoptimizeAllProperties(key === UnknownNonAccessorKey);
|
|
6664
6688
|
}
|
|
6665
6689
|
if (!this.deoptimizedPaths[key]) {
|
|
@@ -10727,6 +10751,15 @@ class ClassBody extends NodeBase {
|
|
|
10727
10751
|
applyDeoptimizations() { }
|
|
10728
10752
|
}
|
|
10729
10753
|
|
|
10754
|
+
function checkEffectForNodes(nodes, context) {
|
|
10755
|
+
for (const node of nodes) {
|
|
10756
|
+
if (node.hasEffects(context)) {
|
|
10757
|
+
return true;
|
|
10758
|
+
}
|
|
10759
|
+
}
|
|
10760
|
+
return false;
|
|
10761
|
+
}
|
|
10762
|
+
|
|
10730
10763
|
class MethodBase extends NodeBase {
|
|
10731
10764
|
constructor() {
|
|
10732
10765
|
super(...arguments);
|
|
@@ -10804,9 +10837,44 @@ class MethodBase extends NodeBase {
|
|
|
10804
10837
|
}
|
|
10805
10838
|
|
|
10806
10839
|
class MethodDefinition extends MethodBase {
|
|
10840
|
+
hasEffects(context) {
|
|
10841
|
+
return super.hasEffects(context) || checkEffectForNodes(this.decorators, context);
|
|
10842
|
+
}
|
|
10807
10843
|
applyDeoptimizations() { }
|
|
10808
10844
|
}
|
|
10809
10845
|
|
|
10846
|
+
class StaticBlock extends NodeBase {
|
|
10847
|
+
createScope(parentScope) {
|
|
10848
|
+
this.scope = new BlockScope(parentScope);
|
|
10849
|
+
}
|
|
10850
|
+
hasEffects(context) {
|
|
10851
|
+
for (const node of this.body) {
|
|
10852
|
+
if (node.hasEffects(context))
|
|
10853
|
+
return true;
|
|
10854
|
+
}
|
|
10855
|
+
return false;
|
|
10856
|
+
}
|
|
10857
|
+
include(context, includeChildrenRecursively) {
|
|
10858
|
+
this.included = true;
|
|
10859
|
+
for (const node of this.body) {
|
|
10860
|
+
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
10861
|
+
node.include(context, includeChildrenRecursively);
|
|
10862
|
+
}
|
|
10863
|
+
}
|
|
10864
|
+
render(code, options) {
|
|
10865
|
+
if (this.body.length > 0) {
|
|
10866
|
+
const bodyStartPos = findFirstOccurrenceOutsideComment(code.original.slice(this.start, this.end), '{') + 1;
|
|
10867
|
+
renderStatementList(this.body, code, this.start + bodyStartPos, this.end - 1, options);
|
|
10868
|
+
}
|
|
10869
|
+
else {
|
|
10870
|
+
super.render(code, options);
|
|
10871
|
+
}
|
|
10872
|
+
}
|
|
10873
|
+
}
|
|
10874
|
+
function isStaticBlock(statement) {
|
|
10875
|
+
return statement.type === parseAst_js.StaticBlock;
|
|
10876
|
+
}
|
|
10877
|
+
|
|
10810
10878
|
class ObjectMember extends ExpressionEntity {
|
|
10811
10879
|
constructor(object, key) {
|
|
10812
10880
|
super();
|
|
@@ -10858,7 +10926,7 @@ class ClassNode extends NodeBase {
|
|
|
10858
10926
|
this.applyDeoptimizations();
|
|
10859
10927
|
const initEffect = this.superClass?.hasEffects(context) || this.body.hasEffects(context);
|
|
10860
10928
|
this.id?.markDeclarationReached();
|
|
10861
|
-
return initEffect || super.hasEffects(context);
|
|
10929
|
+
return initEffect || super.hasEffects(context) || checkEffectForNodes(this.decorators, context);
|
|
10862
10930
|
}
|
|
10863
10931
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
10864
10932
|
return interaction.type === INTERACTION_CALLED && path.length === 0
|
|
@@ -10875,6 +10943,8 @@ class ClassNode extends NodeBase {
|
|
|
10875
10943
|
this.included = true;
|
|
10876
10944
|
this.superClass?.include(context, includeChildrenRecursively);
|
|
10877
10945
|
this.body.include(context, includeChildrenRecursively);
|
|
10946
|
+
for (const decorator of this.decorators)
|
|
10947
|
+
decorator.include(context, includeChildrenRecursively);
|
|
10878
10948
|
if (this.id) {
|
|
10879
10949
|
this.id.markDeclarationReached();
|
|
10880
10950
|
this.id.include();
|
|
@@ -10894,8 +10964,9 @@ class ClassNode extends NodeBase {
|
|
|
10894
10964
|
applyDeoptimizations() {
|
|
10895
10965
|
this.deoptimized = true;
|
|
10896
10966
|
for (const definition of this.body.body) {
|
|
10897
|
-
if (!(definition
|
|
10898
|
-
(definition
|
|
10967
|
+
if (!isStaticBlock(definition) &&
|
|
10968
|
+
!(definition.static ||
|
|
10969
|
+
(definition instanceof MethodDefinition && definition.kind === 'constructor'))) {
|
|
10899
10970
|
// Calls to methods are not tracked, ensure that the return value is deoptimized
|
|
10900
10971
|
definition.deoptimizePath(UNKNOWN_PATH);
|
|
10901
10972
|
}
|
|
@@ -10909,6 +10980,8 @@ class ClassNode extends NodeBase {
|
|
|
10909
10980
|
const staticProperties = [];
|
|
10910
10981
|
const dynamicMethods = [];
|
|
10911
10982
|
for (const definition of this.body.body) {
|
|
10983
|
+
if (isStaticBlock(definition))
|
|
10984
|
+
continue;
|
|
10912
10985
|
const properties = definition.static ? staticProperties : dynamicMethods;
|
|
10913
10986
|
const definitionKind = definition.kind;
|
|
10914
10987
|
// Note that class fields do not end up on the prototype
|
|
@@ -10965,6 +11038,7 @@ class ClassDeclaration extends ClassNode {
|
|
|
10965
11038
|
}
|
|
10966
11039
|
const renderedVariable = variable.getName(getPropertyAccess);
|
|
10967
11040
|
if (renderedVariable !== name) {
|
|
11041
|
+
this.decorators.map(decorator => decorator.render(code, options));
|
|
10968
11042
|
this.superClass?.render(code, options);
|
|
10969
11043
|
this.body.render(code, {
|
|
10970
11044
|
...options,
|
|
@@ -11200,6 +11274,13 @@ class DebuggerStatement extends NodeBase {
|
|
|
11200
11274
|
}
|
|
11201
11275
|
}
|
|
11202
11276
|
|
|
11277
|
+
class Decorator extends NodeBase {
|
|
11278
|
+
hasEffects(context) {
|
|
11279
|
+
return (this.expression.hasEffects(context) ||
|
|
11280
|
+
this.expression.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context));
|
|
11281
|
+
}
|
|
11282
|
+
}
|
|
11283
|
+
|
|
11203
11284
|
function hasLoopBodyEffects(context, body) {
|
|
11204
11285
|
const { brokenFlow, hasBreak, hasContinue, ignore } = context;
|
|
11205
11286
|
const { breaks, continues } = ignore;
|
|
@@ -12452,8 +12533,8 @@ class LogicalExpression extends NodeBase {
|
|
|
12452
12533
|
}
|
|
12453
12534
|
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
12454
12535
|
if (!this.left.included || !this.right.included) {
|
|
12455
|
-
const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
|
|
12456
12536
|
if (this.right.included) {
|
|
12537
|
+
const operatorPos = findFirstOccurrenceOutsideComment(code.original, this.operator, this.left.end);
|
|
12457
12538
|
const removePos = findNonWhiteSpace(code.original, operatorPos + 2);
|
|
12458
12539
|
code.remove(this.start, removePos);
|
|
12459
12540
|
if (preventASI) {
|
|
@@ -12462,7 +12543,7 @@ class LogicalExpression extends NodeBase {
|
|
|
12462
12543
|
this.left.removeAnnotations(code);
|
|
12463
12544
|
}
|
|
12464
12545
|
else {
|
|
12465
|
-
code.remove(
|
|
12546
|
+
code.remove(this.left.end, this.end);
|
|
12466
12547
|
}
|
|
12467
12548
|
this.getUsedBranch().render(code, options, {
|
|
12468
12549
|
isCalleeOfRenderedParent,
|
|
@@ -12922,7 +13003,9 @@ class PropertyDefinition extends NodeBase {
|
|
|
12922
13003
|
: UNKNOWN_RETURN_EXPRESSION;
|
|
12923
13004
|
}
|
|
12924
13005
|
hasEffects(context) {
|
|
12925
|
-
return this.key.hasEffects(context) ||
|
|
13006
|
+
return (this.key.hasEffects(context) ||
|
|
13007
|
+
(this.static && !!this.value?.hasEffects(context)) ||
|
|
13008
|
+
checkEffectForNodes(this.decorators, context));
|
|
12926
13009
|
}
|
|
12927
13010
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
12928
13011
|
return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
@@ -13021,35 +13104,6 @@ class SequenceExpression extends NodeBase {
|
|
|
13021
13104
|
}
|
|
13022
13105
|
}
|
|
13023
13106
|
|
|
13024
|
-
class StaticBlock extends NodeBase {
|
|
13025
|
-
createScope(parentScope) {
|
|
13026
|
-
this.scope = new BlockScope(parentScope);
|
|
13027
|
-
}
|
|
13028
|
-
hasEffects(context) {
|
|
13029
|
-
for (const node of this.body) {
|
|
13030
|
-
if (node.hasEffects(context))
|
|
13031
|
-
return true;
|
|
13032
|
-
}
|
|
13033
|
-
return false;
|
|
13034
|
-
}
|
|
13035
|
-
include(context, includeChildrenRecursively) {
|
|
13036
|
-
this.included = true;
|
|
13037
|
-
for (const node of this.body) {
|
|
13038
|
-
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
13039
|
-
node.include(context, includeChildrenRecursively);
|
|
13040
|
-
}
|
|
13041
|
-
}
|
|
13042
|
-
render(code, options) {
|
|
13043
|
-
if (this.body.length > 0) {
|
|
13044
|
-
const bodyStartPos = findFirstOccurrenceOutsideComment(code.original.slice(this.start, this.end), '{') + 1;
|
|
13045
|
-
renderStatementList(this.body, code, this.start + bodyStartPos, this.end - 1, options);
|
|
13046
|
-
}
|
|
13047
|
-
else {
|
|
13048
|
-
super.render(code, options);
|
|
13049
|
-
}
|
|
13050
|
-
}
|
|
13051
|
-
}
|
|
13052
|
-
|
|
13053
13107
|
class Super extends NodeBase {
|
|
13054
13108
|
bind() {
|
|
13055
13109
|
this.variable = this.scope.findVariable('this');
|
|
@@ -13838,7 +13892,7 @@ class YieldExpression extends NodeBase {
|
|
|
13838
13892
|
// This file is generated by scripts/generate-buffer-parsers.js.
|
|
13839
13893
|
// Do not edit this file directly.
|
|
13840
13894
|
function convertProgram(buffer, parent, parentScope) {
|
|
13841
|
-
return convertNode(parent, parentScope, 0,
|
|
13895
|
+
return convertNode(parent, parentScope, 0, parseAst_js.getAstBuffer(buffer));
|
|
13842
13896
|
}
|
|
13843
13897
|
const nodeTypeStrings = [
|
|
13844
13898
|
'PanicError',
|
|
@@ -13861,6 +13915,7 @@ const nodeTypeStrings = [
|
|
|
13861
13915
|
'ConditionalExpression',
|
|
13862
13916
|
'ContinueStatement',
|
|
13863
13917
|
'DebuggerStatement',
|
|
13918
|
+
'Decorator',
|
|
13864
13919
|
'ExpressionStatement',
|
|
13865
13920
|
'DoWhileStatement',
|
|
13866
13921
|
'EmptyStatement',
|
|
@@ -13942,6 +13997,7 @@ const nodeConstructors$1 = [
|
|
|
13942
13997
|
ConditionalExpression,
|
|
13943
13998
|
ContinueStatement,
|
|
13944
13999
|
DebuggerStatement,
|
|
14000
|
+
Decorator,
|
|
13945
14001
|
ExpressionStatement,
|
|
13946
14002
|
DoWhileStatement,
|
|
13947
14003
|
EmptyStatement,
|
|
@@ -14003,21 +14059,21 @@ const nodeConstructors$1 = [
|
|
|
14003
14059
|
YieldExpression
|
|
14004
14060
|
];
|
|
14005
14061
|
const bufferParsers = [
|
|
14006
|
-
function panicError(node, position, buffer
|
|
14007
|
-
node.message =
|
|
14062
|
+
function panicError(node, position, buffer) {
|
|
14063
|
+
node.message = buffer.convertString(buffer[position]);
|
|
14008
14064
|
},
|
|
14009
|
-
function parseError(node, position, buffer
|
|
14010
|
-
node.message =
|
|
14065
|
+
function parseError(node, position, buffer) {
|
|
14066
|
+
node.message = buffer.convertString(buffer[position]);
|
|
14011
14067
|
},
|
|
14012
|
-
function arrayExpression(node, position, buffer
|
|
14068
|
+
function arrayExpression(node, position, buffer) {
|
|
14013
14069
|
const { scope } = node;
|
|
14014
|
-
node.elements = convertNodeList(node, scope, buffer[position], buffer
|
|
14070
|
+
node.elements = convertNodeList(node, scope, buffer[position], buffer);
|
|
14015
14071
|
},
|
|
14016
|
-
function arrayPattern(node, position, buffer
|
|
14072
|
+
function arrayPattern(node, position, buffer) {
|
|
14017
14073
|
const { scope } = node;
|
|
14018
|
-
node.elements = convertNodeList(node, scope, buffer[position], buffer
|
|
14074
|
+
node.elements = convertNodeList(node, scope, buffer[position], buffer);
|
|
14019
14075
|
},
|
|
14020
|
-
function arrowFunctionExpression(node, position, buffer
|
|
14076
|
+
function arrowFunctionExpression(node, position, buffer) {
|
|
14021
14077
|
const { scope } = node;
|
|
14022
14078
|
const flags = buffer[position];
|
|
14023
14079
|
node.async = (flags & 1) === 1;
|
|
@@ -14025,64 +14081,61 @@ const bufferParsers = [
|
|
|
14025
14081
|
node.generator = (flags & 4) === 4;
|
|
14026
14082
|
const annotations = (node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer));
|
|
14027
14083
|
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
14028
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer
|
|
14084
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 2], buffer));
|
|
14029
14085
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
14030
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer
|
|
14086
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 3], buffer);
|
|
14031
14087
|
},
|
|
14032
|
-
function assignmentExpression(node, position, buffer
|
|
14088
|
+
function assignmentExpression(node, position, buffer) {
|
|
14033
14089
|
const { scope } = node;
|
|
14034
14090
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
14035
|
-
node.left = convertNode(node, scope, buffer[position + 1], buffer
|
|
14036
|
-
node.right = convertNode(node, scope, buffer[position + 2], buffer
|
|
14091
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14092
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14037
14093
|
},
|
|
14038
|
-
function assignmentPattern(node, position, buffer
|
|
14094
|
+
function assignmentPattern(node, position, buffer) {
|
|
14039
14095
|
const { scope } = node;
|
|
14040
|
-
node.left = convertNode(node, scope, buffer[position], buffer
|
|
14041
|
-
node.right = convertNode(node, scope, buffer[position + 1], buffer
|
|
14096
|
+
node.left = convertNode(node, scope, buffer[position], buffer);
|
|
14097
|
+
node.right = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14042
14098
|
},
|
|
14043
|
-
function awaitExpression(node, position, buffer
|
|
14099
|
+
function awaitExpression(node, position, buffer) {
|
|
14044
14100
|
const { scope } = node;
|
|
14045
|
-
node.argument = convertNode(node, scope, buffer[position], buffer
|
|
14101
|
+
node.argument = convertNode(node, scope, buffer[position], buffer);
|
|
14046
14102
|
},
|
|
14047
|
-
function binaryExpression(node, position, buffer
|
|
14103
|
+
function binaryExpression(node, position, buffer) {
|
|
14048
14104
|
const { scope } = node;
|
|
14049
14105
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
14050
|
-
node.left = convertNode(node, scope, buffer[position + 1], buffer
|
|
14051
|
-
node.right = convertNode(node, scope, buffer[position + 2], buffer
|
|
14106
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14107
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14052
14108
|
},
|
|
14053
|
-
function blockStatement(node, position, buffer
|
|
14109
|
+
function blockStatement(node, position, buffer) {
|
|
14054
14110
|
const { scope } = node;
|
|
14055
|
-
node.body = convertNodeList(node, scope, buffer[position], buffer
|
|
14111
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer);
|
|
14056
14112
|
},
|
|
14057
|
-
function breakStatement(node, position, buffer
|
|
14113
|
+
function breakStatement(node, position, buffer) {
|
|
14058
14114
|
const { scope } = node;
|
|
14059
14115
|
const labelPosition = buffer[position];
|
|
14060
|
-
node.label =
|
|
14061
|
-
labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer, readString);
|
|
14116
|
+
node.label = labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer);
|
|
14062
14117
|
},
|
|
14063
|
-
function callExpression(node, position, buffer
|
|
14118
|
+
function callExpression(node, position, buffer) {
|
|
14064
14119
|
const { scope } = node;
|
|
14065
14120
|
const flags = buffer[position];
|
|
14066
14121
|
node.optional = (flags & 1) === 1;
|
|
14067
14122
|
node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer);
|
|
14068
|
-
node.callee = convertNode(node, scope, buffer[position + 2], buffer
|
|
14069
|
-
node.arguments = convertNodeList(node, scope, buffer[position + 3], buffer
|
|
14123
|
+
node.callee = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14124
|
+
node.arguments = convertNodeList(node, scope, buffer[position + 3], buffer);
|
|
14070
14125
|
},
|
|
14071
|
-
function catchClause(node, position, buffer
|
|
14126
|
+
function catchClause(node, position, buffer) {
|
|
14072
14127
|
const { scope } = node;
|
|
14073
14128
|
const parameterPosition = buffer[position];
|
|
14074
14129
|
const parameter = (node.param =
|
|
14075
|
-
parameterPosition === 0
|
|
14076
|
-
? null
|
|
14077
|
-
: convertNode(node, scope, parameterPosition, buffer, readString));
|
|
14130
|
+
parameterPosition === 0 ? null : convertNode(node, scope, parameterPosition, buffer));
|
|
14078
14131
|
parameter?.declare('parameter', UNKNOWN_EXPRESSION);
|
|
14079
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 1], buffer
|
|
14132
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 1], buffer);
|
|
14080
14133
|
},
|
|
14081
|
-
function chainExpression(node, position, buffer
|
|
14134
|
+
function chainExpression(node, position, buffer) {
|
|
14082
14135
|
const { scope } = node;
|
|
14083
|
-
node.expression = convertNode(node, scope, buffer[position], buffer
|
|
14136
|
+
node.expression = convertNode(node, scope, buffer[position], buffer);
|
|
14084
14137
|
},
|
|
14085
|
-
function classBody(node, position, buffer
|
|
14138
|
+
function classBody(node, position, buffer) {
|
|
14086
14139
|
const { scope } = node;
|
|
14087
14140
|
const bodyPosition = buffer[position];
|
|
14088
14141
|
const body = (node.body = []);
|
|
@@ -14090,127 +14143,116 @@ const bufferParsers = [
|
|
|
14090
14143
|
const length = buffer[bodyPosition];
|
|
14091
14144
|
for (let index = 0; index < length; index++) {
|
|
14092
14145
|
const nodePosition = buffer[bodyPosition + 1 + index];
|
|
14093
|
-
body.push(convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer
|
|
14146
|
+
body.push(convertNode(node, (buffer[nodePosition + 3] & 1) === 0 ? scope.instanceScope : scope, nodePosition, buffer));
|
|
14094
14147
|
}
|
|
14095
14148
|
}
|
|
14096
14149
|
},
|
|
14097
|
-
function classDeclaration(node, position, buffer
|
|
14150
|
+
function classDeclaration(node, position, buffer) {
|
|
14098
14151
|
const { scope } = node;
|
|
14099
|
-
|
|
14152
|
+
node.decorators = convertNodeList(node, scope, buffer[position], buffer);
|
|
14153
|
+
const idPosition = buffer[position + 1];
|
|
14100
14154
|
node.id =
|
|
14101
|
-
idPosition === 0
|
|
14102
|
-
|
|
14103
|
-
: convertNode(node, scope.parent, idPosition, buffer, readString);
|
|
14104
|
-
const superClassPosition = buffer[position + 1];
|
|
14155
|
+
idPosition === 0 ? null : convertNode(node, scope.parent, idPosition, buffer);
|
|
14156
|
+
const superClassPosition = buffer[position + 2];
|
|
14105
14157
|
node.superClass =
|
|
14106
|
-
superClassPosition === 0
|
|
14107
|
-
|
|
14108
|
-
: convertNode(node, scope, superClassPosition, buffer, readString);
|
|
14109
|
-
node.body = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
14158
|
+
superClassPosition === 0 ? null : convertNode(node, scope, superClassPosition, buffer);
|
|
14159
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
14110
14160
|
},
|
|
14111
|
-
function classExpression(node, position, buffer
|
|
14161
|
+
function classExpression(node, position, buffer) {
|
|
14112
14162
|
const { scope } = node;
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14163
|
+
node.decorators = convertNodeList(node, scope, buffer[position], buffer);
|
|
14164
|
+
const idPosition = buffer[position + 1];
|
|
14165
|
+
node.id = idPosition === 0 ? null : convertNode(node, scope, idPosition, buffer);
|
|
14166
|
+
const superClassPosition = buffer[position + 2];
|
|
14116
14167
|
node.superClass =
|
|
14117
|
-
superClassPosition === 0
|
|
14118
|
-
|
|
14119
|
-
: convertNode(node, scope, superClassPosition, buffer, readString);
|
|
14120
|
-
node.body = convertNode(node, scope, buffer[position + 2], buffer, readString);
|
|
14168
|
+
superClassPosition === 0 ? null : convertNode(node, scope, superClassPosition, buffer);
|
|
14169
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
14121
14170
|
},
|
|
14122
|
-
function conditionalExpression(node, position, buffer
|
|
14171
|
+
function conditionalExpression(node, position, buffer) {
|
|
14123
14172
|
const { scope } = node;
|
|
14124
|
-
node.test = convertNode(node, scope, buffer[position], buffer
|
|
14125
|
-
node.consequent = convertNode(node, scope, buffer[position + 1], buffer
|
|
14126
|
-
node.alternate = convertNode(node, scope, buffer[position + 2], buffer
|
|
14173
|
+
node.test = convertNode(node, scope, buffer[position], buffer);
|
|
14174
|
+
node.consequent = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14175
|
+
node.alternate = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14127
14176
|
},
|
|
14128
|
-
function continueStatement(node, position, buffer
|
|
14177
|
+
function continueStatement(node, position, buffer) {
|
|
14129
14178
|
const { scope } = node;
|
|
14130
14179
|
const labelPosition = buffer[position];
|
|
14131
|
-
node.label =
|
|
14132
|
-
labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer, readString);
|
|
14180
|
+
node.label = labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer);
|
|
14133
14181
|
},
|
|
14134
14182
|
function debuggerStatement() { },
|
|
14135
|
-
function
|
|
14183
|
+
function decorator(node, position, buffer) {
|
|
14184
|
+
const { scope } = node;
|
|
14185
|
+
node.expression = convertNode(node, scope, buffer[position], buffer);
|
|
14186
|
+
},
|
|
14187
|
+
function directive(node, position, buffer) {
|
|
14136
14188
|
const { scope } = node;
|
|
14137
|
-
node.directive =
|
|
14138
|
-
node.expression = convertNode(node, scope, buffer[position + 1], buffer
|
|
14189
|
+
node.directive = buffer.convertString(buffer[position]);
|
|
14190
|
+
node.expression = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14139
14191
|
},
|
|
14140
|
-
function doWhileStatement(node, position, buffer
|
|
14192
|
+
function doWhileStatement(node, position, buffer) {
|
|
14141
14193
|
const { scope } = node;
|
|
14142
|
-
node.body = convertNode(node, scope, buffer[position], buffer
|
|
14143
|
-
node.test = convertNode(node, scope, buffer[position + 1], buffer
|
|
14194
|
+
node.body = convertNode(node, scope, buffer[position], buffer);
|
|
14195
|
+
node.test = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14144
14196
|
},
|
|
14145
14197
|
function emptyStatement() { },
|
|
14146
|
-
function exportAllDeclaration(node, position, buffer
|
|
14198
|
+
function exportAllDeclaration(node, position, buffer) {
|
|
14147
14199
|
const { scope } = node;
|
|
14148
14200
|
const exportedPosition = buffer[position];
|
|
14149
14201
|
node.exported =
|
|
14150
|
-
exportedPosition === 0
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
node.source = convertNode(node, scope, buffer[position + 1], buffer, readString);
|
|
14154
|
-
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
14202
|
+
exportedPosition === 0 ? null : convertNode(node, scope, exportedPosition, buffer);
|
|
14203
|
+
node.source = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14204
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer);
|
|
14155
14205
|
},
|
|
14156
|
-
function exportDefaultDeclaration(node, position, buffer
|
|
14206
|
+
function exportDefaultDeclaration(node, position, buffer) {
|
|
14157
14207
|
const { scope } = node;
|
|
14158
|
-
node.declaration = convertNode(node, scope, buffer[position], buffer
|
|
14208
|
+
node.declaration = convertNode(node, scope, buffer[position], buffer);
|
|
14159
14209
|
},
|
|
14160
|
-
function exportNamedDeclaration(node, position, buffer
|
|
14210
|
+
function exportNamedDeclaration(node, position, buffer) {
|
|
14161
14211
|
const { scope } = node;
|
|
14162
|
-
node.specifiers = convertNodeList(node, scope, buffer[position], buffer
|
|
14212
|
+
node.specifiers = convertNodeList(node, scope, buffer[position], buffer);
|
|
14163
14213
|
const sourcePosition = buffer[position + 1];
|
|
14164
|
-
node.source =
|
|
14165
|
-
|
|
14166
|
-
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer, readString);
|
|
14214
|
+
node.source = sourcePosition === 0 ? null : convertNode(node, scope, sourcePosition, buffer);
|
|
14215
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer);
|
|
14167
14216
|
const declarationPosition = buffer[position + 3];
|
|
14168
14217
|
node.declaration =
|
|
14169
|
-
declarationPosition === 0
|
|
14170
|
-
? null
|
|
14171
|
-
: convertNode(node, scope, declarationPosition, buffer, readString);
|
|
14218
|
+
declarationPosition === 0 ? null : convertNode(node, scope, declarationPosition, buffer);
|
|
14172
14219
|
},
|
|
14173
|
-
function exportSpecifier(node, position, buffer
|
|
14220
|
+
function exportSpecifier(node, position, buffer) {
|
|
14174
14221
|
const { scope } = node;
|
|
14175
|
-
node.local = convertNode(node, scope, buffer[position], buffer
|
|
14222
|
+
node.local = convertNode(node, scope, buffer[position], buffer);
|
|
14176
14223
|
const exportedPosition = buffer[position + 1];
|
|
14177
14224
|
node.exported =
|
|
14178
|
-
exportedPosition === 0
|
|
14179
|
-
? node.local
|
|
14180
|
-
: convertNode(node, scope, exportedPosition, buffer, readString);
|
|
14225
|
+
exportedPosition === 0 ? node.local : convertNode(node, scope, exportedPosition, buffer);
|
|
14181
14226
|
},
|
|
14182
|
-
function expressionStatement(node, position, buffer
|
|
14227
|
+
function expressionStatement(node, position, buffer) {
|
|
14183
14228
|
const { scope } = node;
|
|
14184
|
-
node.expression = convertNode(node, scope, buffer[position], buffer
|
|
14229
|
+
node.expression = convertNode(node, scope, buffer[position], buffer);
|
|
14185
14230
|
},
|
|
14186
|
-
function forInStatement(node, position, buffer
|
|
14231
|
+
function forInStatement(node, position, buffer) {
|
|
14187
14232
|
const { scope } = node;
|
|
14188
|
-
node.left = convertNode(node, scope, buffer[position], buffer
|
|
14189
|
-
node.right = convertNode(node, scope, buffer[position + 1], buffer
|
|
14190
|
-
node.body = convertNode(node, scope, buffer[position + 2], buffer
|
|
14233
|
+
node.left = convertNode(node, scope, buffer[position], buffer);
|
|
14234
|
+
node.right = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14235
|
+
node.body = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14191
14236
|
},
|
|
14192
|
-
function forOfStatement(node, position, buffer
|
|
14237
|
+
function forOfStatement(node, position, buffer) {
|
|
14193
14238
|
const { scope } = node;
|
|
14194
14239
|
const flags = buffer[position];
|
|
14195
14240
|
node.await = (flags & 1) === 1;
|
|
14196
|
-
node.left = convertNode(node, scope, buffer[position + 1], buffer
|
|
14197
|
-
node.right = convertNode(node, scope, buffer[position + 2], buffer
|
|
14198
|
-
node.body = convertNode(node, scope, buffer[position + 3], buffer
|
|
14241
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14242
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14243
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
14199
14244
|
},
|
|
14200
|
-
function forStatement(node, position, buffer
|
|
14245
|
+
function forStatement(node, position, buffer) {
|
|
14201
14246
|
const { scope } = node;
|
|
14202
14247
|
const initPosition = buffer[position];
|
|
14203
|
-
node.init =
|
|
14204
|
-
initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer, readString);
|
|
14248
|
+
node.init = initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer);
|
|
14205
14249
|
const testPosition = buffer[position + 1];
|
|
14206
|
-
node.test =
|
|
14207
|
-
testPosition === 0 ? null : convertNode(node, scope, testPosition, buffer, readString);
|
|
14250
|
+
node.test = testPosition === 0 ? null : convertNode(node, scope, testPosition, buffer);
|
|
14208
14251
|
const updatePosition = buffer[position + 2];
|
|
14209
|
-
node.update =
|
|
14210
|
-
|
|
14211
|
-
node.body = convertNode(node, scope, buffer[position + 3], buffer, readString);
|
|
14252
|
+
node.update = updatePosition === 0 ? null : convertNode(node, scope, updatePosition, buffer);
|
|
14253
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
14212
14254
|
},
|
|
14213
|
-
function functionDeclaration(node, position, buffer
|
|
14255
|
+
function functionDeclaration(node, position, buffer) {
|
|
14214
14256
|
const { scope } = node;
|
|
14215
14257
|
const flags = buffer[position];
|
|
14216
14258
|
node.async = (flags & 1) === 1;
|
|
@@ -14219,14 +14261,12 @@ const bufferParsers = [
|
|
|
14219
14261
|
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
14220
14262
|
const idPosition = buffer[position + 2];
|
|
14221
14263
|
node.id =
|
|
14222
|
-
idPosition === 0
|
|
14223
|
-
|
|
14224
|
-
: convertNode(node, scope.parent, idPosition, buffer, readString);
|
|
14225
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
|
|
14264
|
+
idPosition === 0 ? null : convertNode(node, scope.parent, idPosition, buffer);
|
|
14265
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer));
|
|
14226
14266
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
14227
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer
|
|
14267
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer);
|
|
14228
14268
|
},
|
|
14229
|
-
function functionExpression(node, position, buffer
|
|
14269
|
+
function functionExpression(node, position, buffer) {
|
|
14230
14270
|
const { scope } = node;
|
|
14231
14271
|
const flags = buffer[position];
|
|
14232
14272
|
node.async = (flags & 1) === 1;
|
|
@@ -14234,69 +14274,65 @@ const bufferParsers = [
|
|
|
14234
14274
|
const annotations = (node.annotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer));
|
|
14235
14275
|
node.annotationNoSideEffects = annotations.some(comment => comment.type === 'noSideEffects');
|
|
14236
14276
|
const idPosition = buffer[position + 2];
|
|
14237
|
-
node.id =
|
|
14238
|
-
|
|
14239
|
-
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer, readString));
|
|
14277
|
+
node.id = idPosition === 0 ? null : convertNode(node, node.idScope, idPosition, buffer);
|
|
14278
|
+
const parameters = (node.params = convertNodeList(node, scope, buffer[position + 3], buffer));
|
|
14240
14279
|
scope.addParameterVariables(parameters.map(parameter => parameter.declare('parameter', UNKNOWN_EXPRESSION)), parameters[parameters.length - 1] instanceof RestElement);
|
|
14241
|
-
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer
|
|
14280
|
+
node.body = convertNode(node, scope.bodyScope, buffer[position + 4], buffer);
|
|
14242
14281
|
},
|
|
14243
|
-
function identifier(node, position, buffer
|
|
14244
|
-
node.name =
|
|
14282
|
+
function identifier(node, position, buffer) {
|
|
14283
|
+
node.name = buffer.convertString(buffer[position]);
|
|
14245
14284
|
},
|
|
14246
|
-
function ifStatement(node, position, buffer
|
|
14285
|
+
function ifStatement(node, position, buffer) {
|
|
14247
14286
|
const { scope } = node;
|
|
14248
|
-
node.test = convertNode(node, scope, buffer[position], buffer
|
|
14249
|
-
node.consequent = convertNode(node, (node.consequentScope = new TrackingScope(scope)), buffer[position + 1], buffer
|
|
14287
|
+
node.test = convertNode(node, scope, buffer[position], buffer);
|
|
14288
|
+
node.consequent = convertNode(node, (node.consequentScope = new TrackingScope(scope)), buffer[position + 1], buffer);
|
|
14250
14289
|
const alternatePosition = buffer[position + 2];
|
|
14251
14290
|
node.alternate =
|
|
14252
14291
|
alternatePosition === 0
|
|
14253
14292
|
? null
|
|
14254
|
-
: convertNode(node, (node.alternateScope = new TrackingScope(scope)), alternatePosition, buffer
|
|
14293
|
+
: convertNode(node, (node.alternateScope = new TrackingScope(scope)), alternatePosition, buffer);
|
|
14255
14294
|
},
|
|
14256
|
-
function importAttribute(node, position, buffer
|
|
14295
|
+
function importAttribute(node, position, buffer) {
|
|
14257
14296
|
const { scope } = node;
|
|
14258
|
-
node.key = convertNode(node, scope, buffer[position], buffer
|
|
14259
|
-
node.value = convertNode(node, scope, buffer[position + 1], buffer
|
|
14297
|
+
node.key = convertNode(node, scope, buffer[position], buffer);
|
|
14298
|
+
node.value = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14260
14299
|
},
|
|
14261
|
-
function importDeclaration(node, position, buffer
|
|
14300
|
+
function importDeclaration(node, position, buffer) {
|
|
14262
14301
|
const { scope } = node;
|
|
14263
|
-
node.specifiers = convertNodeList(node, scope, buffer[position], buffer
|
|
14264
|
-
node.source = convertNode(node, scope, buffer[position + 1], buffer
|
|
14265
|
-
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer
|
|
14302
|
+
node.specifiers = convertNodeList(node, scope, buffer[position], buffer);
|
|
14303
|
+
node.source = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14304
|
+
node.attributes = convertNodeList(node, scope, buffer[position + 2], buffer);
|
|
14266
14305
|
},
|
|
14267
|
-
function importDefaultSpecifier(node, position, buffer
|
|
14306
|
+
function importDefaultSpecifier(node, position, buffer) {
|
|
14268
14307
|
const { scope } = node;
|
|
14269
|
-
node.local = convertNode(node, scope, buffer[position], buffer
|
|
14308
|
+
node.local = convertNode(node, scope, buffer[position], buffer);
|
|
14270
14309
|
},
|
|
14271
|
-
function importExpression(node, position, buffer
|
|
14310
|
+
function importExpression(node, position, buffer) {
|
|
14272
14311
|
const { scope } = node;
|
|
14273
|
-
node.source = convertNode(node, scope, buffer[position], buffer
|
|
14274
|
-
node.sourceAstNode = parseAst_js.convertNode(buffer[position], buffer
|
|
14312
|
+
node.source = convertNode(node, scope, buffer[position], buffer);
|
|
14313
|
+
node.sourceAstNode = parseAst_js.convertNode(buffer[position], buffer);
|
|
14275
14314
|
const optionsPosition = buffer[position + 1];
|
|
14276
|
-
node.options =
|
|
14277
|
-
optionsPosition === 0 ? null : convertNode(node, scope, optionsPosition, buffer, readString);
|
|
14315
|
+
node.options = optionsPosition === 0 ? null : convertNode(node, scope, optionsPosition, buffer);
|
|
14278
14316
|
},
|
|
14279
|
-
function importNamespaceSpecifier(node, position, buffer
|
|
14317
|
+
function importNamespaceSpecifier(node, position, buffer) {
|
|
14280
14318
|
const { scope } = node;
|
|
14281
|
-
node.local = convertNode(node, scope, buffer[position], buffer
|
|
14319
|
+
node.local = convertNode(node, scope, buffer[position], buffer);
|
|
14282
14320
|
},
|
|
14283
|
-
function importSpecifier(node, position, buffer
|
|
14321
|
+
function importSpecifier(node, position, buffer) {
|
|
14284
14322
|
const { scope } = node;
|
|
14285
14323
|
const importedPosition = buffer[position];
|
|
14286
|
-
node.local = convertNode(node, scope, buffer[position + 1], buffer
|
|
14324
|
+
node.local = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14287
14325
|
node.imported =
|
|
14288
|
-
importedPosition === 0
|
|
14289
|
-
? node.local
|
|
14290
|
-
: convertNode(node, scope, importedPosition, buffer, readString);
|
|
14326
|
+
importedPosition === 0 ? node.local : convertNode(node, scope, importedPosition, buffer);
|
|
14291
14327
|
},
|
|
14292
|
-
function labeledStatement(node, position, buffer
|
|
14328
|
+
function labeledStatement(node, position, buffer) {
|
|
14293
14329
|
const { scope } = node;
|
|
14294
|
-
node.label = convertNode(node, scope, buffer[position], buffer
|
|
14295
|
-
node.body = convertNode(node, scope, buffer[position + 1], buffer
|
|
14330
|
+
node.label = convertNode(node, scope, buffer[position], buffer);
|
|
14331
|
+
node.body = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14296
14332
|
},
|
|
14297
|
-
function literalBigInt(node, position, buffer
|
|
14298
|
-
const bigint = (node.bigint =
|
|
14299
|
-
node.raw =
|
|
14333
|
+
function literalBigInt(node, position, buffer) {
|
|
14334
|
+
const bigint = (node.bigint = buffer.convertString(buffer[position]));
|
|
14335
|
+
node.raw = buffer.convertString(buffer[position + 1]);
|
|
14300
14336
|
node.value = BigInt(bigint);
|
|
14301
14337
|
},
|
|
14302
14338
|
function literalBoolean(node, position, buffer) {
|
|
@@ -14307,208 +14343,199 @@ const bufferParsers = [
|
|
|
14307
14343
|
function literalNull(node) {
|
|
14308
14344
|
node.value = null;
|
|
14309
14345
|
},
|
|
14310
|
-
function literalNumber(node, position, buffer
|
|
14346
|
+
function literalNumber(node, position, buffer) {
|
|
14311
14347
|
const rawPosition = buffer[position];
|
|
14312
|
-
node.raw = rawPosition === 0 ? undefined :
|
|
14348
|
+
node.raw = rawPosition === 0 ? undefined : buffer.convertString(rawPosition);
|
|
14313
14349
|
node.value = new DataView(buffer.buffer).getFloat64((position + 1) << 2, true);
|
|
14314
14350
|
},
|
|
14315
|
-
function literalRegExp(node, position, buffer
|
|
14316
|
-
const flags =
|
|
14317
|
-
const pattern =
|
|
14351
|
+
function literalRegExp(node, position, buffer) {
|
|
14352
|
+
const flags = buffer.convertString(buffer[position]);
|
|
14353
|
+
const pattern = buffer.convertString(buffer[position + 1]);
|
|
14318
14354
|
node.raw = `/${pattern}/${flags}`;
|
|
14319
14355
|
node.regex = { flags, pattern };
|
|
14320
14356
|
node.value = new RegExp(pattern, flags);
|
|
14321
14357
|
},
|
|
14322
|
-
function literalString(node, position, buffer
|
|
14323
|
-
node.value =
|
|
14358
|
+
function literalString(node, position, buffer) {
|
|
14359
|
+
node.value = buffer.convertString(buffer[position]);
|
|
14324
14360
|
const rawPosition = buffer[position + 1];
|
|
14325
|
-
node.raw = rawPosition === 0 ? undefined :
|
|
14361
|
+
node.raw = rawPosition === 0 ? undefined : buffer.convertString(rawPosition);
|
|
14326
14362
|
},
|
|
14327
|
-
function logicalExpression(node, position, buffer
|
|
14363
|
+
function logicalExpression(node, position, buffer) {
|
|
14328
14364
|
const { scope } = node;
|
|
14329
14365
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
14330
|
-
node.left = convertNode(node, scope, buffer[position + 1], buffer
|
|
14331
|
-
node.right = convertNode(node, scope, buffer[position + 2], buffer
|
|
14366
|
+
node.left = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14367
|
+
node.right = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14332
14368
|
},
|
|
14333
|
-
function memberExpression(node, position, buffer
|
|
14369
|
+
function memberExpression(node, position, buffer) {
|
|
14334
14370
|
const { scope } = node;
|
|
14335
14371
|
const flags = buffer[position];
|
|
14336
14372
|
node.computed = (flags & 1) === 1;
|
|
14337
14373
|
node.optional = (flags & 2) === 2;
|
|
14338
|
-
node.object = convertNode(node, scope, buffer[position + 1], buffer
|
|
14339
|
-
node.property = convertNode(node, scope, buffer[position + 2], buffer
|
|
14374
|
+
node.object = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14375
|
+
node.property = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14340
14376
|
},
|
|
14341
|
-
function metaProperty(node, position, buffer
|
|
14377
|
+
function metaProperty(node, position, buffer) {
|
|
14342
14378
|
const { scope } = node;
|
|
14343
|
-
node.meta = convertNode(node, scope, buffer[position], buffer
|
|
14344
|
-
node.property = convertNode(node, scope, buffer[position + 1], buffer
|
|
14379
|
+
node.meta = convertNode(node, scope, buffer[position], buffer);
|
|
14380
|
+
node.property = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14345
14381
|
},
|
|
14346
|
-
function methodDefinition(node, position, buffer
|
|
14382
|
+
function methodDefinition(node, position, buffer) {
|
|
14347
14383
|
const { scope } = node;
|
|
14348
14384
|
const flags = buffer[position];
|
|
14349
14385
|
node.static = (flags & 1) === 1;
|
|
14350
14386
|
node.computed = (flags & 2) === 2;
|
|
14351
|
-
node.
|
|
14352
|
-
node.
|
|
14353
|
-
node.
|
|
14387
|
+
node.decorators = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
14388
|
+
node.key = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14389
|
+
node.value = convertNode(node, scope, buffer[position + 3], buffer);
|
|
14390
|
+
node.kind = parseAst_js.FIXED_STRINGS[buffer[position + 4]];
|
|
14354
14391
|
},
|
|
14355
|
-
function newExpression(node, position, buffer
|
|
14392
|
+
function newExpression(node, position, buffer) {
|
|
14356
14393
|
const { scope } = node;
|
|
14357
14394
|
node.annotations = parseAst_js.convertAnnotations(buffer[position], buffer);
|
|
14358
|
-
node.callee = convertNode(node, scope, buffer[position + 1], buffer
|
|
14359
|
-
node.arguments = convertNodeList(node, scope, buffer[position + 2], buffer
|
|
14395
|
+
node.callee = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14396
|
+
node.arguments = convertNodeList(node, scope, buffer[position + 2], buffer);
|
|
14360
14397
|
},
|
|
14361
|
-
function objectExpression(node, position, buffer
|
|
14398
|
+
function objectExpression(node, position, buffer) {
|
|
14362
14399
|
const { scope } = node;
|
|
14363
|
-
node.properties = convertNodeList(node, scope, buffer[position], buffer
|
|
14400
|
+
node.properties = convertNodeList(node, scope, buffer[position], buffer);
|
|
14364
14401
|
},
|
|
14365
|
-
function objectPattern(node, position, buffer
|
|
14402
|
+
function objectPattern(node, position, buffer) {
|
|
14366
14403
|
const { scope } = node;
|
|
14367
|
-
node.properties = convertNodeList(node, scope, buffer[position], buffer
|
|
14404
|
+
node.properties = convertNodeList(node, scope, buffer[position], buffer);
|
|
14368
14405
|
},
|
|
14369
|
-
function privateIdentifier(node, position, buffer
|
|
14370
|
-
node.name =
|
|
14406
|
+
function privateIdentifier(node, position, buffer) {
|
|
14407
|
+
node.name = buffer.convertString(buffer[position]);
|
|
14371
14408
|
},
|
|
14372
|
-
function program(node, position, buffer
|
|
14409
|
+
function program(node, position, buffer) {
|
|
14373
14410
|
const { scope } = node;
|
|
14374
|
-
node.body = convertNodeList(node, scope, buffer[position], buffer
|
|
14411
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer);
|
|
14375
14412
|
node.invalidAnnotations = parseAst_js.convertAnnotations(buffer[position + 1], buffer);
|
|
14376
14413
|
},
|
|
14377
|
-
function property(node, position, buffer
|
|
14414
|
+
function property(node, position, buffer) {
|
|
14378
14415
|
const { scope } = node;
|
|
14379
14416
|
const flags = buffer[position];
|
|
14380
14417
|
node.method = (flags & 1) === 1;
|
|
14381
14418
|
node.shorthand = (flags & 2) === 2;
|
|
14382
14419
|
node.computed = (flags & 4) === 4;
|
|
14383
14420
|
const keyPosition = buffer[position + 1];
|
|
14384
|
-
node.value = convertNode(node, scope, buffer[position + 2], buffer
|
|
14421
|
+
node.value = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14385
14422
|
node.kind = parseAst_js.FIXED_STRINGS[buffer[position + 3]];
|
|
14386
|
-
node.key =
|
|
14387
|
-
keyPosition === 0 ? node.value : convertNode(node, scope, keyPosition, buffer, readString);
|
|
14423
|
+
node.key = keyPosition === 0 ? node.value : convertNode(node, scope, keyPosition, buffer);
|
|
14388
14424
|
},
|
|
14389
|
-
function propertyDefinition(node, position, buffer
|
|
14425
|
+
function propertyDefinition(node, position, buffer) {
|
|
14390
14426
|
const { scope } = node;
|
|
14391
14427
|
const flags = buffer[position];
|
|
14392
14428
|
node.static = (flags & 1) === 1;
|
|
14393
14429
|
node.computed = (flags & 2) === 2;
|
|
14394
|
-
node.
|
|
14395
|
-
|
|
14396
|
-
|
|
14397
|
-
|
|
14430
|
+
node.decorators = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
14431
|
+
node.key = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14432
|
+
const valuePosition = buffer[position + 3];
|
|
14433
|
+
node.value = valuePosition === 0 ? null : convertNode(node, scope, valuePosition, buffer);
|
|
14398
14434
|
},
|
|
14399
|
-
function restElement(node, position, buffer
|
|
14435
|
+
function restElement(node, position, buffer) {
|
|
14400
14436
|
const { scope } = node;
|
|
14401
|
-
node.argument = convertNode(node, scope, buffer[position], buffer
|
|
14437
|
+
node.argument = convertNode(node, scope, buffer[position], buffer);
|
|
14402
14438
|
},
|
|
14403
|
-
function returnStatement(node, position, buffer
|
|
14439
|
+
function returnStatement(node, position, buffer) {
|
|
14404
14440
|
const { scope } = node;
|
|
14405
14441
|
const argumentPosition = buffer[position];
|
|
14406
14442
|
node.argument =
|
|
14407
|
-
argumentPosition === 0
|
|
14408
|
-
? null
|
|
14409
|
-
: convertNode(node, scope, argumentPosition, buffer, readString);
|
|
14443
|
+
argumentPosition === 0 ? null : convertNode(node, scope, argumentPosition, buffer);
|
|
14410
14444
|
},
|
|
14411
|
-
function sequenceExpression(node, position, buffer
|
|
14445
|
+
function sequenceExpression(node, position, buffer) {
|
|
14412
14446
|
const { scope } = node;
|
|
14413
|
-
node.expressions = convertNodeList(node, scope, buffer[position], buffer
|
|
14447
|
+
node.expressions = convertNodeList(node, scope, buffer[position], buffer);
|
|
14414
14448
|
},
|
|
14415
|
-
function spreadElement(node, position, buffer
|
|
14449
|
+
function spreadElement(node, position, buffer) {
|
|
14416
14450
|
const { scope } = node;
|
|
14417
|
-
node.argument = convertNode(node, scope, buffer[position], buffer
|
|
14451
|
+
node.argument = convertNode(node, scope, buffer[position], buffer);
|
|
14418
14452
|
},
|
|
14419
|
-
function staticBlock(node, position, buffer
|
|
14453
|
+
function staticBlock(node, position, buffer) {
|
|
14420
14454
|
const { scope } = node;
|
|
14421
|
-
node.body = convertNodeList(node, scope, buffer[position], buffer
|
|
14455
|
+
node.body = convertNodeList(node, scope, buffer[position], buffer);
|
|
14422
14456
|
},
|
|
14423
14457
|
function superElement() { },
|
|
14424
|
-
function switchCase(node, position, buffer
|
|
14458
|
+
function switchCase(node, position, buffer) {
|
|
14425
14459
|
const { scope } = node;
|
|
14426
14460
|
const testPosition = buffer[position];
|
|
14427
|
-
node.test =
|
|
14428
|
-
|
|
14429
|
-
node.consequent = convertNodeList(node, scope, buffer[position + 1], buffer, readString);
|
|
14461
|
+
node.test = testPosition === 0 ? null : convertNode(node, scope, testPosition, buffer);
|
|
14462
|
+
node.consequent = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
14430
14463
|
},
|
|
14431
|
-
function switchStatement(node, position, buffer
|
|
14464
|
+
function switchStatement(node, position, buffer) {
|
|
14432
14465
|
const { scope } = node;
|
|
14433
|
-
node.discriminant = convertNode(node, node.parentScope, buffer[position], buffer
|
|
14434
|
-
node.cases = convertNodeList(node, scope, buffer[position + 1], buffer
|
|
14466
|
+
node.discriminant = convertNode(node, node.parentScope, buffer[position], buffer);
|
|
14467
|
+
node.cases = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
14435
14468
|
},
|
|
14436
|
-
function taggedTemplateExpression(node, position, buffer
|
|
14469
|
+
function taggedTemplateExpression(node, position, buffer) {
|
|
14437
14470
|
const { scope } = node;
|
|
14438
|
-
node.tag = convertNode(node, scope, buffer[position], buffer
|
|
14439
|
-
node.quasi = convertNode(node, scope, buffer[position + 1], buffer
|
|
14471
|
+
node.tag = convertNode(node, scope, buffer[position], buffer);
|
|
14472
|
+
node.quasi = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14440
14473
|
},
|
|
14441
|
-
function templateElement(node, position, buffer
|
|
14474
|
+
function templateElement(node, position, buffer) {
|
|
14442
14475
|
const flags = buffer[position];
|
|
14443
14476
|
node.tail = (flags & 1) === 1;
|
|
14444
14477
|
const cookedPosition = buffer[position + 1];
|
|
14445
|
-
const cooked = cookedPosition === 0 ? undefined :
|
|
14446
|
-
const raw =
|
|
14478
|
+
const cooked = cookedPosition === 0 ? undefined : buffer.convertString(cookedPosition);
|
|
14479
|
+
const raw = buffer.convertString(buffer[position + 2]);
|
|
14447
14480
|
node.value = { cooked, raw };
|
|
14448
14481
|
},
|
|
14449
|
-
function templateLiteral(node, position, buffer
|
|
14482
|
+
function templateLiteral(node, position, buffer) {
|
|
14450
14483
|
const { scope } = node;
|
|
14451
|
-
node.quasis = convertNodeList(node, scope, buffer[position], buffer
|
|
14452
|
-
node.expressions = convertNodeList(node, scope, buffer[position + 1], buffer
|
|
14484
|
+
node.quasis = convertNodeList(node, scope, buffer[position], buffer);
|
|
14485
|
+
node.expressions = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
14453
14486
|
},
|
|
14454
14487
|
function thisExpression() { },
|
|
14455
|
-
function throwStatement(node, position, buffer
|
|
14488
|
+
function throwStatement(node, position, buffer) {
|
|
14456
14489
|
const { scope } = node;
|
|
14457
|
-
node.argument = convertNode(node, scope, buffer[position], buffer
|
|
14490
|
+
node.argument = convertNode(node, scope, buffer[position], buffer);
|
|
14458
14491
|
},
|
|
14459
|
-
function tryStatement(node, position, buffer
|
|
14492
|
+
function tryStatement(node, position, buffer) {
|
|
14460
14493
|
const { scope } = node;
|
|
14461
|
-
node.block = convertNode(node, scope, buffer[position], buffer
|
|
14494
|
+
node.block = convertNode(node, scope, buffer[position], buffer);
|
|
14462
14495
|
const handlerPosition = buffer[position + 1];
|
|
14463
|
-
node.handler =
|
|
14464
|
-
handlerPosition === 0 ? null : convertNode(node, scope, handlerPosition, buffer, readString);
|
|
14496
|
+
node.handler = handlerPosition === 0 ? null : convertNode(node, scope, handlerPosition, buffer);
|
|
14465
14497
|
const finalizerPosition = buffer[position + 2];
|
|
14466
14498
|
node.finalizer =
|
|
14467
|
-
finalizerPosition === 0
|
|
14468
|
-
? null
|
|
14469
|
-
: convertNode(node, scope, finalizerPosition, buffer, readString);
|
|
14499
|
+
finalizerPosition === 0 ? null : convertNode(node, scope, finalizerPosition, buffer);
|
|
14470
14500
|
},
|
|
14471
|
-
function unaryExpression(node, position, buffer
|
|
14501
|
+
function unaryExpression(node, position, buffer) {
|
|
14472
14502
|
const { scope } = node;
|
|
14473
14503
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
14474
|
-
node.argument = convertNode(node, scope, buffer[position + 1], buffer
|
|
14504
|
+
node.argument = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14475
14505
|
},
|
|
14476
|
-
function updateExpression(node, position, buffer
|
|
14506
|
+
function updateExpression(node, position, buffer) {
|
|
14477
14507
|
const { scope } = node;
|
|
14478
14508
|
const flags = buffer[position];
|
|
14479
14509
|
node.prefix = (flags & 1) === 1;
|
|
14480
14510
|
node.operator = parseAst_js.FIXED_STRINGS[buffer[position + 1]];
|
|
14481
|
-
node.argument = convertNode(node, scope, buffer[position + 2], buffer
|
|
14511
|
+
node.argument = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14482
14512
|
},
|
|
14483
|
-
function variableDeclaration(node, position, buffer
|
|
14513
|
+
function variableDeclaration(node, position, buffer) {
|
|
14484
14514
|
const { scope } = node;
|
|
14485
14515
|
node.kind = parseAst_js.FIXED_STRINGS[buffer[position]];
|
|
14486
|
-
node.declarations = convertNodeList(node, scope, buffer[position + 1], buffer
|
|
14516
|
+
node.declarations = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
14487
14517
|
},
|
|
14488
|
-
function variableDeclarator(node, position, buffer
|
|
14518
|
+
function variableDeclarator(node, position, buffer) {
|
|
14489
14519
|
const { scope } = node;
|
|
14490
|
-
node.id = convertNode(node, scope, buffer[position], buffer
|
|
14520
|
+
node.id = convertNode(node, scope, buffer[position], buffer);
|
|
14491
14521
|
const initPosition = buffer[position + 1];
|
|
14492
|
-
node.init =
|
|
14493
|
-
initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer, readString);
|
|
14522
|
+
node.init = initPosition === 0 ? null : convertNode(node, scope, initPosition, buffer);
|
|
14494
14523
|
},
|
|
14495
|
-
function whileStatement(node, position, buffer
|
|
14524
|
+
function whileStatement(node, position, buffer) {
|
|
14496
14525
|
const { scope } = node;
|
|
14497
|
-
node.test = convertNode(node, scope, buffer[position], buffer
|
|
14498
|
-
node.body = convertNode(node, scope, buffer[position + 1], buffer
|
|
14526
|
+
node.test = convertNode(node, scope, buffer[position], buffer);
|
|
14527
|
+
node.body = convertNode(node, scope, buffer[position + 1], buffer);
|
|
14499
14528
|
},
|
|
14500
|
-
function yieldExpression(node, position, buffer
|
|
14529
|
+
function yieldExpression(node, position, buffer) {
|
|
14501
14530
|
const { scope } = node;
|
|
14502
14531
|
const flags = buffer[position];
|
|
14503
14532
|
node.delegate = (flags & 1) === 1;
|
|
14504
14533
|
const argumentPosition = buffer[position + 1];
|
|
14505
14534
|
node.argument =
|
|
14506
|
-
argumentPosition === 0
|
|
14507
|
-
? null
|
|
14508
|
-
: convertNode(node, scope, argumentPosition, buffer, readString);
|
|
14535
|
+
argumentPosition === 0 ? null : convertNode(node, scope, argumentPosition, buffer);
|
|
14509
14536
|
}
|
|
14510
14537
|
];
|
|
14511
|
-
function convertNode(parent, parentScope, position, buffer
|
|
14538
|
+
function convertNode(parent, parentScope, position, buffer) {
|
|
14512
14539
|
const nodeType = buffer[position];
|
|
14513
14540
|
const NodeConstructor = nodeConstructors$1[nodeType];
|
|
14514
14541
|
/* istanbul ignore if: This should never be executed but is a safeguard against faulty buffers */
|
|
@@ -14520,18 +14547,18 @@ function convertNode(parent, parentScope, position, buffer, readString) {
|
|
|
14520
14547
|
node.type = nodeTypeStrings[nodeType];
|
|
14521
14548
|
node.start = buffer[position + 1];
|
|
14522
14549
|
node.end = buffer[position + 2];
|
|
14523
|
-
bufferParsers[nodeType](node, position + 3, buffer
|
|
14550
|
+
bufferParsers[nodeType](node, position + 3, buffer);
|
|
14524
14551
|
node.initialise();
|
|
14525
14552
|
return node;
|
|
14526
14553
|
}
|
|
14527
|
-
function convertNodeList(parent, parentScope, position, buffer
|
|
14554
|
+
function convertNodeList(parent, parentScope, position, buffer) {
|
|
14528
14555
|
if (position === 0)
|
|
14529
14556
|
return parseAst_js.EMPTY_ARRAY;
|
|
14530
14557
|
const length = buffer[position++];
|
|
14531
14558
|
const list = [];
|
|
14532
14559
|
for (let index = 0; index < length; index++) {
|
|
14533
14560
|
const nodePosition = buffer[position++];
|
|
14534
|
-
list.push(nodePosition ? convertNode(parent, parentScope, nodePosition, buffer
|
|
14561
|
+
list.push(nodePosition ? convertNode(parent, parentScope, nodePosition, buffer) : null);
|
|
14535
14562
|
}
|
|
14536
14563
|
return list;
|
|
14537
14564
|
}
|
|
@@ -14566,6 +14593,7 @@ const nodeConstructors = {
|
|
|
14566
14593
|
ConditionalExpression,
|
|
14567
14594
|
ContinueStatement,
|
|
14568
14595
|
DebuggerStatement,
|
|
14596
|
+
Decorator,
|
|
14569
14597
|
DoWhileStatement,
|
|
14570
14598
|
EmptyStatement,
|
|
14571
14599
|
ExportAllDeclaration,
|
|
@@ -16098,8 +16126,11 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
|
|
|
16098
16126
|
return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess)};`;
|
|
16099
16127
|
}
|
|
16100
16128
|
let exportBlock = '';
|
|
16101
|
-
|
|
16102
|
-
|
|
16129
|
+
if (namedExportsMode) {
|
|
16130
|
+
for (const { defaultVariableName, importPath, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
|
|
16131
|
+
if (!reexports) {
|
|
16132
|
+
continue;
|
|
16133
|
+
}
|
|
16103
16134
|
for (const specifier of reexports) {
|
|
16104
16135
|
if (specifier.reexported !== '*') {
|
|
16105
16136
|
const importName = getReexportedImportName(name, specifier.imported, depNamedExportsMode, isChunk, defaultVariableName, namespaceVariableName, interop, importPath, externalLiveBindings, getPropertyAccess);
|
|
@@ -16143,8 +16174,11 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
|
|
|
16143
16174
|
: `${lhs}${_}=${_}${rhs};`;
|
|
16144
16175
|
}
|
|
16145
16176
|
}
|
|
16146
|
-
|
|
16147
|
-
|
|
16177
|
+
if (namedExportsMode) {
|
|
16178
|
+
for (const { name, reexports } of dependencies) {
|
|
16179
|
+
if (!reexports) {
|
|
16180
|
+
continue;
|
|
16181
|
+
}
|
|
16148
16182
|
for (const specifier of reexports) {
|
|
16149
16183
|
if (specifier.reexported === '*') {
|
|
16150
16184
|
if (exportBlock)
|
|
@@ -19598,7 +19632,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
|
19598
19632
|
|
|
19599
19633
|
function flru (max) {
|
|
19600
19634
|
var num, curr, prev;
|
|
19601
|
-
var limit = max
|
|
19635
|
+
var limit = max;
|
|
19602
19636
|
|
|
19603
19637
|
function keep(key, value) {
|
|
19604
19638
|
if (++num > limit) {
|
|
@@ -20693,7 +20727,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
|
|
|
20693
20727
|
|
|
20694
20728
|
// https://datatracker.ietf.org/doc/html/rfc2396
|
|
20695
20729
|
// eslint-disable-next-line no-control-regex
|
|
20696
|
-
const INVALID_CHAR_REGEX = /[\u0000-\u001F"
|
|
20730
|
+
const INVALID_CHAR_REGEX = /[\u0000-\u001F"#$%&*+,:;<=>?[\]^`{|}\u007F]/g;
|
|
20697
20731
|
const DRIVE_LETTER_REGEX = /^[a-z]:/i;
|
|
20698
20732
|
function sanitizeFileName(name) {
|
|
20699
20733
|
const match = DRIVE_LETTER_REGEX.exec(name);
|
|
@@ -20922,7 +20956,7 @@ const getIndent = (config, compact) => {
|
|
|
20922
20956
|
return '';
|
|
20923
20957
|
}
|
|
20924
20958
|
const configIndent = config.indent;
|
|
20925
|
-
return configIndent === false ? '' : configIndent ?? true;
|
|
20959
|
+
return configIndent === false ? '' : (configIndent ?? true);
|
|
20926
20960
|
};
|
|
20927
20961
|
const ALLOWED_INTEROP_TYPES = new Set([
|
|
20928
20962
|
'compat',
|