rollup 2.50.2 → 2.50.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +2 -2
- package/dist/es/shared/rollup.js +124 -59
- package/dist/es/shared/watch.js +2 -2
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +124 -59
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.50.
|
|
4
|
-
Thu,
|
|
3
|
+
Rollup.js v2.50.6
|
|
4
|
+
Thu, 03 Jun 2021 04:54:09 GMT - commit 9f69fe3f53ae50dffe932529a3503e619292d31a
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -32,7 +32,7 @@ function _interopNamespaceDefault(e) {
|
|
|
32
32
|
|
|
33
33
|
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
34
34
|
|
|
35
|
-
var version$1 = "2.50.
|
|
35
|
+
var version$1 = "2.50.6";
|
|
36
36
|
|
|
37
37
|
function ensureArray(items) {
|
|
38
38
|
if (Array.isArray(items)) {
|
|
@@ -3465,10 +3465,11 @@ const knownGlobals = {
|
|
|
3465
3465
|
Promise: {
|
|
3466
3466
|
__proto__: null,
|
|
3467
3467
|
[ValueProperties]: IMPURE,
|
|
3468
|
-
all:
|
|
3468
|
+
all: O,
|
|
3469
3469
|
prototype: O,
|
|
3470
|
-
race:
|
|
3471
|
-
|
|
3470
|
+
race: O,
|
|
3471
|
+
reject: O,
|
|
3472
|
+
resolve: O
|
|
3472
3473
|
},
|
|
3473
3474
|
propertyIsEnumerable: O,
|
|
3474
3475
|
Proxy: O,
|
|
@@ -4262,6 +4263,7 @@ class Identifier extends NodeBase {
|
|
|
4262
4263
|
this.deoptimized = true;
|
|
4263
4264
|
if (this.variable !== null && this.variable instanceof LocalVariable) {
|
|
4264
4265
|
this.variable.consolidateInitializers();
|
|
4266
|
+
this.context.requestTreeshakingPass();
|
|
4265
4267
|
}
|
|
4266
4268
|
}
|
|
4267
4269
|
disallowImportReassignment() {
|
|
@@ -5053,11 +5055,22 @@ class SpreadElement extends NodeBase {
|
|
|
5053
5055
|
this.argument.deoptimizeThisOnEventAtPath(event, [UnknownKey, ...path], thisParameter, recursionTracker);
|
|
5054
5056
|
}
|
|
5055
5057
|
}
|
|
5058
|
+
hasEffects(context) {
|
|
5059
|
+
if (!this.deoptimized)
|
|
5060
|
+
this.applyDeoptimizations();
|
|
5061
|
+
const { propertyReadSideEffects } = this.context.options
|
|
5062
|
+
.treeshake;
|
|
5063
|
+
return (this.argument.hasEffects(context) ||
|
|
5064
|
+
(propertyReadSideEffects &&
|
|
5065
|
+
(propertyReadSideEffects === 'always' ||
|
|
5066
|
+
this.argument.hasEffectsWhenAccessedAtPath(UNKNOWN_PATH, context))));
|
|
5067
|
+
}
|
|
5056
5068
|
applyDeoptimizations() {
|
|
5057
5069
|
this.deoptimized = true;
|
|
5058
5070
|
// Only properties of properties of the argument could become subject to reassignment
|
|
5059
5071
|
// This will also reassign the return values of iterators
|
|
5060
5072
|
this.argument.deoptimizePath([UnknownKey, UnknownKey]);
|
|
5073
|
+
this.context.requestTreeshakingPass();
|
|
5061
5074
|
}
|
|
5062
5075
|
}
|
|
5063
5076
|
|
|
@@ -5207,6 +5220,7 @@ class RestElement extends NodeBase {
|
|
|
5207
5220
|
this.deoptimized = true;
|
|
5208
5221
|
if (this.declarationInit !== null) {
|
|
5209
5222
|
this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]);
|
|
5223
|
+
this.context.requestTreeshakingPass();
|
|
5210
5224
|
}
|
|
5211
5225
|
}
|
|
5212
5226
|
}
|
|
@@ -5244,7 +5258,7 @@ class FunctionNode extends NodeBase {
|
|
|
5244
5258
|
}
|
|
5245
5259
|
}
|
|
5246
5260
|
getReturnExpressionWhenCalledAtPath(path) {
|
|
5247
|
-
return path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
|
|
5261
|
+
return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
|
|
5248
5262
|
}
|
|
5249
5263
|
hasEffects() {
|
|
5250
5264
|
return this.id !== null && this.id.hasEffects();
|
|
@@ -5263,6 +5277,17 @@ class FunctionNode extends NodeBase {
|
|
|
5263
5277
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
5264
5278
|
if (path.length > 0)
|
|
5265
5279
|
return true;
|
|
5280
|
+
if (this.async) {
|
|
5281
|
+
const { propertyReadSideEffects } = this.context.options
|
|
5282
|
+
.treeshake;
|
|
5283
|
+
const returnExpression = this.scope.getReturnExpression();
|
|
5284
|
+
if (returnExpression.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
|
|
5285
|
+
(propertyReadSideEffects &&
|
|
5286
|
+
(propertyReadSideEffects === 'always' ||
|
|
5287
|
+
returnExpression.hasEffectsWhenAccessedAtPath(['then'], context)))) {
|
|
5288
|
+
return true;
|
|
5289
|
+
}
|
|
5290
|
+
}
|
|
5266
5291
|
for (const param of this.params) {
|
|
5267
5292
|
if (param.hasEffects(context))
|
|
5268
5293
|
return true;
|
|
@@ -6002,7 +6027,7 @@ class ArrowFunctionExpression extends NodeBase {
|
|
|
6002
6027
|
// Arrow functions do not mutate their context
|
|
6003
6028
|
deoptimizeThisOnEventAtPath() { }
|
|
6004
6029
|
getReturnExpressionWhenCalledAtPath(path) {
|
|
6005
|
-
return path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
|
|
6030
|
+
return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
|
|
6006
6031
|
}
|
|
6007
6032
|
hasEffects() {
|
|
6008
6033
|
return false;
|
|
@@ -6016,6 +6041,17 @@ class ArrowFunctionExpression extends NodeBase {
|
|
|
6016
6041
|
hasEffectsWhenCalledAtPath(path, _callOptions, context) {
|
|
6017
6042
|
if (path.length > 0)
|
|
6018
6043
|
return true;
|
|
6044
|
+
if (this.async) {
|
|
6045
|
+
const { propertyReadSideEffects } = this.context.options
|
|
6046
|
+
.treeshake;
|
|
6047
|
+
const returnExpression = this.scope.getReturnExpression();
|
|
6048
|
+
if (returnExpression.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
|
|
6049
|
+
(propertyReadSideEffects &&
|
|
6050
|
+
(propertyReadSideEffects === 'always' ||
|
|
6051
|
+
returnExpression.hasEffectsWhenAccessedAtPath(['then'], context)))) {
|
|
6052
|
+
return true;
|
|
6053
|
+
}
|
|
6054
|
+
}
|
|
6019
6055
|
for (const param of this.params) {
|
|
6020
6056
|
if (param.hasEffects(context))
|
|
6021
6057
|
return true;
|
|
@@ -6136,6 +6172,7 @@ class AssignmentExpression extends NodeBase {
|
|
|
6136
6172
|
this.deoptimized = true;
|
|
6137
6173
|
this.left.deoptimizePath(EMPTY_PATH);
|
|
6138
6174
|
this.right.deoptimizePath(UNKNOWN_PATH);
|
|
6175
|
+
this.context.requestTreeshakingPass();
|
|
6139
6176
|
}
|
|
6140
6177
|
}
|
|
6141
6178
|
|
|
@@ -6164,12 +6201,20 @@ class AssignmentPattern extends NodeBase {
|
|
|
6164
6201
|
this.deoptimized = true;
|
|
6165
6202
|
this.left.deoptimizePath(EMPTY_PATH);
|
|
6166
6203
|
this.right.deoptimizePath(UNKNOWN_PATH);
|
|
6204
|
+
this.context.requestTreeshakingPass();
|
|
6167
6205
|
}
|
|
6168
6206
|
}
|
|
6169
6207
|
|
|
6170
6208
|
class AwaitExpression extends NodeBase {
|
|
6171
6209
|
hasEffects(context) {
|
|
6172
|
-
|
|
6210
|
+
const { propertyReadSideEffects } = this.context.options
|
|
6211
|
+
.treeshake;
|
|
6212
|
+
return (!context.ignore.returnAwaitYield ||
|
|
6213
|
+
this.argument.hasEffects(context) ||
|
|
6214
|
+
this.argument.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
|
|
6215
|
+
(propertyReadSideEffects &&
|
|
6216
|
+
(propertyReadSideEffects === 'always' ||
|
|
6217
|
+
this.argument.hasEffectsWhenAccessedAtPath(['then'], context))));
|
|
6173
6218
|
}
|
|
6174
6219
|
include(context, includeChildrenRecursively) {
|
|
6175
6220
|
if (!this.included) {
|
|
@@ -6450,10 +6495,9 @@ class MemberExpression extends NodeBase {
|
|
|
6450
6495
|
this.propertyKey = getResolvablePropertyKey(this);
|
|
6451
6496
|
}
|
|
6452
6497
|
render(code, options, { renderedParentType, isCalleeOfRenderedParent, renderedSurroundingElement } = BLANK) {
|
|
6453
|
-
const isCalleeOfDifferentParent = renderedParentType === CallExpression$1 && isCalleeOfRenderedParent;
|
|
6454
6498
|
if (this.variable || this.replacement) {
|
|
6455
6499
|
let replacement = this.variable ? this.variable.getName() : this.replacement;
|
|
6456
|
-
if (
|
|
6500
|
+
if (renderedParentType && isCalleeOfRenderedParent)
|
|
6457
6501
|
replacement = '0, ' + replacement;
|
|
6458
6502
|
code.overwrite(this.start, this.end, replacement, {
|
|
6459
6503
|
contentOnly: true,
|
|
@@ -6461,7 +6505,7 @@ class MemberExpression extends NodeBase {
|
|
|
6461
6505
|
});
|
|
6462
6506
|
}
|
|
6463
6507
|
else {
|
|
6464
|
-
if (
|
|
6508
|
+
if (renderedParentType && isCalleeOfRenderedParent) {
|
|
6465
6509
|
code.appendRight(this.start, '0, ');
|
|
6466
6510
|
}
|
|
6467
6511
|
const surroundingElement = renderedParentType || renderedSurroundingElement;
|
|
@@ -6485,6 +6529,7 @@ class MemberExpression extends NodeBase {
|
|
|
6485
6529
|
if (this.parent instanceof AssignmentExpression) {
|
|
6486
6530
|
this.object.deoptimizeThisOnEventAtPath(EVENT_ASSIGNED, [this.propertyKey], this.object, SHARED_RECURSION_TRACKER);
|
|
6487
6531
|
}
|
|
6532
|
+
this.context.requestTreeshakingPass();
|
|
6488
6533
|
}
|
|
6489
6534
|
}
|
|
6490
6535
|
disallowNamespaceReassignment() {
|
|
@@ -6669,7 +6714,10 @@ class CallExpression extends NodeBase {
|
|
|
6669
6714
|
}
|
|
6670
6715
|
render(code, options, { renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
6671
6716
|
const surroundingELement = renderedParentType || renderedSurroundingElement;
|
|
6672
|
-
this.callee.render(code, options,
|
|
6717
|
+
this.callee.render(code, options, {
|
|
6718
|
+
isCalleeOfRenderedParent: true,
|
|
6719
|
+
renderedSurroundingElement: surroundingELement
|
|
6720
|
+
});
|
|
6673
6721
|
if (this.arguments.length > 0) {
|
|
6674
6722
|
if (this.arguments[this.arguments.length - 1].included) {
|
|
6675
6723
|
for (const arg of this.arguments) {
|
|
@@ -6703,6 +6751,7 @@ class CallExpression extends NodeBase {
|
|
|
6703
6751
|
// This will make sure all properties of parameters behave as "unknown"
|
|
6704
6752
|
argument.deoptimizePath(UNKNOWN_PATH);
|
|
6705
6753
|
}
|
|
6754
|
+
this.context.requestTreeshakingPass();
|
|
6706
6755
|
}
|
|
6707
6756
|
getReturnExpression(recursionTracker = SHARED_RECURSION_TRACKER) {
|
|
6708
6757
|
if (this.returnExpression === null) {
|
|
@@ -6715,12 +6764,14 @@ class CallExpression extends NodeBase {
|
|
|
6715
6764
|
|
|
6716
6765
|
class CatchScope extends ParameterScope {
|
|
6717
6766
|
addDeclaration(identifier, context, init, isHoisted) {
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
return super.addDeclaration(identifier, context, init, false);
|
|
6767
|
+
const existingParameter = this.variables.get(identifier.name);
|
|
6768
|
+
if (existingParameter) {
|
|
6769
|
+
existingParameter.addDeclaration(identifier, init);
|
|
6770
|
+
return existingParameter;
|
|
6723
6771
|
}
|
|
6772
|
+
// as parameters are handled differently, all remaining declarations are
|
|
6773
|
+
// hoisted
|
|
6774
|
+
return this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
6724
6775
|
}
|
|
6725
6776
|
}
|
|
6726
6777
|
|
|
@@ -6728,17 +6779,19 @@ class CatchClause extends NodeBase {
|
|
|
6728
6779
|
createScope(parentScope) {
|
|
6729
6780
|
this.scope = new CatchScope(parentScope, this.context);
|
|
6730
6781
|
}
|
|
6731
|
-
|
|
6732
|
-
|
|
6782
|
+
parseNode(esTreeNode) {
|
|
6783
|
+
// Parameters need to be declared first as the logic is that hoisted body
|
|
6784
|
+
// variables are associated with outside vars unless there is a parameter,
|
|
6785
|
+
// in which case they are associated with the parameter
|
|
6786
|
+
const { param } = esTreeNode;
|
|
6787
|
+
if (param) {
|
|
6788
|
+
this.param = new (this.context.nodeConstructors[param.type] ||
|
|
6789
|
+
this.context.nodeConstructors.UnknownNode)(param, this, this.scope);
|
|
6733
6790
|
this.param.declare('parameter', UNKNOWN_EXPRESSION);
|
|
6734
6791
|
}
|
|
6735
|
-
}
|
|
6736
|
-
parseNode(esTreeNode) {
|
|
6737
|
-
this.body = new this.context.nodeConstructors.BlockStatement(esTreeNode.body, this, this.scope);
|
|
6738
6792
|
super.parseNode(esTreeNode);
|
|
6739
6793
|
}
|
|
6740
6794
|
}
|
|
6741
|
-
CatchClause.prototype.preventChildBlockScope = true;
|
|
6742
6795
|
|
|
6743
6796
|
class ChainExpression extends NodeBase {
|
|
6744
6797
|
}
|
|
@@ -6935,7 +6988,7 @@ class ConditionalExpression extends NodeBase {
|
|
|
6935
6988
|
usedBranch.includeCallArguments(context, args);
|
|
6936
6989
|
}
|
|
6937
6990
|
}
|
|
6938
|
-
render(code, options, { isCalleeOfRenderedParent, renderedParentType,
|
|
6991
|
+
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
6939
6992
|
const usedBranch = this.getUsedBranch();
|
|
6940
6993
|
if (!this.test.included) {
|
|
6941
6994
|
const colonPos = findFirstOccurrenceOutsideComment(code.original, ':', this.consequent.end);
|
|
@@ -6951,16 +7004,16 @@ class ConditionalExpression extends NodeBase {
|
|
|
6951
7004
|
}
|
|
6952
7005
|
removeAnnotations(this, code);
|
|
6953
7006
|
usedBranch.render(code, options, {
|
|
6954
|
-
isCalleeOfRenderedParent
|
|
6955
|
-
? isCalleeOfRenderedParent
|
|
6956
|
-
: this.parent.callee === this,
|
|
7007
|
+
isCalleeOfRenderedParent,
|
|
6957
7008
|
preventASI: true,
|
|
6958
|
-
|
|
7009
|
+
...(renderedSurroundingElement
|
|
7010
|
+
? { renderedSurroundingElement }
|
|
7011
|
+
: { renderedParentType: renderedParentType || this.parent.type })
|
|
6959
7012
|
});
|
|
6960
7013
|
}
|
|
6961
7014
|
else {
|
|
6962
7015
|
this.test.render(code, options, {
|
|
6963
|
-
renderedSurroundingElement: renderedParentType
|
|
7016
|
+
renderedSurroundingElement: renderedParentType || renderedSurroundingElement
|
|
6964
7017
|
});
|
|
6965
7018
|
this.consequent.render(code, options);
|
|
6966
7019
|
this.alternate.render(code, options);
|
|
@@ -7108,6 +7161,7 @@ class ForInStatement extends NodeBase {
|
|
|
7108
7161
|
applyDeoptimizations() {
|
|
7109
7162
|
this.deoptimized = true;
|
|
7110
7163
|
this.left.deoptimizePath(EMPTY_PATH);
|
|
7164
|
+
this.context.requestTreeshakingPass();
|
|
7111
7165
|
}
|
|
7112
7166
|
}
|
|
7113
7167
|
|
|
@@ -7147,6 +7201,7 @@ class ForOfStatement extends NodeBase {
|
|
|
7147
7201
|
applyDeoptimizations() {
|
|
7148
7202
|
this.deoptimized = true;
|
|
7149
7203
|
this.left.deoptimizePath(EMPTY_PATH);
|
|
7204
|
+
this.context.requestTreeshakingPass();
|
|
7150
7205
|
}
|
|
7151
7206
|
}
|
|
7152
7207
|
|
|
@@ -7788,11 +7843,11 @@ class LogicalExpression extends NodeBase {
|
|
|
7788
7843
|
}
|
|
7789
7844
|
removeAnnotations(this, code);
|
|
7790
7845
|
this.getUsedBranch().render(code, options, {
|
|
7791
|
-
isCalleeOfRenderedParent
|
|
7792
|
-
? isCalleeOfRenderedParent
|
|
7793
|
-
: this.parent.callee === this,
|
|
7846
|
+
isCalleeOfRenderedParent,
|
|
7794
7847
|
preventASI,
|
|
7795
|
-
|
|
7848
|
+
...(renderedSurroundingElement
|
|
7849
|
+
? { renderedSurroundingElement }
|
|
7850
|
+
: { renderedParentType: renderedParentType || this.parent.type })
|
|
7796
7851
|
});
|
|
7797
7852
|
}
|
|
7798
7853
|
else {
|
|
@@ -8396,6 +8451,7 @@ class NewExpression extends NodeBase {
|
|
|
8396
8451
|
// This will make sure all properties of parameters behave as "unknown"
|
|
8397
8452
|
argument.deoptimizePath(UNKNOWN_PATH);
|
|
8398
8453
|
}
|
|
8454
|
+
this.context.requestTreeshakingPass();
|
|
8399
8455
|
}
|
|
8400
8456
|
}
|
|
8401
8457
|
|
|
@@ -8441,6 +8497,7 @@ class ObjectExpression extends NodeBase {
|
|
|
8441
8497
|
if (this.objectEntity !== null) {
|
|
8442
8498
|
return this.objectEntity;
|
|
8443
8499
|
}
|
|
8500
|
+
let prototype = OBJECT_PROTOTYPE;
|
|
8444
8501
|
const properties = [];
|
|
8445
8502
|
for (const property of this.properties) {
|
|
8446
8503
|
if (property instanceof SpreadElement) {
|
|
@@ -8464,13 +8521,16 @@ class ObjectExpression extends NodeBase {
|
|
|
8464
8521
|
? property.key.name
|
|
8465
8522
|
: String(property.key.value);
|
|
8466
8523
|
if (key === '__proto__' && property.kind === 'init') {
|
|
8467
|
-
|
|
8524
|
+
prototype =
|
|
8525
|
+
property.value instanceof Literal && property.value.value === null
|
|
8526
|
+
? null
|
|
8527
|
+
: property.value;
|
|
8468
8528
|
continue;
|
|
8469
8529
|
}
|
|
8470
8530
|
}
|
|
8471
8531
|
properties.push({ key, kind: property.kind, property });
|
|
8472
8532
|
}
|
|
8473
|
-
return (this.objectEntity = new ObjectEntity(properties,
|
|
8533
|
+
return (this.objectEntity = new ObjectEntity(properties, prototype));
|
|
8474
8534
|
}
|
|
8475
8535
|
}
|
|
8476
8536
|
|
|
@@ -8542,6 +8602,7 @@ class Property extends MethodBase {
|
|
|
8542
8602
|
this.deoptimized = true;
|
|
8543
8603
|
if (this.declarationInit !== null) {
|
|
8544
8604
|
this.declarationInit.deoptimizePath([UnknownKey, UnknownKey]);
|
|
8605
|
+
this.context.requestTreeshakingPass();
|
|
8545
8606
|
}
|
|
8546
8607
|
}
|
|
8547
8608
|
}
|
|
@@ -8610,13 +8671,10 @@ class ReturnStatement extends NodeBase {
|
|
|
8610
8671
|
|
|
8611
8672
|
class SequenceExpression extends NodeBase {
|
|
8612
8673
|
deoptimizePath(path) {
|
|
8613
|
-
|
|
8614
|
-
this.expressions[this.expressions.length - 1].deoptimizePath(path);
|
|
8674
|
+
this.expressions[this.expressions.length - 1].deoptimizePath(path);
|
|
8615
8675
|
}
|
|
8616
8676
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
8617
|
-
|
|
8618
|
-
this.expressions[this.expressions.length - 1].deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
8619
|
-
}
|
|
8677
|
+
this.expressions[this.expressions.length - 1].deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
8620
8678
|
}
|
|
8621
8679
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
8622
8680
|
return this.expressions[this.expressions.length - 1].getLiteralValueAtPath(path, recursionTracker, origin);
|
|
@@ -8633,8 +8691,7 @@ class SequenceExpression extends NodeBase {
|
|
|
8633
8691
|
this.expressions[this.expressions.length - 1].hasEffectsWhenAccessedAtPath(path, context));
|
|
8634
8692
|
}
|
|
8635
8693
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
8636
|
-
return
|
|
8637
|
-
this.expressions[this.expressions.length - 1].hasEffectsWhenAssignedAtPath(path, context));
|
|
8694
|
+
return this.expressions[this.expressions.length - 1].hasEffectsWhenAssignedAtPath(path, context);
|
|
8638
8695
|
}
|
|
8639
8696
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
8640
8697
|
return this.expressions[this.expressions.length - 1].hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
@@ -8663,13 +8720,18 @@ class SequenceExpression extends NodeBase {
|
|
|
8663
8720
|
if (includedNodes === 1 && preventASI) {
|
|
8664
8721
|
removeLineBreaks(code, start, node.start);
|
|
8665
8722
|
}
|
|
8666
|
-
if (
|
|
8667
|
-
node
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
: this.parent.
|
|
8671
|
-
|
|
8672
|
-
}
|
|
8723
|
+
if (includedNodes === 1) {
|
|
8724
|
+
if (node === lastNode) {
|
|
8725
|
+
node.render(code, options, {
|
|
8726
|
+
isCalleeOfRenderedParent,
|
|
8727
|
+
renderedParentType: renderedParentType || this.parent.type
|
|
8728
|
+
});
|
|
8729
|
+
}
|
|
8730
|
+
else {
|
|
8731
|
+
node.render(code, options, {
|
|
8732
|
+
renderedSurroundingElement: renderedParentType || this.parent.type
|
|
8733
|
+
});
|
|
8734
|
+
}
|
|
8673
8735
|
}
|
|
8674
8736
|
else {
|
|
8675
8737
|
node.render(code, options);
|
|
@@ -8816,13 +8878,6 @@ class TaggedTemplateExpression extends NodeBase {
|
|
|
8816
8878
|
message: `Cannot call a namespace ('${name}')`
|
|
8817
8879
|
}, this.start);
|
|
8818
8880
|
}
|
|
8819
|
-
if (name === 'eval') {
|
|
8820
|
-
this.context.warn({
|
|
8821
|
-
code: 'EVAL',
|
|
8822
|
-
message: `Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification`,
|
|
8823
|
-
url: 'https://rollupjs.org/guide/en/#avoiding-eval'
|
|
8824
|
-
}, this.start);
|
|
8825
|
-
}
|
|
8826
8881
|
}
|
|
8827
8882
|
}
|
|
8828
8883
|
hasEffects(context) {
|
|
@@ -8836,6 +8891,10 @@ class TaggedTemplateExpression extends NodeBase {
|
|
|
8836
8891
|
withNew: false
|
|
8837
8892
|
};
|
|
8838
8893
|
}
|
|
8894
|
+
render(code, options) {
|
|
8895
|
+
this.tag.render(code, options, { isCalleeOfRenderedParent: true });
|
|
8896
|
+
this.quasi.render(code, options);
|
|
8897
|
+
}
|
|
8839
8898
|
}
|
|
8840
8899
|
|
|
8841
8900
|
class TemplateElement extends NodeBase {
|
|
@@ -9107,6 +9166,7 @@ class UnaryExpression extends NodeBase {
|
|
|
9107
9166
|
this.deoptimized = true;
|
|
9108
9167
|
if (this.operator === 'delete') {
|
|
9109
9168
|
this.argument.deoptimizePath(EMPTY_PATH);
|
|
9169
|
+
this.context.requestTreeshakingPass();
|
|
9110
9170
|
}
|
|
9111
9171
|
}
|
|
9112
9172
|
}
|
|
@@ -9175,6 +9235,7 @@ class UpdateExpression extends NodeBase {
|
|
|
9175
9235
|
const variable = this.scope.findVariable(this.argument.name);
|
|
9176
9236
|
variable.isReassigned = true;
|
|
9177
9237
|
}
|
|
9238
|
+
this.context.requestTreeshakingPass();
|
|
9178
9239
|
}
|
|
9179
9240
|
}
|
|
9180
9241
|
|
|
@@ -9260,9 +9321,12 @@ class YieldExpression extends NodeBase {
|
|
|
9260
9321
|
}
|
|
9261
9322
|
}
|
|
9262
9323
|
applyDeoptimizations() {
|
|
9263
|
-
var _a;
|
|
9264
9324
|
this.deoptimized = true;
|
|
9265
|
-
|
|
9325
|
+
const { argument } = this;
|
|
9326
|
+
if (argument) {
|
|
9327
|
+
argument.deoptimizePath(UNKNOWN_PATH);
|
|
9328
|
+
this.context.requestTreeshakingPass();
|
|
9329
|
+
}
|
|
9266
9330
|
}
|
|
9267
9331
|
}
|
|
9268
9332
|
|
|
@@ -10128,6 +10192,7 @@ class Module {
|
|
|
10128
10192
|
moduleContext: this.context,
|
|
10129
10193
|
nodeConstructors,
|
|
10130
10194
|
options: this.options,
|
|
10195
|
+
requestTreeshakingPass: () => (this.graph.needsTreeshakingPass = true),
|
|
10131
10196
|
traceExport: this.getVariableForExportName.bind(this),
|
|
10132
10197
|
traceVariable: this.traceVariable.bind(this),
|
|
10133
10198
|
usesTopLevelAwait: false,
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED