rollup 2.52.0 → 2.52.4
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 -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 +50 -36
- 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.d.ts +4 -3
- 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 +50 -36
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +6 -7
package/dist/rollup.d.ts
CHANGED
|
@@ -277,7 +277,8 @@ export type RenderChunkHook = (
|
|
|
277
277
|
| Promise<{ code: string; map?: SourceMapInput } | null>
|
|
278
278
|
| { code: string; map?: SourceMapInput }
|
|
279
279
|
| string
|
|
280
|
-
| null
|
|
280
|
+
| null
|
|
281
|
+
| undefined;
|
|
281
282
|
|
|
282
283
|
export type ResolveDynamicImportHook = (
|
|
283
284
|
this: PluginContext,
|
|
@@ -539,7 +540,7 @@ export interface InputOptions {
|
|
|
539
540
|
moduleContext?: ((id: string) => string | null | undefined) | { [id: string]: string };
|
|
540
541
|
onwarn?: WarningHandlerWithDefault;
|
|
541
542
|
perf?: boolean;
|
|
542
|
-
plugins?: Plugin[];
|
|
543
|
+
plugins?: (Plugin | null | false | undefined)[];
|
|
543
544
|
preserveEntrySignatures?: PreserveEntrySignaturesOption;
|
|
544
545
|
/** @deprecated Use the "preserveModules" output option instead. */
|
|
545
546
|
preserveModules?: boolean;
|
|
@@ -650,7 +651,7 @@ export interface OutputOptions {
|
|
|
650
651
|
noConflict?: boolean;
|
|
651
652
|
outro?: string | (() => string | Promise<string>);
|
|
652
653
|
paths?: OptionsPaths;
|
|
653
|
-
plugins?: OutputPlugin[];
|
|
654
|
+
plugins?: (OutputPlugin | null | false | undefined)[];
|
|
654
655
|
preferConst?: boolean;
|
|
655
656
|
preserveModules?: boolean;
|
|
656
657
|
preserveModulesRoot?: string;
|
package/dist/rollup.js
CHANGED
package/dist/shared/index.js
CHANGED
package/dist/shared/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.52.
|
|
4
|
-
Wed,
|
|
3
|
+
Rollup.js v2.52.4
|
|
4
|
+
Wed, 30 Jun 2021 04:06:36 GMT - commit c3ad218caeeafa8a1b6ff8d4dde0db2556a3309a
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -32,7 +32,7 @@ function _interopNamespaceDefault(e) {
|
|
|
32
32
|
|
|
33
33
|
var fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
|
|
34
34
|
|
|
35
|
-
var version$1 = "2.52.
|
|
35
|
+
var version$1 = "2.52.4";
|
|
36
36
|
|
|
37
37
|
function ensureArray(items) {
|
|
38
38
|
if (Array.isArray(items)) {
|
|
@@ -4578,7 +4578,11 @@ class Identifier extends NodeBase {
|
|
|
4578
4578
|
const { treeshake } = this.context.options;
|
|
4579
4579
|
switch (kind) {
|
|
4580
4580
|
case 'var':
|
|
4581
|
-
variable = this.scope.addDeclaration(this, this.context,
|
|
4581
|
+
variable = this.scope.addDeclaration(this, this.context, init, true);
|
|
4582
|
+
if (treeshake && treeshake.correctVarValueBeforeDeclaration) {
|
|
4583
|
+
// Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here.
|
|
4584
|
+
this.scope.addDeclaration(this, this.context, UNDEFINED_EXPRESSION, true);
|
|
4585
|
+
}
|
|
4582
4586
|
break;
|
|
4583
4587
|
case 'function':
|
|
4584
4588
|
// in strict mode, functions are only hoisted within a scope but not across block scopes
|
|
@@ -4752,9 +4756,10 @@ const INTEGER_REG_EXP = /^\d+$/;
|
|
|
4752
4756
|
class ObjectEntity extends ExpressionEntity {
|
|
4753
4757
|
// If a PropertyMap is used, this will be taken as propertiesAndGettersByKey
|
|
4754
4758
|
// and we assume there are no setters or getters
|
|
4755
|
-
constructor(properties, prototypeExpression) {
|
|
4759
|
+
constructor(properties, prototypeExpression, immutable = false) {
|
|
4756
4760
|
super();
|
|
4757
4761
|
this.prototypeExpression = prototypeExpression;
|
|
4762
|
+
this.immutable = immutable;
|
|
4758
4763
|
this.allProperties = [];
|
|
4759
4764
|
this.deoptimizedPaths = Object.create(null);
|
|
4760
4765
|
this.expressionsToBeDeoptimizedByKey = Object.create(null);
|
|
@@ -4810,7 +4815,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4810
4815
|
}
|
|
4811
4816
|
deoptimizePath(path) {
|
|
4812
4817
|
var _a;
|
|
4813
|
-
if (this.hasUnknownDeoptimizedProperty)
|
|
4818
|
+
if (this.hasUnknownDeoptimizedProperty || this.immutable)
|
|
4814
4819
|
return;
|
|
4815
4820
|
const key = path[0];
|
|
4816
4821
|
if (path.length === 1) {
|
|
@@ -4842,9 +4847,6 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4842
4847
|
}
|
|
4843
4848
|
deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker) {
|
|
4844
4849
|
var _a;
|
|
4845
|
-
if (path.length === 0) {
|
|
4846
|
-
return;
|
|
4847
|
-
}
|
|
4848
4850
|
const [key, ...subPath] = path;
|
|
4849
4851
|
if (this.hasUnknownDeoptimizedProperty ||
|
|
4850
4852
|
// single paths that are deoptimized will not become getters or setters
|
|
@@ -4871,7 +4873,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4871
4873
|
property.deoptimizeThisOnEventAtPath(event, subPath, thisParameter, recursionTracker);
|
|
4872
4874
|
}
|
|
4873
4875
|
}
|
|
4874
|
-
this.
|
|
4876
|
+
if (!this.immutable) {
|
|
4877
|
+
this.thisParametersToBeDeoptimized.add(thisParameter);
|
|
4878
|
+
}
|
|
4875
4879
|
return;
|
|
4876
4880
|
}
|
|
4877
4881
|
for (const property of relevantUnmatchableProperties) {
|
|
@@ -4895,7 +4899,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4895
4899
|
property.deoptimizeThisOnEventAtPath(event, subPath, thisParameter, recursionTracker);
|
|
4896
4900
|
}
|
|
4897
4901
|
}
|
|
4898
|
-
this.
|
|
4902
|
+
if (!this.immutable) {
|
|
4903
|
+
this.thisParametersToBeDeoptimized.add(thisParameter);
|
|
4904
|
+
}
|
|
4899
4905
|
(_a = this.prototypeExpression) === null || _a === void 0 ? void 0 : _a.deoptimizeThisOnEventAtPath(event, path, thisParameter, recursionTracker);
|
|
4900
4906
|
}
|
|
4901
4907
|
getLiteralValueAtPath(path, recursionTracker, origin) {
|
|
@@ -4958,8 +4964,9 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4958
4964
|
return false;
|
|
4959
4965
|
}
|
|
4960
4966
|
for (const getter of this.unmatchableGetters) {
|
|
4961
|
-
if (getter.hasEffectsWhenAccessedAtPath(subPath, context))
|
|
4967
|
+
if (getter.hasEffectsWhenAccessedAtPath(subPath, context)) {
|
|
4962
4968
|
return true;
|
|
4969
|
+
}
|
|
4963
4970
|
}
|
|
4964
4971
|
}
|
|
4965
4972
|
else {
|
|
@@ -4992,6 +4999,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
4992
4999
|
}
|
|
4993
5000
|
if (this.hasUnknownDeoptimizedProperty)
|
|
4994
5001
|
return true;
|
|
5002
|
+
// We do not need to test for unknown properties as in that case, hasUnknownDeoptimizedProperty is true
|
|
4995
5003
|
if (typeof key === 'string') {
|
|
4996
5004
|
if (this.propertiesAndSettersByKey[key]) {
|
|
4997
5005
|
const setters = this.settersByKey[key];
|
|
@@ -5004,15 +5012,8 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5004
5012
|
return false;
|
|
5005
5013
|
}
|
|
5006
5014
|
for (const property of this.unmatchableSetters) {
|
|
5007
|
-
if (property.hasEffectsWhenAssignedAtPath(subPath, context))
|
|
5015
|
+
if (property.hasEffectsWhenAssignedAtPath(subPath, context)) {
|
|
5008
5016
|
return true;
|
|
5009
|
-
}
|
|
5010
|
-
}
|
|
5011
|
-
else {
|
|
5012
|
-
for (const setters of Object.values(this.settersByKey).concat([this.unmatchableSetters])) {
|
|
5013
|
-
for (const setter of setters) {
|
|
5014
|
-
if (setter.hasEffectsWhenAssignedAtPath(subPath, context))
|
|
5015
|
-
return true;
|
|
5016
5017
|
}
|
|
5017
5018
|
}
|
|
5018
5019
|
}
|
|
@@ -5071,11 +5072,6 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5071
5072
|
}
|
|
5072
5073
|
if (!propertiesAndGettersByKey[key]) {
|
|
5073
5074
|
propertiesAndGettersByKey[key] = [property, ...unmatchablePropertiesAndGetters];
|
|
5074
|
-
if (INTEGER_REG_EXP.test(key)) {
|
|
5075
|
-
for (const integerProperty of unknownIntegerProps) {
|
|
5076
|
-
propertiesAndGettersByKey[key].push(integerProperty);
|
|
5077
|
-
}
|
|
5078
|
-
}
|
|
5079
5075
|
}
|
|
5080
5076
|
}
|
|
5081
5077
|
}
|
|
@@ -5126,7 +5122,7 @@ class ObjectEntity extends ExpressionEntity {
|
|
|
5126
5122
|
return UNKNOWN_EXPRESSION;
|
|
5127
5123
|
}
|
|
5128
5124
|
const expression = this.getMemberExpression(key);
|
|
5129
|
-
if (expression
|
|
5125
|
+
if (!(expression === UNKNOWN_EXPRESSION || this.immutable)) {
|
|
5130
5126
|
const expressionsToBeDeoptimized = (this.expressionsToBeDeoptimizedByKey[key] =
|
|
5131
5127
|
this.expressionsToBeDeoptimizedByKey[key] || []);
|
|
5132
5128
|
expressionsToBeDeoptimized.push(origin);
|
|
@@ -5259,7 +5255,7 @@ const OBJECT_PROTOTYPE = new ObjectEntity({
|
|
|
5259
5255
|
toLocaleString: METHOD_RETURNS_STRING,
|
|
5260
5256
|
toString: METHOD_RETURNS_STRING,
|
|
5261
5257
|
valueOf: METHOD_RETURNS_UNKNOWN
|
|
5262
|
-
}, null);
|
|
5258
|
+
}, null, true);
|
|
5263
5259
|
|
|
5264
5260
|
class ClassNode extends NodeBase {
|
|
5265
5261
|
constructor() {
|
|
@@ -6238,7 +6234,7 @@ const ARRAY_PROTOTYPE = new ObjectEntity({
|
|
|
6238
6234
|
splice: METHOD_MUTATES_SELF_RETURNS_NEW_ARRAY,
|
|
6239
6235
|
unshift: METHOD_MUTATES_SELF_RETURNS_NUMBER,
|
|
6240
6236
|
values: METHOD_DEOPTS_SELF_RETURNS_UNKNOWN
|
|
6241
|
-
}, OBJECT_PROTOTYPE);
|
|
6237
|
+
}, OBJECT_PROTOTYPE, true);
|
|
6242
6238
|
|
|
6243
6239
|
class ArrayExpression extends NodeBase {
|
|
6244
6240
|
constructor() {
|
|
@@ -6273,10 +6269,14 @@ class ArrayExpression extends NodeBase {
|
|
|
6273
6269
|
const properties = [
|
|
6274
6270
|
{ key: 'length', kind: 'init', property: UNKNOWN_LITERAL_NUMBER }
|
|
6275
6271
|
];
|
|
6272
|
+
let hasSpread = false;
|
|
6276
6273
|
for (let index = 0; index < this.elements.length; index++) {
|
|
6277
6274
|
const element = this.elements[index];
|
|
6278
|
-
if (element instanceof SpreadElement) {
|
|
6279
|
-
|
|
6275
|
+
if (element instanceof SpreadElement || hasSpread) {
|
|
6276
|
+
if (element) {
|
|
6277
|
+
hasSpread = true;
|
|
6278
|
+
properties.unshift({ key: UnknownInteger, kind: 'init', property: element });
|
|
6279
|
+
}
|
|
6280
6280
|
}
|
|
6281
6281
|
else if (!element) {
|
|
6282
6282
|
properties.push({ key: String(index), kind: 'init', property: UNDEFINED_EXPRESSION });
|
|
@@ -6329,7 +6329,9 @@ class ArrayPattern extends NodeBase {
|
|
|
6329
6329
|
class BlockScope extends ChildScope {
|
|
6330
6330
|
addDeclaration(identifier, context, init, isHoisted) {
|
|
6331
6331
|
if (isHoisted) {
|
|
6332
|
-
|
|
6332
|
+
this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
6333
|
+
// Necessary to make sure the init is deoptimized. We cannot call deoptimizePath here.
|
|
6334
|
+
return this.parent.addDeclaration(identifier, context, UNDEFINED_EXPRESSION, isHoisted);
|
|
6333
6335
|
}
|
|
6334
6336
|
else {
|
|
6335
6337
|
return super.addDeclaration(identifier, context, init, false);
|
|
@@ -7171,8 +7173,7 @@ class CatchScope extends ParameterScope {
|
|
|
7171
7173
|
existingParameter.addDeclaration(identifier, init);
|
|
7172
7174
|
return existingParameter;
|
|
7173
7175
|
}
|
|
7174
|
-
// as parameters are handled differently, all remaining declarations are
|
|
7175
|
-
// hoisted
|
|
7176
|
+
// as parameters are handled differently, all remaining declarations are hoisted
|
|
7176
7177
|
return this.parent.addDeclaration(identifier, context, init, isHoisted);
|
|
7177
7178
|
}
|
|
7178
7179
|
}
|
|
@@ -10070,7 +10071,10 @@ class Module {
|
|
|
10070
10071
|
if (name !== 'default') {
|
|
10071
10072
|
const foundNamespaceReexport = name in this.namespaceReexportsByName
|
|
10072
10073
|
? this.namespaceReexportsByName[name]
|
|
10073
|
-
:
|
|
10074
|
+
: this.getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports);
|
|
10075
|
+
if (!skipExternalNamespaceReexports) {
|
|
10076
|
+
this.namespaceReexportsByName[name] = foundNamespaceReexport;
|
|
10077
|
+
}
|
|
10074
10078
|
if (foundNamespaceReexport) {
|
|
10075
10079
|
return foundNamespaceReexport;
|
|
10076
10080
|
}
|
|
@@ -10462,8 +10466,18 @@ class Module {
|
|
|
10462
10466
|
}
|
|
10463
10467
|
getVariableFromNamespaceReexports(name, importerForSideEffects, searchedNamesAndModules, skipExternalNamespaceReexports = false) {
|
|
10464
10468
|
let foundSyntheticDeclaration = null;
|
|
10465
|
-
const skipExternalNamespaceValues =
|
|
10466
|
-
|
|
10469
|
+
const skipExternalNamespaceValues = [{ searchedNamesAndModules, skipExternalNamespaces: true }];
|
|
10470
|
+
if (!skipExternalNamespaceReexports) {
|
|
10471
|
+
const clonedSearchedNamesAndModules = new Map();
|
|
10472
|
+
for (const [name, modules] of searchedNamesAndModules || []) {
|
|
10473
|
+
clonedSearchedNamesAndModules.set(name, new Set(modules));
|
|
10474
|
+
}
|
|
10475
|
+
skipExternalNamespaceValues.push({
|
|
10476
|
+
searchedNamesAndModules: clonedSearchedNamesAndModules,
|
|
10477
|
+
skipExternalNamespaces: false
|
|
10478
|
+
});
|
|
10479
|
+
}
|
|
10480
|
+
for (const { skipExternalNamespaces, searchedNamesAndModules } of skipExternalNamespaceValues) {
|
|
10467
10481
|
const foundDeclarations = new Set();
|
|
10468
10482
|
for (const module of this.exportAllModules) {
|
|
10469
10483
|
if (module instanceof Module || !skipExternalNamespaces) {
|
package/dist/shared/watch-cli.js
CHANGED
package/dist/shared/watch.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rollup",
|
|
3
|
-
"version": "2.52.
|
|
3
|
+
"version": "2.52.4",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"rollup": "dist/bin/rollup"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "shx rm -rf dist && git rev-parse HEAD > .commithash && rollup
|
|
13
|
-
"build:cjs": "shx rm -rf dist && rollup
|
|
14
|
-
"build:bootstrap": "dist/bin/rollup
|
|
12
|
+
"build": "shx rm -rf dist && git rev-parse HEAD > .commithash && rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup",
|
|
13
|
+
"build:cjs": "shx rm -rf dist && rollup --config rollup.config.ts --configPlugin typescript --configTest && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup",
|
|
14
|
+
"build:bootstrap": "node dist/bin/rollup --config rollup.config.ts --configPlugin typescript && shx cp src/rollup/types.d.ts dist/rollup.d.ts && shx chmod a+x dist/bin/rollup",
|
|
15
15
|
"ci:lint": "npm run lint:nofix",
|
|
16
16
|
"ci:test": "npm run build:cjs && npm run build:bootstrap && npm run test:all",
|
|
17
17
|
"ci:test:only": "npm run build:cjs && npm run build:bootstrap && npm run test:only",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"test:only": "mocha test/test.js",
|
|
39
39
|
"test:typescript": "shx rm -rf test/typescript/dist && shx cp -r dist test/typescript/ && tsc --noEmit -p test/typescript && tsc --noEmit",
|
|
40
40
|
"test:browser": "mocha test/browser/index.js",
|
|
41
|
-
"watch": "rollup
|
|
41
|
+
"watch": "rollup --config rollup.config.ts --configPlugin typescript --watch"
|
|
42
42
|
},
|
|
43
43
|
"repository": "rollup/rollup",
|
|
44
44
|
"keywords": [
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"@rollup/plugin-json": "^4.1.0",
|
|
65
65
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
66
66
|
"@rollup/plugin-replace": "^2.4.2",
|
|
67
|
-
"@rollup/plugin-typescript": "^8.2.1",
|
|
68
67
|
"@types/micromatch": "^4.0.1",
|
|
69
68
|
"@types/node": "^10.17.60",
|
|
70
69
|
"@types/require-relative": "^0.8.0",
|
|
@@ -104,7 +103,7 @@
|
|
|
104
103
|
"pretty-ms": "^7.0.1",
|
|
105
104
|
"require-relative": "^0.8.7",
|
|
106
105
|
"requirejs": "^2.3.6",
|
|
107
|
-
"rollup": "^2.
|
|
106
|
+
"rollup": "^2.52.0",
|
|
108
107
|
"rollup-plugin-license": "^2.5.0",
|
|
109
108
|
"rollup-plugin-string": "^3.0.0",
|
|
110
109
|
"rollup-plugin-terser": "^7.0.2",
|