rollup 2.52.6 → 2.53.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 +37 -1
- 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 +204 -39
- 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 +207 -54
- 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.1
|
|
4
|
+
Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
|
|
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.1";
|
|
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
|
}
|
|
@@ -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();
|
|
@@ -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;
|
|
@@ -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);
|
|
@@ -6167,6 +6266,7 @@ class AwaitExpression extends NodeBase {
|
|
|
6167
6266
|
applyDeoptimizations() {
|
|
6168
6267
|
this.deoptimized = true;
|
|
6169
6268
|
this.argument.deoptimizePath(UNKNOWN_PATH);
|
|
6269
|
+
this.context.requestTreeshakingPass();
|
|
6170
6270
|
}
|
|
6171
6271
|
}
|
|
6172
6272
|
|
|
@@ -6603,17 +6703,21 @@ class CallExpression extends NodeBase {
|
|
|
6603
6703
|
}, UNKNOWN_EXPRESSION);
|
|
6604
6704
|
}
|
|
6605
6705
|
hasEffects(context) {
|
|
6606
|
-
|
|
6607
|
-
this.
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
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();
|
|
6611
6720
|
}
|
|
6612
|
-
if (this.context.options.treeshake.annotations &&
|
|
6613
|
-
this.annotations)
|
|
6614
|
-
return false;
|
|
6615
|
-
return (this.callee.hasEffects(context) ||
|
|
6616
|
-
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
6617
6721
|
}
|
|
6618
6722
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
6619
6723
|
return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
|
|
@@ -8507,6 +8611,11 @@ class ObjectPattern extends NodeBase {
|
|
|
8507
8611
|
}
|
|
8508
8612
|
return false;
|
|
8509
8613
|
}
|
|
8614
|
+
markDeclarationReached() {
|
|
8615
|
+
for (const property of this.properties) {
|
|
8616
|
+
property.markDeclarationReached();
|
|
8617
|
+
}
|
|
8618
|
+
}
|
|
8510
8619
|
}
|
|
8511
8620
|
|
|
8512
8621
|
class PrivateIdentifier extends NodeBase {
|
|
@@ -8531,6 +8640,9 @@ class Property extends MethodBase {
|
|
|
8531
8640
|
this.key.hasEffects(context) ||
|
|
8532
8641
|
this.value.hasEffects(context));
|
|
8533
8642
|
}
|
|
8643
|
+
markDeclarationReached() {
|
|
8644
|
+
this.value.markDeclarationReached();
|
|
8645
|
+
}
|
|
8534
8646
|
render(code, options) {
|
|
8535
8647
|
if (!this.shorthand) {
|
|
8536
8648
|
this.key.render(code, options);
|
|
@@ -9186,16 +9298,19 @@ class VariableDeclarator extends NodeBase {
|
|
|
9186
9298
|
this.id.deoptimizePath(path);
|
|
9187
9299
|
}
|
|
9188
9300
|
hasEffects(context) {
|
|
9189
|
-
|
|
9301
|
+
const initEffect = this.init !== null && this.init.hasEffects(context);
|
|
9302
|
+
this.id.markDeclarationReached();
|
|
9303
|
+
return initEffect || this.id.hasEffects(context);
|
|
9190
9304
|
}
|
|
9191
9305
|
include(context, includeChildrenRecursively) {
|
|
9192
9306
|
this.included = true;
|
|
9193
|
-
if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
|
|
9194
|
-
this.id.include(context, includeChildrenRecursively);
|
|
9195
|
-
}
|
|
9196
9307
|
if (this.init) {
|
|
9197
9308
|
this.init.include(context, includeChildrenRecursively);
|
|
9198
9309
|
}
|
|
9310
|
+
this.id.markDeclarationReached();
|
|
9311
|
+
if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
|
|
9312
|
+
this.id.include(context, includeChildrenRecursively);
|
|
9313
|
+
}
|
|
9199
9314
|
}
|
|
9200
9315
|
render(code, options) {
|
|
9201
9316
|
const renderId = this.id.included;
|
|
@@ -10020,8 +10135,8 @@ class Module {
|
|
|
10020
10135
|
}
|
|
10021
10136
|
includeAllExports(includeNamespaceMembers) {
|
|
10022
10137
|
if (!this.isExecuted) {
|
|
10023
|
-
this.graph.needsTreeshakingPass = true;
|
|
10024
10138
|
markModuleAndImpureDependenciesAsExecuted(this);
|
|
10139
|
+
this.graph.needsTreeshakingPass = true;
|
|
10025
10140
|
}
|
|
10026
10141
|
for (const exportName of this.getExports()) {
|
|
10027
10142
|
if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
|
|
@@ -10050,6 +10165,7 @@ class Module {
|
|
|
10050
10165
|
}
|
|
10051
10166
|
includeAllInBundle() {
|
|
10052
10167
|
this.ast.include(createInclusionContext(), true);
|
|
10168
|
+
this.includeAllExports(false);
|
|
10053
10169
|
}
|
|
10054
10170
|
isIncluded() {
|
|
10055
10171
|
return this.ast.included || this.namespace.included || this.importedFromNotTreeshaken;
|
|
@@ -18986,6 +19102,37 @@ function writeFile(dest, data) {
|
|
|
18986
19102
|
});
|
|
18987
19103
|
}
|
|
18988
19104
|
|
|
19105
|
+
class Queue {
|
|
19106
|
+
constructor(maxParallel = 1) {
|
|
19107
|
+
this.maxParallel = maxParallel;
|
|
19108
|
+
this.queue = new Array();
|
|
19109
|
+
this.workerCount = 0;
|
|
19110
|
+
}
|
|
19111
|
+
run(task) {
|
|
19112
|
+
return new Promise((resolve, reject) => {
|
|
19113
|
+
this.queue.push({ reject, resolve, task });
|
|
19114
|
+
this.work();
|
|
19115
|
+
});
|
|
19116
|
+
}
|
|
19117
|
+
async work() {
|
|
19118
|
+
if (this.workerCount >= this.maxParallel)
|
|
19119
|
+
return;
|
|
19120
|
+
this.workerCount++;
|
|
19121
|
+
let entry;
|
|
19122
|
+
while ((entry = this.queue.shift())) {
|
|
19123
|
+
const { reject, resolve, task } = entry;
|
|
19124
|
+
try {
|
|
19125
|
+
const result = await task();
|
|
19126
|
+
resolve(result);
|
|
19127
|
+
}
|
|
19128
|
+
catch (err) {
|
|
19129
|
+
reject(err);
|
|
19130
|
+
}
|
|
19131
|
+
}
|
|
19132
|
+
this.workerCount--;
|
|
19133
|
+
}
|
|
19134
|
+
}
|
|
19135
|
+
|
|
18989
19136
|
function resolveIdViaPlugins(source, importer, pluginDriver, moduleLoaderResolveId, skip, customOptions) {
|
|
18990
19137
|
let skipped = null;
|
|
18991
19138
|
let replaceContext = null;
|
|
@@ -19305,6 +19452,7 @@ class ModuleLoader {
|
|
|
19305
19452
|
this.indexedEntryModules = [];
|
|
19306
19453
|
this.latestLoadModulesPromise = Promise.resolve();
|
|
19307
19454
|
this.nextEntryModuleIndex = 0;
|
|
19455
|
+
this.readQueue = new Queue();
|
|
19308
19456
|
this.resolveId = async (source, importer, customOptions, skip = null) => {
|
|
19309
19457
|
return this.addDefaultsToResolvedId(this.getNormalizedResolvedIdWithoutDefaults(this.options.external(source, importer, false)
|
|
19310
19458
|
? false
|
|
@@ -19313,6 +19461,7 @@ class ModuleLoader {
|
|
|
19313
19461
|
this.hasModuleSideEffects = options.treeshake
|
|
19314
19462
|
? options.treeshake.moduleSideEffects
|
|
19315
19463
|
: () => true;
|
|
19464
|
+
this.readQueue.maxParallel = options.maxParallelFileReads;
|
|
19316
19465
|
}
|
|
19317
19466
|
async addAdditionalModules(unresolvedModules) {
|
|
19318
19467
|
const result = this.extendLoadModulesPromise(Promise.all(unresolvedModules.map(id => this.loadEntryModule(id, false, undefined, null))));
|
|
@@ -19398,7 +19547,8 @@ class ModuleLoader {
|
|
|
19398
19547
|
timeStart('load modules', 3);
|
|
19399
19548
|
let source;
|
|
19400
19549
|
try {
|
|
19401
|
-
source =
|
|
19550
|
+
source =
|
|
19551
|
+
(_a = (await this.pluginDriver.hookFirst('load', [id]))) !== null && _a !== void 0 ? _a : (await this.readQueue.run(async () => readFile(id)));
|
|
19402
19552
|
}
|
|
19403
19553
|
catch (err) {
|
|
19404
19554
|
timeEnd('load modules', 3);
|
|
@@ -20091,12 +20241,7 @@ class Graph {
|
|
|
20091
20241
|
}
|
|
20092
20242
|
includeStatements() {
|
|
20093
20243
|
for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
|
|
20094
|
-
|
|
20095
|
-
module.includeAllExports(false);
|
|
20096
|
-
}
|
|
20097
|
-
else {
|
|
20098
|
-
markModuleAndImpureDependenciesAsExecuted(module);
|
|
20099
|
-
}
|
|
20244
|
+
markModuleAndImpureDependenciesAsExecuted(module);
|
|
20100
20245
|
}
|
|
20101
20246
|
if (this.options.treeshake) {
|
|
20102
20247
|
let treeshakingPass = 1;
|
|
@@ -20113,6 +20258,16 @@ class Graph {
|
|
|
20113
20258
|
}
|
|
20114
20259
|
}
|
|
20115
20260
|
}
|
|
20261
|
+
if (treeshakingPass === 1) {
|
|
20262
|
+
// We only include exports after the first pass to avoid issues with
|
|
20263
|
+
// the TDZ detection logic
|
|
20264
|
+
for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
|
|
20265
|
+
if (module.preserveSignature !== false) {
|
|
20266
|
+
module.includeAllExports(false);
|
|
20267
|
+
this.needsTreeshakingPass = true;
|
|
20268
|
+
}
|
|
20269
|
+
}
|
|
20270
|
+
}
|
|
20116
20271
|
timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
|
|
20117
20272
|
} while (this.needsTreeshakingPass);
|
|
20118
20273
|
}
|
|
@@ -20234,6 +20389,7 @@ function normalizeInputOptions(config) {
|
|
|
20234
20389
|
input: getInput(config),
|
|
20235
20390
|
makeAbsoluteExternalsRelative: (_c = config.makeAbsoluteExternalsRelative) !== null && _c !== void 0 ? _c : true,
|
|
20236
20391
|
manualChunks: getManualChunks$1(config, onwarn, strictDeprecations),
|
|
20392
|
+
maxParallelFileReads: getMaxParallelFileReads(config),
|
|
20237
20393
|
moduleContext: getModuleContext(config, context),
|
|
20238
20394
|
onwarn,
|
|
20239
20395
|
perf: config.perf || false,
|
|
@@ -20314,6 +20470,15 @@ const getManualChunks$1 = (config, warn, strictDeprecations) => {
|
|
|
20314
20470
|
}
|
|
20315
20471
|
return configManualChunks;
|
|
20316
20472
|
};
|
|
20473
|
+
const getMaxParallelFileReads = (config) => {
|
|
20474
|
+
const maxParallelFileReads = config.maxParallelFileReads;
|
|
20475
|
+
if (typeof maxParallelFileReads === 'number') {
|
|
20476
|
+
if (maxParallelFileReads <= 0)
|
|
20477
|
+
return Infinity;
|
|
20478
|
+
return maxParallelFileReads;
|
|
20479
|
+
}
|
|
20480
|
+
return 20;
|
|
20481
|
+
};
|
|
20317
20482
|
const getModuleContext = (config, context) => {
|
|
20318
20483
|
const configModuleContext = config.moduleContext;
|
|
20319
20484
|
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.1
|
|
4
|
+
Sun, 11 Jul 2021 05:33:49 GMT - commit 89b9370e38359c2b810030e1f8ed5ba3d3035be6
|
|
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