rollup 2.52.5 → 2.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -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 +222 -54
- package/dist/es/shared/watch.js +9 -8
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.d.ts +2 -0
- 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 +3 -2
- package/dist/shared/rollup.js +225 -69
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +1 -1
package/dist/es/rollup.js
CHANGED
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.53.0
|
|
4
|
+
Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { relative as relative$1, resolve, extname, basename, dirname } from 'path';
|
|
12
12
|
import { createHash as createHash$1 } from 'crypto';
|
|
13
|
-
import
|
|
14
|
-
import { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
13
|
+
import fs, { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
15
14
|
import { EventEmitter } from 'events';
|
|
16
15
|
|
|
17
|
-
var version$1 = "2.
|
|
16
|
+
var version$1 = "2.53.0";
|
|
18
17
|
|
|
19
18
|
var charToInteger = {};
|
|
20
19
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1630,8 +1629,10 @@ class Variable extends ExpressionEntity {
|
|
|
1630
1629
|
super();
|
|
1631
1630
|
this.name = name;
|
|
1632
1631
|
this.alwaysRendered = false;
|
|
1632
|
+
this.initReached = false;
|
|
1633
1633
|
this.isId = false;
|
|
1634
1634
|
this.isReassigned = false;
|
|
1635
|
+
this.kind = null;
|
|
1635
1636
|
this.renderBaseName = null;
|
|
1636
1637
|
this.renderName = null;
|
|
1637
1638
|
}
|
|
@@ -1944,7 +1945,7 @@ function createHasEffectsContext() {
|
|
|
1944
1945
|
breaks: false,
|
|
1945
1946
|
continues: false,
|
|
1946
1947
|
labels: new Set(),
|
|
1947
|
-
|
|
1948
|
+
returnYield: false
|
|
1948
1949
|
},
|
|
1949
1950
|
includedLabels: new Set(),
|
|
1950
1951
|
instantiated: new DiscriminatedPathTracker(),
|
|
@@ -4083,11 +4084,19 @@ class GlobalVariable extends Variable {
|
|
|
4083
4084
|
}
|
|
4084
4085
|
}
|
|
4085
4086
|
|
|
4087
|
+
const tdzVariableKinds = {
|
|
4088
|
+
__proto__: null,
|
|
4089
|
+
class: true,
|
|
4090
|
+
const: true,
|
|
4091
|
+
let: true,
|
|
4092
|
+
var: true
|
|
4093
|
+
};
|
|
4086
4094
|
class Identifier extends NodeBase {
|
|
4087
4095
|
constructor() {
|
|
4088
4096
|
super(...arguments);
|
|
4089
4097
|
this.variable = null;
|
|
4090
4098
|
this.deoptimized = false;
|
|
4099
|
+
this.isTDZAccess = null;
|
|
4091
4100
|
}
|
|
4092
4101
|
addExportedVariables(variables, exportNamesByVariable) {
|
|
4093
4102
|
if (this.variable !== null && exportNamesByVariable.has(this.variable)) {
|
|
@@ -4128,6 +4137,7 @@ class Identifier extends NodeBase {
|
|
|
4128
4137
|
/* istanbul ignore next */
|
|
4129
4138
|
throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`);
|
|
4130
4139
|
}
|
|
4140
|
+
variable.kind = kind;
|
|
4131
4141
|
return [(this.variable = variable)];
|
|
4132
4142
|
}
|
|
4133
4143
|
deoptimizePath(path) {
|
|
@@ -4140,26 +4150,34 @@ class Identifier extends NodeBase {
|
|
|
4140
4150
|
this.variable.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
4141
4151
|
}
|
|
4142
4152
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
4143
|
-
return this.
|
|
4153
|
+
return this.getVariableRespectingTDZ().getLiteralValueAtPath(path, recursionTracker, origin);
|
|
4144
4154
|
}
|
|
4145
4155
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
4146
|
-
return this.
|
|
4156
|
+
return this.getVariableRespectingTDZ().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
|
|
4147
4157
|
}
|
|
4148
4158
|
hasEffects() {
|
|
4149
4159
|
if (!this.deoptimized)
|
|
4150
4160
|
this.applyDeoptimizations();
|
|
4161
|
+
if (this.isPossibleTDZ() && this.variable.kind !== 'var') {
|
|
4162
|
+
return true;
|
|
4163
|
+
}
|
|
4151
4164
|
return (this.context.options.treeshake.unknownGlobalSideEffects &&
|
|
4152
4165
|
this.variable instanceof GlobalVariable &&
|
|
4153
4166
|
this.variable.hasEffectsWhenAccessedAtPath(EMPTY_PATH));
|
|
4154
4167
|
}
|
|
4155
4168
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
4156
|
-
return this.variable !== null &&
|
|
4169
|
+
return (this.variable !== null &&
|
|
4170
|
+
this.getVariableRespectingTDZ().hasEffectsWhenAccessedAtPath(path, context));
|
|
4157
4171
|
}
|
|
4158
4172
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
4159
|
-
return !this.variable ||
|
|
4173
|
+
return (!this.variable ||
|
|
4174
|
+
(path.length > 0
|
|
4175
|
+
? this.getVariableRespectingTDZ()
|
|
4176
|
+
: this.variable).hasEffectsWhenAssignedAtPath(path, context));
|
|
4160
4177
|
}
|
|
4161
4178
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
4162
|
-
return !this.variable ||
|
|
4179
|
+
return (!this.variable ||
|
|
4180
|
+
this.getVariableRespectingTDZ().hasEffectsWhenCalledAtPath(path, callOptions, context));
|
|
4163
4181
|
}
|
|
4164
4182
|
include() {
|
|
4165
4183
|
if (!this.deoptimized)
|
|
@@ -4172,7 +4190,10 @@ class Identifier extends NodeBase {
|
|
|
4172
4190
|
}
|
|
4173
4191
|
}
|
|
4174
4192
|
includeCallArguments(context, args) {
|
|
4175
|
-
this.
|
|
4193
|
+
this.getVariableRespectingTDZ().includeCallArguments(context, args);
|
|
4194
|
+
}
|
|
4195
|
+
markDeclarationReached() {
|
|
4196
|
+
this.variable.initReached = true;
|
|
4176
4197
|
}
|
|
4177
4198
|
render(code, _options, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
|
|
4178
4199
|
if (this.variable) {
|
|
@@ -4207,6 +4228,28 @@ class Identifier extends NodeBase {
|
|
|
4207
4228
|
message: `Illegal reassignment to import '${this.name}'`
|
|
4208
4229
|
}, this.start);
|
|
4209
4230
|
}
|
|
4231
|
+
getVariableRespectingTDZ() {
|
|
4232
|
+
if (this.isPossibleTDZ()) {
|
|
4233
|
+
return UNKNOWN_EXPRESSION;
|
|
4234
|
+
}
|
|
4235
|
+
return this.variable;
|
|
4236
|
+
}
|
|
4237
|
+
isPossibleTDZ() {
|
|
4238
|
+
// return cached value to avoid issues with the next tree-shaking pass
|
|
4239
|
+
if (this.isTDZAccess !== null)
|
|
4240
|
+
return this.isTDZAccess;
|
|
4241
|
+
if (!(this.variable instanceof LocalVariable) ||
|
|
4242
|
+
!this.variable.kind ||
|
|
4243
|
+
!(this.variable.kind in tdzVariableKinds)) {
|
|
4244
|
+
return (this.isTDZAccess = false);
|
|
4245
|
+
}
|
|
4246
|
+
if (!this.variable.initReached) {
|
|
4247
|
+
// Either a const/let TDZ violation or
|
|
4248
|
+
// var use before declaration was encountered.
|
|
4249
|
+
return (this.isTDZAccess = true);
|
|
4250
|
+
}
|
|
4251
|
+
return (this.isTDZAccess = false);
|
|
4252
|
+
}
|
|
4210
4253
|
}
|
|
4211
4254
|
|
|
4212
4255
|
const EVENT_ACCESSED = 0;
|
|
@@ -4807,6 +4850,12 @@ class ClassNode extends NodeBase {
|
|
|
4807
4850
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
4808
4851
|
return this.getObjectEntity().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
|
|
4809
4852
|
}
|
|
4853
|
+
hasEffects(context) {
|
|
4854
|
+
var _a, _b;
|
|
4855
|
+
const initEffect = ((_a = this.superClass) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) || this.body.hasEffects(context);
|
|
4856
|
+
(_b = this.id) === null || _b === void 0 ? void 0 : _b.markDeclarationReached();
|
|
4857
|
+
return initEffect || super.hasEffects(context);
|
|
4858
|
+
}
|
|
4810
4859
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
4811
4860
|
return this.getObjectEntity().hasEffectsWhenAccessedAtPath(path, context);
|
|
4812
4861
|
}
|
|
@@ -4825,10 +4874,19 @@ class ClassNode extends NodeBase {
|
|
|
4825
4874
|
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
4826
4875
|
}
|
|
4827
4876
|
}
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4877
|
+
include(context, includeChildrenRecursively) {
|
|
4878
|
+
var _a;
|
|
4879
|
+
this.included = true;
|
|
4880
|
+
(_a = this.superClass) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
|
|
4881
|
+
this.body.include(context, includeChildrenRecursively);
|
|
4882
|
+
if (this.id) {
|
|
4883
|
+
this.id.markDeclarationReached();
|
|
4884
|
+
this.id.include();
|
|
4831
4885
|
}
|
|
4886
|
+
}
|
|
4887
|
+
initialise() {
|
|
4888
|
+
var _a;
|
|
4889
|
+
(_a = this.id) === null || _a === void 0 ? void 0 : _a.declare('class', this);
|
|
4832
4890
|
for (const method of this.body.body) {
|
|
4833
4891
|
if (method instanceof MethodDefinition && method.kind === 'constructor') {
|
|
4834
4892
|
this.classConstructor = method;
|
|
@@ -5143,6 +5201,9 @@ class RestElement extends NodeBase {
|
|
|
5143
5201
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
5144
5202
|
return path.length > 0 || this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
5145
5203
|
}
|
|
5204
|
+
markDeclarationReached() {
|
|
5205
|
+
this.argument.markDeclarationReached();
|
|
5206
|
+
}
|
|
5146
5207
|
applyDeoptimizations() {
|
|
5147
5208
|
this.deoptimized = true;
|
|
5148
5209
|
if (this.declarationInit !== null) {
|
|
@@ -5155,6 +5216,7 @@ class RestElement extends NodeBase {
|
|
|
5155
5216
|
class FunctionNode extends NodeBase {
|
|
5156
5217
|
constructor() {
|
|
5157
5218
|
super(...arguments);
|
|
5219
|
+
this.deoptimizedReturn = false;
|
|
5158
5220
|
this.isPrototypeDeoptimized = false;
|
|
5159
5221
|
}
|
|
5160
5222
|
createScope(parentScope) {
|
|
@@ -5185,7 +5247,18 @@ class FunctionNode extends NodeBase {
|
|
|
5185
5247
|
}
|
|
5186
5248
|
}
|
|
5187
5249
|
getReturnExpressionWhenCalledAtPath(path) {
|
|
5188
|
-
|
|
5250
|
+
if (path.length !== 0) {
|
|
5251
|
+
return UNKNOWN_EXPRESSION;
|
|
5252
|
+
}
|
|
5253
|
+
if (this.async) {
|
|
5254
|
+
if (!this.deoptimizedReturn) {
|
|
5255
|
+
this.deoptimizedReturn = true;
|
|
5256
|
+
this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
|
|
5257
|
+
this.context.requestTreeshakingPass();
|
|
5258
|
+
}
|
|
5259
|
+
return UNKNOWN_EXPRESSION;
|
|
5260
|
+
}
|
|
5261
|
+
return this.scope.getReturnExpression();
|
|
5189
5262
|
}
|
|
5190
5263
|
hasEffects() {
|
|
5191
5264
|
return this.id !== null && this.id.hasEffects();
|
|
@@ -5228,7 +5301,7 @@ class FunctionNode extends NodeBase {
|
|
|
5228
5301
|
breaks: false,
|
|
5229
5302
|
continues: false,
|
|
5230
5303
|
labels: new Set(),
|
|
5231
|
-
|
|
5304
|
+
returnYield: true
|
|
5232
5305
|
};
|
|
5233
5306
|
if (this.body.hasEffects(context))
|
|
5234
5307
|
return true;
|
|
@@ -5851,13 +5924,21 @@ class ArrayPattern extends NodeBase {
|
|
|
5851
5924
|
}
|
|
5852
5925
|
return false;
|
|
5853
5926
|
}
|
|
5927
|
+
markDeclarationReached() {
|
|
5928
|
+
for (const element of this.elements) {
|
|
5929
|
+
if (element !== null) {
|
|
5930
|
+
element.markDeclarationReached();
|
|
5931
|
+
}
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5854
5934
|
}
|
|
5855
5935
|
|
|
5856
5936
|
class BlockScope extends ChildScope {
|
|
5857
5937
|
addDeclaration(identifier, context, init, isHoisted) {
|
|
5858
5938
|
if (isHoisted) {
|
|
5859
5939
|
this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
5860
|
-
// Necessary to make sure the init is deoptimized
|
|
5940
|
+
// Necessary to make sure the init is deoptimized for conditional declarations.
|
|
5941
|
+
// We cannot call deoptimizePath here.
|
|
5861
5942
|
return this.parent.addDeclaration(identifier, context, UNDEFINED_EXPRESSION, isHoisted);
|
|
5862
5943
|
}
|
|
5863
5944
|
else {
|
|
@@ -5947,6 +6028,10 @@ class BlockStatement extends NodeBase {
|
|
|
5947
6028
|
}
|
|
5948
6029
|
|
|
5949
6030
|
class ArrowFunctionExpression extends NodeBase {
|
|
6031
|
+
constructor() {
|
|
6032
|
+
super(...arguments);
|
|
6033
|
+
this.deoptimizedReturn = false;
|
|
6034
|
+
}
|
|
5950
6035
|
createScope(parentScope) {
|
|
5951
6036
|
this.scope = new ReturnValueScope(parentScope, this.context);
|
|
5952
6037
|
}
|
|
@@ -5960,7 +6045,18 @@ class ArrowFunctionExpression extends NodeBase {
|
|
|
5960
6045
|
// Arrow functions do not mutate their context
|
|
5961
6046
|
deoptimizeThisOnEventAtPath() { }
|
|
5962
6047
|
getReturnExpressionWhenCalledAtPath(path) {
|
|
5963
|
-
|
|
6048
|
+
if (path.length !== 0) {
|
|
6049
|
+
return UNKNOWN_EXPRESSION;
|
|
6050
|
+
}
|
|
6051
|
+
if (this.async) {
|
|
6052
|
+
if (!this.deoptimizedReturn) {
|
|
6053
|
+
this.deoptimizedReturn = true;
|
|
6054
|
+
this.scope.getReturnExpression().deoptimizePath(UNKNOWN_PATH);
|
|
6055
|
+
this.context.requestTreeshakingPass();
|
|
6056
|
+
}
|
|
6057
|
+
return UNKNOWN_EXPRESSION;
|
|
6058
|
+
}
|
|
6059
|
+
return this.scope.getReturnExpression();
|
|
5964
6060
|
}
|
|
5965
6061
|
hasEffects() {
|
|
5966
6062
|
return false;
|
|
@@ -5994,7 +6090,7 @@ class ArrowFunctionExpression extends NodeBase {
|
|
|
5994
6090
|
breaks: false,
|
|
5995
6091
|
continues: false,
|
|
5996
6092
|
labels: new Set(),
|
|
5997
|
-
|
|
6093
|
+
returnYield: true
|
|
5998
6094
|
};
|
|
5999
6095
|
if (this.body.hasEffects(context))
|
|
6000
6096
|
return true;
|
|
@@ -6126,6 +6222,9 @@ class AssignmentPattern extends NodeBase {
|
|
|
6126
6222
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
6127
6223
|
return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
6128
6224
|
}
|
|
6225
|
+
markDeclarationReached() {
|
|
6226
|
+
this.left.markDeclarationReached();
|
|
6227
|
+
}
|
|
6129
6228
|
render(code, options, { isShorthandProperty } = BLANK) {
|
|
6130
6229
|
this.left.render(code, options, { isShorthandProperty });
|
|
6131
6230
|
this.right.render(code, options);
|
|
@@ -6139,17 +6238,18 @@ class AssignmentPattern extends NodeBase {
|
|
|
6139
6238
|
}
|
|
6140
6239
|
|
|
6141
6240
|
class AwaitExpression extends NodeBase {
|
|
6142
|
-
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
(
|
|
6149
|
-
|
|
6150
|
-
this.argument.hasEffectsWhenAccessedAtPath(['then'], context))));
|
|
6241
|
+
constructor() {
|
|
6242
|
+
super(...arguments);
|
|
6243
|
+
this.deoptimized = false;
|
|
6244
|
+
}
|
|
6245
|
+
hasEffects() {
|
|
6246
|
+
if (!this.deoptimized)
|
|
6247
|
+
this.applyDeoptimizations();
|
|
6248
|
+
return true;
|
|
6151
6249
|
}
|
|
6152
6250
|
include(context, includeChildrenRecursively) {
|
|
6251
|
+
if (!this.deoptimized)
|
|
6252
|
+
this.applyDeoptimizations();
|
|
6153
6253
|
if (!this.included) {
|
|
6154
6254
|
this.included = true;
|
|
6155
6255
|
checkTopLevelAwait: if (!this.context.usesTopLevelAwait) {
|
|
@@ -6163,6 +6263,11 @@ class AwaitExpression extends NodeBase {
|
|
|
6163
6263
|
}
|
|
6164
6264
|
this.argument.include(context, includeChildrenRecursively);
|
|
6165
6265
|
}
|
|
6266
|
+
applyDeoptimizations() {
|
|
6267
|
+
this.deoptimized = true;
|
|
6268
|
+
this.argument.deoptimizePath(UNKNOWN_PATH);
|
|
6269
|
+
this.context.requestTreeshakingPass();
|
|
6270
|
+
}
|
|
6166
6271
|
}
|
|
6167
6272
|
|
|
6168
6273
|
const binaryOperators = {
|
|
@@ -6598,17 +6703,21 @@ class CallExpression extends NodeBase {
|
|
|
6598
6703
|
}, UNKNOWN_EXPRESSION);
|
|
6599
6704
|
}
|
|
6600
6705
|
hasEffects(context) {
|
|
6601
|
-
|
|
6602
|
-
this.
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
|
|
6706
|
+
try {
|
|
6707
|
+
for (const argument of this.arguments) {
|
|
6708
|
+
if (argument.hasEffects(context))
|
|
6709
|
+
return true;
|
|
6710
|
+
}
|
|
6711
|
+
if (this.context.options.treeshake.annotations &&
|
|
6712
|
+
this.annotations)
|
|
6713
|
+
return false;
|
|
6714
|
+
return (this.callee.hasEffects(context) ||
|
|
6715
|
+
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
6716
|
+
}
|
|
6717
|
+
finally {
|
|
6718
|
+
if (!this.deoptimized)
|
|
6719
|
+
this.applyDeoptimizations();
|
|
6606
6720
|
}
|
|
6607
|
-
if (this.context.options.treeshake.annotations &&
|
|
6608
|
-
this.annotations)
|
|
6609
|
-
return false;
|
|
6610
|
-
return (this.callee.hasEffects(context) ||
|
|
6611
|
-
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
6612
6721
|
}
|
|
6613
6722
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
6614
6723
|
return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
|
|
@@ -8502,6 +8611,11 @@ class ObjectPattern extends NodeBase {
|
|
|
8502
8611
|
}
|
|
8503
8612
|
return false;
|
|
8504
8613
|
}
|
|
8614
|
+
markDeclarationReached() {
|
|
8615
|
+
for (const property of this.properties) {
|
|
8616
|
+
property.markDeclarationReached();
|
|
8617
|
+
}
|
|
8618
|
+
}
|
|
8505
8619
|
}
|
|
8506
8620
|
|
|
8507
8621
|
class PrivateIdentifier extends NodeBase {
|
|
@@ -8526,6 +8640,9 @@ class Property extends MethodBase {
|
|
|
8526
8640
|
this.key.hasEffects(context) ||
|
|
8527
8641
|
this.value.hasEffects(context));
|
|
8528
8642
|
}
|
|
8643
|
+
markDeclarationReached() {
|
|
8644
|
+
this.value.markDeclarationReached();
|
|
8645
|
+
}
|
|
8529
8646
|
render(code, options) {
|
|
8530
8647
|
if (!this.shorthand) {
|
|
8531
8648
|
this.key.render(code, options);
|
|
@@ -8577,7 +8694,7 @@ class PropertyDefinition extends NodeBase {
|
|
|
8577
8694
|
|
|
8578
8695
|
class ReturnStatement extends NodeBase {
|
|
8579
8696
|
hasEffects(context) {
|
|
8580
|
-
if (!context.ignore.
|
|
8697
|
+
if (!context.ignore.returnYield ||
|
|
8581
8698
|
(this.argument !== null && this.argument.hasEffects(context)))
|
|
8582
8699
|
return true;
|
|
8583
8700
|
context.brokenFlow = BROKEN_FLOW_ERROR_RETURN_LABEL;
|
|
@@ -9181,16 +9298,19 @@ class VariableDeclarator extends NodeBase {
|
|
|
9181
9298
|
this.id.deoptimizePath(path);
|
|
9182
9299
|
}
|
|
9183
9300
|
hasEffects(context) {
|
|
9184
|
-
|
|
9301
|
+
const initEffect = this.init !== null && this.init.hasEffects(context);
|
|
9302
|
+
this.id.markDeclarationReached();
|
|
9303
|
+
return initEffect || this.id.hasEffects(context);
|
|
9185
9304
|
}
|
|
9186
9305
|
include(context, includeChildrenRecursively) {
|
|
9187
9306
|
this.included = true;
|
|
9188
|
-
if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
|
|
9189
|
-
this.id.include(context, includeChildrenRecursively);
|
|
9190
|
-
}
|
|
9191
9307
|
if (this.init) {
|
|
9192
9308
|
this.init.include(context, includeChildrenRecursively);
|
|
9193
9309
|
}
|
|
9310
|
+
this.id.markDeclarationReached();
|
|
9311
|
+
if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
|
|
9312
|
+
this.id.include(context, includeChildrenRecursively);
|
|
9313
|
+
}
|
|
9194
9314
|
}
|
|
9195
9315
|
render(code, options) {
|
|
9196
9316
|
const renderId = this.id.included;
|
|
@@ -9243,8 +9363,7 @@ class YieldExpression extends NodeBase {
|
|
|
9243
9363
|
hasEffects(context) {
|
|
9244
9364
|
if (!this.deoptimized)
|
|
9245
9365
|
this.applyDeoptimizations();
|
|
9246
|
-
return (!context.ignore.
|
|
9247
|
-
(this.argument !== null && this.argument.hasEffects(context)));
|
|
9366
|
+
return (!context.ignore.returnYield || (this.argument !== null && this.argument.hasEffects(context)));
|
|
9248
9367
|
}
|
|
9249
9368
|
render(code, options) {
|
|
9250
9369
|
if (this.argument) {
|
|
@@ -10016,8 +10135,8 @@ class Module {
|
|
|
10016
10135
|
}
|
|
10017
10136
|
includeAllExports(includeNamespaceMembers) {
|
|
10018
10137
|
if (!this.isExecuted) {
|
|
10019
|
-
this.graph.needsTreeshakingPass = true;
|
|
10020
10138
|
markModuleAndImpureDependenciesAsExecuted(this);
|
|
10139
|
+
this.graph.needsTreeshakingPass = true;
|
|
10021
10140
|
}
|
|
10022
10141
|
for (const exportName of this.getExports()) {
|
|
10023
10142
|
if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
|
|
@@ -18982,6 +19101,37 @@ function writeFile(dest, data) {
|
|
|
18982
19101
|
});
|
|
18983
19102
|
}
|
|
18984
19103
|
|
|
19104
|
+
class Queue {
|
|
19105
|
+
constructor(maxParallel = 1) {
|
|
19106
|
+
this.maxParallel = maxParallel;
|
|
19107
|
+
this.queue = new Array();
|
|
19108
|
+
this.workerCount = 0;
|
|
19109
|
+
}
|
|
19110
|
+
run(task) {
|
|
19111
|
+
return new Promise((resolve, reject) => {
|
|
19112
|
+
this.queue.push({ reject, resolve, task });
|
|
19113
|
+
this.work();
|
|
19114
|
+
});
|
|
19115
|
+
}
|
|
19116
|
+
async work() {
|
|
19117
|
+
if (this.workerCount >= this.maxParallel)
|
|
19118
|
+
return;
|
|
19119
|
+
this.workerCount++;
|
|
19120
|
+
let entry;
|
|
19121
|
+
while ((entry = this.queue.shift())) {
|
|
19122
|
+
const { reject, resolve, task } = entry;
|
|
19123
|
+
try {
|
|
19124
|
+
const result = await task();
|
|
19125
|
+
resolve(result);
|
|
19126
|
+
}
|
|
19127
|
+
catch (err) {
|
|
19128
|
+
reject(err);
|
|
19129
|
+
}
|
|
19130
|
+
}
|
|
19131
|
+
this.workerCount--;
|
|
19132
|
+
}
|
|
19133
|
+
}
|
|
19134
|
+
|
|
18985
19135
|
function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
|
|
18986
19136
|
let skipped = null;
|
|
18987
19137
|
let replaceContext = null;
|
|
@@ -19301,6 +19451,7 @@ class ModuleLoader {
|
|
|
19301
19451
|
this.indexedEntryModules = [];
|
|
19302
19452
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
19303
19453
|
this.nextEntryModuleIndex = 0;
|
|
19454
|
+
this.readQueue = new Queue();
|
|
19304
19455
|
this.resolveId = async (source, importer, customOptions, skip = null) => {
|
|
19305
19456
|
return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
|
|
19306
19457
|
? false
|
|
@@ -19309,6 +19460,7 @@ class ModuleLoader {
|
|
|
19309
19460
|
this.hasModuleSideEffects = options.treeshake
|
|
19310
19461
|
? options.treeshake.moduleSideEffects
|
|
19311
19462
|
: () => true;
|
|
19463
|
+
this.readQueue.maxParallel = options.maxParallelFileReads;
|
|
19312
19464
|
}
|
|
19313
19465
|
async addAdditionalModules(unresolvedModules) {
|
|
19314
19466
|
const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
|
|
@@ -19394,7 +19546,8 @@ class ModuleLoader {
|
|
|
19394
19546
|
timeStart('load modules', 3);
|
|
19395
19547
|
let source;
|
|
19396
19548
|
try {
|
|
19397
|
-
source =
|
|
19549
|
+
source =
|
|
19550
|
+
(_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await this.readQueue.run(async () => readFile(id)));
|
|
19398
19551
|
}
|
|
19399
19552
|
catch (err) {
|
|
19400
19553
|
timeEnd('load modules', 3);
|
|
@@ -20087,12 +20240,7 @@ class Graph {
|
|
|
20087
20240
|
}
|
|
20088
20241
|
includeStatements() {
|
|
20089
20242
|
for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
|
|
20090
|
-
|
|
20091
|
-
module.includeAllExports(false);
|
|
20092
|
-
}
|
|
20093
|
-
else {
|
|
20094
|
-
markModuleAndImpureDependenciesAsExecuted(module);
|
|
20095
|
-
}
|
|
20243
|
+
markModuleAndImpureDependenciesAsExecuted(module);
|
|
20096
20244
|
}
|
|
20097
20245
|
if (this.options.treeshake) {
|
|
20098
20246
|
let treeshakingPass = 1;
|
|
@@ -20109,6 +20257,16 @@ class Graph {
|
|
|
20109
20257
|
}
|
|
20110
20258
|
}
|
|
20111
20259
|
}
|
|
20260
|
+
if (treeshakingPass === 1) {
|
|
20261
|
+
// We only include exports after the first pass to avoid issues with
|
|
20262
|
+
// the TDZ detection logic
|
|
20263
|
+
for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
|
|
20264
|
+
if (module.preserveSignature !== false) {
|
|
20265
|
+
module.includeAllExports(false);
|
|
20266
|
+
this.needsTreeshakingPass = true;
|
|
20267
|
+
}
|
|
20268
|
+
}
|
|
20269
|
+
}
|
|
20112
20270
|
timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
|
|
20113
20271
|
} while (this.needsTreeshakingPass);
|
|
20114
20272
|
}
|
|
@@ -20230,6 +20388,7 @@ function normalizeInputOptions(config) {
|
|
|
20230
20388
|
input: getInput(config),
|
|
20231
20389
|
makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
|
|
20232
20390
|
manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
|
|
20391
|
+
maxParallelFileReads: getMaxParallelFileReads(config),
|
|
20233
20392
|
moduleContext: getModuleContext(config, context),
|
|
20234
20393
|
onwarn,
|
|
20235
20394
|
perf: config.perf || false,
|
|
@@ -20310,6 +20469,15 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
|
|
|
20310
20469
|
}
|
|
20311
20470
|
return configManualChunks;
|
|
20312
20471
|
};
|
|
20472
|
+
const getMaxParallelFileReads = (config) => {
|
|
20473
|
+
const maxParallelFileReads = config.maxParallelFileReads;
|
|
20474
|
+
if (typeof maxParallelFileReads === 'number') {
|
|
20475
|
+
if (maxParallelFileReads <= 0)
|
|
20476
|
+
return Infinity;
|
|
20477
|
+
return maxParallelFileReads;
|
|
20478
|
+
}
|
|
20479
|
+
return 20;
|
|
20480
|
+
};
|
|
20313
20481
|
const getModuleContext = (config, context) => {
|
|
20314
20482
|
const configModuleContext = config.moduleContext;
|
|
20315
20483
|
if (typeof configModuleContext === 'function') {
|
package/dist/es/shared/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.53.0
|
|
4
|
+
Fri, 09 Jul 2021 04:29:13 GMT - commit 7435d3121ed138a3c335a6c95b07750803af935f
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
import * as require$$0$1 from 'path';
|
|
12
12
|
import require$$0__default, { sep, resolve } from 'path';
|
|
13
13
|
import require$$0$2 from 'util';
|
|
14
|
-
import { defaultOnWarn, ensureArray as ensureArray$1, warnUnknownOptions, error, errInvalidOption, printQuotedStringList,
|
|
14
|
+
import { defaultOnWarn, ensureArray as ensureArray$1, warnUnknownOptions, treeshakePresets, error, errInvalidOption, printQuotedStringList, fseventsImporter, rollupInternal } from './rollup.js';
|
|
15
15
|
import require$$2, { platform } from 'os';
|
|
16
16
|
import require$$0$3 from 'events';
|
|
17
|
-
import
|
|
17
|
+
import fs$4 from 'fs';
|
|
18
18
|
import require$$1 from 'stream';
|
|
19
19
|
import 'crypto';
|
|
20
20
|
|
|
@@ -4083,6 +4083,7 @@ function mergeInputOptions(config, overrides, defaultOnWarnHandler) {
|
|
|
4083
4083
|
input: getOption('input') || [],
|
|
4084
4084
|
makeAbsoluteExternalsRelative: getOption('makeAbsoluteExternalsRelative'),
|
|
4085
4085
|
manualChunks: getOption('manualChunks'),
|
|
4086
|
+
maxParallelFileReads: getOption('maxParallelFileReads'),
|
|
4086
4087
|
moduleContext: getOption('moduleContext'),
|
|
4087
4088
|
onwarn: getOnWarn(config, defaultOnWarnHandler),
|
|
4088
4089
|
perf: getOption('perf'),
|
|
@@ -4186,7 +4187,7 @@ function mergeOutputOptions(config, overrides, warn) {
|
|
|
4186
4187
|
|
|
4187
4188
|
var chokidar = {};
|
|
4188
4189
|
|
|
4189
|
-
const fs$3 =
|
|
4190
|
+
const fs$3 = fs$4;
|
|
4190
4191
|
const { Readable } = require$$1;
|
|
4191
4192
|
const sysPath$3 = require$$0__default;
|
|
4192
4193
|
const { promisify: promisify$3 } = require$$0$2;
|
|
@@ -5063,7 +5064,7 @@ exports.isLinux = platform === 'linux';
|
|
|
5063
5064
|
exports.isIBMi = os.type() === 'OS400';
|
|
5064
5065
|
}(constants));
|
|
5065
5066
|
|
|
5066
|
-
const fs$2 =
|
|
5067
|
+
const fs$2 = fs$4;
|
|
5067
5068
|
const sysPath$2 = require$$0__default;
|
|
5068
5069
|
const { promisify: promisify$2 } = require$$0$2;
|
|
5069
5070
|
const isBinaryPath = isBinaryPath$1;
|
|
@@ -5702,7 +5703,7 @@ var fseventsHandler = {exports: {}};
|
|
|
5702
5703
|
|
|
5703
5704
|
var require$$3 = /*@__PURE__*/getAugmentedNamespace(fseventsImporter);
|
|
5704
5705
|
|
|
5705
|
-
const fs$1 =
|
|
5706
|
+
const fs$1 = fs$4;
|
|
5706
5707
|
const sysPath$1 = require$$0__default;
|
|
5707
5708
|
const { promisify: promisify$1 } = require$$0$2;
|
|
5708
5709
|
|
|
@@ -6226,7 +6227,7 @@ fseventsHandler.exports = FsEventsHandler$1;
|
|
|
6226
6227
|
fseventsHandler.exports.canUse = canUse;
|
|
6227
6228
|
|
|
6228
6229
|
const { EventEmitter } = require$$0$3;
|
|
6229
|
-
const fs =
|
|
6230
|
+
const fs = fs$4;
|
|
6230
6231
|
const sysPath = require$$0__default;
|
|
6231
6232
|
const { promisify } = require$$0$2;
|
|
6232
6233
|
const readdirp = readdirp_1;
|
package/dist/loadConfigFile.js
CHANGED