@rollup/wasm-node 4.63.0 → 4.63.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 +3 -3
- 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 +174 -229
- package/dist/es/shared/parseAst.js +2 -2
- package/dist/es/shared/watch.js +54 -6
- package/dist/getLogFilter.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/parseAst.js +2 -2
- package/dist/rollup.js +2 -2
- package/dist/shared/fsevents-importer.js +2 -2
- package/dist/shared/index.js +54 -6
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/parseAst.js +2 -2
- package/dist/shared/rollup.js +173 -228
- 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 +8 -8
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v4.63.
|
|
4
|
-
|
|
3
|
+
Rollup.js v4.63.1
|
|
4
|
+
Fri, 28 Aug 2026 05:58:50 GMT - commit 78bfef0cb94479566f81012fafa372c84b90bd34
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -42,7 +42,7 @@ function _mergeNamespaces(n, m) {
|
|
|
42
42
|
|
|
43
43
|
const promises__namespace = /*#__PURE__*/_interopNamespaceDefault(promises);
|
|
44
44
|
|
|
45
|
-
var version = "4.63.
|
|
45
|
+
var version = "4.63.1";
|
|
46
46
|
const package_ = {
|
|
47
47
|
version: version};
|
|
48
48
|
|
|
@@ -1309,7 +1309,7 @@ function requireScan () {
|
|
|
1309
1309
|
const opts = options || {};
|
|
1310
1310
|
|
|
1311
1311
|
const length = input.length - 1;
|
|
1312
|
-
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
|
|
1312
|
+
const scanToEnd = opts.parts === true || opts.tokens === true || opts.scanToEnd === true;
|
|
1313
1313
|
const slashes = [];
|
|
1314
1314
|
const tokens = [];
|
|
1315
1315
|
const parts = [];
|
|
@@ -1443,15 +1443,21 @@ function requireScan () {
|
|
|
1443
1443
|
}
|
|
1444
1444
|
|
|
1445
1445
|
if (scanToEnd === true) {
|
|
1446
|
+
let parens = 0;
|
|
1447
|
+
|
|
1446
1448
|
while (eos() !== true && (code = advance())) {
|
|
1447
1449
|
if (code === CHAR_BACKWARD_SLASH) {
|
|
1448
1450
|
backslashes = token.backslashes = true;
|
|
1449
|
-
|
|
1451
|
+
advance();
|
|
1450
1452
|
continue;
|
|
1451
1453
|
}
|
|
1452
1454
|
|
|
1453
|
-
if (code ===
|
|
1454
|
-
|
|
1455
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1456
|
+
parens++;
|
|
1457
|
+
continue;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
1455
1461
|
finished = true;
|
|
1456
1462
|
break;
|
|
1457
1463
|
}
|
|
@@ -1516,14 +1522,21 @@ function requireScan () {
|
|
|
1516
1522
|
isGlob = token.isGlob = true;
|
|
1517
1523
|
|
|
1518
1524
|
if (scanToEnd === true) {
|
|
1525
|
+
let parens = 1;
|
|
1526
|
+
|
|
1519
1527
|
while (eos() !== true && (code = advance())) {
|
|
1520
|
-
if (code ===
|
|
1528
|
+
if (code === CHAR_BACKWARD_SLASH) {
|
|
1521
1529
|
backslashes = token.backslashes = true;
|
|
1522
|
-
|
|
1530
|
+
advance();
|
|
1523
1531
|
continue;
|
|
1524
1532
|
}
|
|
1525
1533
|
|
|
1526
|
-
if (code ===
|
|
1534
|
+
if (code === CHAR_LEFT_PARENTHESES) {
|
|
1535
|
+
parens++;
|
|
1536
|
+
continue;
|
|
1537
|
+
}
|
|
1538
|
+
|
|
1539
|
+
if (code === CHAR_RIGHT_PARENTHESES && --parens === 0) {
|
|
1527
1540
|
finished = true;
|
|
1528
1541
|
break;
|
|
1529
1542
|
}
|
|
@@ -1610,7 +1623,7 @@ function requireScan () {
|
|
|
1610
1623
|
let prevIndex;
|
|
1611
1624
|
|
|
1612
1625
|
for (let idx = 0; idx < slashes.length; idx++) {
|
|
1613
|
-
const n = prevIndex ? prevIndex + 1 : start;
|
|
1626
|
+
const n = prevIndex !== undefined ? prevIndex + 1 : start;
|
|
1614
1627
|
const i = slashes[idx];
|
|
1615
1628
|
const value = input.slice(n, i);
|
|
1616
1629
|
if (opts.tokens) {
|
|
@@ -1623,21 +1636,20 @@ function requireScan () {
|
|
|
1623
1636
|
depth(tokens[idx]);
|
|
1624
1637
|
state.maxDepth += tokens[idx].depth;
|
|
1625
1638
|
}
|
|
1626
|
-
if (
|
|
1639
|
+
if (i >= start) {
|
|
1627
1640
|
parts.push(value);
|
|
1641
|
+
prevIndex = i;
|
|
1628
1642
|
}
|
|
1629
|
-
prevIndex = i;
|
|
1630
1643
|
}
|
|
1631
1644
|
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1645
|
+
const n = prevIndex !== undefined ? prevIndex + 1 : start;
|
|
1646
|
+
const value = input.slice(n);
|
|
1647
|
+
parts.push(value);
|
|
1635
1648
|
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
}
|
|
1649
|
+
if (opts.tokens && prevIndex && prevIndex + 1 < input.length) {
|
|
1650
|
+
tokens[tokens.length - 1].value = value;
|
|
1651
|
+
depth(tokens[tokens.length - 1]);
|
|
1652
|
+
state.maxDepth += tokens[tokens.length - 1].depth;
|
|
1641
1653
|
}
|
|
1642
1654
|
|
|
1643
1655
|
state.slashes = slashes;
|
|
@@ -2188,9 +2200,33 @@ function requireParse () {
|
|
|
2188
2200
|
};
|
|
2189
2201
|
|
|
2190
2202
|
const extglobClose = token => {
|
|
2191
|
-
input.slice(token.startIndex, state.index + 1);
|
|
2203
|
+
const literal = input.slice(token.startIndex, state.index + 1);
|
|
2192
2204
|
const body = input.slice(token.startIndex + 2, state.index);
|
|
2193
|
-
analyzeRepeatedExtglob(body, opts);
|
|
2205
|
+
const analysis = analyzeRepeatedExtglob(body, opts);
|
|
2206
|
+
|
|
2207
|
+
if ((token.type === 'plus' || token.type === 'star') && analysis.risky) {
|
|
2208
|
+
const safeOutput = analysis.safeOutput
|
|
2209
|
+
? (token.output ? '' : ONE_CHAR) + (opts.capture ? `(${analysis.safeOutput})` : analysis.safeOutput)
|
|
2210
|
+
: undefined;
|
|
2211
|
+
const open = tokens[token.tokensIndex];
|
|
2212
|
+
|
|
2213
|
+
open.type = 'text';
|
|
2214
|
+
open.value = literal;
|
|
2215
|
+
open.output = safeOutput || utils.escapeRegex(literal);
|
|
2216
|
+
|
|
2217
|
+
for (let i = token.tokensIndex + 1; i < tokens.length; i++) {
|
|
2218
|
+
tokens[i].value = '';
|
|
2219
|
+
tokens[i].output = '';
|
|
2220
|
+
delete tokens[i].suffix;
|
|
2221
|
+
}
|
|
2222
|
+
|
|
2223
|
+
state.output = token.output + open.output;
|
|
2224
|
+
state.backtrack = true;
|
|
2225
|
+
|
|
2226
|
+
push({ type: 'paren', extglob: true, value, output: '' });
|
|
2227
|
+
decrement('parens');
|
|
2228
|
+
return;
|
|
2229
|
+
}
|
|
2194
2230
|
|
|
2195
2231
|
let output = token.close + (opts.capture ? ')' : '');
|
|
2196
2232
|
let rest;
|
|
@@ -2802,6 +2838,15 @@ function requireParse () {
|
|
|
2802
2838
|
consume('/**', 3);
|
|
2803
2839
|
}
|
|
2804
2840
|
|
|
2841
|
+
// A globstar followed only by balanced closing parens is at the logical end of patterns like
|
|
2842
|
+
// `test(/utils/**)` and `test?(/utils/**)`. Treat it as EOS so the trailing `/**` can match its
|
|
2843
|
+
// parent path, except in negated extglobs where that would change the exclusion semantics.
|
|
2844
|
+
const isEnd = eos() || (
|
|
2845
|
+
state.parens > 0
|
|
2846
|
+
&& rest === ')'.repeat(state.parens)
|
|
2847
|
+
&& !extglobs.some(extglob => extglob.type === 'negate')
|
|
2848
|
+
);
|
|
2849
|
+
|
|
2805
2850
|
if (prior.type === 'bos' && eos()) {
|
|
2806
2851
|
prev.type = 'globstar';
|
|
2807
2852
|
prev.value += value;
|
|
@@ -2812,7 +2857,7 @@ function requireParse () {
|
|
|
2812
2857
|
continue;
|
|
2813
2858
|
}
|
|
2814
2859
|
|
|
2815
|
-
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar &&
|
|
2860
|
+
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && isEnd) {
|
|
2816
2861
|
state.output = state.output.slice(0, -(prior.output + prev.output).length);
|
|
2817
2862
|
prior.output = `(?:${prior.output}`;
|
|
2818
2863
|
|
|
@@ -6202,17 +6247,8 @@ class ExpressionEntity {
|
|
|
6202
6247
|
return true;
|
|
6203
6248
|
}
|
|
6204
6249
|
}
|
|
6205
|
-
class
|
|
6206
|
-
|
|
6207
|
-
super();
|
|
6208
|
-
this.value = value;
|
|
6209
|
-
this.parent = parent;
|
|
6210
|
-
}
|
|
6211
|
-
getLiteralValueAtPath(path) {
|
|
6212
|
-
return path.length > 0 ? UnknownValue : this.value;
|
|
6213
|
-
}
|
|
6214
|
-
}
|
|
6215
|
-
const UNKNOWN_EXPRESSION = new LiteralExpression(UnknownValue);
|
|
6250
|
+
const UNKNOWN_EXPRESSION = new (class UnknownExpression extends ExpressionEntity {
|
|
6251
|
+
})();
|
|
6216
6252
|
const UNKNOWN_RETURN_EXPRESSION = [
|
|
6217
6253
|
UNKNOWN_EXPRESSION,
|
|
6218
6254
|
false
|
|
@@ -6942,7 +6978,11 @@ function isExpressionStatementNode(node) {
|
|
|
6942
6978
|
function assembleMemberDescriptions(memberDescriptions, inheritedDescriptions = null) {
|
|
6943
6979
|
return Object.create(inheritedDescriptions, memberDescriptions);
|
|
6944
6980
|
}
|
|
6945
|
-
const UNDEFINED_EXPRESSION = new
|
|
6981
|
+
const UNDEFINED_EXPRESSION = new (class UndefinedExpression extends ExpressionEntity {
|
|
6982
|
+
getLiteralValueAtPath(path) {
|
|
6983
|
+
return path.length > 0 ? UnknownValue : undefined;
|
|
6984
|
+
}
|
|
6985
|
+
})();
|
|
6946
6986
|
const returnsUnknown = {
|
|
6947
6987
|
value: {
|
|
6948
6988
|
hasEffectsWhenCalled: null,
|
|
@@ -7123,7 +7163,7 @@ function getLiteralMembersForValue(value) {
|
|
|
7123
7163
|
return literalStringMembers;
|
|
7124
7164
|
}
|
|
7125
7165
|
}
|
|
7126
|
-
return
|
|
7166
|
+
return Object.create(null);
|
|
7127
7167
|
}
|
|
7128
7168
|
function hasMemberEffectWhenCalled(members, memberName, interaction, context) {
|
|
7129
7169
|
if (typeof memberName !== 'string' || !members[memberName]) {
|
|
@@ -7423,8 +7463,6 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
7423
7463
|
// causes an issue with TypeScript enums in files with moduleSideEffects:
|
|
7424
7464
|
// false because we cannot properly track whether a "var" has been
|
|
7425
7465
|
// initialized. This should be reverted once we can properly track this.
|
|
7426
|
-
// ALSO needs to be updated once this is resolved:
|
|
7427
|
-
// - literals-from-return-expressions-branches/main.js
|
|
7428
7466
|
// return UnknownTruthyValue;
|
|
7429
7467
|
return UnknownValue;
|
|
7430
7468
|
}
|
|
@@ -10125,156 +10163,6 @@ class ThisVariable extends ParameterVariable {
|
|
|
10125
10163
|
}
|
|
10126
10164
|
}
|
|
10127
10165
|
|
|
10128
|
-
const UNASSIGNED = Symbol('unassigned');
|
|
10129
|
-
|
|
10130
|
-
class ReturnStatement extends NodeBase {
|
|
10131
|
-
constructor() {
|
|
10132
|
-
super(...arguments);
|
|
10133
|
-
this.expressionsToBeDeoptimized = [];
|
|
10134
|
-
}
|
|
10135
|
-
checkReached(origin) {
|
|
10136
|
-
if (this.deoptimized)
|
|
10137
|
-
return true;
|
|
10138
|
-
this.expressionsToBeDeoptimized.push(origin);
|
|
10139
|
-
return false;
|
|
10140
|
-
}
|
|
10141
|
-
applyDeoptimizations() {
|
|
10142
|
-
this.deoptimized = true;
|
|
10143
|
-
const { expressionsToBeDeoptimized } = this;
|
|
10144
|
-
if (expressionsToBeDeoptimized.length) {
|
|
10145
|
-
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_ARRAY;
|
|
10146
|
-
for (const expression of expressionsToBeDeoptimized) {
|
|
10147
|
-
expression.deoptimizeCache();
|
|
10148
|
-
}
|
|
10149
|
-
this.scope.context.requestTreeshakingPass();
|
|
10150
|
-
}
|
|
10151
|
-
}
|
|
10152
|
-
hasEffects(context) {
|
|
10153
|
-
if (!this.deoptimized)
|
|
10154
|
-
this.applyDeoptimizations();
|
|
10155
|
-
if (!context.ignore.returnYield || this.argument?.hasEffects(context))
|
|
10156
|
-
return true;
|
|
10157
|
-
context.brokenFlow = true;
|
|
10158
|
-
return false;
|
|
10159
|
-
}
|
|
10160
|
-
include(context, includeChildrenRecursively) {
|
|
10161
|
-
if (!this.included)
|
|
10162
|
-
this.includeNode(context);
|
|
10163
|
-
this.argument?.include(context, includeChildrenRecursively);
|
|
10164
|
-
context.brokenFlow = true;
|
|
10165
|
-
}
|
|
10166
|
-
includeNode(context) {
|
|
10167
|
-
this.included = true;
|
|
10168
|
-
if (!this.deoptimized)
|
|
10169
|
-
this.applyDeoptimizations();
|
|
10170
|
-
this.argument?.includePath(UNKNOWN_PATH, context);
|
|
10171
|
-
}
|
|
10172
|
-
initialise() {
|
|
10173
|
-
super.initialise();
|
|
10174
|
-
this.scope.addReturnExpression(this.argument || new LiteralExpression(undefined, this));
|
|
10175
|
-
}
|
|
10176
|
-
render(code, options) {
|
|
10177
|
-
if (this.argument) {
|
|
10178
|
-
this.argument.render(code, options, { preventASI: true });
|
|
10179
|
-
if (this.argument.start === this.start + 6 /* 'return'.length */) {
|
|
10180
|
-
code.prependLeft(this.start + 6, ' ');
|
|
10181
|
-
}
|
|
10182
|
-
}
|
|
10183
|
-
}
|
|
10184
|
-
}
|
|
10185
|
-
|
|
10186
|
-
function mergeValues(a, b) {
|
|
10187
|
-
if (a === b)
|
|
10188
|
-
return a;
|
|
10189
|
-
if (a === UnknownTruthyValue) {
|
|
10190
|
-
if (b && b !== UnknownFalsyValue)
|
|
10191
|
-
return UnknownTruthyValue;
|
|
10192
|
-
return UnknownValue;
|
|
10193
|
-
}
|
|
10194
|
-
if (a === UnknownFalsyValue) {
|
|
10195
|
-
if (!b || b === UnknownFalsyValue)
|
|
10196
|
-
return UnknownFalsyValue;
|
|
10197
|
-
return UnknownValue;
|
|
10198
|
-
}
|
|
10199
|
-
if (a && b)
|
|
10200
|
-
return UnknownTruthyValue;
|
|
10201
|
-
if (!a && !b)
|
|
10202
|
-
return UnknownFalsyValue;
|
|
10203
|
-
return UnknownValue;
|
|
10204
|
-
}
|
|
10205
|
-
class MultiExpression extends ExpressionEntity {
|
|
10206
|
-
constructor(expressions) {
|
|
10207
|
-
super();
|
|
10208
|
-
this.expressions = expressions;
|
|
10209
|
-
this.literalValue = UNASSIGNED;
|
|
10210
|
-
this.dependantEntities = new Set();
|
|
10211
|
-
}
|
|
10212
|
-
deoptimizeCache() {
|
|
10213
|
-
if (this.literalValue !== UNASSIGNED) {
|
|
10214
|
-
const { dependantEntities } = this;
|
|
10215
|
-
this.literalValue = UNASSIGNED;
|
|
10216
|
-
this.dependantEntities = new Set();
|
|
10217
|
-
for (const entity of dependantEntities) {
|
|
10218
|
-
entity.deoptimizeCache();
|
|
10219
|
-
}
|
|
10220
|
-
}
|
|
10221
|
-
}
|
|
10222
|
-
deoptimizePath(path) {
|
|
10223
|
-
for (const expression of this.expressions) {
|
|
10224
|
-
expression.deoptimizePath(path);
|
|
10225
|
-
}
|
|
10226
|
-
}
|
|
10227
|
-
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
10228
|
-
if (path.length === 0) {
|
|
10229
|
-
if (this.literalValue === UNASSIGNED)
|
|
10230
|
-
this.literalValue = this.doGetLiteralValueAtPath(path, recursionTracker, this);
|
|
10231
|
-
this.dependantEntities.add(origin);
|
|
10232
|
-
return this.literalValue;
|
|
10233
|
-
}
|
|
10234
|
-
return this.doGetLiteralValueAtPath(path, recursionTracker, origin);
|
|
10235
|
-
}
|
|
10236
|
-
doGetLiteralValueAtPath(path, recursionTracker, origin) {
|
|
10237
|
-
let value = UnknownValue;
|
|
10238
|
-
for (const expression of this.expressions) {
|
|
10239
|
-
if (this.isTreeshaken(expression))
|
|
10240
|
-
continue;
|
|
10241
|
-
const expressionValue = expression.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
10242
|
-
if (expressionValue === UnknownValue)
|
|
10243
|
-
return UnknownValue;
|
|
10244
|
-
if (value === UnknownValue) {
|
|
10245
|
-
value = expressionValue;
|
|
10246
|
-
continue;
|
|
10247
|
-
}
|
|
10248
|
-
value = mergeValues(value, expressionValue);
|
|
10249
|
-
if (value === UnknownValue)
|
|
10250
|
-
return UnknownValue;
|
|
10251
|
-
}
|
|
10252
|
-
return value;
|
|
10253
|
-
}
|
|
10254
|
-
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
10255
|
-
const returnExpressions = this.expressions.map(expression => expression.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin));
|
|
10256
|
-
let pure = true;
|
|
10257
|
-
return [
|
|
10258
|
-
new MultiExpression(returnExpressions.map(expression => ((pure &&= expression[1]), expression[0]))),
|
|
10259
|
-
pure
|
|
10260
|
-
];
|
|
10261
|
-
}
|
|
10262
|
-
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
10263
|
-
for (const expression of this.expressions) {
|
|
10264
|
-
if (!this.isTreeshaken(expression) &&
|
|
10265
|
-
expression.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
10266
|
-
return true;
|
|
10267
|
-
}
|
|
10268
|
-
return false;
|
|
10269
|
-
}
|
|
10270
|
-
isTreeshaken(expression) {
|
|
10271
|
-
if ('parent' in expression && expression.parent instanceof ReturnStatement) {
|
|
10272
|
-
return !expression.parent.checkReached(this);
|
|
10273
|
-
}
|
|
10274
|
-
return false;
|
|
10275
|
-
}
|
|
10276
|
-
}
|
|
10277
|
-
|
|
10278
10166
|
class CatchBodyScope extends ChildScope {
|
|
10279
10167
|
constructor(parent) {
|
|
10280
10168
|
super(parent, parent.context);
|
|
@@ -10484,12 +10372,8 @@ class ReturnValueScope extends ParameterScope {
|
|
|
10484
10372
|
}
|
|
10485
10373
|
}
|
|
10486
10374
|
getReturnExpression() {
|
|
10487
|
-
if (
|
|
10488
|
-
this.
|
|
10489
|
-
this.returnExpressions.length === 1
|
|
10490
|
-
? this.returnExpressions[0]
|
|
10491
|
-
: new MultiExpression(this.returnExpressions);
|
|
10492
|
-
}
|
|
10375
|
+
if (this.returnExpression === null)
|
|
10376
|
+
this.updateReturnExpression();
|
|
10493
10377
|
return this.returnExpression;
|
|
10494
10378
|
}
|
|
10495
10379
|
deoptimizeAllParameters() {
|
|
@@ -10508,6 +10392,17 @@ class ReturnValueScope extends ParameterScope {
|
|
|
10508
10392
|
}
|
|
10509
10393
|
}
|
|
10510
10394
|
addArgumentToBeDeoptimized(_argument) { }
|
|
10395
|
+
updateReturnExpression() {
|
|
10396
|
+
if (this.returnExpressions.length === 1) {
|
|
10397
|
+
this.returnExpression = this.returnExpressions[0];
|
|
10398
|
+
}
|
|
10399
|
+
else {
|
|
10400
|
+
this.returnExpression = UNKNOWN_EXPRESSION;
|
|
10401
|
+
for (const expression of this.returnExpressions) {
|
|
10402
|
+
expression.deoptimizePath(UNKNOWN_PATH);
|
|
10403
|
+
}
|
|
10404
|
+
}
|
|
10405
|
+
}
|
|
10511
10406
|
}
|
|
10512
10407
|
|
|
10513
10408
|
class FunctionScope extends ReturnValueScope {
|
|
@@ -10569,10 +10464,6 @@ ExpressionStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize;
|
|
|
10569
10464
|
ExpressionStatement.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
10570
10465
|
|
|
10571
10466
|
class BlockStatement extends NodeBase {
|
|
10572
|
-
constructor() {
|
|
10573
|
-
super(...arguments);
|
|
10574
|
-
this.virtualReturnStatement = null;
|
|
10575
|
-
}
|
|
10576
10467
|
get deoptimizeBody() {
|
|
10577
10468
|
return isFlagSet(this.flags, 32768 /* Flag.deoptimizeBody */);
|
|
10578
10469
|
}
|
|
@@ -10588,13 +10479,7 @@ class BlockStatement extends NodeBase {
|
|
|
10588
10479
|
addImplicitReturnExpressionToScope() {
|
|
10589
10480
|
const lastStatement = this.body[this.body.length - 1];
|
|
10590
10481
|
if (!lastStatement || lastStatement.type !== parseAst_js.ReturnStatement) {
|
|
10591
|
-
|
|
10592
|
-
virtualReturnStatement.type = parseAst_js.ReturnStatement;
|
|
10593
|
-
virtualReturnStatement.argument = null;
|
|
10594
|
-
virtualReturnStatement.initialise();
|
|
10595
|
-
if (this.deoptimizeBody)
|
|
10596
|
-
virtualReturnStatement.includeNode(createInclusionContext());
|
|
10597
|
-
this.virtualReturnStatement = virtualReturnStatement;
|
|
10482
|
+
this.scope.addReturnExpression(UNKNOWN_EXPRESSION);
|
|
10598
10483
|
}
|
|
10599
10484
|
}
|
|
10600
10485
|
createScope(parentScope) {
|
|
@@ -10605,15 +10490,13 @@ class BlockStatement extends NodeBase {
|
|
|
10605
10490
|
hasEffects(context) {
|
|
10606
10491
|
if (this.deoptimizeBody)
|
|
10607
10492
|
return true;
|
|
10608
|
-
let hasEffect = false;
|
|
10609
10493
|
for (const node of this.body) {
|
|
10610
|
-
if (context.brokenFlow
|
|
10494
|
+
if (context.brokenFlow)
|
|
10611
10495
|
break;
|
|
10496
|
+
if (node.hasEffects(context))
|
|
10497
|
+
return true;
|
|
10612
10498
|
}
|
|
10613
|
-
|
|
10614
|
-
hasEffect ||= !!this.virtualReturnStatement?.hasEffects(context);
|
|
10615
|
-
}
|
|
10616
|
-
return hasEffect;
|
|
10499
|
+
return false;
|
|
10617
10500
|
}
|
|
10618
10501
|
include(context, includeChildrenRecursively) {
|
|
10619
10502
|
if (!(this.deoptimizeBody && this.directlyIncluded)) {
|
|
@@ -10625,8 +10508,6 @@ class BlockStatement extends NodeBase {
|
|
|
10625
10508
|
if (includeChildrenRecursively || node.shouldBeIncluded(context))
|
|
10626
10509
|
node.include(context, includeChildrenRecursively);
|
|
10627
10510
|
}
|
|
10628
|
-
if (includeChildrenRecursively || !context.brokenFlow)
|
|
10629
|
-
this.virtualReturnStatement?.include(context, includeChildrenRecursively);
|
|
10630
10511
|
}
|
|
10631
10512
|
}
|
|
10632
10513
|
initialise() {
|
|
@@ -11639,7 +11520,7 @@ class MemberExpression extends NodeBase {
|
|
|
11639
11520
|
if (!this.included)
|
|
11640
11521
|
this.includeNode(context);
|
|
11641
11522
|
if (this.variable) {
|
|
11642
|
-
this.variable
|
|
11523
|
+
this.variable?.includePath(path, context);
|
|
11643
11524
|
}
|
|
11644
11525
|
else if (!this.isUndefined) {
|
|
11645
11526
|
this.object.includePath([
|
|
@@ -13847,10 +13728,11 @@ const binaryOperators = {
|
|
|
13847
13728
|
// in: () => UnknownValue,
|
|
13848
13729
|
// instanceof: () => UnknownValue,
|
|
13849
13730
|
};
|
|
13731
|
+
const UNASSIGNED$1 = Symbol('Unassigned');
|
|
13850
13732
|
class BinaryExpression extends NodeBase {
|
|
13851
13733
|
constructor() {
|
|
13852
13734
|
super(...arguments);
|
|
13853
|
-
this.renderedLiteralValue = UNASSIGNED;
|
|
13735
|
+
this.renderedLiteralValue = UNASSIGNED$1;
|
|
13854
13736
|
}
|
|
13855
13737
|
deoptimizeCache() {
|
|
13856
13738
|
this.renderedLiteralValue = UnknownValue;
|
|
@@ -13883,7 +13765,7 @@ class BinaryExpression extends NodeBase {
|
|
|
13883
13765
|
if (this.operator !== 'in' || !(this.right.variable instanceof NamespaceVariable)) {
|
|
13884
13766
|
return UnknownValue;
|
|
13885
13767
|
}
|
|
13886
|
-
if (this.renderedLiteralValue !== UNASSIGNED)
|
|
13768
|
+
if (this.renderedLiteralValue !== UNASSIGNED$1)
|
|
13887
13769
|
return this.renderedLiteralValue;
|
|
13888
13770
|
return (this.renderedLiteralValue = getRenderedLiteralValue(this.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this)));
|
|
13889
13771
|
}
|
|
@@ -14018,10 +13900,10 @@ class CallExpressionBase extends NodeBase {
|
|
|
14018
13900
|
}
|
|
14019
13901
|
deoptimizeCache() {
|
|
14020
13902
|
if (this.returnExpression?.[0] !== UNKNOWN_EXPRESSION) {
|
|
14021
|
-
this.returnExpression =
|
|
13903
|
+
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
14022
13904
|
const { deoptimizableDependentExpressions, expressionsToBeDeoptimized } = this;
|
|
14023
|
-
this.expressionsToBeDeoptimized =
|
|
14024
|
-
this.deoptimizableDependentExpressions =
|
|
13905
|
+
this.expressionsToBeDeoptimized = parseAst_js.EMPTY_SET;
|
|
13906
|
+
this.deoptimizableDependentExpressions = parseAst_js.EMPTY_ARRAY;
|
|
14025
13907
|
for (const expression of deoptimizableDependentExpressions) {
|
|
14026
13908
|
expression.deoptimizeCache();
|
|
14027
13909
|
}
|
|
@@ -14047,7 +13929,7 @@ class CallExpressionBase extends NodeBase {
|
|
|
14047
13929
|
}
|
|
14048
13930
|
return recursionTracker.withTrackedEntityAtPath(path, returnExpression, () => {
|
|
14049
13931
|
this.deoptimizableDependentExpressions.push(origin);
|
|
14050
|
-
return returnExpression.getLiteralValueAtPath(path, recursionTracker,
|
|
13932
|
+
return returnExpression.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
14051
13933
|
}, UnknownValue);
|
|
14052
13934
|
}
|
|
14053
13935
|
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
@@ -14159,6 +14041,11 @@ class CallExpression extends CallExpressionBase {
|
|
|
14159
14041
|
this.callee.includeCallArguments(this.interaction, context);
|
|
14160
14042
|
}
|
|
14161
14043
|
}
|
|
14044
|
+
includeNode(_context) {
|
|
14045
|
+
this.included = true;
|
|
14046
|
+
if (!this.deoptimized)
|
|
14047
|
+
this.applyDeoptimizations();
|
|
14048
|
+
}
|
|
14162
14049
|
initialise() {
|
|
14163
14050
|
super.initialise();
|
|
14164
14051
|
if (this.annotations &&
|
|
@@ -14190,13 +14077,12 @@ class CallExpression extends CallExpressionBase {
|
|
|
14190
14077
|
}
|
|
14191
14078
|
getReturnExpression(recursionTracker = SHARED_RECURSION_TRACKER) {
|
|
14192
14079
|
if (this.returnExpression === null) {
|
|
14193
|
-
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
14194
|
-
this.returnExpression = this.callee.getReturnExpressionWhenCalledAtPath(EMPTY_PATH, this.interaction, recursionTracker, this);
|
|
14080
|
+
this.returnExpression = UNKNOWN_RETURN_EXPRESSION;
|
|
14081
|
+
return (this.returnExpression = this.callee.getReturnExpressionWhenCalledAtPath(EMPTY_PATH, this.interaction, recursionTracker, this));
|
|
14195
14082
|
}
|
|
14196
14083
|
return this.returnExpression;
|
|
14197
14084
|
}
|
|
14198
14085
|
}
|
|
14199
|
-
CallExpression.prototype.includeNode = onlyIncludeSelf;
|
|
14200
14086
|
|
|
14201
14087
|
class CatchClause extends NodeBase {
|
|
14202
14088
|
createScope(parentScope) {
|
|
@@ -14296,6 +14182,31 @@ function tryCastLiteralValueToBoolean(literalValue) {
|
|
|
14296
14182
|
return !!literalValue;
|
|
14297
14183
|
}
|
|
14298
14184
|
|
|
14185
|
+
class MultiExpression extends ExpressionEntity {
|
|
14186
|
+
constructor(expressions) {
|
|
14187
|
+
super();
|
|
14188
|
+
this.expressions = expressions;
|
|
14189
|
+
}
|
|
14190
|
+
deoptimizePath(path) {
|
|
14191
|
+
for (const expression of this.expressions) {
|
|
14192
|
+
expression.deoptimizePath(path);
|
|
14193
|
+
}
|
|
14194
|
+
}
|
|
14195
|
+
getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin) {
|
|
14196
|
+
return [
|
|
14197
|
+
new MultiExpression(this.expressions.map(expression => expression.getReturnExpressionWhenCalledAtPath(path, interaction, recursionTracker, origin)[0])),
|
|
14198
|
+
false
|
|
14199
|
+
];
|
|
14200
|
+
}
|
|
14201
|
+
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
14202
|
+
for (const expression of this.expressions) {
|
|
14203
|
+
if (expression.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
14204
|
+
return true;
|
|
14205
|
+
}
|
|
14206
|
+
return false;
|
|
14207
|
+
}
|
|
14208
|
+
}
|
|
14209
|
+
|
|
14299
14210
|
class ConditionalExpression extends NodeBase {
|
|
14300
14211
|
constructor() {
|
|
14301
14212
|
super(...arguments);
|
|
@@ -14799,13 +14710,14 @@ class TrackingScope extends BlockScope {
|
|
|
14799
14710
|
}
|
|
14800
14711
|
}
|
|
14801
14712
|
|
|
14713
|
+
const unset = Symbol('unset');
|
|
14802
14714
|
class IfStatement extends NodeBase {
|
|
14803
14715
|
constructor() {
|
|
14804
14716
|
super(...arguments);
|
|
14805
|
-
this.testValue =
|
|
14717
|
+
this.testValue = unset;
|
|
14806
14718
|
}
|
|
14807
14719
|
deoptimizeCache() {
|
|
14808
|
-
this.testValue =
|
|
14720
|
+
this.testValue = UnknownValue;
|
|
14809
14721
|
}
|
|
14810
14722
|
hasEffects(context) {
|
|
14811
14723
|
if (this.test.hasEffects(context)) {
|
|
@@ -14894,8 +14806,8 @@ class IfStatement extends NodeBase {
|
|
|
14894
14806
|
this.renderHoistedDeclarations(hoistedDeclarations, code, getPropertyAccess);
|
|
14895
14807
|
}
|
|
14896
14808
|
getTestValue() {
|
|
14897
|
-
if (this.testValue ===
|
|
14898
|
-
this.testValue = tryCastLiteralValueToBoolean(this.test.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this));
|
|
14809
|
+
if (this.testValue === unset) {
|
|
14810
|
+
return (this.testValue = tryCastLiteralValueToBoolean(this.test.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this)));
|
|
14899
14811
|
}
|
|
14900
14812
|
return this.testValue;
|
|
14901
14813
|
}
|
|
@@ -16549,6 +16461,38 @@ class PropertyDefinition extends NodeBase {
|
|
|
16549
16461
|
}
|
|
16550
16462
|
PropertyDefinition.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
16551
16463
|
|
|
16464
|
+
class ReturnStatement extends NodeBase {
|
|
16465
|
+
hasEffects(context) {
|
|
16466
|
+
if (!context.ignore.returnYield || this.argument?.hasEffects(context))
|
|
16467
|
+
return true;
|
|
16468
|
+
context.brokenFlow = true;
|
|
16469
|
+
return false;
|
|
16470
|
+
}
|
|
16471
|
+
include(context, includeChildrenRecursively) {
|
|
16472
|
+
if (!this.included)
|
|
16473
|
+
this.includeNode(context);
|
|
16474
|
+
this.argument?.include(context, includeChildrenRecursively);
|
|
16475
|
+
context.brokenFlow = true;
|
|
16476
|
+
}
|
|
16477
|
+
includeNode(context) {
|
|
16478
|
+
this.included = true;
|
|
16479
|
+
this.argument?.includePath(UNKNOWN_PATH, context);
|
|
16480
|
+
}
|
|
16481
|
+
initialise() {
|
|
16482
|
+
super.initialise();
|
|
16483
|
+
this.scope.addReturnExpression(this.argument || UNKNOWN_EXPRESSION);
|
|
16484
|
+
}
|
|
16485
|
+
render(code, options) {
|
|
16486
|
+
if (this.argument) {
|
|
16487
|
+
this.argument.render(code, options, { preventASI: true });
|
|
16488
|
+
if (this.argument.start === this.start + 6 /* 'return'.length */) {
|
|
16489
|
+
code.prependLeft(this.start + 6, ' ');
|
|
16490
|
+
}
|
|
16491
|
+
}
|
|
16492
|
+
}
|
|
16493
|
+
}
|
|
16494
|
+
ReturnStatement.prototype.applyDeoptimizations = doNotDeoptimize;
|
|
16495
|
+
|
|
16552
16496
|
class SequenceExpression extends NodeBase {
|
|
16553
16497
|
deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker) {
|
|
16554
16498
|
this.expressions[this.expressions.length - 1].deoptimizeArgumentsOnInteractionAtPath(interaction, path, recursionTracker);
|
|
@@ -17072,6 +17016,7 @@ const unaryOperators = {
|
|
|
17072
17016
|
void: () => undefined,
|
|
17073
17017
|
'~': value => ~value
|
|
17074
17018
|
};
|
|
17019
|
+
const UNASSIGNED = Symbol('Unassigned');
|
|
17075
17020
|
class UnaryExpression extends NodeBase {
|
|
17076
17021
|
constructor() {
|
|
17077
17022
|
super(...arguments);
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
|
Binary file
|