rollup 2.50.5 → 2.51.2
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 +42 -0
- package/dist/bin/rollup +2 -2
- package/dist/es/rollup.browser.js +3 -3
- package/dist/es/rollup.js +3 -3
- package/dist/es/shared/rollup.js +58 -18
- 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 +3 -0
- package/dist/rollup.js +3 -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 +58 -17
- package/dist/shared/watch-cli.js +2 -2
- package/dist/shared/watch.js +2 -2
- package/package.json +2 -2
package/dist/rollup.d.ts
CHANGED
package/dist/rollup.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
@license
|
|
3
|
-
Rollup.js v2.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.51.2
|
|
4
|
+
Fri, 11 Jun 2021 05:35:15 GMT - commit bfae7910ea7553d56782cb5ee0c8581e2b451729
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
https://github.com/rollup/rollup
|
|
@@ -21,6 +21,7 @@ require('events');
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
exports.VERSION = rollup.version;
|
|
24
|
+
exports.defineConfig = rollup.defineConfig;
|
|
24
25
|
exports.rollup = rollup.rollup;
|
|
25
26
|
exports.watch = rollup.watch;
|
|
26
27
|
//# sourceMappingURL=rollup.js.map
|
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.
|
|
4
|
-
|
|
3
|
+
Rollup.js v2.51.2
|
|
4
|
+
Fri, 11 Jun 2021 05:35:15 GMT - commit bfae7910ea7553d56782cb5ee0c8581e2b451729
|
|
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.
|
|
35
|
+
var version$1 = "2.51.2";
|
|
36
36
|
|
|
37
37
|
function ensureArray(items) {
|
|
38
38
|
if (Array.isArray(items)) {
|
|
@@ -5056,8 +5056,14 @@ class SpreadElement extends NodeBase {
|
|
|
5056
5056
|
}
|
|
5057
5057
|
}
|
|
5058
5058
|
hasEffects(context) {
|
|
5059
|
+
if (!this.deoptimized)
|
|
5060
|
+
this.applyDeoptimizations();
|
|
5061
|
+
const { propertyReadSideEffects } = this.context.options
|
|
5062
|
+
.treeshake;
|
|
5059
5063
|
return (this.argument.hasEffects(context) ||
|
|
5060
|
-
|
|
5064
|
+
(propertyReadSideEffects &&
|
|
5065
|
+
(propertyReadSideEffects === 'always' ||
|
|
5066
|
+
this.argument.hasEffectsWhenAccessedAtPath(UNKNOWN_PATH, context))));
|
|
5061
5067
|
}
|
|
5062
5068
|
applyDeoptimizations() {
|
|
5063
5069
|
this.deoptimized = true;
|
|
@@ -5271,11 +5277,16 @@ class FunctionNode extends NodeBase {
|
|
|
5271
5277
|
hasEffectsWhenCalledAtPath(path, callOptions, context) {
|
|
5272
5278
|
if (path.length > 0)
|
|
5273
5279
|
return true;
|
|
5274
|
-
if (this.async
|
|
5275
|
-
this.
|
|
5276
|
-
.
|
|
5277
|
-
|
|
5278
|
-
|
|
5280
|
+
if (this.async) {
|
|
5281
|
+
const { propertyReadSideEffects } = this.context.options
|
|
5282
|
+
.treeshake;
|
|
5283
|
+
const returnExpression = this.scope.getReturnExpression();
|
|
5284
|
+
if (returnExpression.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
|
|
5285
|
+
(propertyReadSideEffects &&
|
|
5286
|
+
(propertyReadSideEffects === 'always' ||
|
|
5287
|
+
returnExpression.hasEffectsWhenAccessedAtPath(['then'], context)))) {
|
|
5288
|
+
return true;
|
|
5289
|
+
}
|
|
5279
5290
|
}
|
|
5280
5291
|
for (const param of this.params) {
|
|
5281
5292
|
if (param.hasEffects(context))
|
|
@@ -6016,7 +6027,7 @@ class ArrowFunctionExpression extends NodeBase {
|
|
|
6016
6027
|
// Arrow functions do not mutate their context
|
|
6017
6028
|
deoptimizeThisOnEventAtPath() { }
|
|
6018
6029
|
getReturnExpressionWhenCalledAtPath(path) {
|
|
6019
|
-
return path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
|
|
6030
|
+
return !this.async && path.length === 0 ? this.scope.getReturnExpression() : UNKNOWN_EXPRESSION;
|
|
6020
6031
|
}
|
|
6021
6032
|
hasEffects() {
|
|
6022
6033
|
return false;
|
|
@@ -6030,6 +6041,17 @@ class ArrowFunctionExpression extends NodeBase {
|
|
|
6030
6041
|
hasEffectsWhenCalledAtPath(path, _callOptions, context) {
|
|
6031
6042
|
if (path.length > 0)
|
|
6032
6043
|
return true;
|
|
6044
|
+
if (this.async) {
|
|
6045
|
+
const { propertyReadSideEffects } = this.context.options
|
|
6046
|
+
.treeshake;
|
|
6047
|
+
const returnExpression = this.scope.getReturnExpression();
|
|
6048
|
+
if (returnExpression.hasEffectsWhenCalledAtPath(['then'], { args: NO_ARGS, thisParam: null, withNew: false }, context) ||
|
|
6049
|
+
(propertyReadSideEffects &&
|
|
6050
|
+
(propertyReadSideEffects === 'always' ||
|
|
6051
|
+
returnExpression.hasEffectsWhenAccessedAtPath(['then'], context)))) {
|
|
6052
|
+
return true;
|
|
6053
|
+
}
|
|
6054
|
+
}
|
|
6033
6055
|
for (const param of this.params) {
|
|
6034
6056
|
if (param.hasEffects(context))
|
|
6035
6057
|
return true;
|
|
@@ -9764,6 +9786,7 @@ class Module {
|
|
|
9764
9786
|
this.implicitlyLoadedBefore = new Set();
|
|
9765
9787
|
this.importDescriptions = Object.create(null);
|
|
9766
9788
|
this.importMetas = [];
|
|
9789
|
+
this.importedFromNotTreeshaken = false;
|
|
9767
9790
|
this.importers = [];
|
|
9768
9791
|
this.imports = new Set();
|
|
9769
9792
|
this.includedDynamicImporters = [];
|
|
@@ -9895,12 +9918,12 @@ class Module {
|
|
|
9895
9918
|
}
|
|
9896
9919
|
if (!this.options.treeshake || this.info.hasModuleSideEffects === 'no-treeshake') {
|
|
9897
9920
|
for (const dependency of this.dependencies) {
|
|
9898
|
-
|
|
9899
|
-
relevantDependencies.add(dependency);
|
|
9900
|
-
}
|
|
9921
|
+
relevantDependencies.add(dependency);
|
|
9901
9922
|
}
|
|
9902
9923
|
}
|
|
9903
|
-
|
|
9924
|
+
else {
|
|
9925
|
+
this.addRelevantSideEffectDependencies(relevantDependencies, necessaryDependencies, alwaysCheckedDependencies);
|
|
9926
|
+
}
|
|
9904
9927
|
for (const dependency of necessaryDependencies) {
|
|
9905
9928
|
relevantDependencies.add(dependency);
|
|
9906
9929
|
}
|
|
@@ -10088,7 +10111,7 @@ class Module {
|
|
|
10088
10111
|
this.ast.include(createInclusionContext(), true);
|
|
10089
10112
|
}
|
|
10090
10113
|
isIncluded() {
|
|
10091
|
-
return this.ast.included || this.namespace.included;
|
|
10114
|
+
return this.ast.included || this.namespace.included || this.importedFromNotTreeshaken;
|
|
10092
10115
|
}
|
|
10093
10116
|
linkImports() {
|
|
10094
10117
|
this.addModulesToImportDescriptions(this.importDescriptions);
|
|
@@ -11322,6 +11345,7 @@ class Link {
|
|
|
11322
11345
|
const sources = [];
|
|
11323
11346
|
const sourcesContent = [];
|
|
11324
11347
|
const names = [];
|
|
11348
|
+
const nameIndexMap = new Map();
|
|
11325
11349
|
const mappings = [];
|
|
11326
11350
|
for (const line of this.mappings) {
|
|
11327
11351
|
const tracedLine = [];
|
|
@@ -11356,10 +11380,11 @@ class Link {
|
|
|
11356
11380
|
traced.column
|
|
11357
11381
|
];
|
|
11358
11382
|
if (traced.name) {
|
|
11359
|
-
let nameIndex =
|
|
11360
|
-
if (nameIndex ===
|
|
11383
|
+
let nameIndex = nameIndexMap.get(traced.name);
|
|
11384
|
+
if (nameIndex === undefined) {
|
|
11361
11385
|
nameIndex = names.length;
|
|
11362
11386
|
names.push(traced.name);
|
|
11387
|
+
nameIndexMap.set(traced.name, nameIndex);
|
|
11363
11388
|
}
|
|
11364
11389
|
tracedSegment[4] = nameIndex;
|
|
11365
11390
|
}
|
|
@@ -19527,6 +19552,13 @@ class ModuleLoader {
|
|
|
19527
19552
|
module.dependencies.add(dependency);
|
|
19528
19553
|
dependency.importers.push(module.id);
|
|
19529
19554
|
}
|
|
19555
|
+
if (!this.options.treeshake || module.info.hasModuleSideEffects === 'no-treeshake') {
|
|
19556
|
+
for (const dependency of module.dependencies) {
|
|
19557
|
+
if (dependency instanceof Module) {
|
|
19558
|
+
dependency.importedFromNotTreeshaken = true;
|
|
19559
|
+
}
|
|
19560
|
+
}
|
|
19561
|
+
}
|
|
19530
19562
|
}
|
|
19531
19563
|
getNormalizedResolvedIdWithoutDefaults(resolveIdResult, importer, source) {
|
|
19532
19564
|
const { makeAbsoluteExternalsRelative } = this.options;
|
|
@@ -20802,6 +20834,14 @@ function writeOutputFile(outputFile, outputOptions) {
|
|
|
20802
20834
|
}
|
|
20803
20835
|
return Promise.all([writeFile(fileName, source), writeSourceMapPromise]);
|
|
20804
20836
|
}
|
|
20837
|
+
/**
|
|
20838
|
+
* Auxiliary function for defining rollup configuration
|
|
20839
|
+
* Mainly to facilitate IDE code prompts, after all, export default does not prompt, even if you add @type annotations, it is not accurate
|
|
20840
|
+
* @param options
|
|
20841
|
+
*/
|
|
20842
|
+
function defineConfig(options) {
|
|
20843
|
+
return options;
|
|
20844
|
+
}
|
|
20805
20845
|
|
|
20806
20846
|
class WatchEmitter extends require$$0.EventEmitter {
|
|
20807
20847
|
constructor() {
|
|
@@ -20826,6 +20866,7 @@ function watch(configs) {
|
|
|
20826
20866
|
}
|
|
20827
20867
|
|
|
20828
20868
|
exports.defaultOnWarn = defaultOnWarn;
|
|
20869
|
+
exports.defineConfig = defineConfig;
|
|
20829
20870
|
exports.ensureArray = ensureArray;
|
|
20830
20871
|
exports.error = error;
|
|
20831
20872
|
exports.fseventsImporter = fseventsImporter;
|
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.
|
|
3
|
+
"version": "2.51.2",
|
|
4
4
|
"description": "Next-generation ES module bundler",
|
|
5
5
|
"main": "dist/rollup.js",
|
|
6
6
|
"module": "dist/es/rollup.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
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",
|
|
18
|
-
"ci:coverage": "npm run build:cjs && nyc --reporter lcovonly mocha",
|
|
18
|
+
"ci:coverage": "npm run build:cjs && npm run build:bootstrap && nyc --reporter lcovonly mocha",
|
|
19
19
|
"lint": "npx eslint . --fix --cache && npm run lint:markdown",
|
|
20
20
|
"lint:nofix": "npx eslint . && npm run lint:markdown",
|
|
21
21
|
"lint:markdown": "markdownlint --config markdownlint.json docs/**/*.md",
|