@rollup/wasm-node 4.18.1 → 4.19.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 +8 -5
- 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 +258 -135
- package/dist/es/shared/parseAst.js +25 -13
- 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.d.ts +19 -3
- 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 +25 -13
- package/dist/shared/rollup.js +258 -135
- 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 +26 -25
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.1
|
|
4
|
+
Sat, 27 Jul 2024 04:53:31 GMT - commit 8b967917c2923dc6a02ca1238261387aefa2cb2f
|
|
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.1";
|
|
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'],
|
|
@@ -6195,6 +6219,7 @@ const childNodeKeys = {
|
|
|
6195
6219
|
};
|
|
6196
6220
|
|
|
6197
6221
|
const INCLUDE_PARAMETERS = 'variables';
|
|
6222
|
+
const IS_SKIPPED_CHAIN = Symbol('IS_SKIPPED_CHAIN');
|
|
6198
6223
|
class NodeBase extends ExpressionEntity {
|
|
6199
6224
|
/**
|
|
6200
6225
|
* Nodes can apply custom deoptimizations once they become part of the
|
|
@@ -9086,6 +9111,20 @@ function findNonWhiteSpace(code, index) {
|
|
|
9086
9111
|
const result = NON_WHITESPACE.exec(code);
|
|
9087
9112
|
return result.index;
|
|
9088
9113
|
}
|
|
9114
|
+
const WHITESPACE = /\s/;
|
|
9115
|
+
function findLastWhiteSpaceReverse(code, start, end) {
|
|
9116
|
+
while (true) {
|
|
9117
|
+
if (start >= end) {
|
|
9118
|
+
return end;
|
|
9119
|
+
}
|
|
9120
|
+
if (WHITESPACE.test(code[end - 1])) {
|
|
9121
|
+
end--;
|
|
9122
|
+
}
|
|
9123
|
+
else {
|
|
9124
|
+
return end;
|
|
9125
|
+
}
|
|
9126
|
+
}
|
|
9127
|
+
}
|
|
9089
9128
|
// This assumes "code" only contains white-space and comments
|
|
9090
9129
|
// Returns position of line-comment if applicable
|
|
9091
9130
|
function findFirstLineBreakOutsideComment(code) {
|
|
@@ -10136,6 +10175,20 @@ class Literal extends NodeBase {
|
|
|
10136
10175
|
}
|
|
10137
10176
|
}
|
|
10138
10177
|
|
|
10178
|
+
function getChainElementLiteralValueAtPath(element, object, path, recursionTracker, origin) {
|
|
10179
|
+
if ('getLiteralValueAtPathAsChainElement' in object) {
|
|
10180
|
+
const calleeValue = object.getLiteralValueAtPathAsChainElement(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin);
|
|
10181
|
+
if (calleeValue === IS_SKIPPED_CHAIN || (element.optional && calleeValue == null)) {
|
|
10182
|
+
return IS_SKIPPED_CHAIN;
|
|
10183
|
+
}
|
|
10184
|
+
}
|
|
10185
|
+
else if (element.optional &&
|
|
10186
|
+
object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null) {
|
|
10187
|
+
return IS_SKIPPED_CHAIN;
|
|
10188
|
+
}
|
|
10189
|
+
return element.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
10190
|
+
}
|
|
10191
|
+
|
|
10139
10192
|
// To avoid infinite recursions
|
|
10140
10193
|
const MAX_PATH_DEPTH = 7;
|
|
10141
10194
|
function getResolvablePropertyKey(memberExpression) {
|
|
@@ -10279,6 +10332,9 @@ class MemberExpression extends NodeBase {
|
|
|
10279
10332
|
}
|
|
10280
10333
|
return UnknownValue;
|
|
10281
10334
|
}
|
|
10335
|
+
getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
|
|
10336
|
+
return getChainElementLiteralValueAtPath(this, this.object, path, recursionTracker, origin);
|
|
10337
|
+
}
|
|
10282
10338
|
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
10283
10339
|
if (this.variable) {
|
|
10284
10340
|
return this.variable.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin);
|
|
@@ -10299,6 +10355,23 @@ class MemberExpression extends NodeBase {
|
|
|
10299
10355
|
this.object.hasEffects(context) ||
|
|
10300
10356
|
this.hasAccessEffect(context));
|
|
10301
10357
|
}
|
|
10358
|
+
hasEffectsAsChainElement(context) {
|
|
10359
|
+
if (this.variable || this.isUndefined)
|
|
10360
|
+
return this.hasEffects(context);
|
|
10361
|
+
const objectHasEffects = 'hasEffectsAsChainElement' in this.object
|
|
10362
|
+
? this.object.hasEffectsAsChainElement(context)
|
|
10363
|
+
: this.object.hasEffects(context);
|
|
10364
|
+
if (objectHasEffects === IS_SKIPPED_CHAIN)
|
|
10365
|
+
return IS_SKIPPED_CHAIN;
|
|
10366
|
+
if (this.optional &&
|
|
10367
|
+
this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
|
|
10368
|
+
return objectHasEffects || IS_SKIPPED_CHAIN;
|
|
10369
|
+
}
|
|
10370
|
+
// We only apply deoptimizations lazily once we know we are not skipping
|
|
10371
|
+
if (!this.deoptimized)
|
|
10372
|
+
this.applyDeoptimizations();
|
|
10373
|
+
return this.property.hasEffects(context) || this.hasAccessEffect(context);
|
|
10374
|
+
}
|
|
10302
10375
|
hasEffectsAsAssignmentTarget(context, checkAccess) {
|
|
10303
10376
|
if (checkAccess && !this.deoptimized)
|
|
10304
10377
|
this.applyDeoptimizations();
|
|
@@ -10349,13 +10422,6 @@ class MemberExpression extends NodeBase {
|
|
|
10349
10422
|
this.propertyKey = getResolvablePropertyKey(this);
|
|
10350
10423
|
this.accessInteraction = { args: [this.object], type: INTERACTION_ACCESSED };
|
|
10351
10424
|
}
|
|
10352
|
-
isSkippedAsOptional(origin) {
|
|
10353
|
-
return (!this.variable &&
|
|
10354
|
-
!this.isUndefined &&
|
|
10355
|
-
(this.object.isSkippedAsOptional?.(origin) ||
|
|
10356
|
-
(this.optional &&
|
|
10357
|
-
this.object.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null)));
|
|
10358
|
-
}
|
|
10359
10425
|
render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
10360
10426
|
if (this.variable || this.isUndefined) {
|
|
10361
10427
|
const { snippets: { getPropertyAccess } } = options;
|
|
@@ -10595,6 +10661,9 @@ class CallExpression extends CallExpressionBase {
|
|
|
10595
10661
|
withNew: false
|
|
10596
10662
|
};
|
|
10597
10663
|
}
|
|
10664
|
+
getLiteralValueAtPathAsChainElement(path, recursionTracker, origin) {
|
|
10665
|
+
return getChainElementLiteralValueAtPath(this, this.callee, path, recursionTracker, origin);
|
|
10666
|
+
}
|
|
10598
10667
|
hasEffects(context) {
|
|
10599
10668
|
if (!this.deoptimized)
|
|
10600
10669
|
this.applyDeoptimizations();
|
|
@@ -10608,6 +10677,26 @@ class CallExpression extends CallExpressionBase {
|
|
|
10608
10677
|
return (this.callee.hasEffects(context) ||
|
|
10609
10678
|
this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
|
|
10610
10679
|
}
|
|
10680
|
+
hasEffectsAsChainElement(context) {
|
|
10681
|
+
const calleeHasEffects = 'hasEffectsAsChainElement' in this.callee
|
|
10682
|
+
? this.callee.hasEffectsAsChainElement(context)
|
|
10683
|
+
: this.callee.hasEffects(context);
|
|
10684
|
+
if (calleeHasEffects === IS_SKIPPED_CHAIN)
|
|
10685
|
+
return IS_SKIPPED_CHAIN;
|
|
10686
|
+
if (this.optional &&
|
|
10687
|
+
this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this) == null) {
|
|
10688
|
+
return (!this.annotationPure && calleeHasEffects) || IS_SKIPPED_CHAIN;
|
|
10689
|
+
}
|
|
10690
|
+
// We only apply deoptimizations lazily once we know we are not skipping
|
|
10691
|
+
if (!this.deoptimized)
|
|
10692
|
+
this.applyDeoptimizations();
|
|
10693
|
+
for (const argument of this.arguments) {
|
|
10694
|
+
if (argument.hasEffects(context))
|
|
10695
|
+
return true;
|
|
10696
|
+
}
|
|
10697
|
+
return (!this.annotationPure &&
|
|
10698
|
+
this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
|
|
10699
|
+
}
|
|
10611
10700
|
include(context, includeChildrenRecursively) {
|
|
10612
10701
|
if (!this.deoptimized)
|
|
10613
10702
|
this.applyDeoptimizations();
|
|
@@ -10632,11 +10721,6 @@ class CallExpression extends CallExpressionBase {
|
|
|
10632
10721
|
this.annotationPure = this.annotations.some(comment => comment.type === 'pure');
|
|
10633
10722
|
}
|
|
10634
10723
|
}
|
|
10635
|
-
isSkippedAsOptional(origin) {
|
|
10636
|
-
return (this.callee.isSkippedAsOptional?.(origin) ||
|
|
10637
|
-
(this.optional &&
|
|
10638
|
-
this.callee.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, origin) == null));
|
|
10639
|
-
}
|
|
10640
10724
|
render(code, options, { renderedSurroundingElement } = parseAst_js.BLANK) {
|
|
10641
10725
|
this.callee.render(code, options, {
|
|
10642
10726
|
isCalleeOfRenderedParent: true,
|
|
@@ -10679,18 +10763,16 @@ class ChainExpression extends NodeBase {
|
|
|
10679
10763
|
// deoptimizations are not relevant as we are not caching values
|
|
10680
10764
|
deoptimizeCache() { }
|
|
10681
10765
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
return this.expression.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
10766
|
+
const literalValue = this.expression.getLiteralValueAtPathAsChainElement(path, recursionTracker, origin);
|
|
10767
|
+
return literalValue === IS_SKIPPED_CHAIN ? undefined : literalValue;
|
|
10685
10768
|
}
|
|
10686
10769
|
hasEffects(context) {
|
|
10687
|
-
|
|
10688
|
-
return false;
|
|
10689
|
-
return this.expression.hasEffects(context);
|
|
10770
|
+
return this.expression.hasEffectsAsChainElement(context) === true;
|
|
10690
10771
|
}
|
|
10691
10772
|
removeAnnotations(code) {
|
|
10692
10773
|
this.expression.removeAnnotations(code);
|
|
10693
10774
|
}
|
|
10775
|
+
applyDeoptimizations() { }
|
|
10694
10776
|
}
|
|
10695
10777
|
|
|
10696
10778
|
class ClassBodyScope extends ChildScope {
|
|
@@ -10727,6 +10809,15 @@ class ClassBody extends NodeBase {
|
|
|
10727
10809
|
applyDeoptimizations() { }
|
|
10728
10810
|
}
|
|
10729
10811
|
|
|
10812
|
+
function checkEffectForNodes(nodes, context) {
|
|
10813
|
+
for (const node of nodes) {
|
|
10814
|
+
if (node.hasEffects(context)) {
|
|
10815
|
+
return true;
|
|
10816
|
+
}
|
|
10817
|
+
}
|
|
10818
|
+
return false;
|
|
10819
|
+
}
|
|
10820
|
+
|
|
10730
10821
|
class MethodBase extends NodeBase {
|
|
10731
10822
|
constructor() {
|
|
10732
10823
|
super(...arguments);
|
|
@@ -10804,6 +10895,9 @@ class MethodBase extends NodeBase {
|
|
|
10804
10895
|
}
|
|
10805
10896
|
|
|
10806
10897
|
class MethodDefinition extends MethodBase {
|
|
10898
|
+
hasEffects(context) {
|
|
10899
|
+
return super.hasEffects(context) || checkEffectForNodes(this.decorators, context);
|
|
10900
|
+
}
|
|
10807
10901
|
applyDeoptimizations() { }
|
|
10808
10902
|
}
|
|
10809
10903
|
|
|
@@ -10890,7 +10984,7 @@ class ClassNode extends NodeBase {
|
|
|
10890
10984
|
this.applyDeoptimizations();
|
|
10891
10985
|
const initEffect = this.superClass?.hasEffects(context) || this.body.hasEffects(context);
|
|
10892
10986
|
this.id?.markDeclarationReached();
|
|
10893
|
-
return initEffect || super.hasEffects(context);
|
|
10987
|
+
return initEffect || super.hasEffects(context) || checkEffectForNodes(this.decorators, context);
|
|
10894
10988
|
}
|
|
10895
10989
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
10896
10990
|
return interaction.type === INTERACTION_CALLED && path.length === 0
|
|
@@ -10907,6 +11001,8 @@ class ClassNode extends NodeBase {
|
|
|
10907
11001
|
this.included = true;
|
|
10908
11002
|
this.superClass?.include(context, includeChildrenRecursively);
|
|
10909
11003
|
this.body.include(context, includeChildrenRecursively);
|
|
11004
|
+
for (const decorator of this.decorators)
|
|
11005
|
+
decorator.include(context, includeChildrenRecursively);
|
|
10910
11006
|
if (this.id) {
|
|
10911
11007
|
this.id.markDeclarationReached();
|
|
10912
11008
|
this.id.include();
|
|
@@ -11000,6 +11096,7 @@ class ClassDeclaration extends ClassNode {
|
|
|
11000
11096
|
}
|
|
11001
11097
|
const renderedVariable = variable.getName(getPropertyAccess);
|
|
11002
11098
|
if (renderedVariable !== name) {
|
|
11099
|
+
this.decorators.map(decorator => decorator.render(code, options));
|
|
11003
11100
|
this.superClass?.render(code, options);
|
|
11004
11101
|
this.body.render(code, {
|
|
11005
11102
|
...options,
|
|
@@ -11235,6 +11332,13 @@ class DebuggerStatement extends NodeBase {
|
|
|
11235
11332
|
}
|
|
11236
11333
|
}
|
|
11237
11334
|
|
|
11335
|
+
class Decorator extends NodeBase {
|
|
11336
|
+
hasEffects(context) {
|
|
11337
|
+
return (this.expression.hasEffects(context) ||
|
|
11338
|
+
this.expression.hasEffectsOnInteractionAtPath(EMPTY_PATH, NODE_INTERACTION_UNKNOWN_CALL, context));
|
|
11339
|
+
}
|
|
11340
|
+
}
|
|
11341
|
+
|
|
11238
11342
|
function hasLoopBodyEffects(context, body) {
|
|
11239
11343
|
const { brokenFlow, hasBreak, hasContinue, ignore } = context;
|
|
11240
11344
|
const { breaks, continues } = ignore;
|
|
@@ -12497,7 +12601,7 @@ class LogicalExpression extends NodeBase {
|
|
|
12497
12601
|
this.left.removeAnnotations(code);
|
|
12498
12602
|
}
|
|
12499
12603
|
else {
|
|
12500
|
-
code.remove(operatorPos, this.end);
|
|
12604
|
+
code.remove(findLastWhiteSpaceReverse(code.original, this.left.end, operatorPos), this.end);
|
|
12501
12605
|
}
|
|
12502
12606
|
this.getUsedBranch().render(code, options, {
|
|
12503
12607
|
isCalleeOfRenderedParent,
|
|
@@ -12957,7 +13061,9 @@ class PropertyDefinition extends NodeBase {
|
|
|
12957
13061
|
: UNKNOWN_RETURN_EXPRESSION;
|
|
12958
13062
|
}
|
|
12959
13063
|
hasEffects(context) {
|
|
12960
|
-
return this.key.hasEffects(context) ||
|
|
13064
|
+
return (this.key.hasEffects(context) ||
|
|
13065
|
+
(this.static && !!this.value?.hasEffects(context)) ||
|
|
13066
|
+
checkEffectForNodes(this.decorators, context));
|
|
12961
13067
|
}
|
|
12962
13068
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
12963
13069
|
return !this.value || this.value.hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
@@ -13867,6 +13973,7 @@ const nodeTypeStrings = [
|
|
|
13867
13973
|
'ConditionalExpression',
|
|
13868
13974
|
'ContinueStatement',
|
|
13869
13975
|
'DebuggerStatement',
|
|
13976
|
+
'Decorator',
|
|
13870
13977
|
'ExpressionStatement',
|
|
13871
13978
|
'DoWhileStatement',
|
|
13872
13979
|
'EmptyStatement',
|
|
@@ -13948,6 +14055,7 @@ const nodeConstructors$1 = [
|
|
|
13948
14055
|
ConditionalExpression,
|
|
13949
14056
|
ContinueStatement,
|
|
13950
14057
|
DebuggerStatement,
|
|
14058
|
+
Decorator,
|
|
13951
14059
|
ExpressionStatement,
|
|
13952
14060
|
DoWhileStatement,
|
|
13953
14061
|
EmptyStatement,
|
|
@@ -14099,22 +14207,24 @@ const bufferParsers = [
|
|
|
14099
14207
|
},
|
|
14100
14208
|
function classDeclaration(node, position, buffer) {
|
|
14101
14209
|
const { scope } = node;
|
|
14102
|
-
|
|
14210
|
+
node.decorators = convertNodeList(node, scope, buffer[position], buffer);
|
|
14211
|
+
const idPosition = buffer[position + 1];
|
|
14103
14212
|
node.id =
|
|
14104
14213
|
idPosition === 0 ? null : convertNode(node, scope.parent, idPosition, buffer);
|
|
14105
|
-
const superClassPosition = buffer[position +
|
|
14214
|
+
const superClassPosition = buffer[position + 2];
|
|
14106
14215
|
node.superClass =
|
|
14107
14216
|
superClassPosition === 0 ? null : convertNode(node, scope, superClassPosition, buffer);
|
|
14108
|
-
node.body = convertNode(node, scope, buffer[position +
|
|
14217
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
14109
14218
|
},
|
|
14110
14219
|
function classExpression(node, position, buffer) {
|
|
14111
14220
|
const { scope } = node;
|
|
14112
|
-
|
|
14221
|
+
node.decorators = convertNodeList(node, scope, buffer[position], buffer);
|
|
14222
|
+
const idPosition = buffer[position + 1];
|
|
14113
14223
|
node.id = idPosition === 0 ? null : convertNode(node, scope, idPosition, buffer);
|
|
14114
|
-
const superClassPosition = buffer[position +
|
|
14224
|
+
const superClassPosition = buffer[position + 2];
|
|
14115
14225
|
node.superClass =
|
|
14116
14226
|
superClassPosition === 0 ? null : convertNode(node, scope, superClassPosition, buffer);
|
|
14117
|
-
node.body = convertNode(node, scope, buffer[position +
|
|
14227
|
+
node.body = convertNode(node, scope, buffer[position + 3], buffer);
|
|
14118
14228
|
},
|
|
14119
14229
|
function conditionalExpression(node, position, buffer) {
|
|
14120
14230
|
const { scope } = node;
|
|
@@ -14128,6 +14238,10 @@ const bufferParsers = [
|
|
|
14128
14238
|
node.label = labelPosition === 0 ? null : convertNode(node, scope, labelPosition, buffer);
|
|
14129
14239
|
},
|
|
14130
14240
|
function debuggerStatement() { },
|
|
14241
|
+
function decorator(node, position, buffer) {
|
|
14242
|
+
const { scope } = node;
|
|
14243
|
+
node.expression = convertNode(node, scope, buffer[position], buffer);
|
|
14244
|
+
},
|
|
14131
14245
|
function directive(node, position, buffer) {
|
|
14132
14246
|
const { scope } = node;
|
|
14133
14247
|
node.directive = buffer.convertString(buffer[position]);
|
|
@@ -14328,9 +14442,10 @@ const bufferParsers = [
|
|
|
14328
14442
|
const flags = buffer[position];
|
|
14329
14443
|
node.static = (flags & 1) === 1;
|
|
14330
14444
|
node.computed = (flags & 2) === 2;
|
|
14331
|
-
node.
|
|
14332
|
-
node.
|
|
14333
|
-
node.
|
|
14445
|
+
node.decorators = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
14446
|
+
node.key = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14447
|
+
node.value = convertNode(node, scope, buffer[position + 3], buffer);
|
|
14448
|
+
node.kind = parseAst_js.FIXED_STRINGS[buffer[position + 4]];
|
|
14334
14449
|
},
|
|
14335
14450
|
function newExpression(node, position, buffer) {
|
|
14336
14451
|
const { scope } = node;
|
|
@@ -14370,8 +14485,9 @@ const bufferParsers = [
|
|
|
14370
14485
|
const flags = buffer[position];
|
|
14371
14486
|
node.static = (flags & 1) === 1;
|
|
14372
14487
|
node.computed = (flags & 2) === 2;
|
|
14373
|
-
node.
|
|
14374
|
-
|
|
14488
|
+
node.decorators = convertNodeList(node, scope, buffer[position + 1], buffer);
|
|
14489
|
+
node.key = convertNode(node, scope, buffer[position + 2], buffer);
|
|
14490
|
+
const valuePosition = buffer[position + 3];
|
|
14375
14491
|
node.value = valuePosition === 0 ? null : convertNode(node, scope, valuePosition, buffer);
|
|
14376
14492
|
},
|
|
14377
14493
|
function restElement(node, position, buffer) {
|
|
@@ -14535,6 +14651,7 @@ const nodeConstructors = {
|
|
|
14535
14651
|
ConditionalExpression,
|
|
14536
14652
|
ContinueStatement,
|
|
14537
14653
|
DebuggerStatement,
|
|
14654
|
+
Decorator,
|
|
14538
14655
|
DoWhileStatement,
|
|
14539
14656
|
EmptyStatement,
|
|
14540
14657
|
ExportAllDeclaration,
|
|
@@ -16067,8 +16184,11 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
|
|
|
16067
16184
|
return `${n}${n}${mechanism}${getSingleDefaultExport(exports, dependencies, interop, externalLiveBindings, getPropertyAccess)};`;
|
|
16068
16185
|
}
|
|
16069
16186
|
let exportBlock = '';
|
|
16070
|
-
|
|
16071
|
-
|
|
16187
|
+
if (namedExportsMode) {
|
|
16188
|
+
for (const { defaultVariableName, importPath, isChunk, name, namedExportsMode: depNamedExportsMode, namespaceVariableName, reexports } of dependencies) {
|
|
16189
|
+
if (!reexports) {
|
|
16190
|
+
continue;
|
|
16191
|
+
}
|
|
16072
16192
|
for (const specifier of reexports) {
|
|
16073
16193
|
if (specifier.reexported !== '*') {
|
|
16074
16194
|
const importName = getReexportedImportName(name, specifier.imported, depNamedExportsMode, isChunk, defaultVariableName, namespaceVariableName, interop, importPath, externalLiveBindings, getPropertyAccess);
|
|
@@ -16112,8 +16232,11 @@ function getExportBlock$1(exports, dependencies, namedExportsMode, interop, snip
|
|
|
16112
16232
|
: `${lhs}${_}=${_}${rhs};`;
|
|
16113
16233
|
}
|
|
16114
16234
|
}
|
|
16115
|
-
|
|
16116
|
-
|
|
16235
|
+
if (namedExportsMode) {
|
|
16236
|
+
for (const { name, reexports } of dependencies) {
|
|
16237
|
+
if (!reexports) {
|
|
16238
|
+
continue;
|
|
16239
|
+
}
|
|
16117
16240
|
for (const specifier of reexports) {
|
|
16118
16241
|
if (specifier.reexported === '*') {
|
|
16119
16242
|
if (exportBlock)
|
|
@@ -19567,7 +19690,7 @@ function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
|
19567
19690
|
|
|
19568
19691
|
function flru (max) {
|
|
19569
19692
|
var num, curr, prev;
|
|
19570
|
-
var limit = max
|
|
19693
|
+
var limit = max;
|
|
19571
19694
|
|
|
19572
19695
|
function keep(key, value) {
|
|
19573
19696
|
if (++num > limit) {
|
|
@@ -20891,7 +21014,7 @@ const getIndent = (config, compact) => {
|
|
|
20891
21014
|
return '';
|
|
20892
21015
|
}
|
|
20893
21016
|
const configIndent = config.indent;
|
|
20894
|
-
return configIndent === false ? '' : configIndent ?? true;
|
|
21017
|
+
return configIndent === false ? '' : (configIndent ?? true);
|
|
20895
21018
|
};
|
|
20896
21019
|
const ALLOWED_INTEROP_TYPES = new Set([
|
|
20897
21020
|
'compat',
|