rollup 2.52.7 → 2.52.8
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 +9 -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 +127 -34
- package/dist/es/shared/watch.js +3 -3
- package/dist/loadConfigFile.js +2 -2
- package/dist/rollup.browser.js +3 -3
- package/dist/rollup.browser.js.map +1 -1
- package/dist/rollup.js +2 -2
- package/dist/shared/index.js +2 -2
- package/dist/shared/loadConfigFile.js +2 -2
- package/dist/shared/mergeOptions.js +2 -2
- package/dist/shared/rollup.js +127 -34
- 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.52.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.52.8
|
|
4
|
+
Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -14,7 +14,7 @@ import * as fs from 'fs';
|
|
|
14
14
|
import { lstatSync, realpathSync, readdirSync } from 'fs';
|
|
15
15
|
import { EventEmitter } from 'events';
|
|
16
16
|
|
|
17
|
-
var version$1 = "2.52.
|
|
17
|
+
var version$1 = "2.52.8";
|
|
18
18
|
|
|
19
19
|
var charToInteger = {};
|
|
20
20
|
var chars$1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
@@ -1630,8 +1630,10 @@ class Variable extends ExpressionEntity {
|
|
|
1630
1630
|
super();
|
|
1631
1631
|
this.name = name;
|
|
1632
1632
|
this.alwaysRendered = false;
|
|
1633
|
+
this.initReached = false;
|
|
1633
1634
|
this.isId = false;
|
|
1634
1635
|
this.isReassigned = false;
|
|
1636
|
+
this.kind = null;
|
|
1635
1637
|
this.renderBaseName = null;
|
|
1636
1638
|
this.renderName = null;
|
|
1637
1639
|
}
|
|
@@ -4083,11 +4085,19 @@ class GlobalVariable extends Variable {
|
|
|
4083
4085
|
}
|
|
4084
4086
|
}
|
|
4085
4087
|
|
|
4088
|
+
const tdzVariableKinds = {
|
|
4089
|
+
__proto__: null,
|
|
4090
|
+
class: true,
|
|
4091
|
+
const: true,
|
|
4092
|
+
let: true,
|
|
4093
|
+
var: true
|
|
4094
|
+
};
|
|
4086
4095
|
class Identifier extends NodeBase {
|
|
4087
4096
|
constructor() {
|
|
4088
4097
|
super(...arguments);
|
|
4089
4098
|
this.variable = null;
|
|
4090
4099
|
this.deoptimized = false;
|
|
4100
|
+
this.isTDZAccess = null;
|
|
4091
4101
|
}
|
|
4092
4102
|
addExportedVariables(variables, exportNamesByVariable) {
|
|
4093
4103
|
if (this.variable !== null && exportNamesByVariable.has(this.variable)) {
|
|
@@ -4128,6 +4138,7 @@ class Identifier extends NodeBase {
|
|
|
4128
4138
|
/* istanbul ignore next */
|
|
4129
4139
|
throw new Error(`Internal Error: Unexpected identifier kind ${kind}.`);
|
|
4130
4140
|
}
|
|
4141
|
+
variable.kind = kind;
|
|
4131
4142
|
return [(this.variable = variable)];
|
|
4132
4143
|
}
|
|
4133
4144
|
deoptimizePath(path) {
|
|
@@ -4140,26 +4151,34 @@ class Identifier extends NodeBase {
|
|
|
4140
4151
|
this.variable.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
4141
4152
|
}
|
|
4142
4153
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
4143
|
-
return this.
|
|
4154
|
+
return this.getVariableRespectingTDZ().getLiteralValueAtPath(path, recursionTracker, origin);
|
|
4144
4155
|
}
|
|
4145
4156
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
4146
|
-
return this.
|
|
4157
|
+
return this.getVariableRespectingTDZ().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
|
|
4147
4158
|
}
|
|
4148
4159
|
hasEffects() {
|
|
4149
4160
|
if (!this.deoptimized)
|
|
4150
4161
|
this.applyDeoptimizations();
|
|
4162
|
+
if (this.isPossibleTDZ() && this.variable.kind !== 'var') {
|
|
4163
|
+
return true;
|
|
4164
|
+
}
|
|
4151
4165
|
return (this.context.options.treeshake.unknownGlobalSideEffects &&
|
|
4152
4166
|
this.variable instanceof GlobalVariable &&
|
|
4153
4167
|
this.variable.hasEffectsWhenAccessedAtPath(EMPTY_PATH));
|
|
4154
4168
|
}
|
|
4155
4169
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
4156
|
-
return this.variable !== null &&
|
|
4170
|
+
return (this.variable !== null &&
|
|
4171
|
+
this.getVariableRespectingTDZ().hasEffectsWhenAccessedAtPath(path, context));
|
|
4157
4172
|
}
|
|
4158
4173
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
4159
|
-
return !this.variable ||
|
|
4174
|
+
return (!this.variable ||
|
|
4175
|
+
(path.length > 0
|
|
4176
|
+
? this.getVariableRespectingTDZ()
|
|
4177
|
+
: this.variable).hasEffectsWhenAssignedAtPath(path, context));
|
|
4160
4178
|
}
|
|
4161
4179
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
4162
|
-
return !this.variable ||
|
|
4180
|
+
return (!this.variable ||
|
|
4181
|
+
this.getVariableRespectingTDZ().hasEffectsWhenCalledAtPath(path, callOptions, context));
|
|
4163
4182
|
}
|
|
4164
4183
|
include() {
|
|
4165
4184
|
if (!this.deoptimized)
|
|
@@ -4172,7 +4191,10 @@ class Identifier extends NodeBase {
|
|
|
4172
4191
|
}
|
|
4173
4192
|
}
|
|
4174
4193
|
includeCallArguments(context, args) {
|
|
4175
|
-
this.
|
|
4194
|
+
this.getVariableRespectingTDZ().includeCallArguments(context, args);
|
|
4195
|
+
}
|
|
4196
|
+
markDeclarationReached() {
|
|
4197
|
+
this.variable.initReached = true;
|
|
4176
4198
|
}
|
|
4177
4199
|
render(code, _options, { renderedParentType, isCalleeOfRenderedParent, isShorthandProperty } = BLANK) {
|
|
4178
4200
|
if (this.variable) {
|
|
@@ -4207,6 +4229,28 @@ class Identifier extends NodeBase {
|
|
|
4207
4229
|
message: `Illegal reassignment to import '${this.name}'`
|
|
4208
4230
|
}, this.start);
|
|
4209
4231
|
}
|
|
4232
|
+
getVariableRespectingTDZ() {
|
|
4233
|
+
if (this.isPossibleTDZ()) {
|
|
4234
|
+
return UNKNOWN_EXPRESSION;
|
|
4235
|
+
}
|
|
4236
|
+
return this.variable;
|
|
4237
|
+
}
|
|
4238
|
+
isPossibleTDZ() {
|
|
4239
|
+
// return cached value to avoid issues with the next tree-shaking pass
|
|
4240
|
+
if (this.isTDZAccess !== null)
|
|
4241
|
+
return this.isTDZAccess;
|
|
4242
|
+
if (!(this.variable instanceof LocalVariable) ||
|
|
4243
|
+
!this.variable.kind ||
|
|
4244
|
+
!(this.variable.kind in tdzVariableKinds)) {
|
|
4245
|
+
return (this.isTDZAccess = false);
|
|
4246
|
+
}
|
|
4247
|
+
if (!this.variable.initReached) {
|
|
4248
|
+
// Either a const/let TDZ violation or
|
|
4249
|
+
// var use before declaration was encountered.
|
|
4250
|
+
return (this.isTDZAccess = true);
|
|
4251
|
+
}
|
|
4252
|
+
return (this.isTDZAccess = false);
|
|
4253
|
+
}
|
|
4210
4254
|
}
|
|
4211
4255
|
|
|
4212
4256
|
const EVENT_ACCESSED = 0;
|
|
@@ -4807,6 +4851,12 @@ class ClassNode extends NodeBase {
|
|
|
4807
4851
|
getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin) {
|
|
4808
4852
|
return this.getObjectEntity().getReturnExpressionWhenCalledAtPath(path, callOptions, recursionTracker, origin);
|
|
4809
4853
|
}
|
|
4854
|
+
hasEffects(context) {
|
|
4855
|
+
var _a, _b;
|
|
4856
|
+
const initEffect = ((_a = this.superClass) === null || _a === void 0 ? void 0 : _a.hasEffects(context)) || this.body.hasEffects(context);
|
|
4857
|
+
(_b = this.id) === null || _b === void 0 ? void 0 : _b.markDeclarationReached();
|
|
4858
|
+
return initEffect || super.hasEffects(context);
|
|
4859
|
+
}
|
|
4810
4860
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
4811
4861
|
return this.getObjectEntity().hasEffectsWhenAccessedAtPath(path, context);
|
|
4812
4862
|
}
|
|
@@ -4825,10 +4875,19 @@ class ClassNode extends NodeBase {
|
|
|
4825
4875
|
return this.getObjectEntity().hasEffectsWhenCalledAtPath(path, callOptions, context);
|
|
4826
4876
|
}
|
|
4827
4877
|
}
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4878
|
+
include(context, includeChildrenRecursively) {
|
|
4879
|
+
var _a;
|
|
4880
|
+
this.included = true;
|
|
4881
|
+
(_a = this.superClass) === null || _a === void 0 ? void 0 : _a.include(context, includeChildrenRecursively);
|
|
4882
|
+
this.body.include(context, includeChildrenRecursively);
|
|
4883
|
+
if (this.id) {
|
|
4884
|
+
this.id.markDeclarationReached();
|
|
4885
|
+
this.id.include();
|
|
4831
4886
|
}
|
|
4887
|
+
}
|
|
4888
|
+
initialise() {
|
|
4889
|
+
var _a;
|
|
4890
|
+
(_a = this.id) === null || _a === void 0 ? void 0 : _a.declare('class', this);
|
|
4832
4891
|
for (const method of this.body.body) {
|
|
4833
4892
|
if (method instanceof MethodDefinition && method.kind === 'constructor') {
|
|
4834
4893
|
this.classConstructor = method;
|
|
@@ -5143,6 +5202,9 @@ class RestElement extends NodeBase {
|
|
|
5143
5202
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
5144
5203
|
return path.length > 0 || this.argument.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
5145
5204
|
}
|
|
5205
|
+
markDeclarationReached() {
|
|
5206
|
+
this.argument.markDeclarationReached();
|
|
5207
|
+
}
|
|
5146
5208
|
applyDeoptimizations() {
|
|
5147
5209
|
this.deoptimized = true;
|
|
5148
5210
|
if (this.declarationInit !== null) {
|
|
@@ -5863,13 +5925,21 @@ class ArrayPattern extends NodeBase {
|
|
|
5863
5925
|
}
|
|
5864
5926
|
return false;
|
|
5865
5927
|
}
|
|
5928
|
+
markDeclarationReached() {
|
|
5929
|
+
for (const element of this.elements) {
|
|
5930
|
+
if (element !== null) {
|
|
5931
|
+
element.markDeclarationReached();
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5934
|
+
}
|
|
5866
5935
|
}
|
|
5867
5936
|
|
|
5868
5937
|
class BlockScope extends ChildScope {
|
|
5869
5938
|
addDeclaration(identifier, context, init, isHoisted) {
|
|
5870
5939
|
if (isHoisted) {
|
|
5871
5940
|
this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
5872
|
-
// Necessary to make sure the init is deoptimized
|
|
5941
|
+
// Necessary to make sure the init is deoptimized for conditional declarations.
|
|
5942
|
+
// We cannot call deoptimizePath here.
|
|
5873
5943
|
return this.parent.addDeclaration(identifier, context, UNDEFINED_EXPRESSION, isHoisted);
|
|
5874
5944
|
}
|
|
5875
5945
|
else {
|
|
@@ -6153,6 +6223,9 @@ class AssignmentPattern extends NodeBase {
|
|
|
6153
6223
|
hasEffectsWhenAssignedAtPath(path, context) {
|
|
6154
6224
|
return path.length > 0 || this.left.hasEffectsWhenAssignedAtPath(EMPTY_PATH, context);
|
|
6155
6225
|
}
|
|
6226
|
+
markDeclarationReached() {
|
|
6227
|
+
this.left.markDeclarationReached();
|
|
6228
|
+
}
|
|
6156
6229
|
render(code, options, { isShorthandProperty } = BLANK) {
|
|
6157
6230
|
this.left.render(code, options, { isShorthandProperty });
|
|
6158
6231
|
this.right.render(code, options);
|
|
@@ -6631,17 +6704,21 @@ class CallExpression extends NodeBase {
|
|
|
6631
6704
|
}, UNKNOWN_EXPRESSION);
|
|
6632
6705
|
}
|
|
6633
6706
|
hasEffects(context) {
|
|
6634
|
-
|
|
6635
|
-
this.
|
|
6636
|
-
|
|
6637
|
-
|
|
6638
|
-
|
|
6707
|
+
try {
|
|
6708
|
+
for (const argument of this.arguments) {
|
|
6709
|
+
if (argument.hasEffects(context))
|
|
6710
|
+
return true;
|
|
6711
|
+
}
|
|
6712
|
+
if (this.context.options.treeshake.annotations &&
|
|
6713
|
+
this.annotations)
|
|
6714
|
+
return false;
|
|
6715
|
+
return (this.callee.hasEffects(context) ||
|
|
6716
|
+
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
6717
|
+
}
|
|
6718
|
+
finally {
|
|
6719
|
+
if (!this.deoptimized)
|
|
6720
|
+
this.applyDeoptimizations();
|
|
6639
6721
|
}
|
|
6640
|
-
if (this.context.options.treeshake.annotations &&
|
|
6641
|
-
this.annotations)
|
|
6642
|
-
return false;
|
|
6643
|
-
return (this.callee.hasEffects(context) ||
|
|
6644
|
-
this.callee.hasEffectsWhenCalledAtPath(EMPTY_PATH, this.callOptions, context));
|
|
6645
6722
|
}
|
|
6646
6723
|
hasEffectsWhenAccessedAtPath(path, context) {
|
|
6647
6724
|
return (!context.accessed.trackEntityAtPathAndGetIfTracked(path, this) &&
|
|
@@ -8535,6 +8612,11 @@ class ObjectPattern extends NodeBase {
|
|
|
8535
8612
|
}
|
|
8536
8613
|
return false;
|
|
8537
8614
|
}
|
|
8615
|
+
markDeclarationReached() {
|
|
8616
|
+
for (const property of this.properties) {
|
|
8617
|
+
property.markDeclarationReached();
|
|
8618
|
+
}
|
|
8619
|
+
}
|
|
8538
8620
|
}
|
|
8539
8621
|
|
|
8540
8622
|
class PrivateIdentifier extends NodeBase {
|
|
@@ -8559,6 +8641,9 @@ class Property extends MethodBase {
|
|
|
8559
8641
|
this.key.hasEffects(context) ||
|
|
8560
8642
|
this.value.hasEffects(context));
|
|
8561
8643
|
}
|
|
8644
|
+
markDeclarationReached() {
|
|
8645
|
+
this.value.markDeclarationReached();
|
|
8646
|
+
}
|
|
8562
8647
|
render(code, options) {
|
|
8563
8648
|
if (!this.shorthand) {
|
|
8564
8649
|
this.key.render(code, options);
|
|
@@ -9214,16 +9299,19 @@ class VariableDeclarator extends NodeBase {
|
|
|
9214
9299
|
this.id.deoptimizePath(path);
|
|
9215
9300
|
}
|
|
9216
9301
|
hasEffects(context) {
|
|
9217
|
-
|
|
9302
|
+
const initEffect = this.init !== null && this.init.hasEffects(context);
|
|
9303
|
+
this.id.markDeclarationReached();
|
|
9304
|
+
return initEffect || this.id.hasEffects(context);
|
|
9218
9305
|
}
|
|
9219
9306
|
include(context, includeChildrenRecursively) {
|
|
9220
9307
|
this.included = true;
|
|
9221
|
-
if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
|
|
9222
|
-
this.id.include(context, includeChildrenRecursively);
|
|
9223
|
-
}
|
|
9224
9308
|
if (this.init) {
|
|
9225
9309
|
this.init.include(context, includeChildrenRecursively);
|
|
9226
9310
|
}
|
|
9311
|
+
this.id.markDeclarationReached();
|
|
9312
|
+
if (includeChildrenRecursively || this.id.shouldBeIncluded(context)) {
|
|
9313
|
+
this.id.include(context, includeChildrenRecursively);
|
|
9314
|
+
}
|
|
9227
9315
|
}
|
|
9228
9316
|
render(code, options) {
|
|
9229
9317
|
const renderId = this.id.included;
|
|
@@ -10048,8 +10136,8 @@ class Module {
|
|
|
10048
10136
|
}
|
|
10049
10137
|
includeAllExports(includeNamespaceMembers) {
|
|
10050
10138
|
if (!this.isExecuted) {
|
|
10051
|
-
this.graph.needsTreeshakingPass = true;
|
|
10052
10139
|
markModuleAndImpureDependenciesAsExecuted(this);
|
|
10140
|
+
this.graph.needsTreeshakingPass = true;
|
|
10053
10141
|
}
|
|
10054
10142
|
for (const exportName of this.getExports()) {
|
|
10055
10143
|
if (includeNamespaceMembers || exportName !== this.info.syntheticNamedExports) {
|
|
@@ -20119,12 +20207,7 @@ class Graph {
|
|
|
20119
20207
|
}
|
|
20120
20208
|
includeStatements() {
|
|
20121
20209
|
for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
|
|
20122
|
-
|
|
20123
|
-
module.includeAllExports(false);
|
|
20124
|
-
}
|
|
20125
|
-
else {
|
|
20126
|
-
markModuleAndImpureDependenciesAsExecuted(module);
|
|
20127
|
-
}
|
|
20210
|
+
markModuleAndImpureDependenciesAsExecuted(module);
|
|
20128
20211
|
}
|
|
20129
20212
|
if (this.options.treeshake) {
|
|
20130
20213
|
let treeshakingPass = 1;
|
|
@@ -20141,6 +20224,16 @@ class Graph {
|
|
|
20141
20224
|
}
|
|
20142
20225
|
}
|
|
20143
20226
|
}
|
|
20227
|
+
if (treeshakingPass === 1) {
|
|
20228
|
+
// We only include exports after the first pass to avoid issues with
|
|
20229
|
+
// the TDZ detection logic
|
|
20230
|
+
for (const module of [...this.entryModules, ...this.implicitEntryModules]) {
|
|
20231
|
+
if (module.preserveSignature !== false) {
|
|
20232
|
+
module.includeAllExports(false);
|
|
20233
|
+
this.needsTreeshakingPass = true;
|
|
20234
|
+
}
|
|
20235
|
+
}
|
|
20236
|
+
}
|
|
20144
20237
|
timeEnd(`treeshaking pass ${treeshakingPass++}`, 3);
|
|
20145
20238
|
} while (this.needsTreeshakingPass);
|
|
20146
20239
|
}
|
package/dist/es/shared/watch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.52.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.52.8
|
|
4
|
+
Wed, 07 Jul 2021 04:39:13 GMT - commit b3d5f7d02d2ac1597801c23e10f10651b158f3c4
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -11,7 +11,7 @@
|
|
|
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
17
|
import fs__default from 'fs';
|
package/dist/loadConfigFile.js
CHANGED