rollup 2.74.0 → 2.75.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/CHANGELOG.md +30 -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 +137 -148
- 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 +3 -3
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +137 -148
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/es/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.75.1
|
|
4
|
+
Sat, 28 May 2022 13:06:58 GMT - commit 03088cc0ee948dcc51f26edde067cc2b2736a679
|
|
5
5
|
|
|
6
6
|
https://github.com/rollup/rollup
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ import { createHash as createHash$1 } from 'crypto';
|
|
|
14
14
|
import { promises } from 'fs';
|
|
15
15
|
import { EventEmitter } from 'events';
|
|
16
16
|
|
|
17
|
-
var version$1 = "2.
|
|
17
|
+
var version$1 = "2.75.1";
|
|
18
18
|
|
|
19
19
|
var charToInteger = {};
|
|
20
20
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1209,7 +1209,7 @@ class MagicString {
|
|
|
1209
1209
|
const hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1210
1210
|
|
|
1211
1211
|
class Bundle$1 {
|
|
1212
|
-
constructor(options) {
|
|
1212
|
+
constructor(options = {}) {
|
|
1213
1213
|
this.intro = options.intro || '';
|
|
1214
1214
|
this.separator = options.separator !== undefined ? options.separator : '\n';
|
|
1215
1215
|
this.sources = [];
|
|
@@ -1620,7 +1620,7 @@ class ExpressionEntity {
|
|
|
1620
1620
|
include(_context, _includeChildrenRecursively, _options) {
|
|
1621
1621
|
this.included = true;
|
|
1622
1622
|
}
|
|
1623
|
-
|
|
1623
|
+
includeCallArguments(context, args) {
|
|
1624
1624
|
for (const arg of args) {
|
|
1625
1625
|
arg.include(context, false);
|
|
1626
1626
|
}
|
|
@@ -5436,11 +5436,6 @@ class Method extends ExpressionEntity {
|
|
|
5436
5436
|
}
|
|
5437
5437
|
return false;
|
|
5438
5438
|
}
|
|
5439
|
-
includeArgumentsWhenCalledAtPath(_path, context, args) {
|
|
5440
|
-
for (const arg of args) {
|
|
5441
|
-
arg.include(context, false);
|
|
5442
|
-
}
|
|
5443
|
-
}
|
|
5444
5439
|
}
|
|
5445
5440
|
const METHOD_RETURNS_BOOLEAN = [
|
|
5446
5441
|
new Method({
|
|
@@ -5776,16 +5771,6 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5776
5771
|
}
|
|
5777
5772
|
return true;
|
|
5778
5773
|
}
|
|
5779
|
-
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
5780
|
-
const key = path[0];
|
|
5781
|
-
const expressionAtPath = this.getMemberExpression(key);
|
|
5782
|
-
if (expressionAtPath) {
|
|
5783
|
-
return expressionAtPath.includeArgumentsWhenCalledAtPath(path.slice(1), context, args);
|
|
5784
|
-
}
|
|
5785
|
-
if (this.prototypeExpression) {
|
|
5786
|
-
return this.prototypeExpression.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
5787
|
-
}
|
|
5788
|
-
}
|
|
5789
5774
|
buildPropertyMaps(properties) {
|
|
5790
5775
|
const { allProperties, propertiesAndGettersByKey, propertiesAndSettersByKey, settersByKey, gettersByKey, unknownIntegerProps, unmatchablePropertiesAndGetters, unmatchableGetters, unmatchableSetters } = this;
|
|
5791
5776
|
const unmatchablePropertiesAndSetters = [];
|
|
@@ -6079,9 +6064,6 @@ class ArrayExpression extends NodeBase {
|
|
|
6079
6064
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
6080
6065
|
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
6081
6066
|
}
|
|
6082
|
-
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
6083
|
-
this.getObjectEntity().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
6084
|
-
}
|
|
6085
6067
|
applyDeoptimizations() {
|
|
6086
6068
|
this.deoptimized = true;
|
|
6087
6069
|
let hasSpread = false;
|
|
@@ -6274,7 +6256,7 @@ class LocalVariable extends Variable {
|
|
|
6274
6256
|
}
|
|
6275
6257
|
}
|
|
6276
6258
|
}
|
|
6277
|
-
|
|
6259
|
+
includeCallArguments(context, args) {
|
|
6278
6260
|
if (this.isReassigned || (this.init && context.includedCallArguments.has(this.init))) {
|
|
6279
6261
|
for (const arg of args) {
|
|
6280
6262
|
arg.include(context, false);
|
|
@@ -6282,7 +6264,7 @@ class LocalVariable extends Variable {
|
|
|
6282
6264
|
}
|
|
6283
6265
|
else if (this.init) {
|
|
6284
6266
|
context.includedCallArguments.add(this.init);
|
|
6285
|
-
this.init.
|
|
6267
|
+
this.init.includeCallArguments(context, args);
|
|
6286
6268
|
context.includedCallArguments.delete(this.init);
|
|
6287
6269
|
}
|
|
6288
6270
|
}
|
|
@@ -6547,6 +6529,9 @@ class AssignmentPattern extends NodeBase {
|
|
|
6547
6529
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
6548
6530
|
return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
6549
6531
|
}
|
|
6532
|
+
// Note that FunctionBase may directly include .left and .right without
|
|
6533
|
+
// including the pattern itself. This is how default parameter tree-shaking
|
|
6534
|
+
// works at the moment.
|
|
6550
6535
|
include(context, includeChildrenRecursively) {
|
|
6551
6536
|
this.included = true;
|
|
6552
6537
|
this.left.include(context, includeChildrenRecursively);
|
|
@@ -6858,20 +6843,19 @@ class RestElement extends NodeBase {
|
|
|
6858
6843
|
class FunctionBase extends NodeBase {
|
|
6859
6844
|
constructor() {
|
|
6860
6845
|
super(...arguments);
|
|
6861
|
-
// By default, parameters are included via includeArgumentsWhenCalledAtPath
|
|
6862
|
-
this.alwaysIncludeParameters = false;
|
|
6863
6846
|
this.objectEntity = null;
|
|
6864
6847
|
this.deoptimizedReturn = false;
|
|
6848
|
+
this.forceIncludeParameters = false;
|
|
6865
6849
|
}
|
|
6866
6850
|
deoptimizeCache() {
|
|
6867
|
-
this.
|
|
6851
|
+
this.forceIncludeParameters = true;
|
|
6868
6852
|
}
|
|
6869
6853
|
deoptimizePath(path) {
|
|
6870
6854
|
this.getObjectEntity().deoptimizePath(path);
|
|
6871
6855
|
if (path.length === 1 && path[0] === UnknownKey) {
|
|
6872
6856
|
// A reassignment of UNKNOWN_PATH is considered equivalent to having lost track
|
|
6873
6857
|
// which means the return expression needs to be reassigned
|
|
6874
|
-
this.
|
|
6858
|
+
this.forceIncludeParameters = true;
|
|
6875
6859
|
this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
|
|
6876
6860
|
}
|
|
6877
6861
|
}
|
|
@@ -6904,6 +6888,7 @@ class FunctionBase extends NodeBase {
|
|
|
6904
6888
|
return this.getObjectEntity().hasEffectsWhenAssignedAtPath(path, context);
|
|
6905
6889
|
}
|
|
6906
6890
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
6891
|
+
var _a;
|
|
6907
6892
|
if (path.length > 0) {
|
|
6908
6893
|
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
6909
6894
|
}
|
|
@@ -6918,51 +6903,60 @@ class FunctionBase extends NodeBase {
|
|
|
6918
6903
|
return true;
|
|
6919
6904
|
}
|
|
6920
6905
|
}
|
|
6921
|
-
for (
|
|
6922
|
-
|
|
6906
|
+
for (let position = 0; position < this.params.length; position++) {
|
|
6907
|
+
const parameter = this.params[position];
|
|
6908
|
+
if (parameter instanceof AssignmentPattern) {
|
|
6909
|
+
if (parameter.left.hasEffects(context)) {
|
|
6910
|
+
return true;
|
|
6911
|
+
}
|
|
6912
|
+
const argumentValue = (_a = callOptions.args[position]) === null || _a === void 0 ? void 0 : _a.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
6913
|
+
if ((argumentValue === undefined || argumentValue === UnknownValue) &&
|
|
6914
|
+
parameter.right.hasEffects(context)) {
|
|
6915
|
+
return true;
|
|
6916
|
+
}
|
|
6917
|
+
}
|
|
6918
|
+
else if (parameter.hasEffects(context)) {
|
|
6923
6919
|
return true;
|
|
6920
|
+
}
|
|
6924
6921
|
}
|
|
6925
6922
|
return false;
|
|
6926
6923
|
}
|
|
6927
|
-
include(context, includeChildrenRecursively) {
|
|
6924
|
+
include(context, includeChildrenRecursively, { includeWithoutParameterDefaults } = BLANK) {
|
|
6928
6925
|
this.included = true;
|
|
6929
6926
|
const { brokenFlow } = context;
|
|
6930
6927
|
context.brokenFlow = BROKEN_FLOW_NONE;
|
|
6931
6928
|
this.body.include(context, includeChildrenRecursively);
|
|
6932
6929
|
context.brokenFlow = brokenFlow;
|
|
6933
|
-
if (
|
|
6930
|
+
if (!includeWithoutParameterDefaults ||
|
|
6931
|
+
includeChildrenRecursively ||
|
|
6932
|
+
this.forceIncludeParameters) {
|
|
6934
6933
|
for (const param of this.params) {
|
|
6935
6934
|
param.include(context, includeChildrenRecursively);
|
|
6936
6935
|
}
|
|
6937
6936
|
}
|
|
6938
6937
|
}
|
|
6939
|
-
|
|
6938
|
+
includeCallArguments(context, args) {
|
|
6940
6939
|
var _a;
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
if (parameter
|
|
6945
|
-
|
|
6946
|
-
parameter.left.include(context, false);
|
|
6947
|
-
}
|
|
6948
|
-
const argumentValue = (_a = args[position]) === null || _a === void 0 ? void 0 : _a.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
6949
|
-
// If argumentValue === UnknownTruthyValue, then we do not need to
|
|
6950
|
-
// include the default
|
|
6951
|
-
if ((argumentValue === undefined || argumentValue === UnknownValue) &&
|
|
6952
|
-
(this.parameterVariables[position].some(variable => variable.included) ||
|
|
6953
|
-
parameter.right.shouldBeIncluded(context))) {
|
|
6954
|
-
parameter.right.include(context, false);
|
|
6955
|
-
}
|
|
6940
|
+
for (let position = 0; position < this.params.length; position++) {
|
|
6941
|
+
const parameter = this.params[position];
|
|
6942
|
+
if (parameter instanceof AssignmentPattern) {
|
|
6943
|
+
if (parameter.left.shouldBeIncluded(context)) {
|
|
6944
|
+
parameter.left.include(context, false);
|
|
6956
6945
|
}
|
|
6957
|
-
|
|
6958
|
-
|
|
6946
|
+
const argumentValue = (_a = args[position]) === null || _a === void 0 ? void 0 : _a.getLiteralValueAtPath(EMPTY_PATH, SHARED_RECURSION_TRACKER, this);
|
|
6947
|
+
// If argumentValue === UnknownTruthyValue, then we do not need to
|
|
6948
|
+
// include the default
|
|
6949
|
+
if ((argumentValue === undefined || argumentValue === UnknownValue) &&
|
|
6950
|
+
(this.parameterVariables[position].some(variable => variable.included) ||
|
|
6951
|
+
parameter.right.shouldBeIncluded(context))) {
|
|
6952
|
+
parameter.right.include(context, false);
|
|
6959
6953
|
}
|
|
6960
6954
|
}
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
this.getObjectEntity().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
6955
|
+
else if (parameter.shouldBeIncluded(context)) {
|
|
6956
|
+
parameter.include(context, false);
|
|
6957
|
+
}
|
|
6965
6958
|
}
|
|
6959
|
+
this.scope.includeCallArguments(context, args);
|
|
6966
6960
|
}
|
|
6967
6961
|
initialise() {
|
|
6968
6962
|
this.parameterVariables = this.params.map(param => param.declare('parameter', UNKNOWN_EXPRESSION));
|
|
@@ -8076,8 +8070,8 @@ class Identifier extends NodeBase {
|
|
|
8076
8070
|
this.variable.hasEffectsWhenAccessedAtPath(EMPTY_PATH));
|
|
8077
8071
|
}
|
|
8078
8072
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
8079
|
-
|
|
8080
|
-
|
|
8073
|
+
return (this.variable !== null &&
|
|
8074
|
+
this.getVariableRespectingTDZ().hasEffectsWhenAccessedAtPath(path, context));
|
|
8081
8075
|
}
|
|
8082
8076
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
8083
8077
|
return (path.length > 0 ? this.getVariableRespectingTDZ() : this.variable).hasEffectsWhenAssignedAtPath(path, context);
|
|
@@ -8095,8 +8089,8 @@ class Identifier extends NodeBase {
|
|
|
8095
8089
|
}
|
|
8096
8090
|
}
|
|
8097
8091
|
}
|
|
8098
|
-
|
|
8099
|
-
this.variable.
|
|
8092
|
+
includeCallArguments(context, args) {
|
|
8093
|
+
this.variable.includeCallArguments(context, args);
|
|
8100
8094
|
}
|
|
8101
8095
|
isPossibleTDZ() {
|
|
8102
8096
|
// return cached value to avoid issues with the next tree-shaking pass
|
|
@@ -8409,7 +8403,7 @@ class FunctionNode extends FunctionBase {
|
|
|
8409
8403
|
}
|
|
8410
8404
|
hasEffects() {
|
|
8411
8405
|
var _a;
|
|
8412
|
-
return (_a = this.id) === null || _a === void 0 ? void 0 : _a.hasEffects();
|
|
8406
|
+
return !!((_a = this.id) === null || _a === void 0 ? void 0 : _a.hasEffects());
|
|
8413
8407
|
}
|
|
8414
8408
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
8415
8409
|
if (super.hasEffectsWhenCalledAtPath(path, callOptions, context))
|
|
@@ -8437,14 +8431,12 @@ class FunctionNode extends FunctionBase {
|
|
|
8437
8431
|
context.ignore = ignore;
|
|
8438
8432
|
return false;
|
|
8439
8433
|
}
|
|
8440
|
-
include(context, includeChildrenRecursively) {
|
|
8434
|
+
include(context, includeChildrenRecursively, { includeWithoutParameterDefaults } = BLANK) {
|
|
8441
8435
|
var _a;
|
|
8442
|
-
// This ensures that super.include will also include all parameters
|
|
8443
|
-
if (this.scope.argumentsVariable.included) {
|
|
8444
|
-
this.alwaysIncludeParameters = true;
|
|
8445
|
-
}
|
|
8446
8436
|
(_a = this.id) === null || _a === void 0 ? void 0 : _a.include();
|
|
8447
|
-
super.include(context, includeChildrenRecursively
|
|
8437
|
+
super.include(context, includeChildrenRecursively, {
|
|
8438
|
+
includeWithoutParameterDefaults: includeWithoutParameterDefaults && !this.scope.argumentsVariable.included
|
|
8439
|
+
});
|
|
8448
8440
|
}
|
|
8449
8441
|
initialise() {
|
|
8450
8442
|
var _a;
|
|
@@ -8514,9 +8506,10 @@ const binaryOperators = {
|
|
|
8514
8506
|
'>>': (left, right) => left >> right,
|
|
8515
8507
|
'>>>': (left, right) => left >>> right,
|
|
8516
8508
|
'^': (left, right) => left ^ right,
|
|
8517
|
-
in: () => UnknownValue,
|
|
8518
|
-
instanceof: () => UnknownValue,
|
|
8519
8509
|
'|': (left, right) => left | right
|
|
8510
|
+
// We use the fallback for cases where we return something unknown
|
|
8511
|
+
// in: () => UnknownValue,
|
|
8512
|
+
// instanceof: () => UnknownValue,
|
|
8520
8513
|
};
|
|
8521
8514
|
class BinaryExpression extends NodeBase {
|
|
8522
8515
|
deoptimizeCache() { }
|
|
@@ -8600,9 +8593,6 @@ class Literal extends NodeBase {
|
|
|
8600
8593
|
}
|
|
8601
8594
|
return path.length > 1;
|
|
8602
8595
|
}
|
|
8603
|
-
hasEffectsWhenAssignedAtPath(path) {
|
|
8604
|
-
return path.length > 0;
|
|
8605
|
-
}
|
|
8606
8596
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
8607
8597
|
if (path.length === 1) {
|
|
8608
8598
|
return hasMemberEffectWhenCalled(this.members, path[0], callOptions, context);
|
|
@@ -8818,15 +8808,12 @@ class MemberExpression extends NodeBase {
|
|
|
8818
8808
|
this.object.include(context, includeChildrenRecursively);
|
|
8819
8809
|
this.property.include(context, includeChildrenRecursively);
|
|
8820
8810
|
}
|
|
8821
|
-
|
|
8811
|
+
includeCallArguments(context, args) {
|
|
8822
8812
|
if (this.variable) {
|
|
8823
|
-
this.variable.
|
|
8824
|
-
}
|
|
8825
|
-
else if (this.replacement) {
|
|
8826
|
-
super.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
8813
|
+
this.variable.includeCallArguments(context, args);
|
|
8827
8814
|
}
|
|
8828
|
-
else
|
|
8829
|
-
|
|
8815
|
+
else {
|
|
8816
|
+
super.includeCallArguments(context, args);
|
|
8830
8817
|
}
|
|
8831
8818
|
}
|
|
8832
8819
|
initialise() {
|
|
@@ -9047,9 +9034,9 @@ class CallExpression extends CallExpressionBase {
|
|
|
9047
9034
|
}
|
|
9048
9035
|
else {
|
|
9049
9036
|
this.included = true;
|
|
9050
|
-
this.callee.include(context, false);
|
|
9037
|
+
this.callee.include(context, false, { includeWithoutParameterDefaults: true });
|
|
9051
9038
|
}
|
|
9052
|
-
this.callee.
|
|
9039
|
+
this.callee.includeCallArguments(context, this.arguments);
|
|
9053
9040
|
const returnExpression = this.getReturnExpression();
|
|
9054
9041
|
if (!returnExpression.included) {
|
|
9055
9042
|
returnExpression.include(context, false);
|
|
@@ -9220,9 +9207,6 @@ class MethodBase extends NodeBase {
|
|
|
9220
9207
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
9221
9208
|
return this.getAccessedValue().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
9222
9209
|
}
|
|
9223
|
-
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
9224
|
-
this.getAccessedValue().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9225
|
-
}
|
|
9226
9210
|
getAccessedValue() {
|
|
9227
9211
|
if (this.accessedValue === null) {
|
|
9228
9212
|
if (this.kind === 'get') {
|
|
@@ -9339,20 +9323,6 @@ class ClassNode extends NodeBase {
|
|
|
9339
9323
|
this.id.include();
|
|
9340
9324
|
}
|
|
9341
9325
|
}
|
|
9342
|
-
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
9343
|
-
var _a;
|
|
9344
|
-
if (path.length === 0) {
|
|
9345
|
-
if (this.classConstructor) {
|
|
9346
|
-
this.classConstructor.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9347
|
-
}
|
|
9348
|
-
else {
|
|
9349
|
-
(_a = this.superClass) === null || _a === void 0 ? void 0 : _a.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9350
|
-
}
|
|
9351
|
-
}
|
|
9352
|
-
else {
|
|
9353
|
-
this.getObjectEntity().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
9354
|
-
}
|
|
9355
|
-
}
|
|
9356
9326
|
initialise() {
|
|
9357
9327
|
var _a;
|
|
9358
9328
|
(_a = this.id) === null || _a === void 0 ? void 0 : _a.declare('class', this);
|
|
@@ -9369,8 +9339,7 @@ class ClassNode extends NodeBase {
|
|
|
9369
9339
|
for (const definition of this.body.body) {
|
|
9370
9340
|
if (!(definition.static ||
|
|
9371
9341
|
(definition instanceof MethodDefinition && definition.kind === 'constructor'))) {
|
|
9372
|
-
// Calls to methods are not tracked, ensure that
|
|
9373
|
-
// included and the return value is deoptimized
|
|
9342
|
+
// Calls to methods are not tracked, ensure that the return value is deoptimized
|
|
9374
9343
|
definition.deoptimizePath(UNKNOWN_PATH);
|
|
9375
9344
|
}
|
|
9376
9345
|
}
|
|
@@ -9514,7 +9483,7 @@ class ConditionalExpression extends NodeBase {
|
|
|
9514
9483
|
}
|
|
9515
9484
|
deoptimizePath(path) {
|
|
9516
9485
|
const usedBranch = this.getUsedBranch();
|
|
9517
|
-
if (usedBranch
|
|
9486
|
+
if (!usedBranch) {
|
|
9518
9487
|
this.consequent.deoptimizePath(path);
|
|
9519
9488
|
this.alternate.deoptimizePath(path);
|
|
9520
9489
|
}
|
|
@@ -9528,14 +9497,14 @@ class ConditionalExpression extends NodeBase {
|
|
|
9528
9497
|
}
|
|
9529
9498
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
9530
9499
|
const usedBranch = this.getUsedBranch();
|
|
9531
|
-
if (usedBranch
|
|
9500
|
+
if (!usedBranch)
|
|
9532
9501
|
return UnknownValue;
|
|
9533
9502
|
this.expressionsToBeDeoptimized.push(origin);
|
|
9534
9503
|
return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
9535
9504
|
}
|
|
9536
9505
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
9537
9506
|
const usedBranch = this.getUsedBranch();
|
|
9538
|
-
if (usedBranch
|
|
9507
|
+
if (!usedBranch)
|
|
9539
9508
|
return new MultiExpression([
|
|
9540
9509
|
this.consequent.getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin),
|
|
9541
9510
|
this.alternate.getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin)
|
|
@@ -9547,14 +9516,14 @@ class ConditionalExpression extends NodeBase {
|
|
|
9547
9516
|
if (this.test.hasEffects(context))
|
|
9548
9517
|
return true;
|
|
9549
9518
|
const usedBranch = this.getUsedBranch();
|
|
9550
|
-
if (usedBranch
|
|
9519
|
+
if (!usedBranch) {
|
|
9551
9520
|
return this.consequent.hasEffects(context) || this.alternate.hasEffects(context);
|
|
9552
9521
|
}
|
|
9553
9522
|
return usedBranch.hasEffects(context);
|
|
9554
9523
|
}
|
|
9555
9524
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
9556
9525
|
const usedBranch = this.getUsedBranch();
|
|
9557
|
-
if (usedBranch
|
|
9526
|
+
if (!usedBranch) {
|
|
9558
9527
|
return (this.consequent.hasEffectsWhenAccessedAtPath(path, context) ||
|
|
9559
9528
|
this.alternate.hasEffectsWhenAccessedAtPath(path, context));
|
|
9560
9529
|
}
|
|
@@ -9562,7 +9531,7 @@ class ConditionalExpression extends NodeBase {
|
|
|
9562
9531
|
}
|
|
9563
9532
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
9564
9533
|
const usedBranch = this.getUsedBranch();
|
|
9565
|
-
if (usedBranch
|
|
9534
|
+
if (!usedBranch) {
|
|
9566
9535
|
return (this.consequent.hasEffectsWhenAssignedAtPath(path, context) ||
|
|
9567
9536
|
this.alternate.hasEffectsWhenAssignedAtPath(path, context));
|
|
9568
9537
|
}
|
|
@@ -9570,7 +9539,7 @@ class ConditionalExpression extends NodeBase {
|
|
|
9570
9539
|
}
|
|
9571
9540
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
9572
9541
|
const usedBranch = this.getUsedBranch();
|
|
9573
|
-
if (usedBranch
|
|
9542
|
+
if (!usedBranch) {
|
|
9574
9543
|
return (this.consequent.hasEffectsWhenCalledAtPath(path, callOptions, context) ||
|
|
9575
9544
|
this.alternate.hasEffectsWhenCalledAtPath(path, callOptions, context));
|
|
9576
9545
|
}
|
|
@@ -9588,14 +9557,14 @@ class ConditionalExpression extends NodeBase {
|
|
|
9588
9557
|
usedBranch.include(context, includeChildrenRecursively);
|
|
9589
9558
|
}
|
|
9590
9559
|
}
|
|
9591
|
-
|
|
9560
|
+
includeCallArguments(context, args) {
|
|
9592
9561
|
const usedBranch = this.getUsedBranch();
|
|
9593
|
-
if (usedBranch
|
|
9594
|
-
this.consequent.
|
|
9595
|
-
this.alternate.
|
|
9562
|
+
if (!usedBranch) {
|
|
9563
|
+
this.consequent.includeCallArguments(context, args);
|
|
9564
|
+
this.alternate.includeCallArguments(context, args);
|
|
9596
9565
|
}
|
|
9597
9566
|
else {
|
|
9598
|
-
usedBranch.
|
|
9567
|
+
usedBranch.includeCallArguments(context, args);
|
|
9599
9568
|
}
|
|
9600
9569
|
}
|
|
9601
9570
|
render(code, options, { isCalleeOfRenderedParent, preventASI, renderedParentType, renderedSurroundingElement } = BLANK) {
|
|
@@ -9706,6 +9675,9 @@ class ExportAllDeclaration extends NodeBase {
|
|
|
9706
9675
|
ExportAllDeclaration.prototype.needsBoundaries = true;
|
|
9707
9676
|
|
|
9708
9677
|
class FunctionDeclaration extends FunctionNode {
|
|
9678
|
+
include(context, includeChildrenRecursively) {
|
|
9679
|
+
super.include(context, includeChildrenRecursively, { includeWithoutParameterDefaults: true });
|
|
9680
|
+
}
|
|
9709
9681
|
initialise() {
|
|
9710
9682
|
super.initialise();
|
|
9711
9683
|
if (this.id !== null) {
|
|
@@ -9815,7 +9787,7 @@ class ExportNamedDeclaration extends NodeBase {
|
|
|
9815
9787
|
}
|
|
9816
9788
|
hasEffects(context) {
|
|
9817
9789
|
var _a;
|
|
9818
|
-
return (_a = this.declaration) === null || _a === void 0 ? void 0 : _a.hasEffects(context);
|
|
9790
|
+
return !!((_a = this.declaration) === null || _a === void 0 ? void 0 : _a.hasEffects(context));
|
|
9819
9791
|
}
|
|
9820
9792
|
initialise() {
|
|
9821
9793
|
this.context.addExport(this);
|
|
@@ -10017,7 +9989,7 @@ class IfStatement extends NodeBase {
|
|
|
10017
9989
|
context.brokenFlow < consequentBrokenFlow ? context.brokenFlow : consequentBrokenFlow;
|
|
10018
9990
|
return false;
|
|
10019
9991
|
}
|
|
10020
|
-
return testValue ? this.consequent.hasEffects(context) : (_a = this.alternate) === null || _a === void 0 ? void 0 : _a.hasEffects(context);
|
|
9992
|
+
return testValue ? this.consequent.hasEffects(context) : !!((_a = this.alternate) === null || _a === void 0 ? void 0 : _a.hasEffects(context));
|
|
10021
9993
|
}
|
|
10022
9994
|
include(context, includeChildrenRecursively) {
|
|
10023
9995
|
this.included = true;
|
|
@@ -10601,7 +10573,7 @@ class LogicalExpression extends NodeBase {
|
|
|
10601
10573
|
}
|
|
10602
10574
|
deoptimizePath(path) {
|
|
10603
10575
|
const usedBranch = this.getUsedBranch();
|
|
10604
|
-
if (usedBranch
|
|
10576
|
+
if (!usedBranch) {
|
|
10605
10577
|
this.left.deoptimizePath(path);
|
|
10606
10578
|
this.right.deoptimizePath(path);
|
|
10607
10579
|
}
|
|
@@ -10615,14 +10587,14 @@ class LogicalExpression extends NodeBase {
|
|
|
10615
10587
|
}
|
|
10616
10588
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
10617
10589
|
const usedBranch = this.getUsedBranch();
|
|
10618
|
-
if (usedBranch
|
|
10590
|
+
if (!usedBranch)
|
|
10619
10591
|
return UnknownValue;
|
|
10620
10592
|
this.expressionsToBeDeoptimized.push(origin);
|
|
10621
10593
|
return usedBranch.getLiteralValueAtPath(path, recursionTracker, origin);
|
|
10622
10594
|
}
|
|
10623
10595
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
10624
10596
|
const usedBranch = this.getUsedBranch();
|
|
10625
|
-
if (usedBranch
|
|
10597
|
+
if (!usedBranch)
|
|
10626
10598
|
return new MultiExpression([
|
|
10627
10599
|
this.left.getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin),
|
|
10628
10600
|
this.right.getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin)
|
|
@@ -10641,7 +10613,7 @@ class LogicalExpression extends NodeBase {
|
|
|
10641
10613
|
}
|
|
10642
10614
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
10643
10615
|
const usedBranch = this.getUsedBranch();
|
|
10644
|
-
if (usedBranch
|
|
10616
|
+
if (!usedBranch) {
|
|
10645
10617
|
return (this.left.hasEffectsWhenAccessedAtPath(path, context) ||
|
|
10646
10618
|
this.right.hasEffectsWhenAccessedAtPath(path, context));
|
|
10647
10619
|
}
|
|
@@ -10649,7 +10621,7 @@ class LogicalExpression extends NodeBase {
|
|
|
10649
10621
|
}
|
|
10650
10622
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
10651
10623
|
const usedBranch = this.getUsedBranch();
|
|
10652
|
-
if (usedBranch
|
|
10624
|
+
if (!usedBranch) {
|
|
10653
10625
|
return (this.left.hasEffectsWhenAssignedAtPath(path, context) ||
|
|
10654
10626
|
this.right.hasEffectsWhenAssignedAtPath(path, context));
|
|
10655
10627
|
}
|
|
@@ -10657,7 +10629,7 @@ class LogicalExpression extends NodeBase {
|
|
|
10657
10629
|
}
|
|
10658
10630
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
10659
10631
|
const usedBranch = this.getUsedBranch();
|
|
10660
|
-
if (usedBranch
|
|
10632
|
+
if (!usedBranch) {
|
|
10661
10633
|
return (this.left.hasEffectsWhenCalledAtPath(path, callOptions, context) ||
|
|
10662
10634
|
this.right.hasEffectsWhenCalledAtPath(path, callOptions, context));
|
|
10663
10635
|
}
|
|
@@ -10668,7 +10640,7 @@ class LogicalExpression extends NodeBase {
|
|
|
10668
10640
|
const usedBranch = this.getUsedBranch();
|
|
10669
10641
|
if (includeChildrenRecursively ||
|
|
10670
10642
|
(usedBranch === this.right && this.left.shouldBeIncluded(context)) ||
|
|
10671
|
-
usedBranch
|
|
10643
|
+
!usedBranch) {
|
|
10672
10644
|
this.left.include(context, includeChildrenRecursively);
|
|
10673
10645
|
this.right.include(context, includeChildrenRecursively);
|
|
10674
10646
|
}
|
|
@@ -10917,9 +10889,14 @@ class NewExpression extends NodeBase {
|
|
|
10917
10889
|
include(context, includeChildrenRecursively) {
|
|
10918
10890
|
if (!this.deoptimized)
|
|
10919
10891
|
this.applyDeoptimizations();
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10892
|
+
if (includeChildrenRecursively) {
|
|
10893
|
+
super.include(context, includeChildrenRecursively);
|
|
10894
|
+
}
|
|
10895
|
+
else {
|
|
10896
|
+
this.included = true;
|
|
10897
|
+
this.callee.include(context, false);
|
|
10898
|
+
}
|
|
10899
|
+
this.callee.includeCallArguments(context, this.arguments);
|
|
10923
10900
|
}
|
|
10924
10901
|
initialise() {
|
|
10925
10902
|
this.callOptions = {
|
|
@@ -10967,9 +10944,6 @@ class ObjectExpression extends NodeBase {
|
|
|
10967
10944
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
10968
10945
|
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
10969
10946
|
}
|
|
10970
|
-
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
10971
|
-
this.getObjectEntity().includeArgumentsWhenCalledAtPath(path, context, args);
|
|
10972
|
-
}
|
|
10973
10947
|
render(code, options, { renderedSurroundingElement } = BLANK) {
|
|
10974
10948
|
super.render(code, options);
|
|
10975
10949
|
if (renderedSurroundingElement === ExpressionStatement$1 ||
|
|
@@ -11114,7 +11088,7 @@ class PropertyDefinition extends NodeBase {
|
|
|
11114
11088
|
}
|
|
11115
11089
|
hasEffects(context) {
|
|
11116
11090
|
var _a;
|
|
11117
|
-
return this.key.hasEffects(context) || (this.static && ((_a = this.value) === null || _a === void 0 ? void 0 : _a.hasEffects(context)));
|
|
11091
|
+
return this.key.hasEffects(context) || (this.static && !!((_a = this.value) === null || _a === void 0 ? void 0 : _a.hasEffects(context)));
|
|
11118
11092
|
}
|
|
11119
11093
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
11120
11094
|
return !this.value || this.value.hasEffectsWhenAccessedAtPath(path, context);
|
|
@@ -11125,10 +11099,6 @@ class PropertyDefinition extends NodeBase {
|
|
|
11125
11099
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
11126
11100
|
return !this.value || this.value.hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
11127
11101
|
}
|
|
11128
|
-
includeArgumentsWhenCalledAtPath(path, context, args) {
|
|
11129
|
-
var _a;
|
|
11130
|
-
(_a = this.value) === null || _a === void 0 ? void 0 : _a.includeArgumentsWhenCalledAtPath(path, context, args);
|
|
11131
|
-
}
|
|
11132
11102
|
}
|
|
11133
11103
|
|
|
11134
11104
|
class ReturnStatement extends NodeBase {
|
|
@@ -11413,10 +11383,15 @@ class TaggedTemplateExpression extends CallExpressionBase {
|
|
|
11413
11383
|
include(context, includeChildrenRecursively) {
|
|
11414
11384
|
if (!this.deoptimized)
|
|
11415
11385
|
this.applyDeoptimizations();
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11386
|
+
if (includeChildrenRecursively) {
|
|
11387
|
+
super.include(context, includeChildrenRecursively);
|
|
11388
|
+
}
|
|
11389
|
+
else {
|
|
11390
|
+
this.included = true;
|
|
11391
|
+
this.tag.include(context, includeChildrenRecursively);
|
|
11392
|
+
this.quasi.include(context, includeChildrenRecursively);
|
|
11393
|
+
}
|
|
11394
|
+
this.tag.includeCallArguments(context, this.callOptions.args);
|
|
11420
11395
|
const returnExpression = this.getReturnExpression();
|
|
11421
11396
|
if (!returnExpression.included) {
|
|
11422
11397
|
returnExpression.include(context, false);
|
|
@@ -11471,12 +11446,28 @@ class TemplateElement extends NodeBase {
|
|
|
11471
11446
|
}
|
|
11472
11447
|
|
|
11473
11448
|
class TemplateLiteral extends NodeBase {
|
|
11449
|
+
deoptimizeThisOnEventAtPath() { }
|
|
11474
11450
|
getLiteralValueAtPath(path) {
|
|
11475
11451
|
if (path.length > 0 || this.quasis.length !== 1) {
|
|
11476
11452
|
return UnknownValue;
|
|
11477
11453
|
}
|
|
11478
11454
|
return this.quasis[0].value.cooked;
|
|
11479
11455
|
}
|
|
11456
|
+
getReturnExpressionWhenCalledAtPath(path) {
|
|
11457
|
+
if (path.length !== 1) {
|
|
11458
|
+
return UNKNOWN_EXPRESSION;
|
|
11459
|
+
}
|
|
11460
|
+
return getMemberReturnExpressionWhenCalled(literalStringMembers, path[0]);
|
|
11461
|
+
}
|
|
11462
|
+
hasEffectsWhenAccessedAtPath(path) {
|
|
11463
|
+
return path.length > 1;
|
|
11464
|
+
}
|
|
11465
|
+
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
11466
|
+
if (path.length === 1) {
|
|
11467
|
+
return hasMemberEffectWhenCalled(literalStringMembers, path[0], callOptions, context);
|
|
11468
|
+
}
|
|
11469
|
+
return true;
|
|
11470
|
+
}
|
|
11480
11471
|
render(code, options) {
|
|
11481
11472
|
code.indentExclusionRanges.push([this.start, this.end]);
|
|
11482
11473
|
super.render(code, options);
|
|
@@ -11666,9 +11657,7 @@ class TryStatement extends NodeBase {
|
|
|
11666
11657
|
var _a;
|
|
11667
11658
|
return ((this.context.options.treeshake.tryCatchDeoptimization
|
|
11668
11659
|
? this.block.body.length > 0
|
|
11669
|
-
: this.block.hasEffects(context)) ||
|
|
11670
|
-
((_a = this.finalizer) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) ||
|
|
11671
|
-
false);
|
|
11660
|
+
: this.block.hasEffects(context)) || !!((_a = this.finalizer) === null || _a === void 0 ? void 0 : _a.hasEffects(context)));
|
|
11672
11661
|
}
|
|
11673
11662
|
include(context, includeChildrenRecursively) {
|
|
11674
11663
|
var _a, _b;
|
|
@@ -11854,16 +11843,14 @@ class VariableDeclaration extends NodeBase {
|
|
|
11854
11843
|
}
|
|
11855
11844
|
}
|
|
11856
11845
|
else {
|
|
11857
|
-
this.renderReplacedDeclarations(code, options
|
|
11846
|
+
this.renderReplacedDeclarations(code, options);
|
|
11858
11847
|
}
|
|
11859
11848
|
}
|
|
11860
|
-
renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options
|
|
11849
|
+
renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, systemPatternExports, options) {
|
|
11861
11850
|
if (code.original.charCodeAt(this.end - 1) === 59 /*";"*/) {
|
|
11862
11851
|
code.remove(this.end - 1, this.end);
|
|
11863
11852
|
}
|
|
11864
|
-
|
|
11865
|
-
separatorString += ';';
|
|
11866
|
-
}
|
|
11853
|
+
separatorString += ';';
|
|
11867
11854
|
if (lastSeparatorPos !== null) {
|
|
11868
11855
|
if (code.original.charCodeAt(actualContentEnd - 1) === 10 /*"\n"*/ &&
|
|
11869
11856
|
(code.original.charCodeAt(this.end) === 10 /*"\n"*/ ||
|
|
@@ -11888,7 +11875,7 @@ class VariableDeclaration extends NodeBase {
|
|
|
11888
11875
|
code.appendLeft(renderedContentEnd, ` ${getSystemExportStatement(systemPatternExports, options)};`);
|
|
11889
11876
|
}
|
|
11890
11877
|
}
|
|
11891
|
-
renderReplacedDeclarations(code, options
|
|
11878
|
+
renderReplacedDeclarations(code, options) {
|
|
11892
11879
|
const separatedNodes = getCommaSeparatedNodesWithBoundaries(this.declarations, code, this.start + this.kind.length, this.end - (code.original.charCodeAt(this.end - 1) === 59 /*";"*/ ? 1 : 0));
|
|
11893
11880
|
let actualContentEnd, renderedContentEnd;
|
|
11894
11881
|
renderedContentEnd = findNonWhiteSpace(code.original, this.start + this.kind.length);
|
|
@@ -11944,7 +11931,7 @@ class VariableDeclaration extends NodeBase {
|
|
|
11944
11931
|
lastSeparatorPos = separator;
|
|
11945
11932
|
separatorString = nextSeparatorString;
|
|
11946
11933
|
}
|
|
11947
|
-
this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, aggregatedSystemExports, options
|
|
11934
|
+
this.renderDeclarationEnd(code, separatorString, lastSeparatorPos, actualContentEnd, renderedContentEnd, aggregatedSystemExports, options);
|
|
11948
11935
|
}
|
|
11949
11936
|
}
|
|
11950
11937
|
function gatherSystemExportsAndGetSingleExport(separatedNodes, options, aggregatedSystemExports) {
|
|
@@ -11989,7 +11976,9 @@ class VariableDeclarator extends NodeBase {
|
|
|
11989
11976
|
include(context, includeChildrenRecursively) {
|
|
11990
11977
|
var _a;
|
|
11991
11978
|
this.included = true;
|
|
11992
|
-
(_a = this.init) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively
|
|
11979
|
+
(_a = this.init) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively, {
|
|
11980
|
+
includeWithoutParameterDefaults: true
|
|
11981
|
+
});
|
|
11993
11982
|
this.id.markDeclarationReached();
|
|
11994
11983
|
if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
|
|
11995
11984
|
this.id.include(context, includeChildrenRecursively);
|
|
@@ -12047,7 +12036,7 @@ class YieldExpression extends NodeBase {
|
|
|
12047
12036
|
var _a;
|
|
12048
12037
|
if (!this.deoptimized)
|
|
12049
12038
|
this.applyDeoptimizations();
|
|
12050
|
-
return !context.ignore.returnYield || ((_a = this.argument) === null || _a === void 0 ? void 0 : _a.hasEffects(context));
|
|
12039
|
+
return !context.ignore.returnYield || !!((_a = this.argument) === null || _a === void 0 ? void 0 : _a.hasEffects(context));
|
|
12051
12040
|
}
|
|
12052
12041
|
render(code, options) {
|
|
12053
12042
|
if (this.argument) {
|
|
@@ -13510,7 +13499,7 @@ function warnOnBuiltins(warn, dependencies) {
|
|
|
13510
13499
|
return;
|
|
13511
13500
|
warn({
|
|
13512
13501
|
code: 'MISSING_NODE_BUILTINS',
|
|
13513
|
-
message: `Creating a browser bundle that depends on Node.js built-in modules (${printQuotedStringList(externalBuiltins)}). You might need to include https://github.com/
|
|
13502
|
+
message: `Creating a browser bundle that depends on Node.js built-in modules (${printQuotedStringList(externalBuiltins)}). You might need to include https://github.com/FredKSchott/rollup-plugin-polyfill-node`,
|
|
13514
13503
|
modules: externalBuiltins
|
|
13515
13504
|
});
|
|
13516
13505
|
}
|